Skip to content
v2.278.0

QueueHook Class ​

Use an SQS queue as a hook target.

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_sqs as sqs } from 'aws-cdk-lib';

declare const queue: sqs.Queue;
const queueHook = new autoscaling_hooktargets.QueueHook(queue);
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_sqs as sqs

# queue: sqs.Queue

queue_hook = autoscaling_hooktargets.QueueHook(queue)
java
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.services.autoscaling.hooktargets.*;
import software.amazon.awscdk.services.sqs.*;

Queue queue;

QueueHook queueHook = new QueueHook(queue);
csharp
// Install: dotnet add package Amazon.CDK.Lib
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK.AWS.AutoScaling.HookTargets;
using Amazon.CDK.AWS.SQS;

Queue queue;

var queueHook = new QueueHook(queue);
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 queue Queue

queueHook := awscdk.Aws_autoscaling_hooktargets.NewQueueHook(queue)

Initializer ​

ts
new QueueHook(queue: IQueue)
python
QueueHook(queue: IQueue)
java
new QueueHook(IQueue queue)
csharp
new QueueHook(IQueue queue)
go
NewQueueHook(Queue IQueue)

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 access to send messages.

Otherwise, create a new IRole and grant it access to send messages.

returns

Returns: the IRole with access to send messages and the ARN of the queue it has access to send messages to.