SlackChannelConfiguration L2 construct
A new Slack channel configuration.
Example
import * as chatbot from 'aws-cdk-lib/aws-chatbot';
declare const project: codebuild.Project;
const target = new chatbot.SlackChannelConfiguration(this, 'MySlackChannel', {
slackChannelConfigurationName: 'YOUR_CHANNEL_NAME',
slackWorkspaceId: 'YOUR_SLACK_WORKSPACE_ID',
slackChannelId: 'YOUR_SLACK_CHANNEL_ID',
});
const rule = project.notifyOnBuildSucceeded('NotifyOnBuildSucceeded', target);
import aws_cdk.aws_chatbot as chatbot
# project: codebuild.Project
target = chatbot.SlackChannelConfiguration(self, "MySlackChannel",
slack_channel_configuration_name="YOUR_CHANNEL_NAME",
slack_workspace_id="YOUR_SLACK_WORKSPACE_ID",
slack_channel_id="YOUR_SLACK_CHANNEL_ID"
)
rule = project.notify_on_build_succeeded("NotifyOnBuildSucceeded", target)
import software.amazon.awscdk.services.chatbot.*;
Project project;
SlackChannelConfiguration target = SlackChannelConfiguration.Builder.create(this, "MySlackChannel")
.slackChannelConfigurationName("YOUR_CHANNEL_NAME")
.slackWorkspaceId("YOUR_SLACK_WORKSPACE_ID")
.slackChannelId("YOUR_SLACK_CHANNEL_ID")
.build();
INotificationRule rule = project.notifyOnBuildSucceeded("NotifyOnBuildSucceeded", target);
// Install: dotnet add package Amazon.CDK.Lib
using Amazon.CDK.AWS.Chatbot;
Project project;
var target = new SlackChannelConfiguration(this, "MySlackChannel", new SlackChannelConfigurationProps {
SlackChannelConfigurationName = "YOUR_CHANNEL_NAME",
SlackWorkspaceId = "YOUR_SLACK_WORKSPACE_ID",
SlackChannelId = "YOUR_SLACK_CHANNEL_ID"
});
var rule = project.NotifyOnBuildSucceeded("NotifyOnBuildSucceeded", target);
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
import chatbot "github.com/aws/aws-cdk-go/awscdk"
var project Project
target := 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 := project.notifyOnBuildSucceeded(jsii.String("NotifyOnBuildSucceeded"), target)
Initializer
new SlackChannelConfiguration(scope: Construct, id: string, props: SlackChannelConfigurationProps)
SlackChannelConfiguration(scope: Construct, id: str, props: SlackChannelConfigurationProps)
new SlackChannelConfiguration(Construct scope, String id, SlackChannelConfigurationProps props)
new SlackChannelConfiguration(Construct scope, string id, SlackChannelConfigurationProps props)
NewSlackChannelConfiguration(Scope Construct, Id *string, Props SlackChannelConfigurationProps)
Construct Props
guardrailPoliciesoptionalIManagedPolicy[]guardrail_policiesoptionaltyping.List[IManagedPolicy]guardrailPoliciesoptionalList<IManagedPolicy>GuardrailPoliciesoptionalIManagedPolicy[]GuardrailPoliciesoptional*[]IManagedPolicy#Default: The AWS managed 'AdministratorAccess' policy is applied as a default if this is not set.
loggingLeveloptionalLoggingLevellogging_leveloptionalLoggingLevelloggingLeveloptionalLoggingLevelLoggingLeveloptionalLoggingLevelLoggingLeveloptionalLoggingLevel= LoggingLevel.NONE#This property affects the log entries pushed to Amazon CloudWatch Logs.
logRetentionoptionalRetentionDayslog_retentionoptionalRetentionDayslogRetentionoptionalRetentionDaysLogRetentionoptionalRetentionDaysLogRetentionoptionalRetentionDays= logs.RetentionDays.INFINITE#When updating this property, unsetting it doesn't remove the log retention policy. To remove the retention policy, set the value to INFINITE.
logRetentionRetryOptionsoptionalLogRetentionRetryOptionslog_retention_retry_optionsoptionalLogRetentionRetryOptionslogRetentionRetryOptionsoptionalLogRetentionRetryOptionsLogRetentionRetryOptionsoptionalLogRetentionRetryOptionsLogRetentionRetryOptionsoptionalLogRetentionRetryOptions#Default: Default AWS SDK retry options.
These options control the retry policy when interacting with CloudWatch APIs.
logRetentionRoleoptionalIRolelog_retention_roleoptionalIRolelogRetentionRoleoptionalIRoleLogRetentionRoleoptionalIRoleLogRetentionRoleoptionalIRole#Default: A new role is created.
notificationTopicsoptionalITopic[]notification_topicsoptionaltyping.List[ITopic]notificationTopicsoptionalList<ITopic>NotificationTopicsoptionalITopic[]NotificationTopicsoptional*[]ITopic= None#Default: A role will be created.
slackChannelConfigurationNamestringslack_channel_configuration_namestrslackChannelConfigurationNameStringSlackChannelConfigurationNamestringSlackChannelConfigurationName*stringrequired#slackChannelIdstringslack_channel_idstrslackChannelIdStringSlackChannelIdstringSlackChannelId*stringrequired#To get the ID, open Slack, right click on the channel name in the left pane, then choose Copy Link. The channel ID is the 9-character string at the end of the URL. For example, ABCBBLZZZ.
slackWorkspaceIdstringslack_workspace_idstrslackWorkspaceIdStringSlackWorkspaceIdstringSlackWorkspaceId*stringrequired#notes
To get the workspace ID, you must perform the initial authorization flow with Slack in the AWS Chatbot console. Then you can copy and paste the workspace ID from the console. For more details, see steps 1-4 in Setting Up AWS Chatbot with Slack in the AWS Chatbot User Guide.
userRoleRequiredoptionalbooleanuser_role_requiredoptionalbooluserRoleRequiredoptionalBooleanUserRoleRequiredoptionalboolUserRoleRequiredoptional*bool= false#Properties
envResourceEnvironmentenvResourceEnvironmentenvResourceEnvironmentEnvResourceEnvironmentEnvResourceEnvironment#notes
For resources that are created and managed in a Stack (those created by creating new class instances like new Role(), new Bucket(), etc.), this is always the same as the environment of the stack they belong to.
For referenced resources (those obtained from referencing methods like Role.fromRoleArn(), Bucket.fromBucketName(), etc.), they might be different than the stack they were imported into.
grantPrincipalIPrincipalgrant_principalIPrincipalgrantPrincipalIPrincipalGrantPrincipalIPrincipalGrantPrincipalIPrincipal#PROPERTY_INJECTION_IDstringproperty_injection_idstrPROPERTY_INJECTION_IDStringPROPERTY_INJECTION_IDstringPROPERTY_INJECTION_ID*stringstatic#rolemay be undefinedIRolerolemay be undefinedIRolerolemay be undefinedIRoleRolemay be undefinedIRoleRolemay be undefinedIRole#slackChannelConfigurationArnstringslack_channel_configuration_arnstrslackChannelConfigurationArnStringSlackChannelConfigurationArnstringSlackChannelConfigurationArn*string#slackChannelConfigurationNamestringslack_channel_configuration_namestrslackChannelConfigurationNameStringSlackChannelConfigurationNamestringSlackChannelConfigurationName*string#slackChannelConfigurationRefSlackChannelConfigurationReferenceslack_channel_configuration_refSlackChannelConfigurationReferenceslackChannelConfigurationRefSlackChannelConfigurationReferenceSlackChannelConfigurationRefSlackChannelConfigurationReferenceSlackChannelConfigurationRefSlackChannelConfigurationReference#Methods
addNotificationTopic(notificationTopic: ITopic): voiddef add_notification_topic(self, notification_topic: ITopic) -> Nonepublic void addNotificationTopic(ITopic notificationTopic)public void AddNotificationTopic(ITopic notificationTopic)func AddNotificationTopic(NotificationTopic ITopic)#addToRolePolicy(statement: PolicyStatement): voiddef add_to_role_policy(self, statement: PolicyStatement) -> Nonepublic void addToRolePolicy(PolicyStatement statement)public void AddToRolePolicy(PolicyStatement statement)func AddToRolePolicy(Statement PolicyStatement)#applyCrossStackReferenceStrength(strength: ReferenceStrength): voiddef apply_cross_stack_reference_strength(self, strength: ReferenceStrength) -> Nonepublic void applyCrossStackReferenceStrength(ReferenceStrength strength)public void ApplyCrossStackReferenceStrength(ReferenceStrength strength)func ApplyCrossStackReferenceStrength(Strength ReferenceStrength)#notes · 1 parameter
When set, any cross-stack reference to this resource will use the specified mechanism instead of the global default determined by the @aws-cdk/core:defaultCrossStackReferences context key. This is useful for selectively weakening specific references to avoid the "deadly embrace" problem without changing the app-wide default.
Parameters
strengthstrengthstrengthstrengthStrength— - The reference strength to use for this resource.
applyRemovalPolicy(policy: RemovalPolicy): voiddef apply_removal_policy(self, policy: RemovalPolicy) -> Nonepublic void applyRemovalPolicy(RemovalPolicy policy)public void ApplyRemovalPolicy(RemovalPolicy policy)func ApplyRemovalPolicy(Policy RemovalPolicy)#notes
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).
bindAsNotificationRuleTarget(_scope: Construct): NotificationRuleTargetConfigdef bind_as_notification_rule_target(self, _scope: Construct) -> NotificationRuleTargetConfigpublic NotificationRuleTargetConfig bindAsNotificationRuleTarget(Construct _scope)public NotificationRuleTargetConfig BindAsNotificationRuleTarget(Construct _scope)func BindAsNotificationRuleTarget(_scope Construct) NotificationRuleTargetConfig#fromSlackChannelConfigurationArn(scope: Construct, id: string, slackChannelConfigurationArn: string): ISlackChannelConfiguration@staticmethod def from_slack_channel_configuration_arn(scope: Construct, id: str, slack_channel_configuration_arn: str) -> ISlackChannelConfigurationpublic static ISlackChannelConfiguration fromSlackChannelConfigurationArn(Construct scope, String id, String slackChannelConfigurationArn)public static ISlackChannelConfiguration FromSlackChannelConfigurationArn(Construct scope, string id, string slackChannelConfigurationArn)func FromSlackChannelConfigurationArn(Scope Construct, Id *string, SlackChannelConfigurationArn *string) ISlackChannelConfigurationstatic#3 parameters · returns
Parameters
scopescopescopescopeScope— The parent creating construct.ididididId— The construct's name.slackChannelConfigurationArnslack_channel_configuration_arnslackChannelConfigurationArnslackChannelConfigurationArnSlackChannelConfigurationArn— configuration ARN (i.e. arn:aws:chatbot::123456789012:chat-configuration/slack-channel/my-slack).
Returns: a reference to the existing Slack channel configuration
isConstruct(x: any): boolean@staticmethod def is_construct(x: Any) -> boolpublic static Boolean isConstruct(Object x)public static bool IsConstruct(object x)func IsConstruct(X interface{}) *boolstatic#notes · 1 parameter · returns
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.
Parameters
xxxxX— Any object.
Returns: true if x is an object created from a class which extends Construct.
isOwnedResource(construct: IConstruct): boolean@staticmethod def is_owned_resource(construct: IConstruct) -> boolpublic static Boolean isOwnedResource(IConstruct construct)public static bool IsOwnedResource(IConstruct construct)func IsOwnedResource(Construct IConstruct) *boolstatic#isResource(construct: IConstruct): boolean@staticmethod def is_resource(construct: IConstruct) -> boolpublic static Boolean isResource(IConstruct construct)public static bool IsResource(IConstruct construct)func IsResource(Construct IConstruct) *boolstatic#metric(metricName: string, props?: MetricOptions): Metricdef metric(self, metric_name: str, props: typing.Optional[MetricOptions] = None) -> Metricpublic Metric metric(String metricName, MetricOptions props)public Metric Metric(string metricName, MetricOptions? props = null)func Metric(MetricName *string, Props MetricOptions) Metric#metricAll(metricName: string, props?: MetricOptions): Metric@staticmethod def metric_all(metric_name: str, props: typing.Optional[MetricOptions] = None) -> Metricpublic static Metric metricAll(String metricName, MetricOptions props)public static Metric MetricAll(string metricName, MetricOptions? props = null)func MetricAll(MetricName *string, Props MetricOptions) Metricstatic#toString(): stringdef to_string(self, ) -> strpublic String toString()public string ToString()func ToString() *string#with(...mixins: IMixin[]): IConstructdef with(self, mixins: IMixin) -> IConstructpublic IConstruct with(IMixin mixins)public IConstruct With(IMixin mixins)func With(Mixins IMixin) IConstruct#Mixins are applied in order. The list of constructs is captured at the start of the call, so constructs added by a mixin will not be visited. Use multiple with() calls if subsequent mixins should apply to added constructs.