google-cloud-capacity_planner-v1beta 0.a → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.yardopts +12 -0
- data/AUTHENTICATION.md +122 -0
- data/README.md +153 -8
- data/lib/google/cloud/capacity_planner/v1beta/capacity_planning_service/client.rb +686 -0
- data/lib/google/cloud/capacity_planner/v1beta/capacity_planning_service/credentials.rb +48 -0
- data/lib/google/cloud/capacity_planner/v1beta/capacity_planning_service/paths.rb +64 -0
- data/lib/google/cloud/capacity_planner/v1beta/capacity_planning_service/rest/client.rb +639 -0
- data/lib/google/cloud/capacity_planner/v1beta/capacity_planning_service/rest/service_stub.rb +279 -0
- data/lib/google/cloud/capacity_planner/v1beta/capacity_planning_service/rest.rb +54 -0
- data/lib/google/cloud/capacity_planner/v1beta/capacity_planning_service.rb +57 -0
- data/lib/google/cloud/capacity_planner/v1beta/rest.rb +38 -0
- data/lib/google/cloud/capacity_planner/v1beta/usage_service/client.rb +1214 -0
- data/lib/google/cloud/capacity_planner/v1beta/usage_service/credentials.rb +48 -0
- data/lib/google/cloud/capacity_planner/v1beta/usage_service/operations.rb +813 -0
- data/lib/google/cloud/capacity_planner/v1beta/usage_service/paths.rb +50 -0
- data/lib/google/cloud/capacity_planner/v1beta/usage_service/rest/client.rb +1146 -0
- data/lib/google/cloud/capacity_planner/v1beta/usage_service/rest/operations.rb +914 -0
- data/lib/google/cloud/capacity_planner/v1beta/usage_service/rest/service_stub.rb +546 -0
- data/lib/google/cloud/capacity_planner/v1beta/usage_service/rest.rb +53 -0
- data/lib/google/cloud/capacity_planner/v1beta/usage_service.rb +56 -0
- data/lib/google/cloud/capacity_planner/v1beta/version.rb +7 -2
- data/lib/google/cloud/capacity_planner/v1beta.rb +46 -0
- data/lib/google/cloud/capacityplanner/v1beta/allocation_pb.rb +53 -0
- data/lib/google/cloud/capacityplanner/v1beta/capacity_planning_service_pb.rb +73 -0
- data/lib/google/cloud/capacityplanner/v1beta/capacity_planning_service_services_pb.rb +54 -0
- data/lib/google/cloud/capacityplanner/v1beta/future_reservation_pb.rb +51 -0
- data/lib/google/cloud/capacityplanner/v1beta/location_pb.rb +46 -0
- data/lib/google/cloud/capacityplanner/v1beta/resource_pb.rb +51 -0
- data/lib/google/cloud/capacityplanner/v1beta/usage_service_pb.rb +90 -0
- data/lib/google/cloud/capacityplanner/v1beta/usage_service_services_pb.rb +61 -0
- data/lib/google-cloud-capacity_planner-v1beta.rb +21 -0
- data/proto_docs/README.md +4 -0
- data/proto_docs/google/api/client.rb +473 -0
- data/proto_docs/google/api/field_behavior.rb +85 -0
- data/proto_docs/google/api/launch_stage.rb +71 -0
- data/proto_docs/google/api/resource.rb +227 -0
- data/proto_docs/google/cloud/capacityplanner/v1beta/allocation.rb +206 -0
- data/proto_docs/google/cloud/capacityplanner/v1beta/capacity_planning_service.rb +374 -0
- data/proto_docs/google/cloud/capacityplanner/v1beta/future_reservation.rb +185 -0
- data/proto_docs/google/cloud/capacityplanner/v1beta/location.rb +79 -0
- data/proto_docs/google/cloud/capacityplanner/v1beta/resource.rb +159 -0
- data/proto_docs/google/cloud/capacityplanner/v1beta/usage_service.rb +912 -0
- data/proto_docs/google/longrunning/operations.rb +173 -0
- data/proto_docs/google/protobuf/any.rb +145 -0
- data/proto_docs/google/protobuf/duration.rb +98 -0
- data/proto_docs/google/protobuf/empty.rb +34 -0
- data/proto_docs/google/protobuf/timestamp.rb +127 -0
- data/proto_docs/google/rpc/status.rb +48 -0
- data/proto_docs/google/type/date.rb +53 -0
- metadata +83 -9
@@ -0,0 +1,1214 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2025 Google LLC
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# https://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
|
17
|
+
# Auto-generated by gapic-generator-ruby. DO NOT EDIT!
|
18
|
+
|
19
|
+
require "google/cloud/errors"
|
20
|
+
require "google/cloud/capacityplanner/v1beta/usage_service_pb"
|
21
|
+
|
22
|
+
module Google
|
23
|
+
module Cloud
|
24
|
+
module CapacityPlanner
|
25
|
+
module V1beta
|
26
|
+
module UsageService
|
27
|
+
##
|
28
|
+
# Client for the UsageService service.
|
29
|
+
#
|
30
|
+
# Provides access to historical and forecasted usage data.
|
31
|
+
#
|
32
|
+
class Client
|
33
|
+
# @private
|
34
|
+
API_VERSION = ""
|
35
|
+
|
36
|
+
# @private
|
37
|
+
DEFAULT_ENDPOINT_TEMPLATE = "capacityplanner.$UNIVERSE_DOMAIN$"
|
38
|
+
|
39
|
+
include Paths
|
40
|
+
|
41
|
+
# @private
|
42
|
+
attr_reader :usage_service_stub
|
43
|
+
|
44
|
+
##
|
45
|
+
# Configure the UsageService Client class.
|
46
|
+
#
|
47
|
+
# See {::Google::Cloud::CapacityPlanner::V1beta::UsageService::Client::Configuration}
|
48
|
+
# for a description of the configuration fields.
|
49
|
+
#
|
50
|
+
# @example
|
51
|
+
#
|
52
|
+
# # Modify the configuration for all UsageService clients
|
53
|
+
# ::Google::Cloud::CapacityPlanner::V1beta::UsageService::Client.configure do |config|
|
54
|
+
# config.timeout = 10.0
|
55
|
+
# end
|
56
|
+
#
|
57
|
+
# @yield [config] Configure the Client client.
|
58
|
+
# @yieldparam config [Client::Configuration]
|
59
|
+
#
|
60
|
+
# @return [Client::Configuration]
|
61
|
+
#
|
62
|
+
def self.configure
|
63
|
+
@configure ||= begin
|
64
|
+
namespace = ["Google", "Cloud", "CapacityPlanner", "V1beta"]
|
65
|
+
parent_config = while namespace.any?
|
66
|
+
parent_name = namespace.join "::"
|
67
|
+
parent_const = const_get parent_name
|
68
|
+
break parent_const.configure if parent_const.respond_to? :configure
|
69
|
+
namespace.pop
|
70
|
+
end
|
71
|
+
default_config = Client::Configuration.new parent_config
|
72
|
+
|
73
|
+
default_config.timeout = 60.0
|
74
|
+
default_config.retry_policy = {
|
75
|
+
initial_delay: 1.0, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 4, 13]
|
76
|
+
}
|
77
|
+
|
78
|
+
default_config
|
79
|
+
end
|
80
|
+
yield @configure if block_given?
|
81
|
+
@configure
|
82
|
+
end
|
83
|
+
|
84
|
+
##
|
85
|
+
# Configure the UsageService Client instance.
|
86
|
+
#
|
87
|
+
# The configuration is set to the derived mode, meaning that values can be changed,
|
88
|
+
# but structural changes (adding new fields, etc.) are not allowed. Structural changes
|
89
|
+
# should be made on {Client.configure}.
|
90
|
+
#
|
91
|
+
# See {::Google::Cloud::CapacityPlanner::V1beta::UsageService::Client::Configuration}
|
92
|
+
# for a description of the configuration fields.
|
93
|
+
#
|
94
|
+
# @yield [config] Configure the Client client.
|
95
|
+
# @yieldparam config [Client::Configuration]
|
96
|
+
#
|
97
|
+
# @return [Client::Configuration]
|
98
|
+
#
|
99
|
+
def configure
|
100
|
+
yield @config if block_given?
|
101
|
+
@config
|
102
|
+
end
|
103
|
+
|
104
|
+
##
|
105
|
+
# The effective universe domain
|
106
|
+
#
|
107
|
+
# @return [String]
|
108
|
+
#
|
109
|
+
def universe_domain
|
110
|
+
@usage_service_stub.universe_domain
|
111
|
+
end
|
112
|
+
|
113
|
+
##
|
114
|
+
# Create a new UsageService client object.
|
115
|
+
#
|
116
|
+
# @example
|
117
|
+
#
|
118
|
+
# # Create a client using the default configuration
|
119
|
+
# client = ::Google::Cloud::CapacityPlanner::V1beta::UsageService::Client.new
|
120
|
+
#
|
121
|
+
# # Create a client using a custom configuration
|
122
|
+
# client = ::Google::Cloud::CapacityPlanner::V1beta::UsageService::Client.new do |config|
|
123
|
+
# config.timeout = 10.0
|
124
|
+
# end
|
125
|
+
#
|
126
|
+
# @yield [config] Configure the UsageService client.
|
127
|
+
# @yieldparam config [Client::Configuration]
|
128
|
+
#
|
129
|
+
def initialize
|
130
|
+
# These require statements are intentionally placed here to initialize
|
131
|
+
# the gRPC module only when it's required.
|
132
|
+
# See https://github.com/googleapis/toolkit/issues/446
|
133
|
+
require "gapic/grpc"
|
134
|
+
require "google/cloud/capacityplanner/v1beta/usage_service_services_pb"
|
135
|
+
|
136
|
+
# Create the configuration object
|
137
|
+
@config = Configuration.new Client.configure
|
138
|
+
|
139
|
+
# Yield the configuration if needed
|
140
|
+
yield @config if block_given?
|
141
|
+
|
142
|
+
# Create credentials
|
143
|
+
credentials = @config.credentials
|
144
|
+
# Use self-signed JWT if the endpoint is unchanged from default,
|
145
|
+
# but only if the default endpoint does not have a region prefix.
|
146
|
+
enable_self_signed_jwt = @config.endpoint.nil? ||
|
147
|
+
(@config.endpoint == Configuration::DEFAULT_ENDPOINT &&
|
148
|
+
!@config.endpoint.split(".").first.include?("-"))
|
149
|
+
credentials ||= Credentials.default scope: @config.scope,
|
150
|
+
enable_self_signed_jwt: enable_self_signed_jwt
|
151
|
+
if credentials.is_a?(::String) || credentials.is_a?(::Hash)
|
152
|
+
credentials = Credentials.new credentials, scope: @config.scope
|
153
|
+
end
|
154
|
+
@quota_project_id = @config.quota_project
|
155
|
+
@quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
|
156
|
+
|
157
|
+
@operations_client = Operations.new do |config|
|
158
|
+
config.credentials = credentials
|
159
|
+
config.quota_project = @quota_project_id
|
160
|
+
config.endpoint = @config.endpoint
|
161
|
+
config.universe_domain = @config.universe_domain
|
162
|
+
end
|
163
|
+
|
164
|
+
@usage_service_stub = ::Gapic::ServiceStub.new(
|
165
|
+
::Google::Cloud::CapacityPlanner::V1beta::UsageService::Stub,
|
166
|
+
credentials: credentials,
|
167
|
+
endpoint: @config.endpoint,
|
168
|
+
endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
|
169
|
+
universe_domain: @config.universe_domain,
|
170
|
+
channel_args: @config.channel_args,
|
171
|
+
interceptors: @config.interceptors,
|
172
|
+
channel_pool_config: @config.channel_pool,
|
173
|
+
logger: @config.logger
|
174
|
+
)
|
175
|
+
|
176
|
+
@usage_service_stub.stub_logger&.info do |entry|
|
177
|
+
entry.set_system_name
|
178
|
+
entry.set_service
|
179
|
+
entry.message = "Created client for #{entry.service}"
|
180
|
+
entry.set_credentials_fields credentials
|
181
|
+
entry.set "customEndpoint", @config.endpoint if @config.endpoint
|
182
|
+
entry.set "defaultTimeout", @config.timeout if @config.timeout
|
183
|
+
entry.set "quotaProject", @quota_project_id if @quota_project_id
|
184
|
+
end
|
185
|
+
end
|
186
|
+
|
187
|
+
##
|
188
|
+
# Get the associated client for long-running operations.
|
189
|
+
#
|
190
|
+
# @return [::Google::Cloud::CapacityPlanner::V1beta::UsageService::Operations]
|
191
|
+
#
|
192
|
+
attr_reader :operations_client
|
193
|
+
|
194
|
+
##
|
195
|
+
# The logger used for request/response debug logging.
|
196
|
+
#
|
197
|
+
# @return [Logger]
|
198
|
+
#
|
199
|
+
def logger
|
200
|
+
@usage_service_stub.logger
|
201
|
+
end
|
202
|
+
|
203
|
+
# Service calls
|
204
|
+
|
205
|
+
##
|
206
|
+
# Returns a list of the usage histories that are in the parent parameter
|
207
|
+
# and match your specified filters.
|
208
|
+
#
|
209
|
+
# @overload query_usage_histories(request, options = nil)
|
210
|
+
# Pass arguments to `query_usage_histories` via a request object, either of type
|
211
|
+
# {::Google::Cloud::CapacityPlanner::V1beta::QueryUsageHistoriesRequest} or an equivalent Hash.
|
212
|
+
#
|
213
|
+
# @param request [::Google::Cloud::CapacityPlanner::V1beta::QueryUsageHistoriesRequest, ::Hash]
|
214
|
+
# A request object representing the call parameters. Required. To specify no
|
215
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
216
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
217
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
218
|
+
#
|
219
|
+
# @overload 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)
|
220
|
+
# Pass arguments to `query_usage_histories` via keyword arguments. Note that at
|
221
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
222
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
223
|
+
#
|
224
|
+
# @param parent [::String]
|
225
|
+
# Required. The compute engine resource and location for the time series
|
226
|
+
# values to return. The format is:
|
227
|
+
#
|
228
|
+
# projects/{project}/locations/{location} or
|
229
|
+
# organizations/{organization}/locations/{location} or
|
230
|
+
# folders/{folder}/locations/{location}
|
231
|
+
# @param location_level [::Google::Cloud::CapacityPlanner::V1beta::TimeSeries::LocationType]
|
232
|
+
# Optional. The location level of the reservations usage timeseries.
|
233
|
+
# @param is_spot [::Boolean]
|
234
|
+
# Optional. The is_spot flag is used to fetch the usage data for preemptible
|
235
|
+
# Resources.
|
236
|
+
# @param machine_family [::String]
|
237
|
+
# The machine family for the `UsageHistory` values to return. Possible values
|
238
|
+
# include "n1", and "n2d". See
|
239
|
+
# https://cloud.google.com/compute/docs/machine-types for more examples.
|
240
|
+
# Empty machine_family will return results matching all machine families.
|
241
|
+
# @param machine_shape [::Google::Cloud::CapacityPlanner::V1beta::MachineShape, ::Hash]
|
242
|
+
# Optional. The machine shape for the `UsageHistory` values to return.
|
243
|
+
# @param disk_type [::String]
|
244
|
+
# Optional. The disk_type for the `UsageHistory` values to return request
|
245
|
+
# with persistent-disk cloud_resource_type. Empty disk_type will return
|
246
|
+
# results matching all disk types.
|
247
|
+
# @param confidential_mode [::Boolean]
|
248
|
+
# Optional. Whether the persistent disk is in confidential mode.
|
249
|
+
# @param gpu_type [::String]
|
250
|
+
# Optional. The GPU type for the `UsageHistory` values to return. Sample
|
251
|
+
# values are "nvidia-tesla-t4", and "nvidia-tesla-a100". See
|
252
|
+
# https://cloud.google.com/compute/docs/gpus for a list. Empty gpu_type
|
253
|
+
# will return results matching all GPUs.
|
254
|
+
# @param tpu_type [::String]
|
255
|
+
# Optional. The TPU type for the `UsageHistory` values to return. Empty
|
256
|
+
# tpu_type will return results matching all TPUs.
|
257
|
+
# @param cloud_resource_type [::String]
|
258
|
+
# The resource for the `UsageHistory` values to return. Possible values
|
259
|
+
# include "gce-vcpus", "gce-ram", "gce-local-ssd", "gce-persistent-disk",
|
260
|
+
# "gce-gpu" and "gce-tpu".
|
261
|
+
# Empty cloud_resource_type will return results matching all resources.
|
262
|
+
# @param usage_aggregation_method [::Google::Cloud::CapacityPlanner::V1beta::UsageHistory::AggregationMethod]
|
263
|
+
# The method that should be used to convert sampled usage data to daily
|
264
|
+
# usage values.
|
265
|
+
# AGGREGATION_METHOD_UNSPECIFIED will return results matching all the
|
266
|
+
# aggregation methods.
|
267
|
+
# @param start_date [::Google::Type::Date, ::Hash]
|
268
|
+
# Optional. The start date of reservations usage.
|
269
|
+
# @param end_date [::Google::Type::Date, ::Hash]
|
270
|
+
# Optional. The end date of reservations usage.
|
271
|
+
#
|
272
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
273
|
+
# @yieldparam response [::Google::Cloud::CapacityPlanner::V1beta::QueryUsageHistoriesResponse]
|
274
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
275
|
+
#
|
276
|
+
# @return [::Google::Cloud::CapacityPlanner::V1beta::QueryUsageHistoriesResponse]
|
277
|
+
#
|
278
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
279
|
+
#
|
280
|
+
# @example Basic example
|
281
|
+
# require "google/cloud/capacity_planner/v1beta"
|
282
|
+
#
|
283
|
+
# # Create a client object. The client can be reused for multiple calls.
|
284
|
+
# client = Google::Cloud::CapacityPlanner::V1beta::UsageService::Client.new
|
285
|
+
#
|
286
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
287
|
+
# request = Google::Cloud::CapacityPlanner::V1beta::QueryUsageHistoriesRequest.new
|
288
|
+
#
|
289
|
+
# # Call the query_usage_histories method.
|
290
|
+
# result = client.query_usage_histories request
|
291
|
+
#
|
292
|
+
# # The returned object is of type Google::Cloud::CapacityPlanner::V1beta::QueryUsageHistoriesResponse.
|
293
|
+
# p result
|
294
|
+
#
|
295
|
+
def query_usage_histories request, options = nil
|
296
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
297
|
+
|
298
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::CapacityPlanner::V1beta::QueryUsageHistoriesRequest
|
299
|
+
|
300
|
+
# Converts hash and nil to an options object
|
301
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
302
|
+
|
303
|
+
# Customize the options with defaults
|
304
|
+
metadata = @config.rpcs.query_usage_histories.metadata.to_h
|
305
|
+
|
306
|
+
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
307
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
308
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
309
|
+
gapic_version: ::Google::Cloud::CapacityPlanner::V1beta::VERSION
|
310
|
+
metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
|
311
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
312
|
+
|
313
|
+
header_params = {}
|
314
|
+
if request.parent
|
315
|
+
header_params["parent"] = request.parent
|
316
|
+
end
|
317
|
+
|
318
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
319
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
320
|
+
|
321
|
+
options.apply_defaults timeout: @config.rpcs.query_usage_histories.timeout,
|
322
|
+
metadata: metadata,
|
323
|
+
retry_policy: @config.rpcs.query_usage_histories.retry_policy
|
324
|
+
|
325
|
+
options.apply_defaults timeout: @config.timeout,
|
326
|
+
metadata: @config.metadata,
|
327
|
+
retry_policy: @config.retry_policy
|
328
|
+
|
329
|
+
@usage_service_stub.call_rpc :query_usage_histories, request, options: options do |response, operation|
|
330
|
+
yield response, operation if block_given?
|
331
|
+
end
|
332
|
+
rescue ::GRPC::BadStatus => e
|
333
|
+
raise ::Google::Cloud::Error.from_error(e)
|
334
|
+
end
|
335
|
+
|
336
|
+
##
|
337
|
+
# Returns a list of the forecasts that are in the parent parameter
|
338
|
+
# and match your specified filters.
|
339
|
+
#
|
340
|
+
# @overload query_forecasts(request, options = nil)
|
341
|
+
# Pass arguments to `query_forecasts` via a request object, either of type
|
342
|
+
# {::Google::Cloud::CapacityPlanner::V1beta::QueryForecastsRequest} or an equivalent Hash.
|
343
|
+
#
|
344
|
+
# @param request [::Google::Cloud::CapacityPlanner::V1beta::QueryForecastsRequest, ::Hash]
|
345
|
+
# A request object representing the call parameters. Required. To specify no
|
346
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
347
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
348
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
349
|
+
#
|
350
|
+
# @overload 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)
|
351
|
+
# Pass arguments to `query_forecasts` via keyword arguments. Note that at
|
352
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
353
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
354
|
+
#
|
355
|
+
# @param parent [::String]
|
356
|
+
# Required. The compute engine resource and location for the time series
|
357
|
+
# values to return. The format is:
|
358
|
+
#
|
359
|
+
# projects/\\{project}/locations/\\{location} or
|
360
|
+
# organizations/\\{organization}/locations/\\{location} or
|
361
|
+
# folders/\\{folder}/locations/\\{location}
|
362
|
+
# @param machine_family [::String]
|
363
|
+
# The machine family to use to select the `Forecast` values to return.
|
364
|
+
# Possible values include "n1", and "n2d".
|
365
|
+
# Empty machine_family will return results matching all machine families.
|
366
|
+
# @param machine_shape [::Google::Cloud::CapacityPlanner::V1beta::MachineShape, ::Hash]
|
367
|
+
# Optional. The machine shape for the time series values to return.
|
368
|
+
# @param disk_type [::String]
|
369
|
+
# Optional. The disk_type for the `Forecast` values to return with request
|
370
|
+
# persistent-disk cloud_resource_type.
|
371
|
+
# Empty disk_type will return results matching all disk types.
|
372
|
+
# @param confidential_mode [::Boolean]
|
373
|
+
# Optional. Whether the persistent disk is in confidential mode.
|
374
|
+
# @param gpu_type [::String]
|
375
|
+
# Optional. The GPU type for the `Forecast` values to return. Sample values
|
376
|
+
# are "nvidia-tesla-t4", and "nvidia-tesla-a100". See
|
377
|
+
# https://cloud.google.com/compute/docs/gpus for a list. Empty gpu_type
|
378
|
+
# will return results matching all GPUs.
|
379
|
+
# @param tpu_type [::String]
|
380
|
+
# Optional. The TPU type for the `Forecast` values to return. Empty tpu_type
|
381
|
+
# will return results matching all TPUs.
|
382
|
+
# @param cloud_resource_type [::String]
|
383
|
+
# The resource for the `Forecast` values to return. Possible values include
|
384
|
+
# "gce-vcpus", "gce-ram", "gce-local-ssd", "gce-persistent-disk", "gce-gpu"
|
385
|
+
# and "gce-tpu".
|
386
|
+
# Empty cloud_resource_type will return results matching all resources.
|
387
|
+
# @param forecast_type [::Google::Cloud::CapacityPlanner::V1beta::Forecast::ForecastType]
|
388
|
+
# The type of forecast to use to select the `Forecast` values to return.
|
389
|
+
# FORECAST_TYPE_UNSPECIFIED will return results matching all the forecast
|
390
|
+
# types.
|
391
|
+
# @param prediction_interval [::Google::Cloud::CapacityPlanner::V1beta::Forecast::PredictionInterval]
|
392
|
+
# The prediction interval to use to select the `Forecast` values to return.
|
393
|
+
# PREDICTION_INTERVAL_UNSPECIFIED will return results matching all prediction
|
394
|
+
# intervals.
|
395
|
+
# @param aggregation_method [::Google::Cloud::CapacityPlanner::V1beta::UsageHistory::AggregationMethod]
|
396
|
+
# Aggregation Method of the historical usage for which the forecast is
|
397
|
+
# generated
|
398
|
+
#
|
399
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
400
|
+
# @yieldparam response [::Google::Cloud::CapacityPlanner::V1beta::QueryForecastsResponse]
|
401
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
402
|
+
#
|
403
|
+
# @return [::Google::Cloud::CapacityPlanner::V1beta::QueryForecastsResponse]
|
404
|
+
#
|
405
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
406
|
+
#
|
407
|
+
# @example Basic example
|
408
|
+
# require "google/cloud/capacity_planner/v1beta"
|
409
|
+
#
|
410
|
+
# # Create a client object. The client can be reused for multiple calls.
|
411
|
+
# client = Google::Cloud::CapacityPlanner::V1beta::UsageService::Client.new
|
412
|
+
#
|
413
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
414
|
+
# request = Google::Cloud::CapacityPlanner::V1beta::QueryForecastsRequest.new
|
415
|
+
#
|
416
|
+
# # Call the query_forecasts method.
|
417
|
+
# result = client.query_forecasts request
|
418
|
+
#
|
419
|
+
# # The returned object is of type Google::Cloud::CapacityPlanner::V1beta::QueryForecastsResponse.
|
420
|
+
# p result
|
421
|
+
#
|
422
|
+
def query_forecasts request, options = nil
|
423
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
424
|
+
|
425
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::CapacityPlanner::V1beta::QueryForecastsRequest
|
426
|
+
|
427
|
+
# Converts hash and nil to an options object
|
428
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
429
|
+
|
430
|
+
# Customize the options with defaults
|
431
|
+
metadata = @config.rpcs.query_forecasts.metadata.to_h
|
432
|
+
|
433
|
+
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
434
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
435
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
436
|
+
gapic_version: ::Google::Cloud::CapacityPlanner::V1beta::VERSION
|
437
|
+
metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
|
438
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
439
|
+
|
440
|
+
header_params = {}
|
441
|
+
if request.parent
|
442
|
+
header_params["parent"] = request.parent
|
443
|
+
end
|
444
|
+
|
445
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
446
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
447
|
+
|
448
|
+
options.apply_defaults timeout: @config.rpcs.query_forecasts.timeout,
|
449
|
+
metadata: metadata,
|
450
|
+
retry_policy: @config.rpcs.query_forecasts.retry_policy
|
451
|
+
|
452
|
+
options.apply_defaults timeout: @config.timeout,
|
453
|
+
metadata: @config.metadata,
|
454
|
+
retry_policy: @config.retry_policy
|
455
|
+
|
456
|
+
@usage_service_stub.call_rpc :query_forecasts, request, options: options do |response, operation|
|
457
|
+
yield response, operation if block_given?
|
458
|
+
end
|
459
|
+
rescue ::GRPC::BadStatus => e
|
460
|
+
raise ::Google::Cloud::Error.from_error(e)
|
461
|
+
end
|
462
|
+
|
463
|
+
##
|
464
|
+
# Returns a list of the reservations that are in the parent parameter
|
465
|
+
# and match your specified filters.
|
466
|
+
#
|
467
|
+
# @overload query_reservations(request, options = nil)
|
468
|
+
# Pass arguments to `query_reservations` via a request object, either of type
|
469
|
+
# {::Google::Cloud::CapacityPlanner::V1beta::QueryReservationsRequest} or an equivalent Hash.
|
470
|
+
#
|
471
|
+
# @param request [::Google::Cloud::CapacityPlanner::V1beta::QueryReservationsRequest, ::Hash]
|
472
|
+
# A request object representing the call parameters. Required. To specify no
|
473
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
474
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
475
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
476
|
+
#
|
477
|
+
# @overload 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)
|
478
|
+
# Pass arguments to `query_reservations` via keyword arguments. Note that at
|
479
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
480
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
481
|
+
#
|
482
|
+
# @param parent [::String]
|
483
|
+
# Required. The compute engine resource and location for the time series
|
484
|
+
# values to return. The format is:
|
485
|
+
#
|
486
|
+
# projects/\\{project}/locations/\\{location} or
|
487
|
+
# organizations/\\{organization}/locations/\\{location} or
|
488
|
+
# folders/\\{folder}/locations/\\{location}
|
489
|
+
# @param location_level [::Google::Cloud::CapacityPlanner::V1beta::TimeSeries::LocationType]
|
490
|
+
# Optional. The location level of the reservations usage timeseries.
|
491
|
+
# @param machine_family [::String]
|
492
|
+
# Optional. The machine family to use to select the aggregate reserved values
|
493
|
+
# to return. Possible values include "n1", and "n2d" etc. Empty
|
494
|
+
# machine_family will return results matching all machine families.
|
495
|
+
# @param machine_shape [::Google::Cloud::CapacityPlanner::V1beta::MachineShape, ::Hash]
|
496
|
+
# Optional. The machine_shape as a filter to select matching reservations.
|
497
|
+
# @param gpu_type [::String]
|
498
|
+
# Optional. The GPU type for the reserved values to return. Sample values
|
499
|
+
# are "nvidia-tesla-t4", and "nvidia-tesla-a100". See
|
500
|
+
# https://cloud.google.com/compute/docs/gpus for a list. Empty gpu_type
|
501
|
+
# will return results matching all GPUs.
|
502
|
+
# @param cloud_resource_type [::String]
|
503
|
+
# Optional. The resource for the reserved values to return. Possible values
|
504
|
+
# include "gce-vcpus", "gce-ram", "gce-local-ssd", "gce-gpu" and "gce-vm".
|
505
|
+
# @param reservation_type [::Google::Cloud::CapacityPlanner::V1beta::QueryReservationsRequest::ReservationType]
|
506
|
+
# Optional. The Reservation type for example, future reservation request and
|
507
|
+
# allocation. If unspecified, all types are
|
508
|
+
# included.
|
509
|
+
# @param share_type [::Google::Cloud::CapacityPlanner::V1beta::QueryReservationsRequest::ShareType]
|
510
|
+
# Optional. Types of share settings to filter reservations in response. If
|
511
|
+
# unspecified, all types are included.
|
512
|
+
# @param ownership_type [::Google::Cloud::CapacityPlanner::V1beta::QueryReservationsRequest::OwnershipType]
|
513
|
+
# Optional. Types of ownerships to filter reservations based on.
|
514
|
+
# In case of OWNED, it filters reservations which are owned by selected
|
515
|
+
# parent project/folder/organization. If unspecified, all types are
|
516
|
+
# included.
|
517
|
+
# @param reservation_data_level [::Google::Cloud::CapacityPlanner::V1beta::QueryReservationsRequest::ReservationDataLevel]
|
518
|
+
# Optional. Reservations output data format.
|
519
|
+
# @param include_unapproved_reservations [::Boolean]
|
520
|
+
# Optional. Whether to include pending for approval reservations in the
|
521
|
+
# response. This field is only applicable for future reservations.
|
522
|
+
# @param aggregation_method [::Google::Cloud::CapacityPlanner::V1beta::UsageHistory::AggregationMethod]
|
523
|
+
# Optional. Aggregation Method of the historical reservation usage
|
524
|
+
# @param start_date [::Google::Type::Date, ::Hash]
|
525
|
+
# Optional. The start date of reservations usage.
|
526
|
+
# @param end_date [::Google::Type::Date, ::Hash]
|
527
|
+
# Optional. The end date of reservations usage.
|
528
|
+
#
|
529
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
530
|
+
# @yieldparam response [::Google::Cloud::CapacityPlanner::V1beta::QueryReservationsResponse]
|
531
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
532
|
+
#
|
533
|
+
# @return [::Google::Cloud::CapacityPlanner::V1beta::QueryReservationsResponse]
|
534
|
+
#
|
535
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
536
|
+
#
|
537
|
+
# @example Basic example
|
538
|
+
# require "google/cloud/capacity_planner/v1beta"
|
539
|
+
#
|
540
|
+
# # Create a client object. The client can be reused for multiple calls.
|
541
|
+
# client = Google::Cloud::CapacityPlanner::V1beta::UsageService::Client.new
|
542
|
+
#
|
543
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
544
|
+
# request = Google::Cloud::CapacityPlanner::V1beta::QueryReservationsRequest.new
|
545
|
+
#
|
546
|
+
# # Call the query_reservations method.
|
547
|
+
# result = client.query_reservations request
|
548
|
+
#
|
549
|
+
# # The returned object is of type Google::Cloud::CapacityPlanner::V1beta::QueryReservationsResponse.
|
550
|
+
# p result
|
551
|
+
#
|
552
|
+
def query_reservations request, options = nil
|
553
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
554
|
+
|
555
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::CapacityPlanner::V1beta::QueryReservationsRequest
|
556
|
+
|
557
|
+
# Converts hash and nil to an options object
|
558
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
559
|
+
|
560
|
+
# Customize the options with defaults
|
561
|
+
metadata = @config.rpcs.query_reservations.metadata.to_h
|
562
|
+
|
563
|
+
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
564
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
565
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
566
|
+
gapic_version: ::Google::Cloud::CapacityPlanner::V1beta::VERSION
|
567
|
+
metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
|
568
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
569
|
+
|
570
|
+
header_params = {}
|
571
|
+
if request.parent
|
572
|
+
header_params["parent"] = request.parent
|
573
|
+
end
|
574
|
+
|
575
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
576
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
577
|
+
|
578
|
+
options.apply_defaults timeout: @config.rpcs.query_reservations.timeout,
|
579
|
+
metadata: metadata,
|
580
|
+
retry_policy: @config.rpcs.query_reservations.retry_policy
|
581
|
+
|
582
|
+
options.apply_defaults timeout: @config.timeout,
|
583
|
+
metadata: @config.metadata,
|
584
|
+
retry_policy: @config.retry_policy
|
585
|
+
|
586
|
+
@usage_service_stub.call_rpc :query_reservations, request, options: options do |response, operation|
|
587
|
+
yield response, operation if block_given?
|
588
|
+
end
|
589
|
+
rescue ::GRPC::BadStatus => e
|
590
|
+
raise ::Google::Cloud::Error.from_error(e)
|
591
|
+
end
|
592
|
+
|
593
|
+
##
|
594
|
+
# Exports historical usage data requested by user into either an existing
|
595
|
+
# Cloud Storage bucket or a BigQuery table.
|
596
|
+
#
|
597
|
+
# @overload export_usage_histories(request, options = nil)
|
598
|
+
# Pass arguments to `export_usage_histories` via a request object, either of type
|
599
|
+
# {::Google::Cloud::CapacityPlanner::V1beta::ExportUsageHistoriesRequest} or an equivalent Hash.
|
600
|
+
#
|
601
|
+
# @param request [::Google::Cloud::CapacityPlanner::V1beta::ExportUsageHistoriesRequest, ::Hash]
|
602
|
+
# A request object representing the call parameters. Required. To specify no
|
603
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
604
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
605
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
606
|
+
#
|
607
|
+
# @overload 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)
|
608
|
+
# Pass arguments to `export_usage_histories` via keyword arguments. Note that at
|
609
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
610
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
611
|
+
#
|
612
|
+
# @param parent [::String]
|
613
|
+
# Required. The compute engine resource and location for the time series
|
614
|
+
# values to return. The format is:
|
615
|
+
# projects/\\{project}/locations/\\{location} or
|
616
|
+
# organizations/\\{organization}/locations/\\{location} or
|
617
|
+
# folders/\\{folder}/locations/\\{location}
|
618
|
+
# @param is_spot [::Boolean]
|
619
|
+
# Optional. Set true to export usage for spot resources.
|
620
|
+
# @param machine_family [::String]
|
621
|
+
# Optional. The machine family for the `UsageHistory` values to return.
|
622
|
+
# Possible values include "n1", and "n2d". See
|
623
|
+
# https://cloud.google.com/compute/docs/machine-types for more examples.
|
624
|
+
# @param machine_shape [::Google::Cloud::CapacityPlanner::V1beta::MachineShape, ::Hash]
|
625
|
+
# Optional. The machine shape for the time series values to export.
|
626
|
+
# @param disk_type [::String]
|
627
|
+
# Optional. The disk_type for the `UsageHistory` values to return request
|
628
|
+
# with persistent-disk resource_type. Possible values include "pd-ssd",
|
629
|
+
# "pd-standard", "pd-balanced", and "pd-extreme".
|
630
|
+
# @param gpu_type [::String]
|
631
|
+
# Optional. The GPU type for the `UsageHistory` values to return. Sample
|
632
|
+
# values are "nvidia-tesla-t4", and "nvidia-tesla-a100". See
|
633
|
+
# https://cloud.google.com/compute/docs/gpus for a list. Empty gpu_type
|
634
|
+
# will return results matching all GPUs.
|
635
|
+
# @param tpu_type [::String]
|
636
|
+
# Optional. The TPU type for the `UsageHistory` values to return. Empty
|
637
|
+
# tpu_type will return results matching all TPUs.
|
638
|
+
# @param resource_type [::String]
|
639
|
+
# Required. The resource for the `UsageHistory` values to return. Possible
|
640
|
+
# values include "gce-vcpus", "gce-ram", "gce-local-ssd",
|
641
|
+
# "gce-persistent-disk", "gce-gpu" and "gce-tpu".
|
642
|
+
# @param usage_aggregation_method [::Google::Cloud::CapacityPlanner::V1beta::UsageHistory::AggregationMethod]
|
643
|
+
# Optional. The method that should be used to convert sampled usage data to
|
644
|
+
# daily usage values. AGGREGATION_METHOD_UNSPECIFIED will return results
|
645
|
+
# matching all the aggregation methods.
|
646
|
+
# @param start_date [::Google::Type::Date, ::Hash]
|
647
|
+
# Optional. The start date of usage.
|
648
|
+
# @param end_date [::Google::Type::Date, ::Hash]
|
649
|
+
# Optional. The end date of usage.
|
650
|
+
# @param output_config [::Google::Cloud::CapacityPlanner::V1beta::OutputConfig, ::Hash]
|
651
|
+
# Required. Output configuration indicating where the results will be output
|
652
|
+
# to.
|
653
|
+
#
|
654
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
655
|
+
# @yieldparam response [::Gapic::Operation]
|
656
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
657
|
+
#
|
658
|
+
# @return [::Gapic::Operation]
|
659
|
+
#
|
660
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
661
|
+
#
|
662
|
+
# @example Basic example
|
663
|
+
# require "google/cloud/capacity_planner/v1beta"
|
664
|
+
#
|
665
|
+
# # Create a client object. The client can be reused for multiple calls.
|
666
|
+
# client = Google::Cloud::CapacityPlanner::V1beta::UsageService::Client.new
|
667
|
+
#
|
668
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
669
|
+
# request = Google::Cloud::CapacityPlanner::V1beta::ExportUsageHistoriesRequest.new
|
670
|
+
#
|
671
|
+
# # Call the export_usage_histories method.
|
672
|
+
# result = client.export_usage_histories request
|
673
|
+
#
|
674
|
+
# # The returned object is of type Gapic::Operation. You can use it to
|
675
|
+
# # check the status of an operation, cancel it, or wait for results.
|
676
|
+
# # Here is how to wait for a response.
|
677
|
+
# result.wait_until_done! timeout: 60
|
678
|
+
# if result.response?
|
679
|
+
# p result.response
|
680
|
+
# else
|
681
|
+
# puts "No response received."
|
682
|
+
# end
|
683
|
+
#
|
684
|
+
def export_usage_histories request, options = nil
|
685
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
686
|
+
|
687
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::CapacityPlanner::V1beta::ExportUsageHistoriesRequest
|
688
|
+
|
689
|
+
# Converts hash and nil to an options object
|
690
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
691
|
+
|
692
|
+
# Customize the options with defaults
|
693
|
+
metadata = @config.rpcs.export_usage_histories.metadata.to_h
|
694
|
+
|
695
|
+
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
696
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
697
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
698
|
+
gapic_version: ::Google::Cloud::CapacityPlanner::V1beta::VERSION
|
699
|
+
metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
|
700
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
701
|
+
|
702
|
+
header_params = {}
|
703
|
+
if request.parent
|
704
|
+
header_params["parent"] = request.parent
|
705
|
+
end
|
706
|
+
|
707
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
708
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
709
|
+
|
710
|
+
options.apply_defaults timeout: @config.rpcs.export_usage_histories.timeout,
|
711
|
+
metadata: metadata,
|
712
|
+
retry_policy: @config.rpcs.export_usage_histories.retry_policy
|
713
|
+
|
714
|
+
options.apply_defaults timeout: @config.timeout,
|
715
|
+
metadata: @config.metadata,
|
716
|
+
retry_policy: @config.retry_policy
|
717
|
+
|
718
|
+
@usage_service_stub.call_rpc :export_usage_histories, request, options: options do |response, operation|
|
719
|
+
response = ::Gapic::Operation.new response, @operations_client, options: options
|
720
|
+
yield response, operation if block_given?
|
721
|
+
throw :response, response
|
722
|
+
end
|
723
|
+
rescue ::GRPC::BadStatus => e
|
724
|
+
raise ::Google::Cloud::Error.from_error(e)
|
725
|
+
end
|
726
|
+
|
727
|
+
##
|
728
|
+
# Exports forecasted usage data requested by user into either an existing
|
729
|
+
# Cloud Storage bucket or a BigQuery table.
|
730
|
+
#
|
731
|
+
# @overload export_forecasts(request, options = nil)
|
732
|
+
# Pass arguments to `export_forecasts` via a request object, either of type
|
733
|
+
# {::Google::Cloud::CapacityPlanner::V1beta::ExportForecastsRequest} or an equivalent Hash.
|
734
|
+
#
|
735
|
+
# @param request [::Google::Cloud::CapacityPlanner::V1beta::ExportForecastsRequest, ::Hash]
|
736
|
+
# A request object representing the call parameters. Required. To specify no
|
737
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
738
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
739
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
740
|
+
#
|
741
|
+
# @overload 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)
|
742
|
+
# Pass arguments to `export_forecasts` via keyword arguments. Note that at
|
743
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
744
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
745
|
+
#
|
746
|
+
# @param parent [::String]
|
747
|
+
# Required. The compute engine resource and location for the time series
|
748
|
+
# values to return. The format is:
|
749
|
+
# projects/\\{project}/locations/\\{location} or
|
750
|
+
# organizations/\\{organization}/locations/\\{location} or
|
751
|
+
# folders/\\{folder}/locations/\\{location}
|
752
|
+
# @param machine_family [::String]
|
753
|
+
# Optional. The machine family to use to select the `Forecast` values to
|
754
|
+
# return. Possible values include "n1", and "n2d".
|
755
|
+
# @param machine_shape [::Google::Cloud::CapacityPlanner::V1beta::MachineShape, ::Hash]
|
756
|
+
# Optional. The machine shape for the time series values to export.
|
757
|
+
# @param disk_type [::String]
|
758
|
+
# Optional. The disk_type for the `Forecast` values to return with request
|
759
|
+
# persistent-disk resource_type.
|
760
|
+
# @param gpu_type [::String]
|
761
|
+
# Optional. The GPU type for the `Forecast` values to return. Sample values
|
762
|
+
# are "nvidia-tesla-t4", and "nvidia-tesla-a100". See
|
763
|
+
# https://cloud.google.com/compute/docs/gpus for a list. Empty gpu_type
|
764
|
+
# will return results matching all GPUs.
|
765
|
+
# @param tpu_type [::String]
|
766
|
+
# Optional. The TPU type for the `Forecast` values to return. Empty tpu_type
|
767
|
+
# will return results matching all TPUs.
|
768
|
+
# @param resource_type [::String]
|
769
|
+
# Required. The resource for the `Forecast` values to return. Possible values
|
770
|
+
# include "gce-vcpus", "gce-ram", "gce-local-ssd", "gce-persistent-disk",
|
771
|
+
# "gce-gpu" and "gce-tpu".
|
772
|
+
# @param prediction_interval [::Google::Cloud::CapacityPlanner::V1beta::Forecast::PredictionInterval]
|
773
|
+
# Optional. The prediction interval to use to select the `Forecast` values to
|
774
|
+
# return. PREDICTION_INTERVAL_UNSPECIFIED will return results matching all
|
775
|
+
# prediction intervals.
|
776
|
+
# @param aggregation_method [::Google::Cloud::CapacityPlanner::V1beta::UsageHistory::AggregationMethod]
|
777
|
+
# Optional. Aggregation Method of the historical usage for which the forecast
|
778
|
+
# is generated.
|
779
|
+
# @param start_date [::Google::Type::Date, ::Hash]
|
780
|
+
# Optional. The start date of forecasts.
|
781
|
+
# @param end_date [::Google::Type::Date, ::Hash]
|
782
|
+
# Optional. The end date of forecasts.
|
783
|
+
# @param output_config [::Google::Cloud::CapacityPlanner::V1beta::OutputConfig, ::Hash]
|
784
|
+
# Required. Output configuration indicating where the results will be output
|
785
|
+
# to.
|
786
|
+
#
|
787
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
788
|
+
# @yieldparam response [::Gapic::Operation]
|
789
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
790
|
+
#
|
791
|
+
# @return [::Gapic::Operation]
|
792
|
+
#
|
793
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
794
|
+
#
|
795
|
+
# @example Basic example
|
796
|
+
# require "google/cloud/capacity_planner/v1beta"
|
797
|
+
#
|
798
|
+
# # Create a client object. The client can be reused for multiple calls.
|
799
|
+
# client = Google::Cloud::CapacityPlanner::V1beta::UsageService::Client.new
|
800
|
+
#
|
801
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
802
|
+
# request = Google::Cloud::CapacityPlanner::V1beta::ExportForecastsRequest.new
|
803
|
+
#
|
804
|
+
# # Call the export_forecasts method.
|
805
|
+
# result = client.export_forecasts request
|
806
|
+
#
|
807
|
+
# # The returned object is of type Gapic::Operation. You can use it to
|
808
|
+
# # check the status of an operation, cancel it, or wait for results.
|
809
|
+
# # Here is how to wait for a response.
|
810
|
+
# result.wait_until_done! timeout: 60
|
811
|
+
# if result.response?
|
812
|
+
# p result.response
|
813
|
+
# else
|
814
|
+
# puts "No response received."
|
815
|
+
# end
|
816
|
+
#
|
817
|
+
def export_forecasts request, options = nil
|
818
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
819
|
+
|
820
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::CapacityPlanner::V1beta::ExportForecastsRequest
|
821
|
+
|
822
|
+
# Converts hash and nil to an options object
|
823
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
824
|
+
|
825
|
+
# Customize the options with defaults
|
826
|
+
metadata = @config.rpcs.export_forecasts.metadata.to_h
|
827
|
+
|
828
|
+
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
829
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
830
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
831
|
+
gapic_version: ::Google::Cloud::CapacityPlanner::V1beta::VERSION
|
832
|
+
metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
|
833
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
834
|
+
|
835
|
+
header_params = {}
|
836
|
+
if request.parent
|
837
|
+
header_params["parent"] = request.parent
|
838
|
+
end
|
839
|
+
|
840
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
841
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
842
|
+
|
843
|
+
options.apply_defaults timeout: @config.rpcs.export_forecasts.timeout,
|
844
|
+
metadata: metadata,
|
845
|
+
retry_policy: @config.rpcs.export_forecasts.retry_policy
|
846
|
+
|
847
|
+
options.apply_defaults timeout: @config.timeout,
|
848
|
+
metadata: @config.metadata,
|
849
|
+
retry_policy: @config.retry_policy
|
850
|
+
|
851
|
+
@usage_service_stub.call_rpc :export_forecasts, request, options: options do |response, operation|
|
852
|
+
response = ::Gapic::Operation.new response, @operations_client, options: options
|
853
|
+
yield response, operation if block_given?
|
854
|
+
throw :response, response
|
855
|
+
end
|
856
|
+
rescue ::GRPC::BadStatus => e
|
857
|
+
raise ::Google::Cloud::Error.from_error(e)
|
858
|
+
end
|
859
|
+
|
860
|
+
##
|
861
|
+
# Exports reservations usage data requested by user into either an existing
|
862
|
+
# Cloud Storage bucket or a new/existing BigQuery table.
|
863
|
+
#
|
864
|
+
# @overload export_reservations_usage(request, options = nil)
|
865
|
+
# Pass arguments to `export_reservations_usage` via a request object, either of type
|
866
|
+
# {::Google::Cloud::CapacityPlanner::V1beta::ExportReservationsUsageRequest} or an equivalent Hash.
|
867
|
+
#
|
868
|
+
# @param request [::Google::Cloud::CapacityPlanner::V1beta::ExportReservationsUsageRequest, ::Hash]
|
869
|
+
# A request object representing the call parameters. Required. To specify no
|
870
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
871
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
872
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
873
|
+
#
|
874
|
+
# @overload 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)
|
875
|
+
# Pass arguments to `export_reservations_usage` via keyword arguments. Note that at
|
876
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
877
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
878
|
+
#
|
879
|
+
# @param machine_family [::String]
|
880
|
+
# Optional. The machine family to query reservations and usage by. For
|
881
|
+
# example: n1, n2d.
|
882
|
+
#
|
883
|
+
# 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.
|
884
|
+
# @param machine_shape [::Google::Cloud::CapacityPlanner::V1beta::MachineShape, ::Hash]
|
885
|
+
# Optional. The machine_shape as a filter to select matching reservations
|
886
|
+
# and its usage.
|
887
|
+
#
|
888
|
+
# 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.
|
889
|
+
# @param gpu_type [::String]
|
890
|
+
# Optional. The GPU type to query reservations and usage by. For example:
|
891
|
+
# NVIDIA T4.
|
892
|
+
#
|
893
|
+
# 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.
|
894
|
+
# @param parent [::String]
|
895
|
+
# Required. The compute engine resource and location of the
|
896
|
+
# reservationsusage. The format is:
|
897
|
+
# projects/\\{project}/locations/\\{location} or
|
898
|
+
# organizations/\\{organization}/locations/\\{location} or
|
899
|
+
# folders/\\{folder}/locations/\\{location}
|
900
|
+
# @param location_level [::Google::Cloud::CapacityPlanner::V1beta::TimeSeries::LocationType]
|
901
|
+
# Optional. The location level of the reservations usage timeseries.
|
902
|
+
# @param cloud_resource_type [::String]
|
903
|
+
# Required. The resource for the `ReservationsUsage` values to return.
|
904
|
+
# Possible values include "gce-vcpus", "gce-ram", "gce-local-ssd", and
|
905
|
+
# "gce-gpu".
|
906
|
+
# @param usage_aggregation_method [::Google::Cloud::CapacityPlanner::V1beta::UsageHistory::AggregationMethod]
|
907
|
+
# Required. The method that should be used to convert sampled reservations
|
908
|
+
# data to daily usage values.
|
909
|
+
# @param share_type [::Google::Cloud::CapacityPlanner::V1beta::ExportReservationsUsageRequest::ShareType]
|
910
|
+
# Optional. Type of share settings to filter reservations in response. If
|
911
|
+
# unspecified, all types are included.
|
912
|
+
# @param start_date [::Google::Type::Date, ::Hash]
|
913
|
+
# Optional. The start date of reservations usage.
|
914
|
+
# @param end_date [::Google::Type::Date, ::Hash]
|
915
|
+
# Optional. The end date of reservations usage.
|
916
|
+
# @param output_config [::Google::Cloud::CapacityPlanner::V1beta::OutputConfig, ::Hash]
|
917
|
+
# Required. Output configuration indicating where the results will be output
|
918
|
+
# to.
|
919
|
+
#
|
920
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
921
|
+
# @yieldparam response [::Gapic::Operation]
|
922
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
923
|
+
#
|
924
|
+
# @return [::Gapic::Operation]
|
925
|
+
#
|
926
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
927
|
+
#
|
928
|
+
# @example Basic example
|
929
|
+
# require "google/cloud/capacity_planner/v1beta"
|
930
|
+
#
|
931
|
+
# # Create a client object. The client can be reused for multiple calls.
|
932
|
+
# client = Google::Cloud::CapacityPlanner::V1beta::UsageService::Client.new
|
933
|
+
#
|
934
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
935
|
+
# request = Google::Cloud::CapacityPlanner::V1beta::ExportReservationsUsageRequest.new
|
936
|
+
#
|
937
|
+
# # Call the export_reservations_usage method.
|
938
|
+
# result = client.export_reservations_usage request
|
939
|
+
#
|
940
|
+
# # The returned object is of type Gapic::Operation. You can use it to
|
941
|
+
# # check the status of an operation, cancel it, or wait for results.
|
942
|
+
# # Here is how to wait for a response.
|
943
|
+
# result.wait_until_done! timeout: 60
|
944
|
+
# if result.response?
|
945
|
+
# p result.response
|
946
|
+
# else
|
947
|
+
# puts "No response received."
|
948
|
+
# end
|
949
|
+
#
|
950
|
+
def export_reservations_usage request, options = nil
|
951
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
952
|
+
|
953
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::CapacityPlanner::V1beta::ExportReservationsUsageRequest
|
954
|
+
|
955
|
+
# Converts hash and nil to an options object
|
956
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
957
|
+
|
958
|
+
# Customize the options with defaults
|
959
|
+
metadata = @config.rpcs.export_reservations_usage.metadata.to_h
|
960
|
+
|
961
|
+
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
962
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
963
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
964
|
+
gapic_version: ::Google::Cloud::CapacityPlanner::V1beta::VERSION
|
965
|
+
metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
|
966
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
967
|
+
|
968
|
+
header_params = {}
|
969
|
+
if request.parent
|
970
|
+
header_params["parent"] = request.parent
|
971
|
+
end
|
972
|
+
|
973
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
974
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
975
|
+
|
976
|
+
options.apply_defaults timeout: @config.rpcs.export_reservations_usage.timeout,
|
977
|
+
metadata: metadata,
|
978
|
+
retry_policy: @config.rpcs.export_reservations_usage.retry_policy
|
979
|
+
|
980
|
+
options.apply_defaults timeout: @config.timeout,
|
981
|
+
metadata: @config.metadata,
|
982
|
+
retry_policy: @config.retry_policy
|
983
|
+
|
984
|
+
@usage_service_stub.call_rpc :export_reservations_usage, request, options: options do |response, operation|
|
985
|
+
response = ::Gapic::Operation.new response, @operations_client, options: options
|
986
|
+
yield response, operation if block_given?
|
987
|
+
throw :response, response
|
988
|
+
end
|
989
|
+
rescue ::GRPC::BadStatus => e
|
990
|
+
raise ::Google::Cloud::Error.from_error(e)
|
991
|
+
end
|
992
|
+
|
993
|
+
##
|
994
|
+
# Configuration class for the UsageService API.
|
995
|
+
#
|
996
|
+
# This class represents the configuration for UsageService,
|
997
|
+
# providing control over timeouts, retry behavior, logging, transport
|
998
|
+
# parameters, and other low-level controls. Certain parameters can also be
|
999
|
+
# applied individually to specific RPCs. See
|
1000
|
+
# {::Google::Cloud::CapacityPlanner::V1beta::UsageService::Client::Configuration::Rpcs}
|
1001
|
+
# for a list of RPCs that can be configured independently.
|
1002
|
+
#
|
1003
|
+
# Configuration can be applied globally to all clients, or to a single client
|
1004
|
+
# on construction.
|
1005
|
+
#
|
1006
|
+
# @example
|
1007
|
+
#
|
1008
|
+
# # Modify the global config, setting the timeout for
|
1009
|
+
# # query_usage_histories to 20 seconds,
|
1010
|
+
# # and all remaining timeouts to 10 seconds.
|
1011
|
+
# ::Google::Cloud::CapacityPlanner::V1beta::UsageService::Client.configure do |config|
|
1012
|
+
# config.timeout = 10.0
|
1013
|
+
# config.rpcs.query_usage_histories.timeout = 20.0
|
1014
|
+
# end
|
1015
|
+
#
|
1016
|
+
# # Apply the above configuration only to a new client.
|
1017
|
+
# client = ::Google::Cloud::CapacityPlanner::V1beta::UsageService::Client.new do |config|
|
1018
|
+
# config.timeout = 10.0
|
1019
|
+
# config.rpcs.query_usage_histories.timeout = 20.0
|
1020
|
+
# end
|
1021
|
+
#
|
1022
|
+
# @!attribute [rw] endpoint
|
1023
|
+
# A custom service endpoint, as a hostname or hostname:port. The default is
|
1024
|
+
# nil, indicating to use the default endpoint in the current universe domain.
|
1025
|
+
# @return [::String,nil]
|
1026
|
+
# @!attribute [rw] credentials
|
1027
|
+
# Credentials to send with calls. You may provide any of the following types:
|
1028
|
+
# * (`String`) The path to a service account key file in JSON format
|
1029
|
+
# * (`Hash`) A service account key as a Hash
|
1030
|
+
# * (`Google::Auth::Credentials`) A googleauth credentials object
|
1031
|
+
# (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
|
1032
|
+
# * (`Signet::OAuth2::Client`) A signet oauth2 client object
|
1033
|
+
# (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
|
1034
|
+
# * (`GRPC::Core::Channel`) a gRPC channel with included credentials
|
1035
|
+
# * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
|
1036
|
+
# * (`nil`) indicating no credentials
|
1037
|
+
#
|
1038
|
+
# Warning: If you accept a credential configuration (JSON file or Hash) from an
|
1039
|
+
# external source for authentication to Google Cloud, you must validate it before
|
1040
|
+
# providing it to a Google API client library. Providing an unvalidated credential
|
1041
|
+
# configuration to Google APIs can compromise the security of your systems and data.
|
1042
|
+
# For more information, refer to [Validate credential configurations from external
|
1043
|
+
# sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
|
1044
|
+
# @return [::Object]
|
1045
|
+
# @!attribute [rw] scope
|
1046
|
+
# The OAuth scopes
|
1047
|
+
# @return [::Array<::String>]
|
1048
|
+
# @!attribute [rw] lib_name
|
1049
|
+
# The library name as recorded in instrumentation and logging
|
1050
|
+
# @return [::String]
|
1051
|
+
# @!attribute [rw] lib_version
|
1052
|
+
# The library version as recorded in instrumentation and logging
|
1053
|
+
# @return [::String]
|
1054
|
+
# @!attribute [rw] channel_args
|
1055
|
+
# Extra parameters passed to the gRPC channel. Note: this is ignored if a
|
1056
|
+
# `GRPC::Core::Channel` object is provided as the credential.
|
1057
|
+
# @return [::Hash]
|
1058
|
+
# @!attribute [rw] interceptors
|
1059
|
+
# An array of interceptors that are run before calls are executed.
|
1060
|
+
# @return [::Array<::GRPC::ClientInterceptor>]
|
1061
|
+
# @!attribute [rw] timeout
|
1062
|
+
# The call timeout in seconds.
|
1063
|
+
# @return [::Numeric]
|
1064
|
+
# @!attribute [rw] metadata
|
1065
|
+
# Additional gRPC headers to be sent with the call.
|
1066
|
+
# @return [::Hash{::Symbol=>::String}]
|
1067
|
+
# @!attribute [rw] retry_policy
|
1068
|
+
# The retry policy. The value is a hash with the following keys:
|
1069
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
1070
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
1071
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
1072
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
1073
|
+
# trigger a retry.
|
1074
|
+
# @return [::Hash]
|
1075
|
+
# @!attribute [rw] quota_project
|
1076
|
+
# A separate project against which to charge quota.
|
1077
|
+
# @return [::String]
|
1078
|
+
# @!attribute [rw] universe_domain
|
1079
|
+
# The universe domain within which to make requests. This determines the
|
1080
|
+
# default endpoint URL. The default value of nil uses the environment
|
1081
|
+
# universe (usually the default "googleapis.com" universe).
|
1082
|
+
# @return [::String,nil]
|
1083
|
+
# @!attribute [rw] logger
|
1084
|
+
# A custom logger to use for request/response debug logging, or the value
|
1085
|
+
# `:default` (the default) to construct a default logger, or `nil` to
|
1086
|
+
# explicitly disable logging.
|
1087
|
+
# @return [::Logger,:default,nil]
|
1088
|
+
#
|
1089
|
+
class Configuration
|
1090
|
+
extend ::Gapic::Config
|
1091
|
+
|
1092
|
+
# @private
|
1093
|
+
# The endpoint specific to the default "googleapis.com" universe. Deprecated.
|
1094
|
+
DEFAULT_ENDPOINT = "capacityplanner.googleapis.com"
|
1095
|
+
|
1096
|
+
config_attr :endpoint, nil, ::String, nil
|
1097
|
+
config_attr :credentials, nil do |value|
|
1098
|
+
allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Google::Auth::BaseClient, ::Signet::OAuth2::Client, nil]
|
1099
|
+
allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC::Core::Channel
|
1100
|
+
allowed.any? { |klass| klass === value }
|
1101
|
+
end
|
1102
|
+
config_attr :scope, nil, ::String, ::Array, nil
|
1103
|
+
config_attr :lib_name, nil, ::String, nil
|
1104
|
+
config_attr :lib_version, nil, ::String, nil
|
1105
|
+
config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
|
1106
|
+
config_attr :interceptors, nil, ::Array, nil
|
1107
|
+
config_attr :timeout, nil, ::Numeric, nil
|
1108
|
+
config_attr :metadata, nil, ::Hash, nil
|
1109
|
+
config_attr :retry_policy, nil, ::Hash, ::Proc, nil
|
1110
|
+
config_attr :quota_project, nil, ::String, nil
|
1111
|
+
config_attr :universe_domain, nil, ::String, nil
|
1112
|
+
config_attr :logger, :default, ::Logger, nil, :default
|
1113
|
+
|
1114
|
+
# @private
|
1115
|
+
def initialize parent_config = nil
|
1116
|
+
@parent_config = parent_config unless parent_config.nil?
|
1117
|
+
|
1118
|
+
yield self if block_given?
|
1119
|
+
end
|
1120
|
+
|
1121
|
+
##
|
1122
|
+
# Configurations for individual RPCs
|
1123
|
+
# @return [Rpcs]
|
1124
|
+
#
|
1125
|
+
def rpcs
|
1126
|
+
@rpcs ||= begin
|
1127
|
+
parent_rpcs = nil
|
1128
|
+
parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
|
1129
|
+
Rpcs.new parent_rpcs
|
1130
|
+
end
|
1131
|
+
end
|
1132
|
+
|
1133
|
+
##
|
1134
|
+
# Configuration for the channel pool
|
1135
|
+
# @return [::Gapic::ServiceStub::ChannelPool::Configuration]
|
1136
|
+
#
|
1137
|
+
def channel_pool
|
1138
|
+
@channel_pool ||= ::Gapic::ServiceStub::ChannelPool::Configuration.new
|
1139
|
+
end
|
1140
|
+
|
1141
|
+
##
|
1142
|
+
# Configuration RPC class for the UsageService API.
|
1143
|
+
#
|
1144
|
+
# Includes fields providing the configuration for each RPC in this service.
|
1145
|
+
# Each configuration object is of type `Gapic::Config::Method` and includes
|
1146
|
+
# the following configuration fields:
|
1147
|
+
#
|
1148
|
+
# * `timeout` (*type:* `Numeric`) - The call timeout in seconds
|
1149
|
+
# * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
|
1150
|
+
# * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
|
1151
|
+
# include the following keys:
|
1152
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
1153
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
1154
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
1155
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
1156
|
+
# trigger a retry.
|
1157
|
+
#
|
1158
|
+
class Rpcs
|
1159
|
+
##
|
1160
|
+
# RPC-specific configuration for `query_usage_histories`
|
1161
|
+
# @return [::Gapic::Config::Method]
|
1162
|
+
#
|
1163
|
+
attr_reader :query_usage_histories
|
1164
|
+
##
|
1165
|
+
# RPC-specific configuration for `query_forecasts`
|
1166
|
+
# @return [::Gapic::Config::Method]
|
1167
|
+
#
|
1168
|
+
attr_reader :query_forecasts
|
1169
|
+
##
|
1170
|
+
# RPC-specific configuration for `query_reservations`
|
1171
|
+
# @return [::Gapic::Config::Method]
|
1172
|
+
#
|
1173
|
+
attr_reader :query_reservations
|
1174
|
+
##
|
1175
|
+
# RPC-specific configuration for `export_usage_histories`
|
1176
|
+
# @return [::Gapic::Config::Method]
|
1177
|
+
#
|
1178
|
+
attr_reader :export_usage_histories
|
1179
|
+
##
|
1180
|
+
# RPC-specific configuration for `export_forecasts`
|
1181
|
+
# @return [::Gapic::Config::Method]
|
1182
|
+
#
|
1183
|
+
attr_reader :export_forecasts
|
1184
|
+
##
|
1185
|
+
# RPC-specific configuration for `export_reservations_usage`
|
1186
|
+
# @return [::Gapic::Config::Method]
|
1187
|
+
#
|
1188
|
+
attr_reader :export_reservations_usage
|
1189
|
+
|
1190
|
+
# @private
|
1191
|
+
def initialize parent_rpcs = nil
|
1192
|
+
query_usage_histories_config = parent_rpcs.query_usage_histories if parent_rpcs.respond_to? :query_usage_histories
|
1193
|
+
@query_usage_histories = ::Gapic::Config::Method.new query_usage_histories_config
|
1194
|
+
query_forecasts_config = parent_rpcs.query_forecasts if parent_rpcs.respond_to? :query_forecasts
|
1195
|
+
@query_forecasts = ::Gapic::Config::Method.new query_forecasts_config
|
1196
|
+
query_reservations_config = parent_rpcs.query_reservations if parent_rpcs.respond_to? :query_reservations
|
1197
|
+
@query_reservations = ::Gapic::Config::Method.new query_reservations_config
|
1198
|
+
export_usage_histories_config = parent_rpcs.export_usage_histories if parent_rpcs.respond_to? :export_usage_histories
|
1199
|
+
@export_usage_histories = ::Gapic::Config::Method.new export_usage_histories_config
|
1200
|
+
export_forecasts_config = parent_rpcs.export_forecasts if parent_rpcs.respond_to? :export_forecasts
|
1201
|
+
@export_forecasts = ::Gapic::Config::Method.new export_forecasts_config
|
1202
|
+
export_reservations_usage_config = parent_rpcs.export_reservations_usage if parent_rpcs.respond_to? :export_reservations_usage
|
1203
|
+
@export_reservations_usage = ::Gapic::Config::Method.new export_reservations_usage_config
|
1204
|
+
|
1205
|
+
yield self if block_given?
|
1206
|
+
end
|
1207
|
+
end
|
1208
|
+
end
|
1209
|
+
end
|
1210
|
+
end
|
1211
|
+
end
|
1212
|
+
end
|
1213
|
+
end
|
1214
|
+
end
|