DescribeLifecycleHooks

Last updated: 2020-03-06 20:45:42

PDF

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.

Note: This API supports Finance regions. If the common parameter Region is a Finance region, a domain name with the Finance region needs to be specified, for example: as.ap-shanghai-fsi.tencentcloudapi.com

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 parameter. The value used for this API: DescribeLifecycleHooks.
Version Yes String Common parameter. The value used for this API: 2018-04-19.
Region Yes String Common parameter. 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 Filter.
  • 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 auto scaling group ID.

  • Filter.
  • 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 auto scaling group ID.

  • The maximum number of Filters per request is 10. The upper limit for Filter.Values is 5. This parameter does not support specifying both LifecycleHookIds and Filters 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, which is returned for each request. RequestId is required for locating a problem.

    4. Example

    Example1 Querying Lifecycle Hooks

    Input Example

    https://as.tencentcloudapi.com/?Action=DescribeLifecycleHooks
    &<common request parameters>

    Output Example

    {
      "Response": {
        "TotalCount": 4,
        "LifecycleHookSet": [
          {
            "LifecycleHookName": "terminate-topic",
            "AutoScalingGroupId": "asg-8fbozqja",
            "HeartbeatTimeout": 120,
            "NotificationMetadata": "topic",
            "NotificationTarget": {
              "TargetType": "CMQ_TOPIC",
              "TopicName": "one-topic",
              "QueueName": ""
            },
            "CreatedTime": "2019-04-19T02:59:30Z",
            "DefaultResult": "ABANDON",
            "LifecycleHookId": "ash-oq76wsrx",
            "LifecycleTransition": "INSTANCE_TERMINATING"
          },
          {
            "LifecycleHookName": "launch-queue",
            "AutoScalingGroupId": "asg-8fbozqja",
            "HeartbeatTimeout": 120,
            "NotificationMetadata": "queue",
            "NotificationTarget": {
              "TargetType": "CMQ_QUEUE",
              "TopicName": "",
              "QueueName": "one-queue"
            },
            "CreatedTime": "2019-04-19T02:57:14Z",
            "DefaultResult": "CONTINUE",
            "LifecycleHookId": "ash-fbjiexz7",
            "LifecycleTransition": "INSTANCE_LAUNCHING"
          },
          {
            "LifecycleHookName": "one-hook",
            "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",
            "AutoScalingGroupId": "asg-8fbozqja",
            "HeartbeatTimeout": 300,
            "NotificationMetadata": "",
            "NotificationTarget": {
              "TargetType": "",
              "TopicName": "",
              "QueueName": ""
            },
            "CreatedTime": "2019-04-19T02:51:24Z",
            "DefaultResult": "CONTINUE",
            "LifecycleHookId": "ash-8azjzxj9",
            "LifecycleTransition": "INSTANCE_LAUNCHING"
          }
        ],
        "RequestId": "dff07f6e-bdbc-4532-baeb-e7fb3aebe248"
      }
    }

    Example2 Querying Lifecycle Hooks with a Filter

    Input Example

    https://as.tencentcloudapi.com/?Action=DescribeLifecycleHooks
    &Filters.0.Name=lifecycle-hook-id
    &Filters.0.Values.0=ash-oq76wsrx
    &Filters.0.Values.1=ash-fbjiexz7
    &Filters.1.Name=auto-scaling-group-id
    &Filters.1.Values.0=asg-8fbozqja
    &<common request parameters>

    Output Example

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

    5. Developer Resources

    API Explorer

    This tool allows online call, signature authentication, SDK code generation and quick search of APIs to greatly improve the efficiency of using TencentCloud APIs.

    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 Internal error.
    InvalidFilter Invalid filter.
    InvalidParameter Invalid parameter.
    InvalidParameter.Conflict Multiple parameters specified conflict and cannot co-exist.
    MissingParameter Missing parameter.