Creating a Resource Group
Function
This API is used to create a resource group. With resource groups, you can easily manage resources by service and view monitoring and alarm information by group.
URI
POST /V1.0/{project_id}/resource-groups
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
project_id |
Yes |
String |
Definition Project ID. It is used to specify the project that an asset belongs to. You can query the assets of a project by project ID. You can obtain the project ID from the API or console. For details, see Obtaining a Project ID. Constraints N/A Range 1 to 64 characters Default Value N/A |
Request Parameters
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
Content-Type |
No |
String |
Definition MIME type of the request body. Constraints N/A Range 1 to 64 characters Default Value The default value is application/json; charset=UTF-8. For APIs used to upload objects or images, the MIME type varies with the flow type. |
|
X-Auth-Token |
No |
String |
Definition User token. Constraints N/A Range 1 to 16,384 characters Default Value N/A |
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
group_name |
Yes |
String |
Definition Resource group name. Constraints N/A Range The value allows 1 to 128 characters. It can only contain letters, digits, hyphens (-), and underscores (_). Default Value N/A |
|
resources |
No |
Array of CreateResourceGroup objects |
Definition Resource details when resources are manually added. Constraints A maximum of 1,000 resources are allowed. |
|
type |
No |
String |
Definition Method for adding resources to a resource group. Constraints N/A Range The value can only be EPS (synchronizing resources from enterprise projects) or TAG (dynamic tag matching). If this parameter is not specified, resources are manually added. Default Value N/A |
|
relation_ids |
No |
Array of strings |
Definition ID of the enterprise project from which resources in the resource group come. Constraints This parameter is mandatory when type is set to EPS. The value can contain a maximum of 50 enterprise project IDs. |
|
tags |
No |
Array of ResourceGroupTagRelation objects |
Definition Associated tags during dynamic tag matching. Constraints This parameter is mandatory when type is set to TAG. A maximum of 50 tags are allowed. |
|
enterprise_project_id |
No |
String |
Definition ID of the enterprise project that a resource group belongs to. Constraints N/A Range The value can contain digits, letters, or hyphens (-). It can be 0 (default enterprise project ID). Default Value N/A |
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
namespace |
Yes |
String |
Definition Namespace of a service. For details about the namespace of each service, see Namespaces. Constraints N/A Range The value is in the service.item format. The values of service and item must be a string, starting with a letter and containing only digits (0–9), letters (case-insensitive), and underscores (_). It must contain 3 to 32 characters. Default Value N/A |
|
dimensions |
Yes |
Array of MetricsDimension objects |
Definition Resource dimension information. Constraints A maximum of four dimensions are allowed. |
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
name |
Yes |
String |
Definition: 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 Service metric dimension. Constraints N/A Range: The value starts with a letter and can contain letters, digits, underscores (_), or hyphens (-). The length is [1,32] characters. Default Value: N/A |
|
value |
Yes |
String |
Definition Resource dimension value, which is an instance ID, for example, 4270ff17-aba3-4138-89fa-820594c39755. Constraints N/A Range 1 to 256 characters Default Value N/A |
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
key |
Yes |
String |
Definition TMS tag key specifications. Constraints N/A Range 1 to 128 characters Default Value N/A |
|
operator |
No |
String |
Definition Tag operator, which indicates the relationship between the tag key and value. Constraints N/A Range
Default Value N/A |
|
value |
No |
String |
Definition TMS tag value specifications. Constraints N/A Range 0 to 43 characters Default Value N/A |
Response Parameters
Status code: 201
|
Parameter |
Type |
Description |
|---|---|---|
|
group_id |
String |
Definition Resource group ID, for example, rg1606377637506DmVOENVyL. Constraints N/A Range The value starts with rg and is followed by 22 characters of letters, digits, or a combination of both. Default Value N/A |
Status code: 400
|
Parameter |
Type |
Description |
|---|---|---|
|
- |
String |
Request error. |
Status code: 401
|
Parameter |
Type |
Description |
|---|---|---|
|
- |
String |
The authentication information is not provided or is incorrect. |
Status code: 403
|
Parameter |
Type |
Description |
|---|---|---|
|
- |
String |
Access to the requested page is forbidden. |
Status code: 408
|
Parameter |
Type |
Description |
|---|---|---|
|
- |
String |
The request timed out. |
Status code: 429
|
Parameter |
Type |
Description |
|---|---|---|
|
- |
String |
Too many requests. |
Status code: 500
|
Parameter |
Type |
Description |
|---|---|---|
|
- |
String |
Failed to complete the request because of an internal service error. |
Status code: 503
|
Parameter |
Type |
Description |
|---|---|---|
|
- |
String |
The system is currently unavailable. |
Example Requests
{
"group_name" : "Resource-Group-Test01",
"resources" : [ {
"namespace" : "SYS.ECS",
"dimensions" : [ {
"name" : "instance_id",
"value" : "063a83da-a2b5-4630-ab6b-9b4fcfc261ea"
} ]
}, {
"namespace" : "SYS.ECS",
"dimensions" : [ {
"name" : "instance_id",
"value" : "518ace88-abde-46bf-829b-0d1f0f2fb2e9"
} ]
} ]
}
Example Responses
Status code: 201
OK
{
"group_id" : "rg1606377637506DmVOENVyL"
}
Status Codes
|
Status Code |
Description |
|---|---|
|
201 |
OK |
|
400 |
Bad Request |
|
401 |
Unauthorized |
|
403 |
Forbidden |
|
408 |
Request Timeout |
|
429 |
Too Many Requests |
|
500 |
Internal Server Error |
|
503 |
Service Unavailable |
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.