Updated on 2024-12-30 GMT+08:00

Updating the Traffic Limiting Rules of a Migration Task

Function

This API is used to update the traffic limiting rules for a migration task before it is completed.

Calling Method

For details, see Calling APIs.

URI

PUT /v2/{project_id}/tasks/{task_id}/bandwidth-policy

Table 1 Path parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

The project ID.

Minimum length: 1 character

Maximum length: 1,024 characters

task_id

Yes

String

The task ID.

Minimum length: 1 character

Maximum length: 1,024 characters

Request

Table 2 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

Table 3 Request body parameters

Parameter

Mandatory

Type

Description

bandwidth_policy

Yes

Array of BandwidthPolicyDto objects

The traffic limiting rules. Each element in the array corresponds to the maximum bandwidth in a time period. A maximum of five periods are allowed, and the periods cannot overlap.

Array length: 0 to 5

Table 4 BandwidthPolicyDto field description

Parameter

Mandatory

Type

Description

end

Yes

String

The end time of the traffic limiting rule. The format is hh:mm, for example, 12:03.

max_bandwidth

Yes

Long

The maximum traffic bandwidth allowed in the specified time period. The unit is byte/s. The value ranges from 1,048,576 bytes/s (equivalent to 1 MB/s) to 209,715,200 bytes/s (equivalent to 200 MB/s).

Minimum value: 1048576

Maximum value: 209715200

start

Yes

String

The start time of the traffic limiting rule. The format is hh:mm, for example, 12:03.

Response

Status code: 400

Table 5 Response body parameters

Parameter

Type

Description

error_msg

String

The error message.

error_code

String

The error code.

Example Request

This example sets the migration rate limit for the task whose ID is xxxxxxxx during the time period from 00:01 to 23:59 to 50 MB/s.

/v2/{project_id}/tasks/xxxxxxxx/bandwidth-policy

{
  "bandwidth_policy" : [ {
    "start" : "00:01",
    "end" : "23:59",
    "max_bandwidth" : 50000000
  } ]
}

Example Response

None

Status Codes

Status Code

Description

200

OK

400

Bad Request

Error Codes

For details, see Error Codes.