Skip to content

Commit 8404fb6

Browse files
Update kubernetes API spec: cluster status messages (#999)
* Update kubernetes API spec: cluster status messages * Update specification/resources/kubernetes/responses/status_messages.yml Co-authored-by: Andrew Starr-Bochicchio <andrewsomething@users.noreply.github.com> --------- Co-authored-by: Andrew Starr-Bochicchio <andrewsomething@users.noreply.github.com>
1 parent dcc76de commit 8404fb6

7 files changed

Lines changed: 117 additions & 0 deletions

File tree

specification/DigitalOcean-public.v2.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1263,6 +1263,10 @@ paths:
12631263
delete:
12641264
$ref: "resources/kubernetes/kubernetes_remove_registry.yml"
12651265

1266+
/v2/kubernetes/clusters/{cluster_id}/status_messages:
1267+
get:
1268+
$ref: "resources/kubernetes/kubernetes_get_status_messages.yml"
1269+
12661270
/v2/load_balancers:
12671271
post:
12681272
$ref: "resources/load_balancers/loadBalancers_create.yml"
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
lang: cURL
2+
source: |-
3+
curl -X GET \
4+
-H "Content-Type: application/json" \
5+
-H "Authorization: Bearer $DIGITALOCEAN_TOKEN" \
6+
"https://api.digitalocean.com/v2/kubernetes/clusters/bd5f5959-5e1e-4205-a714-a914373942af/status_messages"
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
lang: Go
2+
source: |-
3+
import (
4+
"context"
5+
"os"
6+
7+
"github.com/digitalocean/godo"
8+
)
9+
10+
func main() {
11+
token := os.Getenv("DIGITALOCEAN_TOKEN")
12+
13+
client := godo.NewFromToken(token)
14+
ctx := context.TODO()
15+
16+
messages, _, err := client.Kubernetes.GetClusterStatusMessages(ctx, "8d91899c-0739-4a1a-acc5-deadbeefbb8f", nil)
17+
}
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
operationId: kubernetes_get_status_messages
2+
3+
summary: Fetch Status Messages for a Kubernetes Cluster
4+
5+
description: |
6+
To retrieve status messages for a Kubernetes cluster, send a GET request to
7+
`/v2/kubernetes/clusters/$K8S_CLUSTER_ID/status_messages`. Status messages inform users of any issues that come up during the cluster lifecycle.
8+
9+
tags:
10+
- Kubernetes
11+
12+
parameters:
13+
- $ref: 'parameters.yml#/kubernetes_cluster_id'
14+
- $ref: 'parameters.yml#/kubernetes_status_messages_since'
15+
16+
responses:
17+
'200':
18+
$ref: 'responses/status_messages.yml'
19+
20+
'401':
21+
$ref: '../../shared/responses/unauthorized.yml'
22+
23+
'404':
24+
$ref: '../../shared/responses/not_found.yml'
25+
26+
'429':
27+
$ref: '../../shared/responses/too_many_requests.yml'
28+
29+
'500':
30+
$ref: '../../shared/responses/server_error.yml'
31+
32+
default:
33+
$ref: '../../shared/responses/unexpected_error.yml'
34+
35+
36+
x-codeSamples:
37+
- $ref: 'examples/curl/kubernetes_get_status_messages.yml'
38+
- $ref: 'examples/go/kubernetes_get_status_messages.yml'
39+
40+
security:
41+
- bearer_auth:
42+
- 'kubernetes:read'
43+
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
type: object
2+
3+
properties:
4+
message:
5+
type: string
6+
readOnly: true
7+
example: Resource provisioning may be delayed while our team resolves an incident
8+
description: Status information about the cluster which impacts it's lifecycle.
9+
10+
timestamp:
11+
type: string
12+
format: date-time
13+
readOnly: true
14+
example: "2018-11-15T16:00:11Z"
15+
description: A timestamp in ISO8601 format that represents when the status
16+
message was emitted.

specification/resources/kubernetes/parameters.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,3 +83,14 @@ kubernetes_node_replace:
8383
maximum: 1
8484
default: 0
8585
example: 1
86+
87+
kubernetes_status_messages_since:
88+
in: query
89+
name: since
90+
required: false
91+
description: A timestamp used to return status messages emitted since the
92+
specified time. The timestamp should be in ISO8601 format.
93+
schema:
94+
type: string
95+
format: date-time
96+
example: 2018-11-15T16:00:11Z
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
description: |
2+
The response is a JSON object which contains status messages for a Kubernetes cluster. Each message object contains a timestamp and an indication of what issue the cluster is experiencing at a given time.
3+
4+
5+
headers:
6+
ratelimit-limit:
7+
$ref: '../../../shared/headers.yml#/ratelimit-limit'
8+
ratelimit-remaining:
9+
$ref: '../../../shared/headers.yml#/ratelimit-remaining'
10+
ratelimit-reset:
11+
$ref: '../../../shared/headers.yml#/ratelimit-reset'
12+
13+
content:
14+
application/json:
15+
schema:
16+
properties:
17+
messages:
18+
type: array
19+
items:
20+
$ref: "../models/status_messages.yml"

0 commit comments

Comments
 (0)