UNPKG

1.32 kBTypeScriptView Raw
1import { SubscriptionOptions } from './subscription';
2import { ITopic } from './topic-base';
3import { Construct } from '@aws-cdk/core';
4/**
5 * Subscription configuration
6 */
7export interface TopicSubscriptionConfig extends SubscriptionOptions {
8 /**
9 * The scope in which to create the SNS subscription resource. Normally you'd
10 * want the subscription to be created on the consuming stack because the
11 * topic is usually referenced by the consumer's resource policy (e.g. SQS
12 * queue policy). Otherwise, it will cause a cyclic reference.
13 *
14 * If this is undefined, the subscription will be created on the topic's stack.
15 *
16 * @default - use the topic as the scope of the subscription, in which case `subscriberId` must be defined.
17 */
18 readonly subscriberScope?: Construct;
19 /**
20 * The id of the SNS subscription resource created under `scope`. In most
21 * cases, it is recommended to use the `uniqueId` of the topic you are
22 * subscribing to.
23 */
24 readonly subscriberId: string;
25}
26/**
27 * Topic subscription
28 */
29export interface ITopicSubscription {
30 /**
31 * Returns a configuration used to subscribe to an SNS topic
32 *
33 * @param topic topic for which subscription will be configured
34 */
35 bind(topic: ITopic): TopicSubscriptionConfig;
36}