Class NotificationRule
java.lang.Object
software.amazon.jsii.JsiiObject
software.constructs.Construct
software.amazon.awscdk.Resource
software.amazon.awscdk.services.codestarnotifications.NotificationRule
- All Implemented Interfaces:
IResource,INotificationRule,software.amazon.jsii.JsiiSerializable,software.constructs.IConstruct,software.constructs.IDependable
@Generated(value="jsii-pacmak/1.116.0 (build 0eddcff)",
date="2025-10-29T11:15:35.234Z")
@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))
.notificationRuleName("MyNotificationRuleName")
.enabled(true) // The default is true
.detailType(DetailType.FULL) // The default is FULL
.createdBy("Jone Doe")
.build();
rule.addTarget(slack);
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class software.amazon.jsii.JsiiObject
software.amazon.jsii.JsiiObject.InitializationModeNested classes/interfaces inherited from interface software.constructs.IConstruct
software.constructs.IConstruct.Jsii$DefaultNested classes/interfaces inherited from interface software.amazon.awscdk.services.codestarnotifications.INotificationRule
INotificationRule.Jsii$Default, INotificationRule.Jsii$ProxyNested classes/interfaces inherited from interface software.amazon.awscdk.IResource
IResource.Jsii$Default -
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedNotificationRule(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) protectedNotificationRule(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 INotificationRulefromNotificationRuleArn(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.Resource
applyRemovalPolicy, generatePhysicalName, getEnv, getPhysicalName, getResourceArnAttribute, getResourceNameAttribute, getStack, isOwnedResource, isResourceMethods inherited from class software.constructs.Construct
getNode, isConstruct, toStringMethods inherited from class software.amazon.jsii.JsiiObject
jsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSetMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface software.constructs.IConstruct
getNodeMethods inherited from interface software.amazon.awscdk.IResource
applyRemovalPolicy, getEnv, getStackMethods inherited from interface software.amazon.jsii.JsiiSerializable
$jsii$toJson
-
Field Details
-
PROPERTY_INJECTION_ID
Uniquely identifies this class.
-
-
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:
addTargetin 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:
getNotificationRuleArnin interfaceINotificationRule
-