Class NotificationRule
A new notification rule.
Inherited Members
Namespace: Amazon.CDK.AWS.CodeStarNotifications
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public class NotificationRule : Resource, INotificationRule, IResource
Syntax (vb)
Public Class NotificationRule
Inherits Resource
Implements INotificationRule, IResource
Remarks
Resource: AWS::CodeStarNotifications::NotificationRule
ExampleMetadata: infused
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);
Synopsis
Constructors
Notification |
Used by jsii to construct an instance of this class from a Javascript-owned object reference |
Notification |
Used by jsii to construct an instance of this class from DeputyProps |
Notification |
Properties
Notification |
The ARN of the notification rule (i.e. arn:aws:codestar-notifications:::notificationrule/01234abcde). |
Methods
Add |
Adds target to notification rule. |
From |
Import an existing notification rule provided an ARN. |
Constructors
NotificationRule(ByRefValue)
Used by jsii to construct an instance of this class from a Javascript-owned object reference
protected NotificationRule(ByRefValue reference)
Parameters
- reference Amazon.
JSII. Runtime. Deputy. By Ref Value The Javascript-owned object reference
NotificationRule(DeputyBase.DeputyProps)
Used by jsii to construct an instance of this class from DeputyProps
protected NotificationRule(DeputyBase.DeputyProps props)
Parameters
- props Amazon.
JSII. Runtime. Deputy. Deputy Base. Deputy Props The deputy props
NotificationRule(Construct, String, INotificationRuleProps)
public NotificationRule(Construct scope, string id, INotificationRuleProps props)
Parameters
- scope Constructs.
Construct - id System.
String - props INotification
Rule Props
Properties
NotificationRuleArn
The ARN of the notification rule (i.e. arn:aws:codestar-notifications:::notificationrule/01234abcde).
public virtual string NotificationRuleArn { get; }
Property Value
System.
Remarks
Attribute: true
Methods
AddTarget(INotificationRuleTarget)
Adds target to notification rule.
public virtual bool AddTarget(INotificationRuleTarget target)
Parameters
- target INotification
Rule Target The SNS topic or AWS Chatbot Slack target.
Returns
System.
FromNotificationRuleArn(Construct, String, String)
Import an existing notification rule provided an ARN.
public static INotificationRule FromNotificationRuleArn(Construct scope, string id, string notificationRuleArn)
Parameters
- scope Constructs.
Construct The parent creating construct.
- id System.
String The construct's name.
- notificationRuleArn System.
String Notification rule ARN (i.e. arn:aws:codestar-notifications:::notificationrule/01234abcde).
Returns