# TopicGrants

Collection of grant methods for a ITopicRef.

- Source: Generated code
- Type last changed: v2.244.0 · 19 Mar 2026

## 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());
```

## Methods

- `actions(grantee: IGrantable, actions: string[], options?: EncryptedPermissionsOptions): Grant` — Grant the given identity custom permissions.

- `fromTopic(resource: ITopicRef): TopicGrants // chainable` (static) — Creates grants for TopicGrants.

- `publish(grantee: IGrantable): Grant` — Grant topic publishing permissions to the given identity.

- `subscribe(grantee: IGrantable): Grant` — Grant topic subscribing permissions to the given identity.
