google-cloud-dataproc 0.2.2 → 0.3.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 (55) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -1
  3. data/lib/google/cloud/dataproc.rb +56 -3
  4. data/lib/google/cloud/dataproc/v1.rb +62 -3
  5. data/lib/google/cloud/dataproc/v1/cluster_controller_client.rb +65 -5
  6. data/lib/google/cloud/dataproc/v1/cluster_controller_client_config.json +10 -7
  7. data/lib/google/cloud/dataproc/v1/clusters_pb.rb +11 -0
  8. data/lib/google/cloud/dataproc/v1/clusters_services_pb.rb +3 -2
  9. data/lib/google/cloud/dataproc/v1/credentials.rb +1 -1
  10. data/lib/google/cloud/dataproc/v1/doc/google/cloud/dataproc/v1/clusters.rb +128 -45
  11. data/lib/google/cloud/dataproc/v1/doc/google/cloud/dataproc/v1/jobs.rb +32 -15
  12. data/lib/google/cloud/dataproc/v1/doc/google/cloud/dataproc/v1/workflow_templates.rb +519 -0
  13. data/lib/google/cloud/dataproc/v1/doc/google/longrunning/operations.rb +1 -43
  14. data/lib/google/cloud/dataproc/v1/doc/google/protobuf/any.rb +1 -1
  15. data/lib/google/cloud/dataproc/v1/doc/google/protobuf/duration.rb +1 -1
  16. data/lib/google/cloud/dataproc/v1/doc/google/protobuf/empty.rb +1 -1
  17. data/lib/google/cloud/dataproc/v1/doc/google/protobuf/field_mask.rb +1 -1
  18. data/lib/google/cloud/dataproc/v1/doc/google/protobuf/timestamp.rb +1 -1
  19. data/lib/google/cloud/dataproc/v1/doc/google/rpc/status.rb +1 -1
  20. data/lib/google/cloud/dataproc/v1/job_controller_client.rb +16 -2
  21. data/lib/google/cloud/dataproc/v1/job_controller_client_config.json +9 -6
  22. data/lib/google/cloud/dataproc/v1/jobs_pb.rb +2 -0
  23. data/lib/google/cloud/dataproc/v1/jobs_services_pb.rb +2 -1
  24. data/lib/google/cloud/dataproc/v1/operations_pb.rb +0 -2
  25. data/lib/google/cloud/dataproc/v1/workflow_template_service_client.rb +690 -0
  26. data/lib/google/cloud/dataproc/v1/workflow_template_service_client_config.json +64 -0
  27. data/lib/google/cloud/dataproc/v1/workflow_templates_pb.rb +181 -0
  28. data/lib/google/cloud/dataproc/v1/workflow_templates_services_pb.rb +102 -0
  29. data/lib/google/cloud/dataproc/v1beta2.rb +281 -0
  30. data/lib/google/cloud/dataproc/v1beta2/cluster_controller_client.rb +799 -0
  31. data/lib/google/cloud/dataproc/v1beta2/cluster_controller_client_config.json +59 -0
  32. data/lib/google/cloud/dataproc/v1beta2/clusters_pb.rb +189 -0
  33. data/lib/google/cloud/dataproc/v1beta2/clusters_services_pb.rb +60 -0
  34. data/lib/google/cloud/dataproc/v1beta2/credentials.rb +41 -0
  35. data/lib/google/cloud/dataproc/v1beta2/doc/google/cloud/dataproc/v1beta2/clusters.rb +666 -0
  36. data/lib/google/cloud/dataproc/v1beta2/doc/google/cloud/dataproc/v1beta2/jobs.rb +691 -0
  37. data/lib/google/cloud/dataproc/v1beta2/doc/google/cloud/dataproc/v1beta2/workflow_templates.rb +524 -0
  38. data/lib/google/cloud/dataproc/v1beta2/doc/google/longrunning/operations.rb +51 -0
  39. data/lib/google/cloud/dataproc/v1beta2/doc/google/protobuf/any.rb +130 -0
  40. data/lib/google/cloud/dataproc/v1beta2/doc/google/protobuf/duration.rb +91 -0
  41. data/lib/google/cloud/dataproc/v1beta2/doc/google/protobuf/empty.rb +29 -0
  42. data/lib/google/cloud/dataproc/v1beta2/doc/google/protobuf/field_mask.rb +230 -0
  43. data/lib/google/cloud/dataproc/v1beta2/doc/google/protobuf/timestamp.rb +109 -0
  44. data/lib/google/cloud/dataproc/v1beta2/doc/google/rpc/status.rb +84 -0
  45. data/lib/google/cloud/dataproc/v1beta2/job_controller_client.rb +581 -0
  46. data/lib/google/cloud/dataproc/v1beta2/job_controller_client_config.json +59 -0
  47. data/lib/google/cloud/dataproc/v1beta2/jobs_pb.rb +248 -0
  48. data/lib/google/cloud/dataproc/v1beta2/jobs_services_pb.rb +61 -0
  49. data/lib/google/cloud/dataproc/v1beta2/operations_pb.rb +44 -0
  50. data/lib/google/cloud/dataproc/v1beta2/shared_pb.rb +18 -0
  51. data/lib/google/cloud/dataproc/v1beta2/workflow_template_service_client.rb +698 -0
  52. data/lib/google/cloud/dataproc/v1beta2/workflow_template_service_client_config.json +64 -0
  53. data/lib/google/cloud/dataproc/v1beta2/workflow_templates_pb.rb +183 -0
  54. data/lib/google/cloud/dataproc/v1beta2/workflow_templates_services_pb.rb +102 -0
  55. metadata +36 -5
