-
Notifications
You must be signed in to change notification settings - Fork 82
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add toggle database trusted sources OpenAPI specs (#881)
* 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
1 parent
ed09582
commit 7ccf0fc
Showing
5 changed files
with
92 additions
and
0 deletions.
There are no files selected for viewing
48 changes: 48 additions & 0 deletions
48
specification/resources/apps/apps_toggle_database_trusted_source.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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' |
6 changes: 6 additions & 0 deletions
6
specification/resources/apps/examples/curl/apps_toggle_database_trusted_source.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }' |
17 changes: 17 additions & 0 deletions
17
specification/resources/apps/examples/python/apps_toggle_database_trusted_source.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
16 changes: 16 additions & 0 deletions
16
specification/resources/apps/models/toggle_database_trusted_source_request.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
5 changes: 5 additions & 0 deletions
5
specification/resources/apps/responses/toggle_database_trusted_source.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |