# Capacity Planner V1BETA API - Class Google::Cloud::CapacityPlanner::V1beta::UsageService::Client (v0.5.0)

0.5.0 (latest) 0.4.0 0.3.1 0.2.0 0.1.0 Reference documentation and code samples for the Capacity Planner V1BETA API class Google::Cloud::CapacityPlanner::V1beta::UsageService::Client.

Client for the UsageService service.


<br />

Provides access to historical and forecasted usage data.

## Inherits

- Object

## Includes

- [Google::Cloud::CapacityPlanner::V1beta::UsageService::Paths](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-capacity_planner-v1beta/latest/Google-Cloud-CapacityPlanner-V1beta-UsageService-Paths)

## Methods

### .configure

    def self.configure() { |config| ... } -> Client::Configuration

Configure the UsageService Client class.


<br />

See [Configuration](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-capacity_planner-v1beta/latest/Google-Cloud-CapacityPlanner-V1beta-UsageService-Client-Configuration "Google::Cloud::CapacityPlanner::V1beta::UsageService::Client::Configuration (class)")
for a description of the configuration fields.
**Yields**

- (config) --- Configure the Client client.
**Yield Parameter**

- **config** ([Client::Configuration](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-capacity_planner-v1beta/latest/Google-Cloud-CapacityPlanner-V1beta-UsageService-Client-Configuration))
**Returns**

- ([Client::Configuration](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-capacity_planner-v1beta/latest/Google-Cloud-CapacityPlanner-V1beta-UsageService-Client-Configuration))
**Example**

```ruby
# Modify the configuration for all UsageService clients
::Google::Cloud::CapacityPlanner::V1beta::UsageService::Client.configure do |config|
  config.timeout = 10.0
end
```

### #configure

    def configure() { |config| ... } -> Client::Configuration

Configure the UsageService Client instance.


The configuration is set to the derived mode, meaning that values can be changed,
but structural changes (adding new fields, etc.) are not allowed. Structural changes
should be made on [Client.configure](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-capacity_planner-v1beta/latest/Google-Cloud-CapacityPlanner-V1beta-UsageService-Client#Google__Cloud__CapacityPlanner__V1beta__UsageService__Client_configure_class_ "Google::Cloud::CapacityPlanner::V1beta::UsageService::Client.configure (method)").

<br />

See [Configuration](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-capacity_planner-v1beta/latest/Google-Cloud-CapacityPlanner-V1beta-UsageService-Client-Configuration "Google::Cloud::CapacityPlanner::V1beta::UsageService::Client::Configuration (class)")
for a description of the configuration fields.
**Yields**

- (config) --- Configure the Client client.
**Yield Parameter**

- **config** ([Client::Configuration](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-capacity_planner-v1beta/latest/Google-Cloud-CapacityPlanner-V1beta-UsageService-Client-Configuration))
**Returns**

- ([Client::Configuration](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-capacity_planner-v1beta/latest/Google-Cloud-CapacityPlanner-V1beta-UsageService-Client-Configuration))

### #export_forecasts

    def export_forecasts(request, options = nil) -> ::Gapic::Operation
    def export_forecasts(parent: nil, machine_family: nil, machine_shape: nil, disk_type: nil, gpu_type: nil, tpu_type: nil, resource_type: nil, prediction_interval: nil, aggregation_method: nil, start_date: nil, end_date: nil, output_config: nil) -> ::Gapic::Operation

Exports forecasted usage data requested by user into either an existing
Cloud Storage bucket or a BigQuery table.
**Overloads**

    def export_forecasts(request, options = nil) -> ::Gapic::Operation

Pass arguments to `export_forecasts` via a request object, either of type [ExportForecastsRequest](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-capacity_planner-v1beta/latest/Google-Cloud-CapacityPlanner-V1beta-ExportForecastsRequest "Google::Cloud::CapacityPlanner::V1beta::ExportForecastsRequest (class)") or an equivalent Hash. **Parameters**

- **request** ([::Google::Cloud::CapacityPlanner::V1beta::ExportForecastsRequest](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-capacity_planner-v1beta/latest/Google-Cloud-CapacityPlanner-V1beta-ExportForecastsRequest), ::Hash) --- A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- **options** (::Gapic::CallOptions, ::Hash) --- Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

    def export_forecasts(parent: nil, machine_family: nil, machine_shape: nil, disk_type: nil, gpu_type: nil, tpu_type: nil, resource_type: nil, prediction_interval: nil, aggregation_method: nil, start_date: nil, end_date: nil, output_config: nil) -> ::Gapic::Operation

Pass arguments to `export_forecasts` via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above). **Parameters**

- **parent** (::String) --- 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}
- **machine_family** (::String) --- Optional. The machine family to use to select the `Forecast` values to return. Possible values include "n1", and "n2d".
- **machine_shape** ([::Google::Cloud::CapacityPlanner::V1beta::MachineShape](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-capacity_planner-v1beta/latest/Google-Cloud-CapacityPlanner-V1beta-MachineShape), ::Hash) --- Optional. The machine shape for the time series values to export.
- **disk_type** (::String) --- Optional. The disk_type for the `Forecast` values to return with request persistent-disk resource_type.
- **gpu_type** (::String) --- 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.
- **tpu_type** (::String) --- Optional. The TPU type for the `Forecast` values to return. Empty tpu_type will return results matching all TPUs.
- **resource_type** (::String) --- 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".
- **prediction_interval** ([::Google::Cloud::CapacityPlanner::V1beta::Forecast::PredictionInterval](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-capacity_planner-v1beta/latest/Google-Cloud-CapacityPlanner-V1beta-Forecast-PredictionInterval)) --- Optional. The prediction interval to use to select the `Forecast` values to return. PREDICTION_INTERVAL_UNSPECIFIED will return results matching all prediction intervals.
- **aggregation_method** ([::Google::Cloud::CapacityPlanner::V1beta::UsageHistory::AggregationMethod](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-capacity_planner-v1beta/latest/Google-Cloud-CapacityPlanner-V1beta-UsageHistory-AggregationMethod)) --- Optional. Aggregation Method of the historical usage for which the forecast is generated.
- **start_date** ([::Google::Type::Date](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-capacity_planner-v1beta/latest/Google-Type-Date), ::Hash) --- Optional. The start date of forecasts.
- **end_date** ([::Google::Type::Date](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-capacity_planner-v1beta/latest/Google-Type-Date), ::Hash) --- Optional. The end date of forecasts.
- **output_config** ([::Google::Cloud::CapacityPlanner::V1beta::OutputConfig](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-capacity_planner-v1beta/latest/Google-Cloud-CapacityPlanner-V1beta-OutputConfig), ::Hash) --- Required. Output configuration indicating where the results will be output to.
**Yields**

- (response, operation) --- Access the result along with the RPC operation
**Yield Parameters**

- **response** (::Gapic::Operation)
- **operation** (::GRPC::ActiveCall::Operation)
**Returns**

- (::Gapic::Operation)
**Raises**

- (::Google::Cloud::Error) --- if the RPC is aborted.
**Example**

Basic example

```ruby
require "google/cloud/capacity_planner/v1beta"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::CapacityPlanner::V1beta::UsageService::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::CapacityPlanner::V1beta::ExportForecastsRequest.new

# Call the export_forecasts method.
result = client.export_forecasts request

# The returned object is of type Gapic::Operation. You can use it to
# check the status of an operation, cancel it, or wait for results.
# Here is how to wait for a response.
result.wait_until_done! timeout: 60
if result.response?
  p result.response
else
  puts "No response received."
end
```

### #export_reservations_usage

    def export_reservations_usage(request, options = nil) -> ::Gapic::Operation
    def export_reservations_usage(machine_family: nil, machine_shape: nil, gpu_type: nil, parent: nil, location_level: nil, cloud_resource_type: nil, usage_aggregation_method: nil, share_type: nil, start_date: nil, end_date: nil, output_config: nil) -> ::Gapic::Operation

Exports reservations usage data requested by user into either an existing
Cloud Storage bucket or a new/existing BigQuery table.
**Overloads**

    def export_reservations_usage(request, options = nil) -> ::Gapic::Operation

Pass arguments to `export_reservations_usage` via a request object, either of type [ExportReservationsUsageRequest](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-capacity_planner-v1beta/latest/Google-Cloud-CapacityPlanner-V1beta-ExportReservationsUsageRequest "Google::Cloud::CapacityPlanner::V1beta::ExportReservationsUsageRequest (class)") or an equivalent Hash. **Parameters**

