Document navigation

Auto-Scaling Group Operations

CreateAutoScalingGroup

API Request

URLs
POST zstack/v1/autoscaling/groups
Headers
Authorization: OAuth the-session-uuid
Body
{
  "params": {
    "name": "test-group",
    "description": "just for test",
    "scalingResourceType": "VmInstance",
    "minResourceSize": 2.0,
    "maxResourceSize": 10.0,
    "defaultCooldown": 60.0,
    "removalPolicy": "OldestInstance",
    "defaultEnable": false
  },
  "systemTags": [],
  "userTags": []
}
Note: In the preceding sample, both systemTags and userTags are optional. These two fields can be included in the body structure.
Curl Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{"name":"test-group","description":"just for test","scalingResourceType":"VmInstance","minResourceSize":2.0,"maxResourceSize":10.0,"defaultCooldown":60.0,"removalPolicy":"OldestInstance","defaultEnable":false}}' http://localhost:8080/zstack/v1/autoscaling/groups
Request Parameters
Name Type Location Description Optional Value Starting Version
name String body (contained in the params structure) The resource name. 3.1.0
description String body (contained in the params structure) Optional. The detailed description of the resource. 3.1.0
scalingResourceType String body (contained in the params structure) The resource type of the auto scaling group. Current type: VM instance.
  • VmInstance
3.1.0
minResourceSize Integer body (contained in the params structure) The minimum number of VM instances in the auto scaling group. 3.1.0
maxResourceSize Integer body (contained in the params structure) The maximum number of VM instances in the auto scaling group. 3.1.0
defaultCooldown Long body (contained in the params structure) The default cooldown time of the auto scaling rule. 3.1.0
removalPolicy String body (contained in the params structure) The policy for removing a VM instance.
  • OldestInstance
  • NewestInstance
  • OldestScalingConfiguration
  • MinimumCPUUsageInstance
  • MinimumMemoryUsageInstance
3.1.0
defaultEnable boolean body (contained in the params structure) Optional. Whether to enable the auto scaling group after creation. 3.1.0
resourceUuid String body (contained in the params structure) Optional. The resource UUID. 3.1.0
tagUuids List body (contained in the params structure) Optional. The tag UUID list. 3.1.0
systemTags List body Optional. The system tags. 3.1.0
userTags List body Optional. The user tags. 3.1.0

API Response

Sample Response
{
  "inventory": {
    "name": "test-group",
    "uuid": "ff296e09f82e3a84af082257ff63d162",
    "description": "just for test",
    "createDate": "Nov 14, 2017 10:20:57 PM",
    "lastOpDate": "Nov 14, 2017 10:20:57 PM"
  }
}
Name Type Description Starting Version
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error. 3.1.0
inventory AutoScalingGroupInventory See inventory. 3.1.0
#error
Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 3.1.0
description String The brief description of the error. 3.1.0
details String The details about the error. 3.1.0
elaboration String The reserved field. Default value: null. 3.1.0
opaque LinkedHashMap The reserved field. Default value: null. 3.1.0
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 3.1.0
#inventory
Name Type Description Starting Version
name String The resource name. 3.1.0
uuid String The resource UUID. 3.1.0
scalingResourceType String The resource type of the auto scaling group. Current type: VM instance. 3.1.0
state String The state of the auto scaling group. 3.1.0
defaultCooldown Long The default cooldown time of the auto scaling rule. 3.1.0
description String The detailed description of the resource. 3.1.0
minResourceSize Integer The minimum number of VM instances in the auto scaling group. 3.1.0
maxResourceSize Integer The maximum number of VM instances in the auto scaling group. 3.1.0
removalPolicy String The default policy for removing a VM instance. 3.1.0
createDate Timestamp The creation date. 3.1.0
lastOpDate Timestamp The last operation date. 3.1.0
attachedTemplates List The templates of VM instances attached to the auto scaling group. 3.1.0
systemTags List 3.1.0

SDK Sample

Java SDK
CreateAutoScalingGroupAction action = new CreateAutoScalingGroupAction();
action.name = "test-group";
action.description = "just for test";
action.scalingResourceType = "VmInstance";
action.minResourceSize = 2.0;
action.maxResourceSize = 10.0;
action.defaultCooldown = 60.0;
action.removalPolicy = "OldestInstance";
action.defaultEnable = false;
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
CreateAutoScalingGroupAction.Result res = action.call();
Python SDK
CreateAutoScalingGroupAction action = CreateAutoScalingGroupAction()
action.name = "test-group"
action.description = "just for test"
action.scalingResourceType = "VmInstance"
action.minResourceSize = 2.0
action.maxResourceSize = 10.0
action.defaultCooldown = 60.0
action.removalPolicy = "OldestInstance"
action.defaultEnable = false
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
CreateAutoScalingGroupAction.Result res = action.call()

DeleteAutoScalingGroup

API Request

URLs
DELETE zstack/v1/autoscaling/groups/{uuid}
Headers
Authorization: OAuth the-session-uuid
Curl Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X DELETE http://localhost:8080/zstack/v1/autoscaling/groups/09121b25fdf330538288d1ac81025563
Request Parameters
Name Type Location Description Optional Value Starting Version
uuid String url The resource UUID. 3.1.0
systemTags List body Optional. The system tags. 3.1.0
userTags List body Optional. The user tags. 3.1.0

API Response

When the API succeeded, an empty JSON structure {} is returned. When the API failed, the returned JSON structure includes an error field. For example,
{
"error": {
    "code": "SYS.1001",
    "description": "A message or a operation timeout",
    "details": "Create VM on KVM timeout after 300s"
}
}

SDK Sample

Java SDK
DeleteAutoScalingGroupAction action = new DeleteAutoScalingGroupAction();
action.uuid = "09121b25fdf330538288d1ac81025563";
action.deleteMode = "Permissive";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
DeleteAutoScalingGroupAction.Result res = action.call();
Python SDK
DeleteAutoScalingGroupAction action = DeleteAutoScalingGroupAction()
action.uuid = "09121b25fdf330538288d1ac81025563"
action.deleteMode = "Permissive"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
DeleteAutoScalingGroupAction.Result res = action.call()

UpdateAutoScalingGroup

API Request

URLs
PUT zstack/v1/autoscaling/groups/{uuid}/actions
Headers
Authorization: OAuth the-session-uuid
Body
{
  "updateAutoScalingGroup": {
    "name": "test-group2"
  },
  "systemTags": [],
  "userTags": []
}
Note: In the preceding sample, both systemTags and userTags are optional. These two fields can be included in the body structure.
Curl Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"updateAutoScalingGroup":{"name":"test-group2"}}' http://localhost:8080/zstack/v1/autoscaling/groups/17a8d07735b631a688d6f95f3323fe91/actions
Request Parameters
Name Type Location Description Optional Value Starting Version
uuid String url The resource UUID. 3.1.0
name String body (contained in the updateAutoScalingGroup structure) Optional. The resource name. 3.1.0
description String body (contained in the updateAutoScalingGroup structure) Optional. The detailed description of the resource. 3.1.0
minResourceSize Integer body (contained in the updateAutoScalingGroup structure) Optional. The minimum number of VM instances in the auto scaling group. 3.1.0
maxResourceSize Integer body (contained in the updateAutoScalingGroup structure) Optional. The maximum number of VM instances in the auto scaling group. 3.1.0
removalPolicy String body (contained in the updateAutoScalingGroup structure) Optional. The policy for removing a VM instance. The oldest and newest VM instances take precedence.
  • OldestInstance
  • NewestInstance
  • OldestScalingConfiguration
  • MinimumCPUUsageInstance
  • MinimumMemoryUsageInstance
3.1.0
systemTags List body Optional. The system tags. 3.1.0
userTags List body Optional. The user tags. 3.1.0

API Response

Sample Response
{
  "inventory": {
    "name": "test-load-balance-profile",
    "uuid": "95f4b920e6b63e318940a44c0f47788e",
    "description": "just for test",
    "createDate": "Nov 14, 2017 10:20:57 PM",
    "lastOpDate": "Nov 14, 2017 10:20:57 PM"
  }
}
Name Type Description Starting Version
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error. 3.1.0
inventory AutoScalingGroupInventory See inventory. 3.1.0
#error
Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 3.1.0
description String The brief description of the error. 3.1.0
details String The details about the error. 3.1.0
elaboration String The reserved field. Default value: null. 3.1.0
opaque LinkedHashMap The reserved field. Default value: null. 3.1.0
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 3.1.0
#inventory
Name Type Description Starting Version
name String The resource name. 3.1.0
uuid String The resource UUID. 3.1.0
scalingResourceType String The resource type of the auto scaling group. Current type: VM instance. 3.1.0
state String The state of the auto scaling group. 3.1.0
defaultCooldown Long The default cooldown time of the auto scaling rule. 3.1.0
description String The detailed description of the resource. 3.1.0
minResourceSize Integer The minimum number of VM instances in the auto scaling group. 3.1.0
maxResourceSize Integer The maximum number of VM instances in the auto scaling group. 3.1.0
removalPolicy String The default policy for removing a VM instance. 3.1.0
createDate Timestamp The creation date. 3.1.0
lastOpDate Timestamp The last operation date. 3.1.0
attachedTemplates List The templates of VM instances attached to the auto scaling group. 3.1.0
systemTags List 3.1.0

SDK Sample

Java SDK
UpdateAutoScalingGroupAction action = new UpdateAutoScalingGroupAction();
action.uuid = "17a8d07735b631a688d6f95f3323fe91";
action.name = "test-group2";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
UpdateAutoScalingGroupAction.Result res = action.call();
Python SDK
UpdateAutoScalingGroupAction action = UpdateAutoScalingGroupAction()
action.uuid = "17a8d07735b631a688d6f95f3323fe91"
action.name = "test-group2"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
UpdateAutoScalingGroupAction.Result res = action.call()

QueryAutoScalingGroup

API Request

URLs
GET /v1/autoscaling/groups
GET /v1/autoscaling/groups/{uuid}
Headers
Authorization: OAuth the-session-uuid
Curl Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/autoscaling/groups
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/autoscaling/groups/88dbb881575e37c78e11e988c6db5f64

Queryable Fields

You can check all queryable fields and resource names that can be queried across tables by using zstack-cli, entering QueryAutoScalingGroup, and pressing the Tab key.

API Response

Sample Response
{
  "inventories": [
    {
      "name": "test-group2",
      "uuid": "ed73d20804873d48bddee627a58ca71a",
      "description": "just for test",
      "createDate": "Nov 14, 2017 10:20:57 PM",
      "lastOpDate": "Nov 14, 2017 10:20:57 PM"
    }
  ]
}
Name Type Description Starting Version
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error. 3.1.0
inventories List See inventories. 3.1.0
#error
Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 3.1.0
description String The brief description of the error. 3.1.0
details String The details about the error. 3.1.0
elaboration String The reserved field. Default value: null. 3.1.0
opaque LinkedHashMap The reserved field. Default value: null. 3.1.0
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 3.1.0
#inventories
Name Type Description Starting Version
name String The resource name. 3.1.0
uuid String The resource UUID. 3.1.0
scalingResourceType String The resource type of the auto scaling group. Current type: VM instance. 3.1.0
state String The state of the auto scaling group. 3.1.0
defaultCooldown Long The default cooldown time of the auto scaling rule. 3.1.0
description String The detailed description of the resource. 3.1.0
minResourceSize Integer The minimum number of VM instances in the auto scaling group. 3.1.0
maxResourceSize Integer The maximum number of VM instances in the auto scaling group. 3.1.0
removalPolicy String The default policy for removing a VM instance. 3.1.0
createDate Timestamp The creation date. 3.1.0
lastOpDate Timestamp The last operation date. 3.1.0
attachedTemplates List The templates of VM instances attached to the auto scaling group. 3.1.0
systemTags List 3.1.0

