Interface INotificationRuleProps
- Namespace
- Amazon.CDK.AWS.CodeStarNotifications
- Assembly
- Amazon.CDK.AWS.CodeStarNotifications.dll
Properties for a new notification rule.
public interface INotificationRuleProps : INotificationRuleOptions
- 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
Properties
Events
A list of event types associated with this notification rule.
string[] Events { get; }
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
Source
The Amazon Resource Name (ARN) of the resource to associate with the notification rule.
INotificationRuleSource Source { get; }
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.
INotificationRuleTarget[]? Targets { get; }
Property Value
Remarks
Default: - No targets are added to the rule. Use addTarget()
to add a target.