// Copyright 2025 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.capacityplanner.v1beta;

import "google/api/annotations.proto";
import "google/api/client.proto";
import "google/api/field_behavior.proto";
import "google/api/resource.proto";
import "google/cloud/capacityplanner/v1beta/allocation.proto";
import "google/cloud/capacityplanner/v1beta/future_reservation.proto";
import "google/longrunning/operations.proto";
import "google/protobuf/timestamp.proto";
import "google/type/date.proto";

option csharp_namespace = "Google.Cloud.CapacityPlanner.V1Beta";
option go_package = "cloud.google.com/go/capacityplanner/apiv1beta/capacityplannerpb;capacityplannerpb";
option java_multiple_files = true;
option java_outer_classname = "UsageServiceProto";
option java_package = "com.google.cloud.capacityplanner.v1beta";
option php_namespace = "Google\\Cloud\\CapacityPlanner\\V1beta";
option ruby_package = "Google::Cloud::CapacityPlanner::V1beta";

// Provides access to historical and forecasted usage data.
service UsageService {
  option (google.api.default_host) = "capacityplanner.googleapis.com";
  option (google.api.oauth_scopes) =
      "https://www.googleapis.com/auth/cloud-platform,"
      "https://www.googleapis.com/auth/devstorage.full_control";

  // Returns a list of the usage histories that are in the parent parameter
  // and match your specified filters.
  rpc QueryUsageHistories(QueryUsageHistoriesRequest)
      returns (QueryUsageHistoriesResponse) {
    option (google.api.http) = {
      post: "/v1beta/{parent=projects/*/locations/*}/usageHistories:query"
      body: "*"
      additional_bindings {
        post: "/v1beta/{parent=organizations/*/locations/*}/usageHistories:query"
        body: "*"
      }
      additional_bindings {
        post: "/v1beta/{parent=folders/*/locations/*}/usageHistories:query"
        body: "*"
      }
    };
  }

  // Returns a list of the forecasts that are in the parent parameter
  // and match your specified filters.
  rpc QueryForecasts(QueryForecastsRequest) returns (QueryForecastsResponse) {
    option (google.api.http) = {
      post: "/v1beta/{parent=projects/*/locations/*}/forecasts:query"
      body: "*"
      additional_bindings {
        post: "/v1beta/{parent=organizations/*/locations/*}/forecasts:query"
        body: "*"
      }
      additional_bindings {
        post: "/v1beta/{parent=folders/*/locations/*}/forecasts:query"
        body: "*"
      }
    };
  }

  // Returns a list of the reservations that are in the parent parameter
  // and match your specified filters.
  rpc QueryReservations(QueryReservationsRequest)
      returns (QueryReservationsResponse) {
    option (google.api.http) = {
      get: "/v1beta/{parent=projects/*/locations/*}/reservations:query"
      additional_bindings {
        get: "/v1beta/{parent=organizations/*/locations/*}/reservations:query"
      }
      additional_bindings {
        get: "/v1beta/{parent=folders/*/locations/*}/reservations:query"
      }
    };
    option (google.api.method_signature) = "parent";
  }

  // Exports historical usage data requested by user into either an existing
  // Cloud Storage bucket or a BigQuery table.
  rpc ExportUsageHistories(ExportUsageHistoriesRequest)
      returns (google.longrunning.Operation) {
    option (google.api.http) = {
      post: "/v1beta/{parent=projects/*/locations/*}/usageHistories:export"
      body: "*"
      additional_bindings {
        post: "/v1beta/{parent=organizations/*/locations/*}/usageHistories:export"
        body: "*"
      }
      additional_bindings {
        post: "/v1beta/{parent=folders/*/locations/*}/usageHistories:export"
        body: "*"
      }
    };
    option (google.longrunning.operation_info) = {
      response_type: "ExportUsageHistoriesResponse"
      metadata_type: "OperationMetadata"
    };
  }

  // Exports forecasted usage data requested by user into either an existing
  // Cloud Storage bucket or a BigQuery table.
  rpc ExportForecasts(ExportForecastsRequest)
      returns (google.longrunning.Operation) {
    option (google.api.http) = {
      post: "/v1beta/{parent=projects/*/locations/*}/forecasts:export"
      body: "*"
      additional_bindings {
        post: "/v1beta/{parent=organizations/*/locations/*}/forecasts:export"
        body: "*"
      }
      additional_bindings {
        post: "/v1beta/{parent=folders/*/locations/*}/forecasts:export"
        body: "*"
      }
    };
    option (google.longrunning.operation_info) = {
      response_type: "ExportForecastsResponse"
      metadata_type: "OperationMetadata"
    };
  }

  // Exports reservations usage data requested by user into either an existing
  // Cloud Storage bucket or a new/existing BigQuery table.
  rpc ExportReservationsUsage(ExportReservationsUsageRequest)
      returns (google.longrunning.Operation) {
    option (google.api.http) = {
      post: "/v1beta/{parent=projects/*/locations/*}/reservationsUsage:export"
      body: "*"
      additional_bindings {
        post: "/v1beta/{parent=organizations/*/locations/*}/reservationsUsage:export"
        body: "*"
      }
      additional_bindings {
        post: "/v1beta/{parent=folders/*/locations/*}/reservationsUsage:export"
        body: "*"
      }
    };
    option (google.longrunning.operation_info) = {
      response_type: "ExportReservationsUsageResponse"
      metadata_type: "OperationMetadata"
    };
  }
}

