异步任务查询
功能介绍
该接口为扩展接口,主要用于查询异步接口执行情况,比如查询导出镜像任务的执行状态。
请求消息
请求参数
无
请求示例
查询异步接口执行情况。
GET /v1/ac234de25c6741d2b1273da49eea1b9e/jobs/ff8080814dbd65d7014dbe0d84db0013
响应消息
- 响应参数
根据job_type的取值不同,响应消息的结构会有所差异,更多响应示例请参见响应示例。
参数
参数类型
描述
status
String
任务状态,目前取值如下:
- SUCCESS:表示该任务执行已经结束,任务执行成功。
- FAIL:表示该任务执行已经结束,任务执行失败。
- RUNNING:表示该任务正在执行。
- INIT:表示该任务还未执行,正在初始化。
job_id
String
任务ID。
job_type
String
任务类型。
- imsCreateImageByInstance:云服务器创建镜像
- imsImportImageJob:外部镜像文件创建镜像
- imsImportOvaImageJob:外部Ova镜像文件创建镜像
- imsVolumeCreateImageJob:数据盘创建系统盘镜像
- imsVolumesToSysDataImagesJob:数据盘创建数据盘镜像
- imsImportDataImageJob:外部镜像文件创建数据盘镜像
- imsCreateWholeImageByInstanceJob:云服务器创建整机镜像
- imsCreateWholeImageByBackupJob:云备份或云服务器备份创建整机镜像
- imsNativeImportImageJob:注册镜像
- imsNativeExportImageJob:导出镜像
- imsAddImageMembersJob:添加镜像成员
- imsDelImageMembersJob:删除镜像成员
- imsUpdateImageMembersJob:修改镜像成员
- imsCopyImageInRegionJob:Region内复制镜像
- imsCrossRegionCopyImageJob:跨Region复制镜像
begin_time
String
任务开始执行时间。格式为UTC时间。
end_time
String
任务结束时间。格式为UTC时间。
error_code
String
错误码。
fail_reason
String
失败原因。
entities
Object
任务自定义属性。
任务正常时,返回镜像的ID;任务异常时,返回错误码和信息。
详情请参见表2。
表2 entities字段数据结构说明 参数
参数类型
描述
image_id
String
镜像ID。
当job_type取值为以下任务类型时,会返回该参数。
- imsCreateImageByInstance
- imsImportImageJob
- imsVolumeCreateImageJob
- imsImportDataImageJob
- imsCreateWholeImageByInstanceJob
- imsCreateWholeImageByBackupJob
- imsNativeImportImageJob
- imsNativeExportImageJob
- imsCopyImageInRegionJob
- imsCrossRegionCopyImageJob
current_task
String
当前任务名称。
image_name
String
镜像名称。
process_percent
Double
任务执行进度。
results
Array of result objects
批量任务执行结果。详情请参见表3。
sub_jobs_result
Array of objects
子任务执行结果。详情请参见表4。
sub_jobs_list
Array of string
子任务id列表。
addition_error_code
string
添加错误码
addition_error_msg
string
添加错误消息
error_code
string
错误码
error
string
错误消息
alarm_code
string
告警代码
表3 results字段数据结构说明 参数
参数类型
描述
image_id
String
镜像ID。
当job_type取值为以下任务类型时,会返回该参数。
- imsAddImageMembersJob
- imsUpdateImageMembersJob
project_id
String
项目ID。
status
String
任务状态。
表4 sub_jobs_result字段数据结构说明 参数
参数类型
描述
status
String
子任务状态,取值如下:
- SUCCESS:表示该任务执行已经结束,任务执行成功。
- FAIL:表示该任务执行已经结束,任务执行失败。
- RUNNING:表示该任务正在执行。
- INIT:表示该任务还未执行,正在初始化。
job_id
String
子任务ID。
job_type
String
子任务类型。
begin_time
String
子任务开始执行时间。格式为UTC时间。
end_time
String
子任务结束时间。格式为UTC时间。
error_code
String
错误码。
fail_reason
String
失败原因。
entities
Object
子任务自定义属性。详情请参见表5
- 任务正常时,返回镜像的ID。
- 任务异常时,返回错误码和信息。
响应示例
- 当任务类型为imsCreateImageByInstance,云服务器创建镜像时,响应示例如下:
{ "job_id": "9a175ac792fa12d20193002100dd2762", "job_type": "imsCreateImageByInstance", "begin_time": "2024-11-06T06:19:43.195Z", "end_time": "2024-11-06T06:23:25.158Z", "status": "SUCCESS", "error_code": null, "fail_reason": null, "entities": { "image_name": "test", "image_id": "3f7185de-b59a-4bb8-aa1d-7a513528b0e9" } }
- 当任务类型为imsImportImageJob,外部镜像文件创建镜像时,响应示例如下:
{ "job_id": "9a175ac892fa1342019300224f22218e", "job_type": "imsImportImageJob", "begin_time": "2024-11-06T06:21:08.769Z", "end_time": "2024-11-06T06:27:03.742Z", "status": "SUCCESS", "error_code": null, "fail_reason": null, "entities": { "image_name": "test", "image_id": "431df7fd-a898-4dc0-86b1-22cfefb8a517" } }
- 当任务类型为imsImportOvaImageJob,外部Ova镜像文件创建镜像时,响应示例如下:
{ "job_id": "9a175ac892fa13420193006a49173317", "job_type": "imsImportOvaImageJob", "begin_time": "2024-11-06T07:39:45.814Z", "end_time": "2024-11-06T07:49:45.814Z", "status": "SUCCESS", "error_code": null, "fail_reason": null, "entities": { "sub_jobs_result": [ { "job_id": "9a175ac892fa13420193006c29e133f0", "job_type": "imsImportImageJob", "begin_time": "2024-11-06T07:41:48.896Z", "end_time": "2024-11-06T07:49:45.814Z", "status": "SUCCESS", "error_code": null, "fail_reason": null, "entities": { "image_name": "test", "image_id": "fc496c19-40c2-4220-8b1a-eba9d53fca7b" } } ], "sub_jobs_list": [ "9a175ac892fa13420193006c29e133f0" ] } }
- 当任务类型为imsVolumeCreateImageJob,数据盘创建系统盘镜像时,响应示例如下:
{ "job_id": "9a175ac692fa125401930037d9e329aa", "job_type": "imsVolumeCreateImageJob", "begin_time": "2024-11-06T06:44:40.545Z", "end_time": "2024-11-06T06:47:40.545Z", "status": "SUCCESS", "error_code": null, "fail_reason": null, "entities": { "image_name": "test", "image_id": "21b04ab5-e817-40ee-8d56-7ccdb8820335" } }
- 当任务类型为imsImportDataImageJob,外部镜像文件创建数据盘镜像时,响应示例如下:
{ "job_id": "9a175ac692fa125401930027b9c026b3", "job_type": "imsImportDataImageJob", "begin_time": "2024-11-06T06:27:03.742Z", "end_time": "2024-11-06T06:37:03.742Z", "status": "SUCCESS", "error_code": null, "fail_reason": null, "entities": { "image_name": "test", "image_id": "aa5306f7-bc95-4fa3-aa40-dd38fbdf2031" } }
- 当任务类型为imsCreateWholeImageByInstanceJob,云服务器创建整机镜像时,响应示例如下:
{ "job_id": "9a175ac792fa12d201930028cddb29c6", "job_type": "imsCreateWholeImageByInstanceJob", "begin_time": "2024-11-06T06:28:14.425Z", "end_time": "2024-11-06T06:37:03.742Z", "status": "SUCCESS", "error_code": null, "fail_reason": null, "entities": { "image_name": "test", "image_id": "17b7bdeb-2e72-43a0-a202-d36ce344e902" } }
- 当任务类型为imsCreateWholeImageByBackupJob,云备份或云服务器备份创建整机镜像时,响应示例如下:
{ "job_id": "9a175ac892fa13420193002961972392", "job_type": "imsCreateWholeImageByBackupJob", "begin_time": "2024-11-06T06:28:52.245Z", "end_time": "2024-11-06T06:28:58.399Z", "status": "SUCCESS", "error_code": null, "fail_reason": null, "entities": { "image_name": "test", "image_id": "ea0d5dce-ddb2-4f6f-83e3-55da065347fd" } }
- 当任务类型为imsNativeImportImageJob,注册镜像时,响应示例如下:
{ "job_id": "9a175ac692fa12540193005389023059", "job_type": "imsNativeImportImageJob", "begin_time": "2024-11-06T07:14:54.848Z", "end_time": "2024-11-06T07:19:54.848Z", "status": "SUCCESS", "error_code": null, "fail_reason": null, "entities": { "image_id": "af8ea1dc-02f2-4019-8fa9-c9952a0077ce" } }
- 当任务类型为imsNativeExportImageJob,导出镜像时,响应示例如下:
{ "job_id": "9a175ac892fa134201930039db1a27b1", "job_type": "imsNativeExportImageJob", "begin_time": "2024-11-06T06:46:51.929Z", "end_time": "2024-11-06T06:49:53.657Z", "status": "SUCCESS", "error_code": null, "fail_reason": null, "entities": { "image_id": "1ab4df10-fe18-48b7-91c9-53695fcd9df5" } }
- 当任务类型为imsAddImageMembersJob,添加镜像成员时,响应示例如下:
{ "job_id": "9a175ac692fa12540193002a6d4b2720", "job_type": "imsAddImageMembersJob", "begin_time": "2024-11-06T06:30:00.778Z", "end_time": "2024-11-06T06:30:03.179Z", "status": "SUCCESS", "error_code": null, "fail_reason": null, "entities": { "results": [ { "image_id": "30e55148-deb9-4923-adb9-91618de16ba0", "status": "success" } ] } }
- 当任务类型为imsDelImageMembersJob,删除镜像成员时,响应示例如下:
{ "job_id": "9a175ac792fa12d20193002da96f2ac2", "job_type": "imsDelImageMembersJob", "begin_time": "2024-11-06T06:33:32.781Z", "end_time": "2024-11-06T06:33:34.181Z", "status": "SUCCESS", "error_code": null, "fail_reason": null, "entities": { "results": [] } }
- 当任务类型为imsUpdateImageMembersJob,修改镜像成员时,响应示例如下:
{ "job_id": "9a175ac692fa12540193005c340f321c", "job_type": "imsUpdateImageMembersJob", "begin_time": "2024-11-06T07:24:22.925Z", "end_time": "2024-11-06T07:24:23.773Z", "status": "SUCCESS", "error_code": null, "fail_reason": null, "entities": { "results": [ { "image_id": "6596628c-42d4-4ff1-8660-8ea5ae61f243", "status": "success" } ] } }
- 当任务类型为当任务类型为imsCopyImageInRegionJob,Region内复制镜像时,响应示例如下:
{ "job_id": "9a175ac892fa13420193001c2e62205a", "job_type": "imsCopyImageInRegionJob", "begin_time": "2024-11-06T06:14:27.168Z", "end_time": "2024-11-06T06:16:38.446Z", "status": "SUCCESS", "error_code": null, "fail_reason": null, "entities": { "image_name": "test", "image_id": "30e55148-deb9-4923-adb9-91618de16ba0" } }
- 当任务类型为imsCrossRegionCopyImageJob,跨Region复制镜像时,响应示例如下:
{ "job_id": "9a175ac792fa12d20193001f2a2c2641", "job_type": "imsCrossRegionCopyImageJob", "begin_time": "2024-11-06T06:17:42.699Z", "end_time": "2024-11-06T06:20:22.419Z", "status": "SUCCESS", "error_code": null, "fail_reason": null, "entities": { "image_name": "test", "image_id": "d998b96f-b7e3-4be9-b0c2-9773e592977d" } }
- 当任务类型为imsVolumesToSysDataImagesJob,数据盘创建数据盘镜像时,响应示例如下:
{ "job_id": "9a175ac792fa12d201930031febf2bdd", "job_type": "imsVolumesToSysDataImagesJob", "begin_time": "2024-11-06T06:38:16.765Z", "end_time": "2024-11-06T06:48:16.765Z", "status": "SUCCESS", "error_code": null, "fail_reason": null, "entities": { "sub_jobs_result": [ { "job_id": "9a175ac792fa12d20193003205b22be1", "job_type": "imsCopyVolumeToImageJob", "begin_time": "2024-11-06T06:38:18.545Z", "end_time": "2024-11-06T06:48:16.765Z", "status": "SUCCESS", "error_code": null, "fail_reason": null, "entities": { "image_name": "test", "image_id": "bfb2de92-e7b9-4820-9522-416d8f2c812a" } } ], "sub_jobs_list": [ "9a175ac792fa12d20193003205b22be1" ] } }