// 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.hypercomputecluster.v1alpha;

import "google/api/annotations.proto";
import "google/api/client.proto";
import "google/api/field_behavior.proto";
import "google/api/field_info.proto";
import "google/api/resource.proto";
import "google/longrunning/operations.proto";
import "google/protobuf/duration.proto";
import "google/protobuf/field_mask.proto";
import "google/protobuf/timestamp.proto";
import "google/type/dayofweek.proto";
import "google/type/timeofday.proto";

option csharp_namespace = "Google.Cloud.HypercomputeCluster.V1Alpha";
option go_package = "cloud.google.com/go/hypercomputecluster/apiv1alpha/hypercomputeclusterpb;hypercomputeclusterpb";
option java_multiple_files = true;
option java_outer_classname = "HypercomputeClusterProto";
option java_package = "com.google.cloud.hypercomputecluster.v1alpha";
option php_namespace = "Google\\Cloud\\HypercomputeCluster\\V1alpha";
option ruby_package = "Google::Cloud::HypercomputeCluster::V1alpha";
option (google.api.resource_definition) = {
  type: "compute.googleapis.com/ComputeInstance"
  pattern: "projects/{project}/zones/{zone}/instances/{instance}"
};
option (google.api.resource_definition) = {
  type: "compute.googleapis.com/DiskType"
  pattern: "projects/{project}/zones/{zone}/diskTypes/{disk_type}"
};
option (google.api.resource_definition) = {
  type: "compute.googleapis.com/Image"
  pattern: "projects/{project}/global/images/{image}"
};
option (google.api.resource_definition) = {
  type: "compute.googleapis.com/Network"
  pattern: "projects/{project}/global/networks/{network}"
};
option (google.api.resource_definition) = {
  type: "compute.googleapis.com/Reservation"
  pattern: "projects/{project}/zones/{zone}/reservations/{reservation}"
};
option (google.api.resource_definition) = {
  type: "compute.googleapis.com/ReservationBlock"
  pattern: "projects/{project}/zones/{zone}/reservations/{reservation}/reservationBlocks/{reservation_block}"
};
option (google.api.resource_definition) = {
  type: "compute.googleapis.com/ReservationSubBlock"
  pattern: "projects/{project}/zones/{zone}/reservations/{reservation}/reservationBlocks/{reservation_block}/reservationSubBlocks/{reservation_sub_block}"
};
option (google.api.resource_definition) = {
  type: "compute.googleapis.com/Subnetwork"
  pattern: "projects/{project}/regions/{region}/subnetworks/{subnetwork}"
};
option (google.api.resource_definition) = {
  type: "file.googleapis.com/FileInstance"
  pattern: "projects/{project}/locations/{location}/instances/{instance}"
};
option (google.api.resource_definition) = {
  type: "storage.googleapis.com/Bucket"
  pattern: "projects/{project}/buckets/{bucket}"
};
option (google.api.resource_definition) = {
  type: "container.googleapis.com/Pod"
  pattern: "projects/{project}/locations/{location}/clusters/{cluster}/k8s/namespaces/{namespace}/pods/{pod}"
};

// Service describing handlers for resources
service HypercomputeCluster {
  option (google.api.default_host) = "hypercomputecluster.googleapis.com";
  option (google.api.oauth_scopes) =
      "https://www.googleapis.com/auth/cloud-platform";

  // Lists Clusters in a given project and location.
  rpc ListClusters(ListClustersRequest) returns (ListClustersResponse) {
    option (google.api.http) = {
      get: "/v1alpha/{parent=projects/*/locations/*}/clusters"
    };
    option (google.api.method_signature) = "parent";
  }

  // Gets details of a single Cluster.
  rpc GetCluster(GetClusterRequest) returns (Cluster) {
    option (google.api.http) = {
      get: "/v1alpha/{name=projects/*/locations/*/clusters/*}"
    };
    option (google.api.method_signature) = "name";
  }

  // Creates a new Cluster in a given project and location.
  rpc CreateCluster(CreateClusterRequest)
      returns (google.longrunning.Operation) {
    option (google.api.http) = {
      post: "/v1alpha/{parent=projects/*/locations/*}/clusters"
      body: "cluster"
    };
    option (google.api.method_signature) = "parent,cluster,cluster_id";
    option (google.longrunning.operation_info) = {
      response_type: "Cluster"
      metadata_type: "OperationMetadata"
    };
  }

  // Updates the parameters of a single Cluster.
  rpc UpdateCluster(UpdateClusterRequest)
      returns (google.longrunning.Operation) {
    option (google.api.http) = {
      patch: "/v1alpha/{cluster.name=projects/*/locations/*/clusters/*}"
      body: "cluster"
    };
    option (google.api.method_signature) = "cluster,update_mask";
    option (google.longrunning.operation_info) = {
      response_type: "Cluster"
      metadata_type: "OperationMetadata"
    };
  }

  // Deletes a single Cluster.
  rpc DeleteCluster(DeleteClusterRequest)
      returns (google.longrunning.Operation) {
    option (google.api.http) = {
      delete: "/v1alpha/{name=projects/*/locations/*/clusters/*}"
    };
    option (google.api.method_signature) = "name";
    option (google.longrunning.operation_info) = {
      response_type: "google.protobuf.Empty"
      metadata_type: "OperationMetadata"
    };
  }

  // Gets details of a single Node.
  rpc GetNode(GetNodeRequest) returns (Node) {
    option (google.api.http) = {
      get: "/v1alpha/{name=projects/*/locations/*/clusters/*/nodes/*}"
    };
    option (google.api.method_signature) = "name";
  }

  // Lists Nodes in a given cluster.
  rpc ListNodes(ListNodesRequest) returns (ListNodesResponse) {
    option (google.api.http) = {
      get: "/v1alpha/{parent=projects/*/locations/*/clusters/*}/nodes"
    };
    option (google.api.method_signature) = "parent";
  }
}

// A collection of virtual machines and connected resources forming a
// high-performance computing cluster capable of running large-scale, tightly
// coupled workloads. A cluster combines a set a compute resources that perform
// computations, storage resources that contain inputs and store outputs, an
// orchestrator that is responsible for assigning jobs to compute resources, and
// network resources that connect everything together.
message Cluster {
  option (google.api.resource) = {
    type: "hypercomputecluster.googleapis.com/Cluster"
    pattern: "projects/{project}/locations/{location}/clusters/{cluster}"
    plural: "clusters"
    singular: "cluster"
  };

  // Identifier. [Relative resource name](https://google.aip.dev/122) of the
  // cluster, in the format
  // `projects/{project}/locations/{location}/clusters/{cluster}`.
  string name = 1 [(google.api.field_behavior) = IDENTIFIER];

  // Optional. User-provided description of the cluster. Maximum of 2048
  // characters.
  string description = 9 [(google.api.field_behavior) = OPTIONAL];

  // Optional.
  // [Labels](https://cloud.google.com/compute/docs/labeling-resources) applied
  // to the cluster. Labels can be used to organize clusters and to filter them
  // in queries.
  map<string, string> labels = 4 [(google.api.field_behavior) = OPTIONAL];

  // Output only. Time that the cluster was originally created.
  google.protobuf.Timestamp create_time = 2
      [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. Time that the cluster was most recently updated.
  google.protobuf.Timestamp update_time = 3
      [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. Indicates whether changes to the cluster are currently in
  // flight. If this is `true`, then the current state might not match the
  // cluster's intended state.
  bool reconciling = 10 [(google.api.field_behavior) = OUTPUT_ONLY];

  // Optional. Network resources available to the cluster. Must contain exactly
  // one value. Keys specify the ID of the network resource by which it can be
  // referenced elsewhere, and must conform to
  // [RFC-1034](https://datatracker.ietf.org/doc/html/rfc1034) (lower-case,
  // alphanumeric, and at most 63 characters).
  map<string, NetworkResource> network_resources = 11
      [(google.api.field_behavior) = OPTIONAL];

  // Optional. Storage resources available to the cluster. Keys specify the ID
  // of the storage resource by which it can be referenced elsewhere, and must
  // conform to [RFC-1034](https://datatracker.ietf.org/doc/html/rfc1034)
  // (lower-case, alphanumeric, and at most 63 characters).
  map<string, StorageResource> storage_resources = 12
      [(google.api.field_behavior) = OPTIONAL];

  // Optional. Compute resources available to the cluster. Keys specify the ID
  // of the compute resource by which it can be referenced elsewhere, and must
  // conform to [RFC-1034](https://datatracker.ietf.org/doc/html/rfc1034)
  // (lower-case, alphanumeric, and at most 63 characters).
  map<string, ComputeResource> compute_resources = 13
      [(google.api.field_behavior) = OPTIONAL];

  // Optional. Orchestrator that is responsible for scheduling and running jobs
  // on the cluster.
  Orchestrator orchestrator = 8 [(google.api.field_behavior) = OPTIONAL];

  // Optional. Policy controlling how system-initiated maintenance should be
  // conducted on the cluster.
  MaintenancePolicy maintenance_policy = 14
      [(google.api.field_behavior) = OPTIONAL];

  // Optional. Deprecated. Use compute_resources instead.
  Compute compute = 7
      [deprecated = true, (google.api.field_behavior) = OPTIONAL];
}

// Request message for
// [ListClusters][google.cloud.hypercomputecluster.v1alpha.HypercomputeCluster.ListClusters].
message ListClustersRequest {
  // Required. Parent location of the clusters to list, in the format
  // `projects/{project}/locations/{location}`.
  string parent = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      child_type: "hypercomputecluster.googleapis.com/Cluster"
    }
  ];

  // Optional. Maximum number of clusters to return. The service may return
  // fewer than this value.
  int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL];

  // Optional. A page token received from a previous `ListClusters` call.
  // Provide this to retrieve the subsequent page. When paginating, all other
  // parameters provided to `ListClusters` must match the call that provided the
  // page token.
  string page_token = 3 [(google.api.field_behavior) = OPTIONAL];

  // Optional. [Filter](https://google.aip.dev/160) to apply to the returned
  // results.
  string filter = 4 [(google.api.field_behavior) = OPTIONAL];

  // Optional. How to order the resulting clusters. Must be one of the following
  // strings:
  //
  // * `name`
  // * `name desc`
  // * `create_time`
  // * `create_time desc`
  //
  // If not specified, clusters will be returned in an arbitrary order.
  string order_by = 5 [(google.api.field_behavior) = OPTIONAL];
}

