-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
…30423) ### Issue # (if applicable) Closes aws#30422 ### Reason for this change Missing Property in the Subscription class. ### Description of changes Add destination property to the Subscription class. ### Description of how you validated changes Add unit tests and integ tests. ### 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*
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,172 @@ | ||
{ | ||
"Resources": { | ||
"LogGroupF5B46931": { | ||
"Type": "AWS::Logs::LogGroup", | ||
"Properties": { | ||
"RetentionInDays": 731 | ||
}, | ||
"UpdateReplacePolicy": "Retain", | ||
"DeletionPolicy": "Retain" | ||
}, | ||
"LogGroupSubscriptionCloudWatchLogsCanPutRecords29011851": { | ||
"Type": "AWS::IAM::Role", | ||
"Properties": { | ||
"AssumeRolePolicyDocument": { | ||
"Statement": [ | ||
{ | ||
"Action": "sts:AssumeRole", | ||
"Effect": "Allow", | ||
"Principal": { | ||
"Service": "logs.amazonaws.com" | ||
} | ||
} | ||
], | ||
"Version": "2012-10-17" | ||
} | ||
} | ||
}, | ||
"LogGroupSubscriptionCloudWatchLogsCanPutRecordsDefaultPolicyB7125314": { | ||
"Type": "AWS::IAM::Policy", | ||
"Properties": { | ||
"PolicyDocument": { | ||
"Statement": [ | ||
{ | ||
"Action": [ | ||
"kinesis:ListShards", | ||
"kinesis:PutRecord", | ||
"kinesis:PutRecords" | ||
], | ||
"Effect": "Allow", | ||
"Resource": { | ||
"Fn::GetAtt": [ | ||
"Stream790BDEE4", | ||
"Arn" | ||
] | ||
} | ||
}, | ||
{ | ||
"Action": "iam:PassRole", | ||
"Effect": "Allow", | ||
"Resource": { | ||
"Fn::GetAtt": [ | ||
"LogGroupSubscriptionCloudWatchLogsCanPutRecords29011851", | ||
"Arn" | ||
] | ||
} | ||
} | ||
], | ||
"Version": "2012-10-17" | ||
}, | ||
"PolicyName": "LogGroupSubscriptionCloudWatchLogsCanPutRecordsDefaultPolicyB7125314", | ||
"Roles": [ | ||
{ | ||
"Ref": "LogGroupSubscriptionCloudWatchLogsCanPutRecords29011851" | ||
} | ||
] | ||
} | ||
}, | ||
"LogGroupSubscriptionE3573E29": { | ||
"Type": "AWS::Logs::SubscriptionFilter", | ||
"Properties": { | ||
"DestinationArn": { | ||
"Fn::GetAtt": [ | ||
"Stream790BDEE4", | ||
"Arn" | ||
] | ||
}, | ||
"Distribution": "Random", | ||
"FilterName": "CustomSubscriptionFilterName", | ||
"FilterPattern": "\"ERROR\" \"MainThread\"", | ||
"LogGroupName": { | ||
"Ref": "LogGroupF5B46931" | ||
}, | ||
"RoleArn": { | ||
"Fn::GetAtt": [ | ||
"LogGroupSubscriptionCloudWatchLogsCanPutRecords29011851", | ||
"Arn" | ||
] | ||
} | ||
}, | ||
"DependsOn": [ | ||
"LogGroupSubscriptionCloudWatchLogsCanPutRecordsDefaultPolicyB7125314" | ||
] | ||
}, | ||
"Stream790BDEE4": { | ||
"Type": "AWS::Kinesis::Stream", | ||
"Properties": { | ||
"RetentionPeriodHours": 24, | ||
"ShardCount": 1, | ||
"StreamEncryption": { | ||
"Fn::If": [ | ||
"AwsCdkKinesisEncryptedStreamsUnsupportedRegions", | ||
{ | ||
"Ref": "AWS::NoValue" | ||
}, | ||
{ | ||
"EncryptionType": "KMS", | ||
"KeyId": "alias/aws/kinesis" | ||
} | ||
] | ||
} | ||
}, | ||
"UpdateReplacePolicy": "Retain", | ||
"DeletionPolicy": "Retain" | ||
} | ||
}, | ||
"Conditions": { | ||
"AwsCdkKinesisEncryptedStreamsUnsupportedRegions": { | ||
"Fn::Or": [ | ||
{ | ||
"Fn::Equals": [ | ||
{ | ||
"Ref": "AWS::Region" | ||
}, | ||
"cn-north-1" | ||
] | ||
}, | ||
{ | ||
"Fn::Equals": [ | ||
{ | ||
"Ref": "AWS::Region" | ||
}, | ||
"cn-northwest-1" | ||
] | ||
} | ||
] | ||
} | ||
}, | ||
"Parameters": { | ||
"BootstrapVersion": { | ||
"Type": "AWS::SSM::Parameter::Value<String>", | ||
"Default": "/cdk-bootstrap/hnb659fds/version", | ||
"Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]" | ||
} | ||
}, | ||
"Rules": { | ||
"CheckBootstrapVersion": { | ||
"Assertions": [ | ||
{ | ||
"Assert": { | ||
"Fn::Not": [ | ||
{ | ||
"Fn::Contains": [ | ||
[ | ||
"1", | ||
"2", | ||
"3", | ||
"4", | ||
"5" | ||
], | ||
{ | ||
"Ref": "BootstrapVersion" | ||
} | ||
] | ||
} | ||
] | ||
}, | ||
"AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI." | ||
} | ||
] | ||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { App, Stack, StackProps } from 'aws-cdk-lib'; | ||
import { IntegTest } from '@aws-cdk/integ-tests-alpha'; | ||
import { LogGroup, FilterPattern, Distribution } from 'aws-cdk-lib/aws-logs'; | ||
import { KinesisDestination } from 'aws-cdk-lib/aws-logs-destinations'; | ||
import { Stream } from 'aws-cdk-lib/aws-kinesis'; | ||
class SubscriptionFilterDistributionIntegStack extends Stack { | ||
constructor(scope: App, id: string, props?: StackProps) { | ||
super(scope, id, props); | ||
|
||
const logGroup = new LogGroup(this, 'LogGroup'); | ||
|
||
const stream = new Stream(this, 'Stream'); | ||
|
||
logGroup.addSubscriptionFilter('Subscription', { | ||
destination: new KinesisDestination(stream), | ||
filterPattern: FilterPattern.allTerms('ERROR', 'MainThread'), | ||
filterName: 'CustomSubscriptionFilterName', | ||
distribution: Distribution.RANDOM, | ||
}); | ||
} | ||
} | ||
|
||
const app = new App(); | ||
const testCase = new SubscriptionFilterDistributionIntegStack(app, 'aws-cdk-subscriptionfilter-distribution-integ'); | ||
|
||
new IntegTest(app, 'integ-test', { | ||
testCases: [testCase], | ||
}); |