UNPKG

2.79 kBTypeScriptView Raw
1import * as notifications from '@aws-cdk/aws-codestarnotifications';
2import * as iam from '@aws-cdk/aws-iam';
3import { IResource, Resource } from '@aws-cdk/core';
4import * as constructs from 'constructs';
5import { ITopicSubscription } from './subscriber';
6/**
7 * Represents an SNS topic
8 */
9export interface ITopic extends IResource, notifications.INotificationRuleTarget {
10 /**
11 * The ARN of the topic
12 *
13 * @attribute
14 */
15 readonly topicArn: string;
16 /**
17 * The name of the topic
18 *
19 * @attribute
20 */
21 readonly topicName: string;
22 /**
23 * Whether this topic is an Amazon SNS FIFO queue. If false, this is a standard topic.
24 *
25 * @attribute
26 */
27 readonly fifo: boolean;
28 /**
29 * Subscribe some endpoint to this topic
30 */
31 addSubscription(subscription: ITopicSubscription): void;
32 /**
33 * Adds a statement to the IAM resource policy associated with this topic.
34 *
35 * If this topic was created in this stack (`new Topic`), a topic policy
36 * will be automatically created upon the first call to `addToPolicy`. If
37 * the topic is imported (`Topic.import`), then this is a no-op.
38 */
39 addToResourcePolicy(statement: iam.PolicyStatement): iam.AddToResourcePolicyResult;
40 /**
41 * Grant topic publishing permissions to the given identity
42 */
43 grantPublish(identity: iam.IGrantable): iam.Grant;
44}
45/**
46 * Either a new or imported Topic
47 */
48export declare abstract class TopicBase extends Resource implements ITopic {
49 abstract readonly topicArn: string;
50 abstract readonly topicName: string;
51 abstract readonly fifo: boolean;
52 /**
53 * Controls automatic creation of policy objects.
54 *
55 * Set by subclasses.
56 */
57 protected abstract readonly autoCreatePolicy: boolean;
58 private policy?;
59 /**
60 * Subscribe some endpoint to this topic
61 */
62 addSubscription(subscription: ITopicSubscription): void;
63 /**
64 * Adds a statement to the IAM resource policy associated with this topic.
65 *
66 * If this topic was created in this stack (`new Topic`), a topic policy
67 * will be automatically created upon the first call to `addToPolicy`. If
68 * the topic is imported (`Topic.import`), then this is a no-op.
69 */
70 addToResourcePolicy(statement: iam.PolicyStatement): iam.AddToResourcePolicyResult;
71 protected validate(): string[];
72 /**
73 * Grant topic publishing permissions to the given identity
74 */
75 grantPublish(grantee: iam.IGrantable): iam.Grant;
76 /**
77 * Represents a notification target
78 * That allows SNS topic to associate with this rule target.
79 */
80 bindAsNotificationRuleTarget(_scope: constructs.Construct): notifications.NotificationRuleTargetConfig;
81 private nextTokenId;
82}