SDK Sample

Java SDK
QueryAutoScalingGroupAction action = new QueryAutoScalingGroupAction();
action.conditions = asList();
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
QueryAutoScalingGroupAction.Result res = action.call();
Python SDK
QueryAutoScalingGroupAction action = QueryAutoScalingGroupAction()
action.conditions = []
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
QueryAutoScalingGroupAction.Result res = action.call()

QueryAutoScalingGroupActivity

API Request

URLs
GET zstack/v1/autoscaling/groups/activities
GET zstack/v1/autoscaling/groups/activities/{uuid}
Headers
Authorization: OAuth the-session-uuid
Curl Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/autoscaling/groups/activities
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/autoscaling/groups/activities/e075eb1434203006861a4bd00453f69f

Queryable Fields

You can check all queryable fields and resource names that can be queried across tables by using zstack-cli, entering QueryAutoScalingGroupActivity, and pressing the Tab key.

API Response

Sample Response
{
  "inventories": [
    {
      "uuid": "036f189a51633ec5bfa2f7e77ec1f5ac",
      "description": "just for test",
      "createDate": "Nov 14, 2017 10:20:57 PM",
      "lastOpDate": "Nov 14, 2017 10:20:57 PM"
    }
  ]
}
Name Type Description Starting Version
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error. 3.1.0
inventories List See inventories. 3.1.0
#error
Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 3.1.0
description String The brief description of the error. 3.1.0
details String The details about the error. 3.1.0
elaboration String The reserved field. Default value: null. 3.1.0
opaque LinkedHashMap The reserved field. Default value: null. 3.1.0
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 3.1.0
#inventories
Name Type Description Starting Version
uuid String The resource UUID. 3.1.0
name String The resource name. 3.1.0
scalingGroupUuid String The UUID of the auto scaling group. 3.1.0
activityAction String The type of the auto scaling activity. 3.1.0
scalingGroupRuleUuid String The UUID of the auto scaling rule. 3.1.0
cause String The reason that triggered the auto scaling activity. 3.1.0
description String The detailed description of the auto scaling activity. 3.1.0
status String The status of the auto scaling activity. 3.1.0
activityActionResultMessage String The result of the auto scaling activity. 3.1.0
endDate Timestamp The date and time when the auto scaling activity ends. 3.1.0
createDate Timestamp The creation date. 3.1.0
lastOpDate Timestamp The last operation date. 3.1.0

SDK Sample

Java SDK
QueryAutoScalingGroupActivityAction action = new QueryAutoScalingGroupActivityAction();
action.conditions = asList();
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
QueryAutoScalingGroupActivityAction.Result res = action.call();
Python SDK
QueryAutoScalingGroupActivityAction action = QueryAutoScalingGroupActivityAction()
action.conditions = []
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
QueryAutoScalingGroupActivityAction.Result res = action.call()

CreateAutoScalingGroupAddingNewInstanceRule

API Request

URLs
POST zstack/v1/autoscaling/rules/adding-new-instance
Headers
Authorization: OAuth the-session-uuid
Body
{
  "params": {
    "adjustmentType": "PercentChangeInCapacity",
    "adjustmentValue": 1.0,
    "name": "addingNewInstance",
    "description": "just for test",
    "autoScalingGroupUuid": "9e5900b0682d3eb8868637b455567cbd",
    "cooldown": 10.0
  },
  "systemTags": [],
  "userTags": []
}
Note: In the preceding sample, both systemTags and userTags are optional. These two fields can be included in the body structure.
Curl Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{"adjustmentType":"PercentChangeInCapacity","adjustmentValue":1.0,"name":"addingNewInstance","description":"just for test","autoScalingGroupUuid":"9e5900b0682d3eb8868637b455567cbd","cooldown":10.0}}' http://localhost:8080/zstack/v1/autoscaling/rules/adding-new-instance
Request Parameters
Name Type Location Description Optional Value Starting Version
adjustmentType String body (contained in the params structure) The scale-out method. Options:
  • Add a specified number of VM instances.
  • Add VM instances by percentage.
  • Add VM instances to a specified number.
  • QuantityChangeInCapacity
  • PercentChangeInCapacity
  • TotalCapacity
3.1.0
adjustmentValue Integer body (contained in the params structure) The scale-out size. 3.1.0
name String body (contained in the params structure) The resource name. 3.1.0
description String body (contained in the params structure) Optional. The detailed description of the resource. 3.1.0
autoScalingGroupUuid String body (contained in the params structure) The UUID of the auto scaling group. 3.1.0
type String body (contained in the params structure) Optional. The type of the auto scaling rule. 3.1.0
cooldown Long body (contained in the params structure) Optional. The cooldown time after the auto scaling rule is triggered. 3.1.0
resourceUuid String body (contained in the params structure) Optional. The resource UUID. 3.1.0
tagUuids List body (contained in the params structure) Optional. The tag UUID list. 3.1.0
systemTags List body Optional. The system tags. 3.1.0
userTags List body Optional. The user tags. 3.1.0

API Response

Sample Response
{
  "inventory": {
    "type": "HealthProfile",
    "description": "just for test",
    "cooldown": 10.0,
    "state": "Enabled",
    "createDate": "Nov 14, 2017 10:20:57 PM",
    "lastOpDate": "Nov 14, 2017 10:20:57 PM",
    "name": "test-health-policy",
    "uuid": "f41b2b0ae44637a2af1985e362dc52d4"
  }
}
Name Type Description Starting Version
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error. 3.1.0
inventory AutoScalingRuleInventory See inventory. 3.1.0
#error
Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 3.1.0
description String The brief description of the error. 3.1.0
details String The details about the error. 3.1.0
elaboration String The reserved field. Default value: null. 3.1.0
opaque LinkedHashMap The reserved field. Default value: null. 3.1.0
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 3.1.0
#inventory
Name Type Description Starting Version
type String The type of the auto scaling rule. 3.1.0
description String The detailed description of the resource. 3.1.0
cooldown Long The cooldown time. 3.1.0
systemTags List 3.1.0
createDate Timestamp The creation date. 3.1.0
lastOpDate Timestamp The last operation date. 3.1.0
name String The resource name. 3.1.0
uuid String The resource UUID. 3.1.0
scalingGroupUuid String 3.1.0
state AutoScalingRuleState See state. 3.1.0
status AutoScalingRuleStatus See status. 3.1.0
ruleTriggers List See ruleTriggers. 3.1.0
#state
Name Type Description Starting Version
Enabled AutoScalingRuleState The auto scaling rule is enabled. 3.1.0
Disabled AutoScalingRuleState The auto scaling rule is disabled. 3.1.0
#status
Name Type Description Starting Version
Created AutoScalingRuleStatus The auto scaling rule is created. 3.1.0
WaitingForTrigger AutoScalingRuleStatus The auto scaling rule is waiting to be triggered. 3.1.0
Triggering AutoScalingRuleStatus The auto scaling rule is triggered. 3.1.0
Error AutoScalingRuleStatus 3.1.0
#ruleTriggers
Name Type Description Starting Version
name String The resource name. 3.1.0
uuid String The resource UUID. 3.1.0
type String The trigger type. 3.1.0
ruleUuid String The UUID of the auto scaling rule. 3.1.0
description String The detailed description of the resource. 3.1.0
state String The state of the trigger. 3.1.0
createDate Timestamp The creation date. 3.1.0
lastOpDate Timestamp The last operation date. 3.1.0

SDK Sample

Java SDK
CreateAutoScalingGroupAddingNewInstanceRuleAction action = new CreateAutoScalingGroupAddingNewInstanceRuleAction();
action.adjustmentType = "PercentChangeInCapacity";
action.adjustmentValue = 1.0;
action.name = "addingNewInstance";
action.description = "just for test";
action.autoScalingGroupUuid = "9e5900b0682d3eb8868637b455567cbd";
action.cooldown = 10.0;
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
CreateAutoScalingGroupAddingNewInstanceRuleAction.Result res = action.call();
Python SDK
CreateAutoScalingGroupAddingNewInstanceRuleAction action = CreateAutoScalingGroupAddingNewInstanceRuleAction()
action.adjustmentType = "PercentChangeInCapacity"
action.adjustmentValue = 1.0
action.name = "addingNewInstance"
action.description = "just for test"
action.autoScalingGroupUuid = "9e5900b0682d3eb8868637b455567cbd"
action.cooldown = 10.0
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
CreateAutoScalingGroupAddingNewInstanceRuleAction.Result res = action.call()

CreateAutoScalingGroupRemovalInstanceRule

API Request

URLs
POST zstack/v1/autoscaling/rules/removal-instance
Headers
Authorization: OAuth the-session-uuid
Body
{
  "params": {
    "adjustmentType": "PercentChangeInCapacity",
    "adjustmentValue": 1.0,
    "removalPolicy": "MinimumMemoryUsageInstance",
    "name": "removalInstance",
    "description": "just for test",
    "autoScalingGroupUuid": "8a8070f9926733478acad7bf0ba60a63",
    "cooldown": 10.0
  },
  "systemTags": [],
  "userTags": []
}
Note: In the preceding sample, both systemTags and userTags are optional. These two fields can be included in the body structure.
Curl Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{"adjustmentType":"PercentChangeInCapacity","adjustmentValue":1.0,"removalPolicy":"MinimumMemoryUsageInstance","name":"removalInstance","description":"just for test","autoScalingGroupUuid":"8a8070f9926733478acad7bf0ba60a63","cooldown":10.0}}' http://localhost:8080/zstack/v1/autoscaling/rules/removal-instance
Request Parameters
Name Type Location Description Optional Value Starting Version
adjustmentType String body (contained in the params structure) The scale-in method. Options:
  • Remove a specified number of VM instances.
  • Remove VM instances by percentage.
  • Remove VM instances to a specified number.
  • QuantityChangeInCapacity
  • PercentChangeInCapacity
  • TotalCapacity
3.1.0
adjustmentValue Integer body (contained in the params structure) The scale-in size. 3.1.0
removalPolicy String body (contained in the params structure) The policy for removing a VM instance.
  • OldestInstance
  • NewestInstance
  • OldestScalingConfiguration
  • MinimumCPUUsageInstance
  • MinimumMemoryUsageInstance
3.1.0
name String body (contained in the params structure) The resource name. 3.1.0
description String body (contained in the params structure) Optional. The detailed description of the resource. 3.1.0
autoScalingGroupUuid String body (contained in the params structure) The UUID of the auto scaling group. 3.1.0
type String body (contained in the params structure) Optional. The type of the auto scaling rule. 3.1.0
cooldown Long body (contained in the params structure) Optional. The cooldown time after the auto scaling rule is triggered. 3.1.0
resourceUuid String body (contained in the params structure) Optional. The resource UUID. 3.1.0
tagUuids List body (contained in the params structure) Optional. The tag UUID list. 3.1.0
systemTags List body Optional. The system tags. 3.1.0
userTags List body Optional. The user tags. 3.1.0

