// Copyright 2026 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/api/field_behavior.proto";
import "google/protobuf/struct.proto";

option go_package = "cloud.google.com/go/osconfig/agentendpoint/apiv1/agentendpointpb;agentendpointpb";
option java_multiple_files = true;
option java_outer_classname = "VmInventoryProto";
option java_package = "com.google.cloud.osconfig.agentendpoint.v1";

// OS Config VM Inventory is a service for collecting and reporting operating
// system and package information on VM instances.

// The inventory details of a VM.
message VmInventory {
  // Operating system information for the VM.
  message OsInfo {
    // Required. The VM hostname.
    string host_name = 1 [(google.api.field_behavior) = REQUIRED];

    // Optional. The operating system long name.
    // For example 'Debian GNU/Linux 9' or 'Microsoft Window Server 2019
    // Datacenter'.
    string long_name = 2 [(google.api.field_behavior) = OPTIONAL];

    // Required. The operating system short name.
    // For example, 'windows' or 'debian'.
    string short_name = 3 [(google.api.field_behavior) = REQUIRED];

    // Optional. The version of the operating system.
    string version = 4 [(google.api.field_behavior) = OPTIONAL];

    // Required. The system architecture of the operating system.
    string architecture = 5 [(google.api.field_behavior) = REQUIRED];

    // Optional. The kernel version of the operating system.
    string kernel_version = 6 [(google.api.field_behavior) = OPTIONAL];

    // Optional. The kernel release of the operating system.
    string kernel_release = 7 [(google.api.field_behavior) = OPTIONAL];

    // Required. The current version of the OS Config agent running on the VM.
    string osconfig_agent_version = 8 [(google.api.field_behavior) = REQUIRED];
  }

  // A VM package representation.
  message InventoryItem {
    // Required. Human-readable name of the software, to show to the user.
    string name = 1 [(google.api.field_behavior) = REQUIRED];

    // Required. Package type, e.g. "java/maven", "javascript/npm", "os/dpkg"
    string type = 2 [(google.api.field_behavior) = REQUIRED];

    // Required. Version of the package.
    string version = 3 [(google.api.field_behavior) = REQUIRED];

    // Required. Purl is a package identifier.
    string purl = 4 [(google.api.field_behavior) = REQUIRED];

    // Required. Path or source of files related to the package.
    repeated string location = 5 [(google.api.field_behavior) = REQUIRED];

    // Optional. Metadata of the package extracted by extractor.
    google.protobuf.Struct metadata = 6
        [(google.api.field_behavior) = OPTIONAL];
  }

  // Required. Base level operating system information for the VM.
  OsInfo os_info = 1 [(google.api.field_behavior) = REQUIRED];

  // Required. A list of installed packages currently on the VM.
  repeated InventoryItem installed_packages = 2
      [(google.api.field_behavior) = REQUIRED];

  // Required. A list of software updates available for the VM as reported by
  // the update managers.
  repeated InventoryItem available_packages = 3
      [(google.api.field_behavior) = REQUIRED];
}
