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, IConstruct, IDependable
Syntax (vb)
Public Class NotificationRule Inherits Resource Implements INotificationRule, IResource, IConstruct, IDependable
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
NotificationRule(Construct, string, INotificationRuleProps) | A new notification rule. |
Properties
NotificationRuleArn | The ARN of the notification rule (i.e. arn:aws:codestar-notifications:::notificationrule/01234abcde). |
PROPERTY_INJECTION_ID | Uniquely identifies this class. |
Methods
AddTarget(INotificationRuleTarget) | Adds target to notification rule. |
FromNotificationRuleArn(Construct, string, string) | Import an existing notification rule provided an ARN. |
Constructors
NotificationRule(Construct, string, INotificationRuleProps)
A new notification rule.
public NotificationRule(Construct scope, string id, INotificationRuleProps props)
Parameters
- scope Construct
- id string
- props INotificationRuleProps
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);
Properties
NotificationRuleArn
The ARN of the notification rule (i.e. arn:aws:codestar-notifications:::notificationrule/01234abcde).
public virtual string NotificationRuleArn { get; }
Property Value
Remarks
Attribute: true
PROPERTY_INJECTION_ID
Uniquely identifies this class.
public static string PROPERTY_INJECTION_ID { get; }
Property Value
Remarks
Resource: AWS::CodeStarNotifications::NotificationRule
ExampleMetadata: infused
Methods
AddTarget(INotificationRuleTarget)
Adds target to notification rule.
public virtual bool AddTarget(INotificationRuleTarget target)
Parameters
- target INotificationRuleTarget
The SNS topic or AWS Chatbot Slack target.
Returns
Remarks
Resource: AWS::CodeStarNotifications::NotificationRule
ExampleMetadata: infused
FromNotificationRuleArn(Construct, string, string)
Import an existing notification rule provided an ARN.
public static INotificationRule FromNotificationRuleArn(Construct scope, string id, string notificationRuleArn)
Parameters
- scope Construct
The parent creating construct.
- id string
The construct's name.
- notificationRuleArn string
Notification rule ARN (i.e. arn:aws:codestar-notifications:::notificationrule/01234abcde).
Returns
Remarks
Resource: AWS::CodeStarNotifications::NotificationRule
ExampleMetadata: infused