tencent cloud

Feedback

DescribeLifecycleHooks

Last updated: 2024-10-25 15:16:21

    1. API Description

    Domain name for API request: as.tencentcloudapi.com.

    This API (DescribeLifecycleHooks) is used to query the information of lifecycle hooks.

    • You can query the details of lifecycle hooks based on information such as auto scaling group ID, lifecycle hook ID, or lifecycle hook name. For more information on filters, see Filter.
    • If the parameter is empty, a certain number (specified by Limit and 20 by default) of lifecycle hooks of the current user will be returned.

    A maximum of 20 requests can be initiated per second for this API.

    We recommend you to use API Explorer
    Try it
    API Explorer provides a range of capabilities, including online call, signature authentication, SDK code generation, and API quick search. It enables you to view the request, response, and auto-generated examples.

    2. Input Parameters

    The following request parameter list only provides API request parameters and some common parameters. For the complete common parameter list, see Common Request Parameters.

    Parameter Name Required Type Description
    Action Yes String Common Params. The value used for this API: DescribeLifecycleHooks.
    Version Yes String Common Params. The value used for this API: 2018-04-19.
    Region Yes String Common Params. For more information, please see the list of regions supported by the product.
    LifecycleHookIds.N No Array of String Queries by one or more lifecycle hook IDs in the format of ash-8azjzxcl. The maximum quantity per request is 100. This parameter does not support specifying both LifecycleHookIds and Filters at the same time.
    Filters.N No Array of Filter Filters.
  • lifecycle-hook-id - String - Required: No - (Filter) Filter by lifecycle hook ID.
  • lifecycle-hook-name - String - Required: No - (Filter) Filter by lifecycle hook name.
  • auto-scaling-group-id - String - Required: No - (Filter) Filter by scaling group ID.

  • Up to 10 filters can be included in a request and up to 5 values for each filter. It cannot be specified with LifecycleHookIds at the same time.
    Limit No Integer Number of returned results. Default value: 20. Maximum value: 100. For more information on Limit, see the relevant section in the API overview.
    Offset No Integer Offset. Default value: 0. For more information on Offset, see the relevant section in the API overview.

    3. Output Parameters

    Parameter Name Type Description
    LifecycleHookSet Array of LifecycleHook Array of lifecycle hooks
    TotalCount Integer Total quantity
    RequestId String The unique request ID, generated by the server, will be returned for every request (if the request fails to reach the server for other reasons, the request will not obtain a RequestId). RequestId is required for locating a problem.

    4. Example

    Example1 Querying lifecycle hooks

    Input Example

    POST / HTTP/1.1
    Host: as.tencentcloudapi.com
    Content-Type: application/json
    X-TC-Action: DescribeLifecycleHooks
    <Common request parameters>
    
    {}
    

    Output Example

    {
        "Response": {
            "TotalCount": 4,
            "LifecycleHookSet": [
                {
                    "LifecycleHookName": "terminate-topic",
                    "LifecycleTransitionType": "NORMAL",
                    "AutoScalingGroupId": "asg-8fbozqja",
                    "HeartbeatTimeout": 120,
                    "NotificationMetadata": "topic",
                    "NotificationTarget": {
                        "TargetType": "TDMQ_TOPIC",
                        "TopicName": "one-topic",
                        "QueueName": ""
                    },
                    "LifecycleCommand": {
                        "CommandId": "",
                        "Parameters": ""
                    },
                    "CreatedTime": "2019-04-19T02:59:30Z",
                    "DefaultResult": "ABANDON",
                    "LifecycleHookId": "ash-oq76wsrx",
                    "LifecycleTransition": "INSTANCE_TERMINATING"
                },
                {
                    "LifecycleHookName": "launch-queue",
                    "LifecycleTransitionType": "NORMAL",
                    "AutoScalingGroupId": "asg-8fbozqja",
                    "HeartbeatTimeout": 120,
                    "NotificationMetadata": "queue",
                    "NotificationTarget": {
                        "TargetType": "TDMQ_QUEUE",
                        "TopicName": "",
                        "QueueName": "one-queue"
                    },
                    "LifecycleCommand": {
                        "CommandId": "",
                        "Parameters": ""
                    },
                    "CreatedTime": "2019-04-19T02:57:14Z",
                    "DefaultResult": "CONTINUE",
                    "LifecycleHookId": "ash-fbjiexz7",
                    "LifecycleTransition": "INSTANCE_LAUNCHING"
                },
                {
                    "LifecycleHookName": "one-hook",
                    "LifecycleTransitionType": "NORMAL",
                    "AutoScalingGroupId": "asg-8fbozqja",
                    "HeartbeatTimeout": 360,
                    "NotificationMetadata": "",
                    "NotificationTarget": {
                        "TargetType": "",
                        "TopicName": "",
                        "QueueName": ""
                    },
                    "CreatedTime": "2019-04-19T02:56:02Z",
                    "DefaultResult": "CONTINUE",
                    "LifecycleHookId": "ash-heyubibl",
                    "LifecycleTransition": "INSTANCE_LAUNCHING"
                },
                {
                    "LifecycleHookName": "one-hook-default",
                    "LifecycleTransitionType": "NORMAL",
                    "AutoScalingGroupId": "asg-8fbozqja",
                    "HeartbeatTimeout": 300,
                    "NotificationMetadata": "",
                    "NotificationTarget": {
                        "TargetType": "",
                        "TopicName": "",
                        "QueueName": ""
                    },
                    "LifecycleCommand": {
                        "CommandId": "",
                        "Parameters": ""
                    },
                    "CreatedTime": "2019-04-19T02:51:24Z",
                    "DefaultResult": "CONTINUE",
                    "LifecycleHookId": "ash-8azjzxj9",
                    "LifecycleTransition": "INSTANCE_LAUNCHING"
                }
            ],
            "RequestId": "dff07f6e-bdbc-4532-baeb-e7fb3aebe248"
        }
    }
    

    Example2 Using Filter to query lifecycle hooks

    Input Example

    POST / HTTP/1.1
    Host: as.tencentcloudapi.com
    Content-Type: application/json
    X-TC-Action: DescribeLifecycleHooks
    <Common request parameters>
    
    {
        "Filters": [
            {
                "Values": [
                    "asg-8fbozqja"
                ],
                "Name": "auto-scaling-group-id"
            },
            {
                "Values": [
                    "ash-fbjiexz7",
                    "ash-oq76wsrx"
                ],
                "Name": "lifecycle-hook-id"
            }
        ]
    }
    

    Output Example

    {
        "Response": {
            "TotalCount": 2,
            "LifecycleHookSet": [
                {
                    "LifecycleHookName": "terminate-topic",
                    "LifecycleTransitionType": "NORMAL",
                    "AutoScalingGroupId": "asg-8fbozqja",
                    "HeartbeatTimeout": 120,
                    "NotificationMetadata": "topic",
                    "NotificationTarget": {
                        "TargetType": "TDMQ_TOPIC",
                        "TopicName": "one-topic",
                        "QueueName": ""
                    },
                    "CreatedTime": "2019-04-19T02:59:30Z",
                    "DefaultResult": "ABANDON",
                    "LifecycleHookId": "ash-oq76wsrx",
                    "LifecycleTransition": "INSTANCE_TERMINATING"
                },
                {
                    "LifecycleHookName": "launch-queue",
                    "LifecycleTransitionType": "NORMAL",
                    "AutoScalingGroupId": "asg-8fbozqja",
                    "HeartbeatTimeout": 120,
                    "NotificationMetadata": "queue",
                    "NotificationTarget": {
                        "TargetType": "TDMQ_QUEUE",
                        "TopicName": "",
                        "QueueName": "one-queue"
                    },
                    "LifecycleCommand": {
                        "CommandId": "",
                        "Parameters": ""
                    },
                    "CreatedTime": "2019-04-19T02:57:14Z",
                    "DefaultResult": "CONTINUE",
                    "LifecycleHookId": "ash-fbjiexz7",
                    "LifecycleTransition": "INSTANCE_LAUNCHING"
                }
            ],
            "RequestId": "2d774a6c-bcaa-4805-b0cd-bd64519e2538"
        }
    }
    

    5. Developer Resources

    SDK

    TencentCloud API 3.0 integrates SDKs that support various programming languages to make it easier for you to call APIs.

    Command Line Interface

    6. Error Code

    The following only lists the error codes related to the API business logic. For other error codes, see Common Error Codes.

    Error Code Description
    InternalError An internal error occurred.
    InvalidParameter Invalid parameter.
    InvalidParameter.ActionNotFound Invalid Action request.
    InvalidParameter.Conflict Multiple parameters specified conflict and cannot co-exist.
    InvalidParameterValue.InvalidAutoScalingGroupId Invalid scaling group ID.
    InvalidParameterValue.InvalidFilter Invalid filter condition.
    InvalidParameterValue.InvalidLifecycleHookId Invalid lifecycle hook ID.
    MissingParameter Parameter missing.