Updated on 2024-03-20 GMT+08:00

Querying the Statistics About a Synchronization Task

Function

This API is used to query the statistics of a synchronization task, which includes the number of objects that are covered in synchronization requests, the number of objects that are successfully synchronized, the number of objects that fail to be synchronized, the number of objects that are skipped during synchronization, and the size of objects that are successfully synchronized. Currently, this API is available only in CN North-Beijing4 and CN East-Shanghai1.

Calling Method

For details, see Calling APIs.

URI

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

Table 1 Path parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

The project ID.

Minimum length: 1 character

Maximum length: 1,024 characters

sync_task_id

Yes

String

The synchronization task ID.

Minimum length: 0 characters

Maximum length: 255 characters

Table 2 Query parameters

Parameter

Mandatory

Type

Description

data_type

Yes

String

Statistical data types. Multiple types of data must be separated by commas (,). REQUEST: indicates the number of objects covered in synchronization requests. SUCCESS: indicates the number of objects synchronized. FAILURE: indicates the number of objects failed to be synchronized. SKIP: indicates the number of objects skipped during synchronization. SIZE: indicates the size of objects synchronized (in bytes).

Minimum length: 1 character

Maximum length: 255 characters

The value can be:

  • REQUEST

  • SUCCESS

  • FAILURE

  • SKIP

  • SIZE

start_time

Yes

String

The start time for the query.

Minimum length: 1 character

Maximum length: 1,024 characters

end_time

Yes

String

The start time for the query.

Minimum length: 1 character

Maximum length: 1,024 characters

Request

Table 3 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

The token used for IAM authentication.

Minimum length: 1 character

Maximum length: 16,384 characters

Response

Status code: 200

Table 4 Response body parameters

Parameter

Type

Description

sync_task_id

String

The synchronization task ID.

Minimum length: 1 character

Maximum length: 255 characters

statistic_time_type

String

The statistics collection interval.

Minimum length: 1 character

Maximum length: 255 characters

The value can be:

  • FIVE_MINUTES

  • ONE_HOUR

statistic_datas

Array of StatisticTypeData objects

The statistical result set of the queried synchronization task.

Array length: 0 to 1,000

Table 5 StatisticTypeData field description

Parameter

Type

Description

data_type

String

Statistical data types. REQUEST: indicates the number of objects requested to be synchronized. SUCCESS: indicates the number of objects synchronized. FAILURE: indicates the number of objects failed to be synchronized. SKIP: indicates the number of objects skipped during synchronization. SIZE: indicates the size of objects synchronized (in bytes).

Minimum length: 1 character

Maximum length: 255 characters

The value can be:

  • REQUEST

  • SUCCESS

  • FAILURE

  • SKIP

  • SIZE

data

Array of StatisticData objects

The statistical result set of the queried synchronization task.

Array length: 0 to 1,000

Table 6 StatisticData field description

Parameter

Type

Description

time_stamp

Long

The timestamp.

Minimum value: 0

Maximum value: 9223372036854775807

statistic_num

Long

The statistics.

Minimum value: 0

Maximum value: 9223372036854775807

Status code: 404

Table 7 Response body parameters

Parameter

Type

Description

error_msg

String

The error message.

error_code

String

The error code.

Example Request

This example queries the statistics of task 0d146099-8cf4-437d-b6ef-88e043771c8b in project 2c0689c860ad4728a497c91ec0844383.

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

