Updating a Resource
Function
This API is used to update a subscribed resource.
Calling Method
For details, see Calling APIs.
URI
PUT /v1/{project_id}/subscriptions/orders
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
project_id |
Yes |
String |
Tenant project ID. |
Request Parameters
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
X-Auth-Token |
Yes |
String |
User token. You can call the IAM API to obtain a user token. The value of X-Subject-Token in the response header is the user token. |
|
X-Language |
Yes |
String |
Current language. |
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
scene |
Yes |
String |
Operation scenario. PREPAID: yearly/monthly billing; POSTPAID: pay-per-use billing. |
|
operate_type |
Yes |
String |
Operation type in the pay-per-use or yearly/monthly scenario. For example, you want to increase or decrease the quota, upgrade or downgrade the specifications, and change the billing mode from pay-per-use to yearly/monthly. UPGRADE: upgrading the specifications; ADDITION: increasing the quota. DECREASE: decreasing the quota. POSTPAID_2_PREPAID: changing from pay-per-use to yearly/monthly billing. Note: Currently, specification scale-down is not supported. For example, you cannot change the service from the professional edition to the standard or basic edition. |
|
promotion_info |
No |
String |
Promotion discount information. |
|
tag_list |
No |
Array of SubscriptionTag objects |
Billing tag. |
|
product_list |
No |
Array of UpdateProduct objects |
List of products to be changed. |
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
key |
No |
String |
Key. A maximum of 36 characters are allowed. Only letters, digits, hyphens (-), underscores (_), and Unicode characters (\u4E00-\u9FFF) are allowed. |
|
value |
No |
String |
Value. A maximum of 43 characters are allowed. The value can be an empty string. The character set is as follows: A-Z, a-z, 0-9, periods (.), hyphens (-), underscores (_), and Unicode characters (\u4E00-\u9FFF). |
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
resource_type |
No |
String |
Resource type after the change. |
|
resource_spec_code |
Yes |
String |
Flavor after the modification. |
|
resource_size |
No |
Integer |
Resource quota after the change. If **operate_type **is set to addition, the value of resource_size must be greater than that of resource_id. If operate_type is set to decrease, the value of resource_size must be less than that of resource_id and greater than or equal to the number of ECSs in the current project. |
|
resource_id |
Yes |
String |
Resource ID to be changed. |
Response Parameters
Status code: 200
|
Parameter |
Type |
Description |
|---|---|---|
|
order_id |
String |
ID of the order for creating or changing a resource. This parameter is returned only when scene is set to PREPAID. |
|
order_status |
Integer |
Order update status. 1: The order is changed successfully. 5: The order fails to be changed. |
Status code: 400
|
Parameter |
Type |
Description |
|---|---|---|
|
error_code |
String |
Definition Error code. Range N/A |
|
error_msg |
String |
Definition Error description. Range N/A |
Status code: 403
|
Parameter |
Type |
Description |
|---|---|---|
|
error_code |
String |
Definition Error code. Range N/A |
|
error_msg |
String |
Definition Error description. Range N/A |
Status code: 404
|
Parameter |
Type |
Description |
|---|---|---|
|
error_code |
String |
Definition Error code. Range N/A |
|
error_msg |
String |
Definition Error description. Range N/A |
Example Requests
-
Upgrade the yearly/monthly basic edition to the professional edition (assuming that the historical version is the basic edition).
{ "scene" : "PREPAID", "operate_type" : "UPGRADE", "product_list" : [ { "resource_type" : "xxx.resource.type.secmaster.typical", "resource_spec_code" : "secmaster.professional", "resource_size" : 3, "resource_id" : "e6d9047a-3478-4867-8c0d-7c4cfed1685b" } ], "tag_list" : [ { "key" : "testKey3", "value" : "testVal3" } ] } -
Increase the pay-per-use resource quota.
{ "scene" : "POSTPAID", "operate_type" : "ADDITION", "product_list" : [ { "resource_type" : "xxx.resource.type.secmaster.typical", "resource_spec_code" : "secmaster.professional", "resource_size" : 3, "resource_id" : "e6d9047a-3478-4867-8c0d-7c4cfed1685b" } ], "tag_list" : [ { "key" : "testKey3", "value" : "testVal3" } ] } -
Reduce the pay-per-use resource quota.
{ "scene" : "POSTPAID", "operate_type" : "DECREASE", "product_list" : [ { "resource_type" : "xxx.resource.type.secmaster.typical", "resource_spec_code" : "secmaster.professional", "resource_size" : 2, "resource_id" : "e6d9047a-3478-4867-8c0d-7c4cfed1685b" } ], "tag_list" : [ { "key" : "testKey3", "value" : "testVal3" } ] } -
Change the billing mode from pay-per-use to yearly/monthly.
{ "scene" : "POSTPAID", "operate_type" : "POSTPAID_2_PREPAID", "product_list" : [ { "resource_spec_code" : "secmaster.professional", "resource_id" : "e6d9047a-3478-4867-8c0d-7c4cfed1685b" } ] }
Example Responses
Status code: 200
Request succeeded.
{
"order_id" : "CS2510212051NLDL4",
"order_status" : 1
}
Status Codes
|
Status Code |
Description |
|---|---|
|
200 |
Request succeeded. |
|
400 |
Request parameter error. |
|
403 |
Insufficient permissions. |
|
404 |
Resources are not found. |
Error Codes
See Error Codes.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot