GetLifecycle

Updated at:

Retrieves the lifecycle of an instance.

Operation description

Retrieves the lifecycle transition information of an instance. You can obtain the details of an instance transitioning to a specific state at a certain point in time.

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

The table below describes the authorization required to call this API. You can define it in a Resource Access Management (RAM) policy. The table's columns are detailed below:

  • Action: The actions can be used in the Action element of RAM permission policy statements to grant permissions to perform the operation.

  • API: The API that you can call to perform the action.

  • Access level: The predefined level of access granted for each API. Valid values: create, list, get, update, and delete.

  • Resource type: The type of the resource that supports authorization to perform the action. It indicates if the action supports resource-level permission. The specified resource must be compatible with the action. Otherwise, the policy will be ineffective.

    • For APIs with resource-level permissions, required resource types are marked with an asterisk (*). Specify the corresponding Alibaba Cloud Resource Name (ARN) in the Resource element of the policy.

    • For APIs without resource-level permissions, it is shown as All Resources. Use an asterisk (*) in the Resource element of the policy.

  • Condition key: The condition keys defined by the service. The key allows for granular control, applying to either actions alone or actions associated with specific resources. In addition to service-specific condition keys, Alibaba Cloud provides a set of common condition keys applicable across all RAM-supported services.

  • Dependent action: The dependent actions required to run the action. To complete the action, the RAM user or the RAM role must have the permissions to perform all dependent actions.

Action

Access level

Resource type

Condition key

Dependent action

paidsw:GetLifecycle

get

*All Resource

*

None None

Request syntax

GET /api/v2/instances/{InstanceId}/lifecycle HTTP/1.1

Path Parameters

Parameter

Type

Required

Description

Example

InstanceId

string

Yes

The instance ID. For more information about how to obtain the instance ID, see ListInstances.

dsw-9698d842b6***

Request parameters

Parameter

Type

Required

Description

Example

SessionNumber

integer

No

A session represents the process of an instance from startup to failure or stop. SessionNumber indicates the sequence number offset of the instance session.

1

StartTime

string

No

The start time of the query.

2020-11-08T15:00:00Z

EndTime

string

No

The end time of the query.

2020-11-08T15:00:00Z

Limit

integer

No

The maximum number of sessions to return in the query.

1

Order

string

No

The sort order of the results. Valid values:

  • ASC: Ascending order by time.

  • DESC: Descending order by time.

DESC

Token

string

No

The token used to share the URL.

eyJhbGciOiJSUzI1NiJ9.****.****

Response elements

Element

Type

Description

Example

object

The lifecycle query results.

RequestId

string

The request ID.

E7D55162-4489-1619-AAF5-3F97D5FC****

Success

boolean

Indicates whether the request is successful. Valid values:

  • true: Successful.

  • false: Failed.

true

Message

string

The operation result message.

"XXX"

Code

string

The status code. Valid values:

  • InternalError: An internal error occurred. All errors other than parameter validation errors are classified as internal errors.

  • ValidationError: A parameter validation error occurred.

null

Lifecycle

array<object>

The retrieved instance epoch details.

[[{"Status":"Creating","GmtCreateTime":"2022-09-19T22:38:00Z","Reason":"","ReasonCode":""}]]

array<object>

The list of lifecycle results. Each item represents the lifecycle of a session.

object

The lifecycle details of a session.

Status

string

The status of the instance. Valid values:

  • Creating: The instance is being created.

  • SaveFailed: The instance image failed to be saved.

  • Stopped: The instance is stopped.

  • Failed: The instance creation failed.

  • ResourceAllocating: Resources are being prepared.

  • Stopping: The instance is being stopped.

  • Updating: The instance is being updated.

  • Saving: The instance is being saved.

  • Starting: The instance is being started.

  • Running: The instance is running.

  • Saved: The instance is saved.

  • EnvPreparing: The environment is being prepared.

  • ArrearStopping: The instance is being stopped due to an overdue payment.

  • Arrearge: The instance is stopped due to an overdue payment.

  • Queuing: The instance is queued.

  • Recovering: The instance is being recovered.

Valid values:

  • ArrearStopping :

    ArrearStopping

  • Creating :

    Creating

  • SaveFailed :

    SaveFailed

  • Stopped :

    Stopped

  • Failed :

    Failed

  • ResourceAllocating :

    ResourceAllocating

  • Stopping :

    Stopping

  • Updating :

    Updating

  • Saving :

    Saving

  • Arrearge :

    Arrearge

  • Queuing :

    Queuing

  • Recovering :

    Recovering

  • Starting :

    Starting

  • Running :

    Running

  • Saved :

    Saved

  • EnvPreparing :

    EnvPreparing

Starting

ReasonCode

string

The reason code for an event.

“”

ReasonMessage

string

The description of the reason for an event.

“”

GmtCreateTime

string

The time when the instance transitioned to this status in GMT.

2022-10-21T07:27:44Z

GmtEndTime

string

The end time of the lifecycle record.

2026-11-30T09:51:37Z

LifecycleId

string

The ID of the lifecycle record.

2d5b2551-4a41-4a41-4a41-5b25515b2551

TotalCount

integer

The total number of sessions returned by the query.

35

Examples

Success response

JSON format

{
  "RequestId": "E7D55162-4489-1619-AAF5-3F97D5FC****",
  "Success": true,
  "Message": "\"XXX\"",
  "Code": "null",
  "Lifecycle": [
    [
      {
        "Status": "Starting",
        "ReasonCode": "“”",
        "ReasonMessage": "“”",
        "GmtCreateTime": "2022-10-21T07:27:44Z",
        "GmtEndTime": "2026-11-30T09:51:37Z",
        "LifecycleId": "2d5b2551-4a41-4a41-4a41-5b25515b2551"
      }
    ]
  ],
  "TotalCount": 35
}

Error codes

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.