-
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.
feat(logs): configure custom subscription filter name (#26498)
Currently, we can't set the subscription filter name as a prop for L2 SubscriptionFilter construct. This PR introduces the new prop `filterName`. This will let us set a specific name without requiring escape hatches. Closes #26485 ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
- Loading branch information
Showing
14 changed files
with
738 additions
and
2 deletions.
There are no files selected for viewing
20 changes: 20 additions & 0 deletions
20
...gs/test/integ.subscriptionfilter.js.snapshot/aws-cdk-subscriptionfilter-integ.assets.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,20 @@ | ||
{ | ||
"version": "32.0.0", | ||
"files": { | ||
"7db545e495a738edfcd36389d734d374090aa78c8532312439ddb90cfffdc1ef": { | ||
"source": { | ||
"path": "aws-cdk-subscriptionfilter-integ.template.json", | ||
"packaging": "file" | ||
}, | ||
"destinations": { | ||
"355939527584-us-east-1": { | ||
"bucketName": "cdk-hnb659fds-assets-355939527584-us-east-1", | ||
"objectKey": "7db545e495a738edfcd36389d734d374090aa78c8532312439ddb90cfffdc1ef.json", | ||
"region": "us-east-1", | ||
"assumeRoleArn": "arn:${AWS::Partition}:iam::355939527584:role/cdk-hnb659fds-file-publishing-role-355939527584-us-east-1" | ||
} | ||
} | ||
} | ||
}, | ||
"dockerImages": {} | ||
} |
134 changes: 134 additions & 0 deletions
134
.../test/integ.subscriptionfilter.js.snapshot/aws-cdk-subscriptionfilter-integ.template.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,134 @@ | ||
{ | ||
"Resources": { | ||
"LogGroupF5B46931": { | ||
"Type": "AWS::Logs::LogGroup", | ||
"Properties": { | ||
"RetentionInDays": 731 | ||
}, | ||
"UpdateReplacePolicy": "Retain", | ||
"DeletionPolicy": "Retain" | ||
}, | ||
"LogGroupSubscriptionCanInvokeLambdaE05AC235": { | ||
"Type": "AWS::Lambda::Permission", | ||
"Properties": { | ||
"Action": "lambda:InvokeFunction", | ||
"FunctionName": { | ||
"Fn::GetAtt": [ | ||
"Function76856677", | ||
"Arn" | ||
] | ||
}, | ||
"Principal": "logs.amazonaws.com", | ||
"SourceArn": { | ||
"Fn::GetAtt": [ | ||
"LogGroupF5B46931", | ||
"Arn" | ||
] | ||
} | ||
} | ||
}, | ||
"LogGroupSubscriptionE3573E29": { | ||
"Type": "AWS::Logs::SubscriptionFilter", | ||
"Properties": { | ||
"DestinationArn": { | ||
"Fn::GetAtt": [ | ||
"Function76856677", | ||
"Arn" | ||
] | ||
}, | ||
"FilterName": "CustomSubscriptionFilterName", | ||
"FilterPattern": "\"ERROR\" \"MainThread\"", | ||
"LogGroupName": { | ||
"Ref": "LogGroupF5B46931" | ||
} | ||
}, | ||
"DependsOn": [ | ||
"LogGroupSubscriptionCanInvokeLambdaE05AC235" | ||
] | ||
}, | ||
"FunctionServiceRole675BB04A": { | ||
"Type": "AWS::IAM::Role", | ||
"Properties": { | ||
"AssumeRolePolicyDocument": { | ||
"Statement": [ | ||
{ | ||
"Action": "sts:AssumeRole", | ||
"Effect": "Allow", | ||
"Principal": { | ||
"Service": "lambda.amazonaws.com" | ||
} | ||
} | ||
], | ||
"Version": "2012-10-17" | ||
}, | ||
"ManagedPolicyArns": [ | ||
{ | ||
"Fn::Join": [ | ||
"", | ||
[ | ||
"arn:", | ||
{ | ||
"Ref": "AWS::Partition" | ||
}, | ||
":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" | ||
] | ||
] | ||
} | ||
] | ||
} | ||
}, | ||
"Function76856677": { | ||
"Type": "AWS::Lambda::Function", | ||
"Properties": { | ||
"Code": { | ||
"ZipFile": "foo" | ||
}, | ||
"Handler": "index.handler", | ||
"Role": { | ||
"Fn::GetAtt": [ | ||
"FunctionServiceRole675BB04A", | ||
"Arn" | ||
] | ||
}, | ||
"Runtime": "nodejs18.x" | ||
}, | ||
"DependsOn": [ | ||
"FunctionServiceRole675BB04A" | ||
] | ||
} | ||
}, | ||
"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." | ||
} | ||
] | ||
} | ||
} | ||
} |
1 change: 1 addition & 0 deletions
1
...k-testing/framework-integ/test/aws-logs/test/integ.subscriptionfilter.js.snapshot/cdk.out
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 @@ | ||
{"version":"32.0.0"} |
12 changes: 12 additions & 0 deletions
12
...esting/framework-integ/test/aws-logs/test/integ.subscriptionfilter.js.snapshot/integ.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,12 @@ | ||
{ | ||
"version": "32.0.0", | ||
"testCases": { | ||
"integ-test/DefaultTest": { | ||
"stacks": [ | ||
"aws-cdk-subscriptionfilter-integ" | ||
], | ||
"assertionStack": "integ-test/DefaultTest/DeployAssert", | ||
"assertionStackName": "integtestDefaultTestDeployAssert24D5C536" | ||
} | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
...integ.subscriptionfilter.js.snapshot/integtestDefaultTestDeployAssert24D5C536.assets.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,19 @@ | ||
{ | ||
"version": "32.0.0", | ||
"files": { | ||
"21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22": { | ||
"source": { | ||
"path": "integtestDefaultTestDeployAssert24D5C536.template.json", | ||
"packaging": "file" | ||
}, | ||
"destinations": { | ||
"current_account-current_region": { | ||
"bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", | ||
"objectKey": "21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22.json", | ||
"assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" | ||
} | ||
} | ||
} | ||
}, | ||
"dockerImages": {} | ||
} |
36 changes: 36 additions & 0 deletions
36
...teg.subscriptionfilter.js.snapshot/integtestDefaultTestDeployAssert24D5C536.template.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,36 @@ | ||
{ | ||
"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." | ||
} | ||
] | ||
} | ||
} | ||
} |
135 changes: 135 additions & 0 deletions
135
...ing/framework-integ/test/aws-logs/test/integ.subscriptionfilter.js.snapshot/manifest.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,135 @@ | ||
{ | ||
"version": "32.0.0", | ||
"artifacts": { | ||
"aws-cdk-subscriptionfilter-integ.assets": { | ||
"type": "cdk:asset-manifest", | ||
"properties": { | ||
"file": "aws-cdk-subscriptionfilter-integ.assets.json", | ||
"requiresBootstrapStackVersion": 6, | ||
"bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" | ||
} | ||
}, | ||
"aws-cdk-subscriptionfilter-integ": { | ||
"type": "aws:cloudformation:stack", | ||
"environment": "aws://355939527584/us-east-1", | ||
"properties": { | ||
"templateFile": "aws-cdk-subscriptionfilter-integ.template.json", | ||
"validateOnSynth": false, | ||
"assumeRoleArn": "arn:${AWS::Partition}:iam::355939527584:role/cdk-hnb659fds-deploy-role-355939527584-us-east-1", | ||
"cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::355939527584:role/cdk-hnb659fds-cfn-exec-role-355939527584-us-east-1", | ||
"stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-355939527584-us-east-1/7db545e495a738edfcd36389d734d374090aa78c8532312439ddb90cfffdc1ef.json", | ||
"requiresBootstrapStackVersion": 6, | ||
"bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", | ||
"additionalDependencies": [ | ||
"aws-cdk-subscriptionfilter-integ.assets" | ||
], | ||
"lookupRole": { | ||
"arn": "arn:${AWS::Partition}:iam::355939527584:role/cdk-hnb659fds-lookup-role-355939527584-us-east-1", | ||
"requiresBootstrapStackVersion": 8, | ||
"bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" | ||
} | ||
}, | ||
"dependencies": [ | ||
"aws-cdk-subscriptionfilter-integ.assets" | ||
], | ||
"metadata": { | ||
"/aws-cdk-subscriptionfilter-integ/LogGroup/Resource": [ | ||
{ | ||
"type": "aws:cdk:logicalId", | ||
"data": "LogGroupF5B46931" | ||
} | ||
], | ||
"/aws-cdk-subscriptionfilter-integ/LogGroup/Subscription/CanInvokeLambda": [ | ||
{ | ||
"type": "aws:cdk:logicalId", | ||
"data": "LogGroupSubscriptionCanInvokeLambdaE05AC235" | ||
} | ||
], | ||
"/aws-cdk-subscriptionfilter-integ/LogGroup/Subscription/Resource": [ | ||
{ | ||
"type": "aws:cdk:logicalId", | ||
"data": "LogGroupSubscriptionE3573E29" | ||
} | ||
], | ||
"/aws-cdk-subscriptionfilter-integ/Function/ServiceRole/Resource": [ | ||
{ | ||
"type": "aws:cdk:logicalId", | ||
"data": "FunctionServiceRole675BB04A" | ||
} | ||
], | ||
"/aws-cdk-subscriptionfilter-integ/Function/Resource": [ | ||
{ | ||
"type": "aws:cdk:logicalId", | ||
"data": "Function76856677" | ||
} | ||
], | ||
"/aws-cdk-subscriptionfilter-integ/BootstrapVersion": [ | ||
{ | ||
"type": "aws:cdk:logicalId", | ||
"data": "BootstrapVersion" | ||
} | ||
], | ||
"/aws-cdk-subscriptionfilter-integ/CheckBootstrapVersion": [ | ||
{ | ||
"type": "aws:cdk:logicalId", | ||
"data": "CheckBootstrapVersion" | ||
} | ||
] | ||
}, | ||
"displayName": "aws-cdk-subscriptionfilter-integ" | ||
}, | ||
"integtestDefaultTestDeployAssert24D5C536.assets": { | ||
"type": "cdk:asset-manifest", | ||
"properties": { | ||
"file": "integtestDefaultTestDeployAssert24D5C536.assets.json", | ||
"requiresBootstrapStackVersion": 6, | ||
"bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" | ||
} | ||
}, | ||
"integtestDefaultTestDeployAssert24D5C536": { | ||
"type": "aws:cloudformation:stack", | ||
"environment": "aws://unknown-account/unknown-region", | ||
"properties": { | ||
"templateFile": "integtestDefaultTestDeployAssert24D5C536.template.json", | ||
"validateOnSynth": false, | ||
"assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", | ||
"cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", | ||
"stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22.json", | ||
"requiresBootstrapStackVersion": 6, | ||
"bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", | ||
"additionalDependencies": [ | ||
"integtestDefaultTestDeployAssert24D5C536.assets" | ||
], | ||
"lookupRole": { | ||
"arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-${AWS::Region}", | ||
"requiresBootstrapStackVersion": 8, | ||
"bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" | ||
} | ||
}, | ||
"dependencies": [ | ||
"integtestDefaultTestDeployAssert24D5C536.assets" | ||
], | ||
"metadata": { | ||
"/integ-test/DefaultTest/DeployAssert/BootstrapVersion": [ | ||
{ | ||
"type": "aws:cdk:logicalId", | ||
"data": "BootstrapVersion" | ||
} | ||
], | ||
"/integ-test/DefaultTest/DeployAssert/CheckBootstrapVersion": [ | ||
{ | ||
"type": "aws:cdk:logicalId", | ||
"data": "CheckBootstrapVersion" | ||
} | ||
] | ||
}, | ||
"displayName": "integ-test/DefaultTest/DeployAssert" | ||
}, | ||
"Tree": { | ||
"type": "cdk:tree", | ||
"properties": { | ||
"file": "tree.json" | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.