as — Auto Scaling
as · 2018-04-19
CreateLifecycleHook
POST
Creating a lifecycle hook.
Wire call
Converge Cloud is RPC over HTTP. There is one path — / — and the action travels in the X-TC-Action header. The /as/CreateLifecycleHook path used in the OpenAPI document is a documentation convenience so each action is addressable; it is not a route on the server.
curl
curl -sS https://as.api3.convergecloud.com/ \
-H 'Authorization: TC3-HMAC-SHA256 Credential=<SecretId>/<YYYY-MM-DD>/as/tc3_request, SignedHeaders=content-type;host;x-tc-action, Signature=<sig>' \
-H 'Content-Type: application/json; charset=utf-8' \
-H 'Host: as.api3.convergecloud.com' \
-H 'X-TC-Action: CreateLifecycleHook' \
-H 'X-TC-Version: 2018-04-19' \
-H 'X-TC-Timestamp: <unix-seconds>' \
-H 'X-TC-Region: luzon' \
-d '{"AutoScalingGroupId":"<AutoScalingGroupId>","LifecycleHookName":"<LifecycleHookName>","LifecycleTransition":"<LifecycleTransition>"}'Request parameters
| Field | Type | Required | Description |
|---|---|---|---|
| AutoScalingGroupId | string | Yes | Scaling group ID. obtain available scaling group ids in the following ways:. |
| LifecycleHookName | string | Yes | Lifecycle hook name, which can contain Chinese characters, letters, numbers, underscores (_), hyphens (-), and periods (.) with a maximum length of 128 bytes. |
| LifecycleTransition | string | Yes | Scenario for performing the lifecycle hook. valid values:. |
| DefaultResult | string | No | Action to be taken by the scaling group in case of lifecycle hook timeout or LifecycleCommand execution failure. valid values:. |
| HeartbeatTimeout | integer | No | The maximum length of time (in seconds) that can elapse before the lifecycle hook times out. Value range: 30-7200. Default value: 300 |
| NotificationMetadata | string | No | Additional information of a notification that auto scaling sends to targets. this parameter is set when you configure a notification (default value: ""), with a maximum length of 1024 characters. NotificationMetadata and LifecycleCommand are mutually exclusive, and either can be specified. |
| NotificationTarget | NotificationTarget | No | Notification target. `NotificationTarget` and `LifecycleCommand` cannot be specified at the same time. |
| LifecycleTransitionType | string | No | Specifies the scenario type for performing the lifecycle hook. valid values: NORMAL and EXTENSION. default value: NORMAL. |
| LifecycleCommand | LifecycleCommand | No | Specifies the remote command execution object. NotificationTarget and NotificationMetadata are mutually exclusive with this parameter. either cannot be specified simultaneously. |
Response
Fields are returned inside the Response envelope. Converge Cloud answers HTTP 200 for errors as well as successes, so read Response.Error rather than the status code — and test for the presence of that object, because Code is occasionally the empty string.
| Field | Type | Description |
|---|---|---|
| LifecycleHookId | string | Lifecycle hook ID |
| 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. |
Success
{
"Response": {
"LifecycleHookId": …,
"RequestId": "…"
}
}Error
{
"Response": {
"Error": { "Code": "…", "Message": "…" },
"RequestId": "…"
}
}Try it
CredentialThe key never leaves this tab — it signs the request here. The signed request goes to /api-relay/as.
Request bodyvalid JSONPOST as.api3.convergecloud.com · CreateLifecycleHook
What failure looks like
Example error responses for this action. Match on Code.
Recorded error 1
{
"Response": {
"Error": {
"Code": "ResourceNotFound.AutoScalingGroupNotFound",
"Message": "The specified auto scaling group `asg-00000000` is not found."
},
"RequestId": "d0c74ba7-4c59-64dc-f5b1-94cb830e61ee"
}
}