doc-exports/docs/opengauss/api-ref/opengauss_newapi_0072.html
Ru, Li Yi d97aea4dd2 opengauss_api
Reviewed-by: Boka, Ladislav <ladislav.boka@t-systems.com>
Co-authored-by: Ru, Li Yi <liyiru7@huawei.com>
Co-committed-by: Ru, Li Yi <liyiru7@huawei.com>
2024-09-06 09:04:21 +00:00

28 KiB

Querying Tasks

Function

This API is used to query the tasks in the task center. Before calling this API:

Constraints

The tasks of the last month can be queried at most.

URI

  • URI format

    GET https://{Endpoint}/v3/{project_id}/tasks

  • Example
  • Parameter description
    Table 1 Parameter description

    Name

    Mandatory

    Type

    Description

    project_id

    Yes

    String

    Project ID of a tenant in a region.

    To obtain this value, see Obtaining a Project ID.

    status

    No

    String

    Task status. Value:

    • Running
    • Completed
    • Failed

    name

    No

    String

    Task name.

    • CreateGaussDBV5Instance: Creating a DB instance
    • BackupSnapshotGaussDBV5InInstance: Creating a manual backup
    • CloneGaussDBV5NewInstance: Restoring data to a new DB instance
    • RestoreGaussDBV5InInstance: Restoring data to the original DB instance
    • RestoreGaussDBV5InInstanceToExistedInst: Restoring data to an existing DB instance
    • DeleteGaussDBV5Instance: Deleting a DB instance
    • EnlargeGaussDBV5Volume: Scaling up storage
    • ResizeGaussDBV5Flavor: Changing specifications
    • GaussDBV5ExpandClusterCN: Adding coordinator nodes
    • GaussDBV5ExpandClusterDN: Adding shards

    start_time

    No

    String

    Start time. The value is a UNIX timestamp, in milliseconds. The time zone is UTC.

    end_time

    No

    String

    End time. The value is a UNIX timestamp, in milliseconds. The time zone is UTC.

    offset

    No

    Integer

    Index offset. If offset is set to N, the resource query starts from the N+1 piece of data. The default value is 0, indicating that the query starts from the first piece of data. The value cannot be a negative number.

    limit

    No

    Integer

    Number of records to be queried. The default value is 100. The value cannot be a negative number. The minimum value is 1 and the maximum value is 100.

Request

None

Response

  • Normal response
    Table 2 Parameter description

    Name

    Type

    Description

    tasks

    Array of objects

    Task list.

    For details, see Table 3.

    total_count

    Integer

    Number of tasks.

    Table 3 tasks field data structure description

    Name

    Type

    Description

    instance_info

    Object

    Information about the instance associated with the task.

    For details, see Table 4.

    job_id

    String

    Task ID.

    name

    String

    Task name.

    status

    String

    Task status.

    process

    String

    Task progress, in percentage (%)

    fail_reason

    String

    Failure cause.

    created_at

    String

    Creation time in the "yyyy-mm-ddThh:mm:ssZ" format.

    T is the separator between the calendar and the hourly notation of time. Z indicates the time zone offset.

    ended_at

    String

    End time in the "yyyy-mm-ddThh:mm:ssZ" format.

    T is the separator between the calendar and the hourly notation of time. Z indicates the time zone offset.

    Table 4 instance_info field data structure description

    Name

    Type

    Description

    instance_id

    String

    DB instance ID.

    instance_name

    String

    DB instance name.

    instance_status

    String

    Instance status.

  • Example normal response
    { 
      "tasks" : [ { 
        "instance_info" : { 
          "instance_id" : "ce2dce50f365430abe161bab79495a6ein14", 
          "instance_name" : "gauss-6568-zzh", 
          "instance_status" : "creating" 
        }, 
        "job_id" : "03bc055a-135c-4245-8bd8-b0bc6d3350b3", 
        "name" : "CreateGaussDBV5Instance", 
        "status" : "Failed", 
        "process" : null,
        "fail_reason" : "An exception occurs when the ECS processes services.",
        "created_at": "2022-08-05T08:15:07+0800",
        "ended_at": "2022-08-09T03:06:52+0800"
      }, { 
        "instance_info" : { 
          "instance_id" : "20ba433bd7ee40da9cf35064f04f9e4cin14", 
          "instance_name" : "gauss-7875-lt-m", 
          "instance_status" : "deleted" 
        }, 
        "job_id" : "2cc16e0b-75ab-4a28-9453-16517e990bba", 
        "name" : "DeleteGaussDBV5Instance", 
        "status" : "Completed", 
        "process" : null,
        "fail_reason" : null,
        "created_at": "2022-08-06T09:15:07+0800",
        "ended_at": "2022-08-10T03:06:52+0800"
      } ], 
      "total_count" : 2 
    }
  • Abnormal response

    For details, see Abnormal Request Results.

Status Code

Error Code

For details, see Error Codes.