API Response

Sample Response
{
  "inventory": {
    "type": "HealthProfile",
    "description": "just for test",
    "cooldown": 10.0,
    "state": "Enabled",
    "createDate": "Nov 14, 2017 10:20:57 PM",
    "lastOpDate": "Nov 14, 2017 10:20:57 PM",
    "name": "test-health-policy",
    "uuid": "f41b2b0ae44637a2af1985e362dc52d4"
  }
}
Name Type Description Starting Version
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error. 3.1.0
inventory AutoScalingRuleInventory See inventory. 3.1.0
#error
Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 3.1.0
description String The brief description of the error. 3.1.0
details String The details about the error. 3.1.0
elaboration String The reserved field. Default value: null. 3.1.0
opaque LinkedHashMap The reserved field. Default value: null. 3.1.0
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 3.1.0
#inventory
Name Type Description Starting Version
type String The type of the auto scaling rule. 3.1.0
description String The detailed description of the resource. 3.1.0
cooldown Long The cooldown time. 3.1.0
systemTags List 3.1.0
createDate Timestamp The creation date. 3.1.0
lastOpDate Timestamp The last operation date. 3.1.0
name String The resource name. 3.1.0
uuid String The resource UUID. 3.1.0
scalingGroupUuid String 3.1.0
state AutoScalingRuleState See state. 3.1.0
status AutoScalingRuleStatus See status. 3.1.0
ruleTriggers List See ruleTriggers. 3.1.0
#state
Name Type Description Starting Version
Enabled AutoScalingRuleState The auto scaling rule is enabled. 3.1.0
Disabled AutoScalingRuleState The auto scaling rule is disabled. 3.1.0
#status
Name Type Description Starting Version
Created AutoScalingRuleStatus The auto scaling rule is created. 3.1.0
WaitingForTrigger AutoScalingRuleStatus The auto scaling rule is waiting to be triggered. 3.1.0
Triggering AutoScalingRuleStatus The auto scaling rule is triggered. 3.1.0
Error AutoScalingRuleStatus 3.1.0
#ruleTriggers
Name Type Description Starting Version
name String The resource name. 3.1.0
uuid String The resource UUID. 3.1.0
type String The trigger type. 3.1.0
ruleUuid String The UUID of the auto scaling rule. 3.1.0
description String The detailed description of the resource. 3.1.0
state String The state of the trigger. 3.1.0
createDate Timestamp The creation date. 3.1.0
lastOpDate Timestamp The last operation date. 3.1.0

SDK Sample

Java SDK
CreateAutoScalingGroupRemovalInstanceRuleAction action = new CreateAutoScalingGroupRemovalInstanceRuleAction();
action.adjustmentType = "PercentChangeInCapacity";
action.adjustmentValue = 1.0;
action.removalPolicy = "MinimumMemoryUsageInstance";
action.name = "removalInstance";
action.description = "just for test";
action.autoScalingGroupUuid = "8a8070f9926733478acad7bf0ba60a63";
action.cooldown = 10.0;
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
CreateAutoScalingGroupRemovalInstanceRuleAction.Result res = action.call();
Python SDK
CreateAutoScalingGroupRemovalInstanceRuleAction action = CreateAutoScalingGroupRemovalInstanceRuleAction()
action.adjustmentType = "PercentChangeInCapacity"
action.adjustmentValue = 1.0
action.removalPolicy = "MinimumMemoryUsageInstance"
action.name = "removalInstance"
action.description = "just for test"
action.autoScalingGroupUuid = "8a8070f9926733478acad7bf0ba60a63"
action.cooldown = 10.0
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
CreateAutoScalingGroupRemovalInstanceRuleAction.Result res = action.call()

DeleteAutoScalingRule

API Request

URLs
DELETE zstack/v1/autoscaling/rules/{uuid}
Headers
Authorization: OAuth the-session-uuid
Curl Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X DELETE http://localhost:8080/zstack/v1/autoscaling/rules/55774c4baaea33c4a47b16c772446077
Request Parameters
Name Type Location Description Optional Value Starting Version
uuid String url The UUID of the auto scaling rule. 3.1.0
systemTags List body Optional. The system tags. 3.1.0
userTags List body Optional. The user tags. 3.1.0

API Response

When the API succeeded, an empty JSON structure {} is returned. When the API failed, the returned JSON structure includes an error field. For example,
{
"error": {
    "code": "SYS.1001",
    "description": "A message or a operation timeout",
    "details": "Create VM on KVM timeout after 300s"
}
}

SDK Sample

Java SDK
DeleteAutoScalingRuleAction action = new DeleteAutoScalingRuleAction();
action.uuid = "55774c4baaea33c4a47b16c772446077";
action.deleteMode = "Permissive";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
DeleteAutoScalingRuleAction.Result res = action.call();
Python SDK
DeleteAutoScalingRuleAction action = DeleteAutoScalingRuleAction()
action.uuid = "55774c4baaea33c4a47b16c772446077"
action.deleteMode = "Permissive"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
DeleteAutoScalingRuleAction.Result res = action.call()

UpdateAutoScalingRule

API Request

URLs
PUT zstack/v1/autoscaling/rules/{uuid}/actions
Headers
Authorization: OAuth the-session-uuid
Body
{
  "updateAutoScalingRule": {
    "name": "test name2"
  },
  "systemTags": [],
  "userTags": []
}
Note: In the preceding sample, both systemTags and userTags are optional. These two fields can be included in the body structure.
Curl Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"updateAutoScalingRule":{"name":"test name2"}}' http://localhost:8080/zstack/v1/autoscaling/rules/4e8be98cd3a93176b9d38f3f934f1c2a/actions
Request Parameters
Name Type Location Description Optional Value Starting Version
uuid String url The resource UUID. 3.1.0
name String body (contained in the updateAutoScalingRule structure) Optional. The resource name. 3.1.0
description String body (contained in the updateAutoScalingRule structure) Optional. The detailed description of the resource. 3.1.0
cooldown Long body (contained in the updateAutoScalingRule structure) Optional. The cooldown time. 3.1.0
systemTags List body Optional. The system tags. 3.1.0
userTags List body Optional. The user tags. 3.1.0

API Response

Sample Response
{
  "inventory": {
    "type": "HealthProfile",
    "description": "just for test",
    "cooldown": 10.0,
    "state": "Enabled",
    "status": "Created",
    "createDate": "Nov 14, 2017 10:20:57 PM",
    "lastOpDate": "Nov 14, 2017 10:20:57 PM",
    "name": "test name2",
    "uuid": "39009f21b4a035c08db6cbff4ebe276c"
  }
}
Name Type Description Starting Version
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error. 3.1.0
inventory AutoScalingRuleInventory See inventory. 3.1.0
#error
Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 3.1.0
description String The brief description of the error. 3.1.0
details String The details about the error. 3.1.0
elaboration String The reserved field. Default value: null. 3.1.0
opaque LinkedHashMap The reserved field. Default value: null. 3.1.0
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 3.1.0
#inventory
Name Type Description Starting Version
type String The type of the auto scaling rule. 3.1.0
description String The detailed description of the resource. 3.1.0
cooldown Long The cooldown time. 3.1.0
systemTags List 3.1.0
createDate Timestamp The creation date. 3.1.0
lastOpDate Timestamp The last operation date. 3.1.0
name String The resource name. 3.1.0
uuid String The resource UUID. 3.1.0
scalingGroupUuid String 3.1.0
state AutoScalingRuleState See state. 3.1.0
status AutoScalingRuleStatus See status. 3.1.0
ruleTriggers List See ruleTriggers. 3.1.0
#state
Name Type Description Starting Version
Enabled AutoScalingRuleState The auto scaling rule is enabled. 3.1.0
Disabled AutoScalingRuleState The auto scaling rule is disabled. 3.1.0
#status
Name Type Description Starting Version
Created AutoScalingRuleStatus The auto scaling rule is created. 3.1.0
WaitingForTrigger AutoScalingRuleStatus The auto scaling rule is waiting to be triggered. 3.1.0
Triggering AutoScalingRuleStatus The auto scaling rule is triggered. 3.1.0
Error AutoScalingRuleStatus 3.1.0
#ruleTriggers
Name Type Description Starting Version
name String The resource name. 3.1.0
uuid String The resource UUID. 3.1.0
type String The trigger type. 3.1.0
ruleUuid String The UUID of the auto scaling rule. 3.1.0
description String The detailed description of the resource. 3.1.0
state String The state of the trigger. 3.1.0
createDate Timestamp The creation date. 3.1.0
lastOpDate Timestamp The last operation date. 3.1.0

SDK Sample

Java SDK
UpdateAutoScalingRuleAction action = new UpdateAutoScalingRuleAction();
action.uuid = "4e8be98cd3a93176b9d38f3f934f1c2a";
action.name = "test name2";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
UpdateAutoScalingRuleAction.Result res = action.call();
Python SDK
UpdateAutoScalingRuleAction action = UpdateAutoScalingRuleAction()
action.uuid = "4e8be98cd3a93176b9d38f3f934f1c2a"
action.name = "test name2"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
UpdateAutoScalingRuleAction.Result res = action.call()

UpdateAutoScalingGroupAddingNewInstanceRule

API Request

URLs
PUT zstack/v1/autoscaling/rules/adding-new-instance/{uuid}/actions
Headers
Authorization: OAuth the-session-uuid
Body
{
  "updateAutoScalingGroupAddingNewInstanceRule": {
    "name": "test name2"
  },
  "systemTags": [],
  "userTags": []
}
Note: In the preceding sample, both systemTags and userTags are optional. These two fields can be included in the body structure.
Curl Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"updateAutoScalingGroupAddingNewInstanceRule":{"name":"test name2"}}' http://localhost:8080/zstack/v1/autoscaling/rules/adding-new-instance/e61646c51ac1396fb6d7d413dc5de3f8/actions
Request Parameters
Name Type Location Description Optional Value Starting Version
adjustmentType String body (contained in the updateAutoScalingGroupAddingNewInstanceRule structure) Optional. The scale-out method. Options:
  • Add a specified number of VM instances.
  • Add VM instances by percentage.
  • Add VM instances to a specified number.
  • QuantityChangeInCapacity
  • PercentChangeInCapacity
  • TotalCapacity
3.1.0
adjustmentValue Integer body (contained in the updateAutoScalingGroupAddingNewInstanceRule structure) Optional. The scale-out size. 3.1.0
uuid String url The resource UUID. 3.1.0
name String body (contained in the updateAutoScalingGroupAddingNewInstanceRule structure) Optional. The resource name. 3.1.0
description String body (contained in the updateAutoScalingGroupAddingNewInstanceRule structure) Optional. The detailed description of the resource. 3.1.0
cooldown Long body (contained in the updateAutoScalingGroupAddingNewInstanceRule structure) Optional. The cooldown time. 3.1.0
systemTags List body Optional. The system tags. 3.1.0
userTags List body Optional. The user tags. 3.1.0

API Response

