forked from mikkeloscar/gin-swagger
-
Notifications
You must be signed in to change notification settings - Fork 0
/
swagger.yaml
854 lines (823 loc) · 24.3 KB
/
swagger.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
swagger: '2.0'
info:
version: "0.0.1"
title: Cluster Registry
description: Registry to store information about infrastructure accounts and Kubernetes clusters.
schemes:
- "https"
basePath: /
produces:
- application/json
consumes:
- application/json
securityDefinitions:
OAuth2:
type: oauth2
flow: password
tokenUrl: https://info.services.auth.zalando.com/oauth2/tokeninfo
scopes:
uid: Unique identifier of the user accessing the service.
security:
- OAuth2: [uid]
paths:
'/infrastructure-accounts':
get:
summary: List all registered infrastructure accounts
tags:
- InfrastructureAccounts
operationId: listInfrastructureAccounts
responses:
200:
description: List of all infrastructure accounts.
schema:
type: object
properties:
items:
type: array
items:
'$ref': '#/definitions/InfrastructureAccount'
401:
description: Unauthorized
403:
description: Forbidden
500:
description: Unexpected error
schema:
$ref: '#/definitions/Error'
post:
summary: Create infrastructure account
description: |
Creates a new infrastructure account
tags:
- InfrastructureAccounts
operationId: createInfrastructureAccount
parameters:
- name: infrastructure_account
required: true
in: body
description: Account that will be created.
schema:
'$ref': '#/definitions/InfrastructureAccount'
responses:
201:
description: Infrastructure account was scheduled for creation.
schema:
'$ref': '#/definitions/InfrastructureAccount'
400:
description: Invalid parameters
401:
description: Unauthorized
403:
description: Forbidden
409:
description: Conflict, already existing.
500:
description: Unexpected error
schema:
$ref: '#/definitions/Error'
'/infrastructure-accounts/{account_id}':
patch:
summary: Update infrastructure account
description: update an infrastructure account.
tags:
- InfrastructureAccounts
operationId: updateInfrastructureAccount
parameters:
- $ref: '#/parameters/account_id'
- name: infrastructure_account
required: true
in: body
description: Infrastructure Account that will be updated.
schema:
'$ref': '#/definitions/InfrastructureAccountUpdate'
responses:
200:
description: The infrastructure account update request is accepted
schema:
'$ref': '#/definitions/InfrastructureAccount'
401:
description: Unauthorized
403:
description: Forbidden
404:
description: InfrastructureAccount not found
500:
description: Unexpected error
schema:
$ref: '#/definitions/Error'
get:
summary: Get single infrastructure account
description: |
Read information regarding the infrastructure account.
tags:
- InfrastructureAccounts
operationId: getInfrastructureAccount
parameters:
- $ref: '#/parameters/account_id'
responses:
200:
description: Infrastructure account information.
schema:
'$ref': '#/definitions/InfrastructureAccount'
401:
description: Unauthorized
403:
description: Forbidden
404:
description: InfrastructureAccount not found
500:
description: Unexpected error
schema:
$ref: '#/definitions/Error'
'/kubernetes-clusters':
get:
summary: List all Kubernetes clusters
description: |
Returns the list of all Kubernetes clusters.
tags:
- Clusters
operationId: listClusters
parameters:
- name: alias
in: query
required: false
type: string
description: Filter on cluster alias.
- name: api_server_url
in: query
required: false
type: string
description: Filter on API server URL.
- name: channel
in: query
required: false
type: string
description: Filter on channel.
- name: criticality_level
in: query
required: false
type: integer
format: int32
description: Filter on criticality level.
- name: environment
in: query
required: false
type: string
description: Filter on environment.
- name: infrastructure_account
in: query
required: false
type: string
description: Filter on infrastructure account.
- name: lifecycle_status
in: query
required: false
type: string
enum:
- requested
- creating
- ready
- decommission-requested
- decommissioned
description: Filter on cluster lifecycle status.
- name: local_id
in: query
required: false
type: string
description: Filter on local id.
- name: provider
in: query
required: false
type: string
description: Filter on provider.
- name: region
in: query
required: false
type: string
description: Filter on region.
- name: verbose
in: query
required: false
type: boolean
default: true
description: Include technical data (config items, node pools) in the response, true by default
responses:
200:
description: List of all Kubernetes clusters.
schema:
type: object
properties:
items:
type: array
items:
'$ref': '#/definitions/Cluster'
401:
description: Unauthorized
403:
description: Forbidden
500:
description: Unexpected error
schema:
$ref: '#/definitions/Error'
post:
summary: Create cluster
description: Create a cluster.
tags:
- Clusters
operationId: createCluster
parameters:
- name: cluster
required: true
in: body
description: Cluster that will be created.
schema:
'$ref': '#/definitions/Cluster'
responses:
201:
description: The cluster creation request is accepted
schema:
'$ref': '#/definitions/Cluster'
400:
description: Invalid request
schema:
$ref: '#/definitions/Error'
401:
description: Unauthorized
403:
description: Forbidden
409:
description: Conflict, already existing
500:
description: Unexpected error
schema:
$ref: '#/definitions/Error'
'/kubernetes-clusters/{cluster_id}':
patch:
summary: Update cluster
description: update a cluster.
tags:
- Clusters
operationId: updateCluster
parameters:
- $ref: '#/parameters/cluster_id'
- name: cluster
required: true
in: body
description: Cluster that will be updated.
schema:
'$ref': '#/definitions/ClusterUpdate'
responses:
200:
description: The cluster update request is performed and the updated cluster is returned.
schema:
'$ref': '#/definitions/Cluster'
401:
description: Unauthorized
403:
description: Forbidden
404:
description: Cluster not found
500:
description: Unexpected error
schema:
$ref: '#/definitions/Error'
get:
summary: Get single cluster
description: Read the details of the cluster.
tags:
- Clusters
operationId: getCluster
parameters:
- $ref: '#/parameters/cluster_id'
- name: verbose
in: query
required: false
type: boolean
default: true
description: Include technical data (config items, node pools) in the response, true by default
responses:
200:
description: Cluster information.
schema:
'$ref': '#/definitions/Cluster'
401:
description: Unauthorized
403:
description: Forbidden
404:
description: Cluster not found
500:
description: Unexpected error
schema:
$ref: '#/definitions/Error'
delete:
summary: Delete cluster
description: |
Cluster identified by the ID.
tags:
- Clusters
operationId: deleteCluster
parameters:
- $ref: '#/parameters/cluster_id'
responses:
204:
description: Cluster deleted
400:
description: Invalid request
schema:
$ref: '#/definitions/Error'
401:
description: Unauthorized
403:
description: Forbidden
schema:
$ref: '#/definitions/Error'
404:
description: Cluster not found
500:
description: Unexpected error
schema:
$ref: '#/definitions/Error'
'/kubernetes-clusters/{cluster_id}/config-items/{config_key}':
put:
summary: Add/update config item
description: Add/update a configuration item unique to the cluster.
tags:
- ConfigItems
operationId: addOrUpdateConfigItem
parameters:
- $ref: '#/parameters/cluster_id'
- $ref: '#/parameters/config_key'
- name: value
required: true
in: body
description: Config value.
schema:
'$ref': '#/definitions/ConfigValue'
responses:
200:
description: The config items add/update request is accepted.
schema:
'$ref': '#/definitions/ConfigValue'
400:
description: Invalid request
schema:
$ref: '#/definitions/Error'
401:
description: Unauthorized
403:
description: Forbidden
500:
description: Unexpected error
schema:
$ref: '#/definitions/Error'
delete:
summary: Delete config item
description: Deletes config item.
tags:
- ConfigItems
operationId: deleteConfigItem
parameters:
- $ref: '#/parameters/cluster_id'
- $ref: '#/parameters/config_key'
responses:
204:
description: Config item deleted.
400:
description: Invalid request
schema:
$ref: '#/definitions/Error'
401:
description: Unauthorized
403:
description: Forbidden
404:
description: Config item not found
500:
description: Unexpected error
schema:
$ref: '#/definitions/Error'
'/kubernetes-clusters/{cluster_id}/node-pools':
get:
summary: List node pools
description: List all node pools of a cluster.
tags:
- NodePools
operationId: listNodePools
parameters:
- $ref: '#/parameters/cluster_id'
responses:
200:
description: List of node pools
schema:
type: object
properties:
items:
type: array
items:
'$ref': '#/definitions/NodePool'
401:
description: Unauthorized
403:
description: Forbidden
500:
description: Unexpected error
schema:
$ref: '#/definitions/Error'
'/kubernetes-clusters/{cluster_id}/node-pools/{node_pool_name}':
put:
summary: Create/update node pool
description: Create/update a node pool.
tags:
- NodePools
operationId: createOrUpdateNodePool
parameters:
- $ref: '#/parameters/cluster_id'
- $ref: '#/parameters/node_pool_name'
- name: node-pool
required: true
in: body
description: Node pool to be created.
schema:
'$ref': '#/definitions/NodePool'
responses:
200:
description: The node pool create request is accepted.
schema:
'$ref': '#/definitions/NodePool'
400:
description: Invalid request
schema:
$ref: '#/definitions/Error'
401:
description: Unauthorized
403:
description: Forbidden
500:
description: Unexpected error
schema:
$ref: '#/definitions/Error'
delete:
summary: Delete node pool
description: Deletes node pool.
tags:
- NodePools
operationId: deleteNodePool
parameters:
- $ref: '#/parameters/cluster_id'
- $ref: '#/parameters/node_pool_name'
responses:
204:
description: Node pool deleted.
400:
description: Invalid request
schema:
$ref: '#/definitions/Error'
401:
description: Unauthorized
403:
description: Forbidden
404:
description: Node pool not found
500:
description: Unexpected error
schema:
$ref: '#/definitions/Error'
parameters:
account_id:
name: account_id
in: path
type: string
description: ID of the infrastructure account.
required: true
pattern: "^[a-z][a-z0-9-:]*[a-z0-9]$"
cluster_id:
name: cluster_id
in: path
type: string
description: ID of the cluster.
required: true
pattern: "^[a-z][a-z0-9-:]*[a-z0-9]$"
node_pool_name:
name: node_pool_name
in: path
type: string
description: Name of the node pool.
required: true
pattern: "^[a-z][a-z0-9-]*[a-z0-9]$"
config_key:
name: config_key
in: path
type: string
description: Key for the config value.
required: true
pattern: "^[a-z][a-z0-9_]*[a-z0-9]$"
definitions:
InfrastructureAccount:
type: object
properties:
id:
type: string
example: "aws:123456789012"
description: Globally unique ID of the infrastructure account.
type:
type: string
example: aws
description: Type of the infrastructure account. Possible types are "aws", "gcp", "dc". This field is set at creation time and cannot be modified.
name:
type: string
example: foo
description: Name of the infrastructure account
owner:
type: string
example: team/bar
description: Owner of the infrastructure account (references an object in the organization service)
environment:
type: string
example: production
description: Environment. possible values are "production" or "staging". This field is set at creation time and cannot be modified.
criticality_level:
type: integer
format: int32
example: 2
description: Level of criticality as defined by tech controlling. 1 is non critical, 2 is standard production, 3 is PCI
external_id:
type: string
example: "123456789012"
description: The external identifier of the account (i.e. AWS account ID)
lifecycle_status:
type: string
enum:
- requested
- creating
- ready
- decommissioned
description: Lifecycle Status is used to describe the current status of the account.
required:
- id
- type
- name
- owner
- environment
- criticality_level
- external_id
- lifecycle_status
InfrastructureAccountUpdate:
type: object
properties:
name:
type: string
example: foo
description: Name of the infrastructure account
owner:
type: string
example: team/bar
description: Owner of the infrastructure account (references an object in the organization service)
lifecycle_status:
type: string
enum:
- requested
- creating
- ready
- decommissioned
description: Lifecycle Status is used to describe the current status of the account.
Cluster:
type: object
properties:
id:
type: string
example: aws:123456789012:eu-central-1:kube-1
description: Globally unique ID of the Kubernetes cluster
alias:
type: string
pattern: "^[a-z][a-z0-9-]*[a-z0-9]$"
example: production-cluster
description: |
Human readable alias for the Kubernetes cluster. The alias is unique
but can be changed.
infrastructure_account:
type: string
example: aws:123456789012
description: The identifier of the infrastructure account in which the cluster will live in
region:
type: string
example: eu-central-1
description: The region of the cluster
local_id:
type: string
example: kube-1
description: Cluster identifier which is local to the region
provider:
type: string
example: zalando-aws
description: The provider of the cluster. Possible values are "zalando-aws", "GKE", ... #TODO: enum?
api_server_url:
type: string
example: https://kube-1.foo.example.org/
description: URL of the Kubernetes API server endpoint
channel:
type: string
example: alpha
description: A version channel for the cluster.
environment:
type: string
example: production
description: |
The environment in which the cluster run. This field is set at
creation time and cannot be modified.
criticality_level:
type: integer
format: int32
example: 2
description: Level of criticality as defined by tech controlling. 1 is non critical, 2 is standard production, 3 is PCI.
lifecycle_status:
type: string
enum:
- requested
- creating
- ready
- decommission-requested
- decommissioned
example: ready
description: Status of the cluster.
status:
$ref: '#/definitions/ClusterStatus'
config_items:
type: object
additionalProperties:
type: string
example:
product_x_key: "abcde"
product_y_key: "12345"
description: |
Configuration items unique to the cluster. E.g. custom API key used
by one of the cluster services.
node_pools:
type: array
items:
$ref: '#/definitions/NodePool'
required:
- id
- alias
- infrastructure_account
- region
- local_id
- provider
- api_server_url
- channel
- environment
- criticality_level
- lifecycle_status
ClusterUpdate:
type: object
properties:
alias:
type: string
example: production-cluster
description: |
Human readable alias for the Kubernetes cluster. The alias is unique
but can be changed.
provider:
type: string
example: zalando-aws
description: The provider of the cluster. Possible values are "zalando-aws", "GKE", ... #TODO: enum?
api_server_url:
type: string
example: https://kube-1.foo.example.org/
description: URL of the Kubernetes API server endpoint
channel:
type: string
example: alpha
description: A version channel for the cluster. Possible values are "alpha", "stable" #TODO: enum?
lifecycle_status:
type: string
enum:
- requested
- creating
- ready
- decommission-requested
- decommissioned
example: ready
description: Status of the cluster.
status:
$ref: '#/definitions/ClusterStatus'
config_items:
type: object
additionalProperties:
type: string
example:
product_x_key: "abcde"
product_y_key: "12345"
description: |
Configuration items unique to the cluster. E.g. custom API key used
by one of the cluster services.
ConfigValue:
type: object
properties:
value:
type: string
example: secret-key-id
description: Value of the Config value.
required:
- value
ClusterStatus:
type: object
properties:
current_version:
type: string
example: a1b2c3d4e5f6
description: |
Current version of the cluster. This can refer to a commit hash or
any valid version string in the context.
last_version:
type: string
example: a2b3c4d5e6f7
description: |
Last working version of the cluster. This can refer to a commit
hash or any valid version string in the context. In case any
problems are defined for the current_version then it should be
safe to roll back to this last version.
next_version:
type: string
example: a3b4c5d6e7f8
description: |
Next version of the cluster. This field indicates that the cluster is
being updated to a new version. This can refer to a commit hash or any
valid version string in the context.
problems:
type: array
items:
type: object
properties:
type:
type: string
example: https://cluster-status.example.org/service-apply-failed
description: A URI reference the indentifies the problem type.
title:
type: string
example: "Failed to apply service 'kubernetes-dashboard'"
description: |
A short, human-readable summary of the problem type.
status:
type: integer
format: int32
example: 401
description: |
The HTTP status code generated by the origin server for this
occurence of the problem.
detail:
type: string
example: |
Cluster lifecycle manager was unable to apply the
kubernetes-dashboard service because of insufficient
permissions.
description: |
A human-readable explanation specific to this occurrence of
the problem.
instance:
type: string
example: service/kubernetes-dashboard
description: |
A URI reference that identifies the specific occurrence of
the problem.
additionalProperties:
type: string
required:
- type
- title
NodePool:
type: object
properties:
name:
type: string
example: pool-1
description: Name of the node pool
profile:
type: string
example: worker/default
description: Profile used for the node pool. Possible values are "worker/default", "worker/database", "worker/gpu", "master". The "master" profile identifies the pool containing the cluster master
instance_type:
type: string
example: m4.medium
description: Type of the instance to use for the nodes in the pool. All the nodes in the pool share the same instance types
discount_strategy:
type: string
example: none
description: |
A discount strategy indicates the type of discount to be associated with the node pool. This might affect the availability of the nodes in the pools in case of preemptible or spot instances.
Possible values are "none", "aggressive", "moderate", "reasonable" #TODO naming should be "reasonable" :-D
required:
- name
- profile
- instance_type
- discount_strategy
Error:
type: object
properties:
code:
type: integer
format: int32
message:
type: string
fields:
type: string