google-cloud-notebooks-v2 0.a → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (43) hide show
  1. checksums.yaml +4 -4
  2. data/.yardopts +12 -0
  3. data/AUTHENTICATION.md +149 -0
  4. data/README.md +144 -8
  5. data/lib/google/cloud/notebooks/v2/bindings_override.rb +135 -0
  6. data/lib/google/cloud/notebooks/v2/diagnostic_config_pb.rb +44 -0
  7. data/lib/google/cloud/notebooks/v2/event_pb.rb +47 -0
  8. data/lib/google/cloud/notebooks/v2/gce_setup_pb.rb +57 -0
  9. data/lib/google/cloud/notebooks/v2/instance_pb.rb +54 -0
  10. data/lib/google/cloud/notebooks/v2/notebook_service/client.rb +1582 -0
  11. data/lib/google/cloud/notebooks/v2/notebook_service/credentials.rb +47 -0
  12. data/lib/google/cloud/notebooks/v2/notebook_service/operations.rb +770 -0
  13. data/lib/google/cloud/notebooks/v2/notebook_service/paths.rb +69 -0
  14. data/lib/google/cloud/notebooks/v2/notebook_service/rest/client.rb +1227 -0
  15. data/lib/google/cloud/notebooks/v2/notebook_service/rest/operations.rb +795 -0
  16. data/lib/google/cloud/notebooks/v2/notebook_service/rest/service_stub.rb +764 -0
  17. data/lib/google/cloud/notebooks/v2/notebook_service/rest.rb +54 -0
  18. data/lib/google/cloud/notebooks/v2/notebook_service.rb +56 -0
  19. data/lib/google/cloud/notebooks/v2/rest.rb +38 -0
  20. data/lib/google/cloud/notebooks/v2/service_pb.rb +71 -0
  21. data/lib/google/cloud/notebooks/v2/service_services_pb.rb +67 -0
  22. data/lib/google/cloud/notebooks/v2/version.rb +7 -2
  23. data/lib/google/cloud/notebooks/v2.rb +45 -0
  24. data/lib/google-cloud-notebooks-v2.rb +21 -0
  25. data/proto_docs/README.md +4 -0
  26. data/proto_docs/google/api/client.rb +381 -0
  27. data/proto_docs/google/api/field_behavior.rb +85 -0
  28. data/proto_docs/google/api/launch_stage.rb +71 -0
  29. data/proto_docs/google/api/resource.rb +222 -0
  30. data/proto_docs/google/cloud/notebooks/v2/diagnostic_config.rb +63 -0
  31. data/proto_docs/google/cloud/notebooks/v2/event.rb +79 -0
  32. data/proto_docs/google/cloud/notebooks/v2/gce_setup.rb +352 -0
  33. data/proto_docs/google/cloud/notebooks/v2/instance.rb +233 -0
  34. data/proto_docs/google/cloud/notebooks/v2/service.rb +263 -0
  35. data/proto_docs/google/longrunning/operations.rb +164 -0
  36. data/proto_docs/google/protobuf/any.rb +144 -0
  37. data/proto_docs/google/protobuf/duration.rb +98 -0
  38. data/proto_docs/google/protobuf/empty.rb +34 -0
  39. data/proto_docs/google/protobuf/field_mask.rb +229 -0
  40. data/proto_docs/google/protobuf/timestamp.rb +127 -0
  41. data/proto_docs/google/rpc/status.rb +48 -0
  42. data/proto_docs/google/type/expr.rb +75 -0
  43. metadata +237 -13
