diff --git a/packages/@aws-cdk/aws-gamelift/README.md b/packages/@aws-cdk/aws-gamelift/README.md index 986a84f5aa577..1c52b8d24f06f 100644 --- a/packages/@aws-cdk/aws-gamelift/README.md +++ b/packages/@aws-cdk/aws-gamelift/README.md @@ -80,9 +80,12 @@ services. ```ts declare const bucket: s3.Bucket; -new gamelift.Build(this, 'Build', { +const build = new gamelift.Build(this, 'Build', { content: gamelift.Content.fromBucket(bucket, "sample-asset-key") }); + +new CfnOutput(this, 'BuildArn', { value: build.buildArn }); +new CfnOutput(this, 'BuildId', { value: build.buildId }); ``` #### Upload a realtime server Script diff --git a/packages/@aws-cdk/aws-gamelift/lib/build.ts b/packages/@aws-cdk/aws-gamelift/lib/build.ts index 346ca94618d6d..83fe9ba252a6b 100644 --- a/packages/@aws-cdk/aws-gamelift/lib/build.ts +++ b/packages/@aws-cdk/aws-gamelift/lib/build.ts @@ -23,6 +23,13 @@ export interface IBuild extends cdk.IResource, iam.IGrantable { * @attribute */ readonly buildId: string; + + /** + * The ARN of the build + * + * @attribute + */ + readonly buildArn: string; } /** @@ -33,6 +40,10 @@ export abstract class BuildBase extends cdk.Resource implements IBuild { * The Identifier of the build. */ public abstract readonly buildId: string; + /** + * The ARN of the build. + */ + public abstract readonly buildArn: string; public abstract readonly grantPrincipal: iam.IPrincipal; } @@ -52,12 +63,25 @@ export enum OperatingSystem { */ export interface BuildAttributes { /** - * The identifier of the build + * The ARN of the build + * + * At least one of `buildArn` and `buildId` must be provided. + * + * @default derived from `buildId`. */ - readonly buildId: string; + readonly buildArn?: string; + + /** + * The identifier of the build + * + * At least one of `buildId` and `buildArn` must be provided. + * + * @default derived from `buildArn`. + */ + readonly buildId?: string; /** * The IAM role assumed by GameLift to access server build in S3. - * @default - undefined + * @default the imported fleet cannot be granted access to other resources as an `iam.IGrantable`. */ readonly role?: iam.IRole; } @@ -151,15 +175,45 @@ export class Build extends BuildBase { return this.fromBuildAttributes(scope, id, { buildId }); } + /** + * Import a build into CDK using its ARN + */ + static fromBuildArn(scope: Construct, id: string, buildArn: string): IBuild { + return this.fromBuildAttributes(scope, id, { buildArn }); + } + /** * Import an existing build from its attributes. */ static fromBuildAttributes(scope: Construct, id: string, attrs: BuildAttributes): IBuild { + if (!attrs.buildId && !attrs.buildArn) { + throw new Error('Either buildId or buildArn must be provided in BuildAttributes'); + } + const buildId = attrs.buildId ?? + cdk.Stack.of(scope).splitArn(attrs.buildArn!, cdk.ArnFormat.SLASH_RESOURCE_NAME).resourceName; + + if (!buildId) { + throw new Error(`No build identifier found in ARN: '${attrs.buildArn}'`); + } + + const buildArn = attrs.buildArn ?? cdk.Stack.of(scope).formatArn({ + service: 'gamelift', + resource: 'build', + resourceName: attrs.buildId, + arnFormat: cdk.ArnFormat.SLASH_RESOURCE_NAME, + }); class Import extends BuildBase { - public readonly buildId = attrs.buildId; + public readonly buildId = buildId!; + public readonly buildArn = buildArn; public readonly grantPrincipal = attrs.role ?? new iam.UnknownPrincipal({ resource: this }); - } + public readonly role = attrs.role; + constructor(s: Construct, i: string) { + super(s, i, { + environmentFromArn: buildArn, + }); + } + } return new Import(scope, id); } @@ -168,6 +222,11 @@ export class Build extends BuildBase { */ public readonly buildId: string; + /** + * The ARN of the build. + */ + public readonly buildArn: string; + /** * The IAM role GameLift assumes to acccess server build content. */ @@ -209,7 +268,13 @@ export class Build extends BuildBase { resource.node.addDependency(this.role); - this.buildId = resource.ref; + this.buildId = this.getResourceNameAttribute(resource.ref); + this.buildArn = cdk.Stack.of(scope).formatArn({ + service: 'gamelift', + resource: 'build', + resourceName: this.buildId, + arnFormat: cdk.ArnFormat.SLASH_RESOURCE_NAME, + }); } diff --git a/packages/@aws-cdk/aws-gamelift/rosetta/default.ts-fixture b/packages/@aws-cdk/aws-gamelift/rosetta/default.ts-fixture index a343bb1afbee4..acf0995fb04a8 100644 --- a/packages/@aws-cdk/aws-gamelift/rosetta/default.ts-fixture +++ b/packages/@aws-cdk/aws-gamelift/rosetta/default.ts-fixture @@ -1,6 +1,6 @@ // Fixture with packages imported, but nothing else import { Construct } from 'constructs'; -import { Duration, Size, Stack } from '@aws-cdk/core'; +import { Duration, Size, Stack, CfnOutput } from '@aws-cdk/core'; import * as gamelift from '@aws-cdk/aws-gamelift'; import * as s3 from '@aws-cdk/aws-s3'; import * as ec2 from '@aws-cdk/aws-ec2'; diff --git a/packages/@aws-cdk/aws-gamelift/test/build.test.ts b/packages/@aws-cdk/aws-gamelift/test/build.test.ts index 5ea79a17694c3..3117955d1973e 100644 --- a/packages/@aws-cdk/aws-gamelift/test/build.test.ts +++ b/packages/@aws-cdk/aws-gamelift/test/build.test.ts @@ -7,44 +7,12 @@ import * as cxapi from '@aws-cdk/cx-api'; import * as gamelift from '../lib'; describe('build', () => { - const buildId = 'test-identifier'; - const buildName = 'test-build'; - let stack: cdk.Stack; - - beforeEach(() => { - const app = new cdk.App({ context: { [cxapi.NEW_STYLE_STACK_SYNTHESIS_CONTEXT]: false } }); - stack = new cdk.Stack(app); - }); - - describe('.fromBuildId()', () => { - test('with required fields', () => { - const build = gamelift.Build.fromBuildId(stack, 'ImportedBuild', buildId); - - expect(build.buildId).toEqual(buildId); - expect(build.grantPrincipal).toEqual(new iam.UnknownPrincipal({ resource: build })); - }); - }); - - describe('.fromBuildAttributes()', () => { - test('with required attrs only', () => { - const build = gamelift.Build.fromBuildAttributes(stack, 'ImportedBuild', { buildId }); - - expect(build.buildId).toEqual(buildId); - expect(build.grantPrincipal).toEqual(new iam.UnknownPrincipal({ resource: build })); - }); - - test('with all attrs', () => { - const role = iam.Role.fromRoleArn(stack, 'Role', 'arn:aws:iam::123456789012:role/TestRole'); - const build = gamelift.Build.fromBuildAttributes(stack, 'ImportedBuild', { buildId, role }); - - expect(buildId).toEqual(buildId); - expect(build.grantPrincipal).toEqual(role); - }); - }); describe('new', () => { const localAsset = path.join(__dirname, 'my-game-build'); const contentBucketName = 'bucketname'; + const buildName = 'test-build'; + let stack: cdk.Stack; const contentBucketAccessStatement = { Action: [ 's3:GetObject', @@ -70,6 +38,8 @@ describe('build', () => { let defaultProps: gamelift.BuildProps; beforeEach(() => { + const app = new cdk.App({ context: { [cxapi.NEW_STYLE_STACK_SYNTHESIS_CONTEXT]: false } }); + stack = new cdk.Stack(app); contentBucket = s3.Bucket.fromBucketName(stack, 'ContentBucket', contentBucketName); content = gamelift.Content.fromBucket(contentBucket, 'content'); defaultProps = { @@ -215,6 +185,92 @@ describe('build', () => { }); }); }); + + describe('test import methods', () => { + test('Build.fromBuildArn', () => { + // GIVEN + const stack2 = new cdk.Stack(); + + // WHEN + const imported = gamelift.Build.fromBuildArn(stack2, 'Imported', 'arn:aws:gamelift:us-east-1:123456789012:build/sample-build-id'); + + // THEN + expect(imported.buildArn).toEqual('arn:aws:gamelift:us-east-1:123456789012:build/sample-build-id'); + expect(imported.buildId).toEqual('sample-build-id'); + }); + + test('Build.fromBuildId', () => { + // GIVEN + const stack = new cdk.Stack(); + + // WHEN + const imported = gamelift.Build.fromBuildId(stack, 'Imported', 'sample-build-id'); + + // THEN + expect(stack.resolve(imported.buildArn)).toStrictEqual({ + 'Fn::Join': ['', [ + 'arn:', + { Ref: 'AWS::Partition' }, + ':gamelift:', + { Ref: 'AWS::Region' }, + ':', + { Ref: 'AWS::AccountId' }, + ':build/sample-build-id', + ]], + }); + expect(stack.resolve(imported.buildId)).toStrictEqual('sample-build-id'); + }); + }); + + describe('Build.fromBuildAttributes()', () => { + let stack: cdk.Stack; + const buildId = 'build-test-identifier'; + const buildArn = `arn:aws:gamelift:build-region:123456789012:build/${buildId}`; + + beforeEach(() => { + const app = new cdk.App(); + stack = new cdk.Stack(app, 'Base', { + env: { account: '111111111111', region: 'stack-region' }, + }); + }); + + describe('', () => { + test('with required attrs only', () => { + const importedFleet = gamelift.Build.fromBuildAttributes(stack, 'ImportedBuild', { buildArn }); + + expect(importedFleet.buildId).toEqual(buildId); + expect(importedFleet.buildArn).toEqual(buildArn); + expect(importedFleet.env.account).toEqual('123456789012'); + expect(importedFleet.env.region).toEqual('build-region'); + }); + + test('with missing attrs', () => { + expect(() => gamelift.Build.fromBuildAttributes(stack, 'ImportedBuild', { })) + .toThrow(/Either buildId or buildArn must be provided in BuildAttributes/); + }); + + test('with invalid ARN', () => { + expect(() => gamelift.Build.fromBuildAttributes(stack, 'ImportedBuild', { buildArn: 'arn:aws:gamelift:build-region:123456789012:build' })) + .toThrow(/No build identifier found in ARN: 'arn:aws:gamelift:build-region:123456789012:build'/); + }); + }); + + describe('for an build in a different account and region', () => { + let build: gamelift.IBuild; + + beforeEach(() => { + build = gamelift.Build.fromBuildAttributes(stack, 'ImportedBuild', { buildArn }); + }); + + test("the build's region is taken from the ARN", () => { + expect(build.env.region).toBe('build-region'); + }); + + test("the build's account is taken from the ARN", () => { + expect(build.env.account).toBe('123456789012'); + }); + }); + }); }); diff --git a/packages/@aws-cdk/aws-gamelift/test/integ.build.js.snapshot/asset.6019bfc8ab05a24b0ae9b5d8f4585cbfc7d1c30a23286d0b25ce7066a368a5d7/index.js b/packages/@aws-cdk/aws-gamelift/test/integ.build.js.snapshot/asset.6019bfc8ab05a24b0ae9b5d8f4585cbfc7d1c30a23286d0b25ce7066a368a5d7/index.js deleted file mode 100644 index 73c02658c48d9..0000000000000 --- a/packages/@aws-cdk/aws-gamelift/test/integ.build.js.snapshot/asset.6019bfc8ab05a24b0ae9b5d8f4585cbfc7d1c30a23286d0b25ce7066a368a5d7/index.js +++ /dev/null @@ -1 +0,0 @@ -console.log('Hello World'); \ No newline at end of file diff --git a/packages/@aws-cdk/aws-gamelift/test/integ.build.js.snapshot/asset.b95e4173bc399a8f686a4951aa26e01de1ed1e9d981ee1a7f18a15512dbdcb37/TestApplicationServer b/packages/@aws-cdk/aws-gamelift/test/integ.build.js.snapshot/asset.b95e4173bc399a8f686a4951aa26e01de1ed1e9d981ee1a7f18a15512dbdcb37/TestApplicationServer new file mode 100755 index 0000000000000..a4f885388c109 Binary files /dev/null and b/packages/@aws-cdk/aws-gamelift/test/integ.build.js.snapshot/asset.b95e4173bc399a8f686a4951aa26e01de1ed1e9d981ee1a7f18a15512dbdcb37/TestApplicationServer differ diff --git a/packages/@aws-cdk/aws-gamelift/test/integ.build.js.snapshot/asset.b95e4173bc399a8f686a4951aa26e01de1ed1e9d981ee1a7f18a15512dbdcb37/install.sh b/packages/@aws-cdk/aws-gamelift/test/integ.build.js.snapshot/asset.b95e4173bc399a8f686a4951aa26e01de1ed1e9d981ee1a7f18a15512dbdcb37/install.sh new file mode 100755 index 0000000000000..1ef448e39373c --- /dev/null +++ b/packages/@aws-cdk/aws-gamelift/test/integ.build.js.snapshot/asset.b95e4173bc399a8f686a4951aa26e01de1ed1e9d981ee1a7f18a15512dbdcb37/install.sh @@ -0,0 +1,4 @@ +#!/bin/bash +# make sure the gameserver is executable +/usr/bin/chmod +x /local/game/TestApplicationServer +exit 0 diff --git a/packages/@aws-cdk/aws-gamelift/test/integ.build.js.snapshot/aws-gamelift-build.assets.json b/packages/@aws-cdk/aws-gamelift/test/integ.build.js.snapshot/aws-gamelift-build.assets.json index 288379fb15a56..e28bd324f7030 100644 --- a/packages/@aws-cdk/aws-gamelift/test/integ.build.js.snapshot/aws-gamelift-build.assets.json +++ b/packages/@aws-cdk/aws-gamelift/test/integ.build.js.snapshot/aws-gamelift-build.assets.json @@ -1,20 +1,20 @@ { "version": "21.0.0", "files": { - "6019bfc8ab05a24b0ae9b5d8f4585cbfc7d1c30a23286d0b25ce7066a368a5d7": { + "b95e4173bc399a8f686a4951aa26e01de1ed1e9d981ee1a7f18a15512dbdcb37": { "source": { - "path": "asset.6019bfc8ab05a24b0ae9b5d8f4585cbfc7d1c30a23286d0b25ce7066a368a5d7", + "path": "asset.b95e4173bc399a8f686a4951aa26e01de1ed1e9d981ee1a7f18a15512dbdcb37", "packaging": "zip" }, "destinations": { "current_account-current_region": { "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "6019bfc8ab05a24b0ae9b5d8f4585cbfc7d1c30a23286d0b25ce7066a368a5d7.zip", + "objectKey": "b95e4173bc399a8f686a4951aa26e01de1ed1e9d981ee1a7f18a15512dbdcb37.zip", "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" } } }, - "56a977de7626326c13fb108674329fc1a0952d0c525384c951169c7c75812e47": { + "2bd5bde6b8c6af8bf7ca2e03bf58bcf2fbd6a755101d9747a72238d65e0d8230": { "source": { "path": "aws-gamelift-build.template.json", "packaging": "file" @@ -22,7 +22,7 @@ "destinations": { "current_account-current_region": { "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "56a977de7626326c13fb108674329fc1a0952d0c525384c951169c7c75812e47.json", + "objectKey": "2bd5bde6b8c6af8bf7ca2e03bf58bcf2fbd6a755101d9747a72238d65e0d8230.json", "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" } } diff --git a/packages/@aws-cdk/aws-gamelift/test/integ.build.js.snapshot/aws-gamelift-build.template.json b/packages/@aws-cdk/aws-gamelift/test/integ.build.js.snapshot/aws-gamelift-build.template.json index ebdf264e941a1..d1e5c0a43f872 100644 --- a/packages/@aws-cdk/aws-gamelift/test/integ.build.js.snapshot/aws-gamelift-build.template.json +++ b/packages/@aws-cdk/aws-gamelift/test/integ.build.js.snapshot/aws-gamelift-build.template.json @@ -40,7 +40,7 @@ { "Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}" }, - "/6019bfc8ab05a24b0ae9b5d8f4585cbfc7d1c30a23286d0b25ce7066a368a5d7.zip" + "/b95e4173bc399a8f686a4951aa26e01de1ed1e9d981ee1a7f18a15512dbdcb37.zip" ] ] } @@ -59,18 +59,20 @@ "Build45A36621": { "Type": "AWS::GameLift::Build", "Properties": { + "OperatingSystem": "AMAZON_LINUX_2", "StorageLocation": { "Bucket": { "Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}" }, - "Key": "6019bfc8ab05a24b0ae9b5d8f4585cbfc7d1c30a23286d0b25ce7066a368a5d7.zip", + "Key": "b95e4173bc399a8f686a4951aa26e01de1ed1e9d981ee1a7f18a15512dbdcb37.zip", "RoleArn": { "Fn::GetAtt": [ "BuildServiceRole1F57E904", "Arn" ] } - } + }, + "Version": "1.0" }, "DependsOn": [ "BuildServiceRoleDefaultPolicyCB7101C6", @@ -78,6 +80,38 @@ ] } }, + "Outputs": { + "BuildArn": { + "Value": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":gamelift:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":build/", + { + "Ref": "Build45A36621" + } + ] + ] + } + }, + "BuildId": { + "Value": { + "Ref": "Build45A36621" + } + } + }, "Parameters": { "BootstrapVersion": { "Type": "AWS::SSM::Parameter::Value", diff --git a/packages/@aws-cdk/aws-gamelift/test/integ.build.js.snapshot/manifest.json b/packages/@aws-cdk/aws-gamelift/test/integ.build.js.snapshot/manifest.json index c0fe7b2462be3..fef7e9c3c0857 100644 --- a/packages/@aws-cdk/aws-gamelift/test/integ.build.js.snapshot/manifest.json +++ b/packages/@aws-cdk/aws-gamelift/test/integ.build.js.snapshot/manifest.json @@ -1,12 +1,6 @@ { "version": "21.0.0", "artifacts": { - "Tree": { - "type": "cdk:tree", - "properties": { - "file": "tree.json" - } - }, "aws-gamelift-build.assets": { "type": "cdk:asset-manifest", "properties": { @@ -23,7 +17,7 @@ "validateOnSynth": false, "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", - "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/56a977de7626326c13fb108674329fc1a0952d0c525384c951169c7c75812e47.json", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/2bd5bde6b8c6af8bf7ca2e03bf58bcf2fbd6a755101d9747a72238d65e0d8230.json", "requiresBootstrapStackVersion": 6, "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", "additionalDependencies": [ @@ -57,6 +51,18 @@ "data": "Build45A36621" } ], + "/aws-gamelift-build/BuildArn": [ + { + "type": "aws:cdk:logicalId", + "data": "BuildArn" + } + ], + "/aws-gamelift-build/BuildId": [ + { + "type": "aws:cdk:logicalId", + "data": "BuildId" + } + ], "/aws-gamelift-build/BootstrapVersion": [ { "type": "aws:cdk:logicalId", @@ -118,6 +124,12 @@ ] }, "displayName": "Build/DefaultTest/DeployAssert" + }, + "Tree": { + "type": "cdk:tree", + "properties": { + "file": "tree.json" + } } } } \ No newline at end of file diff --git a/packages/@aws-cdk/aws-gamelift/test/integ.build.js.snapshot/tree.json b/packages/@aws-cdk/aws-gamelift/test/integ.build.js.snapshot/tree.json index 58798a9740d0c..69e8ae12fa743 100644 --- a/packages/@aws-cdk/aws-gamelift/test/integ.build.js.snapshot/tree.json +++ b/packages/@aws-cdk/aws-gamelift/test/integ.build.js.snapshot/tree.json @@ -4,14 +4,6 @@ "id": "App", "path": "", "children": { - "Tree": { - "id": "Tree", - "path": "Tree", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.140" - } - }, "aws-gamelift-build": { "id": "aws-gamelift-build", "path": "aws-gamelift-build", @@ -24,6 +16,14 @@ "id": "ServiceRole", "path": "aws-gamelift-build/Build/ServiceRole", "children": { + "ImportServiceRole": { + "id": "ImportServiceRole", + "path": "aws-gamelift-build/Build/ServiceRole/ImportServiceRole", + "constructInfo": { + "fqn": "@aws-cdk/core.Resource", + "version": "0.0.0" + } + }, "Resource": { "id": "Resource", "path": "aws-gamelift-build/Build/ServiceRole/Resource", @@ -79,7 +79,7 @@ { "Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}" }, - "/6019bfc8ab05a24b0ae9b5d8f4585cbfc7d1c30a23286d0b25ce7066a368a5d7.zip" + "/b95e4173bc399a8f686a4951aa26e01de1ed1e9d981ee1a7f18a15512dbdcb37.zip" ] ] } @@ -152,18 +152,20 @@ "attributes": { "aws:cdk:cloudformation:type": "AWS::GameLift::Build", "aws:cdk:cloudformation:props": { + "operatingSystem": "AMAZON_LINUX_2", "storageLocation": { "bucket": { "Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}" }, - "key": "6019bfc8ab05a24b0ae9b5d8f4585cbfc7d1c30a23286d0b25ce7066a368a5d7.zip", + "key": "b95e4173bc399a8f686a4951aa26e01de1ed1e9d981ee1a7f18a15512dbdcb37.zip", "roleArn": { "Fn::GetAtt": [ "BuildServiceRole1F57E904", "Arn" ] } - } + }, + "version": "1.0" } }, "constructInfo": { @@ -176,6 +178,38 @@ "fqn": "@aws-cdk/aws-gamelift.Build", "version": "0.0.0" } + }, + "BuildArn": { + "id": "BuildArn", + "path": "aws-gamelift-build/BuildArn", + "constructInfo": { + "fqn": "@aws-cdk/core.CfnOutput", + "version": "0.0.0" + } + }, + "BuildId": { + "id": "BuildId", + "path": "aws-gamelift-build/BuildId", + "constructInfo": { + "fqn": "@aws-cdk/core.CfnOutput", + "version": "0.0.0" + } + }, + "BootstrapVersion": { + "id": "BootstrapVersion", + "path": "aws-gamelift-build/BootstrapVersion", + "constructInfo": { + "fqn": "@aws-cdk/core.CfnParameter", + "version": "0.0.0" + } + }, + "CheckBootstrapVersion": { + "id": "CheckBootstrapVersion", + "path": "aws-gamelift-build/CheckBootstrapVersion", + "constructInfo": { + "fqn": "@aws-cdk/core.CfnRule", + "version": "0.0.0" + } } }, "constructInfo": { @@ -196,12 +230,30 @@ "path": "Build/DefaultTest/Default", "constructInfo": { "fqn": "constructs.Construct", - "version": "10.1.140" + "version": "10.1.161" } }, "DeployAssert": { "id": "DeployAssert", "path": "Build/DefaultTest/DeployAssert", + "children": { + "BootstrapVersion": { + "id": "BootstrapVersion", + "path": "Build/DefaultTest/DeployAssert/BootstrapVersion", + "constructInfo": { + "fqn": "@aws-cdk/core.CfnParameter", + "version": "0.0.0" + } + }, + "CheckBootstrapVersion": { + "id": "CheckBootstrapVersion", + "path": "Build/DefaultTest/DeployAssert/CheckBootstrapVersion", + "constructInfo": { + "fqn": "@aws-cdk/core.CfnRule", + "version": "0.0.0" + } + } + }, "constructInfo": { "fqn": "@aws-cdk/core.Stack", "version": "0.0.0" @@ -218,6 +270,14 @@ "fqn": "@aws-cdk/integ-tests.IntegTest", "version": "0.0.0" } + }, + "Tree": { + "id": "Tree", + "path": "Tree", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.161" + } } }, "constructInfo": { diff --git a/packages/@aws-cdk/aws-gamelift/test/integ.build.ts b/packages/@aws-cdk/aws-gamelift/test/integ.build.ts index 75d260e07c58d..cd58a55109737 100644 --- a/packages/@aws-cdk/aws-gamelift/test/integ.build.ts +++ b/packages/@aws-cdk/aws-gamelift/test/integ.build.ts @@ -1,5 +1,6 @@ import * as path from 'path'; import * as cdk from '@aws-cdk/core'; +import { CfnOutput } from '@aws-cdk/core'; import { IntegTest } from '@aws-cdk/integ-tests'; import { Construct } from 'constructs'; import * as gamelift from '../lib'; @@ -8,9 +9,14 @@ class TestStack extends cdk.Stack { constructor(scope: Construct, id: string, props?: cdk.StackProps) { super(scope, id, props); - new gamelift.Build(this, 'Build', { + const build = new gamelift.Build(this, 'Build', { content: gamelift.Content.fromAsset(path.join(__dirname, 'my-game-build')), + operatingSystem: gamelift.OperatingSystem.AMAZON_LINUX_2, + buildVersion: '1.0', }); + + new CfnOutput(this, 'BuildArn', { value: build.buildArn }); + new CfnOutput(this, 'BuildId', { value: build.buildId }); } }