-
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.
Stream resource policy for Table(v1)
- Loading branch information
Lee Hannigan
committed
Sep 21, 2024
1 parent
eb2dfda
commit 0fc111a
Showing
4 changed files
with
178 additions
and
3 deletions.
There are no files selected for viewing
42 changes: 42 additions & 0 deletions
42
...s/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb.stream-policy.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,42 @@ | ||
import { App, RemovalPolicy, Stack, StackProps } from 'aws-cdk-lib'; | ||
import { Construct } from 'constructs'; | ||
import * as dynamodb from 'aws-cdk-lib/aws-dynamodb'; | ||
import * as iam from 'aws-cdk-lib/aws-iam'; | ||
import { IntegTest } from '@aws-cdk/integ-tests-alpha'; | ||
|
||
export class TestStack extends Stack { | ||
|
||
readonly table: dynamodb.Table; | ||
|
||
constructor(scope: Construct, id: string, props?: StackProps) { | ||
super(scope, id, props); | ||
|
||
const doc = new iam.PolicyDocument({ | ||
statements: [ | ||
new iam.PolicyStatement({ | ||
actions: ['dynamodb:GetRecords', 'dynamodb:DescribeStream'], | ||
principals: [new iam.AccountRootPrincipal()], | ||
resources: ['*'], | ||
}), | ||
], | ||
}); | ||
|
||
this.table = new dynamodb.Table(this, 'TableTest1', { | ||
partitionKey: { | ||
name: 'id', | ||
type: dynamodb.AttributeType.STRING, | ||
}, | ||
removalPolicy: RemovalPolicy.DESTROY, | ||
streamResourcePolicy: doc, | ||
stream: dynamodb.StreamViewType.NEW_AND_OLD_IMAGES, | ||
}); | ||
|
||
} | ||
} | ||
|
||
const app = new App(); | ||
const stack = new TestStack(app, 'resource-policy-stack', {}); | ||
|
||
new IntegTest(app, 'resource-policy-integ-test', { | ||
testCases: [stack], | ||
}); |
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