awscodestarnotifications

package
v2.41.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 8, 2022 License: Apache-2.0 Imports: 7 Imported by: 1

README

AWS CodeStarNotifications Construct Library

This module is part of the AWS Cloud Development Kit project.

NotificationRule

The NotificationRule construct defines an AWS CodeStarNotifications rule. The rule specifies the events you want notifications about and the targets (such as Amazon SNS topics or AWS Chatbot clients configured for Slack) where you want to receive them. Notification targets are objects that implement the INotificationRuleTarget interface and notification source is object that implement the INotificationRuleSource interface.

Notification Targets

This module includes classes that implement the INotificationRuleTarget interface for SNS and slack in AWS Chatbot.

The following targets are supported:

  • SNS: specify event and notify to SNS topic.
  • AWS Chatbot: specify event and notify to slack channel and only support SlackChannelConfiguration.

Examples

import notifications "github.com/aws/aws-cdk-go/awscdk"
import codebuild "github.com/aws/aws-cdk-go/awscdk"
import sns "github.com/aws/aws-cdk-go/awscdk"
import chatbot "github.com/aws/aws-cdk-go/awscdk"


project := codebuild.NewPipelineProject(this, jsii.String("MyProject"))

topic := sns.NewTopic(this, jsii.String("MyTopic1"))

slack := chatbot.NewSlackChannelConfiguration(this, jsii.String("MySlackChannel"), &slackChannelConfigurationProps{
	slackChannelConfigurationName: jsii.String("YOUR_CHANNEL_NAME"),
	slackWorkspaceId: jsii.String("YOUR_SLACK_WORKSPACE_ID"),
	slackChannelId: jsii.String("YOUR_SLACK_CHANNEL_ID"),
})

rule := notifications.NewNotificationRule(this, jsii.String("NotificationRule"), &notificationRuleProps{
	source: project,
	events: []*string{
		jsii.String("codebuild-project-build-state-succeeded"),
		jsii.String("codebuild-project-build-state-failed"),
	},
	targets: []iNotificationRuleTarget{
		topic,
	},
})
rule.addTarget(slack)

Notification Source

This module includes classes that implement the INotificationRuleSource interface for AWS CodeBuild, AWS CodePipeline and will support AWS CodeCommit, AWS CodeDeploy in future.

The following sources are supported:

  • AWS CodeBuild: support codebuild project to trigger notification when event specified.
  • AWS CodePipeline: support codepipeline to trigger notification when event specified.

Events

For the complete list of supported event types for CodeBuild and CodePipeline, see:

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CfnNotificationRule_CFN_RESOURCE_TYPE_NAME

func CfnNotificationRule_CFN_RESOURCE_TYPE_NAME() *string

func CfnNotificationRule_IsCfnElement

func CfnNotificationRule_IsCfnElement(x interface{}) *bool

Returns `true` if a construct is a stack element (i.e. part of the synthesized cloudformation template).

Uses duck-typing instead of `instanceof` to allow stack elements from different versions of this library to be included in the same stack.

Returns: The construct as a stack element or undefined if it is not a stack element.

func CfnNotificationRule_IsCfnResource

func CfnNotificationRule_IsCfnResource(construct constructs.IConstruct) *bool

Check whether the given construct is a CfnResource.

func CfnNotificationRule_IsConstruct

func CfnNotificationRule_IsConstruct(x interface{}) *bool

Checks if `x` is a construct.

Use this method instead of `instanceof` to properly detect `Construct` instances, even when the construct library is symlinked.

Explanation: in JavaScript, multiple copies of the `constructs` library on disk are seen as independent, completely different libraries. As a consequence, the class `Construct` in each copy of the `constructs` library is seen as a different class, and an instance of one class will not test as `instanceof` the other class. `npm install` will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the `constructs` library can be accidentally installed, and `instanceof` will behave unpredictably. It is safest to avoid using `instanceof`, and using this type-testing method instead.

Returns: true if `x` is an object created from a class which extends `Construct`.

func NewCfnNotificationRule_Override

func NewCfnNotificationRule_Override(c CfnNotificationRule, scope constructs.Construct, id *string, props *CfnNotificationRuleProps)

Create a new `AWS::CodeStarNotifications::NotificationRule`.

func NewNotificationRule_Override

func NewNotificationRule_Override(n NotificationRule, scope constructs.Construct, id *string, props *NotificationRuleProps)

