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
@@ -0,0 +1,109 @@
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
+
16
+ module Google
17
+ module Protobuf
18
+ # A Timestamp represents a point in time independent of any time zone
19
+ # or calendar, represented as seconds and fractions of seconds at
20
+ # nanosecond resolution in UTC Epoch time. It is encoded using the
21
+ # Proleptic Gregorian Calendar which extends the Gregorian calendar
22
+ # backwards to year one. It is encoded assuming all minutes are 60
23
+ # seconds long, i.e. leap seconds are "smeared" so that no leap second
24
+ # table is needed for interpretation. Range is from
25
+ # 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z.
26
+ # By restricting to that range, we ensure that we can convert to
27
+ # and from RFC 3339 date strings.
28
+ # See [https://www.ietf.org/rfc/rfc3339.txt](https://www.ietf.org/rfc/rfc3339.txt).
29
+ #
30
+ # = Examples
31
+ #
32
+ # Example 1: Compute Timestamp from POSIX `time()`.
33
+ #
34
+ # Timestamp timestamp;
35
+ # timestamp.set_seconds(time(NULL));
36
+ # timestamp.set_nanos(0);
37
+ #
38
+ # Example 2: Compute Timestamp from POSIX `gettimeofday()`.
39
+ #
40
+ # struct timeval tv;
41
+ # gettimeofday(&tv, NULL);
42
+ #
43
+ # Timestamp timestamp;
44
+ # timestamp.set_seconds(tv.tv_sec);
45
+ # timestamp.set_nanos(tv.tv_usec * 1000);
46
+ #
47
+ # Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`.
48
+ #
49
+ # FILETIME ft;
50
+ # GetSystemTimeAsFileTime(&ft);
51
+ # UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime;
52
+ #
53
+ # // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z
54
+ # // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z.
55
+ # Timestamp timestamp;
56
+ # timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL));
57
+ # timestamp.set_nanos((INT32) ((ticks % 10000000) * 100));
58
+ #
59
+ # Example 4: Compute Timestamp from Java `System.currentTimeMillis()`.
60
+ #
61
+ # long millis = System.currentTimeMillis();
62
+ #
63
+ # Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000)
64
+ # .setNanos((int) ((millis % 1000) * 1000000)).build();
65
+ #
66
+ #
67
+ # Example 5: Compute Timestamp from current time in Python.
68
+ #
69
+ # timestamp = Timestamp()
70
+ # timestamp.GetCurrentTime()
71
+ #
72
+ # = JSON Mapping
73
+ #
74
+ # In JSON format, the Timestamp type is encoded as a string in the
75
+ # [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the
76
+ # format is "\\{year}-\\{month}-\\{day}T\\{hour}:\\{min}:\\{sec}[.\\{frac_sec}]Z"
77
+ # where \\{year} is always expressed using four digits while \\{month}, \\{day},
78
+ # \\{hour}, \\{min}, and \\{sec} are zero-padded to two digits each. The fractional
79
+ # seconds, which can go up to 9 digits (i.e. up to 1 nanosecond resolution),
80
+ # are optional. The "Z" suffix indicates the timezone ("UTC"); the timezone
81
+ # is required. A proto3 JSON serializer should always use UTC (as indicated by
82
+ # "Z") when printing the Timestamp type and a proto3 JSON parser should be
83
+ # able to accept both UTC and other timezones (as indicated by an offset).
84
+ #
85
+ # For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past
86
+ # 01:30 UTC on January 15, 2017.
87
+ #
88
+ # In JavaScript, one can convert a Date object to this format using the
89
+ # standard [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString]
90
+ # method. In Python, a standard `datetime.datetime` object can be converted
91
+ # to this format using [`strftime`](https://docs.python.org/2/library/time.html#time.strftime)
92
+ # with the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one
93
+ # can use the Joda Time's [`ISODateTimeFormat.dateTime()`](
94
+ # http://www.joda.org/joda-time/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime--
95
+ # ) to obtain a formatter capable of generating timestamps in this format.
96
+ # @!attribute [rw] seconds
97
+ # @return [Integer]
98
+ # Represents seconds of UTC time since Unix epoch
99
+ # 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to
100
+ # 9999-12-31T23:59:59Z inclusive.
101
+ # @!attribute [rw] nanos
102
+ # @return [Integer]
103
+ # Non-negative fractions of a second at nanosecond resolution. Negative
104
+ # second values with fractions must still have non-negative nanos values
105
+ # that count forward in time. Must be from 0 to 999,999,999
106
+ # inclusive.
107
+ class Timestamp; end
108
+ end
109
+ end
@@ -0,0 +1,84 @@
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
+
16
+ module Google
17
+ module Rpc
18
+ # The `Status` type defines a logical error model that is suitable for different
19
+ # programming environments, including REST APIs and RPC APIs. It is used by
20
+ # [gRPC](https://github.com/grpc). The error model is designed to be:
21
+ #
22
+ # * Simple to use and understand for most users
23
+ # * Flexible enough to meet unexpected needs
24
+ #
25
+ # = Overview
26
+ #
27
+ # The `Status` message contains three pieces of data: error code, error message,
28
+ # and error details. The error code should be an enum value of
29
+ # {Google::Rpc::Code}, but it may accept additional error codes if needed. The
30
+ # error message should be a developer-facing English message that helps
31
+ # developers *understand* and *resolve* the error. If a localized user-facing
32
+ # error message is needed, put the localized message in the error details or
33
+ # localize it in the client. The optional error details may contain arbitrary
34
+ # information about the error. There is a predefined set of error detail types
35
+ # in the package `google.rpc` that can be used for common error conditions.
36
+ #
37
+ # = Language mapping
38
+ #
39
+ # The `Status` message is the logical representation of the error model, but it
40
+ # is not necessarily the actual wire format. When the `Status` message is
41
+ # exposed in different client libraries and different wire protocols, it can be
42
+ # mapped differently. For example, it will likely be mapped to some exceptions
43
+ # in Java, but more likely mapped to some error codes in C.
44
+ #
45
+ # = Other uses
46
+ #
47
+ # The error model and the `Status` message can be used in a variety of
48
+ # environments, either with or without APIs, to provide a
49
+ # consistent developer experience across different environments.
50
+ #
51
+ # Example uses of this error model include:
52
+ #
53
+ # * Partial errors. If a service needs to return partial errors to the client,
54
+ # it may embed the `Status` in the normal response to indicate the partial
55
+ # errors.
56
+ #
57
+ # * Workflow errors. A typical workflow has multiple steps. Each step may
58
+ # have a `Status` message for error reporting.
59
+ #
60
+ # * Batch operations. If a client uses batch request and batch response, the
61
+ # `Status` message should be used directly inside batch response, one for
62
+ # each error sub-response.
63
+ #
64
+ # * Asynchronous operations. If an API call embeds asynchronous operation
65
+ # results in its response, the status of those operations should be
66
+ # represented directly using the `Status` message.
67
+ #
68
+ # * Logging. If some API errors are stored in logs, the message `Status` could
69
+ # be used directly after any stripping needed for security/privacy reasons.
70
+ # @!attribute [rw] code
71
+ # @return [Integer]
72
+ # The status code, which should be an enum value of {Google::Rpc::Code}.
73
+ # @!attribute [rw] message
74
+ # @return [String]
75
+ # A developer-facing error message, which should be in English. Any
76
+ # user-facing error message should be localized and sent in the
77
+ # {Google::Rpc::Status#details} field, or localized by the client.
78
+ # @!attribute [rw] details
79
+ # @return [Array<Google::Protobuf::Any>]
80
+ # A list of messages that carry the error details. There is a common set of
81
+ # message types for APIs to use.
82
+ class Status; end
83
+ end
84
+ end
@@ -0,0 +1,581 @@
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/jobs.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
+
28
+ require "google/cloud/dataproc/v1beta2/jobs_pb"
29
+ require "google/cloud/dataproc/v1beta2/credentials"
30
+
31
+ module Google
32
+ module Cloud
33
+ module Dataproc
34
+ module V1beta2
35
+ # The JobController provides methods to manage jobs.
36
+ #
37
+ # @!attribute [r] job_controller_stub
38
+ # @return [Google::Cloud::Dataproc::V1beta2::JobController::Stub]
39
+ class JobControllerClient
40
+ # @private
41
+ attr_reader :job_controller_stub
42
+
43
+ # The default address of the service.
44
+ SERVICE_ADDRESS = "dataproc.googleapis.com".freeze
45
+
46
+ # The default port of the service.
47
+ DEFAULT_SERVICE_PORT = 443
48
+
49
+ # The default set of gRPC interceptors.
50
+ GRPC_INTERCEPTORS = []
51
+
52
+ DEFAULT_TIMEOUT = 30
53
+
54
+ PAGE_DESCRIPTORS = {
55
+ "list_jobs" => Google::Gax::PageDescriptor.new(
56
+ "page_token",
57
+ "next_page_token",
58
+ "jobs")
59
+ }.freeze
60
+
61
+ private_constant :PAGE_DESCRIPTORS
62
+
63
+ # The scopes needed to make gRPC calls to all of the methods defined in
64
+ # this service.
65
+ ALL_SCOPES = [
66
+ "https://www.googleapis.com/auth/cloud-platform"
67
+ ].freeze
68
+
69
+
70
+ # @param credentials [Google::Auth::Credentials, String, Hash, GRPC::Core::Channel, GRPC::Core::ChannelCredentials, Proc]
71
+ # Provides the means for authenticating requests made by the client. This parameter can
72
+ # be many types.
73
+ # A `Google::Auth::Credentials` uses a the properties of its represented keyfile for
74
+ # authenticating requests made by this client.
75
+ # A `String` will be treated as the path to the keyfile to be used for the construction of
76
+ # credentials for this client.
77
+ # A `Hash` will be treated as the contents of a keyfile to be used for the construction of
78
+ # credentials for this client.
79
+ # A `GRPC::Core::Channel` will be used to make calls through.
80
+ # A `GRPC::Core::ChannelCredentials` for the setting up the RPC client. The channel credentials
81
+ # should already be composed with a `GRPC::Core::CallCredentials` object.
82
+ # A `Proc` will be used as an updater_proc for the Grpc channel. The proc transforms the
83
+ # metadata for requests, generally, to give OAuth credentials.
84
+ # @param scopes [Array<String>]
85
+ # The OAuth scopes for this service. This parameter is ignored if
86
+ # an updater_proc is supplied.
87
+ # @param client_config [Hash]
88
+ # A Hash for call options for each method. See
89
+ # Google::Gax#construct_settings for the structure of
90
+ # this data. Falls back to the default config if not specified
91
+ # or the specified config is missing data points.
92
+ # @param timeout [Numeric]
93
+ # The default timeout, in seconds, for calls made through this client.
94
+ # @param metadata [Hash]
95
+ # Default metadata to be sent with each request. This can be overridden on a per call basis.
96
+ # @param exception_transformer [Proc]
97
+ # An optional proc that intercepts any exceptions raised during an API call to inject
98
+ # custom error handling.
99
+ def initialize \
100
+ credentials: nil,
101
+ scopes: ALL_SCOPES,
102
+ client_config: {},
103
+ timeout: DEFAULT_TIMEOUT,
104
+ metadata: nil,
105
+ exception_transformer: nil,
106
+ lib_name: nil,
107
+ lib_version: ""
108
+ # These require statements are intentionally placed here to initialize
109
+ # the gRPC module only when it's required.
110
+ # See https://github.com/googleapis/toolkit/issues/446
111
+ require "google/gax/grpc"
112
+ require "google/cloud/dataproc/v1beta2/jobs_services_pb"
113
+
114
+ credentials ||= Google::Cloud::Dataproc::V1beta2::Credentials.default
115
+
116
+ if credentials.is_a?(String) || credentials.is_a?(Hash)
117
+ updater_proc = Google::Cloud::Dataproc::V1beta2::Credentials.new(credentials).updater_proc
118
+ end
119
+ if credentials.is_a?(GRPC::Core::Channel)
120
+ channel = credentials
121
+ end
122
+ if credentials.is_a?(GRPC::Core::ChannelCredentials)
123
+ chan_creds = credentials
124
+ end
125
+ if credentials.is_a?(Proc)
126
+ updater_proc = credentials
127
+ end
128
+ if credentials.is_a?(Google::Auth::Credentials)
129
+ updater_proc = credentials.updater_proc
130
+ end
131
+
132
+ package_version = Gem.loaded_specs['google-cloud-dataproc'].version.version
133
+
134
+ google_api_client = "gl-ruby/#{RUBY_VERSION}"
135
+ google_api_client << " #{lib_name}/#{lib_version}" if lib_name
136
+ google_api_client << " gapic/#{package_version} gax/#{Google::Gax::VERSION}"
137
+ google_api_client << " grpc/#{GRPC::VERSION}"
138
+ google_api_client.freeze
139
+
140
+ headers = { :"x-goog-api-client" => google_api_client }
141
+ headers.merge!(metadata) unless metadata.nil?
142
+ client_config_file = Pathname.new(__dir__).join(
143
+ "job_controller_client_config.json"
144
+ )
145
+ defaults = client_config_file.open do |f|
146
+ Google::Gax.construct_settings(
147
+ "google.cloud.dataproc.v1beta2.JobController",
148
+ JSON.parse(f.read),
149
+ client_config,
150
+ Google::Gax::Grpc::STATUS_CODE_NAMES,
151
+ timeout,
152
+ page_descriptors: PAGE_DESCRIPTORS,
153
+ errors: Google::Gax::Grpc::API_ERRORS,
154
+ metadata: headers
155
+ )
156
+ end
157
+
158
+ # Allow overriding the service path/port in subclasses.
159
+ service_path = self.class::SERVICE_ADDRESS
160
+ port = self.class::DEFAULT_SERVICE_PORT
161
+ interceptors = self.class::GRPC_INTERCEPTORS
162
+ @job_controller_stub = Google::Gax::Grpc.create_stub(
163
+ service_path,
164
+ port,
165
+ chan_creds: chan_creds,
166
+ channel: channel,
167
+ updater_proc: updater_proc,
168
+ scopes: scopes,
169
+ interceptors: interceptors,
170
+ &Google::Cloud::Dataproc::V1beta2::JobController::Stub.method(:new)
171
+ )
172
+
173
+ @submit_job = Google::Gax.create_api_call(
174
+ @job_controller_stub.method(:submit_job),
175
+ defaults["submit_job"],
176
+ exception_transformer: exception_transformer
177
+ )
178
+ @get_job = Google::Gax.create_api_call(
179
+ @job_controller_stub.method(:get_job),
180
+ defaults["get_job"],
181
+ exception_transformer: exception_transformer
182
+ )
183
+ @list_jobs = Google::Gax.create_api_call(
184
+ @job_controller_stub.method(:list_jobs),
185
+ defaults["list_jobs"],
186
+ exception_transformer: exception_transformer
187
+ )
188
+ @update_job = Google::Gax.create_api_call(
189
+ @job_controller_stub.method(:update_job),
190
+ defaults["update_job"],
191
+ exception_transformer: exception_transformer
192
+ )
193
+ @cancel_job = Google::Gax.create_api_call(
194
+ @job_controller_stub.method(:cancel_job),
195
+ defaults["cancel_job"],
196
+ exception_transformer: exception_transformer
197
+ )
198
+ @delete_job = Google::Gax.create_api_call(
199
+ @job_controller_stub.method(:delete_job),
200
+ defaults["delete_job"],
201
+ exception_transformer: exception_transformer
202
+ )
203
+ end
204
+
205
+ # Service calls
206
+
207
+ # Submits a job to a cluster.
208
+ #
209
+ # @param project_id [String]
210
+ # Required. The ID of the Google Cloud Platform project that the job
211
+ # belongs to.
212
+ # @param region [String]
213
+ # Required. The Cloud Dataproc region in which to handle the request.
214
+ # @param job [Google::Cloud::Dataproc::V1beta2::Job | Hash]
215
+ # Required. The job resource.
216
+ # A hash of the same form as `Google::Cloud::Dataproc::V1beta2::Job`
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::V1beta2::SubmitJobRequest SubmitJobRequest} requests with the same
221
+ # id, then the second request will be ignored and the
222
+ # first {Google::Cloud::Dataproc::V1beta2::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.
230
+ # @param options [Google::Gax::CallOptions]
231
+ # Overrides the default settings for this call, e.g, timeout,
232
+ # retries, etc.
233
+ # @yield [result, operation] Access the result along with the RPC operation
234
+ # @yieldparam result [Google::Cloud::Dataproc::V1beta2::Job]
235
+ # @yieldparam operation [GRPC::ActiveCall::Operation]
236
+ # @return [Google::Cloud::Dataproc::V1beta2::Job]
237
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
238
+ # @example
239
+ # require "google/cloud/dataproc"
240
+ #
241
+ # job_controller_client = Google::Cloud::Dataproc::JobController.new(version: :v1beta2)
242
+ #
243
+ # # TODO: Initialize `project_id`:
244
+ # project_id = ''
245
+ #
246
+ # # TODO: Initialize `region`:
247
+ # region = ''
248
+ #
249
+ # # TODO: Initialize `job`:
250
+ # job = {}
251
+ # response = job_controller_client.submit_job(project_id, region, job)
252
+
253
+ def submit_job \
254
+ project_id,
255
+ region,
256
+ job,
257
+ request_id: nil,
258
+ options: nil,
259
+ &block
260
+ req = {
261
+ project_id: project_id,
262
+ region: region,
263
+ job: job,
264
+ request_id: request_id
265
+ }.delete_if { |_, v| v.nil? }
266
+ req = Google::Gax::to_proto(req, Google::Cloud::Dataproc::V1beta2::SubmitJobRequest)
267
+ @submit_job.call(req, options, &block)
268
+ end
269
+
270
+ # Gets the resource representation for a job in a project.
271
+ #
272
+ # @param project_id [String]
273
+ # Required. The ID of the Google Cloud Platform project that the job
274
+ # belongs to.
275
+ # @param region [String]
276
+ # Required. The Cloud Dataproc region in which to handle the request.
277
+ # @param job_id [String]
278
+ # Required. The job ID.
279
+ # @param options [Google::Gax::CallOptions]
280
+ # Overrides the default settings for this call, e.g, timeout,
281
+ # retries, etc.
282
+ # @yield [result, operation] Access the result along with the RPC operation
283
+ # @yieldparam result [Google::Cloud::Dataproc::V1beta2::Job]
284
+ # @yieldparam operation [GRPC::ActiveCall::Operation]
285
+ # @return [Google::Cloud::Dataproc::V1beta2::Job]
286
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
287
+ # @example
288
+ # require "google/cloud/dataproc"
289
+ #
290
+ # job_controller_client = Google::Cloud::Dataproc::JobController.new(version: :v1beta2)
291
+ #
292
+ # # TODO: Initialize `project_id`:
293
+ # project_id = ''
294
+ #
295
+ # # TODO: Initialize `region`:
296
+ # region = ''
297
+ #
298
+ # # TODO: Initialize `job_id`:
299
+ # job_id = ''
300
+ # response = job_controller_client.get_job(project_id, region, job_id)
301
+
302
+ def get_job \
303
+ project_id,
304
+ region,
305
+ job_id,
306
+ options: nil,
307
+ &block
308
+ req = {
309
+ project_id: project_id,
310
+ region: region,
311
+ job_id: job_id
312
+ }.delete_if { |_, v| v.nil? }
313
+ req = Google::Gax::to_proto(req, Google::Cloud::Dataproc::V1beta2::GetJobRequest)
314
+ @get_job.call(req, options, &block)
315
+ end
316
+
317
+ # Lists regions/\\{region}/jobs in a project.
318
+ #
319
+ # @param project_id [String]
320
+ # Required. The ID of the Google Cloud Platform project that the job
321
+ # belongs to.
322
+ # @param region [String]
323
+ # Required. The Cloud Dataproc region in which to handle the request.
324
+ # @param page_size [Integer]
325
+ # The maximum number of resources contained in the underlying API
326
+ # response. If page streaming is performed per-resource, this
327
+ # parameter does not affect the return value. If page streaming is
328
+ # performed per-page, this determines the maximum number of
329
+ # resources in a page.
330
+ # @param cluster_name [String]
331
+ # Optional. If set, the returned jobs list includes only jobs that were
332
+ # submitted to the named cluster.
333
+ # @param job_state_matcher [Google::Cloud::Dataproc::V1beta2::ListJobsRequest::JobStateMatcher]
334
+ # Optional. Specifies enumerated categories of jobs to list.
335
+ # (default = match ALL jobs).
336
+ #
337
+ # If `filter` is provided, `jobStateMatcher` will be ignored.
338
+ # @param filter [String]
339
+ # Optional. A filter constraining the jobs to list. Filters are
340
+ # case-sensitive and have the following syntax:
341
+ #
342
+ # [field = value] AND [field [= value]] ...
343
+ #
344
+ # where **field** is `status.state` or `labels.[KEY]`, and `[KEY]` is a label
345
+ # key. **value** can be `*` to match all values.
346
+ # `status.state` can be either `ACTIVE` or `NON_ACTIVE`.
347
+ # Only the logical `AND` operator is supported; space-separated items are
348
+ # treated as having an implicit `AND` operator.
349
+ #
350
+ # Example filter:
351
+ #
352
+ # status.state = ACTIVE AND labels.env = staging AND labels.starred = *
353
+ # @param options [Google::Gax::CallOptions]
354
+ # Overrides the default settings for this call, e.g, timeout,
355
+ # retries, etc.
356
+ # @yield [result, operation] Access the result along with the RPC operation
357
+ # @yieldparam result [Google::Gax::PagedEnumerable<Google::Cloud::Dataproc::V1beta2::Job>]
358
+ # @yieldparam operation [GRPC::ActiveCall::Operation]
359
+ # @return [Google::Gax::PagedEnumerable<Google::Cloud::Dataproc::V1beta2::Job>]
360
+ # An enumerable of Google::Cloud::Dataproc::V1beta2::Job instances.
361
+ # See Google::Gax::PagedEnumerable documentation for other
362
+ # operations such as per-page iteration or access to the response
363
+ # object.
364
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
365
+ # @example
366
+ # require "google/cloud/dataproc"
367
+ #
368
+ # job_controller_client = Google::Cloud::Dataproc::JobController.new(version: :v1beta2)
369
+ #
370
+ # # TODO: Initialize `project_id`:
371
+ # project_id = ''
372
+ #
373
+ # # TODO: Initialize `region`:
374
+ # region = ''
375
+ #
376
+ # # Iterate over all results.
377
+ # job_controller_client.list_jobs(project_id, region).each do |element|
378
+ # # Process element.
379
+ # end
380
+ #
381
+ # # Or iterate over results one page at a time.
382
+ # job_controller_client.list_jobs(project_id, region).each_page do |page|
383
+ # # Process each page at a time.
384
+ # page.each do |element|
385
+ # # Process element.
386
+ # end
387
+ # end
388
+
389
+ def list_jobs \
390
+ project_id,
391
+ region,
392
+ page_size: nil,
393
+ cluster_name: nil,
394
+ job_state_matcher: nil,
395
+ filter: nil,
396
+ options: nil,
397
+ &block
398
+ req = {
399
+ project_id: project_id,
400
+ region: region,
401
+ page_size: page_size,
402
+ cluster_name: cluster_name,
403
+ job_state_matcher: job_state_matcher,
404
+ filter: filter
405
+ }.delete_if { |_, v| v.nil? }
406
+ req = Google::Gax::to_proto(req, Google::Cloud::Dataproc::V1beta2::ListJobsRequest)
407
+ @list_jobs.call(req, options, &block)
408
+ end
409
+
410
+ # Updates a job in a project.
411
+ #
412
+ # @param project_id [String]
413
+ # Required. The ID of the Google Cloud Platform project that the job
414
+ # belongs to.
415
+ # @param region [String]
416
+ # Required. The Cloud Dataproc region in which to handle the request.
417
+ # @param job_id [String]
418
+ # Required. The job ID.
419
+ # @param job [Google::Cloud::Dataproc::V1beta2::Job | Hash]
420
+ # Required. The changes to the job.
421
+ # A hash of the same form as `Google::Cloud::Dataproc::V1beta2::Job`
422
+ # can also be provided.
423
+ # @param update_mask [Google::Protobuf::FieldMask | Hash]
424
+ # Required. Specifies the path, relative to <code>Job</code>, of
425
+ # the field to update. For example, to update the labels of a Job the
426
+ # <code>update_mask</code> parameter would be specified as
427
+ # <code>labels</code>, and the `PATCH` request body would specify the new
428
+ # value. <strong>Note:</strong> Currently, <code>labels</code> is the only
429
+ # field that can be updated.
430
+ # A hash of the same form as `Google::Protobuf::FieldMask`
431
+ # can also be provided.
432
+ # @param options [Google::Gax::CallOptions]
433
+ # Overrides the default settings for this call, e.g, timeout,
434
+ # retries, etc.
435
+ # @yield [result, operation] Access the result along with the RPC operation
436
+ # @yieldparam result [Google::Cloud::Dataproc::V1beta2::Job]
437
+ # @yieldparam operation [GRPC::ActiveCall::Operation]
438
+ # @return [Google::Cloud::Dataproc::V1beta2::Job]
439
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
440
+ # @example
441
+ # require "google/cloud/dataproc"
442
+ #
443
+ # job_controller_client = Google::Cloud::Dataproc::JobController.new(version: :v1beta2)
444
+ #
445
+ # # TODO: Initialize `project_id`:
446
+ # project_id = ''
447
+ #
448
+ # # TODO: Initialize `region`:
449
+ # region = ''
450
+ #
451
+ # # TODO: Initialize `job_id`:
452
+ # job_id = ''
453
+ #
454
+ # # TODO: Initialize `job`:
455
+ # job = {}
456
+ #
457
+ # # TODO: Initialize `update_mask`:
458
+ # update_mask = {}
459
+ # response = job_controller_client.update_job(project_id, region, job_id, job, update_mask)
460
+
461
+ def update_job \
462
+ project_id,
463
+ region,
464
+ job_id,
465
+ job,
466
+ update_mask,
467
+ options: nil,
468
+ &block
469
+ req = {
470
+ project_id: project_id,
471
+ region: region,
472
+ job_id: job_id,
473
+ job: job,
474
+ update_mask: update_mask
475
+ }.delete_if { |_, v| v.nil? }
476
+ req = Google::Gax::to_proto(req, Google::Cloud::Dataproc::V1beta2::UpdateJobRequest)
477
+ @update_job.call(req, options, &block)
478
+ end
479
+
480
+ # Starts a job cancellation request. To access the job resource
481
+ # after cancellation, call
482
+ # [regions/\\{region}/jobs.list](https://cloud.google.com/dataproc/docs/reference/rest/v1beta2/projects.regions.jobs/list) or
483
+ # [regions/\\{region}/jobs.get](https://cloud.google.com/dataproc/docs/reference/rest/v1beta2/projects.regions.jobs/get).
484
+ #
485
+ # @param project_id [String]
486
+ # Required. The ID of the Google Cloud Platform project that the job
487
+ # belongs to.
488
+ # @param region [String]
489
+ # Required. The Cloud Dataproc region in which to handle the request.
490
+ # @param job_id [String]
491
+ # Required. The job ID.
492
+ # @param options [Google::Gax::CallOptions]
493
+ # Overrides the default settings for this call, e.g, timeout,
494
+ # retries, etc.
495
+ # @yield [result, operation] Access the result along with the RPC operation
496
+ # @yieldparam result [Google::Cloud::Dataproc::V1beta2::Job]
497
+ # @yieldparam operation [GRPC::ActiveCall::Operation]
498
+ # @return [Google::Cloud::Dataproc::V1beta2::Job]
499
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
500
+ # @example
501
+ # require "google/cloud/dataproc"
502
+ #
503
+ # job_controller_client = Google::Cloud::Dataproc::JobController.new(version: :v1beta2)
504
+ #
505
+ # # TODO: Initialize `project_id`:
506
+ # project_id = ''
507
+ #
508
+ # # TODO: Initialize `region`:
509
+ # region = ''
510
+ #
511
+ # # TODO: Initialize `job_id`:
512
+ # job_id = ''
513
+ # response = job_controller_client.cancel_job(project_id, region, job_id)
514
+
515
+ def cancel_job \
516
+ project_id,
517
+ region,
518
+ job_id,
519
+ options: nil,
520
+ &block
521
+ req = {
522
+ project_id: project_id,
523
+ region: region,
524
+ job_id: job_id
525
+ }.delete_if { |_, v| v.nil? }
526
+ req = Google::Gax::to_proto(req, Google::Cloud::Dataproc::V1beta2::CancelJobRequest)
527
+ @cancel_job.call(req, options, &block)
528
+ end
529
+
530
+ # Deletes the job from the project. If the job is active, the delete fails,
531
+ # and the response returns `FAILED_PRECONDITION`.
532
+ #
533
+ # @param project_id [String]
534
+ # Required. The ID of the Google Cloud Platform project that the job
535
+ # belongs to.
536
+ # @param region [String]
537
+ # Required. The Cloud Dataproc region in which to handle the request.
538
+ # @param job_id [String]
539
+ # Required. The job ID.
540
+ # @param options [Google::Gax::CallOptions]
541
+ # Overrides the default settings for this call, e.g, timeout,
542
+ # retries, etc.
543
+ # @yield [result, operation] Access the result along with the RPC operation
544
+ # @yieldparam result []
545
+ # @yieldparam operation [GRPC::ActiveCall::Operation]
546
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
547
+ # @example
548
+ # require "google/cloud/dataproc"
549
+ #
550
+ # job_controller_client = Google::Cloud::Dataproc::JobController.new(version: :v1beta2)
551
+ #
552
+ # # TODO: Initialize `project_id`:
553
+ # project_id = ''
554
+ #
555
+ # # TODO: Initialize `region`:
556
+ # region = ''
557
+ #
558
+ # # TODO: Initialize `job_id`:
559
+ # job_id = ''
560
+ # job_controller_client.delete_job(project_id, region, job_id)
561
+
562
+ def delete_job \
563
+ project_id,
564
+ region,
565
+ job_id,
566
+ options: nil,
567
+ &block
568
+ req = {
569
+ project_id: project_id,
570
+ region: region,
571
+ job_id: job_id
572
+ }.delete_if { |_, v| v.nil? }
573
+ req = Google::Gax::to_proto(req, Google::Cloud::Dataproc::V1beta2::DeleteJobRequest)
574
+ @delete_job.call(req, options, &block)
575
+ nil
576
+ end
577
+ end
578
+ end
579
+ end
580
+ end
581
+ end