// The `QueryUsageHistories` request.
// Next : 16
message QueryUsageHistoriesRequest {
  // Required. The compute engine resource and location for the time series
  // values to return. The format is:
  //
  //     projects/{project}/locations/{location} or
  //     organizations/{organization}/locations/{location} or
  //     folders/{folder}/locations/{location}
  string parent = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      type: "locations.googleapis.com/Location"
    }
  ];

  // Optional. The location level of the reservations usage timeseries.
  TimeSeries.LocationType location_level = 11
      [(google.api.field_behavior) = OPTIONAL];

  // Optional. The is_spot flag is used to fetch the usage data for preemptible
  // Resources.
  bool is_spot = 14 [(google.api.field_behavior) = OPTIONAL];

  // The machine family for the `UsageHistory` values to return. Possible values
  // include "n1", and "n2d". See
  // https://cloud.google.com/compute/docs/machine-types for more examples.
  // Empty machine_family will return results matching all machine families.
  string machine_family = 2;

  // Optional. The machine shape for the `UsageHistory` values to return.
  MachineShape machine_shape = 13 [(google.api.field_behavior) = OPTIONAL];

  // Optional. The disk_type for the `UsageHistory` values to return request
  // with persistent-disk cloud_resource_type. Empty disk_type will return
  // results matching all disk types.
  string disk_type = 7 [(google.api.field_behavior) = OPTIONAL];

  // Optional. Whether the persistent disk is in confidential mode.
  bool confidential_mode = 15 [(google.api.field_behavior) = OPTIONAL];

  // Optional. The GPU type for the `UsageHistory` values to return. Sample
  // values are "nvidia-tesla-t4", and "nvidia-tesla-a100". See
  // https://cloud.google.com/compute/docs/gpus for a list. Empty gpu_type
  // will return results matching all GPUs.
  string gpu_type = 8 [(google.api.field_behavior) = OPTIONAL];

  // Optional. The TPU type for the `UsageHistory` values to return. Empty
  // tpu_type will return results matching all TPUs.
  string tpu_type = 12 [(google.api.field_behavior) = OPTIONAL];

  // The resource for the `UsageHistory` values to return. Possible values
  // include "gce-vcpus", "gce-ram", "gce-local-ssd", "gce-persistent-disk",
  // "gce-gpu" and "gce-tpu".
  // Empty cloud_resource_type will return results matching all resources.
  string cloud_resource_type = 3;

  // The method that should be used to convert sampled usage data to daily
  // usage values.
  // AGGREGATION_METHOD_UNSPECIFIED will return results matching all the
  // aggregation methods.
  UsageHistory.AggregationMethod usage_aggregation_method = 4;

  // Optional. The start date of reservations usage.
  google.type.Date start_date = 9 [(google.api.field_behavior) = OPTIONAL];

  // Optional. The end date of reservations usage.
  google.type.Date end_date = 10 [(google.api.field_behavior) = OPTIONAL];
}

// The `QueryUsageHistories` response.
message QueryUsageHistoriesResponse {
  // The usage histories that match the request.
  repeated UsageHistory usage_histories = 1;
}