// Response message for
// [ListClusters][google.cloud.hypercomputecluster.v1alpha.HypercomputeCluster.ListClusters].
message ListClustersResponse {
  // Clusters in the specified location.
  repeated Cluster clusters = 1;

  // A token that can be sent as `page_token` to retrieve the next page. If this
  // field is absent, there are no subsequent pages.
  string next_page_token = 2;

  // Locations that could not be reached.
  repeated string unreachable = 3;
}

// Request message for
// [GetCluster][google.cloud.hypercomputecluster.v1alpha.HypercomputeCluster.GetCluster].
message GetClusterRequest {
  // Required. Name of the cluster to retrieve, in the format
  // `projects/{project}/locations/{location}/clusters/{cluster}`.
  string name = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      type: "hypercomputecluster.googleapis.com/Cluster"
    }
  ];
}

// Request message for
// [CreateCluster][google.cloud.hypercomputecluster.v1alpha.HypercomputeCluster.CreateCluster].
message CreateClusterRequest {
  // Required. Parent location in which the cluster should be created, in the
  // format `projects/{project}/locations/{location}`.
  string parent = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      child_type: "hypercomputecluster.googleapis.com/Cluster"
    }
  ];

  // Required. ID of the cluster to create. Must conform to
  // [RFC-1034](https://datatracker.ietf.org/doc/html/rfc1034) (lower-case,
  // alphanumeric, and at most 63 characters).
  string cluster_id = 2 [(google.api.field_behavior) = REQUIRED];

  // Required. Cluster to create.
  Cluster cluster = 3 [(google.api.field_behavior) = REQUIRED];

  // Optional. A unique identifier for this request. A random UUID is
  // recommended. This request is idempotent if and only if `request_id` is
  // provided.
  string request_id = 4 [
    (google.api.field_info).format = UUID4,
    (google.api.field_behavior) = OPTIONAL
  ];
}

// Request message for
// [UpdateCluster][google.cloud.hypercomputecluster.v1alpha.HypercomputeCluster.UpdateCluster].
message UpdateClusterRequest {
  // Required. Cluster to update.
  Cluster cluster = 2 [(google.api.field_behavior) = REQUIRED];

  // Optional. Mask specifying which fields in the cluster to update. All paths
  // must be specified explicitly - wildcards are not supported. At least one
  // path must be provided.
  google.protobuf.FieldMask update_mask = 1
      [(google.api.field_behavior) = OPTIONAL];

  // Optional. A unique identifier for this request. A random UUID is
  // recommended. This request is idempotent if and only if `request_id` is
  // provided.
  string request_id = 3 [
    (google.api.field_info).format = UUID4,
    (google.api.field_behavior) = OPTIONAL
  ];
}

// Request message for
// [DeleteCluster][google.cloud.hypercomputecluster.v1alpha.HypercomputeCluster.DeleteCluster].
message DeleteClusterRequest {
  // Required. Name of the cluster to delete, in the format
  // `projects/{project}/locations/{location}/clusters/{cluster}`.
  string name = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      type: "hypercomputecluster.googleapis.com/Cluster"
    }
  ];

  // Optional. A unique identifier for this request. A random UUID is
  // recommended. This request is idempotent if and only if `request_id` is
  // provided.
  string request_id = 2 [
    (google.api.field_info).format = UUID4,
    (google.api.field_behavior) = OPTIONAL
  ];
}

// Request message for
// [GetNode][google.cloud.hypercomputecluster.v1alpha.HypercomputeCluster.GetNode].
message GetNodeRequest {
  // Required. Name of the node to retrieve, in the format
  // `projects/{project}/locations/{location}/clusters/{cluster}/nodes/{node}`.
  string name = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      type: "hypercomputecluster.googleapis.com/Node"
    }
  ];
}

// Request message for
// [ListNodes][google.cloud.hypercomputecluster.v1alpha.HypercomputeCluster.ListNodes].
message ListNodesRequest {
  // Required. Parent cluster of the nodes to list, in the format
  // `projects/{project}/locations/{location}/clusters/{cluster}`.
  string parent = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      child_type: "hypercomputecluster.googleapis.com/Node"
    }
  ];

  // Optional. Maximum number of nodes to return. The service may return fewer
  // than this value.
  int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL];

  // Optional. A page token received from a previous `ListNodes` call. Provide
  // this to retrieve the subsequent page. When paginating, all other parameters
  // provided to `ListNodes` must match the call that provided the page
  // token.
  string page_token = 3 [(google.api.field_behavior) = OPTIONAL];

  // Optional. [Filter](https://google.aip.dev/160) to apply to the returned
  // results.
  string filter = 4 [(google.api.field_behavior) = OPTIONAL];

  // Optional. How to order the resulting nodes. Must be one of the following
  // strings:
  //
  // * `name`
  // * `name desc`
  //
  // If not specified, nodes will be returned in an arbitrary order.
  string order_by = 5 [(google.api.field_behavior) = OPTIONAL];
}

// Response message for
// [ListNodes][google.cloud.hypercomputecluster.v1alpha.HypercomputeCluster.ListNodes].
message ListNodesResponse {
  // Nodes in the specified cluster.
  repeated Node nodes = 1;

  // A token that can be sent as `page_token` to retrieve the next page. If this
  // field is absent, there are no subsequent pages.
  string next_page_token = 2;
}

// A resource representing a network that connects the various components of a
// cluster together.
message NetworkResource {
  // Reference to the network resource in Google Cloud. Exactly one of these
  // fields will be populated based on the configured type of network resource.
  oneof reference {
    // Output only. Reference to a network in Google Compute Engine.
    NetworkReference network = 3 [(google.api.field_behavior) = OUTPUT_ONLY];
  }

  // Immutable. Configuration for this network resource, which describes how it
  // should be created or imported. This field only controls how the network
  // resource is initially created or imported. Subsequent changes to the
  // network resource should be made via the resource's API and will not be
  // reflected in the configuration.
  NetworkResourceConfig config = 2 [(google.api.field_behavior) = IMMUTABLE];
}

// A reference to a [VPC network](https://cloud.google.com/vpc/docs/vpc) in
// Google Compute Engine.
message NetworkReference {
  // Output only. Name of the network, in the format
  // `projects/{project}/global/networks/{network}`.
  string network = 1 [
    (google.api.field_behavior) = OUTPUT_ONLY,
    (google.api.resource_reference) = { type: "compute.googleapis.com/Network" }
  ];

  // Output only. Name of the particular subnetwork being used by the cluster,
  // in the format
  // `projects/{project}/regions/{region}/subnetworks/{subnetwork}`.
  string subnetwork = 2 [
    (google.api.field_behavior) = OUTPUT_ONLY,
    (google.api.resource_reference) = {
      type: "compute.googleapis.com/Subnetwork"
    }
  ];
}

// Describes how a network resource should be initialized. Each network resource
// can either be imported from an existing Google Cloud resource or initialized
// when the cluster is created.
message NetworkResourceConfig {
  // Particular type of configuration for this network resource.
  oneof config {
    // Optional. Immutable. If set, indicates that a new network should be
    // created.
    NewNetworkConfig new_network = 3 [
      (google.api.field_behavior) = OPTIONAL,
      (google.api.field_behavior) = IMMUTABLE
    ];

    // Optional. Immutable. If set, indicates that an existing network should be
    // imported.
    ExistingNetworkConfig existing_network = 4 [
      (google.api.field_behavior) = OPTIONAL,
      (google.api.field_behavior) = IMMUTABLE
    ];
  }
}

