-
Notifications
You must be signed in to change notification settings - Fork 4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
s3: bucketUrl and urlForObject(key) (#370)
The `bucketUrl` returns the URL of the bucket and `urlForObject(key)` returns the URL of an object within the bucket. Furthermore: `iam.IIdentityResource` was soft-renamed to `iam.IPrincipal` (IIdentityResource is still supported).
- Loading branch information
Elad Ben-Israel
authored
Jul 18, 2018
1 parent
f0bf75f
commit 5502436
Showing
8 changed files
with
281 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
61 changes: 61 additions & 0 deletions
61
packages/@aws-cdk/s3/test/integ.bucket.url.lit.expected.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
{ | ||
"Resources": { | ||
"MyBucketF68F3FF0": { | ||
"Type": "AWS::S3::Bucket" | ||
} | ||
}, | ||
"Outputs": { | ||
"BucketURL": { | ||
"Value": { | ||
"Fn::Join": [ | ||
"", | ||
[ | ||
"https://", | ||
"s3.", | ||
{ | ||
"Ref": "AWS::Region" | ||
}, | ||
".", | ||
{ | ||
"Ref": "AWS::URLSuffix" | ||
}, | ||
"/", | ||
{ | ||
"Ref": "MyBucketF68F3FF0" | ||
} | ||
] | ||
] | ||
}, | ||
"Export": { | ||
"Name": "aws-cdk-s3-urls:BucketURL" | ||
} | ||
}, | ||
"ObjectURL": { | ||
"Value": { | ||
"Fn::Join": [ | ||
"", | ||
[ | ||
"https://", | ||
"s3.", | ||
{ | ||
"Ref": "AWS::Region" | ||
}, | ||
".", | ||
{ | ||
"Ref": "AWS::URLSuffix" | ||
}, | ||
"/", | ||
{ | ||
"Ref": "MyBucketF68F3FF0" | ||
}, | ||
"/", | ||
"myfolder/myfile.txt" | ||
] | ||
] | ||
}, | ||
"Export": { | ||
"Name": "aws-cdk-s3-urls:ObjectURL" | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import cdk = require('@aws-cdk/core'); | ||
import s3 = require('../lib'); | ||
|
||
class TestStack extends cdk.Stack { | ||
constructor(parent: cdk.App, id: string) { | ||
super(parent, id); | ||
|
||
/// !show | ||
const bucket = new s3.Bucket(this, 'MyBucket'); | ||
|
||
new cdk.Output(this, 'BucketURL', { value: bucket.bucketUrl }); | ||
new cdk.Output(this, 'ObjectURL', { value: bucket.urlForObject('myfolder/myfile.txt') }); | ||
/// !hide | ||
} | ||
} | ||
|
||
const app = new cdk.App(process.argv); | ||
new TestStack(app, 'aws-cdk-s3-urls'); | ||
process.stdout.write(app.run()); |
Oops, something went wrong.