// The `QueryForecasts` request.
// Next : 14
message QueryForecastsRequest {
  // Required. The compute engine resource and location for the time series
  // values to return. The format is:
  //
  // projects/{project}/locations/{location} or
  // organizations/{organization}/locations/{location} or
  // folders/{folder}/locations/{location}
  string parent = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      type: "locations.googleapis.com/Location"
    }
  ];

  // The machine family to use to select the `Forecast` values to return.
  // Possible values include "n1", and "n2d".
  // Empty machine_family will return results matching all machine families.
  string machine_family = 2;

  // Optional. The machine shape for the time series values to return.
  MachineShape machine_shape = 12 [(google.api.field_behavior) = OPTIONAL];

  // Optional. The disk_type for the `Forecast` values to return with request
  // persistent-disk cloud_resource_type.
  // Empty disk_type will return results matching all disk types.
  string disk_type = 9 [(google.api.field_behavior) = OPTIONAL];

  // Optional. Whether the persistent disk is in confidential mode.
  bool confidential_mode = 13 [(google.api.field_behavior) = OPTIONAL];

  // Optional. The GPU type for the `Forecast` values to return. Sample values
  // are "nvidia-tesla-t4", and "nvidia-tesla-a100". See
  // https://cloud.google.com/compute/docs/gpus for a list. Empty gpu_type
  // will return results matching all GPUs.
  string gpu_type = 10 [(google.api.field_behavior) = OPTIONAL];

  // Optional. The TPU type for the `Forecast` values to return. Empty tpu_type
  // will return results matching all TPUs.
  string tpu_type = 11 [(google.api.field_behavior) = OPTIONAL];

  // The resource for the `Forecast` values to return. Possible values include
  // "gce-vcpus", "gce-ram", "gce-local-ssd", "gce-persistent-disk", "gce-gpu"
  // and "gce-tpu".
  // Empty cloud_resource_type will return results matching all resources.
  string cloud_resource_type = 3;

  // The type of forecast to use to select the `Forecast` values to return.
  // FORECAST_TYPE_UNSPECIFIED will return results matching all the forecast
  // types.
  Forecast.ForecastType forecast_type = 4;

  // The prediction interval to use to select the `Forecast` values to return.
  // PREDICTION_INTERVAL_UNSPECIFIED will return results matching all prediction
  // intervals.
  Forecast.PredictionInterval prediction_interval = 5;

  // Aggregation Method of the historical usage for which the forecast is
  // generated
  UsageHistory.AggregationMethod aggregation_method = 8;
}

// The `QueryForecasts` response.
message QueryForecastsResponse {
  // The forecasts that match the request.
  repeated Forecast forecasts = 1;
}

// The `QueryReservations` request.
message QueryReservationsRequest {
  // Type of the reservation
  enum ReservationType {
    // No reservation type specified.
    RESERVATION_TYPE_UNSPECIFIED = 0;

    // Allocation refers to realized reservation either auto created or created
    // by the users on demand.
    RESERVATION_TYPE_ALLOCATION = 1;

    // Future Reservation requests created by users.
    RESERVATION_TYPE_FUTURE_RESERVATION = 2;

    // All reservations.
    RESERVATION_TYPE_ALL = 3;
  }

  // Possible scope in which the reservation can be shared.
  enum ShareType {
    // No share type specified.
    SHARE_TYPE_UNSPECIFIED = 0;

    // Default value, for which reservation is open to only owner project.
    SHARE_TYPE_LOCAL = 1;

    // Shared-reservation is open to specific projects.
    SHARE_TYPE_SPECIFIC_PROJECTS = 2;
  }

  // Reservation ownership status to provide distinction for Capacity Planning.
  enum OwnershipType {
    // No ownership status specified.
    OWNERSHIP_TYPE_UNSPECIFIED = 0;

    // For the reservations owned within selected Google Cloud Platform Resource
    // Container (project/folder/organization).
    OWNERSHIP_TYPE_OWNED = 1;

    // For the reservations consumable within selected Google Cloud Platform
    // Resource Container (project/folder/organization), but not owned by them.
    OWNERSHIP_TYPE_SHARED_BY_OTHERS = 2;
  }

  // The form in which data of reservations should be returned.
  // In case of AGGREGATED, timeseries for selected reservations is returned. If
  // unspecified, all levels are included.
  enum ReservationDataLevel {
    // No reservation data level specified.
    RESERVATION_DATA_LEVEL_UNSPECIFIED = 0;

    // aggregated reservations data in a timeseries or aggregation over
    // timeseries.
    RESERVATION_DATA_LEVEL_AGGREGATED = 1;

    // per reservation detail which is equivalent of Arcus Future Reservation or
    // Allocation with only limited fields which are useful for Capacity
    // Planning.
    RESERVATION_DATA_LEVEL_PER_RESERVATION = 2;
  }

  // Required. The compute engine resource and location for the time series
  // values to return. The format is:
  //
  // projects/{project}/locations/{location} or
  // organizations/{organization}/locations/{location} or
  // folders/{folder}/locations/{location}
  string parent = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      type: "locations.googleapis.com/Location"
    }
  ];

  // Optional. The location level of the reservations usage timeseries.
  TimeSeries.LocationType location_level = 16
      [(google.api.field_behavior) = OPTIONAL];

  // Optional. The machine family to use to select the aggregate reserved values
  // to return. Possible values include "n1", and "n2d" etc. Empty
  // machine_family will return results matching all machine families.
  string machine_family = 2 [(google.api.field_behavior) = OPTIONAL];

  // Optional. The machine_shape as a filter to select matching reservations.
  MachineShape machine_shape = 11 [(google.api.field_behavior) = OPTIONAL];

  // Optional. The GPU type for the reserved values to return. Sample values
  // are "nvidia-tesla-t4", and "nvidia-tesla-a100". See
  // https://cloud.google.com/compute/docs/gpus for a list. Empty gpu_type
  // will return results matching all GPUs.
  string gpu_type = 3 [(google.api.field_behavior) = OPTIONAL];

  // Optional. The resource for the reserved values to return. Possible values
  // include "gce-vcpus", "gce-ram", "gce-local-ssd", "gce-gpu" and "gce-vm".
  string cloud_resource_type = 4 [(google.api.field_behavior) = OPTIONAL];

  // Optional. The Reservation type for example, future reservation request and
  // allocation. If unspecified, all types are
  // included.
  ReservationType reservation_type = 5 [(google.api.field_behavior) = OPTIONAL];

  // Optional. Types of share settings to filter reservations in response. If
  // unspecified, all types are included.
  ShareType share_type = 6 [(google.api.field_behavior) = OPTIONAL];

  // Optional. Types of ownerships to filter reservations based on.
  // In case of OWNED, it filters reservations which are owned by selected
  // parent project/folder/organization. If unspecified, all types are
  // included.
  OwnershipType ownership_type = 7 [(google.api.field_behavior) = OPTIONAL];

  // Optional. Reservations output data format.
  ReservationDataLevel reservation_data_level = 8
      [(google.api.field_behavior) = OPTIONAL];

  // Optional. Whether to include pending for approval reservations in the
  // response. This field is only applicable for future reservations.
  bool include_unapproved_reservations = 12
      [(google.api.field_behavior) = OPTIONAL];

  // Optional. Aggregation Method of the historical reservation usage
  UsageHistory.AggregationMethod aggregation_method = 13
      [(google.api.field_behavior) = OPTIONAL];

  // Optional. The start date of reservations usage.
  google.type.Date start_date = 14 [(google.api.field_behavior) = OPTIONAL];

  // Optional. The end date of reservations usage.
  google.type.Date end_date = 15 [(google.api.field_behavior) = OPTIONAL];
}

