From 4024415ad4632e1865d6e7ecaebf6d8f5f1f5bdd Mon Sep 17 00:00:00 2001 From: Blake Price Date: Wed, 3 Oct 2018 10:36:43 -0700 Subject: [PATCH] feat(aws-s3) Expose BucketDomainName to S3.Bucket Exports --- packages/@aws-cdk/aws-s3/lib/bucket.ts | 1 + packages/@aws-cdk/aws-s3/test/test.bucket.ts | 28 ++++++++++++++++++-- 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/packages/@aws-cdk/aws-s3/lib/bucket.ts b/packages/@aws-cdk/aws-s3/lib/bucket.ts index d3291312c3f29..0bf19511b5928 100644 --- a/packages/@aws-cdk/aws-s3/lib/bucket.ts +++ b/packages/@aws-cdk/aws-s3/lib/bucket.ts @@ -110,6 +110,7 @@ export abstract class BucketRef extends cdk.Construct { return { bucketArn: new cdk.Output(this, 'BucketArn', { value: this.bucketArn }).makeImportValue().toString(), bucketName: new cdk.Output(this, 'BucketName', { value: this.bucketName }).makeImportValue().toString(), + bucketDomainName: new cdk.Output(this, 'DomainName', { value: this.domainName }).makeImportValue().toString(), }; } diff --git a/packages/@aws-cdk/aws-s3/test/test.bucket.ts b/packages/@aws-cdk/aws-s3/test/test.bucket.ts index 32a20b87a2229..5f94485c79c9c 100644 --- a/packages/@aws-cdk/aws-s3/test/test.bucket.ts +++ b/packages/@aws-cdk/aws-s3/test/test.bucket.ts @@ -329,7 +329,8 @@ export = { const bucketRef = bucket.export(); test.deepEqual(cdk.resolve(bucketRef), { bucketArn: { 'Fn::ImportValue': 'MyStack:MyBucketBucketArnE260558C' }, - bucketName: { 'Fn::ImportValue': 'MyStack:MyBucketBucketName8A027014' } + bucketName: { 'Fn::ImportValue': 'MyStack:MyBucketBucketName8A027014' }, + bucketDomainName: { 'Fn::ImportValue': 'MyStack:MyBucketDomainNameF76B9A7A' } }); test.done(); }, @@ -340,7 +341,8 @@ export = { const bucketRef = bucket.export(); test.deepEqual(cdk.resolve(bucketRef), { bucketArn: { 'Fn::ImportValue': 'MyStack:MyBucketBucketArnE260558C' }, - bucketName: { 'Fn::ImportValue': 'MyStack:MyBucketBucketName8A027014' } + bucketName: { 'Fn::ImportValue': 'MyStack:MyBucketBucketName8A027014' }, + bucketDomainName: { 'Fn::ImportValue': 'MyStack:MyBucketDomainNameF76B9A7A' } }); test.done(); }, @@ -457,6 +459,17 @@ export = { "Export": { "Name": "S1:MyBucketBucketName8A027014" } + }, + "MyBucketDomainNameF76B9A7A": { + "Value": { + "Fn::GetAtt": [ + "MyBucketF68F3FF0", + "DomainName" + ] + }, + "Export": { + "Name": "S1:MyBucketDomainNameF76B9A7A" + } } } }); @@ -881,6 +894,17 @@ export = { "Export": { "Name": "MyBucketBucketName8A027014" } + }, + "MyBucketDomainNameF76B9A7A": { + "Value": { + "Fn::GetAtt": [ + "MyBucketF68F3FF0", + "DomainName" + ] + }, + "Export": { + "Name": "MyBucketDomainNameF76B9A7A" + } } } });