func NotificationRule_IsConstruct

func NotificationRule_IsConstruct(x interface{}) *bool

Checks if `x` is a construct.

Use this method instead of `instanceof` to properly detect `Construct` instances, even when the construct library is symlinked.

Explanation: in JavaScript, multiple copies of the `constructs` library on disk are seen as independent, completely different libraries. As a consequence, the class `Construct` in each copy of the `constructs` library is seen as a different class, and an instance of one class will not test as `instanceof` the other class. `npm install` will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the `constructs` library can be accidentally installed, and `instanceof` will behave unpredictably. It is safest to avoid using `instanceof`, and using this type-testing method instead.

Returns: true if `x` is an object created from a class which extends `Construct`.

func NotificationRule_IsOwnedResource added in v2.32.0

func NotificationRule_IsOwnedResource(construct constructs.IConstruct) *bool

Returns true if the construct was created by CDK, and false otherwise.

func NotificationRule_IsResource

func NotificationRule_IsResource(construct constructs.IConstruct) *bool

Check whether the given construct is a Resource.

Types

type CfnNotificationRule

type CfnNotificationRule interface {
	awscdk.CfnResource
	awscdk.IInspectable
	AttrArn() *string
	// Options for this resource, such as condition, update policy etc.
	CfnOptions() awscdk.ICfnResourceOptions
	CfnProperties() *map[string]interface{}
	// AWS resource type.
	CfnResourceType() *string
	// `AWS::CodeStarNotifications::NotificationRule.CreatedBy`.
	CreatedBy() *string
	SetCreatedBy(val *string)
	// Returns: the stack trace of the point where this Resource was created from, sourced
	// from the +metadata+ entry typed +aws:cdk:logicalId+, and with the bottom-most
	// node +internal+ entries filtered.
	CreationStack() *[]*string
	// The level of detail to include in the notifications for this resource.
	//
	// `BASIC` will include only the contents of the event as it would appear in Amazon CloudWatch. `FULL` will include any supplemental information provided by AWS CodeStar Notifications and/or the service for the resource for which the notification is created.
	DetailType() *string
	SetDetailType(val *string)
	// `AWS::CodeStarNotifications::NotificationRule.EventTypeId`.
	EventTypeId() *string
	SetEventTypeId(val *string)
	// A list of event types associated with this notification rule.
	//
	// For a complete list of event types and IDs, see [Notification concepts](https://docs.aws.amazon.com/codestar-notifications/latest/userguide/concepts.html#concepts-api) in the *Developer Tools Console User Guide* .
	EventTypeIds() *[]*string
	SetEventTypeIds(val *[]*string)
	// The logical ID for this CloudFormation stack element.
	//
	// The logical ID of the element
	// is calculated from the path of the resource node in the construct tree.
	//
	// To override this value, use `overrideLogicalId(newLogicalId)`.
	//
	// Returns: the logical ID as a stringified token. This value will only get
	// resolved during synthesis.
	LogicalId() *string
	// The name for the notification rule.
	//
	// Notification rule names must be unique in your AWS account .
	Name() *string
	SetName(val *string)
	// The tree node.
	Node() constructs.Node
	// Return a string that will be resolved to a CloudFormation `{ Ref }` for this element.
	//
	// If, by any chance, the intrinsic reference of a resource is not a string, you could
	// coerce it to an IResolvable through `Lazy.any({ produce: resource.ref })`.
	Ref() *string
	// The Amazon Resource Name (ARN) of the resource to associate with the notification rule.
	//
	// Supported resources include pipelines in AWS CodePipeline , repositories in AWS CodeCommit , and build projects in AWS CodeBuild .
	Resource() *string
	SetResource(val *string)
	// The stack in which this element is defined.
	//
	// CfnElements must be defined within a stack scope (directly or indirectly).
	Stack() awscdk.Stack
	// The status of the notification rule.
	//
	// The default value is `ENABLED` . If the status is set to `DISABLED` , notifications aren't sent for the notification rule.
	Status() *string
	SetStatus(val *string)
	// A list of tags to apply to this notification rule.
	//
	// Key names cannot start with " `aws` ".
	Tags() awscdk.TagManager
	// `AWS::CodeStarNotifications::NotificationRule.TargetAddress`.
	TargetAddress() *string
	SetTargetAddress(val *string)
	// A list of Amazon Resource Names (ARNs) of AWS Chatbot topics and AWS Chatbot clients to associate with the notification rule.
	Targets() interface{}
	SetTargets(val interface{})
	// Deprecated.
	// Deprecated: use `updatedProperties`
	//
	// Return properties modified after initiation
	//
	// Resources that expose mutable properties should override this function to
	// collect and return the properties object for this resource.
	UpdatedProperites() *map[string]interface{}
	// Return properties modified after initiation.
	//
	// Resources that expose mutable properties should override this function to
	// collect and return the properties object for this resource.
	UpdatedProperties() *map[string]interface{}
	// Syntactic sugar for `addOverride(path, undefined)`.
	AddDeletionOverride(path *string)
	// Indicates that this resource depends on another resource and cannot be provisioned unless the other resource has been successfully provisioned.
	//
	// This can be used for resources across stacks (or nested stack) boundaries
	// and the dependency will automatically be transferred to the relevant scope.
	AddDependsOn(target awscdk.CfnResource)
	// Add a value to the CloudFormation Resource Metadata.
	// See: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/metadata-section-structure.html
	//
	// Note that this is a different set of metadata from CDK node metadata; this
	// metadata ends up in the stack template under the resource, whereas CDK
	// node metadata ends up in the Cloud Assembly.
	//
	AddMetadata(key *string, value interface{})
	// Adds an override to the synthesized CloudFormation resource.
	//
	// To add a
	// property override, either use `addPropertyOverride` or prefix `path` with
	// "Properties." (i.e. `Properties.TopicName`).
	//
	// If the override is nested, separate each nested level using a dot (.) in the path parameter.
	// If there is an array as part of the nesting, specify the index in the path.
	//
	// To include a literal `.` in the property name, prefix with a `\`. In most
	// programming languages you will need to write this as `"\\."` because the
	// `\` itself will need to be escaped.
	//
	// For example,
	// “`typescript
	// cfnResource.addOverride('Properties.GlobalSecondaryIndexes.0.Projection.NonKeyAttributes', ['myattribute']);
	// cfnResource.addOverride('Properties.GlobalSecondaryIndexes.1.ProjectionType', 'INCLUDE');
	// “`
	// would add the overrides
	// “`json
	// "Properties": {
	//    "GlobalSecondaryIndexes": [
	//      {
	//        "Projection": {
	//          "NonKeyAttributes": [ "myattribute" ]
	//          ...
	//        }
	//        ...
	//      },
	//      {
	//        "ProjectionType": "INCLUDE"
	//        ...
	//      },
	//    ]
	//    ...
	// }
	// “`
	//
	// The `value` argument to `addOverride` will not be processed or translated
	// in any way. Pass raw JSON values in here with the correct capitalization
	// for CloudFormation. If you pass CDK classes or structs, they will be
	// rendered with lowercased key names, and CloudFormation will reject the
	// template.
	AddOverride(path *string, value interface{})
	// Adds an override that deletes the value of a property from the resource definition.
	AddPropertyDeletionOverride(propertyPath *string)
	// Adds an override to a resource property.
	//
	// Syntactic sugar for `addOverride("Properties.<...>", value)`.
	AddPropertyOverride(propertyPath *string, value interface{})
	// Sets the deletion policy of the resource based on the removal policy specified.
	//
	// The Removal Policy controls what happens to this resource when it stops
	// being managed by CloudFormation, either because you've removed it from the
	// CDK application or because you've made a change that requires the resource
	// to be replaced.
	//
	// The resource can be deleted (`RemovalPolicy.DESTROY`), or left in your AWS
	// account for data recovery and cleanup later (`RemovalPolicy.RETAIN`). In some
	// cases, a snapshot can be taken of the resource prior to deletion
	// (`RemovalPolicy.SNAPSHOT`). A list of resources that support this policy
	// can be found in the following link:.
	// See: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html#aws-attribute-deletionpolicy-options
	//
	ApplyRemovalPolicy(policy awscdk.RemovalPolicy, options *awscdk.RemovalPolicyOptions)
	// Returns a token for an runtime attribute of this resource.
	//
	// Ideally, use generated attribute accessors (e.g. `resource.arn`), but this can be used for future compatibility
	// in case there is no generated attribute.
	GetAtt(attributeName *string) awscdk.Reference
	// Retrieve a value value from the CloudFormation Resource Metadata.
	// See: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/metadata-section-structure.html
	//
	// Note that this is a different set of metadata from CDK node metadata; this
	// metadata ends up in the stack template under the resource, whereas CDK
	// node metadata ends up in the Cloud Assembly.
	//
	GetMetadata(key *string) interface{}
	// Examines the CloudFormation resource and discloses attributes.
	Inspect(inspector awscdk.TreeInspector)
	// Overrides the auto-generated logical ID with a specific ID.
	OverrideLogicalId(newLogicalId *string)
	RenderProperties(props *map[string]interface{}) *map[string]interface{}
	// Can be overridden by subclasses to determine if this resource will be rendered into the cloudformation template.
	//
	// Returns: `true` if the resource should be included or `false` is the resource
	// should be omitted.
	ShouldSynthesize() *bool
	// Returns a string representation of this construct.
	//
	// Returns: a string representation of this resource.
	ToString() *string
	ValidateProperties(_properties interface{})
}