@@ -1,4 +1,4 @@
1
- # Copyright 2018 Google LLC
1
+ # Copyright 2019 Google LLC
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -47,47 +47,5 @@ module Google
47
47
  # is `TakeSnapshot()`, the inferred response type is
48
48
  # `TakeSnapshotResponse`.
49
49
  class Operation; end
50
-
51
- # The request message for {Google::Longrunning::Operations::GetOperation Operations::GetOperation}.
52
- # @!attribute [rw] name
53
- # @return [String]
54
- # The name of the operation resource.
55
- class GetOperationRequest; end
56
-
57
- # The request message for {Google::Longrunning::Operations::ListOperations Operations::ListOperations}.
58
- # @!attribute [rw] name
59
- # @return [String]
60
- # The name of the operation collection.
61
- # @!attribute [rw] filter
62
- # @return [String]
63
- # The standard list filter.
64
- # @!attribute [rw] page_size
65
- # @return [Integer]
66
- # The standard list page size.
67
- # @!attribute [rw] page_token
68
- # @return [String]
69
- # The standard list page token.
70
- class ListOperationsRequest; end
71
-
72
- # The response message for {Google::Longrunning::Operations::ListOperations Operations::ListOperations}.
73
- # @!attribute [rw] operations
74
- # @return [Array<Google::Longrunning::Operation>]
75
- # A list of operations that matches the specified filter in the request.
76
- # @!attribute [rw] next_page_token
77
- # @return [String]
78
- # The standard List next-page token.
79
- class ListOperationsResponse; end
80
-
81
- # The request message for {Google::Longrunning::Operations::CancelOperation Operations::CancelOperation}.
82
- # @!attribute [rw] name
83
- # @return [String]
84
- # The name of the operation resource to be cancelled.
85
- class CancelOperationRequest; end
86
-
87
- # The request message for {Google::Longrunning::Operations::DeleteOperation Operations::DeleteOperation}.
88
- # @!attribute [rw] name
89
- # @return [String]
90
- # The name of the operation resource to be deleted.
91
- class DeleteOperationRequest; end
92
50
  end
93
51
  end
@@ -1,4 +1,4 @@
1
- # Copyright 2018 Google LLC
1
+ # Copyright 2019 Google LLC
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -1,4 +1,4 @@
1
- # Copyright 2018 Google LLC
1
+ # Copyright 2019 Google LLC
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -1,4 +1,4 @@
1
- # Copyright 2018 Google LLC
1
+ # Copyright 2019 Google LLC
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -1,4 +1,4 @@
1
- # Copyright 2018 Google LLC
1
+ # Copyright 2019 Google LLC
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -1,4 +1,4 @@
1
- # Copyright 2018 Google LLC
1
+ # Copyright 2019 Google LLC
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -1,4 +1,4 @@
1
- # Copyright 2018 Google LLC
1
+ # Copyright 2019 Google LLC
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -1,4 +1,4 @@
1
- # Copyright 2018 Google LLC
1
+ # Copyright 2019 Google LLC
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -215,6 +215,18 @@ module Google
215
215
  # Required. The job resource.
216
216
  # A hash of the same form as `Google::Cloud::Dataproc::V1::Job`
217
217
  # can also be provided.
218
+ # @param request_id [String]
219
+ # Optional. A unique id used to identify the request. If the server
220
+ # receives two {Google::Cloud::Dataproc::V1::SubmitJobRequest SubmitJobRequest} requests with the same
221
+ # id, then the second request will be ignored and the
222
+ # first {Google::Cloud::Dataproc::V1::Job Job} created and stored in the backend
223
+ # is returned.
224
+ #
225
+ # It is recommended to always set this value to a
226
+ # [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier).
227
+ #
228
+ # The id must contain only letters (a-z, A-Z), numbers (0-9),
229
+ # underscores (_), and hyphens (-). The maximum length is 40 characters.
218
230
  # @param options [Google::Gax::CallOptions]
219
231
  # Overrides the default settings for this call, e.g, timeout,
220
232
  # retries, etc.
@@ -242,12 +254,14 @@ module Google
242
254
  project_id,
243
255
  region,
244
256
  job,
257
+ request_id: nil,
245
258
  options: nil,
246
259
  &block
247
260
  req = {
248
261
  project_id: project_id,
249
262
  region: region,
250
- job: job
263
+ job: job,
264
+ request_id: request_id
251
265
  }.delete_if { |_, v| v.nil? }
252
266
  req = Google::Gax::to_proto(req, Google::Cloud::Dataproc::V1::SubmitJobRequest)
253
267
  @submit_job.call(req, options, &block)
@@ -4,9 +4,12 @@
4
4
  "retry_codes": {
5
5
  "idempotent": [
6
6
  "DEADLINE_EXCEEDED",
7
+ "INTERNAL",
7
8
  "UNAVAILABLE"
8
9
  ],
9
- "non_idempotent": []
10
+ "non_idempotent": [
11
+ "UNAVAILABLE"
12
+ ]
10
13
  },
11
14
  "retry_params": {
12
15
  "default": {
@@ -16,7 +19,7 @@
16
19
  "initial_rpc_timeout_millis": 30000,
17
20
  "rpc_timeout_multiplier": 1.0,
18
21
  "max_rpc_timeout_millis": 30000,
19
- "total_timeout_millis": 600000
22
+ "total_timeout_millis": 900000
20
23
  }
21
24
  },
22
25
  "methods": {
@@ -26,7 +29,7 @@
26
29
  "retry_params_name": "default"
27
30
  },
