syntax = "proto3";

package yandex.cloud.compute.v1;

import "google/protobuf/timestamp.proto";

option go_package = "github.com/yandex-cloud/go-genproto/yandex/cloud/compute/v1;compute";
option java_package = "yandex.cloud.api.compute.v1";

// Represents group of dedicated hosts
message HostGroup {

  enum Status {
    STATUS_UNSPECIFIED = 0;
    CREATING = 1;
    READY = 2;
    UPDATING = 3;
    DELETING = 4;
  }

  // ID of the group.
  string id = 1;

  // ID of the folder that the group belongs to.
  string folder_id = 2;

  // Creation timestamp in [RFC3339](https://www.ietf.org/rfc/rfc3339.txt) text format.
  google.protobuf.Timestamp created_at = 3;

  // Name of the group. The name is unique within the folder.
  string name = 4;

  // Description of the group.
  string description = 5;

  // Resource labels as `key:value` pairs.
  map<string, string> labels = 6;

  // Availability zone where all dedicated hosts are allocated.
  string zone_id = 7;

  // Status of the group.
  Status status = 8;

  // ID of host type. Resources provided by each host of the group.
  string type_id = 9;

  // Behaviour on maintenance events.
  MaintenancePolicy maintenance_policy = 10;

  // Scale policy. Only fixed number of hosts are supported at this moment.
  ScalePolicy scale_policy = 11;
}

// Represents a dedicated host
message Host {
  enum Status {
    STATUS_UNSPECIFIED = 0;
    UP = 1;
    DOWN = 2;
  }

  // ID of the host.
  string id = 1;

  // Current status of the host. New instances are unable to start on host in DOWN status.
  Status status = 2;

  // ID of the physical server that the host belongs to.
  string server_id = 3;
}

enum MaintenancePolicy {
  MAINTENANCE_POLICY_UNSPECIFIED = 0;
  // Restart instances on the same host after maintenance event.
  RESTART = 1;
  // Migrate instances to another host before maintenance event.
  MIGRATE = 2;
}

message ScalePolicy {
  message FixedScale {
    int64 size = 1;
  }

  oneof scale_type {
    FixedScale fixed_scale = 1;
  }
}
