aws-cdk-lib
Version:
Version 2 of the AWS Cloud Development Kit library
51 lines (50 loc) • 1.73 kB
TypeScript
import { TargetBaseProps } from './util';
import * as events from '../../aws-events';
import * as iam from '../../aws-iam';
import * as sns from '../../aws-sns';
/**
* Customize the SNS Topic Event Target
*/
export interface SnsTopicProps extends TargetBaseProps {
/**
* The message to send to the topic
*
* @default the entire EventBridge event
*/
readonly message?: events.RuleTargetInput;
/**
* Specifies whether an IAM role should be used to publish to the topic
*
* @default - true if `role` is provided, false otherwise
*/
readonly authorizeUsingRole?: boolean;
/**
* The IAM role to be used to publish to the topic
*
* @default - a new role will be created if `authorizeUsingRole` is true
*/
readonly role?: iam.IRole;
}
/**
* Use an SNS topic as a target for Amazon EventBridge rules.
* If the topic is imported the required permissions to publish to that topic need to be set manually.
*
* @example
* /// fixture=withRepoAndTopic
* // publish to an SNS topic every time code is committed
* // to a CodeCommit repository
* repository.onCommit('onCommit', { target: new targets.SnsTopic(topic) });
*
*/
export declare class SnsTopic implements events.IRuleTarget {
readonly topic: sns.ITopic;
private readonly props;
constructor(topic: sns.ITopic, props?: SnsTopicProps);
/**
* Returns a RuleTarget that can be used to trigger this SNS topic as a
* result from an EventBridge event.
*
* @see https://docs.aws.amazon.com/eventbridge/latest/userguide/resource-based-policies-eventbridge.html#sns-permissions
*/
bind(_rule: events.IRule, _id?: string): events.RuleTargetConfig;
}