google-cloud-dataproc-v1 0.23.1 → 0.24.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (31) hide show
  1. checksums.yaml +4 -4
  2. data/lib/google/cloud/dataproc/v1/operations_pb.rb +3 -1
  3. data/lib/google/cloud/dataproc/v1/rest.rb +2 -0
  4. data/lib/google/cloud/dataproc/v1/session_controller/client.rb +912 -0
  5. data/lib/google/cloud/dataproc/v1/session_controller/credentials.rb +51 -0
  6. data/lib/google/cloud/dataproc/v1/session_controller/operations.rb +801 -0
  7. data/lib/google/cloud/dataproc/v1/session_controller/paths.rb +107 -0
  8. data/lib/google/cloud/dataproc/v1/session_controller/rest/client.rb +859 -0
  9. data/lib/google/cloud/dataproc/v1/session_controller/rest/operations.rb +922 -0
  10. data/lib/google/cloud/dataproc/v1/session_controller/rest/service_stub.rb +366 -0
  11. data/lib/google/cloud/dataproc/v1/session_controller/rest.rb +54 -0
  12. data/lib/google/cloud/dataproc/v1/session_controller.rb +56 -0
  13. data/lib/google/cloud/dataproc/v1/session_template_controller/client.rb +822 -0
  14. data/lib/google/cloud/dataproc/v1/session_template_controller/credentials.rb +51 -0
  15. data/lib/google/cloud/dataproc/v1/session_template_controller/paths.rb +88 -0
  16. data/lib/google/cloud/dataproc/v1/session_template_controller/rest/client.rb +769 -0
  17. data/lib/google/cloud/dataproc/v1/session_template_controller/rest/service_stub.rb +366 -0
  18. data/lib/google/cloud/dataproc/v1/session_template_controller/rest.rb +53 -0
  19. data/lib/google/cloud/dataproc/v1/session_template_controller.rb +55 -0
  20. data/lib/google/cloud/dataproc/v1/session_templates_pb.rb +60 -0
  21. data/lib/google/cloud/dataproc/v1/session_templates_services_pb.rb +53 -0
  22. data/lib/google/cloud/dataproc/v1/sessions_pb.rb +62 -0
  23. data/lib/google/cloud/dataproc/v1/sessions_services_pb.rb +54 -0
  24. data/lib/google/cloud/dataproc/v1/shared_pb.rb +3 -1
  25. data/lib/google/cloud/dataproc/v1/version.rb +1 -1
  26. data/lib/google/cloud/dataproc/v1.rb +2 -0
  27. data/proto_docs/google/cloud/dataproc/v1/operations.rb +54 -0
  28. data/proto_docs/google/cloud/dataproc/v1/session_templates.rb +153 -0
  29. data/proto_docs/google/cloud/dataproc/v1/sessions.rb +295 -0
  30. data/proto_docs/google/cloud/dataproc/v1/shared.rb +86 -17
  31. metadata +24 -2
