更新时间:2024-02-19 GMT+08:00
分享

查询指定ID的同步任务详情

功能介绍

查询指定ID的同步任务详情。

调用方法

请参见如何调用API

URI

GET /v2/{project_id}/sync-tasks/{sync_task_id}

表1 路径参数

参数

是否必选

参数类型

描述

project_id

String

项目ID

最小长度:1

最大长度:1024

sync_task_id

String

同步任务ID。

最小长度:0

最大长度:255

表2 Query参数

参数

是否必选

参数类型

描述

query_time

String

查询同步任务详情的时间(毫秒),依据该值返回所在月份的统计数据。

最小长度:1

最大长度:1024

请求参数

表3 请求Header参数

参数

是否必选

参数类型

描述

X-Auth-Token

String

IAM鉴权Token。

最小长度:1

最大长度:16384

响应参数

状态码: 200

表4 响应Body参数

参数

参数类型

描述

sync_task_id

String

同步任务ID

最小长度:0

最大长度:255

src_cloud_type

String

源端云服务提供商。可选值有AWS、Azure、Aliyun、Tencent、HuaweiCloud、QingCloud、KingsoftCloud、Baidu、Qiniu、UCloud。默认值为Aliyun。

枚举值:

  • AWS

  • Azure

  • Aliyun

  • Tencent

  • HuaweiCloud

  • QingCloud

  • KingsoftCloud

  • Baidu

  • Qiniu

  • UCloud

src_region

String

源端桶所处的区域

最小长度:0

最大长度:100

src_bucket

String

源端桶

最小长度:0

最大长度:1024

create_time

Long

同步任务创建时间(Unix时间戳,毫秒)

最小值:0

最大值:9223372036854775807

last_start_time

Long

最近启动同步任务时间(Unix时间戳,毫秒)

最小值:0

最大值:9223372036854775807

dst_bucket

String

目的端桶。

最小长度:0

最大长度:1024

dst_region

String

目的端region

最小长度:0

最大长度:100

description

String

任务描述,不能超过255个字符,且不能包含<>()"'&等特殊字符。

最小长度:0

最大长度:255

status

String

同步任务状态 SYNCHRONIZING:同步中 STOPPED:已停止

枚举值:

  • SYNCHRONIZING

  • STOPPED

enable_kms

Boolean

是否开启KMS加密,默认不开启。

enable_metadata_migration

Boolean

是否启用元数据迁移,默认否。不启用时,为保证迁移任务正常运行,仍将为您迁移ContentType元数据。

enable_restore

Boolean

是否自动解冻归档数据,默认否。 开启后,如果遇到归档类型数据,会自动解冻再进行迁移。

app_id

String

当源端为腾讯云时,需要填写此参数。

最小长度:0

最大长度:255

monthly_acceptance_request

Long

当月接收同步请求对象数

最小值:0

最大值:9223372036854775807

monthly_success_object

Long

当月同步成功对象数

最小值:0

最大值:9223372036854775807

monthly_failure_object

Long

当月同步失败对象数

最小值:0

最大值:9223372036854775807

monthly_skip_object

Long

当月同步忽略对象数

最小值:0

最大值:9223372036854775807

monthly_size

Long

当月同步对象容量大小(Byte)。

最小值:0

最大值:9223372036854775807

object_overwrite_mode

String

迁移前同名对象覆盖方式,用于迁移前判断源端与目的端有同名对象时,覆盖目的端或跳过迁移。默认SIZE_LAST_MODIFIED_COMPARISON_OVERWRITE。NO_OVERWRITE:不覆盖。迁移前源端对象与目的端对象同名时,不做对比直接跳过迁移。SIZE_LAST_MODIFIED_COMPARISON_OVERWRITE:大小/最后修改时间对比覆盖。默认配置。迁移前源端对象与目的端对象同名时,通过对比源端和目的端对象大小和最后修改时间,判断是否覆盖目的端,需满足源端/目的端对象的加密状态一致。源端与目的端同名对象大小不相同,或目的端对象的最后修改时间晚于源端对象的最后修改时间(源端较新),覆盖目的端。 CRC64_COMPARISON_OVERWRITE:CRC64对比覆盖。目前仅支持华为/阿里/腾讯。迁移前源端对象与目的端对象同名时,通过对比源端和目的端对象元数据中CRC64值是否相同,判断是否覆盖目的端,需满足源端/目的端对象的加密状态一致。如果源端与目的端对象元数据中不存在CRC64值,则系统会默认使用SIZE_LAST_MODIFIED_COMPARISON_OVERWRITE(大小/最后修改时间对比覆盖)来对比进行覆盖判断。FULL_OVERWRITE:全覆盖。迁移前源端对象与目的端对象同名时,不做对比覆盖目的端。

枚举值:

  • NO_OVERWRITE

  • SIZE_LAST_MODIFIED_COMPARISON_OVERWRITE

  • CRC64_COMPARISON_OVERWRITE

  • FULL_OVERWRITE

dst_storage_policy

String

目的端存储类型设置,当且仅当目的端为华为云OBS时需要,默认为标准存储 STANDARD:华为云OBS标准存储 IA:华为云OBS低频存储 ARCHIVE:华为云OBS归档存储 DEEP_ARCHIVE:华为云OBS深度归档存储 SRC_STORAGE_MAPPING:保留源端存储类型,将源端存储类型映射为华为云OBS存储类型

