Help Center/ Cloud Eye/ API Reference/ API V1/ Resource Groups/ Updating a Resource Group
Updated on 2024-01-04 GMT+08:00

Updating a Resource Group

Function

This API is used to update a resource group. You can use resource groups to manage resources by service, and view monitoring and alarm information by group to improve O&M efficiency.

Debugging

You can debug the API in API Explorer which supports automatic authentication. API Explorer can automatically generate and debug example SDK code.

URI

PUT /V1.0/{project_id}/resource-groups/{group_id}

  • Parameter description
    Table 1 Parameter description

    Parameter

    Type

    Mandatory

    Description

    project_id

    String

    Yes

    Specifies the project ID.

    For details about how to obtain the project ID, see Obtaining a Project ID.

    group_id

    String

    Yes

    Specifies the resource group ID.

  • Request example
    PUT https://{Cloud Eye endpoint}/V1.0/{project_id}/resource-groups/{group_id}

Request

  • Request parameters
    Table 2 Parameter description

    Parameter

    Type

    Mandatory

    Description

    group_name

    String

    Yes

    Specifies the resource group name. Enter 1 to 128 characters. Only letters, digits, underscores (_), and hyphens (-) are allowed. Example: ResourceGroup-Test01

    resources

    Array of objects

    Yes

    Select one or more resources for the resource group to be created.

    For details, see Table 3.

    Table 3 resources data structure description

    Parameter

    Type

    Mandatory

    Description

    namespace

    String

    Yes

    Specifies the resource namespace. For example, the ECS namespace is SYS.ECS. To view the namespace of each service, see Services Interconnected with Cloud Eye.

    dimensions

    Array of objects

    Yes

    Specifies one or more resource dimensions.

    For details, see Table 4.

    Table 4 dimensions data structure description

    Parameter

    Type

    Mandatory

    Description

    name

    String

    Yes

    Specifies the resource dimension. For example, the ECS dimension is instance_id. To view the dimension of each resource, see Services Interconnected with Cloud Eye.

    value

    String

    Yes

    Specifies the resource dimension value, which is the instance ID. Example: 4270ff17-aba3-4138-89fa-820594c39755

  • Example request
    {
       "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"
                   }
               ]
           },
           {
               "namespace": "SYS.ECS",
               "dimensions": [
                   {
                       "name": "instance_id",
                       "value": "675006b5-477a-4aab-948c-0aa467de9c68"
                   }
               ]
           }
       ]
    }

Response

None

Returned Values

  • Normal

    204

  • Abnormal

    Returned Value

    Description

    400 Bad Request

    Request error.

    401 Unauthorized

    The authentication information is not provided or is incorrect.

    403 Forbidden

    Access to the requested page is forbidden.

    408 Request Timeout

    The request timed out.

    429 Too Many Requests

    Concurrent requests are excessive.

    500 Internal Server Error

    Failed to complete the request because of an internal service error.

    503 Service Unavailable

    The service is currently unavailable.

Error Codes

See Error Codes.