- **request** ([::Google::Cloud::CapacityPlanner::V1beta::ExportReservationsUsageRequest](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-capacity_planner-v1beta/latest/Google-Cloud-CapacityPlanner-V1beta-ExportReservationsUsageRequest), ::Hash) --- A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- **options** (::Gapic::CallOptions, ::Hash) --- Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

    def export_reservations_usage(machine_family: nil, machine_shape: nil, gpu_type: nil, parent: nil, location_level: nil, cloud_resource_type: nil, usage_aggregation_method: nil, share_type: nil, start_date: nil, end_date: nil, output_config: nil) -> ::Gapic::Operation

Pass arguments to `export_reservations_usage` via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above). **Parameters**

- **machine_family** (::String) --- Optional. The machine family to query reservations and usage by. For example: n1, n2d.


  Note: The following parameters are mutually exclusive: `machine_family`, `machine_shape`, `gpu_type`. At most one of these parameters can be set. If more than one is set, only one will be used, and it is not defined which one.
- **machine_shape** ([::Google::Cloud::CapacityPlanner::V1beta::MachineShape](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-capacity_planner-v1beta/latest/Google-Cloud-CapacityPlanner-V1beta-MachineShape), ::Hash) --- Optional. The machine_shape as a filter to select matching reservations and its usage.


  Note: The following parameters are mutually exclusive: `machine_shape`, `machine_family`, `gpu_type`. At most one of these parameters can be set. If more than one is set, only one will be used, and it is not defined which one.
- **gpu_type** (::String) --- Optional. The GPU type to query reservations and usage by. For example: NVIDIA T4.


  Note: The following parameters are mutually exclusive: `gpu_type`, `machine_family`, `machine_shape`. At most one of these parameters can be set. If more than one is set, only one will be used, and it is not defined which one.
- **parent** (::String) --- 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}
- **location_level** ([::Google::Cloud::CapacityPlanner::V1beta::TimeSeries::LocationType](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-capacity_planner-v1beta/latest/Google-Cloud-CapacityPlanner-V1beta-TimeSeries-LocationType)) --- Optional. The location level of the reservations usage timeseries.
- **cloud_resource_type** (::String) --- Required. The resource for the `ReservationsUsage` values to return. Possible values include "gce-vcpus", "gce-ram", "gce-local-ssd", and "gce-gpu".
- **usage_aggregation_method** ([::Google::Cloud::CapacityPlanner::V1beta::UsageHistory::AggregationMethod](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-capacity_planner-v1beta/latest/Google-Cloud-CapacityPlanner-V1beta-UsageHistory-AggregationMethod)) --- Required. The method that should be used to convert sampled reservations data to daily usage values.
- **share_type** ([::Google::Cloud::CapacityPlanner::V1beta::ExportReservationsUsageRequest::ShareType](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-capacity_planner-v1beta/latest/Google-Cloud-CapacityPlanner-V1beta-ExportReservationsUsageRequest-ShareType)) --- Optional. Type of share settings to filter reservations in response. If unspecified, all types are included.
- **start_date** ([::Google::Type::Date](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-capacity_planner-v1beta/latest/Google-Type-Date), ::Hash) --- Optional. The start date of reservations usage.
- **end_date** ([::Google::Type::Date](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-capacity_planner-v1beta/latest/Google-Type-Date), ::Hash) --- Optional. The end date of reservations usage.
- **output_config** ([::Google::Cloud::CapacityPlanner::V1beta::OutputConfig](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-capacity_planner-v1beta/latest/Google-Cloud-CapacityPlanner-V1beta-OutputConfig), ::Hash) --- Required. Output configuration indicating where the results will be output to.
**Yields**

- (response, operation) --- Access the result along with the RPC operation
**Yield Parameters**

- **response** (::Gapic::Operation)
- **operation** (::GRPC::ActiveCall::Operation)
**Returns**

- (::Gapic::Operation)
**Raises**

- (::Google::Cloud::Error) --- if the RPC is aborted.
**Example**

Basic example

```ruby
require "google/cloud/capacity_planner/v1beta"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::CapacityPlanner::V1beta::UsageService::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::CapacityPlanner::V1beta::ExportReservationsUsageRequest.new

# Call the export_reservations_usage method.
result = client.export_reservations_usage request

# The returned object is of type Gapic::Operation. You can use it to
# check the status of an operation, cancel it, or wait for results.
# Here is how to wait for a response.
result.wait_until_done! timeout: 60
if result.response?
  p result.response
else
  puts "No response received."
end
```

