google-cloud-notebooks-v1 0.4.2 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,1342 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2023 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/notebooks/v1/managed_service_pb"
21
+ require "google/cloud/notebooks/v1/managed_notebook_service/rest/service_stub"
22
+ require "google/cloud/location/rest"
23
+ require "google/iam/v1/rest"
24
+
25
+ module Google
26
+ module Cloud
27
+ module Notebooks
28
+ module V1
29
+ module ManagedNotebookService
30
+ module Rest
31
+ ##
32
+ # REST client for the ManagedNotebookService service.
33
+ #
34
+ # API v1 service for Managed Notebooks.
35
+ #
36
+ class Client
37
+ include Paths
38
+
39
+ # @private
40
+ attr_reader :managed_notebook_service_stub
41
+
42
+ ##
43
+ # Configure the ManagedNotebookService Client class.
44
+ #
45
+ # See {::Google::Cloud::Notebooks::V1::ManagedNotebookService::Rest::Client::Configuration}
46
+ # for a description of the configuration fields.
47
+ #
48
+ # @example
49
+ #
50
+ # # Modify the configuration for all ManagedNotebookService clients
51
+ # ::Google::Cloud::Notebooks::V1::ManagedNotebookService::Rest::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", "Notebooks", "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.timeout = 60.0
72
+ default_config.retry_policy = {
73
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14]
74
+ }
75
+
76
+ default_config.rpcs.list_runtimes.timeout = 60.0
77
+
78
+ default_config.rpcs.get_runtime.timeout = 60.0
79
+
80
+ default_config.rpcs.create_runtime.timeout = 60.0
81
+
82
+ default_config.rpcs.update_runtime.timeout = 60.0
83
+
84
+ default_config.rpcs.delete_runtime.timeout = 60.0
85
+
86
+ default_config.rpcs.start_runtime.timeout = 60.0
87
+
88
+ default_config.rpcs.stop_runtime.timeout = 60.0
89
+
90
+ default_config.rpcs.switch_runtime.timeout = 60.0
91
+
92
+ default_config.rpcs.report_runtime_event.timeout = 60.0
93
+
94
+ default_config.rpcs.diagnose_runtime.timeout = 60.0
95
+
96
+ default_config
97
+ end
98
+ yield @configure if block_given?
99
+ @configure
100
+ end
101
+
102
+ ##
103
+ # Configure the ManagedNotebookService Client instance.
104
+ #
105
+ # The configuration is set to the derived mode, meaning that values can be changed,
106
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
107
+ # should be made on {Client.configure}.
108
+ #
109
+ # See {::Google::Cloud::Notebooks::V1::ManagedNotebookService::Rest::Client::Configuration}
110
+ # for a description of the configuration fields.
111
+ #
112
+ # @yield [config] Configure the Client client.
113
+ # @yieldparam config [Client::Configuration]
114
+ #
115
+ # @return [Client::Configuration]
116
+ #
117
+ def configure
118
+ yield @config if block_given?
119
+ @config
120
+ end
121
+
122
+ ##
123
+ # Create a new ManagedNotebookService REST client object.
124
+ #
125
+ # @example
126
+ #
127
+ # # Create a client using the default configuration
128
+ # client = ::Google::Cloud::Notebooks::V1::ManagedNotebookService::Rest::Client.new
129
+ #
130
+ # # Create a client using a custom configuration
131
+ # client = ::Google::Cloud::Notebooks::V1::ManagedNotebookService::Rest::Client.new do |config|
132
+ # config.timeout = 10.0
133
+ # end
134
+ #
135
+ # @yield [config] Configure the ManagedNotebookService client.
136
+ # @yieldparam config [Client::Configuration]
137
+ #
138
+ def initialize
139
+ # Create the configuration object
140
+ @config = Configuration.new Client.configure
141
+
142
+ # Yield the configuration if needed
143
+ yield @config if block_given?
144
+
145
+ # Create credentials
146
+ credentials = @config.credentials
147
+ # Use self-signed JWT if the endpoint is unchanged from default,
148
+ # but only if the default endpoint does not have a region prefix.
149
+ enable_self_signed_jwt = @config.endpoint == Client.configure.endpoint &&
150
+ !@config.endpoint.split(".").first.include?("-")
151
+ credentials ||= Credentials.default scope: @config.scope,
152
+ enable_self_signed_jwt: enable_self_signed_jwt
153
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
154
+ credentials = Credentials.new credentials, scope: @config.scope
155
+ end
156
+
157
+ @quota_project_id = @config.quota_project
158
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
159
+
160
+ @operations_client = ::Google::Cloud::Notebooks::V1::ManagedNotebookService::Rest::Operations.new do |config|
161
+ config.credentials = credentials
162
+ config.quota_project = @quota_project_id
163
+ config.endpoint = @config.endpoint
164
+ end
165
+
166
+ @location_client = Google::Cloud::Location::Locations::Rest::Client.new do |config|
167
+ config.credentials = credentials
168
+ config.quota_project = @quota_project_id
169
+ config.endpoint = @config.endpoint
170
+ config.bindings_override = @config.bindings_override
171
+ end
172
+
173
+ @iam_policy_client = Google::Iam::V1::IAMPolicy::Rest::Client.new do |config|
174
+ config.credentials = credentials
175
+ config.quota_project = @quota_project_id
176
+ config.endpoint = @config.endpoint
177
+ config.bindings_override = @config.bindings_override
178
+ end
179
+
180
+ @managed_notebook_service_stub = ::Google::Cloud::Notebooks::V1::ManagedNotebookService::Rest::ServiceStub.new endpoint: @config.endpoint, credentials: credentials
181
+ end
182
+
183
+ ##
184
+ # Get the associated client for long-running operations.
185
+ #
186
+ # @return [::Google::Cloud::Notebooks::V1::ManagedNotebookService::Rest::Operations]
187
+ #
188
+ attr_reader :operations_client
189
+
190
+ ##
191
+ # Get the associated client for mix-in of the Locations.
192
+ #
193
+ # @return [Google::Cloud::Location::Locations::Rest::Client]
194
+ #
195
+ attr_reader :location_client
196
+
197
+ ##
198
+ # Get the associated client for mix-in of the IAMPolicy.
199
+ #
200
+ # @return [Google::Iam::V1::IAMPolicy::Rest::Client]
201
+ #
202
+ attr_reader :iam_policy_client
203
+
204
+ # Service calls
205
+
206
+ ##
207
+ # Lists Runtimes in a given project and location.
208
+ #
209
+ # @overload list_runtimes(request, options = nil)
210
+ # Pass arguments to `list_runtimes` via a request object, either of type
211
+ # {::Google::Cloud::Notebooks::V1::ListRuntimesRequest} or an equivalent Hash.
212
+ #
213
+ # @param request [::Google::Cloud::Notebooks::V1::ListRuntimesRequest, ::Hash]
214
+ # A request object representing the call parameters. Required. To specify no
215
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
216
+ # @param options [::Gapic::CallOptions, ::Hash]
217
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
218
+ #
219
+ # @overload list_runtimes(parent: nil, page_size: nil, page_token: nil)
220
+ # Pass arguments to `list_runtimes` via keyword arguments. Note that at
221
+ # least one keyword argument is required. To specify no parameters, or to keep all
222
+ # the default parameter values, pass an empty Hash as a request object (see above).
223
+ #
224
+ # @param parent [::String]
225
+ # Required. Format:
226
+ # `parent=projects/{project_id}/locations/{location}`
227
+ # @param page_size [::Integer]
228
+ # Maximum return size of the list call.
229
+ # @param page_token [::String]
230
+ # A previous returned page token that can be used to continue listing
231
+ # from the last result.
232
+ # @yield [result, operation] Access the result along with the TransportOperation object
233
+ # @yieldparam result [::Google::Cloud::Notebooks::V1::ListRuntimesResponse]
234
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
235
+ #
236
+ # @return [::Google::Cloud::Notebooks::V1::ListRuntimesResponse]
237
+ #
238
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
239
+ def list_runtimes request, options = nil
240
+ raise ::ArgumentError, "request must be provided" if request.nil?
241
+
242
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Notebooks::V1::ListRuntimesRequest
243
+
244
+ # Converts hash and nil to an options object
245
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
246
+
247
+ # Customize the options with defaults
248
+ call_metadata = @config.rpcs.list_runtimes.metadata.to_h
249
+
250
+ # Set x-goog-api-client and x-goog-user-project headers
251
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
252
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
253
+ gapic_version: ::Google::Cloud::Notebooks::V1::VERSION,
254
+ transports_version_send: [:rest]
255
+
256
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
257
+
258
+ options.apply_defaults timeout: @config.rpcs.list_runtimes.timeout,
259
+ metadata: call_metadata,
260
+ retry_policy: @config.rpcs.list_runtimes.retry_policy
261
+
262
+ options.apply_defaults timeout: @config.timeout,
263
+ metadata: @config.metadata,
264
+ retry_policy: @config.retry_policy
265
+
266
+ @managed_notebook_service_stub.list_runtimes request, options do |result, operation|
267
+ yield result, operation if block_given?
268
+ return result
269
+ end
270
+ rescue ::Gapic::Rest::Error => e
271
+ raise ::Google::Cloud::Error.from_error(e)
272
+ end
273
+
274
+ ##
275
+ # Gets details of a single Runtime. The location must be a regional endpoint
276
+ # rather than zonal.
277
+ #
278
+ # @overload get_runtime(request, options = nil)
279
+ # Pass arguments to `get_runtime` via a request object, either of type
280
+ # {::Google::Cloud::Notebooks::V1::GetRuntimeRequest} or an equivalent Hash.
281
+ #
282
+ # @param request [::Google::Cloud::Notebooks::V1::GetRuntimeRequest, ::Hash]
283
+ # A request object representing the call parameters. Required. To specify no
284
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
285
+ # @param options [::Gapic::CallOptions, ::Hash]
286
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
287
+ #
288
+ # @overload get_runtime(name: nil)
289
+ # Pass arguments to `get_runtime` via keyword arguments. Note that at
290
+ # least one keyword argument is required. To specify no parameters, or to keep all
291
+ # the default parameter values, pass an empty Hash as a request object (see above).
292
+ #
293
+ # @param name [::String]
294
+ # Required. Format:
295
+ # `projects/{project_id}/locations/{location}/runtimes/{runtime_id}`
296
+ # @yield [result, operation] Access the result along with the TransportOperation object
297
+ # @yieldparam result [::Google::Cloud::Notebooks::V1::Runtime]
298
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
299
+ #
300
+ # @return [::Google::Cloud::Notebooks::V1::Runtime]
301
+ #
302
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
303
+ def get_runtime request, options = nil
304
+ raise ::ArgumentError, "request must be provided" if request.nil?
305
+
306
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Notebooks::V1::GetRuntimeRequest
307
+
308
+ # Converts hash and nil to an options object
309
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
310
+
311
+ # Customize the options with defaults
312
+ call_metadata = @config.rpcs.get_runtime.metadata.to_h
313
+
314
+ # Set x-goog-api-client and x-goog-user-project headers
315
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
316
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
317
+ gapic_version: ::Google::Cloud::Notebooks::V1::VERSION,
318
+ transports_version_send: [:rest]
319
+
320
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
321
+
322
+ options.apply_defaults timeout: @config.rpcs.get_runtime.timeout,
323
+ metadata: call_metadata,
324
+ retry_policy: @config.rpcs.get_runtime.retry_policy
325
+
326
+ options.apply_defaults timeout: @config.timeout,
327
+ metadata: @config.metadata,
328
+ retry_policy: @config.retry_policy
329
+
330
+ @managed_notebook_service_stub.get_runtime request, options do |result, operation|
331
+ yield result, operation if block_given?
332
+ return result
333
+ end
334
+ rescue ::Gapic::Rest::Error => e
335
+ raise ::Google::Cloud::Error.from_error(e)
336
+ end
337
+
338
+ ##
339
+ # Creates a new Runtime in a given project and location.
340
+ #
341
+ # @overload create_runtime(request, options = nil)
342
+ # Pass arguments to `create_runtime` via a request object, either of type
343
+ # {::Google::Cloud::Notebooks::V1::CreateRuntimeRequest} or an equivalent Hash.
344
+ #
345
+ # @param request [::Google::Cloud::Notebooks::V1::CreateRuntimeRequest, ::Hash]
346
+ # A request object representing the call parameters. Required. To specify no
347
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
348
+ # @param options [::Gapic::CallOptions, ::Hash]
349
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
350
+ #
351
+ # @overload create_runtime(parent: nil, runtime_id: nil, runtime: nil, request_id: nil)
352
+ # Pass arguments to `create_runtime` via keyword arguments. Note that at
353
+ # least one keyword argument is required. To specify no parameters, or to keep all
354
+ # the default parameter values, pass an empty Hash as a request object (see above).
355
+ #
356
+ # @param parent [::String]
357
+ # Required. Format:
358
+ # `parent=projects/{project_id}/locations/{location}`
359
+ # @param runtime_id [::String]
360
+ # Required. User-defined unique ID of this Runtime.
361
+ # @param runtime [::Google::Cloud::Notebooks::V1::Runtime, ::Hash]
362
+ # Required. The Runtime to be created.
363
+ # @param request_id [::String]
364
+ # Idempotent request UUID.
365
+ # @yield [result, operation] Access the result along with the TransportOperation object
366
+ # @yieldparam result [::Gapic::Operation]
367
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
368
+ #
369
+ # @return [::Gapic::Operation]
370
+ #
371
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
372
+ def create_runtime request, options = nil
373
+ raise ::ArgumentError, "request must be provided" if request.nil?
374
+
375
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Notebooks::V1::CreateRuntimeRequest
376
+
377
+ # Converts hash and nil to an options object
378
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
379
+
380
+ # Customize the options with defaults
381
+ call_metadata = @config.rpcs.create_runtime.metadata.to_h
382
+
383
+ # Set x-goog-api-client and x-goog-user-project headers
384
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
385
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
386
+ gapic_version: ::Google::Cloud::Notebooks::V1::VERSION,
387
+ transports_version_send: [:rest]
388
+
389
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
390
+
391
+ options.apply_defaults timeout: @config.rpcs.create_runtime.timeout,
392
+ metadata: call_metadata,
393
+ retry_policy: @config.rpcs.create_runtime.retry_policy
394
+
395
+ options.apply_defaults timeout: @config.timeout,
396
+ metadata: @config.metadata,
397
+ retry_policy: @config.retry_policy
398
+
399
+ @managed_notebook_service_stub.create_runtime request, options do |result, operation|
400
+ result = ::Gapic::Operation.new result, @operations_client, options: options
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
+ # Update Notebook Runtime configuration.
410
+ #
411
+ # @overload update_runtime(request, options = nil)
412
+ # Pass arguments to `update_runtime` via a request object, either of type
413
+ # {::Google::Cloud::Notebooks::V1::UpdateRuntimeRequest} or an equivalent Hash.
414
+ #
415
+ # @param request [::Google::Cloud::Notebooks::V1::UpdateRuntimeRequest, ::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 update_runtime(runtime: nil, update_mask: nil, request_id: nil)
422
+ # Pass arguments to `update_runtime` 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 runtime [::Google::Cloud::Notebooks::V1::Runtime, ::Hash]
427
+ # Required. The Runtime to be updated.
428
+ # @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
429
+ # Required. Specifies the path, relative to `Runtime`, of
430
+ # the field to update. For example, to change the software configuration
431
+ # kernels, the `update_mask` parameter would be
432
+ # specified as `software_config.kernels`,
433
+ # and the `PATCH` request body would specify the new value, as follows:
434
+ #
435
+ # {
436
+ # "software_config":{
437
+ # "kernels": [{
438
+ # 'repository':
439
+ # 'gcr.io/deeplearning-platform-release/pytorch-gpu', 'tag':
440
+ # 'latest' }],
441
+ # }
442
+ # }
443
+ #
444
+ #
445
+ # Currently, only the following fields can be updated:
446
+ # - `software_config.kernels`
447
+ # - `software_config.post_startup_script`
448
+ # - `software_config.custom_gpu_driver_path`
449
+ # - `software_config.idle_shutdown`
450
+ # - `software_config.idle_shutdown_timeout`
451
+ # - `software_config.disable_terminal`
452
+ # @param request_id [::String]
453
+ # Idempotent request UUID.
454
+ # @yield [result, operation] Access the result along with the TransportOperation object
455
+ # @yieldparam result [::Gapic::Operation]
456
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
457
+ #
458
+ # @return [::Gapic::Operation]
459
+ #
460
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
461
+ def update_runtime request, options = nil
462
+ raise ::ArgumentError, "request must be provided" if request.nil?
463
+
464
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Notebooks::V1::UpdateRuntimeRequest
465
+
466
+ # Converts hash and nil to an options object
467
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
468
+
469
+ # Customize the options with defaults
470
+ call_metadata = @config.rpcs.update_runtime.metadata.to_h
471
+
472
+ # Set x-goog-api-client and x-goog-user-project headers
473
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
474
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
475
+ gapic_version: ::Google::Cloud::Notebooks::V1::VERSION,
476
+ transports_version_send: [:rest]
477
+
478
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
479
+
480
+ options.apply_defaults timeout: @config.rpcs.update_runtime.timeout,
481
+ metadata: call_metadata,
482
+ retry_policy: @config.rpcs.update_runtime.retry_policy
483
+
484
+ options.apply_defaults timeout: @config.timeout,
485
+ metadata: @config.metadata,
486
+ retry_policy: @config.retry_policy
487
+
488
+ @managed_notebook_service_stub.update_runtime request, options do |result, operation|
489
+ result = ::Gapic::Operation.new result, @operations_client, options: options
490
+ yield result, operation if block_given?
491
+ return result
492
+ end
493
+ rescue ::Gapic::Rest::Error => e
494
+ raise ::Google::Cloud::Error.from_error(e)
495
+ end
496
+
497
+ ##
498
+ # Deletes a single Runtime.
499
+ #
500
+ # @overload delete_runtime(request, options = nil)
501
+ # Pass arguments to `delete_runtime` via a request object, either of type
502
+ # {::Google::Cloud::Notebooks::V1::DeleteRuntimeRequest} or an equivalent Hash.
503
+ #
504
+ # @param request [::Google::Cloud::Notebooks::V1::DeleteRuntimeRequest, ::Hash]
505
+ # A request object representing the call parameters. Required. To specify no
506
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
507
+ # @param options [::Gapic::CallOptions, ::Hash]
508
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
509
+ #
510
+ # @overload delete_runtime(name: nil, request_id: nil)
511
+ # Pass arguments to `delete_runtime` via keyword arguments. Note that at
512
+ # least one keyword argument is required. To specify no parameters, or to keep all
513
+ # the default parameter values, pass an empty Hash as a request object (see above).
514
+ #
515
+ # @param name [::String]
516
+ # Required. Format:
517
+ # `projects/{project_id}/locations/{location}/runtimes/{runtime_id}`
518
+ # @param request_id [::String]
519
+ # Idempotent request UUID.
520
+ # @yield [result, operation] Access the result along with the TransportOperation object
521
+ # @yieldparam result [::Gapic::Operation]
522
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
523
+ #
524
+ # @return [::Gapic::Operation]
525
+ #
526
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
527
+ def delete_runtime request, options = nil
528
+ raise ::ArgumentError, "request must be provided" if request.nil?
529
+
530
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Notebooks::V1::DeleteRuntimeRequest
531
+
532
+ # Converts hash and nil to an options object
533
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
534
+
535
+ # Customize the options with defaults
536
+ call_metadata = @config.rpcs.delete_runtime.metadata.to_h
537
+
538
+ # Set x-goog-api-client and x-goog-user-project headers
539
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
540
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
541
+ gapic_version: ::Google::Cloud::Notebooks::V1::VERSION,
542
+ transports_version_send: [:rest]
543
+
544
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
545
+
546
+ options.apply_defaults timeout: @config.rpcs.delete_runtime.timeout,
547
+ metadata: call_metadata,
548
+ retry_policy: @config.rpcs.delete_runtime.retry_policy
549
+
550
+ options.apply_defaults timeout: @config.timeout,
551
+ metadata: @config.metadata,
552
+ retry_policy: @config.retry_policy
553
+
554
+ @managed_notebook_service_stub.delete_runtime request, options do |result, operation|
555
+ result = ::Gapic::Operation.new result, @operations_client, options: options
556
+ yield result, operation if block_given?
557
+ return result
558
+ end
559
+ rescue ::Gapic::Rest::Error => e
560
+ raise ::Google::Cloud::Error.from_error(e)
561
+ end
562
+
563
+ ##
564
+ # Starts a Managed Notebook Runtime.
565
+ # Perform "Start" on GPU instances; "Resume" on CPU instances
566
+ # See:
567
+ # https://cloud.google.com/compute/docs/instances/stop-start-instance
568
+ # https://cloud.google.com/compute/docs/instances/suspend-resume-instance
569
+ #
570
+ # @overload start_runtime(request, options = nil)
571
+ # Pass arguments to `start_runtime` via a request object, either of type
572
+ # {::Google::Cloud::Notebooks::V1::StartRuntimeRequest} or an equivalent Hash.
573
+ #
574
+ # @param request [::Google::Cloud::Notebooks::V1::StartRuntimeRequest, ::Hash]
575
+ # A request object representing the call parameters. Required. To specify no
576
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
577
+ # @param options [::Gapic::CallOptions, ::Hash]
578
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
579
+ #
580
+ # @overload start_runtime(name: nil, request_id: nil)
581
+ # Pass arguments to `start_runtime` via keyword arguments. Note that at
582
+ # least one keyword argument is required. To specify no parameters, or to keep all
583
+ # the default parameter values, pass an empty Hash as a request object (see above).
584
+ #
585
+ # @param name [::String]
586
+ # Required. Format:
587
+ # `projects/{project_id}/locations/{location}/runtimes/{runtime_id}`
588
+ # @param request_id [::String]
589
+ # Idempotent request UUID.
590
+ # @yield [result, operation] Access the result along with the TransportOperation object
591
+ # @yieldparam result [::Gapic::Operation]
592
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
593
+ #
594
+ # @return [::Gapic::Operation]
595
+ #
596
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
597
+ def start_runtime request, options = nil
598
+ raise ::ArgumentError, "request must be provided" if request.nil?
599
+
600
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Notebooks::V1::StartRuntimeRequest
601
+
602
+ # Converts hash and nil to an options object
603
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
604
+
605
+ # Customize the options with defaults
606
+ call_metadata = @config.rpcs.start_runtime.metadata.to_h
607
+
608
+ # Set x-goog-api-client and x-goog-user-project headers
609
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
610
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
611
+ gapic_version: ::Google::Cloud::Notebooks::V1::VERSION,
612
+ transports_version_send: [:rest]
613
+
614
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
615
+
616
+ options.apply_defaults timeout: @config.rpcs.start_runtime.timeout,
617
+ metadata: call_metadata,
618
+ retry_policy: @config.rpcs.start_runtime.retry_policy
619
+
620
+ options.apply_defaults timeout: @config.timeout,
621
+ metadata: @config.metadata,
622
+ retry_policy: @config.retry_policy
623
+
624
+ @managed_notebook_service_stub.start_runtime request, options do |result, operation|
625
+ result = ::Gapic::Operation.new result, @operations_client, options: options
626
+ yield result, operation if block_given?
627
+ return result
628
+ end
629
+ rescue ::Gapic::Rest::Error => e
630
+ raise ::Google::Cloud::Error.from_error(e)
631
+ end
632
+
633
+ ##
634
+ # Stops a Managed Notebook Runtime.
635
+ # Perform "Stop" on GPU instances; "Suspend" on CPU instances
636
+ # See:
637
+ # https://cloud.google.com/compute/docs/instances/stop-start-instance
638
+ # https://cloud.google.com/compute/docs/instances/suspend-resume-instance
639
+ #
640
+ # @overload stop_runtime(request, options = nil)
641
+ # Pass arguments to `stop_runtime` via a request object, either of type
642
+ # {::Google::Cloud::Notebooks::V1::StopRuntimeRequest} or an equivalent Hash.
643
+ #
644
+ # @param request [::Google::Cloud::Notebooks::V1::StopRuntimeRequest, ::Hash]
645
+ # A request object representing the call parameters. Required. To specify no
646
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
647
+ # @param options [::Gapic::CallOptions, ::Hash]
648
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
649
+ #
650
+ # @overload stop_runtime(name: nil, request_id: nil)
651
+ # Pass arguments to `stop_runtime` via keyword arguments. Note that at
652
+ # least one keyword argument is required. To specify no parameters, or to keep all
653
+ # the default parameter values, pass an empty Hash as a request object (see above).
654
+ #
655
+ # @param name [::String]
656
+ # Required. Format:
657
+ # `projects/{project_id}/locations/{location}/runtimes/{runtime_id}`
658
+ # @param request_id [::String]
659
+ # Idempotent request UUID.
660
+ # @yield [result, operation] Access the result along with the TransportOperation object
661
+ # @yieldparam result [::Gapic::Operation]
662
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
663
+ #
664
+ # @return [::Gapic::Operation]
665
+ #
666
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
667
+ def stop_runtime request, options = nil
668
+ raise ::ArgumentError, "request must be provided" if request.nil?
669
+
670
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Notebooks::V1::StopRuntimeRequest
671
+
672
+ # Converts hash and nil to an options object
673
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
674
+
675
+ # Customize the options with defaults
676
+ call_metadata = @config.rpcs.stop_runtime.metadata.to_h
677
+
678
+ # Set x-goog-api-client and x-goog-user-project headers
679
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
680
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
681
+ gapic_version: ::Google::Cloud::Notebooks::V1::VERSION,
682
+ transports_version_send: [:rest]
683
+
684
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
685
+
686
+ options.apply_defaults timeout: @config.rpcs.stop_runtime.timeout,
687
+ metadata: call_metadata,
688
+ retry_policy: @config.rpcs.stop_runtime.retry_policy
689
+
690
+ options.apply_defaults timeout: @config.timeout,
691
+ metadata: @config.metadata,
692
+ retry_policy: @config.retry_policy
693
+
694
+ @managed_notebook_service_stub.stop_runtime request, options do |result, operation|
695
+ result = ::Gapic::Operation.new result, @operations_client, options: options
696
+ yield result, operation if block_given?
697
+ return result
698
+ end
699
+ rescue ::Gapic::Rest::Error => e
700
+ raise ::Google::Cloud::Error.from_error(e)
701
+ end
702
+
703
+ ##
704
+ # Switch a Managed Notebook Runtime.
705
+ #
706
+ # @overload switch_runtime(request, options = nil)
707
+ # Pass arguments to `switch_runtime` via a request object, either of type
708
+ # {::Google::Cloud::Notebooks::V1::SwitchRuntimeRequest} or an equivalent Hash.
709
+ #
710
+ # @param request [::Google::Cloud::Notebooks::V1::SwitchRuntimeRequest, ::Hash]
711
+ # A request object representing the call parameters. Required. To specify no
712
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
713
+ # @param options [::Gapic::CallOptions, ::Hash]
714
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
715
+ #
716
+ # @overload switch_runtime(name: nil, machine_type: nil, accelerator_config: nil, request_id: nil)
717
+ # Pass arguments to `switch_runtime` via keyword arguments. Note that at
718
+ # least one keyword argument is required. To specify no parameters, or to keep all
719
+ # the default parameter values, pass an empty Hash as a request object (see above).
720
+ #
721
+ # @param name [::String]
722
+ # Required. Format:
723
+ # `projects/{project_id}/locations/{location}/runtimes/{runtime_id}`
724
+ # @param machine_type [::String]
725
+ # machine type.
726
+ # @param accelerator_config [::Google::Cloud::Notebooks::V1::RuntimeAcceleratorConfig, ::Hash]
727
+ # accelerator config.
728
+ # @param request_id [::String]
729
+ # Idempotent request UUID.
730
+ # @yield [result, operation] Access the result along with the TransportOperation object
731
+ # @yieldparam result [::Gapic::Operation]
732
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
733
+ #
734
+ # @return [::Gapic::Operation]
735
+ #
736
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
737
+ def switch_runtime request, options = nil
738
+ raise ::ArgumentError, "request must be provided" if request.nil?
739
+
740
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Notebooks::V1::SwitchRuntimeRequest
741
+
742
+ # Converts hash and nil to an options object
743
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
744
+
745
+ # Customize the options with defaults
746
+ call_metadata = @config.rpcs.switch_runtime.metadata.to_h
747
+
748
+ # Set x-goog-api-client and x-goog-user-project headers
749
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
750
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
751
+ gapic_version: ::Google::Cloud::Notebooks::V1::VERSION,
752
+ transports_version_send: [:rest]
753
+
754
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
755
+
756
+ options.apply_defaults timeout: @config.rpcs.switch_runtime.timeout,
757
+ metadata: call_metadata,
758
+ retry_policy: @config.rpcs.switch_runtime.retry_policy
759
+
760
+ options.apply_defaults timeout: @config.timeout,
761
+ metadata: @config.metadata,
762
+ retry_policy: @config.retry_policy
763
+
764
+ @managed_notebook_service_stub.switch_runtime request, options do |result, operation|
765
+ result = ::Gapic::Operation.new result, @operations_client, options: options
766
+ yield result, operation if block_given?
767
+ return result
768
+ end
769
+ rescue ::Gapic::Rest::Error => e
770
+ raise ::Google::Cloud::Error.from_error(e)
771
+ end
772
+
773
+ ##
774
+ # Resets a Managed Notebook Runtime.
775
+ #
776
+ # @overload reset_runtime(request, options = nil)
777
+ # Pass arguments to `reset_runtime` via a request object, either of type
778
+ # {::Google::Cloud::Notebooks::V1::ResetRuntimeRequest} or an equivalent Hash.
779
+ #
780
+ # @param request [::Google::Cloud::Notebooks::V1::ResetRuntimeRequest, ::Hash]
781
+ # A request object representing the call parameters. Required. To specify no
782
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
783
+ # @param options [::Gapic::CallOptions, ::Hash]
784
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
785
+ #
786
+ # @overload reset_runtime(name: nil, request_id: nil)
787
+ # Pass arguments to `reset_runtime` via keyword arguments. Note that at
788
+ # least one keyword argument is required. To specify no parameters, or to keep all
789
+ # the default parameter values, pass an empty Hash as a request object (see above).
790
+ #
791
+ # @param name [::String]
792
+ # Required. Format:
793
+ # `projects/{project_id}/locations/{location}/runtimes/{runtime_id}`
794
+ # @param request_id [::String]
795
+ # Idempotent request UUID.
796
+ # @yield [result, operation] Access the result along with the TransportOperation object
797
+ # @yieldparam result [::Gapic::Operation]
798
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
799
+ #
800
+ # @return [::Gapic::Operation]
801
+ #
802
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
803
+ def reset_runtime request, options = nil
804
+ raise ::ArgumentError, "request must be provided" if request.nil?
805
+
806
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Notebooks::V1::ResetRuntimeRequest
807
+
808
+ # Converts hash and nil to an options object
809
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
810
+
811
+ # Customize the options with defaults
812
+ call_metadata = @config.rpcs.reset_runtime.metadata.to_h
813
+
814
+ # Set x-goog-api-client and x-goog-user-project headers
815
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
816
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
817
+ gapic_version: ::Google::Cloud::Notebooks::V1::VERSION,
818
+ transports_version_send: [:rest]
819
+
820
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
821
+
822
+ options.apply_defaults timeout: @config.rpcs.reset_runtime.timeout,
823
+ metadata: call_metadata,
824
+ retry_policy: @config.rpcs.reset_runtime.retry_policy
825
+
826
+ options.apply_defaults timeout: @config.timeout,
827
+ metadata: @config.metadata,
828
+ retry_policy: @config.retry_policy
829
+
830
+ @managed_notebook_service_stub.reset_runtime request, options do |result, operation|
831
+ result = ::Gapic::Operation.new result, @operations_client, options: options
832
+ yield result, operation if block_given?
833
+ return result
834
+ end
835
+ rescue ::Gapic::Rest::Error => e
836
+ raise ::Google::Cloud::Error.from_error(e)
837
+ end
838
+
839
+ ##
840
+ # Upgrades a Managed Notebook Runtime to the latest version.
841
+ #
842
+ # @overload upgrade_runtime(request, options = nil)
843
+ # Pass arguments to `upgrade_runtime` via a request object, either of type
844
+ # {::Google::Cloud::Notebooks::V1::UpgradeRuntimeRequest} or an equivalent Hash.
845
+ #
846
+ # @param request [::Google::Cloud::Notebooks::V1::UpgradeRuntimeRequest, ::Hash]
847
+ # A request object representing the call parameters. Required. To specify no
848
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
849
+ # @param options [::Gapic::CallOptions, ::Hash]
850
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
851
+ #
852
+ # @overload upgrade_runtime(name: nil, request_id: nil)
853
+ # Pass arguments to `upgrade_runtime` via keyword arguments. Note that at
854
+ # least one keyword argument is required. To specify no parameters, or to keep all
855
+ # the default parameter values, pass an empty Hash as a request object (see above).
856
+ #
857
+ # @param name [::String]
858
+ # Required. Format:
859
+ # `projects/{project_id}/locations/{location}/runtimes/{runtime_id}`
860
+ # @param request_id [::String]
861
+ # Idempotent request UUID.
862
+ # @yield [result, operation] Access the result along with the TransportOperation object
863
+ # @yieldparam result [::Gapic::Operation]
864
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
865
+ #
866
+ # @return [::Gapic::Operation]
867
+ #
868
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
869
+ def upgrade_runtime request, options = nil
870
+ raise ::ArgumentError, "request must be provided" if request.nil?
871
+
872
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Notebooks::V1::UpgradeRuntimeRequest
873
+
874
+ # Converts hash and nil to an options object
875
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
876
+
877
+ # Customize the options with defaults
878
+ call_metadata = @config.rpcs.upgrade_runtime.metadata.to_h
879
+
880
+ # Set x-goog-api-client and x-goog-user-project headers
881
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
882
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
883
+ gapic_version: ::Google::Cloud::Notebooks::V1::VERSION,
884
+ transports_version_send: [:rest]
885
+
886
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
887
+
888
+ options.apply_defaults timeout: @config.rpcs.upgrade_runtime.timeout,
889
+ metadata: call_metadata,
890
+ retry_policy: @config.rpcs.upgrade_runtime.retry_policy
891
+
892
+ options.apply_defaults timeout: @config.timeout,
893
+ metadata: @config.metadata,
894
+ retry_policy: @config.retry_policy
895
+
896
+ @managed_notebook_service_stub.upgrade_runtime request, options do |result, operation|
897
+ result = ::Gapic::Operation.new result, @operations_client, options: options
898
+ yield result, operation if block_given?
899
+ return result
900
+ end
901
+ rescue ::Gapic::Rest::Error => e
902
+ raise ::Google::Cloud::Error.from_error(e)
903
+ end
904
+
905
+ ##
906
+ # Report and process a runtime event.
907
+ #
908
+ # @overload report_runtime_event(request, options = nil)
909
+ # Pass arguments to `report_runtime_event` via a request object, either of type
910
+ # {::Google::Cloud::Notebooks::V1::ReportRuntimeEventRequest} or an equivalent Hash.
911
+ #
912
+ # @param request [::Google::Cloud::Notebooks::V1::ReportRuntimeEventRequest, ::Hash]
913
+ # A request object representing the call parameters. Required. To specify no
914
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
915
+ # @param options [::Gapic::CallOptions, ::Hash]
916
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
917
+ #
918
+ # @overload report_runtime_event(name: nil, vm_id: nil, event: nil)
919
+ # Pass arguments to `report_runtime_event` via keyword arguments. Note that at
920
+ # least one keyword argument is required. To specify no parameters, or to keep all
921
+ # the default parameter values, pass an empty Hash as a request object (see above).
922
+ #
923
+ # @param name [::String]
924
+ # Required. Format:
925
+ # `projects/{project_id}/locations/{location}/runtimes/{runtime_id}`
926
+ # @param vm_id [::String]
927
+ # Required. The VM hardware token for authenticating the VM.
928
+ # https://cloud.google.com/compute/docs/instances/verifying-instance-identity
929
+ # @param event [::Google::Cloud::Notebooks::V1::Event, ::Hash]
930
+ # Required. The Event to be reported.
931
+ # @yield [result, operation] Access the result along with the TransportOperation object
932
+ # @yieldparam result [::Gapic::Operation]
933
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
934
+ #
935
+ # @return [::Gapic::Operation]
936
+ #
937
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
938
+ def report_runtime_event request, options = nil
939
+ raise ::ArgumentError, "request must be provided" if request.nil?
940
+
941
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Notebooks::V1::ReportRuntimeEventRequest
942
+
943
+ # Converts hash and nil to an options object
944
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
945
+
946
+ # Customize the options with defaults
947
+ call_metadata = @config.rpcs.report_runtime_event.metadata.to_h
948
+
949
+ # Set x-goog-api-client and x-goog-user-project headers
950
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
951
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
952
+ gapic_version: ::Google::Cloud::Notebooks::V1::VERSION,
953
+ transports_version_send: [:rest]
954
+
955
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
956
+
957
+ options.apply_defaults timeout: @config.rpcs.report_runtime_event.timeout,
958
+ metadata: call_metadata,
959
+ retry_policy: @config.rpcs.report_runtime_event.retry_policy
960
+
961
+ options.apply_defaults timeout: @config.timeout,
962
+ metadata: @config.metadata,
963
+ retry_policy: @config.retry_policy
964
+
965
+ @managed_notebook_service_stub.report_runtime_event request, options do |result, operation|
966
+ result = ::Gapic::Operation.new result, @operations_client, options: options
967
+ yield result, operation if block_given?
968
+ return result
969
+ end
970
+ rescue ::Gapic::Rest::Error => e
971
+ raise ::Google::Cloud::Error.from_error(e)
972
+ end
973
+
974
+ ##
975
+ # Gets an access token for the consumer service account that the customer
976
+ # attached to the runtime. Only accessible from the tenant instance.
977
+ #
978
+ # @overload refresh_runtime_token_internal(request, options = nil)
979
+ # Pass arguments to `refresh_runtime_token_internal` via a request object, either of type
980
+ # {::Google::Cloud::Notebooks::V1::RefreshRuntimeTokenInternalRequest} or an equivalent Hash.
981
+ #
982
+ # @param request [::Google::Cloud::Notebooks::V1::RefreshRuntimeTokenInternalRequest, ::Hash]
983
+ # A request object representing the call parameters. Required. To specify no
984
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
985
+ # @param options [::Gapic::CallOptions, ::Hash]
986
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
987
+ #
988
+ # @overload refresh_runtime_token_internal(name: nil, vm_id: nil)
989
+ # Pass arguments to `refresh_runtime_token_internal` via keyword arguments. Note that at
990
+ # least one keyword argument is required. To specify no parameters, or to keep all
991
+ # the default parameter values, pass an empty Hash as a request object (see above).
992
+ #
993
+ # @param name [::String]
994
+ # Required. Format:
995
+ # `projects/{project_id}/locations/{location}/runtimes/{runtime_id}`
996
+ # @param vm_id [::String]
997
+ # Required. The VM hardware token for authenticating the VM.
998
+ # https://cloud.google.com/compute/docs/instances/verifying-instance-identity
999
+ # @yield [result, operation] Access the result along with the TransportOperation object
1000
+ # @yieldparam result [::Google::Cloud::Notebooks::V1::RefreshRuntimeTokenInternalResponse]
1001
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
1002
+ #
1003
+ # @return [::Google::Cloud::Notebooks::V1::RefreshRuntimeTokenInternalResponse]
1004
+ #
1005
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
1006
+ def refresh_runtime_token_internal request, options = nil
1007
+ raise ::ArgumentError, "request must be provided" if request.nil?
1008
+
1009
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Notebooks::V1::RefreshRuntimeTokenInternalRequest
1010
+
1011
+ # Converts hash and nil to an options object
1012
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1013
+
1014
+ # Customize the options with defaults
1015
+ call_metadata = @config.rpcs.refresh_runtime_token_internal.metadata.to_h
1016
+
1017
+ # Set x-goog-api-client and x-goog-user-project headers
1018
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1019
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1020
+ gapic_version: ::Google::Cloud::Notebooks::V1::VERSION,
1021
+ transports_version_send: [:rest]
1022
+
1023
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1024
+
1025
+ options.apply_defaults timeout: @config.rpcs.refresh_runtime_token_internal.timeout,
1026
+ metadata: call_metadata,
1027
+ retry_policy: @config.rpcs.refresh_runtime_token_internal.retry_policy
1028
+
1029
+ options.apply_defaults timeout: @config.timeout,
1030
+ metadata: @config.metadata,
1031
+ retry_policy: @config.retry_policy
1032
+
1033
+ @managed_notebook_service_stub.refresh_runtime_token_internal request, options do |result, operation|
1034
+ yield result, operation if block_given?
1035
+ return result
1036
+ end
1037
+ rescue ::Gapic::Rest::Error => e
1038
+ raise ::Google::Cloud::Error.from_error(e)
1039
+ end
1040
+
1041
+ ##
1042
+ # Creates a Diagnostic File and runs Diagnostic Tool given a Runtime.
1043
+ #
1044
+ # @overload diagnose_runtime(request, options = nil)
1045
+ # Pass arguments to `diagnose_runtime` via a request object, either of type
1046
+ # {::Google::Cloud::Notebooks::V1::DiagnoseRuntimeRequest} or an equivalent Hash.
1047
+ #
1048
+ # @param request [::Google::Cloud::Notebooks::V1::DiagnoseRuntimeRequest, ::Hash]
1049
+ # A request object representing the call parameters. Required. To specify no
1050
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1051
+ # @param options [::Gapic::CallOptions, ::Hash]
1052
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
1053
+ #
1054
+ # @overload diagnose_runtime(name: nil, diagnostic_config: nil)
1055
+ # Pass arguments to `diagnose_runtime` via keyword arguments. Note that at
1056
+ # least one keyword argument is required. To specify no parameters, or to keep all
1057
+ # the default parameter values, pass an empty Hash as a request object (see above).
1058
+ #
1059
+ # @param name [::String]
1060
+ # Required. Format:
1061
+ # `projects/{project_id}/locations/{location}/runtimes/{runtimes_id}`
1062
+ # @param diagnostic_config [::Google::Cloud::Notebooks::V1::DiagnosticConfig, ::Hash]
1063
+ # Required. Defines flags that are used to run the diagnostic tool
1064
+ # @yield [result, operation] Access the result along with the TransportOperation object
1065
+ # @yieldparam result [::Gapic::Operation]
1066
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
1067
+ #
1068
+ # @return [::Gapic::Operation]
1069
+ #
1070
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
1071
+ def diagnose_runtime request, options = nil
1072
+ raise ::ArgumentError, "request must be provided" if request.nil?
1073
+
1074
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Notebooks::V1::DiagnoseRuntimeRequest
1075
+
1076
+ # Converts hash and nil to an options object
1077
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1078
+
1079
+ # Customize the options with defaults
1080
+ call_metadata = @config.rpcs.diagnose_runtime.metadata.to_h
1081
+
1082
+ # Set x-goog-api-client and x-goog-user-project headers
1083
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1084
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1085
+ gapic_version: ::Google::Cloud::Notebooks::V1::VERSION,
1086
+ transports_version_send: [:rest]
1087
+
1088
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1089
+
1090
+ options.apply_defaults timeout: @config.rpcs.diagnose_runtime.timeout,
1091
+ metadata: call_metadata,
1092
+ retry_policy: @config.rpcs.diagnose_runtime.retry_policy
1093
+
1094
+ options.apply_defaults timeout: @config.timeout,
1095
+ metadata: @config.metadata,
1096
+ retry_policy: @config.retry_policy
1097
+
1098
+ @managed_notebook_service_stub.diagnose_runtime request, options do |result, operation|
1099
+ result = ::Gapic::Operation.new result, @operations_client, options: options
1100
+ yield result, operation if block_given?
1101
+ return result
1102
+ end
1103
+ rescue ::Gapic::Rest::Error => e
1104
+ raise ::Google::Cloud::Error.from_error(e)
1105
+ end
1106
+
1107
+ ##
1108
+ # Configuration class for the ManagedNotebookService REST API.
1109
+ #
1110
+ # This class represents the configuration for ManagedNotebookService REST,
1111
+ # providing control over timeouts, retry behavior, logging, transport
1112
+ # parameters, and other low-level controls. Certain parameters can also be
1113
+ # applied individually to specific RPCs. See
1114
+ # {::Google::Cloud::Notebooks::V1::ManagedNotebookService::Rest::Client::Configuration::Rpcs}
1115
+ # for a list of RPCs that can be configured independently.
1116
+ #
1117
+ # Configuration can be applied globally to all clients, or to a single client
1118
+ # on construction.
1119
+ #
1120
+ # @example
1121
+ #
1122
+ # # Modify the global config, setting the timeout for
1123
+ # # list_runtimes to 20 seconds,
1124
+ # # and all remaining timeouts to 10 seconds.
1125
+ # ::Google::Cloud::Notebooks::V1::ManagedNotebookService::Rest::Client.configure do |config|
1126
+ # config.timeout = 10.0
1127
+ # config.rpcs.list_runtimes.timeout = 20.0
1128
+ # end
1129
+ #
1130
+ # # Apply the above configuration only to a new client.
1131
+ # client = ::Google::Cloud::Notebooks::V1::ManagedNotebookService::Rest::Client.new do |config|
1132
+ # config.timeout = 10.0
1133
+ # config.rpcs.list_runtimes.timeout = 20.0
1134
+ # end
1135
+ #
1136
+ # @!attribute [rw] endpoint
1137
+ # The hostname or hostname:port of the service endpoint.
1138
+ # Defaults to `"notebooks.googleapis.com"`.
1139
+ # @return [::String]
1140
+ # @!attribute [rw] credentials
1141
+ # Credentials to send with calls. You may provide any of the following types:
1142
+ # * (`String`) The path to a service account key file in JSON format
1143
+ # * (`Hash`) A service account key as a Hash
1144
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
1145
+ # (see the [googleauth docs](https://googleapis.dev/ruby/googleauth/latest/index.html))
1146
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
1147
+ # (see the [signet docs](https://googleapis.dev/ruby/signet/latest/Signet/OAuth2/Client.html))
1148
+ # * (`nil`) indicating no credentials
1149
+ # @return [::Object]
1150
+ # @!attribute [rw] scope
1151
+ # The OAuth scopes
1152
+ # @return [::Array<::String>]
1153
+ # @!attribute [rw] lib_name
1154
+ # The library name as recorded in instrumentation and logging
1155
+ # @return [::String]
1156
+ # @!attribute [rw] lib_version
1157
+ # The library version as recorded in instrumentation and logging
1158
+ # @return [::String]
1159
+ # @!attribute [rw] timeout
1160
+ # The call timeout in seconds.
1161
+ # @return [::Numeric]
1162
+ # @!attribute [rw] metadata
1163
+ # Additional headers to be sent with the call.
1164
+ # @return [::Hash{::Symbol=>::String}]
1165
+ # @!attribute [rw] retry_policy
1166
+ # The retry policy. The value is a hash with the following keys:
1167
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
1168
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
1169
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
1170
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
1171
+ # trigger a retry.
1172
+ # @return [::Hash]
1173
+ # @!attribute [rw] quota_project
1174
+ # A separate project against which to charge quota.
1175
+ # @return [::String]
1176
+ #
1177
+ class Configuration
1178
+ extend ::Gapic::Config
1179
+
1180
+ config_attr :endpoint, "notebooks.googleapis.com", ::String
1181
+ config_attr :credentials, nil do |value|
1182
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
1183
+ allowed.any? { |klass| klass === value }
1184
+ end
1185
+ config_attr :scope, nil, ::String, ::Array, nil
1186
+ config_attr :lib_name, nil, ::String, nil
1187
+ config_attr :lib_version, nil, ::String, nil
1188
+ config_attr :timeout, nil, ::Numeric, nil
1189
+ config_attr :metadata, nil, ::Hash, nil
1190
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
1191
+ config_attr :quota_project, nil, ::String, nil
1192
+
1193
+ # @private
1194
+ # Overrides for http bindings for the RPCs of this service
1195
+ # are only used when this service is used as mixin, and only
1196
+ # by the host service.
1197
+ # @return [::Hash{::Symbol=>::Array<::Gapic::Rest::GrpcTranscoder::HttpBinding>}]
1198
+ config_attr :bindings_override, {}, ::Hash, nil
1199
+
1200
+ # @private
1201
+ def initialize parent_config = nil
1202
+ @parent_config = parent_config unless parent_config.nil?
1203
+
1204
+ yield self if block_given?
1205
+ end
1206
+
1207
+ ##
1208
+ # Configurations for individual RPCs
1209
+ # @return [Rpcs]
1210
+ #
1211
+ def rpcs
1212
+ @rpcs ||= begin
1213
+ parent_rpcs = nil
1214
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
1215
+ Rpcs.new parent_rpcs
1216
+ end
1217
+ end
1218
+
1219
+ ##
1220
+ # Configuration RPC class for the ManagedNotebookService API.
1221
+ #
1222
+ # Includes fields providing the configuration for each RPC in this service.
1223
+ # Each configuration object is of type `Gapic::Config::Method` and includes
1224
+ # the following configuration fields:
1225
+ #
1226
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
1227
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers
1228
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
1229
+ # include the following keys:
1230
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
1231
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
1232
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
1233
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
1234
+ # trigger a retry.
1235
+ #
1236
+ class Rpcs
1237
+ ##
1238
+ # RPC-specific configuration for `list_runtimes`
1239
+ # @return [::Gapic::Config::Method]
1240
+ #
1241
+ attr_reader :list_runtimes
1242
+ ##
1243
+ # RPC-specific configuration for `get_runtime`
1244
+ # @return [::Gapic::Config::Method]
1245
+ #
1246
+ attr_reader :get_runtime
1247
+ ##
1248
+ # RPC-specific configuration for `create_runtime`
1249
+ # @return [::Gapic::Config::Method]
1250
+ #
1251
+ attr_reader :create_runtime
1252
+ ##
1253
+ # RPC-specific configuration for `update_runtime`
1254
+ # @return [::Gapic::Config::Method]
1255
+ #
1256
+ attr_reader :update_runtime
1257
+ ##
1258
+ # RPC-specific configuration for `delete_runtime`
1259
+ # @return [::Gapic::Config::Method]
1260
+ #
1261
+ attr_reader :delete_runtime
1262
+ ##
1263
+ # RPC-specific configuration for `start_runtime`
1264
+ # @return [::Gapic::Config::Method]
1265
+ #
1266
+ attr_reader :start_runtime
1267
+ ##
1268
+ # RPC-specific configuration for `stop_runtime`
1269
+ # @return [::Gapic::Config::Method]
1270
+ #
1271
+ attr_reader :stop_runtime
1272
+ ##
1273
+ # RPC-specific configuration for `switch_runtime`
1274
+ # @return [::Gapic::Config::Method]
1275
+ #
1276
+ attr_reader :switch_runtime
1277
+ ##
1278
+ # RPC-specific configuration for `reset_runtime`
1279
+ # @return [::Gapic::Config::Method]
1280
+ #
1281
+ attr_reader :reset_runtime
1282
+ ##
1283
+ # RPC-specific configuration for `upgrade_runtime`
1284
+ # @return [::Gapic::Config::Method]
1285
+ #
1286
+ attr_reader :upgrade_runtime
1287
+ ##
1288
+ # RPC-specific configuration for `report_runtime_event`
1289
+ # @return [::Gapic::Config::Method]
1290
+ #
1291
+ attr_reader :report_runtime_event
1292
+ ##
1293
+ # RPC-specific configuration for `refresh_runtime_token_internal`
1294
+ # @return [::Gapic::Config::Method]
1295
+ #
1296
+ attr_reader :refresh_runtime_token_internal
1297
+ ##
1298
+ # RPC-specific configuration for `diagnose_runtime`
1299
+ # @return [::Gapic::Config::Method]
1300
+ #
1301
+ attr_reader :diagnose_runtime
1302
+
1303
+ # @private
1304
+ def initialize parent_rpcs = nil
1305
+ list_runtimes_config = parent_rpcs.list_runtimes if parent_rpcs.respond_to? :list_runtimes
1306
+ @list_runtimes = ::Gapic::Config::Method.new list_runtimes_config
1307
+ get_runtime_config = parent_rpcs.get_runtime if parent_rpcs.respond_to? :get_runtime
1308
+ @get_runtime = ::Gapic::Config::Method.new get_runtime_config
1309
+ create_runtime_config = parent_rpcs.create_runtime if parent_rpcs.respond_to? :create_runtime
1310
+ @create_runtime = ::Gapic::Config::Method.new create_runtime_config
1311
+ update_runtime_config = parent_rpcs.update_runtime if parent_rpcs.respond_to? :update_runtime
1312
+ @update_runtime = ::Gapic::Config::Method.new update_runtime_config
1313
+ delete_runtime_config = parent_rpcs.delete_runtime if parent_rpcs.respond_to? :delete_runtime
1314
+ @delete_runtime = ::Gapic::Config::Method.new delete_runtime_config
1315
+ start_runtime_config = parent_rpcs.start_runtime if parent_rpcs.respond_to? :start_runtime
1316
+ @start_runtime = ::Gapic::Config::Method.new start_runtime_config
1317
+ stop_runtime_config = parent_rpcs.stop_runtime if parent_rpcs.respond_to? :stop_runtime
1318
+ @stop_runtime = ::Gapic::Config::Method.new stop_runtime_config
1319
+ switch_runtime_config = parent_rpcs.switch_runtime if parent_rpcs.respond_to? :switch_runtime
1320
+ @switch_runtime = ::Gapic::Config::Method.new switch_runtime_config
1321
+ reset_runtime_config = parent_rpcs.reset_runtime if parent_rpcs.respond_to? :reset_runtime
1322
+ @reset_runtime = ::Gapic::Config::Method.new reset_runtime_config
1323
+ upgrade_runtime_config = parent_rpcs.upgrade_runtime if parent_rpcs.respond_to? :upgrade_runtime
1324
+ @upgrade_runtime = ::Gapic::Config::Method.new upgrade_runtime_config
1325
+ report_runtime_event_config = parent_rpcs.report_runtime_event if parent_rpcs.respond_to? :report_runtime_event
1326
+ @report_runtime_event = ::Gapic::Config::Method.new report_runtime_event_config
1327
+ refresh_runtime_token_internal_config = parent_rpcs.refresh_runtime_token_internal if parent_rpcs.respond_to? :refresh_runtime_token_internal
1328
+ @refresh_runtime_token_internal = ::Gapic::Config::Method.new refresh_runtime_token_internal_config
1329
+ diagnose_runtime_config = parent_rpcs.diagnose_runtime if parent_rpcs.respond_to? :diagnose_runtime
1330
+ @diagnose_runtime = ::Gapic::Config::Method.new diagnose_runtime_config
1331
+
1332
+ yield self if block_given?
1333
+ end
1334
+ end
1335
+ end
1336
+ end
1337
+ end
1338
+ end
1339
+ end
1340
+ end
1341
+ end
1342
+ end