@Generated(value="jsii-pacmak/1.74.0 (build 6d08790)", date="2023-03-22T19:35:35.594Z") public class NotificationRule extends Resource implements INotificationRule
Example:
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)) .build(); rule.addTarget(slack);
Modifier and Type | Class and Description |
---|---|
static class |
NotificationRule.Builder
A fluent builder for
NotificationRule . |
INotificationRule.Jsii$Default, INotificationRule.Jsii$Proxy
Modifier | Constructor and Description |
---|---|
protected |
NotificationRule(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) |
protected |
NotificationRule(software.amazon.jsii.JsiiObjectRef objRef) |
|
NotificationRule(software.constructs.Construct scope,
java.lang.String id,
NotificationRuleProps props) |
Modifier and Type | Method and Description |
---|---|
java.lang.Boolean |
addTarget(INotificationRuleTarget target)
Adds target to notification rule.
|
static INotificationRule |
fromNotificationRuleArn(software.constructs.Construct scope,
java.lang.String id,
java.lang.String notificationRuleArn)
Import an existing notification rule provided an ARN.
|
java.lang.String |
getNotificationRuleArn()
The ARN of the notification rule (i.e.
|
applyRemovalPolicy, generatePhysicalName, getEnv, getPhysicalName, getResourceArnAttribute, getResourceNameAttribute, getStack, isResource
getNode, isConstruct, onPrepare, onSynthesize, onValidate, prepare, synthesize, validate
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
applyRemovalPolicy, getEnv, getStack
getNode
protected NotificationRule(software.amazon.jsii.JsiiObjectRef objRef)
protected NotificationRule(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
public NotificationRule(software.constructs.Construct scope, java.lang.String id, NotificationRuleProps props)
scope
- This parameter is required.id
- This parameter is required.props
- This parameter is required.public static INotificationRule fromNotificationRuleArn(software.constructs.Construct scope, java.lang.String id, java.lang.String notificationRuleArn)
scope
- The parent creating construct. This parameter is required.id
- The construct's name. This parameter is required.notificationRuleArn
- Notification rule ARN (i.e. arn:aws:codestar-notifications:::notificationrule/01234abcde). This parameter is required.public java.lang.Boolean addTarget(INotificationRuleTarget target)
addTarget
in interface INotificationRule
target
- The SNS topic or AWS Chatbot Slack target. This parameter is required.public java.lang.String getNotificationRuleArn()
getNotificationRuleArn
in interface INotificationRule