Class NotificationRuleProps
- Namespace
- Amazon.CDK.AWS.CodeStarNotifications
- Assembly
- Amazon.CDK.AWS.CodeStarNotifications.dll
Properties for a new notification rule.
public class NotificationRuleProps : INotificationRuleProps, INotificationRuleOptions
- Inheritance
-
NotificationRuleProps
- Implements
- Inherited Members
Examples
using Amazon.CDK.AWS.CodeStarNotifications;
using Amazon.CDK.AWS.CodeBuild;
using Amazon.CDK.AWS.SNS;
using Amazon.CDK.AWS.Chatbot;
var project = new PipelineProject(this, "MyProject");
var topic = new Topic(this, "MyTopic1");
var slack = new SlackChannelConfiguration(this, "MySlackChannel", new SlackChannelConfigurationProps {
SlackChannelConfigurationName = "YOUR_CHANNEL_NAME",
SlackWorkspaceId = "YOUR_SLACK_WORKSPACE_ID",
SlackChannelId = "YOUR_SLACK_CHANNEL_ID"
});
var rule = new NotificationRule(this, "NotificationRule", new NotificationRuleProps {
Source = project,
Events = new [] { "codebuild-project-build-state-succeeded", "codebuild-project-build-state-failed" },
Targets = new [] { topic }
});
rule.AddTarget(slack);
Remarks
ExampleMetadata: infused
Constructors
NotificationRuleProps()
public NotificationRuleProps()
Properties
DetailType
The level of detail to include in the notifications for this resource.
public DetailType? DetailType { get; set; }
Property Value
Remarks
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.
Default: DetailType.FULL
Enabled
The status of the notification rule.
public bool? Enabled { get; set; }
Property Value
- bool?
Remarks
If the enabled is set to DISABLED, notifications aren't sent for the notification rule.
Default: true
Events
A list of event types associated with this notification rule.
public string[] Events { get; set; }
Property Value
- string[]
Remarks
For a complete list of event types and IDs, see Notification concepts in the Developer Tools Console User Guide.
See: https://docs.aws.amazon.com/dtconsole/latest/userguide/concepts.html#concepts-api
NotificationRuleName
The name for the notification rule.
public string? NotificationRuleName { get; set; }
Property Value
Remarks
Notification rule names must be unique in your AWS account.
Default: - generated from the id
Source
The Amazon Resource Name (ARN) of the resource to associate with the notification rule.
public INotificationRuleSource Source { get; set; }
Property Value
Remarks
Currently, Supported sources include pipelines in AWS CodePipeline, build projects in AWS CodeBuild, and repositories in AWS CodeCommit in this L2 constructor.
Targets
The targets to register for the notification destination.
public INotificationRuleTarget[]? Targets { get; set; }
Property Value
Remarks
Default: - No targets are added to the rule. Use addTarget()
to add a target.