A CloudFormation `AWS::CodeStarNotifications::NotificationRule`.

Creates a notification rule for a resource. The rule specifies the events you want notifications about and the targets (such as AWS Chatbot topics or AWS Chatbot clients configured for Slack) where you want to receive them.

Example:

// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import "github.com/aws/aws-cdk-go/awscdk"

var tags interface{}

cfnNotificationRule := awscdk.Aws_codestarnotifications.NewCfnNotificationRule(this, jsii.String("MyCfnNotificationRule"), &cfnNotificationRuleProps{
	detailType: jsii.String("detailType"),
	eventTypeIds: []*string{
		jsii.String("eventTypeIds"),
	},
	name: jsii.String("name"),
	resource: jsii.String("resource"),
	targets: []interface{}{
		&targetProperty{
			targetAddress: jsii.String("targetAddress"),
			targetType: jsii.String("targetType"),
		},
	},

	// the properties below are optional
	createdBy: jsii.String("createdBy"),
	eventTypeId: jsii.String("eventTypeId"),
	status: jsii.String("status"),
	tags: tags,
	targetAddress: jsii.String("targetAddress"),
})

func NewCfnNotificationRule

func NewCfnNotificationRule(scope constructs.Construct, id *string, props *CfnNotificationRuleProps) CfnNotificationRule