{
  "sync_task_id" : "4fb05cd2-c94e-44e4-a07f-e65a2f01ebcb",
  "statistic_time_type" : "FIVE_MINUTES",
  "statistic_datas" : [ {
    "data_type" : "REQUEST",
    "data" : [ {
      "time_stamp" : 1700150400000,
      "statistic_num" : 1
    }, {
      "time_stamp" : 1700151000000,
      "statistic_num" : 20
    }, {
      "time_stamp" : 1700151300000,
      "statistic_num" : 13
    }, {
      "time_stamp" : 1700151600000,
      "statistic_num" : 12
    }, {
      "time_stamp" : 1700151900000,
      "statistic_num" : 10
    }, {
      "time_stamp" : 1700152200000,
      "statistic_num" : 11
    }, {
      "time_stamp" : 1700152500000,
      "statistic_num" : 9
    }, {
      "time_stamp" : 1700152800000,
      "statistic_num" : 12
    }, {
      "time_stamp" : 1700153100000,
      "statistic_num" : 9
    }, {
      "time_stamp" : 1700153400000,
      "statistic_num" : 10
    }, {
      "time_stamp" : 1700153700000,
      "statistic_num" : 7
    }, {
      "time_stamp" : 1700154000000,
      "statistic_num" : 13
    }, {
      "time_stamp" : 1700154300000,
      "statistic_num" : 9
    }, {
      "time_stamp" : 1700154600000,
      "statistic_num" : 9
    }, {
      "time_stamp" : 1700154900000,
      "statistic_num" : 9
    }, {
      "time_stamp" : 1700155200000,
      "statistic_num" : 10
    }, {
      "time_stamp" : 1700155500000,
      "statistic_num" : 11
    }, {
      "time_stamp" : 1700155800000,
      "statistic_num" : 9
    }, {
      "time_stamp" : 1700156100000,
      "statistic_num" : 8
    }, {
      "time_stamp" : 1700156400000,
      "statistic_num" : 11
    }, {
      "time_stamp" : 1700156700000,
      "statistic_num" : 10
    }, {
      "time_stamp" : 1700157000000,
      "statistic_num" : 8
    }, {
      "time_stamp" : 1700157300000,
      "statistic_num" : 10
    }, {
      "time_stamp" : 1700157600000,
      "statistic_num" : 11
    }, {
      "time_stamp" : 1700157900000,
      "statistic_num" : 9
    }, {
      "time_stamp" : 1700158200000,
      "statistic_num" : 11
    }, {
      "time_stamp" : 1700158500000,
      "statistic_num" : 9
    }, {
      "time_stamp" : 1700158800000,
      "statistic_num" : 10
    }, {
      "time_stamp" : 1700159100000,
      "statistic_num" : 11
    }, {
      "time_stamp" : 1700159400000,
      "statistic_num" : 9
    }, {
      "time_stamp" : 1700159700000,
      "statistic_num" : 11
    }, {
      "time_stamp" : 1700160000000,
      "statistic_num" : 10
    }, {
      "time_stamp" : 1700160300000,
      "statistic_num" : 10
    }, {
      "time_stamp" : 1700160600000,
      "statistic_num" : 9
    }, {
      "time_stamp" : 1700160900000,
      "statistic_num" : 8
    }, {
      "time_stamp" : 1700161200000,
      "statistic_num" : 11
    }, {
      "time_stamp" : 1700161500000,
      "statistic_num" : 9
    }, {
      "time_stamp" : 1700161800000,
      "statistic_num" : 9
    }, {
      "time_stamp" : 1700162100000,
      "statistic_num" : 9
    }, {
      "time_stamp" : 1700162400000,
      "statistic_num" : 10
    }, {
      "time_stamp" : 1700162700000,
      "statistic_num" : 11
    }, {
      "time_stamp" : 1700163000000,
      "statistic_num" : 9
    }, {
      "time_stamp" : 1700163300000,
      "statistic_num" : 9
    }, {
      "time_stamp" : 1700163600000,
      "statistic_num" : 11
    }, {
      "time_stamp" : 1700163900000,
      "statistic_num" : 10
    }, {
      "time_stamp" : 1700164200000,
      "statistic_num" : 9
    }, {
      "time_stamp" : 1700164500000,
      "statistic_num" : 10
    }, {
      "time_stamp" : 1700164800000,
      "statistic_num" : 9
    }, {
      "time_stamp" : 1700165100000,
      "statistic_num" : 11
    }, {
      "time_stamp" : 1700165400000,
      "statistic_num" : 10
    }, {
      "time_stamp" : 1700165700000,
      "statistic_num" : 10
    }, {
      "time_stamp" : 1700166000000,
      "statistic_num" : 11
    }, {
      "time_stamp" : 1700166300000,
      "statistic_num" : 10
    }, {
      "time_stamp" : 1700166600000,
      "statistic_num" : 9
    }, {
      "time_stamp" : 1700166900000,
      "statistic_num" : 9
    }, {
      "time_stamp" : 1700167200000,
      "statistic_num" : 11
    }, {
      "time_stamp" : 1700167500000,
      "statistic_num" : 10
    }, {
      "time_stamp" : 1700167800000,
      "statistic_num" : 8
    }, {
      "time_stamp" : 1700168100000,
      "statistic_num" : 11
    }, {
      "time_stamp" : 1700168400000,
      "statistic_num" : 8
    }, {
      "time_stamp" : 1700168700000,
      "statistic_num" : 10
    }, {
      "time_stamp" : 1700169000000,
      "statistic_num" : 10
    }, {
      "time_stamp" : 1700169300000,
      "statistic_num" : 9
    }, {
      "time_stamp" : 1700169600000,
      "statistic_num" : 10
    }, {
      "time_stamp" : 1700169900000,
      "statistic_num" : 8
    }, {
      "time_stamp" : 1700170200000,
      "statistic_num" : 11
    }, {
      "time_stamp" : 1700170500000,
      "statistic_num" : 9
    }, {
      "time_stamp" : 1700170800000,
      "statistic_num" : 13
    }, {
      "time_stamp" : 1700171100000,
      "statistic_num" : 10
    }, {
      "time_stamp" : 1700171400000,
      "statistic_num" : 8
    }, {
      "time_stamp" : 1700171700000,
      "statistic_num" : 10
    }, {
      "time_stamp" : 1700172000000,
      "statistic_num" : 11
    }, {
      "time_stamp" : 1700172300000,
      "statistic_num" : 11
    }, {
      "time_stamp" : 1700172600000,
      "statistic_num" : 10
    }, {
      "time_stamp" : 1700172900000,
      "statistic_num" : 11
    }, {
      "time_stamp" : 1700173200000,
      "statistic_num" : 9
    }, {
      "time_stamp" : 1700173500000,
      "statistic_num" : 9
    }, {
      "time_stamp" : 1700173800000,
      "statistic_num" : 12
    }, {
      "time_stamp" : 1700174100000,
      "statistic_num" : 9
    }, {
      "time_stamp" : 1700174400000,
      "statistic_num" : 11
    }, {
      "time_stamp" : 1700174700000,
      "statistic_num" : 10
    }, {
      "time_stamp" : 1700175000000,
      "statistic_num" : 10
    }, {
      "time_stamp" : 1700175300000,
      "statistic_num" : 11
    }, {
      "time_stamp" : 1700175600000,
      "statistic_num" : 9
    }, {
      "time_stamp" : 1700175900000,
      "statistic_num" : 11
    }, {
      "time_stamp" : 1700176200000,
      "statistic_num" : 10
    }, {
      "time_stamp" : 1700176500000,
      "statistic_num" : 9
    }, {
      "time_stamp" : 1700176800000,
      "statistic_num" : 11
    }, {
      "time_stamp" : 1700177100000,
      "statistic_num" : 9
    }, {
      "time_stamp" : 1700177400000,
      "statistic_num" : 11
    }, {
      "time_stamp" : 1700177700000,
      "statistic_num" : 9
    }, {
      "time_stamp" : 1700178000000,
      "statistic_num" : 12
    }, {
      "time_stamp" : 1700178300000,
      "statistic_num" : 10
    }, {
      "time_stamp" : 1700178600000,
      "statistic_num" : 9
    }, {
      "time_stamp" : 1700178900000,
      "statistic_num" : 11
    }, {
      "time_stamp" : 1700179200000,
      "statistic_num" : 9
    }, {
      "time_stamp" : 1700179500000,
      "statistic_num" : 10
    }, {
      "time_stamp" : 1700179800000,
      "statistic_num" : 10
    }, {
      "time_stamp" : 1700180100000,
      "statistic_num" : 11
    }, {
      "time_stamp" : 1700180400000,
      "statistic_num" : 10
    }, {
      "time_stamp" : 1700180700000,
      "statistic_num" : 9
    }, {
      "time_stamp" : 1700181000000,
      "statistic_num" : 12
    }, {
      "time_stamp" : 1700181300000,
      "statistic_num" : 9
    }, {
      "time_stamp" : 1700181600000,
      "statistic_num" : 12
    }, {
      "time_stamp" : 1700181900000,
      "statistic_num" : 9
    }, {
      "time_stamp" : 1700182200000,
      "statistic_num" : 11
    }, {
      "time_stamp" : 1700182500000,
      "statistic_num" : 9
    }, {
      "time_stamp" : 1700182800000,
      "statistic_num" : 10
    }, {
      "time_stamp" : 1700183100000,
      "statistic_num" : 11
    }, {
      "time_stamp" : 1700183400000,
      "statistic_num" : 10
    }, {
      "time_stamp" : 1700183700000,
      "statistic_num" : 9
    }, {
      "time_stamp" : 1700184000000,
      "statistic_num" : 8
    }, {
      "time_stamp" : 1700188200000,
      "statistic_num" : 1
    } ]
  } ]
}