// The `QueryReservations` response.
message QueryReservationsResponse {
  // The reservations data that match the request.
  repeated ReservationData reservations = 1;
}

// A single data point in a time series.
message Point {
  // The time which the data point applies.
  google.protobuf.Timestamp event_time = 1;

  // The value of the data point.
  double value = 2;
}

// A collection of data points that describes the predicted time-varying values
// of a resource.
message Forecast {
  option (google.api.resource) = {
    type: "capacityplanner.googleapis.com/Forecast"
    pattern: "projects/{project}/locations/{location}/forecasts/{forecast}"
    pattern: "organizations/{organization}/locations/{location}/forecasts/{forecast}"
    pattern: "folders/{folder}/locations/{location}/forecasts/{forecast}"
    plural: "forecasts"
    singular: "forecast"
  };

  // The type of the forecast. This describes the method that was used to
  // produce future time series values from historical time series values.
  enum ForecastType {
    // No forecast type is specified.
    FORECAST_TYPE_UNSPECIFIED = 0;

    // Statistical forecast.
    STATISTICAL = 1;

    // Statistical forecast that attempts to predict the seasonal affects of
    // Black Friday and Cyber Monday.
    STATISTICAL_WITH_BFCM = 2;

    // Yearly Seasonality model provides generic seasonality beyond BFCM.
    YEARLY_SEASONALITY = 3;
  }

  // The bounds of the forecast time series.
  enum Bounds {
    // No bounds is specified.
    BOUNDS_UNSPECIFIED = 0;

    // The time series represents the upper bound of the forecast.
    LOWER_BOUND = 1;

    // The time series represents the median expected forecast value.
    MEDIAN = 2;

    // The time series represents the lower bound of the forecast.
    UPPER_BOUND = 3;
  }

  // The prediction interval represented by a forecast.
  enum PredictionInterval {
    // No prediction interval is specified.
    PREDICTION_INTERVAL_UNSPECIFIED = 0;

    // This represents a prediction interval that has 90% confidence. For
    // example, for a symmetric prediction interval, a `PredictionInterval`
    // of `PREDICTION_INTERVAL_90` means that the `UPPER_BOUND` will represent
    // the 95th precentile.
    PREDICTION_INTERVAL_90 = 1;

    // This represents a prediction interval that has 50% confidence. For
    // example, for a symmetric prediction interval, a `PredictionInterval`
    // of `PREDICTION_INTERVAL_50` means that the `UPPER_BOUND` will represent
    // the 75th precentile.
    PREDICTION_INTERVAL_50 = 2;
  }

  // The resource name of the connection in the form of:
  // `projects/{project_id}/locations/{location_id}/forecasts/{forecast_id}` or
  // `organizations/{organization_id}/locations/{location_id}/forecasts/{forecast_id}`
  // or `folders/{folder_id}/locations/{location_id}/forecasts/{forecast_id}`
  string name = 1;

  // The collection of data points that represent the predicted values. Note
  // that some of these values may be in the past (if, for example, the forecast
  // was created in the past and predicted values for the present day).
  TimeSeries time_series = 2;

  // The type of forecast.
  ForecastType forecast_type = 3;

  // The bounds represented by this forecast time series.
  Bounds bounds = 4;

  // The prediction interval represented by the time series.
  PredictionInterval prediction_interval = 5;

  // Aggregation Method of the historical usage for which the forecast is
  // generated
  UsageHistory.AggregationMethod aggregation_method = 6;
}