Create a new `AWS::CodeStarNotifications::NotificationRule`.

type CfnNotificationRuleProps

type CfnNotificationRuleProps struct {
	// The level of detail to include in the notifications for this resource.
	//
	// `BASIC` will include only the contents of the event as it would appear in Amazon CloudWatch. `FULL` will include any supplemental information provided by AWS CodeStar Notifications and/or the service for the resource for which the notification is created.
	DetailType *string `field:"required" json:"detailType" yaml:"detailType"`
	// A list of event types associated with this notification rule.
	//
	// For a complete list of event types and IDs, see [Notification concepts](https://docs.aws.amazon.com/codestar-notifications/latest/userguide/concepts.html#concepts-api) in the *Developer Tools Console User Guide* .
	EventTypeIds *[]*string `field:"required" json:"eventTypeIds" yaml:"eventTypeIds"`
	// The name for the notification rule.
	//
	// Notification rule names must be unique in your AWS account .
	Name *string `field:"required" json:"name" yaml:"name"`
	// The Amazon Resource Name (ARN) of the resource to associate with the notification rule.
	//
	// Supported resources include pipelines in AWS CodePipeline , repositories in AWS CodeCommit , and build projects in AWS CodeBuild .
	Resource *string `field:"required" json:"resource" yaml:"resource"`
	// A list of Amazon Resource Names (ARNs) of AWS Chatbot topics and AWS Chatbot clients to associate with the notification rule.
	Targets interface{} `field:"required" json:"targets" yaml:"targets"`
	// `AWS::CodeStarNotifications::NotificationRule.CreatedBy`.
	CreatedBy *string `field:"optional" json:"createdBy" yaml:"createdBy"`
	// `AWS::CodeStarNotifications::NotificationRule.EventTypeId`.
	EventTypeId *string `field:"optional" json:"eventTypeId" yaml:"eventTypeId"`
	// The status of the notification rule.
	//
	// The default value is `ENABLED` . If the status is set to `DISABLED` , notifications aren't sent for the notification rule.
	Status *string `field:"optional" json:"status" yaml:"status"`
	// A list of tags to apply to this notification rule.
	//
	// Key names cannot start with " `aws` ".
	Tags interface{} `field:"optional" json:"tags" yaml:"tags"`
	// `AWS::CodeStarNotifications::NotificationRule.TargetAddress`.
	TargetAddress *string `field:"optional" json:"targetAddress" yaml:"targetAddress"`
}

