google-cloud-dataproc-v1 0.23.1 → 0.24.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 (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,822 @@
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/session_templates_pb"
21
+ require "google/iam/v1"
22
+
23
+ module Google
24
+ module Cloud
25
+ module Dataproc
26
+ module V1
27
+ module SessionTemplateController
28
+ ##
29
+ # Client for the SessionTemplateController service.
30
+ #
31
+ # The SessionTemplateController provides methods to manage session templates.
32
+ #
33
+ class Client
34
+ # @private
35
+ DEFAULT_ENDPOINT_TEMPLATE = "dataproc.$UNIVERSE_DOMAIN$"
36
+
37
+ include Paths
38
+
39
+ # @private
40
+ attr_reader :session_template_controller_stub
41
+
42
+ ##
43
+ # Configure the SessionTemplateController Client class.
44
+ #
45
+ # See {::Google::Cloud::Dataproc::V1::SessionTemplateController::Client::Configuration}
46
+ # for a description of the configuration fields.
47
+ #
48
+ # @example
49
+ #
50
+ # # Modify the configuration for all SessionTemplateController clients
51
+ # ::Google::Cloud::Dataproc::V1::SessionTemplateController::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 SessionTemplateController 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::SessionTemplateController::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_template_controller_stub.universe_domain
104
+ end
105
+
106
+ ##
107
+ # Create a new SessionTemplateController client object.
108
+ #
109
+ # @example
110
+ #
111
+ # # Create a client using the default configuration
112
+ # client = ::Google::Cloud::Dataproc::V1::SessionTemplateController::Client.new
113
+ #
114
+ # # Create a client using a custom configuration
115
+ # client = ::Google::Cloud::Dataproc::V1::SessionTemplateController::Client.new do |config|
116
+ # config.timeout = 10.0
117
+ # end
118
+ #
119
+ # @yield [config] Configure the SessionTemplateController 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/session_templates_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
+ @session_template_controller_stub = ::Gapic::ServiceStub.new(
151
+ ::Google::Cloud::Dataproc::V1::SessionTemplateController::Stub,
152
+ credentials: credentials,
153
+ endpoint: @config.endpoint,
154
+ endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
155
+ universe_domain: @config.universe_domain,
156
+ channel_args: @config.channel_args,
157
+ interceptors: @config.interceptors,
158
+ channel_pool_config: @config.channel_pool
159
+ )
160
+
161
+ @iam_policy_client = Google::Iam::V1::IAMPolicy::Client.new do |config|
162
+ config.credentials = credentials
163
+ config.quota_project = @quota_project_id
164
+ config.endpoint = @session_template_controller_stub.endpoint
165
+ config.universe_domain = @session_template_controller_stub.universe_domain
166
+ end
167
+ end
168
+
169
+ ##
170
+ # Get the associated client for mix-in of the IAMPolicy.
171
+ #
172
+ # @return [Google::Iam::V1::IAMPolicy::Client]
173
+ #
174
+ attr_reader :iam_policy_client
175
+
176
+ # Service calls
177
+
178
+ ##
179
+ # Create a session template synchronously.
180
+ #
181
+ # @overload create_session_template(request, options = nil)
182
+ # Pass arguments to `create_session_template` via a request object, either of type
183
+ # {::Google::Cloud::Dataproc::V1::CreateSessionTemplateRequest} or an equivalent Hash.
184
+ #
185
+ # @param request [::Google::Cloud::Dataproc::V1::CreateSessionTemplateRequest, ::Hash]
186
+ # A request object representing the call parameters. Required. To specify no
187
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
188
+ # @param options [::Gapic::CallOptions, ::Hash]
189
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
190
+ #
191
+ # @overload create_session_template(parent: nil, session_template: nil)
192
+ # Pass arguments to `create_session_template` via keyword arguments. Note that at
193
+ # least one keyword argument is required. To specify no parameters, or to keep all
194
+ # the default parameter values, pass an empty Hash as a request object (see above).
195
+ #
196
+ # @param parent [::String]
197
+ # Required. The parent resource where this session template will be created.
198
+ # @param session_template [::Google::Cloud::Dataproc::V1::SessionTemplate, ::Hash]
199
+ # Required. The session template to create.
200
+ #
201
+ # @yield [response, operation] Access the result along with the RPC operation
202
+ # @yieldparam response [::Google::Cloud::Dataproc::V1::SessionTemplate]
203
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
204
+ #
205
+ # @return [::Google::Cloud::Dataproc::V1::SessionTemplate]
206
+ #
207
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
208
+ #
209
+ # @example Basic example
210
+ # require "google/cloud/dataproc/v1"
211
+ #
212
+ # # Create a client object. The client can be reused for multiple calls.
213
+ # client = Google::Cloud::Dataproc::V1::SessionTemplateController::Client.new
214
+ #
215
+ # # Create a request. To set request fields, pass in keyword arguments.
216
+ # request = Google::Cloud::Dataproc::V1::CreateSessionTemplateRequest.new
217
+ #
218
+ # # Call the create_session_template method.
219
+ # result = client.create_session_template request
220
+ #
221
+ # # The returned object is of type Google::Cloud::Dataproc::V1::SessionTemplate.
222
+ # p result
223
+ #
224
+ def create_session_template request, options = nil
225
+ raise ::ArgumentError, "request must be provided" if request.nil?
226
+
227
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dataproc::V1::CreateSessionTemplateRequest
228
+
229
+ # Converts hash and nil to an options object
230
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
231
+
232
+ # Customize the options with defaults
233
+ metadata = @config.rpcs.create_session_template.metadata.to_h
234
+
235
+ # Set x-goog-api-client and x-goog-user-project headers
236
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
237
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
238
+ gapic_version: ::Google::Cloud::Dataproc::V1::VERSION
239
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
240
+
241
+ header_params = {}
242
+ if request.parent
243
+ header_params["parent"] = request.parent
244
+ end
245
+
246
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
247
+ metadata[:"x-goog-request-params"] ||= request_params_header
248
+
249
+ options.apply_defaults timeout: @config.rpcs.create_session_template.timeout,
250
+ metadata: metadata,
251
+ retry_policy: @config.rpcs.create_session_template.retry_policy
252
+
253
+ options.apply_defaults timeout: @config.timeout,
254
+ metadata: @config.metadata,
255
+ retry_policy: @config.retry_policy
256
+
257
+ @session_template_controller_stub.call_rpc :create_session_template, request, options: options do |response, operation|
258
+ yield response, operation if block_given?
259
+ return response
260
+ end
261
+ rescue ::GRPC::BadStatus => e
262
+ raise ::Google::Cloud::Error.from_error(e)
263
+ end
264
+
265
+ ##
266
+ # Updates the session template synchronously.
267
+ #
268
+ # @overload update_session_template(request, options = nil)
269
+ # Pass arguments to `update_session_template` via a request object, either of type
270
+ # {::Google::Cloud::Dataproc::V1::UpdateSessionTemplateRequest} or an equivalent Hash.
271
+ #
272
+ # @param request [::Google::Cloud::Dataproc::V1::UpdateSessionTemplateRequest, ::Hash]
273
+ # A request object representing the call parameters. Required. To specify no
274
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
275
+ # @param options [::Gapic::CallOptions, ::Hash]
276
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
277
+ #
278
+ # @overload update_session_template(session_template: nil)
279
+ # Pass arguments to `update_session_template` via keyword arguments. Note that at
280
+ # least one keyword argument is required. To specify no parameters, or to keep all
281
+ # the default parameter values, pass an empty Hash as a request object (see above).
282
+ #
283
+ # @param session_template [::Google::Cloud::Dataproc::V1::SessionTemplate, ::Hash]
284
+ # Required. The updated session template.
285
+ #
286
+ # @yield [response, operation] Access the result along with the RPC operation
287
+ # @yieldparam response [::Google::Cloud::Dataproc::V1::SessionTemplate]
288
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
289
+ #
290
+ # @return [::Google::Cloud::Dataproc::V1::SessionTemplate]
291
+ #
292
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
293
+ #
294
+ # @example Basic example
295
+ # require "google/cloud/dataproc/v1"
296
+ #
297
+ # # Create a client object. The client can be reused for multiple calls.
298
+ # client = Google::Cloud::Dataproc::V1::SessionTemplateController::Client.new
299
+ #
300
+ # # Create a request. To set request fields, pass in keyword arguments.
301
+ # request = Google::Cloud::Dataproc::V1::UpdateSessionTemplateRequest.new
302
+ #
303
+ # # Call the update_session_template method.
304
+ # result = client.update_session_template request
305
+ #
306
+ # # The returned object is of type Google::Cloud::Dataproc::V1::SessionTemplate.
307
+ # p result
308
+ #
309
+ def update_session_template request, options = nil
310
+ raise ::ArgumentError, "request must be provided" if request.nil?
311
+
312
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dataproc::V1::UpdateSessionTemplateRequest
313
+
314
+ # Converts hash and nil to an options object
315
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
316
+
317
+ # Customize the options with defaults
318
+ metadata = @config.rpcs.update_session_template.metadata.to_h
319
+
320
+ # Set x-goog-api-client and x-goog-user-project headers
321
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
322
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
323
+ gapic_version: ::Google::Cloud::Dataproc::V1::VERSION
324
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
325
+
326
+ header_params = {}
327
+ if request.session_template&.name
328
+ header_params["session_template.name"] = request.session_template.name
329
+ end
330
+
331
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
332
+ metadata[:"x-goog-request-params"] ||= request_params_header
333
+
334
+ options.apply_defaults timeout: @config.rpcs.update_session_template.timeout,
335
+ metadata: metadata,
336
+ retry_policy: @config.rpcs.update_session_template.retry_policy
337
+
338
+ options.apply_defaults timeout: @config.timeout,
339
+ metadata: @config.metadata,
340
+ retry_policy: @config.retry_policy
341
+
342
+ @session_template_controller_stub.call_rpc :update_session_template, request, options: options do |response, operation|
343
+ yield response, operation if block_given?
344
+ return response
345
+ end
346
+ rescue ::GRPC::BadStatus => e
347
+ raise ::Google::Cloud::Error.from_error(e)
348
+ end
349
+
350
+ ##
351
+ # Gets the resource representation for a session template.
352
+ #
353
+ # @overload get_session_template(request, options = nil)
354
+ # Pass arguments to `get_session_template` via a request object, either of type
355
+ # {::Google::Cloud::Dataproc::V1::GetSessionTemplateRequest} or an equivalent Hash.
356
+ #
357
+ # @param request [::Google::Cloud::Dataproc::V1::GetSessionTemplateRequest, ::Hash]
358
+ # A request object representing the call parameters. Required. To specify no
359
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
360
+ # @param options [::Gapic::CallOptions, ::Hash]
361
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
362
+ #
363
+ # @overload get_session_template(name: nil)
364
+ # Pass arguments to `get_session_template` via keyword arguments. Note that at
365
+ # least one keyword argument is required. To specify no parameters, or to keep all
366
+ # the default parameter values, pass an empty Hash as a request object (see above).
367
+ #
368
+ # @param name [::String]
369
+ # Required. The name of the session template to retrieve.
370
+ #
371
+ # @yield [response, operation] Access the result along with the RPC operation
372
+ # @yieldparam response [::Google::Cloud::Dataproc::V1::SessionTemplate]
373
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
374
+ #
375
+ # @return [::Google::Cloud::Dataproc::V1::SessionTemplate]
376
+ #
377
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
378
+ #
379
+ # @example Basic example
380
+ # require "google/cloud/dataproc/v1"
381
+ #
382
+ # # Create a client object. The client can be reused for multiple calls.
383
+ # client = Google::Cloud::Dataproc::V1::SessionTemplateController::Client.new
384
+ #
385
+ # # Create a request. To set request fields, pass in keyword arguments.
386
+ # request = Google::Cloud::Dataproc::V1::GetSessionTemplateRequest.new
387
+ #
388
+ # # Call the get_session_template method.
389
+ # result = client.get_session_template request
390
+ #
391
+ # # The returned object is of type Google::Cloud::Dataproc::V1::SessionTemplate.
392
+ # p result
393
+ #
394
+ def get_session_template request, options = nil
395
+ raise ::ArgumentError, "request must be provided" if request.nil?
396
+
397
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dataproc::V1::GetSessionTemplateRequest
398
+
399
+ # Converts hash and nil to an options object
400
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
401
+
402
+ # Customize the options with defaults
403
+ metadata = @config.rpcs.get_session_template.metadata.to_h
404
+
405
+ # Set x-goog-api-client and x-goog-user-project headers
406
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
407
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
408
+ gapic_version: ::Google::Cloud::Dataproc::V1::VERSION
409
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
410
+
411
+ header_params = {}
412
+ if request.name
413
+ header_params["name"] = request.name
414
+ end
415
+
416
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
417
+ metadata[:"x-goog-request-params"] ||= request_params_header
418
+
419
+ options.apply_defaults timeout: @config.rpcs.get_session_template.timeout,
420
+ metadata: metadata,
421
+ retry_policy: @config.rpcs.get_session_template.retry_policy
422
+
423
+ options.apply_defaults timeout: @config.timeout,
424
+ metadata: @config.metadata,
425
+ retry_policy: @config.retry_policy
426
+
427
+ @session_template_controller_stub.call_rpc :get_session_template, request, options: options do |response, operation|
428
+ yield response, operation if block_given?
429
+ return response
430
+ end
431
+ rescue ::GRPC::BadStatus => e
432
+ raise ::Google::Cloud::Error.from_error(e)
433
+ end
434
+
435
+ ##
436
+ # Lists session templates.
437
+ #
438
+ # @overload list_session_templates(request, options = nil)
439
+ # Pass arguments to `list_session_templates` via a request object, either of type
440
+ # {::Google::Cloud::Dataproc::V1::ListSessionTemplatesRequest} or an equivalent Hash.
441
+ #
442
+ # @param request [::Google::Cloud::Dataproc::V1::ListSessionTemplatesRequest, ::Hash]
443
+ # A request object representing the call parameters. Required. To specify no
444
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
445
+ # @param options [::Gapic::CallOptions, ::Hash]
446
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
447
+ #
448
+ # @overload list_session_templates(parent: nil, page_size: nil, page_token: nil, filter: nil)
449
+ # Pass arguments to `list_session_templates` via keyword arguments. Note that at
450
+ # least one keyword argument is required. To specify no parameters, or to keep all
451
+ # the default parameter values, pass an empty Hash as a request object (see above).
452
+ #
453
+ # @param parent [::String]
454
+ # Required. The parent that owns this collection of session templates.
455
+ # @param page_size [::Integer]
456
+ # Optional. The maximum number of sessions to return in each response.
457
+ # The service may return fewer than this value.
458
+ # @param page_token [::String]
459
+ # Optional. A page token received from a previous `ListSessions` call.
460
+ # Provide this token to retrieve the subsequent page.
461
+ # @param filter [::String]
462
+ # Optional. A filter for the session templates to return in the response.
463
+ # Filters are case sensitive and have the following syntax:
464
+ #
465
+ # [field = value] AND [field [= value]] ...
466
+ #
467
+ # @yield [response, operation] Access the result along with the RPC operation
468
+ # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::Dataproc::V1::SessionTemplate>]
469
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
470
+ #
471
+ # @return [::Gapic::PagedEnumerable<::Google::Cloud::Dataproc::V1::SessionTemplate>]
472
+ #
473
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
474
+ #
475
+ # @example Basic example
476
+ # require "google/cloud/dataproc/v1"
477
+ #
478
+ # # Create a client object. The client can be reused for multiple calls.
479
+ # client = Google::Cloud::Dataproc::V1::SessionTemplateController::Client.new
480
+ #
481
+ # # Create a request. To set request fields, pass in keyword arguments.
482
+ # request = Google::Cloud::Dataproc::V1::ListSessionTemplatesRequest.new
483
+ #
484
+ # # Call the list_session_templates method.
485
+ # result = client.list_session_templates request
486
+ #
487
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
488
+ # # over elements, and API calls will be issued to fetch pages as needed.
489
+ # result.each do |item|
490
+ # # Each element is of type ::Google::Cloud::Dataproc::V1::SessionTemplate.
491
+ # p item
492
+ # end
493
+ #
494
+ def list_session_templates request, options = nil
495
+ raise ::ArgumentError, "request must be provided" if request.nil?
496
+
497
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dataproc::V1::ListSessionTemplatesRequest
498
+
499
+ # Converts hash and nil to an options object
500
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
501
+
502
+ # Customize the options with defaults
503
+ metadata = @config.rpcs.list_session_templates.metadata.to_h
504
+
505
+ # Set x-goog-api-client and x-goog-user-project headers
506
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
507
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
508
+ gapic_version: ::Google::Cloud::Dataproc::V1::VERSION
509
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
510
+
511
+ header_params = {}
512
+ if request.parent
513
+ header_params["parent"] = request.parent
514
+ end
515
+
516
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
517
+ metadata[:"x-goog-request-params"] ||= request_params_header
518
+
519
+ options.apply_defaults timeout: @config.rpcs.list_session_templates.timeout,
520
+ metadata: metadata,
521
+ retry_policy: @config.rpcs.list_session_templates.retry_policy
522
+
523
+ options.apply_defaults timeout: @config.timeout,
524
+ metadata: @config.metadata,
525
+ retry_policy: @config.retry_policy
526
+
527
+ @session_template_controller_stub.call_rpc :list_session_templates, request, options: options do |response, operation|
528
+ response = ::Gapic::PagedEnumerable.new @session_template_controller_stub, :list_session_templates, request, response, operation, options
529
+ yield response, operation if block_given?
530
+ return response
531
+ end
532
+ rescue ::GRPC::BadStatus => e
533
+ raise ::Google::Cloud::Error.from_error(e)
534
+ end
535
+
536
+ ##
537
+ # Deletes a session template.
538
+ #
539
+ # @overload delete_session_template(request, options = nil)
540
+ # Pass arguments to `delete_session_template` via a request object, either of type
541
+ # {::Google::Cloud::Dataproc::V1::DeleteSessionTemplateRequest} or an equivalent Hash.
542
+ #
543
+ # @param request [::Google::Cloud::Dataproc::V1::DeleteSessionTemplateRequest, ::Hash]
544
+ # A request object representing the call parameters. Required. To specify no
545
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
546
+ # @param options [::Gapic::CallOptions, ::Hash]
547
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
548
+ #
549
+ # @overload delete_session_template(name: nil)
550
+ # Pass arguments to `delete_session_template` via keyword arguments. Note that at
551
+ # least one keyword argument is required. To specify no parameters, or to keep all
552
+ # the default parameter values, pass an empty Hash as a request object (see above).
553
+ #
554
+ # @param name [::String]
555
+ # Required. The name of the session template resource to delete.
556
+ #
557
+ # @yield [response, operation] Access the result along with the RPC operation
558
+ # @yieldparam response [::Google::Protobuf::Empty]
559
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
560
+ #
561
+ # @return [::Google::Protobuf::Empty]
562
+ #
563
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
564
+ #
565
+ # @example Basic example
566
+ # require "google/cloud/dataproc/v1"
567
+ #
568
+ # # Create a client object. The client can be reused for multiple calls.
569
+ # client = Google::Cloud::Dataproc::V1::SessionTemplateController::Client.new
570
+ #
571
+ # # Create a request. To set request fields, pass in keyword arguments.
572
+ # request = Google::Cloud::Dataproc::V1::DeleteSessionTemplateRequest.new
573
+ #
574
+ # # Call the delete_session_template method.
575
+ # result = client.delete_session_template request
576
+ #
577
+ # # The returned object is of type Google::Protobuf::Empty.
578
+ # p result
579
+ #
580
+ def delete_session_template request, options = nil
581
+ raise ::ArgumentError, "request must be provided" if request.nil?
582
+
583
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dataproc::V1::DeleteSessionTemplateRequest
584
+
585
+ # Converts hash and nil to an options object
586
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
587
+
588
+ # Customize the options with defaults
589
+ metadata = @config.rpcs.delete_session_template.metadata.to_h
590
+
591
+ # Set x-goog-api-client and x-goog-user-project headers
592
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
593
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
594
+ gapic_version: ::Google::Cloud::Dataproc::V1::VERSION
595
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
596
+
597
+ header_params = {}
598
+ if request.name
599
+ header_params["name"] = request.name
600
+ end
601
+
602
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
603
+ metadata[:"x-goog-request-params"] ||= request_params_header
604
+
605
+ options.apply_defaults timeout: @config.rpcs.delete_session_template.timeout,
606
+ metadata: metadata,
607
+ retry_policy: @config.rpcs.delete_session_template.retry_policy
608
+
609
+ options.apply_defaults timeout: @config.timeout,
610
+ metadata: @config.metadata,
611
+ retry_policy: @config.retry_policy
612
+
613
+ @session_template_controller_stub.call_rpc :delete_session_template, request, options: options do |response, operation|
614
+ yield response, operation if block_given?
615
+ return response
616
+ end
617
+ rescue ::GRPC::BadStatus => e
618
+ raise ::Google::Cloud::Error.from_error(e)
619
+ end
620
+
621
+ ##
622
+ # Configuration class for the SessionTemplateController API.
623
+ #
624
+ # This class represents the configuration for SessionTemplateController,
625
+ # providing control over timeouts, retry behavior, logging, transport
626
+ # parameters, and other low-level controls. Certain parameters can also be
627
+ # applied individually to specific RPCs. See
628
+ # {::Google::Cloud::Dataproc::V1::SessionTemplateController::Client::Configuration::Rpcs}
629
+ # for a list of RPCs that can be configured independently.
630
+ #
631
+ # Configuration can be applied globally to all clients, or to a single client
632
+ # on construction.
633
+ #
634
+ # @example
635
+ #
636
+ # # Modify the global config, setting the timeout for
637
+ # # create_session_template to 20 seconds,
638
+ # # and all remaining timeouts to 10 seconds.
639
+ # ::Google::Cloud::Dataproc::V1::SessionTemplateController::Client.configure do |config|
640
+ # config.timeout = 10.0
641
+ # config.rpcs.create_session_template.timeout = 20.0
642
+ # end
643
+ #
644
+ # # Apply the above configuration only to a new client.
645
+ # client = ::Google::Cloud::Dataproc::V1::SessionTemplateController::Client.new do |config|
646
+ # config.timeout = 10.0
647
+ # config.rpcs.create_session_template.timeout = 20.0
648
+ # end
649
+ #
650
+ # @!attribute [rw] endpoint
651
+ # A custom service endpoint, as a hostname or hostname:port. The default is
652
+ # nil, indicating to use the default endpoint in the current universe domain.
653
+ # @return [::String,nil]
654
+ # @!attribute [rw] credentials
655
+ # Credentials to send with calls. You may provide any of the following types:
656
+ # * (`String`) The path to a service account key file in JSON format
657
+ # * (`Hash`) A service account key as a Hash
658
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
659
+ # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
660
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
661
+ # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
662
+ # * (`GRPC::Core::Channel`) a gRPC channel with included credentials
663
+ # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
664
+ # * (`nil`) indicating no credentials
665
+ # @return [::Object]
666
+ # @!attribute [rw] scope
667
+ # The OAuth scopes
668
+ # @return [::Array<::String>]
669
+ # @!attribute [rw] lib_name
670
+ # The library name as recorded in instrumentation and logging
671
+ # @return [::String]
672
+ # @!attribute [rw] lib_version
673
+ # The library version as recorded in instrumentation and logging
674
+ # @return [::String]
675
+ # @!attribute [rw] channel_args
676
+ # Extra parameters passed to the gRPC channel. Note: this is ignored if a
677
+ # `GRPC::Core::Channel` object is provided as the credential.
678
+ # @return [::Hash]
679
+ # @!attribute [rw] interceptors
680
+ # An array of interceptors that are run before calls are executed.
681
+ # @return [::Array<::GRPC::ClientInterceptor>]
682
+ # @!attribute [rw] timeout
683
+ # The call timeout in seconds.
684
+ # @return [::Numeric]
685
+ # @!attribute [rw] metadata
686
+ # Additional gRPC headers to be sent with the call.
687
+ # @return [::Hash{::Symbol=>::String}]
688
+ # @!attribute [rw] retry_policy
689
+ # The retry policy. The value is a hash with the following keys:
690
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
691
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
692
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
693
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
694
+ # trigger a retry.
695
+ # @return [::Hash]
696
+ # @!attribute [rw] quota_project
697
+ # A separate project against which to charge quota.
698
+ # @return [::String]
699
+ # @!attribute [rw] universe_domain
700
+ # The universe domain within which to make requests. This determines the
701
+ # default endpoint URL. The default value of nil uses the environment
702
+ # universe (usually the default "googleapis.com" universe).
703
+ # @return [::String,nil]
704
+ #
705
+ class Configuration
706
+ extend ::Gapic::Config
707
+
708
+ # @private
709
+ # The endpoint specific to the default "googleapis.com" universe. Deprecated.
710
+ DEFAULT_ENDPOINT = "dataproc.googleapis.com"
711
+
712
+ config_attr :endpoint, nil, ::String, nil
713
+ config_attr :credentials, nil do |value|
714
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
715
+ allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
716
+ allowed.any? { |klass| klass === value }
717
+ end
718
+ config_attr :scope, nil, ::String, ::Array, nil
719
+ config_attr :lib_name, nil, ::String, nil
720
+ config_attr :lib_version, nil, ::String, nil
721
+ config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
722
+ config_attr :interceptors, nil, ::Array, nil
723
+ config_attr :timeout, nil, ::Numeric, nil
724
+ config_attr :metadata, nil, ::Hash, nil
725
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
726
+ config_attr :quota_project, nil, ::String, nil
727
+ config_attr :universe_domain, nil, ::String, nil
728
+
729
+ # @private
730
+ def initialize parent_config = nil
731
+ @parent_config = parent_config unless parent_config.nil?
732
+
733
+ yield self if block_given?
734
+ end
735
+
736
+ ##
737
+ # Configurations for individual RPCs
738
+ # @return [Rpcs]
739
+ #
740
+ def rpcs
741
+ @rpcs ||= begin
742
+ parent_rpcs = nil
743
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
744
+ Rpcs.new parent_rpcs
745
+ end
746
+ end
747
+
748
+ ##
749
+ # Configuration for the channel pool
750
+ # @return [::Gapic::ServiceStub::ChannelPool::Configuration]
751
+ #
752
+ def channel_pool
753
+ @channel_pool ||= ::Gapic::ServiceStub::ChannelPool::Configuration.new
754
+ end
755
+
756
+ ##
757
+ # Configuration RPC class for the SessionTemplateController API.
758
+ #
759
+ # Includes fields providing the configuration for each RPC in this service.
760
+ # Each configuration object is of type `Gapic::Config::Method` and includes
761
+ # the following configuration fields:
762
+ #
763
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
764
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
765
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
766
+ # include the following keys:
767
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
768
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
769
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
770
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
771
+ # trigger a retry.
772
+ #
773
+ class Rpcs
774
+ ##
775
+ # RPC-specific configuration for `create_session_template`
776
+ # @return [::Gapic::Config::Method]
777
+ #
778
+ attr_reader :create_session_template
779
+ ##
780
+ # RPC-specific configuration for `update_session_template`
781
+ # @return [::Gapic::Config::Method]
782
+ #
783
+ attr_reader :update_session_template
784
+ ##
785
+ # RPC-specific configuration for `get_session_template`
786
+ # @return [::Gapic::Config::Method]
787
+ #
788
+ attr_reader :get_session_template
789
+ ##
790
+ # RPC-specific configuration for `list_session_templates`
791
+ # @return [::Gapic::Config::Method]
792
+ #
793
+ attr_reader :list_session_templates
794
+ ##
795
+ # RPC-specific configuration for `delete_session_template`
796
+ # @return [::Gapic::Config::Method]
797
+ #
798
+ attr_reader :delete_session_template
799
+
800
+ # @private
801
+ def initialize parent_rpcs = nil
802
+ create_session_template_config = parent_rpcs.create_session_template if parent_rpcs.respond_to? :create_session_template
803
+ @create_session_template = ::Gapic::Config::Method.new create_session_template_config
804
+ update_session_template_config = parent_rpcs.update_session_template if parent_rpcs.respond_to? :update_session_template
805
+ @update_session_template = ::Gapic::Config::Method.new update_session_template_config
806
+ get_session_template_config = parent_rpcs.get_session_template if parent_rpcs.respond_to? :get_session_template
807
+ @get_session_template = ::Gapic::Config::Method.new get_session_template_config
808
+ list_session_templates_config = parent_rpcs.list_session_templates if parent_rpcs.respond_to? :list_session_templates
809
+ @list_session_templates = ::Gapic::Config::Method.new list_session_templates_config
810
+ delete_session_template_config = parent_rpcs.delete_session_template if parent_rpcs.respond_to? :delete_session_template
811
+ @delete_session_template = ::Gapic::Config::Method.new delete_session_template_config
812
+
813
+ yield self if block_given?
814
+ end
815
+ end
816
+ end
817
+ end
818
+ end
819
+ end
820
+ end
821
+ end
822
+ end