Skip to content

Commit

Permalink
Add toggle database trusted sources OpenAPI specs (#881)
Browse files Browse the repository at this point in the history
* APPS-8263: Add toggle trusted sources openapi specs

* Update specification/resources/apps/examples/python/apps_toggle_database_trusted_source.yml

Co-authored-by: danaelhe <[email protected]>

* Update specification/resources/apps/apps_toggle_database_trusted_source.yml

Co-authored-by: danaelhe <[email protected]>

* Update example format

---------

Co-authored-by: danaelhe <[email protected]>
  • Loading branch information
thearyanahmed and danaelhe authored Jun 11, 2024
1 parent ed09582 commit 7ccf0fc
Show file tree
Hide file tree
Showing 5 changed files with 92 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
operationId: apps_toggle_database_trusted_source

summary: Toggle Database Trusted Source

description: Toggles the trusted source status of a database component for a given app.

tags:
- Apps

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

requestBody:
content:
application/json:
schema:
$ref: models/toggle_database_trusted_source_request.yml
required: true

responses:
"200":
$ref: responses/toggle_database_trusted_source.yml

"400":
$ref: ../../shared/responses/bad_request.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_toggle_database_trusted_source.yml'
- $ref: 'examples/python/apps_toggle_database_trusted_source.yml'

security:
- bearer_auth:
- 'app:update'
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
lang: Curl
source: |-
curl -X POST https://api.digitalocean.com/v2/apps/{app_id}/components/{component_name}/trusted_sources \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $DIGITALOCEAN_TOKEN" \
-d '{ "enable": true }'
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
lang: Python
source: |-
import os
from pydo import Client
client = Client(token=os.environ.get("DIGITALOCEAN_TOKEN"))
app_id = "123e4567-e89b-12d3-a456-426614174000"
component_name = "database"
req = {
"enable": True
}
toggle_resp = client.apps.toggle_database_trusted_source(app_id=app_id, component_name=component_name, body=req)
print(toggle_resp)
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
type: object
properties:
appId:
type: string
format: uuid
description: The ID of the app
componentName:
type: string
description: The name of the component to toggle
enable:
type: boolean
description: Whether to enable or disable the trusted source status
required:
- appId
- componentName
- enable
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
type: object
properties:
isEnabled:
type: boolean
description: Indicates if the trusted source status is enabled

0 comments on commit 7ccf0fc

Please sign in to comment.