Batch Update Resource Custom Attributes

POST/zstack/v1/resource-configurations/{resourceUuid}/resource-configs/actions

Headers

Authorization: OAuth the-session-uuid

Body

{
  "params": {
    "resourceConfigs": [
      {
        "category": "vm",
        "name": "cleanTraffic",
        "value": "true"
      }
    ]
  },
  "systemTags": [],
  "userTags": []
}

In the above example, the systemTags and userTags fields are optional. They are listed to indicate that these two fields can be included in the body.

Curl Example

curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{"resourceConfigs":[{"category":"vm","name":"cleanTraffic","value":"true"}]}}' \
http://localhost:8080/zstack/v1/resource-configurations/f4f8970eba3536a69fc2139456f383ae/resource-configs/actions

Parameter List

NameTypeLocationDescriptionAllowed ValuesStarting Version
resourceUuidStringurlResource UUID of the configuration 4.7.0
resourceConfigsListbody (Included in the params structure)The list of resource custom attributes 4.7.0
systemTags (Optional)ListbodySystem tags 4.7.0
userTags (Optional)ListbodyUser tags 4.7.0

API Response

Response Example

{
  "inventories": [
    {
      "value": "10",
      "effectiveConfigs": [
        {
          "uuid": "9d7aeba3ff604f46b419475c0ade1538",
          "resourceUuid": "378c6a50c9ee415baa4688fcd19f023a",
          "resourceType": "ClusterVO",
          "name": "cpu.overProvisioning.ratio",
          "category": "host",
          "value": "10",
          "createDate": "Nov 14, 2017 2:20:57 PM",
          "lastOpDate": "Nov 14, 2017 2:20:57 PM"
        }
      ],
      "name": "cpu.overProvisioning.ratio"
    }
  ]
}
NameTypeDescriptionStarting Version
successboolean 4.7.0
inventoriesListSee inventories for details4.7.0
errorErrorCodeThe error code. If not null, the operation failed. This field is null when the operation succeeds. See error for details4.7.0

inventories

NameTypeDescriptionStarting Version
valueString 4.7.0
nameString 4.7.0
effectiveConfigsListSee effectiveConfigs for details4.7.0

effectiveConfigs

NameTypeDescriptionStarting Version
uuidStringThe UUID of the resource, uniquely identifying the resource3.4.0
resourceUuidStringThe resource UUID associated with the configuration3.4.0
resourceTypeStringThe resource type associated with the configuration3.4.0
nameStringConfiguration name3.4.0
descriptionStringThe detailed description of the configuration3.4.0
categoryStringConfiguration category3.4.0
valueStringThe configuration value3.4.0
createDateTimestampCreation time3.4.0
lastOpDateTimestampLast modification time3.4.0

error

NameTypeDescriptionStarting Version
codeStringThe error code number. A globally unique identifier for the error, for example, SYS.1000, HOST.10013.4.0
descriptionStringA brief description of the error3.4.0
detailsStringThe detailed error information3.4.0
elaborationStringReserved field. Default is null3.4.0
opaqueLinkedHashMapReserved field. Default is null3.4.0
causeErrorCodeThe root error that caused the current error. If no root error exists, this field is null3.4.0

SDK Examples

Java SDK

UpdateResourceConfigsAction action = new UpdateResourceConfigsAction();
action.resourceUuid = "f4f8970eba3536a69fc2139456f383ae";
action.resourceConfigs = asList([category:vm, name:cleanTraffic, value:true]);
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
UpdateResourceConfigsAction.Result res = action.call();

Python SDK

UpdateResourceConfigsAction action = UpdateResourceConfigsAction()
action.resourceUuid = "f4f8970eba3536a69fc2139456f383ae"
action.resourceConfigs = [[category:vm, name:cleanTraffic, value:true]]
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
UpdateResourceConfigsAction.Result res = action.call()