Example Response

Status code: 200

OK

{
  "sync_task_id" : "4fb05cd2-c94e-44e4-a07f-e65a2f01ebcb",
  "statistic_time_type" : "FIVE_MINUTES",
  "statistic_datas" : [ {
    "data_type" : "REQUEST",
    "data" : [ {
      "time_stamp" : 1700150400000,
      "statistic_num" : 1
    }, {
      "time_stamp" : 1700151000000,
      "statistic_num" : 20
    }, {
      "time_stamp" : 1700151300000,
      "statistic_num" : 13
    }, {
      "time_stamp" : 1700151600000,
      "statistic_num" : 12
    }, {
      "time_stamp" : 1700151900000,
      "statistic_num" : 10
    }, {
      "time_stamp" : 1700152200000,
      "statistic_num" : 11
    }, {
      "time_stamp" : 1700152500000,
      "statistic_num" : 9
    }, {
      "time_stamp" : 1700152800000,
      "statistic_num" : 12
    }, {
      "time_stamp" : 1700153100000,
      "statistic_num" : 9
    }, {
      "time_stamp" : 1700153400000,
      "statistic_num" : 10
    }, {
      "time_stamp" : 1700153700000,
      "statistic_num" : 7
    }, {
      "time_stamp" : 1700154000000,
      "statistic_num" : 13
    }, {
      "time_stamp" : 1700154300000,
      "statistic_num" : 9
    }, {
      "time_stamp" : 1700154600000,
      "statistic_num" : 9
    }, {
      "time_stamp" : 1700154900000,
      "statistic_num" : 9
    }, {
      "time_stamp" : 1700155200000,
      "statistic_num" : 10
    }, {
      "time_stamp" : 1700155500000,
      "statistic_num" : 11
    }, {
      "time_stamp" : 1700155800000,
      "statistic_num" : 9
    }, {
      "time_stamp" : 1700156100000,
      "statistic_num" : 8
    }, {
      "time_stamp" : 1700156400000,
      "statistic_num" : 11
    }, {
      "time_stamp" : 1700156700000,
      "statistic_num" : 10
    }, {
      "time_stamp" : 1700157000000,
      "statistic_num" : 8
    }, {
      "time_stamp" : 1700157300000,
      "statistic_num" : 10
    }, {
      "time_stamp" : 1700157600000,
      "statistic_num" : 11
    }, {
      "time_stamp" : 1700157900000,
      "statistic_num" : 9
    }, {
      "time_stamp" : 1700158200000,
      "statistic_num" : 11
    }, {
      "time_stamp" : 1700158500000,
      "statistic_num" : 9
    }, {
      "time_stamp" : 1700158800000,
      "statistic_num" : 10
    }, {
      "time_stamp" : 1700159100000,
      "statistic_num" : 11
    }, {
      "time_stamp" : 1700159400000,
      "statistic_num" : 9
    }, {
      "time_stamp" : 1700159700000,
      "statistic_num" : 11
    }, {
      "time_stamp" : 1700160000000,
      "statistic_num" : 10
    }, {
      "time_stamp" : 1700160300000,
      "statistic_num" : 10
    }, {
      "time_stamp" : 1700160600000,
      "statistic_num" : 9
    }, {
      "time_stamp" : 1700160900000,
      "statistic_num" : 8
    }, {
      "time_stamp" : 1700161200000,
      "statistic_num" : 11
    }, {
      "time_stamp" : 1700161500000,
      "statistic_num" : 9
    }, {
      "time_stamp" : 1700161800000,
      "statistic_num" : 9
    }, {
      "time_stamp" : 1700162100000,
      "statistic_num" : 9
    }, {
      "time_stamp" : 1700162400000,
      "statistic_num" : 10
    }, {
      "time_stamp" : 1700162700000,
      "statistic_num" : 11
    }, {
      "time_stamp" : 1700163000000,
      "statistic_num" : 9
    }, {
      "time_stamp" : 1700163300000,
      "statistic_num" : 9
    }, {
      "time_stamp" : 1700163600000,
      "statistic_num" : 11
    }, {
      "time_stamp" : 1700163900000,
      "statistic_num" : 10
    }, {
      "time_stamp" : 1700164200000,
      "statistic_num" : 9
    }, {
      "time_stamp" : 1700164500000,
      "statistic_num" : 10
    }, {
      "time_stamp" : 1700164800000,
      "statistic_num" : 9
    }, {
      "time_stamp" : 1700165100000,
      "statistic_num" : 11
    }, {
      "time_stamp" : 1700165400000,
      "statistic_num" : 10
    }, {
      "time_stamp" : 1700165700000,
      "statistic_num" : 10
    }, {
      "time_stamp" : 1700166000000,
      "statistic_num" : 11
    }, {
      "time_stamp" : 1700166300000,
      "statistic_num" : 10
    }, {
      "time_stamp" : 1700166600000,
      "statistic_num" : 9
    }, {
      "time_stamp" : 1700166900000,
      "statistic_num" : 9
    }, {
      "time_stamp" : 1700167200000,
      "statistic_num" : 11
    }, {
      "time_stamp" : 1700167500000,
      "statistic_num" : 10
    }, {
      "time_stamp" : 1700167800000,
      "statistic_num" : 8
    }, {
      "time_stamp" : 1700168100000,
      "statistic_num" : 11
    }, {
      "time_stamp" : 1700168400000,
      "statistic_num" : 8
    }, {
      "time_stamp" : 1700168700000,
      "statistic_num" : 10
    }, {
      "time_stamp" : 1700169000000,
      "statistic_num" : 10
    }, {
      "time_stamp" : 1700169300000,
      "statistic_num" : 9
    }, {
      "time_stamp" : 1700169600000,
      "statistic_num" : 10
    }, {
      "time_stamp" : 1700169900000,
      "statistic_num" : 8
    }, {
      "time_stamp" : 1700170200000,
      "statistic_num" : 11
    }, {
      "time_stamp" : 1700170500000,
      "statistic_num" : 9
    }, {
      "time_stamp" : 1700170800000,
      "statistic_num" : 13
    }, {
      "time_stamp" : 1700171100000,
      "statistic_num" : 10
    }, {
      "time_stamp" : 1700171400000,
      "statistic_num" : 8
    }, {
      "time_stamp" : 1700171700000,
      "statistic_num" : 10
    }, {
      "time_stamp" : 1700172000000,
      "statistic_num" : 11
    }, {
      "time_stamp" : 1700172300000,
      "statistic_num" : 11
    }, {
      "time_stamp" : 1700172600000,
      "statistic_num" : 10
    }, {
      "time_stamp" : 1700172900000,
      "statistic_num" : 11
    }, {
      "time_stamp" : 1700173200000,
      "statistic_num" : 9
    }, {
      "time_stamp" : 1700173500000,
      "statistic_num" : 9
    }, {
      "time_stamp" : 1700173800000,
      "statistic_num" : 12
    }, {
      "time_stamp" : 1700174100000,
      "statistic_num" : 9
    }, {
      "time_stamp" : 1700174400000,
      "statistic_num" : 11
    }, {
      "time_stamp" : 1700174700000,
      "statistic_num" : 10
    }, {
      "time_stamp" : 1700175000000,
      "statistic_num" : 10
    }, {
      "time_stamp" : 1700175300000,
      "statistic_num" : 11
    }, {
      "time_stamp" : 1700175600000,
      "statistic_num" : 9
    }, {
      "time_stamp" : 1700175900000,
      "statistic_num" : 11
    }, {
      "time_stamp" : 1700176200000,
      "statistic_num" : 10
    }, {
      "time_stamp" : 1700176500000,
      "statistic_num" : 9
    }, {
      "time_stamp" : 1700176800000,
      "statistic_num" : 11
    }, {
      "time_stamp" : 1700177100000,
      "statistic_num" : 9
    }, {
      "time_stamp" : 1700177400000,
      "statistic_num" : 11
    }, {
      "time_stamp" : 1700177700000,
      "statistic_num" : 9
    }, {
      "time_stamp" : 1700178000000,
      "statistic_num" : 12
    }, {
      "time_stamp" : 1700178300000,
      "statistic_num" : 10
    }, {
      "time_stamp" : 1700178600000,
      "statistic_num" : 9
    }, {
      "time_stamp" : 1700178900000,
      "statistic_num" : 11
    }, {
      "time_stamp" : 1700179200000,
      "statistic_num" : 9
    }, {
      "time_stamp" : 1700179500000,
      "statistic_num" : 10
    }, {
      "time_stamp" : 1700179800000,
      "statistic_num" : 10
    }, {
      "time_stamp" : 1700180100000,
      "statistic_num" : 11
    }, {
      "time_stamp" : 1700180400000,
      "statistic_num" : 10
    }, {
      "time_stamp" : 1700180700000,
      "statistic_num" : 9
    }, {
      "time_stamp" : 1700181000000,
      "statistic_num" : 12
    }, {
      "time_stamp" : 1700181300000,
      "statistic_num" : 9
    }, {
      "time_stamp" : 1700181600000,
      "statistic_num" : 12
    }, {
      "time_stamp" : 1700181900000,
      "statistic_num" : 9
    }, {
      "time_stamp" : 1700182200000,
      "statistic_num" : 11
    }, {
      "time_stamp" : 1700182500000,
      "statistic_num" : 9
    }, {
      "time_stamp" : 1700182800000,
      "statistic_num" : 10
    }, {
      "time_stamp" : 1700183100000,
      "statistic_num" : 11
    }, {
      "time_stamp" : 1700183400000,
      "statistic_num" : 10
    }, {
      "time_stamp" : 1700183700000,
      "statistic_num" : 9
    }, {
      "time_stamp" : 1700184000000,
      "statistic_num" : 8
    }, {
      "time_stamp" : 1700188200000,
      "statistic_num" : 1
    } ]
  } ]
}

