google-cloud-dataproc-v1 0.16.0 → 0.18.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (58) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +2 -2
  3. data/lib/google/cloud/dataproc/v1/autoscaling_policies_pb.rb +25 -51
  4. data/lib/google/cloud/dataproc/v1/autoscaling_policy_service/client.rb +6 -4
  5. data/lib/google/cloud/dataproc/v1/autoscaling_policy_service/rest/client.rb +713 -0
  6. data/lib/google/cloud/dataproc/v1/autoscaling_policy_service/rest/service_stub.rb +382 -0
  7. data/lib/google/cloud/dataproc/v1/autoscaling_policy_service/rest.rb +54 -0
  8. data/lib/google/cloud/dataproc/v1/autoscaling_policy_service.rb +6 -0
  9. data/lib/google/cloud/dataproc/v1/batch_controller/client.rb +6 -4
  10. data/lib/google/cloud/dataproc/v1/batch_controller/operations.rb +5 -3
  11. data/lib/google/cloud/dataproc/v1/batch_controller/rest/client.rb +642 -0
  12. data/lib/google/cloud/dataproc/v1/batch_controller/rest/operations.rb +822 -0
  13. data/lib/google/cloud/dataproc/v1/batch_controller/rest/service_stub.rb +285 -0
  14. data/lib/google/cloud/dataproc/v1/batch_controller/rest.rb +54 -0
  15. data/lib/google/cloud/dataproc/v1/batch_controller.rb +6 -0
  16. data/lib/google/cloud/dataproc/v1/batches_pb.rb +26 -88
  17. data/lib/google/cloud/dataproc/v1/bindings_override.rb +257 -0
  18. data/lib/google/cloud/dataproc/v1/cluster_controller/client.rb +6 -4
  19. data/lib/google/cloud/dataproc/v1/cluster_controller/operations.rb +5 -3
  20. data/lib/google/cloud/dataproc/v1/cluster_controller/rest/client.rb +1119 -0
  21. data/lib/google/cloud/dataproc/v1/cluster_controller/rest/operations.rb +822 -0
  22. data/lib/google/cloud/dataproc/v1/cluster_controller/rest/service_stub.rb +539 -0
  23. data/lib/google/cloud/dataproc/v1/cluster_controller/rest.rb +55 -0
  24. data/lib/google/cloud/dataproc/v1/cluster_controller.rb +6 -0
  25. data/lib/google/cloud/dataproc/v1/clusters_pb.rb +28 -289
  26. data/lib/google/cloud/dataproc/v1/job_controller/client.rb +6 -4
  27. data/lib/google/cloud/dataproc/v1/job_controller/operations.rb +5 -3
  28. data/lib/google/cloud/dataproc/v1/job_controller/rest/client.rb +931 -0
  29. data/lib/google/cloud/dataproc/v1/job_controller/rest/operations.rb +822 -0
  30. data/lib/google/cloud/dataproc/v1/job_controller/rest/service_stub.rb +476 -0
  31. data/lib/google/cloud/dataproc/v1/job_controller/rest.rb +53 -0
  32. data/lib/google/cloud/dataproc/v1/job_controller.rb +6 -0
  33. data/lib/google/cloud/dataproc/v1/jobs_pb.rb +26 -248
  34. data/lib/google/cloud/dataproc/v1/node_group_controller/client.rb +6 -4
  35. data/lib/google/cloud/dataproc/v1/node_group_controller/operations.rb +5 -3
  36. data/lib/google/cloud/dataproc/v1/node_group_controller/rest/client.rb +583 -0
  37. data/lib/google/cloud/dataproc/v1/node_group_controller/rest/operations.rb +822 -0
  38. data/lib/google/cloud/dataproc/v1/node_group_controller/rest/service_stub.rb +227 -0
  39. data/lib/google/cloud/dataproc/v1/node_group_controller/rest.rb +55 -0
  40. data/lib/google/cloud/dataproc/v1/node_group_controller.rb +6 -0
  41. data/lib/google/cloud/dataproc/v1/node_groups_pb.rb +26 -16
  42. data/lib/google/cloud/dataproc/v1/operations_pb.rb +25 -55
  43. data/lib/google/cloud/dataproc/v1/rest.rb +43 -0
  44. data/lib/google/cloud/dataproc/v1/shared_pb.rb +26 -116
  45. data/lib/google/cloud/dataproc/v1/version.rb +1 -1
  46. data/lib/google/cloud/dataproc/v1/workflow_template_service/client.rb +6 -4
  47. data/lib/google/cloud/dataproc/v1/workflow_template_service/operations.rb +5 -3
  48. data/lib/google/cloud/dataproc/v1/workflow_template_service/rest/client.rb +985 -0
  49. data/lib/google/cloud/dataproc/v1/workflow_template_service/rest/operations.rb +822 -0
  50. data/lib/google/cloud/dataproc/v1/workflow_template_service/rest/service_stub.rb +518 -0
  51. data/lib/google/cloud/dataproc/v1/workflow_template_service/rest.rb +55 -0
  52. data/lib/google/cloud/dataproc/v1/workflow_template_service.rb +6 -0
  53. data/lib/google/cloud/dataproc/v1/workflow_templates_pb.rb +28 -142
  54. data/lib/google/cloud/dataproc/v1.rb +5 -0
  55. data/proto_docs/google/api/client.rb +67 -4
  56. data/proto_docs/google/protobuf/any.rb +7 -4
  57. data/proto_docs/google/protobuf/timestamp.rb +1 -3
  58. metadata +30 -5