### #export_usage_histories

    def export_usage_histories(request, options = nil) -> ::Gapic::Operation
    def export_usage_histories(parent: nil, is_spot: nil, machine_family: nil, machine_shape: nil, disk_type: nil, gpu_type: nil, tpu_type: nil, resource_type: nil, usage_aggregation_method: nil, start_date: nil, end_date: nil, output_config: nil) -> ::Gapic::Operation

Exports historical usage data requested by user into either an existing
Cloud Storage bucket or a BigQuery table.
**Overloads**

    def export_usage_histories(request, options = nil) -> ::Gapic::Operation

Pass arguments to `export_usage_histories` via a request object, either of type [ExportUsageHistoriesRequest](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-capacity_planner-v1beta/latest/Google-Cloud-CapacityPlanner-V1beta-ExportUsageHistoriesRequest "Google::Cloud::CapacityPlanner::V1beta::ExportUsageHistoriesRequest (class)") or an equivalent Hash. **Parameters**

- **request** ([::Google::Cloud::CapacityPlanner::V1beta::ExportUsageHistoriesRequest](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-capacity_planner-v1beta/latest/Google-Cloud-CapacityPlanner-V1beta-ExportUsageHistoriesRequest), ::Hash) --- A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- **options** (::Gapic::CallOptions, ::Hash) --- Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

    def export_usage_histories(parent: nil, is_spot: nil, machine_family: nil, machine_shape: nil, disk_type: nil, gpu_type: nil, tpu_type: nil, resource_type: nil, usage_aggregation_method: nil, start_date: nil, end_date: nil, output_config: nil) -> ::Gapic::Operation

Pass arguments to `export_usage_histories` via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above). **Parameters**

- **parent** (::String) --- 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}
- **is_spot** (::Boolean) --- Optional. Set true to export usage for spot resources.
- **machine_family** (::String) --- 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.
- **machine_shape** ([::Google::Cloud::CapacityPlanner::V1beta::MachineShape](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-capacity_planner-v1beta/latest/Google-Cloud-CapacityPlanner-V1beta-MachineShape), ::Hash) --- Optional. The machine shape for the time series values to export.
- **disk_type** (::String) --- 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".
- **gpu_type** (::String) --- 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.
- **tpu_type** (::String) --- Optional. The TPU type for the `UsageHistory` values to return. Empty tpu_type will return results matching all TPUs.
- **resource_type** (::String) --- 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".
- **usage_aggregation_method** ([::Google::Cloud::CapacityPlanner::V1beta::UsageHistory::AggregationMethod](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-capacity_planner-v1beta/latest/Google-Cloud-CapacityPlanner-V1beta-UsageHistory-AggregationMethod)) --- 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.
- **start_date** ([::Google::Type::Date](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-capacity_planner-v1beta/latest/Google-Type-Date), ::Hash) --- Optional. The start date of usage.
- **end_date** ([::Google::Type::Date](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-capacity_planner-v1beta/latest/Google-Type-Date), ::Hash) --- Optional. The end date of usage.
- **output_config** ([::Google::Cloud::CapacityPlanner::V1beta::OutputConfig](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-capacity_planner-v1beta/latest/Google-Cloud-CapacityPlanner-V1beta-OutputConfig), ::Hash) --- Required. Output configuration indicating where the results will be output to.
**Yields**

- (response, operation) --- Access the result along with the RPC operation
**Yield Parameters**

- **response** (::Gapic::Operation)
- **operation** (::GRPC::ActiveCall::Operation)
**Returns**

- (::Gapic::Operation)
**Raises**

- (::Google::Cloud::Error) --- if the RPC is aborted.
**Example**

Basic example

```ruby
require "google/cloud/capacity_planner/v1beta"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::CapacityPlanner::V1beta::UsageService::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::CapacityPlanner::V1beta::ExportUsageHistoriesRequest.new

# Call the export_usage_histories method.
result = client.export_usage_histories request

# The returned object is of type Gapic::Operation. You can use it to
# check the status of an operation, cancel it, or wait for results.
# Here is how to wait for a response.
result.wait_until_done! timeout: 60
if result.response?
  p result.response
else
  puts "No response received."
end
```

### #initialize

    def initialize() { |config| ... } -> Client

