google-cloud-dataproc-v1 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 +7 -0
- data/.yardopts +12 -0
- data/AUTHENTICATION.md +169 -0
- data/LICENSE.md +203 -0
- data/README.md +71 -0
- data/lib/google/cloud/common_resources_pb.rb +15 -0
- data/lib/google/cloud/dataproc/v1/autoscaling_policies_pb.rb +81 -0
- data/lib/google/cloud/dataproc/v1/autoscaling_policies_services_pb.rb +58 -0
- data/lib/google/cloud/dataproc/v1/autoscaling_policy_service/client.rb +734 -0
- data/lib/google/cloud/dataproc/v1/autoscaling_policy_service/credentials.rb +51 -0
- data/lib/google/cloud/dataproc/v1/autoscaling_policy_service/paths.rb +110 -0
- data/lib/google/cloud/dataproc/v1/autoscaling_policy_service.rb +50 -0
- data/lib/google/cloud/dataproc/v1/cluster_controller/client.rb +970 -0
- data/lib/google/cloud/dataproc/v1/cluster_controller/credentials.rb +51 -0
- data/lib/google/cloud/dataproc/v1/cluster_controller/operations.rb +564 -0
- data/lib/google/cloud/dataproc/v1/cluster_controller.rb +50 -0
- data/lib/google/cloud/dataproc/v1/clusters_pb.rb +235 -0
- data/lib/google/cloud/dataproc/v1/clusters_services_pb.rb +68 -0
- data/lib/google/cloud/dataproc/v1/job_controller/client.rb +980 -0
- data/lib/google/cloud/dataproc/v1/job_controller/credentials.rb +51 -0
- data/lib/google/cloud/dataproc/v1/job_controller/operations.rb +564 -0
- data/lib/google/cloud/dataproc/v1/job_controller.rb +49 -0
- data/lib/google/cloud/dataproc/v1/jobs_pb.rb +282 -0
- data/lib/google/cloud/dataproc/v1/jobs_services_pb.rb +62 -0
- data/lib/google/cloud/dataproc/v1/operations_pb.rb +46 -0
- data/lib/google/cloud/dataproc/v1/shared_pb.rb +29 -0
- data/lib/google/cloud/dataproc/v1/version.rb +28 -0
- data/lib/google/cloud/dataproc/v1/workflow_template_service/client.rb +1024 -0
- data/lib/google/cloud/dataproc/v1/workflow_template_service/credentials.rb +51 -0
- data/lib/google/cloud/dataproc/v1/workflow_template_service/operations.rb +564 -0
- data/lib/google/cloud/dataproc/v1/workflow_template_service/paths.rb +110 -0
- data/lib/google/cloud/dataproc/v1/workflow_template_service.rb +51 -0
- data/lib/google/cloud/dataproc/v1/workflow_templates_pb.rb +187 -0
- data/lib/google/cloud/dataproc/v1/workflow_templates_services_pb.rb +104 -0
- data/lib/google/cloud/dataproc/v1.rb +38 -0
- data/lib/google-cloud-dataproc-v1.rb +21 -0
- data/proto_docs/README.md +4 -0
- data/proto_docs/google/api/field_behavior.rb +59 -0
- data/proto_docs/google/api/resource.rb +247 -0
- data/proto_docs/google/cloud/dataproc/v1/autoscaling_policies.rb +272 -0
- data/proto_docs/google/cloud/dataproc/v1/clusters.rb +961 -0
- data/proto_docs/google/cloud/dataproc/v1/jobs.rb +976 -0
- data/proto_docs/google/cloud/dataproc/v1/operations.rb +98 -0
- data/proto_docs/google/cloud/dataproc/v1/shared.rb +50 -0
- data/proto_docs/google/cloud/dataproc/v1/workflow_templates.rb +693 -0
- data/proto_docs/google/longrunning/operations.rb +150 -0
- data/proto_docs/google/protobuf/any.rb +138 -0
- data/proto_docs/google/protobuf/duration.rb +98 -0
- data/proto_docs/google/protobuf/empty.rb +36 -0
- data/proto_docs/google/protobuf/field_mask.rb +229 -0
- data/proto_docs/google/protobuf/timestamp.rb +120 -0
- data/proto_docs/google/rpc/status.rb +46 -0
- metadata +205 -0
@@ -0,0 +1,734 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2020 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/dataproc/v1/autoscaling_policies_pb"
|
21
|
+
|
22
|
+
module Google
|
23
|
+
module Cloud
|
24
|
+
module Dataproc
|
25
|
+
module V1
|
26
|
+
module AutoscalingPolicyService
|
27
|
+
##
|
28
|
+
# Client for the AutoscalingPolicyService service.
|
29
|
+
#
|
30
|
+
# The API interface for managing autoscaling policies in the
|
31
|
+
# Dataproc API.
|
32
|
+
#
|
33
|
+
class Client
|
34
|
+
include Paths
|
35
|
+
|
36
|
+
# @private
|
37
|
+
attr_reader :autoscaling_policy_service_stub
|
38
|
+
|
39
|
+
##
|
40
|
+
# Configure the AutoscalingPolicyService Client class.
|
41
|
+
#
|
42
|
+
# See {Google::Cloud::Dataproc::V1::AutoscalingPolicyService::Client::Configuration}
|
43
|
+
# for a description of the configuration fields.
|
44
|
+
#
|
45
|
+
# ## Example
|
46
|
+
#
|
47
|
+
# To modify the configuration for all AutoscalingPolicyService clients:
|
48
|
+
#
|
49
|
+
# Google::Cloud::Dataproc::V1::AutoscalingPolicyService::Client.configure do |config|
|
50
|
+
# config.timeout = 10_000
|
51
|
+
# end
|
52
|
+
#
|
53
|
+
# @yield [config] Configure the Client client.
|
54
|
+
# @yieldparam config [Client::Configuration]
|
55
|
+
#
|
56
|
+
# @return [Client::Configuration]
|
57
|
+
#
|
58
|
+
def self.configure
|
59
|
+
@configure ||= begin
|
60
|
+
namespace = ["Google", "Cloud", "Dataproc", "V1"]
|
61
|
+
parent_config = while namespace.any?
|
62
|
+
parent_name = namespace.join "::"
|
63
|
+
parent_const = const_get parent_name
|
64
|
+
break parent_const.configure if parent_const&.respond_to? :configure
|
65
|
+
namespace.pop
|
66
|
+
end
|
67
|
+
default_config = Client::Configuration.new parent_config
|
68
|
+
|
69
|
+
default_config.rpcs.create_autoscaling_policy.timeout = 600.0
|
70
|
+
|
71
|
+
default_config.rpcs.update_autoscaling_policy.timeout = 600.0
|
72
|
+
default_config.rpcs.update_autoscaling_policy.retry_policy = {
|
73
|
+
initial_delay: 0.1,
|
74
|
+
max_delay: 60.0,
|
75
|
+
multiplier: 1.3,
|
76
|
+
retry_codes: ["DEADLINE_EXCEEDED", "UNAVAILABLE"]
|
77
|
+
}
|
78
|
+
|
79
|
+
default_config.rpcs.get_autoscaling_policy.timeout = 600.0
|
80
|
+
default_config.rpcs.get_autoscaling_policy.retry_policy = {
|
81
|
+
initial_delay: 0.1,
|
82
|
+
max_delay: 60.0,
|
83
|
+
multiplier: 1.3,
|
84
|
+
retry_codes: ["DEADLINE_EXCEEDED", "UNAVAILABLE"]
|
85
|
+
}
|
86
|
+
|
87
|
+
default_config.rpcs.list_autoscaling_policies.timeout = 600.0
|
88
|
+
default_config.rpcs.list_autoscaling_policies.retry_policy = {
|
89
|
+
initial_delay: 0.1,
|
90
|
+
max_delay: 60.0,
|
91
|
+
multiplier: 1.3,
|
92
|
+
retry_codes: ["DEADLINE_EXCEEDED", "UNAVAILABLE"]
|
93
|
+
}
|
94
|
+
|
95
|
+
default_config.rpcs.delete_autoscaling_policy.timeout = 600.0
|
96
|
+
|
97
|
+
default_config
|
98
|
+
end
|
99
|
+
yield @configure if block_given?
|
100
|
+
@configure
|
101
|
+
end
|
102
|
+
|
103
|
+
##
|
104
|
+
# Configure the AutoscalingPolicyService Client instance.
|
105
|
+
#
|
106
|
+
# The configuration is set to the derived mode, meaning that values can be changed,
|
107
|
+
# but structural changes (adding new fields, etc.) are not allowed. Structural changes
|
108
|
+
# should be made on {Client.configure}.
|
109
|
+
#
|
110
|
+
# See {Google::Cloud::Dataproc::V1::AutoscalingPolicyService::Client::Configuration}
|
111
|
+
# for a description of the configuration fields.
|
112
|
+
#
|
113
|
+
# @yield [config] Configure the Client client.
|
114
|
+
# @yieldparam config [Client::Configuration]
|
115
|
+
#
|
116
|
+
# @return [Client::Configuration]
|
117
|
+
#
|
118
|
+
def configure
|
119
|
+
yield @config if block_given?
|
120
|
+
@config
|
121
|
+
end
|
122
|
+
|
123
|
+
##
|
124
|
+
# Create a new AutoscalingPolicyService client object.
|
125
|
+
#
|
126
|
+
# ## Examples
|
127
|
+
#
|
128
|
+
# To create a new AutoscalingPolicyService client with the default
|
129
|
+
# configuration:
|
130
|
+
#
|
131
|
+
# client = Google::Cloud::Dataproc::V1::AutoscalingPolicyService::Client.new
|
132
|
+
#
|
133
|
+
# To create a new AutoscalingPolicyService client with a custom
|
134
|
+
# configuration:
|
135
|
+
#
|
136
|
+
# client = Google::Cloud::Dataproc::V1::AutoscalingPolicyService::Client.new do |config|
|
137
|
+
# config.timeout = 10_000
|
138
|
+
# end
|
139
|
+
#
|
140
|
+
# @yield [config] Configure the AutoscalingPolicyService client.
|
141
|
+
# @yieldparam config [Client::Configuration]
|
142
|
+
#
|
143
|
+
def initialize
|
144
|
+
# These require statements are intentionally placed here to initialize
|
145
|
+
# the gRPC module only when it's required.
|
146
|
+
# See https://github.com/googleapis/toolkit/issues/446
|
147
|
+
require "gapic/grpc"
|
148
|
+
require "google/cloud/dataproc/v1/autoscaling_policies_services_pb"
|
149
|
+
|
150
|
+
# Create the configuration object
|
151
|
+
@config = Configuration.new Client.configure
|
152
|
+
|
153
|
+
# Yield the configuration if needed
|
154
|
+
yield @config if block_given?
|
155
|
+
|
156
|
+
# Create credentials
|
157
|
+
credentials = @config.credentials
|
158
|
+
credentials ||= Credentials.default scope: @config.scope
|
159
|
+
if credentials.is_a?(String) || credentials.is_a?(Hash)
|
160
|
+
credentials = Credentials.new credentials, scope: @config.scope
|
161
|
+
end
|
162
|
+
@quota_project_id = credentials.respond_to?(:quota_project_id) ? credentials.quota_project_id : nil
|
163
|
+
|
164
|
+
@autoscaling_policy_service_stub = Gapic::ServiceStub.new(
|
165
|
+
Google::Cloud::Dataproc::V1::AutoscalingPolicyService::Stub,
|
166
|
+
credentials: credentials,
|
167
|
+
endpoint: @config.endpoint,
|
168
|
+
channel_args: @config.channel_args,
|
169
|
+
interceptors: @config.interceptors
|
170
|
+
)
|
171
|
+
end
|
172
|
+
|
173
|
+
# Service calls
|
174
|
+
|
175
|
+
##
|
176
|
+
# Creates new autoscaling policy.
|
177
|
+
#
|
178
|
+
# @overload create_autoscaling_policy(request, options = nil)
|
179
|
+
# Pass arguments to `create_autoscaling_policy` via a request object, either of type
|
180
|
+
# {Google::Cloud::Dataproc::V1::CreateAutoscalingPolicyRequest} or an equivalent Hash.
|
181
|
+
#
|
182
|
+
# @param request [Google::Cloud::Dataproc::V1::CreateAutoscalingPolicyRequest, Hash]
|
183
|
+
# A request object representing the call parameters. Required. To specify no
|
184
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
185
|
+
# @param options [Gapic::CallOptions, Hash]
|
186
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
187
|
+
#
|
188
|
+
# @overload create_autoscaling_policy(parent: nil, policy: nil)
|
189
|
+
# Pass arguments to `create_autoscaling_policy` via keyword arguments. Note that at
|
190
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
191
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
192
|
+
#
|
193
|
+
# @param parent [String]
|
194
|
+
# Required. The "resource name" of the region or location, as described
|
195
|
+
# in https://cloud.google.com/apis/design/resource_names.
|
196
|
+
#
|
197
|
+
# * For `projects.regions.autoscalingPolicies.create`, the resource name
|
198
|
+
# of the region has the following format:
|
199
|
+
# `projects/{project_id}/regions/{region}`
|
200
|
+
#
|
201
|
+
# * For `projects.locations.autoscalingPolicies.create`, the resource name
|
202
|
+
# of the location has the following format:
|
203
|
+
# `projects/{project_id}/locations/{location}`
|
204
|
+
# @param policy [Google::Cloud::Dataproc::V1::AutoscalingPolicy, Hash]
|
205
|
+
# Required. The autoscaling policy to create.
|
206
|
+
#
|
207
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
208
|
+
# @yieldparam response [Google::Cloud::Dataproc::V1::AutoscalingPolicy]
|
209
|
+
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
210
|
+
#
|
211
|
+
# @return [Google::Cloud::Dataproc::V1::AutoscalingPolicy]
|
212
|
+
#
|
213
|
+
# @raise [Google::Cloud::Error] if the RPC is aborted.
|
214
|
+
#
|
215
|
+
def create_autoscaling_policy request, options = nil
|
216
|
+
raise ArgumentError, "request must be provided" if request.nil?
|
217
|
+
|
218
|
+
request = Gapic::Protobuf.coerce request, to: Google::Cloud::Dataproc::V1::CreateAutoscalingPolicyRequest
|
219
|
+
|
220
|
+
# Converts hash and nil to an options object
|
221
|
+
options = Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
222
|
+
|
223
|
+
# Customize the options with defaults
|
224
|
+
metadata = @config.rpcs.create_autoscaling_policy.metadata.to_h
|
225
|
+
|
226
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
227
|
+
metadata[:"x-goog-api-client"] ||= Gapic::Headers.x_goog_api_client \
|
228
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
229
|
+
gapic_version: ::Google::Cloud::Dataproc::V1::VERSION
|
230
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
231
|
+
|
232
|
+
header_params = {
|
233
|
+
"parent" => request.parent
|
234
|
+
}
|
235
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
236
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
237
|
+
|
238
|
+
options.apply_defaults timeout: @config.rpcs.create_autoscaling_policy.timeout,
|
239
|
+
metadata: metadata,
|
240
|
+
retry_policy: @config.rpcs.create_autoscaling_policy.retry_policy
|
241
|
+
options.apply_defaults metadata: @config.metadata,
|
242
|
+
retry_policy: @config.retry_policy
|
243
|
+
|
244
|
+
@autoscaling_policy_service_stub.call_rpc :create_autoscaling_policy, request, options: options do |response, operation|
|
245
|
+
yield response, operation if block_given?
|
246
|
+
return response
|
247
|
+
end
|
248
|
+
rescue GRPC::BadStatus => e
|
249
|
+
raise Google::Cloud::Error.from_error(e)
|
250
|
+
end
|
251
|
+
|
252
|
+
##
|
253
|
+
# Updates (replaces) autoscaling policy.
|
254
|
+
#
|
255
|
+
# Disabled check for update_mask, because all updates will be full
|
256
|
+
# replacements.
|
257
|
+
#
|
258
|
+
# @overload update_autoscaling_policy(request, options = nil)
|
259
|
+
# Pass arguments to `update_autoscaling_policy` via a request object, either of type
|
260
|
+
# {Google::Cloud::Dataproc::V1::UpdateAutoscalingPolicyRequest} or an equivalent Hash.
|
261
|
+
#
|
262
|
+
# @param request [Google::Cloud::Dataproc::V1::UpdateAutoscalingPolicyRequest, Hash]
|
263
|
+
# A request object representing the call parameters. Required. To specify no
|
264
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
265
|
+
# @param options [Gapic::CallOptions, Hash]
|
266
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
267
|
+
#
|
268
|
+
# @overload update_autoscaling_policy(policy: nil)
|
269
|
+
# Pass arguments to `update_autoscaling_policy` via keyword arguments. Note that at
|
270
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
271
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
272
|
+
#
|
273
|
+
# @param policy [Google::Cloud::Dataproc::V1::AutoscalingPolicy, Hash]
|
274
|
+
# Required. The updated autoscaling policy.
|
275
|
+
#
|
276
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
277
|
+
# @yieldparam response [Google::Cloud::Dataproc::V1::AutoscalingPolicy]
|
278
|
+
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
279
|
+
#
|
280
|
+
# @return [Google::Cloud::Dataproc::V1::AutoscalingPolicy]
|
281
|
+
#
|
282
|
+
# @raise [Google::Cloud::Error] if the RPC is aborted.
|
283
|
+
#
|
284
|
+
def update_autoscaling_policy request, options = nil
|
285
|
+
raise ArgumentError, "request must be provided" if request.nil?
|
286
|
+
|
287
|
+
request = Gapic::Protobuf.coerce request, to: Google::Cloud::Dataproc::V1::UpdateAutoscalingPolicyRequest
|
288
|
+
|
289
|
+
# Converts hash and nil to an options object
|
290
|
+
options = Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
291
|
+
|
292
|
+
# Customize the options with defaults
|
293
|
+
metadata = @config.rpcs.update_autoscaling_policy.metadata.to_h
|
294
|
+
|
295
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
296
|
+
metadata[:"x-goog-api-client"] ||= Gapic::Headers.x_goog_api_client \
|
297
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
298
|
+
gapic_version: ::Google::Cloud::Dataproc::V1::VERSION
|
299
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
300
|
+
|
301
|
+
header_params = {
|
302
|
+
"policy.name" => request.policy.name
|
303
|
+
}
|
304
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
305
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
306
|
+
|
307
|
+
options.apply_defaults timeout: @config.rpcs.update_autoscaling_policy.timeout,
|
308
|
+
metadata: metadata,
|
309
|
+
retry_policy: @config.rpcs.update_autoscaling_policy.retry_policy
|
310
|
+
options.apply_defaults metadata: @config.metadata,
|
311
|
+
retry_policy: @config.retry_policy
|
312
|
+
|
313
|
+
@autoscaling_policy_service_stub.call_rpc :update_autoscaling_policy, request, options: options do |response, operation|
|
314
|
+
yield response, operation if block_given?
|
315
|
+
return response
|
316
|
+
end
|
317
|
+
rescue GRPC::BadStatus => e
|
318
|
+
raise Google::Cloud::Error.from_error(e)
|
319
|
+
end
|
320
|
+
|
321
|
+
##
|
322
|
+
# Retrieves autoscaling policy.
|
323
|
+
#
|
324
|
+
# @overload get_autoscaling_policy(request, options = nil)
|
325
|
+
# Pass arguments to `get_autoscaling_policy` via a request object, either of type
|
326
|
+
# {Google::Cloud::Dataproc::V1::GetAutoscalingPolicyRequest} or an equivalent Hash.
|
327
|
+
#
|
328
|
+
# @param request [Google::Cloud::Dataproc::V1::GetAutoscalingPolicyRequest, Hash]
|
329
|
+
# A request object representing the call parameters. Required. To specify no
|
330
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
331
|
+
# @param options [Gapic::CallOptions, Hash]
|
332
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
333
|
+
#
|
334
|
+
# @overload get_autoscaling_policy(name: nil)
|
335
|
+
# Pass arguments to `get_autoscaling_policy` via keyword arguments. Note that at
|
336
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
337
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
338
|
+
#
|
339
|
+
# @param name [String]
|
340
|
+
# Required. The "resource name" of the autoscaling policy, as described
|
341
|
+
# in https://cloud.google.com/apis/design/resource_names.
|
342
|
+
#
|
343
|
+
# * For `projects.regions.autoscalingPolicies.get`, the resource name
|
344
|
+
# of the policy has the following format:
|
345
|
+
# `projects/{project_id}/regions/{region}/autoscalingPolicies/{policy_id}`
|
346
|
+
#
|
347
|
+
# * For `projects.locations.autoscalingPolicies.get`, the resource name
|
348
|
+
# of the policy has the following format:
|
349
|
+
# `projects/{project_id}/locations/{location}/autoscalingPolicies/{policy_id}`
|
350
|
+
#
|
351
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
352
|
+
# @yieldparam response [Google::Cloud::Dataproc::V1::AutoscalingPolicy]
|
353
|
+
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
354
|
+
#
|
355
|
+
# @return [Google::Cloud::Dataproc::V1::AutoscalingPolicy]
|
356
|
+
#
|
357
|
+
# @raise [Google::Cloud::Error] if the RPC is aborted.
|
358
|
+
#
|
359
|
+
def get_autoscaling_policy request, options = nil
|
360
|
+
raise ArgumentError, "request must be provided" if request.nil?
|
361
|
+
|
362
|
+
request = Gapic::Protobuf.coerce request, to: Google::Cloud::Dataproc::V1::GetAutoscalingPolicyRequest
|
363
|
+
|
364
|
+
# Converts hash and nil to an options object
|
365
|
+
options = Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
366
|
+
|
367
|
+
# Customize the options with defaults
|
368
|
+
metadata = @config.rpcs.get_autoscaling_policy.metadata.to_h
|
369
|
+
|
370
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
371
|
+
metadata[:"x-goog-api-client"] ||= Gapic::Headers.x_goog_api_client \
|
372
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
373
|
+
gapic_version: ::Google::Cloud::Dataproc::V1::VERSION
|
374
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
375
|
+
|
376
|
+
header_params = {
|
377
|
+
"name" => request.name
|
378
|
+
}
|
379
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
380
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
381
|
+
|
382
|
+
options.apply_defaults timeout: @config.rpcs.get_autoscaling_policy.timeout,
|
383
|
+
metadata: metadata,
|
384
|
+
retry_policy: @config.rpcs.get_autoscaling_policy.retry_policy
|
385
|
+
options.apply_defaults metadata: @config.metadata,
|
386
|
+
retry_policy: @config.retry_policy
|
387
|
+
|
388
|
+
@autoscaling_policy_service_stub.call_rpc :get_autoscaling_policy, request, options: options do |response, operation|
|
389
|
+
yield response, operation if block_given?
|
390
|
+
return response
|
391
|
+
end
|
392
|
+
rescue GRPC::BadStatus => e
|
393
|
+
raise Google::Cloud::Error.from_error(e)
|
394
|
+
end
|
395
|
+
|
396
|
+
##
|
397
|
+
# Lists autoscaling policies in the project.
|
398
|
+
#
|
399
|
+
# @overload list_autoscaling_policies(request, options = nil)
|
400
|
+
# Pass arguments to `list_autoscaling_policies` via a request object, either of type
|
401
|
+
# {Google::Cloud::Dataproc::V1::ListAutoscalingPoliciesRequest} or an equivalent Hash.
|
402
|
+
#
|
403
|
+
# @param request [Google::Cloud::Dataproc::V1::ListAutoscalingPoliciesRequest, Hash]
|
404
|
+
# A request object representing the call parameters. Required. To specify no
|
405
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
406
|
+
# @param options [Gapic::CallOptions, Hash]
|
407
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
408
|
+
#
|
409
|
+
# @overload list_autoscaling_policies(parent: nil, page_size: nil, page_token: nil)
|
410
|
+
# Pass arguments to `list_autoscaling_policies` via keyword arguments. Note that at
|
411
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
412
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
413
|
+
#
|
414
|
+
# @param parent [String]
|
415
|
+
# Required. The "resource name" of the region or location, as described
|
416
|
+
# in https://cloud.google.com/apis/design/resource_names.
|
417
|
+
#
|
418
|
+
# * For `projects.regions.autoscalingPolicies.list`, the resource name
|
419
|
+
# of the region has the following format:
|
420
|
+
# `projects/{project_id}/regions/{region}`
|
421
|
+
#
|
422
|
+
# * For `projects.locations.autoscalingPolicies.list`, the resource name
|
423
|
+
# of the location has the following format:
|
424
|
+
# `projects/{project_id}/locations/{location}`
|
425
|
+
# @param page_size [Integer]
|
426
|
+
# Optional. The maximum number of results to return in each response.
|
427
|
+
# Must be less than or equal to 1000. Defaults to 100.
|
428
|
+
# @param page_token [String]
|
429
|
+
# Optional. The page token, returned by a previous call, to request the
|
430
|
+
# next page of results.
|
431
|
+
#
|
432
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
433
|
+
# @yieldparam response [Gapic::PagedEnumerable<Google::Cloud::Dataproc::V1::AutoscalingPolicy>]
|
434
|
+
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
435
|
+
#
|
436
|
+
# @return [Gapic::PagedEnumerable<Google::Cloud::Dataproc::V1::AutoscalingPolicy>]
|
437
|
+
#
|
438
|
+
# @raise [Google::Cloud::Error] if the RPC is aborted.
|
439
|
+
#
|
440
|
+
def list_autoscaling_policies request, options = nil
|
441
|
+
raise ArgumentError, "request must be provided" if request.nil?
|
442
|
+
|
443
|
+
request = Gapic::Protobuf.coerce request, to: Google::Cloud::Dataproc::V1::ListAutoscalingPoliciesRequest
|
444
|
+
|
445
|
+
# Converts hash and nil to an options object
|
446
|
+
options = Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
447
|
+
|
448
|
+
# Customize the options with defaults
|
449
|
+
metadata = @config.rpcs.list_autoscaling_policies.metadata.to_h
|
450
|
+
|
451
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
452
|
+
metadata[:"x-goog-api-client"] ||= Gapic::Headers.x_goog_api_client \
|
453
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
454
|
+
gapic_version: ::Google::Cloud::Dataproc::V1::VERSION
|
455
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
456
|
+
|
457
|
+
header_params = {
|
458
|
+
"parent" => request.parent
|
459
|
+
}
|
460
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
461
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
462
|
+
|
463
|
+
options.apply_defaults timeout: @config.rpcs.list_autoscaling_policies.timeout,
|
464
|
+
metadata: metadata,
|
465
|
+
retry_policy: @config.rpcs.list_autoscaling_policies.retry_policy
|
466
|
+
options.apply_defaults metadata: @config.metadata,
|
467
|
+
retry_policy: @config.retry_policy
|
468
|
+
|
469
|
+
@autoscaling_policy_service_stub.call_rpc :list_autoscaling_policies, request, options: options do |response, operation|
|
470
|
+
response = Gapic::PagedEnumerable.new @autoscaling_policy_service_stub, :list_autoscaling_policies, request, response, operation, options
|
471
|
+
yield response, operation if block_given?
|
472
|
+
return response
|
473
|
+
end
|
474
|
+
rescue GRPC::BadStatus => e
|
475
|
+
raise Google::Cloud::Error.from_error(e)
|
476
|
+
end
|
477
|
+
|
478
|
+
##
|
479
|
+
# Deletes an autoscaling policy. It is an error to delete an autoscaling
|
480
|
+
# policy that is in use by one or more clusters.
|
481
|
+
#
|
482
|
+
# @overload delete_autoscaling_policy(request, options = nil)
|
483
|
+
# Pass arguments to `delete_autoscaling_policy` via a request object, either of type
|
484
|
+
# {Google::Cloud::Dataproc::V1::DeleteAutoscalingPolicyRequest} or an equivalent Hash.
|
485
|
+
#
|
486
|
+
# @param request [Google::Cloud::Dataproc::V1::DeleteAutoscalingPolicyRequest, Hash]
|
487
|
+
# A request object representing the call parameters. Required. To specify no
|
488
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
489
|
+
# @param options [Gapic::CallOptions, Hash]
|
490
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
491
|
+
#
|
492
|
+
# @overload delete_autoscaling_policy(name: nil)
|
493
|
+
# Pass arguments to `delete_autoscaling_policy` via keyword arguments. Note that at
|
494
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
495
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
496
|
+
#
|
497
|
+
# @param name [String]
|
498
|
+
# Required. The "resource name" of the autoscaling policy, as described
|
499
|
+
# in https://cloud.google.com/apis/design/resource_names.
|
500
|
+
#
|
501
|
+
# * For `projects.regions.autoscalingPolicies.delete`, the resource name
|
502
|
+
# of the policy has the following format:
|
503
|
+
# `projects/{project_id}/regions/{region}/autoscalingPolicies/{policy_id}`
|
504
|
+
#
|
505
|
+
# * For `projects.locations.autoscalingPolicies.delete`, the resource name
|
506
|
+
# of the policy has the following format:
|
507
|
+
# `projects/{project_id}/locations/{location}/autoscalingPolicies/{policy_id}`
|
508
|
+
#
|
509
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
510
|
+
# @yieldparam response [Google::Protobuf::Empty]
|
511
|
+
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
512
|
+
#
|
513
|
+
# @return [Google::Protobuf::Empty]
|
514
|
+
#
|
515
|
+
# @raise [Google::Cloud::Error] if the RPC is aborted.
|
516
|
+
#
|
517
|
+
def delete_autoscaling_policy request, options = nil
|
518
|
+
raise ArgumentError, "request must be provided" if request.nil?
|
519
|
+
|
520
|
+
request = Gapic::Protobuf.coerce request, to: Google::Cloud::Dataproc::V1::DeleteAutoscalingPolicyRequest
|
521
|
+
|
522
|
+
# Converts hash and nil to an options object
|
523
|
+
options = Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
524
|
+
|
525
|
+
# Customize the options with defaults
|
526
|
+
metadata = @config.rpcs.delete_autoscaling_policy.metadata.to_h
|
527
|
+
|
528
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
529
|
+
metadata[:"x-goog-api-client"] ||= Gapic::Headers.x_goog_api_client \
|
530
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
531
|
+
gapic_version: ::Google::Cloud::Dataproc::V1::VERSION
|
532
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
533
|
+
|
534
|
+
header_params = {
|
535
|
+
"name" => request.name
|
536
|
+
}
|
537
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
538
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
539
|
+
|
540
|
+
options.apply_defaults timeout: @config.rpcs.delete_autoscaling_policy.timeout,
|
541
|
+
metadata: metadata,
|
542
|
+
retry_policy: @config.rpcs.delete_autoscaling_policy.retry_policy
|
543
|
+
options.apply_defaults metadata: @config.metadata,
|
544
|
+
retry_policy: @config.retry_policy
|
545
|
+
|
546
|
+
@autoscaling_policy_service_stub.call_rpc :delete_autoscaling_policy, request, options: options do |response, operation|
|
547
|
+
yield response, operation if block_given?
|
548
|
+
return response
|
549
|
+
end
|
550
|
+
rescue GRPC::BadStatus => e
|
551
|
+
raise Google::Cloud::Error.from_error(e)
|
552
|
+
end
|
553
|
+
|
554
|
+
##
|
555
|
+
# Configuration class for the AutoscalingPolicyService API.
|
556
|
+
#
|
557
|
+
# This class represents the configuration for AutoscalingPolicyService,
|
558
|
+
# providing control over timeouts, retry behavior, logging, transport
|
559
|
+
# parameters, and other low-level controls. Certain parameters can also be
|
560
|
+
# applied individually to specific RPCs. See
|
561
|
+
# {Google::Cloud::Dataproc::V1::AutoscalingPolicyService::Client::Configuration::Rpcs}
|
562
|
+
# for a list of RPCs that can be configured independently.
|
563
|
+
#
|
564
|
+
# Configuration can be applied globally to all clients, or to a single client
|
565
|
+
# on construction.
|
566
|
+
#
|
567
|
+
# # Examples
|
568
|
+
#
|
569
|
+
# To modify the global config, setting the timeout for create_autoscaling_policy
|
570
|
+
# to 20 seconds, and all remaining timeouts to 10 seconds:
|
571
|
+
#
|
572
|
+
# Google::Cloud::Dataproc::V1::AutoscalingPolicyService::Client.configure do |config|
|
573
|
+
# config.timeout = 10_000
|
574
|
+
# config.rpcs.create_autoscaling_policy.timeout = 20_000
|
575
|
+
# end
|
576
|
+
#
|
577
|
+
# To apply the above configuration only to a new client:
|
578
|
+
#
|
579
|
+
# client = Google::Cloud::Dataproc::V1::AutoscalingPolicyService::Client.new do |config|
|
580
|
+
# config.timeout = 10_000
|
581
|
+
# config.rpcs.create_autoscaling_policy.timeout = 20_000
|
582
|
+
# end
|
583
|
+
#
|
584
|
+
# @!attribute [rw] endpoint
|
585
|
+
# The hostname or hostname:port of the service endpoint.
|
586
|
+
# Defaults to `"dataproc.googleapis.com"`.
|
587
|
+
# @return [String]
|
588
|
+
# @!attribute [rw] credentials
|
589
|
+
# Credentials to send with calls. You may provide any of the following types:
|
590
|
+
# * (`String`) The path to a service account key file in JSON format
|
591
|
+
# * (`Hash`) A service account key as a Hash
|
592
|
+
# * (`Google::Auth::Credentials`) A googleauth credentials object
|
593
|
+
# (see the [googleauth docs](https://googleapis.dev/ruby/googleauth/latest/index.html))
|
594
|
+
# * (`Signet::OAuth2::Client`) A signet oauth2 client object
|
595
|
+
# (see the [signet docs](https://googleapis.dev/ruby/signet/latest/Signet/OAuth2/Client.html))
|
596
|
+
# * (`GRPC::Core::Channel`) a gRPC channel with included credentials
|
597
|
+
# * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
|
598
|
+
# * (`nil`) indicating no credentials
|
599
|
+
# @return [Object]
|
600
|
+
# @!attribute [rw] scope
|
601
|
+
# The OAuth scopes
|
602
|
+
# @return [Array<String>]
|
603
|
+
# @!attribute [rw] lib_name
|
604
|
+
# The library name as recorded in instrumentation and logging
|
605
|
+
# @return [String]
|
606
|
+
# @!attribute [rw] lib_version
|
607
|
+
# The library version as recorded in instrumentation and logging
|
608
|
+
# @return [String]
|
609
|
+
# @!attribute [rw] channel_args
|
610
|
+
# Extra parameters passed to the gRPC channel. Note: this is ignored if a
|
611
|
+
# `GRPC::Core::Channel` object is provided as the credential.
|
612
|
+
# @return [Hash]
|
613
|
+
# @!attribute [rw] interceptors
|
614
|
+
# An array of interceptors that are run before calls are executed.
|
615
|
+
# @return [Array<GRPC::ClientInterceptor>]
|
616
|
+
# @!attribute [rw] timeout
|
617
|
+
# The call timeout in milliseconds.
|
618
|
+
# @return [Numeric]
|
619
|
+
# @!attribute [rw] metadata
|
620
|
+
# Additional gRPC headers to be sent with the call.
|
621
|
+
# @return [Hash{Symbol=>String}]
|
622
|
+
# @!attribute [rw] retry_policy
|
623
|
+
# The retry policy. The value is a hash with the following keys:
|
624
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
625
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
626
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
627
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
628
|
+
# trigger a retry.
|
629
|
+
# @return [Hash]
|
630
|
+
#
|
631
|
+
class Configuration
|
632
|
+
extend Gapic::Config
|
633
|
+
|
634
|
+
config_attr :endpoint, "dataproc.googleapis.com", String
|
635
|
+
config_attr :credentials, nil do |value|
|
636
|
+
allowed = [::String, ::Hash, ::Proc, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
|
637
|
+
allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
|
638
|
+
allowed.any? { |klass| klass === value }
|
639
|
+
end
|
640
|
+
config_attr :scope, nil, String, Array, nil
|
641
|
+
config_attr :lib_name, nil, String, nil
|
642
|
+
config_attr :lib_version, nil, String, nil
|
643
|
+
config_attr(:channel_args, { "grpc.service_config_disable_resolution"=>1 }, Hash, nil)
|
644
|
+
config_attr :interceptors, nil, Array, nil
|
645
|
+
config_attr :timeout, nil, Numeric, nil
|
646
|
+
config_attr :metadata, nil, Hash, nil
|
647
|
+
config_attr :retry_policy, nil, Hash, Proc, nil
|
648
|
+
|
649
|
+
# @private
|
650
|
+
def initialize parent_config = nil
|
651
|
+
@parent_config = parent_config unless parent_config.nil?
|
652
|
+
|
653
|
+
yield self if block_given?
|
654
|
+
end
|
655
|
+
|
656
|
+
##
|
657
|
+
# Configurations for individual RPCs
|
658
|
+
# @return [Rpcs]
|
659
|
+
#
|
660
|
+
def rpcs
|
661
|
+
@rpcs ||= begin
|
662
|
+
parent_rpcs = nil
|
663
|
+
parent_rpcs = @parent_config.rpcs if @parent_config&.respond_to? :rpcs
|
664
|
+
Rpcs.new parent_rpcs
|
665
|
+
end
|
666
|
+
end
|
667
|
+
|
668
|
+
##
|
669
|
+
# Configuration RPC class for the AutoscalingPolicyService API.
|
670
|
+
#
|
671
|
+
# Includes fields providing the configuration for each RPC in this service.
|
672
|
+
# Each configuration object is of type `Gapic::Config::Method` and includes
|
673
|
+
# the following configuration fields:
|
674
|
+
#
|
675
|
+
# * `timeout` (*type:* `Numeric`) - The call timeout in milliseconds
|
676
|
+
# * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
|
677
|
+
# * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
|
678
|
+
# include the following keys:
|
679
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
680
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
681
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
682
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
683
|
+
# trigger a retry.
|
684
|
+
#
|
685
|
+
class Rpcs
|
686
|
+
##
|
687
|
+
# RPC-specific configuration for `create_autoscaling_policy`
|
688
|
+
# @return [Gapic::Config::Method]
|
689
|
+
#
|
690
|
+
attr_reader :create_autoscaling_policy
|
691
|
+
##
|
692
|
+
# RPC-specific configuration for `update_autoscaling_policy`
|
693
|
+
# @return [Gapic::Config::Method]
|
694
|
+
#
|
695
|
+
attr_reader :update_autoscaling_policy
|
696
|
+
##
|
697
|
+
# RPC-specific configuration for `get_autoscaling_policy`
|
698
|
+
# @return [Gapic::Config::Method]
|
699
|
+
#
|
700
|
+
attr_reader :get_autoscaling_policy
|
701
|
+
##
|
702
|
+
# RPC-specific configuration for `list_autoscaling_policies`
|
703
|
+
# @return [Gapic::Config::Method]
|
704
|
+
#
|
705
|
+
attr_reader :list_autoscaling_policies
|
706
|
+
##
|
707
|
+
# RPC-specific configuration for `delete_autoscaling_policy`
|
708
|
+
# @return [Gapic::Config::Method]
|
709
|
+
#
|
710
|
+
attr_reader :delete_autoscaling_policy
|
711
|
+
|
712
|
+
# @private
|
713
|
+
def initialize parent_rpcs = nil
|
714
|
+
create_autoscaling_policy_config = parent_rpcs&.create_autoscaling_policy if parent_rpcs&.respond_to? :create_autoscaling_policy
|
715
|
+
@create_autoscaling_policy = Gapic::Config::Method.new create_autoscaling_policy_config
|
716
|
+
update_autoscaling_policy_config = parent_rpcs&.update_autoscaling_policy if parent_rpcs&.respond_to? :update_autoscaling_policy
|
717
|
+
@update_autoscaling_policy = Gapic::Config::Method.new update_autoscaling_policy_config
|
718
|
+
get_autoscaling_policy_config = parent_rpcs&.get_autoscaling_policy if parent_rpcs&.respond_to? :get_autoscaling_policy
|
719
|
+
@get_autoscaling_policy = Gapic::Config::Method.new get_autoscaling_policy_config
|
720
|
+
list_autoscaling_policies_config = parent_rpcs&.list_autoscaling_policies if parent_rpcs&.respond_to? :list_autoscaling_policies
|
721
|
+
@list_autoscaling_policies = Gapic::Config::Method.new list_autoscaling_policies_config
|
722
|
+
delete_autoscaling_policy_config = parent_rpcs&.delete_autoscaling_policy if parent_rpcs&.respond_to? :delete_autoscaling_policy
|
723
|
+
@delete_autoscaling_policy = Gapic::Config::Method.new delete_autoscaling_policy_config
|
724
|
+
|
725
|
+
yield self if block_given?
|
726
|
+
end
|
727
|
+
end
|
728
|
+
end
|
729
|
+
end
|
730
|
+
end
|
731
|
+
end
|
732
|
+
end
|
733
|
+
end
|
734
|
+
end
|