// A collection of data points that describes the historical time-varying values
// of a resource.
message UsageHistory {
  // Methods for converting sampled data to time series values.
  enum AggregationMethod {
    // No aggregation method is specified.
    AGGREGATION_METHOD_UNSPECIFIED = 0;

    MEDIAN = 1;

    // Time series values represent the 99th percentile of the sampled values.
    PEAK = 2;

    // Time series values represent the 50th(median) percentile of the sampled
    // values.
    P50 = 3;

    // Time series values represent the 75th percentile of the sampled values.
    P75 = 4;

    // Time series values represent the 99th percentile of the sampled values.
    P99 = 5;
  }

  // The collection of data points that represent the historical values.
  TimeSeries time_series = 1;

  // Method used to convert sampled usage data to time series values.
  AggregationMethod aggregation_method = 2;
}

// A collection of data points that describes the time-varying values of a
// resource. A time series is identified by its ID.
// Next : 13
message TimeSeries {
  // The type of location that the time series is summarizing.
  enum LocationType {
    // No location type was specified.
    LOCATION_TYPE_UNSPECIFIED = 0;

    // Time series values represent usage aggregated at the region level.
    REGIONAL = 1;

    // Time series values represent usage aggregated at the zone level.
    ZONAL = 2;
  }

  // Required. The type of location that the time series is summarizing.
  LocationType location_type = 1 [(google.api.field_behavior) = REQUIRED];

  // Optional. The location of the usage data in time series.
  string location = 9 [(google.api.field_behavior) = OPTIONAL];

  // Optional. The location of the usage data in time series.
  bool is_spot = 11 [(google.api.field_behavior) = OPTIONAL];

  // The machine family for the time series values to return. Possible values
  // include "n1" and "n2d".
  string machine_family = 2;

  // The disk type for the time series values to return.
  string disk_type = 6;

  // Optional. The confidential mode for disk.
  bool confidential_mode = 12 [(google.api.field_behavior) = OPTIONAL];

  // The GPU type of the time series.
  string gpu_type = 7;

  // The TPU type of the time series.
  string tpu_type = 10;

  // The machine shape of the time series.
  MachineShape machine_shape = 8;

  // The resource for the time series values to return. Possible values include
  // "gce-vcpus", "gce-ram", "gce-local-ssd", "gce-persistent-disk", "gce-gpu",
  // "gce-tpu" and "gce-vm".
  string cloud_resource_type = 3;

  // The data points of this time series. When listing time series, points are
  // returned in chronological order.
  repeated Point points = 4;

  // The units in which the values are reported.
  string unit = 5;
}

// Response entity for reservations data.
message ReservationData {
  option (google.api.resource) = {
    type: "capacityplanner.googleapis.com/Reservation"
    pattern: "projects/{project}/locations/{location}/reservations/{reservation}"
    pattern: "organizations/{organization}/locations/{location}/reservations/{reservation}"
    pattern: "folders/{folder}/locations/{location}/reservations/{reservation}"
    plural: "reservations"
    singular: "reservation"
  };

  // Identifier. The resource name of the connection in the form of:
  // `projects/{project_id}/locations/{location_id}/reservations/{reservation_id}`
  // or
  // `organizations/{organization_id}/locations/{location_id}/reservations/{reservation_id}`
  // or
  // `folders/{folder_id}/locations/{location_id}/reservations/{reservation_id}`
  string name = 1 [(google.api.field_behavior) = IDENTIFIER];

  // The collection of data points that represent the aggregated reserved value
  // for reservations filtered by the criteria.
  TimeSeries time_series = 2;

  // The collection of data points that represent the aggregated used value for
  // reservations filtered by the criteria.
  TimeSeries used_reservation_values = 5;

  // Future reservations filtered by the criteria.
  repeated FutureReservation future_reservations = 3;

  // Allocations filtered by the criteria.
  repeated Allocation allocations = 4;
}

