google-cloud-dataproc 0.10.0 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (72) hide show
  1. checksums.yaml +4 -4
  2. data/.yardopts +3 -2
  3. data/AUTHENTICATION.md +51 -59
  4. data/LICENSE.md +203 -0
  5. data/MIGRATING.md +310 -0
  6. data/README.md +33 -44
  7. data/lib/{google/cloud/dataproc/v1/doc/google/protobuf/empty.rb → google-cloud-dataproc.rb} +4 -14
  8. data/lib/google/cloud/dataproc.rb +167 -305
  9. data/lib/google/cloud/dataproc/version.rb +6 -2
  10. metadata +97 -100
  11. data/LICENSE +0 -201
  12. data/lib/google/cloud/dataproc/v1.rb +0 -371
  13. data/lib/google/cloud/dataproc/v1/autoscaling_policies_pb.rb +0 -80
  14. data/lib/google/cloud/dataproc/v1/autoscaling_policies_services_pb.rb +0 -59
  15. data/lib/google/cloud/dataproc/v1/autoscaling_policy_service_client.rb +0 -494
  16. data/lib/google/cloud/dataproc/v1/autoscaling_policy_service_client_config.json +0 -51
  17. data/lib/google/cloud/dataproc/v1/cluster_controller_client.rb +0 -824
  18. data/lib/google/cloud/dataproc/v1/cluster_controller_client_config.json +0 -59
  19. data/lib/google/cloud/dataproc/v1/clusters_pb.rb +0 -234
  20. data/lib/google/cloud/dataproc/v1/clusters_services_pb.rb +0 -69
  21. data/lib/google/cloud/dataproc/v1/credentials.rb +0 -41
  22. data/lib/google/cloud/dataproc/v1/doc/google/cloud/dataproc/v1/autoscaling_policies.rb +0 -238
  23. data/lib/google/cloud/dataproc/v1/doc/google/cloud/dataproc/v1/clusters.rb +0 -819
  24. data/lib/google/cloud/dataproc/v1/doc/google/cloud/dataproc/v1/jobs.rb +0 -759
  25. data/lib/google/cloud/dataproc/v1/doc/google/cloud/dataproc/v1/workflow_templates.rb +0 -566
  26. data/lib/google/cloud/dataproc/v1/doc/google/longrunning/operations.rb +0 -51
  27. data/lib/google/cloud/dataproc/v1/doc/google/protobuf/any.rb +0 -131
  28. data/lib/google/cloud/dataproc/v1/doc/google/protobuf/duration.rb +0 -91
  29. data/lib/google/cloud/dataproc/v1/doc/google/protobuf/field_mask.rb +0 -222
  30. data/lib/google/cloud/dataproc/v1/doc/google/protobuf/timestamp.rb +0 -113
  31. data/lib/google/cloud/dataproc/v1/doc/google/rpc/status.rb +0 -39
  32. data/lib/google/cloud/dataproc/v1/job_controller_client.rb +0 -592
  33. data/lib/google/cloud/dataproc/v1/job_controller_client_config.json +0 -59
  34. data/lib/google/cloud/dataproc/v1/jobs_pb.rb +0 -273
  35. data/lib/google/cloud/dataproc/v1/jobs_services_pb.rb +0 -61
  36. data/lib/google/cloud/dataproc/v1/operations_pb.rb +0 -45
  37. data/lib/google/cloud/dataproc/v1/shared_pb.rb +0 -26
  38. data/lib/google/cloud/dataproc/v1/workflow_template_service_client.rb +0 -770
  39. data/lib/google/cloud/dataproc/v1/workflow_template_service_client_config.json +0 -64
  40. data/lib/google/cloud/dataproc/v1/workflow_templates_pb.rb +0 -184
  41. data/lib/google/cloud/dataproc/v1/workflow_templates_services_pb.rb +0 -105
  42. data/lib/google/cloud/dataproc/v1beta2.rb +0 -371
  43. data/lib/google/cloud/dataproc/v1beta2/autoscaling_policies_pb.rb +0 -80
  44. data/lib/google/cloud/dataproc/v1beta2/autoscaling_policies_services_pb.rb +0 -59
  45. data/lib/google/cloud/dataproc/v1beta2/autoscaling_policy_service_client.rb +0 -494
  46. data/lib/google/cloud/dataproc/v1beta2/autoscaling_policy_service_client_config.json +0 -51
  47. data/lib/google/cloud/dataproc/v1beta2/cluster_controller_client.rb +0 -833
  48. data/lib/google/cloud/dataproc/v1beta2/cluster_controller_client_config.json +0 -59
  49. data/lib/google/cloud/dataproc/v1beta2/clusters_pb.rb +0 -241
  50. data/lib/google/cloud/dataproc/v1beta2/clusters_services_pb.rb +0 -69
  51. data/lib/google/cloud/dataproc/v1beta2/credentials.rb +0 -41
  52. data/lib/google/cloud/dataproc/v1beta2/doc/google/cloud/dataproc/v1beta2/autoscaling_policies.rb +0 -238
  53. data/lib/google/cloud/dataproc/v1beta2/doc/google/cloud/dataproc/v1beta2/clusters.rb +0 -841
  54. data/lib/google/cloud/dataproc/v1beta2/doc/google/cloud/dataproc/v1beta2/jobs.rb +0 -728
  55. data/lib/google/cloud/dataproc/v1beta2/doc/google/cloud/dataproc/v1beta2/workflow_templates.rb +0 -579
  56. data/lib/google/cloud/dataproc/v1beta2/doc/google/longrunning/operations.rb +0 -51
  57. data/lib/google/cloud/dataproc/v1beta2/doc/google/protobuf/any.rb +0 -131
  58. data/lib/google/cloud/dataproc/v1beta2/doc/google/protobuf/duration.rb +0 -91
  59. data/lib/google/cloud/dataproc/v1beta2/doc/google/protobuf/empty.rb +0 -29
  60. data/lib/google/cloud/dataproc/v1beta2/doc/google/protobuf/field_mask.rb +0 -222
  61. data/lib/google/cloud/dataproc/v1beta2/doc/google/protobuf/timestamp.rb +0 -113
  62. data/lib/google/cloud/dataproc/v1beta2/doc/google/rpc/status.rb +0 -39
  63. data/lib/google/cloud/dataproc/v1beta2/job_controller_client.rb +0 -592
  64. data/lib/google/cloud/dataproc/v1beta2/job_controller_client_config.json +0 -59
  65. data/lib/google/cloud/dataproc/v1beta2/jobs_pb.rb +0 -261
  66. data/lib/google/cloud/dataproc/v1beta2/jobs_services_pb.rb +0 -61
  67. data/lib/google/cloud/dataproc/v1beta2/operations_pb.rb +0 -44
  68. data/lib/google/cloud/dataproc/v1beta2/shared_pb.rb +0 -30
  69. data/lib/google/cloud/dataproc/v1beta2/workflow_template_service_client.rb +0 -778
  70. data/lib/google/cloud/dataproc/v1beta2/workflow_template_service_client_config.json +0 -64
  71. data/lib/google/cloud/dataproc/v1beta2/workflow_templates_pb.rb +0 -186
  72. data/lib/google/cloud/dataproc/v1beta2/workflow_templates_services_pb.rb +0 -105
