-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathswagger.yaml
877 lines (877 loc) · 28.2 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
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
swagger: "2.0"
info:
version: 1.0.0
title: Kong Admin API
description: REST interface to configurate Kong.
host: kong-admin.hvg.hu
paths:
/services:
get:
summary: List all services
operationId: ListServices
tags:
- services
parameters:
- in: query
name: offset
description: An uid of a service as an offset.
required: false
type: string
produces:
- application/json
responses:
200:
description: OK
schema:
$ref: "#/definitions/ServiceList"
default:
description: Unexpected error
schema:
$ref: '#/definitions/Error'
post:
summary: Registrate service to Kong
operationId: AddService
tags:
- services
consumes:
- application/json
parameters:
- in: body
name: serviceUpsert
required: true
schema:
$ref: "#/definitions/ServiceUpsert"
produces:
- application/json
responses:
201:
description: Created
schema:
$ref: "#/definitions/Service"
default:
description: Unexpected error
schema:
$ref: '#/definitions/Error'
/services/{service}:
delete:
summary: Delete a service by a name or id
operationId: DeleteService
tags:
- services
parameters:
- name: service
in: path
description: The unique identifier or the name of the Service to delete.
required: true
type: string
responses:
204:
description: No Content
default:
description: Unexpected error
schema:
$ref: '#/definitions/Error'
/services/{service}/routes:
get:
summary: List Routes associated to a specific Service
operationId: ListRoutes
tags:
- routes
parameters:
- name: service
in: path
description: The unique identifier or the name attribute of the Service that's Routes should be listed.
required: true
type: string
- name: offset
in: query
description: An uid of a route as an offset.
required: false
type: string
produces:
- application/json
responses:
200:
description: OK
schema:
$ref: "#/definitions/RouteList"
default:
description: Unexpected error
schema:
$ref: '#/definitions/Error'
post:
summary: Create Route associated to a specific Service
operationId: AddRoute
tags:
- routes
consumes:
- application/json
parameters:
- name: service
in: path
description: The unique identifier or the name attribute of the Service that should be associated to the newly-created Route.
required: true
type: string
- name: routeUpsert
in: body
required: true
schema:
$ref: "#/definitions/RouteUpsert"
produces:
- application/json
responses:
201:
description: Created
schema:
$ref: "#/definitions/Route"
default:
description: Unexpected error
schema:
$ref: '#/definitions/Error'
/routes/{route}:
delete:
summary: Delete a Route by a name or id
operationId: DeleteRoute
tags:
- routes
parameters:
- name: route
in: path
description: The unique identifier or the name of the Route to delete.
required: true
type: string
responses:
204:
description: No Content
default:
description: Unexpected error
schema:
$ref: '#/definitions/Error'
/services/{service}/plugins:
get:
summary: List Plugins associated to a specific Service
operationId: ListPlugins
tags:
- plugins
parameters:
- name: service
in: path
description: The unique identifier or the name attribute of the Service that's Plugins should be listed.
required: true
type: string
- name: offset
in: query
description: An uid of a plugin as an offset.
required: false
type: string
produces:
- application/json
responses:
200:
description: OK
schema:
$ref: "#/definitions/PluginList"
default:
description: Unexpected error
schema:
$ref: '#/definitions/Error'
post:
summary: Enabling the plugin on a Service
operationId: AddPlugin
tags:
- plugins
consumes:
- application/json
parameters:
- name: service
in: path
description: The id or name of the Service that this plugin configuration will target..
required: true
type: string
- name: pluginUpsert
in: body
required: true
schema:
$ref: "#/definitions/PluginUpsert"
produces:
- application/json
responses:
201:
description: Created
schema:
$ref: "#/definitions/Plugin"
default:
description: Unexpected error
schema:
$ref: '#/definitions/Error'
/plugins/{pluginId}:
delete:
summary: Delete a Plugin by an id
operationId: DeletePlugin
tags:
- plugins
parameters:
- name: pluginId
in: path
description: The unique identifier of the Plugin to delete.
required: true
type: string
responses:
204:
description: No Content
default:
description: Unexpected error
schema:
$ref: '#/definitions/Error'
/consumers:
get:
summary: List all Consumers
operationId: ListConsumers
tags:
- consumers
parameters:
- name: offset
in: query
description: An uid of a consumer as an offset.
required: false
type: string
produces:
- application/json
responses:
200:
description: OK
schema:
$ref: "#/definitions/ConsumerList"
default:
description: Unexpected error
schema:
$ref: '#/definitions/Error'
post:
summary: Create Consumer
operationId: AddConsumer
tags:
- consumers
consumes:
- application/json
parameters:
- name: consumerUpsert
in: body
required: true
schema:
$ref: "#/definitions/ConsumerUpsert"
produces:
- application/json
responses:
201:
description: Created
schema:
$ref: "#/definitions/Consumer"
default:
description: Unexpected error
schema:
$ref: '#/definitions/Error'
/consumers/{consumer}:
get:
summary: Retrieve a Consumer
operationId: GetConsumer
tags:
- consumers
parameters:
- name: consumer
in: path
description: The unique identifier or the username of the Consumer to retrieve.
required: true
type: string
produces:
- application/json
responses:
200:
description: OK
schema:
$ref: "#/definitions/Consumer"
default:
description: Unexpected error
schema:
$ref: '#/definitions/Error'
patch:
summary: Update a Consumer
operationId: UpdateConsumer
tags:
- consumers
consumes:
- application/json
parameters:
- name: consumer
in: path
description: The unique identifier or the username of the Consumer to update.
required: true
type: string
- name: consumerUpsert
in: body
required: true
schema:
$ref: "#/definitions/ConsumerUpsert"
produces:
- application/json
responses:
200:
description: OK
schema:
$ref: "#/definitions/Consumer"
default:
description: Unexpected error
schema:
$ref: '#/definitions/Error'
put:
summary: Create or update a Consumer
operationId: AddConsumerWithId
tags:
- consumers
consumes:
- application/json
parameters:
- name: consumer
in: path
description: The unique identifier of the new Consumer.
required: true
type: string
- name: consumerUpsert
in: body
required: true
schema:
$ref: "#/definitions/ConsumerUpsert"
produces:
- application/json
responses:
200:
description: OK
schema:
$ref: "#/definitions/Consumer"
201:
description: Created
schema:
$ref: "#/definitions/Consumer"
default:
description: Unexpected error
schema:
$ref: '#/definitions/Error'
delete:
summary: Delete a Consumer by username or id
operationId: DeleteConsumer
tags:
- consumers
parameters:
- name: consumer
in: path
description: The unique identifier or the username of the Consumer to delete.
required: true
type: string
responses:
204:
description: No Content
default:
description: Unexpected error
schema:
$ref: '#/definitions/Error'
/consumers/{consumer}/jwt:
get:
summary: List JWT credentials of Consumer
operationId: ListCredentials
tags:
- credentials
parameters:
- name: consumer
in: path
description: The id or username property of the Consumer entity to list credentials for.
required: true
type: string
produces:
- application/json
responses:
200:
description: OK
schema:
$ref: "#/definitions/CredentialList"
default:
description: Unexpected error
schema:
$ref: '#/definitions/Error'
post:
summary: Create a JWT credential
operationId: AddCredential
tags:
- credentials
parameters:
- name: consumer
in: path
description: The id or username property of the Consumer entity to associate the credentials to.
required: true
type: string
- name: credentialUpsert
in: body
required: false
schema:
$ref: "#/definitions/CredentialUpsert"
produces:
- application/json
responses:
201:
description: Created
schema:
$ref: "#/definitions/Credential"
default:
description: Unexpected error
schema:
$ref: '#/definitions/Error'
/consumers/{consumer}/jwt/{id}:
get:
summary: Get a JWT Credential
operationId: GetCredential
tags:
- credentials
parameters:
- name: consumer
in: path
description: The id or username property of the Consumer entity to associate the credentials to.
required: true
type: string
- name: id
in: path
description: The id or the key of the JWT credential.
required: true
type: string
responses:
200:
description: OK
schema:
$ref: "#/definitions/Credential"
default:
description: Unexpected error
schema:
$ref: '#/definitions/Error'
delete:
summary: Delete a JWT Credential
operationId: DeleteCredential
tags:
- credentials
parameters:
- name: consumer
in: path
description: The id or username property of the Consumer entity to associate the credentials to.
required: true
type: string
- name: id
in: path
description: The id or the key of the JWT credential.
required: true
type: string
responses:
204:
description: No Content
default:
description: Unexpected error
schema:
$ref: '#/definitions/Error'
/acls:
get:
summary: Retrieve all ACLs
operationId: ListAcls
tags:
- acls
produces:
- application/json
responses:
200:
description: OK
schema:
$ref: "#/definitions/AclList"
default:
description: Unexpected error
schema:
$ref: '#/definitions/Error'
/consumers/{consumer}/acls:
get:
summary: Retrieve all ACLs for the given Consumer
operationId: ListAclsForConsumer
tags:
- acls
parameters:
- name: consumer
in: path
description: The id or username property of the Consumer entity which ACLs will be listed.
required: true
type: string
produces:
- application/json
responses:
200:
description: OK
schema:
$ref: "#/definitions/AclList"
default:
description: Unexpected error
schema:
$ref: '#/definitions/Error'
post:
summary: Add ACL to a consumer
operationId: AddAcl
tags:
- acls
consumes:
- application/x-www-form-urlencoded
parameters:
- name: consumer
in: path
description: The id or username property of the Consumer entity to associate the credentials to.
required: true
type: string
- name: group
in: formData
required: true
type: string
produces:
- application/json
responses:
201:
description: Created
schema:
$ref: "#/definitions/Acl"
default:
description: Unexpected error
schema:
$ref: '#/definitions/Error'
/consumers/{consumer}/acls/{id}:
delete:
summary: Delete an ACL
operationId: DeleteAcl
tags:
- acls
parameters:
- name: consumer
in: path
description: The id or username property of the Consumer entity to associate the credentials to.
required: true
type: string
- name: id
in: path
description: The id of the ACL.
required: true
type: string
responses:
204:
description: No Content
default:
description: Unexpected error
schema:
$ref: '#/definitions/Error'
definitions:
ServiceUpsert:
properties:
name:
type: string
description: The Service name.
retries:
type: integer
format: int32
description: The number of retries to execute upon failure to proxy. Defaults to 5.
protocol:
type: string
enum: [http, https]
description: The protocol used to communicate with the upstream. It can be one of http or https.
default: http
host:
type: string
description: The host of the upstream server.
port:
type: integer
format: int32
description: The upstream server port.
default: 80
path:
type: string
description: The path to be used in requests to the upstream server.
connect_timeout:
type: integer
format: int32
description: The timeout in milliseconds for establishing a connection to the upstream server.
default: 60000
write_timeout:
type: integer
format: int32
description: The timeout in milliseconds between two successive write operations for transmitting a request to the upstream server.
default: 60000
read_timeout:
type: integer
format: int32
description: The timeout in milliseconds between two successive read operations for transmitting a request to the upstream server.
default: 60000
# The following parameter is not included, otherwise protocol, host and port could not be required.
#url:
# type: string
# description: Shorthand attribute to set protocol, host, port and path at once. This attribute is write-only (the Admin API never “returns” the url).
Service:
allOf:
- $ref: "#/definitions/ServiceUpsert"
- $ref: "#/definitions/ModelBaseWithCreateAndUpdate"
ServicePreview:
properties:
id:
type: string
description: Uid.
ServiceList:
properties:
data:
type: array
items:
$ref: "#/definitions/Service"
description: List of services.
next:
type: string
description: Url to fetch next part of the service list.
RouteUpsert:
properties:
name:
type: string
description: The name of the Route.
protocols:
type: array
items:
type: string
description: A list of the protocols this Route should allow. When set to ["https"], HTTP requests are answered with a request to upgrade to HTTPS. Defaults to ["http", "https"].
methods:
type: array
items:
type: string
description: A list of HTTP methods that match this Route. When using http or https protocols, at least one of hosts, paths, or methods must be set.
hosts:
type: array
items:
type: string
description: A list of domain names that match this Route. When using http or https protocols, at least one of hosts, paths, or methods must be set. With form-encoded, the notation is hosts[]=example.com&hosts[]=foo.test. With JSON, use an Array.
paths:
type: array
items:
type: string
description: A list of paths that match this Route. When using http or https protocols, at least one of hosts, paths, or methods must be set. With form-encoded, the notation is paths[]=/foo&paths[]=/bar. With JSON, use an Array.
regex_priority:
type: integer
default: 0
description: A number used to choose which route resolves a given request when several routes match it using regexes simultaneously. When two routes match the path and have the same regex_priority, the older one (lowest created_at) is used. Note that the priority for non-regex routes is different (longer non-regex routes are matched before shorter ones).
strip_path:
type: boolean
default: true
description: When matching a Route via one of the paths, strip the matching prefix from the upstream request URL.
preserve_host:
type: boolean
description: When matching a Route via one of the hosts domain names, use the request Host header in the upstream request headers. If set to false, the upstream Host header will be that of the Service’s host.
snis:
type: array
items:
type: string
description: A list of SNIs that match this Route when using stream routing. When using tcp or tls protocols, at least one of snis, sources, or destinations must be set.
sources:
type: array
items:
type: string
description: A list of IP sources of incoming connections that match this Route when using stream routing. Each entry is an object with fields “ip” (optionally in CIDR range notation) and/or “port”. When using tcp or tls protocols, at least one of snis, sources, or destinations must be set.
destinations:
type: array
items:
type: string
description: A list of IP destinations of incoming connections that match this Route when using stream routing. Each entry is an object with fields “ip” (optionally in CIDR range notation) and/or “port”. When using tcp or tls protocols, at least one of snis, sources, or destinations must be set.
Route:
allOf:
- $ref: "#/definitions/RouteUpsert"
- $ref: "#/definitions/ModelBaseWithCreateAndUpdate"
- type: object
properties:
service:
$ref: "#/definitions/ServicePreview"
RoutePreview:
properties:
id:
type: string
description: Uid.
RouteList:
properties:
data:
type: array
items:
$ref: "#/definitions/Route"
description: List of routes associated to a specific service.
next:
type: string
description: Url to fetch next part of the route list.
PluginUpsert:
properties:
name:
type: string
description: The name of the Plugin that’s going to be added. Currently the Plugin must be installed in every Kong instance separately.
config:
type: object
description: The configuration properties for the Plugin which can be found on the plugins documentation page in the Kong Hub.
additionalProperties:
type: object
route:
$ref: "#/definitions/RoutePreview"
description: 'If set, the plugin will only activate when receiving requests via the specified route. Leave unset for the plugin to activate regardless of the Route being used. Defaults to null. With form-encoded, the notation is route.id=<route_id>. With JSON, use "route":{"id":"<route_id>"}.'
service:
$ref: "#/definitions/ServicePreview"
description: 'If set, the plugin will only activate when receiving requests via one of the routes belonging to the specified Service. Leave unset for the plugin to activate regardless of the Service being matched. Defaults to null. With form-encoded, the notation is service.id=<service_id>. With JSON, use "service":{"id":"<service_id>"}.'
consumer:
$ref: "#/definitions/ConsumerPreview"
description: If set, the plugin will activate only for requests where the specified has been authenticated. (Note that some plugins can not be restricted to consumers this way.). Leave unset for the plugin to activate regardless of the authenticated consumer. Defaults to null. With form-encoded, the notation is consumer.id=<consumer_id>. With JSON, use "consumer":{"id":"<consumer_id>"}.
run_on:
type: string
default: first
description: "Control on which Kong nodes this plugin will run, given a Service Mesh scenario. Accepted values are: * first, meaning “run on the first Kong node that is encountered by the request”. On an API Getaway scenario, this is the usual operation, since there is only one Kong node in between source and destination. In a sidecar-to-sidecar Service Mesh scenario, this means running the plugin only on the Kong sidecar of the outbound connection. * second, meaning “run on the second node that is encountered by the request”. This option is only relevant for sidecar-to-sidecar Service Mesh scenarios: this means running the plugin only on the Kong sidecar of the inbound connection. * all means “run on all nodes”, meaning both sidecars in a sidecar-to-sidecar scenario. This is useful for tracing/logging plugins."
enabled:
type: boolean
default: true
description: Whether the plugin is applied.
Plugin:
allOf:
- $ref: "#/definitions/PluginUpsert"
- $ref: "#/definitions/ModelBaseWithCreate"
PluginList:
properties:
data:
type: array
items:
$ref: "#/definitions/Plugin"
description: List of plugins associated to a specific service.
next:
type: string
description: Url to fetch next part of the plugin list.
ConsumerUpsert:
properties:
username:
type: string
description: The unique username of the consumer. You must send either this field or custom_id with the request.
custom_id:
type: string
description: Field for storing an existing unique ID for the consumer - useful for mapping Kong with users in your existing database. You must send either this field or username with the request.
Consumer:
allOf:
- $ref: "#/definitions/ConsumerUpsert"
- $ref: "#/definitions/ModelBaseWithCreate"
ConsumerPreview:
properties:
id:
type: string
description: Uid.
ConsumerList:
properties:
data:
type: array
items:
$ref: "#/definitions/Consumer"
description: List of Consumers.
next:
type: string
description: Url to fetch next part of the Consumer list.
CredentialUpsert:
allOf:
- type: object
properties:
key:
type: string
description: A unique string identifying the credential.
Credential:
allOf:
- $ref: "#/definitions/ModelBaseWithMilisecCreate"
- type: object
properties:
key:
type: string
description: A unique string identifying the credential.
secret:
type: string
description: If algorithm is HS256 or ES256, the secret used to sign JWTs for this credential.
algorithm:
type: string
enum: [HS256, HS384, HS512, RS256, ES256]
description: The algorithm used to verify the token’s signature. Can be HS256, HS384, HS512, RS256, or ES256.
rsa_public_key:
type: string
description: If algorithm is RS256 or ES256, the public key (in PEM format) to use to verify the token’s signature.
consumer_id:
type: string
description: Uid of consumer.
CredentialList:
properties:
data:
type: array
items:
$ref: "#/definitions/Credential"
description: List of Credentials.
total:
type: integer
format: int32
description: Number of Credentials for a Consumer.
AclUpsert:
properties:
group:
type: string
description: The arbitrary group name to associate to the consumer.
Acl:
allOf:
- $ref: "#/definitions/AclUpsert"
- $ref: "#/definitions/ModelBaseWithMilisecCreate"
- type: object
properties:
consumer:
$ref: "#/definitions/ConsumerPreview"
AclList:
properties:
data:
type: array
items:
$ref: "#/definitions/Acl"
description: List of Acls.
total:
type: integer
format: int32
description: Number of Acls for a Consumer.
ModelBaseWithCreate:
properties:
id:
type: string
description: Uid.
created_at:
type: integer
format: int32
description: Unix timestamp of the create action
ModelBaseWithCreateAndUpdate:
properties:
id:
type: string
description: Uid.
created_at:
type: integer
format: int32
description: Unix timestamp of the create action
updated_at:
type: integer
format: int32
description: Unix timestamp of the last update action
ModelBaseWithMilisecCreate:
properties:
id:
type: string
description: Uid.
created_at:
type: integer
format: int32
description: Milisec based timestamp of the create action
Error:
properties:
code:
type: integer
format: int32
message:
type: string
name:
type: string
fields:
type: object