google-cloud-notebooks-v1 0.1.0

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