SDK Sample Code

The sample code is as follows:

This example queries the statistics of task 0d146099-8cf4-437d-b6ef-88e043771c8b in project 2c0689c860ad4728a497c91ec0844383.

 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
47
48
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 ListSyncTaskStatisticSolution {

    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();
        ListSyncTaskStatisticRequest request = new ListSyncTaskStatisticRequest();
        request.withDataType(ListSyncTaskStatisticRequest.DataTypeEnum.fromValue("<data_type>"));
        request.withStartTime("<start_time>");
        request.withEndTime("<end_time>");
        try {
            ListSyncTaskStatisticResponse response = client.listSyncTaskStatistic(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());
        }
    }
}

This example queries the statistics of task 0d146099-8cf4-437d-b6ef-88e043771c8b in project 2c0689c860ad4728a497c91ec0844383.

 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
# 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 = ListSyncTaskStatisticRequest()
        request.data_type = "<data_type>"
        request.start_time = "<start_time>"
        request.end_time = "<end_time>"
        response = client.list_sync_task_statistic(request)
        print(response)
    except exceptions.ClientRequestException as e:
        print(e.status_code)
        print(e.request_id)
        print(e.error_code)
        print(e.error_msg)

This example queries the statistics of task 0d146099-8cf4-437d-b6ef-88e043771c8b in project 2c0689c860ad4728a497c91ec0844383.

 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
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.ListSyncTaskStatisticRequest{}
	request.DataType = model.GetListSyncTaskStatisticRequestDataTypeEnum().<DATA_TYPE>
	request.StartTime = "<start_time>"
	request.EndTime = "<end_time>"
	response, err := client.ListSyncTaskStatistic(request)
	if err == nil {
        fmt.Printf("%+v\n", response)
    } else {
        fmt.Println(err)
    }
}

For more SDK sample code of programming languages, visit API Explorer and click the Sample Code tab. Example code can be automatically generated.

Status Codes

Status Code

Description

200

OK

404

Not Found

Error Codes

For details, see Error Codes.