// Machine shape details
// Next : 13
message MachineShape {
  // Optional. The VM family.
  string machine_family = 1 [(google.api.field_behavior) = OPTIONAL];

  // Optional. The characteristics of the sampled VM expressed as a string.
  string machine_type = 2 [(google.api.field_behavior) = OPTIONAL];

  // Optional. The customer visible string representing the type of VM.
  string machine_shape = 3 [(google.api.field_behavior) = OPTIONAL];

  // Optional. Number of CPU cores per VM.
  double cpu_cores = 4 [(google.api.field_behavior) = OPTIONAL];

  // Optional. The type of GPU with the VM.
  string gpu_type = 5 [(google.api.field_behavior) = OPTIONAL];

  // Optional. The GPU name recognized by Compute Engine APIs.
  string gpu_compute_type = 10 [(google.api.field_behavior) = OPTIONAL];

  // Optional. The number of GPU cores per VM.
  int64 gpu_cores = 6 [(google.api.field_behavior) = OPTIONAL];

  // Optional. The number of local SSD partitions per VM.
  int64 local_ssd_partitions = 7 [(google.api.field_behavior) = OPTIONAL];

  // Optional. Total amount of local SSD storage.
  double local_ssd_gb = 8 [(google.api.field_behavior) = OPTIONAL];

  // Optional. Total amount of memory with the VM.
  double memory_gb = 9 [(google.api.field_behavior) = OPTIONAL];

  // Optional. The local SSD interface used such as nvme or scsi
  string local_ssd_interface = 11 [(google.api.field_behavior) = OPTIONAL];

  // Optional. The Min-cpu platform used such as icelake
  string min_cpu_platform = 12 [(google.api.field_behavior) = OPTIONAL];
}

// The `ExportUsageHistories` request
// Next : 12
message ExportUsageHistoriesRequest {
  // Required. The compute engine resource and location for the time series
  // values to return. The format is:
  //    projects/{project}/locations/{location} or
  //    organizations/{organization}/locations/{location} or
  //    folders/{folder}/locations/{location}
  string parent = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      type: "locations.googleapis.com/Location"
    }
  ];

  // Optional. Set true to export usage for spot resources.
  bool is_spot = 11 [(google.api.field_behavior) = OPTIONAL];

  // Optional. The machine family for the `UsageHistory` values to return.
  // Possible values include "n1", and "n2d". See
  // https://cloud.google.com/compute/docs/machine-types for more examples.
  string machine_family = 2 [(google.api.field_behavior) = OPTIONAL];

  // Optional. The machine shape for the time series values to export.
  MachineShape machine_shape = 13 [(google.api.field_behavior) = OPTIONAL];

  // Optional. The disk_type for the `UsageHistory` values to return request
  // with persistent-disk resource_type. Possible values include "pd-ssd",
  // "pd-standard", "pd-balanced", and "pd-extreme".
  string disk_type = 3 [(google.api.field_behavior) = OPTIONAL];

  // Optional. The GPU type for the `UsageHistory` values to return. Sample
  // values are "nvidia-tesla-t4", and "nvidia-tesla-a100". See
  // https://cloud.google.com/compute/docs/gpus for a list. Empty gpu_type
  // will return results matching all GPUs.
  string gpu_type = 9 [(google.api.field_behavior) = OPTIONAL];

  // Optional. The TPU type for the `UsageHistory` values to return. Empty
  // tpu_type will return results matching all TPUs.
  string tpu_type = 10 [(google.api.field_behavior) = OPTIONAL];

  // Required. The resource for the `UsageHistory` values to return. Possible
  // values include "gce-vcpus", "gce-ram", "gce-local-ssd",
  // "gce-persistent-disk", "gce-gpu" and "gce-tpu".
  string resource_type = 4 [(google.api.field_behavior) = REQUIRED];

  // Optional. The method that should be used to convert sampled usage data to
  // daily usage values. AGGREGATION_METHOD_UNSPECIFIED will return results
  // matching all the aggregation methods.
  UsageHistory.AggregationMethod usage_aggregation_method = 5
      [(google.api.field_behavior) = OPTIONAL];

  // Optional. The start date of usage.
  google.type.Date start_date = 6 [(google.api.field_behavior) = OPTIONAL];

  // Optional. The end date of usage.
  google.type.Date end_date = 7 [(google.api.field_behavior) = OPTIONAL];

  // Required. Output configuration indicating where the results will be output
  // to.
  OutputConfig output_config = 8 [(google.api.field_behavior) = REQUIRED];
}

