查询单个任务
功能介绍
根据指定任务ID查询任务
调用方法
请参见如何调用API。
URI
GET /v3/{project_id}/operation-logs/{operation_log_id}
参数 |
是否必选 |
参数类型 |
描述 |
---|---|---|---|
operation_log_id |
是 |
String |
任务ID |
project_id |
是 |
String |
项目ID |
请求参数
参数 |
是否必选 |
参数类型 |
描述 |
---|---|---|---|
X-Auth-Token |
是 |
String |
用户Token。 通过调用IAM服务获取用户Token接口获取(响应消息头中X-Subject-Token的值)。 |
响应参数
状态码: 200
参数 |
参数类型 |
描述 |
---|---|---|
operation_log |
OperationLog object |
任务信息 |
参数 |
参数类型 |
描述 |
---|---|---|
checkpoint_id |
String |
备份记录id |
created_at |
String |
创建时间,例如: "2020-02-23T01:00:32Z" |
ended_at |
String |
任务结束时间,例如: "2020-02-23T01:00:32Z" |
error_info |
OpErrorInfo object |
任务错误信息 |
extra_info |
OpExtraInfo object |
任务扩展信息 |
id |
String |
任务id |
operation_type |
String |
任务类型
|
policy_id |
String |
策略ID |
project_id |
String |
项目ID |
provider_id |
String |
备份提供商ID。用于区分备份对象。 |
started_at |
String |
任务开始时间,例如: "2020-02-23T01:00:32Z" |
status |
String |
任务状态
|
updated_at |
String |
修改时间,例如: "2020-02-23T01:00:32Z" |
vault_id |
String |
任务操作资源所属存储库ID |
vault_name |
String |
任务操作资源所属存储库名称 |
参数 |
参数类型 |
描述 |
---|---|---|
backup |
OpExtendInfoBckup object |
备份扩展参数 |
common |
OpExtendInfoCommon object |
公共参数 |
delete |
OpExtendInfoDelete object |
删除扩展参数 |
sync |
OpExtendInfoSync object |
扩展同步信息 |
remove_resources |
OpExtendInfoRemoveResources object |
移除Vault的资源 |
replication |
OpExtendInfoReplication object |
扩展复制信息 |
resource |
Resource object |
资源信息 |
restore |
OpExtendInfoRestore object |
扩展恢复信息 |
vault_delete |
OpExtendInfoVaultDelete object |
删除vault |
参数 |
参数类型 |
描述 |
---|---|---|
app_consistency_error_code |
String |
应用一致性备份失败错误码。请参见错误码。 |
app_consistency_error_message |
String |
应用一致性备份错误信息 |
app_consistency_status |
String |
应用一致性备份状态
|
backup_id |
String |
备份副本ID |
backup_name |
String |
备份名称 |
incremental |
String |
是否增备
|
参数 |
参数类型 |
描述 |
---|---|---|
progress |
Integer |
进度,取值为0-100 最小值:0 最大值:100 |
request_id |
String |
请求id |
task_id |
String |
备份任务id |
参数 |
参数类型 |
描述 |
---|---|---|
sync_backup_num |
Integer |
同步备份副本数 |
delete_backup_num |
Integer |
删除的备份副本数 |
err_sync_backup_num |
Integer |
同步失败备份副本数 |
参数 |
参数类型 |
描述 |
---|---|---|
fail_count |
Integer |
删除失败的资源数量 |
total_count |
Integer |
删除的备份数量 |
resources |
Array of Resource objects |
资源信息 |
参数 |
参数类型 |
描述 |
---|---|---|
extra_info |
ResourceExtraInfo object |
资源附加信息 |
id |
String |
待备份资源id |
name |
String |
待备份资源名称,长度限制:0-255 最小长度:0 最大长度:255 |
type |
String |
待备份资源的类型: OS::Nova::Server, OS::Cinder::Volume, OS::Ironic::BareMetalServer, OS::Native::Server, OS::Sfs::Turbo, OS::Workspace::DesktopV2 |
参数 |
参数类型 |
描述 |
---|---|---|
destination_backup_id |
String |
目标副本ID |
destination_checkpoint_id |
String |
目标还原点ID |
destination_project_id |
String |
目标project_id |
destination_region |
String |
目标区域 |
source_backup_id |
String |
源副本ID |
source_checkpoint_id |
String |
源还原点ID |
source_project_id |
String |
源project_id |
source_region |
String |
源区域 |
source_backup_name |
String |
源备份名称 |
destination_backup_name |
String |
目标备份名称 |
参数 |
参数类型 |
描述 |
---|---|---|
exclude_volumes |
Array of strings |
需要排除备份的卷id。仅在多盘备份特性中有效,排除不需要备份的磁盘。当虚拟机新绑定磁盘时,也能继续排除之前设置不用备份的卷。 |
参数 |
参数类型 |
描述 |
---|---|---|
backup_id |
String |
备份副本ID |
backup_name |
String |
备份名称 |
target_resource_id |
String |
恢复目标资源ID |
target_resource_name |
String |
恢复目标资源名称 |
参数 |
参数类型 |
描述 |
---|---|---|
fail_count |
Integer |
本次任务删除失败的资源数量 |
total_count |
Integer |
本次任务删除的备份总数 |
状态码: 404
参数 |
参数类型 |
描述 |
---|---|---|
error_code |
String |
请参见错误码。 |
error_msg |
String |
错误信息 |
请求示例
GET https://{endpoint}/v3/{project_id}/operation-logs/{operation_log_id}
响应示例
状态码: 200
OK
{ "operation_log" : { "status" : "success", "provider_id" : "0daac4c5-6707-4851-97ba-169e36266b66", "checkpoint_id" : "b432511f-d889-428f-8b0e-5f47c524c6b6", "updated_at" : "2019-05-23T14:35:23.584+00:00", "error_info" : { "message" : "", "code" : "" }, "started_at" : "2019-05-23T14:31:36.007+00:00", "id" : "4827f2da-b008-4507-ab7d-42d0df5ed912", "extra_info" : { "resource" : { "type" : "OS::Nova::Server", "id" : "1dab32fa-ebf2-415a-ab0b-eabe6353bc86", "name" : "ECS-0001" }, "backup" : { "backup_name" : "manualbk_1234", "backup_id" : "0e5d0ef6-7f0a-4890-b98c-cb12490e31c1" }, "common" : { "progress" : 100, "request_id" : "req-cdb98cc4-e87b-4f40-9b4a-57ec036620bc" } }, "ended_at" : "2019-05-23T14:35:23.511+00:00", "created_at" : "2019-05-23T14:31:36.039+00:00", "operation_type" : "backup", "project_id" : "04f1829c788037ac2fb8c01eb2b04b95" } }
状态码: 404
任务ID不存在
{ "error_code" : "BackupService.6500", "error_msg" : "Operation log does not exist." }
SDK代码示例
SDK代码示例如下。
Java
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
package com.huaweicloud.sdk.test; import com.huaweicloud.sdk.core.auth.ICredential; import com.huaweicloud.sdk.core.auth.BasicCredentials; import com.huaweicloud.sdk.core.exception.ConnectionException; import com.huaweicloud.sdk.core.exception.RequestTimeoutException; import com.huaweicloud.sdk.core.exception.ServiceResponseException; import com.huaweicloud.sdk.cbr.v1.region.CbrRegion; import com.huaweicloud.sdk.cbr.v1.*; import com.huaweicloud.sdk.cbr.v1.model.*; public class ShowOpLogSolution { public static void main(String[] args) { // The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security. // In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment String ak = System.getenv("CLOUD_SDK_AK"); String sk = System.getenv("CLOUD_SDK_SK"); ICredential auth = new BasicCredentials() .withAk(ak) .withSk(sk); CbrClient client = CbrClient.newBuilder() .withCredential(auth) .withRegion(CbrRegion.valueOf("<YOUR REGION>")) .build(); ShowOpLogRequest request = new ShowOpLogRequest(); try { ShowOpLogResponse response = client.showOpLog(request); System.out.println(response.toString()); } catch (ConnectionException e) { e.printStackTrace(); } catch (RequestTimeoutException e) { e.printStackTrace(); } catch (ServiceResponseException e) { e.printStackTrace(); System.out.println(e.getHttpStatusCode()); System.out.println(e.getRequestId()); System.out.println(e.getErrorCode()); System.out.println(e.getErrorMsg()); } } } |
Python
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# coding: utf-8 from huaweicloudsdkcore.auth.credentials import BasicCredentials from huaweicloudsdkcbr.v1.region.cbr_region import CbrRegion from huaweicloudsdkcore.exceptions import exceptions from huaweicloudsdkcbr.v1 import * if __name__ == "__main__": # The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security. # In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment ak = __import__('os').getenv("CLOUD_SDK_AK") sk = __import__('os').getenv("CLOUD_SDK_SK") credentials = BasicCredentials(ak, sk) \ client = CbrClient.new_builder() \ .with_credentials(credentials) \ .with_region(CbrRegion.value_of("<YOUR REGION>")) \ .build() try: request = ShowOpLogRequest() response = client.show_op_log(request) print(response) except exceptions.ClientRequestException as e: print(e.status_code) print(e.request_id) print(e.error_code) print(e.error_msg) |
Go
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
package main import ( "fmt" "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/basic" cbr "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/cbr/v1" "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/cbr/v1/model" region "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/cbr/v1/region" ) func main() { // The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security. // In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment ak := os.Getenv("CLOUD_SDK_AK") sk := os.Getenv("CLOUD_SDK_SK") auth := basic.NewCredentialsBuilder(). WithAk(ak). WithSk(sk). Build() client := cbr.NewCbrClient( cbr.CbrClientBuilder(). WithRegion(region.ValueOf("<YOUR REGION>")). WithCredential(auth). Build()) request := &model.ShowOpLogRequest{} response, err := client.ShowOpLog(request) if err == nil { fmt.Printf("%+v\n", response) } else { fmt.Println(err) } } |
更多
更多编程语言的SDK代码示例,请参见API Explorer的代码示例页签,可生成自动对应的SDK代码示例。
状态码
状态码 |
描述 |
---|---|
200 |
OK |
404 |
任务ID不存在 |
错误码
请参见错误码。