Create a new UsageService client object.
**Yields**

- (config) --- Configure the UsageService client.
**Yield Parameter**

- **config** ([Client::Configuration](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-capacity_planner-v1beta/latest/Google-Cloud-CapacityPlanner-V1beta-UsageService-Client-Configuration))
**Returns**

- ([Client](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-capacity_planner-v1beta/latest/Google-Cloud-CapacityPlanner-V1beta-UsageService-Client)) --- a new instance of Client
**Example**

```ruby
# Create a client using the default configuration
client = ::Google::Cloud::CapacityPlanner::V1beta::UsageService::Client.new

# Create a client using a custom configuration
client = ::Google::Cloud::CapacityPlanner::V1beta::UsageService::Client.new do |config|
  config.timeout = 10.0
end
```

### #logger

    def logger() -> Logger

The logger used for request/response debug logging.
**Returns**

- (Logger)

### #operations_client

    def operations_client() -> ::Google::Cloud::CapacityPlanner::V1beta::UsageService::Operations

Get the associated client for long-running operations.
**Returns**

- ([::Google::Cloud::CapacityPlanner::V1beta::UsageService::Operations](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-capacity_planner-v1beta/latest/Google-Cloud-CapacityPlanner-V1beta-UsageService-Operations))

### #query_forecasts

    def query_forecasts(request, options = nil) -> ::Google::Cloud::CapacityPlanner::V1beta::QueryForecastsResponse
    def query_forecasts(parent: nil, machine_family: nil, machine_shape: nil, disk_type: nil, confidential_mode: nil, gpu_type: nil, tpu_type: nil, cloud_resource_type: nil, forecast_type: nil, prediction_interval: nil, aggregation_method: nil) -> ::Google::Cloud::CapacityPlanner::V1beta::QueryForecastsResponse

Returns a list of the forecasts that are in the parent parameter
and match your specified filters.
**Overloads**

    def query_forecasts(request, options = nil) -> ::Google::Cloud::CapacityPlanner::V1beta::QueryForecastsResponse

Pass arguments to `query_forecasts` via a request object, either of type [QueryForecastsRequest](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-capacity_planner-v1beta/latest/Google-Cloud-CapacityPlanner-V1beta-QueryForecastsRequest "Google::Cloud::CapacityPlanner::V1beta::QueryForecastsRequest (class)") or an equivalent Hash. **Parameters**

- **request** ([::Google::Cloud::CapacityPlanner::V1beta::QueryForecastsRequest](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-capacity_planner-v1beta/latest/Google-Cloud-CapacityPlanner-V1beta-QueryForecastsRequest), ::Hash) --- A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- **options** (::Gapic::CallOptions, ::Hash) --- Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

    def query_forecasts(parent: nil, machine_family: nil, machine_shape: nil, disk_type: nil, confidential_mode: nil, gpu_type: nil, tpu_type: nil, cloud_resource_type: nil, forecast_type: nil, prediction_interval: nil, aggregation_method: nil) -> ::Google::Cloud::CapacityPlanner::V1beta::QueryForecastsResponse

Pass arguments to `query_forecasts` via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above). **Parameters**

- **parent** (::String) --- 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}
- **machine_family** (::String) --- 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.
- **machine_shape** ([::Google::Cloud::CapacityPlanner::V1beta::MachineShape](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-capacity_planner-v1beta/latest/Google-Cloud-CapacityPlanner-V1beta-MachineShape), ::Hash) --- Optional. The machine shape for the time series values to return.
- **disk_type** (::String) --- 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.
- **confidential_mode** (::Boolean) --- Optional. Whether the persistent disk is in confidential mode.
- **gpu_type** (::String) --- 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.
- **tpu_type** (::String) --- Optional. The TPU type for the `Forecast` values to return. Empty tpu_type will return results matching all TPUs.
- **cloud_resource_type** (::String) --- 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". Empty cloud_resource_type will return results matching all resources.
- **forecast_type** ([::Google::Cloud::CapacityPlanner::V1beta::Forecast::ForecastType](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-capacity_planner-v1beta/latest/Google-Cloud-CapacityPlanner-V1beta-Forecast-ForecastType)) --- The type of forecast to use to select the `Forecast` values to return. FORECAST_TYPE_UNSPECIFIED will return results matching all the forecast types.
- **prediction_interval** ([::Google::Cloud::CapacityPlanner::V1beta::Forecast::PredictionInterval](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-capacity_planner-v1beta/latest/Google-Cloud-CapacityPlanner-V1beta-Forecast-PredictionInterval)) --- The prediction interval to use to select the `Forecast` values to return. PREDICTION_INTERVAL_UNSPECIFIED will return results matching all prediction intervals.
- **aggregation_method** ([::Google::Cloud::CapacityPlanner::V1beta::UsageHistory::AggregationMethod](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-capacity_planner-v1beta/latest/Google-Cloud-CapacityPlanner-V1beta-UsageHistory-AggregationMethod)) --- Aggregation Method of the historical usage for which the forecast is generated
**Yields**