// When set in a
// [NetworkResourceConfig][google.cloud.hypercomputecluster.v1alpha.NetworkResourceConfig],
// indicates that a new network should be created.
message NewNetworkConfig {
  // Required. Immutable. Name of the network to create, in the format
  // `projects/{project}/global/networks/{network}`.
  string network = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.field_behavior) = IMMUTABLE,
    (google.api.resource_reference) = { type: "compute.googleapis.com/Network" }
  ];

  // Optional. Immutable. Description of the network. Maximum of 2048
  // characters.
  string description = 2 [
    (google.api.field_behavior) = OPTIONAL,
    (google.api.field_behavior) = IMMUTABLE
  ];
}

// When set in a
// [NetworkResourceConfig][google.cloud.hypercomputecluster.v1alpha.NetworkResourceConfig],
// indicates that an existing network should be imported.
message ExistingNetworkConfig {
  // Required. Immutable. Name of the network to import, in the format
  // `projects/{project}/global/networks/{network}`.
  string network = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.field_behavior) = IMMUTABLE,
    (google.api.resource_reference) = { type: "compute.googleapis.com/Network" }
  ];

  // Required. Immutable. Particular subnetwork to use, in the format
  // `projects/{project}/regions/{region}/subnetworks/{subnetwork}`.
  string subnetwork = 2 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.field_behavior) = IMMUTABLE,
    (google.api.resource_reference) = {
      type: "compute.googleapis.com/Subnetwork"
    }
  ];
}

// A resource representing a form of persistent storage that is accessible to
// compute resources in the cluster.
message StorageResource {
  // Reference to the storage resource in Google Cloud. Exactly one of these
  // fields will be populated based on the configured type of storage resource.
  oneof reference {
    // Output only. Reference to a Filestore instance. Populated if and only if
    // the storage resource was configured to use Filestore.
    FilestoreReference filestore = 1
        [(google.api.field_behavior) = OUTPUT_ONLY];

    // Output only. Reference to a Google Cloud Storage bucket. Populated if and
    // only if the storage resource was configured to use Google Cloud Storage.
    BucketReference bucket = 2 [(google.api.field_behavior) = OUTPUT_ONLY];

    // Output only. Reference to a Managed Lustre instance. Populated if and
    // only if the storage resource was configured to use Managed Lustre.
    LustreReference lustre = 3 [(google.api.field_behavior) = OUTPUT_ONLY];
  }

  // Required. Immutable. Configuration for this storage resource, which
  // describes how it should be created or imported. This field only controls
  // how the storage resource is initially created or imported. Subsequent
  // changes to the storage resource should be made via the resource's API and
  // will not be reflected in the configuration.
  StorageResourceConfig config = 4 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.field_behavior) = IMMUTABLE
  ];
}

// A reference to a [Filestore](https://cloud.google.com/filestore) instance.
message FilestoreReference {
  // Output only. Name of the Filestore instance, in the format
  // `projects/{project}/locations/{location}/instances/{instance}`
  string filestore = 1 [
    (google.api.field_behavior) = OUTPUT_ONLY,
    (google.api.resource_reference) = {
      type: "file.googleapis.com/FileInstance"
    }
  ];
}

// A reference to a [Google Cloud Storage](https://cloud.google.com/storage)
// bucket.
message BucketReference {
  // Output only. Name of the bucket.
  string bucket = 1 [
    (google.api.field_behavior) = OUTPUT_ONLY,
    (google.api.resource_reference) = { type: "storage.googleapis.com/Bucket" }
  ];
}

// A reference to a [Managed
// Lustre](https://cloud.google.com/products/managed-lustre) instance.
message LustreReference {
  // Output only. Name of the Managed Lustre instance, in the format
  // `projects/{project}/locations/{location}/instances/{instance}`
  string lustre = 1 [
    (google.api.field_behavior) = OUTPUT_ONLY,
    (google.api.resource_reference) = { type: "lustre.googleapis.com/Instance" }
  ];
}

// Describes how a storage resource should be initialized. Each storage resource
// can either be imported from an existing Google Cloud resource or initialized
// when the cluster is created.
message StorageResourceConfig {
  // Particular type of configuration for this storage resource.
  oneof config {
    // Optional. Immutable. If set, indicates that a new Filestore instance
    // should be created.
    NewFilestoreConfig new_filestore = 1 [
      (google.api.field_behavior) = OPTIONAL,
      (google.api.field_behavior) = IMMUTABLE
    ];

    // Optional. Immutable. If set, indicates that an existing Filestore
    // instance should be imported.
    ExistingFilestoreConfig existing_filestore = 2 [
      (google.api.field_behavior) = OPTIONAL,
      (google.api.field_behavior) = IMMUTABLE
    ];

    // Optional. Immutable. If set, indicates that a new Cloud Storage bucket
    // should be created.
    NewBucketConfig new_bucket = 3 [
      (google.api.field_behavior) = OPTIONAL,
      (google.api.field_behavior) = IMMUTABLE
    ];

    // Optional. Immutable. If set, indicates that an existing Cloud Storage
    // bucket should be imported.
    ExistingBucketConfig existing_bucket = 4 [
      (google.api.field_behavior) = OPTIONAL,
      (google.api.field_behavior) = IMMUTABLE
    ];

    // Optional. Immutable. If set, indicates that a new Managed Lustre instance
    // should be created.
    NewLustreConfig new_lustre = 5 [
      (google.api.field_behavior) = OPTIONAL,
      (google.api.field_behavior) = IMMUTABLE
    ];

    // Optional. Immutable. If set, indicates that an existing Managed Lustre
    // instance should be imported.
    ExistingLustreConfig existing_lustre = 6 [
      (google.api.field_behavior) = OPTIONAL,
      (google.api.field_behavior) = IMMUTABLE
    ];
  }
}

// When set in a
// [StorageResourceConfig][google.cloud.hypercomputecluster.v1alpha.StorageResourceConfig],
// indicates that a new [Filestore](https://cloud.google.com/filestore) instance
// should be created.
message NewFilestoreConfig {
  // Available [service
  // tiers](https://cloud.google.com/filestore/docs/service-tiers) for Filestore
  // instances.
  enum Tier {
    // Not set.
    TIER_UNSPECIFIED = 0;

    // Offers expanded capacity and performance scaling capabilities suitable
    // for high-performance computing application requirements.
    ZONAL = 4;

    // Offers features and availability needed for mission-critical,
    // high-performance computing workloads.
    REGIONAL = 6;
  }

  // File access protocol for Filestore instances.
  enum Protocol {
    // Not set.
    PROTOCOL_UNSPECIFIED = 0;

    // NFS 3.0.
    NFSV3 = 1;

    // NFS 4.1.
    NFSV41 = 2;
  }

  // Required. Immutable. Name of the Filestore instance to create, in the
  // format `projects/{project}/locations/{location}/instances/{instance}`
  string filestore = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.field_behavior) = IMMUTABLE,
    (google.api.resource_reference) = {
      type: "file.googleapis.com/FileInstance"
    }
  ];

  // Optional. Immutable. Description of the instance. Maximum of 2048
  // characters.
  string description = 4 [
    (google.api.field_behavior) = OPTIONAL,
    (google.api.field_behavior) = IMMUTABLE
  ];

  // Required. Immutable. File system shares on the instance. Exactly one file
  // share must be specified.
  repeated FileShareConfig file_shares = 2 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.field_behavior) = IMMUTABLE
  ];

  // Required. Immutable. Service tier to use for the instance.
  Tier tier = 3 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.field_behavior) = IMMUTABLE
  ];

  // Optional. Immutable. Access protocol to use for all file shares in the
  // instance. Defaults to NFS V3 if not set.
  Protocol protocol = 5 [
    (google.api.field_behavior) = OPTIONAL,
    (google.api.field_behavior) = OPTIONAL,
    (google.api.field_behavior) = IMMUTABLE
  ];
}

// Message describing filestore configuration
message FileShareConfig {
  // Required. Size of the filestore in GB. Must be between 1024 and 102400, and
  // must meet scalability requirements described at
  // https://cloud.google.com/filestore/docs/service-tiers.
  int64 capacity_gb = 1 [(google.api.field_behavior) = REQUIRED];

  // Required. Filestore share location
  string file_share = 2 [(google.api.field_behavior) = REQUIRED];
}

