Skip to content

Commit 18fbd6d

Browse files
authored
feat(kinesis): support resource policy for a data stream (#31909)
### Issue # (if applicable) Closes #28814 . ### Reason for this change To support resource policy for a Kinesis Data stream. ### Description of changes * Add `ResourcePolicy` Construct. * Add `addToResourcePolicy` method to `Stream` Construct. ### Description of how you validated changes Add unit tests and integ test. ### Checklist - [x] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md) ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
1 parent f15de81 commit 18fbd6d

16 files changed

+806
-3
lines changed

packages/@aws-cdk-testing/framework-integ/test/aws-kinesis/test/integ.resource-policy.js.snapshot/cdk.out

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/@aws-cdk-testing/framework-integ/test/aws-kinesis/test/integ.resource-policy.js.snapshot/integ.json

+13
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/@aws-cdk-testing/framework-integ/test/aws-kinesis/test/integ.resource-policy.js.snapshot/integkinesisresourcepolicyDefaultTestDeployAssert52C5D16C.assets.json

+19
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/@aws-cdk-testing/framework-integ/test/aws-kinesis/test/integ.resource-policy.js.snapshot/integkinesisresourcepolicyDefaultTestDeployAssert52C5D16C.template.json

+36
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/@aws-cdk-testing/framework-integ/test/aws-kinesis/test/integ.resource-policy.js.snapshot/kinesis-resource-policy.assets.json

+19
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
{
2+
"Resources": {
3+
"MyStream5C050E93": {
4+
"Type": "AWS::Kinesis::Stream",
5+
"Properties": {
6+
"RetentionPeriodHours": 24,
7+
"ShardCount": 1,
8+
"StreamEncryption": {
9+
"Fn::If": [
10+
"AwsCdkKinesisEncryptedStreamsUnsupportedRegions",
11+
{
12+
"Ref": "AWS::NoValue"
13+
},
14+
{
15+
"EncryptionType": "KMS",
16+
"KeyId": "alias/aws/kinesis"
17+
}
18+
]
19+
}
20+
},
21+
"UpdateReplacePolicy": "Retain",
22+
"DeletionPolicy": "Retain"
23+
},
24+
"MyStreamPolicyC34ACF94": {
25+
"Type": "AWS::Kinesis::ResourcePolicy",
26+
"Properties": {
27+
"ResourceArn": {
28+
"Fn::GetAtt": [
29+
"MyStream5C050E93",
30+
"Arn"
31+
]
32+
},
33+
"ResourcePolicy": {
34+
"Statement": [
35+
{
36+
"Action": [
37+
"kinesis:DescribeStreamSummary",
38+
"kinesis:GetRecords"
39+
],
40+
"Effect": "Allow",
41+
"Principal": {
42+
"AWS": {
43+
"Fn::Join": [
44+
"",
45+
[
46+
"arn:",
47+
{
48+
"Ref": "AWS::Partition"
49+
},
50+
":iam::",
51+
{
52+
"Ref": "AWS::AccountId"
53+
},
54+
":root"
55+
]
56+
]
57+
}
58+
},
59+
"Resource": {
60+
"Fn::GetAtt": [
61+
"MyStream5C050E93",
62+
"Arn"
63+
]
64+
}
65+
}
66+
],
67+
"Version": "2012-10-17"
68+
}
69+
}
70+
}
71+
},
72+
"Conditions": {
73+
"AwsCdkKinesisEncryptedStreamsUnsupportedRegions": {
74+
"Fn::Or": [
75+
{
76+
"Fn::Equals": [
77+
{
78+
"Ref": "AWS::Region"
79+
},
80+
"cn-north-1"
81+
]
82+
},
83+
{
84+
"Fn::Equals": [
85+
{
86+
"Ref": "AWS::Region"
87+
},
88+
"cn-northwest-1"
89+
]
90+
}
91+
]
92+
}
93+
},
94+
"Parameters": {
95+
"BootstrapVersion": {
96+
"Type": "AWS::SSM::Parameter::Value<String>",
97+
"Default": "/cdk-bootstrap/hnb659fds/version",
98+
"Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]"
99+
}
100+
},
101+
"Rules": {
102+
"CheckBootstrapVersion": {
103+
"Assertions": [
104+
{
105+
"Assert": {
106+
"Fn::Not": [
107+
{
108+
"Fn::Contains": [
109+
[
110+
"1",
111+
"2",
112+
"3",
113+
"4",
114+
"5"
115+
],
116+
{
117+
"Ref": "BootstrapVersion"
118+
}
119+
]
120+
}
121+
]
122+
},
123+
"AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI."
124+
}
125+
]
126+
}
127+
}
128+
}

packages/@aws-cdk-testing/framework-integ/test/aws-kinesis/test/integ.resource-policy.js.snapshot/manifest.json

+127
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)