Sample Response
{
  "inventory": {
    "type": "HealthProfile",
    "description": "just for test",
    "cooldown": 10.0,
    "state": "Enabled",
    "status": "Created",
    "createDate": "Nov 14, 2017 10:20:57 PM",
    "lastOpDate": "Nov 14, 2017 10:20:57 PM",
    "name": "test name2",
    "uuid": "39009f21b4a035c08db6cbff4ebe276c"
  }
}
Name Type Description Starting Version
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error. 3.1.0
inventory AutoScalingRuleInventory See inventory. 3.1.0
#error
Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 3.1.0
description String The brief description of the error. 3.1.0
details String The details about the error. 3.1.0
elaboration String The reserved field. Default value: null. 3.1.0
opaque LinkedHashMap The reserved field. Default value: null. 3.1.0
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 3.1.0
#inventory
Name Type Description Starting Version
type String The type of the auto scaling rule. 3.1.0
description String The detailed description of the resource. 3.1.0
cooldown Long The cooldown time. 3.1.0
systemTags List 3.1.0
createDate Timestamp The creation date. 3.1.0
lastOpDate Timestamp The last operation date. 3.1.0
name String The resource name. 3.1.0
uuid String The resource UUID. 3.1.0
scalingGroupUuid String 3.1.0
state AutoScalingRuleState See state. 3.1.0
status AutoScalingRuleStatus See status. 3.1.0
ruleTriggers List See ruleTriggers. 3.1.0
#state
Name Type Description Starting Version
Enabled AutoScalingRuleState The auto scaling rule is enabled. 3.1.0
Disabled AutoScalingRuleState The auto scaling rule is disabled. 3.1.0
#status
Name Type Description Starting Version
Created AutoScalingRuleStatus The auto scaling rule is created. 3.1.0
WaitingForTrigger AutoScalingRuleStatus The auto scaling rule is waiting to be triggered. 3.1.0
Triggering AutoScalingRuleStatus The auto scaling rule is triggered. 3.1.0
Error AutoScalingRuleStatus 3.1.0
#ruleTriggers
Name Type Description Starting Version
name String The resource name. 3.1.0
uuid String The resource UUID. 3.1.0
type String The trigger type. 3.1.0
ruleUuid String The UUID of the auto scaling rule. 3.1.0
description String The detailed description of the resource. 3.1.0
state String The state of the trigger. 3.1.0
createDate Timestamp The creation date. 3.1.0
lastOpDate Timestamp The last operation date. 3.1.0

SDK Sample

Java SDK
UpdateAutoScalingGroupAddingNewInstanceRuleAction action = new UpdateAutoScalingGroupAddingNewInstanceRuleAction();
action.uuid = "e61646c51ac1396fb6d7d413dc5de3f8";
action.name = "test name2";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
UpdateAutoScalingGroupAddingNewInstanceRuleAction.Result res = action.call();
Python SDK
UpdateAutoScalingGroupAddingNewInstanceRuleAction action = UpdateAutoScalingGroupAddingNewInstanceRuleAction()
action.uuid = "e61646c51ac1396fb6d7d413dc5de3f8"
action.name = "test name2"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
UpdateAutoScalingGroupAddingNewInstanceRuleAction.Result res = action.call()

UpdateAutoScalingGroupRemovalInstanceRule

API Request

URLs
PUT zstack/v1/autoscaling/rules/removal-instance/{uuid}/actions
Headers
Authorization: OAuth the-session-uuid
Body
{
  "updateAutoScalingGroupRemovalInstanceRule": {
    "name": "test name2"
  },
  "systemTags": [],
  "userTags": []
}
Note: In the preceding sample, both systemTags and userTags are optional. These two fields can be included in the body structure.
Curl Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"updateAutoScalingGroupRemovalInstanceRule":{"name":"test name2"}}' http://localhost:8080/zstack/v1/autoscaling/rules/removal-instance/66d7d0b81f1c399bb98063dfb0d3beaf/actions
Request Parameters
Name Type Location Description Optional Value Starting Version
adjustmentType String body (contained in the updateAutoScalingGroupRemovalInstanceRule structure) Optional. The scale-in method. Options:
  • Remove a specified number of VM instances.
  • Remove VM instances by percentage.
  • Remove VM instances to a specified number.
  • QuantityChangeInCapacity
  • PercentChangeInCapacity
  • TotalCapacity
3.1.0
adjustmentValue Integer body (contained in the updateAutoScalingGroupRemovalInstanceRule structure) Optional. The scale-in size. 3.1.0
removalPolicy String body (contained in the updateAutoScalingGroupRemovalInstanceRule structure) Optional. The policy for removing a VM instance.
  • OldestInstance
  • NewestInstance
  • OldestScalingConfiguration
  • MinimumCPUUsageInstance
  • MinimumMemoryUsageInstance
3.1.0
uuid String url The resource UUID. 3.1.0
name String body (contained in the updateAutoScalingGroupRemovalInstanceRule structure) Optional. The resource name. 3.1.0
description String body (contained in the updateAutoScalingGroupRemovalInstanceRule structure) Optional. The detailed description of the resource. 3.1.0
cooldown Long body (contained in the updateAutoScalingGroupRemovalInstanceRule structure) Optional. The cooldown time. 3.1.0
systemTags List body Optional. The system tags. 3.1.0
userTags List body Optional. The user tags. 3.1.0

API Response

SDK Sample
{
  "inventory": {
    "type": "HealthProfile",
    "description": "just for test",
    "cooldown": 10.0,
    "state": "Enabled",
    "status": "Created",
    "createDate": "Nov 14, 2017 10:20:57 PM",
    "lastOpDate": "Nov 14, 2017 10:20:57 PM",
    "name": "test name2",
    "uuid": "39009f21b4a035c08db6cbff4ebe276c"
  }
}
Name Type Description Starting Version
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error. 3.1.0
inventory AutoScalingRuleInventory See inventory. 3.1.0
#error
Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 3.1.0
description String The brief description of the error. 3.1.0
details String The details about the error. 3.1.0
elaboration String The reserved field. Default value: null. 3.1.0
opaque LinkedHashMap The reserved field. Default value: null. 3.1.0
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 3.1.0
#inventory
Name Type Description Starting Version
type String The type of the auto scaling rule. 3.1.0
description String The detailed description of the resource. 3.1.0
cooldown Long The cooldown time. 3.1.0
systemTags List 3.1.0
createDate Timestamp The creation date. 3.1.0
lastOpDate Timestamp The last operation date. 3.1.0
name String The resource name. 3.1.0
uuid String The resource UUID. 3.1.0
scalingGroupUuid String 3.1.0
state AutoScalingRuleState See state. 3.1.0
status AutoScalingRuleStatus See status. 3.1.0
ruleTriggers List See ruleTriggers. 3.1.0
#state
Name Type Description Starting Version
Enabled AutoScalingRuleState The auto scaling rule is enabled. 3.1.0
Disabled AutoScalingRuleState The auto scaling rule is disabled. 3.1.0
#status
Name Type Description Starting Version
Created AutoScalingRuleStatus The auto scaling rule is created. 3.1.0
WaitingForTrigger AutoScalingRuleStatus The auto scaling rule is waiting to be triggered. 3.1.0
Triggering AutoScalingRuleStatus The auto scaling rule is triggered. 3.1.0
Error AutoScalingRuleStatus 3.1.0
#ruleTriggers
Name Type Description Starting Version
name String The resource name. 3.1.0
uuid String The resource UUID. 3.1.0
type String The trigger type. 3.1.0
ruleUuid String The UUID of the auto scaling rule. 3.1.0
description String The detailed description of the resource. 3.1.0
state String The state of the trigger. 3.1.0
createDate Timestamp The creation date. 3.1.0
lastOpDate Timestamp The last operation date. 3.1.0

SDK Sample

Java SDK
UpdateAutoScalingGroupRemovalInstanceRuleAction action = new UpdateAutoScalingGroupRemovalInstanceRuleAction();
action.uuid = "66d7d0b81f1c399bb98063dfb0d3beaf";
action.name = "test name2";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
UpdateAutoScalingGroupRemovalInstanceRuleAction.Result res = action.call();
Python SDK
UpdateAutoScalingGroupRemovalInstanceRuleAction action = UpdateAutoScalingGroupRemovalInstanceRuleAction()
action.uuid = "66d7d0b81f1c399bb98063dfb0d3beaf"
action.name = "test name2"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
UpdateAutoScalingGroupRemovalInstanceRuleAction.Result res = action.call()

QueryAutoScalingRule

API Request

URLs
GET zstack/v1/autoscaling/groups/rules
GET zstack/v1/autoscaling/groups/rules/{uuid}
Headers
Authorization: OAuth the-session-uuid
Curl Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/autoscaling/groups/rules
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/autoscaling/groups/rules/404fe677c3213e4bbb39d91a2efb3595

Queryable Fields

You can check all queryable fields and resource names that can be queried across tables by using zstack-cli, entering QueryAutoScalingRule, and pressing the Tab key.

API Response

Sample Response
{
  "inventories": [
    {
      "type": "LoadBalanceProfile",
      "description": "just for test",
      "cooldown": 100.0,
      "state": "Enabled",
      "status": "Created",
      "createDate": "Nov 14, 2017 10:20:57 PM",
      "lastOpDate": "Nov 14, 2017 10:20:57 PM",
      "name": "test-load-balance-profile",
      "uuid": "a0d075cd82c13084b29f93325651fc65"
    }
  ]
}
Name Type Description Starting Version
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error. 3.1.0
inventories List See inventories. 3.1.0
#error
Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 3.1.0
description String The brief description of the error. 3.1.0
details String The details about the error. 3.1.0
elaboration String The reserved field. Default value: null. 3.1.0
opaque LinkedHashMap The reserved field. Default value: null. 3.1.0
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 3.1.0
#inventories
Name Type Description Starting Version
type String The type of the auto scaling rule. 3.1.0
description String The detailed description of the resource. 3.1.0
cooldown Long The cooldown time. 3.1.0
systemTags List 3.1.0
createDate Timestamp The creation date. 3.1.0
lastOpDate Timestamp The last operation date. 3.1.0
name String The resource name. 3.1.0
uuid String The resource UUID. 3.1.0
scalingGroupUuid String 3.1.0
state AutoScalingRuleState See state. 3.1.0
status AutoScalingRuleStatus See status. 3.1.0
ruleTriggers List See ruleTriggers. 3.1.0
#state
Name Type Description Starting Version
Enabled AutoScalingRuleState The auto scaling rule is enabled. 3.1.0
Disabled AutoScalingRuleState The auto scaling rule is disabled. 3.1.0
#status
Name Type Description Starting Version
Created AutoScalingRuleStatus The auto scaling rule is created. 3.1.0
WaitingForTrigger AutoScalingRuleStatus The auto scaling rule is waiting to be triggered. 3.1.0
Triggering AutoScalingRuleStatus The auto scaling rule is triggered. 3.1.0
Error AutoScalingRuleStatus 3.1.0
#ruleTriggers
Name Type Description Starting Version
name String The resource name. 3.1.0
uuid String The resource UUID. 3.1.0
type String The trigger type. 3.1.0
ruleUuid String The UUID of the auto scaling rule. 3.1.0
description String The detailed description of the resource. 3.1.0
state String The state of the trigger. 3.1.0
createDate Timestamp The creation date. 3.1.0
lastOpDate Timestamp The last operation date. 3.1.0

SDK Sample