- (response, operation) --- Access the result along with the RPC operation
**Yield Parameters**

- **response** ([::Google::Cloud::CapacityPlanner::V1beta::QueryForecastsResponse](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-capacity_planner-v1beta/latest/Google-Cloud-CapacityPlanner-V1beta-QueryForecastsResponse))
- **operation** (::GRPC::ActiveCall::Operation)
**Returns**

- ([::Google::Cloud::CapacityPlanner::V1beta::QueryForecastsResponse](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-capacity_planner-v1beta/latest/Google-Cloud-CapacityPlanner-V1beta-QueryForecastsResponse))
**Raises**

- (::Google::Cloud::Error) --- if the RPC is aborted.
**Example**

Basic example

```ruby
require "google/cloud/capacity_planner/v1beta"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::CapacityPlanner::V1beta::UsageService::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::CapacityPlanner::V1beta::QueryForecastsRequest.new

# Call the query_forecasts method.
result = client.query_forecasts request

# The returned object is of type Google::Cloud::CapacityPlanner::V1beta::QueryForecastsResponse.
p result
```

### #query_reservations

    def query_reservations(request, options = nil) -> ::Google::Cloud::CapacityPlanner::V1beta::QueryReservationsResponse
    def query_reservations(parent: nil, location_level: nil, machine_family: nil, machine_shape: nil, gpu_type: nil, cloud_resource_type: nil, reservation_type: nil, share_type: nil, ownership_type: nil, reservation_data_level: nil, include_unapproved_reservations: nil, aggregation_method: nil, start_date: nil, end_date: nil) -> ::Google::Cloud::CapacityPlanner::V1beta::QueryReservationsResponse

Returns a list of the reservations that are in the parent parameter
and match your specified filters.
**Overloads**

    def query_reservations(request, options = nil) -> ::Google::Cloud::CapacityPlanner::V1beta::QueryReservationsResponse

Pass arguments to `query_reservations` via a request object, either of type [QueryReservationsRequest](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-capacity_planner-v1beta/latest/Google-Cloud-CapacityPlanner-V1beta-QueryReservationsRequest "Google::Cloud::CapacityPlanner::V1beta::QueryReservationsRequest (class)") or an equivalent Hash. **Parameters**

- **request** ([::Google::Cloud::CapacityPlanner::V1beta::QueryReservationsRequest](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-capacity_planner-v1beta/latest/Google-Cloud-CapacityPlanner-V1beta-QueryReservationsRequest), ::Hash) --- A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- **options** (::Gapic::CallOptions, ::Hash) --- Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

    def query_reservations(parent: nil, location_level: nil, machine_family: nil, machine_shape: nil, gpu_type: nil, cloud_resource_type: nil, reservation_type: nil, share_type: nil, ownership_type: nil, reservation_data_level: nil, include_unapproved_reservations: nil, aggregation_method: nil, start_date: nil, end_date: nil) -> ::Google::Cloud::CapacityPlanner::V1beta::QueryReservationsResponse

Pass arguments to `query_reservations` via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above). **Parameters**

