class Script (construct)
Language | Type name |
---|---|
.NET | Amazon.CDK.AWS.GameLift.Alpha.Script |
Go | github.com/aws/aws-cdk-go/awscdkgameliftalpha/v2#Script |
Java | software.amazon.awscdk.services.gamelift.alpha.Script |
Python | aws_cdk.aws_gamelift_alpha.Script |
TypeScript (source) | @aws-cdk/aws-gamelift-alpha ยป Script |
Implements
IConstruct
, IDependable
, IResource
, IScript
, IGrantable
A GameLift script, that is installed and runs on instances in an Amazon GameLift fleet.
It consists of a zip file with all of the components of the realtime game server script.
Example
declare const bucket: s3.Bucket;
new gamelift.Script(this, 'Script', {
content: gamelift.Content.fromBucket(bucket, "sample-asset-key")
});
Initializer
new Script(scope: Construct, id: string, props: ScriptProps)
Parameters
- scope
Construct
- id
string
- props
Script
Props
Construct Props
Name | Type | Description |
---|---|---|
content | Content | The game content. |
role? | IRole | The IAM role assumed by GameLift to access server script in S3. |
script | string | Name of this realtime server script. |
script | string | Version of this realtime server script. |
content
Type:
Content
The game content.
role?
Type:
IRole
(optional, default: a role will be created with default permissions.)
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" }] }
scriptName?
Type:
string
(optional, default: No name)
Name of this realtime server script.
scriptVersion?
Type:
string
(optional, default: No version)
Version of this realtime server script.
Properties
Name | Type | Description |
---|---|---|
env | Resource | The environment this resource belongs to. |
grant | IPrincipal | The principal this GameLift script is using. |
node | Node | The tree node. |
role | IRole | The IAM role GameLift assumes to acccess server script content. |
script | string | The ARN of the realtime server script. |
script | string | The Identifier of the realtime server script. |
stack | Stack | The stack in which this resource is defined. |
env
Type:
Resource
The environment this resource belongs to.
For resources that are created and managed by the CDK (generally, those created by creating new class instances like Role, Bucket, etc.), this is always the same as the environment of the stack they belong to; however, for imported resources (those obtained from static methods like fromRoleArn, fromBucketName, etc.), that might be different than the stack they were imported into.
grantPrincipal
Type:
IPrincipal
The principal this GameLift script is using.
node
Type:
Node
The tree node.
role
Type:
IRole
The IAM role GameLift assumes to acccess server script content.
scriptArn
Type:
string
The ARN of the realtime server script.
scriptId
Type:
string
The Identifier of the realtime server script.
stack
Type:
Stack
The stack in which this resource is defined.
Methods
Name | Description |
---|---|
apply | Apply the given removal policy to this resource. |
to | Returns a string representation of this construct. |
static from | Create a new realtime server script from asset content. |
static from | Create a new realtime server script from s3 content. |
static from | Import a script into CDK using its ARN. |
static from | Import an existing realtime server script from its attributes. |
applyRemovalPolicy(policy)
public applyRemovalPolicy(policy: RemovalPolicy): void
Parameters
- policy
Removal
Policy
Apply the given removal policy to this resource.
The Removal Policy controls what happens to this resource when it stops being managed by CloudFormation, either because you've removed it from the CDK application or because you've made a change that requires the resource to be replaced.
The resource can be deleted (RemovalPolicy.DESTROY
), or left in your AWS
account for data recovery and cleanup later (RemovalPolicy.RETAIN
).
toString()
public toString(): string
Returns
string
Returns a string representation of this construct.
static fromAsset(scope, id, path, options?)
public static fromAsset(scope: Construct, id: string, path: string, options?: AssetOptions): Script
Parameters
- scope
Construct
- id
string
- path
string
- options
Asset
Options
Returns
Create a new realtime server script from asset content.
static fromBucket(scope, id, bucket, key, objectVersion?)
public static fromBucket(scope: Construct, id: string, bucket: IBucket, key: string, objectVersion?: string): Script
Parameters
Returns
Create a new realtime server script from s3 content.
static fromScriptArn(scope, id, scriptArn)
public static fromScriptArn(scope: Construct, id: string, scriptArn: string): IScript
Parameters
- scope
Construct
- id
string
- scriptArn
string
Returns
Import a script into CDK using its ARN.
static fromScriptAttributes(scope, id, attrs)
public static fromScriptAttributes(scope: Construct, id: string, attrs: ScriptAttributes): IScript
Parameters
- scope
Construct
- id
string
- attrs
Script
Attributes
Returns
Import an existing realtime server script from its attributes.