缺省值:STANDARD

最小长度:0

最大长度:128

枚举值:

  • STANDARD

  • IA

  • ARCHIVE

  • DEEP_ARCHIVE

  • SRC_STORAGE_MAPPING

consistency_check

String

迁移后对象一致性校验方式,用于迁移后校验对象是否一致,所有校验方式需满足源端/目的端对象的加密状态一致,具体校验方式和校验结果可通过对象列表查看。默认size_last_modified。size_last_modified:默认配置。迁移后,通过对比源端和目的端对象大小和最后修改时间,判断对象迁移后数据是否完整。源端与目的端同名对象大小相同,且目的端对象的最后修改时间不早于源端对象的最后修改时间,则代表该对象迁移成功。crc64:目前仅支持华为/阿里/腾讯。迁移后,通过对比源端和目的端对象元数据中CRC64值是否相同,判断对象是否迁移完成。如果源端与目的端对象元数据中不存在CRC64值,则系统会默认使用大小/最后修改时间校验方式来校验。no_check:目前仅支持HTTP/HTTPS数据源。当源端对象无法通过标准http协议中content-length字段获取数据大小时,默认数据下载成功即迁移成功,不对数据做额外校验。当源端对象能正常通过标准http协议中content-length字段获取数据大小时,则采用大小/最后修改时间校验方式来校验。

枚举值:

  • size_last_modified

  • crc64

  • no_check

状态码: 404

表5 响应Body参数

参数

参数类型

描述

error_msg

String

错误信息。

error_code

String

错误码。

请求示例

查询2c0689c860ad4728a497c91ec0844383项目下的0d146099-8cf4-437d-b6ef-88e043771c8b任务的详情

GET https://{endpoint}/v2/2c0689c860ad4728a497c91ec0844383/sync-tasks/0d146099-8cf4-437d-b6ef-88e043771c8b

响应示例

状态码: 200

OK

{
  "sync_task_id" : "d18befdd-eb82-41f3-8019-bbb593d74a3e",
  "src_cloud_type" : "HuaweiCloud",
  "src_region" : "cn-north-7",
  "src_bucket" : "oms-sdk-test-src",
  "create_time" : 1700639560751,
  "last_start_time" : 1700639560751,
  "dst_bucket" : "oms-sdk-test-dst",
  "dst_region" : "cn-north-7",
  "description" : "sync task test",
  "status" : "SYNCHRONIZING",
  "enable_kms" : false,
  "enable_metadata_migration" : false,
  "enable_restore" : false,
  "app_id" : null,
  "monthly_acceptance_request" : 11,
  "monthly_success_object" : 0,
  "monthly_failure_object" : 11,
  "monthly_skip_object" : 0,
  "monthly_size" : 0,
  "object_overwrite_mode" : "SIZE_LAST_MODIFIED_COMPARISON_OVERWRITE",
  "dst_storage_policy" : null,
  "consistency_check" : "size_last_modified"
}

SDK代码示例

SDK代码示例如下。

 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
46
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.oms.v2.region.OmsRegion;
import com.huaweicloud.sdk.oms.v2.*;
import com.huaweicloud.sdk.oms.v2.model.*;


public class ShowSyncTaskSolution {

    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);

        OmsClient client = OmsClient.newBuilder()
                .withCredential(auth)
                .withRegion(OmsRegion.valueOf("<YOUR REGION>"))
                .build();
        ShowSyncTaskRequest request = new ShowSyncTaskRequest();
        request.withQueryTime("<query_time>");
        try {
            ShowSyncTaskResponse response = client.showSyncTask(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());
        }
    }
}
 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
# coding: utf-8

from huaweicloudsdkcore.auth.credentials import BasicCredentials
from huaweicloudsdkoms.v2.region.oms_region import OmsRegion
from huaweicloudsdkcore.exceptions import exceptions
from huaweicloudsdkoms.v2 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 = OmsClient.new_builder() \
        .with_credentials(credentials) \
        .with_region(OmsRegion.value_of("<YOUR REGION>")) \
        .build()

    try:
        request = ShowSyncTaskRequest()
        request.query_time = "<query_time>"
        response = client.show_sync_task(request)
        print(response)
    except exceptions.ClientRequestException as e:
        print(e.status_code)
        print(e.request_id)
        print(e.error_code)
        print(e.error_msg)
 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
package main

import (
	"fmt"
	"github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/basic"
    oms "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/oms/v2"
	"github.com/huaweicloud/huaweicloud-sdk-go-v3/services/oms/v2/model"
    region "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/oms/v2/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 := oms.NewOmsClient(
        oms.OmsClientBuilder().
            WithRegion(region.ValueOf("<YOUR REGION>")).
            WithCredential(auth).
            Build())

    request := &model.ShowSyncTaskRequest{}
	request.QueryTime = "<query_time>"
	response, err := client.ShowSyncTask(request)
	if err == nil {
        fmt.Printf("%+v\n", response)
    } else {
        fmt.Println(err)
    }
}

更多编程语言的SDK代码示例,请参见API Explorer的代码示例页签,可生成自动对应的SDK代码示例。

状态码

状态码

描述

200

OK

404

Not Found

错误码

请参见错误码

分享:

    相关文档

    相关产品