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