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,770 +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/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/v1/workflow_templates_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 API interface for managing Workflow Templates in the
39
- # Dataproc API.
40
- #
41
- # @!attribute [r] workflow_template_service_stub
42
- # @return [Google::Cloud::Dataproc::V1::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/v1/workflow_templates_services_pb"
163
-
164
- credentials ||= Google::Cloud::Dataproc::V1::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::V1::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.v1.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::V1::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::V1::WorkflowTemplate | Hash]
312
- # Required. The Dataproc workflow template to create.
313
- # A hash of the same form as `Google::Cloud::Dataproc::V1::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::V1::WorkflowTemplate]
320
- # @yieldparam operation [GRPC::ActiveCall::Operation]
321
- # @return [Google::Cloud::Dataproc::V1::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: :v1)
327
- # formatted_parent = Google::Cloud::Dataproc::V1::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::V1::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::V1::WorkflowTemplate]
372
- # @yieldparam operation [GRPC::ActiveCall::Operation]
373
- # @return [Google::Cloud::Dataproc::V1::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: :v1)
379
- # formatted_name = Google::Cloud::Dataproc::V1::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::V1::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.v1#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 request_id [String]
435
- # Optional. A tag that prevents multiple concurrent workflow
436
- # instances with the same tag from running. This mitigates risk of
437
- # concurrent instances started due to retries.
438
- #
439
- # It is recommended to always set this value to a
440
- # [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier).
441
- #
442
- # The tag must contain only letters (a-z, A-Z), numbers (0-9),
443
- # underscores (_), and hyphens (-). The maximum length is 40 characters.
444
- # @param parameters [Hash{String => String}]
445
- # Optional. Map from parameter names to values that should be used for those
446
- # parameters. Values may not exceed 100 characters.
447
- # @param options [Google::Gax::CallOptions]
448
- # Overrides the default settings for this call, e.g, timeout,
449
- # retries, etc.
450
- # @return [Google::Gax::Operation]
451
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
452
- # @example
453
- # require "google/cloud/dataproc"
454
- #
455
- # workflow_template_client = Google::Cloud::Dataproc::WorkflowTemplateService.new(version: :v1)
456
- # formatted_name = Google::Cloud::Dataproc::V1::WorkflowTemplateServiceClient.workflow_template_path("[PROJECT]", "[REGION]", "[WORKFLOW_TEMPLATE]")
457
- #
458
- # # Register a callback during the method call.
459
- # operation = workflow_template_client.instantiate_workflow_template(formatted_name) do |op|
460
- # raise op.results.message if op.error?
461
- # op_results = op.results
462
- # # Process the results.
463
- #
464
- # metadata = op.metadata
465
- # # Process the metadata.
466
- # end
467
- #
468
- # # Or use the return value to register a callback.
469
- # operation.on_done do |op|
470
- # raise op.results.message if op.error?
471
- # op_results = op.results
472
- # # Process the results.
473
- #
474
- # metadata = op.metadata
475
- # # Process the metadata.
476
- # end
477
- #
478
- # # Manually reload the operation.
479
- # operation.reload!
480
- #
481
- # # Or block until the operation completes, triggering callbacks on
482
- # # completion.
483
- # operation.wait_until_done!
484
-
485
- def instantiate_workflow_template \
486
- name,
487
- version: nil,
488
- request_id: nil,
489
- parameters: nil,
490
- options: nil
491
- req = {
492
- name: name,
493
- version: version,
494
- request_id: request_id,
495
- parameters: parameters
496
- }.delete_if { |_, v| v.nil? }
497
- req = Google::Gax::to_proto(req, Google::Cloud::Dataproc::V1::InstantiateWorkflowTemplateRequest)
498
- operation = Google::Gax::Operation.new(
499
- @instantiate_workflow_template.call(req, options),
500
- @operations_client,
501
- Google::Protobuf::Empty,
502
- Google::Cloud::Dataproc::V1::WorkflowMetadata,
503
- call_options: options
504
- )
505
- operation.on_done { |operation| yield(operation) } if block_given?
506
- operation
507
- end
508
-
509
- # Instantiates a template and begins execution.
510
- #
511
- # This method is equivalent to executing the sequence
512
- # {Google::Cloud::Dataproc::V1::WorkflowTemplateService::CreateWorkflowTemplate CreateWorkflowTemplate}, {Google::Cloud::Dataproc::V1::WorkflowTemplateService::InstantiateWorkflowTemplate InstantiateWorkflowTemplate},
513
- # {Google::Cloud::Dataproc::V1::WorkflowTemplateService::DeleteWorkflowTemplate DeleteWorkflowTemplate}.
514
- #
515
- # The returned Operation can be used to track execution of
516
- # workflow by polling
517
- # {Google::Longrunning::Operations::GetOperation operations::get}.
518
- # The Operation will complete when entire workflow is finished.
519
- #
520
- # The running workflow can be aborted via
521
- # {Google::Longrunning::Operations::CancelOperation operations::cancel}.
522
- # This will cause any inflight jobs to be cancelled and workflow-owned
523
- # clusters to be deleted.
524
- #
525
- # The {Google::Longrunning::Operation#metadata Operation#metadata} will be
526
- # [WorkflowMetadata](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#workflowmetadata).
527
- # Also see [Using
528
- # WorkflowMetadata](https://cloud.google.com/dataproc/docs/concepts/workflows/debugging#using_workflowmetadata).
529
- #
530
- # On successful completion,
531
- # {Google::Longrunning::Operation#response Operation#response} will be
532
- # {Google::Protobuf::Empty Empty}.
533
- #
534
- # @param parent [String]
535
- # Required. The resource name of the region or location, as described
536
- # in https://cloud.google.com/apis/design/resource_names.
537
- #
538
- # * For `projects.regions.workflowTemplates,instantiateinline`, the resource
539
- # name of the region has the following format:
540
- # `projects/{project_id}/regions/{region}`
541
- #
542
- # * For `projects.locations.workflowTemplates.instantiateinline`, the
543
- # resource name of the location has the following format:
544
- # `projects/{project_id}/locations/{location}`
545
- # @param template [Google::Cloud::Dataproc::V1::WorkflowTemplate | Hash]
546
- # Required. The workflow template to instantiate.
547
- # A hash of the same form as `Google::Cloud::Dataproc::V1::WorkflowTemplate`
548
- # can also be provided.
549
- # @param request_id [String]
550
- # Optional. A tag that prevents multiple concurrent workflow
551
- # instances with the same tag from running. This mitigates risk of
552
- # concurrent instances started due to retries.
553
- #
554
- # It is recommended to always set this value to a
555
- # [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier).
556
- #
557
- # The tag must contain only letters (a-z, A-Z), numbers (0-9),
558
- # underscores (_), and hyphens (-). The maximum length is 40 characters.
559
- # @param options [Google::Gax::CallOptions]
560
- # Overrides the default settings for this call, e.g, timeout,
561
- # retries, etc.
562
- # @return [Google::Gax::Operation]
563
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
564
- # @example
565
- # require "google/cloud/dataproc"
566
- #
567
- # workflow_template_client = Google::Cloud::Dataproc::WorkflowTemplateService.new(version: :v1)
568
- # formatted_parent = Google::Cloud::Dataproc::V1::WorkflowTemplateServiceClient.region_path("[PROJECT]", "[REGION]")
569
- #
570
- # # TODO: Initialize `template`:
571
- # template = {}
572
- #
573
- # # Register a callback during the method call.
574
- # operation = workflow_template_client.instantiate_inline_workflow_template(formatted_parent, template) do |op|
575
- # raise op.results.message if op.error?
576
- # op_results = op.results
577
- # # Process the results.
578
- #
579
- # metadata = op.metadata
580
- # # Process the metadata.
581
- # end
582
- #
583
- # # Or use the return value to register a callback.
584
- # operation.on_done do |op|
585
- # raise op.results.message if op.error?
586
- # op_results = op.results
587
- # # Process the results.
588
- #
589
- # metadata = op.metadata
590
- # # Process the metadata.
591
- # end
592
- #
593
- # # Manually reload the operation.
594
- # operation.reload!
595
- #
596
- # # Or block until the operation completes, triggering callbacks on
597
- # # completion.
598
- # operation.wait_until_done!
599
-
600
- def instantiate_inline_workflow_template \
601
- parent,
602
- template,
603
- request_id: nil,
604
- options: nil
605
- req = {
606
- parent: parent,
607
- template: template,
608
- request_id: request_id
609
- }.delete_if { |_, v| v.nil? }
610
- req = Google::Gax::to_proto(req, Google::Cloud::Dataproc::V1::InstantiateInlineWorkflowTemplateRequest)
611
- operation = Google::Gax::Operation.new(
612
- @instantiate_inline_workflow_template.call(req, options),
613
- @operations_client,
614
- Google::Protobuf::Empty,
615
- Google::Cloud::Dataproc::V1::WorkflowMetadata,
616
- call_options: options
617
- )
618
- operation.on_done { |operation| yield(operation) } if block_given?
619
- operation
620
- end
621
-
622
- # Updates (replaces) workflow template. The updated template
623
- # must contain version that matches the current server version.
624
- #
625
- # @param template [Google::Cloud::Dataproc::V1::WorkflowTemplate | Hash]
626
- # Required. The updated workflow template.
627
- #
628
- # The `template.version` field must match the current version.
629
- # A hash of the same form as `Google::Cloud::Dataproc::V1::WorkflowTemplate`
630
- # can also be provided.
631
- # @param options [Google::Gax::CallOptions]
632
- # Overrides the default settings for this call, e.g, timeout,
633
- # retries, etc.
634
- # @yield [result, operation] Access the result along with the RPC operation
635
- # @yieldparam result [Google::Cloud::Dataproc::V1::WorkflowTemplate]
636
- # @yieldparam operation [GRPC::ActiveCall::Operation]
637
- # @return [Google::Cloud::Dataproc::V1::WorkflowTemplate]
638
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
639
- # @example
640
- # require "google/cloud/dataproc"
641
- #
642
- # workflow_template_client = Google::Cloud::Dataproc::WorkflowTemplateService.new(version: :v1)
643
- #
644
- # # TODO: Initialize `template`:
645
- # template = {}
646
- # response = workflow_template_client.update_workflow_template(template)
647
-
648
- def update_workflow_template \
649
- template,
650
- options: nil,
651
- &block
652
- req = {
653
- template: template
654
- }.delete_if { |_, v| v.nil? }
655
- req = Google::Gax::to_proto(req, Google::Cloud::Dataproc::V1::UpdateWorkflowTemplateRequest)
656
- @update_workflow_template.call(req, options, &block)
657
- end
658
-
659
- # Lists workflows that match the specified filter in the request.
660
- #
661
- # @param parent [String]
662
- # Required. The resource name of the region or location, as described
663
- # in https://cloud.google.com/apis/design/resource_names.
664
- #
665
- # * For `projects.regions.workflowTemplates,list`, the resource
666
- # name of the region has the following format:
667
- # `projects/{project_id}/regions/{region}`
668
- #
669
- # * For `projects.locations.workflowTemplates.list`, the
670
- # resource name of the location has the following format:
671
- # `projects/{project_id}/locations/{location}`
672
- # @param page_size [Integer]
673
- # The maximum number of resources contained in the underlying API
674
- # response. If page streaming is performed per-resource, this
675
- # parameter does not affect the return value. If page streaming is
676
- # performed per-page, this determines the maximum number of
677
- # resources in a page.
678
- # @param options [Google::Gax::CallOptions]
679
- # Overrides the default settings for this call, e.g, timeout,
680
- # retries, etc.
681
- # @yield [result, operation] Access the result along with the RPC operation
682
- # @yieldparam result [Google::Gax::PagedEnumerable<Google::Cloud::Dataproc::V1::WorkflowTemplate>]
683
- # @yieldparam operation [GRPC::ActiveCall::Operation]
684
- # @return [Google::Gax::PagedEnumerable<Google::Cloud::Dataproc::V1::WorkflowTemplate>]
685
- # An enumerable of Google::Cloud::Dataproc::V1::WorkflowTemplate instances.
686
- # See Google::Gax::PagedEnumerable documentation for other
687
- # operations such as per-page iteration or access to the response
688
- # object.
689
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
690
- # @example
691
- # require "google/cloud/dataproc"
692
- #
693
- # workflow_template_client = Google::Cloud::Dataproc::WorkflowTemplateService.new(version: :v1)
694
- # formatted_parent = Google::Cloud::Dataproc::V1::WorkflowTemplateServiceClient.region_path("[PROJECT]", "[REGION]")
695
- #
696
- # # Iterate over all results.
697
- # workflow_template_client.list_workflow_templates(formatted_parent).each do |element|
698
- # # Process element.
699
- # end
700
- #
701
- # # Or iterate over results one page at a time.
702
- # workflow_template_client.list_workflow_templates(formatted_parent).each_page do |page|
703
- # # Process each page at a time.
704
- # page.each do |element|
705
- # # Process element.
706
- # end
707
- # end
708
-
709
- def list_workflow_templates \
710
- parent,
711
- page_size: nil,
712
- options: nil,
713
- &block
714
- req = {
715
- parent: parent,
716
- page_size: page_size
717
- }.delete_if { |_, v| v.nil? }
718
- req = Google::Gax::to_proto(req, Google::Cloud::Dataproc::V1::ListWorkflowTemplatesRequest)
719
- @list_workflow_templates.call(req, options, &block)
720
- end
721
-
722
- # Deletes a workflow template. It does not cancel in-progress workflows.
723
- #
724
- # @param name [String]
725
- # Required. The resource name of the workflow template, as described
726
- # in https://cloud.google.com/apis/design/resource_names.
727
- #
728
- # * For `projects.regions.workflowTemplates.delete`, the resource name
729
- # of the template has the following format:
730
- # `projects/{project_id}/regions/{region}/workflowTemplates/{template_id}`
731
- #
732
- # * For `projects.locations.workflowTemplates.instantiate`, the resource name
733
- # of the template has the following format:
734
- # `projects/{project_id}/locations/{location}/workflowTemplates/{template_id}`
735
- # @param version [Integer]
736
- # Optional. The version of workflow template to delete. If specified,
737
- # will only delete the template if the current server version matches
738
- # specified version.
739
- # @param options [Google::Gax::CallOptions]
740
- # Overrides the default settings for this call, e.g, timeout,
741
- # retries, etc.
742
- # @yield [result, operation] Access the result along with the RPC operation
743
- # @yieldparam result []
744
- # @yieldparam operation [GRPC::ActiveCall::Operation]
745
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
746
- # @example
747
- # require "google/cloud/dataproc"
748
- #
749
- # workflow_template_client = Google::Cloud::Dataproc::WorkflowTemplateService.new(version: :v1)
750
- # formatted_name = Google::Cloud::Dataproc::V1::WorkflowTemplateServiceClient.workflow_template_path("[PROJECT]", "[REGION]", "[WORKFLOW_TEMPLATE]")
751
- # workflow_template_client.delete_workflow_template(formatted_name)
752
-
753
- def delete_workflow_template \
754
- name,
755
- version: nil,
756
- options: nil,
757
- &block
758
- req = {
759
- name: name,
760
- version: version
761
- }.delete_if { |_, v| v.nil? }
762
- req = Google::Gax::to_proto(req, Google::Cloud::Dataproc::V1::DeleteWorkflowTemplateRequest)
763
- @delete_workflow_template.call(req, options, &block)
764
- nil
765
- end
766
- end
767
- end
768
- end
769
- end
770
- end