@@ -0,0 +1,1227 @@
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/v2/service_pb"
21
+ require "google/cloud/notebooks/v2/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 V2
29
+ module NotebookService
30
+ module Rest
31
+ ##
32
+ # REST client for the NotebookService service.
33
+ #
34
+ # API v2 service for Workbench Notebooks Instances.
35
+ #
36
+ class Client
37
+ include Paths
38
+
39
+ # @private
40
+ attr_reader :notebook_service_stub
41
+
42
+ ##
43
+ # Configure the NotebookService Client class.
44
+ #
45
+ # See {::Google::Cloud::Notebooks::V2::NotebookService::Rest::Client::Configuration}
46
+ # for a description of the configuration fields.
47
+ #
48
+ # @example
49
+ #
50
+ # # Modify the configuration for all NotebookService clients
51
+ # ::Google::Cloud::Notebooks::V2::NotebookService::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", "V2"]
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_instances.timeout = 60.0
77
+
78
+ default_config.rpcs.get_instance.timeout = 60.0
79
+
80
+ default_config.rpcs.create_instance.timeout = 60.0
81
+
82
+ default_config.rpcs.delete_instance.timeout = 60.0
83
+
84
+ default_config.rpcs.start_instance.timeout = 60.0
85
+
86
+ default_config.rpcs.stop_instance.timeout = 60.0
87
+
88
+ default_config.rpcs.reset_instance.timeout = 60.0
89
+
90
+ default_config.rpcs.upgrade_instance.timeout = 60.0
91
+
92
+ default_config.rpcs.rollback_instance.timeout = 60.0
93
+
94
+ default_config
95
+ end
96
+ yield @configure if block_given?
97
+ @configure
98
+ end
99
+
100
+ ##
101
+ # Configure the NotebookService Client instance.
102
+ #
103
+ # The configuration is set to the derived mode, meaning that values can be changed,
104
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
105
+ # should be made on {Client.configure}.
106
+ #
107
+ # See {::Google::Cloud::Notebooks::V2::NotebookService::Rest::Client::Configuration}
108
+ # for a description of the configuration fields.
109
+ #
110
+ # @yield [config] Configure the Client client.
111
+ # @yieldparam config [Client::Configuration]
112
+ #
113
+ # @return [Client::Configuration]
114
+ #
115
+ def configure
116
+ yield @config if block_given?
117
+ @config
118
+ end
119
+
120
+ ##
121
+ # Create a new NotebookService REST client object.
122
+ #
123
+ # @example
124
+ #
125
+ # # Create a client using the default configuration
126
+ # client = ::Google::Cloud::Notebooks::V2::NotebookService::Rest::Client.new
127
+ #
128
+ # # Create a client using a custom configuration
129
+ # client = ::Google::Cloud::Notebooks::V2::NotebookService::Rest::Client.new do |config|
130
+ # config.timeout = 10.0
131
+ # end
132
+ #
133
+ # @yield [config] Configure the NotebookService client.
134
+ # @yieldparam config [Client::Configuration]
135
+ #
136
+ def initialize
137
+ # Create the configuration object
138
+ @config = Configuration.new Client.configure
139
+
140
+ # Yield the configuration if needed
141
+ yield @config if block_given?
142
+
143
+ # Create credentials
144
+ credentials = @config.credentials
145
+ # Use self-signed JWT if the endpoint is unchanged from default,
146
+ # but only if the default endpoint does not have a region prefix.
147
+ enable_self_signed_jwt = @config.endpoint == Configuration::DEFAULT_ENDPOINT &&
148
+ !@config.endpoint.split(".").first.include?("-")
149
+ credentials ||= Credentials.default scope: @config.scope,
150
+ enable_self_signed_jwt: enable_self_signed_jwt
151
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
152
+ credentials = Credentials.new credentials, scope: @config.scope
153
+ end
154
+
155
+ @quota_project_id = @config.quota_project
156
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
157
+
158
+ @operations_client = ::Google::Cloud::Notebooks::V2::NotebookService::Rest::Operations.new do |config|
159
+ config.credentials = credentials
160
+ config.quota_project = @quota_project_id
161
+ config.endpoint = @config.endpoint
162
+ end
163
+
164
+ @location_client = Google::Cloud::Location::Locations::Rest::Client.new do |config|
165
+ config.credentials = credentials
166
+ config.quota_project = @quota_project_id
167
+ config.endpoint = @config.endpoint
168
+ config.bindings_override = @config.bindings_override
169
+ end
170
+
171
+ @iam_policy_client = Google::Iam::V1::IAMPolicy::Rest::Client.new do |config|
172
+ config.credentials = credentials
173
+ config.quota_project = @quota_project_id
174
+ config.endpoint = @config.endpoint
175
+ config.bindings_override = @config.bindings_override
176
+ end
177
+
178
+ @notebook_service_stub = ::Google::Cloud::Notebooks::V2::NotebookService::Rest::ServiceStub.new endpoint: @config.endpoint, credentials: credentials
179
+ end
180
+
181
+ ##
182
+ # Get the associated client for long-running operations.
183
+ #
184
+ # @return [::Google::Cloud::Notebooks::V2::NotebookService::Rest::Operations]
185
+ #
186
+ attr_reader :operations_client
187
+
188
+ ##
189
+ # Get the associated client for mix-in of the Locations.
190
+ #
191
+ # @return [Google::Cloud::Location::Locations::Rest::Client]
192
+ #
193
+ attr_reader :location_client
194
+
195
+ ##
196
+ # Get the associated client for mix-in of the IAMPolicy.
197
+ #
198
+ # @return [Google::Iam::V1::IAMPolicy::Rest::Client]
199
+ #
200
+ attr_reader :iam_policy_client
201
+
202
+ # Service calls
203
+
204
+ ##
205
+ # Lists instances in a given project and location.
206
+ #
207
+ # @overload list_instances(request, options = nil)
208
+ # Pass arguments to `list_instances` via a request object, either of type
209
+ # {::Google::Cloud::Notebooks::V2::ListInstancesRequest} or an equivalent Hash.
210
+ #
211
+ # @param request [::Google::Cloud::Notebooks::V2::ListInstancesRequest, ::Hash]
212
+ # A request object representing the call parameters. Required. To specify no
213
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
214
+ # @param options [::Gapic::CallOptions, ::Hash]
215
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
216
+ #
217
+ # @overload list_instances(parent: nil, page_size: nil, page_token: nil, order_by: nil, filter: nil)
218
+ # Pass arguments to `list_instances` via keyword arguments. Note that at
219
+ # least one keyword argument is required. To specify no parameters, or to keep all
220
+ # the default parameter values, pass an empty Hash as a request object (see above).
221
+ #
222
+ # @param parent [::String]
223
+ # Required. Format:
224
+ # `parent=projects/{project_id}/locations/{location}`
225
+ # @param page_size [::Integer]
226
+ # Optional. Maximum return size of the list call.
227
+ # @param page_token [::String]
228
+ # Optional. A previous returned page token that can be used to continue
229
+ # listing from the last result.
230
+ # @param order_by [::String]
231
+ # Optional. Sort results. Supported values are "name", "name desc" or ""
232
+ # (unsorted).
233
+ # @param filter [::String]
234
+ # Optional. List filter.
235
+ # @yield [result, operation] Access the result along with the TransportOperation object
236
+ # @yieldparam result [::Google::Cloud::Notebooks::V2::ListInstancesResponse]
237
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
238
+ #
239
+ # @return [::Google::Cloud::Notebooks::V2::ListInstancesResponse]
240
+ #
241
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
242
+ def list_instances request, options = nil
243
+ raise ::ArgumentError, "request must be provided" if request.nil?
244
+
245
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Notebooks::V2::ListInstancesRequest
246
+
247
+ # Converts hash and nil to an options object
248
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
249
+
250
+ # Customize the options with defaults
251
+ call_metadata = @config.rpcs.list_instances.metadata.to_h
252
+
253
+ # Set x-goog-api-client and x-goog-user-project headers
254
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
255
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
256
+ gapic_version: ::Google::Cloud::Notebooks::V2::VERSION,
257
+ transports_version_send: [:rest]
258
+
259
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
260
+
261
+ options.apply_defaults timeout: @config.rpcs.list_instances.timeout,
262
+ metadata: call_metadata,
263
+ retry_policy: @config.rpcs.list_instances.retry_policy
264
+
265
+ options.apply_defaults timeout: @config.timeout,
266
+ metadata: @config.metadata,
267
+ retry_policy: @config.retry_policy
268
+
269
+ @notebook_service_stub.list_instances request, options do |result, operation|
270
+ yield result, operation if block_given?
271
+ return result
272
+ end
273
+ rescue ::Gapic::Rest::Error => e
274
+ raise ::Google::Cloud::Error.from_error(e)
275
+ end
276
+
277
+ ##
278
+ # Gets details of a single Instance.
279
+ #
280
+ # @overload get_instance(request, options = nil)
281
+ # Pass arguments to `get_instance` via a request object, either of type
282
+ # {::Google::Cloud::Notebooks::V2::GetInstanceRequest} or an equivalent Hash.
283
+ #
284
+ # @param request [::Google::Cloud::Notebooks::V2::GetInstanceRequest, ::Hash]
285
+ # A request object representing the call parameters. Required. To specify no
286
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
287
+ # @param options [::Gapic::CallOptions, ::Hash]
288
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
289
+ #
290
+ # @overload get_instance(name: nil)
291
+ # Pass arguments to `get_instance` via keyword arguments. Note that at
292
+ # least one keyword argument is required. To specify no parameters, or to keep all
293
+ # the default parameter values, pass an empty Hash as a request object (see above).
294
+ #
295
+ # @param name [::String]
296
+ # Required. Format:
297
+ # `projects/{project_id}/locations/{location}/instances/{instance_id}`
298
+ # @yield [result, operation] Access the result along with the TransportOperation object
299
+ # @yieldparam result [::Google::Cloud::Notebooks::V2::Instance]
300
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
301
+ #
302
+ # @return [::Google::Cloud::Notebooks::V2::Instance]
303
+ #
304
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
305
+ def get_instance request, options = nil
306
+ raise ::ArgumentError, "request must be provided" if request.nil?
307
+
308
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Notebooks::V2::GetInstanceRequest
309
+
310
+ # Converts hash and nil to an options object
311
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
312
+
313
+ # Customize the options with defaults
314
+ call_metadata = @config.rpcs.get_instance.metadata.to_h
315
+
316
+ # Set x-goog-api-client and x-goog-user-project headers
317
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
318
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
319
+ gapic_version: ::Google::Cloud::Notebooks::V2::VERSION,
320
+ transports_version_send: [:rest]
321
+
322
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
323
+
324
+ options.apply_defaults timeout: @config.rpcs.get_instance.timeout,
325
+ metadata: call_metadata,
326
+ retry_policy: @config.rpcs.get_instance.retry_policy
327
+
328
+ options.apply_defaults timeout: @config.timeout,
329
+ metadata: @config.metadata,
330
+ retry_policy: @config.retry_policy
331
+
332
+ @notebook_service_stub.get_instance request, options do |result, operation|
333
+ yield result, operation if block_given?
334
+ return result
335
+ end
336
+ rescue ::Gapic::Rest::Error => e
337
+ raise ::Google::Cloud::Error.from_error(e)
338
+ end
339
+
340
+ ##
341
+ # Creates a new Instance in a given project and location.
342
+ #
343
+ # @overload create_instance(request, options = nil)
344
+ # Pass arguments to `create_instance` via a request object, either of type
345
+ # {::Google::Cloud::Notebooks::V2::CreateInstanceRequest} or an equivalent Hash.
346
+ #
347
+ # @param request [::Google::Cloud::Notebooks::V2::CreateInstanceRequest, ::Hash]
348
+ # A request object representing the call parameters. Required. To specify no
349
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
350
+ # @param options [::Gapic::CallOptions, ::Hash]
351
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
352
+ #
353
+ # @overload create_instance(parent: nil, instance_id: nil, instance: nil, request_id: nil)
354
+ # Pass arguments to `create_instance` via keyword arguments. Note that at
355
+ # least one keyword argument is required. To specify no parameters, or to keep all
356
+ # the default parameter values, pass an empty Hash as a request object (see above).
357
+ #
358
+ # @param parent [::String]
359
+ # Required. Format:
360
+ # `parent=projects/{project_id}/locations/{location}`
361
+ # @param instance_id [::String]
362
+ # Required. User-defined unique ID of this instance.
363
+ # @param instance [::Google::Cloud::Notebooks::V2::Instance, ::Hash]
364
+ # Required. The instance to be created.
365
+ # @param request_id [::String]
366
+ # Optional. Idempotent request UUID.
367
+ # @yield [result, operation] Access the result along with the TransportOperation object
368
+ # @yieldparam result [::Gapic::Operation]
369
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
370
+ #
371
+ # @return [::Gapic::Operation]
372
+ #
373
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
374
+ def create_instance request, options = nil
375
+ raise ::ArgumentError, "request must be provided" if request.nil?
376
+
377
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Notebooks::V2::CreateInstanceRequest
378
+
379
+ # Converts hash and nil to an options object
380
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
381
+
382
+ # Customize the options with defaults
383
+ call_metadata = @config.rpcs.create_instance.metadata.to_h
384
+
385
+ # Set x-goog-api-client and x-goog-user-project headers
386
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
387
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
388
+ gapic_version: ::Google::Cloud::Notebooks::V2::VERSION,
389
+ transports_version_send: [:rest]
390
+
391
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
392
+
393
+ options.apply_defaults timeout: @config.rpcs.create_instance.timeout,
394
+ metadata: call_metadata,
395
+ retry_policy: @config.rpcs.create_instance.retry_policy
396
+
397
+ options.apply_defaults timeout: @config.timeout,
398
+ metadata: @config.metadata,
399
+ retry_policy: @config.retry_policy
400
+
401
+ @notebook_service_stub.create_instance request, options do |result, operation|
402
+ result = ::Gapic::Operation.new result, @operations_client, options: options
403
+ yield result, operation if block_given?
404
+ return result
405
+ end
406
+ rescue ::Gapic::Rest::Error => e
407
+ raise ::Google::Cloud::Error.from_error(e)
408
+ end
409
+
410
+ ##
411
+ # UpdateInstance updates an Instance.
412
+ #
413
+ # @overload update_instance(request, options = nil)
414
+ # Pass arguments to `update_instance` via a request object, either of type
415
+ # {::Google::Cloud::Notebooks::V2::UpdateInstanceRequest} or an equivalent Hash.
416
+ #
417
+ # @param request [::Google::Cloud::Notebooks::V2::UpdateInstanceRequest, ::Hash]
418
+ # A request object representing the call parameters. Required. To specify no
419
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
420
+ # @param options [::Gapic::CallOptions, ::Hash]
421
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
422
+ #
423
+ # @overload update_instance(instance: nil, update_mask: nil, request_id: nil)
424
+ # Pass arguments to `update_instance` via keyword arguments. Note that at
425
+ # least one keyword argument is required. To specify no parameters, or to keep all
426
+ # the default parameter values, pass an empty Hash as a request object (see above).
427
+ #
428
+ # @param instance [::Google::Cloud::Notebooks::V2::Instance, ::Hash]
429
+ # Required. A representation of an instance.
430
+ # @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
431
+ # Required. Mask used to update an instance
432
+ # @param request_id [::String]
433
+ # Optional. Idempotent request UUID.
434
+ # @yield [result, operation] Access the result along with the TransportOperation object
435
+ # @yieldparam result [::Gapic::Operation]
436
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
437
+ #
438
+ # @return [::Gapic::Operation]
439
+ #
440
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
441
+ def update_instance request, options = nil
442
+ raise ::ArgumentError, "request must be provided" if request.nil?
443
+
444
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Notebooks::V2::UpdateInstanceRequest
445
+
446
+ # Converts hash and nil to an options object
447
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
448
+
449
+ # Customize the options with defaults
450
+ call_metadata = @config.rpcs.update_instance.metadata.to_h
451
+
452
+ # Set x-goog-api-client and x-goog-user-project headers
453
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
454
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
455
+ gapic_version: ::Google::Cloud::Notebooks::V2::VERSION,
456
+ transports_version_send: [:rest]
457
+
458
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
459
+
460
+ options.apply_defaults timeout: @config.rpcs.update_instance.timeout,
461
+ metadata: call_metadata,
462
+ retry_policy: @config.rpcs.update_instance.retry_policy
463
+
464
+ options.apply_defaults timeout: @config.timeout,
465
+ metadata: @config.metadata,
466
+ retry_policy: @config.retry_policy
467
+
468
+ @notebook_service_stub.update_instance request, options do |result, operation|
469
+ result = ::Gapic::Operation.new result, @operations_client, options: options
470
+ yield result, operation if block_given?
471
+ return result
472
+ end
473
+ rescue ::Gapic::Rest::Error => e
474
+ raise ::Google::Cloud::Error.from_error(e)
475
+ end
476
+
477
+ ##
478
+ # Deletes a single Instance.
479
+ #
480
+ # @overload delete_instance(request, options = nil)
481
+ # Pass arguments to `delete_instance` via a request object, either of type
482
+ # {::Google::Cloud::Notebooks::V2::DeleteInstanceRequest} or an equivalent Hash.
483
+ #
484
+ # @param request [::Google::Cloud::Notebooks::V2::DeleteInstanceRequest, ::Hash]
485
+ # A request object representing the call parameters. Required. To specify no
486
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
487
+ # @param options [::Gapic::CallOptions, ::Hash]
488
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
489
+ #
490
+ # @overload delete_instance(name: nil, request_id: nil)
491
+ # Pass arguments to `delete_instance` via keyword arguments. Note that at
492
+ # least one keyword argument is required. To specify no parameters, or to keep all
493
+ # the default parameter values, pass an empty Hash as a request object (see above).
494
+ #
495
+ # @param name [::String]
496
+ # Required. Format:
497
+ # `projects/{project_id}/locations/{location}/instances/{instance_id}`
498
+ # @param request_id [::String]
499
+ # Optional. Idempotent request UUID.
500
+ # @yield [result, operation] Access the result along with the TransportOperation object
501
+ # @yieldparam result [::Gapic::Operation]
502
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
503
+ #
504
+ # @return [::Gapic::Operation]
505
+ #
506
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
507
+ def delete_instance request, options = nil
508
+ raise ::ArgumentError, "request must be provided" if request.nil?
509
+
510
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Notebooks::V2::DeleteInstanceRequest
511
+
512
+ # Converts hash and nil to an options object
513
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
514
+
515
+ # Customize the options with defaults
516
+ call_metadata = @config.rpcs.delete_instance.metadata.to_h
517
+
518
+ # Set x-goog-api-client and x-goog-user-project headers
519
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
520
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
521
+ gapic_version: ::Google::Cloud::Notebooks::V2::VERSION,
522
+ transports_version_send: [:rest]
523
+
524
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
525
+
526
+ options.apply_defaults timeout: @config.rpcs.delete_instance.timeout,
527
+ metadata: call_metadata,
528
+ retry_policy: @config.rpcs.delete_instance.retry_policy
529
+
530
+ options.apply_defaults timeout: @config.timeout,
531
+ metadata: @config.metadata,
532
+ retry_policy: @config.retry_policy
533
+
534
+ @notebook_service_stub.delete_instance request, options do |result, operation|
535
+ result = ::Gapic::Operation.new result, @operations_client, options: options
536
+ yield result, operation if block_given?
537
+ return result
538
+ end
539
+ rescue ::Gapic::Rest::Error => e
540
+ raise ::Google::Cloud::Error.from_error(e)
541
+ end
542
+
543
+ ##
544
+ # Starts a notebook instance.
545
+ #
546
+ # @overload start_instance(request, options = nil)
547
+ # Pass arguments to `start_instance` via a request object, either of type
548
+ # {::Google::Cloud::Notebooks::V2::StartInstanceRequest} or an equivalent Hash.
549
+ #
550
+ # @param request [::Google::Cloud::Notebooks::V2::StartInstanceRequest, ::Hash]
551
+ # A request object representing the call parameters. Required. To specify no
552
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
553
+ # @param options [::Gapic::CallOptions, ::Hash]
554
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
555
+ #
556
+ # @overload start_instance(name: nil)
557
+ # Pass arguments to `start_instance` via keyword arguments. Note that at
558
+ # least one keyword argument is required. To specify no parameters, or to keep all
559
+ # the default parameter values, pass an empty Hash as a request object (see above).
560
+ #
561
+ # @param name [::String]
562
+ # Required. Format:
563
+ # `projects/{project_id}/locations/{location}/instances/{instance_id}`
564
+ # @yield [result, operation] Access the result along with the TransportOperation object
565
+ # @yieldparam result [::Gapic::Operation]
566
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
567
+ #
568
+ # @return [::Gapic::Operation]
569
+ #
570
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
571
+ def start_instance request, options = nil
572
+ raise ::ArgumentError, "request must be provided" if request.nil?
573
+
574
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Notebooks::V2::StartInstanceRequest
575
+
576
+ # Converts hash and nil to an options object
577
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
578
+
579
+ # Customize the options with defaults
580
+ call_metadata = @config.rpcs.start_instance.metadata.to_h
581
+
582
+ # Set x-goog-api-client and x-goog-user-project headers
583
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
584
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
585
+ gapic_version: ::Google::Cloud::Notebooks::V2::VERSION,
586
+ transports_version_send: [:rest]
587
+
588
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
589
+
590
+ options.apply_defaults timeout: @config.rpcs.start_instance.timeout,
591
+ metadata: call_metadata,
592
+ retry_policy: @config.rpcs.start_instance.retry_policy
593
+
594
+ options.apply_defaults timeout: @config.timeout,
595
+ metadata: @config.metadata,
596
+ retry_policy: @config.retry_policy
597
+
598
+ @notebook_service_stub.start_instance request, options do |result, operation|
599
+ result = ::Gapic::Operation.new result, @operations_client, options: options
600
+ yield result, operation if block_given?
601
+ return result
602
+ end
603
+ rescue ::Gapic::Rest::Error => e
604
+ raise ::Google::Cloud::Error.from_error(e)
605
+ end
606
+
607
+ ##
608
+ # Stops a notebook instance.
609
+ #
610
+ # @overload stop_instance(request, options = nil)
611
+ # Pass arguments to `stop_instance` via a request object, either of type
612
+ # {::Google::Cloud::Notebooks::V2::StopInstanceRequest} or an equivalent Hash.
613
+ #
614
+ # @param request [::Google::Cloud::Notebooks::V2::StopInstanceRequest, ::Hash]
615
+ # A request object representing the call parameters. Required. To specify no
616
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
617
+ # @param options [::Gapic::CallOptions, ::Hash]
618
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
619
+ #
620
+ # @overload stop_instance(name: nil)
621
+ # Pass arguments to `stop_instance` via keyword arguments. Note that at
622
+ # least one keyword argument is required. To specify no parameters, or to keep all
623
+ # the default parameter values, pass an empty Hash as a request object (see above).
624
+ #
625
+ # @param name [::String]
626
+ # Required. Format:
627
+ # `projects/{project_id}/locations/{location}/instances/{instance_id}`
628
+ # @yield [result, operation] Access the result along with the TransportOperation object
629
+ # @yieldparam result [::Gapic::Operation]
630
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
631
+ #
632
+ # @return [::Gapic::Operation]
633
+ #
634
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
635
+ def stop_instance request, options = nil
636
+ raise ::ArgumentError, "request must be provided" if request.nil?
637
+
638
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Notebooks::V2::StopInstanceRequest
639
+
640
+ # Converts hash and nil to an options object
641
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
642
+
643
+ # Customize the options with defaults
644
+ call_metadata = @config.rpcs.stop_instance.metadata.to_h
645
+
646
+ # Set x-goog-api-client and x-goog-user-project headers
647
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
648
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
649
+ gapic_version: ::Google::Cloud::Notebooks::V2::VERSION,
650
+ transports_version_send: [:rest]
651
+
652
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
653
+
654
+ options.apply_defaults timeout: @config.rpcs.stop_instance.timeout,
655
+ metadata: call_metadata,
656
+ retry_policy: @config.rpcs.stop_instance.retry_policy
657
+
658
+ options.apply_defaults timeout: @config.timeout,
659
+ metadata: @config.metadata,
660
+ retry_policy: @config.retry_policy
661
+
662
+ @notebook_service_stub.stop_instance request, options do |result, operation|
663
+ result = ::Gapic::Operation.new result, @operations_client, options: options
664
+ yield result, operation if block_given?
665
+ return result
666
+ end
667
+ rescue ::Gapic::Rest::Error => e
668
+ raise ::Google::Cloud::Error.from_error(e)
669
+ end
670
+
671
+ ##
672
+ # Resets a notebook instance.
673
+ #
674
+ # @overload reset_instance(request, options = nil)
675
+ # Pass arguments to `reset_instance` via a request object, either of type
676
+ # {::Google::Cloud::Notebooks::V2::ResetInstanceRequest} or an equivalent Hash.
677
+ #
678
+ # @param request [::Google::Cloud::Notebooks::V2::ResetInstanceRequest, ::Hash]
679
+ # A request object representing the call parameters. Required. To specify no
680
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
681
+ # @param options [::Gapic::CallOptions, ::Hash]
682
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
683
+ #
684
+ # @overload reset_instance(name: nil)
685
+ # Pass arguments to `reset_instance` via keyword arguments. Note that at
686
+ # least one keyword argument is required. To specify no parameters, or to keep all
687
+ # the default parameter values, pass an empty Hash as a request object (see above).
688
+ #
689
+ # @param name [::String]
690
+ # Required. Format:
691
+ # `projects/{project_id}/locations/{location}/instances/{instance_id}`
692
+ # @yield [result, operation] Access the result along with the TransportOperation object
693
+ # @yieldparam result [::Gapic::Operation]
694
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
695
+ #
696
+ # @return [::Gapic::Operation]
697
+ #
698
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
699
+ def reset_instance request, options = nil
700
+ raise ::ArgumentError, "request must be provided" if request.nil?
701
+
702
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Notebooks::V2::ResetInstanceRequest
703
+
704
+ # Converts hash and nil to an options object
705
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
706
+
707
+ # Customize the options with defaults
708
+ call_metadata = @config.rpcs.reset_instance.metadata.to_h
709
+
710
+ # Set x-goog-api-client and x-goog-user-project headers
711
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
712
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
713
+ gapic_version: ::Google::Cloud::Notebooks::V2::VERSION,
714
+ transports_version_send: [:rest]
715
+
716
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
717
+
718
+ options.apply_defaults timeout: @config.rpcs.reset_instance.timeout,
719
+ metadata: call_metadata,
720
+ retry_policy: @config.rpcs.reset_instance.retry_policy
721
+
722
+ options.apply_defaults timeout: @config.timeout,
723
+ metadata: @config.metadata,
724
+ retry_policy: @config.retry_policy
725
+
726
+ @notebook_service_stub.reset_instance request, options do |result, operation|
727
+ result = ::Gapic::Operation.new result, @operations_client, options: options
728
+ yield result, operation if block_given?
729
+ return result
730
+ end
731
+ rescue ::Gapic::Rest::Error => e
732
+ raise ::Google::Cloud::Error.from_error(e)
733
+ end
734
+
735
+ ##
736
+ # Checks whether a notebook instance is upgradable.
737
+ #
738
+ # @overload check_instance_upgradability(request, options = nil)
739
+ # Pass arguments to `check_instance_upgradability` via a request object, either of type
740
+ # {::Google::Cloud::Notebooks::V2::CheckInstanceUpgradabilityRequest} or an equivalent Hash.
741
+ #
742
+ # @param request [::Google::Cloud::Notebooks::V2::CheckInstanceUpgradabilityRequest, ::Hash]
743
+ # A request object representing the call parameters. Required. To specify no
744
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
745
+ # @param options [::Gapic::CallOptions, ::Hash]
746
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
747
+ #
748
+ # @overload check_instance_upgradability(notebook_instance: nil)
749
+ # Pass arguments to `check_instance_upgradability` via keyword arguments. Note that at
750
+ # least one keyword argument is required. To specify no parameters, or to keep all
751
+ # the default parameter values, pass an empty Hash as a request object (see above).
752
+ #
753
+ # @param notebook_instance [::String]
754
+ # Required. Format:
755
+ # `projects/{project_id}/locations/{location}/instances/{instance_id}`
756
+ # @yield [result, operation] Access the result along with the TransportOperation object
757
+ # @yieldparam result [::Google::Cloud::Notebooks::V2::CheckInstanceUpgradabilityResponse]
758
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
759
+ #
760
+ # @return [::Google::Cloud::Notebooks::V2::CheckInstanceUpgradabilityResponse]
761
+ #
762
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
763
+ def check_instance_upgradability request, options = nil
764
+ raise ::ArgumentError, "request must be provided" if request.nil?
765
+
766
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Notebooks::V2::CheckInstanceUpgradabilityRequest
767
+
768
+ # Converts hash and nil to an options object
769
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
770
+
771
+ # Customize the options with defaults
772
+ call_metadata = @config.rpcs.check_instance_upgradability.metadata.to_h
773
+
774
+ # Set x-goog-api-client and x-goog-user-project headers
775
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
776
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
777
+ gapic_version: ::Google::Cloud::Notebooks::V2::VERSION,
778
+ transports_version_send: [:rest]
779
+
780
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
781
+
782
+ options.apply_defaults timeout: @config.rpcs.check_instance_upgradability.timeout,
783
+ metadata: call_metadata,
784
+ retry_policy: @config.rpcs.check_instance_upgradability.retry_policy
785
+
786
+ options.apply_defaults timeout: @config.timeout,
787
+ metadata: @config.metadata,
788
+ retry_policy: @config.retry_policy
789
+
790
+ @notebook_service_stub.check_instance_upgradability request, options do |result, operation|
791
+ yield result, operation if block_given?
792
+ return result
793
+ end
794
+ rescue ::Gapic::Rest::Error => e
795
+ raise ::Google::Cloud::Error.from_error(e)
796
+ end
797
+
798
+ ##
799
+ # Upgrades a notebook instance to the latest version.
800
+ #
801
+ # @overload upgrade_instance(request, options = nil)
802
+ # Pass arguments to `upgrade_instance` via a request object, either of type
803
+ # {::Google::Cloud::Notebooks::V2::UpgradeInstanceRequest} or an equivalent Hash.
804
+ #
805
+ # @param request [::Google::Cloud::Notebooks::V2::UpgradeInstanceRequest, ::Hash]
806
+ # A request object representing the call parameters. Required. To specify no
807
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
808
+ # @param options [::Gapic::CallOptions, ::Hash]
809
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
810
+ #
811
+ # @overload upgrade_instance(name: nil)
812
+ # Pass arguments to `upgrade_instance` via keyword arguments. Note that at
813
+ # least one keyword argument is required. To specify no parameters, or to keep all
814
+ # the default parameter values, pass an empty Hash as a request object (see above).
815
+ #
816
+ # @param name [::String]
817
+ # Required. Format:
818
+ # `projects/{project_id}/locations/{location}/instances/{instance_id}`
819
+ # @yield [result, operation] Access the result along with the TransportOperation object
820
+ # @yieldparam result [::Gapic::Operation]
821
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
822
+ #
823
+ # @return [::Gapic::Operation]
824
+ #
825
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
826
+ def upgrade_instance request, options = nil
827
+ raise ::ArgumentError, "request must be provided" if request.nil?
828
+
829
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Notebooks::V2::UpgradeInstanceRequest
830
+
831
+ # Converts hash and nil to an options object
832
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
833
+
834
+ # Customize the options with defaults
835
+ call_metadata = @config.rpcs.upgrade_instance.metadata.to_h
836
+
837
+ # Set x-goog-api-client and x-goog-user-project headers
838
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
839
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
840
+ gapic_version: ::Google::Cloud::Notebooks::V2::VERSION,
841
+ transports_version_send: [:rest]
842
+
843
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
844
+
845
+ options.apply_defaults timeout: @config.rpcs.upgrade_instance.timeout,
846
+ metadata: call_metadata,
847
+ retry_policy: @config.rpcs.upgrade_instance.retry_policy
848
+
849
+ options.apply_defaults timeout: @config.timeout,
850
+ metadata: @config.metadata,
851
+ retry_policy: @config.retry_policy
852
+
853
+ @notebook_service_stub.upgrade_instance request, options do |result, operation|
854
+ result = ::Gapic::Operation.new result, @operations_client, options: options
855
+ yield result, operation if block_given?
856
+ return result
857
+ end
858
+ rescue ::Gapic::Rest::Error => e
859
+ raise ::Google::Cloud::Error.from_error(e)
860
+ end
861
+
862
+ ##
863
+ # Rollbacks a notebook instance to the previous version.
864
+ #
865
+ # @overload rollback_instance(request, options = nil)
866
+ # Pass arguments to `rollback_instance` via a request object, either of type
867
+ # {::Google::Cloud::Notebooks::V2::RollbackInstanceRequest} or an equivalent Hash.
868
+ #
869
+ # @param request [::Google::Cloud::Notebooks::V2::RollbackInstanceRequest, ::Hash]
870
+ # A request object representing the call parameters. Required. To specify no
871
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
872
+ # @param options [::Gapic::CallOptions, ::Hash]
873
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
874
+ #
875
+ # @overload rollback_instance(name: nil, target_snapshot: nil)
876
+ # Pass arguments to `rollback_instance` via keyword arguments. Note that at
877
+ # least one keyword argument is required. To specify no parameters, or to keep all
878
+ # the default parameter values, pass an empty Hash as a request object (see above).
879
+ #
880
+ # @param name [::String]
881
+ # Required. Format:
882
+ # `projects/{project_id}/locations/{location}/instances/{instance_id}`
883
+ # @param target_snapshot [::String]
884
+ # Required. The snapshot for rollback.
885
+ # Example: "projects/test-project/global/snapshots/krwlzipynril".
886
+ # @yield [result, operation] Access the result along with the TransportOperation object
887
+ # @yieldparam result [::Gapic::Operation]
888
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
889
+ #
890
+ # @return [::Gapic::Operation]
891
+ #
892
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
893
+ def rollback_instance request, options = nil
894
+ raise ::ArgumentError, "request must be provided" if request.nil?
895
+
896
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Notebooks::V2::RollbackInstanceRequest
897
+
898
+ # Converts hash and nil to an options object
899
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
900
+
901
+ # Customize the options with defaults
902
+ call_metadata = @config.rpcs.rollback_instance.metadata.to_h
903
+
904
+ # Set x-goog-api-client and x-goog-user-project headers
905
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
906
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
907
+ gapic_version: ::Google::Cloud::Notebooks::V2::VERSION,
908
+ transports_version_send: [:rest]
909
+
910
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
911
+
912
+ options.apply_defaults timeout: @config.rpcs.rollback_instance.timeout,
913
+ metadata: call_metadata,
914
+ retry_policy: @config.rpcs.rollback_instance.retry_policy
915
+
916
+ options.apply_defaults timeout: @config.timeout,
917
+ metadata: @config.metadata,
918
+ retry_policy: @config.retry_policy
919
+
920
+ @notebook_service_stub.rollback_instance request, options do |result, operation|
921
+ result = ::Gapic::Operation.new result, @operations_client, options: options
922
+ yield result, operation if block_given?
923
+ return result
924
+ end
925
+ rescue ::Gapic::Rest::Error => e
926
+ raise ::Google::Cloud::Error.from_error(e)
927
+ end
928
+
929
+ ##
930
+ # Creates a Diagnostic File and runs Diagnostic Tool given an Instance.
931
+ #
932
+ # @overload diagnose_instance(request, options = nil)
933
+ # Pass arguments to `diagnose_instance` via a request object, either of type
934
+ # {::Google::Cloud::Notebooks::V2::DiagnoseInstanceRequest} or an equivalent Hash.
935
+ #
936
+ # @param request [::Google::Cloud::Notebooks::V2::DiagnoseInstanceRequest, ::Hash]
937
+ # A request object representing the call parameters. Required. To specify no
938
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
939
+ # @param options [::Gapic::CallOptions, ::Hash]
940
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
941
+ #
942
+ # @overload diagnose_instance(name: nil, diagnostic_config: nil, timeout_minutes: nil)
943
+ # Pass arguments to `diagnose_instance` via keyword arguments. Note that at
944
+ # least one keyword argument is required. To specify no parameters, or to keep all
945
+ # the default parameter values, pass an empty Hash as a request object (see above).
946
+ #
947
+ # @param name [::String]
948
+ # Required. Format:
949
+ # `projects/{project_id}/locations/{location}/instances/{instance_id}`
950
+ # @param diagnostic_config [::Google::Cloud::Notebooks::V2::DiagnosticConfig, ::Hash]
951
+ # Required. Defines flags that are used to run the diagnostic tool
952
+ # @param timeout_minutes [::Integer]
953
+ # Optional. Maxmium amount of time in minutes before the operation times out.
954
+ # @yield [result, operation] Access the result along with the TransportOperation object
955
+ # @yieldparam result [::Gapic::Operation]
956
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
957
+ #
958
+ # @return [::Gapic::Operation]
959
+ #
960
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
961
+ def diagnose_instance request, options = nil
962
+ raise ::ArgumentError, "request must be provided" if request.nil?
963
+
964
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Notebooks::V2::DiagnoseInstanceRequest
965
+
966
+ # Converts hash and nil to an options object
967
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
968
+
969
+ # Customize the options with defaults
970
+ call_metadata = @config.rpcs.diagnose_instance.metadata.to_h
971
+
972
+ # Set x-goog-api-client and x-goog-user-project headers
973
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
974
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
975
+ gapic_version: ::Google::Cloud::Notebooks::V2::VERSION,
976
+ transports_version_send: [:rest]
977
+
978
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
979
+
980
+ options.apply_defaults timeout: @config.rpcs.diagnose_instance.timeout,
981
+ metadata: call_metadata,
982
+ retry_policy: @config.rpcs.diagnose_instance.retry_policy
983
+
984
+ options.apply_defaults timeout: @config.timeout,
985
+ metadata: @config.metadata,
986
+ retry_policy: @config.retry_policy
987
+
988
+ @notebook_service_stub.diagnose_instance request, options do |result, operation|
989
+ result = ::Gapic::Operation.new result, @operations_client, options: options
990
+ yield result, operation if block_given?
991
+ return result
992
+ end
993
+ rescue ::Gapic::Rest::Error => e
994
+ raise ::Google::Cloud::Error.from_error(e)
995
+ end
996
+
997
+ ##
998
+ # Configuration class for the NotebookService REST API.
999
+ #
1000
+ # This class represents the configuration for NotebookService REST,
1001
+ # providing control over timeouts, retry behavior, logging, transport
1002
+ # parameters, and other low-level controls. Certain parameters can also be
1003
+ # applied individually to specific RPCs. See
1004
+ # {::Google::Cloud::Notebooks::V2::NotebookService::Rest::Client::Configuration::Rpcs}
1005
+ # for a list of RPCs that can be configured independently.
1006
+ #
1007
+ # Configuration can be applied globally to all clients, or to a single client
1008
+ # on construction.
1009
+ #
1010
+ # @example
1011
+ #
1012
+ # # Modify the global config, setting the timeout for
1013
+ # # list_instances to 20 seconds,
1014
+ # # and all remaining timeouts to 10 seconds.
1015
+ # ::Google::Cloud::Notebooks::V2::NotebookService::Rest::Client.configure do |config|
1016
+ # config.timeout = 10.0
1017
+ # config.rpcs.list_instances.timeout = 20.0
1018
+ # end
1019
+ #
1020
+ # # Apply the above configuration only to a new client.
1021
+ # client = ::Google::Cloud::Notebooks::V2::NotebookService::Rest::Client.new do |config|
1022
+ # config.timeout = 10.0
1023
+ # config.rpcs.list_instances.timeout = 20.0
1024
+ # end
1025
+ #
1026
+ # @!attribute [rw] endpoint
1027
+ # The hostname or hostname:port of the service endpoint.
1028
+ # Defaults to `"notebooks.googleapis.com"`.
1029
+ # @return [::String]
1030
+ # @!attribute [rw] credentials
1031
+ # Credentials to send with calls. You may provide any of the following types:
1032
+ # * (`String`) The path to a service account key file in JSON format
1033
+ # * (`Hash`) A service account key as a Hash
1034
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
1035
+ # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
1036
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
1037
+ # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
1038
+ # * (`nil`) indicating no credentials
1039
+ # @return [::Object]
1040
+ # @!attribute [rw] scope
1041
+ # The OAuth scopes
1042
+ # @return [::Array<::String>]
1043
+ # @!attribute [rw] lib_name
1044
+ # The library name as recorded in instrumentation and logging
1045
+ # @return [::String]
1046
+ # @!attribute [rw] lib_version
1047
+ # The library version as recorded in instrumentation and logging
1048
+ # @return [::String]
1049
+ # @!attribute [rw] timeout
1050
+ # The call timeout in seconds.
1051
+ # @return [::Numeric]
1052
+ # @!attribute [rw] metadata
1053
+ # Additional headers to be sent with the call.
1054
+ # @return [::Hash{::Symbol=>::String}]
1055
+ # @!attribute [rw] retry_policy
1056
+ # The retry policy. The value is a hash with the following keys:
1057
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
1058
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
1059
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
1060
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
1061
+ # trigger a retry.
1062
+ # @return [::Hash]
1063
+ # @!attribute [rw] quota_project
1064
+ # A separate project against which to charge quota.
1065
+ # @return [::String]
1066
+ #
1067
+ class Configuration
1068
+ extend ::Gapic::Config
1069
+
1070
+ DEFAULT_ENDPOINT = "notebooks.googleapis.com"
1071
+
1072
+ config_attr :endpoint, DEFAULT_ENDPOINT, ::String
1073
+ config_attr :credentials, nil do |value|
1074
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
1075
+ allowed.any? { |klass| klass === value }
1076
+ end
1077
+ config_attr :scope, nil, ::String, ::Array, nil
1078
+ config_attr :lib_name, nil, ::String, nil
1079
+ config_attr :lib_version, nil, ::String, nil
1080
+ config_attr :timeout, nil, ::Numeric, nil
1081
+ config_attr :metadata, nil, ::Hash, nil
1082
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
1083
+ config_attr :quota_project, nil, ::String, nil
1084
+
1085
+ # @private
1086
+ # Overrides for http bindings for the RPCs of this service
1087
+ # are only used when this service is used as mixin, and only
1088
+ # by the host service.
1089
+ # @return [::Hash{::Symbol=>::Array<::Gapic::Rest::GrpcTranscoder::HttpBinding>}]
1090
+ config_attr :bindings_override, {}, ::Hash, nil
1091
+
1092
+ # @private
1093
+ def initialize parent_config = nil
1094
+ @parent_config = parent_config unless parent_config.nil?
1095
+
1096
+ yield self if block_given?
1097
+ end
1098
+
1099
+ ##
1100
+ # Configurations for individual RPCs
1101
+ # @return [Rpcs]
1102
+ #
1103
+ def rpcs
1104
+ @rpcs ||= begin
1105
+ parent_rpcs = nil
1106
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
1107
+ Rpcs.new parent_rpcs
1108
+ end
1109
+ end
1110
+
1111
+ ##
1112
+ # Configuration RPC class for the NotebookService API.
1113
+ #
1114
+ # Includes fields providing the configuration for each RPC in this service.
1115
+ # Each configuration object is of type `Gapic::Config::Method` and includes
1116
+ # the following configuration fields:
1117
+ #
1118
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
1119
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers
1120
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
1121
+ # include the following keys:
1122
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
1123
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
1124
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
1125
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
1126
+ # trigger a retry.
1127
+ #
1128
+ class Rpcs
1129
+ ##
1130
+ # RPC-specific configuration for `list_instances`
1131
+ # @return [::Gapic::Config::Method]
1132
+ #
1133
+ attr_reader :list_instances
1134
+ ##
1135
+ # RPC-specific configuration for `get_instance`
1136
+ # @return [::Gapic::Config::Method]
1137
+ #
1138
+ attr_reader :get_instance
1139
+ ##
1140
+ # RPC-specific configuration for `create_instance`
1141
+ # @return [::Gapic::Config::Method]
1142
+ #
1143
+ attr_reader :create_instance
1144
+ ##
1145
+ # RPC-specific configuration for `update_instance`
1146
+ # @return [::Gapic::Config::Method]
1147
+ #
1148
+ attr_reader :update_instance
1149
+ ##
1150
+ # RPC-specific configuration for `delete_instance`
1151
+ # @return [::Gapic::Config::Method]
1152
+ #
1153
+ attr_reader :delete_instance
1154
+ ##
1155
+ # RPC-specific configuration for `start_instance`
1156
+ # @return [::Gapic::Config::Method]
1157
+ #
1158
+ attr_reader :start_instance
1159
+ ##
1160
+ # RPC-specific configuration for `stop_instance`
1161
+ # @return [::Gapic::Config::Method]
1162
+ #
1163
+ attr_reader :stop_instance
1164
+ ##
1165
+ # RPC-specific configuration for `reset_instance`
1166
+ # @return [::Gapic::Config::Method]
1167
+ #
1168
+ attr_reader :reset_instance
1169
+ ##
1170
+ # RPC-specific configuration for `check_instance_upgradability`
1171
+ # @return [::Gapic::Config::Method]
1172
+ #
1173
+ attr_reader :check_instance_upgradability
1174
+ ##
1175
+ # RPC-specific configuration for `upgrade_instance`
1176
+ # @return [::Gapic::Config::Method]
1177
+ #
1178
+ attr_reader :upgrade_instance
1179
+ ##
1180
+ # RPC-specific configuration for `rollback_instance`
1181
+ # @return [::Gapic::Config::Method]
1182
+ #
1183
+ attr_reader :rollback_instance
1184
+ ##
1185
+ # RPC-specific configuration for `diagnose_instance`
1186
+ # @return [::Gapic::Config::Method]
1187
+ #
1188
+ attr_reader :diagnose_instance
1189
+
1190
+ # @private
1191
+ def initialize parent_rpcs = nil
1192
+ list_instances_config = parent_rpcs.list_instances if parent_rpcs.respond_to? :list_instances
1193
+ @list_instances = ::Gapic::Config::Method.new list_instances_config
1194
+ get_instance_config = parent_rpcs.get_instance if parent_rpcs.respond_to? :get_instance
1195
+ @get_instance = ::Gapic::Config::Method.new get_instance_config
1196
+ create_instance_config = parent_rpcs.create_instance if parent_rpcs.respond_to? :create_instance
1197
+ @create_instance = ::Gapic::Config::Method.new create_instance_config
1198
+ update_instance_config = parent_rpcs.update_instance if parent_rpcs.respond_to? :update_instance
1199
+ @update_instance = ::Gapic::Config::Method.new update_instance_config
1200
+ delete_instance_config = parent_rpcs.delete_instance if parent_rpcs.respond_to? :delete_instance
1201
+ @delete_instance = ::Gapic::Config::Method.new delete_instance_config
1202
+ start_instance_config = parent_rpcs.start_instance if parent_rpcs.respond_to? :start_instance
1203
+ @start_instance = ::Gapic::Config::Method.new start_instance_config
1204
+ stop_instance_config = parent_rpcs.stop_instance if parent_rpcs.respond_to? :stop_instance
1205
+ @stop_instance = ::Gapic::Config::Method.new stop_instance_config
1206
+ reset_instance_config = parent_rpcs.reset_instance if parent_rpcs.respond_to? :reset_instance
1207
+ @reset_instance = ::Gapic::Config::Method.new reset_instance_config
1208
+ check_instance_upgradability_config = parent_rpcs.check_instance_upgradability if parent_rpcs.respond_to? :check_instance_upgradability
1209
+ @check_instance_upgradability = ::Gapic::Config::Method.new check_instance_upgradability_config
1210
+ upgrade_instance_config = parent_rpcs.upgrade_instance if parent_rpcs.respond_to? :upgrade_instance
1211
+ @upgrade_instance = ::Gapic::Config::Method.new upgrade_instance_config
1212
+ rollback_instance_config = parent_rpcs.rollback_instance if parent_rpcs.respond_to? :rollback_instance
1213
+ @rollback_instance = ::Gapic::Config::Method.new rollback_instance_config
1214
+ diagnose_instance_config = parent_rpcs.diagnose_instance if parent_rpcs.respond_to? :diagnose_instance
1215
+ @diagnose_instance = ::Gapic::Config::Method.new diagnose_instance_config
1216
+
1217
+ yield self if block_given?
1218
+ end
1219
+ end
1220
+ end
1221
+ end
1222
+ end
1223
+ end
1224
+ end
1225
+ end
1226
+ end
1227
+ end