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.v1.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,824 +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/v1/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/v1/clusters_pb"
31
- require "google/cloud/dataproc/v1/credentials"
32
- require "google/cloud/dataproc/version"
33
-
34
- module Google
35
- module Cloud
36
- module Dataproc
37
- module V1
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::V1::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/v1/clusters_services_pb"
128
-
129
- credentials ||= Google::Cloud::Dataproc::V1::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::V1::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.v1.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::V1::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.v1#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::V1::Cluster | Hash]
247
- # Required. The cluster to create.
248
- # A hash of the same form as `Google::Cloud::Dataproc::V1::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::V1::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: :v1)
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::V1::CreateClusterRequest)
321
- operation = Google::Gax::Operation.new(
322
- @create_cluster.call(req, options),
323
- @operations_client,
324
- Google::Cloud::Dataproc::V1::Cluster,
325
- Google::Cloud::Dataproc::V1::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.v1#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::V1::Cluster | Hash]
344
- # Required. The changes to the cluster.
345
- # A hash of the same form as `Google::Cloud::Dataproc::V1::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
- # Similarly, to change the number of preemptible workers in a cluster to 5,
362
- # the `update_mask` parameter would be
363
- # `config.secondary_worker_config.num_instances`, and the `PATCH` request
364
- # body would be set as follows:
365
- #
366
- # {
367
- # "config":{
368
- # "secondaryWorkerConfig":{
369
- # "numInstances":"5"
370
- # }
371
- # }
372
- # }
373
- # <strong>Note:</strong> Currently, only the following fields can be updated:
374
- #
375
- # <table>
376
- # <tbody>
377
- # <tr>
378
- # <td><strong>Mask</strong></td>
379
- # <td><strong>Purpose</strong></td>
380
- # </tr>
381
- # <tr>
382
- # <td><strong><em>labels</em></strong></td>
383
- # <td>Update labels</td>
384
- # </tr>
385
- # <tr>
386
- # <td><strong><em>config.worker_config.num_instances</em></strong></td>
387
- # <td>Resize primary worker group</td>
388
- # </tr>
389
- # <tr>
390
- # <td><strong><em>config.secondary_worker_config.num_instances</em></strong></td>
391
- # <td>Resize secondary worker group</td>
392
- # </tr>
393
- # <tr>
394
- # <td>config.autoscaling_config.policy_uri</td><td>Use, stop using, or
395
- # change autoscaling policies</td>
396
- # </tr>
397
- # </tbody>
398
- # </table>
399
- # A hash of the same form as `Google::Protobuf::FieldMask`
400
- # can also be provided.
401
- # @param graceful_decommission_timeout [Google::Protobuf::Duration | Hash]
402
- # Optional. Timeout for graceful YARN decomissioning. Graceful
403
- # decommissioning allows removing nodes from the cluster without
404
- # interrupting jobs in progress. Timeout specifies how long to wait for jobs
405
- # in progress to finish before forcefully removing nodes (and potentially
406
- # interrupting jobs). Default timeout is 0 (for forceful decommission), and
407
- # the maximum allowed timeout is 1 day. (see JSON representation of
408
- # [Duration](https://developers.google.com/protocol-buffers/docs/proto3#json)).
409
- #
410
- # Only supported on Dataproc image versions 1.2 and higher.
411
- # A hash of the same form as `Google::Protobuf::Duration`
412
- # can also be provided.
413
- # @param request_id [String]
414
- # Optional. A unique id used to identify the request. If the server
415
- # receives two {Google::Cloud::Dataproc::V1::UpdateClusterRequest UpdateClusterRequest} requests with the same
416
- # id, then the second request will be ignored and the
417
- # first {Google::Longrunning::Operation} created and stored in the
418
- # backend is returned.
419
- #
420
- # It is recommended to always set this value to a
421
- # [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier).
422
- #
423
- # The id must contain only letters (a-z, A-Z), numbers (0-9),
424
- # underscores (_), and hyphens (-). The maximum length is 40 characters.
425
- # @param options [Google::Gax::CallOptions]
426
- # Overrides the default settings for this call, e.g, timeout,
427
- # retries, etc.
428
- # @return [Google::Gax::Operation]
429
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
430
- # @example
431
- # require "google/cloud/dataproc"
432
- #
433
- # cluster_controller_client = Google::Cloud::Dataproc::ClusterController.new(version: :v1)
434
- #
435
- # # TODO: Initialize `project_id`:
436
- # project_id = ''
437
- #
438
- # # TODO: Initialize `region`:
439
- # region = ''
440
- #
441
- # # TODO: Initialize `cluster_name`:
442
- # cluster_name = ''
443
- #
444
- # # TODO: Initialize `cluster`:
445
- # cluster = {}
446
- #
447
- # # TODO: Initialize `update_mask`:
448
- # update_mask = {}
449
- #
450
- # # Register a callback during the method call.
451
- # operation = cluster_controller_client.update_cluster(project_id, region, cluster_name, cluster, update_mask) do |op|
452
- # raise op.results.message if op.error?
453
- # op_results = op.results
454
- # # Process the results.
455
- #
456
- # metadata = op.metadata
457
- # # Process the metadata.
458
- # end
459
- #
460
- # # Or use the return value to register a callback.
461
- # operation.on_done do |op|
462
- # raise op.results.message if op.error?
463
- # op_results = op.results
464
- # # Process the results.
465
- #
466
- # metadata = op.metadata
467
- # # Process the metadata.
468
- # end
469
- #
470
- # # Manually reload the operation.
471
- # operation.reload!
472
- #
473
- # # Or block until the operation completes, triggering callbacks on
474
- # # completion.
475
- # operation.wait_until_done!
476
-
477
- def update_cluster \
478
- project_id,
479
- region,
480
- cluster_name,
481
- cluster,
482
- update_mask,
483
- graceful_decommission_timeout: nil,
484
- request_id: nil,
485
- options: nil
486
- req = {
487
- project_id: project_id,
488
- region: region,
489
- cluster_name: cluster_name,
490
- cluster: cluster,
491
- update_mask: update_mask,
492
- graceful_decommission_timeout: graceful_decommission_timeout,
493
- request_id: request_id
494
- }.delete_if { |_, v| v.nil? }
495
- req = Google::Gax::to_proto(req, Google::Cloud::Dataproc::V1::UpdateClusterRequest)
496
- operation = Google::Gax::Operation.new(
497
- @update_cluster.call(req, options),
498
- @operations_client,
499
- Google::Cloud::Dataproc::V1::Cluster,
500
- Google::Cloud::Dataproc::V1::ClusterOperationMetadata,
501
- call_options: options
502
- )
503
- operation.on_done { |operation| yield(operation) } if block_given?
504
- operation
505
- end
506
-
507
- # Deletes a cluster in a project. The returned
508
- # {Google::Longrunning::Operation#metadata Operation#metadata} will be
509
- # [ClusterOperationMetadata](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#clusteroperationmetadata).
510
- #
511
- # @param project_id [String]
512
- # Required. The ID of the Google Cloud Platform project that the cluster
513
- # belongs to.
514
- # @param region [String]
515
- # Required. The Dataproc region in which to handle the request.
516
- # @param cluster_name [String]
517
- # Required. The cluster name.
518
- # @param cluster_uuid [String]
519
- # Optional. Specifying the `cluster_uuid` means the RPC should fail
520
- # (with error NOT_FOUND) if cluster with specified UUID does not exist.
521
- # @param request_id [String]
522
- # Optional. A unique id used to identify the request. If the server
523
- # receives two {Google::Cloud::Dataproc::V1::DeleteClusterRequest DeleteClusterRequest} requests with the same
524
- # id, then the second request will be ignored and the
525
- # first {Google::Longrunning::Operation} created and stored in the
526
- # backend is returned.
527
- #
528
- # It is recommended to always set this value to a
529
- # [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier).
530
- #
531
- # The id must contain only letters (a-z, A-Z), numbers (0-9),
532
- # underscores (_), and hyphens (-). The maximum length is 40 characters.
533
- # @param options [Google::Gax::CallOptions]
534
- # Overrides the default settings for this call, e.g, timeout,
535
- # retries, etc.
536
- # @return [Google::Gax::Operation]
537
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
538
- # @example
539
- # require "google/cloud/dataproc"
540
- #
541
- # cluster_controller_client = Google::Cloud::Dataproc::ClusterController.new(version: :v1)
542
- #
543
- # # TODO: Initialize `project_id`:
544
- # project_id = ''
545
- #
546
- # # TODO: Initialize `region`:
547
- # region = ''
548
- #
549
- # # TODO: Initialize `cluster_name`:
550
- # cluster_name = ''
551
- #
552
- # # Register a callback during the method call.
553
- # operation = cluster_controller_client.delete_cluster(project_id, region, cluster_name) do |op|
554
- # raise op.results.message if op.error?
555
- # op_results = op.results
556
- # # Process the results.
557
- #
558
- # metadata = op.metadata
559
- # # Process the metadata.
560
- # end
561
- #
562
- # # Or use the return value to register a callback.
563
- # operation.on_done do |op|
564
- # raise op.results.message if op.error?
565
- # op_results = op.results
566
- # # Process the results.
567
- #
568
- # metadata = op.metadata
569
- # # Process the metadata.
570
- # end
571
- #
572
- # # Manually reload the operation.
573
- # operation.reload!
574
- #
575
- # # Or block until the operation completes, triggering callbacks on
576
- # # completion.
577
- # operation.wait_until_done!
578
-
579
- def delete_cluster \
580
- project_id,
581
- region,
582
- cluster_name,
583
- cluster_uuid: nil,
584
- request_id: nil,
585
- options: nil
586
- req = {
587
- project_id: project_id,
588
- region: region,
589
- cluster_name: cluster_name,
590
- cluster_uuid: cluster_uuid,
591
- request_id: request_id
592
- }.delete_if { |_, v| v.nil? }
593
- req = Google::Gax::to_proto(req, Google::Cloud::Dataproc::V1::DeleteClusterRequest)
594
- operation = Google::Gax::Operation.new(
595
- @delete_cluster.call(req, options),
596
- @operations_client,
597
- Google::Protobuf::Empty,
598
- Google::Cloud::Dataproc::V1::ClusterOperationMetadata,
599
- call_options: options
600
- )
601
- operation.on_done { |operation| yield(operation) } if block_given?
602
- operation
603
- end
604
-
605
- # Gets the resource representation for a cluster in a project.
606
- #
607
- # @param project_id [String]
608
- # Required. The ID of the Google Cloud Platform project that the cluster
609
- # belongs to.
610
- # @param region [String]
611
- # Required. The Dataproc region in which to handle the request.
612
- # @param cluster_name [String]
613
- # Required. The cluster name.
614
- # @param options [Google::Gax::CallOptions]
615
- # Overrides the default settings for this call, e.g, timeout,
616
- # retries, etc.
617
- # @yield [result, operation] Access the result along with the RPC operation
618
- # @yieldparam result [Google::Cloud::Dataproc::V1::Cluster]
619
- # @yieldparam operation [GRPC::ActiveCall::Operation]
620
- # @return [Google::Cloud::Dataproc::V1::Cluster]
621
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
622
- # @example
623
- # require "google/cloud/dataproc"
624
- #
625
- # cluster_controller_client = Google::Cloud::Dataproc::ClusterController.new(version: :v1)
626
- #
627
- # # TODO: Initialize `project_id`:
628
- # project_id = ''
629
- #
630
- # # TODO: Initialize `region`:
631
- # region = ''
632
- #
633
- # # TODO: Initialize `cluster_name`:
634
- # cluster_name = ''
635
- # response = cluster_controller_client.get_cluster(project_id, region, cluster_name)
636
-
637
- def get_cluster \
638
- project_id,
639
- region,
640
- cluster_name,
641
- options: nil,
642
- &block
643
- req = {
644
- project_id: project_id,
645
- region: region,
646
- cluster_name: cluster_name
647
- }.delete_if { |_, v| v.nil? }
648
- req = Google::Gax::to_proto(req, Google::Cloud::Dataproc::V1::GetClusterRequest)
649
- @get_cluster.call(req, options, &block)
650
- end
651
-
652
- # Lists all regions/\\{region}/clusters in a project.
653
- #
654
- # @param project_id [String]
655
- # Required. The ID of the Google Cloud Platform project that the cluster
656
- # belongs to.
657
- # @param region [String]
658
- # Required. The Dataproc region in which to handle the request.
659
- # @param filter [String]
660
- # Optional. A filter constraining the clusters to list. Filters are
661
- # case-sensitive and have the following syntax:
662
- #
663
- # field = value [AND [field = value]] ...
664
- #
665
- # where **field** is one of `status.state`, `clusterName`, or `labels.[KEY]`,
666
- # and `[KEY]` is a label key. **value** can be `*` to match all values.
667
- # `status.state` can be one of the following: `ACTIVE`, `INACTIVE`,
668
- # `CREATING`, `RUNNING`, `ERROR`, `DELETING`, or `UPDATING`. `ACTIVE`
669
- # contains the `CREATING`, `UPDATING`, and `RUNNING` states. `INACTIVE`
670
- # contains the `DELETING` and `ERROR` states.
671
- # `clusterName` is the name of the cluster provided at creation time.
672
- # Only the logical `AND` operator is supported; space-separated items are
673
- # treated as having an implicit `AND` operator.
674
- #
675
- # Example filter:
676
- #
677
- # status.state = ACTIVE AND clusterName = mycluster
678
- # AND labels.env = staging AND labels.starred = *
679
- # @param page_size [Integer]
680
- # The maximum number of resources contained in the underlying API
681
- # response. If page streaming is performed per-resource, this
682
- # parameter does not affect the return value. If page streaming is
683
- # performed per-page, this determines the maximum number of
684
- # resources in a page.
685
- # @param options [Google::Gax::CallOptions]
686
- # Overrides the default settings for this call, e.g, timeout,
687
- # retries, etc.
688
- # @yield [result, operation] Access the result along with the RPC operation
689
- # @yieldparam result [Google::Gax::PagedEnumerable<Google::Cloud::Dataproc::V1::Cluster>]
690
- # @yieldparam operation [GRPC::ActiveCall::Operation]
691
- # @return [Google::Gax::PagedEnumerable<Google::Cloud::Dataproc::V1::Cluster>]
692
- # An enumerable of Google::Cloud::Dataproc::V1::Cluster instances.
693
- # See Google::Gax::PagedEnumerable documentation for other
694
- # operations such as per-page iteration or access to the response
695
- # object.
696
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
697
- # @example
698
- # require "google/cloud/dataproc"
699
- #
700
- # cluster_controller_client = Google::Cloud::Dataproc::ClusterController.new(version: :v1)
701
- #
702
- # # TODO: Initialize `project_id`:
703
- # project_id = ''
704
- #
705
- # # TODO: Initialize `region`:
706
- # region = ''
707
- #
708
- # # Iterate over all results.
709
- # cluster_controller_client.list_clusters(project_id, region).each do |element|
710
- # # Process element.
711
- # end
712
- #
713
- # # Or iterate over results one page at a time.
714
- # cluster_controller_client.list_clusters(project_id, region).each_page do |page|
715
- # # Process each page at a time.
716
- # page.each do |element|
717
- # # Process element.
718
- # end
719
- # end
720
-
721
- def list_clusters \
722
- project_id,
723
- region,
724
- filter: nil,
725
- page_size: nil,
726
- options: nil,
727
- &block
728
- req = {
729
- project_id: project_id,
730
- region: region,
731
- filter: filter,
732
- page_size: page_size
733
- }.delete_if { |_, v| v.nil? }
734
- req = Google::Gax::to_proto(req, Google::Cloud::Dataproc::V1::ListClustersRequest)
735
- @list_clusters.call(req, options, &block)
736
- end
737
-
738
- # Gets cluster diagnostic information. The returned
739
- # {Google::Longrunning::Operation#metadata Operation#metadata} will be
740
- # [ClusterOperationMetadata](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#clusteroperationmetadata).
741
- # After the operation completes,
742
- # {Google::Longrunning::Operation#response Operation#response}
743
- # contains
744
- # [DiagnoseClusterResults](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#diagnoseclusterresults).
745
- #
746
- # @param project_id [String]
747
- # Required. The ID of the Google Cloud Platform project that the cluster
748
- # belongs to.
749
- # @param region [String]
750
- # Required. The Dataproc region in which to handle the request.
751
- # @param cluster_name [String]
752
- # Required. The cluster name.
753
- # @param options [Google::Gax::CallOptions]
754
- # Overrides the default settings for this call, e.g, timeout,
755
- # retries, etc.
756
- # @return [Google::Gax::Operation]
757
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
758
- # @example
759
- # require "google/cloud/dataproc"
760
- #
761
- # cluster_controller_client = Google::Cloud::Dataproc::ClusterController.new(version: :v1)
762
- #
763
- # # TODO: Initialize `project_id`:
764
- # project_id = ''
765
- #
766
- # # TODO: Initialize `region`:
767
- # region = ''
768
- #
769
- # # TODO: Initialize `cluster_name`:
770
- # cluster_name = ''
771
- #
772
- # # Register a callback during the method call.
773
- # operation = cluster_controller_client.diagnose_cluster(project_id, region, cluster_name) do |op|
774
- # raise op.results.message if op.error?
775
- # op_results = op.results
776
- # # Process the results.
777
- #
778
- # metadata = op.metadata
779
- # # Process the metadata.
780
- # end
781
- #
782
- # # Or use the return value to register a callback.
783
- # operation.on_done do |op|
784
- # raise op.results.message if op.error?
785
- # op_results = op.results
786
- # # Process the results.
787
- #
788
- # metadata = op.metadata
789
- # # Process the metadata.
790
- # end
791
- #
792
- # # Manually reload the operation.
793
- # operation.reload!
794
- #
795
- # # Or block until the operation completes, triggering callbacks on
796
- # # completion.
797
- # operation.wait_until_done!
798
-
799
- def diagnose_cluster \
800
- project_id,
801
- region,
802
- cluster_name,
803
- options: nil
804
- req = {
805
- project_id: project_id,
806
- region: region,
807
- cluster_name: cluster_name
808
- }.delete_if { |_, v| v.nil? }
809
- req = Google::Gax::to_proto(req, Google::Cloud::Dataproc::V1::DiagnoseClusterRequest)
810
- operation = Google::Gax::Operation.new(
811
- @diagnose_cluster.call(req, options),
812
- @operations_client,
813
- Google::Protobuf::Empty,
814
- Google::Cloud::Dataproc::V1::DiagnoseClusterResults,
815
- call_options: options
816
- )
817
- operation.on_done { |operation| yield(operation) } if block_given?
818
- operation
819
- end
820
- end
821
- end
822
- end
823
- end
824
- end