TopicHook Class
Use an SNS topic as a hook target.
| Source | aws-autoscaling-hooktargets/lib/topic-hook.ts |
|---|---|
| Type last changed |
Example
ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_autoscaling_hooktargets as autoscaling_hooktargets } from 'aws-cdk-lib';
import { aws_sns as sns } from 'aws-cdk-lib';
declare const topic: sns.Topic;
const topicHook = new autoscaling_hooktargets.TopicHook(topic);
python
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_autoscaling_hooktargets as autoscaling_hooktargets
from aws_cdk import aws_sns as sns
# topic: sns.Topic
topic_hook = autoscaling_hooktargets.TopicHook(topic)
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
// 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"
import "github.com/aws/aws-cdk-go/awscdk"
var topic Topic
topicHook := awscdk.Aws_autoscaling_hooktargets.NewTopicHook(topic)
Initializer
Methods
bind(_scope: Construct, options: BindHookTargetOptions): LifecycleHookTargetConfigdef bind(self, _scope: Construct, options: BindHookTargetOptions) -> LifecycleHookTargetConfigpublic LifecycleHookTargetConfig bind(Construct _scope, BindHookTargetOptions options)public LifecycleHookTargetConfig Bind(Construct _scope, BindHookTargetOptions options)func Bind(_scope Construct, Options BindHookTargetOptions) LifecycleHookTargetConfig #If an `IRole` is found in `options`, grant it topic publishing permissions.
Otherwise, create a new IRole and grant it topic publishing permissions.
returns
Returns: the IRole with topic publishing permissions and the ARN of the topic it has publishing permission to.