// The `ExportForecasts` request
// Next : 13
message ExportForecastsRequest {
  // Required. The compute engine resource and location for the time series
  // values to return. The format is:
  //    projects/{project}/locations/{location} or
  //    organizations/{organization}/locations/{location} or
  //    folders/{folder}/locations/{location}
  string parent = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      type: "locations.googleapis.com/Location"
    }
  ];

  // Optional. The machine family to use to select the `Forecast` values to
  // return. Possible values include "n1", and "n2d".
  string machine_family = 2 [(google.api.field_behavior) = OPTIONAL];

  // Optional. The machine shape for the time series values to export.
  MachineShape machine_shape = 12 [(google.api.field_behavior) = OPTIONAL];

  // Optional. The disk_type for the `Forecast` values to return with request
  // persistent-disk resource_type.
  string disk_type = 3 [(google.api.field_behavior) = OPTIONAL];

  // Optional. The GPU type for the `Forecast` values to return. Sample values
  // are "nvidia-tesla-t4", and "nvidia-tesla-a100". See
  // https://cloud.google.com/compute/docs/gpus for a list. Empty gpu_type
  // will return results matching all GPUs.
  string gpu_type = 10 [(google.api.field_behavior) = OPTIONAL];

  // Optional. The TPU type for the `Forecast` values to return. Empty tpu_type
  // will return results matching all TPUs.
  string tpu_type = 11 [(google.api.field_behavior) = OPTIONAL];

  // Required. The resource for the `Forecast` values to return. Possible values
  // include "gce-vcpus", "gce-ram", "gce-local-ssd", "gce-persistent-disk",
  // "gce-gpu" and "gce-tpu".
  string resource_type = 4 [(google.api.field_behavior) = REQUIRED];

  // Optional. The prediction interval to use to select the `Forecast` values to
  // return. PREDICTION_INTERVAL_UNSPECIFIED will return results matching all
  // prediction intervals.
  Forecast.PredictionInterval prediction_interval = 5
      [(google.api.field_behavior) = OPTIONAL];

  // Optional. Aggregation Method of the historical usage for which the forecast
  // is generated.
  UsageHistory.AggregationMethod aggregation_method = 6
      [(google.api.field_behavior) = OPTIONAL];

  // Optional. The start date of forecasts.
  google.type.Date start_date = 7 [(google.api.field_behavior) = OPTIONAL];

  // Optional. The end date of forecasts.
  google.type.Date end_date = 8 [(google.api.field_behavior) = OPTIONAL];

  // Required. Output configuration indicating where the results will be output
  // to.
  OutputConfig output_config = 9 [(google.api.field_behavior) = REQUIRED];
}

// The `ExportReservationsUsage` request
message ExportReservationsUsageRequest {
  // Possible scope in which the reservation can be shared.
  enum ShareType {
    // No share type specified.
    SHARE_TYPE_UNSPECIFIED = 0;

    // Default value, for which reservation is open to only owner project.
    SHARE_TYPE_LOCAL = 1;

    // Shared-reservation is open to specific projects.
    SHARE_TYPE_SPECIFIC_PROJECTS = 2;
  }

  // resource to query reservations and usage by.
  oneof resource {
    // Optional. The machine family to query reservations and usage by. For
    // example: n1, n2d.
    string machine_family = 2 [(google.api.field_behavior) = OPTIONAL];

    // Optional. The machine_shape as a filter to select matching reservations
    // and its usage.
    MachineShape machine_shape = 3 [(google.api.field_behavior) = OPTIONAL];

    // Optional. The GPU type to query reservations and usage  by. For example:
    // NVIDIA T4.
    string gpu_type = 4 [(google.api.field_behavior) = OPTIONAL];
  }

  // Required. The compute engine resource and location of the
  // reservationsusage. The format is:
  //    projects/{project}/locations/{location} or
  //    organizations/{organization}/locations/{location} or
  //    folders/{folder}/locations/{location}
  string parent = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      type: "locations.googleapis.com/Location"
    }
  ];

  // Optional. The location level of the reservations usage timeseries.
  TimeSeries.LocationType location_level = 11
      [(google.api.field_behavior) = OPTIONAL];

  // Required. The resource for the `ReservationsUsage` values to return.
  // Possible values include "gce-vcpus", "gce-ram", "gce-local-ssd", and
  // "gce-gpu".
  string cloud_resource_type = 5 [(google.api.field_behavior) = REQUIRED];

  // Required. The method that should be used to convert sampled reservations
  // data to daily usage values.
  UsageHistory.AggregationMethod usage_aggregation_method = 6
      [(google.api.field_behavior) = REQUIRED];

  // Optional. Type of share settings to filter reservations in response. If
  // unspecified, all types are included.
  ShareType share_type = 7 [(google.api.field_behavior) = OPTIONAL];

  // Optional. The start date of reservations usage.
  google.type.Date start_date = 8 [(google.api.field_behavior) = OPTIONAL];

  // Optional. The end date of reservations usage.
  google.type.Date end_date = 9 [(google.api.field_behavior) = OPTIONAL];

  // Required. Output configuration indicating where the results will be output
  // to.
  OutputConfig output_config = 10 [(google.api.field_behavior) = REQUIRED];
}

// Output configuration for export destination.
message OutputConfig {
  // Export destination.
  oneof destination {
    // Destination on Cloud Storage.
    GcsDestination gcs_destination = 1;

    // Destination on BigQuery.
    BigQueryDestination bigquery_destination = 2;
  }
}