Java SDK
QueryAutoScalingRuleAction action = new QueryAutoScalingRuleAction();
action.conditions = asList();
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
QueryAutoScalingRuleAction.Result res = action.call();
Python SDK
QueryAutoScalingRuleAction action = QueryAutoScalingRuleAction()
action.conditions = []
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
QueryAutoScalingRuleAction.Result res = action.call()

CreateAutoScalingRuleAlarmTrigger

API Request

URLs
POST zstack/v1/zwatch/alarms/{alarmUuid}/autoscaling/rules/{ruleUuid}
Headers
Authorization: OAuth the-session-uuid
Body
{
  "params": {
    "name": "createAlarmTrigger"
  },
  "systemTags": [],
  "userTags": []
}
Note: In the preceding sample, both systemTags and userTags are optional. These two fields can be included in the body structure.
Curl Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{"name":"createAlarmTrigger"}}' http://localhost:8080/zstack/v1/zwatch/alarms/00f142f73b633bf0ab4a1e34aa84062b/autoscaling/rules/14b74127a20634c6b6d3566ef33b0600
Request Parameters
Name Type Location Description Optional Value Starting Version
alarmUuid String url The alarm UUID. 3.1.0
triggerType String body (contained in the params structure) Optional. The trigger type. 3.1.0
name String body (contained in the params structure) The trigger name. 3.1.0
description String body (contained in the params structure) Optional. The detailed description of the resource. 3.1.0
ruleUuid String url The UUID of the auto scaling rule. 3.1.0
resourceUuid String body (contained in the params structure) Optional. The resource UUID. 3.1.0
tagUuids List body (contained in the params structure) Optional. The tag UUID list. 3.1.0
systemTags List body Optional. The system tags. 3.1.0
userTags List body Optional. The user tags. 3.1.0

API Response

Sample Response
{
  "inventory": {
    "name": "test-group",
    "uuid": "d09cd777bb863d6bbfe1267b590e947e",
    "description": "just for test",
    "createDate": "Nov 14, 2017 10:20:57 PM",
    "lastOpDate": "Nov 14, 2017 10:20:57 PM"
  }
}
Name Type Description Starting Version
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error. 3.1.0
inventory AutoScalingRuleTriggerInventory See inventory. 3.1.0
#error
Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 3.1.0
description String The brief description of the error. 3.1.0
details String The details about the error. 3.1.0
elaboration String The reserved field. Default value: null. 3.1.0
opaque LinkedHashMap The reserved field. Default value: null. 3.1.0
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 3.1.0
#inventory
Name Type Description Starting Version
name String The resource name. 3.1.0
uuid String The resource UUID. 3.1.0
type String The trigger type. 3.1.0
ruleUuid String The UUID of the auto scaling rule. 3.1.0
description String Optional. The detailed description of the resource. 3.1.0
state String The state of the trigger. 3.1.0
createDate Timestamp The creation date. 3.1.0
lastOpDate Timestamp The last operation date. 3.1.0

SDK Sample

Java SDK
CreateAutoScalingRuleAlarmTriggerAction action = new CreateAutoScalingRuleAlarmTriggerAction();
action.alarmUuid = "00f142f73b633bf0ab4a1e34aa84062b";
action.name = "createAlarmTrigger";
action.ruleUuid = "14b74127a20634c6b6d3566ef33b0600";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
CreateAutoScalingRuleAlarmTriggerAction.Result res = action.call();
Python SDK
CreateAutoScalingRuleAlarmTriggerAction action = CreateAutoScalingRuleAlarmTriggerAction()
action.alarmUuid = "00f142f73b633bf0ab4a1e34aa84062b"
action.name = "createAlarmTrigger"
action.ruleUuid = "14b74127a20634c6b6d3566ef33b0600"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
CreateAutoScalingRuleAlarmTriggerAction.Result res = action.call()

CreateAutoScalingRuleSchedulerJobTrigger

API Request

URLs
POST zstack/v1/scheduler/jobs/{schedulerJobUuid}/autoscaling/rules/{ruleUuid}
Headers
Authorization: OAuth the-session-uuid
Body
{
  "params": {
    "name": "createAlarmTrigger"
  },
  "systemTags": [],
  "userTags": []
}
Note: In the preceding sample, both systemTags and userTags are optional. These two fields can be included in the body structure.
Curl Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{"name":"createAlarmTrigger"}}' http://localhost:8080/zstack/v1/scheduler/jobs/2f194775b8ab3e2b912f92a74501a7ea/autoscaling/rules/852f6e9199c439d0861eec939c5fbbe1
Request Parameters
Name Type Location Description Valid Value Starting Version
schedulerJobUuid String url The scheduled job UUID. 4.1.0
triggerType String body (contained in the params structure) Optional. The trigger type. 4.1.0
name String body (contained in the params structure) The trigger name. 4.1.0
description String body (contained in the params structure) Optional. The detailed description of the trigger. 4.1.0
ruleUuid String url The auto-scaling UUID. 4.1.0
resourceUuid String body (contained in the params structure) Optional. The resource UUID. 4.1.0
tagUuids List body (contained in the params structure) Optional. The tag UUIDs. 4.1.0
systemTags List body Optional. The system tags. 4.1.0
userTags List body Optional. The user tags. 4.1.0

API Response

Sample Response
{
  "inventory": {
    "name": "test-group",
    "uuid": "d09cd777bb863d6bbfe1267b590e947e",
    "description": "just for test",
    "createDate": "Nov 14, 2017 10:20:57 PM",
    "lastOpDate": "Nov 14, 2017 10:20:57 PM"
  }
}
Name Type Description Starting Version
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error 4.1.0
inventory AutoScalingRuleTriggerInventory See inventory 4.1.0
#error
Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 4.1.0
description String The brief description of the error. 4.1.0
details String The details about the error. 4.1.0
elaboration String The reserved field. Default value: null. 4.1.0
opaque LinkedHashMap The reserved field. Default value: null. 4.1.0
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 4.1.0
#inventory
Name Type Description Starting Version
name String The resource name. 4.1.0
uuid String The resource UUID. 4.1.0
type String The trigger type. 4.1.0
ruleUuid String The auto-scaling rule UUID. 4.1.0
description String Optional. The detailed description of the resource. 4.1.0
state String The trigger state. 4.1.0
createDate Timestamp The creation time. 4.1.0
lastOpDate Timestamp The last update time. 4.1.0

SDK Sample

Java SDK
CreateAutoScalingRuleSchedulerJobTriggerAction action = new CreateAutoScalingRuleSchedulerJobTriggerAction();
action.schedulerJobUuid = "2f194775b8ab3e2b912f92a74501a7ea";
action.name = "createAlarmTrigger";
action.ruleUuid = "852f6e9199c439d0861eec939c5fbbe1";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
CreateAutoScalingRuleSchedulerJobTriggerAction.Result res = action.call();
Python SDK
CreateAutoScalingRuleSchedulerJobTriggerAction action = CreateAutoScalingRuleSchedulerJobTriggerAction()
action.schedulerJobUuid = "2f194775b8ab3e2b912f92a74501a7ea"
action.name = "createAlarmTrigger"
action.ruleUuid = "852f6e9199c439d0861eec939c5fbbe1"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
CreateAutoScalingRuleSchedulerJobTriggerAction.Result res = action.call()

DeleteAutoScalingRuleTrigger

API Request

URLs
DELETE zstack/v1/autoscaling/groups/rules/triggers/{uuid}
Headers
Authorization: OAuth the-session-uuid
Curl Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X DELETE http://localhost:8080/zstack/v1/autoscaling/groups/rules/triggers/c81896a39caf320d988503625feb5a84
Request Parameters
Name Type Location Description Optional Value Starting Version
uuid String url The resource UUID. 3.1.0
systemTags List body Optional. The system tags. 3.1.0
userTags List body Optional. The user tags. 3.1.0

API Response

When the API succeeded, an empty JSON structure {} is returned. When the API failed, the returned JSON structure includes an error field. For example,
{
"error": {
    "code": "SYS.1001",
    "description": "A message or a operation timeout",
    "details": "Create VM on KVM timeout after 300s"
}
}

SDK Sample

Java SDK
DeleteAutoScalingRuleTriggerAction action = new DeleteAutoScalingRuleTriggerAction();
action.uuid = "c81896a39caf320d988503625feb5a84";
action.deleteMode = "Permissive";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
DeleteAutoScalingRuleTriggerAction.Result res = action.call();
Python SDK
DeleteAutoScalingRuleTriggerAction action = DeleteAutoScalingRuleTriggerAction()
action.uuid = "c81896a39caf320d988503625feb5a84"
action.deleteMode = "Permissive"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
DeleteAutoScalingRuleTriggerAction.Result res = action.call()

QueryAutoScalingRuleTrigger

API Request

URLs
GET zstack/v1/autoscaling/groups/rules/trigger
GET zstack/v1/autoscaling/groups/rules/trigger/{uuid}
Headers
Authorization: OAuth the-session-uuid
Curl Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/autoscaling/groups/rules/trigger
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/autoscaling/groups/rules/trigger/7af20bc1523536289223a7410ca04abd

Queryable Fields

You can check all queryable fields and resource names that can be queried across tables by using zstack-cli, entering QueryAutoScalingRuleTrigger, and pressing the Tab key.

API Response

Sample Response
{
  "inventories": [
    {
      "name": "test-load-balance-profile",
      "uuid": "cf762471646230209faee02b6423625c",
      "type": "Alarm",
      "description": "just for test",
      "createDate": "Nov 14, 2017 10:20:57 PM",
      "lastOpDate": "Nov 14, 2017 10:20:57 PM"
    }
  ]
}
Name Type Description Starting Version
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error. 3.1.0
inventories List See inventories. 3.1.0
#error
Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 3.1.0
description String The brief description of the error. 3.1.0
details String The details about the error. 3.1.0
elaboration String The reserved field. Default value: null. 3.1.0
opaque LinkedHashMap The reserved field. Default value: null. 3.1.0
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 3.1.0
#inventories
Name Type Description Starting Version
name String The resource name. 3.1.0
uuid String The resource UUID. 3.1.0
type String The trigger type. 3.1.0
ruleUuid String The UUID of the auto scaling rule. 3.1.0
description String The detailed description of the resource. 3.1.0
state String The state of the trigger. 3.1.0
createDate Timestamp The creation date. 3.1.0
lastOpDate Timestamp The last operation date. 3.1.0

SDK Sample

Java SDK
QueryAutoScalingRuleTriggerAction action = new QueryAutoScalingRuleTriggerAction();
action.conditions = asList();
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
QueryAutoScalingRuleTriggerAction.Result res = action.call();
Python SDK
QueryAutoScalingRuleTriggerAction action = QueryAutoScalingRuleTriggerAction()
action.conditions = []
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
QueryAutoScalingRuleTriggerAction.Result res = action.call()

CreateAutoScalingVmTemplate

API Request

