Namespace Amazon.CDK.AWS.CodeStarNotifications
AWS CodeStarNotifications Construct Library
This module is part of the AWS Cloud Development Kit project.
NotificationRule
The NotificationRule
construct defines an AWS CodeStarNotifications rule.
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.
Notification targets are objects that implement the INotificationRuleTarget
interface and notification source is object that implement the INotificationRuleSource
interface.
Notification Targets
This module includes classes that implement the INotificationRuleTarget
interface for SNS and slack in AWS Chatbot.
The following targets are supported:
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 },
NotificationRuleName = "MyNotificationRuleName",
Enabled = true, // The default is true
DetailType = DetailType.FULL, // The default is FULL
CreatedBy = "Jone Doe"
});
rule.AddTarget(slack);
Notification Source
This module includes classes that implement the INotificationRuleSource
interface for AWS CodeBuild,
AWS CodePipeline and will support AWS CodeCommit, AWS CodeDeploy in future.
The following sources are supported:
Events
For the complete list of supported event types for CodeBuild and CodePipeline, see:
Classes
CfnNotificationRule | Creates a notification rule for a resource. |
CfnNotificationRule.TargetProperty | Information about the AWS Chatbot topics or AWS Chatbot clients associated with a notification rule. |
CfnNotificationRuleProps | Properties for defining a |
DetailType | The level of detail to include in the notifications for this resource. |
NotificationRule | A new notification rule. |
NotificationRuleOptions | Standard set of options for |
NotificationRuleProps | Properties for a new notification rule. |
NotificationRuleSourceConfig | Information about the Codebuild or CodePipeline associated with a notification source. |
NotificationRuleTargetConfig | Information about the SNS topic or AWS Chatbot client associated with a notification target. |
Interfaces
CfnNotificationRule.ITargetProperty | Information about the AWS Chatbot topics or AWS Chatbot clients associated with a notification rule. |
ICfnNotificationRuleProps | Properties for defining a |
INotificationRule | Represents a notification rule. |
INotificationRuleOptions | Standard set of options for |
INotificationRuleProps | Properties for a new notification rule. |
INotificationRuleSource | Represents a notification source The source that allows CodeBuild and CodePipeline to associate with this rule. |
INotificationRuleSourceConfig | Information about the Codebuild or CodePipeline associated with a notification source. |
INotificationRuleTarget | Represents a notification target That allows AWS Chatbot and SNS topic to associate with this rule target. |
INotificationRuleTargetConfig | Information about the SNS topic or AWS Chatbot client associated with a notification target. |