@@ -0,0 +1,713 @@
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 == Configuration::DEFAULT_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://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
571
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
572
+ # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
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
+ DEFAULT_ENDPOINT = "dataproc.googleapis.com"
606
+
607
+ config_attr :endpoint, DEFAULT_ENDPOINT, ::String
608
+ config_attr :credentials, nil do |value|
609
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
610
+ allowed.any? { |klass| klass === value }
611
+ end
612
+ config_attr :scope, nil, ::String, ::Array, nil
613
+ config_attr :lib_name, nil, ::String, nil
614
+ config_attr :lib_version, nil, ::String, nil
615
+ config_attr :timeout, nil, ::Numeric, nil
616
+ config_attr :metadata, nil, ::Hash, nil
617
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
618
+ config_attr :quota_project, nil, ::String, nil
619
+
620
+ # @private
621
+ # Overrides for http bindings for the RPCs of this service
622
+ # are only used when this service is used as mixin, and only
623
+ # by the host service.
624
+ # @return [::Hash{::Symbol=>::Array<::Gapic::Rest::GrpcTranscoder::HttpBinding>}]
625
+ config_attr :bindings_override, {}, ::Hash, nil
626
+
627
+ # @private
628
+ def initialize parent_config = nil
629
+ @parent_config = parent_config unless parent_config.nil?
630
+
631
+ yield self if block_given?
632
+ end
633
+
634
+ ##
635
+ # Configurations for individual RPCs
636
+ # @return [Rpcs]
637
+ #
638
+ def rpcs
639
+ @rpcs ||= begin
640
+ parent_rpcs = nil
641
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
642
+ Rpcs.new parent_rpcs
643
+ end
644
+ end
645
+
646
+ ##
647
+ # Configuration RPC class for the AutoscalingPolicyService API.
648
+ #
649
+ # Includes fields providing the configuration for each RPC in this service.
650
+ # Each configuration object is of type `Gapic::Config::Method` and includes
651
+ # the following configuration fields:
652
+ #
653
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
654
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers
655
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
656
+ # include the following keys:
657
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
658
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
659
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
660
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
661
+ # trigger a retry.
662
+ #
663
+ class Rpcs
664
+ ##
665
+ # RPC-specific configuration for `create_autoscaling_policy`
666
+ # @return [::Gapic::Config::Method]
667
+ #
668
+ attr_reader :create_autoscaling_policy
669
+ ##
670
+ # RPC-specific configuration for `update_autoscaling_policy`
671
+ # @return [::Gapic::Config::Method]
672
+ #
673
+ attr_reader :update_autoscaling_policy
674
+ ##
675
+ # RPC-specific configuration for `get_autoscaling_policy`
676
+ # @return [::Gapic::Config::Method]
677
+ #
678
+ attr_reader :get_autoscaling_policy
679
+ ##
680
+ # RPC-specific configuration for `list_autoscaling_policies`
681
+ # @return [::Gapic::Config::Method]
682
+ #
683
+ attr_reader :list_autoscaling_policies
684
+ ##
685
+ # RPC-specific configuration for `delete_autoscaling_policy`
686
+ # @return [::Gapic::Config::Method]
687
+ #
688
+ attr_reader :delete_autoscaling_policy
689
+
690
+ # @private
691
+ def initialize parent_rpcs = nil
692
+ create_autoscaling_policy_config = parent_rpcs.create_autoscaling_policy if parent_rpcs.respond_to? :create_autoscaling_policy
693
+ @create_autoscaling_policy = ::Gapic::Config::Method.new create_autoscaling_policy_config
694
+ update_autoscaling_policy_config = parent_rpcs.update_autoscaling_policy if parent_rpcs.respond_to? :update_autoscaling_policy
695
+ @update_autoscaling_policy = ::Gapic::Config::Method.new update_autoscaling_policy_config
696
+ get_autoscaling_policy_config = parent_rpcs.get_autoscaling_policy if parent_rpcs.respond_to? :get_autoscaling_policy
697
+ @get_autoscaling_policy = ::Gapic::Config::Method.new get_autoscaling_policy_config
698
+ list_autoscaling_policies_config = parent_rpcs.list_autoscaling_policies if parent_rpcs.respond_to? :list_autoscaling_policies
699
+ @list_autoscaling_policies = ::Gapic::Config::Method.new list_autoscaling_policies_config
700
+ delete_autoscaling_policy_config = parent_rpcs.delete_autoscaling_policy if parent_rpcs.respond_to? :delete_autoscaling_policy
701
+ @delete_autoscaling_policy = ::Gapic::Config::Method.new delete_autoscaling_policy_config
702
+
703
+ yield self if block_given?
704
+ end
705
+ end
706
+ end
707
+ end
708
+ end
709
+ end
710
+ end
711
+ end
712
+ end
713
+ end