-
Notifications
You must be signed in to change notification settings - Fork 17
/
openapi.yaml
1223 lines (1200 loc) · 42.2 KB
/
openapi.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: Gopher Holes Unlimited API!
description: |
Gopher Holes Unlimited (GHU) is a fictional website to track gophers, holes, and our continuous quest to keep them from destroying our gardens.
This API is designed to help illustrate the capabilities of OAS3.0 in a fun and meaningful way.
![Gopher Holes Unlimited](https://readysetcloud.s3.amazonaws.com/GHU.png)
version: 1.0.0
tags:
- name: Gophers
description: The little varmints themselves
- name: Holes
description: Details on the gopher holes
servers:
- description: test
url: https://c5dbc886-b8ab-48c8-907b-d34893b05569.mock.pstmn.io
- description: prod
url: https://api.gopherholesunlimited.com
x-amazon-apigateway-request-validators:
Validate All:
validateRequestParameters: true
validateRequestBody: true
x-amazon-apigateway-gateway-responses:
BAD_REQUEST_BODY:
statusCode: 400
responseTemplates:
application/json: '{ "message": "$context.error.validationErrorString" }'
INVALID_API_KEY:
statusCode: 401
responseTemplates:
application/json: '{ "message": "Unauthorized" }'
security:
- api_key: []
paths:
/gophers:
post:
summary: Track a new gopher
description: When you find a new gopher, add it to the list with this endpoint. Keeping track of gophers helps the community know where they are and where not to plant their garden.
tags:
- Gophers
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/Gopher'
responses:
202:
$ref: '#/components/responses/Accepted'
x-postman-variables:
- type: save
name: gopherId
path: .id
400:
$ref: '#/components/responses/BadRequest'
x-amazon-apigateway-request-validator: Validate All
x-amazon-apigateway-integration:
credentials:
Fn::Sub: ${AddGopherRole.Arn}
uri:
Fn::Sub: arn:${AWS::Partition}:apigateway:${AWS::Region}:dynamodb:action/PutItem
httpMethod: POST
type: aws
passthroughBehavior: 'never'
requestTemplates:
application/json:
Fn::Sub:
- |-
#set($inputRoot = $input.path('$'))
{
"TableName": "${TableName}",
"Item": {
"pk": { "S": "$context.requestId"},
"sk": { "S": "job#addGopher"},
"status": { "S": "Pending" },
"createdDate": { "S": "$context.requestTime" },
"data": {
"M": {
"name": { "S": "$input.path('$.name')" },
"location": {
"M": {
"latitude": { "S": "$input.path('$.location.latitude')"},
"longitude": { "S": "$input.path('$.location.longitude')"},
"city": { "S": "$input.path('$.location.city')" },
"state": { "S": "$input.path('$.location.state')" },
"addressLine1": { "S": "$input.path('$.location.addressLine1')" },
"addressLine2": { "S": "$input.path('$.location.addressLine2')" }
}
}
},
"picture": { "S": "$input.path('$.picture')"},
"type": { "S": "$input.path('$.type')"},
"sex": { "S": "$input.path('$.sex')"},
"status": { "S": "$input.path('$.status')"},
"color": { "S": "$input.path('$.color')"},
"comment": { "S": "$input.path('$.comment')"}
}
}
},
"ReturnValues": "NONE"
}
- { TableName: { Ref: TableName } }
responses:
200:
statusCode: 202
responseTemplates:
application/json: |
#set($context.responseOverride.header.Access-Control-Allow-Origin = '*')
#set($inputRoot = $input.path('$'))
{
"id": "$context.requestId",
"links": [
{
"method": "GET",
"url": "https://api.gopherholesunlimited.com/jobs/gophers/$context.requestId"
}
]
}
get:
summary: View a list of all gophers
description: Use this endpoint to view a list of all gophers in the system
tags:
- Gophers
responses:
200:
description: The request was successful and a list of gophers was returned
content:
application/json:
schema:
$ref: '#/components/schemas/GopherSummary'
x-amazon-apigateway-request-validator: Validate All
x-amazon-apigateway-integration:
credentials:
Fn::Sub: ${GetAllGophersRole.Arn}
uri:
Fn::Sub: arn:${AWS::Partition}:apigateway:${AWS::Region}:dynamodb:action/Query
httpMethod: POST
type: aws
passthroughBehavior: never
requestTemplates:
application/json:
Fn::Sub:
- |-
{
"TableName": "${TableName}",
"IndexName": "GSI1",
"KeyConditionExpression": "#GSI1PK = :GSI1PK",
"ExpressionAttributeNames": {
"#GSI1PK": "GSI1PK"
},
"ExpressionAttributeValues": {
":GSI1PK": { "S": "gopher#" }
}
}
- { TableName: { Ref: TableName } }
responses:
200:
statusCode: 200
responseTemplates:
application/json: |
#set($context.reponseOverride.header.Access-Control-Allow-Origin = '*')
#set($inputRoot = $input.path('$'))
{
"items": [
#foreach($elem in $inputRoot.Items) {
"id": "$elem.pk.S",
"name": "$elem.data.M.name.S",
"location": {
#if("$elem.data.M.location.M.city.S" != "")
"city": "$elem.data.M.location.M.city.S",
"state": "$elem.data.M.location.M.state.S"
#else
"latitude": "$elem.data.M.location.M.latitude.S",
"longitude": "$elem.data.M.location.M.longitude.S"
#end
}
#if("$elem.data.M.location.M.type.S" != ""),
"type": "$elem.data.M.location.M.type.S"
#end
}
#end
]
}
/gophers/{gopherId}/statuses:
parameters:
- $ref: '#/components/parameters/gopherId'
post:
summary: Add a new status to a specific gopher
description: Sets a the current status of a gopher. All status history is maintained
tags:
- Gophers
requestBody:
required: true
content:
application/json:
schema:
type: object
required:
- status
properties:
status:
type: string
minLength: 1
description: Current status of the gopher
enum: [at large, trapped, deceased, unknown]
example: trapped
responses:
204:
$ref: '#/components/responses/NoContent'
400:
$ref: '#/components/responses/BadRequest'
404:
$ref: '#/components/responses/NotFound'
x-amazon-apigateway-request-validator: Validate All
x-amazon-apigateway-integration:
uri:
Fn::Sub: arn:${AWS::Partition}:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/${AddGopherStatusFunction.Arn}/invocations
httpMethod: POST
type: aws_proxy
/gophers/{gopherId}:
parameters:
- $ref: '#/components/parameters/gopherId'
patch:
summary: Update a subset of details of a specific gopher
description: If updates are necessary to the gopher, provide only the details that have changed
tags:
- Gophers
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/UpdateGopher'
responses:
204:
$ref: '#/components/responses/NoContent'
400:
$ref: '#/components/responses/BadRequest'
x-amazon-apigateway-request-validator: Validate All
x-amazon-apigateway-integration:
uri:
Fn::Sub: arn:${AWS::Partition}:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/${UpdateGopherFunction.Arn}/invocations
httpMethod: POST
type: aws_proxy
get:
parameters:
- name: include
in: query
description: |
Denotes what additional information to include in the response. Currently allows: *holes*
required: false
schema:
type: string
example: holes
summary: Get the details of a specific gopher
description: To view additional details about a gopher, look them up by their id
tags:
- Gophers
responses:
200:
description: The requested gopher has been found and the details returned
content:
application/json:
schema:
$ref: '#/components/schemas/Gopher'
400:
$ref: '#/components/responses/NotFound'
x-amazon-apigateway-request-validator: Validate All
x-amazon-apigateway-integration:
uri:
Fn::Sub: arn:${AWS::Partition}:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/${GetGopherFunction.Arn}/invocations
httpMethod: POST
type: aws_proxy
delete:
summary: Delete a gopher
description: Deletes a gopher and all statuses from the system
tags:
- Gophers
responses:
204:
$ref: '#/components/responses/NoContent'
x-amazon-apigateway-request-validator: Validate All
x-amazon-apigateway-integration:
credentials:
Fn::Sub: ${DeleteGopherRole.Arn}
uri:
Fn::Sub: arn:${AWS::Partition}:apigateway:${AWS::Region}:dynamodb:action/DeleteItem
httpMethod: POST
type: aws
passthroughBehavior: 'never'
requestTemplates:
application/json:
Fn::Sub:
- |-
{
"TableName": "${TableName}",
"Key": {
"pk": { "S": "$input.params('gopherId')"},
"sk": { "S": "gopher#"}
},
"ReturnValues": "NONE"
}
- { TableName: { Ref: TableName } }
responses:
200:
statusCode: 204
responseTemplates:
application/json: |
#set($context.responseOverride.header.Access-Control-Allow-Origin = '*')
/jobs/gophers/{gopherId}:
parameters:
- $ref: '#/components/parameters/gopherId'
get:
summary: View the details of a job that creates a gopher
description: Get the status of an "Add Gopher" job
tags:
- Jobs
responses:
200:
description: The request was successful and the job detail was returned
content:
application/json:
schema:
$ref: '#/components/schemas/AddGopherJobDetail'
x-amazon-apigateway-request-validator: Validate All
x-amazon-apigateway-integration:
credentials:
Fn::Sub: ${GetAddGopherJobRole.Arn}
uri:
Fn::Sub: arn:${AWS::Partition}:apigateway:${AWS::Region}:dynamodb:action/GetItem
httpMethod: POST
type: aws
passthroughBehavior: never
requestTemplates:
application/json:
Fn::Sub:
- |-
{
"TableName": "${TableName}",
"Key": {
"pk": { "S": "$input.params('gopherId')" },
"sk": { "S": "job#addGopher" }
}
}
- { TableName: { Ref: TableName } }
responses:
200:
statusCode: 200
responseTemplates:
application/json: |
#set($context.reponseOverride.header.Access-Control-Allow-Origin = '*')
#set($inputRoot = $input.path('$'))
{
#if("$inputRoot.Item" != "")
"id": "$inputRoot.Item.pk.S",
"status": "$inputRoot.Item.status.S",
"createdDate": "$inputRoot.Item.createdDate.S",
"input": {
"name": "$inputRoot.Item.data.M.name.S",
"location": {
#if("$inputRoot.Item.data.M.location.M.latitude.S" != "")
"latitude": "$inputRoot.Item.data.M.location.M.latitude.S",
"longitude": "$inputRoot.Item.data.M.location.M.longitude.S"
#else
"city": "$inputRoot.Item.data.M.location.M.city.S",
"state": "$inputRoot.Item.data.M.location.M.state.S",
"addressLine1": "$inputRoot.Item.data.M.location.M.addressLine1.S"
#if("$inputRoot.Item.data.M.location.M.addressLine2.S" != "")
,"addressLine2": "$inputRoot.Item.data.M.location.M.addressLine2.S"
#end
#end
}
#if("$inputRoot.Item.data.M.picture" != "")
,"picture": "$inputRoot.Item.data.M.picture.S"
#end
#if("$inputRoot.Item.data.M.type" != "")
,"type": "$inputRoot.Item.data.M.type.S"
#end
#if("$inputRoot.Item.data.M.sex" != "")
,"sex": "$inputRoot.Item.data.M.sex.S"
#end
#if("$inputRoot.Item.data.M.status" != "")
,"status": "$inputRoot.Item.data.M.status.S"
#else
,"status": "unknown"
#end
#if("$inputRoot.Item.data.M.color" != "")
,"color": "$inputRoot.Item.data.M.color.S"
#end
#if("$inputRoot.Item.data.M.comment" != "")
,"comment": "$inputRoot.Item.data.M.comment.S"
#end
}
#if("$inputRoot.Item.result" != "")
,"result": {
"gopherId": "$inputRoot.Item.result.M.gopherId.S",
"linkedHoles": "$inputRoot.Item.result.M.linkedHoles.N"
}
#end
#if("$inputRoot.Item.error" != "")
,"error": "$inputRoot.Item.error.S"
#end
#else
#set($context.responseOverride.status = 404)
"message": "A job with the provided id could not be found"
#end
}
/holes:
post:
summary: Track a new hole
description: When you find a new gopher hole, add it into the system via this endpoint
tags:
- Holes
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/Hole'
responses:
201:
$ref: '#/components/responses/Created'
x-postman-variables:
- type: save
name: holdId
path: .id
400:
$ref: '#/components/responses/BadRequest'
x-amazon-apigateway-request-validator: Validate All
x-amazon-apigateway-integration:
credentials:
Fn::Sub: ${AddHoleRole.Arn}
uri:
Fn::Sub: arn:${AWS::Partition}:apigateway:${AWS::Region}:dynamodb:action/PutItem
httpMethod: POST
type: aws
passthroughBehavior: 'never'
requestTemplates:
application/json:
Fn::Sub:
- |-
#set($epochDate = $context.requestTimeEpoch / 1000 )
{
"TableName": "${TableName}",
"Item":{
"pk": { "S": "$context.requestId"},
"sk": { "S": "hole#"},
"GSI1PK": { "S": "hole#"},
"GSI1SK": { "S": "$epochDate"},
#if("$input.path('$.location.latitude')" != "")
"GSI2PK": { "S": "$input.path('$.location.latitude')#$input.path('$.location.longitude')" },
#else
"GSI2PK": { "S": "$input.path('$.location.addressLine1')#$input.path('$.location.city')#$input.path('$.location.state')" },
#end
"GSI2SK": { "S": "hole#" },
"data": {
"M": {
"description": { "S": "$input.path('$.description')" },
"location": {
"M": {
#if("$input.path('$.location.latitude')" != "")
"latitude": { "S": "$input.path('$.location.latitude')"},
"longitude": { "S": "$input.path('$.location.longitude')"}
#end
#if("$input.path('$.location.city')" != "")
"city": { "S": "$input.path('$.location.city')" },
"state": { "S": "$input.path('$.location.state')" }
#if("$input.path('$.location.addressLine1')" != ""),
"addressLine1": { "S": "$input.path('$.location.addressLine1')" }
#end
#if("$input.path('$.location.addressLine2')" != ""),
"addressLine2": { "S": "$input.path('$.location.addressLine2')" }
#end
#end
}
}
}
#if("$input.path('$.gopherId')" != ""),
"gopherId": { "S": "$input.path('$.gopherId')"}
#end
#if("$input.path('$.status')" != ""),
"status": { "S": "$input.path('$.status')"}
#else
,"status": { "S": "visible"}
#end
#if("$input.path('$.comment')" != ""),
"comment": { "S": "$input.path('$.comment')"}
#end
}
}
},
"ReturnValues": "NONE"
}
- { TableName: { Ref: TableName } }
responses:
200:
statusCode: 201
responseTemplates:
application/json: |
#set($context.responseOverride.header.Access-Control-Allow-Origin = '*')
#set($inputRoot = $input.path('$'))
{
"id": "$context.requestId"
}
get:
summary: View a list of all holes
description: To view a list of all the gopher holes, use this endpoint. Returns all holes by default, but has an optional query parameter to filter by status
parameters:
- in: query
name: status
required: false
description: Filter holes by their current status
example: filled
schema:
type: string
tags:
- Holes
responses:
200:
description: The list of holes was returned
content:
application/json:
schema:
$ref: '#/components/schemas/HoleSummary'
x-amazon-apigateway-request-validator: Validate All
x-amazon-apigateway-integration:
credentials:
Fn::Sub: ${GetAllHolesRole.Arn}
uri:
Fn::Sub: arn:${AWS::Partition}:apigateway:${AWS::Region}:dynamodb:action/Query
httpMethod: POST
type: aws
passthroughBehavior: never
requestTemplates:
application/json:
Fn::Sub:
- |-
{
"TableName": "${TableName}",
"IndexName": "GSI1",
"KeyConditionExpression": "#GSI1PK = :GSI1PK",
"ExpressionAttributeNames": {
"#GSI1PK": "GSI1PK"
},
"ExpressionAttributeValues": {
":GSI1PK": { "S": "hole#" }
}
}
- { TableName: { Ref: TableName } }
responses:
200:
statusCode: 200
responseTemplates:
application/json: |
#set($context.reponseOverride.header.Access-Control-Allow-Origin = '*')
#set($inputRoot = $input.path('$'))
{
"items": [
#foreach($elem in $inputRoot.Items) {
"id": "$elem.pk.S",
"description": "$elem.data.M.description.S",
"location": {
#if("$elem.data.M.location.M.city.S" != "")
"city": "$elem.data.M.location.M.city.S",
"state": "$elem.data.M.location.M.state.S"
#else
"latitude": "$elem.data.M.location.M.latitude.S",
"longitude": "$elem.data.M.location.M.longitude.S"
#end
}
#if("$elem.data.M.location.M.gopherId.S" != ""),
"type": "$elem.data.M.location.M.gopherId.S"
#end
}
#end
]
}
/holes/{holeId}/statuses:
parameters:
- $ref: '#/components/parameters/holeId'
post:
summary: Update the gopher hole status
description: When the status of the gopher hole changes, i.e. filled, post to the this endpoint to update the hole.
tags:
- Holes
requestBody:
required: true
content:
application/json:
schema:
type: object
required:
- status
properties:
status:
type: string
minLength: 1
enum: [filled, visible]
description: New status of the gopher hole
example: filled
responses:
204:
$ref: '#/components/responses/NoContent'
400:
$ref: '#/components/responses/BadRequest'
x-amazon-apigateway-request-validator: Validate All
x-amazon-apigateway-integration:
credentials:
Fn::Sub: ${AddHoleStatusRole.Arn}
uri:
Fn::Sub: arn:${AWS::Partition}:apigateway:${AWS::Region}:dynamodb:action/UpdateItem
httpMethod: POST
type: aws
passthroughBehavior: 'never'
requestTemplates:
application/json:
Fn::Sub:
- |-
#set($epochDate = $context.requestTimeEpoch / 1000 )
{
"TableName": "${TableName}",
"Key": {
"pk": { "S": "$input.params('holeId')" },
"sk": { "S": "hole#" }
},
"KeyConditionExporession": "#pk = :pk",
"UpdateExpression": "#data.#status = :status",
"ExpressionAttributeNames": {
"#pk": "pk",
"#data": "data",
"#status": "status"
},
"ExpressionAttributeValues": {
":pk": { "S": "$input.params('holeId')" },
":status": { "S": "$input.path('$.status')" }
},
"ReturnValues": "NONE"
}
- { TableName: { Ref: TableName } }
responses:
200:
statusCode: 204
responseTemplates:
application/json: |
#set($context.responseOverride.header.Access-Control-Allow-Origin = '*')
400:
statusCode: 404
responseTemplates:
application/json: |
#set($context.responseOverride.header.Access-Control-Allow-Origin = '*')
{
"message": "A hole with the provided id could not be found"
}
/holes/{holeId}:
parameters:
- $ref: '#/components/parameters/holeId'
put:
summary: Update the details of a specific hole
description: If updates are necessary to the hole, pass in all the details and replace the entity entirely.
tags:
- Holes
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/Hole'
responses:
204:
$ref: '#/components/responses/NoContent'
400:
$ref: '#/components/responses/BadRequest'
404:
$ref: '#/components/responses/NotFound'
x-amazon-apigateway-request-validator: Validate All
x-amazon-apigateway-integration:
uri:
Fn::Sub: arn:${AWS::Partition}:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/${UpdateHoleFunction.Arn}/invocations
httpMethod: POST
type: aws_proxy
patch:
summary: Update some of the details of a specific hole
description: Will update only the provided details of the whole
tags:
- Holes
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/HolePatch'
responses:
204:
$ref: '#/components/responses/NoContent'
400:
$ref: '#/components/responses/BadRequest'
404:
$ref: '#/components/responses/NotFound'
x-amazon-apigateway-request-validator: Validate All
x-amazon-apigateway-integration:
uri:
Fn::Sub: arn:${AWS::Partition}:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/${UpdateHoleFunction.Arn}/invocations
httpMethod: POST
type: aws_proxy
get:
summary: Get the details of a specific hole
description: To view additional details about a hole, look it up by id.
tags:
- Holes
responses:
200:
description: The requested hole has been found and the details returned
content:
application/json:
schema:
$ref: '#/components/schemas/Hole'
404:
$ref: '#/components/responses/NotFound'
x-amazon-apigateway-request-validator: Validate All
x-amazon-apigateway-integration:
uri:
Fn::Sub: arn:${AWS::Partition}:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/${GetHoleFunction.Arn}/invocations
httpMethod: POST
type: aws_proxy
components:
securitySchemes:
api_key:
type: apiKey
name: x-api-key
in: header
parameters:
gopherId:
name: gopherId
in: path
description: Unique identifier for a gopher
required: true
schema:
type: string
example: kfghusfdglksgu858y
x-postman-variables:
- type: load
name: gopherId
holeId:
name: holeId
in: path
description: Unique identifier for a hole
required: true
schema:
type: string
example: dhr558QRdvSoBkM9JcLFSK
x-postman-variables:
- type: load
name: holeId
schemas:
Gopher:
description: All information describing a gopher
type: object
required:
- name
- location
properties:
id:
type: string
description: Unique identifier of the gopher
example: 8dqNfMQaR4VfHxsizLJyCx
name:
type: string
minLength: 1
description: The name of the gopher given by the hunter who submitted it
example: Gerry
type:
type: string
enum: [Western Pocket, Eastern Pocket, Geomys]
description: What kind of gopher is this?
example: Western Pocket
sex:
type: string
enum: [male, female, no preference, unknown]
description: Sex of the gopher
example: male
picture:
type: string
minLength: 1
description: Url of a recent photo
example: https://gopherhunter.s3.amazonaws.com/gerry.jpg
timesSeen:
type: number
description: How many times has this gopher been spotted
example: 42
status:
type: string
description: Current status of the gopher
enum: [at large, trapped, deceased, unknown]
example: at large
color:
type: string
description: Color of the Gopher's fur
example: brown
location:
$ref: '#/components/schemas/Location'
comment:
type: string
description: Text comment with any additional details
example: He keeps eating the carrots from my garden. So annoying!!
knownAssociates:
type: array
items:
type: object
required:
- id
- name
properties:
id:
type: string
minLength: 1
description: Unique identifier of the gopher
example: 5Fe3ZQqqEcurytZdK69iew
name:
type: string
minLength: 1
description: Name of the associated gopher
example: Carla
UpdateGopher:
description: All information describing a gopher
type: object
properties:
name:
type: string
minLength: 1
description: The name of the gopher given by the hunter who submitted it
example: Gerry
type:
type: string
enum: [Western Pocket, Eastern Pocket, Geomys]
description: What kind of gopher is this?
example: Western Pocket
sex:
type: string
enum: [male, female, no preference, unknown]
description: Sex of the gopher
example: male
picture:
type: string
minLength: 1
description: Url of a recent photo
example: https://gopherhunter.s3.amazonaws.com/gerry.jpg
status:
type: string
description: Current status of the gopher
enum: [at large, trapped, deceased, unknown]
example: at large
color:
type: string
description: Color of the Gopher's fur
example: brown
location:
$ref: '#/components/schemas/Location'
comment:
type: string
description: Text comment with any additional details
example: He keeps eating the carrots from my garden. So annoying!!
Location:
description: Where it is located
oneOf:
- type: object
required:
- latitude
- longitude
properties:
latitude:
type: string
minLength: 1
description: Latitude location of the known whereabouts
example: '33.067067'
longitude:
type: string
minLength: 1
description: Longitude location of the known whereabouts
example: '-96.801599'
- type: object
required:
- city
- state
properties:
addressLine1:
type: string
description: Line 1 of the address of the known whereabouts
example: 123 Main Street
addressLine 2:
type: string
description: Line 2 of the address of the known whereabouts
example: 'Apt #2212'
city:
type: string
minLength: 1
description: City of the known whereabouts
example: Plano
state:
type: string
minLength: 1
description: State of the known whereabouts
example: TX
example:
latitude: '33.067067'
longitude: '-96.801599'
GopherSummary:
description: High level information about a gopher
type: array
items:
type: object
required:
- id
- name
properties:
id:
type: string
minLength: 1
description: Unique identifier of the gopher
example: igdLLki4no9ey1aN2rAB3s
name:
type: string
minLength: 1
description: The name of the gopher given by the hunter who submitted it
example: Gerry
type:
type: string
enum: [Western Pocket, Eastern Pocket, Geomys]
description: What kind of gopher is this?
example: Western Pocket
location:
type: object
description: Known location of the gopher
oneOf:
- type: object
required:
- latitude
- longitude
properties:
latitude:
type: string
minLength: 1
description: Latitude location of the gopher's whereabouts
example: '33.067067'
longitude:
type: string
minLength: 1
description: Longitude location of the gopher's whereabouts
example: '-96.801599'
- type: object
required:
- city
- state
- addressLine1
properties:
addressLine1:
type: string
description: Line 1 of the address of the known whereabouts
example: 123 Main Street
addressLine 2:
type: string
description: Line 2 of the address of the known whereabouts
example: 'Apt #2212'
city:
type: string
minLength: 1
description: City of the known whereabouts
example: Plano
state:
type: string
minLength: 1
description: State of the known whereabouts
example: TX
example:
latitude: '33.067067'
longitude: '-96.801599'
Hole:
description: Full detailed information about a gopher hole
type: object
required:
- location
- description