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