/
swagger.yaml
1222 lines (1169 loc) 路 34.1 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
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
openapi: 3.0.0
info:
title: gnomock
description: >
`gnomock` is an HTTP wrapper for
[Gnomock](https://github.com/orlangure/gnomock) integration and end-to-end
testing toolkit. It allows to use Gnomock outside of Go ecosystem. Not all
Gnomock features exist in this wrapper, but official presets, as well as
basic general configuration, are supported.
version: 1.20.0
contact:
url: https://github.com/orlangure/gnomock/
license:
name: MIT
url: https://github.com/orlangure/gnomock/blob/master/LICENSE
paths:
/start/localstack:
post:
summary: Start a new Gnomock Localstack container
operationId: startLocalstack
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/localstack-request'
responses:
'200':
$ref: '#/components/responses/container-created'
'400':
$ref: '#/components/responses/invalid-configuration'
'500':
$ref: '#/components/responses/start-failed'
tags:
- presets
/start/mongo:
post:
summary: Start a new Gnomock MongoDB container
operationId: startMongo
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/mongo-request'
responses:
'200':
$ref: '#/components/responses/container-created'
'400':
$ref: '#/components/responses/invalid-configuration'
'500':
$ref: '#/components/responses/start-failed'
tags:
- presets
/start/mssql:
post:
summary: Start a new Gnomock Microsoft SQL Server container
operationId: startMssql
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/mssql-request'
responses:
'200':
$ref: '#/components/responses/container-created'
'400':
$ref: '#/components/responses/invalid-configuration'
'500':
$ref: '#/components/responses/start-failed'
tags:
- presets
/start/mysql:
post:
summary: Start a new Gnomock MySQL container
operationId: startMysql
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/mysql-request'
responses:
'200':
$ref: '#/components/responses/container-created'
'400':
$ref: '#/components/responses/invalid-configuration'
'500':
$ref: '#/components/responses/start-failed'
tags:
- presets
/start/mariadb:
post:
summary: Start a new Gnomock MariaDB container
operationId: startMariadb
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/mariadb-request'
responses:
'200':
$ref: '#/components/responses/container-created'
'400':
$ref: '#/components/responses/invalid-configuration'
'500':
$ref: '#/components/responses/start-failed'
tags:
- presets
/start/postgres:
post:
summary: Start a new Gnomock Postgres container
operationId: startPostgres
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/postgres-request'
responses:
'200':
$ref: '#/components/responses/container-created'
'400':
$ref: '#/components/responses/invalid-configuration'
'500':
$ref: '#/components/responses/start-failed'
tags:
- presets
/start/redis:
post:
summary: Start a new Gnomock Redis container
operationId: startRedis
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/redis-request'
responses:
'200':
$ref: '#/components/responses/container-created'
'400':
$ref: '#/components/responses/invalid-configuration'
'500':
$ref: '#/components/responses/start-failed'
tags:
- presets
/start/memcached:
post:
summary: Start a new Gnomock Memcached container
operationId: startMemcached
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/memcached-request'
responses:
'200':
$ref: '#/components/responses/container-created'
'400':
$ref: '#/components/responses/invalid-configuration'
'500':
$ref: '#/components/responses/start-failed'
tags:
- presets
/start/splunk:
post:
summary: Start a new Gnomock Splunk container
operationId: startSplunk
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/splunk-request'
responses:
'200':
$ref: '#/components/responses/container-created'
'400':
$ref: '#/components/responses/invalid-configuration'
'500':
$ref: '#/components/responses/start-failed'
tags:
- presets
/start/rabbitmq:
post:
summary: Start a new Gnomock RabbitMQ container
operationId: startRabbitMq
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/rabbitmq-request'
responses:
'200':
$ref: '#/components/responses/container-created'
'400':
$ref: '#/components/responses/invalid-configuration'
'500':
$ref: '#/components/responses/start-failed'
tags:
- presets
/start/kafka:
post:
summary: Start a new Gnomock Kafka container
operationId: startKafka
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/kafka-request'
responses:
'200':
$ref: '#/components/responses/container-created'
'400':
$ref: '#/components/responses/invalid-configuration'
'500':
$ref: '#/components/responses/start-failed'
tags:
- presets
/start/elastic:
post:
summary: Start a new Gnomock Elasticsearch container
operationId: startElastic
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/elastic-request'
responses:
'200':
$ref: '#/components/responses/container-created'
'400':
$ref: '#/components/responses/invalid-configuration'
'500':
$ref: '#/components/responses/start-failed'
tags:
- presets
/start/kubernetes:
post:
summary: >
Start a new Gnomock lightweight kubernetes (k3s) preset. Use
`host:<kubeconfig-port>/kubeconfig` to retrieve the kubeconfig file
that should be used to connect to this container.
operationId: startKubernetes
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/kubernetes-request'
responses:
'200':
$ref: '#/components/responses/container-created'
'400':
$ref: '#/components/responses/invalid-configuration'
'500':
$ref: '#/components/responses/start-failed'
tags:
- presets
/start/cockroachdb:
post:
summary: Start a new Gnomock CockroachDB preset.
operationId: startCockroachDB
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/cockroachdb-request'
responses:
'200':
$ref: '#/components/responses/container-created'
'400':
$ref: '#/components/responses/invalid-configuration'
'500':
$ref: '#/components/responses/start-failed'
tags:
- presets
/start/influxdb:
post:
summary: Start a new Gnomock InfluxDB preset.
operationId: startInfluxDB
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/influxdb-request'
responses:
'200':
$ref: '#/components/responses/container-created'
'400':
$ref: '#/components/responses/invalid-configuration'
'500':
$ref: '#/components/responses/start-failed'
tags:
- presets
/start/cassandra:
post:
summary: Start a new Gnomock Cassandra preset.
operationId: startCassandra
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/cassandra-request'
responses:
'200':
$ref: '#/components/responses/container-created'
'400':
$ref: '#/components/responses/invalid-configuration'
'500':
$ref: '#/components/responses/start-failed'
tags:
- presets
### /start/preset
/stop:
post:
summary: Stop an existing Gnomock container
operationId: stop
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/stop-request'
responses:
'200':
description: Container stopped successfully
'400':
description: Invalid stop request
content:
application/json:
schema:
$ref: '#/components/schemas/invalid-stop-request'
'500':
description: Stop failed
content:
application/json:
schema:
$ref: '#/components/schemas/stop-failed'
tags:
- presets
components:
schemas:
container:
type: object
properties:
id:
description: Container ID
type: string
example: f5d08dc84421
host:
description: Host of bound ports
type: string
default: localhost
ports:
$ref: '#/components/schemas/named-ports'
description: >
This object is a Gnomock wrapper of a regular docker container. It uses
the same container ID as docker, and adds bound ports information.
named-ports:
type: object
example:
api:
protocol: tcp
port: 35973
additionalProperties:
type: object
properties:
protocol:
description: Protocol of bound port
type: string
example: tcp
port:
description: Port number on host machine
type: integer
example: 35973
description: >
A map of port bindings of a Gnomock container. Human readable names are
used to make the values readable. `port` value is an actual port
exposed on the host; use this port to connect to the container.
invalid-start-request:
type: object
properties:
error:
type: string
description: >
This error usually means that the request schema was invalid, or there
were missing/incorrect/unsupported values.
start-failed:
type: object
properties:
error:
type: string
description: >
This error means that Gnomock attempted to start a new container, but
failed somewhere during the process. It is possible that image took too
long to download, or there was an issue with container configuration.
stop-failed:
type: object
properties:
error:
type: string
description: >
This error means that Gnomock couldn't stop the requested container. It
is possible that the ID is incorrect, or that there is something wrong
with docker daemon.
invalid-stop-request:
type: object
properties:
error:
type: string
description: >
This error means that the provided `/stop` request was invalid.
options:
type: object
properties:
timeout:
type: integer
format: int64
description: Wait timeout in nanoseconds
default: 300000000000
example: 60000000000
env:
type: array
description: Array of environment variables to set in the container
items:
type: string
example: ENV_VAR_NAME=some-value
debug:
type: boolean
description: Set to true to see logs inside the Gnomock container
default: false
container_name:
type: string
description: >
Use a specific container name instead of a random one. In case a
container with this name already exists, it is killed and replaced
by a new container.
example: gnomock
privileged:
type: boolean
description: Runs a container in privileged mode.
cmd:
type: array
description: Command and its arguments to execute on container startup.
items:
type: string
disable_cleanup:
type: boolean
description: Disables auto removal of this container after tests.
use_local_images_first:
type: boolean
description: If possible to avoid hitting the Docker Hub pull rate limit.
custom_named_ports:
$ref: '#/components/schemas/named-ports'
auth:
type: string
description: >
base64 encoded JSON string with docker access credentials. JSON
string should include two fields, username and password. For Docker
Hub, if 2FA authentication is enabled, an access token should be
used instead of a password.
example: eyJ1c2VybmFtZSI6ImZvbyIsInBhc3N3b3JkIjoiYmFyIn0K
description: >
This object includes general Gnomock configuration, similar to all
presets. Timeout configuration is especially useful for
troubleshooting.
localstack-request:
type: object
properties:
preset:
$ref: '#/components/schemas/localstack'
options:
$ref: '#/components/schemas/options'
description: >
This request includes Localstack and general configuration.
localstack:
type: object
properties:
services:
type: array
description: A list of localstack services to start
example:
- s3
- ses
items:
type: string
example: s3
enum:
- apigateway
- cloudformation
- cloudwatch
- logs
- events
- dynamodb
- dynamodbstreams
- ec2
- es
- firehose
- iam
- kinesis
- kms
- lambda
- redshift
- route53
- s3
- secretsmanager
- ses
- sns
- sqs
- ssm
- sts
- stepfunctions
s3_path:
type: string
description: >
Path to folder to setup initial S3 state. Top level folders are
used as buckets; all child folders and files are uploaded as-is
example: /home/gnomock/project/testdata/s3
version:
type: string
description: Docker image tag (version)
default: latest
required:
- services
example:
services:
- s3
description: >
This object describes Localstack container.
mongo-request:
type: object
properties:
preset:
$ref: '#/components/schemas/mongo'
options:
$ref: '#/components/schemas/options'
description: >
This request includes MongoDB and general configuration.
mongo:
type: object
properties:
data_path:
description: >
Path to folder to setup initial container state. Each top level
folder maps to a database, every separate file under it is a
collection, and every line is a document in that collection.
type: string
example: /home/gnomock/project/testdata/mongo/data
user:
type: string
description: Username to create inside the container.
example: gnomock
password:
type: string
description: Password to set for the created user.
example: p@s$w0rD
version:
type: string
description: Docker image tag (version)
default: latest
description: >
This object describes MongoDB container.
mssql-request:
type: object
properties:
preset:
$ref: '#/components/schemas/mssql'
options:
$ref: '#/components/schemas/options'
description: >
This request includes Microsoft SQL Server and general configuration.
mssql:
type: object
properties:
db:
type: string
description: Database name to create.
example: mydb
default: mydb
password:
type: string
description: Superuser password.
example: p@s$w0rD
default: Gn0m!ck~
queries:
type: array
description: >
A list of queries to execute while setting up the container.
items:
type: string
example:
- create table foo(bar int)
- insert into foo(bar) values(1)
queries_files:
type: array
items:
type: string
description: SQL files to execute while setting up container state.
example:
- /home/gnomock/project/testdata/mssql/queries.sql
license:
type: boolean
description: Accept or decline Microsoft SQL Server license.
example: true
version:
type: string
description: Docker image tag (version)
default: latest
required:
- license
description: >
This object describes Microsoft SQL Server container.
mysql-request:
type: object
properties:
preset:
$ref: '#/components/schemas/mysql'
options:
$ref: '#/components/schemas/options'
description: >
This request includes MySQL and general configuration.
mysql:
type: object
properties:
db:
type: string
description: Database name to create.
example: mydb
default: mydb
user:
type: string
description: User to create in the container.
example: gnomock
default: gnomock
password:
type: string
description: New user's password.
example: p@s$w0rD
default: gnomick
queries:
type: array
description: >
A list of queries to execute while setting up the container.
items:
type: string
example:
- create table foo(bar int)
- insert into foo(bar) values(1)
queries_files:
type: array
items:
type: string
description: SQL files to execute while setting up container state.
example:
- /home/gnomock/project/testdata/mysql/queries.sql
version:
type: string
description: Docker image tag (version)
default: latest
description: >
This object describes MySQL container.
mariadb-request:
type: object
properties:
preset:
$ref: '#/components/schemas/mariadb'
options:
$ref: '#/components/schemas/options'
description: >
This request includes MariaDB and general configuration.
mariadb:
type: object
properties:
db:
type: string
description: Database name to create.
example: mydb
default: mydb
user:
type: string
description: User to create in the container.
example: gnomock
default: gnomock
password:
type: string
description: New user's password.
example: p@s$w0rD
default: gnoria
queries:
type: array
description: >
A list of queries to execute while setting up the container.
items:
type: string
example:
- create table foo(bar int)
- insert into foo(bar) values(1)
queries_files:
type: array
items:
type: string
description: SQL files to execute while setting up container state.
example:
- /home/gnomock/project/testdata/mysql/queries.sql
version:
type: string
description: Docker image tag (version)
default: latest
description: >
This object describes MariaDB container.
postgres-request:
type: object
properties:
preset:
$ref: '#/components/schemas/postgres'
options:
$ref: '#/components/schemas/options'
description: >
This request includes Postgres and general configuration.
postgres:
type: object
properties:
db:
type: string
description: Database name to create. By default, `postgres` is used.
example: mydb
user:
type: string
description: >
User to create in the container. By default, `postgres` is used
with password `password`.
example: gnomock
password:
type: string
description: New user's password.
example: p@s$w0rD
queries:
type: array
description: >
A list of queries to execute while setting up the container.
items:
type: string
example:
- create table foo(bar int)
- insert into foo(bar) values(1)
queries_files:
type: array
items:
type: string
description: SQL files to execute while setting up container state.
example:
- /home/gnomock/project/testdata/postgres/queries.sql
timezone:
type: string
description: The timezone in the container.
example: Europe/Paris
version:
type: string
description: Docker image tag (version)
default: latest
description: >
This object describes Postgres container.
redis-request:
type: object
properties:
preset:
$ref: '#/components/schemas/redis'
options:
$ref: '#/components/schemas/options'
description: >
This request includes Redis and general configuration.
redis:
type: object
properties:
values:
type: object
description: A list of key/value pairs to create in the container.
example:
foo: bar
baz: 42
meh: 3.14
version:
type: string
description: Docker image tag (version)
default: latest
description: >
This object describes Redis container.
memcached-request:
type: object
properties:
preset:
$ref: '#/components/schemas/memcached'
options:
$ref: '#/components/schemas/options'
description: >
This request includes Memcached and general configuration.
memcached:
type: object
properties:
values:
type: object
description: A list of key/value pairs to create in the container.
example:
computer: hal9000
byteValues:
type: object
description: A list of key/value pairs to create in the container. Values are base64 strings.
example:
foo: YmFy
baz: NDI=
meh: My4xNA==
version:
type: string
description: Docker image tag (version)
default: latest
description: >
This object describes Memcached container.
splunk-request:
type: object
properties:
preset:
$ref: '#/components/schemas/splunk'
options:
$ref: '#/components/schemas/options'
description: >
This request includes Splunk and general configuration.
splunk:
type: object
properties:
values:
type: array
description: A list of events to ingest into the container.
items:
type: object
properties:
event:
type: string
example: something happened
index:
type: string
example: main
source:
type: string
example: web
sourcetype:
type: string
example: http
time:
type: number
format: double
description: timestamp in seconds (or milli-, micro- or nanoseconds)
example: 1588269752
required:
- event
- index
- source
- sourcetype
- time
values_file:
type: string
description: >
File name with events to ingest into Splunk. Use JSON Lines format
(every event is a separate JSON object), each new event starts from
a new line.
example: /home/gnomock/project/testdata/splunk/events.jsonl
accept_license:
type: boolean
description: Accept or decline Splunk license.
example: true
admin_password:
type: string
description: Set a password for `admin` user.
example: p@s$w0rD
version:
type: string
description: Splunk version.
default: latest
example: 8.0.2.1
required:
- accept_license
- admin_password
description: >
This object describes Splunk container.
rabbitmq-request:
type: object
properties:
preset:
$ref: '#/components/schemas/rabbitmq'
options:
$ref: '#/components/schemas/options'
description: >
This request includes RabbitMQ and general configuration.
rabbitmq:
type: object
properties:
user:
type: string
description: Set a user name
example: gnomock
default: guest
password:
type: string
description: Set a password for a created user
example: p@s$w0rD
default: guest
version:
type: string
description: RabbitMQ version.
default: 3.8.5-alpine
example: latest
messages:
type: array
description: A list of messages to send to RabbitMQ
items:
$ref: '#/components/schemas/rabbitmqMessage'
messages_files:
type: array
items:
type: string
description: >
This object describes a RabbitMQ container.
rabbitmqMessage:
type: object
properties:
queue:
type: string
example: alerts
content_type:
type: string
example: text/plain
string_body:
type: string
example: high cpu
body:
type: string
format: byte
kafka-request:
type: object
properties:
preset:
$ref: '#/components/schemas/kafka'
options:
$ref: '#/components/schemas/options'
description: >
This request includes Kafka and general configuration.
kafka:
type: object
properties:
messages: