tencent cloud

Feedback

DescribeLifecycleHooks

Last updated: 2024-12-03 17:50:41

    1. API Description

    Domain name for API request: as.intl.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.intl.tencentcloudapi.com
    Content-Type: application/json
    X-TC-Action: DescribeLifecycleHooks
    <Common request parameters>
    
    {}
    

    Output Example

    {
        "Response": {
            "TotalCount": 1,
            "LifecycleHookSet": [
                {
                    "LifecycleHookName": "terminate-topic",
                    "LifecycleTransitionType": "NORMAL",
                    "AutoScalingGroupId": "asg-8fbozqja",
                    "HeartbeatTimeout": 120,
                    "NotificationMetadata": "topic",
                    "NotificationTarget": {
                        "TargetType": "TDMQ_TOPIC",
                        "TopicName": "one-topic",
                        "QueueName": "as-tdmq-queue"
                    },
                    "LifecycleCommand": {
                        "CommandId": "cmd-hyg5r4e3",
                        "Parameters": "{123: 222}"
                    },
                    "CreatedTime": "2019-04-19T02:59:30Z",
                    "DefaultResult": "ABANDON",
                    "LifecycleHookId": "ash-oq76wsrx",
                    "LifecycleTransition": "INSTANCE_TERMINATING"
                }
            ],
            "RequestId": "dff07f6e-bdbc-4532-baeb-e7fb3aebe248"
        }
    }
    

    Example2 Querying Lifecycle Hooks by Using Filters

    Input Example

    POST / HTTP/1.1
    Host: as.intl.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"
                ],
                "Name": "lifecycle-hook-id"
            }
        ]
    }
    

    Output Example

    {
        "Response": {
            "TotalCount": 1,
            "LifecycleHookSet": [
                {
                    "LifecycleHookName": "launch-queue",
                    "LifecycleTransitionType": "NORMAL",
                    "AutoScalingGroupId": "asg-8fbozqja",
                    "HeartbeatTimeout": 120,
                    "NotificationMetadata": "queue",
                    "NotificationTarget": {
                        "TargetType": "TDMQ_QUEUE",
                        "TopicName": "as-topic-0",
                        "QueueName": "one-queue"
                    },
                    "LifecycleCommand": {
                        "CommandId": "cmd-j87y5tr4",
                        "Parameters": "{123: 222}"
                    },
                    "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.