28
31
  "GetJob": {
29
- "timeout_millis": 10000,
32
+ "timeout_millis": 30000,
30
33
  "retry_codes_name": "idempotent",
31
34
  "retry_params_name": "default"
32
35
  },
@@ -42,12 +45,12 @@
42
45
  },
43
46
  "CancelJob": {
44
47
  "timeout_millis": 30000,
45
- "retry_codes_name": "non_idempotent",
48
+ "retry_codes_name": "idempotent",
46
49
  "retry_params_name": "default"
47
50
  },
48
51
  "DeleteJob": {
49
- "timeout_millis": 60000,
50
- "retry_codes_name": "idempotent",
52
+ "timeout_millis": 30000,
53
+ "retry_codes_name": "non_idempotent",
51
54
  "retry_params_name": "default"
52
55
  }
53
56
  }
@@ -150,6 +150,7 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
150
150
  optional :driver_control_files_uri, :string, 15
151
151
  map :labels, :string, :string, 18
152
152
  optional :scheduling, :message, 20, "google.cloud.dataproc.v1.JobScheduling"
153
+ optional :job_uuid, :string, 22
153
154
  oneof :type_job do
154
155
  optional :hadoop_job, :message, 3, "google.cloud.dataproc.v1.HadoopJob"
155
156
  optional :spark_job, :message, 4, "google.cloud.dataproc.v1.SparkJob"
@@ -166,6 +167,7 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
166
167
  optional :project_id, :string, 1
167
168
  optional :region, :string, 3
168
169
  optional :job, :message, 2, "google.cloud.dataproc.v1.Job"
170
+ optional :request_id, :string, 4
169
171
  end
170
172
  add_message "google.cloud.dataproc.v1.GetJobRequest" do
171
173
  optional :project_id, :string, 1
@@ -1,7 +1,7 @@
1
1
  # Generated by the protocol buffer compiler. DO NOT EDIT!
2
2
  # Source: google/cloud/dataproc/v1/jobs.proto for package 'google.cloud.dataproc.v1'
3
3
  # Original file comments:
4
- # Copyright 2017 Google Inc.
4
+ # Copyright 2018 Google LLC.
5
5
  #
6
6
  # Licensed under the Apache License, Version 2.0 (the "License");
7
7
  # you may not use this file except in compliance with the License.
@@ -15,6 +15,7 @@
15
15
  # See the License for the specific language governing permissions and
16
16
  # limitations under the License.
17
17
  #
18
+ #
18
19
 
19
20
 
20
21
  require 'grpc'
@@ -5,8 +5,6 @@
5
5
  require 'google/protobuf'
6
6
 
7
7
  require 'google/api/annotations_pb'
8
- require 'google/longrunning/operations_pb'
9
- require 'google/protobuf/empty_pb'
10
8
  require 'google/protobuf/timestamp_pb'
11
9
  Google::Protobuf::DescriptorPool.generated_pool.build do
12
10
  add_message "google.cloud.dataproc.v1.ClusterOperationStatus" do