// When set in a
// [StorageResourceConfig][google.cloud.hypercomputecluster.v1alpha.StorageResourceConfig],
// indicates that an existing [Filestore](https://cloud.google.com/filestore)
// instance should be imported.
message ExistingFilestoreConfig {
  // Required. Immutable. Name of the Filestore instance to import, in the
  // format `projects/{project}/locations/{location}/instances/{instance}`
  string filestore = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.field_behavior) = IMMUTABLE,
    (google.api.resource_reference) = {
      type: "file.googleapis.com/FileInstance"
    }
  ];
}

// When set in a
// [StorageResourceConfig][google.cloud.hypercomputecluster.v1alpha.StorageResourceConfig],
// indicates that a new [Google Cloud Storage](https://cloud.google.com/storage)
// bucket should be created.
message NewBucketConfig {
  // [Storage class](https://cloud.google.com/storage/docs/storage-classes) for
  // a Cloud Storage bucket.
  enum StorageClass {
    // Not set.
    STORAGE_CLASS_UNSPECIFIED = 0;

    // Best for data that is frequently accessed.
    STANDARD = 1;

    // Low-cost storage for data that is accessed less frequently.
    NEARLINE = 2;

    // Very low-cost storage for infrequently accessed data.
    COLDLINE = 3;

    // Lowest-cost storage for data archiving, online backup, and disaster
    // recovery.
    ARCHIVE = 4;
  }

  // Storage class of the bucket, which can be set automatically or explicitly.
  oneof option {
    // Optional. Immutable. If set, indicates that the bucket should use
    // [Autoclass](https://cloud.google.com/storage/docs/autoclass).
    GcsAutoclassConfig autoclass = 2 [
      (google.api.field_behavior) = OPTIONAL,
      (google.api.field_behavior) = IMMUTABLE
    ];

    // Optional. Immutable. If set, uses the provided storage class as the
    // bucket's default storage class.
    StorageClass storage_class = 3 [
      (google.api.field_behavior) = OPTIONAL,
      (google.api.field_behavior) = IMMUTABLE
    ];
  }

  // Required. Immutable. Name of the Cloud Storage bucket to create.
  string bucket = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.field_behavior) = IMMUTABLE,
    (google.api.resource_reference) = { type: "storage.googleapis.com/Bucket" }
  ];

  // Optional. Immutable. If set, indicates that the bucket should use
  // [hierarchical
  // namespaces](https://cloud.google.com/storage/docs/hns-overview).
  GcsHierarchicalNamespaceConfig hierarchical_namespace = 4 [
    (google.api.field_behavior) = OPTIONAL,
    (google.api.field_behavior) = IMMUTABLE
  ];
}

// Message describing Google Cloud Storage autoclass configuration
message GcsAutoclassConfig {
  // Terminal storage class types of the autoclass bucket
  enum TerminalStorageClass {
    // Unspecified terminal storage class
    TERMINAL_STORAGE_CLASS_UNSPECIFIED = 0;

    // Nearline terminal storage class
    TERMINAL_STORAGE_CLASS_NEARLINE = 1;

    // Archive terminal storage class
    TERMINAL_STORAGE_CLASS_ARCHIVE = 2;
  }

  // Required. Enables Auto-class feature.
  bool enabled = 1 [(google.api.field_behavior) = REQUIRED];

  // Optional. Terminal storage class of the autoclass bucket
  TerminalStorageClass terminal_storage_class = 2
      [(google.api.field_behavior) = OPTIONAL];
}

// Message describing Google Cloud Storage hierarchical namespace configuration
message GcsHierarchicalNamespaceConfig {
  // Required. Enables hierarchical namespace setup for the bucket.
  bool enabled = 1 [(google.api.field_behavior) = REQUIRED];
}

// When set in a
// [StorageResourceConfig][google.cloud.hypercomputecluster.v1alpha.StorageResourceConfig],
// indicates that an existing [Google Cloud
// Storage](https://cloud.google.com/storage) bucket should be imported.
message ExistingBucketConfig {
  // Required. Immutable. Name of the Cloud Storage bucket to import.
  string bucket = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.field_behavior) = IMMUTABLE,
    (google.api.resource_reference) = { type: "storage.googleapis.com/Bucket" }
  ];
}

// When set in a
// [StorageResourceConfig][google.cloud.hypercomputecluster.v1alpha.StorageResourceConfig],
// indicates that a new [Managed
// Lustre](https://cloud.google.com/products/managed-lustre) instance should be
// created.
message NewLustreConfig {
  // Required. Immutable. Name of the Managed Lustre instance to create, in the
  // format `projects/{project}/locations/{location}/instances/{instance}`
  string lustre = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.field_behavior) = IMMUTABLE
  ];

  // Optional. Immutable. Description of the Managed Lustre instance. Maximum of
  // 2048 characters.
  string description = 2 [
    (google.api.field_behavior) = OPTIONAL,
    (google.api.field_behavior) = IMMUTABLE
  ];

  // Required. Immutable. Filesystem name for this instance. This name is used
  // by client-side tools, including when mounting the instance. Must be 8
  // characters or less and can only contain letters and numbers.
  string filesystem = 3 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.field_behavior) = IMMUTABLE
  ];

  // Required. Immutable. Storage capacity of the instance in gibibytes (GiB).
  // Allowed values are between 18000 and 7632000.
  int64 capacity_gb = 4 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.field_behavior) = IMMUTABLE
  ];

  // Optional. Immutable. Throughput of the instance in MB/s/TiB. Valid values
  // are 125, 250, 500, 1000. See [Performance tiers and maximum storage
  // capacities](https://cloud.google.com/managed-lustre/docs/create-instance#performance-tiers)
  // for more information.
  int64 per_unit_storage_throughput = 5 [
    (google.api.field_behavior) = OPTIONAL,
    (google.api.field_behavior) = IMMUTABLE
  ];
}

// When set in a
// [StorageResourceConfig][google.cloud.hypercomputecluster.v1alpha.StorageResourceConfig],
// indicates that an existing [Managed
// Lustre](https://cloud.google.com/products/managed-lustre) instance should be
// imported.
message ExistingLustreConfig {
  // Required. Immutable. Name of the Managed Lustre instance to import, in the
  // format `projects/{project}/locations/{location}/instances/{instance}`
  string lustre = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.field_behavior) = IMMUTABLE,
    (google.api.resource_reference) = { type: "lustre.googleapis.com/Instance" }
  ];
}

// A resource defining how virtual machines and accelerators should be
// provisioned for the cluster.
message ComputeResource {
  // Required. Immutable. Configuration for this compute resource, which
  // describes how it should be created at runtime.
  ComputeResourceConfig config = 6 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.field_behavior) = IMMUTABLE
  ];
}

// Describes how a compute resource should be created at runtime.
message ComputeResourceConfig {
  // Particular type of configuration for this compute resource.
  oneof config {
    // Optional. Immutable. If set, indicates that this resource should use
    // on-demand VMs.
    NewOnDemandInstancesConfig new_on_demand_instances = 1 [
      (google.api.field_behavior) = OPTIONAL,
      (google.api.field_behavior) = IMMUTABLE
    ];

    // Optional. Immutable. If set, indicates that this resource should use spot
    // VMs.
    NewSpotInstancesConfig new_spot_instances = 2 [
      (google.api.field_behavior) = OPTIONAL,
      (google.api.field_behavior) = IMMUTABLE
    ];

    // Optional. Immutable. If set, indicates that this resource should use
    // reserved VMs.
    NewReservedInstancesConfig new_reserved_instances = 3 [
      (google.api.field_behavior) = OPTIONAL,
      (google.api.field_behavior) = IMMUTABLE
    ];

    // Optional. Immutable. If set, indicates that this resource should use
    // flex-start VMs.
    NewFlexStartInstancesConfig new_flex_start_instances = 5 [
      (google.api.field_behavior) = OPTIONAL,
      (google.api.field_behavior) = IMMUTABLE
    ];
  }
}

// When set in a
// [ComputeResourceConfig][google.cloud.hypercomputecluster.v1alpha.ComputeResourceConfig],
// indicates that on-demand (i.e., using the standard provisioning model) VM
// instances should be created.
message NewOnDemandInstancesConfig {
  // Required. Immutable. Name of the zone in which VM instances should run,
  // e.g., `us-central1-a`. Must be in the same region as the cluster, and must
  // match the zone of any other resources specified in the cluster.
  string zone = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.field_behavior) = IMMUTABLE
  ];

  // Required. Immutable. Name of the Compute Engine [machine
  // type](https://cloud.google.com/compute/docs/machine-resource) to use, e.g.
  // `n2-standard-2`.
  string machine_type = 2 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.field_behavior) = IMMUTABLE
  ];

  // Optional. Immutable. Unstable: Contact hypercompute-service-eng@ before
  // using.
  map<string, string> atm_tags = 3 [
    (google.api.field_behavior) = OPTIONAL,
    (google.api.field_behavior) = IMMUTABLE
  ];
}

