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

Add documentation for /monitoring/sinks/** #933

Merged
merged 9 commits into from
Oct 29, 2024
Merged
Show file tree
Hide file tree
Changes from 4 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
26 changes: 26 additions & 0 deletions specification/DigitalOcean-public.v2.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1402,6 +1402,32 @@ paths:
get:
$ref: 'resources/monitoring/monitoring_get_lb_droplets_downtime.yml'

/v2/monitoring/sinks/destinations:
post:
$ref: 'resources/monitoring/monitoring_create_destination.yml'
get:
$ref: 'resources/monitoring/monitoring_list_destinations.yml'

/v2/monitoring/sinks/destinations/{destination_uuid}:
get:
$ref: 'resources/monitoring/monitoring_get_destination.yml'
post:
$ref: 'resources/monitoring/monitoring_update_destination.yml'
delete:
$ref: 'resources/monitoring/monitoring_delete_destination.yml'

/v2/monitoring/sinks:
post:
$ref: 'resources/monitoring/monitoring_create_sink.yml'
get:
$ref: 'resources/monitoring/monitoring_list_sinks.yml'

/v2/monitoring/sinks/{sink_uuid}:
get:
$ref: 'resources/monitoring/monitoring_get_sink.yml'
delete:
$ref: 'resources/monitoring/monitoring_delete_sink.yml'

/v2/projects:
get:
$ref: 'resources/projects/projects_list.yml'
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
lang: cURL
source: |-
curl -X POST \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $DIGITALOCEAN_TOKEN" \
"https://api.digitalocean.com/v2/monitoring/sinks/destinations" \
--data '{"name":"cluster", "type":"opensearch_dbaas", "config": {"endpoint": "example.com", "credentials": {"username": "username", "password": "password"}}}'
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
lang: cURL
source: |-
curl -X POST \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $DIGITALOCEAN_TOKEN" \
"https://api.digitalocean.com/v2/monitoring/sinks" \
--data '{"destination_uuid": "f2fcd5d9-f410-4f3a-8015-130ada94b1fe", "resources": [{"name": "fra_kubernetes_cluster", "urn":"do:kubernetes:8463c9db-150c-4b44-830c-fca7f68d005b"}]}'
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
lang: cURL
source: |-
curl -X DELETE \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $DIGITALOCEAN_TOKEN" \
"https://api.digitalocean.com/v2/monitoring/sinks/destinations/01f30bfa-319a-4769-ba95-9d43971fb514"
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
lang: cURL
source: |-
curl -X DELETE \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $DIGITALOCEAN_TOKEN" \
"https://api.digitalocean.com/v2/monitoring/sinks/aef7ff4a-f1be-4d9e-b886-650fcb5bdfe3"
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/monitoring/sinks/destinations/01f30bfa-319a-4769-ba95-9d43971fb514"
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/monitoring/sinks/f945d774-86e8-4dc8-8f60-cfc76dd3d098"
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/monitoring/sinks/destinations"
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/monitoring/sinks?resource_id=do:kubernetes:f2fcd5d9-f410-4f3a-8015-130ada94b1fe"
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
lang: cURL
source: |-
curl -X POST \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $DIGITALOCEAN_TOKEN" \
"https://api.digitalocean.com/v2/monitoring/alerts" \
--data '{"index_name": "logs", "retention_days": 30}'
18 changes: 18 additions & 0 deletions specification/resources/monitoring/models/destination.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
type: object
required:
- config
properties:
id:
type: string
description: "A unique identifier for a destination."
example: "01f30bfa-319a-4769-ba95-9d43971fb514"
name:
type: string
description: "destination name"
example: "managed_opensearch_cluster"
type:
type: string
description: "destination type, one of `opensearch_dbaas` or `opensearch_ext`."
dwilsondo marked this conversation as resolved.
Show resolved Hide resolved
example: "opensearch_dbaas"
config:
$ref: 'opensearch_config.yml'
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
type: object
properties:
id:
type: string
description: "A unique identifier for a destination."
example: "01f30bfa-319a-4769-ba95-9d43971fb514"
name:
type: string
description: "destination name"
example: "managed_opensearch_cluster"
type:
type: string
description: "destination type, one of `opensearch_dbaas` or `opensearch_ext`."
dwilsondo marked this conversation as resolved.
Show resolved Hide resolved
example: "opensearch_dbaas"
config:
$ref: 'opensearch_config_omit_credentials.yml'
15 changes: 15 additions & 0 deletions specification/resources/monitoring/models/destination_request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
type: object
required:
- config
- type
properties:
name:
type: string
description: "destination name"
example: "managed_opensearch_cluster"
type:
type: string
description: "destination type, one of `opensearch_dbaas` or `opensearch_ext`."
andrewsomething marked this conversation as resolved.
Show resolved Hide resolved
example: "opensearch_dbaas"
config:
$ref: 'opensearch_config_request.yml'
38 changes: 38 additions & 0 deletions specification/resources/monitoring/models/opensearch_config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
type: object
required:
- endpoint
properties:
id:
type: string
description: "A unique identifier for a configuration."
example: "41078d41-165c-4cff-9f0a-19536e3e3d49"
credentials:
type: object
description: "Credentials for an OpenSearch cluster user. Optional if `cluster_uuid` is passed."
properties:
username:
type: string
example: "username"
password:
type: string
example: "password"
endpoint:
type: string
example: "example.com"
description: "host of the OpenSearch cluster"
cluster_uuid:
type: string
example: "85148069-7e35-4999-80bd-6fa1637ca385"
description: "A unique identifier for a managed OpenSearch cluster."
cluster_name:
type: string
example: "managed_dbaas_cluster"
description: "Name of a managed OpenSearch cluster."
index_name:
type: string
description: "OpenSearch index to send logs to."
example: "logs"
retention_days:
type: integer
description: "Number of days to retain logs in OpenSearch (default: 14)"
example: 14
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
type: object
description: "Opensearch destination configuration with `credentials` omitted."
properties:
id:
type: string
description: "A unique identifier for a configuration."
example: "41078d41-165c-4cff-9f0a-19536e3e3d49"
endpoint:
type: string
example: "example.com"
description: "host of the Opensearch cluster"
cluster_uuid:
type: string
example: "85148069-7e35-4999-80bd-6fa1637ca385"
description: "A unique identifier for a managed OpenSearch cluster."
cluster_name:
type: string
example: "managed_dbaas_cluster"
description: "Name of a managed OpenSearch cluster."
index_name:
type: string
description: "OpenSearch index to send logs to."
example: "logs"
retention_days:
type: integer
description: "Number of days to retain logs in Opensearch."
example: 14
default: 14
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
type: object
required:
- endpoint
properties:
credentials:
type: object
description: "Credentials for an OpenSearch cluster user. Optional if `cluster_uuid` is passed."
properties:
username:
type: string
example: "username"
password:
type: string
example: "password"
endpoint:
type: string
example: "example.com"
description: "host of the Opensearch cluster"
cluster_uuid:
type: string
example: "85148069-7e35-4999-80bd-6fa1637ca385"
description: "A unique identifier for a managed OpenSearch cluster."
cluster_name:
type: string
example: "managed_dbaas_cluster"
description: "Name of a managed OpenSearch cluster."
index_name:
type: string
description: "OpenSearch index to send logs to."
example: "logs"
retention_days:
type: integer
description: "Number of days to retain logs in an OpenSearch cluster."
example: 14
default: 14


14 changes: 14 additions & 0 deletions specification/resources/monitoring/models/sink_resource.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
type: object
required:
- urn
properties:
urn:
type: string
pattern: ^do:(dbaas|domain|droplet|floatingip|loadbalancer|space|volume|kubernetes|vpc):.*
example: do:kubernetes:f453aa14-646e-4cf8-8c62-75a19fb24ec2
description: The uniform resource name (URN) for the resource in the format
do:resource_type:resource_id.
andrewsomething marked this conversation as resolved.
Show resolved Hide resolved
name:
type: string
description: "resource name"
example: "managed_kubernetes_cluster"
11 changes: 11 additions & 0 deletions specification/resources/monitoring/models/sinks_response.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
type: object
required:
- urn
properties:
destination:
$ref: '../models/destination.yml'
resources:
type: array
description: "List of resources identified by their URNs."
items:
$ref: '../models/sink_resource.yml'
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
operationId: monitoring_create_destination

summary: Create Logging Destination

description: To create a new destination, send a POST request to `/v2/monitoring/sinks/destinations`.

tags:
- Monitoring

requestBody:
required: true
content:
application/json:
schema:
$ref: 'models/destination_request.yml'
andrewsomething marked this conversation as resolved.
Show resolved Hide resolved

responses:
'200':
$ref: 'responses/destination.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/monitoring_create_destination.yml'

security:
- bearer_auth:
- 'monitoring:create'
52 changes: 52 additions & 0 deletions specification/resources/monitoring/monitoring_create_sink.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
operationId: monitoring_create_sink

summary: Create Sink

description: |
To create a new sink, send a POST request to `/v2/monitoring/sinks`. Forwards logs from the
resources identified in `resources` to the specified pre-existing destination.

tags:
- Monitoring

responses:
'202':
$ref: '../../shared/responses/accepted.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'

requestBody:
required: true
content:
application/json:
schema:
properties:
destination_uuid:
type: string
example: "9df2b7e9-3fb2-4577-b60a-e9c0d53f9a99"
description: "A unique identifier for an already-existing destination."
resources:
type: array
description: "List of resources identified by their URNs."
items:
$ref: 'models/sink_resource.yml'

x-codeSamples:
- $ref: 'examples/curl/monitoring_create_sink.yml'

security:
- bearer_auth:
- 'monitoring:create'
Loading
Loading