Security News
JavaScript Leaders Demand Oracle Release the JavaScript Trademark
In an open letter, JavaScript community leaders urge Oracle to give up the JavaScript trademark, arguing that it has been effectively abandoned through nonuse.
@aws-cdk/aws-codestarnotifications
Advanced tools
The CDK Construct Library for AWS::CodeStarNotifications
@aws-cdk/aws-codestarnotifications is an AWS CDK library that allows you to create and manage AWS CodeStar Notifications. This package helps you set up notifications for various AWS Code services like CodeBuild, CodePipeline, and CodeCommit, enabling you to receive alerts on different events such as build failures, pipeline state changes, and repository updates.
Create Notification Rule for CodeBuild
{"TypeScript":"import * as cdk from '@aws-cdk/core';\nimport * as codestarnotifications from '@aws-cdk/aws-codestarnotifications';\nimport * as codebuild from '@aws-cdk/aws-codebuild';\n\nconst app = new cdk.App();\nconst stack = new cdk.Stack(app, 'MyStack');\n\nconst project = new codebuild.PipelineProject(stack, 'MyProject');\n\nnew codestarnotifications.NotificationRule(stack, 'MyNotificationRule', {\n source: project,\n events: [\n 'codebuild-project-build-state-succeeded',\n 'codebuild-project-build-state-failed'\n ],\n targets: [\n new codestarnotifications.SlackChannelConfiguration(stack, 'MySlackChannel', {\n slackChannelConfigurationName: 'my-slack-channel',\n slackWorkspaceId: 'T00000000',\n slackChannelId: 'C00000000'\n })\n ]\n});","description":"This code sample demonstrates how to create a notification rule for an AWS CodeBuild project. The rule triggers notifications for build state changes (succeeded or failed) and sends them to a specified Slack channel."}
Create Notification Rule for CodePipeline
{"TypeScript":"import * as cdk from '@aws-cdk/core';\nimport * as codestarnotifications from '@aws-cdk/aws-codestarnotifications';\nimport * as codepipeline from '@aws-cdk/aws-codepipeline';\n\nconst app = new cdk.App();\nconst stack = new cdk.Stack(app, 'MyStack');\n\nconst pipeline = new codepipeline.Pipeline(stack, 'MyPipeline');\n\nnew codestarnotifications.NotificationRule(stack, 'MyNotificationRule', {\n source: pipeline,\n events: [\n 'codepipeline-pipeline-pipeline-execution-failed',\n 'codepipeline-pipeline-pipeline-execution-succeeded'\n ],\n targets: [\n new codestarnotifications.SlackChannelConfiguration(stack, 'MySlackChannel', {\n slackChannelConfigurationName: 'my-slack-channel',\n slackWorkspaceId: 'T00000000',\n slackChannelId: 'C00000000'\n })\n ]\n});","description":"This code sample demonstrates how to create a notification rule for an AWS CodePipeline. The rule triggers notifications for pipeline execution state changes (succeeded or failed) and sends them to a specified Slack channel."}
Create Notification Rule for CodeCommit
{"TypeScript":"import * as cdk from '@aws-cdk/core';\nimport * as codestarnotifications from '@aws-cdk/aws-codestarnotifications';\nimport * as codecommit from '@aws-cdk/aws-codecommit';\n\nconst app = new cdk.App();\nconst stack = new cdk.Stack(app, 'MyStack');\n\nconst repository = new codecommit.Repository(stack, 'MyRepository', {\n repositoryName: 'my-repo'\n});\n\nnew codestarnotifications.NotificationRule(stack, 'MyNotificationRule', {\n source: repository,\n events: [\n 'codecommit-repository-comments-on-commits',\n 'codecommit-repository-pull-request-created'\n ],\n targets: [\n new codestarnotifications.SlackChannelConfiguration(stack, 'MySlackChannel', {\n slackChannelConfigurationName: 'my-slack-channel',\n slackWorkspaceId: 'T00000000',\n slackChannelId: 'C00000000'\n })\n ]\n});","description":"This code sample demonstrates how to create a notification rule for an AWS CodeCommit repository. The rule triggers notifications for events such as comments on commits and pull request creation, and sends them to a specified Slack channel."}
@aws-cdk/aws-sns is a CDK library for creating and managing Amazon Simple Notification Service (SNS) topics. While it provides a broader range of notification capabilities beyond CodeStar services, it requires more manual setup for integrating with CodeBuild, CodePipeline, and CodeCommit.
@aws-cdk/aws-chatbot is a CDK library for setting up AWS Chatbot, which integrates with Slack and Amazon Chime to provide notifications. It can be used in conjunction with SNS to receive notifications from various AWS services, including CodeStar services, but requires additional configuration.
@aws-cdk/aws-events is a CDK library for creating and managing Amazon EventBridge (formerly CloudWatch Events) rules. It allows you to route events from various AWS services to different targets, including SNS and Lambda. It provides more flexibility but requires more setup compared to @aws-cdk/aws-codestarnotifications.
This module is part of the AWS Cloud Development Kit project.
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.
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
.import * as notifications from '@aws-cdk/aws-codestarnotifications';
import * as codebuild from '@aws-cdk/aws-codebuild';
import * as sns from '@aws-cdk/aws-sns';
import * as chatbot from '@aws-cdk/aws-chatbot';
const project = new codebuild.PipelineProject(this, 'MyProject');
const topic = new sns.Topic(this, 'MyTopic1');
const slack = new chatbot.SlackChannelConfiguration(this, 'MySlackChannel', {
slackChannelConfigurationName: 'YOUR_CHANNEL_NAME',
slackWorkspaceId: 'YOUR_SLACK_WORKSPACE_ID',
slackChannelId: 'YOUR_SLACK_CHANNEL_ID',
});
const rule = new notifications.NotificationRule(this, 'NotificationRule', {
source: project,
events: [
'codebuild-project-build-state-succeeded',
'codebuild-project-build-state-failed',
],
targets: [topic],
});
rule.addTarget(slack);
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.For the complete list of supported event types for CodeBuild and CodePipeline, see:
FAQs
The CDK Construct Library for AWS::CodeStarNotifications
The npm package @aws-cdk/aws-codestarnotifications receives a total of 122,066 weekly downloads. As such, @aws-cdk/aws-codestarnotifications popularity was classified as popular.
We found that @aws-cdk/aws-codestarnotifications demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 4 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
In an open letter, JavaScript community leaders urge Oracle to give up the JavaScript trademark, arguing that it has been effectively abandoned through nonuse.
Security News
The initial version of the Socket Python SDK is now on PyPI, enabling developers to more easily interact with the Socket REST API in Python projects.
Security News
Floating dependency ranges in npm can introduce instability and security risks into your project by allowing unverified or incompatible versions to be installed automatically, leading to unpredictable behavior and potential conflicts.