// When set in a
// [ComputeResourceConfig][google.cloud.hypercomputecluster.v1alpha.ComputeResourceConfig],
// indicates that [spot
// VM](https://cloud.google.com/compute/docs/instances/spot) instances should be
// created.
message NewSpotInstancesConfig {
  // Specifies the termination action of the instance
  enum TerminationAction {
    // Not set.
    TERMINATION_ACTION_UNSPECIFIED = 0;

    // Compute Engine stops the Spot VM on preemption.
    STOP = 1;

    // Compute Engine deletes the Spot VM on preemption.
    DELETE = 2;
  }

  // Required. Immutable. Name of the zone in which VM instances should run,
  // e.g., `us-central1-a`. Must be in the same region as the cluster, and must
  // match the zone of any other resources specified in the cluster.
  string zone = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.field_behavior) = IMMUTABLE
  ];

  // Required. Immutable. Name of the Compute Engine [machine
  // type](https://cloud.google.com/compute/docs/machine-resource) to use, e.g.
  // `n2-standard-2`.
  string machine_type = 2 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.field_behavior) = IMMUTABLE
  ];

  // Optional. Immutable. Unstable: Contact hypercompute-service-eng@ before
  // using.
  map<string, string> atm_tags = 3 [
    (google.api.field_behavior) = OPTIONAL,
    (google.api.field_behavior) = IMMUTABLE
  ];

  // Optional. Termination action for the instance. If not specified, Compute
  // Engine sets the termination action to DELETE.
  TerminationAction termination_action = 5
      [(google.api.field_behavior) = OPTIONAL];
}

// When set in a
// [ComputeResourceConfig][google.cloud.hypercomputecluster.v1alpha.ComputeResourceConfig],
// indicates that VM instances should be created from a
// [reservation](https://cloud.google.com/compute/docs/instances/reservations-overview).
message NewReservedInstancesConfig {
  // Source of the reservation
  oneof source {
    // Optional. Immutable. Name of the reservation from which VM instances
    // should be created, in the format
    // `projects/{project}/zones/{zone}/reservations/{reservation}`.
    string reservation = 1 [
      (google.api.field_behavior) = OPTIONAL,
      (google.api.field_behavior) = IMMUTABLE,
      (google.api.resource_reference) = {
        type: "compute.googleapis.com/Reservation"
      }
    ];

    // Optional. Immutable. Name of the reservation block from which VM
    // instances should be created, in the format
    // `projects/{project}/zones/{zone}/reservations/{reservation}/reservationBlocks/{reservation_block}`.
    string reservation_block = 7 [
      (google.api.field_behavior) = OPTIONAL,
      (google.api.field_behavior) = IMMUTABLE,
      (google.api.resource_reference) = {
        type: "compute.googleapis.com/ReservationBlock"
      }
    ];

    // Optional. Immutable. Name of the reservation sub block from which VM
    // instances should be created, in the format
    // `projects/{project}/zones/{zone}/reservations/{reservation}/reservationBlocks/{reservation_block}/reservationSubBlocks/{reservation_sub_block}`.
    string reservation_sub_block = 8 [
      (google.api.field_behavior) = OPTIONAL,
      (google.api.field_behavior) = IMMUTABLE,
      (google.api.resource_reference) = {
        type: "compute.googleapis.com/ReservationSubBlock"
      }
    ];
  }

  // Optional. Immutable. Unstable: Contact hypercompute-service-eng@ before
  // using.
  map<string, string> atm_tags = 2 [
    (google.api.field_behavior) = OPTIONAL,
    (google.api.field_behavior) = IMMUTABLE
  ];

  // Optional. Immutable. Deprecated: Do not use.
  string zone = 3 [
    deprecated = true,
    (google.api.field_behavior) = OPTIONAL,
    (google.api.field_behavior) = IMMUTABLE
  ];

  // Optional. Immutable. Deprecated: Do not use.
  string machine_type = 4 [
    deprecated = true,
    (google.api.field_behavior) = OPTIONAL,
    (google.api.field_behavior) = IMMUTABLE
  ];
}

// When set in a
// [ComputeResourceConfig][google.cloud.hypercomputecluster.v1alpha.ComputeResourceConfig],
// indicates that VM instances should be created using [Flex
// Start](https://cloud.google.com/compute/docs/instances/provisioning-models).
message NewFlexStartInstancesConfig {
  // Required. Immutable. Name of the zone in which VM instances should run,
  // e.g., `us-central1-a`. Must be in the same region as the cluster, and must
  // match the zone of any other resources specified in the cluster.
  string zone = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.field_behavior) = IMMUTABLE
  ];

  // Required. Immutable. Name of the Compute Engine [machine
  // type](https://cloud.google.com/compute/docs/machine-resource) to use, e.g.
  // `n2-standard-2`.
  string machine_type = 2 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.field_behavior) = IMMUTABLE
  ];

  // Required. Immutable. Specifies the time limit for created instances.
  // Instances will be terminated at the end of this duration.
  google.protobuf.Duration max_duration = 3 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.field_behavior) = IMMUTABLE
  ];

  // Optional. Immutable. Unstable: Contact hypercompute-service-eng@ before
  // using.
  map<string, string> atm_tags = 4 [
    (google.api.field_behavior) = OPTIONAL,
    (google.api.field_behavior) = IMMUTABLE
  ];
}

// A [Persistent disk](https://cloud.google.com/compute/docs/disks) used as the
// boot disk for a Compute Engine VM instance.
message BootDisk {
  // Required. Immutable. [Persistent disk
  // type](https://cloud.google.com/compute/docs/disks#disk-types), in the
  // format `projects/{project}/zones/{zone}/diskTypes/{disk_type}`.
  string type = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.field_behavior) = IMMUTABLE,
    (google.api.resource_reference) = {
      type: "compute.googleapis.com/DiskType"
    }
  ];

  // Required. Immutable. Size of the disk in gigabytes. Must be at least 10GB.
  int64 size_gb = 2 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.field_behavior) = IMMUTABLE
  ];

  // Optional. Source image family used to create this disk. Must be a
  // [supported image
  // family](https://docs.cloud.google.com/cluster-director/docs/compute#os-images)
  // for the VM instance's machine type. If no family is specified, the system
  // will select a supported image family based on the machine type. If this
  // field is cleared, the system will continue to use the current image family.
  string image = 3 [
    (google.api.field_behavior) = OPTIONAL,
    (google.api.resource_reference) = { type: "compute.googleapis.com/Image" }
  ];

  // Output only. The specific image family that will be used for new VM
  // instances using this disk. If
  // [image][google.cloud.hypercomputecluster.v1alpha.BootDisk.image] is
  // non-empty, this field will be set to the same value as `image`. Otherwise,
  // this field will be set to a system-selected image.
  string effective_image = 4 [
    (google.api.field_behavior) = OUTPUT_ONLY,
    (google.api.resource_reference) = { type: "compute.googleapis.com/Image" }
  ];
}

// Unstable: Contact hypercompute-service-eng@ before using.
message AtmTag {
  // Required. Unstable: Contact hypercompute-service-eng@ before using.
  string key = 1 [(google.api.field_behavior) = REQUIRED];

  // Required. Unstable: Contact hypercompute-service-eng@ before using.
  string value = 2 [(google.api.field_behavior) = REQUIRED];
}

// The component responsible for scheduling and running workloads on the
// cluster as well as providing the user interface for interacting with the
// cluster at runtime.
message Orchestrator {
  // Particular type of orchestrator to use in this cluster.
  oneof option {
    // Optional. If set, indicates that the cluster should use Slurm as the
    // orchestrator.
    SlurmOrchestrator slurm = 1 [(google.api.field_behavior) = OPTIONAL];
  }
}