Properties for defining a `CfnNotificationRule`.

Example:

// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import "github.com/aws/aws-cdk-go/awscdk"

var tags interface{}

cfnNotificationRuleProps := &cfnNotificationRuleProps{
	detailType: jsii.String("detailType"),
	eventTypeIds: []*string{
		jsii.String("eventTypeIds"),
	},
	name: jsii.String("name"),
	resource: jsii.String("resource"),
	targets: []interface{}{
		&targetProperty{
			targetAddress: jsii.String("targetAddress"),
			targetType: jsii.String("targetType"),
		},
	},

	// the properties below are optional
	createdBy: jsii.String("createdBy"),
	eventTypeId: jsii.String("eventTypeId"),
	status: jsii.String("status"),
	tags: tags,
	targetAddress: jsii.String("targetAddress"),
}

type CfnNotificationRule_TargetProperty

type CfnNotificationRule_TargetProperty struct {
	// The Amazon Resource Name (ARN) of the AWS Chatbot topic or AWS Chatbot client.
	TargetAddress *string `field:"required" json:"targetAddress" yaml:"targetAddress"`
	// The target type. Can be an Amazon Simple Notification Service topic or AWS Chatbot client.
	//
	// - Amazon Simple Notification Service topics are specified as `SNS` .
	// - AWS Chatbot clients are specified as `AWSChatbotSlack` .
	TargetType *string `field:"required" json:"targetType" yaml:"targetType"`
}

Information about the AWS Chatbot topics or AWS Chatbot clients associated with a notification rule.

Example:

// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import "github.com/aws/aws-cdk-go/awscdk"

targetProperty := &targetProperty{
	targetAddress: jsii.String("targetAddress"),
	targetType: jsii.String("targetType"),
}

type DetailType

type DetailType string

The level of detail to include in the notifications for this resource.

const (
	// BASIC will include only the contents of the event as it would appear in AWS CloudWatch.
	DetailType_BASIC DetailType = "BASIC"
	// FULL will include any supplemental information provided by AWS CodeStar Notifications and/or the service for the resource for which the notification is created.
	DetailType_FULL DetailType = "FULL"
)

type INotificationRule

type INotificationRule interface {
	awscdk.IResource
	// Adds target to notification rule.
	//
	// Returns: boolean - return true if it had any effect.
	AddTarget(target INotificationRuleTarget) *bool
	// The ARN of the notification rule (i.e. arn:aws:codestar-notifications:::notificationrule/01234abcde).
	NotificationRuleArn() *string
}

Represents a notification rule.

func NotificationRule_FromNotificationRuleArn

func NotificationRule_FromNotificationRuleArn(scope constructs.Construct, id *string, notificationRuleArn *string) INotificationRule

Import an existing notification rule provided an ARN.

type INotificationRuleSource

type INotificationRuleSource interface {
	// Returns a source configuration for notification rule.
	BindAsNotificationRuleSource(scope constructs.Construct) *NotificationRuleSourceConfig
}

Represents a notification source The source that allows CodeBuild and CodePipeline to associate with this rule.

type INotificationRuleTarget

type INotificationRuleTarget interface {
	// Returns a target configuration for notification rule.
	BindAsNotificationRuleTarget(scope constructs.Construct) *NotificationRuleTargetConfig
}

Represents a notification target That allows AWS Chatbot and SNS topic to associate with this rule target.

type NotificationRule

