Skip to content

Commit

Permalink
APPS-9908 Add docs for exec endpoint (#945)
Browse files Browse the repository at this point in the history
* APPS-9908 Add docs for exec endpoint

* update wording
  • Loading branch information
blesswinsamuel authored Nov 13, 2024
1 parent 90e7d90 commit b7a368d
Show file tree
Hide file tree
Showing 10 changed files with 146 additions and 0 deletions.
8 changes: 8 additions & 0 deletions specification/DigitalOcean-public.v2.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -553,6 +553,10 @@ paths:
get:
$ref: 'resources/apps/apps_get_logs_active_deployment.yml'

/v2/apps/{app_id}/components/{component_name}/exec:
get:
$ref: 'resources/apps/apps_get_exec_active_deployment.yml'

/v2/apps/{app_id}/deployments:
get:
$ref: 'resources/apps/apps_list_deployments.yml'
Expand All @@ -575,6 +579,10 @@ paths:
get:
$ref: 'resources/apps/apps_get_logs_aggregate.yml'

/v2/apps/{app_id}/deployments/{deployment_id}/components/{component_name}/exec:
get:
$ref: 'resources/apps/apps_get_exec.yml'

/v2/apps/{app_id}/logs:
get:
$ref: 'resources/apps/apps_get_logs_active_deployment_aggregate.yml'
Expand Down
42 changes: 42 additions & 0 deletions specification/resources/apps/apps_get_exec.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
operationId: apps_get_exec

summary: Retrieve Exec URL for Deployment

description:
Returns a websocket URL that allows sending/receiving console input and output
to a component of the specified deployment if one exists.

tags:
- Apps

parameters:
- $ref: parameters.yml#/app_id
- $ref: parameters.yml#/deployment_id
- $ref: parameters.yml#/component

responses:
"200":
$ref: responses/get_exec.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_exec.yml"
- $ref: "examples/python/apps_get_exec.yml"

security:
- bearer_auth:
- "app:update"
41 changes: 41 additions & 0 deletions specification/resources/apps/apps_get_exec_active_deployment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
operationId: apps_get_exec_active_deployment

summary: Retrieve Exec URL

description:
Returns a websocket URL that allows sending/receiving console input and output
to a component of the active deployment if one exists.

tags:
- Apps

parameters:
- $ref: parameters.yml#/app_id
- $ref: parameters.yml#/component

responses:
"200":
$ref: responses/get_exec.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_exec_active_deployment.yml"
- $ref: "examples/python/apps_get_exec_active_deployment.yml"

security:
- bearer_auth:
- "app:update"
6 changes: 6 additions & 0 deletions specification/resources/apps/examples/curl/apps_get_exec.yml
Original file line number Diff line number Diff line change
@@ -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}/components/{component_name}/exec"
Original file line number Diff line number Diff line change
@@ -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}/exec"
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"))
get_resp = client.apps.get_exec(app_id="4f6c71e2", deployment_id="3aa4d20e", component_name="component")
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"))
get_resp = client.apps.get_exec_active_deployment(app_id="a6adf840", component_name="component")
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
properties:
url:
description: A websocket URL that allows sending/receiving console input and receiving console output.
type: string
example: wss://exec/?token=xxx
type: object
4 changes: 4 additions & 0 deletions specification/resources/apps/responses/examples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -599,6 +599,10 @@ logs:
historic_logs:
- https://logs-example/archive/build.log

exec:
value:
url: wss://exec/?token=xxx

regions:
value:
regions:
Expand Down
17 changes: 17 additions & 0 deletions specification/resources/apps/responses/get_exec.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
description: A JSON object with a websocket URL that allows sending/receiving console input and output.

content:
application/json:
schema:
$ref: ../models/apps_get_exec_response.yml
examples:
exec:
$ref: examples.yml#/exec

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

0 comments on commit b7a368d

Please sign in to comment.