software.amazon.awscdk.services.gamelift.alpha.ScriptProps Maven / Gradle / Ivy
Show all versions of gamelift-alpha Show documentation
package software.amazon.awscdk.services.gamelift.alpha;
/**
* (experimental) Properties for a new realtime server script.
*
* Example:
*
*
* Bucket bucket;
* Script.Builder.create(this, "Script")
* .content(Content.fromBucket(bucket, "sample-asset-key"))
* .build();
*
*/
@javax.annotation.Generated(value = "jsii-pacmak/1.104.0 (build e79254c)", date = "2024-12-27T17:02:12.144Z")
@software.amazon.jsii.Jsii(module = software.amazon.awscdk.services.gamelift.alpha.$Module.class, fqn = "@aws-cdk/aws-gamelift-alpha.ScriptProps")
@software.amazon.jsii.Jsii.Proxy(ScriptProps.Jsii$Proxy.class)
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public interface ScriptProps extends software.amazon.jsii.JsiiSerializable {
/**
* (experimental) The game content.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@org.jetbrains.annotations.NotNull software.amazon.awscdk.services.gamelift.alpha.Content getContent();
/**
* (experimental) The IAM role assumed by GameLift to access server script in S3.
*
* If providing a custom role, it needs to trust the GameLift service principal (gamelift.amazonaws.com) and be granted sufficient permissions
* to have Read access to a specific key content into a specific S3 bucket.
* Below an example of required permission:
* {
* "Version": "2012-10-17",
* "Statement": [{
* "Effect": "Allow",
* "Action": [
* "s3:GetObject",
* "s3:GetObjectVersion"
* ],
* "Resource": "arn:aws:s3:::bucket-name/object-name"
* }]
* }
*
* Default: - a role will be created with default permissions.
*
* @see https://docs.aws.amazon.com/gamelift/latest/developerguide/security_iam_id-based-policy-examples.html#security_iam_id-based-policy-examples-access-storage-loc
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
default @org.jetbrains.annotations.Nullable software.amazon.awscdk.services.iam.IRole getRole() {
return null;
}
/**
* (experimental) Name of this realtime server script.
*
* Default: No name
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
default @org.jetbrains.annotations.Nullable java.lang.String getScriptName() {
return null;
}
/**
* (experimental) Version of this realtime server script.
*
* Default: No version
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
default @org.jetbrains.annotations.Nullable java.lang.String getScriptVersion() {
return null;
}
/**
* @return a {@link Builder} of {@link ScriptProps}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
static Builder builder() {
return new Builder();
}
/**
* A builder for {@link ScriptProps}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public static final class Builder implements software.amazon.jsii.Builder {
software.amazon.awscdk.services.gamelift.alpha.Content content;
software.amazon.awscdk.services.iam.IRole role;
java.lang.String scriptName;
java.lang.String scriptVersion;
/**
* Sets the value of {@link ScriptProps#getContent}
* @param content The game content. This parameter is required.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder content(software.amazon.awscdk.services.gamelift.alpha.Content content) {
this.content = content;
return this;
}
/**
* Sets the value of {@link ScriptProps#getRole}
* @param role The IAM role assumed by GameLift to access server script in S3.
* If providing a custom role, it needs to trust the GameLift service principal (gamelift.amazonaws.com) and be granted sufficient permissions
* to have Read access to a specific key content into a specific S3 bucket.
* Below an example of required permission:
* {
* "Version": "2012-10-17",
* "Statement": [{
* "Effect": "Allow",
* "Action": [
* "s3:GetObject",
* "s3:GetObjectVersion"
* ],
* "Resource": "arn:aws:s3:::bucket-name/object-name"
* }]
* }
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder role(software.amazon.awscdk.services.iam.IRole role) {
this.role = role;
return this;
}
/**
* Sets the value of {@link ScriptProps#getScriptName}
* @param scriptName Name of this realtime server script.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder scriptName(java.lang.String scriptName) {
this.scriptName = scriptName;
return this;
}
/**
* Sets the value of {@link ScriptProps#getScriptVersion}
* @param scriptVersion Version of this realtime server script.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder scriptVersion(java.lang.String scriptVersion) {
this.scriptVersion = scriptVersion;
return this;
}
/**
* Builds the configured instance.
* @return a new instance of {@link ScriptProps}
* @throws NullPointerException if any required attribute was not provided
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@Override
public ScriptProps build() {
return new Jsii$Proxy(this);
}
}
/**
* An implementation for {@link ScriptProps}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@software.amazon.jsii.Internal
final class Jsii$Proxy extends software.amazon.jsii.JsiiObject implements ScriptProps {
private final software.amazon.awscdk.services.gamelift.alpha.Content content;
private final software.amazon.awscdk.services.iam.IRole role;
private final java.lang.String scriptName;
private final java.lang.String scriptVersion;
/**
* Constructor that initializes the object based on values retrieved from the JsiiObject.
* @param objRef Reference to the JSII managed object.
*/
protected Jsii$Proxy(final software.amazon.jsii.JsiiObjectRef objRef) {
super(objRef);
this.content = software.amazon.jsii.Kernel.get(this, "content", software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.services.gamelift.alpha.Content.class));
this.role = software.amazon.jsii.Kernel.get(this, "role", software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.services.iam.IRole.class));
this.scriptName = software.amazon.jsii.Kernel.get(this, "scriptName", software.amazon.jsii.NativeType.forClass(java.lang.String.class));
this.scriptVersion = software.amazon.jsii.Kernel.get(this, "scriptVersion", software.amazon.jsii.NativeType.forClass(java.lang.String.class));
}
/**
* Constructor that initializes the object based on literal property values passed by the {@link Builder}.
*/
protected Jsii$Proxy(final Builder builder) {
super(software.amazon.jsii.JsiiObject.InitializationMode.JSII);
this.content = java.util.Objects.requireNonNull(builder.content, "content is required");
this.role = builder.role;
this.scriptName = builder.scriptName;
this.scriptVersion = builder.scriptVersion;
}
@Override
public final software.amazon.awscdk.services.gamelift.alpha.Content getContent() {
return this.content;
}
@Override
public final software.amazon.awscdk.services.iam.IRole getRole() {
return this.role;
}
@Override
public final java.lang.String getScriptName() {
return this.scriptName;
}
@Override
public final java.lang.String getScriptVersion() {
return this.scriptVersion;
}
@Override
@software.amazon.jsii.Internal
public com.fasterxml.jackson.databind.JsonNode $jsii$toJson() {
final com.fasterxml.jackson.databind.ObjectMapper om = software.amazon.jsii.JsiiObjectMapper.INSTANCE;
final com.fasterxml.jackson.databind.node.ObjectNode data = com.fasterxml.jackson.databind.node.JsonNodeFactory.instance.objectNode();
data.set("content", om.valueToTree(this.getContent()));
if (this.getRole() != null) {
data.set("role", om.valueToTree(this.getRole()));
}
if (this.getScriptName() != null) {
data.set("scriptName", om.valueToTree(this.getScriptName()));
}
if (this.getScriptVersion() != null) {
data.set("scriptVersion", om.valueToTree(this.getScriptVersion()));
}
final com.fasterxml.jackson.databind.node.ObjectNode struct = com.fasterxml.jackson.databind.node.JsonNodeFactory.instance.objectNode();
struct.set("fqn", om.valueToTree("@aws-cdk/aws-gamelift-alpha.ScriptProps"));
struct.set("data", data);
final com.fasterxml.jackson.databind.node.ObjectNode obj = com.fasterxml.jackson.databind.node.JsonNodeFactory.instance.objectNode();
obj.set("$jsii.struct", struct);
return obj;
}
@Override
public final boolean equals(final Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
ScriptProps.Jsii$Proxy that = (ScriptProps.Jsii$Proxy) o;
if (!content.equals(that.content)) return false;
if (this.role != null ? !this.role.equals(that.role) : that.role != null) return false;
if (this.scriptName != null ? !this.scriptName.equals(that.scriptName) : that.scriptName != null) return false;
return this.scriptVersion != null ? this.scriptVersion.equals(that.scriptVersion) : that.scriptVersion == null;
}
@Override
public final int hashCode() {
int result = this.content.hashCode();
result = 31 * result + (this.role != null ? this.role.hashCode() : 0);
result = 31 * result + (this.scriptName != null ? this.scriptName.hashCode() : 0);
result = 31 * result + (this.scriptVersion != null ? this.scriptVersion.hashCode() : 0);
return result;
}
}
}