type NotificationRule interface {
	awscdk.Resource
	INotificationRule
	// The environment this resource belongs to.
	//
	// For resources that are created and managed by the CDK
	// (generally, those created by creating new class instances like Role, Bucket, etc.),
	// this is always the same as the environment of the stack they belong to;
	// however, for imported resources
	// (those obtained from static methods like fromRoleArn, fromBucketName, etc.),
	// that might be different than the stack they were imported into.
	Env() *awscdk.ResourceEnvironment
	// The tree node.
	Node() constructs.Node
	// The ARN of the notification rule (i.e. arn:aws:codestar-notifications:::notificationrule/01234abcde).
	NotificationRuleArn() *string
	// Returns a string-encoded token that resolves to the physical name that should be passed to the CloudFormation resource.
	//
	// This value will resolve to one of the following:
	// - a concrete value (e.g. `"my-awesome-bucket"`)
	// - `undefined`, when a name should be generated by CloudFormation
	// - a concrete name generated automatically during synthesis, in
	//    cross-environment scenarios.
	PhysicalName() *string
	// The stack in which this resource is defined.
	Stack() awscdk.Stack
	// Adds target to notification rule.
	AddTarget(target INotificationRuleTarget) *bool
	// Apply the given removal policy to this resource.
	//
	// The Removal Policy controls what happens to this resource when it stops
	// being managed by CloudFormation, either because you've removed it from the
	// CDK application or because you've made a change that requires the resource
	// to be replaced.
	//
	// The resource can be deleted (`RemovalPolicy.DESTROY`), or left in your AWS
	// account for data recovery and cleanup later (`RemovalPolicy.RETAIN`).
	ApplyRemovalPolicy(policy awscdk.RemovalPolicy)
	GeneratePhysicalName() *string
	// Returns an environment-sensitive token that should be used for the resource's "ARN" attribute (e.g. `bucket.bucketArn`).
	//
	// Normally, this token will resolve to `arnAttr`, but if the resource is
	// referenced across environments, `arnComponents` will be used to synthesize
	// a concrete ARN with the resource's physical name. Make sure to reference
	// `this.physicalName` in `arnComponents`.
	GetResourceArnAttribute(arnAttr *string, arnComponents *awscdk.ArnComponents) *string
	// Returns an environment-sensitive token that should be used for the resource's "name" attribute (e.g. `bucket.bucketName`).
	//
	// Normally, this token will resolve to `nameAttr`, but if the resource is
	// referenced across environments, it will be resolved to `this.physicalName`,
	// which will be a concrete name.
	GetResourceNameAttribute(nameAttr *string) *string
	// Returns a string representation of this construct.
	ToString() *string
}

A new notification rule.

Example:

import notifications "github.com/aws/aws-cdk-go/awscdk"
import codebuild "github.com/aws/aws-cdk-go/awscdk"
import sns "github.com/aws/aws-cdk-go/awscdk"
import chatbot "github.com/aws/aws-cdk-go/awscdk"

project := codebuild.NewPipelineProject(this, jsii.String("MyProject"))

topic := sns.NewTopic(this, jsii.String("MyTopic1"))

slack := chatbot.NewSlackChannelConfiguration(this, jsii.String("MySlackChannel"), &slackChannelConfigurationProps{
	slackChannelConfigurationName: jsii.String("YOUR_CHANNEL_NAME"),
	slackWorkspaceId: jsii.String("YOUR_SLACK_WORKSPACE_ID"),
	slackChannelId: jsii.String("YOUR_SLACK_CHANNEL_ID"),
})

rule := notifications.NewNotificationRule(this, jsii.String("NotificationRule"), &notificationRuleProps{
	source: project,
	events: []*string{
		jsii.String("codebuild-project-build-state-succeeded"),
		jsii.String("codebuild-project-build-state-failed"),
	},
	targets: []iNotificationRuleTarget{
		topic,
	},
})
rule.addTarget(slack)

func NewNotificationRule

func NewNotificationRule(scope constructs.Construct, id *string, props *NotificationRuleProps) NotificationRule

type NotificationRuleOptions

type NotificationRuleOptions struct {
	// The level of detail to include in the notifications for this resource.
	//
	// BASIC will include only the contents of the event as it would appear in AWS CloudWatch.
	// FULL will include any supplemental information provided by AWS CodeStar Notifications and/or the service for the resource for which the notification is created.
	DetailType DetailType `field:"optional" json:"detailType" yaml:"detailType"`
	// The status of the notification rule.
	//
	// If the enabled is set to DISABLED, notifications aren't sent for the notification rule.
	Enabled *bool `field:"optional" json:"enabled" yaml:"enabled"`
	// The name for the notification rule.
	//
	// Notification rule names must be unique in your AWS account.
	NotificationRuleName *string `field:"optional" json:"notificationRuleName" yaml:"notificationRuleName"`
}

Standard set of options for `notifyOnXxx` codestar notification handler on construct.

Example:

// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import "github.com/aws/aws-cdk-go/awscdk"

notificationRuleOptions := &notificationRuleOptions{
	detailType: awscdk.Aws_codestarnotifications.detailType_BASIC,
	enabled: jsii.Boolean(false),
	notificationRuleName: jsii.String("notificationRuleName"),
}

