Enabling or Configuring SecMaster Subscription
Function
This API is used to enable or configure the subscription to SecMaster.
Calling Method
For details, see Calling APIs.
URI
POST /v1/{project_id}/subscriptions/orders
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
project_id |
Yes |
String |
Project ID. |
Request Parameters
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
X-Auth-Token |
Yes |
String |
User token. It can be obtained by calling the IAM API used to obtain a user token. The value of X-Subject-Token in the response header is the user token. |
|
X-Language |
Yes |
String |
Current environment language. The value can be zh-cn or en-us. |
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
scene |
Yes |
String |
Scenario description. The value can be PREPAID (yearly/monthly billing), POSTPAID (pay-per-use billing), or CONFIG (resource usage configuration). The default value is PREPAID. The value is case-insensitive. |
|
promotion_info |
No |
String |
Promotion discount information. String, JSON format. |
|
operate_type |
Yes |
String |
Operation type. The value can be CREATE (creation) or ALERT_CONFIG (order usage warning configuration). The value is case insensitive. |
|
tag_list |
No |
Array of SubscriptionTag objects |
Billing tag. |
|
product_list |
No |
Array of Product objects |
This parameter is mandatory when scene is set to PREPAID or POSTPAID. Offering list. |
|
config |
No |
OrderConfig object |
Configuration list. This parameter is mandatory when scene is set to CONFIG. |
|
period_type |
No |
Integer |
Subscription period type. This parameter is mandatory when scene is set to PREPAID. 2: monthly 3: yearly |
|
period_num |
No |
Integer |
Number of subscription periods. This parameter is mandatory when scene is set to PREPAID. The value must be greater than 0 to avoid reporting an error. If period_type is set to 2, the value range is [1, 9]. If period_type is set to 3, the value range is [1, 3]. |
|
is_auto_renew |
No |
Integer |
Whether to automatically renew the subscription. This parameter is mandatory when scene is set to PREPAID. If this parameter is left empty, the subscription is not automatically renewed. 1: Auto renewal is enabled. 0 (default): Auto renewal is disabled. |
|
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 |
Yes |
String |
Resource type. |
|
resource_spec_code |
Yes |
String |
Resource specification code. |
|
resource_size |
Yes |
Integer |
Subscription quantity. |
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
threshold_list |
No |
Array of UsageThreshold objects |
Thresholds. |
|
alert_config |
No |
AlertConfig object |
Enabling or disabling of current alarm configuration. |
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
resource_spec_code |
No |
String |
Resource type. |
|
source_resource_spec_code |
No |
String |
Original resource type. |
|
threshold |
Yes |
Double |
Threshold. |
|
unit |
Yes |
String |
Unit of the threshold. The options are %, MB, and GB. If the unit is %, the maximum threshold is 95. |
|
enable |
No |
Boolean |
Alert reporting settings of the current resource type. |
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
topic_urn |
No |
String |
Associated SMN topic. When type is set to smn, this parameter can be set. The default value is empty. |
|
type |
No |
String |
Supported order alarm types. SMN is the message protocol, and MC is the message center. |
|
enable |
No |
Boolean |
Enabling or disabling of current alert configuration. true: enabled; false: disabled. |
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 |
Example Requests
-
Subscribe to yearly/monthly resources.
POST https://{endpoint}/v1/{projectId}/subscriptions/orders { "period_num" : 1, "period_type" : 2, "is_auto_renew" : 1, "scene" : "PREPAID", "operate_type" : "CREATE", "product_list" : [ { "resource_type" : "xxx.resource.type.secmaster.typical", "resource_spec_code" : "secmaster.professional", "resource_size" : 3 } ], "tag_list" : [ { "key" : "testKey1", "value" : "testVal1" } ] } -
Subscribe to pay-per-use resources.
{ "scene" : "POSTPAID", "operate_type" : "CREATE", "product_list" : [ { "resource_type" : "xxx.resource.type.secmaster.typical", "resource_spec_code" : "secmaster.basic", "resource_size" : 3 } ], "tag_list" : [ { "key" : "testKey2", "value" : "testVal2" } ] }
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. |
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