URLs
POST zstack/v1/autoscaling/vmtemplate
Headers
Authorization: OAuth the-session-uuid
Body
{
  "params": {
    "vmInstanceName": "vm1",
    "vmInstanceDescription": "vm1 desc",
    "vmInstanceOfferingUuid": "07e435acb1c230d5b328f23e5a840da2",
    "imageUuid": "77407eb341e732b2a45ad5bad4a2c76e",
    "l3NetworkUuids": [
      "93edf15377e233a291fe1ab1c4190241"
    ],
    "vmInstanceType": "UserVm",
    "rootDiskOfferingUuid": "85f44fe072733d90becb4ddd8a9867de",
    "dataDiskOfferingUuids": [
      "22247b0705a43af7a47ed6428c537934"
    ],
    "vmInstanceZoneUuid": "04e22fb60516363a94c93e7f299a1eb3",
    "vmInstanceClusterUuid": "792ec8d3dac83f10b29f0924e0787cef",
    "hostUuid": "41782afc684036c092a803b58413420e",
    "primaryStorageUuidForRootVolume": "8e3de0904fd937bdaaf2d29ea510a434",
    "defaultL3NetworkUuid": "f7a50ab3ffb038ddb1f366e6f87db083",
    "strategy": "InstantStart",
    "name": "template1",
    "description": "for new vm"
  },
  "systemTags": [],
  "userTags": []
}
Note: In the preceding sample, both systemTags and userTags are optional. These two fields can be included in the body structure.
Curl Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{"vmInstanceName":"vm1","vmInstanceDescription":"vm1 desc","vmInstanceOfferingUuid":"07e435acb1c230d5b328f23e5a840da2","imageUuid":"77407eb341e732b2a45ad5bad4a2c76e","l3NetworkUuids":["93edf15377e233a291fe1ab1c4190241"],"vmInstanceType":"UserVm","rootDiskOfferingUuid":"85f44fe072733d90becb4ddd8a9867de","dataDiskOfferingUuids":["22247b0705a43af7a47ed6428c537934"],"vmInstanceZoneUuid":"04e22fb60516363a94c93e7f299a1eb3","vmInstanceClusterUuid":"792ec8d3dac83f10b29f0924e0787cef","hostUuid":"41782afc684036c092a803b58413420e","primaryStorageUuidForRootVolume":"8e3de0904fd937bdaaf2d29ea510a434","defaultL3NetworkUuid":"f7a50ab3ffb038ddb1f366e6f87db083","strategy":"InstantStart","name":"template1","description":"for new vm"}}' http://localhost:8080/zstack/v1/autoscaling/vmtemplate
Request Parameters
Name Type Location Description Optional Value Starting Version
vmInstanceName String body (contained in the params structure) The VM instance name. 3.1.0
vmInstanceDescription String body (contained in the params structure) Optional. The detailed description of the VM instance. 3.1.0
vmInstanceOfferingUuid String body (contained in the params structure) The instance offering of the VM instance. 3.1.0
imageUuid String body (contained in the params structure) The image UUID of the VM instance. 3.1.0
l3NetworkUuids List body (contained in the params structure) The L3 networks of the VM instance. 3.1.0
rootDiskOfferingUuid String body (contained in the params structure) Optional. The disk offering of the VM instance root volume. 3.1.0
dataDiskOfferingUuids List body (contained in the params structure) Optional. The disk offerings of the VM instance data volumes. 3.1.0
vmInstanceZoneUuid String body (contained in the params structure) Optional. The zone to which the VM instance belongs. 3.1.0
vmInstanceClusterUuid String body (contained in the params structure) Optional. The cluster to which the VM instance belongs. 3.1.0
hostUuid String body (contained in the params structure) Optional. The host UUID. 3.1.0
primaryStorageUuidForRootVolume String body (contained in the params structure) Optional. The UUID of the primary storage where the root volume locates. 3.1.0
defaultL3NetworkUuid String body (contained in the params structure) The default L3 network of the VM instance. 3.1.0
name String body (contained in the params structure) The resource name. 3.1.0
description String body (contained in the params structure) Optional. The detailed description of the resource. 3.1.0
type String body (contained in the params structure) Optional. The template type. 3.1.0
resourceUuid String body (contained in the params structure) Optional. The resource UUID. 3.1.0
tagUuids List body (contained in the params structure) Optional. The tag UUID list. 3.1.0
systemTags List body Optional. The system tags. 3.1.0
userTags List body Optional. The user tags. 3.1.0
Note:
  • ZStack Cloud allows you to attach an affinity group to an auto-scaling group by using the systemTags parameter. You can set the value of the systemTags parameter to the affinityGroupUuid option.
    • The format of the option is affinityGroupUuid::affinity group uuid.
    • For example, affinityGroupUuid::ade3ccc31fc63ac2937b2210c21c39b1.

API Response

Sample Response
{
  "inventory": {
    "name": "template",
    "description": "desc",
    "state": "Enabled"
  }
}
Name Type Description Starting Version
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error. 3.1.0
inventory AutoScalingTemplateInventory See inventory. 3.1.0
#error
Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 3.1.0
description String The brief description of the error. 3.1.0
details String The details about the error. 3.1.0
elaboration String The reserved field. Default value: null. 3.1.0
opaque LinkedHashMap The reserved field. Default value: null. 3.1.0
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 3.1.0
#inventory
Name Type Description Starting Version
uuid String The resource UUID. 3.1.0
name String The resource name. 3.1.0
description String The detailed description of the resource. 3.1.0
type String The template type. 3.1.0
state String The state of the template. 3.1.0
systemTags List 3.1.0
createDate Timestamp The creation date. 3.1.0
lastOpDate Timestamp The last operation date. 3.1.0

SDK Sample

Java SDK
CreateAutoScalingVmTemplateAction action = new CreateAutoScalingVmTemplateAction();
action.vmInstanceName = "vm1";
action.vmInstanceDescription = "vm1 desc";
action.vmInstanceOfferingUuid = "07e435acb1c230d5b328f23e5a840da2";
action.imageUuid = "77407eb341e732b2a45ad5bad4a2c76e";
action.l3NetworkUuids = asList("93edf15377e233a291fe1ab1c4190241");
action.vmInstanceType = "UserVm";
action.rootDiskOfferingUuid = "85f44fe072733d90becb4ddd8a9867de";
action.dataDiskOfferingUuids = asList("22247b0705a43af7a47ed6428c537934");
action.vmInstanceZoneUuid = "04e22fb60516363a94c93e7f299a1eb3";
action.vmInstanceClusterUuid = "792ec8d3dac83f10b29f0924e0787cef";
action.hostUuid = "41782afc684036c092a803b58413420e";
action.primaryStorageUuidForRootVolume = "8e3de0904fd937bdaaf2d29ea510a434";
action.defaultL3NetworkUuid = "f7a50ab3ffb038ddb1f366e6f87db083";
action.strategy = "InstantStart";
action.name = "template1";
action.description = "for new vm";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
CreateAutoScalingVmTemplateAction.Result res = action.call();
Python SDK
CreateAutoScalingVmTemplateAction action = CreateAutoScalingVmTemplateAction()
action.vmInstanceName = "vm1"
action.vmInstanceDescription = "vm1 desc"
action.vmInstanceOfferingUuid = "07e435acb1c230d5b328f23e5a840da2"
action.imageUuid = "77407eb341e732b2a45ad5bad4a2c76e"
action.l3NetworkUuids = [93edf15377e233a291fe1ab1c4190241]
action.vmInstanceType = "UserVm"
action.rootDiskOfferingUuid = "85f44fe072733d90becb4ddd8a9867de"
action.dataDiskOfferingUuids = [22247b0705a43af7a47ed6428c537934]
action.vmInstanceZoneUuid = "04e22fb60516363a94c93e7f299a1eb3"
action.vmInstanceClusterUuid = "792ec8d3dac83f10b29f0924e0787cef"
action.hostUuid = "41782afc684036c092a803b58413420e"
action.primaryStorageUuidForRootVolume = "8e3de0904fd937bdaaf2d29ea510a434"
action.defaultL3NetworkUuid = "f7a50ab3ffb038ddb1f366e6f87db083"
action.strategy = "InstantStart"
action.name = "template1"
action.description = "for new vm"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
CreateAutoScalingVmTemplateAction.Result res = action.call()

AttachAutoScalingTemplateToGroup

API Request

URLs
POST zstack/v1/autoscaling/template/{uuid}/groups/{groupUuid}
Headers
Authorization: OAuth the-session-uuid
Body
{
  "params": {},
  "systemTags": [],
  "userTags": []
}
Note: In the preceding sample, both systemTags and userTags are optional. These two fields can be included in the body structure.
Curl Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{}}' http://localhost:8080/zstack/v1/autoscaling/template/a53e0f84df15313bba8560f6567da2d9/groups/284172349b50324a9c2b8a09a28b3294
Request Parameters
Name Type Location Description Optional Value Starting Version
uuid String url The template UUID. 3.1.0
groupUuid String url The UUID of the auto scaling group. 3.1.0
systemTags List body Optional. The system tags. 3.1.0
userTags List body Optional. The user tags. 3.1.0

API Response

Sample Response
{
  "inventory": {
    "name": "test-group",
    "uuid": "32d1739bb918364a840d0ff0130eda61",
    "description": "just for test",
    "createDate": "Nov 14, 2017 10:20:57 PM",
    "lastOpDate": "Nov 14, 2017 10:20:57 PM",
    "attachedTemplates": [
      "e54e8d9e51113de2b6742ace7bfee306"
    ]
  }
}
Name Type Description Starting Version
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error. 3.1.0
inventory AutoScalingGroupInventory See inventory. 3.1.0
#error
Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 3.1.0
description String The brief description of the error. 3.1.0
details String The details about the error. 3.1.0
elaboration String The reserved field. Default value: null. 3.1.0
opaque LinkedHashMap The reserved field. Default value: null. 3.1.0
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 3.1.0
#inventory
Name Type Description Starting Version
name String The resource name. 3.1.0
uuid String The resource UUID. 3.1.0
scalingResourceType String The type of the auto scaling resource: VM instance. 3.1.0
state String The state of the auto scaling group. 3.1.0
defaultCooldown Long The default cooldown time of the auto scaling rule. 3.1.0
description String The detailed description of the resource. 3.1.0
minResourceSize Integer The minimum number of VM instances in the auto scaling group. 3.1.0
maxResourceSize Integer The maximum number of VM instances in the auto scaling group. 3.1.0
removalPolicy String The default policy for removing a VM instance. 3.1.0
createDate Timestamp The creation date. 3.1.0
lastOpDate Timestamp The last operation date. 3.1.0
attachedTemplates List The templates of VM instances attached to the auto scaling group. 3.1.0
systemTags List 3.1.0

SDK Sample

Java SDK
AttachAutoScalingTemplateToGroupAction action = new AttachAutoScalingTemplateToGroupAction();
action.uuid = "a53e0f84df15313bba8560f6567da2d9";
action.groupUuid = "284172349b50324a9c2b8a09a28b3294";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
AttachAutoScalingTemplateToGroupAction.Result res = action.call();
Python SDK
AttachAutoScalingTemplateToGroupAction action = AttachAutoScalingTemplateToGroupAction()
action.uuid = "a53e0f84df15313bba8560f6567da2d9"
action.groupUuid = "284172349b50324a9c2b8a09a28b3294"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
AttachAutoScalingTemplateToGroupAction.Result res = action.call()

DeleteAutoScalingTemplate

API Request

URLs
DELETE zstack/v1/autoscaling/template/{uuid}
Headers
Authorization: OAuth the-session-uuid
Curl Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X DELETE http://localhost:8080/zstack/v1/autoscaling/template/5c9e41a7d5c9335f99d639e75c294392
Request Parameters
Name Type Location Description Optional Value Starting Version
uuid String url The resource UUID. 3.1.0
systemTags List body Optional. The system tags. 3.1.0
userTags List body Optional. The user tags. 3.1.0