type NotificationRuleProps

type NotificationRuleProps struct {
	// The level of detail to include in the notifications for this resource.
	//
	// BASIC will include only the contents of the event as it would appear in AWS CloudWatch.
	// FULL will include any supplemental information provided by AWS CodeStar Notifications and/or the service for the resource for which the notification is created.
	DetailType DetailType `field:"optional" json:"detailType" yaml:"detailType"`
	// The status of the notification rule.
	//
	// If the enabled is set to DISABLED, notifications aren't sent for the notification rule.
	Enabled *bool `field:"optional" json:"enabled" yaml:"enabled"`
	// The name for the notification rule.
	//
	// Notification rule names must be unique in your AWS account.
	NotificationRuleName *string `field:"optional" json:"notificationRuleName" yaml:"notificationRuleName"`
	// A list of event types associated with this notification rule.
	//
	// For a complete list of event types and IDs, see Notification concepts in the Developer Tools Console User Guide.
	// See: https://docs.aws.amazon.com/dtconsole/latest/userguide/concepts.html#concepts-api
	//
	Events *[]*string `field:"required" json:"events" yaml:"events"`
	// The Amazon Resource Name (ARN) of the resource to associate with the notification rule.
	//
	// Currently, Supported sources include pipelines in AWS CodePipeline, build projects in AWS CodeBuild, and repositories in AWS CodeCommit in this L2 constructor.
	// See: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-codestarnotifications-notificationrule.html#cfn-codestarnotifications-notificationrule-resource
	//
	Source INotificationRuleSource `field:"required" json:"source" yaml:"source"`
	// The targets to register for the notification destination.
	Targets *[]INotificationRuleTarget `field:"optional" json:"targets" yaml:"targets"`
}

Properties for a new notification rule.

Example:

import notifications "github.com/aws/aws-cdk-go/awscdk"
import codebuild "github.com/aws/aws-cdk-go/awscdk"
import sns "github.com/aws/aws-cdk-go/awscdk"
import chatbot "github.com/aws/aws-cdk-go/awscdk"

project := codebuild.NewPipelineProject(this, jsii.String("MyProject"))

topic := sns.NewTopic(this, jsii.String("MyTopic1"))

slack := chatbot.NewSlackChannelConfiguration(this, jsii.String("MySlackChannel"), &slackChannelConfigurationProps{
	slackChannelConfigurationName: jsii.String("YOUR_CHANNEL_NAME"),
	slackWorkspaceId: jsii.String("YOUR_SLACK_WORKSPACE_ID"),
	slackChannelId: jsii.String("YOUR_SLACK_CHANNEL_ID"),
})

rule := notifications.NewNotificationRule(this, jsii.String("NotificationRule"), &notificationRuleProps{
	source: project,
	events: []*string{
		jsii.String("codebuild-project-build-state-succeeded"),
		jsii.String("codebuild-project-build-state-failed"),
	},
	targets: []iNotificationRuleTarget{
		topic,
	},
})
rule.addTarget(slack)

type NotificationRuleSourceConfig

type NotificationRuleSourceConfig struct {
	// The Amazon Resource Name (ARN) of the notification source.
	SourceArn *string `field:"required" json:"sourceArn" yaml:"sourceArn"`
}

Information about the Codebuild or CodePipeline associated with a notification source.

Example:

// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import "github.com/aws/aws-cdk-go/awscdk"

notificationRuleSourceConfig := &notificationRuleSourceConfig{
	sourceArn: jsii.String("sourceArn"),
}

type NotificationRuleTargetConfig

type NotificationRuleTargetConfig struct {
	// The Amazon Resource Name (ARN) of the Amazon SNS topic or AWS Chatbot client.
	TargetAddress *string `field:"required" json:"targetAddress" yaml:"targetAddress"`
	// The target type.
	//
	// Can be an Amazon SNS topic or AWS Chatbot client.
	TargetType *string `field:"required" json:"targetType" yaml:"targetType"`
}

Information about the SNS topic or AWS Chatbot client associated with a notification target.

Example:

// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import "github.com/aws/aws-cdk-go/awscdk"

notificationRuleTargetConfig := &notificationRuleTargetConfig{
	targetAddress: jsii.String("targetAddress"),
	targetType: jsii.String("targetType"),
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL