Class NotificationRule
java.lang.Object
software.amazon.jsii.JsiiObject
software.constructs.Construct
software.amazon.awscdk.core.Construct
software.amazon.awscdk.core.Resource
software.amazon.awscdk.services.codestarnotifications.NotificationRule
- All Implemented Interfaces:
IConstruct
,IDependable
,IResource
,INotificationRule
,software.amazon.jsii.JsiiSerializable
,software.constructs.IConstruct
@Generated(value="jsii-pacmak/1.84.0 (build 5404dcf)",
date="2023-06-19T16:29:55.921Z")
@Stability(Stable)
public class NotificationRule
extends Resource
implements INotificationRule
A new notification rule.
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);
-
Nested Class Summary
Nested classes/interfaces inherited from class software.amazon.jsii.JsiiObject
software.amazon.jsii.JsiiObject.InitializationMode
Nested classes/interfaces inherited from interface software.amazon.awscdk.core.IConstruct
IConstruct.Jsii$Default
Nested classes/interfaces inherited from interface software.constructs.IConstruct
software.constructs.IConstruct.Jsii$Default
Nested classes/interfaces inherited from interface software.amazon.awscdk.services.codestarnotifications.INotificationRule
INotificationRule.Jsii$Default, INotificationRule.Jsii$Proxy
Nested classes/interfaces inherited from interface software.amazon.awscdk.core.IResource
IResource.Jsii$Default
-
Constructor Summary
ModifierConstructorDescriptionprotected
NotificationRule
(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) protected
NotificationRule
(software.amazon.jsii.JsiiObjectRef objRef) NotificationRule
(software.constructs.Construct scope, String id, NotificationRuleProps props) -
Method Summary
Modifier and TypeMethodDescriptionaddTarget
(INotificationRuleTarget target) Adds target to notification rule.static INotificationRule
fromNotificationRuleArn
(software.constructs.Construct scope, String id, String notificationRuleArn) Import an existing notification rule provided an ARN.The ARN of the notification rule (i.e.Methods inherited from class software.amazon.awscdk.core.Resource
applyRemovalPolicy, generatePhysicalName, getEnv, getPhysicalName, getResourceArnAttribute, getResourceNameAttribute, getStack, isResource
Methods inherited from class software.amazon.awscdk.core.Construct
getNode, isConstruct, onPrepare, onSynthesize, onValidate, prepare, synthesize, validate
Methods inherited from class software.constructs.Construct
toString
Methods inherited from class software.amazon.jsii.JsiiObject
jsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSet
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface software.amazon.awscdk.core.IConstruct
getNode
Methods inherited from interface software.amazon.awscdk.core.IResource
applyRemovalPolicy, getEnv, getStack
Methods inherited from interface software.amazon.jsii.JsiiSerializable
$jsii$toJson
-
Constructor Details
-
NotificationRule
protected NotificationRule(software.amazon.jsii.JsiiObjectRef objRef) -
NotificationRule
protected NotificationRule(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) -
NotificationRule
@Stability(Stable) public NotificationRule(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull NotificationRuleProps props) - Parameters:
scope
- This parameter is required.id
- This parameter is required.props
- This parameter is required.
-
-
Method Details
-
fromNotificationRuleArn
@Stability(Stable) @NotNull public static INotificationRule fromNotificationRuleArn(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull String notificationRuleArn) Import an existing notification rule provided an ARN.- Parameters:
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.
-
addTarget
Adds target to notification rule.- Specified by:
addTarget
in interfaceINotificationRule
- Parameters:
target
- The SNS topic or AWS Chatbot Slack target. This parameter is required.- Returns:
- boolean - return true if it had any effect
-
getNotificationRuleArn
The ARN of the notification rule (i.e. arn:aws:codestar-notifications:::notificationrule/01234abcde).- Specified by:
getNotificationRuleArn
in interfaceINotificationRule
-