-
Notifications
You must be signed in to change notification settings - Fork 36
/
Copy pathswagger.yaml
680 lines (636 loc) · 19 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
---
#-----------------------------------------------------------------------------------------------------------------------
# Copyright Amazon.com Inc. or its affiliates. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance
# with the License. A copy of the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in the 'license' file accompanying this file. This file is distributed on an 'AS IS' BASIS, WITHOUT WARRANTIES
# OR CONDITIONS OF ANY KIND, express or implied. See the License for the specific language governing permissions
# and limitations under the License.
#-----------------------------------------------------------------------------------------------------------------------
openapi: 3.0.0
info:
title: 'AWS Connected Device Framework: Device Patcher'
description: >
Allows for patching of devices remotely utilizing SSM State Manager Associations Ansible Playbook executions on physical devices.
version: 1.0.0
tags:
- name: Patch Templates
description: >
A Template that provides specifies the configuration of a patch Task
- name: Activation
description: >
Activation represent SSM acitvation of devices as hybrid instances
- name: Patch Tasks
description: >
Patch represent SSM State Manager association against devices managed as hybrid instances.
paths:
'/patchTemplates':
post:
tags:
- Patch Templates
summary: Creates a new patch patch template
description: >
Defines a new template by specifying the type of the patch "agentless" or "agentbased" and a source of the ansible playbook.
operationId: createTemplate
requestBody:
content:
application/vnd.aws-cdf-v1.0+json:
schema:
$ref: '#/components/schemas/CreatePatchTemplate'
responses:
'201':
description: Created
'400':
$ref: '#/components/responses/BadRequest'
'409':
$ref: '#/components/responses/Conflict'
get:
tags:
- Patch Templates
summary: List all available patch patch templates.
operationId: listTemplates
responses:
'200':
description: OK
content:
application/vnd.aws-cdf-v1.0+json:
schema:
$ref: '#/components/schemas/PatchTemplatesList'
'404':
$ref: '#/components/responses/NotFound'
'/patchTemplates/{templateName}':
parameters:
- $ref: '#/components/parameters/templateName'
patch:
tags:
- Patch Templates
summary: Updates a patch patch template
description: >
Defines a new template by specifying the type of the patch "agentless" or "agentbased" and a source of the ansible playbook.
operationId: updateTemplate
requestBody:
content:
multipart/form-data:
schema:
$ref: '#/components/schemas/UpdatePatchTemplate'
responses:
'201':
description: Created
'400':
$ref: '#/components/responses/BadRequest'
get:
tags:
- Patch Templates
summary: Find a specific patch template
description: >
Returns a specific patch template by template name.
operationId: getTemplate
responses:
'200':
description: OK
content:
application/vnd.aws-cdf-v1.0+json:
schema:
$ref: '#/components/schemas/PatchTemplate'
'404':
$ref: '#/components/responses/NotFound'
delete:
tags:
- Patch Templates
summary: Deletes a specific patch template
description: >
Deletes a specific patch template by template name.
operationId: deleteTemplate
responses:
'204':
description: OK
'404':
$ref: '#/components/responses/NotFound'
'/activiations':
'post':
tags:
- Activation
summary: Creates a device activation
description: >
Creates an SSM activation for a managed device
operationId: createActivation
requestBody:
content:
application/vnd.aws-cdf-v1.0+json:
schema:
$ref: '#/components/schemas/Activation'
responses:
'200':
description: OK
content:
application/vnd.aws-cdf-v1.0+json:
schema:
$ref: '#/components/schemas/Activation'
'/activations/{activationId}':
parameters:
- $ref: '#/components/parameters/activationId'
get:
tags:
- Activation
summary: Find a specific activation by Id
operationId: getActivationById
responses:
'200':
description: OK
content:
application/vnd.aws-cdf-v1.0+json:
schema:
$ref: '#/components/schemas/Activation'
'404':
$ref: '#/components/responses/NotFound'
delete:
tags:
- Activation
summary: Deletes a specific activation for a device by id
operationId: deleteActivationById
responses:
'204':
description: OK
'404':
$ref: '#/components/responses/NotFound'
'/patchTasks':
'post':
tags:
- Patch Tasks
summary: Creates a device patches in bulk
description: >
Creates an SSM state manager association for a ssm managed device
operationId: createPatchTask
requestBody:
content:
application/vnd.aws-cdf-v1.0+json:
schema:
$ref: '#/components/schemas/PatchList'
responses:
'200':
description: OK
content:
application/vnd.aws-cdf-v1.0+json:
schema:
$ref: '#/components/schemas/PatchTask'
'/patchTasks/{patchTaskId}':
parameters:
- $ref: '#/components/parameters/patchTaskId'
get:
tags:
- Patch Tasks
summary: Find a specific patch Task by patchTaskId
operationId: getPatchById
responses:
'200':
description: OK
content:
application/vnd.aws-cdf-v1.0+json:
schema:
$ref: '#/components/schemas/PatchTask'
'404':
$ref: '#/components/responses/NotFound'
'/patches/{patchId}':
parameters:
- $ref: '#/components/parameters/patchId'
get:
tags:
- Patch
summary: Get a patch by its Id
operationId: getPatch
responses:
'200':
description: OK
content:
application/vnd.aws-cdf-v1.0+json:
schema:
$ref: '#/components/schemas/Patch'
'404':
$ref: '#/components/responses/NotFound'
patch:
tags:
- Patch
summary: Retry a specific patch by patchId
operationId: patchPatchById
description: >
Retries an SSM state manager association for a ssm managed device
requestBody:
content:
application/vnd.aws-cdf-v1.0+json:
schema:
$ref: '#/components/schemas/RetryPatch'
responses:
'200':
description: OK
'404':
$ref: '#/components/responses/NotFound'
'400':
$ref: '#/components/responses/BadRequest'
delete:
tags:
- Patch
summary: Deletes a specific patch by patchId
operationId: deletePatchById
responses:
'204':
description: OK
'404':
$ref: '#/components/responses/NotFound'
'/patchTasks/{patchTaskId}/patches':
parameters:
- $ref: '#/components/parameters/patchTaskId'
get:
tags:
- Patch Tasks
summary: Gets the list of patches associated with a particular patch Task
operationId: getPatchsByTask
responses:
'200':
description: OK
content:
application/vnd.aws-cdf-v1.0+json:
schema:
$ref: '#/components/schemas/PatchList'
'404':
$ref: '#/components/responses/NotFound'
'/devices/{deviceId}/patches':
parameters:
- $ref: '#/components/parameters/deviceId'
get:
tags:
- Patch
summary: Gets the list of patches associated with a particular device
operationId: getPatchsByDevice
responses:
'200':
description: OK
content:
application/vnd.aws-cdf-v1.0+json:
schema:
$ref: '#/components/schemas/PatchList'
'404':
$ref: '#/components/responses/NotFound'
components:
parameters:
templateName:
name: templateName
in: path
description: Name of template
required: true
schema:
type: string
activationId:
name: activationId
in: path
description: Device task Id
required: true
schema:
type: string
deviceId:
name: deviceId
in: path
description: Device Id
required: true
schema:
type: string
patchTaskId:
name: patchTaskId
in: path
description: Patch Task ID
required: true
schema:
type: string
patchId:
name: patchId
in: path
description: Patch ID
required: true
schema:
type: string
offset:
name: offset
in: query
schema:
type: integer
minimum: 0
count:
name: offset
in: query
schema:
type: integer
minimum: 0
responses:
Created:
description: Created successfully
headers:
location:
schema:
type: string
BadRequest:
description: Invalid input
content:
application/vnd.aws-cdf-v1.0+json:
schema:
$ref: '#/components/schemas/Error'
NotFound:
description: Not found
content:
application/vnd.aws-cdf-v1.0+json:
schema:
$ref: '#/components/schemas/Error'
Conflict:
description: Conflict
content:
application/vnd.aws-cdf-v1.0+json:
schema:
$ref: '#/components/schemas/Error'
schemas:
CreatePatchTemplate:
type: object
properties:
playbookFileContent:
type: string
description: A base64 encoded string of the playbook file
name:
type: string
description: Name of template.
patchType:
type: string
description: type
enum: [agentless, agentbased]
enabled:
type: boolean
description: Whether the template is enabled for use.
description:
type: string
description: Description regarding the template
extraVars[<key>]:
type: string
description: Extra Variables that need to be passed down to the ansible exeucution as input external paramters
required:
- name
- patchType
- playbookFileContent
example:
name: ggv2 installer template
patchType: 'agentbased'
playbookFileContent: 'LS0tCi0gaG9zdHM6IGFsbAogIHJlbW90ZV91c2VyOiBlYzJfdXNlcgogIGdhdGhlcl9mYWN0czogZmFsc2UKICBiZWNvbWU6IHllcwogIHRhc2tzOgogICAgLSBwaW5nOgo='
extraVars[key1]: val1
extraVars[key2]: val2
UpdatePatchTemplate:
type: object
properties:
playbookFile:
type: string
format: binary
description: Path to the playbook file
example: /home/user/playbook.yml
patchType:
type: string
description: type
enum: [agentless, agentbased]
enabled:
type: boolean
description: Whether the template is enabled for use.
description:
type: string
description: Description regarding the template
extraVars[key]:
type: string
description: Extra Variables that need to be passed down to the ansible exeucution as input external paramters
example:
name: ggv2 installer template
extraVars[key1]: var1
PatchTemplate:
type: object
properties:
name:
type: string
description: Name of template.
playbookName:
type: string
description: Name of the playbook.
playbookSource:
type: object
properties:
key:
type: string
description: key path of where the ansible playbook file is stored in S3.
bucket:
type: string
description: Bucket of where the ansible playbook file is stored in S3.
description: Name of template.
patchType:
type: string
description: type
enum: [agentless, agentbased]
enabled:
type: boolean
description: Whether the template is enabled for use.
VersionNo:
type: number
description: Version of the template.
description:
type: string
description: Description regarding the template
createdAt:
type: string
format: 'date-time'
description: Date/time the group was created.
readOnly: true
updatedAt:
type: string
format: 'date-time'
description: Date/time the group was updated.
readOnly: true
extraVars[key]:
type: object
description: Extra Variables that need to be passed down to the ansible exeucution as input external paramters
properties:
<key>:
type: string
example:
name: ggv2 installer template
versionNo: 1
createdAt: '2020-03-16T21:42:53.594Z'
updatedAt: '2020-03-16T21:42:53.594Z'
enabled: true
patchType: 'agentbased'
playbookName: 'ggv2-ec2-amazonlinux2-installer-playbook.yml'
playbookSource:
bucket: 'myBucket'
key: 'device-patching/ggv2-ec2-amazonlinux2-installer-playbook.yml'
extraVars:
commonVar1: commonVarVal1
commonVar2: commonVarVal2
PatchTemplatesList:
properties:
tempaltes:
type: array
description: A list of templates
items:
$ref: '#/components/schemas/PatchTemplate'
pagination:
type: object
properties:
lastEvaulated:
type: object
properties:
name:
type: string
count:
type: integer
example:
templates:
- name: ggv2 installer template
versionNo: 1
createdAt: '2020-03-16T21:42:53.594Z'
updatedAt: '2020-03-16T21:42:53.594Z'
enabled: true
patchType: 'agentbased'
playbookSource:
type: 's3'
bucket: 'myBucket'
prefix: 'device-patching/ggv2-ec2-amazonlinux2-installer-playbook.yml'
extraVars:
commonVar1: commonVarVal1
commonVar2: commonVarVal2
pagination:
count: 3
lastEvaluated:
name: 'myTemplate5'
Activation:
type: object
properties:
deviceId:
type: string
description: The id of target device
activationId:
type: string
description: The id of the activaiton
activationRegion:
type: string
description: The region where device activation has been created
example:
activationId: 'a1102421-922f-46d5-9a85-bdbad8d90d6c'
activationCode: 'nxj3IC1HBquDVxM14Oqo'
activationRegion: 'us-east-1'
PatchTask:
type: object
properties:
taskId:
type: string
description: patch Task Id
createdAt:
type: string
format: 'date-time'
description: Date/time the group was created.
readOnly: true
updatedAt:
type: string
format: 'date-time'
description: Date/time the group was updated.
readOnly: true
patches:
type: array
description: A list of patches
items:
$ref: '#/components/schemas/Patch'
Patch:
type: object
properties:
taskId:
type: string
description: Patch Task Id
readOnly: true
deviceId:
type: string
description: The Id of the Device
readOnly: true
patchId:
type: string
description: The Id of the patch
createdAt:
type: string
format: 'date-time'
description: Date/time the group was created.
readOnly: true
updatedAt:
type: string
format: 'date-time'
description: Date/time the group was updated.
readOnly: true
patchTemplateName:
type: string
description: Patch Template Name
patchStatus:
type: string
description: The status of the patch
enum: [pending, success, failed]
patchType:
type: string
description: The type of patch
enum: [agentless, agentbased]
statusMessage:
type: string
description: Message detail pertaining to patchStatus
readOnly: true
associationId:
type: string
description: SSM Association ID reference once the association is successfully been created
readOnly: true
extraVars:
type: object
properties:
<somekey>:
type: string
description: extra variables which are passed through to the playbook
example:
deviceId: 'ggv2-ec2-devive1'
patchId: 'a1b83c20-ab84-11ea-9634-37cb5e1c09aa'
createdAt: '2020-06-11T01:41:12.546Z'
updatedAt: '2020-06-11T01:41:12.546Z'
patchTemplateName: 'ggv2-ec2-amazonlinux2-template'
patchStatus: 'failed'
patchType: 'agentbased'
statusMessage: 'DEVICE_NOT_ACTIVATED_AS_HYBRID_INSTANCE'
associationId: 'a1b83c20-ab84-11ea-9634-37cb5e1c09aa'
extraVars:
iot_endpoint: '<string>'
iot_role_alias: '<string>'
RetryPatch:
type: object
properties:
patchStatus:
type: string
description: retry is the only supported patching operation supported for Retry Patchs
example:
patchStatus: 'retry'
PatchList:
type: object
properties:
patches:
type: array
description: A list of templates
items:
$ref: '#/components/schemas/Patch'
pagination:
type: object
properties:
lastEvaluated:
type: object
properties:
nextToken:
type: string
description: the last evauluated key token, can be used to retrieve the next batch of patches
count:
type: integer
Error:
type: object
properties:
message:
type: string