google-cloud-dataproc-v1 0.23.1 → 0.24.1

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