notification-rule.d.ts
  1  import { IResource, Resource } from '@aws-cdk/core';
  2  import * as constructs from 'constructs';
  3  import { INotificationRuleSource } from './notification-rule-source';
  4  import { INotificationRuleTarget } from './notification-rule-target';
  5  /**
  6   * The level of detail to include in the notifications for this resource.
  7   *
  8   * @stability stable
  9   */
 10  export declare enum DetailType {
 11      /**
 12       * BASIC will include only the contents of the event as it would appear in AWS CloudWatch.
 13       *
 14       * @stability stable
 15       */
 16      BASIC = "BASIC",
 17      /**
 18       * FULL will include any supplemental information provided by AWS CodeStar Notifications and/or the service for the resource for which the notification is created.
 19       *
 20       * @stability stable
 21       */
 22      FULL = "FULL"
 23  }
 24  /**
 25   * Standard set of options for `notifyOnXxx` codestar notification handler on construct.
 26   *
 27   * @stability stable
 28   */
 29  export interface NotificationRuleOptions {
 30      /**
 31       * The name for the notification rule.
 32       *
 33       * Notification rule names must be unique in your AWS account.
 34       *
 35       * @default - generated from the `id`
 36       * @stability stable
 37       */
 38      readonly notificationRuleName?: string;
 39      /**
 40       * The status of the notification rule.
 41       *
 42       * If the enabled is set to DISABLED, notifications aren't sent for the notification rule.
 43       *
 44       * @default true
 45       * @stability stable
 46       */
 47      readonly enabled?: boolean;
 48      /**
 49       * The level of detail to include in the notifications for this resource.
 50       *
 51       * BASIC will include only the contents of the event as it would appear in AWS CloudWatch.
 52       * FULL will include any supplemental information provided by AWS CodeStar Notifications and/or the service for the resource for which the notification is created.
 53       *
 54       * @default DetailType.FULL
 55       * @stability stable
 56       */
 57      readonly detailType?: DetailType;
 58  }
 59  /**
 60   * Properties for a new notification rule.
 61   *
 62   * @stability stable
 63   */
 64  export interface NotificationRuleProps extends NotificationRuleOptions {
 65      /**
 66       * A list of event types associated with this notification rule.
 67       *
 68       * For a complete list of event types and IDs, see Notification concepts in the Developer Tools Console User Guide.
 69       *
 70       * @see https://docs.aws.amazon.com/dtconsole/latest/userguide/concepts.html#concepts-api
 71       * @stability stable
 72       */
 73      readonly events: string[];
 74      /**
 75       * The Amazon Resource Name (ARN) of the resource to associate with the notification rule.
 76       *
 77       * Currently, Supported sources include pipelines in AWS CodePipeline, build projects in AWS CodeBuild, and repositories in AWS CodeCommit in this L2 constructor.
 78       *
 79       * @see https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-codestarnotifications-notificationrule.html#cfn-codestarnotifications-notificationrule-resource
 80       * @stability stable
 81       */
 82      readonly source: INotificationRuleSource;
 83      /**
 84       * The targets to register for the notification destination.
 85       *
 86       * @default - No targets are added to the rule. Use `addTarget()` to add a target.
 87       * @stability stable
 88       */
 89      readonly targets?: INotificationRuleTarget[];
 90  }
 91  /**
 92   * Represents a notification rule.
 93   *
 94   * @stability stable
 95   */
 96  export interface INotificationRule extends IResource {
 97      /**
 98       * The ARN of the notification rule (i.e. arn:aws:codestar-notifications:::notificationrule/01234abcde).
 99       *
100       * @stability stable
101       * @attribute true
102       */
103      readonly notificationRuleArn: string;
104      /**
105       * Adds target to notification rule.
106       *
107       * @param target The SNS topic or AWS Chatbot Slack target.
108       * @returns boolean - return true if it had any effect
109       * @stability stable
110       */
111      addTarget(target: INotificationRuleTarget): boolean;
112  }
113  /**
114   * A new notification rule.
115   *
116   * @stability stable
117   * @resource AWS::CodeStarNotifications::NotificationRule
118   */
119  export declare class NotificationRule extends Resource implements INotificationRule {
120      /**
121       * Import an existing notification rule provided an ARN.
122       *
123       * @param scope The parent creating construct.
124       * @param id The construct's name.
125       * @param notificationRuleArn Notification rule ARN (i.e. arn:aws:codestar-notifications:::notificationrule/01234abcde).
126       * @stability stable
127       */
128      static fromNotificationRuleArn(scope: constructs.Construct, id: string, notificationRuleArn: string): INotificationRule;
129      /**
130       * The ARN of the notification rule (i.e. arn:aws:codestar-notifications:::notificationrule/01234abcde).
131       *
132       * @stability stable
133       * @attribute true
134       */
135      readonly notificationRuleArn: string;
136      private readonly targets;
137      private readonly events;
138      /**
139       * @stability stable
140       */
141      constructor(scope: constructs.Construct, id: string, props: NotificationRuleProps);
142      /**
143       * Adds target to notification rule.
144       *
145       * @param target The SNS topic or AWS Chatbot Slack target.
146       * @stability stable
147       */
148      addTarget(target: INotificationRuleTarget): boolean;
149      /**
150       * Adds events to notification rule
151       *
152       * @see https://docs.aws.amazon.com/dtconsole/latest/userguide/concepts.html#events-ref-pipeline
153       * @see https://docs.aws.amazon.com/dtconsole/latest/userguide/concepts.html#events-ref-buildproject
154       * @param events The list of event types for AWS Codebuild and AWS CodePipeline
155       */
156      private addEvents;
157  }