@@ -1,51 +0,0 @@
1
- {
2
- "interfaces": {
3
- "google.cloud.dataproc.v1beta2.AutoscalingPolicyService": {
4
- "retry_codes": {
5
- "idempotent": [
6
- "DEADLINE_EXCEEDED",
7
- "UNAVAILABLE"
8
- ],
9
- "non_idempotent": []
10
- },
11
- "retry_params": {
12
- "default": {
13
- "initial_retry_delay_millis": 100,
14
- "retry_delay_multiplier": 1.3,
15
- "max_retry_delay_millis": 60000,
16
- "initial_rpc_timeout_millis": 20000,
17
- "rpc_timeout_multiplier": 1.0,
18
- "max_rpc_timeout_millis": 20000,
19
- "total_timeout_millis": 600000
20
- }
21
- },
22
- "methods": {
23
- "CreateAutoscalingPolicy": {
24
- "timeout_millis": 60000,
25
- "retry_codes_name": "non_idempotent",
26
- "retry_params_name": "default"
27
- },
28
- "UpdateAutoscalingPolicy": {
29
- "timeout_millis": 60000,
30
- "retry_codes_name": "idempotent",
31
- "retry_params_name": "default"
32
- },
33
- "GetAutoscalingPolicy": {
34
- "timeout_millis": 60000,
35
- "retry_codes_name": "idempotent",
36
- "retry_params_name": "default"
37
- },
38
- "ListAutoscalingPolicies": {
39
- "timeout_millis": 60000,
40
- "retry_codes_name": "idempotent",
41
- "retry_params_name": "default"
42
- },
43
- "DeleteAutoscalingPolicy": {
44
- "timeout_millis": 60000,
45
- "retry_codes_name": "non_idempotent",
46
- "retry_params_name": "default"
47
- }
48
- }
49
- }
50
- }
51
- }
@@ -1,833 +0,0 @@
1
- # Copyright 2020 Google LLC
2
- #
3
- # Licensed under the Apache License, Version 2.0 (the "License");
4
- # you may not use this file except in compliance with the License.
5
- # You may obtain a copy of the License at
6
- #
7
- # https://www.apache.org/licenses/LICENSE-2.0
8
- #
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- # See the License for the specific language governing permissions and
13
- # limitations under the License.
14
- #
15
- # EDITING INSTRUCTIONS
16
- # This file was generated from the file
17
- # https://github.com/googleapis/googleapis/blob/master/google/cloud/dataproc/v1beta2/clusters.proto,
18
- # and updates to that file get reflected here through a refresh process.
19
- # For the short term, the refresh process will only be runnable by Google
20
- # engineers.
21
-
22
-
23
- require "json"
24
- require "pathname"
25
-
26
- require "google/gax"
27
- require "google/gax/operation"
28
- require "google/longrunning/operations_client"
29
-
30
- require "google/cloud/dataproc/v1beta2/clusters_pb"
31
- require "google/cloud/dataproc/v1beta2/credentials"
32
- require "google/cloud/dataproc/version"
33
-
34
- module Google
35
- module Cloud
36
- module Dataproc
37
- module V1beta2
38
- # The ClusterControllerService provides methods to manage clusters
39
- # of Compute Engine instances.
40
- #
41
- # @!attribute [r] cluster_controller_stub
42
- # @return [Google::Cloud::Dataproc::V1beta2::ClusterController::Stub]
43
- class ClusterControllerClient
44
- # @private
45
- attr_reader :cluster_controller_stub
46
-
47
- # The default address of the service.
48
- SERVICE_ADDRESS = "dataproc.googleapis.com".freeze
49
-
50
- # The default port of the service.
51
- DEFAULT_SERVICE_PORT = 443
52
-
53
- # The default set of gRPC interceptors.
54
- GRPC_INTERCEPTORS = []
55
-
56
- DEFAULT_TIMEOUT = 30
57
-
58
- PAGE_DESCRIPTORS = {
59
- "list_clusters" => Google::Gax::PageDescriptor.new(
60
- "page_token",
61
- "next_page_token",
62
- "clusters")
63
- }.freeze
64
-
65
- private_constant :PAGE_DESCRIPTORS
66
-
67
- # The scopes needed to make gRPC calls to all of the methods defined in
68
- # this service.
69
- ALL_SCOPES = [
70
- "https://www.googleapis.com/auth/cloud-platform"
71
- ].freeze
72
-
73
- # @private
74
- class OperationsClient < Google::Longrunning::OperationsClient
75
- self::SERVICE_ADDRESS = ClusterControllerClient::SERVICE_ADDRESS
76
- self::GRPC_INTERCEPTORS = ClusterControllerClient::GRPC_INTERCEPTORS
77
- end
78
-
79
- # @param credentials [Google::Auth::Credentials, String, Hash, GRPC::Core::Channel, GRPC::Core::ChannelCredentials, Proc]
80
- # Provides the means for authenticating requests made by the client. This parameter can
81
- # be many types.
82
- # A `Google::Auth::Credentials` uses a the properties of its represented keyfile for
83
- # authenticating requests made by this client.
84
- # A `String` will be treated as the path to the keyfile to be used for the construction of
85
- # credentials for this client.
86
- # A `Hash` will be treated as the contents of a keyfile to be used for the construction of
87
- # credentials for this client.
88
- # A `GRPC::Core::Channel` will be used to make calls through.
89
- # A `GRPC::Core::ChannelCredentials` for the setting up the RPC client. The channel credentials
90
- # should already be composed with a `GRPC::Core::CallCredentials` object.
91
- # A `Proc` will be used as an updater_proc for the Grpc channel. The proc transforms the
92
- # metadata for requests, generally, to give OAuth credentials.
93
- # @param scopes [Array<String>]
94
- # The OAuth scopes for this service. This parameter is ignored if
95
- # an updater_proc is supplied.
96
- # @param client_config [Hash]
97
- # A Hash for call options for each method. See
98
- # Google::Gax#construct_settings for the structure of
99
- # this data. Falls back to the default config if not specified
100
- # or the specified config is missing data points.
101
- # @param timeout [Numeric]
102
- # The default timeout, in seconds, for calls made through this client.
103
- # @param metadata [Hash]
104
- # Default metadata to be sent with each request. This can be overridden on a per call basis.
105
- # @param service_address [String]
106
- # Override for the service hostname, or `nil` to leave as the default.
107
- # @param service_port [Integer]
108
- # Override for the service port, or `nil` to leave as the default.
109
- # @param exception_transformer [Proc]
110
- # An optional proc that intercepts any exceptions raised during an API call to inject
111
- # custom error handling.
112
- def initialize \
113
- credentials: nil,
114
- scopes: ALL_SCOPES,
115
- client_config: {},
116
- timeout: DEFAULT_TIMEOUT,
117
- metadata: nil,
118
- service_address: nil,
119
- service_port: nil,
120
- exception_transformer: nil,
121
- lib_name: nil,
122
- lib_version: ""
123
- # These require statements are intentionally placed here to initialize
124
- # the gRPC module only when it's required.
125
- # See https://github.com/googleapis/toolkit/issues/446
126
- require "google/gax/grpc"
127
- require "google/cloud/dataproc/v1beta2/clusters_services_pb"
128
-
129
- credentials ||= Google::Cloud::Dataproc::V1beta2::Credentials.default
130
-
131
- @operations_client = OperationsClient.new(
132
- credentials: credentials,
133
- scopes: scopes,
134
- client_config: client_config,
135
- timeout: timeout,
136
- lib_name: lib_name,
137
- service_address: service_address,
138
- service_port: service_port,
139
- lib_version: lib_version,
140
- metadata: metadata,
141
- )
142
-
143
- if credentials.is_a?(String) || credentials.is_a?(Hash)
144
- updater_proc = Google::Cloud::Dataproc::V1beta2::Credentials.new(credentials).updater_proc
145
- end
146
- if credentials.is_a?(GRPC::Core::Channel)
147
- channel = credentials
148
- end
149
- if credentials.is_a?(GRPC::Core::ChannelCredentials)
150
- chan_creds = credentials
151
- end
152
- if credentials.is_a?(Proc)
153
- updater_proc = credentials
154
- end
155
- if credentials.is_a?(Google::Auth::Credentials)
156
- updater_proc = credentials.updater_proc
157
- end
158
-
159
- package_version = Google::Cloud::Dataproc::VERSION
160
-
161
- google_api_client = "gl-ruby/#{RUBY_VERSION}"
162
- google_api_client << " #{lib_name}/#{lib_version}" if lib_name
163
- google_api_client << " gapic/#{package_version} gax/#{Google::Gax::VERSION}"
164
- google_api_client << " grpc/#{GRPC::VERSION}"
165
- google_api_client.freeze
166
-
167
- headers = { :"x-goog-api-client" => google_api_client }
168
- if credentials.respond_to?(:quota_project_id) && credentials.quota_project_id
169
- headers[:"x-goog-user-project"] = credentials.quota_project_id
170
- end
171
- headers.merge!(metadata) unless metadata.nil?
172
- client_config_file = Pathname.new(__dir__).join(
173
- "cluster_controller_client_config.json"
174
- )
175
- defaults = client_config_file.open do |f|
176
- Google::Gax.construct_settings(
177
- "google.cloud.dataproc.v1beta2.ClusterController",
178
- JSON.parse(f.read),
179
- client_config,
180
- Google::Gax::Grpc::STATUS_CODE_NAMES,
181
- timeout,
182
- page_descriptors: PAGE_DESCRIPTORS,
183
- errors: Google::Gax::Grpc::API_ERRORS,
184
- metadata: headers
185
- )
186
- end
187
-
188
- # Allow overriding the service path/port in subclasses.
189
- service_path = service_address || self.class::SERVICE_ADDRESS
190
- port = service_port || self.class::DEFAULT_SERVICE_PORT
191
- interceptors = self.class::GRPC_INTERCEPTORS
192
- @cluster_controller_stub = Google::Gax::Grpc.create_stub(
193
- service_path,
194
- port,
195
- chan_creds: chan_creds,
196
- channel: channel,
197
- updater_proc: updater_proc,
198
- scopes: scopes,
199
- interceptors: interceptors,
200
- &Google::Cloud::Dataproc::V1beta2::ClusterController::Stub.method(:new)
201
- )
202
-
203
- @create_cluster = Google::Gax.create_api_call(
204
- @cluster_controller_stub.method(:create_cluster),
205
- defaults["create_cluster"],
206
- exception_transformer: exception_transformer
207
- )
208
- @update_cluster = Google::Gax.create_api_call(
209
- @cluster_controller_stub.method(:update_cluster),
210
- defaults["update_cluster"],
211
- exception_transformer: exception_transformer
212
- )
213
- @delete_cluster = Google::Gax.create_api_call(
214
- @cluster_controller_stub.method(:delete_cluster),
215
- defaults["delete_cluster"],
216
- exception_transformer: exception_transformer
217
- )
218
- @get_cluster = Google::Gax.create_api_call(
219
- @cluster_controller_stub.method(:get_cluster),
220
- defaults["get_cluster"],
221
- exception_transformer: exception_transformer
222
- )
223
- @list_clusters = Google::Gax.create_api_call(
224
- @cluster_controller_stub.method(:list_clusters),
225
- defaults["list_clusters"],
226
- exception_transformer: exception_transformer
227
- )
228
- @diagnose_cluster = Google::Gax.create_api_call(
229
- @cluster_controller_stub.method(:diagnose_cluster),
230
- defaults["diagnose_cluster"],
231
- exception_transformer: exception_transformer
232
- )
233
- end
234
-
235
- # Service calls
236
-
237
- # Creates a cluster in a project. The returned
238
- # {Google::Longrunning::Operation#metadata Operation#metadata} will be
239
- # [ClusterOperationMetadata](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1beta2#clusteroperationmetadata).
240
- #
241
- # @param project_id [String]
242
- # Required. The ID of the Google Cloud Platform project that the cluster
243
- # belongs to.
244
- # @param region [String]
245
- # Required. The Dataproc region in which to handle the request.
246
- # @param cluster [Google::Cloud::Dataproc::V1beta2::Cluster | Hash]
247
- # Required. The cluster to create.
248
- # A hash of the same form as `Google::Cloud::Dataproc::V1beta2::Cluster`
249
- # can also be provided.
250
- # @param request_id [String]
251
- # Optional. A unique id used to identify the request. If the server
252
- # receives two {Google::Cloud::Dataproc::V1beta2::CreateClusterRequest CreateClusterRequest} requests with the same
253
- # id, then the second request will be ignored and the
254
- # first {Google::Longrunning::Operation} created and stored in the backend
255
- # is returned.
256
- #
257
- # It is recommended to always set this value to a
258
- # [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier).
259
- #
260
- # The id must contain only letters (a-z, A-Z), numbers (0-9),
261
- # underscores (_), and hyphens (-). The maximum length is 40 characters.
262
- # @param options [Google::Gax::CallOptions]
263
- # Overrides the default settings for this call, e.g, timeout,
264
- # retries, etc.
265
- # @return [Google::Gax::Operation]
266
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
267
- # @example
268
- # require "google/cloud/dataproc"
269
- #
270
- # cluster_controller_client = Google::Cloud::Dataproc::ClusterController.new(version: :v1beta2)
271
- #
272
- # # TODO: Initialize `project_id`:
273
- # project_id = ''
274
- #
275
- # # TODO: Initialize `region`:
276
- # region = ''
277
- #
278
- # # TODO: Initialize `cluster`:
279
- # cluster = {}
280
- #
281
- # # Register a callback during the method call.
282
- # operation = cluster_controller_client.create_cluster(project_id, region, cluster) do |op|
283
- # raise op.results.message if op.error?
284
- # op_results = op.results
285
- # # Process the results.
286
- #
287
- # metadata = op.metadata
288
- # # Process the metadata.
289
- # end
290
- #
291
- # # Or use the return value to register a callback.
292
- # operation.on_done do |op|
293
- # raise op.results.message if op.error?
294
- # op_results = op.results
295
- # # Process the results.
296
- #
297
- # metadata = op.metadata
298
- # # Process the metadata.
299
- # end
300
- #
301
- # # Manually reload the operation.
302
- # operation.reload!
303
- #
304
- # # Or block until the operation completes, triggering callbacks on
305
- # # completion.
306
- # operation.wait_until_done!
307
-
308
- def create_cluster \
309
- project_id,
310
- region,
311
- cluster,
312
- request_id: nil,
313
- options: nil
314
- req = {
315
- project_id: project_id,
316
- region: region,
317
- cluster: cluster,
318
- request_id: request_id
319
- }.delete_if { |_, v| v.nil? }
320
- req = Google::Gax::to_proto(req, Google::Cloud::Dataproc::V1beta2::CreateClusterRequest)
321
- operation = Google::Gax::Operation.new(
322
- @create_cluster.call(req, options),
323
- @operations_client,
324
- Google::Cloud::Dataproc::V1beta2::Cluster,
325
- Google::Cloud::Dataproc::V1beta2::ClusterOperationMetadata,
326
- call_options: options
327
- )
328
- operation.on_done { |operation| yield(operation) } if block_given?
329
- operation
330
- end
331
-
332
- # Updates a cluster in a project. The returned
333
- # {Google::Longrunning::Operation#metadata Operation#metadata} will be
334
- # [ClusterOperationMetadata](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1beta2#clusteroperationmetadata).
335
- #
336
- # @param project_id [String]
337
- # Required. The ID of the Google Cloud Platform project the
338
- # cluster belongs to.
339
- # @param region [String]
340
- # Required. The Dataproc region in which to handle the request.
341
- # @param cluster_name [String]
342
- # Required. The cluster name.
343
- # @param cluster [Google::Cloud::Dataproc::V1beta2::Cluster | Hash]
344
- # Required. The changes to the cluster.
345
- # A hash of the same form as `Google::Cloud::Dataproc::V1beta2::Cluster`
346
- # can also be provided.
347
- # @param update_mask [Google::Protobuf::FieldMask | Hash]
348
- # Required. Specifies the path, relative to `Cluster`, of
349
- # the field to update. For example, to change the number of workers
350
- # in a cluster to 5, the `update_mask` parameter would be
351
- # specified as `config.worker_config.num_instances`,
352
- # and the `PATCH` request body would specify the new value, as follows:
353
- #
354
- # {
355
- # "config":{
356
- # "workerConfig":{
357
- # "numInstances":"5"
358
- # }
359
- # }
360
- # }
361
- #
362
- # Similarly, to change the number of preemptible workers in a cluster to 5,
363
- # the `update_mask` parameter would be
364
- # `config.secondary_worker_config.num_instances`, and the `PATCH` request
365
- # body would be set as follows:
366
- #
367
- # {
368
- # "config":{
369
- # "secondaryWorkerConfig":{
370
- # "numInstances":"5"
371
- # }
372
- # }
373
- # }
374
- # <strong>Note:</strong> currently only the following fields can be updated:
375
- #
376
- # <table>
377
- # <tr>
378
- # <td><strong>Mask</strong></td><td><strong>Purpose</strong></td>
379
- # </tr>
380
- # <tr>
381
- # <td>labels</td><td>Updates labels</td>
382
- # </tr>
383
- # <tr>
384
- # <td>config.worker_config.num_instances</td><td>Resize primary worker
385
- # group</td>
386
- # </tr>
387
- # <tr>
388
- # <td>config.secondary_worker_config.num_instances</td><td>Resize secondary
389
- # worker group</td>
390
- # </tr>
391
- # <tr>
392
- # <td>config.lifecycle_config.auto_delete_ttl</td><td>Reset MAX TTL
393
- # duration</td>
394
- # </tr>
395
- # <tr>
396
- # <td>config.lifecycle_config.auto_delete_time</td><td>Update MAX TTL
397
- # deletion timestamp</td>
398
- # </tr>
399
- # <tr>
400
- # <td>config.lifecycle_config.idle_delete_ttl</td><td>Update Idle TTL
401
- # duration</td>
402
- # </tr>
403
- # <tr>
404
- # <td>config.autoscaling_config.policy_uri</td><td>Use, stop using, or change
405
- # autoscaling policies</td>
406
- # </tr>
407
- # </table>
408
- # A hash of the same form as `Google::Protobuf::FieldMask`
409
- # can also be provided.
410
- # @param graceful_decommission_timeout [Google::Protobuf::Duration | Hash]
411
- # Optional. Timeout for graceful YARN decomissioning. Graceful
412
- # decommissioning allows removing nodes from the cluster without
413
- # interrupting jobs in progress. Timeout specifies how long to wait for jobs
414
- # in progress to finish before forcefully removing nodes (and potentially
415
- # interrupting jobs). Default timeout is 0 (for forceful decommission), and
416
- # the maximum allowed timeout is 1 day (see JSON representation of
417
- # [Duration](https://developers.google.com/protocol-buffers/docs/proto3#json)).
418
- #
419
- # Only supported on Dataproc image versions 1.2 and higher.
420
- # A hash of the same form as `Google::Protobuf::Duration`
421
- # can also be provided.
422
- # @param request_id [String]
423
- # Optional. A unique id used to identify the request. If the server
424
- # receives two {Google::Cloud::Dataproc::V1beta2::UpdateClusterRequest UpdateClusterRequest} requests with the same
425
- # id, then the second request will be ignored and the
426
- # first {Google::Longrunning::Operation} created and stored in the
427
- # backend is returned.
428
- #
429
- # It is recommended to always set this value to a
430
- # [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier).
431
- #
432
- # The id must contain only letters (a-z, A-Z), numbers (0-9),
433
- # underscores (_), and hyphens (-). The maximum length is 40 characters.
434
- # @param options [Google::Gax::CallOptions]
435
- # Overrides the default settings for this call, e.g, timeout,
436
- # retries, etc.
437
- # @return [Google::Gax::Operation]
438
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
439
- # @example
440
- # require "google/cloud/dataproc"
441
- #
442
- # cluster_controller_client = Google::Cloud::Dataproc::ClusterController.new(version: :v1beta2)
443
- #
444
- # # TODO: Initialize `project_id`:
445
- # project_id = ''
446
- #
447
- # # TODO: Initialize `region`:
448
- # region = ''
449
- #
450
- # # TODO: Initialize `cluster_name`:
451
- # cluster_name = ''
452
- #
453
- # # TODO: Initialize `cluster`:
454
- # cluster = {}
455
- #
456
- # # TODO: Initialize `update_mask`:
457
- # update_mask = {}
458
- #
459
- # # Register a callback during the method call.
460
- # operation = cluster_controller_client.update_cluster(project_id, region, cluster_name, cluster, update_mask) do |op|
461
- # raise op.results.message if op.error?
462
- # op_results = op.results
463
- # # Process the results.
464
- #
465
- # metadata = op.metadata
466
- # # Process the metadata.
467
- # end
468
- #
469
- # # Or use the return value to register a callback.
470
- # operation.on_done do |op|
471
- # raise op.results.message if op.error?
472
- # op_results = op.results
473
- # # Process the results.
474
- #
475
- # metadata = op.metadata
476
- # # Process the metadata.
477
- # end
478
- #
479
- # # Manually reload the operation.
480
- # operation.reload!
481
- #
482
- # # Or block until the operation completes, triggering callbacks on
483
- # # completion.
484
- # operation.wait_until_done!
485
-
486
- def update_cluster \
487
- project_id,
488
- region,
489
- cluster_name,
490
- cluster,
491
- update_mask,
492
- graceful_decommission_timeout: nil,
493
- request_id: nil,
494
- options: nil
495
- req = {
496
- project_id: project_id,
497
- region: region,
498
- cluster_name: cluster_name,
499
- cluster: cluster,
500
- update_mask: update_mask,
501
- graceful_decommission_timeout: graceful_decommission_timeout,
502
- request_id: request_id
503
- }.delete_if { |_, v| v.nil? }
504
- req = Google::Gax::to_proto(req, Google::Cloud::Dataproc::V1beta2::UpdateClusterRequest)
505
- operation = Google::Gax::Operation.new(
506
- @update_cluster.call(req, options),
507
- @operations_client,
508
- Google::Cloud::Dataproc::V1beta2::Cluster,
509
- Google::Cloud::Dataproc::V1beta2::ClusterOperationMetadata,
510
- call_options: options
511
- )
512
- operation.on_done { |operation| yield(operation) } if block_given?
513
- operation
514
- end
515
-
516
- # Deletes a cluster in a project. The returned
517
- # {Google::Longrunning::Operation#metadata Operation#metadata} will be
518
- # [ClusterOperationMetadata](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1beta2#clusteroperationmetadata).
519
- #
520
- # @param project_id [String]
521
- # Required. The ID of the Google Cloud Platform project that the cluster
522
- # belongs to.
523
- # @param region [String]
524
- # Required. The Dataproc region in which to handle the request.
525
- # @param cluster_name [String]
526
- # Required. The cluster name.
527
- # @param cluster_uuid [String]
528
- # Optional. Specifying the `cluster_uuid` means the RPC should fail
529
- # (with error NOT_FOUND) if cluster with specified UUID does not exist.
530
- # @param request_id [String]
531
- # Optional. A unique id used to identify the request. If the server
532
- # receives two {Google::Cloud::Dataproc::V1beta2::DeleteClusterRequest DeleteClusterRequest} requests with the same
533
- # id, then the second request will be ignored and the
534
- # first {Google::Longrunning::Operation} created and stored in the
535
- # backend is returned.
536
- #
537
- # It is recommended to always set this value to a
538
- # [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier).
539
- #
540
- # The id must contain only letters (a-z, A-Z), numbers (0-9),
541
- # underscores (_), and hyphens (-). The maximum length is 40 characters.
542
- # @param options [Google::Gax::CallOptions]
543
- # Overrides the default settings for this call, e.g, timeout,
544
- # retries, etc.
545
- # @return [Google::Gax::Operation]
546
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
547
- # @example
548
- # require "google/cloud/dataproc"
549
- #
550
- # cluster_controller_client = Google::Cloud::Dataproc::ClusterController.new(version: :v1beta2)
551
- #
552
- # # TODO: Initialize `project_id`:
553
- # project_id = ''
554
- #
555
- # # TODO: Initialize `region`:
556
- # region = ''
557
- #
558
- # # TODO: Initialize `cluster_name`:
559
- # cluster_name = ''
560
- #
561
- # # Register a callback during the method call.
562
- # operation = cluster_controller_client.delete_cluster(project_id, region, cluster_name) do |op|
563
- # raise op.results.message if op.error?
564
- # op_results = op.results
565
- # # Process the results.
566
- #
567
- # metadata = op.metadata
568
- # # Process the metadata.
569
- # end
570
- #
571
- # # Or use the return value to register a callback.
572
- # operation.on_done do |op|
573
- # raise op.results.message if op.error?
574
- # op_results = op.results
575
- # # Process the results.
576
- #
577
- # metadata = op.metadata
578
- # # Process the metadata.
579
- # end
580
- #
581
- # # Manually reload the operation.
582
- # operation.reload!
583
- #
584
- # # Or block until the operation completes, triggering callbacks on
585
- # # completion.
586
- # operation.wait_until_done!
587
-
588
- def delete_cluster \
589
- project_id,
590
- region,
591
- cluster_name,
592
- cluster_uuid: nil,
593
- request_id: nil,
594
- options: nil
595
- req = {
596
- project_id: project_id,
597
- region: region,
598
- cluster_name: cluster_name,
599
- cluster_uuid: cluster_uuid,
600
- request_id: request_id
601
- }.delete_if { |_, v| v.nil? }
602
- req = Google::Gax::to_proto(req, Google::Cloud::Dataproc::V1beta2::DeleteClusterRequest)
603
- operation = Google::Gax::Operation.new(
604
- @delete_cluster.call(req, options),
605
- @operations_client,
606
- Google::Protobuf::Empty,
607
- Google::Cloud::Dataproc::V1beta2::ClusterOperationMetadata,
608
- call_options: options
609
- )
610
- operation.on_done { |operation| yield(operation) } if block_given?
611
- operation
612
- end
613
-
614
- # Gets the resource representation for a cluster in a project.
615
- #
616
- # @param project_id [String]
617
- # Required. The ID of the Google Cloud Platform project that the cluster
618
- # belongs to.
619
- # @param region [String]
620
- # Required. The Dataproc region in which to handle the request.
621
- # @param cluster_name [String]
622
- # Required. The cluster name.
623
- # @param options [Google::Gax::CallOptions]
624
- # Overrides the default settings for this call, e.g, timeout,
625
- # retries, etc.
626
- # @yield [result, operation] Access the result along with the RPC operation
627
- # @yieldparam result [Google::Cloud::Dataproc::V1beta2::Cluster]
628
- # @yieldparam operation [GRPC::ActiveCall::Operation]
629
- # @return [Google::Cloud::Dataproc::V1beta2::Cluster]
630
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
631
- # @example
632
- # require "google/cloud/dataproc"
633
- #
634
- # cluster_controller_client = Google::Cloud::Dataproc::ClusterController.new(version: :v1beta2)
635
- #
636
- # # TODO: Initialize `project_id`:
637
- # project_id = ''
638
- #
639
- # # TODO: Initialize `region`:
640
- # region = ''
641
- #
642
- # # TODO: Initialize `cluster_name`:
643
- # cluster_name = ''
644
- # response = cluster_controller_client.get_cluster(project_id, region, cluster_name)
645
-
646
- def get_cluster \
647
- project_id,
648
- region,
649
- cluster_name,
650
- options: nil,
651
- &block
652
- req = {
653
- project_id: project_id,
654
- region: region,
655
- cluster_name: cluster_name
656
- }.delete_if { |_, v| v.nil? }
657
- req = Google::Gax::to_proto(req, Google::Cloud::Dataproc::V1beta2::GetClusterRequest)
658
- @get_cluster.call(req, options, &block)
659
- end
660
-
661
- # Lists all regions/\\{region}/clusters in a project.
662
- #
663
- # @param project_id [String]
664
- # Required. The ID of the Google Cloud Platform project that the cluster
665
- # belongs to.
666
- # @param region [String]
667
- # Required. The Dataproc region in which to handle the request.
668
- # @param filter [String]
669
- # Optional. A filter constraining the clusters to list. Filters are
670
- # case-sensitive and have the following syntax:
671
- #
672
- # field = value [AND [field = value]] ...
673
- #
674
- # where **field** is one of `status.state`, `clusterName`, or `labels.[KEY]`,
675
- # and `[KEY]` is a label key. **value** can be `*` to match all values.
676
- # `status.state` can be one of the following: `ACTIVE`, `INACTIVE`,
677
- # `CREATING`, `RUNNING`, `ERROR`, `DELETING`, or `UPDATING`. `ACTIVE`
678
- # contains the `CREATING`, `UPDATING`, and `RUNNING` states. `INACTIVE`
679
- # contains the `DELETING` and `ERROR` states.
680
- # `clusterName` is the name of the cluster provided at creation time.
681
- # Only the logical `AND` operator is supported; space-separated items are
682
- # treated as having an implicit `AND` operator.
683
- #
684
- # Example filter:
685
- #
686
- # status.state = ACTIVE AND clusterName = mycluster
687
- # AND labels.env = staging AND labels.starred = *
688
- # @param page_size [Integer]
689
- # The maximum number of resources contained in the underlying API
690
- # response. If page streaming is performed per-resource, this
691
- # parameter does not affect the return value. If page streaming is
692
- # performed per-page, this determines the maximum number of
693
- # resources in a page.
694
- # @param options [Google::Gax::CallOptions]
695
- # Overrides the default settings for this call, e.g, timeout,
696
- # retries, etc.
697
- # @yield [result, operation] Access the result along with the RPC operation
698
- # @yieldparam result [Google::Gax::PagedEnumerable<Google::Cloud::Dataproc::V1beta2::Cluster>]
699
- # @yieldparam operation [GRPC::ActiveCall::Operation]
700
- # @return [Google::Gax::PagedEnumerable<Google::Cloud::Dataproc::V1beta2::Cluster>]
701
- # An enumerable of Google::Cloud::Dataproc::V1beta2::Cluster instances.
702
- # See Google::Gax::PagedEnumerable documentation for other
703
- # operations such as per-page iteration or access to the response
704
- # object.
705
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
706
- # @example
707
- # require "google/cloud/dataproc"
708
- #
709
- # cluster_controller_client = Google::Cloud::Dataproc::ClusterController.new(version: :v1beta2)
710
- #
711
- # # TODO: Initialize `project_id`:
712
- # project_id = ''
713
- #
714
- # # TODO: Initialize `region`:
715
- # region = ''
716
- #
717
- # # Iterate over all results.
718
- # cluster_controller_client.list_clusters(project_id, region).each do |element|
719
- # # Process element.
720
- # end
721
- #
722
- # # Or iterate over results one page at a time.
723
- # cluster_controller_client.list_clusters(project_id, region).each_page do |page|
724
- # # Process each page at a time.
725
- # page.each do |element|
726
- # # Process element.
727
- # end
728
- # end
729
-
730
- def list_clusters \
731
- project_id,
732
- region,
733
- filter: nil,
734
- page_size: nil,
735
- options: nil,
736
- &block
737
- req = {
738
- project_id: project_id,
739
- region: region,
740
- filter: filter,
741
- page_size: page_size
742
- }.delete_if { |_, v| v.nil? }
743
- req = Google::Gax::to_proto(req, Google::Cloud::Dataproc::V1beta2::ListClustersRequest)
744
- @list_clusters.call(req, options, &block)
745
- end
746
-
747
- # Gets cluster diagnostic information. The returned
748
- # {Google::Longrunning::Operation#metadata Operation#metadata} will be
749
- # [ClusterOperationMetadata](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1beta2#clusteroperationmetadata).
750
- # After the operation completes,
751
- # {Google::Longrunning::Operation#response Operation#response}
752
- # contains
753
- # {Google::Protobuf::Empty Empty}.
754
- #
755
- # @param project_id [String]
756
- # Required. The ID of the Google Cloud Platform project that the cluster
757
- # belongs to.
758
- # @param region [String]
759
- # Required. The Dataproc region in which to handle the request.
760
- # @param cluster_name [String]
761
- # Required. The cluster name.
762
- # @param options [Google::Gax::CallOptions]
763
- # Overrides the default settings for this call, e.g, timeout,
764
- # retries, etc.
765
- # @return [Google::Gax::Operation]
766
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
767
- # @example
768
- # require "google/cloud/dataproc"
769
- #
770
- # cluster_controller_client = Google::Cloud::Dataproc::ClusterController.new(version: :v1beta2)
771
- #
772
- # # TODO: Initialize `project_id`:
773
- # project_id = ''
774
- #
775
- # # TODO: Initialize `region`:
776
- # region = ''
777
- #
778
- # # TODO: Initialize `cluster_name`:
779
- # cluster_name = ''
780
- #
781
- # # Register a callback during the method call.
782
- # operation = cluster_controller_client.diagnose_cluster(project_id, region, cluster_name) do |op|
783
- # raise op.results.message if op.error?
784
- # op_results = op.results
785
- # # Process the results.
786
- #
787
- # metadata = op.metadata
788
- # # Process the metadata.
789
- # end
790
- #
791
- # # Or use the return value to register a callback.
792
- # operation.on_done do |op|
793
- # raise op.results.message if op.error?
794
- # op_results = op.results
795
- # # Process the results.
796
- #
797
- # metadata = op.metadata
798
- # # Process the metadata.
799
- # end
800
- #
801
- # # Manually reload the operation.
802
- # operation.reload!
803
- #
804
- # # Or block until the operation completes, triggering callbacks on
805
- # # completion.
806
- # operation.wait_until_done!
807
-
808
- def diagnose_cluster \
809
- project_id,
810
- region,
811
- cluster_name,
812
- options: nil
813
- req = {
814
- project_id: project_id,
815
- region: region,
816
- cluster_name: cluster_name
817
- }.delete_if { |_, v| v.nil? }
818
- req = Google::Gax::to_proto(req, Google::Cloud::Dataproc::V1beta2::DiagnoseClusterRequest)
819
- operation = Google::Gax::Operation.new(
820
- @diagnose_cluster.call(req, options),
821
- @operations_client,
822
- Google::Protobuf::Empty,
823
- Google::Cloud::Dataproc::V1beta2::DiagnoseClusterResults,
824
- call_options: options
825
- )
826
- operation.on_done { |operation| yield(operation) } if block_given?
827
- operation
828
- end
829
- end
830
- end
831
- end
832
- end
833
- end