TopicGrants

class aws_cdk.aws_sns.TopicGrants(*args: Any, **kwargs)

Bases: object

Collection of grant methods for a ITopicRef.

ExampleMetadata:

infused

Example:

topic = sns.Topic(self, "Topic")

# This would work the same way if topic was a CfnTopic (L1)
sns.TopicGrants.from_topic(topic).subscribe(iam.AnyPrincipal())

Methods

actions(grantee, actions, *, key_actions=None, resource_arns=None)

Grant the given identity custom permissions.

Parameters:
  • grantee (IGrantable)

  • actions (Sequence[str])

  • key_actions (Optional[Sequence[str]]) – The KMS key actions to grant permissions for. Default: - No permission is added to the KMS key, even if it exists

  • resource_arns (Optional[Sequence[str]]) – The ARNs of the resources to grant permissions on. Default: - The ARN of the resource associated with the grant is used.

Return type:

Grant

publish(grantee)

Grant topic publishing permissions to the given identity.

Parameters:

grantee (IGrantable)

Return type:

Grant

subscribe(grantee)

Grant topic subscribing permissions to the given identity.

Parameters:

grantee (IGrantable)

Return type:

Grant

Static Methods

classmethod from_topic(resource)

Creates grants for TopicGrants.

Parameters:

resource (ITopicRef)

Return type:

TopicGrants