google-cloud-dataproc 0.2.2 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
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
@@ -0,0 +1,59 @@
1
+ {
2
+ "interfaces": {
3
+ "google.cloud.dataproc.v1beta2.JobController": {
4
+ "retry_codes": {
5
+ "idempotent": [
6
+ "DEADLINE_EXCEEDED",
7
+ "INTERNAL",
8
+ "UNAVAILABLE"
9
+ ],
10
+ "non_idempotent": [
11
+ "UNAVAILABLE"
12
+ ]
13
+ },
14
+ "retry_params": {
15
+ "default": {
16
+ "initial_retry_delay_millis": 100,
17
+ "retry_delay_multiplier": 1.3,
18
+ "max_retry_delay_millis": 60000,
19
+ "initial_rpc_timeout_millis": 30000,
20
+ "rpc_timeout_multiplier": 1.0,
21
+ "max_rpc_timeout_millis": 30000,
22
+ "total_timeout_millis": 900000
23
+ }
24
+ },
25
+ "methods": {
26
+ "SubmitJob": {
27
+ "timeout_millis": 30000,
28
+ "retry_codes_name": "non_idempotent",
29
+ "retry_params_name": "default"
30
+ },
31
+ "GetJob": {
32
+ "timeout_millis": 30000,
33
+ "retry_codes_name": "idempotent",
34
+ "retry_params_name": "default"
35
+ },
36
+ "ListJobs": {
37
+ "timeout_millis": 30000,
38
+ "retry_codes_name": "idempotent",
39
+ "retry_params_name": "default"
40
+ },
41
+ "UpdateJob": {
42
+ "timeout_millis": 30000,
43
+ "retry_codes_name": "non_idempotent",
44
+ "retry_params_name": "default"
45
+ },
46
+ "CancelJob": {
47
+ "timeout_millis": 30000,
48
+ "retry_codes_name": "idempotent",
49
+ "retry_params_name": "default"
50
+ },
51
+ "DeleteJob": {
52
+ "timeout_millis": 30000,
53
+ "retry_codes_name": "non_idempotent",
54
+ "retry_params_name": "default"
55
+ }
56
+ }
57
+ }
58
+ }
59
+ }
@@ -0,0 +1,248 @@
1
+ # Generated by the protocol buffer compiler. DO NOT EDIT!
2
+ # source: google/cloud/dataproc/v1beta2/jobs.proto
3
+
4
+
5
+ require 'google/protobuf'
6
+
7
+ require 'google/api/annotations_pb'
8
+ require 'google/protobuf/empty_pb'
9
+ require 'google/protobuf/field_mask_pb'
10
+ require 'google/protobuf/timestamp_pb'
11
+ Google::Protobuf::DescriptorPool.generated_pool.build do
12
+ add_message "google.cloud.dataproc.v1beta2.LoggingConfig" do
13
+ map :driver_log_levels, :string, :enum, 2, "google.cloud.dataproc.v1beta2.LoggingConfig.Level"
14
+ end
15
+ add_enum "google.cloud.dataproc.v1beta2.LoggingConfig.Level" do
16
+ value :LEVEL_UNSPECIFIED, 0
17
+ value :ALL, 1
18
+ value :TRACE, 2
19
+ value :DEBUG, 3
20
+ value :INFO, 4
21
+ value :WARN, 5
22
+ value :ERROR, 6
23
+ value :FATAL, 7
24
+ value :OFF, 8
25
+ end
26
+ add_message "google.cloud.dataproc.v1beta2.HadoopJob" do
27
+ repeated :args, :string, 3
28
+ repeated :jar_file_uris, :string, 4
29
+ repeated :file_uris, :string, 5
30
+ repeated :archive_uris, :string, 6
31
+ map :properties, :string, :string, 7
32
+ optional :logging_config, :message, 8, "google.cloud.dataproc.v1beta2.LoggingConfig"
33
+ oneof :driver do
34
+ optional :main_jar_file_uri, :string, 1
35
+ optional :main_class, :string, 2
36
+ end
37
+ end
38
+ add_message "google.cloud.dataproc.v1beta2.SparkJob" do
39
+ repeated :args, :string, 3
40
+ repeated :jar_file_uris, :string, 4
41
+ repeated :file_uris, :string, 5
42
+ repeated :archive_uris, :string, 6
43
+ map :properties, :string, :string, 7
44
+ optional :logging_config, :message, 8, "google.cloud.dataproc.v1beta2.LoggingConfig"
45
+ oneof :driver do
46
+ optional :main_jar_file_uri, :string, 1
47
+ optional :main_class, :string, 2
48
+ end
49
+ end
50
+ add_message "google.cloud.dataproc.v1beta2.PySparkJob" do
51
+ optional :main_python_file_uri, :string, 1
52
+ repeated :args, :string, 2
53
+ repeated :python_file_uris, :string, 3
54
+ repeated :jar_file_uris, :string, 4
55
+ repeated :file_uris, :string, 5
56
+ repeated :archive_uris, :string, 6
57
+ map :properties, :string, :string, 7
58
+ optional :logging_config, :message, 8, "google.cloud.dataproc.v1beta2.LoggingConfig"
59
+ end
60
+ add_message "google.cloud.dataproc.v1beta2.QueryList" do
61
+ repeated :queries, :string, 1
62
+ end
63
+ add_message "google.cloud.dataproc.v1beta2.HiveJob" do
64
+ optional :continue_on_failure, :bool, 3
65
+ map :script_variables, :string, :string, 4
66
+ map :properties, :string, :string, 5
67
+ repeated :jar_file_uris, :string, 6
68
+ oneof :queries do
69
+ optional :query_file_uri, :string, 1
70
+ optional :query_list, :message, 2, "google.cloud.dataproc.v1beta2.QueryList"
71
+ end
72
+ end
73
+ add_message "google.cloud.dataproc.v1beta2.SparkSqlJob" do
74
+ map :script_variables, :string, :string, 3
75
+ map :properties, :string, :string, 4
76
+ repeated :jar_file_uris, :string, 56
77
+ optional :logging_config, :message, 6, "google.cloud.dataproc.v1beta2.LoggingConfig"
78
+ oneof :queries do
79
+ optional :query_file_uri, :string, 1
80
+ optional :query_list, :message, 2, "google.cloud.dataproc.v1beta2.QueryList"
81
+ end
82
+ end
83
+ add_message "google.cloud.dataproc.v1beta2.PigJob" do
84
+ optional :continue_on_failure, :bool, 3
85
+ map :script_variables, :string, :string, 4
86
+ map :properties, :string, :string, 5
87
+ repeated :jar_file_uris, :string, 6
88
+ optional :logging_config, :message, 7, "google.cloud.dataproc.v1beta2.LoggingConfig"
89
+ oneof :queries do
90
+ optional :query_file_uri, :string, 1
91
+ optional :query_list, :message, 2, "google.cloud.dataproc.v1beta2.QueryList"
92
+ end
93
+ end
94
+ add_message "google.cloud.dataproc.v1beta2.JobPlacement" do
95
+ optional :cluster_name, :string, 1
96
+ optional :cluster_uuid, :string, 2
97
+ end
98
+ add_message "google.cloud.dataproc.v1beta2.JobStatus" do
99
+ optional :state, :enum, 1, "google.cloud.dataproc.v1beta2.JobStatus.State"
100
+ optional :details, :string, 2
101
+ optional :state_start_time, :message, 6, "google.protobuf.Timestamp"
102
+ optional :substate, :enum, 7, "google.cloud.dataproc.v1beta2.JobStatus.Substate"
103
+ end
104
+ add_enum "google.cloud.dataproc.v1beta2.JobStatus.State" do
105
+ value :STATE_UNSPECIFIED, 0
106
+ value :PENDING, 1
107
+ value :SETUP_DONE, 8
108
+ value :RUNNING, 2
109
+ value :CANCEL_PENDING, 3
110
+ value :CANCEL_STARTED, 7
111
+ value :CANCELLED, 4
112
+ value :DONE, 5
113
+ value :ERROR, 6
114
+ value :ATTEMPT_FAILURE, 9
115
+ end
116
+ add_enum "google.cloud.dataproc.v1beta2.JobStatus.Substate" do
117
+ value :UNSPECIFIED, 0
118
+ value :SUBMITTED, 1
119
+ value :QUEUED, 2
120
+ value :STALE_STATUS, 3
121
+ end
122
+ add_message "google.cloud.dataproc.v1beta2.JobReference" do
123
+ optional :project_id, :string, 1
124
+ optional :job_id, :string, 2
125
+ end
126
+ add_message "google.cloud.dataproc.v1beta2.YarnApplication" do
127
+ optional :name, :string, 1
128
+ optional :state, :enum, 2, "google.cloud.dataproc.v1beta2.YarnApplication.State"
129
+ optional :progress, :float, 3
130
+ optional :tracking_url, :string, 4
131
+ end
132
+ add_enum "google.cloud.dataproc.v1beta2.YarnApplication.State" do
133
+ value :STATE_UNSPECIFIED, 0
134
+ value :NEW, 1
135
+ value :NEW_SAVING, 2
136
+ value :SUBMITTED, 3
137
+ value :ACCEPTED, 4
138
+ value :RUNNING, 5
139
+ value :FINISHED, 6
140
+ value :FAILED, 7
141
+ value :KILLED, 8
142
+ end
143
+ add_message "google.cloud.dataproc.v1beta2.Job" do
144
+ optional :reference, :message, 1, "google.cloud.dataproc.v1beta2.JobReference"
145
+ optional :placement, :message, 2, "google.cloud.dataproc.v1beta2.JobPlacement"
146
+ optional :status, :message, 8, "google.cloud.dataproc.v1beta2.JobStatus"
147
+ repeated :status_history, :message, 13, "google.cloud.dataproc.v1beta2.JobStatus"
148
+ repeated :yarn_applications, :message, 9, "google.cloud.dataproc.v1beta2.YarnApplication"
149
+ optional :submitted_by, :string, 10
150
+ optional :driver_output_resource_uri, :string, 17
151
+ optional :driver_control_files_uri, :string, 15
152
+ map :labels, :string, :string, 18
153
+ optional :scheduling, :message, 20, "google.cloud.dataproc.v1beta2.JobScheduling"
154
+ optional :job_uuid, :string, 22
155
+ oneof :type_job do
156
+ optional :hadoop_job, :message, 3, "google.cloud.dataproc.v1beta2.HadoopJob"
157
+ optional :spark_job, :message, 4, "google.cloud.dataproc.v1beta2.SparkJob"
158
+ optional :pyspark_job, :message, 5, "google.cloud.dataproc.v1beta2.PySparkJob"
159
+ optional :hive_job, :message, 6, "google.cloud.dataproc.v1beta2.HiveJob"
160
+ optional :pig_job, :message, 7, "google.cloud.dataproc.v1beta2.PigJob"
161
+ optional :spark_sql_job, :message, 12, "google.cloud.dataproc.v1beta2.SparkSqlJob"
162
+ end
163
+ end
164
+ add_message "google.cloud.dataproc.v1beta2.JobScheduling" do
165
+ optional :max_failures_per_hour, :int32, 1
166
+ end
167
+ add_message "google.cloud.dataproc.v1beta2.SubmitJobRequest" do
168
+ optional :project_id, :string, 1
169
+ optional :region, :string, 3
170
+ optional :job, :message, 2, "google.cloud.dataproc.v1beta2.Job"
171
+ optional :request_id, :string, 4
172
+ end
173
+ add_message "google.cloud.dataproc.v1beta2.GetJobRequest" do
174
+ optional :project_id, :string, 1
175
+ optional :region, :string, 3
176
+ optional :job_id, :string, 2
177
+ end
178
+ add_message "google.cloud.dataproc.v1beta2.ListJobsRequest" do
179
+ optional :project_id, :string, 1
180
+ optional :region, :string, 6
181
+ optional :page_size, :int32, 2
182
+ optional :page_token, :string, 3
183
+ optional :cluster_name, :string, 4
184
+ optional :job_state_matcher, :enum, 5, "google.cloud.dataproc.v1beta2.ListJobsRequest.JobStateMatcher"
185
+ optional :filter, :string, 7
186
+ end
187
+ add_enum "google.cloud.dataproc.v1beta2.ListJobsRequest.JobStateMatcher" do
188
+ value :ALL, 0
189
+ value :ACTIVE, 1
190
+ value :NON_ACTIVE, 2
191
+ end
192
+ add_message "google.cloud.dataproc.v1beta2.UpdateJobRequest" do
193
+ optional :project_id, :string, 1
194
+ optional :region, :string, 2
195
+ optional :job_id, :string, 3
196
+ optional :job, :message, 4, "google.cloud.dataproc.v1beta2.Job"
197
+ optional :update_mask, :message, 5, "google.protobuf.FieldMask"
198
+ end
199
+ add_message "google.cloud.dataproc.v1beta2.ListJobsResponse" do
200
+ repeated :jobs, :message, 1, "google.cloud.dataproc.v1beta2.Job"
201
+ optional :next_page_token, :string, 2
202
+ end
203
+ add_message "google.cloud.dataproc.v1beta2.CancelJobRequest" do
204
+ optional :project_id, :string, 1
205
+ optional :region, :string, 3
206
+ optional :job_id, :string, 2
207
+ end
208
+ add_message "google.cloud.dataproc.v1beta2.DeleteJobRequest" do
209
+ optional :project_id, :string, 1
210
+ optional :region, :string, 3
211
+ optional :job_id, :string, 2
212
+ end
213
+ end
214
+
215
+ module Google
216
+ module Cloud
217
+ module Dataproc
218
+ module V1beta2
219
+ LoggingConfig = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dataproc.v1beta2.LoggingConfig").msgclass
220
+ LoggingConfig::Level = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dataproc.v1beta2.LoggingConfig.Level").enummodule
221
+ HadoopJob = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dataproc.v1beta2.HadoopJob").msgclass
222
+ SparkJob = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dataproc.v1beta2.SparkJob").msgclass
223
+ PySparkJob = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dataproc.v1beta2.PySparkJob").msgclass
224
+ QueryList = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dataproc.v1beta2.QueryList").msgclass
225
+ HiveJob = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dataproc.v1beta2.HiveJob").msgclass
226
+ SparkSqlJob = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dataproc.v1beta2.SparkSqlJob").msgclass
227
+ PigJob = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dataproc.v1beta2.PigJob").msgclass
228
+ JobPlacement = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dataproc.v1beta2.JobPlacement").msgclass
229
+ JobStatus = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dataproc.v1beta2.JobStatus").msgclass
230
+ JobStatus::State = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dataproc.v1beta2.JobStatus.State").enummodule
231
+ JobStatus::Substate = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dataproc.v1beta2.JobStatus.Substate").enummodule
232
+ JobReference = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dataproc.v1beta2.JobReference").msgclass
233
+ YarnApplication = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dataproc.v1beta2.YarnApplication").msgclass
234
+ YarnApplication::State = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dataproc.v1beta2.YarnApplication.State").enummodule
235
+ Job = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dataproc.v1beta2.Job").msgclass
236
+ JobScheduling = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dataproc.v1beta2.JobScheduling").msgclass
237
+ SubmitJobRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dataproc.v1beta2.SubmitJobRequest").msgclass
238
+ GetJobRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dataproc.v1beta2.GetJobRequest").msgclass
239
+ ListJobsRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dataproc.v1beta2.ListJobsRequest").msgclass
240
+ ListJobsRequest::JobStateMatcher = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dataproc.v1beta2.ListJobsRequest.JobStateMatcher").enummodule
241
+ UpdateJobRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dataproc.v1beta2.UpdateJobRequest").msgclass
242
+ ListJobsResponse = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dataproc.v1beta2.ListJobsResponse").msgclass
243
+ CancelJobRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dataproc.v1beta2.CancelJobRequest").msgclass
244
+ DeleteJobRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dataproc.v1beta2.DeleteJobRequest").msgclass
245
+ end
246
+ end
247
+ end
248
+ end
@@ -0,0 +1,61 @@
1
+ # Generated by the protocol buffer compiler. DO NOT EDIT!
2
+ # Source: google/cloud/dataproc/v1beta2/jobs.proto for package 'google.cloud.dataproc.v1beta2'
3
+ # Original file comments:
4
+ # Copyright 2018 Google LLC.
5
+ #
6
+ # Licensed under the Apache License, Version 2.0 (the "License");
7
+ # you may not use this file except in compliance with the License.
8
+ # You may obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS,
14
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ # See the License for the specific language governing permissions and
16
+ # limitations under the License.
17
+ #
18
+ #
19
+
20
+
21
+ require 'grpc'
22
+ require 'google/cloud/dataproc/v1beta2/jobs_pb'
23
+
24
+ module Google
25
+ module Cloud
26
+ module Dataproc
27
+ module V1beta2
28
+ module JobController
29
+ # The JobController provides methods to manage jobs.
30
+ class Service
31
+
32
+ include GRPC::GenericService
33
+
34
+ self.marshal_class_method = :encode
35
+ self.unmarshal_class_method = :decode
36
+ self.service_name = 'google.cloud.dataproc.v1beta2.JobController'
37
+
38
+ # Submits a job to a cluster.
39
+ rpc :SubmitJob, SubmitJobRequest, Job
40
+ # Gets the resource representation for a job in a project.
41
+ rpc :GetJob, GetJobRequest, Job
42
+ # Lists regions/\\{region}/jobs in a project.
43
+ rpc :ListJobs, ListJobsRequest, ListJobsResponse
44
+ # Updates a job in a project.
45
+ rpc :UpdateJob, UpdateJobRequest, Job
46
+ # Starts a job cancellation request. To access the job resource
47
+ # after cancellation, call
48
+ # [regions/\\{region}/jobs.list](/dataproc/docs/reference/rest/v1beta2/projects.regions.jobs/list) or
49
+ # [regions/\\{region}/jobs.get](/dataproc/docs/reference/rest/v1beta2/projects.regions.jobs/get).
50
+ rpc :CancelJob, CancelJobRequest, Job
51
+ # Deletes the job from the project. If the job is active, the delete fails,
52
+ # and the response returns `FAILED_PRECONDITION`.
53
+ rpc :DeleteJob, DeleteJobRequest, Google::Protobuf::Empty
54
+ end
55
+
56
+ Stub = Service.rpc_stub_class
57
+ end
58
+ end
59
+ end
60
+ end
61
+ end
@@ -0,0 +1,44 @@
1
+ # Generated by the protocol buffer compiler. DO NOT EDIT!
2
+ # source: google/cloud/dataproc/v1beta2/operations.proto
3
+
4
+
5
+ require 'google/protobuf'
6
+
7
+ require 'google/api/annotations_pb'
8
+ require 'google/protobuf/timestamp_pb'
9
+ Google::Protobuf::DescriptorPool.generated_pool.build do
10
+ add_message "google.cloud.dataproc.v1beta2.ClusterOperationStatus" do
11
+ optional :state, :enum, 1, "google.cloud.dataproc.v1beta2.ClusterOperationStatus.State"
12
+ optional :inner_state, :string, 2
13
+ optional :details, :string, 3
14
+ optional :state_start_time, :message, 4, "google.protobuf.Timestamp"
15
+ end
16
+ add_enum "google.cloud.dataproc.v1beta2.ClusterOperationStatus.State" do
17
+ value :UNKNOWN, 0
18
+ value :PENDING, 1
19
+ value :RUNNING, 2
20
+ value :DONE, 3
21
+ end
22
+ add_message "google.cloud.dataproc.v1beta2.ClusterOperationMetadata" do
23
+ optional :cluster_name, :string, 7
24
+ optional :cluster_uuid, :string, 8
25
+ optional :status, :message, 9, "google.cloud.dataproc.v1beta2.ClusterOperationStatus"
26
+ repeated :status_history, :message, 10, "google.cloud.dataproc.v1beta2.ClusterOperationStatus"
27
+ optional :operation_type, :string, 11
28
+ optional :description, :string, 12
29
+ map :labels, :string, :string, 13
30
+ repeated :warnings, :string, 14
31
+ end
32
+ end
33
+
34
+ module Google
35
+ module Cloud
36
+ module Dataproc
37
+ module V1beta2
38
+ ClusterOperationStatus = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dataproc.v1beta2.ClusterOperationStatus").msgclass
39
+ ClusterOperationStatus::State = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dataproc.v1beta2.ClusterOperationStatus.State").enummodule
40
+ ClusterOperationMetadata = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dataproc.v1beta2.ClusterOperationMetadata").msgclass
41
+ end
42
+ end
43
+ end
44
+ end
@@ -0,0 +1,18 @@
1
+ # Generated by the protocol buffer compiler. DO NOT EDIT!
2
+ # source: google/cloud/dataproc/v1beta2/shared.proto
3
+
4
+
5
+ require 'google/protobuf'
6
+
7
+ require 'google/api/annotations_pb'
8
+ Google::Protobuf::DescriptorPool.generated_pool.build do
9
+ end
10
+
11
+ module Google
12
+ module Cloud
13
+ module Dataproc
14
+ module V1beta2
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,698 @@
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/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
+
33
+ module Google
34
+ module Cloud
35
+ module Dataproc
36
+ module V1beta2
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::V1beta2::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/v1beta2/workflow_templates_services_pb"
156
+
157
+ credentials ||= Google::Cloud::Dataproc::V1beta2::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::V1beta2::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.v1beta2.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::V1beta2::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::V1beta2::WorkflowTemplate | Hash]
271
+ # Required. The Dataproc workflow template to create.
272
+ # A hash of the same form as `Google::Cloud::Dataproc::V1beta2::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::V1beta2::WorkflowTemplate]
279
+ # @yieldparam operation [GRPC::ActiveCall::Operation]
280
+ # @return [Google::Cloud::Dataproc::V1beta2::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: :v1beta2)
286
+ # formatted_parent = Google::Cloud::Dataproc::V1beta2::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::V1beta2::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::V1beta2::WorkflowTemplate]
324
+ # @yieldparam operation [GRPC::ActiveCall::Operation]
325
+ # @return [Google::Cloud::Dataproc::V1beta2::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: :v1beta2)
331
+ # formatted_name = Google::Cloud::Dataproc::V1beta2::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::V1beta2::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::V1beta2::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 instance_id [String]
378
+ # Deprecated. Please use `request_id` field instead.
379
+ # @param request_id [String]
380
+ # Optional. A tag that prevents multiple concurrent workflow
381
+ # instances with the same tag from running. This mitigates risk of
382
+ # concurrent instances started due to retries.
383
+ #
384
+ # It is recommended to always set this value to a
385
+ # [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier).
386
+ #
387
+ # The tag must contain only letters (a-z, A-Z), numbers (0-9),
388
+ # underscores (_), and hyphens (-). The maximum length is 40 characters.
389
+ # @param parameters [Hash{String => String}]
390
+ # Optional. Map from parameter names to values that should be used for those
391
+ # parameters. Values may not exceed 100 characters.
392
+ # @param options [Google::Gax::CallOptions]
393
+ # Overrides the default settings for this call, e.g, timeout,
394
+ # retries, etc.
395
+ # @return [Google::Gax::Operation]
396
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
397
+ # @example
398
+ # require "google/cloud/dataproc"
399
+ #
400
+ # workflow_template_service_client = Google::Cloud::Dataproc::WorkflowTemplateService.new(version: :v1beta2)
401
+ # formatted_name = Google::Cloud::Dataproc::V1beta2::WorkflowTemplateServiceClient.workflow_template_path("[PROJECT]", "[REGION]", "[WORKFLOW_TEMPLATE]")
402
+ #
403
+ # # Register a callback during the method call.
404
+ # operation = workflow_template_service_client.instantiate_workflow_template(formatted_name) do |op|
405
+ # raise op.results.message if op.error?
406
+ # op_results = op.results
407
+ # # Process the results.
408
+ #
409
+ # metadata = op.metadata
410
+ # # Process the metadata.
411
+ # end
412
+ #
413
+ # # Or use the return value to register a callback.
414
+ # operation.on_done do |op|
415
+ # raise op.results.message if op.error?
416
+ # op_results = op.results
417
+ # # Process the results.
418
+ #
419
+ # metadata = op.metadata
420
+ # # Process the metadata.
421
+ # end
422
+ #
423
+ # # Manually reload the operation.
424
+ # operation.reload!
425
+ #
426
+ # # Or block until the operation completes, triggering callbacks on
427
+ # # completion.
428
+ # operation.wait_until_done!
429
+
430
+ def instantiate_workflow_template \
431
+ name,
432
+ version: nil,
433
+ instance_id: nil,
434
+ request_id: nil,
435
+ parameters: nil,
436
+ options: nil
437
+ req = {
438
+ name: name,
439
+ version: version,
440
+ instance_id: instance_id,
441
+ request_id: request_id,
442
+ parameters: parameters
443
+ }.delete_if { |_, v| v.nil? }
444
+ req = Google::Gax::to_proto(req, Google::Cloud::Dataproc::V1beta2::InstantiateWorkflowTemplateRequest)
445
+ operation = Google::Gax::Operation.new(
446
+ @instantiate_workflow_template.call(req, options),
447
+ @operations_client,
448
+ Google::Protobuf::Empty,
449
+ Google::Cloud::Dataproc::V1beta2::WorkflowMetadata,
450
+ call_options: options
451
+ )
452
+ operation.on_done { |operation| yield(operation) } if block_given?
453
+ operation
454
+ end
455
+
456
+ # Instantiates a template and begins execution.
457
+ #
458
+ # This method is equivalent to executing the sequence
459
+ # {Google::Cloud::Dataproc::V1beta2::WorkflowTemplateService::CreateWorkflowTemplate CreateWorkflowTemplate}, {Google::Cloud::Dataproc::V1beta2::WorkflowTemplateService::InstantiateWorkflowTemplate InstantiateWorkflowTemplate},
460
+ # {Google::Cloud::Dataproc::V1beta2::WorkflowTemplateService::DeleteWorkflowTemplate DeleteWorkflowTemplate}.
461
+ #
462
+ # The returned Operation can be used to track execution of
463
+ # workflow by polling
464
+ # {Google::Longrunning::Operations::GetOperation operations::get}.
465
+ # The Operation will complete when entire workflow is finished.
466
+ #
467
+ # The running workflow can be aborted via
468
+ # {Google::Longrunning::Operations::CancelOperation operations::cancel}.
469
+ # This will cause any inflight jobs to be cancelled and workflow-owned
470
+ # clusters to be deleted.
471
+ #
472
+ # The {Google::Longrunning::Operation#metadata Operation#metadata} will be
473
+ # {Google::Cloud::Dataproc::V1beta2::WorkflowMetadata WorkflowMetadata}.
474
+ #
475
+ # On successful completion,
476
+ # {Google::Longrunning::Operation#response Operation#response} will be
477
+ # {Google::Protobuf::Empty Empty}.
478
+ #
479
+ # @param parent [String]
480
+ # Required. The "resource name" of the workflow template region, as described
481
+ # in https://cloud.google.com/apis/design/resource_names of the form
482
+ # `projects/{project_id}/regions/{region}`
483
+ # @param template [Google::Cloud::Dataproc::V1beta2::WorkflowTemplate | Hash]
484
+ # Required. The workflow template to instantiate.
485
+ # A hash of the same form as `Google::Cloud::Dataproc::V1beta2::WorkflowTemplate`
486
+ # can also be provided.
487
+ # @param instance_id [String]
488
+ # Deprecated. Please use `request_id` field instead.
489
+ # @param request_id [String]
490
+ # Optional. A tag that prevents multiple concurrent workflow
491
+ # instances with the same tag from running. This mitigates risk of
492
+ # concurrent instances started due to retries.
493
+ #
494
+ # It is recommended to always set this value to a
495
+ # [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier).
496
+ #
497
+ # The tag must contain only letters (a-z, A-Z), numbers (0-9),
498
+ # underscores (_), and hyphens (-). The maximum length is 40 characters.
499
+ # @param options [Google::Gax::CallOptions]
500
+ # Overrides the default settings for this call, e.g, timeout,
501
+ # retries, etc.
502
+ # @return [Google::Gax::Operation]
503
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
504
+ # @example
505
+ # require "google/cloud/dataproc"
506
+ #
507
+ # workflow_template_service_client = Google::Cloud::Dataproc::WorkflowTemplateService.new(version: :v1beta2)
508
+ # formatted_parent = Google::Cloud::Dataproc::V1beta2::WorkflowTemplateServiceClient.region_path("[PROJECT]", "[REGION]")
509
+ #
510
+ # # TODO: Initialize `template`:
511
+ # template = {}
512
+ #
513
+ # # Register a callback during the method call.
514
+ # operation = workflow_template_service_client.instantiate_inline_workflow_template(formatted_parent, template) do |op|
515
+ # raise op.results.message if op.error?
516
+ # op_results = op.results
517
+ # # Process the results.
518
+ #
519
+ # metadata = op.metadata
520
+ # # Process the metadata.
521
+ # end
522
+ #
523
+ # # Or use the return value to register a callback.
524
+ # operation.on_done do |op|
525
+ # raise op.results.message if op.error?
526
+ # op_results = op.results
527
+ # # Process the results.
528
+ #
529
+ # metadata = op.metadata
530
+ # # Process the metadata.
531
+ # end
532
+ #
533
+ # # Manually reload the operation.
534
+ # operation.reload!
535
+ #
536
+ # # Or block until the operation completes, triggering callbacks on
537
+ # # completion.
538
+ # operation.wait_until_done!
539
+
540
+ def instantiate_inline_workflow_template \
541
+ parent,
542
+ template,
543
+ instance_id: nil,
544
+ request_id: nil,
545
+ options: nil
546
+ req = {
547
+ parent: parent,
548
+ template: template,
549
+ instance_id: instance_id,
550
+ request_id: request_id
551
+ }.delete_if { |_, v| v.nil? }
552
+ req = Google::Gax::to_proto(req, Google::Cloud::Dataproc::V1beta2::InstantiateInlineWorkflowTemplateRequest)
553
+ operation = Google::Gax::Operation.new(
554
+ @instantiate_inline_workflow_template.call(req, options),
555
+ @operations_client,
556
+ Google::Protobuf::Empty,
557
+ Google::Cloud::Dataproc::V1beta2::WorkflowMetadata,
558
+ call_options: options
559
+ )
560
+ operation.on_done { |operation| yield(operation) } if block_given?
561
+ operation
562
+ end
563
+
564
+ # Updates (replaces) workflow template. The updated template
565
+ # must contain version that matches the current server version.
566
+ #
567
+ # @param template [Google::Cloud::Dataproc::V1beta2::WorkflowTemplate | Hash]
568
+ # Required. The updated workflow template.
569
+ #
570
+ # The `template.version` field must match the current version.
571
+ # A hash of the same form as `Google::Cloud::Dataproc::V1beta2::WorkflowTemplate`
572
+ # can also be provided.
573
+ # @param options [Google::Gax::CallOptions]
574
+ # Overrides the default settings for this call, e.g, timeout,
575
+ # retries, etc.
576
+ # @yield [result, operation] Access the result along with the RPC operation
577
+ # @yieldparam result [Google::Cloud::Dataproc::V1beta2::WorkflowTemplate]
578
+ # @yieldparam operation [GRPC::ActiveCall::Operation]
579
+ # @return [Google::Cloud::Dataproc::V1beta2::WorkflowTemplate]
580
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
581
+ # @example
582
+ # require "google/cloud/dataproc"
583
+ #
584
+ # workflow_template_service_client = Google::Cloud::Dataproc::WorkflowTemplateService.new(version: :v1beta2)
585
+ #
586
+ # # TODO: Initialize `template`:
587
+ # template = {}
588
+ # response = workflow_template_service_client.update_workflow_template(template)
589
+
590
+ def update_workflow_template \
591
+ template,
592
+ options: nil,
593
+ &block
594
+ req = {
595
+ template: template
596
+ }.delete_if { |_, v| v.nil? }
597
+ req = Google::Gax::to_proto(req, Google::Cloud::Dataproc::V1beta2::UpdateWorkflowTemplateRequest)
598
+ @update_workflow_template.call(req, options, &block)
599
+ end
600
+
601
+ # Lists workflows that match the specified filter in the request.
602
+ #
603
+ # @param parent [String]
604
+ # Required. The "resource name" of the region, as described
605
+ # in https://cloud.google.com/apis/design/resource_names of the form
606
+ # `projects/{project_id}/regions/{region}`
607
+ # @param page_size [Integer]
608
+ # The maximum number of resources contained in the underlying API
609
+ # response. If page streaming is performed per-resource, this
610
+ # parameter does not affect the return value. If page streaming is
611
+ # performed per-page, this determines the maximum number of
612
+ # resources in a page.
613
+ # @param options [Google::Gax::CallOptions]
614
+ # Overrides the default settings for this call, e.g, timeout,
615
+ # retries, etc.
616
+ # @yield [result, operation] Access the result along with the RPC operation
617
+ # @yieldparam result [Google::Gax::PagedEnumerable<Google::Cloud::Dataproc::V1beta2::WorkflowTemplate>]
618
+ # @yieldparam operation [GRPC::ActiveCall::Operation]
619
+ # @return [Google::Gax::PagedEnumerable<Google::Cloud::Dataproc::V1beta2::WorkflowTemplate>]
620
+ # An enumerable of Google::Cloud::Dataproc::V1beta2::WorkflowTemplate instances.
621
+ # See Google::Gax::PagedEnumerable documentation for other
622
+ # operations such as per-page iteration or access to the response
623
+ # object.
624
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
625
+ # @example
626
+ # require "google/cloud/dataproc"
627
+ #
628
+ # workflow_template_service_client = Google::Cloud::Dataproc::WorkflowTemplateService.new(version: :v1beta2)
629
+ # formatted_parent = Google::Cloud::Dataproc::V1beta2::WorkflowTemplateServiceClient.region_path("[PROJECT]", "[REGION]")
630
+ #
631
+ # # Iterate over all results.
632
+ # workflow_template_service_client.list_workflow_templates(formatted_parent).each do |element|
633
+ # # Process element.
634
+ # end
635
+ #
636
+ # # Or iterate over results one page at a time.
637
+ # workflow_template_service_client.list_workflow_templates(formatted_parent).each_page do |page|
638
+ # # Process each page at a time.
639
+ # page.each do |element|
640
+ # # Process element.
641
+ # end
642
+ # end
643
+
644
+ def list_workflow_templates \
645
+ parent,
646
+ page_size: nil,
647
+ options: nil,
648
+ &block
649
+ req = {
650
+ parent: parent,
651
+ page_size: page_size
652
+ }.delete_if { |_, v| v.nil? }
653
+ req = Google::Gax::to_proto(req, Google::Cloud::Dataproc::V1beta2::ListWorkflowTemplatesRequest)
654
+ @list_workflow_templates.call(req, options, &block)
655
+ end
656
+
657
+ # Deletes a workflow template. It does not cancel in-progress workflows.
658
+ #
659
+ # @param name [String]
660
+ # Required. The "resource name" of the workflow template, as described
661
+ # in https://cloud.google.com/apis/design/resource_names of the form
662
+ # `projects/{project_id}/regions/{region}/workflowTemplates/{template_id}`
663
+ # @param version [Integer]
664
+ # Optional. The version of workflow template to delete. If specified,
665
+ # will only delete the template if the current server version matches
666
+ # specified version.
667
+ # @param options [Google::Gax::CallOptions]
668
+ # Overrides the default settings for this call, e.g, timeout,
669
+ # retries, etc.
670
+ # @yield [result, operation] Access the result along with the RPC operation
671
+ # @yieldparam result []
672
+ # @yieldparam operation [GRPC::ActiveCall::Operation]
673
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
674
+ # @example
675
+ # require "google/cloud/dataproc"
676
+ #
677
+ # workflow_template_service_client = Google::Cloud::Dataproc::WorkflowTemplateService.new(version: :v1beta2)
678
+ # formatted_name = Google::Cloud::Dataproc::V1beta2::WorkflowTemplateServiceClient.workflow_template_path("[PROJECT]", "[REGION]", "[WORKFLOW_TEMPLATE]")
679
+ # workflow_template_service_client.delete_workflow_template(formatted_name)
680
+
681
+ def delete_workflow_template \
682
+ name,
683
+ version: nil,
684
+ options: nil,
685
+ &block
686
+ req = {
687
+ name: name,
688
+ version: version
689
+ }.delete_if { |_, v| v.nil? }
690
+ req = Google::Gax::to_proto(req, Google::Cloud::Dataproc::V1beta2::DeleteWorkflowTemplateRequest)
691
+ @delete_workflow_template.call(req, options, &block)
692
+ nil
693
+ end
694
+ end
695
+ end
696
+ end
697
+ end
698
+ end