Auto-Scaling Group Operations
CreateAutoScalingGroup
API Request
POST zstack/v1/autoscaling/groupsAuthorization: OAuth the-session-uuid{
"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 -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| 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. |
|
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. |
|
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
{
"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 |
| 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 |
| 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
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();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
DELETE zstack/v1/autoscaling/groups/{uuid}Authorization: OAuth the-session-uuidcurl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X DELETE http://localhost:8080/zstack/v1/autoscaling/groups/09121b25fdf330538288d1ac81025563| 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
{} 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
DeleteAutoScalingGroupAction action = new DeleteAutoScalingGroupAction();
action.uuid = "09121b25fdf330538288d1ac81025563";
action.deleteMode = "Permissive";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
DeleteAutoScalingGroupAction.Result res = action.call();DeleteAutoScalingGroupAction action = DeleteAutoScalingGroupAction()
action.uuid = "09121b25fdf330538288d1ac81025563"
action.deleteMode = "Permissive"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
DeleteAutoScalingGroupAction.Result res = action.call()UpdateAutoScalingGroup
API Request
PUT zstack/v1/autoscaling/groups/{uuid}/actionsAuthorization: OAuth the-session-uuid{
"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 -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| 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. |
|
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
{
"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 |
| 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 |
| 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
UpdateAutoScalingGroupAction action = new UpdateAutoScalingGroupAction();
action.uuid = "17a8d07735b631a688d6f95f3323fe91";
action.name = "test-group2";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
UpdateAutoScalingGroupAction.Result res = action.call();UpdateAutoScalingGroupAction action = UpdateAutoScalingGroupAction()
action.uuid = "17a8d07735b631a688d6f95f3323fe91"
action.name = "test-group2"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
UpdateAutoScalingGroupAction.Result res = action.call()QueryAutoScalingGroup
API Request
GET /v1/autoscaling/groupsGET /v1/autoscaling/groups/{uuid}Authorization: OAuth the-session-uuidcurl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/autoscaling/groupscurl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/autoscaling/groups/88dbb881575e37c78e11e988c6db5f64Queryable 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
{
"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 |
| 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 |
| 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
QueryAutoScalingGroupAction action = new QueryAutoScalingGroupAction();
action.conditions = asList();
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
QueryAutoScalingGroupAction.Result res = action.call();QueryAutoScalingGroupAction action = QueryAutoScalingGroupAction()
action.conditions = []
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
QueryAutoScalingGroupAction.Result res = action.call()QueryAutoScalingGroupActivity
API Request
GET zstack/v1/autoscaling/groups/activitiesGET zstack/v1/autoscaling/groups/activities/{uuid}Authorization: OAuth the-session-uuidcurl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/autoscaling/groups/activitiescurl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/autoscaling/groups/activities/e075eb1434203006861a4bd00453f69fQueryable 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
{
"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 |
| 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 |
| 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
QueryAutoScalingGroupActivityAction action = new QueryAutoScalingGroupActivityAction();
action.conditions = asList();
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
QueryAutoScalingGroupActivityAction.Result res = action.call();QueryAutoScalingGroupActivityAction action = QueryAutoScalingGroupActivityAction()
action.conditions = []
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
QueryAutoScalingGroupActivityAction.Result res = action.call()CreateAutoScalingGroupAddingNewInstanceRule
API Request
POST zstack/v1/autoscaling/rules/adding-new-instanceAuthorization: OAuth the-session-uuid{
"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 -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| Name | Type | Location | Description | Optional Value | Starting Version |
|---|---|---|---|---|---|
| adjustmentType | String | body (contained in the params structure) | The scale-out method. Options:
|
|
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
{
"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 |
| 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 |
| 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 |
| 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 |
| 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 |
| 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
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();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
POST zstack/v1/autoscaling/rules/removal-instanceAuthorization: OAuth the-session-uuid{
"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 -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| Name | Type | Location | Description | Optional Value | Starting Version |
|---|---|---|---|---|---|
| adjustmentType | String | body (contained in the params structure) | The scale-in method. Options:
|
|
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. |
|
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
{
"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 |
| 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 |
| 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 |
| 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 |
| 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 |
| 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
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();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
DELETE zstack/v1/autoscaling/rules/{uuid}Authorization: OAuth the-session-uuidcurl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X DELETE http://localhost:8080/zstack/v1/autoscaling/rules/55774c4baaea33c4a47b16c772446077| 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
{
"error": {
"code": "SYS.1001",
"description": "A message or a operation timeout",
"details": "Create VM on KVM timeout after 300s"
}
}SDK Sample
DeleteAutoScalingRuleAction action = new DeleteAutoScalingRuleAction();
action.uuid = "55774c4baaea33c4a47b16c772446077";
action.deleteMode = "Permissive";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
DeleteAutoScalingRuleAction.Result res = action.call();DeleteAutoScalingRuleAction action = DeleteAutoScalingRuleAction()
action.uuid = "55774c4baaea33c4a47b16c772446077"
action.deleteMode = "Permissive"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
DeleteAutoScalingRuleAction.Result res = action.call()UpdateAutoScalingRule
API Request
PUT zstack/v1/autoscaling/rules/{uuid}/actionsAuthorization: OAuth the-session-uuid{
"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 -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| 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
{
"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 |
| 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 |
| 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 |
| 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 |
| 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 |
| 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
UpdateAutoScalingRuleAction action = new UpdateAutoScalingRuleAction();
action.uuid = "4e8be98cd3a93176b9d38f3f934f1c2a";
action.name = "test name2";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
UpdateAutoScalingRuleAction.Result res = action.call();UpdateAutoScalingRuleAction action = UpdateAutoScalingRuleAction()
action.uuid = "4e8be98cd3a93176b9d38f3f934f1c2a"
action.name = "test name2"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
UpdateAutoScalingRuleAction.Result res = action.call()UpdateAutoScalingGroupAddingNewInstanceRule
API Request
PUT zstack/v1/autoscaling/rules/adding-new-instance/{uuid}/actionsAuthorization: OAuth the-session-uuid{
"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 -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| Name | Type | Location | Description | Optional Value | Starting Version |
|---|---|---|---|---|---|
| adjustmentType | String | body (contained in the updateAutoScalingGroupAddingNewInstanceRule structure) | Optional. The scale-out method. Options:
|
|
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
{
"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 |
| 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 |
| 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 |
| 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 |
| 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 |
| 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
UpdateAutoScalingGroupAddingNewInstanceRuleAction action = new UpdateAutoScalingGroupAddingNewInstanceRuleAction();
action.uuid = "e61646c51ac1396fb6d7d413dc5de3f8";
action.name = "test name2";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
UpdateAutoScalingGroupAddingNewInstanceRuleAction.Result res = action.call();UpdateAutoScalingGroupAddingNewInstanceRuleAction action = UpdateAutoScalingGroupAddingNewInstanceRuleAction()
action.uuid = "e61646c51ac1396fb6d7d413dc5de3f8"
action.name = "test name2"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
UpdateAutoScalingGroupAddingNewInstanceRuleAction.Result res = action.call()UpdateAutoScalingGroupRemovalInstanceRule
API Request
PUT zstack/v1/autoscaling/rules/removal-instance/{uuid}/actionsAuthorization: OAuth the-session-uuid{
"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 -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| Name | Type | Location | Description | Optional Value | Starting Version |
|---|---|---|---|---|---|
| adjustmentType | String | body (contained in the updateAutoScalingGroupRemovalInstanceRule structure) | Optional. The scale-in method. Options:
|
|
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. |
|
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
{
"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 |
| 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 |
| 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 |
| 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 |
| 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 |
| 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
UpdateAutoScalingGroupRemovalInstanceRuleAction action = new UpdateAutoScalingGroupRemovalInstanceRuleAction();
action.uuid = "66d7d0b81f1c399bb98063dfb0d3beaf";
action.name = "test name2";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
UpdateAutoScalingGroupRemovalInstanceRuleAction.Result res = action.call();UpdateAutoScalingGroupRemovalInstanceRuleAction action = UpdateAutoScalingGroupRemovalInstanceRuleAction()
action.uuid = "66d7d0b81f1c399bb98063dfb0d3beaf"
action.name = "test name2"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
UpdateAutoScalingGroupRemovalInstanceRuleAction.Result res = action.call()QueryAutoScalingRule
API Request
GET zstack/v1/autoscaling/groups/rulesGET zstack/v1/autoscaling/groups/rules/{uuid}Authorization: OAuth the-session-uuidcurl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/autoscaling/groups/rulescurl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/autoscaling/groups/rules/404fe677c3213e4bbb39d91a2efb3595Queryable 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
{
"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 |
| 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 |
| 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 |
| 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 |
| 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 |
| 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
QueryAutoScalingRuleAction action = new QueryAutoScalingRuleAction();
action.conditions = asList();
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
QueryAutoScalingRuleAction.Result res = action.call();QueryAutoScalingRuleAction action = QueryAutoScalingRuleAction()
action.conditions = []
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
QueryAutoScalingRuleAction.Result res = action.call()CreateAutoScalingRuleAlarmTrigger
API Request
POST zstack/v1/zwatch/alarms/{alarmUuid}/autoscaling/rules/{ruleUuid}Authorization: OAuth the-session-uuid{
"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 -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| 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
{
"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 |
| 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 |
| 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
CreateAutoScalingRuleAlarmTriggerAction action = new CreateAutoScalingRuleAlarmTriggerAction();
action.alarmUuid = "00f142f73b633bf0ab4a1e34aa84062b";
action.name = "createAlarmTrigger";
action.ruleUuid = "14b74127a20634c6b6d3566ef33b0600";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
CreateAutoScalingRuleAlarmTriggerAction.Result res = action.call();CreateAutoScalingRuleAlarmTriggerAction action = CreateAutoScalingRuleAlarmTriggerAction()
action.alarmUuid = "00f142f73b633bf0ab4a1e34aa84062b"
action.name = "createAlarmTrigger"
action.ruleUuid = "14b74127a20634c6b6d3566ef33b0600"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
CreateAutoScalingRuleAlarmTriggerAction.Result res = action.call()CreateAutoScalingRuleSchedulerJobTrigger
API Request
POST zstack/v1/scheduler/jobs/{schedulerJobUuid}/autoscaling/rules/{ruleUuid}Authorization: OAuth the-session-uuid{
"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 -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| 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
{
"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 |
| 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 |
| 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
CreateAutoScalingRuleSchedulerJobTriggerAction action = new CreateAutoScalingRuleSchedulerJobTriggerAction();
action.schedulerJobUuid = "2f194775b8ab3e2b912f92a74501a7ea";
action.name = "createAlarmTrigger";
action.ruleUuid = "852f6e9199c439d0861eec939c5fbbe1";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
CreateAutoScalingRuleSchedulerJobTriggerAction.Result res = action.call();CreateAutoScalingRuleSchedulerJobTriggerAction action = CreateAutoScalingRuleSchedulerJobTriggerAction()
action.schedulerJobUuid = "2f194775b8ab3e2b912f92a74501a7ea"
action.name = "createAlarmTrigger"
action.ruleUuid = "852f6e9199c439d0861eec939c5fbbe1"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
CreateAutoScalingRuleSchedulerJobTriggerAction.Result res = action.call()DeleteAutoScalingRuleTrigger
API Request
DELETE zstack/v1/autoscaling/groups/rules/triggers/{uuid}Authorization: OAuth the-session-uuidcurl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X DELETE http://localhost:8080/zstack/v1/autoscaling/groups/rules/triggers/c81896a39caf320d988503625feb5a84| 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
{} 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
DeleteAutoScalingRuleTriggerAction action = new DeleteAutoScalingRuleTriggerAction();
action.uuid = "c81896a39caf320d988503625feb5a84";
action.deleteMode = "Permissive";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
DeleteAutoScalingRuleTriggerAction.Result res = action.call();DeleteAutoScalingRuleTriggerAction action = DeleteAutoScalingRuleTriggerAction()
action.uuid = "c81896a39caf320d988503625feb5a84"
action.deleteMode = "Permissive"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
DeleteAutoScalingRuleTriggerAction.Result res = action.call()QueryAutoScalingRuleTrigger
API Request
GET zstack/v1/autoscaling/groups/rules/triggerGET zstack/v1/autoscaling/groups/rules/trigger/{uuid}Authorization: OAuth the-session-uuidcurl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/autoscaling/groups/rules/triggercurl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/autoscaling/groups/rules/trigger/7af20bc1523536289223a7410ca04abdQueryable 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
{
"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 |
| 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 |
| 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
QueryAutoScalingRuleTriggerAction action = new QueryAutoScalingRuleTriggerAction();
action.conditions = asList();
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
QueryAutoScalingRuleTriggerAction.Result res = action.call();QueryAutoScalingRuleTriggerAction action = QueryAutoScalingRuleTriggerAction()
action.conditions = []
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
QueryAutoScalingRuleTriggerAction.Result res = action.call()CreateAutoScalingVmTemplate
API Request
POST zstack/v1/autoscaling/vmtemplateAuthorization: OAuth the-session-uuid{
"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 -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| 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.
- The format of the option is
API 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 |
| 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 |
| 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
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();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
POST zstack/v1/autoscaling/template/{uuid}/groups/{groupUuid}Authorization: OAuth the-session-uuid{
"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 -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| 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
{
"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 |
| 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 |
| 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
AttachAutoScalingTemplateToGroupAction action = new AttachAutoScalingTemplateToGroupAction();
action.uuid = "a53e0f84df15313bba8560f6567da2d9";
action.groupUuid = "284172349b50324a9c2b8a09a28b3294";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
AttachAutoScalingTemplateToGroupAction.Result res = action.call();AttachAutoScalingTemplateToGroupAction action = AttachAutoScalingTemplateToGroupAction()
action.uuid = "a53e0f84df15313bba8560f6567da2d9"
action.groupUuid = "284172349b50324a9c2b8a09a28b3294"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
AttachAutoScalingTemplateToGroupAction.Result res = action.call()DeleteAutoScalingTemplate
API Request
DELETE zstack/v1/autoscaling/template/{uuid}Authorization: OAuth the-session-uuidcurl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X DELETE http://localhost:8080/zstack/v1/autoscaling/template/5c9e41a7d5c9335f99d639e75c294392| 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
{} 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
DeleteAutoScalingTemplateAction action = new DeleteAutoScalingTemplateAction();
action.uuid = "5c9e41a7d5c9335f99d639e75c294392";
action.deleteMode = "Permissive";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
DeleteAutoScalingTemplateAction.Result res = action.call();DeleteAutoScalingTemplateAction action = DeleteAutoScalingTemplateAction()
action.uuid = "5c9e41a7d5c9335f99d639e75c294392"
action.deleteMode = "Permissive"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
DeleteAutoScalingTemplateAction.Result res = action.call()DetachAutoScalingTemplateFromGroup
API Request
DELETE zstack/v1/autoscaling/template/{uuid}/groups/{groupUuid}Authorization: OAuth the-session-uuidcurl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X DELETE http://localhost:8080/zstack/v1/autoscaling/template/801a456fff0a355f9159d74af32026b9/groups/bdbbb1d168023ec7b9331bddd1b55b88| 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
{
"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 |
| 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 |
| 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
DetachAutoScalingTemplateFromGroupAction action = new DetachAutoScalingTemplateFromGroupAction();
action.templateUuid = "801a456fff0a355f9159d74af32026b9";
action.groupUuid = "bdbbb1d168023ec7b9331bddd1b55b88";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
DetachAutoScalingTemplateFromGroupAction.Result res = action.call();DetachAutoScalingTemplateFromGroupAction action = DetachAutoScalingTemplateFromGroupAction()
action.templateUuid = "801a456fff0a355f9159d74af32026b9"
action.groupUuid = "bdbbb1d168023ec7b9331bddd1b55b88"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
DetachAutoScalingTemplateFromGroupAction.Result res = action.call()QueryAutoScalingVmTemplate
API Request
GET zstack/v1/autoscaling/vmtemplateGET zstack/v1/autoscaling/vmtemplate/{uuid}Authorization: OAuth the-session-uuidcurl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/autoscaling/vmtemplatecurl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/autoscaling/vmtemplate/8b6b502328bc3755a237f9a67980dd32Queryable 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
{
"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 |
| 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 |
| 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
QueryAutoScalingVmTemplateAction action = new QueryAutoScalingVmTemplateAction();
action.conditions = asList();
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
QueryAutoScalingVmTemplateAction.Result res = action.call();QueryAutoScalingVmTemplateAction action = QueryAutoScalingVmTemplateAction()
action.conditions = []
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
QueryAutoScalingVmTemplateAction.Result res = action.call()DeleteAutoScalingGroupInstance
API Request
DELETE zstack/v1/autoscaling/groups/instances/{instanceUuid}Authorization: OAuth the-session-uuidcurl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X DELETE http://localhost:8080/zstack/v1/autoscaling/groups/instances/3f55b1b15c273122b6b815218282efe5| 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
{} 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
DeleteAutoScalingGroupInstanceAction action = new DeleteAutoScalingGroupInstanceAction();
action.instanceUuid = "3f55b1b15c273122b6b815218282efe5";
action.deleteMode = "Permissive";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
DeleteAutoScalingGroupInstanceAction.Result res = action.call();DeleteAutoScalingGroupInstanceAction action = DeleteAutoScalingGroupInstanceAction()
action.instanceUuid = "3f55b1b15c273122b6b815218282efe5"
action.deleteMode = "Permissive"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
DeleteAutoScalingGroupInstanceAction.Result res = action.call()QueryAutoScalingGroupInstance
API Request
GET zstack/v1/autoscaling/groups/instancesGET zstack/v1/autoscaling/groups/instances/{uuid}Authorization: OAuth the-session-uuidcurl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/autoscaling/groups/instancescurl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/autoscaling/groups/instances/87d8ab674af337deabc1af2c24bc3733Queryable 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
{
"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 |
| 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 |
| 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
QueryAutoScalingGroupInstanceAction action = new QueryAutoScalingGroupInstanceAction();
action.conditions = asList();
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
QueryAutoScalingGroupInstanceAction.Result res = action.call();QueryAutoScalingGroupInstanceAction action = QueryAutoScalingGroupInstanceAction()
action.conditions = []
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
QueryAutoScalingGroupInstanceAction.Result res = action.call()ChangeAutoScalingGroupState
API Request
PUT zstack/v1/autoscaling/groups/{uuid}/actionsAuthorization: OAuth the-session-uuid{
"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 -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| 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. |
|
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
{} 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
ChangeAutoScalingGroupStateAction action = new ChangeAutoScalingGroupStateAction();
action.uuid = "384ac055e3113366907f06e8aaefb12d";
action.stateEvent = "disable";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
ChangeAutoScalingGroupStateAction.Result res = action.call();ChangeAutoScalingGroupStateAction action = ChangeAutoScalingGroupStateAction()
action.uuid = "384ac055e3113366907f06e8aaefb12d"
action.stateEvent = "disable"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
ChangeAutoScalingGroupStateAction.Result res = action.call()ExecuteAutoScalingRule
API Request
PUT zstack/v1/autoscaling/rules/{uuid}/actionsAuthorization: OAuth the-session-uuid{
"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 -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| 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
{
"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 |
| 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 |
| 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
ExecuteAutoScalingRuleAction action = new ExecuteAutoScalingRuleAction();
action.uuid = "9311aaae28333775b3339b644961c990";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
ExecuteAutoScalingRuleAction.Result res = action.call();ExecuteAutoScalingRuleAction action = ExecuteAutoScalingRuleAction()
action.uuid = "9311aaae28333775b3339b644961c990"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
ExecuteAutoScalingRuleAction.Result res = action.call()UpdateAutoScalingGroupInstance
API Request
PUT zstack/v1/autoscaling/groups/instances/{instanceUuid}/actionsAuthorization: OAuth the-session-uuid{
"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 -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| 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. |
|
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
{} 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
UpdateAutoScalingGroupInstanceAction action = new UpdateAutoScalingGroupInstanceAction();
action.groupUuid = "a3b7616d6e6a3ed6bdf5dd5a640a4548";
action.instanceUuid = "a6dcd12ee95e345787a34175327df816";
action.protectionStrategy = "Protected";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
UpdateAutoScalingGroupInstanceAction.Result res = action.call();UpdateAutoScalingGroupInstanceAction action = UpdateAutoScalingGroupInstanceAction()
action.groupUuid = "a3b7616d6e6a3ed6bdf5dd5a640a4548"
action.instanceUuid = "a6dcd12ee95e345787a34175327df816"
action.protectionStrategy = "Protected"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
UpdateAutoScalingGroupInstanceAction.Result res = action.call()UpdateAutoScalingVmTemplate
API Request
PUT zstack/v1/autoscaling/vmtemplate/{uuid}/actionsAuthorization: OAuth the-session-uuid{
"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 -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| 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
{
"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 |
| 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 |
| 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
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();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()