-
Notifications
You must be signed in to change notification settings - Fork 4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(s3): export bucket websiteURL (#1521) #1522
Changes from 2 commits
497620d
f6a3bfa
c2aeebd
a36ac08
7bafbff
1724161
a4645f2
b22cf0c
19c9392
5096201
9bae09b
be19cc5
81a5a07
ed5a38b
ccd01e2
b1f5b2e
9cb842f
f393a26
6ad8c5e
0fb62c8
3961ad7
01d72cf
948b5df
4443d5c
582c8b1
c79d234
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -180,7 +180,7 @@ export interface IBucket extends cdk.IConstruct { | |
*/ | ||
export interface BucketImportProps { | ||
/** | ||
* The ARN fo the bucket. At least one of bucketArn or bucketName must be | ||
* The ARN of the bucket. At least one of bucketArn or bucketName must be | ||
* defined in order to initialize a bucket ref. | ||
*/ | ||
bucketArn?: string; | ||
|
@@ -199,6 +199,13 @@ export interface BucketImportProps { | |
* @default Inferred from bucket name | ||
*/ | ||
bucketDomainName?: string; | ||
|
||
/** | ||
* The website URL of the bucket (if static web hosting is enabled). | ||
* | ||
* @default Inferred from bucket name | ||
*/ | ||
bucketWebsiteURL?: string; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please rename to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What's the difference between this and domainName? I also can't seem to find the actual implementation in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for the review @eladb 😄 I've pushed the change to rename to Ah, I've just spotted that this actually will be identical to |
||
} | ||
|
||
/** | ||
|
@@ -620,6 +627,7 @@ export class Bucket extends BucketBase { | |
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(), | ||
bucketWebsiteURL: new cdk.Output(this, 'WebsiteURL', { value: this.domainName }).makeImportValue().toString() | ||
}; | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -334,7 +334,8 @@ export = { | |
test.deepEqual(cdk.resolve(bucketRef), { | ||
bucketArn: { 'Fn::ImportValue': 'MyStack:MyBucketBucketArnE260558C' }, | ||
bucketName: { 'Fn::ImportValue': 'MyStack:MyBucketBucketName8A027014' }, | ||
bucketDomainName: { 'Fn::ImportValue': 'MyStack:MyBucketDomainNameF76B9A7A' } | ||
bucketDomainName: { 'Fn::ImportValue': 'MyStack:MyBucketDomainNameF76B9A7A' }, | ||
bucketWebsiteURL: { 'Fn::ImportValue': 'MyStack:MyBucketWebsiteURL9C222788' } | ||
}); | ||
test.done(); | ||
}, | ||
|
@@ -346,7 +347,8 @@ export = { | |
test.deepEqual(cdk.resolve(bucketRef), { | ||
bucketArn: { 'Fn::ImportValue': 'MyStack:MyBucketBucketArnE260558C' }, | ||
bucketName: { 'Fn::ImportValue': 'MyStack:MyBucketBucketName8A027014' }, | ||
bucketDomainName: { 'Fn::ImportValue': 'MyStack:MyBucketDomainNameF76B9A7A' } | ||
bucketDomainName: { 'Fn::ImportValue': 'MyStack:MyBucketDomainNameF76B9A7A' }, | ||
bucketWebsiteURL: { 'Fn::ImportValue': 'MyStack:MyBucketWebsiteURL9C222788' } | ||
}); | ||
test.done(); | ||
}, | ||
|
@@ -465,6 +467,17 @@ export = { | |
"Export": { | ||
"Name": "S1:MyBucketDomainNameF76B9A7A" | ||
} | ||
}, | ||
"MyBucketWebsiteURL9C222788": { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I found the logical ID here (i.e. I'm not sure if I was meant to have determined the output from somewhere else? |
||
"Value": { | ||
"Fn::GetAtt": [ | ||
"MyBucketF68F3FF0", | ||
"DomainName" | ||
] | ||
}, | ||
"Export": { | ||
"Name": "S1:MyBucketWebsiteURL9C222788" | ||
} | ||
} | ||
} | ||
}); | ||
|
@@ -898,6 +911,17 @@ export = { | |
"Export": { | ||
"Name": "MyBucketDomainNameF76B9A7A" | ||
} | ||
}, | ||
"MyBucketWebsiteURL9C222788": { | ||
"Value": { | ||
"Fn::GetAtt": [ | ||
"MyBucketF68F3FF0", | ||
"DomainName" | ||
] | ||
}, | ||
"Export": { | ||
"Name": "MyBucketWebsiteURL9C222788" | ||
} | ||
} | ||
} | ||
}); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure how useful this description is, I tried a couple of different variations but couldn't come up with anything better than this.
Suggestions welcome!