google-cloud-dataproc 0.10.0 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (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,778 +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/workflow_templates.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/workflow_templates_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 API interface for managing Workflow Templates in the
39
- # Dataproc API.
40
- #
41
- # @!attribute [r] workflow_template_service_stub
42
- # @return [Google::Cloud::Dataproc::V1beta2::WorkflowTemplateService::Stub]
43
- class WorkflowTemplateServiceClient
44
- # @private
45
- attr_reader :workflow_template_service_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_workflow_templates" => Google::Gax::PageDescriptor.new(
60
- "page_token",
61
- "next_page_token",
62
- "templates")
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
- class OperationsClient < Google::Longrunning::OperationsClient
74
- self::SERVICE_ADDRESS = WorkflowTemplateServiceClient::SERVICE_ADDRESS
75
- self::GRPC_INTERCEPTORS = WorkflowTemplateServiceClient::GRPC_INTERCEPTORS
76
- end
77
-
78
- REGION_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
79
- "projects/{project}/regions/{region}"
80
- )
81
-
82
- private_constant :REGION_PATH_TEMPLATE
83
-
84
- WORKFLOW_TEMPLATE_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
85
- "projects/{project}/regions/{region}/workflowTemplates/{workflow_template}"
86
- )
87
-
88
- private_constant :WORKFLOW_TEMPLATE_PATH_TEMPLATE
89
-
90
- # Returns a fully-qualified region resource name string.
91
- # @param project [String]
92
- # @param region [String]
93
- # @return [String]
94
- def self.region_path project, region
95
- REGION_PATH_TEMPLATE.render(
96
- :"project" => project,
97
- :"region" => region
98
- )
99
- end
100
-
101
- # Returns a fully-qualified workflow_template resource name string.
102
- # @param project [String]
103
- # @param region [String]
104
- # @param workflow_template [String]
105
- # @return [String]
106
- def self.workflow_template_path project, region, workflow_template
107
- WORKFLOW_TEMPLATE_PATH_TEMPLATE.render(
108
- :"project" => project,
109
- :"region" => region,
110
- :"workflow_template" => workflow_template
111
- )
112
- end
113
-
114
- # @param credentials [Google::Auth::Credentials, String, Hash, GRPC::Core::Channel, GRPC::Core::ChannelCredentials, Proc]
115
- # Provides the means for authenticating requests made by the client. This parameter can
116
- # be many types.
117
- # A `Google::Auth::Credentials` uses a the properties of its represented keyfile for
118
- # authenticating requests made by this client.
119
- # A `String` will be treated as the path to the keyfile to be used for the construction of
120
- # credentials for this client.
121
- # A `Hash` will be treated as the contents of a keyfile to be used for the construction of
122
- # credentials for this client.
123
- # A `GRPC::Core::Channel` will be used to make calls through.
124
- # A `GRPC::Core::ChannelCredentials` for the setting up the RPC client. The channel credentials
125
- # should already be composed with a `GRPC::Core::CallCredentials` object.
126
- # A `Proc` will be used as an updater_proc for the Grpc channel. The proc transforms the
127
- # metadata for requests, generally, to give OAuth credentials.
128
- # @param scopes [Array<String>]
129
- # The OAuth scopes for this service. This parameter is ignored if
130
- # an updater_proc is supplied.
131
- # @param client_config [Hash]
132
- # A Hash for call options for each method. See
133
- # Google::Gax#construct_settings for the structure of
134
- # this data. Falls back to the default config if not specified
135
- # or the specified config is missing data points.
136
- # @param timeout [Numeric]
137
- # The default timeout, in seconds, for calls made through this client.
138
- # @param metadata [Hash]
139
- # Default metadata to be sent with each request. This can be overridden on a per call basis.
140
- # @param service_address [String]
141
- # Override for the service hostname, or `nil` to leave as the default.
142
- # @param service_port [Integer]
143
- # Override for the service port, or `nil` to leave as the default.
144
- # @param exception_transformer [Proc]
145
- # An optional proc that intercepts any exceptions raised during an API call to inject
146
- # custom error handling.
147
- def initialize \
148
- credentials: nil,
149
- scopes: ALL_SCOPES,
150
- client_config: {},
151
- timeout: DEFAULT_TIMEOUT,
152
- metadata: nil,
153
- service_address: nil,
154
- service_port: nil,
155
- exception_transformer: nil,
156
- lib_name: nil,
157
- lib_version: ""
158
- # These require statements are intentionally placed here to initialize
159
- # the gRPC module only when it's required.
160
- # See https://github.com/googleapis/toolkit/issues/446
161
- require "google/gax/grpc"
162
- require "google/cloud/dataproc/v1beta2/workflow_templates_services_pb"
163
-
164
- credentials ||= Google::Cloud::Dataproc::V1beta2::Credentials.default
165
-
166
- @operations_client = OperationsClient.new(
167
- credentials: credentials,
168
- scopes: scopes,
169
- client_config: client_config,
170
- timeout: timeout,
171
- lib_name: lib_name,
172
- service_address: service_address,
173
- service_port: service_port,
174
- lib_version: lib_version,
175
- metadata: metadata,
176
- )
177
-
178
- if credentials.is_a?(String) || credentials.is_a?(Hash)
179
- updater_proc = Google::Cloud::Dataproc::V1beta2::Credentials.new(credentials).updater_proc
180
- end
181
- if credentials.is_a?(GRPC::Core::Channel)
182
- channel = credentials
183
- end
184
- if credentials.is_a?(GRPC::Core::ChannelCredentials)
185
- chan_creds = credentials
186
- end
187
- if credentials.is_a?(Proc)
188
- updater_proc = credentials
189
- end
190
- if credentials.is_a?(Google::Auth::Credentials)
191
- updater_proc = credentials.updater_proc
192
- end
193
-
194
- package_version = Google::Cloud::Dataproc::VERSION
195
-
196
- google_api_client = "gl-ruby/#{RUBY_VERSION}"
197
- google_api_client << " #{lib_name}/#{lib_version}" if lib_name
198
- google_api_client << " gapic/#{package_version} gax/#{Google::Gax::VERSION}"
199
- google_api_client << " grpc/#{GRPC::VERSION}"
200
- google_api_client.freeze
201
-
202
- headers = { :"x-goog-api-client" => google_api_client }
203
- if credentials.respond_to?(:quota_project_id) && credentials.quota_project_id
204
- headers[:"x-goog-user-project"] = credentials.quota_project_id
205
- end
206
- headers.merge!(metadata) unless metadata.nil?
207
- client_config_file = Pathname.new(__dir__).join(
208
- "workflow_template_service_client_config.json"
209
- )
210
- defaults = client_config_file.open do |f|
211
- Google::Gax.construct_settings(
212
- "google.cloud.dataproc.v1beta2.WorkflowTemplateService",
213
- JSON.parse(f.read),
214
- client_config,
215
- Google::Gax::Grpc::STATUS_CODE_NAMES,
216
- timeout,
217
- page_descriptors: PAGE_DESCRIPTORS,
218
- errors: Google::Gax::Grpc::API_ERRORS,
219
- metadata: headers
220
- )
221
- end
222
-
223
- # Allow overriding the service path/port in subclasses.
224
- service_path = service_address || self.class::SERVICE_ADDRESS
225
- port = service_port || self.class::DEFAULT_SERVICE_PORT
226
- interceptors = self.class::GRPC_INTERCEPTORS
227
- @workflow_template_service_stub = Google::Gax::Grpc.create_stub(
228
- service_path,
229
- port,
230
- chan_creds: chan_creds,
231
- channel: channel,
232
- updater_proc: updater_proc,
233
- scopes: scopes,
234
- interceptors: interceptors,
235
- &Google::Cloud::Dataproc::V1beta2::WorkflowTemplateService::Stub.method(:new)
236
- )
237
-
238
- @create_workflow_template = Google::Gax.create_api_call(
239
- @workflow_template_service_stub.method(:create_workflow_template),
240
- defaults["create_workflow_template"],
241
- exception_transformer: exception_transformer,
242
- params_extractor: proc do |request|
243
- {'parent' => request.parent}
244
- end
245
- )
246
- @get_workflow_template = Google::Gax.create_api_call(
247
- @workflow_template_service_stub.method(:get_workflow_template),
248
- defaults["get_workflow_template"],
249
- exception_transformer: exception_transformer,
250
- params_extractor: proc do |request|
251
- {'name' => request.name}
252
- end
253
- )
254
- @instantiate_workflow_template = Google::Gax.create_api_call(
255
- @workflow_template_service_stub.method(:instantiate_workflow_template),
256
- defaults["instantiate_workflow_template"],
257
- exception_transformer: exception_transformer,
258
- params_extractor: proc do |request|
259
- {'name' => request.name}
260
- end
261
- )
262
- @instantiate_inline_workflow_template = Google::Gax.create_api_call(
263
- @workflow_template_service_stub.method(:instantiate_inline_workflow_template),
264
- defaults["instantiate_inline_workflow_template"],
265
- exception_transformer: exception_transformer,
266
- params_extractor: proc do |request|
267
- {'parent' => request.parent}
268
- end
269
- )
270
- @update_workflow_template = Google::Gax.create_api_call(
271
- @workflow_template_service_stub.method(:update_workflow_template),
272
- defaults["update_workflow_template"],
273
- exception_transformer: exception_transformer,
274
- params_extractor: proc do |request|
275
- {'template.name' => request.template.name}
276
- end
277
- )
278
- @list_workflow_templates = Google::Gax.create_api_call(
279
- @workflow_template_service_stub.method(:list_workflow_templates),
280
- defaults["list_workflow_templates"],
281
- exception_transformer: exception_transformer,
282
- params_extractor: proc do |request|
283
- {'parent' => request.parent}
284
- end
285
- )
286
- @delete_workflow_template = Google::Gax.create_api_call(
287
- @workflow_template_service_stub.method(:delete_workflow_template),
288
- defaults["delete_workflow_template"],
289
- exception_transformer: exception_transformer,
290
- params_extractor: proc do |request|
291
- {'name' => request.name}
292
- end
293
- )
294
- end
295
-
296
- # Service calls
297
-
298
- # Creates new workflow template.
299
- #
300
- # @param parent [String]
301
- # Required. The resource name of the region or location, as described
302
- # in https://cloud.google.com/apis/design/resource_names.
303
- #
304
- # * For `projects.regions.workflowTemplates,create`, the resource name of the
305
- # region has the following format:
306
- # `projects/{project_id}/regions/{region}`
307
- #
308
- # * For `projects.locations.workflowTemplates.create`, the resource name of
309
- # the location has the following format:
310
- # `projects/{project_id}/locations/{location}`
311
- # @param template [Google::Cloud::Dataproc::V1beta2::WorkflowTemplate | Hash]
312
- # Required. The Dataproc workflow template to create.
313
- # A hash of the same form as `Google::Cloud::Dataproc::V1beta2::WorkflowTemplate`
314
- # can also be provided.
315
- # @param options [Google::Gax::CallOptions]
316
- # Overrides the default settings for this call, e.g, timeout,
317
- # retries, etc.
318
- # @yield [result, operation] Access the result along with the RPC operation
319
- # @yieldparam result [Google::Cloud::Dataproc::V1beta2::WorkflowTemplate]
320
- # @yieldparam operation [GRPC::ActiveCall::Operation]
321
- # @return [Google::Cloud::Dataproc::V1beta2::WorkflowTemplate]
322
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
323
- # @example
324
- # require "google/cloud/dataproc"
325
- #
326
- # workflow_template_client = Google::Cloud::Dataproc::WorkflowTemplateService.new(version: :v1beta2)
327
- # formatted_parent = Google::Cloud::Dataproc::V1beta2::WorkflowTemplateServiceClient.region_path("[PROJECT]", "[REGION]")
328
- #
329
- # # TODO: Initialize `template`:
330
- # template = {}
331
- # response = workflow_template_client.create_workflow_template(formatted_parent, template)
332
-
333
- def create_workflow_template \
334
- parent,
335
- template,
336
- options: nil,
337
- &block
338
- req = {
339
- parent: parent,
340
- template: template
341
- }.delete_if { |_, v| v.nil? }
342
- req = Google::Gax::to_proto(req, Google::Cloud::Dataproc::V1beta2::CreateWorkflowTemplateRequest)
343
- @create_workflow_template.call(req, options, &block)
344
- end
345
-
346
- # Retrieves the latest workflow template.
347
- #
348
- # Can retrieve previously instantiated template by specifying optional
349
- # version parameter.
350
- #
351
- # @param name [String]
352
- # Required. The resource name of the workflow template, as described
353
- # in https://cloud.google.com/apis/design/resource_names.
354
- #
355
- # * For `projects.regions.workflowTemplates.get`, the resource name of the
356
- # template has the following format:
357
- # `projects/{project_id}/regions/{region}/workflowTemplates/{template_id}`
358
- #
359
- # * For `projects.locations.workflowTemplates.get`, the resource name of the
360
- # template has the following format:
361
- # `projects/{project_id}/locations/{location}/workflowTemplates/{template_id}`
362
- # @param version [Integer]
363
- # Optional. The version of workflow template to retrieve. Only previously
364
- # instantiated versions can be retrieved.
365
- #
366
- # If unspecified, retrieves the current version.
367
- # @param options [Google::Gax::CallOptions]
368
- # Overrides the default settings for this call, e.g, timeout,
369
- # retries, etc.
370
- # @yield [result, operation] Access the result along with the RPC operation
371
- # @yieldparam result [Google::Cloud::Dataproc::V1beta2::WorkflowTemplate]
372
- # @yieldparam operation [GRPC::ActiveCall::Operation]
373
- # @return [Google::Cloud::Dataproc::V1beta2::WorkflowTemplate]
374
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
375
- # @example
376
- # require "google/cloud/dataproc"
377
- #
378
- # workflow_template_client = Google::Cloud::Dataproc::WorkflowTemplateService.new(version: :v1beta2)
379
- # formatted_name = Google::Cloud::Dataproc::V1beta2::WorkflowTemplateServiceClient.workflow_template_path("[PROJECT]", "[REGION]", "[WORKFLOW_TEMPLATE]")
380
- # response = workflow_template_client.get_workflow_template(formatted_name)
381
-
382
- def get_workflow_template \
383
- name,
384
- version: nil,
385
- options: nil,
386
- &block
387
- req = {
388
- name: name,
389
- version: version
390
- }.delete_if { |_, v| v.nil? }
391
- req = Google::Gax::to_proto(req, Google::Cloud::Dataproc::V1beta2::GetWorkflowTemplateRequest)
392
- @get_workflow_template.call(req, options, &block)
393
- end
394
-
395
- # Instantiates a template and begins execution.
396
- #
397
- # The returned Operation can be used to track execution of
398
- # workflow by polling
399
- # {Google::Longrunning::Operations::GetOperation operations::get}.
400
- # The Operation will complete when entire workflow is finished.
401
- #
402
- # The running workflow can be aborted via
403
- # {Google::Longrunning::Operations::CancelOperation operations::cancel}.
404
- # This will cause any inflight jobs to be cancelled and workflow-owned
405
- # clusters to be deleted.
406
- #
407
- # The {Google::Longrunning::Operation#metadata Operation#metadata} will be
408
- # [WorkflowMetadata](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1beta2#workflowmetadata).
409
- # Also see [Using
410
- # WorkflowMetadata](https://cloud.google.com/dataproc/docs/concepts/workflows/debugging#using_workflowmetadata).
411
- #
412
- # On successful completion,
413
- # {Google::Longrunning::Operation#response Operation#response} will be
414
- # {Google::Protobuf::Empty Empty}.
415
- #
416
- # @param name [String]
417
- # Required. The resource name of the workflow template, as described
418
- # in https://cloud.google.com/apis/design/resource_names.
419
- #
420
- # * For `projects.regions.workflowTemplates.instantiate`, the resource name
421
- # of the template has the following format:
422
- # `projects/{project_id}/regions/{region}/workflowTemplates/{template_id}`
423
- #
424
- # * For `projects.locations.workflowTemplates.instantiate`, the resource name
425
- # of the template has the following format:
426
- # `projects/{project_id}/locations/{location}/workflowTemplates/{template_id}`
427
- # @param version [Integer]
428
- # Optional. The version of workflow template to instantiate. If specified,
429
- # the workflow will be instantiated only if the current version of
430
- # the workflow template has the supplied version.
431
- #
432
- # This option cannot be used to instantiate a previous version of
433
- # workflow template.
434
- # @param instance_id [String]
435
- # Deprecated. Please use `request_id` field instead.
436
- # @param request_id [String]
437
- # Optional. A tag that prevents multiple concurrent workflow
438
- # instances with the same tag from running. This mitigates risk of
439
- # concurrent instances started due to retries.
440
- #
441
- # It is recommended to always set this value to a
442
- # [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier).
443
- #
444
- # The tag must contain only letters (a-z, A-Z), numbers (0-9),
445
- # underscores (_), and hyphens (-). The maximum length is 40 characters.
446
- # @param parameters [Hash{String => String}]
447
- # Optional. Map from parameter names to values that should be used for those
448
- # parameters. Values may not exceed 100 characters.
449
- # @param options [Google::Gax::CallOptions]
450
- # Overrides the default settings for this call, e.g, timeout,
451
- # retries, etc.
452
- # @return [Google::Gax::Operation]
453
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
454
- # @example
455
- # require "google/cloud/dataproc"
456
- #
457
- # workflow_template_client = Google::Cloud::Dataproc::WorkflowTemplateService.new(version: :v1beta2)
458
- # formatted_name = Google::Cloud::Dataproc::V1beta2::WorkflowTemplateServiceClient.workflow_template_path("[PROJECT]", "[REGION]", "[WORKFLOW_TEMPLATE]")
459
- #
460
- # # Register a callback during the method call.
461
- # operation = workflow_template_client.instantiate_workflow_template(formatted_name) 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
- # # Or use the return value to register a callback.
471
- # operation.on_done do |op|
472
- # raise op.results.message if op.error?
473
- # op_results = op.results
474
- # # Process the results.
475
- #
476
- # metadata = op.metadata
477
- # # Process the metadata.
478
- # end
479
- #
480
- # # Manually reload the operation.
481
- # operation.reload!
482
- #
483
- # # Or block until the operation completes, triggering callbacks on
484
- # # completion.
485
- # operation.wait_until_done!
486
-
487
- def instantiate_workflow_template \
488
- name,
489
- version: nil,
490
- instance_id: nil,
491
- request_id: nil,
492
- parameters: nil,
493
- options: nil
494
- req = {
495
- name: name,
496
- version: version,
497
- instance_id: instance_id,
498
- request_id: request_id,
499
- parameters: parameters
500
- }.delete_if { |_, v| v.nil? }
501
- req = Google::Gax::to_proto(req, Google::Cloud::Dataproc::V1beta2::InstantiateWorkflowTemplateRequest)
502
- operation = Google::Gax::Operation.new(
503
- @instantiate_workflow_template.call(req, options),
504
- @operations_client,
505
- Google::Protobuf::Empty,
506
- Google::Cloud::Dataproc::V1beta2::WorkflowMetadata,
507
- call_options: options
508
- )
509
- operation.on_done { |operation| yield(operation) } if block_given?
510
- operation
511
- end
512
-
513
- # Instantiates a template and begins execution.
514
- #
515
- # This method is equivalent to executing the sequence
516
- # {Google::Cloud::Dataproc::V1beta2::WorkflowTemplateService::CreateWorkflowTemplate CreateWorkflowTemplate}, {Google::Cloud::Dataproc::V1beta2::WorkflowTemplateService::InstantiateWorkflowTemplate InstantiateWorkflowTemplate},
517
- # {Google::Cloud::Dataproc::V1beta2::WorkflowTemplateService::DeleteWorkflowTemplate DeleteWorkflowTemplate}.
518
- #
519
- # The returned Operation can be used to track execution of
520
- # workflow by polling
521
- # {Google::Longrunning::Operations::GetOperation operations::get}.
522
- # The Operation will complete when entire workflow is finished.
523
- #
524
- # The running workflow can be aborted via
525
- # {Google::Longrunning::Operations::CancelOperation operations::cancel}.
526
- # This will cause any inflight jobs to be cancelled and workflow-owned
527
- # clusters to be deleted.
528
- #
529
- # The {Google::Longrunning::Operation#metadata Operation#metadata} will be
530
- # [WorkflowMetadata](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#workflowmetadata).
531
- # Also see [Using
532
- # WorkflowMetadata](https://cloud.google.com/dataproc/docs/concepts/workflows/debugging#using_workflowmetadata).
533
- #
534
- # On successful completion,
535
- # {Google::Longrunning::Operation#response Operation#response} will be
536
- # {Google::Protobuf::Empty Empty}.
537
- #
538
- # @param parent [String]
539
- # Required. The resource name of the region or location, as described
540
- # in https://cloud.google.com/apis/design/resource_names.
541
- #
542
- # * For `projects.regions.workflowTemplates,instantiateinline`, the resource
543
- # name of the region has the following format:
544
- # `projects/{project_id}/regions/{region}`
545
- #
546
- # * For `projects.locations.workflowTemplates.instantiateinline`, the
547
- # resource name of the location has the following format:
548
- # `projects/{project_id}/locations/{location}`
549
- # @param template [Google::Cloud::Dataproc::V1beta2::WorkflowTemplate | Hash]
550
- # Required. The workflow template to instantiate.
551
- # A hash of the same form as `Google::Cloud::Dataproc::V1beta2::WorkflowTemplate`
552
- # can also be provided.
553
- # @param instance_id [String]
554
- # Deprecated. Please use `request_id` field instead.
555
- # @param request_id [String]
556
- # Optional. A tag that prevents multiple concurrent workflow
557
- # instances with the same tag from running. This mitigates risk of
558
- # concurrent instances started due to retries.
559
- #
560
- # It is recommended to always set this value to a
561
- # [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier).
562
- #
563
- # The tag must contain only letters (a-z, A-Z), numbers (0-9),
564
- # underscores (_), and hyphens (-). The maximum length is 40 characters.
565
- # @param options [Google::Gax::CallOptions]
566
- # Overrides the default settings for this call, e.g, timeout,
567
- # retries, etc.
568
- # @return [Google::Gax::Operation]
569
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
570
- # @example
571
- # require "google/cloud/dataproc"
572
- #
573
- # workflow_template_client = Google::Cloud::Dataproc::WorkflowTemplateService.new(version: :v1beta2)
574
- # formatted_parent = Google::Cloud::Dataproc::V1beta2::WorkflowTemplateServiceClient.region_path("[PROJECT]", "[REGION]")
575
- #
576
- # # TODO: Initialize `template`:
577
- # template = {}
578
- #
579
- # # Register a callback during the method call.
580
- # operation = workflow_template_client.instantiate_inline_workflow_template(formatted_parent, template) do |op|
581
- # raise op.results.message if op.error?
582
- # op_results = op.results
583
- # # Process the results.
584
- #
585
- # metadata = op.metadata
586
- # # Process the metadata.
587
- # end
588
- #
589
- # # Or use the return value to register a callback.
590
- # operation.on_done do |op|
591
- # raise op.results.message if op.error?
592
- # op_results = op.results
593
- # # Process the results.
594
- #
595
- # metadata = op.metadata
596
- # # Process the metadata.
597
- # end
598
- #
599
- # # Manually reload the operation.
600
- # operation.reload!
601
- #
602
- # # Or block until the operation completes, triggering callbacks on
603
- # # completion.
604
- # operation.wait_until_done!
605
-
606
- def instantiate_inline_workflow_template \
607
- parent,
608
- template,
609
- instance_id: nil,
610
- request_id: nil,
611
- options: nil
612
- req = {
613
- parent: parent,
614
- template: template,
615
- instance_id: instance_id,
616
- request_id: request_id
617
- }.delete_if { |_, v| v.nil? }
618
- req = Google::Gax::to_proto(req, Google::Cloud::Dataproc::V1beta2::InstantiateInlineWorkflowTemplateRequest)
619
- operation = Google::Gax::Operation.new(
620
- @instantiate_inline_workflow_template.call(req, options),
621
- @operations_client,
622
- Google::Protobuf::Empty,
623
- Google::Cloud::Dataproc::V1beta2::WorkflowMetadata,
624
- call_options: options
625
- )
626
- operation.on_done { |operation| yield(operation) } if block_given?
627
- operation
628
- end
629
-
630
- # Updates (replaces) workflow template. The updated template
631
- # must contain version that matches the current server version.
632
- #
633
- # @param template [Google::Cloud::Dataproc::V1beta2::WorkflowTemplate | Hash]
634
- # Required. The updated workflow template.
635
- #
636
- # The `template.version` field must match the current version.
637
- # A hash of the same form as `Google::Cloud::Dataproc::V1beta2::WorkflowTemplate`
638
- # can also be provided.
639
- # @param options [Google::Gax::CallOptions]
640
- # Overrides the default settings for this call, e.g, timeout,
641
- # retries, etc.
642
- # @yield [result, operation] Access the result along with the RPC operation
643
- # @yieldparam result [Google::Cloud::Dataproc::V1beta2::WorkflowTemplate]
644
- # @yieldparam operation [GRPC::ActiveCall::Operation]
645
- # @return [Google::Cloud::Dataproc::V1beta2::WorkflowTemplate]
646
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
647
- # @example
648
- # require "google/cloud/dataproc"
649
- #
650
- # workflow_template_client = Google::Cloud::Dataproc::WorkflowTemplateService.new(version: :v1beta2)
651
- #
652
- # # TODO: Initialize `template`:
653
- # template = {}
654
- # response = workflow_template_client.update_workflow_template(template)
655
-
656
- def update_workflow_template \
657
- template,
658
- options: nil,
659
- &block
660
- req = {
661
- template: template
662
- }.delete_if { |_, v| v.nil? }
663
- req = Google::Gax::to_proto(req, Google::Cloud::Dataproc::V1beta2::UpdateWorkflowTemplateRequest)
664
- @update_workflow_template.call(req, options, &block)
665
- end
666
-
667
- # Lists workflows that match the specified filter in the request.
668
- #
669
- # @param parent [String]
670
- # Required. The resource name of the region or location, as described
671
- # in https://cloud.google.com/apis/design/resource_names.
672
- #
673
- # * For `projects.regions.workflowTemplates,list`, the resource
674
- # name of the region has the following format:
675
- # `projects/{project_id}/regions/{region}`
676
- #
677
- # * For `projects.locations.workflowTemplates.list`, the
678
- # resource name of the location has the following format:
679
- # `projects/{project_id}/locations/{location}`
680
- # @param page_size [Integer]
681
- # The maximum number of resources contained in the underlying API
682
- # response. If page streaming is performed per-resource, this
683
- # parameter does not affect the return value. If page streaming is
684
- # performed per-page, this determines the maximum number of
685
- # resources in a page.
686
- # @param options [Google::Gax::CallOptions]
687
- # Overrides the default settings for this call, e.g, timeout,
688
- # retries, etc.
689
- # @yield [result, operation] Access the result along with the RPC operation
690
- # @yieldparam result [Google::Gax::PagedEnumerable<Google::Cloud::Dataproc::V1beta2::WorkflowTemplate>]
691
- # @yieldparam operation [GRPC::ActiveCall::Operation]
692
- # @return [Google::Gax::PagedEnumerable<Google::Cloud::Dataproc::V1beta2::WorkflowTemplate>]
693
- # An enumerable of Google::Cloud::Dataproc::V1beta2::WorkflowTemplate instances.
694
- # See Google::Gax::PagedEnumerable documentation for other
695
- # operations such as per-page iteration or access to the response
696
- # object.
697
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
698
- # @example
699
- # require "google/cloud/dataproc"
700
- #
701
- # workflow_template_client = Google::Cloud::Dataproc::WorkflowTemplateService.new(version: :v1beta2)
702
- # formatted_parent = Google::Cloud::Dataproc::V1beta2::WorkflowTemplateServiceClient.region_path("[PROJECT]", "[REGION]")
703
- #
704
- # # Iterate over all results.
705
- # workflow_template_client.list_workflow_templates(formatted_parent).each do |element|
706
- # # Process element.
707
- # end
708
- #
709
- # # Or iterate over results one page at a time.
710
- # workflow_template_client.list_workflow_templates(formatted_parent).each_page do |page|
711
- # # Process each page at a time.
712
- # page.each do |element|
713
- # # Process element.
714
- # end
715
- # end
716
-
717
- def list_workflow_templates \
718
- parent,
719
- page_size: nil,
720
- options: nil,
721
- &block
722
- req = {
723
- parent: parent,
724
- page_size: page_size
725
- }.delete_if { |_, v| v.nil? }
726
- req = Google::Gax::to_proto(req, Google::Cloud::Dataproc::V1beta2::ListWorkflowTemplatesRequest)
727
- @list_workflow_templates.call(req, options, &block)
728
- end
729
-
730
- # Deletes a workflow template. It does not cancel in-progress workflows.
731
- #
732
- # @param name [String]
733
- # Required. The resource name of the workflow template, as described
734
- # in https://cloud.google.com/apis/design/resource_names.
735
- #
736
- # * For `projects.regions.workflowTemplates.delete`, the resource name
737
- # of the template has the following format:
738
- # `projects/{project_id}/regions/{region}/workflowTemplates/{template_id}`
739
- #
740
- # * For `projects.locations.workflowTemplates.instantiate`, the resource name
741
- # of the template has the following format:
742
- # `projects/{project_id}/locations/{location}/workflowTemplates/{template_id}`
743
- # @param version [Integer]
744
- # Optional. The version of workflow template to delete. If specified,
745
- # will only delete the template if the current server version matches
746
- # specified version.
747
- # @param options [Google::Gax::CallOptions]
748
- # Overrides the default settings for this call, e.g, timeout,
749
- # retries, etc.
750
- # @yield [result, operation] Access the result along with the RPC operation
751
- # @yieldparam result []
752
- # @yieldparam operation [GRPC::ActiveCall::Operation]
753
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
754
- # @example
755
- # require "google/cloud/dataproc"
756
- #
757
- # workflow_template_client = Google::Cloud::Dataproc::WorkflowTemplateService.new(version: :v1beta2)
758
- # formatted_name = Google::Cloud::Dataproc::V1beta2::WorkflowTemplateServiceClient.workflow_template_path("[PROJECT]", "[REGION]", "[WORKFLOW_TEMPLATE]")
759
- # workflow_template_client.delete_workflow_template(formatted_name)
760
-
761
- def delete_workflow_template \
762
- name,
763
- version: nil,
764
- options: nil,
765
- &block
766
- req = {
767
- name: name,
768
- version: version
769
- }.delete_if { |_, v| v.nil? }
770
- req = Google::Gax::to_proto(req, Google::Cloud::Dataproc::V1beta2::DeleteWorkflowTemplateRequest)
771
- @delete_workflow_template.call(req, options, &block)
772
- nil
773
- end
774
- end
775
- end
776
- end
777
- end
778
- end