FunctionHook Class
Use a Lambda Function as a hook target.
Internally creates a Topic to make the connection.
| Source | aws-autoscaling-hooktargets/lib/lambda-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_kms as kms } from 'aws-cdk-lib';
import { aws_lambda as lambda } from 'aws-cdk-lib';
declare const function_: lambda.Function;
declare const key: kms.Key;
const functionHook = new autoscaling_hooktargets.FunctionHook(function_, /* all optional props */ key);
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_kms as kms
from aws_cdk import aws_lambda as lambda_
# function_: lambda.Function
# key: kms.Key
function_hook = autoscaling_hooktargets.FunctionHook(function_, key)
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.kms.*;
import software.amazon.awscdk.services.lambda.*;
Function function_;
Key key;
FunctionHook functionHook = new FunctionHook(function_, key);
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.KMS;
using Amazon.CDK.AWS.Lambda;
Function function_;
Key key;
var functionHook = new FunctionHook(function_, key);
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"
import "github.com/aws/aws-cdk-go/awscdk"
var function_ Function
var key Key
functionHook := awscdk.Aws_autoscaling_hooktargets.NewFunctionHook(function_, key)
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 the `IRole` does not exist in `options`, will create an `IRole` and an SNS Topic and attach both to the lifecycle hook.
If the IRole does exist in options, will only create an SNS Topic and attach it to the lifecycle hook.