API Response

When the API succeeded, an empty JSON structure {} is returned. When the API failed, the returned JSON structure includes an error field. For example,
{
"error": {
    "code": "SYS.1001",
    "description": "A message or a operation timeout",
    "details": "Create VM on KVM timeout after 300s"
}
}

SDK Sample

Java SDK
DeleteAutoScalingTemplateAction action = new DeleteAutoScalingTemplateAction();
action.uuid = "5c9e41a7d5c9335f99d639e75c294392";
action.deleteMode = "Permissive";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
DeleteAutoScalingTemplateAction.Result res = action.call();
Python SDK
DeleteAutoScalingTemplateAction action = DeleteAutoScalingTemplateAction()
action.uuid = "5c9e41a7d5c9335f99d639e75c294392"
action.deleteMode = "Permissive"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
DeleteAutoScalingTemplateAction.Result res = action.call()

DetachAutoScalingTemplateFromGroup

API Request

URLs
DELETE zstack/v1/autoscaling/template/{uuid}/groups/{groupUuid}
Headers
Authorization: OAuth the-session-uuid
Curl Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X DELETE http://localhost:8080/zstack/v1/autoscaling/template/801a456fff0a355f9159d74af32026b9/groups/bdbbb1d168023ec7b9331bddd1b55b88
Request Parameters
Name Type Location Description Optional Value Starting Version
templateUuid String body The template UUID. 3.1.0
groupUuid String url The UUID of the auto scaling group. 3.1.0
systemTags List body Optional. The system tags. 3.1.0
userTags List body Optional. The user tags. 3.1.0

API Response

Sample Response
{
  "inventory": {
    "name": "test-group",
    "uuid": "33cebe4b8d0b3e34bf2f9c517234bac9",
    "description": "just for test",
    "createDate": "Nov 14, 2017 10:20:57 PM",
    "lastOpDate": "Nov 14, 2017 10:20:57 PM"
  }
}
Name Type Description Starting Version
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error. 3.1.0
inventory AutoScalingGroupInventory See inventory. 3.1.0
#error
Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 3.1.0
description String The brief description of the error. 3.1.0
details String The details about the error. 3.1.0
elaboration String The reserved field. Default value: null. 3.1.0
opaque LinkedHashMap The reserved field. Default value: null. 3.1.0
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 3.1.0
#inventory
Name Type Description Starting Version
name String The resource name. 3.1.0
uuid String The resource UUID. 3.1.0
scalingResourceType String The type of the auto scaling resource: VM instance. 3.1.0
state String The state of the auto scaling group. 3.1.0
defaultCooldown Long The default cooldown time of the auto scaling rule. 3.1.0
description String The detailed description of the resource. 3.1.0
minResourceSize Integer The minimum number of VM instances in the auto scaling group. 3.1.0
maxResourceSize Integer The maximum number of VM instances in the auto scaling group. 3.1.0
removalPolicy String The default policy for removing a VM instance. 3.1.0
createDate Timestamp The creation date. 3.1.0
lastOpDate Timestamp The last operation date. 3.1.0
attachedTemplates List The templates of VM instances attached to the auto scaling group. 3.1.0
systemTags List 3.1.0

SDK Sample

Java SDK
DetachAutoScalingTemplateFromGroupAction action = new DetachAutoScalingTemplateFromGroupAction();
action.templateUuid = "801a456fff0a355f9159d74af32026b9";
action.groupUuid = "bdbbb1d168023ec7b9331bddd1b55b88";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
DetachAutoScalingTemplateFromGroupAction.Result res = action.call();
Python SDK
DetachAutoScalingTemplateFromGroupAction action = DetachAutoScalingTemplateFromGroupAction()
action.templateUuid = "801a456fff0a355f9159d74af32026b9"
action.groupUuid = "bdbbb1d168023ec7b9331bddd1b55b88"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
DetachAutoScalingTemplateFromGroupAction.Result res = action.call()

QueryAutoScalingVmTemplate

API Request

URLs
GET zstack/v1/autoscaling/vmtemplate
GET zstack/v1/autoscaling/vmtemplate/{uuid}
Headers
Authorization: OAuth the-session-uuid
Curl Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/autoscaling/vmtemplate
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/autoscaling/vmtemplate/8b6b502328bc3755a237f9a67980dd32

Queryable Fields

You can check all queryable fields and resource names that can be queried across tables by using zstack-cli, entering QueryAutoScalingVmTemplate, and pressing the Tab key.

API Response

Sample Response
{
  "inventories": [
    {
      "l3NetworkUuids": [
        "9f56c162374d382f9ddb7c383bce6887",
        "8e07df171471330c83306d78063fba69"
      ],
      "rootDiskOfferingUuid": "57fb695d2d033c1e849dac6fb87cebb5",
      "dataDiskOfferingUuids": [
        "52bfe290f5363130a1452e2ca1c57783",
        "8022018c7f6834d4a7a62a02128672ed"
      ],
      "vmInstanceZoneUuid": "cefa21204105347a82148c099c09a0cb",
      "vmInstanceClusterUuid": "ad7fcc77266f34e8a64fd208a9b7ed38",
      "hostUuid": "975ceb93de173b22a2b073ee856166e3",
      "primaryStorageUuidForRootVolume": "87cf45bf5a37364d85ae9968af7d2bd1",
      "defaultL3NetworkUuid": "8e07df171471330c83306d78063fba69",
      "uuid": "785259bf48303b0d9a4a34ddc3774da5",
      "name": "test-template",
      "description": "just for test",
      "type": "VmInstance",
      "createDate": "Nov 14, 2017 10:20:57 PM",
      "lastOpDate": "Nov 14, 2017 10:20:57 PM"
    }
  ]
}
Name Type Description Starting Version
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error. 3.1.0
inventories List See inventories. 3.1.0
#error
Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 3.1.0
description String The brief description of the error. 3.1.0
details String The details about the error. 3.1.0
elaboration String The reserved field. Default value: null. 3.1.0
opaque LinkedHashMap The reserved field. Default value: null. 3.1.0
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 3.1.0
#inventories
Name Type Description Starting Version
vmInstanceName String The VM instance name. 3.1.0
vmInstanceType String The VM instance type. 3.1.0
vmInstanceDescription String The VM instance description. 3.1.0
vmInstanceOfferingUuid String The instance offering of the VM instance. 3.1.0
imageUuid String The image UUID of the VM instance. 3.1.0
l3NetworkUuids List The L3 networks of the VM instance. 3.1.0
rootDiskOfferingUuid String The disk offering of the VM instance root volume. 3.1.0
dataDiskOfferingUuids List The disk offerings of the VM instance data volumes. 3.1.0
vmInstanceZoneUuid String The zone to which the VM instance belongs. 3.1.0
vmInstanceClusterUuid String The cluster to which the VM instance belongs. 3.1.0
hostUuid String The host UUID of the VM instance. 3.1.0
primaryStorageUuidForRootVolume String The primary storage where the root volume of the VM instance locates. 3.1.0
defaultL3NetworkUuid String The default L3 network of the VM instance. 3.1.0
uuid String The resource UUID. 3.1.0
name String The resource name. 3.1.0
description String The detailed description of the resource. 3.1.0
type String The template type. 3.1.0
state String The template state. 3.1.0
systemTags List 3.1.0
createDate Timestamp The creation date. 3.1.0
lastOpDate Timestamp The last operation date. 3.1.0

SDK Sample

Java SDK
QueryAutoScalingVmTemplateAction action = new QueryAutoScalingVmTemplateAction();
action.conditions = asList();
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
QueryAutoScalingVmTemplateAction.Result res = action.call();
Python SDK
QueryAutoScalingVmTemplateAction action = QueryAutoScalingVmTemplateAction()
action.conditions = []
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
QueryAutoScalingVmTemplateAction.Result res = action.call()

DeleteAutoScalingGroupInstance

API Request

URLs
DELETE zstack/v1/autoscaling/groups/instances/{instanceUuid}
Headers
Authorization: OAuth the-session-uuid
Curl Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X DELETE http://localhost:8080/zstack/v1/autoscaling/groups/instances/3f55b1b15c273122b6b815218282efe5
Request Parameters
Name Type Location Description Optional Value Starting Version
instanceUuid String url The VM instance UUID. 3.1.0
systemTags List body Optional. The system tags. 3.1.0
userTags List body Optional. The user tags. 3.1.0

API Response

When the API succeeded, an empty JSON structure {} is returned. When the API failed, the returned JSON structure includes an error field. For example,
{
"error": {
    "code": "SYS.1001",
    "description": "A message or a operation timeout",
    "details": "Create VM on KVM timeout after 300s"
}
}

SDK Sample

Java SDK
DeleteAutoScalingGroupInstanceAction action = new DeleteAutoScalingGroupInstanceAction();
action.instanceUuid = "3f55b1b15c273122b6b815218282efe5";
action.deleteMode = "Permissive";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
DeleteAutoScalingGroupInstanceAction.Result res = action.call();
Python SDK
DeleteAutoScalingGroupInstanceAction action = DeleteAutoScalingGroupInstanceAction()
action.instanceUuid = "3f55b1b15c273122b6b815218282efe5"
action.deleteMode = "Permissive"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
DeleteAutoScalingGroupInstanceAction.Result res = action.call()

QueryAutoScalingGroupInstance

API Request

URLs
GET zstack/v1/autoscaling/groups/instances
GET zstack/v1/autoscaling/groups/instances/{uuid}
Headers
Authorization: OAuth the-session-uuid
Curl Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/autoscaling/groups/instances
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/autoscaling/groups/instances/87d8ab674af337deabc1af2c24bc3733

Queryable Fields

You can check all queryable fields and resource names that can be queried across tables by using zstack-cli, entering QueryAutoScalingGroupInstance, and pressing the Tab key.

API Response

Sample Response
{
  "inventories": [
    {
      "uuid": "c23dc6fd3dd13436b5d65b0a4d328f2c",
      "instanceUuid": "1dcb05b79b2b3a61b74114ff3aa00266",
      "description": "just for test",
      "createDate": "Nov 14, 2017 10:20:57 PM",
      "lastOpDate": "Nov 14, 2017 10:20:57 PM"
    }
  ]
}
Name Type Description Starting Version
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error. 3.1.0
inventories List See inventories. 3.1.0
#error
Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 3.1.0
description String The brief description of the error. 3.1.0
details String The details about the error. 3.1.0
elaboration String The reserved field. Default value: null. 3.1.0
opaque LinkedHashMap The reserved field. Default value: null. 3.1.0
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 3.1.0
#inventories
Name Type Description Starting Version
uuid String The resource UUID. 3.1.0
instanceUuid String The VM instance UUID. 3.1.0
scalingGroupUuid String The UUID of the auto scaling group. 3.1.0
templateUuid String The UUID of the VM instance template in the auto scaling group. 3.1.0
scalingGroupActivityUuid String The UUID of the auto scaling activity. 3.1.0
status String The status of the VM instance in the auto scaling group. 3.1.0
healthStatus String The health status of the VM instance in the auto scaling group. 3.1.0
description String The detailed description of the resource. 3.1.0
createDate Timestamp The creation date. 3.1.0
lastOpDate Timestamp The last operation date. 3.1.0
protectionStrategy String The instance protection strategy. 0.6

