diff --git a/examples/digital-ocean-api/resources/apps/apps_get_logs_active_deployment.yml b/examples/digital-ocean-api/resources/apps/apps_get_logs_active_deployment.yml new file mode 100755 index 000000000..e142102f5 --- /dev/null +++ b/examples/digital-ocean-api/resources/apps/apps_get_logs_active_deployment.yml @@ -0,0 +1,47 @@ +operationId: apps_get_logs_active_deployment + +summary: Retrieve Active Deployment Logs + +description: Retrieve the logs of the active deployment if one exists. The + response will include links to either real-time logs of an in-progress or + active deployment or archived logs of a past deployment. Note log_type=BUILD + logs will return logs associated with the current active deployment (being + served). To view build logs associated with in-progress build, the query must + explicitly reference the deployment id. + +tags: +- Apps + +parameters: + - $ref: parameters.yml#/app_id + - $ref: parameters.yml#/component + - $ref: parameters.yml#/live_updates + - $ref: parameters.yml#/log_type + - $ref: parameters.yml#/time_wait + +responses: + "200": + $ref: responses/list_logs.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/apps_get_logs_active_deployment.yml' + +security: + - bearer_auth: + - 'read' + diff --git a/examples/digital-ocean-api/resources/apps/apps_get_logs_active_deployment_aggregate.yml b/examples/digital-ocean-api/resources/apps/apps_get_logs_active_deployment_aggregate.yml new file mode 100755 index 000000000..e8c1a4afb --- /dev/null +++ b/examples/digital-ocean-api/resources/apps/apps_get_logs_active_deployment_aggregate.yml @@ -0,0 +1,46 @@ +operationId: apps_get_logs_active_deployment_aggregate + +summary: Retrieve Active Deployment Aggregate Logs + +description: Retrieve the logs of the active deployment if one exists. The + response will include links to either real-time logs of an in-progress or + active deployment or archived logs of a past deployment. Note log_type=BUILD + logs will return logs associated with the current active deployment (being + served). To view build logs associated with in-progress build, the query must + explicitly reference the deployment id. + +tags: +- Apps + +parameters: + - $ref: parameters.yml#/app_id + - $ref: parameters.yml#/live_updates + - $ref: parameters.yml#/log_type + - $ref: parameters.yml#/time_wait + +responses: + "200": + $ref: responses/list_logs.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/apps_get_logs_active_deployment_aggregate.yml' + +security: + - bearer_auth: + - 'read' + diff --git a/examples/digital-ocean-api/resources/apps/apps_get_logs_aggregate.yml b/examples/digital-ocean-api/resources/apps/apps_get_logs_aggregate.yml new file mode 100755 index 000000000..6c4ac2113 --- /dev/null +++ b/examples/digital-ocean-api/resources/apps/apps_get_logs_aggregate.yml @@ -0,0 +1,45 @@ +operationId: apps_get_logs_aggregate + +summary: Retrieve Aggregate Deployment Logs + +description: Retrieve the logs of a past, in-progress, or active deployment. If a + component name is specified, the logs will be limited to only that component. The + response will include links to either real-time logs of an in-progress or active + deployment or archived logs of a past deployment. + +tags: +- Apps + +parameters: + - $ref: parameters.yml#/app_id + - $ref: parameters.yml#/deployment_id + - $ref: parameters.yml#/live_updates + - $ref: parameters.yml#/log_type + - $ref: parameters.yml#/time_wait + +responses: + "200": + $ref: responses/list_logs.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/apps_get_logs_aggregate.yml' + +security: + - bearer_auth: + - 'read' + diff --git a/examples/digital-ocean-api/resources/apps/apps_get_metrics_bandwidth_usage.yml b/examples/digital-ocean-api/resources/apps/apps_get_metrics_bandwidth_usage.yml new file mode 100644 index 000000000..e3220ae26 --- /dev/null +++ b/examples/digital-ocean-api/resources/apps/apps_get_metrics_bandwidth_usage.yml @@ -0,0 +1,44 @@ +operationId: apps_get_metrics_bandwidth_daily + +summary: 'Retrieve App Daily Bandwidth Metrics' + +description: 'Retrieve daily bandwidth usage metrics for a single app.' + +tags: + - Apps + +parameters: + - $ref: parameters.yml#/app_id + - name: date + description: 'Optional day to query. Only the date component of the timestamp will be considered. Default: yesterday.' + in: query + schema: + type: string + format: date-time + example: 2023-01-17T00:00:00Z + +responses: + "200": + $ref: responses/get_metrics_bandwidth_usage.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/apps_get_metrics_bandwidth_usage.yml + +security: + - bearer_auth: + - read diff --git a/examples/digital-ocean-api/resources/apps/apps_list_metrics_bandwidth_usage.yml b/examples/digital-ocean-api/resources/apps/apps_list_metrics_bandwidth_usage.yml new file mode 100644 index 000000000..aa7319904 --- /dev/null +++ b/examples/digital-ocean-api/resources/apps/apps_list_metrics_bandwidth_usage.yml @@ -0,0 +1,46 @@ +operationId: apps_list_metrics_bandwidth_daily + +summary: "Retrieve Multiple Apps' Daily Bandwidth Metrics" + +description: 'Retrieve daily bandwidth usage metrics for multiple apps.' + +tags: + - Apps + +requestBody: + content: + application/json: + schema: + $ref: models/app_metrics_bandwidth_usage_request.yml + example: + app_ids: + - 4f6c71e2-1e90-4762-9fee-6cc4a0a9f2cf + - c2a93513-8d9b-4223-9d61-5e7272c81cf5 + date: 2023-01-17T00:00:00Z + required: true + +responses: + "200": + $ref: responses/list_metrics_bandwidth_usage.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/apps_list_metrics_bandwidth_usage.yml + +security: + - bearer_auth: + - read diff --git a/examples/digital-ocean-api/resources/apps/examples/curl/apps_get_logs_active_deployment.yml b/examples/digital-ocean-api/resources/apps/examples/curl/apps_get_logs_active_deployment.yml new file mode 100644 index 000000000..1b271c429 --- /dev/null +++ b/examples/digital-ocean-api/resources/apps/examples/curl/apps_get_logs_active_deployment.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/apps/{app_id}/components/{component_name}/logs" diff --git a/examples/digital-ocean-api/resources/apps/examples/curl/apps_get_logs_active_deployment_aggregate.yml b/examples/digital-ocean-api/resources/apps/examples/curl/apps_get_logs_active_deployment_aggregate.yml new file mode 100644 index 000000000..db76d4fdc --- /dev/null +++ b/examples/digital-ocean-api/resources/apps/examples/curl/apps_get_logs_active_deployment_aggregate.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/apps/{app_id}/logs" diff --git a/examples/digital-ocean-api/resources/apps/examples/curl/apps_get_logs_aggregate.yml b/examples/digital-ocean-api/resources/apps/examples/curl/apps_get_logs_aggregate.yml new file mode 100644 index 000000000..c9d459a9e --- /dev/null +++ b/examples/digital-ocean-api/resources/apps/examples/curl/apps_get_logs_aggregate.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/apps/{app_id}/deployments/{deployment_id}/logs" diff --git a/examples/digital-ocean-api/resources/apps/examples/curl/apps_get_metrics_bandwidth_usage.yml b/examples/digital-ocean-api/resources/apps/examples/curl/apps_get_metrics_bandwidth_usage.yml new file mode 100644 index 000000000..0dea72637 --- /dev/null +++ b/examples/digital-ocean-api/resources/apps/examples/curl/apps_get_metrics_bandwidth_usage.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/apps/{id}/metrics/bandwidth_daily" diff --git a/examples/digital-ocean-api/resources/apps/examples/curl/apps_list_metrics_bandwidth_usage.yml b/examples/digital-ocean-api/resources/apps/examples/curl/apps_list_metrics_bandwidth_usage.yml new file mode 100644 index 000000000..6a1d3f025 --- /dev/null +++ b/examples/digital-ocean-api/resources/apps/examples/curl/apps_list_metrics_bandwidth_usage.yml @@ -0,0 +1,7 @@ +lang: cURL +source: |- + curl -X POST \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $DIGITALOCEAN_TOKEN" \ + "https://api.digitalocean.com/v2/apps/metrics/bandwidth_daily" \ + -d '{ "app_ids": ["4f6c71e2-1e90-4762-9fee-6cc4a0a9f2cf"] }' diff --git a/examples/digital-ocean-api/resources/apps/models/app_domain_validation.yml b/examples/digital-ocean-api/resources/apps/models/app_domain_validation.yml new file mode 100644 index 000000000..f7a2f6eec --- /dev/null +++ b/examples/digital-ocean-api/resources/apps/models/app_domain_validation.yml @@ -0,0 +1,11 @@ +properties: + "txt_name": + title: "TXT record name" + type: string + readOnly: true + example: "_acme-challenge.app.example.com" + "txt_value": + title: "TXT record value" + type: string + readOnly: true + example: "lXLOcN6cPv0nproViNcUHcahD9TrIPlNgdwesj0pYpk" diff --git a/examples/digital-ocean-api/resources/apps/models/app_metrics_bandwidth_usage.yml b/examples/digital-ocean-api/resources/apps/models/app_metrics_bandwidth_usage.yml new file mode 100644 index 000000000..78faf7162 --- /dev/null +++ b/examples/digital-ocean-api/resources/apps/models/app_metrics_bandwidth_usage.yml @@ -0,0 +1,12 @@ +type: object +properties: + app_bandwidth_usage: + type: array + items: + $ref: ../models/app_metrics_bandwidth_usage_details.yml + description: 'A list of bandwidth usage details by app.' + date: + type: string + format: date-time + description: 'The date for the metrics data.' + example: 2023-01-17T00:00:00Z diff --git a/examples/digital-ocean-api/resources/apps/models/app_metrics_bandwidth_usage_details.yml b/examples/digital-ocean-api/resources/apps/models/app_metrics_bandwidth_usage_details.yml new file mode 100644 index 000000000..55e5944a2 --- /dev/null +++ b/examples/digital-ocean-api/resources/apps/models/app_metrics_bandwidth_usage_details.yml @@ -0,0 +1,12 @@ +type: object +properties: + app_id: + type: string + description: 'The ID of the app.' + example: 4f6c71e2-1e90-4762-9fee-6cc4a0a9f2cf + bandwidth_bytes: + type: string + format: uint64 + description: 'The used bandwidth amount in bytes.' + example: '513668' +description: 'Bandwidth usage for an app.' diff --git a/examples/digital-ocean-api/resources/apps/models/app_metrics_bandwidth_usage_request.yml b/examples/digital-ocean-api/resources/apps/models/app_metrics_bandwidth_usage_request.yml new file mode 100644 index 000000000..aaba27660 --- /dev/null +++ b/examples/digital-ocean-api/resources/apps/models/app_metrics_bandwidth_usage_request.yml @@ -0,0 +1,18 @@ +type: object +properties: + app_ids: + type: array + items: + type: string + description: 'A list of app IDs to query bandwidth metrics for.' + maxItems: 100 + example: + - 4f6c71e2-1e90-4762-9fee-6cc4a0a9f2cf + - c2a93513-8d9b-4223-9d61-5e7272c81cf5 + date: + type: string + format: date-time + description: 'Optional day to query. Only the date component of the timestamp will be considered. Default: yesterday.' + example: 2023-01-17T00:00:00Z +required: + - app_ids diff --git a/examples/digital-ocean-api/resources/apps/responses/get_metrics_bandwidth_usage.yml b/examples/digital-ocean-api/resources/apps/responses/get_metrics_bandwidth_usage.yml new file mode 100644 index 000000000..460a9785b --- /dev/null +++ b/examples/digital-ocean-api/resources/apps/responses/get_metrics_bandwidth_usage.yml @@ -0,0 +1,17 @@ +description: 'A JSON object with a `app_bandwidth_usage` key' + +content: + application/json: + schema: + $ref: ../models/app_metrics_bandwidth_usage.yml + examples: + app_bandwidth_usage: + $ref: examples.yml#/app_bandwidth_usage + +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 diff --git a/examples/digital-ocean-api/resources/apps/responses/list_metrics_bandwidth_usage.yml b/examples/digital-ocean-api/resources/apps/responses/list_metrics_bandwidth_usage.yml new file mode 100644 index 000000000..039642198 --- /dev/null +++ b/examples/digital-ocean-api/resources/apps/responses/list_metrics_bandwidth_usage.yml @@ -0,0 +1,17 @@ +description: 'A JSON object with a `app_bandwidth_usage` key' + +content: + application/json: + schema: + $ref: ../models/app_metrics_bandwidth_usage.yml + examples: + app_bandwidth_usage: + $ref: examples.yml#/app_bandwidth_usage_multiple + +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 diff --git a/examples/digital-ocean-api/resources/databases/databases_promote_replica.yml b/examples/digital-ocean-api/resources/databases/databases_promote_replica.yml new file mode 100644 index 000000000..d7a214340 --- /dev/null +++ b/examples/digital-ocean-api/resources/databases/databases_promote_replica.yml @@ -0,0 +1,48 @@ +operationId: databases_promote_replica + +summary: Promote a Read-only Replica to become a Primary Cluster + +description: >- + To promote a specific read-only replica, send a PUT request to + `/v2/databases/$DATABASE_ID/replicas/$REPLICA_NAME/promote`. + + + **Note**: Read-only replicas are not supported for Redis clusters. + + + A status of 204 will be given. This indicates that the request was processed + successfully, but that no response body is needed. + +tags: + - Databases + +parameters: + - $ref: 'parameters.yml#/database_cluster_uuid' + - $ref: 'parameters.yml#/replica_name' + +responses: + '204': + $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/databases_promote_replica.yml' + - $ref: 'examples/go/databases_promote_replica.yml' + +security: + - bearer_auth: + - 'write' diff --git a/examples/digital-ocean-api/resources/databases/databases_update_connectionPool.yml b/examples/digital-ocean-api/resources/databases/databases_update_connectionPool.yml new file mode 100644 index 000000000..1869b0486 --- /dev/null +++ b/examples/digital-ocean-api/resources/databases/databases_update_connectionPool.yml @@ -0,0 +1,54 @@ +operationId: databases_update_connectionPool + +summary: Update Connection Pools (PostgreSQL) + +description: >- + To update a connection pool for a PostgreSQL database cluster, send a PUT request to + `/v2/databases/$DATABASE_ID/pools/$POOL_NAME`. + +tags: + - Databases + +requestBody: + required: true + content: + application/json: + schema: + $ref: 'models/connection_pool_update.yml' + example: + mode: transaction + size: 10 + db: defaultdb + user: doadmin + +parameters: + - $ref: 'parameters.yml#/database_cluster_uuid' + - $ref: 'parameters.yml#/pool_name' + +responses: + '204': + $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/databases_update_connectionPool.yml' + - $ref: 'examples/go/databases_update_connectionPool.yml' + +security: + - bearer_auth: + - 'read' + diff --git a/examples/digital-ocean-api/resources/databases/databases_upgrade_major_version.yml b/examples/digital-ocean-api/resources/databases/databases_upgrade_major_version.yml new file mode 100644 index 000000000..ea16c9b3c --- /dev/null +++ b/examples/digital-ocean-api/resources/databases/databases_upgrade_major_version.yml @@ -0,0 +1,52 @@ +operationId: databases_update_major_version + +summary: Upgrade Major Version for a Database + +description: >- + To upgrade the major version of a database, send a PUT + request to `/v2/databases/$DATABASE_ID/upgrade`, specifying the target + version. + + A successful request will receive a 204 No Content status code with no body + in response. + +tags: + - Databases + +parameters: + - $ref: 'parameters.yml#/database_cluster_uuid' + +requestBody: + required: true + content: + application/json: + schema: + $ref: 'models/version.yml' + example: + version: '14' + +responses: + '204': + $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/databases_upgrade_version.yml' + +security: + - bearer_auth: + - 'write' diff --git a/examples/digital-ocean-api/resources/databases/examples/curl/databases_promote_replica.yml b/examples/digital-ocean-api/resources/databases/examples/curl/databases_promote_replica.yml new file mode 100644 index 000000000..3190c6b4a --- /dev/null +++ b/examples/digital-ocean-api/resources/databases/examples/curl/databases_promote_replica.yml @@ -0,0 +1,6 @@ +lang: cURL +source: |- + curl -X PUT \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $DIGITALOCEAN_TOKEN" \ + "https://api.digitalocean.com/v2/databases/9cc10173-e9ea-4176-9dbc-a4cee4c4ff30/replicas/read-nyc3-01/promote" diff --git a/examples/digital-ocean-api/resources/databases/examples/curl/databases_update_connectionPool.yml b/examples/digital-ocean-api/resources/databases/examples/curl/databases_update_connectionPool.yml new file mode 100644 index 000000000..4191a0fc8 --- /dev/null +++ b/examples/digital-ocean-api/resources/databases/examples/curl/databases_update_connectionPool.yml @@ -0,0 +1,7 @@ +lang: cURL +source: |- + curl -X PUT \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $DIGITALOCEAN_TOKEN" \ + -d '{"mode": "transaction", "size": 15, "db": "defaultdb", "user": "doadmin"}' \ + "https://api.digitalocean.com/v2/databases/9cc10173-e9ea-4176-9dbc-a4cee4c4ff30/pools/backend-pool" diff --git a/examples/digital-ocean-api/resources/databases/examples/curl/databases_upgrade_version.yml b/examples/digital-ocean-api/resources/databases/examples/curl/databases_upgrade_version.yml new file mode 100644 index 000000000..a7f91f0a5 --- /dev/null +++ b/examples/digital-ocean-api/resources/databases/examples/curl/databases_upgrade_version.yml @@ -0,0 +1,7 @@ +lang: cURL +source: |- + curl -X PUT \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $DIGITALOCEAN_TOKEN" \ + -d '{"version":"14"}' \ + "https://api.digitalocean.com/v2/databases/9cdb64e5-61e4-4b30-b711-11ef66d84558/upgrade" diff --git a/examples/digital-ocean-api/resources/databases/examples/go/databases_promote_replica.yml b/examples/digital-ocean-api/resources/databases/examples/go/databases_promote_replica.yml new file mode 100644 index 000000000..afaf8d3bf --- /dev/null +++ b/examples/digital-ocean-api/resources/databases/examples/go/databases_promote_replica.yml @@ -0,0 +1,17 @@ +lang: Go +source: |- + import ( + "context" + "os" + + "github.com/digitalocean/godo" + ) + + func main() { + token := os.Getenv("DIGITALOCEAN_TOKEN") + + client := godo.NewFromToken(token) + ctx := context.TODO() + + _, err := client.Databases.PromoteReplicaToPrimary(ctx, "9cc10173-e9ea-4176-9dbc-a4cee4c4ff30", "read-nyc3-01") + } diff --git a/examples/digital-ocean-api/resources/databases/examples/go/databases_update_connectionPool.yml b/examples/digital-ocean-api/resources/databases/examples/go/databases_update_connectionPool.yml new file mode 100644 index 000000000..e6fdd29e1 --- /dev/null +++ b/examples/digital-ocean-api/resources/databases/examples/go/databases_update_connectionPool.yml @@ -0,0 +1,23 @@ +lang: Go +source: |- + import ( + "context" + "github.com/digitalocean/godo" + ) + + func main() { + pat := "mytoken" + + client := godo.NewFromToken(pat) + ctx := context.TODO() + + updateReq := &godo.DatabaseUpdatePoolRequest{ + User: "doadmin", + Size: 15, + Database: "defaultdb", + Mode: "transaction", + } + + _, err := client.Databases.UpdatePool(ctx, "9cc10173-e9ea-4176-9dbc-a4cee4c4ff30", "backend-pool", updateReq) + + } diff --git a/examples/digital-ocean-api/resources/databases/models/connection_pool_update.yml b/examples/digital-ocean-api/resources/databases/models/connection_pool_update.yml new file mode 100644 index 000000000..ed3c6388f --- /dev/null +++ b/examples/digital-ocean-api/resources/databases/models/connection_pool_update.yml @@ -0,0 +1,35 @@ +type: object + +properties: + mode: + type: string + description: >- + The PGBouncer transaction mode for the connection pool. The allowed + values are session, transaction, and statement. + example: transaction + size: + type: integer + format: int32 + description: >- + The desired size of the PGBouncer connection pool. The maximum allowed + size is determined by the size of the cluster's primary node. 25 backend + server connections are allowed for every 1GB of RAM. Three are reserved + for maintenance. For example, a primary node with 1 GB of RAM allows for + a maximum of 22 backend server connections while one with 4 GB would + allow for 97. Note that these are shared across all connection pools in + a cluster. + example: 10 + db: + type: string + description: The database for use with the connection pool. + example: defaultdb + user: + type: string + description: >- + The name of the user for use with the connection pool. When excluded, + all sessions connect to the database as the inbound user. + example: doadmin +required: + - mode + - size + - db diff --git a/examples/digital-ocean-api/resources/databases/models/database_version_availabilities.yml b/examples/digital-ocean-api/resources/databases/models/database_version_availabilities.yml new file mode 100644 index 000000000..c9ae48e89 --- /dev/null +++ b/examples/digital-ocean-api/resources/databases/models/database_version_availabilities.yml @@ -0,0 +1,5 @@ +type: array +description: >- + An array of objects, each indicating the version end-of-life, end-of-availability for various database engines +items: + $ref: './database_version_availability.yml' \ No newline at end of file diff --git a/examples/digital-ocean-api/resources/databases/models/database_version_availability.yml b/examples/digital-ocean-api/resources/databases/models/database_version_availability.yml new file mode 100644 index 000000000..b935c746e --- /dev/null +++ b/examples/digital-ocean-api/resources/databases/models/database_version_availability.yml @@ -0,0 +1,20 @@ +type: object + +properties: + end_of_life: + type: string + example: '2023-11-09T00:00:00Z' + description: >- + A timestamp referring to the date when the particular version will no longer be supported. If null, the version + does not have an end of life timeline. + end_of_availability: + type: string + example: '2023-05-09T00:00:00Z' + description: >- + A timestamp referring to the date when the particular version will no longer be available for creating new + clusters. If null, the version does not have an end of availability timeline. + version: + type: string + example: '8' + description: The engine version. + diff --git a/examples/digital-ocean-api/resources/databases/models/version.yml b/examples/digital-ocean-api/resources/databases/models/version.yml new file mode 100644 index 000000000..751cfc843 --- /dev/null +++ b/examples/digital-ocean-api/resources/databases/models/version.yml @@ -0,0 +1,5 @@ +type: object + +properties: + version: + $ref: './database_cluster.yml#/properties/version' \ No newline at end of file diff --git a/examples/digital-ocean-api/resources/domains/examples/curl/domains_patch_record.yml b/examples/digital-ocean-api/resources/domains/examples/curl/domains_patch_record.yml new file mode 100644 index 000000000..1cd0f82ad --- /dev/null +++ b/examples/digital-ocean-api/resources/domains/examples/curl/domains_patch_record.yml @@ -0,0 +1,7 @@ +lang: cURL +source: |- + curl -X PATCH \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $DIGITALOCEAN_TOKEN" \ + -d '{"name":"blog","type":"A"}' \ + "https://api.digitalocean.com/v2/domains/example.com/records/3352896" diff --git a/examples/digital-ocean-api/resources/functions/examples/curl/create_trigger.yml b/examples/digital-ocean-api/resources/functions/examples/curl/create_trigger.yml new file mode 100644 index 000000000..f084d6a19 --- /dev/null +++ b/examples/digital-ocean-api/resources/functions/examples/curl/create_trigger.yml @@ -0,0 +1,7 @@ +lang: cURL +source: |- + curl -X POST \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $DIGITALOCEAN_TOKEN" \ + -d '{"name": "my trigger", "function": "hello", "type": "SCHEDULED", "is_enabled": true, "scheduled_details": {"cron": "* * * * *", "body": {"name": "Welcome to DO!"}}}' \ + "https://api.digitalocean.com/v2/functions/namespaces/{{namespace_id}}/triggers" diff --git a/examples/digital-ocean-api/resources/functions/examples/curl/delete_trigger.yml b/examples/digital-ocean-api/resources/functions/examples/curl/delete_trigger.yml new file mode 100644 index 000000000..e62503772 --- /dev/null +++ b/examples/digital-ocean-api/resources/functions/examples/curl/delete_trigger.yml @@ -0,0 +1,5 @@ +lang: cURL +source: |- + curl -X DELETE \ + -H "Authorization: Bearer $DIGITALOCEAN_TOKEN" \ + "https://api.digitalocean.com/v2/functions/namespaces/{{namespace_id}}/triggers/{{trigger_name}}" diff --git a/examples/digital-ocean-api/resources/functions/examples/curl/get_trigger.yml b/examples/digital-ocean-api/resources/functions/examples/curl/get_trigger.yml new file mode 100644 index 000000000..375124087 --- /dev/null +++ b/examples/digital-ocean-api/resources/functions/examples/curl/get_trigger.yml @@ -0,0 +1,5 @@ +lang: cURL +source: |- + curl -X GET \ + -H "Authorization: Bearer $DIGITALOCEAN_TOKEN" \ + "https://api.digitalocean.com/v2/functions/namespaces/{{namespace_id}}/triggers/{{trigger_name}}" diff --git a/examples/digital-ocean-api/resources/functions/examples/curl/list_triggers.yml b/examples/digital-ocean-api/resources/functions/examples/curl/list_triggers.yml new file mode 100644 index 000000000..24d3c12fb --- /dev/null +++ b/examples/digital-ocean-api/resources/functions/examples/curl/list_triggers.yml @@ -0,0 +1,5 @@ +lang: cURL +source: |- + curl -X GET \ + -H "Authorization: Bearer $DIGITALOCEAN_TOKEN" \ + "https://api.digitalocean.com/v2/functions/namespaces/{{namespace_id}}/triggers" diff --git a/examples/digital-ocean-api/resources/functions/examples/curl/update_trigger.yml b/examples/digital-ocean-api/resources/functions/examples/curl/update_trigger.yml new file mode 100644 index 000000000..16ce2e236 --- /dev/null +++ b/examples/digital-ocean-api/resources/functions/examples/curl/update_trigger.yml @@ -0,0 +1,7 @@ +lang: cURL +source: |- + curl -X PUT \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $DIGITALOCEAN_TOKEN" \ + -d '{"is_enabled": true, "scheduled_details": {"cron": "* * * * *", "body": {"name": "Welcome to DO!"}}}' \ + "https://api.digitalocean.com/v2/functions/namespaces/{{namespace_id}}/triggers/{{trigger_name}}" diff --git a/examples/digital-ocean-api/resources/functions/functions_create_trigger.yml b/examples/digital-ocean-api/resources/functions/functions_create_trigger.yml new file mode 100644 index 000000000..aefd24246 --- /dev/null +++ b/examples/digital-ocean-api/resources/functions/functions_create_trigger.yml @@ -0,0 +1,51 @@ +operationId: functions_create_trigger + +summary: Create Trigger + +description: >- + Creates a new trigger for a given function in a namespace. To create a trigger, send a POST request to `/v2/functions/namespaces/$NAMESPACE_ID/triggers` with the `name`, `function`, `type`, `is_enabled` and `scheduled_details` properties. + +parameters: + - $ref: 'parameters.yml#/namespace_id' + +requestBody: + required: true + content: + application/json: + schema: + $ref: 'models/create_trigger.yml' + +tags: + - Functions + +responses: + '200': + $ref: 'responses/trigger_response.yml' + + '401': + $ref: '../../shared/responses/unauthorized.yml' + + '400': + $ref: 'responses/trigger_bad_request.yml' + + '404': + $ref: 'responses/namespace_not_found.yml' + + '422': + $ref: 'responses/trigger_limit_reached.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/create_trigger.yml' + +security: + - bearer_auth: + - 'write' diff --git a/examples/digital-ocean-api/resources/functions/functions_delete_trigger.yml b/examples/digital-ocean-api/resources/functions/functions_delete_trigger.yml new file mode 100644 index 000000000..a5a68202d --- /dev/null +++ b/examples/digital-ocean-api/resources/functions/functions_delete_trigger.yml @@ -0,0 +1,43 @@ +operationId: functions_delete_trigger + +summary: Delete Trigger + +description: >- + Deletes the given trigger. + + To delete trigger, send a DELETE request to `/v2/functions/namespaces/$NAMESPACE_ID/triggers/$TRIGGER_NAME`. + + A successful deletion returns a 204 response. + +tags: + - Functions + +parameters: + - $ref: 'parameters.yml#/namespace_id' + - $ref: 'parameters.yml#/trigger_name' + +responses: + '204': + $ref: '../../shared/responses/no_content.yml' + + '401': + $ref: '../../shared/responses/unauthorized.yml' + + '404': + $ref: 'responses/trigger_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/delete_trigger.yml' + +security: + - bearer_auth: + - 'read' diff --git a/examples/digital-ocean-api/resources/functions/functions_get_trigger.yml b/examples/digital-ocean-api/resources/functions/functions_get_trigger.yml new file mode 100644 index 000000000..f22faaa1e --- /dev/null +++ b/examples/digital-ocean-api/resources/functions/functions_get_trigger.yml @@ -0,0 +1,40 @@ +operationId: functions_get_trigger + +summary: Get Trigger + +description: >- + Gets the trigger details. + To get the trigger details, send a GET request to `/v2/functions/namespaces/$NAMESPACE_ID/triggers/$TRIGGER_NAME`. + +parameters: + - $ref: 'parameters.yml#/namespace_id' + - $ref: 'parameters.yml#/trigger_name' + +tags: + - Functions + +responses: + '200': + $ref: 'responses/trigger_response.yml' + + '401': + $ref: '../../shared/responses/unauthorized.yml' + + '404': + $ref: 'responses/trigger_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/get_trigger.yml' + +security: + - bearer_auth: + - 'read' diff --git a/examples/digital-ocean-api/resources/functions/functions_list_triggers.yml b/examples/digital-ocean-api/resources/functions/functions_list_triggers.yml new file mode 100644 index 000000000..90a0cc3c6 --- /dev/null +++ b/examples/digital-ocean-api/resources/functions/functions_list_triggers.yml @@ -0,0 +1,39 @@ +operationId: functions_list_triggers + +summary: List Triggers + +description: >- + Returns a list of triggers associated with the current user and namespace. + To get all triggers, send a GET request to `/v2/functions/namespaces/$NAMESPACE_ID/triggers`. + +parameters: + - $ref: 'parameters.yml#/namespace_id' + +tags: + - Functions + +responses: + '200': + $ref: 'responses/list_triggers.yml' + + '401': + $ref: '../../shared/responses/unauthorized.yml' + + '404': + $ref: 'responses/namespace_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/list_triggers.yml' + +security: + - bearer_auth: + - 'read' diff --git a/examples/digital-ocean-api/resources/functions/functions_update_trigger.yml b/examples/digital-ocean-api/resources/functions/functions_update_trigger.yml new file mode 100644 index 000000000..609c0cead --- /dev/null +++ b/examples/digital-ocean-api/resources/functions/functions_update_trigger.yml @@ -0,0 +1,49 @@ +operationId: functions_update_trigger + +summary: Update Trigger + +description: >- + Updates the details of the given trigger. To update a trigger, send a PUT request to `/v2/functions/namespaces/$NAMESPACE_ID/triggers/$TRIGGER_NAME` with new values for the `is_enabled ` or `scheduled_details` properties. + +parameters: + - $ref: 'parameters.yml#/namespace_id' + - $ref: 'parameters.yml#/trigger_name' + +requestBody: + required: true + content: + application/json: + schema: + $ref: 'models/update_trigger.yml' + +tags: + - Functions + +responses: + '200': + $ref: 'responses/trigger_response.yml' + + '401': + $ref: '../../shared/responses/unauthorized.yml' + + '400': + $ref: 'responses/trigger_bad_request.yml' + + '404': + $ref: 'responses/trigger_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/update_trigger.yml' + +security: + - bearer_auth: + - 'write' diff --git a/examples/digital-ocean-api/resources/functions/models/create_trigger.yml b/examples/digital-ocean-api/resources/functions/models/create_trigger.yml new file mode 100644 index 000000000..d5c525a54 --- /dev/null +++ b/examples/digital-ocean-api/resources/functions/models/create_trigger.yml @@ -0,0 +1,31 @@ +type: object +properties: + name: + type: string + example: my trigger + description: The trigger's unique name within the namespace. + + function: + type: string + example: hello + description: Name of function(action) that exists in the given namespace. + + type: + type: string + example: SCHEDULED + description: One of different type of triggers. Currently only SCHEDULED is supported. + + is_enabled: + type: boolean + example: true + description: Indicates weather the trigger is paused or unpaused. + + scheduled_details: + $ref: './scheduled_details.yml' + +required: + - name + - function + - type + - is_enabled + - scheduled_details diff --git a/examples/digital-ocean-api/resources/functions/models/scheduled_details.yml b/examples/digital-ocean-api/resources/functions/models/scheduled_details.yml new file mode 100644 index 000000000..b6145b917 --- /dev/null +++ b/examples/digital-ocean-api/resources/functions/models/scheduled_details.yml @@ -0,0 +1,22 @@ +type: object + +description: | + Trigger details for SCHEDULED type, where body is optional. + +properties: + cron: + description: valid cron expression string which is required for SCHEDULED type triggers. + type: string + example: '* * * * *' + + body: + description: Optional data to be sent to function while triggering the function. + type: object + nullable: true + properties: + name: + type: string + example: Welcome to DO! + +required: + - cron diff --git a/examples/digital-ocean-api/resources/functions/models/trigger_info.yml b/examples/digital-ocean-api/resources/functions/models/trigger_info.yml new file mode 100644 index 000000000..57579dcec --- /dev/null +++ b/examples/digital-ocean-api/resources/functions/models/trigger_info.yml @@ -0,0 +1,55 @@ +type: object + +properties: + namespace: + type: string + example: fn-xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx + description: A unique string format of UUID with a prefix fn-. + + name: + type: string + example: my trigger + description: The trigger's unique name within the namespace. + + function: + type: string + example: hello + description: Name of function(action) that exists in the given namespace. + + type: + type: string + example: SCHEDULED + description: String which indicates the type of trigger source like SCHEDULED. + + is_enabled: + type: boolean + example: true + description: Indicates weather the trigger is paused or unpaused. + + created_at: + type: string + example: 2022-11-11T04:16:45Z + description: UTC time string. + + updated_at: + type: string + example: 2022-11-11T04:16:45Z + description: UTC time string. + + scheduled_details: + $ref: './scheduled_details.yml' + + scheduled_runs: + type: object + properties: + last_run_at: + description: Indicates last run time. null value indicates trigger not run yet. + type: string + nullable: true + example: 2022-11-11T04:16:45Z + + next_run_at: + description: Indicates next run time. null value indicates trigger will not run. + type: string + nullable: true + example: 2022-11-11T04:16:45Z diff --git a/examples/digital-ocean-api/resources/functions/models/update_trigger.yml b/examples/digital-ocean-api/resources/functions/models/update_trigger.yml new file mode 100644 index 000000000..ed48c6bdc --- /dev/null +++ b/examples/digital-ocean-api/resources/functions/models/update_trigger.yml @@ -0,0 +1,9 @@ +type: object +properties: + is_enabled: + type: boolean + example: true + description: Indicates weather the trigger is paused or unpaused. + + scheduled_details: + $ref: './scheduled_details.yml' diff --git a/examples/digital-ocean-api/resources/functions/responses/list_triggers.yml b/examples/digital-ocean-api/resources/functions/responses/list_triggers.yml new file mode 100644 index 000000000..ef9339c09 --- /dev/null +++ b/examples/digital-ocean-api/resources/functions/responses/list_triggers.yml @@ -0,0 +1,22 @@ +description: |- + An array of JSON objects with a key called `namespaces`. Each object represents a namespace and contains + the properties associated with it. + +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: + triggers: + type: array + items: + $ref: '../models/trigger_info.yml' diff --git a/examples/digital-ocean-api/resources/functions/responses/trigger_bad_request.yml b/examples/digital-ocean-api/resources/functions/responses/trigger_bad_request.yml new file mode 100644 index 000000000..57f72ec99 --- /dev/null +++ b/examples/digital-ocean-api/resources/functions/responses/trigger_bad_request.yml @@ -0,0 +1,19 @@ + +description: Bad Request. + +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: + $ref: '../../../shared/models/error.yml' + example: + id: bad_request + message: 'validating create trigger: validation error: missing trigger name, missing function name, missing source details' + request_id: 4851a473-1621-42ea-b2f9-5071c0ea8414 diff --git a/examples/digital-ocean-api/resources/functions/responses/trigger_limit_reached.yml b/examples/digital-ocean-api/resources/functions/responses/trigger_limit_reached.yml new file mode 100644 index 000000000..7b9a23a7f --- /dev/null +++ b/examples/digital-ocean-api/resources/functions/responses/trigger_limit_reached.yml @@ -0,0 +1,19 @@ + +description: Limit Reached + +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: + $ref: '../../../shared/models/error.yml' + example: + id: unprocessable_entity + message: 'triggers limit reached' + request_id: 7ba99a43-6618-4fe0-9af7-092752ad0d56 diff --git a/examples/digital-ocean-api/resources/functions/responses/trigger_not_found.yml b/examples/digital-ocean-api/resources/functions/responses/trigger_not_found.yml new file mode 100644 index 000000000..f5296a7e0 --- /dev/null +++ b/examples/digital-ocean-api/resources/functions/responses/trigger_not_found.yml @@ -0,0 +1,25 @@ +description: Bad Request. + +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: + $ref: '../../../shared/models/error.yml' + examples: + "namespace not found": + value: + id: not_found + message: 'namespace not found' + request_id: 88d17b7a-630b-4083-99ce-5b91045efdb4 + "trigger not found": + value: + id: not_found + message: 'trigger not found' + request_id: 88d17b7a-630b-4083-99ce-5b91045efdb4 diff --git a/examples/digital-ocean-api/resources/functions/responses/trigger_response.yml b/examples/digital-ocean-api/resources/functions/responses/trigger_response.yml new file mode 100644 index 000000000..3ee873258 --- /dev/null +++ b/examples/digital-ocean-api/resources/functions/responses/trigger_response.yml @@ -0,0 +1,20 @@ + +description: |- + A JSON response object with a key called `trigger`. The object contains the properties associated + with the trigger. + +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: + type: object + properties: + trigger: + $ref: '../models/trigger_info.yml' diff --git a/examples/digital-ocean-api/resources/kubernetes/examples/curl/kubernetes_get_clusterUser.yml b/examples/digital-ocean-api/resources/kubernetes/examples/curl/kubernetes_get_clusterUser.yml new file mode 100644 index 000000000..16277eb5c --- /dev/null +++ b/examples/digital-ocean-api/resources/kubernetes/examples/curl/kubernetes_get_clusterUser.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/kubernetes/clusters/bd5f5959-5e1e-4205-a714-a914373942af/user" diff --git a/examples/digital-ocean-api/resources/load_balancers/models/lb_firewall.yml b/examples/digital-ocean-api/resources/load_balancers/models/lb_firewall.yml new file mode 100644 index 000000000..ea31caf6e --- /dev/null +++ b/examples/digital-ocean-api/resources/load_balancers/models/lb_firewall.yml @@ -0,0 +1,24 @@ +type: object + +description: An object specifying allow and deny rules to control traffic to the load balancer. + +properties: + deny: + type: array + items: + type: string + example: + - ip:1.2.3.4 + - cidr:2.3.0.0/16 + default: [] + description: the rules for denying traffic to the load balancer (in the form 'ip:1.2.3.4' or 'cidr:1.2.0.0/16') + + allow: + type: array + items: + type: string + example: + - ip:1.2.3.4 + - cidr:2.3.0.0/16 + default: [] + description: the rules for allowing traffic to the load balancer (in the form 'ip:1.2.3.4' or 'cidr:1.2.0.0/16') diff --git a/examples/digital-ocean-api/resources/volumes/examples/curl/volumeSnapshots_get_byId.yml b/examples/digital-ocean-api/resources/volumes/examples/curl/volumeSnapshots_get_byId.yml new file mode 100644 index 000000000..7fca59e65 --- /dev/null +++ b/examples/digital-ocean-api/resources/volumes/examples/curl/volumeSnapshots_get_byId.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/volumes/snapshots/fbe805e8-866b-11e6-96bf-000f53315a41"