From 2987612c6aacc1857ee35468e7aeb1c393460799 Mon Sep 17 00:00:00 2001 From: Google APIs Date: Thu, 24 Sep 2020 13:18:54 -0700 Subject: [PATCH] feat: added ReportInventory RPC PiperOrigin-RevId: 333583499 --- .../osconfig/agentendpoint/v1/BUILD.bazel | 13 ++ .../agentendpoint/v1/agentendpoint.proto | 30 +++ .../osconfig/agentendpoint/v1/inventory.proto | 204 ++++++++++++++++++ .../osconfig/agentendpoint/v1beta/BUILD.bazel | 10 + 4 files changed, 257 insertions(+) create mode 100644 google/cloud/osconfig/agentendpoint/v1/inventory.proto diff --git a/google/cloud/osconfig/agentendpoint/v1/BUILD.bazel b/google/cloud/osconfig/agentendpoint/v1/BUILD.bazel index 107975dd9..453633544 100644 --- a/google/cloud/osconfig/agentendpoint/v1/BUILD.bazel +++ b/google/cloud/osconfig/agentendpoint/v1/BUILD.bazel @@ -1,4 +1,13 @@ # This file was automatically generated by BuildFileGenerator +# https://github.com/googleapis/gapic-generator/tree/master/rules_gapic/bazel + +# Most of the manual changes to this file will be overwritten. +# It's **only** allowed to change the following rule attribute values: +# - names of *_gapic_assembly_* rules +# - certain parameters of *_gapic_library rules, including but not limited to: +# * extra_protoc_parameters +# * extra_protoc_file_parameters +# The complete list of preserved parameters can be found in the source code. # This is an API workspace, having public visibility by default makes perfect sense. package(default_visibility = ["//visibility:public"]) @@ -13,12 +22,14 @@ proto_library( name = "agentendpoint_proto", srcs = [ "agentendpoint.proto", + "inventory.proto", "patch_jobs.proto", "tasks.proto", ], deps = [ "//google/api:client_proto", "//google/api:field_behavior_proto", + "@com_google_protobuf//:timestamp_proto", ], ) @@ -154,6 +165,7 @@ moved_proto_library( deps = [ "//google/api:client_proto", "//google/api:field_behavior_proto", + "@com_google_protobuf//:timestamp_proto", ], ) @@ -289,6 +301,7 @@ ruby_gapic_library( name = "agentendpoint_ruby_gapic", src = ":agentendpoint_proto_with_info", gapic_yaml = "osconfig_gapic.yaml", + grpc_service_config = "agentendpoint_grpc_service_config.json", package = "google.cloud.osconfig.agentendpoint.v1", service_yaml = "osconfig_v1.yaml", deps = [ diff --git a/google/cloud/osconfig/agentendpoint/v1/agentendpoint.proto b/google/cloud/osconfig/agentendpoint/v1/agentendpoint.proto index 58b9cb4d6..6e6e211ed 100644 --- a/google/cloud/osconfig/agentendpoint/v1/agentendpoint.proto +++ b/google/cloud/osconfig/agentendpoint/v1/agentendpoint.proto @@ -18,6 +18,7 @@ package google.cloud.osconfig.agentendpoint.v1; import "google/api/client.proto"; import "google/api/field_behavior.proto"; +import "google/cloud/osconfig/agentendpoint/v1/inventory.proto"; import "google/cloud/osconfig/agentendpoint/v1/tasks.proto"; option go_package = "google.golang.org/genproto/googleapis/cloud/osconfig/agentendpoint/v1;agentendpoint"; @@ -54,6 +55,11 @@ service AgentEndpointService { rpc RegisterAgent(RegisterAgentRequest) returns (RegisterAgentResponse) { option (google.api.method_signature) = "instance_id_token,agent_version,supported_capabilities"; } + + // Reports the VMs current inventory. + rpc ReportInventory(ReportInventoryRequest) returns (ReportInventoryResponse) { + option (google.api.method_signature) = "instance_id_token,inventory_checksum,inventory"; + } } // A request message to receive task notifications. @@ -178,3 +184,27 @@ message RegisterAgentRequest { message RegisterAgentResponse { } + +// The request message for having the agent report inventory. +message ReportInventoryRequest { + // Required. This is the Compute Engine instance identity token described in + // https://cloud.google.com/compute/docs/instances/verifying-instance-identity + // where the audience is 'osconfig.googleapis.com' and the format is 'full'. + string instance_id_token = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. This is a client created checksum that should be generated based on the + // contents of the reported inventory. This will be used by the service to + // determine if it has the latest version of inventory. + string inventory_checksum = 2 [(google.api.field_behavior) = REQUIRED]; + + // Optional. This is the details of the inventory. Should only be provided if the + // inventory has changed since the last report, or if instructed by the + // service to provide full inventory. + Inventory inventory = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// The response message after the agent has reported inventory. +message ReportInventoryResponse { + // If true, the full inventory should be reported back to the server. + bool report_full_inventory = 1; +} diff --git a/google/cloud/osconfig/agentendpoint/v1/inventory.proto b/google/cloud/osconfig/agentendpoint/v1/inventory.proto new file mode 100644 index 000000000..1fc5ebfaf --- /dev/null +++ b/google/cloud/osconfig/agentendpoint/v1/inventory.proto @@ -0,0 +1,204 @@ +// 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. + +syntax = "proto3"; + +package google.cloud.osconfig.agentendpoint.v1; + +import "google/protobuf/timestamp.proto"; + +option go_package = "google.golang.org/genproto/googleapis/cloud/osconfig/agentendpoint/v1;agentendpoint"; +option java_multiple_files = true; +option java_outer_classname = "InventoryProto"; +option java_package = "com.google.cloud.osconfig.agentendpoint.v1"; + +// OS Config Inventory is a service for collecting and reporting operating +// system and package information on VM instances. + +// The inventory details of a VM. +message Inventory { + // Operating system information for the VM. + message OsInfo { + // The VM hostname. + string hostname = 1; + + // The operating system long name. + // For example 'Debian GNU/Linux 9' or 'Microsoft Window Server 2019 + // Datacenter'. + string long_name = 2; + + // The operating system short name. + // For example, 'windows' or 'debian'. + string short_name = 3; + + // The version of the operating system. + string version = 4; + + // The system architecture of the operating system. + string architecture = 5; + + // The kernel version of the operating system. + string kernel_version = 6; + + // The kernel release of the operating system. + string kernel_release = 7; + + // The current version of the OS Config agent running on the VM. + string osconfig_agent_version = 8; + } + + // Software package information of the operating system. + message SoftwarePackage { + // Information about the different types of software packages. + oneof details { + // 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. + VersionedPackage yum_package = 1; + + // Details of an APT package. + // For details about the apt package manager, see + // https://wiki.debian.org/Apt. + VersionedPackage apt_package = 2; + + // Details of a Zypper package. + // For details about the Zypper package manager, see + // https://en.opensuse.org/SDB:Zypper_manual. + VersionedPackage zypper_package = 3; + + // Details of a Googet package. + // For details about the googet package manager, see + // https://github.com/google/googet. + VersionedPackage googet_package = 4; + + // Details of a Zypper patch. + // For details about the Zypper package manager, see + // https://en.opensuse.org/SDB:Zypper_manual. + ZypperPatch zypper_patch = 5; + + // Details of a Windows Update package. + // See https://docs.microsoft.com/en-us/windows/win32/api/_wua/ for + // information about Windows Update. + WindowsUpdatePackage wua_package = 6; + + // 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. + WindowsQuickFixEngineeringPackage qfe_package = 7; + } + } + + // Information related to the a standard versioned package. This includes + // package info for APT, Yum, Zypper, and Googet package managers. + message VersionedPackage { + // The name of the package. + string package_name = 1; + + // The system architecture this package is intended for. + string architecture = 2; + + // The version of the package. + string version = 3; + } + + // 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. + message WindowsUpdatePackage { + // Categories specified by the Windows Update. + message WindowsUpdateCategory { + // The identifier of the windows update category. + string id = 1; + + // The name of the windows update category. + string name = 2; + } + + // The localized title of the update package. + string title = 1; + + // The localized description of the update package. + string description = 2; + + // The categories that are associated with this update package. + repeated WindowsUpdateCategory categories = 3; + + // A collection of Microsoft Knowledge Base article IDs that are associated + // with the update package. + repeated string kb_article_ids = 4; + + // A hyperlink to the language-specific support information for the update. + string support_url = 5; + + // A collection of URLs that provide more information about the update + // package. + repeated string more_info_urls = 6; + + // Gets the identifier of an update package. Stays the same across + // revisions. + string update_id = 7; + + // The revision number of this update package. + int32 revision_number = 8; + + // The last published date of the update, in (UTC) date and time. + google.protobuf.Timestamp last_deployment_change_time = 9; + } + + // Details related to a Zypper Patch. + message ZypperPatch { + // The name of the patch. + string patch_name = 1; + + // The category of the patch. + string category = 2; + + // The severity specified for this patch + string severity = 3; + + // Any summary information provided about this patch. + string summary = 4; + } + + // 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 + message WindowsQuickFixEngineeringPackage { + // A short textual description of the QFE update. + string caption = 1; + + // A textual description of the QFE update. + string description = 2; + + // Unique identifier associated with a particular QFE update. + string hot_fix_id = 3; + + // Date that the QFE update was installed. Mapped from installed_on field. + google.protobuf.Timestamp install_time = 4; + } + + // Base level operating system information for the VM. + OsInfo os_info = 1; + + // A list of installed packages currently on the VM. + repeated SoftwarePackage installed_packages = 2; + + // A list of software updates available for the VM as reported by the update + // managers. + repeated SoftwarePackage available_packages = 3; +} diff --git a/google/cloud/osconfig/agentendpoint/v1beta/BUILD.bazel b/google/cloud/osconfig/agentendpoint/v1beta/BUILD.bazel index cc070c7c6..12a4ccfdc 100644 --- a/google/cloud/osconfig/agentendpoint/v1beta/BUILD.bazel +++ b/google/cloud/osconfig/agentendpoint/v1beta/BUILD.bazel @@ -1,4 +1,13 @@ # This file was automatically generated by BuildFileGenerator +# https://github.com/googleapis/gapic-generator/tree/master/rules_gapic/bazel + +# Most of the manual changes to this file will be overwritten. +# It's **only** allowed to change the following rule attribute values: +# - names of *_gapic_assembly_* rules +# - certain parameters of *_gapic_library rules, including but not limited to: +# * extra_protoc_parameters +# * extra_protoc_file_parameters +# The complete list of preserved parameters can be found in the source code. # This is an API workspace, having public visibility by default makes perfect sense. package(default_visibility = ["//visibility:public"]) @@ -292,6 +301,7 @@ ruby_gapic_library( name = "agentendpoint_ruby_gapic", src = ":agentendpoint_proto_with_info", gapic_yaml = "osconfig_gapic.yaml", + grpc_service_config = "agentendpoint_grpc_service_config.json", package = "google.cloud.osconfig.agentendpoint.v1beta", service_yaml = "osconfig_v1beta.yaml", deps = [