Package software.amazon.awscdk.services.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:
SNS
: specify event and notify to SNS topic.AWS Chatbot
: specify event and notify to slack channel and only supportSlackChannelConfiguration
.
Examples
import software.amazon.awscdk.services.codestarnotifications.*; import software.amazon.awscdk.services.codebuild.*; import software.amazon.awscdk.services.sns.*; import software.amazon.awscdk.services.chatbot.*; PipelineProject project = new PipelineProject(this, "MyProject"); Topic topic = new Topic(this, "MyTopic1"); SlackChannelConfiguration slack = SlackChannelConfiguration.Builder.create(this, "MySlackChannel") .slackChannelConfigurationName("YOUR_CHANNEL_NAME") .slackWorkspaceId("YOUR_SLACK_WORKSPACE_ID") .slackChannelId("YOUR_SLACK_CHANNEL_ID") .build(); NotificationRule rule = NotificationRule.Builder.create(this, "NotificationRule") .source(project) .events(List.of("codebuild-project-build-state-succeeded", "codebuild-project-build-state-failed")) .targets(List.of(topic)) .notificationRuleName("MyNotificationRuleName") .enabled(true) // The default is true .detailType(DetailType.FULL) // The default is FULL .createdBy("Jone Doe") .build(); 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:
AWS CodeBuild
: support codebuild project to trigger notification when event specified.AWS CodePipeline
: support codepipeline to trigger notification when event specified.
Events
For the complete list of supported event types for CodeBuild and CodePipeline, see:
-
ClassDescriptionCreates a notification rule for a resource.A fluent builder for
CfnNotificationRule
.Information about the AWS Chatbot topics or AWS Chatbot clients associated with a notification rule.A builder forCfnNotificationRule.TargetProperty
An implementation forCfnNotificationRule.TargetProperty
Properties for defining aCfnNotificationRule
.A builder forCfnNotificationRuleProps
An implementation forCfnNotificationRuleProps
The level of detail to include in the notifications for this resource.Represents a notification rule.Internal default implementation forINotificationRule
.A proxy class which represents a concrete javascript instance of this type.Represents a notification source The source that allows CodeBuild and CodePipeline to associate with this rule.Internal default implementation forINotificationRuleSource
.A proxy class which represents a concrete javascript instance of this type.Represents a notification target That allows AWS Chatbot and SNS topic to associate with this rule target.Internal default implementation forINotificationRuleTarget
.A proxy class which represents a concrete javascript instance of this type.A new notification rule.A fluent builder forNotificationRule
.Standard set of options fornotifyOnXxx
codestar notification handler on construct.A builder forNotificationRuleOptions
An implementation forNotificationRuleOptions
Properties for a new notification rule.A builder forNotificationRuleProps
An implementation forNotificationRuleProps
Information about the Codebuild or CodePipeline associated with a notification source.A builder forNotificationRuleSourceConfig
An implementation forNotificationRuleSourceConfig
Information about the SNS topic or AWS Chatbot client associated with a notification target.A builder forNotificationRuleTargetConfig
An implementation forNotificationRuleTargetConfig