@@ -0,0 +1,690 @@
1
+ # Copyright 2019 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
+
33
+ module Google
34
+ module Cloud
35
+ module Dataproc
36
+ module V1
37
+ # The API interface for managing Workflow Templates in the
38
+ # Cloud Dataproc API.
39
+ #
40
+ # @!attribute [r] workflow_template_service_stub
41
+ # @return [Google::Cloud::Dataproc::V1::WorkflowTemplateService::Stub]
42
+ class WorkflowTemplateServiceClient
43
+ # @private
44
+ attr_reader :workflow_template_service_stub
45
+
46
+ # The default address of the service.
47
+ SERVICE_ADDRESS = "dataproc.googleapis.com".freeze
48
+
49
+ # The default port of the service.
50
+ DEFAULT_SERVICE_PORT = 443
51
+
52
+ # The default set of gRPC interceptors.
53
+ GRPC_INTERCEPTORS = []
54
+
55
+ DEFAULT_TIMEOUT = 30
56
+
57
+ PAGE_DESCRIPTORS = {
58
+ "list_workflow_templates" => Google::Gax::PageDescriptor.new(
59
+ "page_token",
60
+ "next_page_token",
61
+ "templates")
62
+ }.freeze
63
+
64
+ private_constant :PAGE_DESCRIPTORS
65
+
66
+ # The scopes needed to make gRPC calls to all of the methods defined in
67
+ # this service.
68
+ ALL_SCOPES = [
69
+ "https://www.googleapis.com/auth/cloud-platform"
70
+ ].freeze
71
+
72
+ class OperationsClient < Google::Longrunning::OperationsClient
73
+ self::SERVICE_ADDRESS = WorkflowTemplateServiceClient::SERVICE_ADDRESS
74
+ self::GRPC_INTERCEPTORS = WorkflowTemplateServiceClient::GRPC_INTERCEPTORS
75
+ end
76
+
77
+ REGION_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
78
+ "projects/{project}/regions/{region}"
79
+ )
80
+
81
+ private_constant :REGION_PATH_TEMPLATE
82
+
83
+ WORKFLOW_TEMPLATE_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
84
+ "projects/{project}/regions/{region}/workflowTemplates/{workflow_template}"
85
+ )
86
+
87
+ private_constant :WORKFLOW_TEMPLATE_PATH_TEMPLATE
88
+
89
+ # Returns a fully-qualified region resource name string.
90
+ # @param project [String]
91
+ # @param region [String]
92
+ # @return [String]
93
+ def self.region_path project, region
94
+ REGION_PATH_TEMPLATE.render(
95
+ :"project" => project,
96
+ :"region" => region
97
+ )
98
+ end
99
+
100
+ # Returns a fully-qualified workflow_template resource name string.
101
+ # @param project [String]
102
+ # @param region [String]
103
+ # @param workflow_template [String]
104
+ # @return [String]
105
+ def self.workflow_template_path project, region, workflow_template
106
+ WORKFLOW_TEMPLATE_PATH_TEMPLATE.render(
107
+ :"project" => project,
108
+ :"region" => region,
109
+ :"workflow_template" => workflow_template
110
+ )
111
+ end
112
+
113
+ # @param credentials [Google::Auth::Credentials, String, Hash, GRPC::Core::Channel, GRPC::Core::ChannelCredentials, Proc]
114
+ # Provides the means for authenticating requests made by the client. This parameter can
115
+ # be many types.
116
+ # A `Google::Auth::Credentials` uses a the properties of its represented keyfile for
117
+ # authenticating requests made by this client.
118
+ # A `String` will be treated as the path to the keyfile to be used for the construction of
119
+ # credentials for this client.
120
+ # A `Hash` will be treated as the contents of a keyfile to be used for the construction of
121
+ # credentials for this client.
122
+ # A `GRPC::Core::Channel` will be used to make calls through.
123
+ # A `GRPC::Core::ChannelCredentials` for the setting up the RPC client. The channel credentials
124
+ # should already be composed with a `GRPC::Core::CallCredentials` object.
125
+ # A `Proc` will be used as an updater_proc for the Grpc channel. The proc transforms the
126
+ # metadata for requests, generally, to give OAuth credentials.
127
+ # @param scopes [Array<String>]
128
+ # The OAuth scopes for this service. This parameter is ignored if
129
+ # an updater_proc is supplied.
130
+ # @param client_config [Hash]
131
+ # A Hash for call options for each method. See
132
+ # Google::Gax#construct_settings for the structure of
133
+ # this data. Falls back to the default config if not specified
134
+ # or the specified config is missing data points.
135
+ # @param timeout [Numeric]
136
+ # The default timeout, in seconds, for calls made through this client.
137
+ # @param metadata [Hash]
138
+ # Default metadata to be sent with each request. This can be overridden on a per call basis.
139
+ # @param exception_transformer [Proc]
140
+ # An optional proc that intercepts any exceptions raised during an API call to inject
141
+ # custom error handling.
142
+ def initialize \
143
+ credentials: nil,
144
+ scopes: ALL_SCOPES,
145
+ client_config: {},
146
+ timeout: DEFAULT_TIMEOUT,
147
+ metadata: nil,
148
+ exception_transformer: nil,
149
+ lib_name: nil,
150
+ lib_version: ""
151
+ # These require statements are intentionally placed here to initialize
152
+ # the gRPC module only when it's required.
153
+ # See https://github.com/googleapis/toolkit/issues/446
154
+ require "google/gax/grpc"
155
+ require "google/cloud/dataproc/v1/workflow_templates_services_pb"
156
+
157
+ credentials ||= Google::Cloud::Dataproc::V1::Credentials.default
158
+
159
+ @operations_client = OperationsClient.new(
160
+ credentials: credentials,
161
+ scopes: scopes,
162
+ client_config: client_config,
163
+ timeout: timeout,
164
+ lib_name: lib_name,
165
+ lib_version: lib_version,
166
+ )
167
+
168
+ if credentials.is_a?(String) || credentials.is_a?(Hash)
169
+ updater_proc = Google::Cloud::Dataproc::V1::Credentials.new(credentials).updater_proc
170
+ end
171
+ if credentials.is_a?(GRPC::Core::Channel)
172
+ channel = credentials
173
+ end
174
+ if credentials.is_a?(GRPC::Core::ChannelCredentials)
175
+ chan_creds = credentials
176
+ end
177
+ if credentials.is_a?(Proc)
178
+ updater_proc = credentials
179
+ end
180
+ if credentials.is_a?(Google::Auth::Credentials)
181
+ updater_proc = credentials.updater_proc
182
+ end
183
+
184
+ package_version = Gem.loaded_specs['google-cloud-dataproc'].version.version
185
+
186
+ google_api_client = "gl-ruby/#{RUBY_VERSION}"
187
+ google_api_client << " #{lib_name}/#{lib_version}" if lib_name
188
+ google_api_client << " gapic/#{package_version} gax/#{Google::Gax::VERSION}"
189
+ google_api_client << " grpc/#{GRPC::VERSION}"
190
+ google_api_client.freeze
191
+
192
+ headers = { :"x-goog-api-client" => google_api_client }
193
+ headers.merge!(metadata) unless metadata.nil?
194
+ client_config_file = Pathname.new(__dir__).join(
195
+ "workflow_template_service_client_config.json"
196
+ )
197
+ defaults = client_config_file.open do |f|
198
+ Google::Gax.construct_settings(
199
+ "google.cloud.dataproc.v1.WorkflowTemplateService",
200
+ JSON.parse(f.read),
201
+ client_config,
202
+ Google::Gax::Grpc::STATUS_CODE_NAMES,
203
+ timeout,
204
+ page_descriptors: PAGE_DESCRIPTORS,
205
+ errors: Google::Gax::Grpc::API_ERRORS,
206
+ metadata: headers
207
+ )
208
+ end
209
+
210
+ # Allow overriding the service path/port in subclasses.
211
+ service_path = self.class::SERVICE_ADDRESS
212
+ port = self.class::DEFAULT_SERVICE_PORT
213
+ interceptors = self.class::GRPC_INTERCEPTORS
214
+ @workflow_template_service_stub = Google::Gax::Grpc.create_stub(
215
+ service_path,
216
+ port,
217
+ chan_creds: chan_creds,
218
+ channel: channel,
219
+ updater_proc: updater_proc,
220
+ scopes: scopes,
221
+ interceptors: interceptors,
222
+ &Google::Cloud::Dataproc::V1::WorkflowTemplateService::Stub.method(:new)
223
+ )
224
+
225
+ @create_workflow_template = Google::Gax.create_api_call(
226
+ @workflow_template_service_stub.method(:create_workflow_template),
227
+ defaults["create_workflow_template"],
228
+ exception_transformer: exception_transformer
229
+ )
230
+ @get_workflow_template = Google::Gax.create_api_call(
231
+ @workflow_template_service_stub.method(:get_workflow_template),
232
+ defaults["get_workflow_template"],
233
+ exception_transformer: exception_transformer
234
+ )
235
+ @instantiate_workflow_template = Google::Gax.create_api_call(
236
+ @workflow_template_service_stub.method(:instantiate_workflow_template),
237
+ defaults["instantiate_workflow_template"],
238
+ exception_transformer: exception_transformer
239
+ )
240
+ @instantiate_inline_workflow_template = Google::Gax.create_api_call(
241
+ @workflow_template_service_stub.method(:instantiate_inline_workflow_template),
242
+ defaults["instantiate_inline_workflow_template"],
243
+ exception_transformer: exception_transformer
244
+ )
245
+ @update_workflow_template = Google::Gax.create_api_call(
246
+ @workflow_template_service_stub.method(:update_workflow_template),
247
+ defaults["update_workflow_template"],
248
+ exception_transformer: exception_transformer
249
+ )
250
+ @list_workflow_templates = Google::Gax.create_api_call(
251
+ @workflow_template_service_stub.method(:list_workflow_templates),
252
+ defaults["list_workflow_templates"],
253
+ exception_transformer: exception_transformer
254
+ )
255
+ @delete_workflow_template = Google::Gax.create_api_call(
256
+ @workflow_template_service_stub.method(:delete_workflow_template),
257
+ defaults["delete_workflow_template"],
258
+ exception_transformer: exception_transformer
259
+ )
260
+ end
261
+
262
+ # Service calls
263
+
264
+ # Creates new workflow template.
265
+ #
266
+ # @param parent [String]
267
+ # Required. The "resource name" of the region, as described
268
+ # in https://cloud.google.com/apis/design/resource_names of the form
269
+ # `projects/{project_id}/regions/{region}`
270
+ # @param template [Google::Cloud::Dataproc::V1::WorkflowTemplate | Hash]
271
+ # Required. The Dataproc workflow template to create.
272
+ # A hash of the same form as `Google::Cloud::Dataproc::V1::WorkflowTemplate`
273
+ # can also be provided.
274
+ # @param options [Google::Gax::CallOptions]
275
+ # Overrides the default settings for this call, e.g, timeout,
276
+ # retries, etc.
277
+ # @yield [result, operation] Access the result along with the RPC operation
278
+ # @yieldparam result [Google::Cloud::Dataproc::V1::WorkflowTemplate]
279
+ # @yieldparam operation [GRPC::ActiveCall::Operation]
280
+ # @return [Google::Cloud::Dataproc::V1::WorkflowTemplate]
281
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
282
+ # @example
283
+ # require "google/cloud/dataproc"
284
+ #
285
+ # workflow_template_service_client = Google::Cloud::Dataproc::WorkflowTemplateService.new(version: :v1)
286
+ # formatted_parent = Google::Cloud::Dataproc::V1::WorkflowTemplateServiceClient.region_path("[PROJECT]", "[REGION]")
287
+ #
288
+ # # TODO: Initialize `template`:
289
+ # template = {}
290
+ # response = workflow_template_service_client.create_workflow_template(formatted_parent, template)
291
+
292
+ def create_workflow_template \
293
+ parent,
294
+ template,
295
+ options: nil,
296
+ &block
297
+ req = {
298
+ parent: parent,
299
+ template: template
300
+ }.delete_if { |_, v| v.nil? }
301
+ req = Google::Gax::to_proto(req, Google::Cloud::Dataproc::V1::CreateWorkflowTemplateRequest)
302
+ @create_workflow_template.call(req, options, &block)
303
+ end
304
+
305
+ # Retrieves the latest workflow template.
306
+ #
307
+ # Can retrieve previously instantiated template by specifying optional
308
+ # version parameter.
309
+ #
310
+ # @param name [String]
311
+ # Required. The "resource name" of the workflow template, as described
312
+ # in https://cloud.google.com/apis/design/resource_names of the form
313
+ # `projects/{project_id}/regions/{region}/workflowTemplates/{template_id}`
314
+ # @param version [Integer]
315
+ # Optional. The version of workflow template to retrieve. Only previously
316
+ # instatiated versions can be retrieved.
317
+ #
318
+ # If unspecified, retrieves the current version.
319
+ # @param options [Google::Gax::CallOptions]
320
+ # Overrides the default settings for this call, e.g, timeout,
321
+ # retries, etc.
322
+ # @yield [result, operation] Access the result along with the RPC operation
323
+ # @yieldparam result [Google::Cloud::Dataproc::V1::WorkflowTemplate]
324
+ # @yieldparam operation [GRPC::ActiveCall::Operation]
325
+ # @return [Google::Cloud::Dataproc::V1::WorkflowTemplate]
326
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
327
+ # @example
328
+ # require "google/cloud/dataproc"
329
+ #
330
+ # workflow_template_service_client = Google::Cloud::Dataproc::WorkflowTemplateService.new(version: :v1)
331
+ # formatted_name = Google::Cloud::Dataproc::V1::WorkflowTemplateServiceClient.workflow_template_path("[PROJECT]", "[REGION]", "[WORKFLOW_TEMPLATE]")
332
+ # response = workflow_template_service_client.get_workflow_template(formatted_name)
333
+
334
+ def get_workflow_template \
335
+ name,
336
+ version: nil,
337
+ options: nil,
338
+ &block
339
+ req = {
340
+ name: name,
341
+ version: version
342
+ }.delete_if { |_, v| v.nil? }
343
+ req = Google::Gax::to_proto(req, Google::Cloud::Dataproc::V1::GetWorkflowTemplateRequest)
344
+ @get_workflow_template.call(req, options, &block)
345
+ end
346
+
347
+ # Instantiates a template and begins execution.
348
+ #
349
+ # The returned Operation can be used to track execution of
350
+ # workflow by polling
351
+ # {Google::Longrunning::Operations::GetOperation operations::get}.
352
+ # The Operation will complete when entire workflow is finished.
353
+ #
354
+ # The running workflow can be aborted via
355
+ # {Google::Longrunning::Operations::CancelOperation operations::cancel}.
356
+ # This will cause any inflight jobs to be cancelled and workflow-owned
357
+ # clusters to be deleted.
358
+ #
359
+ # The {Google::Longrunning::Operation#metadata Operation#metadata} will be
360
+ # {Google::Cloud::Dataproc::V1::WorkflowMetadata WorkflowMetadata}.
361
+ #
362
+ # On successful completion,
363
+ # {Google::Longrunning::Operation#response Operation#response} will be
364
+ # {Google::Protobuf::Empty Empty}.
365
+ #
366
+ # @param name [String]
367
+ # Required. The "resource name" of the workflow template, as described
368
+ # in https://cloud.google.com/apis/design/resource_names of the form
369
+ # `projects/{project_id}/regions/{region}/workflowTemplates/{template_id}`
370
+ # @param version [Integer]
371
+ # Optional. The version of workflow template to instantiate. If specified,
372
+ # the workflow will be instantiated only if the current version of
373
+ # the workflow template has the supplied version.
374
+ #
375
+ # This option cannot be used to instantiate a previous version of
376
+ # workflow template.
377
+ # @param request_id [String]
378
+ # Optional. A tag that prevents multiple concurrent workflow
379
+ # instances with the same tag from running. This mitigates risk of
380
+ # concurrent instances started due to retries.
381
+ #
382
+ # It is recommended to always set this value to a
383
+ # [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier).
384
+ #
385
+ # The tag must contain only letters (a-z, A-Z), numbers (0-9),
386
+ # underscores (_), and hyphens (-). The maximum length is 40 characters.
387
+ # @param parameters [Hash{String => String}]
388
+ # Optional. Map from parameter names to values that should be used for those
389
+ # parameters. Values may not exceed 100 characters.
390
+ # @param options [Google::Gax::CallOptions]
391
+ # Overrides the default settings for this call, e.g, timeout,
392
+ # retries, etc.
393
+ # @return [Google::Gax::Operation]
394
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
395
+ # @example
396
+ # require "google/cloud/dataproc"
397
+ #
398
+ # workflow_template_service_client = Google::Cloud::Dataproc::WorkflowTemplateService.new(version: :v1)
399
+ # formatted_name = Google::Cloud::Dataproc::V1::WorkflowTemplateServiceClient.workflow_template_path("[PROJECT]", "[REGION]", "[WORKFLOW_TEMPLATE]")
400
+ #
401
+ # # Register a callback during the method call.
402
+ # operation = workflow_template_service_client.instantiate_workflow_template(formatted_name) do |op|
403
+ # raise op.results.message if op.error?
404
+ # op_results = op.results
405
+ # # Process the results.
406
+ #
407
+ # metadata = op.metadata
408
+ # # Process the metadata.
409
+ # end
410
+ #
411
+ # # Or use the return value to register a callback.
412
+ # operation.on_done do |op|
413
+ # raise op.results.message if op.error?
414
+ # op_results = op.results
415
+ # # Process the results.
416
+ #
417
+ # metadata = op.metadata
418
+ # # Process the metadata.
419
+ # end
420
+ #
421
+ # # Manually reload the operation.
422
+ # operation.reload!
423
+ #
424
+ # # Or block until the operation completes, triggering callbacks on
425
+ # # completion.
426
+ # operation.wait_until_done!
427
+
428
+ def instantiate_workflow_template \
429
+ name,
430
+ version: nil,
431
+ request_id: nil,
432
+ parameters: nil,
433
+ options: nil
434
+ req = {
435
+ name: name,
436
+ version: version,
437
+ request_id: request_id,
438
+ parameters: parameters
439
+ }.delete_if { |_, v| v.nil? }
440
+ req = Google::Gax::to_proto(req, Google::Cloud::Dataproc::V1::InstantiateWorkflowTemplateRequest)
441
+ operation = Google::Gax::Operation.new(
442
+ @instantiate_workflow_template.call(req, options),
443
+ @operations_client,
444
+ Google::Protobuf::Empty,
445
+ Google::Cloud::Dataproc::V1::WorkflowMetadata,
446
+ call_options: options
447
+ )
448
+ operation.on_done { |operation| yield(operation) } if block_given?
449
+ operation
450
+ end
451
+
452
+ # Instantiates a template and begins execution.
453
+ #
454
+ # This method is equivalent to executing the sequence
455
+ # {Google::Cloud::Dataproc::V1::WorkflowTemplateService::CreateWorkflowTemplate CreateWorkflowTemplate}, {Google::Cloud::Dataproc::V1::WorkflowTemplateService::InstantiateWorkflowTemplate InstantiateWorkflowTemplate},
456
+ # {Google::Cloud::Dataproc::V1::WorkflowTemplateService::DeleteWorkflowTemplate DeleteWorkflowTemplate}.
457
+ #
458
+ # The returned Operation can be used to track execution of
459
+ # workflow by polling
460
+ # {Google::Longrunning::Operations::GetOperation operations::get}.
461
+ # The Operation will complete when entire workflow is finished.
462
+ #
463
+ # The running workflow can be aborted via
464
+ # {Google::Longrunning::Operations::CancelOperation operations::cancel}.
465
+ # This will cause any inflight jobs to be cancelled and workflow-owned
466
+ # clusters to be deleted.
467
+ #
468
+ # The {Google::Longrunning::Operation#metadata Operation#metadata} will be
469
+ # {Google::Cloud::Dataproc::V1::WorkflowMetadata WorkflowMetadata}.
470
+ #
471
+ # On successful completion,
472
+ # {Google::Longrunning::Operation#response Operation#response} will be
473
+ # {Google::Protobuf::Empty Empty}.
474
+ #
475
+ # @param parent [String]
476
+ # Required. The "resource name" of the workflow template region, as described
477
+ # in https://cloud.google.com/apis/design/resource_names of the form
478
+ # `projects/{project_id}/regions/{region}`
479
+ # @param template [Google::Cloud::Dataproc::V1::WorkflowTemplate | Hash]
480
+ # Required. The workflow template to instantiate.
481
+ # A hash of the same form as `Google::Cloud::Dataproc::V1::WorkflowTemplate`
482
+ # can also be provided.
483
+ # @param request_id [String]
484
+ # Optional. A tag that prevents multiple concurrent workflow
485
+ # instances with the same tag from running. This mitigates risk of
486
+ # concurrent instances started due to retries.
487
+ #
488
+ # It is recommended to always set this value to a
489
+ # [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier).
490
+ #
491
+ # The tag must contain only letters (a-z, A-Z), numbers (0-9),
492
+ # underscores (_), and hyphens (-). The maximum length is 40 characters.
493
+ # @param options [Google::Gax::CallOptions]
494
+ # Overrides the default settings for this call, e.g, timeout,
495
+ # retries, etc.
496
+ # @return [Google::Gax::Operation]
497
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
498
+ # @example
499
+ # require "google/cloud/dataproc"
500
+ #
501
+ # workflow_template_service_client = Google::Cloud::Dataproc::WorkflowTemplateService.new(version: :v1)
502
+ # formatted_parent = Google::Cloud::Dataproc::V1::WorkflowTemplateServiceClient.region_path("[PROJECT]", "[REGION]")
503
+ #
504
+ # # TODO: Initialize `template`:
505
+ # template = {}
506
+ #
507
+ # # Register a callback during the method call.
508
+ # operation = workflow_template_service_client.instantiate_inline_workflow_template(formatted_parent, template) do |op|
509
+ # raise op.results.message if op.error?
510
+ # op_results = op.results
511
+ # # Process the results.
512
+ #
513
+ # metadata = op.metadata
514
+ # # Process the metadata.
515
+ # end
516
+ #
517
+ # # Or use the return value to register a callback.
518
+ # operation.on_done do |op|
519
+ # raise op.results.message if op.error?
520
+ # op_results = op.results
521
+ # # Process the results.
522
+ #
523
+ # metadata = op.metadata
524
+ # # Process the metadata.
525
+ # end
526
+ #
527
+ # # Manually reload the operation.
528
+ # operation.reload!
529
+ #
530
+ # # Or block until the operation completes, triggering callbacks on
531
+ # # completion.
532
+ # operation.wait_until_done!
533
+
534
+ def instantiate_inline_workflow_template \
535
+ parent,
536
+ template,
537
+ request_id: nil,
538
+ options: nil
539
+ req = {
540
+ parent: parent,
541
+ template: template,
542
+ request_id: request_id
543
+ }.delete_if { |_, v| v.nil? }
544
+ req = Google::Gax::to_proto(req, Google::Cloud::Dataproc::V1::InstantiateInlineWorkflowTemplateRequest)
545
+ operation = Google::Gax::Operation.new(
546
+ @instantiate_inline_workflow_template.call(req, options),
547
+ @operations_client,
548
+ Google::Protobuf::Empty,
549
+ Google::Cloud::Dataproc::V1::WorkflowMetadata,
550
+ call_options: options
551
+ )
552
+ operation.on_done { |operation| yield(operation) } if block_given?
553
+ operation
554
+ end
555
+
556
+ # Updates (replaces) workflow template. The updated template
557
+ # must contain version that matches the current server version.
558
+ #
559
+ # @param template [Google::Cloud::Dataproc::V1::WorkflowTemplate | Hash]
560
+ # Required. The updated workflow template.
561
+ #
562
+ # The `template.version` field must match the current version.
563
+ # A hash of the same form as `Google::Cloud::Dataproc::V1::WorkflowTemplate`
564
+ # can also be provided.
565
+ # @param options [Google::Gax::CallOptions]
566
+ # Overrides the default settings for this call, e.g, timeout,
567
+ # retries, etc.
568
+ # @yield [result, operation] Access the result along with the RPC operation
569
+ # @yieldparam result [Google::Cloud::Dataproc::V1::WorkflowTemplate]
570
+ # @yieldparam operation [GRPC::ActiveCall::Operation]
571
+ # @return [Google::Cloud::Dataproc::V1::WorkflowTemplate]
572
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
573
+ # @example
574
+ # require "google/cloud/dataproc"
575
+ #
576
+ # workflow_template_service_client = Google::Cloud::Dataproc::WorkflowTemplateService.new(version: :v1)
577
+ #
578
+ # # TODO: Initialize `template`:
579
+ # template = {}
580
+ # response = workflow_template_service_client.update_workflow_template(template)
581
+
582
+ def update_workflow_template \
583
+ template,
584
+ options: nil,
585
+ &block
586
+ req = {
587
+ template: template
588
+ }.delete_if { |_, v| v.nil? }
589
+ req = Google::Gax::to_proto(req, Google::Cloud::Dataproc::V1::UpdateWorkflowTemplateRequest)
590
+ @update_workflow_template.call(req, options, &block)
591
+ end
592
+
593
+ # Lists workflows that match the specified filter in the request.
594
+ #
595
+ # @param parent [String]
596
+ # Required. The "resource name" of the region, as described
597
+ # in https://cloud.google.com/apis/design/resource_names of the form
598
+ # `projects/{project_id}/regions/{region}`
599
+ # @param page_size [Integer]
600
+ # The maximum number of resources contained in the underlying API
601
+ # response. If page streaming is performed per-resource, this
602
+ # parameter does not affect the return value. If page streaming is
603
+ # performed per-page, this determines the maximum number of
604
+ # resources in a page.
605
+ # @param options [Google::Gax::CallOptions]
606
+ # Overrides the default settings for this call, e.g, timeout,
607
+ # retries, etc.
608
+ # @yield [result, operation] Access the result along with the RPC operation
609
+ # @yieldparam result [Google::Gax::PagedEnumerable<Google::Cloud::Dataproc::V1::WorkflowTemplate>]
610
+ # @yieldparam operation [GRPC::ActiveCall::Operation]
611
+ # @return [Google::Gax::PagedEnumerable<Google::Cloud::Dataproc::V1::WorkflowTemplate>]
612
+ # An enumerable of Google::Cloud::Dataproc::V1::WorkflowTemplate instances.
613
+ # See Google::Gax::PagedEnumerable documentation for other
614
+ # operations such as per-page iteration or access to the response
615
+ # object.
616
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
617
+ # @example
618
+ # require "google/cloud/dataproc"
619
+ #
620
+ # workflow_template_service_client = Google::Cloud::Dataproc::WorkflowTemplateService.new(version: :v1)
621
+ # formatted_parent = Google::Cloud::Dataproc::V1::WorkflowTemplateServiceClient.region_path("[PROJECT]", "[REGION]")
622
+ #
623
+ # # Iterate over all results.
624
+ # workflow_template_service_client.list_workflow_templates(formatted_parent).each do |element|
625
+ # # Process element.
626
+ # end
627
+ #
628
+ # # Or iterate over results one page at a time.
629
+ # workflow_template_service_client.list_workflow_templates(formatted_parent).each_page do |page|
630
+ # # Process each page at a time.
631
+ # page.each do |element|
632
+ # # Process element.
633
+ # end
634
+ # end
635
+
636
+ def list_workflow_templates \
637
+ parent,
638
+ page_size: nil,
639
+ options: nil,
640
+ &block
641
+ req = {
642
+ parent: parent,
643
+ page_size: page_size
644
+ }.delete_if { |_, v| v.nil? }
645
+ req = Google::Gax::to_proto(req, Google::Cloud::Dataproc::V1::ListWorkflowTemplatesRequest)
646
+ @list_workflow_templates.call(req, options, &block)
647
+ end
648
+
649
+ # Deletes a workflow template. It does not cancel in-progress workflows.
650
+ #
651
+ # @param name [String]
652
+ # Required. The "resource name" of the workflow template, as described
653
+ # in https://cloud.google.com/apis/design/resource_names of the form
654
+ # `projects/{project_id}/regions/{region}/workflowTemplates/{template_id}`
655
+ # @param version [Integer]
656
+ # Optional. The version of workflow template to delete. If specified,
657
+ # will only delete the template if the current server version matches
658
+ # specified version.
659
+ # @param options [Google::Gax::CallOptions]
660
+ # Overrides the default settings for this call, e.g, timeout,
661
+ # retries, etc.
662
+ # @yield [result, operation] Access the result along with the RPC operation
663
+ # @yieldparam result []
664
+ # @yieldparam operation [GRPC::ActiveCall::Operation]
665
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
666
+ # @example
667
+ # require "google/cloud/dataproc"
668
+ #
669
+ # workflow_template_service_client = Google::Cloud::Dataproc::WorkflowTemplateService.new(version: :v1)
670
+ # formatted_name = Google::Cloud::Dataproc::V1::WorkflowTemplateServiceClient.workflow_template_path("[PROJECT]", "[REGION]", "[WORKFLOW_TEMPLATE]")
671
+ # workflow_template_service_client.delete_workflow_template(formatted_name)
672
+
673
+ def delete_workflow_template \
674
+ name,
675
+ version: nil,
676
+ options: nil,
677
+ &block
678
+ req = {
679
+ name: name,
680
+ version: version
681
+ }.delete_if { |_, v| v.nil? }
682
+ req = Google::Gax::to_proto(req, Google::Cloud::Dataproc::V1::DeleteWorkflowTemplateRequest)
683
+ @delete_workflow_template.call(req, options, &block)
684
+ nil
685
+ end
686
+ end
687
+ end
688
+ end
689
+ end
690
+ end