diff --git a/specification/DigitalOcean-public.v2.yaml b/specification/DigitalOcean-public.v2.yaml index b89ccbb9..ea66dc4f 100644 --- a/specification/DigitalOcean-public.v2.yaml +++ b/specification/DigitalOcean-public.v2.yaml @@ -549,6 +549,10 @@ paths: put: $ref: 'resources/apps/apps_update.yml' + /v2/apps/{app_id}/restart: + post: + $ref: 'resources/apps/apps_restart.yml' + /v2/apps/{app_id}/components/{component_name}/logs: get: $ref: 'resources/apps/apps_get_logs_active_deployment.yml' diff --git a/specification/resources/apps/apps_restart.yml b/specification/resources/apps/apps_restart.yml new file mode 100755 index 00000000..c59adb20 --- /dev/null +++ b/specification/resources/apps/apps_restart.yml @@ -0,0 +1,44 @@ +operationId: apps_restart + +summary: Restart an App + +description: Perform a rolling restart of all or specific components in an app. + +tags: + - Apps + +parameters: + - $ref: parameters.yml#/app_id + +requestBody: + content: + application/json: + schema: + $ref: models/apps_restart_request.yml + +responses: + "200": + $ref: responses/new_app_deployment.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_restart.yml" + - $ref: "examples/python/apps_restart.yml" + +security: + - bearer_auth: + - "app:update" diff --git a/specification/resources/apps/examples/curl/apps_restart.yml b/specification/resources/apps/examples/curl/apps_restart.yml new file mode 100644 index 00000000..467323f0 --- /dev/null +++ b/specification/resources/apps/examples/curl/apps_restart.yml @@ -0,0 +1,6 @@ +lang: cURL +source: |- + curl -X POST \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $DIGITALOCEAN_TOKEN" \ + "https://api.digitalocean.com/v2/apps/{app_id}/restart" diff --git a/specification/resources/apps/examples/python/apps_restart.yml b/specification/resources/apps/examples/python/apps_restart.yml new file mode 100644 index 00000000..6c979bca --- /dev/null +++ b/specification/resources/apps/examples/python/apps_restart.yml @@ -0,0 +1,8 @@ +lang: Python +source: |- + import os + from pydo import Client + + client = Client(token=os.environ.get("DIGITALOCEAN_TOKEN")) + + create_resp = client.apps.restart(app_id="b6bdf840", body={"components": ["component1", "component2"]}) diff --git a/specification/resources/apps/models/apps_restart_request.yml b/specification/resources/apps/models/apps_restart_request.yml new file mode 100755 index 00000000..915e2b7a --- /dev/null +++ b/specification/resources/apps/models/apps_restart_request.yml @@ -0,0 +1,10 @@ +type: object +properties: + components: + title: Optional list of components to restart. If not provided, all components will be restarted. + type: array + items: + type: string + example: + - component1 + - component2 diff --git a/spectral/functions/validateOpIDNaming.js b/spectral/functions/validateOpIDNaming.js index 80210c8a..8556bfc6 100644 --- a/spectral/functions/validateOpIDNaming.js +++ b/spectral/functions/validateOpIDNaming.js @@ -10,7 +10,7 @@ const GET = ["get", "list"]; const PATCH = ["patch"]; const POST = ["create", "post", "add", "tag", "install", "reset", "upgrade", "recycle", "run", "retry", "validate", "assign", "unassign", "cancel", "list", - "destroy", "delete", "update", "attach", "revert", "commit"]; + "destroy", "delete", "update", "attach", "revert", "commit", "restart"]; const PUT = ["update", "promote", "install"]; const articles = ["_a_", "_an_", "_the_"]