Get Auto Scale policies
This action provides the state and params of all Auto Scale policies for the respective container. It can also provide available configuration params for each resource's auto scale policy.
To access this API service send a POST request with action name: scaleGetAutoscale
Request
The data
object of the JSON request must contain container_id
value. You can retrieve all unique ids of your containers using the Get Active Containers action. You can also request a detailed information of all available options for each auto scale policy by providing a value for the get_options
parameter. So, this action supports the following parameters:
Name |
Type |
Description |
Required |
container_id |
integer |
The container's ID to retrieve auto scale policies for |
Yes |
get_options |
integer |
If set to 1 the response will include all available auto scale options for each policy |
No |
Response
The API will provide a response in a JSON format that will contain an object named autoscales
which will contain sub-objects for each resource type policy. Those could be cpu
, hdd
, mem
and bw
. Each of the resource type sub-objects will contains the current configuration of each policy as follows:
Name |
Type |
Description |
autoscales:type |
object |
Auto scale policy type. Could be mem, cpu, hdd or bw. |
autoscales:type:active |
intiger |
Status of the auto scale policy. 0 - is not active; 1 - is active; |
autoscales:type:cap |
integer |
The maximum value for the respective resource type. Once reached the auto scale process stops. |
autoscales:type:current |
integer |
The current allocation of the respective resource type |
autoscales:type:max |
integer |
Same as autoscales:type:cap |
autoscales:type:min |
integer |
The minimum value for the respective resource type. Used for auto scale down. This feature is currently not live yet. |
autoscales:type:name |
string |
Human readable name of the respective resource type |
autoscales:type:price |
string |
Detailed price format of the respective resource type |
autoscales:type:priceRaw |
float |
Raw format of the price for this resource |
autoscales:type:step |
integer |
Amount of resource to be added upon auto scale |
autoscales:type:threshold |
integer |
The limit of resource usage in percentage upon which auto scale is triggered. |
autoscales:type:unit |
string |
Measurement unit for the respective resource type |
callback_url |
string |
Scale event callback API url |
Detailed response
As previously mentioned this API action can also provide you with information on the available configuration for each auto scale policy. In other words it can tell the exact possible values for each auto scale policy.
As you already may noticed the primarily auto scale parameters are cap, threshold and step. The available values for each of those are provided in the API response as nested objects of the resource type object.
Each options JSON nested object is a list of string elements that represent the available values for the respective auto scale. Example:
"autoscales": { "cpu": { "cap_options": { "5": "5 Cores", "6": "6 Cores", "7": "7 Cores", "8": "8 Cores" } } },
The key of each element could be used as integer value of the available option. The table below list the currently available options objects:
Name |
Description |
cap_options |
The available values that can be set as a maximum for the respective auto scale policy type |
threshold_options |
The available values that can be set as thresholds for the respective auto scale policy type |
step_options |
The available values that can be set as increase step for the respective auto scale policy type |
The detailed response of this API action is generally very useful when developing a front end interface that provides the end user with the ability to configure auto scale policies for his container.
Errors
In case of a wrongly configured JSON request or failure of the API service the response may contain one of the following errors:
Error Code |
Description |
201 |
Missing parameter container_id |
202 |
Container does not belong to your identity |
203 |
Container doesn't exist |
(more…)
curl -s "https://api.kyup.com/client/v1" --data 'request={ "action":"scaleGetAutoscale", "authorization_key":"$APIKEY", "data":{ "container_id":123,"get_options":1} }'
request={
"action":"scaleGetAutoscale",
"authorization_key":"$APIKEY",
"data":{
"container_id":123,
"get_options":1} }
}
}
{
"data": {
"autoscales": {
"bw": {
"active": "0",
"cap": "2",
"cap_options": {"2": "2 TB"},
"current": "2",
"max": 2,
"min": 2,
"name": "Bandwidth",
"price": "$0.20 per additional GB",
"priceRaw": 0.2016,
"step": "1",
"step_options": {"1": "1 TB"},
"threshold": "90",
"threshold_options": {
"30": "30%",
"50": "50%",
"70": "70%",
"90": "90%"
},
"unit": "TB",
"unitPlural": "TB"
},
"cpu": {
"active": "1",
"cap": "8",
"cap_options": {
"5": "5 Cores",
"6": "6 Cores",
"7": "7 Cores",
"8": "8 Cores"
},
"current": "4",
"max": 8,
"min": 2,
"name": "CPU",
"price": "$10.00 per additional CPU Core",
"priceRaw": 10.0008,
"step": "1",
"step_options": {
"1": "1 Cores",
"2": "2 Cores",
"3": "3 Cores",
"4": "4 Cores"
},
"threshold": "90",
"threshold_options": {
"30": "30%",
"50": "50%",
"70": "70%",
"90": "90%"
},
"unit": "Core",
"unitPlural": "Cores"
},
"hdd": {
"active": "0",
"cap": "40",
"cap_options": {
"100": "100 GB",
"110": "110 GB",
"120": "120 GB",
"130": "130 GB",
"140": "140 GB",
"150": "150 GB",
"160": "160 GB",
"30": "30 GB",
"40": "40 GB",
"50": "50 GB",
"60": "60 GB",
"70": "70 GB",
"80": "80 GB",
"90": "90 GB"
},
"current": "20",
"max": 160,
"min": 20,
"name": "Storage",
"price": "$5.00 per additional 10 GB",
"priceRaw": 0.49968,
"step": "10",
"step_options": {
"10": "10 GB",
"100": "100 GB",
"110": "110 GB",
"120": "120 GB",
"130": "130 GB",
"140": "140 GB",
"20": "20 GB",
"30": "30 GB",
"40": "40 GB",
"50": "50 GB",
"60": "60 GB",
"70": "70 GB",
"80": "80 GB",
"90": "90 GB"
},
"threshold": "90",
"threshold_options": {
"30": "30%",
"50": "50%",
"70": "70%",
"90": "90%"
},
"unit": "GB",
"unitPlural": "GB"
},
"mem": {
"active": "1",
"cap": "8",
"cap_options": {
"5": "5 GB",
"6": "6 GB",
"7": "7 GB",
"8": "8 GB"
},
"current": "4",
"max": 8,
"min": 2,
"name": "RAM",
"price": "$10.00 per additional GB",
"priceRaw": 10.0008,
"step": "2",
"step_options": {
"1": "1 GB",
"2": "2 GB",
"3": "3 GB",
"4": "4 GB"
},
"threshold": "90",
"threshold_options": {
"30": "30%",
"50": "50%",
"70": "70%",
"90": "90%"
},
"unit": "GB",
"unitPlural": "GB"
}
},
"callback_url": "https://some.url/here"
},
"status": 1
}