Skip to content

Commit

Permalink
APPS-9764 Add docs for restart API (#941)
Browse files Browse the repository at this point in the history
* APPS-9764 Add docs for restart API

* remove required

* add "restart" to valid POST paths to fix linter

* change auth requirement to app:update

---------

Co-authored-by: Andrew Starr-Bochicchio <andrewsomething@users.noreply.github.com>
  • Loading branch information
blesswinsamuel and andrewsomething authored Nov 19, 2024
1 parent de14248 commit 231e5bb
Show file tree
Hide file tree
Showing 6 changed files with 73 additions and 1 deletion.
4 changes: 4 additions & 0 deletions specification/DigitalOcean-public.v2.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
44 changes: 44 additions & 0 deletions specification/resources/apps/apps_restart.yml
Original file line number Diff line number Diff line change
@@ -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"
6 changes: 6 additions & 0 deletions specification/resources/apps/examples/curl/apps_restart.yml
Original file line number Diff line number Diff line change
@@ -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"
8 changes: 8 additions & 0 deletions specification/resources/apps/examples/python/apps_restart.yml
Original file line number Diff line number Diff line change
@@ -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"]})
10 changes: 10 additions & 0 deletions specification/resources/apps/models/apps_restart_request.yml
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion spectral/functions/validateOpIDNaming.js
Original file line number Diff line number Diff line change
Expand Up @@ -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_"]
Expand Down

0 comments on commit 231e5bb

Please sign in to comment.