@@ -0,0 +1,859 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2024 Google LLC
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # https://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ # Auto-generated by gapic-generator-ruby. DO NOT EDIT!
18
+
19
+ require "google/cloud/errors"
20
+ require "google/cloud/dataproc/v1/sessions_pb"
21
+ require "google/cloud/dataproc/v1/session_controller/rest/service_stub"
22
+ require "google/iam/v1/rest"
23
+
24
+ module Google
25
+ module Cloud
26
+ module Dataproc
27
+ module V1
28
+ module SessionController
29
+ module Rest
30
+ ##
31
+ # REST client for the SessionController service.
32
+ #
33
+ # The `SessionController` provides methods to manage interactive sessions.
34
+ #
35
+ class Client
36
+ # @private
37
+ DEFAULT_ENDPOINT_TEMPLATE = "dataproc.$UNIVERSE_DOMAIN$"
38
+
39
+ include Paths
40
+
41
+ # @private
42
+ attr_reader :session_controller_stub
43
+
44
+ ##
45
+ # Configure the SessionController Client class.
46
+ #
47
+ # See {::Google::Cloud::Dataproc::V1::SessionController::Rest::Client::Configuration}
48
+ # for a description of the configuration fields.
49
+ #
50
+ # @example
51
+ #
52
+ # # Modify the configuration for all SessionController clients
53
+ # ::Google::Cloud::Dataproc::V1::SessionController::Rest::Client.configure do |config|
54
+ # config.timeout = 10.0
55
+ # end
56
+ #
57
+ # @yield [config] Configure the Client client.
58
+ # @yieldparam config [Client::Configuration]
59
+ #
60
+ # @return [Client::Configuration]
61
+ #
62
+ def self.configure
63
+ @configure ||= begin
64
+ namespace = ["Google", "Cloud", "Dataproc", "V1"]
65
+ parent_config = while namespace.any?
66
+ parent_name = namespace.join "::"
67
+ parent_const = const_get parent_name
68
+ break parent_const.configure if parent_const.respond_to? :configure
69
+ namespace.pop
70
+ end
71
+ default_config = Client::Configuration.new parent_config
72
+
73
+ default_config
74
+ end
75
+ yield @configure if block_given?
76
+ @configure
77
+ end
78
+
79
+ ##
80
+ # Configure the SessionController Client instance.
81
+ #
82
+ # The configuration is set to the derived mode, meaning that values can be changed,
83
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
84
+ # should be made on {Client.configure}.
85
+ #
86
+ # See {::Google::Cloud::Dataproc::V1::SessionController::Rest::Client::Configuration}
87
+ # for a description of the configuration fields.
88
+ #
89
+ # @yield [config] Configure the Client client.
90
+ # @yieldparam config [Client::Configuration]
91
+ #
92
+ # @return [Client::Configuration]
93
+ #
94
+ def configure
95
+ yield @config if block_given?
96
+ @config
97
+ end
98
+
99
+ ##
100
+ # The effective universe domain
101
+ #
102
+ # @return [String]
103
+ #
104
+ def universe_domain
105
+ @session_controller_stub.universe_domain
106
+ end
107
+
108
+ ##
109
+ # Create a new SessionController REST client object.
110
+ #
111
+ # @example
112
+ #
113
+ # # Create a client using the default configuration
114
+ # client = ::Google::Cloud::Dataproc::V1::SessionController::Rest::Client.new
115
+ #
116
+ # # Create a client using a custom configuration
117
+ # client = ::Google::Cloud::Dataproc::V1::SessionController::Rest::Client.new do |config|
118
+ # config.timeout = 10.0
119
+ # end
120
+ #
121
+ # @yield [config] Configure the SessionController client.
122
+ # @yieldparam config [Client::Configuration]
123
+ #
124
+ def initialize
125
+ # Create the configuration object
126
+ @config = Configuration.new Client.configure
127
+
128
+ # Yield the configuration if needed
129
+ yield @config if block_given?
130
+
131
+ # Create credentials
132
+ credentials = @config.credentials
133
+ # Use self-signed JWT if the endpoint is unchanged from default,
134
+ # but only if the default endpoint does not have a region prefix.
135
+ enable_self_signed_jwt = @config.endpoint.nil? ||
136
+ (@config.endpoint == Configuration::DEFAULT_ENDPOINT &&
137
+ !@config.endpoint.split(".").first.include?("-"))
138
+ credentials ||= Credentials.default scope: @config.scope,
139
+ enable_self_signed_jwt: enable_self_signed_jwt
140
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
141
+ credentials = Credentials.new credentials, scope: @config.scope
142
+ end
143
+
144
+ @quota_project_id = @config.quota_project
145
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
146
+
147
+ @operations_client = ::Google::Cloud::Dataproc::V1::SessionController::Rest::Operations.new do |config|
148
+ config.credentials = credentials
149
+ config.quota_project = @quota_project_id
150
+ config.endpoint = @config.endpoint
151
+ config.universe_domain = @config.universe_domain
152
+ end
153
+
154
+ @session_controller_stub = ::Google::Cloud::Dataproc::V1::SessionController::Rest::ServiceStub.new(
155
+ endpoint: @config.endpoint,
156
+ endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
157
+ universe_domain: @config.universe_domain,
158
+ credentials: credentials
159
+ )
160
+
161
+ @iam_policy_client = Google::Iam::V1::IAMPolicy::Rest::Client.new do |config|
162
+ config.credentials = credentials
163
+ config.quota_project = @quota_project_id
164
+ config.endpoint = @session_controller_stub.endpoint
165
+ config.universe_domain = @session_controller_stub.universe_domain
166
+ config.bindings_override = @config.bindings_override
167
+ end
168
+ end
169
+
170
+ ##
171
+ # Get the associated client for long-running operations.
172
+ #
173
+ # @return [::Google::Cloud::Dataproc::V1::SessionController::Rest::Operations]
174
+ #
175
+ attr_reader :operations_client
176
+
177
+ ##
178
+ # Get the associated client for mix-in of the IAMPolicy.
179
+ #
180
+ # @return [Google::Iam::V1::IAMPolicy::Rest::Client]
181
+ #
182
+ attr_reader :iam_policy_client
183
+
184
+ # Service calls
185
+
186
+ ##
187
+ # Create an interactive session asynchronously.
188
+ #
189
+ # @overload create_session(request, options = nil)
190
+ # Pass arguments to `create_session` via a request object, either of type
191
+ # {::Google::Cloud::Dataproc::V1::CreateSessionRequest} or an equivalent Hash.
192
+ #
193
+ # @param request [::Google::Cloud::Dataproc::V1::CreateSessionRequest, ::Hash]
194
+ # A request object representing the call parameters. Required. To specify no
195
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
196
+ # @param options [::Gapic::CallOptions, ::Hash]
197
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
198
+ #
199
+ # @overload create_session(parent: nil, session: nil, session_id: nil, request_id: nil)
200
+ # Pass arguments to `create_session` via keyword arguments. Note that at
201
+ # least one keyword argument is required. To specify no parameters, or to keep all
202
+ # the default parameter values, pass an empty Hash as a request object (see above).
203
+ #
204
+ # @param parent [::String]
205
+ # Required. The parent resource where this session will be created.
206
+ # @param session [::Google::Cloud::Dataproc::V1::Session, ::Hash]
207
+ # Required. The interactive session to create.
208
+ # @param session_id [::String]
209
+ # Required. The ID to use for the session, which becomes the final component
210
+ # of the session's resource name.
211
+ #
212
+ # This value must be 4-63 characters. Valid characters
213
+ # are /[a-z][0-9]-/.
214
+ # @param request_id [::String]
215
+ # Optional. A unique ID used to identify the request. If the service
216
+ # receives two
217
+ # [CreateSessionRequests](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.CreateSessionRequest)s
218
+ # with the same ID, the second request is ignored, and the
219
+ # first {::Google::Cloud::Dataproc::V1::Session Session} is created and stored in
220
+ # the backend.
221
+ #
222
+ # Recommendation: Set this value to a
223
+ # [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier).
224
+ #
225
+ # The value must contain only letters (a-z, A-Z), numbers (0-9),
226
+ # underscores (_), and hyphens (-). The maximum length is 40 characters.
227
+ # @yield [result, operation] Access the result along with the TransportOperation object
228
+ # @yieldparam result [::Gapic::Operation]
229
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
230
+ #
231
+ # @return [::Gapic::Operation]
232
+ #
233
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
234
+ #
235
+ # @example Basic example
236
+ # require "google/cloud/dataproc/v1"
237
+ #
238
+ # # Create a client object. The client can be reused for multiple calls.
239
+ # client = Google::Cloud::Dataproc::V1::SessionController::Rest::Client.new
240
+ #
241
+ # # Create a request. To set request fields, pass in keyword arguments.
242
+ # request = Google::Cloud::Dataproc::V1::CreateSessionRequest.new
243
+ #
244
+ # # Call the create_session method.
245
+ # result = client.create_session request
246
+ #
247
+ # # The returned object is of type Gapic::Operation. You can use it to
248
+ # # check the status of an operation, cancel it, or wait for results.
249
+ # # Here is how to wait for a response.
250
+ # result.wait_until_done! timeout: 60
251
+ # if result.response?
252
+ # p result.response
253
+ # else
254
+ # puts "No response received."
255
+ # end
256
+ #
257
+ def create_session request, options = nil
258
+ raise ::ArgumentError, "request must be provided" if request.nil?
259
+
260
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dataproc::V1::CreateSessionRequest
261
+
262
+ # Converts hash and nil to an options object
263
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
264
+
265
+ # Customize the options with defaults
266
+ call_metadata = @config.rpcs.create_session.metadata.to_h
267
+
268
+ # Set x-goog-api-client and x-goog-user-project headers
269
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
270
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
271
+ gapic_version: ::Google::Cloud::Dataproc::V1::VERSION,
272
+ transports_version_send: [:rest]
273
+
274
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
275
+
276
+ options.apply_defaults timeout: @config.rpcs.create_session.timeout,
277
+ metadata: call_metadata,
278
+ retry_policy: @config.rpcs.create_session.retry_policy
279
+
280
+ options.apply_defaults timeout: @config.timeout,
281
+ metadata: @config.metadata,
282
+ retry_policy: @config.retry_policy
283
+
284
+ @session_controller_stub.create_session request, options do |result, operation|
285
+ result = ::Gapic::Operation.new result, @operations_client, options: options
286
+ yield result, operation if block_given?
287
+ return result
288
+ end
289
+ rescue ::Gapic::Rest::Error => e
290
+ raise ::Google::Cloud::Error.from_error(e)
291
+ end
292
+
293
+ ##
294
+ # Gets the resource representation for an interactive session.
295
+ #
296
+ # @overload get_session(request, options = nil)
297
+ # Pass arguments to `get_session` via a request object, either of type
298
+ # {::Google::Cloud::Dataproc::V1::GetSessionRequest} or an equivalent Hash.
299
+ #
300
+ # @param request [::Google::Cloud::Dataproc::V1::GetSessionRequest, ::Hash]
301
+ # A request object representing the call parameters. Required. To specify no
302
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
303
+ # @param options [::Gapic::CallOptions, ::Hash]
304
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
305
+ #
306
+ # @overload get_session(name: nil)
307
+ # Pass arguments to `get_session` via keyword arguments. Note that at
308
+ # least one keyword argument is required. To specify no parameters, or to keep all
309
+ # the default parameter values, pass an empty Hash as a request object (see above).
310
+ #
311
+ # @param name [::String]
312
+ # Required. The name of the session to retrieve.
313
+ # @yield [result, operation] Access the result along with the TransportOperation object
314
+ # @yieldparam result [::Google::Cloud::Dataproc::V1::Session]
315
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
316
+ #
317
+ # @return [::Google::Cloud::Dataproc::V1::Session]
318
+ #
319
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
320
+ #
321
+ # @example Basic example
322
+ # require "google/cloud/dataproc/v1"
323
+ #
324
+ # # Create a client object. The client can be reused for multiple calls.
325
+ # client = Google::Cloud::Dataproc::V1::SessionController::Rest::Client.new
326
+ #
327
+ # # Create a request. To set request fields, pass in keyword arguments.
328
+ # request = Google::Cloud::Dataproc::V1::GetSessionRequest.new
329
+ #
330
+ # # Call the get_session method.
331
+ # result = client.get_session request
332
+ #
333
+ # # The returned object is of type Google::Cloud::Dataproc::V1::Session.
334
+ # p result
335
+ #
336
+ def get_session request, options = nil
337
+ raise ::ArgumentError, "request must be provided" if request.nil?
338
+
339
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dataproc::V1::GetSessionRequest
340
+
341
+ # Converts hash and nil to an options object
342
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
343
+
344
+ # Customize the options with defaults
345
+ call_metadata = @config.rpcs.get_session.metadata.to_h
346
+
347
+ # Set x-goog-api-client and x-goog-user-project headers
348
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
349
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
350
+ gapic_version: ::Google::Cloud::Dataproc::V1::VERSION,
351
+ transports_version_send: [:rest]
352
+
353
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
354
+
355
+ options.apply_defaults timeout: @config.rpcs.get_session.timeout,
356
+ metadata: call_metadata,
357
+ retry_policy: @config.rpcs.get_session.retry_policy
358
+
359
+ options.apply_defaults timeout: @config.timeout,
360
+ metadata: @config.metadata,
361
+ retry_policy: @config.retry_policy
362
+
363
+ @session_controller_stub.get_session request, options do |result, operation|
364
+ yield result, operation if block_given?
365
+ return result
366
+ end
367
+ rescue ::Gapic::Rest::Error => e
368
+ raise ::Google::Cloud::Error.from_error(e)
369
+ end
370
+
371
+ ##
372
+ # Lists interactive sessions.
373
+ #
374
+ # @overload list_sessions(request, options = nil)
375
+ # Pass arguments to `list_sessions` via a request object, either of type
376
+ # {::Google::Cloud::Dataproc::V1::ListSessionsRequest} or an equivalent Hash.
377
+ #
378
+ # @param request [::Google::Cloud::Dataproc::V1::ListSessionsRequest, ::Hash]
379
+ # A request object representing the call parameters. Required. To specify no
380
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
381
+ # @param options [::Gapic::CallOptions, ::Hash]
382
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
383
+ #
384
+ # @overload list_sessions(parent: nil, page_size: nil, page_token: nil, filter: nil)
385
+ # Pass arguments to `list_sessions` via keyword arguments. Note that at
386
+ # least one keyword argument is required. To specify no parameters, or to keep all
387
+ # the default parameter values, pass an empty Hash as a request object (see above).
388
+ #
389
+ # @param parent [::String]
390
+ # Required. The parent, which owns this collection of sessions.
391
+ # @param page_size [::Integer]
392
+ # Optional. The maximum number of sessions to return in each response.
393
+ # The service may return fewer than this value.
394
+ # @param page_token [::String]
395
+ # Optional. A page token received from a previous `ListSessions` call.
396
+ # Provide this token to retrieve the subsequent page.
397
+ # @param filter [::String]
398
+ # Optional. A filter for the sessions to return in the response.
399
+ #
400
+ # A filter is a logical expression constraining the values of various fields
401
+ # in each session resource. Filters are case sensitive, and may contain
402
+ # multiple clauses combined with logical operators (AND, OR).
403
+ # Supported fields are `session_id`, `session_uuid`, `state`, and
404
+ # `create_time`.
405
+ #
406
+ # Example: `state = ACTIVE and create_time < "2023-01-01T00:00:00Z"`
407
+ # is a filter for sessions in an ACTIVE state that were created before
408
+ # 2023-01-01.
409
+ #
410
+ # See https://google.aip.dev/assets/misc/ebnf-filtering.txt for a detailed
411
+ # description of the filter syntax and a list of supported comparators.
412
+ # @yield [result, operation] Access the result along with the TransportOperation object
413
+ # @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Dataproc::V1::Session>]
414
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
415
+ #
416
+ # @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Dataproc::V1::Session>]
417
+ #
418
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
419
+ #
420
+ # @example Basic example
421
+ # require "google/cloud/dataproc/v1"
422
+ #
423
+ # # Create a client object. The client can be reused for multiple calls.
424
+ # client = Google::Cloud::Dataproc::V1::SessionController::Rest::Client.new
425
+ #
426
+ # # Create a request. To set request fields, pass in keyword arguments.
427
+ # request = Google::Cloud::Dataproc::V1::ListSessionsRequest.new
428
+ #
429
+ # # Call the list_sessions method.
430
+ # result = client.list_sessions request
431
+ #
432
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
433
+ # # over elements, and API calls will be issued to fetch pages as needed.
434
+ # result.each do |item|
435
+ # # Each element is of type ::Google::Cloud::Dataproc::V1::Session.
436
+ # p item
437
+ # end
438
+ #
439
+ def list_sessions request, options = nil
440
+ raise ::ArgumentError, "request must be provided" if request.nil?
441
+
442
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dataproc::V1::ListSessionsRequest
443
+
444
+ # Converts hash and nil to an options object
445
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
446
+
447
+ # Customize the options with defaults
448
+ call_metadata = @config.rpcs.list_sessions.metadata.to_h
449
+
450
+ # Set x-goog-api-client and x-goog-user-project headers
451
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
452
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
453
+ gapic_version: ::Google::Cloud::Dataproc::V1::VERSION,
454
+ transports_version_send: [:rest]
455
+
456
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
457
+
458
+ options.apply_defaults timeout: @config.rpcs.list_sessions.timeout,
459
+ metadata: call_metadata,
460
+ retry_policy: @config.rpcs.list_sessions.retry_policy
461
+
462
+ options.apply_defaults timeout: @config.timeout,
463
+ metadata: @config.metadata,
464
+ retry_policy: @config.retry_policy
465
+
466
+ @session_controller_stub.list_sessions request, options do |result, operation|
467
+ result = ::Gapic::Rest::PagedEnumerable.new @session_controller_stub, :list_sessions, "sessions", request, result, options
468
+ yield result, operation if block_given?
469
+ return result
470
+ end
471
+ rescue ::Gapic::Rest::Error => e
472
+ raise ::Google::Cloud::Error.from_error(e)
473
+ end
474
+
475
+ ##
476
+ # Terminates the interactive session.
477
+ #
478
+ # @overload terminate_session(request, options = nil)
479
+ # Pass arguments to `terminate_session` via a request object, either of type
480
+ # {::Google::Cloud::Dataproc::V1::TerminateSessionRequest} or an equivalent Hash.
481
+ #
482
+ # @param request [::Google::Cloud::Dataproc::V1::TerminateSessionRequest, ::Hash]
483
+ # A request object representing the call parameters. Required. To specify no
484
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
485
+ # @param options [::Gapic::CallOptions, ::Hash]
486
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
487
+ #
488
+ # @overload terminate_session(name: nil, request_id: nil)
489
+ # Pass arguments to `terminate_session` via keyword arguments. Note that at
490
+ # least one keyword argument is required. To specify no parameters, or to keep all
491
+ # the default parameter values, pass an empty Hash as a request object (see above).
492
+ #
493
+ # @param name [::String]
494
+ # Required. The name of the session resource to terminate.
495
+ # @param request_id [::String]
496
+ # Optional. A unique ID used to identify the request. If the service
497
+ # receives two
498
+ # [TerminateSessionRequest](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.TerminateSessionRequest)s
499
+ # with the same ID, the second request is ignored.
500
+ #
501
+ # Recommendation: Set this value to a
502
+ # [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier).
503
+ #
504
+ # The value must contain only letters (a-z, A-Z), numbers (0-9),
505
+ # underscores (_), and hyphens (-). The maximum length is 40 characters.
506
+ # @yield [result, operation] Access the result along with the TransportOperation object
507
+ # @yieldparam result [::Gapic::Operation]
508
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
509
+ #
510
+ # @return [::Gapic::Operation]
511
+ #
512
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
513
+ #
514
+ # @example Basic example
515
+ # require "google/cloud/dataproc/v1"
516
+ #
517
+ # # Create a client object. The client can be reused for multiple calls.
518
+ # client = Google::Cloud::Dataproc::V1::SessionController::Rest::Client.new
519
+ #
520
+ # # Create a request. To set request fields, pass in keyword arguments.
521
+ # request = Google::Cloud::Dataproc::V1::TerminateSessionRequest.new
522
+ #
523
+ # # Call the terminate_session method.
524
+ # result = client.terminate_session request
525
+ #
526
+ # # The returned object is of type Gapic::Operation. You can use it to
527
+ # # check the status of an operation, cancel it, or wait for results.
528
+ # # Here is how to wait for a response.
529
+ # result.wait_until_done! timeout: 60
530
+ # if result.response?
531
+ # p result.response
532
+ # else
533
+ # puts "No response received."
534
+ # end
535
+ #
536
+ def terminate_session request, options = nil
537
+ raise ::ArgumentError, "request must be provided" if request.nil?
538
+
539
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dataproc::V1::TerminateSessionRequest
540
+
541
+ # Converts hash and nil to an options object
542
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
543
+
544
+ # Customize the options with defaults
545
+ call_metadata = @config.rpcs.terminate_session.metadata.to_h
546
+
547
+ # Set x-goog-api-client and x-goog-user-project headers
548
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
549
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
550
+ gapic_version: ::Google::Cloud::Dataproc::V1::VERSION,
551
+ transports_version_send: [:rest]
552
+
553
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
554
+
555
+ options.apply_defaults timeout: @config.rpcs.terminate_session.timeout,
556
+ metadata: call_metadata,
557
+ retry_policy: @config.rpcs.terminate_session.retry_policy
558
+
559
+ options.apply_defaults timeout: @config.timeout,
560
+ metadata: @config.metadata,
561
+ retry_policy: @config.retry_policy
562
+
563
+ @session_controller_stub.terminate_session request, options do |result, operation|
564
+ result = ::Gapic::Operation.new result, @operations_client, options: options
565
+ yield result, operation if block_given?
566
+ return result
567
+ end
568
+ rescue ::Gapic::Rest::Error => e
569
+ raise ::Google::Cloud::Error.from_error(e)
570
+ end
571
+
572
+ ##
573
+ # Deletes the interactive session resource. If the session is not in terminal
574
+ # state, it is terminated, and then deleted.
575
+ #
576
+ # @overload delete_session(request, options = nil)
577
+ # Pass arguments to `delete_session` via a request object, either of type
578
+ # {::Google::Cloud::Dataproc::V1::DeleteSessionRequest} or an equivalent Hash.
579
+ #
580
+ # @param request [::Google::Cloud::Dataproc::V1::DeleteSessionRequest, ::Hash]
581
+ # A request object representing the call parameters. Required. To specify no
582
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
583
+ # @param options [::Gapic::CallOptions, ::Hash]
584
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
585
+ #
586
+ # @overload delete_session(name: nil, request_id: nil)
587
+ # Pass arguments to `delete_session` via keyword arguments. Note that at
588
+ # least one keyword argument is required. To specify no parameters, or to keep all
589
+ # the default parameter values, pass an empty Hash as a request object (see above).
590
+ #
591
+ # @param name [::String]
592
+ # Required. The name of the session resource to delete.
593
+ # @param request_id [::String]
594
+ # Optional. A unique ID used to identify the request. If the service
595
+ # receives two
596
+ # [DeleteSessionRequest](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.DeleteSessionRequest)s
597
+ # with the same ID, the second request is ignored.
598
+ #
599
+ # Recommendation: Set this value to a
600
+ # [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier).
601
+ #
602
+ # The value must contain only letters (a-z, A-Z), numbers (0-9),
603
+ # underscores (_), and hyphens (-). The maximum length is 40 characters.
604
+ # @yield [result, operation] Access the result along with the TransportOperation object
605
+ # @yieldparam result [::Gapic::Operation]
606
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
607
+ #
608
+ # @return [::Gapic::Operation]
609
+ #
610
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
611
+ #
612
+ # @example Basic example
613
+ # require "google/cloud/dataproc/v1"
614
+ #
615
+ # # Create a client object. The client can be reused for multiple calls.
616
+ # client = Google::Cloud::Dataproc::V1::SessionController::Rest::Client.new
617
+ #
618
+ # # Create a request. To set request fields, pass in keyword arguments.
619
+ # request = Google::Cloud::Dataproc::V1::DeleteSessionRequest.new
620
+ #
621
+ # # Call the delete_session method.
622
+ # result = client.delete_session request
623
+ #
624
+ # # The returned object is of type Gapic::Operation. You can use it to
625
+ # # check the status of an operation, cancel it, or wait for results.
626
+ # # Here is how to wait for a response.
627
+ # result.wait_until_done! timeout: 60
628
+ # if result.response?
629
+ # p result.response
630
+ # else
631
+ # puts "No response received."
632
+ # end
633
+ #
634
+ def delete_session request, options = nil
635
+ raise ::ArgumentError, "request must be provided" if request.nil?
636
+
637
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dataproc::V1::DeleteSessionRequest
638
+
639
+ # Converts hash and nil to an options object
640
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
641
+
642
+ # Customize the options with defaults
643
+ call_metadata = @config.rpcs.delete_session.metadata.to_h
644
+
645
+ # Set x-goog-api-client and x-goog-user-project headers
646
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
647
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
648
+ gapic_version: ::Google::Cloud::Dataproc::V1::VERSION,
649
+ transports_version_send: [:rest]
650
+
651
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
652
+
653
+ options.apply_defaults timeout: @config.rpcs.delete_session.timeout,
654
+ metadata: call_metadata,
655
+ retry_policy: @config.rpcs.delete_session.retry_policy
656
+
657
+ options.apply_defaults timeout: @config.timeout,
658
+ metadata: @config.metadata,
659
+ retry_policy: @config.retry_policy
660
+
661
+ @session_controller_stub.delete_session request, options do |result, operation|
662
+ result = ::Gapic::Operation.new result, @operations_client, options: options
663
+ yield result, operation if block_given?
664
+ return result
665
+ end
666
+ rescue ::Gapic::Rest::Error => e
667
+ raise ::Google::Cloud::Error.from_error(e)
668
+ end
669
+
670
+ ##
671
+ # Configuration class for the SessionController REST API.
672
+ #
673
+ # This class represents the configuration for SessionController REST,
674
+ # providing control over timeouts, retry behavior, logging, transport
675
+ # parameters, and other low-level controls. Certain parameters can also be
676
+ # applied individually to specific RPCs. See
677
+ # {::Google::Cloud::Dataproc::V1::SessionController::Rest::Client::Configuration::Rpcs}
678
+ # for a list of RPCs that can be configured independently.
679
+ #
680
+ # Configuration can be applied globally to all clients, or to a single client
681
+ # on construction.
682
+ #
683
+ # @example
684
+ #
685
+ # # Modify the global config, setting the timeout for
686
+ # # create_session to 20 seconds,
687
+ # # and all remaining timeouts to 10 seconds.
688
+ # ::Google::Cloud::Dataproc::V1::SessionController::Rest::Client.configure do |config|
689
+ # config.timeout = 10.0
690
+ # config.rpcs.create_session.timeout = 20.0
691
+ # end
692
+ #
693
+ # # Apply the above configuration only to a new client.
694
+ # client = ::Google::Cloud::Dataproc::V1::SessionController::Rest::Client.new do |config|
695
+ # config.timeout = 10.0
696
+ # config.rpcs.create_session.timeout = 20.0
697
+ # end
698
+ #
699
+ # @!attribute [rw] endpoint
700
+ # A custom service endpoint, as a hostname or hostname:port. The default is
701
+ # nil, indicating to use the default endpoint in the current universe domain.
702
+ # @return [::String,nil]
703
+ # @!attribute [rw] credentials
704
+ # Credentials to send with calls. You may provide any of the following types:
705
+ # * (`String`) The path to a service account key file in JSON format
706
+ # * (`Hash`) A service account key as a Hash
707
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
708
+ # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
709
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
710
+ # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
711
+ # * (`nil`) indicating no credentials
712
+ # @return [::Object]
713
+ # @!attribute [rw] scope
714
+ # The OAuth scopes
715
+ # @return [::Array<::String>]
716
+ # @!attribute [rw] lib_name
717
+ # The library name as recorded in instrumentation and logging
718
+ # @return [::String]
719
+ # @!attribute [rw] lib_version
720
+ # The library version as recorded in instrumentation and logging
721
+ # @return [::String]
722
+ # @!attribute [rw] timeout
723
+ # The call timeout in seconds.
724
+ # @return [::Numeric]
725
+ # @!attribute [rw] metadata
726
+ # Additional headers to be sent with the call.
727
+ # @return [::Hash{::Symbol=>::String}]
728
+ # @!attribute [rw] retry_policy
729
+ # The retry policy. The value is a hash with the following keys:
730
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
731
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
732
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
733
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
734
+ # trigger a retry.
735
+ # @return [::Hash]
736
+ # @!attribute [rw] quota_project
737
+ # A separate project against which to charge quota.
738
+ # @return [::String]
739
+ # @!attribute [rw] universe_domain
740
+ # The universe domain within which to make requests. This determines the
741
+ # default endpoint URL. The default value of nil uses the environment
742
+ # universe (usually the default "googleapis.com" universe).
743
+ # @return [::String,nil]
744
+ #
745
+ class Configuration
746
+ extend ::Gapic::Config
747
+
748
+ # @private
749
+ # The endpoint specific to the default "googleapis.com" universe. Deprecated.
750
+ DEFAULT_ENDPOINT = "dataproc.googleapis.com"
751
+
752
+ config_attr :endpoint, nil, ::String, nil
753
+ config_attr :credentials, nil do |value|
754
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
755
+ allowed.any? { |klass| klass === value }
756
+ end
757
+ config_attr :scope, nil, ::String, ::Array, nil
758
+ config_attr :lib_name, nil, ::String, nil
759
+ config_attr :lib_version, nil, ::String, nil
760
+ config_attr :timeout, nil, ::Numeric, nil
761
+ config_attr :metadata, nil, ::Hash, nil
762
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
763
+ config_attr :quota_project, nil, ::String, nil
764
+ config_attr :universe_domain, nil, ::String, nil
765
+
766
+ # @private
767
+ # Overrides for http bindings for the RPCs of this service
768
+ # are only used when this service is used as mixin, and only
769
+ # by the host service.
770
+ # @return [::Hash{::Symbol=>::Array<::Gapic::Rest::GrpcTranscoder::HttpBinding>}]
771
+ config_attr :bindings_override, {}, ::Hash, nil
772
+
773
+ # @private
774
+ def initialize parent_config = nil
775
+ @parent_config = parent_config unless parent_config.nil?
776
+
777
+ yield self if block_given?
778
+ end
779
+
780
+ ##
781
+ # Configurations for individual RPCs
782
+ # @return [Rpcs]
783
+ #
784
+ def rpcs
785
+ @rpcs ||= begin
786
+ parent_rpcs = nil
787
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
788
+ Rpcs.new parent_rpcs
789
+ end
790
+ end
791
+
792
+ ##
793
+ # Configuration RPC class for the SessionController API.
794
+ #
795
+ # Includes fields providing the configuration for each RPC in this service.
796
+ # Each configuration object is of type `Gapic::Config::Method` and includes
797
+ # the following configuration fields:
798
+ #
799
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
800
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers
801
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
802
+ # include the following keys:
803
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
804
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
805
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
806
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
807
+ # trigger a retry.
808
+ #
809
+ class Rpcs
810
+ ##
811
+ # RPC-specific configuration for `create_session`
812
+ # @return [::Gapic::Config::Method]
813
+ #
814
+ attr_reader :create_session
815
+ ##
816
+ # RPC-specific configuration for `get_session`
817
+ # @return [::Gapic::Config::Method]
818
+ #
819
+ attr_reader :get_session
820
+ ##
821
+ # RPC-specific configuration for `list_sessions`
822
+ # @return [::Gapic::Config::Method]
823
+ #
824
+ attr_reader :list_sessions
825
+ ##
826
+ # RPC-specific configuration for `terminate_session`
827
+ # @return [::Gapic::Config::Method]
828
+ #
829
+ attr_reader :terminate_session
830
+ ##
831
+ # RPC-specific configuration for `delete_session`
832
+ # @return [::Gapic::Config::Method]
833
+ #
834
+ attr_reader :delete_session
835
+
836
+ # @private
837
+ def initialize parent_rpcs = nil
838
+ create_session_config = parent_rpcs.create_session if parent_rpcs.respond_to? :create_session
839
+ @create_session = ::Gapic::Config::Method.new create_session_config
840
+ get_session_config = parent_rpcs.get_session if parent_rpcs.respond_to? :get_session
841
+ @get_session = ::Gapic::Config::Method.new get_session_config
842
+ list_sessions_config = parent_rpcs.list_sessions if parent_rpcs.respond_to? :list_sessions
843
+ @list_sessions = ::Gapic::Config::Method.new list_sessions_config
844
+ terminate_session_config = parent_rpcs.terminate_session if parent_rpcs.respond_to? :terminate_session
845
+ @terminate_session = ::Gapic::Config::Method.new terminate_session_config
846
+ delete_session_config = parent_rpcs.delete_session if parent_rpcs.respond_to? :delete_session
847
+ @delete_session = ::Gapic::Config::Method.new delete_session_config
848
+
849
+ yield self if block_given?
850
+ end
851
+ end
852
+ end
853
+ end
854
+ end
855
+ end
856
+ end
857
+ end
858
+ end
859
+ end