diff --git a/specification/DigitalOcean-public.v2.yaml b/specification/DigitalOcean-public.v2.yaml index ea66dc4f..d29ec984 100644 --- a/specification/DigitalOcean-public.v2.yaml +++ b/specification/DigitalOcean-public.v2.yaml @@ -228,6 +228,10 @@ tags: types. Find more information about each of these objects in their respective sections. + - name: Droplet Autoscale Pools + description: |- + Droplet autoscale pools manage automatic horizontal scaling for your applications based on resource usage (CPU, memory, or both) or a static configuration. + - name: Firewalls description: |- [DigitalOcean Cloud Firewalls](https://docs.digitalocean.com/products/networking/firewalls/) @@ -998,6 +1002,32 @@ paths: post: $ref: 'resources/droplets/droplets_destroy_retryWithAssociatedResources.yml' + /v2/droplets/autoscale: + get: + $ref: 'resources/autoscale_pools/autoscale_pool_list.yml' + post: + $ref: 'resources/autoscale_pools/autoscale_pool_create.yml' + + /v2/droplets/autoscale/{autoscale_pool_id}: + get: + $ref: 'resources/autoscale_pools/autoscale_pool_get.yml' + put: + $ref: 'resources/autoscale_pools/autoscale_pool_update.yml' + delete: + $ref: 'resources/autoscale_pools/autoscale_pool_delete.yml' + + /v2/droplets/autoscale/{autoscale_pool_id}/dangerous: + delete: + $ref: 'resources/autoscale_pools/autoscale_pool_delete_dangerous.yml' + + /v2/droplets/autoscale/{autoscale_pool_id}/members: + get: + $ref: 'resources/autoscale_pools/autoscale_pool_list_members.yml' + + /v2/droplets/autoscale/{autoscale_pool_id}/history: + get: + $ref: 'resources/autoscale_pools/autoscale_pool_list_history.yml' + /v2/firewalls: get: $ref: 'resources/firewalls/firewalls_list.yml' diff --git a/specification/resources/autoscale_pools/autoscale_pool_create.yml b/specification/resources/autoscale_pools/autoscale_pool_create.yml new file mode 100644 index 00000000..2d039d1d --- /dev/null +++ b/specification/resources/autoscale_pools/autoscale_pool_create.yml @@ -0,0 +1,45 @@ +operationId: autoscalepools_create + +summary: Create a New Autoscale Pool + +description: | + To create a new autoscale pool, send a POST request to `/v2/droplets/autoscale` setting the required attributes. + + The response body will contain a JSON object with a key called `autoscale_pool` containing the standard attributes for the new autoscale pool. + +tags: + - Droplet Autoscale Pools + +requestBody: + content: + application/json: + schema: + $ref: 'models/autoscale_pool_create.yml' + examples: + Autoscale Create Request Dynamic Config: + $ref: 'examples.yml#/autoscale_create_request_dynamic' + Autoscale Create Request Static Config: + $ref: 'examples.yml#/autoscale_create_request_static' + +responses: + '202': + $ref: 'responses/autoscale_pool_create.yml' + + '401': + $ref: '../../shared/responses/unauthorized.yml' + + '429': + $ref: '../../shared/responses/too_many_requests.yml' + + '500': + $ref: '../../shared/responses/server_error.yml' + + default: + $ref: '../../shared/responses/unexpected_error.yml' + +x-codeSamples: + - $ref: 'examples/curl/autoscale_pool_create.yml' + +security: + - bearer_auth: + - 'droplet:create' diff --git a/specification/resources/autoscale_pools/autoscale_pool_delete.yml b/specification/resources/autoscale_pools/autoscale_pool_delete.yml new file mode 100644 index 00000000..74cd40ec --- /dev/null +++ b/specification/resources/autoscale_pools/autoscale_pool_delete.yml @@ -0,0 +1,40 @@ +operationId: autoscalepools_delete + +summary: Delete autoscale pool + +description: | + To destroy an autoscale pool, send a DELETE request to the `/v2/droplets/autoscale/$AUTOSCALE_POOL_ID` endpoint. + + A successful response will include a 202 response code and no content. + +tags: + - Droplet Autoscale Pools + +parameters: + - $ref: 'parameters.yml#/autoscale_pool_id' + +responses: + '202': + $ref: '../../shared/responses/no_content.yml' + + '401': + $ref: '../../shared/responses/unauthorized.yml' + + '404': + $ref: '../../shared/responses/not_found.yml' + + '429': + $ref: '../../shared/responses/too_many_requests.yml' + + '500': + $ref: '../../shared/responses/server_error.yml' + + default: + $ref: '../../shared/responses/unexpected_error.yml' + +x-codeSamples: + - $ref: 'examples/curl/autoscale_pool_delete.yml' + +security: + - bearer_auth: + - 'droplet:delete' diff --git a/specification/resources/autoscale_pools/autoscale_pool_delete_dangerous.yml b/specification/resources/autoscale_pools/autoscale_pool_delete_dangerous.yml new file mode 100644 index 00000000..6309ab7f --- /dev/null +++ b/specification/resources/autoscale_pools/autoscale_pool_delete_dangerous.yml @@ -0,0 +1,40 @@ +operationId: autoscalepools_delete_dangerous + +summary: Delete autoscale pool and resources + +description: | + To destroy an autoscale pool and its associated resources (Droplets), + send a DELETE request to the `/v2/droplets/autoscale/$AUTOSCALE_POOL_ID/dangerous` endpoint. + +tags: + - Droplet Autoscale Pools + +parameters: + - $ref: 'parameters.yml#/autoscale_pool_id' + - $ref: 'parameters.yml#/x_dangerous' + +responses: + '202': + $ref: '../../shared/responses/no_content.yml' + + '401': + $ref: '../../shared/responses/unauthorized.yml' + + '404': + $ref: '../../shared/responses/not_found.yml' + + '429': + $ref: '../../shared/responses/too_many_requests.yml' + + '500': + $ref: '../../shared/responses/server_error.yml' + + default: + $ref: '../../shared/responses/unexpected_error.yml' + +x-codeSamples: + - $ref: 'examples/curl/autoscale_pool_delete_dangerous.yml' + +security: + - bearer_auth: + - 'droplet:delete' diff --git a/specification/resources/autoscale_pools/autoscale_pool_get.yml b/specification/resources/autoscale_pools/autoscale_pool_get.yml new file mode 100644 index 00000000..cc812726 --- /dev/null +++ b/specification/resources/autoscale_pools/autoscale_pool_get.yml @@ -0,0 +1,39 @@ +operationId: autoscalepools_get + +summary: Retrieve an Existing Autoscale Pool + +description: | + To show information about an individual autoscale pool, send a GET request to + `/v2/droplets/autoscale/$AUTOSCALE_POOL_ID`. + +tags: + - Droplet Autoscale Pools + +parameters: + - $ref: 'parameters.yml#/autoscale_pool_id' + +responses: + '200': + $ref: 'responses/existing_autoscale_pool.yml' + + '401': + $ref: '../../shared/responses/unauthorized.yml' + + '404': + $ref: '../../shared/responses/not_found.yml' + + '429': + $ref: '../../shared/responses/too_many_requests.yml' + + '500': + $ref: '../../shared/responses/server_error.yml' + + default: + $ref: '../../shared/responses/unexpected_error.yml' + +x-codeSamples: + - $ref: 'examples/curl/autoscale_pool_get.yml' + +security: + - bearer_auth: + - 'droplet:read' diff --git a/specification/resources/autoscale_pools/autoscale_pool_list.yml b/specification/resources/autoscale_pools/autoscale_pool_list.yml new file mode 100644 index 00000000..3a40dc5e --- /dev/null +++ b/specification/resources/autoscale_pools/autoscale_pool_list.yml @@ -0,0 +1,40 @@ +operationId: autoscalepools_list + +summary: List All Autoscale Pools + +description: | + To list all autoscale pools in your team, send a GET request to `/v2/droplets/autoscale`. + The response body will be a JSON object with a key of `autoscale_pools` containing an array of autoscale pool objects. + These each contain the standard autoscale pool attributes. + +tags: + - Droplet Autoscale Pools + +parameters: + - $ref: '../../shared/parameters.yml#/per_page' + - $ref: '../../shared/parameters.yml#/page' + - $ref: './parameters.yml#/autoscale_pool_name' + +responses: + '200': + $ref: 'responses/all_autoscale_pools.yml' + + '401': + $ref: '../../shared/responses/unauthorized.yml' + + '429': + $ref: '../../shared/responses/too_many_requests.yml' + + '500': + $ref: '../../shared/responses/server_error.yml' + + default: + $ref: '../../shared/responses/unexpected_error.yml' + +x-codeSamples: + - $ref: 'examples/curl/autoscale_pools_list.yml' + + +security: + - bearer_auth: + - 'droplet:read' diff --git a/specification/resources/autoscale_pools/autoscale_pool_list_history.yml b/specification/resources/autoscale_pools/autoscale_pool_list_history.yml new file mode 100644 index 00000000..426706c3 --- /dev/null +++ b/specification/resources/autoscale_pools/autoscale_pool_list_history.yml @@ -0,0 +1,44 @@ +operationId: autoscalepools_list_history + +summary: List history events + +description: | + To list all of the scaling history events of an autoscale pool, send a GET request to `/v2/droplets/autoscale/$AUTOSCALE_POOL_ID/history`. + + The response body will be a JSON object with a key of `history`. This will be + set to an array containing objects each representing a history event. + +tags: + - Droplet Autoscale Pools + +parameters: + - $ref: '../../shared/parameters.yml#/per_page' + - $ref: '../../shared/parameters.yml#/page' + - $ref: 'parameters.yml#/autoscale_pool_id' + +responses: + '200': + $ref: 'responses/history_events.yml' + + '401': + $ref: '../../shared/responses/unauthorized.yml' + + '404': + $ref: '../../shared/responses/not_found.yml' + + '429': + $ref: '../../shared/responses/too_many_requests.yml' + + '500': + $ref: '../../shared/responses/server_error.yml' + + default: + $ref: '../../shared/responses/unexpected_error.yml' + +x-codeSamples: + - $ref: 'examples/curl/autoscale_pool_history_events.yml' + + +security: + - bearer_auth: + - 'droplet:read' diff --git a/specification/resources/autoscale_pools/autoscale_pool_list_members.yml b/specification/resources/autoscale_pools/autoscale_pool_list_members.yml new file mode 100644 index 00000000..7b8ee23f --- /dev/null +++ b/specification/resources/autoscale_pools/autoscale_pool_list_members.yml @@ -0,0 +1,44 @@ +operationId: autoscalepools_list_members + +summary: List members + +description: | + To list the Droplets in an autoscale pool, send a GET request to `/v2/droplets/autoscale/$AUTOSCALE_POOL_ID/members`. + + The response body will be a JSON object with a key of `droplets`. This will be + set to an array containing information about each of the Droplets in the autoscale pool. + +tags: + - Droplet Autoscale Pools + +parameters: + - $ref: '../../shared/parameters.yml#/per_page' + - $ref: '../../shared/parameters.yml#/page' + - $ref: 'parameters.yml#/autoscale_pool_id' + +responses: + '200': + $ref: 'responses/all_members.yml' + + '401': + $ref: '../../shared/responses/unauthorized.yml' + + '404': + $ref: '../../shared/responses/not_found.yml' + + '429': + $ref: '../../shared/responses/too_many_requests.yml' + + '500': + $ref: '../../shared/responses/server_error.yml' + + default: + $ref: '../../shared/responses/unexpected_error.yml' + +x-codeSamples: + - $ref: 'examples/curl/autoscale_pool_members.yml' + + +security: + - bearer_auth: + - 'droplet:read' diff --git a/specification/resources/autoscale_pools/autoscale_pool_update.yml b/specification/resources/autoscale_pools/autoscale_pool_update.yml new file mode 100644 index 00000000..46278e1d --- /dev/null +++ b/specification/resources/autoscale_pools/autoscale_pool_update.yml @@ -0,0 +1,49 @@ +operationId: autoscalepools_update + +summary: Update Autoscale Pool + +description: | + To update the configuration of an existing autoscale pool, send a PUT request to + `/v2/droplets/autoscale/$AUTOSCALE_POOL_ID`. The request must contain a full representation + of the autoscale pool including existing attributes. + +tags: + - Droplet Autoscale Pools + +parameters: + - $ref: 'parameters.yml#/autoscale_pool_id' + +requestBody: + content: + application/json: + schema: + $ref: 'models/autoscale_pool_create.yml' + examples: + Autoscale Update Request: + $ref: 'examples.yml#/autoscale_update_request' + +responses: + '200': + $ref: 'responses/autoscale_pool_create.yml' + + '401': + $ref: '../../shared/responses/unauthorized.yml' + + '404': + $ref: '../../shared/responses/not_found.yml' + + '429': + $ref: '../../shared/responses/too_many_requests.yml' + + '500': + $ref: '../../shared/responses/server_error.yml' + + default: + $ref: '../../shared/responses/unexpected_error.yml' + +x-codeSamples: + - $ref: 'examples/curl/autoscale_pool_update.yml' + +security: + - bearer_auth: + - 'droplet:create' diff --git a/specification/resources/autoscale_pools/examples.yml b/specification/resources/autoscale_pools/examples.yml new file mode 100644 index 00000000..5cd7ebe4 --- /dev/null +++ b/specification/resources/autoscale_pools/examples.yml @@ -0,0 +1,63 @@ +autoscale_create_request_dynamic: + value: + name: "my-autoscale-pool" + config: + min_instances: 1 + max_instances: 5 + target_cpu_utilization: 0.5 + cooldown_minutes: 10 + droplet_template: + name: example.com + region: nyc3 + size: c-2 + image: ubuntu-20-04-x64 + ssh_keys: + - 3b:16:e4:bf:8b:00:8b:b8:59:8c:a9:d3:f0:19:fa:45 + backups: true + ipv6: true + monitoring: true + tags: + - env:prod + - web + user_data: "#cloud-config\nruncmd:\n - touch /test.txt\n" + vpc_uuid: 760e09ef-dc84-11e8-981e-3cfdfeaae000 +autoscale_create_request_static: + value: + name: "my-autoscale-pool" + config: + target_number_instances: 2 + droplet_template: + name: example.com + region: nyc3 + size: c-2 + image: ubuntu-20-04-x64 + ssh_keys: + - 3b:16:e4:bf:8b:00:8b:b8:59:8c:a9:d3:f0:19:fa:45 + backups: true + ipv6: true + monitoring: true + tags: + - env:prod + - web + user_data: "#cloud-config\nruncmd:\n - touch /test.txt\n" + vpc_uuid: 760e09ef-dc84-11e8-981e-3cfdfeaae000 +autoscale_update_request: + value: + name: "my-autoscale-pool" + config: + target_number_instances: 2 + droplet_template: + name: example.com + region: nyc3 + size: c-2 + image: ubuntu-20-04-x64 + ssh_keys: + - 3b:16:e4:bf:8b:00:8b:b8:59:8c:a9:d3:f0:19:fa:45 + backups: true + ipv6: true + monitoring: true + tags: + - env:prod + - web + user_data: "#cloud-config\nruncmd:\n - touch /test.txt\n" + vpc_uuid: 760e09ef-dc84-11e8-981e-3cfdfeaae000 diff --git a/specification/resources/autoscale_pools/examples/curl/autoscale_pool_create.yml b/specification/resources/autoscale_pools/examples/curl/autoscale_pool_create.yml new file mode 100644 index 00000000..8a6e9403 --- /dev/null +++ b/specification/resources/autoscale_pools/examples/curl/autoscale_pool_create.yml @@ -0,0 +1,30 @@ +lang: cURL +source: |- + curl -X POST \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $DIGITALOCEAN_TOKEN" \ + -d '{ + "name": "test-autoscalergroup", + "config": { + "min_instances": 1, + "max_instances": 5, + "target_cpu_utilization": 0.5, + "cooldown_minutes": 5 + }, + "droplet_template": { + "size": "c-2", + "region": "tor1", + "image": "ubuntu-20-04-x64", + "tags": [ + "test-ag-01" + ], + "ssh_keys": [ + "392594", + "385255" + ], + "vpc_uuid": "c472520a-831e-4770-8135-542c57a69daa", + "ipv6": true, + "user_data": "\n#cloud-config\nruncmd:\n- apt-get update\n" + } + }' \ + "https://api.digitalocean.com/v2/droplets/autoscale" diff --git a/specification/resources/autoscale_pools/examples/curl/autoscale_pool_delete.yml b/specification/resources/autoscale_pools/examples/curl/autoscale_pool_delete.yml new file mode 100644 index 00000000..9db34579 --- /dev/null +++ b/specification/resources/autoscale_pools/examples/curl/autoscale_pool_delete.yml @@ -0,0 +1,6 @@ +lang: cURL +source: |- + curl -X DELETE \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $DIGITALOCEAN_TOKEN" \ + "https://api.digitalocean.com/v2/droplets/autoscale/880fee37-d07a-4f94-94a0-f07d9fc7bbb4" diff --git a/specification/resources/autoscale_pools/examples/curl/autoscale_pool_delete_dangerous.yml b/specification/resources/autoscale_pools/examples/curl/autoscale_pool_delete_dangerous.yml new file mode 100644 index 00000000..db76f5b7 --- /dev/null +++ b/specification/resources/autoscale_pools/examples/curl/autoscale_pool_delete_dangerous.yml @@ -0,0 +1,7 @@ +lang: cURL +source: |- + curl -X DELETE \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $DIGITALOCEAN_TOKEN" \ + -H "X-Dangerous: true" \ + "https://api.digitalocean.com/v2/droplets/autoscale/880fee37-d07a-4f94-94a0-f07d9fc7bbb4/dangerous" diff --git a/specification/resources/autoscale_pools/examples/curl/autoscale_pool_get.yml b/specification/resources/autoscale_pools/examples/curl/autoscale_pool_get.yml new file mode 100644 index 00000000..219256d7 --- /dev/null +++ b/specification/resources/autoscale_pools/examples/curl/autoscale_pool_get.yml @@ -0,0 +1,6 @@ +lang: cURL +source: |- + curl -X GET \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $DIGITALOCEAN_TOKEN" \ + "https://api.digitalocean.com/v2/droplets/autoscale/880fee37-d07a-4f94-94a0-f07d9fc7bbb4" diff --git a/specification/resources/autoscale_pools/examples/curl/autoscale_pool_history_events.yml b/specification/resources/autoscale_pools/examples/curl/autoscale_pool_history_events.yml new file mode 100644 index 00000000..f4ddb63a --- /dev/null +++ b/specification/resources/autoscale_pools/examples/curl/autoscale_pool_history_events.yml @@ -0,0 +1,6 @@ +lang: cURL +source: |- + curl -X GET \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $DIGITALOCEAN_TOKEN" \ + "https://api.digitalocean.com/v2/droplets/autoscale/07445b1b-1dc1-414d-b0a7-239ac66a9148/history" diff --git a/specification/resources/autoscale_pools/examples/curl/autoscale_pool_members.yml b/specification/resources/autoscale_pools/examples/curl/autoscale_pool_members.yml new file mode 100644 index 00000000..72ab0a9a --- /dev/null +++ b/specification/resources/autoscale_pools/examples/curl/autoscale_pool_members.yml @@ -0,0 +1,6 @@ +lang: cURL +source: |- + curl -X GET \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $DIGITALOCEAN_TOKEN" \ + "https://api.digitalocean.com/v2/droplets/autoscale/d0067f19-c9bd-4d8c-b28b-e464fd1fb250/members" diff --git a/specification/resources/autoscale_pools/examples/curl/autoscale_pool_update.yml b/specification/resources/autoscale_pools/examples/curl/autoscale_pool_update.yml new file mode 100644 index 00000000..a36f222e --- /dev/null +++ b/specification/resources/autoscale_pools/examples/curl/autoscale_pool_update.yml @@ -0,0 +1,32 @@ +lang: cURL +source: |- + curl -X PUT \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $DIGITALOCEAN_TOKEN" \ + -d '{ + "name": "test-autoscalergroup-01", + "config": { + "min_instances": 1, + "max_instances": 5, + "target_cpu_utilization": 0.5, + "cooldown_minutes": 10 + }, + "droplet_template": { + "size": "c-2", + "region": "tor1", + "image": "ubuntu-20-04-x64", + "tags": [ + "test-ag-01" + ], + "ssh_keys": [ + "372862", + "367582", + "355790" + ], + "vpc_uuid": "4637280e-3842-4661-a628-a6f0392959d3", + "with_droplet_agent": true, + "ipv6": true, + "user_data": "\n#cloud-config\nruncmd:\n- apt-get update\n" + } + }' \ + "https://api.digitalocean.com/v2/droplets/autoscale/d0067f19-c9bd-4d8c-b28b-e464fd1fb250" diff --git a/specification/resources/autoscale_pools/examples/curl/autoscale_pools_list.yml b/specification/resources/autoscale_pools/examples/curl/autoscale_pools_list.yml new file mode 100644 index 00000000..137d297c --- /dev/null +++ b/specification/resources/autoscale_pools/examples/curl/autoscale_pools_list.yml @@ -0,0 +1,6 @@ +lang: cURL +source: |- + curl -X GET \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $DIGITALOCEAN_TOKEN" \ + "https://api.digitalocean.com/v2/droplets/autoscale?page=1&per_page=1" diff --git a/specification/resources/autoscale_pools/models/autoscale_pool.yml b/specification/resources/autoscale_pools/models/autoscale_pool.yml new file mode 100644 index 00000000..2c567d74 --- /dev/null +++ b/specification/resources/autoscale_pools/models/autoscale_pool.yml @@ -0,0 +1,68 @@ +type: object + +properties: + id: + type: string + example: 0d3db13e-a604-4944-9827-7ec2642d32ac + description: A unique identifier for each autoscale pool instance. This is + automatically generated upon autoscale pool creation. + + name: + type: string + example: my-autoscale-pool + description: The human-readable name set for the autoscale pool. + + config: + oneOf: + - $ref: ../models/autoscale_pool_static_config.yml + - $ref: ../models/autoscale_pool_dynamic_config.yml + type: object + description: The scaling configuration for an autoscale pool, which + is how the pool scales up and down (either by resource utilization + or static configuration). + + droplet_template: + $ref: ../models/autoscale_pool_droplet_template.yml + + current_utilization: + $ref: ../models/current_utilization.yml + + created_at: + format: date-time + title: The creation time of the autoscale pool + type: string + example: 2020-07-28T18:00:00Z + description: A time value given in ISO8601 combined date and time format + that represents when the autoscale pool was created. + + updated_at: + format: date-time + title: When the autoscale pool was last updated + type: string + example: 2020-07-28T18:00:00Z + description: A time value given in ISO8601 combined date and time format + that represents when the autoscale pool was last updated. + + status: + type: string + enum: + - active + - deleting + - error + description: The current status of the autoscale pool. + example: active + + active_resources_count: + type: integer + example: 1 + description: The number of active Droplets in the autoscale pool. + +required: + - id + - name + - config + - droplet_template + - created_at + - updated_at + - status + - active_resources_count diff --git a/specification/resources/autoscale_pools/models/autoscale_pool_create.yml b/specification/resources/autoscale_pools/models/autoscale_pool_create.yml new file mode 100644 index 00000000..fd1e8e5e --- /dev/null +++ b/specification/resources/autoscale_pools/models/autoscale_pool_create.yml @@ -0,0 +1,22 @@ +type: object + +properties: + name: + example: "my-autoscale-pool" + type: string + description: "The human-readable name of the autoscale pool. This field cannot be updated" + config: + oneOf: + - $ref: ../models/autoscale_pool_static_config.yml + - $ref: ../models/autoscale_pool_dynamic_config.yml + type: object + description: The scaling configuration for an autoscale pool, which + is how the pool scales up and down (either by resource utilization + or static configuration). + droplet_template: + $ref: ../models/autoscale_pool_droplet_template.yml + +required: + - name + - config + - droplet_template diff --git a/specification/resources/autoscale_pools/models/autoscale_pool_droplet_template.yml b/specification/resources/autoscale_pools/models/autoscale_pool_droplet_template.yml new file mode 100644 index 00000000..990d132b --- /dev/null +++ b/specification/resources/autoscale_pools/models/autoscale_pool_droplet_template.yml @@ -0,0 +1,89 @@ +type: object + +properties: + name: + type: string + example: my-droplet-name + description: "The name(s) to be applied to all Droplets in the autoscale pool." + + region: + type: string + example: tor1 + enum: + - nyc1 + - nyc2 + - nyc3 + - ams2 + - ams3 + - sfo1 + - sfo2 + - sfo3 + - sgp1 + - lon1 + - fra1 + - tor1 + - blr1 + - syd1 + description: The datacenter in which all of the Droplets will be created. + + size: + type: string + example: c-2 + description: The Droplet size to be used for all Droplets in the autoscale pool. + + image: + type: string + example: ubuntu-20-04-x64 + description: The Droplet image to be used for all Droplets in the autoscale pool. + You may specify the slug or the image ID. + + ssh_keys: + type: array + items: + type: string + example: + - "88:66:90:d2:68:d5:b5:85:e3:26:26:11:31:57:e6:f8" + description: The SSH keys to be installed on the Droplets in the autoscale pool. You can either specify the key ID or the fingerprint. + + tags: + type: array + items: + type: string + example: + - my-tag + description: The tags to apply to each of the Droplets in the autoscale pool. + + vpc_uuid: + type: string + description: The VPC where the Droplets in the autoscale pool will be created. The VPC must be in the region where you want to create the Droplets. + example: 760e09ef-dc84-11e8-981e-3cfdfeaae000 + + with_droplet_agent: + type: boolean + description: Installs the Droplet agent. This must be set to true to monitor Droplets for resource utilization scaling. + example: true + + project_id: + type: string + description: The project that the Droplets in the autoscale pool will belong to. + example: 746c6152-2fa2-11ed-92d3-27aaa54e4988 + + ipv6: + type: boolean + description: Assigns a unique IPv6 address to each of the Droplets in the autoscale pool. + example: true + + user_data: + type: string + example: | + #cloud-config + runcmd: + - touch /test.txt + description: A string containing user data that cloud-init consumes to configure a Droplet on first boot. + User data is often a cloud-config file or Bash script. It must be plain text and may not exceed 64 KiB in size. + +required: + - region + - image + - size + - ssh_keys diff --git a/specification/resources/autoscale_pools/models/autoscale_pool_dynamic_config.yml b/specification/resources/autoscale_pools/models/autoscale_pool_dynamic_config.yml new file mode 100644 index 00000000..2cf9b4fc --- /dev/null +++ b/specification/resources/autoscale_pools/models/autoscale_pool_dynamic_config.yml @@ -0,0 +1,39 @@ +type: object + +properties: + min_instances: + type: integer + example: 5 + description: The minimum number of Droplets in an autoscale pool. + minimum: 1 + maximum: 500 + max_instances: + type: integer + example: 10 + description: The maximum number of Droplets in an autoscale pool. + minimum: 1 + maximum: 1000 + target_cpu_utilization: + type: number + format: float + example: 0.6 + description: Target CPU utilization as a decimal. + minimum: 0.05 + maximum: 1 + target_memory_utilization: + type: number + format: float + example: 0.6 + description: Target memory utilization as a decimal. + minimum: 0.05 + maximum: 1 + cooldown_minutes: + type: integer + example: 5 + description: The number of minutes to wait between scaling events in an autoscale pool. Defaults to 10 minutes. + minimum: 5 + maximum: 20 + +required: + - min_instances + - max_instances diff --git a/specification/resources/autoscale_pools/models/autoscale_pool_static_config.yml b/specification/resources/autoscale_pools/models/autoscale_pool_static_config.yml new file mode 100644 index 00000000..415fb5fa --- /dev/null +++ b/specification/resources/autoscale_pools/models/autoscale_pool_static_config.yml @@ -0,0 +1,13 @@ +type: object + +properties: + target_number_instances: + title: static config + type: integer + example: 3 + description: Fixed number of instances in an autoscale pool. + minimum: 1 + maximum: 1000 + +required: + - target_number_instances diff --git a/specification/resources/autoscale_pools/models/current_utilization.yml b/specification/resources/autoscale_pools/models/current_utilization.yml new file mode 100644 index 00000000..47e0536b --- /dev/null +++ b/specification/resources/autoscale_pools/models/current_utilization.yml @@ -0,0 +1,17 @@ +type: object + +properties: + memory: + type: number + format: float + example: 0.3588531587713522 + description: The average memory utilization of the autoscale pool. + minimum: 0 + maximum: 1 + cpu: + type: number + format: float + example: 0.0007338008770232183 + description: The average CPU utilization of the autoscale pool. + minimum: 0 + maximum: 1 diff --git a/specification/resources/autoscale_pools/models/history.yml b/specification/resources/autoscale_pools/models/history.yml new file mode 100644 index 00000000..1ffd3147 --- /dev/null +++ b/specification/resources/autoscale_pools/models/history.yml @@ -0,0 +1,50 @@ +type: object + +properties: + history_event_id: + type: string + example: 01936530-4471-7b86-9634-32d8fcfecbc6 + description: The unique identifier of the history event. + current_instance_count: + type: integer + example: 2 + description: The current number of Droplets in the autoscale pool. + desired_instance_count: + type: integer + example: 2 + description: The target number of Droplets for the autoscale pool after the scaling event. + reason: + type: string + enum: + - CONFIGURATION_CHANGE + - SCALE_UP + - SCALE_DOWN + description: The reason for the scaling event. + example: 'CONFIGURATION_CHANGE' + status: + type: string + enum: + - in_progress + - success + - error + description: The status of the scaling event. + example: 'success' + created_at: + format: date-time + description: The creation time of the history event in ISO8601 combined date and time format. + type: string + example: 2020-07-28T18:00:00Z + updated_at: + format: date-time + description: The last updated time of the history event in ISO8601 combined date and time format. + type: string + example: 2020-07-28T18:00:00Z + +required: + - history_event_id + - current_instance_count + - desired_instance_count + - reason + - status + - created_at + - updated_at diff --git a/specification/resources/autoscale_pools/models/member.yml b/specification/resources/autoscale_pools/models/member.yml new file mode 100644 index 00000000..43a024e1 --- /dev/null +++ b/specification/resources/autoscale_pools/models/member.yml @@ -0,0 +1,40 @@ +type: object + +properties: + droplet_id: + type: integer + example: 459903570 + description: The unique identifier of the Droplet. + created_at: + format: date-time + description: The creation time of the Droplet in ISO8601 combined date and time format. + type: string + example: 2020-07-28T18:00:00Z + updated_at: + format: date-time + description: The last updated time of the Droplet in ISO8601 combined date and time format. + type: string + example: 2020-07-28T18:00:00Z + health_status: + type: string + example: 'active' + description: The health status of the Droplet. + status: + type: string + enum: + - provisioning + - active + - deleting + - "off" + description: The power status of the Droplet. + example: "active" + current_utilization: + $ref: ../models/member_current_utilization.yml + +required: + - droplet_id + - created_at + - updated_at + - health_status + - status + - current_utilization diff --git a/specification/resources/autoscale_pools/models/member_current_utilization.yml b/specification/resources/autoscale_pools/models/member_current_utilization.yml new file mode 100644 index 00000000..1dabe39e --- /dev/null +++ b/specification/resources/autoscale_pools/models/member_current_utilization.yml @@ -0,0 +1,13 @@ +type: object + +properties: + memory: + type: number + format: float + example: 0.3588531587713522 + description: The memory utilization average of the individual Droplet. + cpu: + type: number + format: float + example: 0.0007338008770232183 + description: The CPU utilization average of the individual Droplet. diff --git a/specification/resources/autoscale_pools/parameters.yml b/specification/resources/autoscale_pools/parameters.yml new file mode 100644 index 00000000..503781ca --- /dev/null +++ b/specification/resources/autoscale_pools/parameters.yml @@ -0,0 +1,24 @@ +autoscale_pool_id: + in: path + name: autoscale_pool_id + description: A unique identifier for an autoscale pool. + required: true + schema: + type: string + example: 0d3db13e-a604-4944-9827-7ec2642d32ac +x_dangerous: + in: header + name: X-Dangerous + description: Acknowledge this action will destroy the autoscale pool and its + associated resources and _can not_ be reversed. + schema: + type: boolean + example: true + required: true +autoscale_pool_name: + name: name + in: query + description: The name of the autoscale pool + schema: + type: string + example: my-autoscale-pool diff --git a/specification/resources/autoscale_pools/responses/all_autoscale_pools.yml b/specification/resources/autoscale_pools/responses/all_autoscale_pools.yml new file mode 100644 index 00000000..704f1c83 --- /dev/null +++ b/specification/resources/autoscale_pools/responses/all_autoscale_pools.yml @@ -0,0 +1,26 @@ +description: A JSON object with a key of `autoscale_pools`. + +headers: + ratelimit-limit: + $ref: '../../../shared/headers.yml#/ratelimit-limit' + ratelimit-remaining: + $ref: '../../../shared/headers.yml#/ratelimit-remaining' + ratelimit-reset: + $ref: '../../../shared/headers.yml#/ratelimit-reset' + + +content: + application/json: + schema: + allOf: + - type: object + properties: + autoscale_pools: + type: array + items: + $ref: '../models/autoscale_pool.yml' + - $ref: '../../../shared/pages.yml#/pagination' + - $ref: '../../../shared/meta.yml' + examples: + All Autoscale Pools: + $ref: 'examples.yml#/autoscale_pools_all' diff --git a/specification/resources/autoscale_pools/responses/all_members.yml b/specification/resources/autoscale_pools/responses/all_members.yml new file mode 100644 index 00000000..6d5dac88 --- /dev/null +++ b/specification/resources/autoscale_pools/responses/all_members.yml @@ -0,0 +1,27 @@ +description: A JSON object with a key of `droplets`. + +headers: + ratelimit-limit: + $ref: '../../../shared/headers.yml#/ratelimit-limit' + ratelimit-remaining: + $ref: '../../../shared/headers.yml#/ratelimit-remaining' + ratelimit-reset: + $ref: '../../../shared/headers.yml#/ratelimit-reset' + + +content: + application/json: + schema: + allOf: + - type: object + properties: + droplets: + type: array + items: + $ref: '../models/member.yml' + - $ref: '../../../shared/pages.yml#/pagination' + - $ref: '../../../shared/meta.yml' + examples: + All members: + $ref: 'examples.yml#/members_all' + diff --git a/specification/resources/autoscale_pools/responses/autoscale_pool_create.yml b/specification/resources/autoscale_pools/responses/autoscale_pool_create.yml new file mode 100644 index 00000000..f3b0b4ba --- /dev/null +++ b/specification/resources/autoscale_pools/responses/autoscale_pool_create.yml @@ -0,0 +1,22 @@ +description: Accepted + +headers: + ratelimit-limit: + $ref: '../../../shared/headers.yml#/ratelimit-limit' + ratelimit-remaining: + $ref: '../../../shared/headers.yml#/ratelimit-remaining' + ratelimit-reset: + $ref: '../../../shared/headers.yml#/ratelimit-reset' + +content: + application/json: + schema: + properties: + autoscale_pool: + $ref: '../models/autoscale_pool.yml' + + examples: + Autoscale Create Response Dynamic Config: + $ref: 'examples.yml#/autoscale_create_response_dynamic' + Autoscale Create Response Static Config: + $ref: 'examples.yml#/autoscale_create_response_static' \ No newline at end of file diff --git a/specification/resources/autoscale_pools/responses/examples.yml b/specification/resources/autoscale_pools/responses/examples.yml new file mode 100644 index 00000000..ff827447 --- /dev/null +++ b/specification/resources/autoscale_pools/responses/examples.yml @@ -0,0 +1,148 @@ +autoscale_pools_all: + value: + autoscale_pools: + - id: 0d3db13e-a604-4944-9827-7ec2642d32ac + name: "test-autoscaler-group-01" + config: + min_instances: 1 + max_instances: 5 + target_cpu_utilization: 0.5 + cooldown_minutes: 10 + droplet_template: + name: "droplet-name" + size: c-2 + region: tor1 + image: ubuntu-20-04-x64 + tags: + - my-tag + ssh_keys: + - 3b:16:e4:bf:8b:00:8b:b8:59:8c:a9:d3:f0:19:fa:45 + vpc_uuid: 760e09ef-dc84-11e8-981e-3cfdfeaae000 + with_droplet_agent: true + project_id: 746c6152-2fa2-11ed-92d3-27aaa54e4988 + ipv6: true + user_data: "#cloud-config\nruncmd:\n - touch /test.txt\n" + created_at: 2020-11-19T20:27:18Z + updated_at: 2020-12-01T00:42:16Z + current_utilization: + memory: 0.3588531587713522 + cpu: 0.0007338008770232183 + status: active + active_resources_count: 1 + links: + pages: + meta: + total: 1 +autoscale_pool_single: + value: + autoscale_pool: + id: 0d3db13e-a604-4944-9827-7ec2642d32ac + name: "test-autoscaler-group-01" + config: + min_instances: 1 + max_instances: 5 + target_cpu_utilization: 0.5 + cooldown_minutes: 10 + droplet_template: + name: "droplet-name" + size: c-2 + region: tor1 + image: 'ubuntu-20-04-x64' + tags: + - my-tag + ssh_keys: + - 3b:16:e4:bf:8b:00:8b:b8:59:8c:a9:d3:f0:19:fa:45 + vpc_uuid: 760e09ef-dc84-11e8-981e-3cfdfeaae000 + with_droplet_agent: true + project_id: 746c6152-2fa2-11ed-92d3-27aaa54e4988 + ipv6: true + user_data: "#cloud-config\nruncmd:\n - touch /test.txt\n" + created_at: 2020-11-19T20:27:18Z + updated_at: 2020-12-01T00:42:16Z + current_utilization: + memory: 0.3588531587713522 + cpu: 0.0007338008770232183 + status: active + active_resources_count: 1 +members_all: + value: + droplets: + - droplet_id: 123456 + created_at: 2020-11-19T20:27:18Z + updated_at: 2020-12-01T00:42:16Z + health_status: "healthy" + status: "active" + current_utilization: + memory: 0.3588531587713522 + cpu: 0.0007338008770232183 + links: + pages: + meta: + total: 1 +history_all: + value: + history: + - history_event_id: 01936530-4471-7b86-9634-32d8fcfecbc6 + current_instance_count: 2 + desired_instance_count: 2 + reason: "CONFIGURATION_CHANGE" + status: "success" + created_at: 2020-11-19T20:27:18Z + updated_at: 2020-12-01T00:42:16Z + links: + pages: + meta: + total: 1 +autoscale_create_response_dynamic: + value: + autoscale_pool: + id: 0d3db13e-a604-4944-9827-7ec2642d32ac + name: "test-autoscaler-group-01" + config: + min_instances: 1 + max_instances: 5 + target_cpu_utilization: 0.5 + cooldown_minutes: 10 + droplet_template: + name: "droplet-name" + size: c-2 + region: tor1 + image: 'ubuntu-20-04-x64' + tags: + - my-tag + ssh_keys: + - 3b:16:e4:bf:8b:00:8b:b8:59:8c:a9:d3:f0:19:fa:45 + vpc_uuid: 760e09ef-dc84-11e8-981e-3cfdfeaae000 + with_droplet_agent: true + project_id: 746c6152-2fa2-11ed-92d3-27aaa54e4988 + ipv6: true + user_data: "#cloud-config\nruncmd:\n - touch /test.txt\n" + created_at: 2020-11-19T20:27:18Z + updated_at: 2020-12-01T00:42:16Z + status: active + active_resources_count: 1 +autoscale_create_response_static: + value: + autoscale_pool: + id: 0d3db13e-a604-4944-9827-7ec2642d32ac + name: "test-autoscaler-group-01" + config: + target_number_instances: 1 + droplet_template: + name: "droplet-name" + size: c-2 + region: tor1 + image: 'ubuntu-20-04-x64' + tags: + - my-tag + ssh_keys: + - 3b:16:e4:bf:8b:00:8b:b8:59:8c:a9:d3:f0:19:fa:45 + vpc_uuid: 760e09ef-dc84-11e8-981e-3cfdfeaae000 + with_droplet_agent: true + project_id: 746c6152-2fa2-11ed-92d3-27aaa54e4988 + ipv6: true + user_data: "#cloud-config\nruncmd:\n - touch /test.txt\n" + created_at: 2020-11-19T20:27:18Z + updated_at: 2020-12-01T00:42:16Z + status: active + active_resources_count: 1 diff --git a/specification/resources/autoscale_pools/responses/existing_autoscale_pool.yml b/specification/resources/autoscale_pools/responses/existing_autoscale_pool.yml new file mode 100644 index 00000000..6643b13c --- /dev/null +++ b/specification/resources/autoscale_pools/responses/existing_autoscale_pool.yml @@ -0,0 +1,21 @@ +description: | + The response will be a JSON object with a key called `autoscale_pool`. This will be + set to a JSON object that contains the standard autoscale pool attributes. + +headers: + ratelimit-limit: + $ref: '../../../shared/headers.yml#/ratelimit-limit' + ratelimit-remaining: + $ref: '../../../shared/headers.yml#/ratelimit-remaining' + ratelimit-reset: + $ref: '../../../shared/headers.yml#/ratelimit-reset' + +content: + application/json: + schema: + properties: + autoscale_pool: + $ref: '../models/autoscale_pool.yml' + examples: + Single Autoscale Pool: + $ref: 'examples.yml#/autoscale_pool_single' diff --git a/specification/resources/autoscale_pools/responses/history_events.yml b/specification/resources/autoscale_pools/responses/history_events.yml new file mode 100644 index 00000000..49f97444 --- /dev/null +++ b/specification/resources/autoscale_pools/responses/history_events.yml @@ -0,0 +1,25 @@ +description: A JSON object with a key of `history`. + +headers: + ratelimit-limit: + $ref: '../../../shared/headers.yml#/ratelimit-limit' + ratelimit-remaining: + $ref: '../../../shared/headers.yml#/ratelimit-remaining' + ratelimit-reset: + $ref: '../../../shared/headers.yml#/ratelimit-reset' + +content: + application/json: + schema: + allOf: + - type: object + properties: + history: + type: array + items: + $ref: '../models/history.yml' + - $ref: '../../../shared/pages.yml#/pagination' + - $ref: '../../../shared/meta.yml' + examples: + All History Events: + $ref: 'examples.yml#/history_all'