forked from RedHatInsights/insights-host-inventory
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathapi.spec.yaml
818 lines (818 loc) · 24.8 KB
/
api.spec.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
openapi: 3.0.0
info:
description: REST interface for the Insights Platform Host Inventory application.
version: 1.0.0
title: Insights Host Inventory REST Interface
paths:
/hosts:
get:
operationId: api.host.get_host_list
tags:
- hosts
summary: Read the entire list of hosts
description: Read the entire list of all hosts available to the account.
security:
- ApiKeyAuth: []
parameters:
- in: query
name: display_name
schema:
type: string
description: A part of a searched host’s display name.
required: false
- in: query
name: fqdn
schema:
type: string
description: Filter by a host's FQDN
required: false
- in: query
name: hostname_or_id
schema:
type: string
description: 'Search for a host by display_name, fqdn, id'
required: false
- in: query
name: insights_id
schema:
type: string
format: uuid
description: Search for a host by insights_id
required: false
- $ref: '#/components/parameters/perPageParam'
- $ref: '#/components/parameters/pageParam'
responses:
'200':
description: Successfully read the hosts list.
content:
application/json:
schema:
$ref: '#/components/schemas/HostQueryOutput'
post:
operationId: api.host.add_host_list
tags:
- hosts
summary: Create/update multiple host and add them to the host list
description: >-
Create a new host and add it to the host list or update an existing
hosts. A host is updated if there is already one with the same
canonicals facts and belonging to the same account.
security:
- ApiKeyAuth: []
- BearerAuth: []
requestBody:
description: A list of host objects to be added to the host list
required: true
content:
application/json:
schema:
x-body-name: host_list
type: array
items:
$ref: '#/components/schemas/CreateHostIn'
responses:
'207':
description: Successfully created a host.
content:
application/json:
schema:
$ref: '#/components/schemas/BulkHostOut'
examples:
update:
value:
status: 200
host: Host details
create:
value:
status: 201
host: Host details
error:
value:
status: 400
title: Invalid Request
detail: Could not process request
host: Input host data
'400':
description: Invalid request.
'/hosts/{host_id_list}':
get:
tags:
- hosts
summary: Find hosts by their IDs
description: Find one or more hosts by their ID.
operationId: api.host.get_host_by_id
security:
- ApiKeyAuth: []
parameters:
- in: path
name: host_id_list
description: A comma separated list of host IDs.
required: true
schema:
type: array
items:
type: string
format: uuid
- $ref: '#/components/parameters/perPageParam'
- $ref: '#/components/parameters/pageParam'
responses:
'200':
description: Successfully searched for hosts.
content:
application/json:
schema:
$ref: '#/components/schemas/HostQueryOutput'
'400':
description: Invalid request.
'404':
description: Host not found.
'/hosts/{host_id_list}/facts/{namespace}':
patch:
tags:
- hosts
summary: Merge facts under a namespace
description: Merge one or multiple hosts facts under a namespace.
operationId: api.host.merge_facts
security:
- ApiKeyAuth: []
parameters:
- in: path
name: host_id_list
description: IDs of the hosts that own the facts to be merged.
required: true
schema:
type: array
items:
type: string
- in: path
name: namespace
description: A namespace of the merged facts.
required: true
schema:
type: string
requestBody:
description: A dictionary with the new facts to merge with the original ones.
required: true
content:
application/json:
schema:
x-body-name: fact_dict
$ref: '#/components/schemas/Facts'
responses:
'200':
description: Successfully merged facts.
'400':
description: Invalid request.
'404':
description: Host or namespace not found.
put:
tags:
- hosts
summary: Replace facts under a namespace
description: Replace facts under a namespace
security:
- ApiKeyAuth: []
operationId: api.host.replace_facts
parameters:
- in: path
name: host_id_list
description: IDs of the hosts that own the facts to be replaced.
required: true
schema:
type: array
items:
type: string
- in: path
name: namespace
description: A namespace of the merged facts.
required: true
schema:
type: string
requestBody:
description: A dictionary with the new facts to replace the original ones.
required: true
content:
application/json:
schema:
x-body-name: fact_dict
$ref: '#/components/schemas/Facts'
responses:
'200':
description: Successfully replaced facts.
'400':
description: Invalid request.
'404':
description: Host or namespace not found.
'/hosts/{host_id_list}/system_profile':
get:
tags:
- hosts
summary: Return one or more hosts system profile
description: Find one or more hosts by their ID and return the id and system profile
operationId: api.host.get_host_system_profile_by_id
security:
- ApiKeyAuth: []
parameters:
- in: path
name: host_id_list
description: A comma separated list of host IDs.
required: true
schema:
type: array
items:
type: string
format: uuid
- $ref: '#/components/parameters/perPageParam'
- $ref: '#/components/parameters/pageParam'
responses:
'200':
description: Successfully searched for hosts.
content:
application/json:
schema:
$ref: '#/components/schemas/SystemProfileByHostOut'
'400':
description: Invalid request.
'404':
description: Host not found.
components:
securitySchemes:
BearerAuth:
type: http
scheme: bearer
x-bearerInfoFunc: app.auth.bearer_token_handler
ApiKeyAuth:
type: apiKey
in: header
name: x-rh-identity
description: >-
Base64-encoded JSON identity header provided by 3Scale. Contains an
account number of the user issuing the request. Format of the JSON:
{"identity": {"account_number": "12345678"}}
x-apikeyInfoFunc: app.auth.authentication_header_handler
parameters:
pageParam:
name: page
in: query
required: false
schema:
type: integer
minimum: 1
default: 1
description: A page number of the items to return.
perPageParam:
name: per_page
in: query
required: false
schema:
type: integer
minimum: 1
maximum: 100
default: 50
description: A number of items to return per page.
schemas:
BulkHostOut:
type: object
properties:
total:
type: integer
description: Total number of items in the "data" list.
errors:
type: integer
description: Number of items in the "data" list that contain errors.
data:
type: array
items:
$ref: '#/components/schemas/BulkHostOutDetails'
description: 'List of hosts that were created, updated or failed to be processed.'
BulkHostOutDetails:
type: object
properties:
status:
type: integer
description: HTTP status code of the results of the host create/update process
host:
$ref: '#/components/schemas/CreateHostOut'
title:
type: string
description: Short description of why a host failed to be created or updated.
detail:
type: string
description: Details about why a host failed to be created or updated.
Facts:
title: Host facts
description: A set of string facts about a host.
type: object
example:
fact1: value1
fact2: value2
FactSet:
title: Host facts under a namespace
description: A set of string facts belonging to a single namespace.
properties:
namespace:
type: string
minLength: 1
description: A namespace the facts belong to.
facts:
type: object
description: The facts themselves.
example:
fact1: value1
fact2: value2
required:
- namespace
- facts
CreateHostIn:
title: Host data
description: >-
Data of a single host belonging to an account. Represents the hosts
without its Inventory metadata.
type: object
required:
- account
properties:
display_name:
description: >-
A host’s human-readable display name, e.g. in a form of a domain
name.
type: string
example: host1.mydomain.com
account:
description: A Red Hat Account number that owns the host.
type: string
example: '000102'
insights_id:
description: >-
An ID defined in /etc/insights-client/machine-id. This field is
considered a canonical fact.
type: string
example: 3f01b55457674041b75e41829bcee1dc
rhel_machine_id:
description: >-
A Machine ID of a RHEL host. This field is considered to be a
canonical fact.
type: string
example: 3f01b55457674041b75e41829bcee1dc
subscription_manager_id:
description: >-
A Red Hat Subcription Manager ID of a RHEL host. This field is
considered to be a canonical fact.
type: string
example: 3f01b55457674041b75e41829bcee1dc
satellite_id:
description: >-
A Red Hat Satellite ID of a RHEL host. This field is considered to
be a canonical fact.
type: string
example: 3f01b55457674041b75e41829bcee1dc
bios_uuid:
description: >-
A UUID of the host machine BIOS. This field is considered to be a
canonical fact.
type: string
example: 3f01b55457674041b75e41829bcee1dc
ip_addresses:
description: >-
Host’s network IP addresses. This field is considered to be a
canonical fact.
type: array
items:
type: string
example:
- 10.10.0.1
- 10.0.0.2
fqdn:
description: >-
A host’s Fully Qualified Domain Name. This field is considered to
be a canonical fact.
type: string
example: my.host.example.com
mac_addresses:
description: >-
Host’s network interfaces MAC addresses. This field is considered
to be a canonical fact.
type: array
items:
type: string
example:
- 'c2:00:d0:c8:61:01'
external_id:
description: >-
Host’s reference in the external source e.g. AWS EC2, Azure,
OpenStack, etc. This field is considered to be a canonical fact.
type: string
example: i-05d2313e6b9a42b16
facts:
description: A set of facts belonging to the host.
type: array
items:
$ref: '#/components/schemas/FactSet'
system_profile:
$ref: '#/components/schemas/SystemProfileIn'
CreateHostOut:
title: Create Host Out
description: >-
Data of a single host belonging to an account. Represents the hosts
without its Inventory metadata.
type: object
required:
- account
properties:
display_name:
description: >-
A host’s human-readable display name, e.g. in a form of a domain
name.
type: string
example: host1.mydomain.com
nullable: true
account:
description: A Red Hat Account number that owns the host.
type: string
example: '000102'
insights_id:
description: >-
An ID defined in /etc/insights-client/machine-id. This field is
considered a canonical fact.
type: string
example: 3f01b55457674041b75e41829bcee1dc
nullable: true
rhel_machine_id:
description: >-
A Machine ID of a RHEL host. This field is considered to be a
canonical fact.
type: string
example: 3f01b55457674041b75e41829bcee1dc
nullable: true
subscription_manager_id:
description: >-
A Red Hat Subcription Manager ID of a RHEL host. This field is
considered to be a canonical fact.
type: string
example: 3f01b55457674041b75e41829bcee1dc
nullable: true
satellite_id:
description: >-
A Red Hat Satellite ID of a RHEL host. This field is considered to
be a canonical fact.
type: string
example: 3f01b55457674041b75e41829bcee1dc
nullable: true
bios_uuid:
description: >-
A UUID of the host machine BIOS. This field is considered to be a
canonical fact.
type: string
example: 3f01b55457674041b75e41829bcee1dc
nullable: true
ip_addresses:
description: >-
Host’s network IP addresses. This field is considered to be a
canonical fact.
type: array
items:
type: string
nullable: true
example:
- 10.10.0.1
- 10.0.0.2
fqdn:
description: >-
A host’s Fully Qualified Domain Name. This field is considered to
be a canonical fact.
type: string
example: my.host.example.com
nullable: true
mac_addresses:
description: >-
Host’s network interfaces MAC addresses. This field is considered
to be a canonical fact.
type: array
items:
type: string
nullable: true
example:
- 'c2:00:d0:c8:61:01'
external_id:
description: >-
Host’s reference in the external source e.g. AWS EC2, Azure,
OpenStack, etc. This field is considered to be a canonical fact.
type: string
nullable: true
example: i-05d2313e6b9a42b16
id:
description: >-
A durable and reliable platform-wide host identifier. Applications
should use this identifier to reference hosts.
type: string
example: 3f01b55457674041b75e41829bcee1dc
created:
description: A timestamp when the entry was created.
type: string
format: date-time
updated:
description: A timestamp when the entry was last updated.
type: string
format: date-time
facts:
description: A set of facts belonging to the host.
type: array
items:
$ref: '#/components/schemas/FactSet'
HostOut:
title: A Host Inventory entry
description: A database entry representing a single host with its Inventory metadata.
allOf:
- $ref: '#/components/schemas/CreateHostOut'
- type: object
properties:
facts:
description: A set of facts belonging to the host.
type: array
items:
$ref: '#/components/schemas/FactSet'
HostQueryOutput:
title: A Host Inventory query result
description: >-
A paginated host search query result with host entries and their
Inventory metadata.
type: object
required:
- count
- page
- per_page
- total
- results
properties:
count:
description: A number of entries on the current page.
type: integer
page:
description: A current page number.
type: integer
per_page:
description: A page size – a number of entries per single page.
type: integer
total:
description: A total count of the found entries.
type: integer
results:
description: Actual host search query result entries.
type: array
items:
$ref: '#/components/schemas/HostOut'
SystemProfileByHostOut:
title: A host system profile query result
description: Structure of the output of the host system profile query
type: object
required:
- count
- page
- per_page
- total
- results
properties:
count:
description: A number of entries on the current page.
type: integer
page:
description: A current page number.
type: integer
per_page:
description: A page size – a number of entries per single page.
type: integer
total:
description: A total count of the found entries.
type: integer
results:
description: Actual host search query result entries.
type: array
items:
$ref: '#/components/schemas/HostSystemProfileOut'
HostSystemProfileOut:
title: Structure of an individual host system profile output
description: Individual host record that contains only the host id and system profile
properties:
id:
type: string
system_profile:
$ref: '#/components/schemas/SystemProfileIn'
DiskDevice:
title: Disk Device
description: Representation of one mounted device
properties:
device:
example:
device:
summary: device example
value: "/dev/fdd0"
type: string
label:
description: user-defined mount label
type: string
options:
description: mount options
example:
options:
summary: Options example
value: {"uid": "0", "ro": true}
type: object
properties:
name:
type: string
value:
type: string
mount_point:
description: mount point
example:
mountpoint:
summary: mount point example
value: "/mnt/remote_nfs_share"
type: string
type:
description: mount type
example:
mounttype:
summary: mount type example
value: "ext3"
type: string
YumRepo:
title: Yum Repository
description: Representation of one yum repository
properties:
name:
type: string
gpgcheck:
type: boolean
enabled:
type: boolean
baseurl:
type: string
format: uri
InstalledProduct:
title: Installed Product
description: Representation of one installed product
properties:
name:
type: string
id:
description: the product ID
example:
product_id:
summary: product ID example
value: "71"
type: string
status:
description: subscription status for product
example:
status:
summary: status example
value: "Subscribed"
type: string
NetworkInterface:
title: Network Interface
description: Representation of one network interface
properties:
ipv4_addresses:
type: array
items:
type: string
format: ipv4
ipv6_addresses:
type: array
items:
type: string
format: ipv6
mtu:
description: MTU
type: integer
mac_address:
description: MAC address
example:
mac_colons:
summary: mac address with colons
value: "00:00:00:00:00:00"
mac_hex:
summary: mac address
value: "000000000000"
type: string
name:
description: name of interface
type: string
example:
eth0:
summary: eth0 example
value: "eth0"
state:
description: interface state
type: string
example:
up:
summary: up example
value: "UP"
down:
summary: down example
value: "DOWN"
unknown:
summary: unknown example
value: "UNKNOWN"
type:
description: interface type
type: string
example:
ether:
summary: ether example
value: "ether"
loop:
summary: loopback example
value: "loopback"
SystemProfileIn:
title: System profile fields
description: Representation of the system profile fields
type: object
properties:
number_of_cpus:
type: integer
number_of_sockets:
type: integer
cores_per_socket:
type: integer
system_memory_bytes:
type: integer
infrastructure_type:
type: string
infrastructure_vendor:
type: string
network_interfaces:
type: array # techincally a set, ordering is not important
items:
$ref: '#/components/schemas/NetworkInterface'
disk_devices:
type: array # techincally a set, ordering is not important
items:
$ref: '#/components/schemas/DiskDevice'
bios_vendor:
type: string
bios_version:
type: string
bios_release_date:
type: string
cpu_flags:
items:
type: string
type: array
os_release:
type: string
os_kernel_version:
type: string
arch:
type: string
kernel_modules:
type: array
items:
type: string
last_boot_time:
type: string
format: date-time
running_processes:
type: array # techincally a set, ordering is not important
items:
description: a single running process. This will be truncated to 1000 characters when saved.
type: string
subscription_status:
type: string
subscription_auto_attach:
type: string
katello_agent_running:
type: boolean
satellite_managed:
type: boolean
yum_repos:
type: array # technically a set, ordering is not important
items:
$ref: '#/components/schemas/YumRepo'
installed_products:
type: array # technically a set, ordering is not important
items:
$ref: '#/components/schemas/InstalledProduct'
insights_client_version:
type: string
insights_egg_version:
type: string
installed_packages:
type: array # technically a set, ordering is not important
items:
description: a NEVRA string for a single installed package
type: string
example:
package:
summary: package example
value: "0:krb5-libs-1.16.1-23.fc29.i686"
installed_services:
type: array
items:
type: string
enabled_services:
type: array
items:
type: string