AWS::CodeStarNotifications::NotificationRule - AWS CloudFormation

AWS::CodeStarNotifications::NotificationRule

Creates a notification rule for a resource. The rule specifies the events you want notifications about and the targets (such as Amazon SNS topics or AWS Chatbot clients configured for Slack) where you want to receive them.

Syntax

To declare this entity in your AWS CloudFormation template, use the following syntax:

JSON

{ "Type" : "AWS::CodeStarNotifications::NotificationRule", "Properties" : { "DetailType" : String, "EventTypeIds" : [ String, ... ], "Name" : String, "Resource" : String, "Status" : String, "Tags" : Json, "Targets" : [ Target, ... ] } }

YAML

Type: AWS::CodeStarNotifications::NotificationRule Properties: DetailType: String EventTypeIds: - String Name: String Resource: String Status: String Tags: Json Targets: - Target

Properties

DetailType

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.

Required: Yes

Type: String

Allowed values: BASIC | FULL

Update requires: No interruption

EventTypeIds

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.

Required: Yes

Type: List of String

Update requires: No interruption

Name

The name for the notification rule. Notification rule names must be unique in your AWS account.

Required: Yes

Type: String

Minimum: 1

Maximum: 64

Pattern: [A-Za-z0-9\-_ ]+$

Update requires: No interruption

Resource

The Amazon Resource Name (ARN) of the resource to associate with the notification rule. Supported resources include pipelines in AWS CodePipeline, repositories in AWS CodeCommit, and build projects in AWS CodeBuild.

Required: Yes

Type: String

Pattern: ^arn:aws[^:\s]*:[^:\s]*:[^:\s]*:[0-9]{12}:[^\s]+$

Update requires: Replacement

Status

The status of the notification rule. The default value is ENABLED. If the status is set to DISABLED, notifications aren't sent for the notification rule.

Required: No

Type: String

Allowed values: DISABLED | ENABLED

Update requires: No interruption

Tags

A list of tags to apply to this notification rule. Key names cannot start with "aws".

Required: No

Type: Json

Update requires: Replacement

Targets

A list of Amazon Resource Names (ARNs) of Amazon SNS topics and AWS Chatbot clients to associate with the notification rule.

Required: Yes

Type: List of Target

Maximum: 10

Update requires: No interruption

Return values

Ref

When the logical ID of this resource is provided to the Ref intrinsic function, Ref returns the notification rule ARN.

Examples

Example

The following example creates a notification rule with a name of My Notification Rule for Comments on Commits. The notification rule is tagged with a key-value pair indicating what team owns the rule.

JSON

{ "Type": "AWS::CodeStarNotifications::NotificationRule", "Properties": { "Name": "My Notification Rule for Comments on Commits", "DetailType": "FULL", "Resource": "arn:aws:codecommit:us-east-2:123456789012:MyDemoRepo", "EventTypeIds": [ "codecommit-repository-comments-on-commits" ], "Targets": [ { "TargetType": "SNS", "TargetAddress": { "Fn::Sub": "arn:aws:sns:us-east-2:123456789012:MyNotificationTopic" } } ], "Tags": { "Team": "Saanvi" } } }

YAML

Type: 'AWS::CodeStarNotifications::NotificationRule' Properties: Name: 'My Notification Rule for Comments on Commits' DetailType: FULL Resource: 'arn:aws:codecommit:us-east-2:123456789012:MyDemoRepo' EventTypeIds: - codecommit-repository-comments-on-commits Targets: - TargetType: SNS TargetAddress: 'Fn::Sub': 'arn:aws:sns:us-east-2:123456789012:MyNotificationTopic' Tags: Team: Saanvi