Skip to content
v2.278.0

TopicGrants Facade ​

Collection of grant methods for a ITopicRef.

Example ​

ts
const topic = new sns.Topic(this, 'Topic');

// This would work the same way if topic was a CfnTopic (L1)
sns.TopicGrants.fromTopic(topic).subscribe(new iam.AnyPrincipal());
python
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())
java
Topic topic = new Topic(this, "Topic");

// This would work the same way if topic was a CfnTopic (L1)
TopicGrants.fromTopic(topic).subscribe(new AnyPrincipal());
csharp
// Install: dotnet add package Amazon.CDK.Lib
var topic = new Topic(this, "Topic");

// This would work the same way if topic was a CfnTopic (L1)
TopicGrants.FromTopic(topic).Subscribe(new AnyPrincipal());
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
topic := sns.NewTopic(this, jsii.String("Topic"))

// This would work the same way if topic was a CfnTopic (L1)
sns.TopicGrants_FromTopic(topic).Subscribe(iam.NewAnyPrincipal())

Methods ​

actions(grantee: IGrantable, actions: string[], options?: EncryptedPermissionsOptions): Grantdef actions(self, grantee: IGrantable, actions: typing.List[str], options: typing.Optional[EncryptedPermissionsOptions] = None) -> Grantpublic Grant actions(IGrantable grantee, List<String> actions, EncryptedPermissionsOptions options)public Grant Actions(IGrantable grantee, string[] actions, EncryptedPermissionsOptions? options = null)func Actions(Grantee IGrantable, Actions *[]*string, Options EncryptedPermissionsOptions) Grant #
Grant the given identity custom permissions.
fromTopic(resource: ITopicRef): TopicGrants // chainable@staticmethod def from_topic(resource: ITopicRef) -> TopicGrantspublic static TopicGrants fromTopic(ITopicRef resource)public static TopicGrants FromTopic(ITopicRef resource)func FromTopic(Resource ITopicRef) TopicGrants static #
Creates grants for TopicGrants.
publish(grantee: IGrantable): Grantdef publish(self, grantee: IGrantable) -> Grantpublic Grant publish(IGrantable grantee)public Grant Publish(IGrantable grantee)func Publish(Grantee IGrantable) Grant #
Grant topic publishing permissions to the given identity.
subscribe(grantee: IGrantable): Grantdef subscribe(self, grantee: IGrantable) -> Grantpublic Grant subscribe(IGrantable grantee)public Grant Subscribe(IGrantable grantee)func Subscribe(Grantee IGrantable) Grant #
Grant topic subscribing permissions to the given identity.