// When set in
// [Orchestrator][google.cloud.hypercomputecluster.v1alpha.Orchestrator],
// indicates that the cluster should use [Slurm](https://slurm.schedmd.com/) as
// the orchestrator.
message SlurmOrchestrator {
  // Slurm orchestrator configuration. Values correspond to a subset of those
  // found in https://slurm.schedmd.com/slurm.conf.html.
  message SlurmConfig {
    // Flags to control the Prolog behavior.
    enum PrologFlag {
      // Unspecified prolog flag.
      PROLOG_FLAG_UNSPECIFIED = 0;

      // Prolog script will be executed at job allocation. NOTE: increases the
      // time required to start jobs. Corresponds to Alloc.
      ALLOC = 1;

      // Use the ProcTrack plugin to create a job container on all allocated
      // compute nodes. Corresponds to Contain.
      CONTAIN = 2;

      // Slurmctld will wait until the prolog completes on all allocated nodes
      // before sending the batch job launch request. Corresponds to DeferBatch.
      DEFER_BATCH = 3;

      // If set, the ALLOC flag should also be set. This will allow for salloc
      // to not block until the prolog is finished on each node. Corresponds to
      // NoHold.
      NO_HOLD = 4;

      // Always requeue it automatically even if the job requested no requeues.
      // NOTE: Setting this flag implicitly sets the ALLOC flag. Corresponds to
      // ForceRequeueOnFail.
      FORCE_REQUEUE_ON_FAIL = 5;

      // Make the Prolog/Epilog run in the extern slurmstepd. Corresponds to
      // RunInJob.
      RUN_IN_JOB = 6;

      // Force prolog and epilog scripts to run serially within each node. NOTE:
      // This is incompatible with Serial.
      SERIAL = 7;

      // Enable Slurm's built-in X11 forwarding capabilities. Corresponds to
      // X11.
      X11 = 8;
    }

    // Flags to control the level of association to impose on job submissions.
    enum AccountingStorageEnforceFlag {
      // Unspecified accounting storage enforce flag.
      ACCOUNTING_STORAGE_ENFORCE_FLAG_UNSPECIFIED = 0;

      // Implies all other available options except nojobs and nosteps.
      ALL = 1;

      // No new job will be allowed to run unless a corresponding association
      // exists in the system.
      ASSOCIATIONS = 2;

      // Users will be limited by association to whatever job size or run time
      // limits are defined. Implies associations.
      LIMITS = 3;

      // Slurm will not account for any jobs or steps on the system. Implies
      // nosteps.
      NOJOBS = 4;

      // Slurm will not account for any steps that have run.
      NOSTEPS = 5;

      // Jobs will not be scheduled unless a valid qos is specified. Implies
      // associations.
      QOS = 6;

      // A job will only be launched against an association or qos that has a
      // TRES-minutes limit set if the job will be able to run to completion.
      // Without this option set, jobs will be launched as long as their usage
      // hasn't reached the TRES-minutes limit. This can lead to jobs being
      // launched but then killed when the limit is reached. With this option, a
      // job won't be killed due to limits, even if the limits are changed after
      // the job was started and the association or qos violates the updated
      // limits. Implies limits and associations.
      SAFE = 7;

      // Jobs will not be scheduled unless a valid workload characterization key
      // is specified. Implies associations and TrackWCKey (a separate
      // configuration option).
      WCKEYS = 8;
    }

    // Specifies the plugin to be used in establishing a job's scheduling
    // priority.
    enum PriorityType {
      // Unspecified priority type.
      PRIORITY_TYPE_UNSPECIFIED = 0;

      // Jobs are evaluated in a First In, First Out (FIFO) manner.
      PRIORITY_BASIC = 1;

      // Jobs are assigned a priority based upon a variety of factors that
      // include size, age, Fairshare, etc.
      PRIORITY_MULTIFACTOR = 2;
    }

    // Specifies the mechanism used to preempt jobs or enable gang scheduling.
    enum PreemptMode {
      // Unspecified preempt mode.
      PREEMPT_MODE_UNSPECIFIED = 0;

      // Is the default value and disables job preemption and gang scheduling.
      OFF = 1;

      // The preempted job will be cancelled
      CANCEL = 2;

      // Enables gang scheduling (time slicing) of jobs in the same partition,
      // and allows the resuming of suspended jobs.
      GANG = 3;

      // Preempts jobs by requeuing them (if possible) or canceling them.
      REQUEUE = 4;

      // The preempted jobs will be suspended, and later the Gang scheduler will
      // resume them.
      SUSPEND = 5;

      // Allow preemption only if the preemptor's job priority is higher than
      // the preemptee's job priority.
      PRIORITY = 6;

      // Allow jobs within the same qos to preempt one another.
      WITHIN = 7;
    }

    // Specifies the plugin used to identify which jobs can be preempted in
    // order to start a pending job.
    enum PreemptType {
      // Unspecified preempt type.
      PREEMPT_TYPE_UNSPECIFIED = 0;

      // Job preemption is disabled (default).
      PREEMPT_NONE = 1;

      // Job preemption is based upon partition PriorityTier.
      PREEMPT_PARTITION_PRIO = 2;

      // Job preemption rules are specified by Quality Of Service (QOS)
      // specifications in the Slurm database.
      PREEMPT_QOS = 3;
    }

    // Optional. Enables automatic requeue for batch jobs which exit with the
    // specified values. Default is empty. Corresponds to RequeueExit.
    repeated int64 requeue_exit_codes = 1
        [(google.api.field_behavior) = OPTIONAL];

    // Optional. Enables automatic requeue for batch jobs which exit with the
    // specified values, with these jobs being held until released manually by
    // the user. Default is empty. Corresponds to RequeueExitHold.
    repeated int64 requeue_hold_exit_codes = 2
        [(google.api.field_behavior) = OPTIONAL];

    // Optional. Flags to control the Prolog behavior. By default no flags are
    // set. Corresponds to PrologFlags.
    repeated PrologFlag prolog_flags = 3
        [(google.api.field_behavior) = OPTIONAL];

    // Optional. The interval Slurm waits for Prolog and Epilog before
    // terminating them. Default is 65534 seconds. Corresponds to
    // PrologEpilogTimeout.
    google.protobuf.Duration prolog_epilog_timeout = 4
        [(google.api.field_behavior) = OPTIONAL];

    // Optional. Flags to control the level of association to impose on job
    // submissions. By default no flags are set. Corresponds to
    // AccountingStorageEnforce.
    repeated AccountingStorageEnforceFlag accounting_storage_enforce_flags = 5
        [(google.api.field_behavior) = OPTIONAL];

    // Optional. Specifies the plugin to be used in establishing a job's
    // scheduling priority. Set this value to "priority/multifactor" to enable
    // the Multifactor Job Priority Plugin.
    PriorityType priority_type = 6 [(google.api.field_behavior) = OPTIONAL];

    // Optional. An unsigned integer that scales the contribution of the age
    // factor.
    int64 priority_weight_age = 7 [(google.api.field_behavior) = OPTIONAL];

    // Optional. An unsigned integer that scales the contribution of the
    // association factor.
    int64 priority_weight_assoc = 8 [(google.api.field_behavior) = OPTIONAL];

    // Optional. An unsigned integer that scales the contribution of the
    // fair-share factor.
    int64 priority_weight_fairshare = 9
        [(google.api.field_behavior) = OPTIONAL];

    // Optional. An unsigned integer that scales the contribution of the job
    // size factor.
    int64 priority_weight_job_size = 10
        [(google.api.field_behavior) = OPTIONAL];

    // Optional. An unsigned integer that scales the contribution of the
    // partition factor.
    int64 priority_weight_partition = 11
        [(google.api.field_behavior) = OPTIONAL];

    // Optional. An unsigned integer that scales the contribution of the quality
    // of service factor.
    int64 priority_weight_qos = 12 [(google.api.field_behavior) = OPTIONAL];

    // Optional. A comma-separated list of TRES Types and weights that sets the
    // degree that each TRES Type contributes to the job's priority.
    string priority_weight_tres = 13 [(google.api.field_behavior) = OPTIONAL];

    // Optional. Specifies the mechanism used to preempt jobs or enable gang
    // scheduling.
    repeated PreemptMode preempt_mode = 14
        [(google.api.field_behavior) = OPTIONAL];

    // Optional. Specifies the plugin used to identify which jobs can be
    // preempted in order to start a pending job.
    PreemptType preempt_type = 15 [(google.api.field_behavior) = OPTIONAL];

    // Optional. Specifies minimum run time of jobs before they are considered
    // for preemption.
    string preempt_exempt_time = 16 [(google.api.field_behavior) = OPTIONAL];

    // Optional. The interval in seconds between executions of
    // HealthCheckProgram. If provided, must be > 0. To disable health checks,
    // use disable_health_check_program instead.
    int64 health_check_interval = 17 [(google.api.field_behavior) = OPTIONAL];

    // Optional. The node state to check for. Allowed values are "ALLOC", "ANY",
    // "CYCLE", "IDLE", "NONDRAINED_IDLE", "MIXED", and "START_ONLY". Multiple
    // state values may be specified with a comma separator.
    string health_check_node_state = 18
        [(google.api.field_behavior) = OPTIONAL];

    // Optional. The fully-qualified path to the health check program to be
    // executed.
    string health_check_program = 19 [(google.api.field_behavior) = OPTIONAL];
  }

  // Required. Configuration for login nodes, which allow users to access the
  // cluster over SSH.
  SlurmLoginNodes login_nodes = 6 [(google.api.field_behavior) = REQUIRED];

  // Optional. Compute resource configuration for the Slurm nodesets in your
  // cluster. If not specified, the cluster won't create any nodes.
  repeated SlurmNodeSet node_sets = 1 [(google.api.field_behavior) = OPTIONAL];

  // Optional. Configuration for the Slurm partitions in your cluster. Each
  // partition can contain one or more nodesets, and you can submit separate
  // jobs on each partition. If you don't specify at least one partition in your
  // cluster, you can't submit jobs to the cluster.
  repeated SlurmPartition partitions = 2
      [(google.api.field_behavior) = OPTIONAL];

  // Optional. Default partition to use for submitted jobs that do not
  // explicitly specify a partition. Required if and only if there is more than
  // one partition, in which case it must match the id of one of the partitions.
  string default_partition = 3 [(google.api.field_behavior) = OPTIONAL];

  // Optional. Slurm [prolog
  // scripts](https://slurm.schedmd.com/prolog_epilog.html), which will be
  // executed by compute nodes before a node begins running a new job. Values
  // must not be empty.
  repeated string prolog_bash_scripts = 4
      [(google.api.field_behavior) = OPTIONAL];

  // Optional. Slurm [epilog
  // scripts](https://slurm.schedmd.com/prolog_epilog.html), which will be
  // executed by compute nodes whenever a node finishes running a job. Values
  // must not be empty.
  repeated string epilog_bash_scripts = 5
      [(google.api.field_behavior) = OPTIONAL];

  // Optional. Unstable: Contact hypercompute-service-eng@ before using.
  SlurmConfig config = 7 [(google.api.field_behavior) = OPTIONAL];

  // Optional. Unstable: Contact hypercompute-service-eng@ before using.
  repeated string task_prolog_bash_scripts = 8
      [(google.api.field_behavior) = OPTIONAL];

  // Optional. Unstable: Contact hypercompute-service-eng@ before using.
  repeated string task_epilog_bash_scripts = 9
      [(google.api.field_behavior) = OPTIONAL];

  // Optional. Unstable: Contact hypercompute-service-eng@ before using.
  // If true, health checking is disabled, and health_check_interval,
  // health_check_node_state, and health_check_program should not be passed in.
  bool disable_health_check_program = 10
      [(google.api.field_behavior) = OPTIONAL];
}

