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 Simple Notification Service 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" : { "CreatedBy" : String, "DetailType" : String, "EventTypeId" : String, "EventTypeIds" : [ String, ... ], "Name" : String, "Resource" : String, "Status" : String, "Tags" : {Key: Value, ...}, "TargetAddress" : String, "Targets" : [ Target, ... ] } }

YAML

Type: AWS::CodeStarNotifications::NotificationRule Properties: CreatedBy: String DetailType: String EventTypeId: String EventTypeIds: - String Name: String Resource: String Status: String Tags: Key: Value TargetAddress: String Targets: - Target

Properties

CreatedBy

The name or email alias of the person who created the notification rule.

Required: No

Type: String

Minimum: 1

Maximum: 2048

Update requires: No interruption

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 Amazon 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

EventTypeId

The event type 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: No

Type: String

Minimum: 1

Maximum: 2048

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: Array of String

Minimum: 1

Maximum: 200

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

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

Minimum: 1

Maximum: 64

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: ENABLED | DISABLED

Update requires: No interruption

Tags

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

Required: No

Type: Object of String

Pattern: .*

Update requires: No interruption

TargetAddress

The Amazon Resource Name (ARN) of the Amazon SNS topic or AWS Chatbot client.

Required: No

Type: String

Minimum: 1

Maximum: 2048

Update requires: No interruption

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: Array 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.

Fn::GetAtt

Arn

The Amazon Resource Name (ARN) of the notification rule.

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": "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: 'arn:aws:sns:us-east-2:123456789012:MyNotificationTopic' Tags: Team: Saanvi