diff --git a/specification/DigitalOcean-public.v2.yaml b/specification/DigitalOcean-public.v2.yaml index 9bdbd9d1..f9907767 100644 --- a/specification/DigitalOcean-public.v2.yaml +++ b/specification/DigitalOcean-public.v2.yaml @@ -720,6 +720,10 @@ paths: get: $ref: "resources/apps/apps_get_job_invocation.yml" + /v2/apps/{app_id}/job-invocations/{job_invocation_id}/cancel: + post: + $ref: "resources/apps/apps_cancel_job_invocation.yml" + /v2/apps/{app_id}/jobs/{job_name}/invocations/{job_invocation_id}/logs: get: $ref: "resources/apps/apps_get_job_invocation_logs.yml" diff --git a/specification/resources/apps/apps_cancel_job_invocation.yml b/specification/resources/apps/apps_cancel_job_invocation.yml new file mode 100644 index 00000000..8894dd09 --- /dev/null +++ b/specification/resources/apps/apps_cancel_job_invocation.yml @@ -0,0 +1,41 @@ +operationId: apps_cancel_job_invocation + +summary: Cancel Job Invocation + +description: Cancel a specific job invocation for an app. + +tags: +- Apps + +parameters: + - $ref: parameters.yml#/app_id + - $ref: parameters.yml#/job_invocation_id + - $ref: parameters.yml#/job_name + +responses: + "200": + $ref: responses/cancel_job_invocation.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_cancel_job_invocation.yml' + - $ref: 'examples/python/apps_cancel_job_invocation.yml' + +security: + - bearer_auth: + - 'app:update' + diff --git a/specification/resources/apps/examples/curl/apps_cancel_job_invocation.yml b/specification/resources/apps/examples/curl/apps_cancel_job_invocation.yml new file mode 100644 index 00000000..a3fe6193 --- /dev/null +++ b/specification/resources/apps/examples/curl/apps_cancel_job_invocation.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}/job-invocations/{job_invocation_id}/cancel" \ No newline at end of file diff --git a/specification/resources/apps/examples/python/apps_cancel_job_invocation.yml b/specification/resources/apps/examples/python/apps_cancel_job_invocation.yml new file mode 100644 index 00000000..4ccda7e5 --- /dev/null +++ b/specification/resources/apps/examples/python/apps_cancel_job_invocation.yml @@ -0,0 +1,8 @@ +lang: Python +source: |- + import os + from pydo import Client + + client = Client(token=os.environ.get("DIGITALOCEAN_TOKEN")) + + get_resp = client.apps.cancel_job_invocation(app_id="4f6c71e2", job_invocation_id="3aa4d20e") \ No newline at end of file diff --git a/specification/resources/apps/responses/cancel_job_invocation.yml b/specification/resources/apps/responses/cancel_job_invocation.yml new file mode 100644 index 00000000..1b146458 --- /dev/null +++ b/specification/resources/apps/responses/cancel_job_invocation.yml @@ -0,0 +1,17 @@ +description: A JSON with key `job_invocation` + +content: + application/json: + schema: + $ref: ../models/app_job_invocation.yml + examples: + job_invocation: + $ref: examples.yml#/job_invocation + +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