Skip to content

Commit e5f6e95

Browse files
committed
Merge branch 'main' into 36653
2 parents f6297cb + d0850af commit e5f6e95

287 files changed

Lines changed: 139249 additions & 137332 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

docs/DESIGN_GUIDELINES.md

Lines changed: 44 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1165,9 +1165,50 @@ export abstract class TopicBase extends Resource implements ITopic, IEncryptedRe
11651165
}
11661166
```
11671167

1168-
The `TopicGrants` class, and many others, are generated automatically. But if there
1169-
is no auto-generated grants class for a resource, you can implement it manually,
1170-
following the same patterns.
1168+
The `TopicGrants` class, and many others, are generated automatically from the `grants.json`
1169+
file present at the root of each individual module (`packages/aws-sns` for SNS constructs and
1170+
so on). The `grants.json` file has the following general structure:
1171+
1172+
```json
1173+
{
1174+
"resources": {
1175+
"Topic": {
1176+
"hasResourcePolicy": true,
1177+
"grants": {
1178+
"publish": {
1179+
"actions": ["sns:Publish"],
1180+
"keyActions": ["kms:Decrypt", "kms:GenerateDataKey*"],
1181+
"docSummary": "Grant topic publishing permissions to the given identity"
1182+
},
1183+
"subscribe": {
1184+
"actions": ["sns:Subscribe"],
1185+
"arnFormat": "${topicArn}/*"
1186+
}
1187+
}
1188+
}
1189+
}
1190+
}
1191+
```
1192+
1193+
where:
1194+
1195+
* `Topic` - the class to generate grants for. This will lead to a class named TopicGrants.
1196+
* `hasResourcePolicy` - indicates whether the resource supports a resource policy. When true, all auto-generated methods in the Grants class will attempt to add statements to the resource policy when applicable. When false, the methods will only modify the principal's policy.
1197+
* `publish` - the name of a grant.
1198+
* `actions` - the actions to encompass in the grant.
1199+
* `keyActions` - if the resource has an associated KMS key, also grant these permissions on the key. Notice that the resource must implement the `iam.IEncryptedResource` interface for this to work.
1200+
* `docSummary` - the public documentation for the method.
1201+
* `arnFormat` - In some cases, the policy applies to a specific ARN patterns, rather than just the ARN of the resource.
1202+
1203+
In some cases, however, it might not be possible to specify the grant details using the `grants.json`
1204+
file. This is usually the case when grants require additional logic, such as checking whether the
1205+
resource is owned or unowned, or when the grant needs to modify the resource policy of the resource
1206+
(if it has one). In these cases, you can implement the grants class manually.
1207+
1208+
Historically, grant methods were implemented directly on the resource construct interface (e.g.
1209+
`sns.ITopic.grantPublish(principal)`). For backward compatibility reasons, these methods are still
1210+
present on the resource interfaces, but new grant implementations are only allowed through the Grants
1211+
classes [_awslint:no-grants_].
11711212

11721213
### Metrics
11731214

packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.cross-account-pipeline-cfn-action.js.snapshot/CdkPipelineCfnActionStack.assets.json

Lines changed: 7 additions & 7 deletions
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-codepipeline-actions/test/integ.cross-account-pipeline-cfn-action.js.snapshot/CdkPipelineCfnActionStack.template.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@
198198
"Properties": {
199199
"Content": {
200200
"S3Bucket": "cdk-hnb659fds-assets-12345678-test-region",
201-
"S3Key": "c82567645316e1499ecd064c937f1183bb4a74e95800ff64fab4d308451ba5f0.zip"
201+
"S3Key": "0cfdecad2260a3a84ad0c2d08a77e03c9d25e26c7b52f26b1e1faf97aef92f18.zip"
202202
},
203203
"Description": "/opt/awscli/aws"
204204
}

packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.cross-account-pipeline-cfn-action.js.snapshot/asset.0cfdecad2260a3a84ad0c2d08a77e03c9d25e26c7b52f26b1e1faf97aef92f18.zip

Lines changed: 3 additions & 0 deletions
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-codepipeline-actions/test/integ.cross-account-pipeline-cfn-action.js.snapshot/asset.c82567645316e1499ecd064c937f1183bb4a74e95800ff64fab4d308451ba5f0.zip

Lines changed: 0 additions & 3 deletions
This file was deleted.

packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.cross-account-pipeline-cfn-action.js.snapshot/manifest.json

Lines changed: 3 additions & 45 deletions
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-codepipeline-actions/test/integ.cross-account-pipeline-cfn-action.js.snapshot/tree.json

Lines changed: 1 addition & 1 deletion
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-codepipeline-actions/test/integ.cross-account-pipeline-sfn-action.js.snapshot/CdkPipelineStepFunctionsActionStack.assets.json

Lines changed: 7 additions & 7 deletions
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-codepipeline-actions/test/integ.cross-account-pipeline-sfn-action.js.snapshot/CdkPipelineStepFunctionsActionStack.template.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@
199199
"Properties": {
200200
"Content": {
201201
"S3Bucket": "cdk-hnb659fds-assets-12345678-test-region",
202-
"S3Key": "c82567645316e1499ecd064c937f1183bb4a74e95800ff64fab4d308451ba5f0.zip"
202+
"S3Key": "0cfdecad2260a3a84ad0c2d08a77e03c9d25e26c7b52f26b1e1faf97aef92f18.zip"
203203
},
204204
"Description": "/opt/awscli/aws"
205205
}

packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.cross-account-pipeline-sfn-action.js.snapshot/asset.0cfdecad2260a3a84ad0c2d08a77e03c9d25e26c7b52f26b1e1faf97aef92f18.zip

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)