// A Cloud Storage location.
message GcsDestination {
  // Optional. The path to the file in Cloud Storage where the export will be
  // stored. The URI is in the form `gs://bucketName/fileName`. If the file
  // already exists, the request succeeds, but the operation fails.
  string uri = 1 [(google.api.field_behavior) = OPTIONAL];

  // Required. The bucket name to which the export will be stored.
  string bucket = 3 [(google.api.field_behavior) = REQUIRED];

  // Required. The object name to which the export will be stored.
  string object = 4 [(google.api.field_behavior) = REQUIRED];

  // Optional. Flag to indicate overwrite in case file already exists.
  bool force = 2 [(google.api.field_behavior) = OPTIONAL];
}

// A BigQuery destination for exporting assets to.
message BigQueryDestination {
  // This enum determines the partition key column for the BigQuery tables.
  // Partitioning can improve query performance and reduce query cost by
  // filtering partitions. Refer to
  // https://cloud.google.com/bigquery/docs/partitioned-tables for details.
  enum PartitionKey {
    // Unspecified partition key. Tables won't be partitioned using this
    // option.
    PARTITION_KEY_UNSPECIFIED = 0;

    // The time when the request is received. If specified as partition key,
    // the result table(s) is partitioned by the RequestTime column, an
    // additional timestamp column representing when the request was received.
    REQUEST_TIME = 1;
  }

  // Specifies the action that occurs if the destination table or partition
  // already exists. By default, the data will be appended to the existing
  // table.
  enum WriteDisposition {
    // Unspecified write disposition.
    WRITE_DISPOSITION_UNSPECIFIED = 0;

    // If the table or partition already exists, BigQuery appends the data to
    // the table or the latest partition.
    WRITE_APPEND = 1;

    // If the table or partition already exists, BigQuery overwrites the entire
    // table or all the partitions data.
    WRITE_TRUNCATE = 2;

    // If the table already exists and contains data, an error is returned.
    WRITE_EMPTY = 3;
  }

  // Specifies the action that occurs if the destination table does not exist.
  // By default, a new table will be created.
  enum CreateDisposition {
    // Unspecified create disposition.
    CREATE_DISPOSITION_UNSPECIFIED = 0;

    // If the table does not exist, BigQuery creates the table.
    CREATE_IF_NEEDED = 1;

    // If the table does not exist, an error will be returned.
    CREATE_NEVER = 2;
  }

  // Required. The BigQuery dataset in format
  // "projects/{projectId}/datasets/{datasetId}", to which the snapshot result
  // should be exported. If this dataset does not exist, the export call returns
  // an INVALID_ARGUMENT error.
  string dataset = 1 [(google.api.field_behavior) = REQUIRED];

  // Required. The BigQuery table to which the snapshot result should be
  // written.
  string table = 2 [(google.api.field_behavior) = REQUIRED];

  // Optional. The partition key for BigQuery partitioned table.
  PartitionKey partition_key = 3 [(google.api.field_behavior) = OPTIONAL];

  // Optional. Specifies the action that occurs if the destination table or
  // partition already exists.
  WriteDisposition write_disposition = 4
      [(google.api.field_behavior) = OPTIONAL];

  // Optional. Specifies the action that occurs if the destination table does
  // not exist
  CreateDisposition create_disposition = 5
      [(google.api.field_behavior) = OPTIONAL];

  // Optional. Specifies the Cloud Storage location.
  // Users can choose to provide a location for Cloud Storage bucket to store
  // the exported data. (as it is possible that some locations are restricted
  // via org policy for that project) Temporary Cloud Storage bucket creation is
  // an interim step for BigQuery upload. If no value is provided, the default
  // location used will be 'US'.
  string gcs_location = 6 [(google.api.field_behavior) = OPTIONAL];
}

// Represents the metadata of a long-running operation.
message OperationMetadata {
  // Output only. The time the operation was created.
  google.protobuf.Timestamp create_time = 1
      [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. The time the operation finished running.
  google.protobuf.Timestamp end_time = 2
      [(google.api.field_behavior) = OUTPUT_ONLY];
}

// A response message for [UsageService.ExportUsageHistories].
message ExportUsageHistoriesResponse {
  // The response message for the usage history export. In case of bigquery,
  // it will also contain job id.
  string response = 1;
}

// A response message for [UsageService.ExportForecasts].
message ExportForecastsResponse {
  // The response message for the forecast export. In case of bigquery,
  // it will also contain job id.
  string response = 1;
}

// A response message for [UsageService.ExportReservationsUsage].
message ExportReservationsUsageResponse {
  // The response message for the reservations usage export. In case of
  // bigquery, it will also contain job id.
  string response = 1;
}
