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()
























Download

Already filled the basic info? Click here.

Enter at least 2 characters.
Invalid mobile number.
Enter at least 4 characters.
Invalid email address.
Wrong code. Try again. Send Code Resend Code (60s)

An email with a verification code will be sent to you. Make sure the address you provided is valid and correct.

Download

Not filled the basic info yet? Click here.

Invalid email address or mobile number.

Email Us

contact@zstack.io
ZStack certification training consulting
Enter at least 2 characters.
Invalid mobile number.
Enter at least 4 characters.
Invalid email address.
Wrong code. Try again. Send Code Resend Code (60s)

Email Us

contact@zstack.io

The download link is sent to your email address.

If you don't see it, check your spam folder, subscription folder, or AD folder. After receiving the email, click the URL to download the documentation.

The download link is sent to your email address.

If you don't see it, check your spam folder, subscription folder, or AD folder.
Or click on the URL below. (For Internet Explorer, right-click the URL and save it.)

Thank you for using ZStack products and services.

Submit successfully.

We'll connect soon.

Thank you for choosing ZStack products and services.

Back to Top