-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathswagger.yaml
136 lines (128 loc) · 3.28 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
---
swagger: "2.0"
info:
title:
Fn::Sub: scheduler-${ENVIRONMENT}
description: REST APIs for scheduler service
contact:
name: Joakim Hedlund
version: 1.0.0
servers:
- url:
Fn::Sub: https://aws.triplehead.net/${PROJECT}/
description: The best of servers.
schemes:
- https
x-definitions:
APILambda: &APILambda
x-amazon-apigateway-integration:
uri:
Fn::Sub: arn:aws:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/${ApiLambda.Arn}/invocations
passthroughBehavior: when_no_match
httpMethod: POST
type: aws_proxy
CORSHeaders: &CORSHeaders
Access-Control-Allow-Headers:
type: string
Access-Control-Allow-Methods:
type: string
Access-Control-Allow-Origin:
type: string
enableCORS: &enableCORS
<<: *APILambda
responses:
200:
description: Allows CORS
definitions:
Job:
type: object
properties:
id:
type: string
description: UUID for the job, e.g. `193a3b0d-aec5-42ae-acf9-40d9e843447c`
endpoint:
type: string
description: URL that will be called when the job is executed.
method:
type: string
description: GET, POST, PUT, PATCH, or DELETE
body:
type: object
description: JSON payload, required for methods that aren't GET or DELETE
scheduleAt:
type: string
description: An ISO 8601-compatible timestamp, e.g. `2021-09-03T18:45:00.000Z`
createdAt:
type: string
updatedAt:
type: string
executedAt:
type: string
paths:
/jobs:
options:
<<: *enableCORS
get:
<<: *APILambda
summary: List all jobs
responses:
200:
description: Success
schema:
type: array
items:
$ref: '#/definitions/Job'
post:
<<: *APILambda
summary: Create a job
consumes:
- application/json
parameters:
- name: event
in: body
required: true
schema:
$ref: '#/definitions/Job'
required:
- endpoint
- scheduleAt
responses:
200:
description: maximum swag
400:
description: no bueno
/jobs/{id}:
options:
<<: *enableCORS
parameters:
- name: id
in: path
type: string
required: true
get:
<<: *APILambda
summary: Retrieve a job
parameters:
- name: id
in: path
type: string
required: true
responses:
200:
description: Success
headers:
<<: *CORSHeaders
schema:
$ref: '#/definitions/Job'
x-amazon-apigateway-request-validator: validate-body-and-params
x-amazon-apigateway-request-validators:
validate-body-and-params:
validateRequestParameters: true
validateRequestBody: true
x-amazon-apigateway-gateway-responses:
DEFAULT_4XX: &gatewayCorsResponse
responseParameters:
gatewayresponse.header.Access-Control-Allow-Headers: "'Content-Type,Authorization'"
gatewayresponse.header.Access-Control-Allow-Methods: "'OPTIONS,GET,POST'"
gatewayresponse.header.Access-Control-Allow-Origin: "'*'"
DEFAULT_5XX: *gatewayCorsResponse