- **parent** (::String) --- 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}
- **location_level** ([::Google::Cloud::CapacityPlanner::V1beta::TimeSeries::LocationType](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-capacity_planner-v1beta/latest/Google-Cloud-CapacityPlanner-V1beta-TimeSeries-LocationType)) --- Optional. The location level of the reservations usage timeseries.
- **machine_family** (::String) --- 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.
- **machine_shape** ([::Google::Cloud::CapacityPlanner::V1beta::MachineShape](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-capacity_planner-v1beta/latest/Google-Cloud-CapacityPlanner-V1beta-MachineShape), ::Hash) --- Optional. The machine_shape as a filter to select matching reservations.
- **gpu_type** (::String) --- 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.
- **cloud_resource_type** (::String) --- Required. The resource for the reserved values to return. Possible values include "gce-vcpus", "gce-ram", "gce-local-ssd", "gce-gpu" and "gce-vm".
- **reservation_type** ([::Google::Cloud::CapacityPlanner::V1beta::QueryReservationsRequest::ReservationType](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-capacity_planner-v1beta/latest/Google-Cloud-CapacityPlanner-V1beta-QueryReservationsRequest-ReservationType)) --- Required. The Reservation type for example, future reservation request and allocation. If unspecified, all types are included.
- **share_type** ([::Google::Cloud::CapacityPlanner::V1beta::QueryReservationsRequest::ShareType](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-capacity_planner-v1beta/latest/Google-Cloud-CapacityPlanner-V1beta-QueryReservationsRequest-ShareType)) --- Optional. Types of share settings to filter reservations in response. If unspecified, all types are included.
- **ownership_type** ([::Google::Cloud::CapacityPlanner::V1beta::QueryReservationsRequest::OwnershipType](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-capacity_planner-v1beta/latest/Google-Cloud-CapacityPlanner-V1beta-QueryReservationsRequest-OwnershipType)) --- 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.
- **reservation_data_level** ([::Google::Cloud::CapacityPlanner::V1beta::QueryReservationsRequest::ReservationDataLevel](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-capacity_planner-v1beta/latest/Google-Cloud-CapacityPlanner-V1beta-QueryReservationsRequest-ReservationDataLevel)) --- Required. Reservations output data format.
- **include_unapproved_reservations** (::Boolean) --- Optional. Whether to include pending for approval reservations in the response. This field is only applicable for future reservations.
- **aggregation_method** ([::Google::Cloud::CapacityPlanner::V1beta::UsageHistory::AggregationMethod](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-capacity_planner-v1beta/latest/Google-Cloud-CapacityPlanner-V1beta-UsageHistory-AggregationMethod)) --- Optional. Aggregation Method of the historical reservation usage
- **start_date** ([::Google::Type::Date](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-capacity_planner-v1beta/latest/Google-Type-Date), ::Hash) --- Optional. The start date of reservations usage.
- **end_date** ([::Google::Type::Date](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-capacity_planner-v1beta/latest/Google-Type-Date), ::Hash) --- Optional. The end date of reservations usage.
**Yields**

- (response, operation) --- Access the result along with the RPC operation
**Yield Parameters**

- **response** ([::Google::Cloud::CapacityPlanner::V1beta::QueryReservationsResponse](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-capacity_planner-v1beta/latest/Google-Cloud-CapacityPlanner-V1beta-QueryReservationsResponse))
- **operation** (::GRPC::ActiveCall::Operation)
**Returns**

- ([::Google::Cloud::CapacityPlanner::V1beta::QueryReservationsResponse](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-capacity_planner-v1beta/latest/Google-Cloud-CapacityPlanner-V1beta-QueryReservationsResponse))
**Raises**

- (::Google::Cloud::Error) --- if the RPC is aborted.
**Example**

Basic example

```ruby
require "google/cloud/capacity_planner/v1beta"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::CapacityPlanner::V1beta::UsageService::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::CapacityPlanner::V1beta::QueryReservationsRequest.new

# Call the query_reservations method.
result = client.query_reservations request

# The returned object is of type Google::Cloud::CapacityPlanner::V1beta::QueryReservationsResponse.
p result
```

### #query_usage_histories

    def query_usage_histories(request, options = nil) -> ::Google::Cloud::CapacityPlanner::V1beta::QueryUsageHistoriesResponse
    def query_usage_histories(parent: nil, location_level: nil, is_spot: nil, machine_family: nil, machine_shape: nil, disk_type: nil, confidential_mode: nil, gpu_type: nil, tpu_type: nil, cloud_resource_type: nil, usage_aggregation_method: nil, start_date: nil, end_date: nil) -> ::Google::Cloud::CapacityPlanner::V1beta::QueryUsageHistoriesResponse

Returns a list of the usage histories that are in the parent parameter
and match your specified filters.
**Overloads**

    def query_usage_histories(request, options = nil) -> ::Google::Cloud::CapacityPlanner::V1beta::QueryUsageHistoriesResponse

