class TopicGrants
| Language | Type name |
|---|---|
.NET | Amazon.CDK.AWS.SNS.TopicGrants |
Go | github.com/aws/aws-cdk-go/awscdk/v2/awssns#TopicGrants |
Java | software.amazon.awscdk.services.sns.TopicGrants |
Python | aws_cdk.aws_sns.TopicGrants |
TypeScript | aws-cdk-lib » aws_sns » TopicGrants |
Collection of grant methods for a ITopicRef.
Example
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());
Properties
| Name | Type | Description |
|---|---|---|
| resource | ITopic | |
| encrypted | IEncrypted | |
| policy | IResource |
resource
Type:
ITopic
encryptedResource?
Type:
IEncrypted
(optional)
policyResource?
Type:
IResource
(optional)
Methods
| Name | Description |
|---|---|
| actions(grantee, actions, options?) | Grant the given identity custom permissions. |
| publish(grantee) | Grant topic publishing permissions to the given identity. |
| subscribe(grantee) | Grant topic subscribing permissions to the given identity. |
| static from | Creates grants for TopicGrants. |
actions(grantee, actions, options?)
public actions(grantee: IGrantable, actions: string[], options?: EncryptedPermissionsOptions): Grant
Parameters
- grantee
IGrantable - actions
string[] - options
EncryptedPermissions Options
Returns
Grant the given identity custom permissions.
publish(grantee)
public publish(grantee: IGrantable): Grant
Parameters
- grantee
IGrantable
Returns
Grant topic publishing permissions to the given identity.
subscribe(grantee)
public subscribe(grantee: IGrantable): Grant
Parameters
- grantee
IGrantable
Returns
Grant topic subscribing permissions to the given identity.
static fromTopic(resource)
public static fromTopic(resource: ITopicRef): TopicGrants
Parameters
- resource
ITopicRef
Returns
Creates grants for TopicGrants.

.NET
Go
Java
Python
TypeScript