-
Notifications
You must be signed in to change notification settings - Fork 75
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Include DBaaS metrics endpoint operations (#859)
* add metrics auth docs * rm duplicate metrics endpoint definition * split out basic auth obj * add godo examples
- Loading branch information
Showing
12 changed files
with
202 additions
and
0 deletions.
There are no files selected for viewing
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
38 changes: 38 additions & 0 deletions
38
specification/resources/databases/databases_get_cluster_metrics_credentials.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,38 @@ | ||
operationId: databases_get_cluster_metrics_credentials | ||
|
||
summary: Retrieve Database Clusters' Metrics Endpoint Credentials | ||
|
||
description: >- | ||
To show the credentials for all database clusters' metrics endpoints, send a GET request to | ||
`/v2/databases/metrics/credentials`. The result will be a JSON object with a `credentials` key. | ||
tags: | ||
- Databases | ||
|
||
responses: | ||
'200': | ||
$ref: 'responses/database_metrics_auth.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/databases_get_cluster_metrics_credentials.yml' | ||
- $ref: 'examples/go/databases_get_cluster_metrics_credentials.yml' | ||
|
||
security: | ||
- bearer_auth: | ||
- 'write' | ||
|
47 changes: 47 additions & 0 deletions
47
specification/resources/databases/databases_update_cluster_metrics_credentials.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,47 @@ | ||
operationId: databases_update_cluster_metrics_credentials | ||
|
||
summary: Update Database Clusters' Metrics Endpoint Credentials | ||
|
||
description: >- | ||
To update the credentials for all database clusters' metrics endpoints, send a PUT request to | ||
`/v2/databases/metrics/credentials`. A successful request will receive a 204 No Content status code | ||
with no body in response. | ||
tags: | ||
- Databases | ||
|
||
requestBody: | ||
content: | ||
application/json: | ||
schema: | ||
allOf: | ||
- $ref: 'models/database_metrics_credentials.yml' | ||
example: | ||
credentials: | ||
basic_auth_username: "new_username" | ||
basic_auth_password: "new_password" | ||
|
||
responses: | ||
'204': | ||
$ref: '../../shared/responses/no_content.yml' | ||
|
||
'401': | ||
$ref: '../../shared/responses/unauthorized.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/databases_update_cluster_metrics_credentials.yml' | ||
- $ref: 'examples/go/databases_update_cluster_metrics_credentials.yml' | ||
|
||
security: | ||
- bearer_auth: | ||
- 'write' | ||
|
6 changes: 6 additions & 0 deletions
6
...ification/resources/databases/examples/curl/databases_get_cluster_metrics_credentials.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 GET \ | ||
-H "Authorization: Bearer $DIGITALOCEAN_TOKEN" \ | ||
"https://api.digitalocean.com/v2/databases/metrics/credentials" | ||
8 changes: 8 additions & 0 deletions
8
...cation/resources/databases/examples/curl/databases_update_cluster_metrics_credentials.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,8 @@ | ||
lang: cURL | ||
source: |- | ||
curl -X PUT \ | ||
-H "Content-Type: application/json" \ | ||
-H "Authorization: Bearer $DIGITALOCEAN_TOKEN" \ | ||
-d '{"credentials": {"basic_auth_username": "new_username", "basic_auth_password": "new_password"}}'\ | ||
"https://api.digitalocean.com/v2/databases/metrics/credentials" | ||
17 changes: 17 additions & 0 deletions
17
specification/resources/databases/examples/go/databases_get_cluster_metrics_credentials.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: Go | ||
source: |- | ||
import ( | ||
"context" | ||
"os" | ||
"github.com/digitalocean/godo" | ||
) | ||
func main() { | ||
token := os.Getenv("DIGITALOCEAN_TOKEN") | ||
client := godo.NewFromToken(token) | ||
ctx := context.TODO() | ||
creds, _, _ := client.Databases.GetMetricsCredentials(ctx) | ||
} |
22 changes: 22 additions & 0 deletions
22
...fication/resources/databases/examples/go/databases_update_cluster_metrics_credentials.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,22 @@ | ||
lang: Go | ||
source: |- | ||
import ( | ||
"context" | ||
"os" | ||
"github.com/digitalocean/godo" | ||
) | ||
func main() { | ||
token := os.Getenv("DIGITALOCEAN_TOKEN") | ||
client := godo.NewFromToken(token) | ||
ctx := context.TODO() | ||
_, _ = client.Databases.UpdateMetricsCredentials(ctx, &godo.DatabaseUpdateMetricsCredentialsRequest{ | ||
Credentials: &godo.DatabaseMetricsCredentials{ | ||
BasicAuthUsername: "a_new_username", | ||
BasicAuthPassword: "a_new_password", | ||
}, | ||
}) | ||
} |
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
5 changes: 5 additions & 0 deletions
5
specification/resources/databases/models/database_metrics_credentials.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: | ||
credentials: | ||
$ref: "./databases_basic_auth_credentials.yml" |
13 changes: 13 additions & 0 deletions
13
specification/resources/databases/models/database_service_endpoint.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,13 @@ | ||
type: object | ||
|
||
properties: | ||
host: | ||
type: string | ||
description: A FQDN pointing to the database cluster's node(s). | ||
example: backend-do-user-19081923-0.db.ondigitalocean.com | ||
readOnly: true | ||
port: | ||
type: integer | ||
description: The port on which a service is listening. | ||
example: 9273 | ||
readOnly: true |
11 changes: 11 additions & 0 deletions
11
specification/resources/databases/models/databases_basic_auth_credentials.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,11 @@ | ||
type: object | ||
|
||
properties: | ||
basic_auth_username: | ||
type: string | ||
example: username | ||
description: basic authentication username for metrics HTTP endpoint | ||
basic_auth_password: | ||
type: string | ||
example: password | ||
description: basic authentication password for metrics HTTP endpoint |
20 changes: 20 additions & 0 deletions
20
specification/resources/databases/responses/database_metrics_auth.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,20 @@ | ||
description: A JSON object with a key of `credentials`. | ||
|
||
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' | ||
|
||
content: | ||
application/json: | ||
schema: | ||
properties: | ||
credentials: | ||
$ref: '../models/database_metrics_credentials.yml' | ||
example: | ||
credentials: | ||
basic_auth_username: username | ||
basic_auth_password: password |