1// Copyright 2021 Google LLC
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//     http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15syntax = "proto3";
16
17package google.cloud.osconfig.v1;
18
19import "google/api/field_behavior.proto";
20import "google/api/resource.proto";
21import "google/protobuf/timestamp.proto";
22import "google/type/date.proto";
23
24option csharp_namespace = "Google.Cloud.OsConfig.V1";
25option go_package = "cloud.google.com/go/osconfig/apiv1/osconfigpb;osconfigpb";
26option java_multiple_files = true;
27option java_outer_classname = "Inventories";
28option java_package = "com.google.cloud.osconfig.v1";
29option php_namespace = "Google\\Cloud\\OsConfig\\V1";
30option ruby_package = "Google::Cloud::OsConfig::V1";
31
32// OS Config Inventory is a service for collecting and reporting operating
33// system and package information on VM instances.
34
35// This API resource represents the available inventory data for a
36// Compute Engine virtual machine (VM) instance at a given point in time.
37//
38// You can use this API resource to determine the inventory data of your VM.
39//
40// For more information, see [Information provided by OS inventory
41// management](https://cloud.google.com/compute/docs/instances/os-inventory-management#data-collected).
42message Inventory {
43  option (google.api.resource) = {
44    type: "osconfig.googleapis.com/Inventory"
45    pattern: "projects/{project}/locations/{location}/instances/{instance}/inventory"
46  };
47
48  // Operating system information for the VM.
49  message OsInfo {
50    // The VM hostname.
51    string hostname = 9;
52
53    // The operating system long name.
54    // For example 'Debian GNU/Linux 9' or 'Microsoft Window Server 2019
55    // Datacenter'.
56    string long_name = 2;
57
58    // The operating system short name.
59    // For example, 'windows' or 'debian'.
60    string short_name = 3;
61
62    // The version of the operating system.
63    string version = 4;
64
65    // The system architecture of the operating system.
66    string architecture = 5;
67
68    // The kernel version of the operating system.
69    string kernel_version = 6;
70
71    // The kernel release of the operating system.
72    string kernel_release = 7;
73
74    // The current version of the OS Config agent running on the VM.
75    string osconfig_agent_version = 8;
76  }
77
78  // A single piece of inventory on a VM.
79  message Item {
80    // The origin of a specific inventory item.
81    enum OriginType {
82      // Invalid. An origin type must be specified.
83      ORIGIN_TYPE_UNSPECIFIED = 0;
84
85      // This inventory item was discovered as the result of the agent
86      // reporting inventory via the reporting API.
87      INVENTORY_REPORT = 1;
88    }
89
90    // The different types of inventory that are tracked on a VM.
91    enum Type {
92      // Invalid. An type must be specified.
93      TYPE_UNSPECIFIED = 0;
94
95      // This represents a package that is installed on the VM.
96      INSTALLED_PACKAGE = 1;
97
98      // This represents an update that is available for a package.
99      AVAILABLE_PACKAGE = 2;
100    }
101
102    // Identifier for this item, unique across items for this VM.
103    string id = 1;
104
105    // The origin of this inventory item.
106    OriginType origin_type = 2;
107
108    // When this inventory item was first detected.
109    google.protobuf.Timestamp create_time = 8;
110
111    // When this inventory item was last modified.
112    google.protobuf.Timestamp update_time = 9;
113
114    // The specific type of inventory, correlating to its specific details.
115    Type type = 5;
116
117    // Specific details of this inventory item based on its type.
118    oneof details {
119      // Software package present on the VM instance.
120      SoftwarePackage installed_package = 6;
121
122      // Software package available to be installed on the VM instance.
123      SoftwarePackage available_package = 7;
124    }
125  }
126
127  // Software package information of the operating system.
128  message SoftwarePackage {
129    // Information about the different types of software packages.
130    oneof details {
131      // Yum package info.
132      // For details about the yum package manager, see
133      // https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/6/html/deployment_guide/ch-yum.
134      VersionedPackage yum_package = 1;
135
136      // Details of an APT package.
137      // For details about the apt package manager, see
138      // https://wiki.debian.org/Apt.
139      VersionedPackage apt_package = 2;
140
141      // Details of a Zypper package.
142      // For details about the Zypper package manager, see
143      // https://en.opensuse.org/SDB:Zypper_manual.
144      VersionedPackage zypper_package = 3;
145
146      // Details of a Googet package.
147      //  For details about the googet package manager, see
148      //  https://github.com/google/googet.
149      VersionedPackage googet_package = 4;
150
151      // Details of a Zypper patch.
152      // For details about the Zypper package manager, see
153      // https://en.opensuse.org/SDB:Zypper_manual.
154      ZypperPatch zypper_patch = 5;
155
156      // Details of a Windows Update package.
157      // See https://docs.microsoft.com/en-us/windows/win32/api/_wua/ for
158      // information about Windows Update.
159      WindowsUpdatePackage wua_package = 6;
160
161      // Details of a Windows Quick Fix engineering package.
162      // See
163      // https://docs.microsoft.com/en-us/windows/win32/cimwin32prov/win32-quickfixengineering
164      // for info in Windows Quick Fix Engineering.
165      WindowsQuickFixEngineeringPackage qfe_package = 7;
166
167      // Details of a COS package.
168      VersionedPackage cos_package = 8;
169
170      // Details of Windows Application.
171      WindowsApplication windows_application = 9;
172    }
173  }
174
175  // Information related to the a standard versioned package.  This includes
176  // package info for APT, Yum, Zypper, and Googet package managers.
177  message VersionedPackage {
178    // The name of the package.
179    string package_name = 4;
180
181    // The system architecture this package is intended for.
182    string architecture = 2;
183
184    // The version of the package.
185    string version = 3;
186  }
187
188  // Details related to a Zypper Patch.
189  message ZypperPatch {
190    // The name of the patch.
191    string patch_name = 5;
192
193    // The category of the patch.
194    string category = 2;
195
196    // The severity specified for this patch
197    string severity = 3;
198
199    // Any summary information provided about this patch.
200    string summary = 4;
201  }
202
203  // Details related to a Windows Update package.
204  // Field data and names are taken from Windows Update API IUpdate Interface:
205  // https://docs.microsoft.com/en-us/windows/win32/api/_wua/
206  // Descriptive fields like title, and description are localized based on
207  // the locale of the VM being updated.
208  message WindowsUpdatePackage {
209    // Categories specified by the Windows Update.
210    message WindowsUpdateCategory {
211      // The identifier of the windows update category.
212      string id = 1;
213
214      // The name of the windows update category.
215      string name = 2;
216    }
217
218    // The localized title of the update package.
219    string title = 1;
220
221    // The localized description of the update package.
222    string description = 2;
223
224    // The categories that are associated with this update package.
225    repeated WindowsUpdateCategory categories = 3;
226
227    // A collection of Microsoft Knowledge Base article IDs that are associated
228    // with the update package.
229    repeated string kb_article_ids = 4;
230
231    // A hyperlink to the language-specific support information for the update.
232    string support_url = 11;
233
234    // A collection of URLs that provide more information about the update
235    // package.
236    repeated string more_info_urls = 5;
237
238    // Gets the identifier of an update package.  Stays the same across
239    // revisions.
240    string update_id = 6;
241
242    // The revision number of this update package.
243    int32 revision_number = 7;
244
245    // The last published date of the update, in (UTC) date and time.
246    google.protobuf.Timestamp last_deployment_change_time = 10;
247  }
248
249  // Information related to a Quick Fix Engineering package.
250  // Fields are taken from Windows QuickFixEngineering Interface and match
251  // the source names:
252  // https://docs.microsoft.com/en-us/windows/win32/cimwin32prov/win32-quickfixengineering
253  message WindowsQuickFixEngineeringPackage {
254    // A short textual description of the QFE update.
255    string caption = 1;
256
257    // A textual description of the QFE update.
258    string description = 2;
259
260    // Unique identifier associated with a particular QFE update.
261    string hot_fix_id = 3;
262
263    // Date that the QFE update was installed.  Mapped from installed_on field.
264    google.protobuf.Timestamp install_time = 5;
265  }
266
267  // Contains information about a Windows application that is retrieved from the
268  // Windows Registry. For more information about these fields, see:
269  // https://docs.microsoft.com/en-us/windows/win32/msi/uninstall-registry-key
270  message WindowsApplication {
271    // The name of the application or product.
272    string display_name = 1;
273
274    // The version of the product or application in string format.
275    string display_version = 2;
276
277    // The name of the manufacturer for the product or application.
278    string publisher = 3;
279
280    // The last time this product received service. The value of this property
281    // is replaced each time a patch is applied or removed from the product or
282    // the command-line option is used to repair the product.
283    google.type.Date install_date = 4;
284
285    // The internet address for technical support.
286    string help_link = 5;
287  }
288
289  // Output only. The `Inventory` API resource name.
290  //
291  // Format:
292  // `projects/{project_number}/locations/{location}/instances/{instance_id}/inventory`
293  string name = 3 [(google.api.field_behavior) = OUTPUT_ONLY];
294
295  // Base level operating system information for the VM.
296  OsInfo os_info = 1;
297
298  // Inventory items related to the VM keyed by an opaque unique identifier for
299  // each inventory item.  The identifier is unique to each distinct and
300  // addressable inventory item and will change, when there is a new package
301  // version.
302  map<string, Item> items = 2;
303
304  // Output only. Timestamp of the last reported inventory for the VM.
305  google.protobuf.Timestamp update_time = 4
306      [(google.api.field_behavior) = OUTPUT_ONLY];
307}
308
309// A request message for getting inventory data for the specified VM.
310message GetInventoryRequest {
311  // Required. API resource name for inventory resource.
312  //
313  // Format:
314  // `projects/{project}/locations/{location}/instances/{instance}/inventory`
315  //
316  // For `{project}`, either `project-number` or `project-id` can be provided.
317  // For `{instance}`, either Compute Engine  `instance-id` or `instance-name`
318  // can be provided.
319  string name = 1 [
320    (google.api.field_behavior) = REQUIRED,
321    (google.api.resource_reference) = {
322      type: "osconfig.googleapis.com/Inventory"
323    }
324  ];
325
326  // Inventory view indicating what information should be included in the
327  // inventory resource. If unspecified, the default view is BASIC.
328  InventoryView view = 2;
329}
330
331// A request message for listing inventory data for all VMs in the specified
332// location.
333message ListInventoriesRequest {
334  // Required. The parent resource name.
335  //
336  // Format: `projects/{project}/locations/{location}/instances/-`
337  //
338  // For `{project}`, either `project-number` or `project-id` can be provided.
339  string parent = 1 [
340    (google.api.field_behavior) = REQUIRED,
341    (google.api.resource_reference) = {
342      type: "compute.googleapis.com/Instance"
343    }
344  ];
345
346  // Inventory view indicating what information should be included in the
347  // inventory resource. If unspecified, the default view is BASIC.
348  InventoryView view = 2;
349
350  // The maximum number of results to return.
351  int32 page_size = 3;
352
353  // A pagination token returned from a previous call to
354  // `ListInventories` that indicates where this listing
355  // should continue from.
356  string page_token = 4;
357
358  // If provided, this field specifies the criteria that must be met by a
359  // `Inventory` API resource to be included in the response.
360  string filter = 5;
361}
362
363// A response message for listing inventory data for all VMs in a specified
364// location.
365message ListInventoriesResponse {
366  // List of inventory objects.
367  repeated Inventory inventories = 1;
368
369  // The pagination token to retrieve the next page of inventory objects.
370  string next_page_token = 2;
371}
372
373// The view for inventory objects.
374enum InventoryView {
375  // The default value.
376  // The API defaults to the BASIC view.
377  INVENTORY_VIEW_UNSPECIFIED = 0;
378
379  // Returns the basic inventory information that includes `os_info`.
380  BASIC = 1;
381
382  // Returns all fields.
383  FULL = 2;
384}
385