Batch Adding Resources to a Resource Group
Function
This API is used to batch add resources to a resource group whose type is Manual.
URI
POST /v2/{project_id}/resource-groups/{group_id}/resources/batch-create
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
group_id |
Yes |
String |
Specifies the resource group ID, which starts with rg and is followed by 22 characters, including letters and digits. Minimum: 2 Maximum: 24 |
project_id |
Yes |
String |
Specifies the tenant ID. Minimum: 1 Maximum: 64 |
Request Parameters
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
X-Auth-Token |
Yes |
String |
Specifies the user token. Minimum: 1 Maximum: 16384 |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
resources |
Yes |
Array of Resource objects |
Specifies the resource information. Array Length: 1 - 1000 |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
namespace |
Yes |
String |
Specifies the namespace of a service. For details about the namespace of each service, see Namespace. |
dimensions |
Yes |
Array of Dimension objects |
Specifies the resource dimension information. Array Length: 1 - 4 |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
name |
Yes |
String |
Specifies the dimension of a resource. For example, the dimension of an ECS can be instance_id. A maximum of four dimensions are supported. For the metric dimension of each resource, see Services Interconnected with Cloud Eye. Regex Pattern: ^([a-z]|[A-Z]){1}([a-z]|[A-Z]|[0-9]|_|-){1,32}$ |
value |
Yes |
String |
Specifies the value of a resource dimension, which is the resource ID, for example, 4270ff17-aba3-4138-89fa-820594c39755. Regex Pattern: ^((([a-z]|[A-Z]|[0-9]){1}([a-z]|[A-Z]|[0-9]|_|-|\.)*)|\*){1,256}$ |
Response Parameters
Status code: 200
Parameter |
Type |
Description |
---|---|---|
succeed_count |
Integer |
Specifies the number of resources that were successfully added. Minimum: 0 Maximum: 1000 |
Status code: 400
Parameter |
Type |
Description |
---|---|---|
error_code |
String |
Specifies the status codes customized by each cloud service when a request error occurs. Minimum: 0 Maximum: 256 |
error_msg |
String |
Specifies the request error message. Minimum: 0 Maximum: 256 |
request_id |
String |
Specifies the request ID. Minimum: 0 Maximum: 256 |
Status code: 404
Parameter |
Type |
Description |
---|---|---|
error_code |
String |
Specifies the status codes customized by each cloud service when a request error occurs. Minimum: 0 Maximum: 256 |
error_msg |
String |
Specifies the request error message. Minimum: 0 Maximum: 256 |
request_id |
String |
Specifies the request ID. Minimum: 0 Maximum: 256 |
Status code: 500
Parameter |
Type |
Description |
---|---|---|
error_code |
String |
Specifies the status codes customized by each cloud service when a request error occurs. Minimum: 0 Maximum: 256 |
error_msg |
String |
Specifies the request error message. Minimum: 0 Maximum: 256 |
request_id |
String |
Specifies the request ID. Minimum: 0 Maximum: 256 |
Example Requests
Batch Adding Resources to a Resource Group Whose type Is Manual
{ "resources" : [ { "namespace" : "SYS.ECS", "dimensions" : [ { "name" : "instance_id", "value" : "4270ff17-aba3-4138-89fa-820594c39755" } ] } ] }
Example Responses
Status code: 200
Resources added.
{ "succeed_count" : 4 }
Status Codes
Status Code |
Description |
---|---|
200 |
Resources added. |
400 |
Failed to verify parameters. |
404 |
Resource not found. |
500 |
Internal system error. |
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.