// Configuration for Slurm nodesets in the cluster. Nodesets are groups of
// compute nodes used by Slurm that are responsible for running workloads
// submitted to the cluster.
message SlurmNodeSet {
  // Additional configuration for the nodeset. If not set, the nodeset will
  // use
  // [ComputeInstanceSlurmNodeSet][google.cloud.hypercomputecluster.v1alpha.ComputeInstanceSlurmNodeSet]
  // with default values.
  oneof type {
    // Optional. If set, indicates that the nodeset should be backed by Compute
    // Engine instances.
    ComputeInstanceSlurmNodeSet compute_instance = 17
        [(google.api.field_behavior) = OPTIONAL];

    // Optional. If set, indicates that the nodeset should be backed by a
    // Kubernetes Engine node pool.
    ContainerNodePoolSlurmNodeSet container_node_pool = 18
        [(google.api.field_behavior) = OPTIONAL];
  }

  // Required. Identifier for the nodeset, which allows it to be referenced by
  // partitions. Must conform to
  // [RFC-1034](https://datatracker.ietf.org/doc/html/rfc1034) (lower-case,
  // alphanumeric, and at most 63 characters).
  string id = 1 [(google.api.field_behavior) = REQUIRED];

  // Required. ID of the compute resource on which this nodeset will run. Must
  // match a key in the cluster's
  // [compute_resources][google.cloud.hypercomputecluster.v1alpha.Cluster.compute_resources].
  string compute_id = 16 [(google.api.field_behavior) = REQUIRED];

  // Optional. How [storage
  // resources][google.cloud.hypercomputecluster.v1alpha.StorageResource] should
  // be mounted on each compute node.
  repeated StorageConfig storage_configs = 3
      [(google.api.field_behavior) = OPTIONAL];

  // Optional. Number of nodes to be statically created for this nodeset. The
  // cluster will attempt to ensure that at least this many nodes exist at all
  // times.
  int64 static_node_count = 4 [(google.api.field_behavior) = OPTIONAL];

  // Optional. Controls how many additional nodes a cluster can bring online to
  // handle workloads. Set this value to enable dynamic node creation and limit
  // the number of additional nodes the cluster can bring online. Leave empty if
  // you do not want the cluster to create nodes dynamically, and instead rely
  // only on static nodes.
  int64 max_dynamic_node_count = 5 [(google.api.field_behavior) = OPTIONAL];

  // Optional. Unstable: Contact hypercompute-service-eng@ before using.
  ServiceAccount service_account = 13 [(google.api.field_behavior) = OPTIONAL];

  // Optional. Whether compute node instances should be assigned [external IP
  // addresses](https://cloud.google.com/compute/docs/ip-addresses#externaladdresses).
  bool enable_public_ips = 11 [(google.api.field_behavior) = OPTIONAL];

  // Optional. Deprecated: Use
  // [ComputeInstanceSlurmNodeSet.startup_script][google.cloud.hypercomputecluster.v1alpha.ComputeInstanceSlurmNodeSet.startup_script]
  // instead.
  string startup_script = 7
      [deprecated = true, (google.api.field_behavior) = OPTIONAL];

  // Optional. Deprecated: Do not use.
  bool enable_os_login = 9
      [deprecated = true, (google.api.field_behavior) = OPTIONAL];

  // Optional. Deprecated: Use
  // [ComputeInstanceSlurmNodeSet.labels][google.cloud.hypercomputecluster.v1alpha.ComputeInstanceSlurmNodeSet.labels]
  // instead.
  map<string, string> labels = 12
      [deprecated = true, (google.api.field_behavior) = OPTIONAL];
}

// When set in a
// [SlurmNodeSet][google.cloud.hypercomputecluster.v1alpha.SlurmNodeSet],
// indicates that the nodeset should be backed by Compute Engine VM instances.
message ComputeInstanceSlurmNodeSet {
  // Optional. [Startup
  // script](https://cloud.google.com/compute/docs/instances/startup-scripts/linux)
  // to be run on each VM instance in the nodeset. Max 256KB.
  string startup_script = 1 [(google.api.field_behavior) = OPTIONAL];

  // Optional.
  // [Labels](https://cloud.google.com/compute/docs/labeling-resources) that
  // should be applied to each VM instance in the nodeset.
  map<string, string> labels = 2 [(google.api.field_behavior) = OPTIONAL];

  // Optional. Boot disk for the compute instance
  BootDisk boot_disk = 3 [(google.api.field_behavior) = OPTIONAL];

  // Optional. The maximum time to wait for the startup script to complete. If
  // the script exceeds this duration, the instance setup will be considered
  // failed. This value must be positive. If this value is unset, a default
  // timeout of 5 minutes (300 seconds) will be used by the system.
  google.protobuf.Duration startup_script_timeout = 4
      [(google.api.field_behavior) = OPTIONAL];
}

// When set in a
// [SlurmNodeSet][google.cloud.hypercomputecluster.v1alpha.SlurmNodeSet],
// indicates that the nodeset should be backed by a Kubernetes Engine node pool.
message ContainerNodePoolSlurmNodeSet {
  // Optional. Resource labels that are applied to the underlying Google Compute
  // Engine resources.
  map<string, string> resource_labels = 1
      [(google.api.field_behavior) = OPTIONAL];

  // Optional. Script to run in each pod in the nodeset when it first starts.
  // Max 256KB.
  string startup_script = 2 [(google.api.field_behavior) = OPTIONAL];
}

// Configuration for Slurm partitions in the cluster. Partitions are groups of
// nodesets, and are how clients specify where their workloads should be run.
message SlurmPartition {
  // Required. ID of the partition, which is how users will identify it. Must
  // conform to [RFC-1034](https://datatracker.ietf.org/doc/html/rfc1034)
  // (lower-case, alphanumeric, and at most 63 characters).
  string id = 1 [(google.api.field_behavior) = REQUIRED];

  // Required. IDs of the nodesets that make up this partition. Values must
  // match
  // [SlurmNodeSet.id][google.cloud.hypercomputecluster.v1alpha.SlurmNodeSet.id].
  repeated string node_set_ids = 2 [(google.api.field_behavior) = REQUIRED];

  // Optional. Unstable: Contact hypercompute-service-eng@ before using.
  bool exclusive = 3 [(google.api.field_behavior) = OPTIONAL];
}

