aws-cdk-lib.aws_codestarnotifications.NotificationRuleProps

interface NotificationRuleProps

LanguageType name
.NETAmazon.CDK.AWS.CodeStarNotifications.NotificationRuleProps
Gogithub.com/aws/aws-cdk-go/awscdk/v2/awscodestarnotifications#NotificationRuleProps
Javasoftware.amazon.awscdk.services.codestarnotifications.NotificationRuleProps
Pythonaws_cdk.aws_codestarnotifications.NotificationRuleProps
TypeScript (source)aws-cdk-lib » aws_codestarnotifications » NotificationRuleProps

Properties for a new notification rule.

Example

import * as notifications from 'aws-cdk-lib/aws-codestarnotifications';
import * as codebuild from 'aws-cdk-lib/aws-codebuild';
import * as sns from 'aws-cdk-lib/aws-sns';
import * as chatbot from 'aws-cdk-lib/aws-chatbot';

const project = new codebuild.PipelineProject(this, 'MyProject');

const topic = new sns.Topic(this, 'MyTopic1');

const slack = new chatbot.SlackChannelConfiguration(this, 'MySlackChannel', {
  slackChannelConfigurationName: 'YOUR_CHANNEL_NAME',
  slackWorkspaceId: 'YOUR_SLACK_WORKSPACE_ID',
  slackChannelId: 'YOUR_SLACK_CHANNEL_ID',
});

const rule = new notifications.NotificationRule(this, 'NotificationRule', {
  source: project,
  events: [
    'codebuild-project-build-state-succeeded',
    'codebuild-project-build-state-failed',
  ],
  targets: [topic],
});
rule.addTarget(slack);

Properties

NameTypeDescription
eventsstring[]A list of event types associated with this notification rule.
sourceINotificationRuleSourceThe Amazon Resource Name (ARN) of the resource to associate with the notification rule.
detailType?DetailTypeThe level of detail to include in the notifications for this resource.
enabled?booleanThe status of the notification rule.
notificationRuleName?stringThe name for the notification rule.
targets?INotificationRuleTarget[]The targets to register for the notification destination.

events

Type: string[]

A list of event types associated with this notification rule.

For a complete list of event types and IDs, see Notification concepts in the Developer Tools Console User Guide.

See also: https://docs.aws.amazon.com/dtconsole/latest/userguide/concepts.html#concepts-api


source

Type: INotificationRuleSource

The Amazon Resource Name (ARN) of the resource to associate with the notification rule.

Currently, Supported sources include pipelines in AWS CodePipeline, build projects in AWS CodeBuild, and repositories in AWS CodeCommit in this L2 constructor.

See also: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-codestarnotifications-notificationrule.html#cfn-codestarnotifications-notificationrule-resource


detailType?

Type: DetailType (optional, default: DetailType.FULL)

The level of detail to include in the notifications for this resource.

BASIC will include only the contents of the event as it would appear in AWS CloudWatch. FULL will include any supplemental information provided by AWS CodeStar Notifications and/or the service for the resource for which the notification is created.


enabled?

Type: boolean (optional, default: true)

The status of the notification rule.

If the enabled is set to DISABLED, notifications aren't sent for the notification rule.


notificationRuleName?

Type: string (optional, default: generated from the id)

The name for the notification rule.

Notification rule names must be unique in your AWS account.


targets?

Type: INotificationRuleTarget[] (optional, default: No targets are added to the rule. Use addTarget() to add a target.)

The targets to register for the notification destination.