forked from aws/aws-cdk
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add CloudFront AccessLevel.READ_VERSIONED
This allows creating an S3 bucket origin OriginAccessControl for access of versioned objects Fixes aws#33034
- Loading branch information
1 parent
a928748
commit 7aaae57
Showing
5 changed files
with
201 additions
and
119 deletions.
There are no files selected for viewing
24 changes: 24 additions & 0 deletions
24
...ng/framework-integ/test/aws-cloudfront-origins/test/integ.s3-origin-oac-read-versioned.ts
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,24 @@ | ||
import * as cloudfront from 'aws-cdk-lib/aws-cloudfront'; | ||
import * as s3 from 'aws-cdk-lib/aws-s3'; | ||
import * as cdk from 'aws-cdk-lib'; | ||
import * as origins from 'aws-cdk-lib/aws-cloudfront-origins'; | ||
import { ExpectedResult, IntegTest } from '@aws-cdk/integ-tests-alpha'; | ||
|
||
const app = new cdk.App(); | ||
|
||
const stack = new cdk.Stack(app, 'cloudfront-s3-bucket-origin-oac-read-versioned-access'); | ||
|
||
const bucket = new s3.Bucket(stack, 'Bucket', { | ||
removalPolicy: cdk.RemovalPolicy.DESTROY, | ||
}); | ||
origins.S3BucketOrigin.withOriginAccessControl(bucket, { | ||
originAccessLevels: [cloudfront.AccessLevel.READ, cloudfront.AccessLevel.READ_VERSIONED], | ||
}); | ||
|
||
const integ = new IntegTest(app, 's3-origin-oac-read-versioned-access', { | ||
testCases: [stack], | ||
}); | ||
|
||
integ.assertions.awsApiCall('S3', 'getBucketPolicy', { | ||
Bucket: bucket.bucketName, | ||
}).expect(ExpectedResult.objectLike({ Statement: [{ Action: ['s3:GetObject', 's3:GetObjectVersion'] }] })); |
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
Oops, something went wrong.