-
Notifications
You must be signed in to change notification settings - Fork 74
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update OpenAPI docs to include opensearch index crud changes (#903)
Co-authored-by: Rahul Bhardwaj <rahulbhardwaj@digitalocean.com>
- Loading branch information
1 parent
12a6416
commit 47108d8
Showing
11 changed files
with
241 additions
and
2 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
44 changes: 44 additions & 0 deletions
44
specification/resources/databases/databases_delete_opensearch_index.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,44 @@ | ||
operationId: databases_delete_opensearch_index | ||
|
||
summary: Delete Index for OpenSearch Cluster | ||
|
||
description: | | ||
To delete a single index within OpenSearch cluster, send a DELETE request | ||
to `/v2/databases/$DATABASE_ID/indexes/$INDEX_NAME`. | ||
A status of 204 will be given. This indicates that the request was | ||
processed successfully, but that no response body is needed. | ||
tags: | ||
- Databases | ||
|
||
parameters: | ||
- $ref: 'parameters.yml#/database_cluster_uuid' | ||
- $ref: 'parameters.yml#/opensearch_index_name' | ||
|
||
responses: | ||
'204': | ||
$ref: '../../shared/responses/no_content.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_delete_opensearch_index.yml' | ||
- $ref: 'examples/go/databases_delete_opensearch_index.yml' | ||
|
||
security: | ||
- bearer_auth: | ||
- 'database:delete' |
42 changes: 42 additions & 0 deletions
42
specification/resources/databases/databases_list_opensearch_indexes.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,42 @@ | ||
operationId: databases_list_opeasearch_indexes | ||
|
||
summary: List Indexes for a OpenSearch Cluster | ||
|
||
description: | | ||
To list all of a OpenSearch cluster's indexes, send a GET request to | ||
`/v2/databases/$DATABASE_ID/indexes`. | ||
The result will be a JSON object with a `indexes` key. | ||
tags: | ||
- Databases | ||
|
||
parameters: | ||
- $ref: 'parameters.yml#/database_cluster_uuid' | ||
|
||
responses: | ||
'200': | ||
$ref: 'responses/opensearch_indexes.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_list_opensearch_indexes.yml' | ||
- $ref: 'examples/go/databases_list_opensearch_indexes.yml' | ||
|
||
security: | ||
- bearer_auth: | ||
- 'database:read' |
6 changes: 6 additions & 0 deletions
6
specification/resources/databases/examples/curl/databases_delete_opensearch_index.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 DELETE \ | ||
-H "Content-Type: application/json" \ | ||
-H "Authorization: Bearer $DIGITALOCEAN_TOKEN" \ | ||
"https://api.digitalocean.com/v2/databases/9cc10173-e9ea-4176-9dbc-a4cee4c4ff30/indexes/sample-index" |
6 changes: 6 additions & 0 deletions
6
specification/resources/databases/examples/curl/databases_list_opensearch_indexes.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 "Content-Type: application/json" \ | ||
-H "Authorization: Bearer $DIGITALOCEAN_TOKEN" \ | ||
"https://api.digitalocean.com/v2/databases/9cc10173-e9ea-4176-9dbc-a4cee4c4ff30/indexes" |
19 changes: 19 additions & 0 deletions
19
specification/resources/databases/examples/go/databases_delete_opensearch_index.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,19 @@ | ||
lang: Go | ||
source: |- | ||
import ( | ||
"context" | ||
"os" | ||
"github.com/digitalocean/godo" | ||
) | ||
func main() { | ||
token := os.Getenv("DIGITALOCEAN_TOKEN") | ||
client := godo.NewFromToken(token) | ||
ctx := context.TODO() | ||
indexName := "sampe-index" | ||
_, err := client.Databases.DeleteIndex(ctx, "9cc10173-e9ea-4176-9dbc-a4cee4c4ff30", indexName) | ||
} |
17 changes: 17 additions & 0 deletions
17
specification/resources/databases/examples/go/databases_list_opensearch_indexes.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() | ||
replicas, _, err := client.Databases.ListIndexes(ctx, "9cc10173-e9ea-4176-9dbc-a4cee4c4ff30", nil) | ||
} |
25 changes: 25 additions & 0 deletions
25
specification/resources/databases/models/opensearch_index.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,25 @@ | ||
type: object | ||
|
||
allOf: | ||
- $ref: './opensearch_index_base.yml' | ||
- properties: | ||
status: | ||
type: string | ||
enum: | ||
- unknown | ||
- open | ||
- close | ||
- none | ||
example: open | ||
description: The status of the OpenSearch index. | ||
|
||
health: | ||
type: string | ||
enum: | ||
- unknown | ||
- green | ||
- yellow | ||
- red | ||
- red* | ||
example: green | ||
description: The health of the OpenSearch index. |
28 changes: 28 additions & 0 deletions
28
specification/resources/databases/models/opensearch_index_base.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,28 @@ | ||
type: object | ||
|
||
properties: | ||
index_name: | ||
type: string | ||
description: The name of the opensearch index. | ||
example: events | ||
|
||
number_of_shards: | ||
type: integer | ||
example: 2 | ||
description: The number of shards for the index. | ||
|
||
number_of_replicas: | ||
type: integer | ||
example: 3 | ||
description: The number of replicas for the index. | ||
|
||
size: | ||
type: integer | ||
example: 208 | ||
description: The size of the index. | ||
|
||
created_time: | ||
type: string | ||
format: date-time | ||
example: "2021-01-01T00:00:00Z" | ||
description: The date and time the index was created. |
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
35 changes: 35 additions & 0 deletions
35
specification/resources/databases/responses/opensearch_indexes.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,35 @@ | ||
description: A JSON object with a key of `indexes`. | ||
|
||
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: | ||
indexes: | ||
type: array | ||
items: | ||
$ref: "../models/opensearch_index.yml" | ||
|
||
example: | ||
indexes: | ||
- index_name: sample-data | ||
number_of_shards: 2 | ||
number_of_replicas: 3 | ||
size: 208 | ||
created_time: "2021-01-01T00:00:00Z" | ||
status: open | ||
health: green | ||
- index_name: logs-* | ||
number_of_shards: 2 | ||
number_of_replicas: 3 | ||
size: 208 | ||
created_time: "2021-01-01T00:00:00Z" | ||
status: open | ||
health: green |