// Configuration for Slurm [login
// nodes](https://slurm.schedmd.com/quickstart_admin.html#login) in the cluster.
// Login nodes are Compute Engine VM instances that allow users to access the
// cluster over SSH.
message SlurmLoginNodes {
  // Required. Number of login node instances to create.
  int64 count = 3 [(google.api.field_behavior) = REQUIRED];

  // Required. Name of the zone in which login nodes should run, e.g.,
  // `us-central1-a`. Must be in the same region as the cluster, and must match
  // the zone of any other resources specified in the cluster.
  string zone = 2 [(google.api.field_behavior) = REQUIRED];

  // Required. Name of the Compute Engine [machine
  // type](https://cloud.google.com/compute/docs/machine-resource) to use for
  // login nodes, e.g. `n2-standard-2`.
  string machine_type = 1 [(google.api.field_behavior) = REQUIRED];

  // Optional. [Startup
  // script](https://cloud.google.com/compute/docs/instances/startup-scripts/linux)
  // to be run on each login node instance. Max 256KB.
  // The script must complete within the system-defined default timeout of 5
  // minutes. For tasks that require more time, consider running them in the
  // background using methods such as `&` or `nohup`.
  string startup_script = 5 [(google.api.field_behavior) = OPTIONAL];

  // Optional. Whether [OS Login](https://cloud.google.com/compute/docs/oslogin)
  // should be enabled on login node instances.
  bool enable_os_login = 6 [(google.api.field_behavior) = OPTIONAL];

  // Optional. Whether login node instances should be assigned [external IP
  // addresses](https://cloud.google.com/compute/docs/ip-addresses#externaladdresses).
  bool enable_public_ips = 7 [(google.api.field_behavior) = OPTIONAL];

  // Optional.
  // [Labels](https://cloud.google.com/compute/docs/labeling-resources) that
  // should be applied to each login node instance.
  map<string, string> labels = 8 [(google.api.field_behavior) = OPTIONAL];

  // Optional. How [storage
  // resources][google.cloud.hypercomputecluster.v1alpha.StorageResource] should
  // be mounted on each login node.
  repeated StorageConfig storage_configs = 12
      [(google.api.field_behavior) = OPTIONAL];

  // Output only. Information about the login node instances that were created
  // in Compute Engine.
  repeated ComputeInstance instances = 10
      [(google.api.field_behavior) = OUTPUT_ONLY];

  // Optional. Boot disk for the login node.
  BootDisk boot_disk = 13 [(google.api.field_behavior) = OPTIONAL];

  // Optional. Unstable: Contact hypercompute-service-eng@ before using.
  ServiceAccount service_account = 9 [(google.api.field_behavior) = OPTIONAL];
}

// Service account email and scopes
message ServiceAccount {
  // Optional. Service account email
  string email = 1 [(google.api.field_behavior) = OPTIONAL];

  // Optional. Service account scopes
  repeated string scopes = 2 [(google.api.field_behavior) = OPTIONAL];
}

// Description of how a [storage
// resource][google.cloud.hypercomputecluster.v1alpha.StorageResource] should be
// mounted on a VM instance.
message StorageConfig {
  // Required. ID of the storage resource to mount, which must match a key in
  // the cluster's
  // [storage_resources][google.cloud.hypercomputecluster.v1alpha.Cluster.storage_resources].
  string id = 1 [(google.api.field_behavior) = REQUIRED];

  // Required. A directory inside the VM instance's file system where the
  // storage resource should be mounted (e.g., `/mnt/share`).
  string local_mount = 2 [(google.api.field_behavior) = REQUIRED];
}

// Details about a Compute Engine
// [instance](https://cloud.google.com/compute/docs/instances).
message ComputeInstance {
  // Output only. Name of the VM instance, in the format
  // `projects/{project}/zones/{zone}/instances/{instance}`.
  string instance = 1 [
    (google.api.field_behavior) = OUTPUT_ONLY,
    (google.api.resource_reference) = {
      type: "compute.googleapis.com/ComputeInstance"
    }
  ];
}

// Policy controlling how system-initiated maintenance should be conducted on
// the cluster.
message MaintenancePolicy {
  // Optional. Periods during which the system may perform maintenance
  // operations on the cluster that might carry a risk of disruption. The system
  // will make a best-effort attempt to only perform maintenance within these
  // windows. If no windows are specified, the system may perform maintenance at
  // any time. All windows must have same start_time and duration.
  repeated MaintenanceWindow windows = 1
      [(google.api.field_behavior) = OPTIONAL];
}

// A window of time in which maintenance is allowed.
message MaintenanceWindow {
  // Required. Day of the week on which maintenance may be performed.
  google.type.DayOfWeek day = 1 [(google.api.field_behavior) = REQUIRED];

  // Required. Time in UTC during the given day when the system is allowed to
  // start performing maintenance.
  google.type.TimeOfDay start_time = 2 [(google.api.field_behavior) = REQUIRED];

  // Required. Duration of the maintenance window. The system will attempt to
  // complete maintenance within this duration from start_time. Must be between
  // 4 and 24 hours.
  google.protobuf.Duration duration = 3
      [(google.api.field_behavior) = REQUIRED];
}

// Message describing Compute object
message Compute {
  option deprecated = true;

  // Optional. ATM Tags to attach to compute VM instances
  repeated AtmTag atm_tags = 2 [(google.api.field_behavior) = OPTIONAL];
}

// A resource representing a compute node managed by Cluster Director.
message Node {
  option (google.api.resource) = {
    type: "hypercomputecluster.googleapis.com/Node"
    pattern: "projects/{project}/locations/{location}/clusters/{cluster}/nodes/{node}"
    plural: "nodes"
    singular: "node"
  };

  // High-level lifecycle state of the node.
  enum State {
    // Not set.
    STATE_UNSPECIFIED = 0;

    // The node is being provisioned at the infrastructure layer or
    // initialized by the orchestrator.
    CREATING = 1;

    // The node is healthy and operational.
    ACTIVE = 2;

    // The node is transitioning to a stopped or suspended state.
    SUSPENDING = 3;

    // The node is suspended or stopped and not consuming compute resources.
    SUSPENDED = 4;

    // The node is undergoing maintenance or automatic recovery.
    REPAIRING = 5;

    // The node is in an unhealthy or terminal error state.
    FAILED = 6;

    // The node is being deleted.
    DELETING = 7;
  }

  // Identifier. [Relative resource name](https://google.aip.dev/122) of the
  // node, in the format
  // `projects/{project}/locations/{location}/clusters/{cluster}/nodes/{node}`.
  string name = 1 [(google.api.field_behavior) = IDENTIFIER];

  // Output only. Name of the zone in which the node is running, e.g.
  // `us-central1-a`.
  string zone = 2 [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. High-level lifecycle state of the node.
  State state = 3 [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. Human-readable message providing extra information about the
  // current state.
  string state_message = 4 [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. Indicates whether the node is currently executing workloads.
  bool running_jobs = 5 [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. Indicates whether the node is available for new job
  // allocations.
  bool accepting_jobs = 6 [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. Slurm-specific details for the node.
  SlurmNodeDetails slurm_details = 7
      [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. Compute Engine-specific details for the node.
  ComputeEngineNodeDetails compute_engine_details = 8
      [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. Container Engine-specific details for the node.
  ContainerEngineNodeDetails container_engine_details = 9
      [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. Time that the node was originally created.
  google.protobuf.Timestamp create_time = 10
      [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. Time that the node was most recently updated.
  google.protobuf.Timestamp update_time = 11
      [(google.api.field_behavior) = OUTPUT_ONLY];
}

// Slurm-specific details for a Node.
message SlurmNodeDetails {
  // Output only. Raw state flags directly from Slurm.
  repeated string states = 1 [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. User-readable reason for the current state.
  string reason = 2 [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. Slurm partitions this node belongs to.
  repeated string partitions = 3 [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. The ID of the nodeset this node belongs to.
  string nodeset = 4 [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. System comments from Slurm.
  string comment = 5 [(google.api.field_behavior) = OUTPUT_ONLY];
}

// Compute Engine-specific details for a Node.
message ComputeEngineNodeDetails {
  // Output only. [Relative resource name](https://google.aip.dev/122) of the VM
  // instance, in the format
  // `projects/{project}/zones/{zone}/instances/{instance}`.
  string instance = 1 [
    (google.api.field_behavior) = OUTPUT_ONLY,
    (google.api.resource_reference) = {
      type: "compute.googleapis.com/ComputeInstance"
    }
  ];

  // Output only. Name of the Compute Engine [machine
  // type](https://cloud.google.com/compute/docs/machine-resource) to use, e.g.
  // `n2-standard-2`.
  string machine_type = 2 [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. The Compute Engine VM [instance lifecycle
  // state](https://cloud.google.com/compute/docs/instances/instance-lifecycle).
  string state = 3 [(google.api.field_behavior) = OUTPUT_ONLY];
}

// Container Engine-specific details for a Node.
message ContainerEngineNodeDetails {
  // Output only. [Relative resource name](https://google.aip.dev/122) of the
  // pod, in the format
  // `projects/{project}/locations/{location}/clusters/{cluster}/k8s/namespaces/{namespace}/pods/{pod}`.
  string pod = 1 [
    (google.api.field_behavior) = OUTPUT_ONLY,
    (google.api.resource_reference) = { type: "container.googleapis.com/Pod" }
  ];

  // Output only. The Container Engine [pod lifecycle
  // state](https://kubernetes.io/docs/Concepts/Workloads/Pods/Pod-lifecycle/).
  string state = 2 [(google.api.field_behavior) = OUTPUT_ONLY];
}
