This repository has been archived by the owner on Nov 29, 2023. It is now read-only.
/
inventory.py
392 lines (359 loc) · 15.9 KB
/
inventory.py
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
# -*- coding: utf-8 -*-
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
import proto # type: ignore
from google.protobuf import timestamp_pb2 # type: ignore
from google.type import date_pb2 # type: ignore
__protobuf__ = proto.module(
package="google.cloud.osconfig.v1", manifest={"Inventory",},
)
class Inventory(proto.Message):
r"""The inventory details of a VM.
Attributes:
os_info (google.cloud.osconfig_v1.types.Inventory.OsInfo):
Base level operating system information for
the VM.
items (Sequence[google.cloud.osconfig_v1.types.Inventory.ItemsEntry]):
Inventory items related to the VM keyed by an
opaque unique identifier for each inventory
item. The identifier is unique to each distinct
and addressable inventory item and will change,
when there is a new package version.
"""
class OsInfo(proto.Message):
r"""Operating system information for the VM.
Attributes:
hostname (str):
The VM hostname.
long_name (str):
The operating system long name.
For example 'Debian GNU/Linux 9' or 'Microsoft
Window Server 2019 Datacenter'.
short_name (str):
The operating system short name.
For example, 'windows' or 'debian'.
version (str):
The version of the operating system.
architecture (str):
The system architecture of the operating
system.
kernel_version (str):
The kernel version of the operating system.
kernel_release (str):
The kernel release of the operating system.
osconfig_agent_version (str):
The current version of the OS Config agent
running on the VM.
"""
hostname = proto.Field(proto.STRING, number=9,)
long_name = proto.Field(proto.STRING, number=2,)
short_name = proto.Field(proto.STRING, number=3,)
version = proto.Field(proto.STRING, number=4,)
architecture = proto.Field(proto.STRING, number=5,)
kernel_version = proto.Field(proto.STRING, number=6,)
kernel_release = proto.Field(proto.STRING, number=7,)
osconfig_agent_version = proto.Field(proto.STRING, number=8,)
class Item(proto.Message):
r"""A single piece of inventory on a VM.
Attributes:
id (str):
Identifier for this item, unique across items
for this VM.
origin_type (google.cloud.osconfig_v1.types.Inventory.Item.OriginType):
The origin of this inventory item.
create_time (google.protobuf.timestamp_pb2.Timestamp):
When this inventory item was first detected.
update_time (google.protobuf.timestamp_pb2.Timestamp):
When this inventory item was last modified.
type_ (google.cloud.osconfig_v1.types.Inventory.Item.Type):
The specific type of inventory, correlating
to its specific details.
installed_package (google.cloud.osconfig_v1.types.Inventory.SoftwarePackage):
Software package present on the VM instance.
available_package (google.cloud.osconfig_v1.types.Inventory.SoftwarePackage):
Software package available to be installed on
the VM instance.
"""
class OriginType(proto.Enum):
r"""The origin of a specific inventory item."""
ORIGIN_TYPE_UNSPECIFIED = 0
INVENTORY_REPORT = 1
class Type(proto.Enum):
r"""The different types of inventory that are tracked on a VM."""
TYPE_UNSPECIFIED = 0
INSTALLED_PACKAGE = 1
AVAILABLE_PACKAGE = 2
id = proto.Field(proto.STRING, number=1,)
origin_type = proto.Field(
proto.ENUM, number=2, enum="Inventory.Item.OriginType",
)
create_time = proto.Field(
proto.MESSAGE, number=8, message=timestamp_pb2.Timestamp,
)
update_time = proto.Field(
proto.MESSAGE, number=9, message=timestamp_pb2.Timestamp,
)
type_ = proto.Field(proto.ENUM, number=5, enum="Inventory.Item.Type",)
installed_package = proto.Field(
proto.MESSAGE,
number=6,
oneof="details",
message="Inventory.SoftwarePackage",
)
available_package = proto.Field(
proto.MESSAGE,
number=7,
oneof="details",
message="Inventory.SoftwarePackage",
)
class SoftwarePackage(proto.Message):
r"""Software package information of the operating system.
Attributes:
yum_package (google.cloud.osconfig_v1.types.Inventory.VersionedPackage):
Yum package info. For details about the yum package manager,
see
https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/6/html/deployment_guide/ch-yum.
apt_package (google.cloud.osconfig_v1.types.Inventory.VersionedPackage):
Details of an APT package.
For details about the apt package manager, see
https://wiki.debian.org/Apt.
zypper_package (google.cloud.osconfig_v1.types.Inventory.VersionedPackage):
Details of a Zypper package. For details about the Zypper
package manager, see
https://en.opensuse.org/SDB:Zypper_manual.
googet_package (google.cloud.osconfig_v1.types.Inventory.VersionedPackage):
Details of a Googet package.
For details about the googet package manager,
see https://github.com/google/googet.
zypper_patch (google.cloud.osconfig_v1.types.Inventory.ZypperPatch):
Details of a Zypper patch. For details about the Zypper
package manager, see
https://en.opensuse.org/SDB:Zypper_manual.
wua_package (google.cloud.osconfig_v1.types.Inventory.WindowsUpdatePackage):
Details of a Windows Update package. See
https://docs.microsoft.com/en-us/windows/win32/api/_wua/ for
information about Windows Update.
qfe_package (google.cloud.osconfig_v1.types.Inventory.WindowsQuickFixEngineeringPackage):
Details of a Windows Quick Fix engineering
package. See
https://docs.microsoft.com/en-
us/windows/win32/cimwin32prov/win32-quickfixengineering
for info in Windows Quick Fix Engineering.
cos_package (google.cloud.osconfig_v1.types.Inventory.VersionedPackage):
Details of a COS package.
windows_application (google.cloud.osconfig_v1.types.Inventory.WindowsApplication):
Details of a Windows Application
"""
yum_package = proto.Field(
proto.MESSAGE,
number=1,
oneof="details",
message="Inventory.VersionedPackage",
)
apt_package = proto.Field(
proto.MESSAGE,
number=2,
oneof="details",
message="Inventory.VersionedPackage",
)
zypper_package = proto.Field(
proto.MESSAGE,
number=3,
oneof="details",
message="Inventory.VersionedPackage",
)
googet_package = proto.Field(
proto.MESSAGE,
number=4,
oneof="details",
message="Inventory.VersionedPackage",
)
zypper_patch = proto.Field(
proto.MESSAGE, number=5, oneof="details", message="Inventory.ZypperPatch",
)
wua_package = proto.Field(
proto.MESSAGE,
number=6,
oneof="details",
message="Inventory.WindowsUpdatePackage",
)
qfe_package = proto.Field(
proto.MESSAGE,
number=7,
oneof="details",
message="Inventory.WindowsQuickFixEngineeringPackage",
)
cos_package = proto.Field(
proto.MESSAGE,
number=8,
oneof="details",
message="Inventory.VersionedPackage",
)
windows_application = proto.Field(
proto.MESSAGE,
number=9,
oneof="details",
message="Inventory.WindowsApplication",
)
class VersionedPackage(proto.Message):
r"""Information related to the a standard versioned package.
This includes package info for APT, Yum, Zypper, and Googet
package managers.
Attributes:
package_name (str):
The name of the package.
architecture (str):
The system architecture this package is
intended for.
version (str):
The version of the package.
"""
package_name = proto.Field(proto.STRING, number=4,)
architecture = proto.Field(proto.STRING, number=2,)
version = proto.Field(proto.STRING, number=3,)
class WindowsUpdatePackage(proto.Message):
r"""Details related to a Windows Update package. Field data and names
are taken from Windows Update API IUpdate Interface:
https://docs.microsoft.com/en-us/windows/win32/api/_wua/ Descriptive
fields like title, and description are localized based on the locale
of the VM being updated.
Attributes:
title (str):
The localized title of the update package.
description (str):
The localized description of the update
package.
categories (Sequence[google.cloud.osconfig_v1.types.Inventory.WindowsUpdatePackage.WindowsUpdateCategory]):
The categories that are associated with this
update package.
kb_article_ids (Sequence[str]):
A collection of Microsoft Knowledge Base
article IDs that are associated with the update
package.
support_url (str):
A hyperlink to the language-specific support
information for the update.
more_info_urls (Sequence[str]):
A collection of URLs that provide more
information about the update package.
update_id (str):
Gets the identifier of an update package.
Stays the same across revisions.
revision_number (int):
The revision number of this update package.
last_deployment_change_time (google.protobuf.timestamp_pb2.Timestamp):
The last published date of the update, in
(UTC) date and time.
"""
class WindowsUpdateCategory(proto.Message):
r"""Categories specified by the Windows Update.
Attributes:
id (str):
The identifier of the windows update
category.
name (str):
The name of the windows update category.
"""
id = proto.Field(proto.STRING, number=1,)
name = proto.Field(proto.STRING, number=2,)
title = proto.Field(proto.STRING, number=1,)
description = proto.Field(proto.STRING, number=2,)
categories = proto.RepeatedField(
proto.MESSAGE,
number=3,
message="Inventory.WindowsUpdatePackage.WindowsUpdateCategory",
)
kb_article_ids = proto.RepeatedField(proto.STRING, number=4,)
support_url = proto.Field(proto.STRING, number=11,)
more_info_urls = proto.RepeatedField(proto.STRING, number=5,)
update_id = proto.Field(proto.STRING, number=6,)
revision_number = proto.Field(proto.INT32, number=7,)
last_deployment_change_time = proto.Field(
proto.MESSAGE, number=10, message=timestamp_pb2.Timestamp,
)
class ZypperPatch(proto.Message):
r"""Details related to a Zypper Patch.
Attributes:
patch_name (str):
The name of the patch.
category (str):
The category of the patch.
severity (str):
The severity specified for this patch
summary (str):
Any summary information provided about this
patch.
"""
patch_name = proto.Field(proto.STRING, number=5,)
category = proto.Field(proto.STRING, number=2,)
severity = proto.Field(proto.STRING, number=3,)
summary = proto.Field(proto.STRING, number=4,)
class WindowsQuickFixEngineeringPackage(proto.Message):
r"""Information related to a Quick Fix Engineering package.
Fields are taken from Windows QuickFixEngineering Interface and
match the source names:
https://docs.microsoft.com/en-
us/windows/win32/cimwin32prov/win32-quickfixengineering
Attributes:
caption (str):
A short textual description of the QFE
update.
description (str):
A textual description of the QFE update.
hot_fix_id (str):
Unique identifier associated with a
particular QFE update.
install_time (google.protobuf.timestamp_pb2.Timestamp):
Date that the QFE update was installed. Mapped from
installed_on field.
"""
caption = proto.Field(proto.STRING, number=1,)
description = proto.Field(proto.STRING, number=2,)
hot_fix_id = proto.Field(proto.STRING, number=3,)
install_time = proto.Field(
proto.MESSAGE, number=5, message=timestamp_pb2.Timestamp,
)
class WindowsApplication(proto.Message):
r"""Contains information about a Windows application as retrieved from
the Windows Registry. For more information about these fields, see
`Windows Installer Properties for the Uninstall
Registry <https://docs.microsoft.com/en-us/windows/win32/msi/uninstall-registry-key>`__\ {:
class="external" }
Attributes:
display_name (str):
The name of the application or product.
display_version (str):
The version of the product or application in
string format.
publisher (str):
The name of the manufacturer for the product
or application.
install_date (google.type.date_pb2.Date):
The last time this product received service.
The value of this property is replaced each time
a patch is applied or removed from the product
or the command-line option is used to repair the
product.
help_link (str):
The internet address for technical support.
"""
display_name = proto.Field(proto.STRING, number=1,)
display_version = proto.Field(proto.STRING, number=2,)
publisher = proto.Field(proto.STRING, number=3,)
install_date = proto.Field(proto.MESSAGE, number=4, message=date_pb2.Date,)
help_link = proto.Field(proto.STRING, number=5,)
os_info = proto.Field(proto.MESSAGE, number=1, message=OsInfo,)
items = proto.MapField(proto.STRING, proto.MESSAGE, number=2, message=Item,)
__all__ = tuple(sorted(__protobuf__.manifest))