Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

APPS-9764 Add docs for restart API #941

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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:create"
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
Loading