Skip to content

docs(sns): expand grant* JSDoc with granted actions#37991

Open
MukundaKatta wants to merge 1 commit into
aws:mainfrom
MukundaKatta:docs/sns-topic-grant-permissions-jsdoc
Open

docs(sns): expand grant* JSDoc with granted actions#37991
MukundaKatta wants to merge 1 commit into
aws:mainfrom
MukundaKatta:docs/sns-topic-grant-permissions-jsdoc

Conversation

@MukundaKatta
Copy link
Copy Markdown

Issue # (if applicable)

Closes #35736.

Reason for this change

The SNS Topic API reference is light on detail compared to SQS. In particular, grantPublish and grantSubscribe do not list the IAM and KMS actions they grant, so users have to read the source to confirm whether SSE-encrypted topics are handled correctly.

Description of changes

JSDoc-only update on ITopic and TopicBase in packages/aws-cdk-lib/aws-sns/lib/topic-base.ts:

  • grantPublish: lists the granted IAM action (sns:Publish) and the KMS actions (kms:Decrypt, kms:GenerateDataKey*) added when the topic is encrypted with a customer-managed KMS key. Adds a @see link to the SNS server-side encryption docs.
  • grantSubscribe: lists the granted IAM action (sns:Subscribe) and clarifies that this only grants permission to call the Subscribe API, not to receive messages on a particular delivery protocol. Notes that KMS permissions are not required for subscribing.

Follows the same JSDoc style already used by grantConsumeMessages / grantSendMessages in packages/aws-cdk-lib/aws-sqs/lib/queue-base.ts.

Describe any new or updated permissions being added

None. This PR is documentation only and does not change any granted permissions or generated CloudFormation output.

Description of how you validated changes

  • Confirmed the listed actions against existing unit tests in packages/aws-cdk-lib/aws-sns/test/sns.test.ts:
    • give publishing permissions to CfnTopic asserts sns:Publish.
    • give service principal permissions to publish to CfnTopic with encryption key asserts kms:Decrypt and kms:GenerateDataKey* on the master key.
    • give subscribing permissions asserts sns:Subscribe.
  • No runtime/behavior changes, so no new tests added.

Checklist


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

List the IAM and KMS permissions granted by grantPublish and
grantSubscribe so users can see what the helpers do without reading
the source.

Closes aws#35736
@github-actions github-actions Bot added beginning-contributor [Pilot] contributed between 0-2 PRs to the CDK effort/small Small work item – less than a day of effort p2 labels May 24, 2026
Copy link
Copy Markdown
Collaborator

@aws-cdk-automation aws-cdk-automation left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(This review is outdated)

@MukundaKatta MukundaKatta changed the title docs(aws-sns): expand grant* JSDoc with granted actions docs(sns): expand grant* JSDoc with granted actions May 27, 2026
@aws-cdk-automation aws-cdk-automation dismissed their stale review May 27, 2026 05:45

✅ Updated pull request passes all PRLinter validations. Dismissing previous PRLinter review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

beginning-contributor [Pilot] contributed between 0-2 PRs to the CDK effort/small Small work item – less than a day of effort p2

Projects

None yet

Development

Successfully merging this pull request may close these issues.

sns: Add details to aws_cdk.aws_sns/Topic.html documentation

2 participants