// 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.compute.logging.agentcontrolplane.v1;

import "google/protobuf/timestamp.proto";

option csharp_namespace = "Google.Compute.Logging.AgentControlPlane.V1";
option go_package = "google.golang.org/genproto/googleapis/compute/logging/agentcontrolplane/v1;agentcontrolplane";
option java_multiple_files = true;
option java_outer_classname = "LogsProto";
option java_package = "com.google.compute.logging.agentcontrolplane.v1";
option php_namespace = "Google\\Compute\\Logging\\AgentControlPlane\\V1";
option ruby_package = "Google::Compute::Logging::AgentControlPlane::V1";

// This file defines the format of Cloud Agent Control Plane Logging Logs.

// Log message used to send Platform Logging for critical events in VM Extension
// lifecycle.
message VmExtensionEvent {
  // Enum for the types of events that are critical in VM Extension lifecycle.
  enum ExtensionEventType {
    // Unspecified event type, used as a default value.
    EXTENSION_EVENT_TYPE_UNSPECIFIED = 0;

    // Event indicating that the extension has crashed.
    // This indicates that the extension was once installed and started
    // successfully, but then crashed.
    CRASHED = 1;

    // Event indicating that the extension install has failed.
    INSTALL_FAILED = 2;

    // Event indicating that the extension is installed and started
    // successfully.
    INSTALLED = 3;

    // Event indicating that the extension rollback has failed.
    ROLLBACK_FAILED = 4;

    // Event indicating that the extension rollback has succeeded.
    ROLLED_BACK = 5;

    // Event indicating that none of the extension revision candidates satisfies
    // the install requirements, e.g. operating system and/or architecture.
    INCOMPATIBLE = 6;

    // The service requiring this extension is disabled.
    SERVICE_DISABLED = 7;
  }

  // Event timestamp.
  google.protobuf.Timestamp timestamp = 1;

  // Type of event that is critical in VM Extension lifecycle.
  ExtensionEventType event_type = 2;

  // Name of the VM extension.
  string extension_name = 3;

  // Policy ID that is associated with this VM extension event if applicable.
  // Format:
  // projects/{project}/zones/{zone}/vmExtensionPolicies/{vmExtensionPolicy} or
  // projects/{project}/global/vmExtensionPolicies/{vmExtensionPolicy}
  string policy_id = 4;

  // Revision ID of the VM extension.
  string revision_id = 5;

  // Message that describes the event in detail.
  string event_message = 6;
}