Pass arguments to `query_usage_histories` via a request object, either of type [QueryUsageHistoriesRequest](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-capacity_planner-v1beta/latest/Google-Cloud-CapacityPlanner-V1beta-QueryUsageHistoriesRequest "Google::Cloud::CapacityPlanner::V1beta::QueryUsageHistoriesRequest (class)") or an equivalent Hash. **Parameters**

- **request** ([::Google::Cloud::CapacityPlanner::V1beta::QueryUsageHistoriesRequest](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-capacity_planner-v1beta/latest/Google-Cloud-CapacityPlanner-V1beta-QueryUsageHistoriesRequest), ::Hash) --- A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- **options** (::Gapic::CallOptions, ::Hash) --- Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

    def query_usage_histories(parent: nil, location_level: nil, is_spot: nil, machine_family: nil, machine_shape: nil, disk_type: nil, confidential_mode: nil, gpu_type: nil, tpu_type: nil, cloud_resource_type: nil, usage_aggregation_method: nil, start_date: nil, end_date: nil) -> ::Google::Cloud::CapacityPlanner::V1beta::QueryUsageHistoriesResponse

Pass arguments to `query_usage_histories` via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above). **Parameters**

- **parent** (::String) ---

  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}

- **location_level** ([::Google::Cloud::CapacityPlanner::V1beta::TimeSeries::LocationType](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-capacity_planner-v1beta/latest/Google-Cloud-CapacityPlanner-V1beta-TimeSeries-LocationType)) --- Optional. The location level of the reservations usage timeseries.
- **is_spot** (::Boolean) --- Optional. The is_spot flag is used to fetch the usage data for preemptible Resources.
- **machine_family** (::String) --- 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.
- **machine_shape** ([::Google::Cloud::CapacityPlanner::V1beta::MachineShape](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-capacity_planner-v1beta/latest/Google-Cloud-CapacityPlanner-V1beta-MachineShape), ::Hash) --- Optional. The machine shape for the `UsageHistory` values to return.
- **disk_type** (::String) --- 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.
- **confidential_mode** (::Boolean) --- Optional. Whether the persistent disk is in confidential mode.
- **gpu_type** (::String) --- 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.
- **tpu_type** (::String) --- Optional. The TPU type for the `UsageHistory` values to return. Empty tpu_type will return results matching all TPUs.
- **cloud_resource_type** (::String) --- 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". Empty cloud_resource_type will return results matching all resources.
- **usage_aggregation_method** ([::Google::Cloud::CapacityPlanner::V1beta::UsageHistory::AggregationMethod](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-capacity_planner-v1beta/latest/Google-Cloud-CapacityPlanner-V1beta-UsageHistory-AggregationMethod)) --- 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.
- **start_date** ([::Google::Type::Date](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-capacity_planner-v1beta/latest/Google-Type-Date), ::Hash) --- Optional. The start date of reservations usage.
- **end_date** ([::Google::Type::Date](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-capacity_planner-v1beta/latest/Google-Type-Date), ::Hash) --- Optional. The end date of reservations usage.
**Yields**

- (response, operation) --- Access the result along with the RPC operation
**Yield Parameters**

- **response** ([::Google::Cloud::CapacityPlanner::V1beta::QueryUsageHistoriesResponse](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-capacity_planner-v1beta/latest/Google-Cloud-CapacityPlanner-V1beta-QueryUsageHistoriesResponse))
- **operation** (::GRPC::ActiveCall::Operation)
**Returns**

- ([::Google::Cloud::CapacityPlanner::V1beta::QueryUsageHistoriesResponse](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-capacity_planner-v1beta/latest/Google-Cloud-CapacityPlanner-V1beta-QueryUsageHistoriesResponse))
**Raises**

- (::Google::Cloud::Error) --- if the RPC is aborted.
**Example**

Basic example

```ruby
require "google/cloud/capacity_planner/v1beta"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::CapacityPlanner::V1beta::UsageService::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::CapacityPlanner::V1beta::QueryUsageHistoriesRequest.new

# Call the query_usage_histories method.
result = client.query_usage_histories request

# The returned object is of type Google::Cloud::CapacityPlanner::V1beta::QueryUsageHistoriesResponse.
p result
```

### #universe_domain

    def universe_domain() -> String

The effective universe domain
**Returns**

- (String)