SDK Sample

Java SDK
QueryAutoScalingGroupInstanceAction action = new QueryAutoScalingGroupInstanceAction();
action.conditions = asList();
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
QueryAutoScalingGroupInstanceAction.Result res = action.call();
Python SDK
QueryAutoScalingGroupInstanceAction action = QueryAutoScalingGroupInstanceAction()
action.conditions = []
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
QueryAutoScalingGroupInstanceAction.Result res = action.call()

ChangeAutoScalingGroupState

API Request

URLs
PUT zstack/v1/autoscaling/groups/{uuid}/actions
Headers
Authorization: OAuth the-session-uuid
Body
{
  "changeAutoScalingGroupState": {
    "stateEvent": "disable"
  },
  "systemTags": [],
  "userTags": []
}
Note: In the preceding sample, both systemTags and userTags are optional. These two fields can be included in the body structure.
Curl Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"changeAutoScalingGroupState":{"stateEvent":"disable"}}' http://localhost:8080/zstack/v1/autoscaling/groups/384ac055e3113366907f06e8aaefb12d/actions
Request Parameters
Name Type Location Description Optional Value Starting Version
uuid String url The resource UUID. 3.1.0
stateEvent String body (contained in the changeAutoScalingGroupState structure) Whether to enable or disable the auto scaling group.
  • enable
  • disable
3.1.0
systemTags List body Optional. The system tags. 3.1.0
userTags List body Optional. The user tags. 3.1.0

API Response

When the API succeeded, an empty JSON structure {} is returned. When the API failed, the returned JSON structure includes an error field. For example,
{
"error": {
    "code": "SYS.1001",
    "description": "A message or a operation timeout",
    "details": "Create VM on KVM timeout after 300s"
}
}

SDK Sample

Java SDK
ChangeAutoScalingGroupStateAction action = new ChangeAutoScalingGroupStateAction();
action.uuid = "384ac055e3113366907f06e8aaefb12d";
action.stateEvent = "disable";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
ChangeAutoScalingGroupStateAction.Result res = action.call();
Python SDK
ChangeAutoScalingGroupStateAction action = ChangeAutoScalingGroupStateAction()
action.uuid = "384ac055e3113366907f06e8aaefb12d"
action.stateEvent = "disable"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
ChangeAutoScalingGroupStateAction.Result res = action.call()

ExecuteAutoScalingRule

API Request

URLs
PUT zstack/v1/autoscaling/rules/{uuid}/actions
Headers
Authorization: OAuth the-session-uuid
Body
{
  "executeAutoScalingRule": {},
  "systemTags": [],
  "userTags": []
}
Note: In the preceding sample, both systemTags and userTags are optional. These two fields can be included in the body structure.
Curl Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"executeAutoScalingRule":{}}' http://localhost:8080/zstack/v1/autoscaling/rules/9311aaae28333775b3339b644961c990/actions
Request Parameters
Name Type Location Description Optional Value Starting Version
uuid String url The UUID of the auto scaling rule. 3.9.0
systemTags List body Optional. The system tags. 3.9.0
userTags List body Optional. The user tags. 3.9.0

API Response

Sample Response
{
  "scalingActivityUuid": "20ba90ed9e1631768fd7b896569fae62"
}
Name Type Description Starting Version
scalingActivityUuid String The UUID of the auto scaling activity. 3.9.0
success boolean 3.9.0
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error. 3.9.0
error ErrorCode See error. 3.9.0
#error
Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 3.9.0
description String The brief description of the error. 3.9.0
details String The details about the error. 3.9.0
elaboration String The reserved field. Default value: null. 3.9.0
opaque LinkedHashMap The reserved field. Default value: null. 3.9.0
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 3.9.0
#error
Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 3.9.0
description String The brief description of the error. 3.9.0
details String The details about the error. 3.9.0
elaboration String The reserved field. Default value: null. 3.9.0
opaque LinkedHashMap The reserved field. Default value: null. 3.9.0
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 3.9.0

SDK Sample

Java SDK
ExecuteAutoScalingRuleAction action = new ExecuteAutoScalingRuleAction();
action.uuid = "9311aaae28333775b3339b644961c990";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
ExecuteAutoScalingRuleAction.Result res = action.call();
Python SDK
ExecuteAutoScalingRuleAction action = ExecuteAutoScalingRuleAction()
action.uuid = "9311aaae28333775b3339b644961c990"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
ExecuteAutoScalingRuleAction.Result res = action.call()

UpdateAutoScalingGroupInstance

API Request

URLs
PUT zstack/v1/autoscaling/groups/instances/{instanceUuid}/actions
Headers
Authorization: OAuth the-session-uuid
Body
{
  "updateAutoScalingGroupInstance": {
    "groupUuid": "a3b7616d6e6a3ed6bdf5dd5a640a4548",
    "protectionStrategy": "Protected"
  },
  "systemTags": [],
  "userTags": []
}
Note: In the preceding sample, both systemTags and userTags are optional. These two fields can be included in the body structure.
Curl Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"updateAutoScalingGroupInstance":{"groupUuid":"a3b7616d6e6a3ed6bdf5dd5a640a4548","protectionStrategy":"Protected"}}' http://localhost:8080/zstack/v1/autoscaling/groups/instances/a6dcd12ee95e345787a34175327df816/actions
Request Parameters
Name Type Location Description Optional Value Starting Version
groupUuid String body (contained in the updateAutoScalingGroupInstance structure) The UUID of the auto scaling group. 3.9.0
instanceUuid String url The UUID of the VM instance in the auto scaling group. 3.9.0
protectionStrategy String body (contained in the updateAutoScalingGroupInstance structure) Optional. The VM protection strategy of the auto scaling group.
  • Protected
  • Unprotected
3.9.0
systemTags List body Optional. The system tags. 3.9.0
userTags List body Optional. The user tags. 3.9.0

API Response

When the API succeeded, an empty JSON structure {} is returned. When the API failed, the returned JSON structure includes an error field. For example,
{
	"error": {
		"code": "SYS.1001",
		"description": "A message or a operation timeout",
		"details": "Create VM on KVM timeout after 300s"
	}
}

SDK Sample

Java SDK
UpdateAutoScalingGroupInstanceAction action = new UpdateAutoScalingGroupInstanceAction();
action.groupUuid = "a3b7616d6e6a3ed6bdf5dd5a640a4548";
action.instanceUuid = "a6dcd12ee95e345787a34175327df816";
action.protectionStrategy = "Protected";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
UpdateAutoScalingGroupInstanceAction.Result res = action.call();
Python SDK
UpdateAutoScalingGroupInstanceAction action = UpdateAutoScalingGroupInstanceAction()
action.groupUuid = "a3b7616d6e6a3ed6bdf5dd5a640a4548"
action.instanceUuid = "a6dcd12ee95e345787a34175327df816"
action.protectionStrategy = "Protected"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
UpdateAutoScalingGroupInstanceAction.Result res = action.call()

UpdateAutoScalingVmTemplate

API Request

URLs
PUT zstack/v1/autoscaling/vmtemplate/{uuid}/actions
Headers
Authorization: OAuth the-session-uuid
Body
{
  "updateAutoScalingVmTemplate": {
    "name": "template",
    "description": "for new vm",
    "vmInstanceName": "vm",
    "vmInstanceDescription": "vm desc",
    "vmInstanceOfferingUuid": "af0462e292513725aa228476d0f08ac3",
    "imageUuid": "9dc29a7b3e603a7cb26bc1d16eccc1f1"
  },
  "systemTags": [],
  "userTags": []
}
Note: In the preceding sample, both systemTags and userTags are optional. These two fields can be included in the body structure.
Curl Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"updateAutoScalingVmTemplate":{"name":"template","description":"for new vm","vmInstanceName":"vm","vmInstanceDescription":"vm desc","vmInstanceOfferingUuid":"af0462e292513725aa228476d0f08ac3","imageUuid":"9dc29a7b3e603a7cb26bc1d16eccc1f1"}}' http://localhost:8080/zstack/v1/autoscaling/vmtemplate/dfb4e8245e32361db57b92c95c84c01b/actions
Request Parameters
Name Type Location Description Optional Value Starting Version
uuid String url The VM template UUID. 3.9.0
name String body (contained in the updateAutoScalingVmTemplate structure) Optional. The template name. 3.9.0
description String body (contained in the updateAutoScalingVmTemplate structure) Optional. The detailed description. 3.9.0
vmInstanceName String body (contained in the updateAutoScalingVmTemplate structure) Optional. The name of the VM instance. 3.9.0
vmInstanceDescription String body (contained in the updateAutoScalingVmTemplate structure) Optional. The description of the VM instance. 3.9.0
vmInstanceOfferingUuid String body (contained in the updateAutoScalingVmTemplate structure) Optional. The instance offering UUID of the VM instance. 3.9.0
imageUuid String body (contained in the updateAutoScalingVmTemplate structure) Optional. The UUID of the VM image. 3.9.0
systemTags List body Optional. The system tags. 3.9.0
userTags List body Optional. The user tags. 3.9.0

API Response

Sample Response
{
  "inventory": {
    "name": "template",
    "description": "desc",
    "state": "Enabled"
  }
}
Name Type Description Starting Version
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error. 3.9.0
inventory AutoScalingTemplateInventory See inventory. 3.9.0
#error
Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 3.9.0
description String The brief description of the error. 3.9.0
details String The details about the error. 3.9.0
elaboration String The reserved field. Default value: null. 3.9.0
opaque LinkedHashMap The reserved field. Default value: null. 3.9.0
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 3.9.0
#inventory
Name Type Description Starting Version
uuid String The resource UUID. 3.9.0
name String The resource name. 3.9.0
description String The detailed description of the resource. 3.9.0
type String The template type. 3.9.0
state String The state of the template. 3.9.0
systemTags List 3.9.0
createDate Timestamp The creation date. 3.9.0
lastOpDate Timestamp The last operation date. 3.9.0

SDK Sample

Java SDK
UpdateAutoScalingVmTemplateAction action = new UpdateAutoScalingVmTemplateAction();
action.uuid = "dfb4e8245e32361db57b92c95c84c01b";
action.name = "template";
action.description = "for new vm";
action.vmInstanceName = "vm";
action.vmInstanceDescription = "vm desc";
action.vmInstanceOfferingUuid = "af0462e292513725aa228476d0f08ac3";
action.imageUuid = "9dc29a7b3e603a7cb26bc1d16eccc1f1";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
UpdateAutoScalingVmTemplateAction.Result res = action.call();
Python SDK
UpdateAutoScalingVmTemplateAction action = UpdateAutoScalingVmTemplateAction()
action.uuid = "dfb4e8245e32361db57b92c95c84c01b"
action.name = "template"
action.description = "for new vm"
action.vmInstanceName = "vm"
action.vmInstanceDescription = "vm desc"
action.vmInstanceOfferingUuid = "af0462e292513725aa228476d0f08ac3"
action.imageUuid = "9dc29a7b3e603a7cb26bc1d16eccc1f1"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
UpdateAutoScalingVmTemplateAction.Result res = action.call()
API Reference | 5.5.30 | ZStack Cloud · ZCF | ZStack Resource Center