google-cloud-bare_metal_solution-v2 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (37) hide show
  1. checksums.yaml +7 -0
  2. data/.yardopts +12 -0
  3. data/AUTHENTICATION.md +149 -0
  4. data/LICENSE.md +201 -0
  5. data/README.md +144 -0
  6. data/lib/google/cloud/bare_metal_solution/v2/bare_metal_solution/client.rb +2365 -0
  7. data/lib/google/cloud/bare_metal_solution/v2/bare_metal_solution/credentials.rb +47 -0
  8. data/lib/google/cloud/bare_metal_solution/v2/bare_metal_solution/operations.rb +767 -0
  9. data/lib/google/cloud/bare_metal_solution/v2/bare_metal_solution/paths.rb +166 -0
  10. data/lib/google/cloud/bare_metal_solution/v2/bare_metal_solution.rb +57 -0
  11. data/lib/google/cloud/bare_metal_solution/v2/version.rb +28 -0
  12. data/lib/google/cloud/bare_metal_solution/v2.rb +40 -0
  13. data/lib/google/cloud/baremetalsolution/v2/baremetalsolution_pb.rb +42 -0
  14. data/lib/google/cloud/baremetalsolution/v2/baremetalsolution_services_pb.rb +92 -0
  15. data/lib/google/cloud/baremetalsolution/v2/instance_pb.rb +113 -0
  16. data/lib/google/cloud/baremetalsolution/v2/lun_pb.rb +69 -0
  17. data/lib/google/cloud/baremetalsolution/v2/network_pb.rb +127 -0
  18. data/lib/google/cloud/baremetalsolution/v2/nfs_share_pb.rb +74 -0
  19. data/lib/google/cloud/baremetalsolution/v2/volume_pb.rb +93 -0
  20. data/lib/google-cloud-bare_metal_solution-v2.rb +21 -0
  21. data/proto_docs/README.md +4 -0
  22. data/proto_docs/google/api/field_behavior.rb +71 -0
  23. data/proto_docs/google/api/resource.rb +222 -0
  24. data/proto_docs/google/cloud/baremetalsolution/v2/baremetalsolution.rb +62 -0
  25. data/proto_docs/google/cloud/baremetalsolution/v2/instance.rb +283 -0
  26. data/proto_docs/google/cloud/baremetalsolution/v2/lun.rb +142 -0
  27. data/proto_docs/google/cloud/baremetalsolution/v2/network.rb +312 -0
  28. data/proto_docs/google/cloud/baremetalsolution/v2/nfs_share.rb +169 -0
  29. data/proto_docs/google/cloud/baremetalsolution/v2/volume.rb +238 -0
  30. data/proto_docs/google/longrunning/operations.rb +164 -0
  31. data/proto_docs/google/protobuf/any.rb +141 -0
  32. data/proto_docs/google/protobuf/duration.rb +98 -0
  33. data/proto_docs/google/protobuf/empty.rb +36 -0
  34. data/proto_docs/google/protobuf/field_mask.rb +229 -0
  35. data/proto_docs/google/protobuf/timestamp.rb +129 -0
  36. data/proto_docs/google/rpc/status.rb +46 -0
  37. metadata +268 -0
@@ -0,0 +1,2365 @@
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/baremetalsolution/v2/baremetalsolution_pb"
21
+ require "google/cloud/location"
22
+ require "google/iam/v1/iam_policy"
23
+
24
+ module Google
25
+ module Cloud
26
+ module BareMetalSolution
27
+ module V2
28
+ module BareMetalSolution
29
+ ##
30
+ # Client for the BareMetalSolution service.
31
+ #
32
+ # Performs management operations on Bare Metal Solution servers.
33
+ #
34
+ # The `baremetalsolution.googleapis.com` service provides management
35
+ # capabilities for Bare Metal Solution servers. To access the API methods, you
36
+ # must assign Bare Metal Solution IAM roles containing the desired permissions
37
+ # to your staff in your Google Cloud project. You must also enable the Bare
38
+ # Metal Solution API. Once enabled, the methods act
39
+ # upon specific servers in your Bare Metal Solution environment.
40
+ #
41
+ class Client
42
+ include Paths
43
+
44
+ # @private
45
+ attr_reader :bare_metal_solution_stub
46
+
47
+ ##
48
+ # Configure the BareMetalSolution Client class.
49
+ #
50
+ # See {::Google::Cloud::BareMetalSolution::V2::BareMetalSolution::Client::Configuration}
51
+ # for a description of the configuration fields.
52
+ #
53
+ # @example
54
+ #
55
+ # # Modify the configuration for all BareMetalSolution clients
56
+ # ::Google::Cloud::BareMetalSolution::V2::BareMetalSolution::Client.configure do |config|
57
+ # config.timeout = 10.0
58
+ # end
59
+ #
60
+ # @yield [config] Configure the Client client.
61
+ # @yieldparam config [Client::Configuration]
62
+ #
63
+ # @return [Client::Configuration]
64
+ #
65
+ def self.configure
66
+ @configure ||= begin
67
+ namespace = ["Google", "Cloud", "BareMetalSolution", "V2"]
68
+ parent_config = while namespace.any?
69
+ parent_name = namespace.join "::"
70
+ parent_const = const_get parent_name
71
+ break parent_const.configure if parent_const.respond_to? :configure
72
+ namespace.pop
73
+ end
74
+ default_config = Client::Configuration.new parent_config
75
+
76
+ default_config.timeout = 60.0
77
+
78
+ default_config
79
+ end
80
+ yield @configure if block_given?
81
+ @configure
82
+ end
83
+
84
+ ##
85
+ # Configure the BareMetalSolution Client instance.
86
+ #
87
+ # The configuration is set to the derived mode, meaning that values can be changed,
88
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
89
+ # should be made on {Client.configure}.
90
+ #
91
+ # See {::Google::Cloud::BareMetalSolution::V2::BareMetalSolution::Client::Configuration}
92
+ # for a description of the configuration fields.
93
+ #
94
+ # @yield [config] Configure the Client client.
95
+ # @yieldparam config [Client::Configuration]
96
+ #
97
+ # @return [Client::Configuration]
98
+ #
99
+ def configure
100
+ yield @config if block_given?
101
+ @config
102
+ end
103
+
104
+ ##
105
+ # Create a new BareMetalSolution client object.
106
+ #
107
+ # @example
108
+ #
109
+ # # Create a client using the default configuration
110
+ # client = ::Google::Cloud::BareMetalSolution::V2::BareMetalSolution::Client.new
111
+ #
112
+ # # Create a client using a custom configuration
113
+ # client = ::Google::Cloud::BareMetalSolution::V2::BareMetalSolution::Client.new do |config|
114
+ # config.timeout = 10.0
115
+ # end
116
+ #
117
+ # @yield [config] Configure the BareMetalSolution client.
118
+ # @yieldparam config [Client::Configuration]
119
+ #
120
+ def initialize
121
+ # These require statements are intentionally placed here to initialize
122
+ # the gRPC module only when it's required.
123
+ # See https://github.com/googleapis/toolkit/issues/446
124
+ require "gapic/grpc"
125
+ require "google/cloud/baremetalsolution/v2/baremetalsolution_services_pb"
126
+
127
+ # Create the configuration object
128
+ @config = Configuration.new Client.configure
129
+
130
+ # Yield the configuration if needed
131
+ yield @config if block_given?
132
+
133
+ # Create credentials
134
+ credentials = @config.credentials
135
+ # Use self-signed JWT if the endpoint is unchanged from default,
136
+ # but only if the default endpoint does not have a region prefix.
137
+ enable_self_signed_jwt = @config.endpoint == Client.configure.endpoint &&
138
+ !@config.endpoint.split(".").first.include?("-")
139
+ credentials ||= Credentials.default scope: @config.scope,
140
+ enable_self_signed_jwt: enable_self_signed_jwt
141
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
142
+ credentials = Credentials.new credentials, scope: @config.scope
143
+ end
144
+ @quota_project_id = @config.quota_project
145
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
146
+
147
+ @operations_client = Operations.new do |config|
148
+ config.credentials = credentials
149
+ config.quota_project = @quota_project_id
150
+ config.endpoint = @config.endpoint
151
+ end
152
+
153
+ @location_client = Google::Cloud::Location::Locations::Client.new do |config|
154
+ config.credentials = credentials
155
+ config.quota_project = @quota_project_id
156
+ config.endpoint = @config.endpoint
157
+ end
158
+
159
+ @iam_policy_client = Google::Iam::V1::IAMPolicy::Client.new do |config|
160
+ config.credentials = credentials
161
+ config.quota_project = @quota_project_id
162
+ config.endpoint = @config.endpoint
163
+ end
164
+
165
+ @bare_metal_solution_stub = ::Gapic::ServiceStub.new(
166
+ ::Google::Cloud::BareMetalSolution::V2::BareMetalSolution::Stub,
167
+ credentials: credentials,
168
+ endpoint: @config.endpoint,
169
+ channel_args: @config.channel_args,
170
+ interceptors: @config.interceptors
171
+ )
172
+ end
173
+
174
+ ##
175
+ # Get the associated client for long-running operations.
176
+ #
177
+ # @return [::Google::Cloud::BareMetalSolution::V2::BareMetalSolution::Operations]
178
+ #
179
+ attr_reader :operations_client
180
+
181
+ ##
182
+ # Get the associated client for mix-in of the Locations.
183
+ #
184
+ # @return [Google::Cloud::Location::Locations::Client]
185
+ #
186
+ attr_reader :location_client
187
+
188
+ ##
189
+ # Get the associated client for mix-in of the IAMPolicy.
190
+ #
191
+ # @return [Google::Iam::V1::IAMPolicy::Client]
192
+ #
193
+ attr_reader :iam_policy_client
194
+
195
+ # Service calls
196
+
197
+ ##
198
+ # List servers in a given project and location.
199
+ #
200
+ # @overload list_instances(request, options = nil)
201
+ # Pass arguments to `list_instances` via a request object, either of type
202
+ # {::Google::Cloud::BareMetalSolution::V2::ListInstancesRequest} or an equivalent Hash.
203
+ #
204
+ # @param request [::Google::Cloud::BareMetalSolution::V2::ListInstancesRequest, ::Hash]
205
+ # A request object representing the call parameters. Required. To specify no
206
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
207
+ # @param options [::Gapic::CallOptions, ::Hash]
208
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
209
+ #
210
+ # @overload list_instances(parent: nil, page_size: nil, page_token: nil, filter: nil)
211
+ # Pass arguments to `list_instances` via keyword arguments. Note that at
212
+ # least one keyword argument is required. To specify no parameters, or to keep all
213
+ # the default parameter values, pass an empty Hash as a request object (see above).
214
+ #
215
+ # @param parent [::String]
216
+ # Required. Parent value for ListInstancesRequest.
217
+ # @param page_size [::Integer]
218
+ # Requested page size. Server may return fewer items than requested.
219
+ # If unspecified, the server will pick an appropriate default.
220
+ # @param page_token [::String]
221
+ # A token identifying a page of results from the server.
222
+ # @param filter [::String]
223
+ # List filter.
224
+ #
225
+ # @yield [response, operation] Access the result along with the RPC operation
226
+ # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::BareMetalSolution::V2::Instance>]
227
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
228
+ #
229
+ # @return [::Gapic::PagedEnumerable<::Google::Cloud::BareMetalSolution::V2::Instance>]
230
+ #
231
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
232
+ #
233
+ # @example Basic example
234
+ # require "google/cloud/bare_metal_solution/v2"
235
+ #
236
+ # # Create a client object. The client can be reused for multiple calls.
237
+ # client = Google::Cloud::BareMetalSolution::V2::BareMetalSolution::Client.new
238
+ #
239
+ # # Create a request. To set request fields, pass in keyword arguments.
240
+ # request = Google::Cloud::BareMetalSolution::V2::ListInstancesRequest.new
241
+ #
242
+ # # Call the list_instances method.
243
+ # result = client.list_instances request
244
+ #
245
+ # # The returned object is of type Gapic::PagedEnumerable. You can
246
+ # # iterate over all elements by calling #each, and the enumerable
247
+ # # will lazily make API calls to fetch subsequent pages. Other
248
+ # # methods are also available for managing paging directly.
249
+ # result.each do |response|
250
+ # # Each element is of type ::Google::Cloud::BareMetalSolution::V2::Instance.
251
+ # p response
252
+ # end
253
+ #
254
+ def list_instances request, options = nil
255
+ raise ::ArgumentError, "request must be provided" if request.nil?
256
+
257
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::BareMetalSolution::V2::ListInstancesRequest
258
+
259
+ # Converts hash and nil to an options object
260
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
261
+
262
+ # Customize the options with defaults
263
+ metadata = @config.rpcs.list_instances.metadata.to_h
264
+
265
+ # Set x-goog-api-client and x-goog-user-project headers
266
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
267
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
268
+ gapic_version: ::Google::Cloud::BareMetalSolution::V2::VERSION
269
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
270
+
271
+ header_params = {}
272
+ if request.parent
273
+ header_params["parent"] = request.parent
274
+ end
275
+
276
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
277
+ metadata[:"x-goog-request-params"] ||= request_params_header
278
+
279
+ options.apply_defaults timeout: @config.rpcs.list_instances.timeout,
280
+ metadata: metadata,
281
+ retry_policy: @config.rpcs.list_instances.retry_policy
282
+
283
+ options.apply_defaults timeout: @config.timeout,
284
+ metadata: @config.metadata,
285
+ retry_policy: @config.retry_policy
286
+
287
+ @bare_metal_solution_stub.call_rpc :list_instances, request, options: options do |response, operation|
288
+ response = ::Gapic::PagedEnumerable.new @bare_metal_solution_stub, :list_instances, request, response, operation, options
289
+ yield response, operation if block_given?
290
+ return response
291
+ end
292
+ rescue ::GRPC::BadStatus => e
293
+ raise ::Google::Cloud::Error.from_error(e)
294
+ end
295
+
296
+ ##
297
+ # Get details about a single server.
298
+ #
299
+ # @overload get_instance(request, options = nil)
300
+ # Pass arguments to `get_instance` via a request object, either of type
301
+ # {::Google::Cloud::BareMetalSolution::V2::GetInstanceRequest} or an equivalent Hash.
302
+ #
303
+ # @param request [::Google::Cloud::BareMetalSolution::V2::GetInstanceRequest, ::Hash]
304
+ # A request object representing the call parameters. Required. To specify no
305
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
306
+ # @param options [::Gapic::CallOptions, ::Hash]
307
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
308
+ #
309
+ # @overload get_instance(name: nil)
310
+ # Pass arguments to `get_instance` via keyword arguments. Note that at
311
+ # least one keyword argument is required. To specify no parameters, or to keep all
312
+ # the default parameter values, pass an empty Hash as a request object (see above).
313
+ #
314
+ # @param name [::String]
315
+ # Required. Name of the resource.
316
+ #
317
+ # @yield [response, operation] Access the result along with the RPC operation
318
+ # @yieldparam response [::Google::Cloud::BareMetalSolution::V2::Instance]
319
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
320
+ #
321
+ # @return [::Google::Cloud::BareMetalSolution::V2::Instance]
322
+ #
323
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
324
+ #
325
+ # @example Basic example
326
+ # require "google/cloud/bare_metal_solution/v2"
327
+ #
328
+ # # Create a client object. The client can be reused for multiple calls.
329
+ # client = Google::Cloud::BareMetalSolution::V2::BareMetalSolution::Client.new
330
+ #
331
+ # # Create a request. To set request fields, pass in keyword arguments.
332
+ # request = Google::Cloud::BareMetalSolution::V2::GetInstanceRequest.new
333
+ #
334
+ # # Call the get_instance method.
335
+ # result = client.get_instance request
336
+ #
337
+ # # The returned object is of type Google::Cloud::BareMetalSolution::V2::Instance.
338
+ # p result
339
+ #
340
+ def get_instance request, options = nil
341
+ raise ::ArgumentError, "request must be provided" if request.nil?
342
+
343
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::BareMetalSolution::V2::GetInstanceRequest
344
+
345
+ # Converts hash and nil to an options object
346
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
347
+
348
+ # Customize the options with defaults
349
+ metadata = @config.rpcs.get_instance.metadata.to_h
350
+
351
+ # Set x-goog-api-client and x-goog-user-project headers
352
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
353
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
354
+ gapic_version: ::Google::Cloud::BareMetalSolution::V2::VERSION
355
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
356
+
357
+ header_params = {}
358
+ if request.name
359
+ header_params["name"] = request.name
360
+ end
361
+
362
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
363
+ metadata[:"x-goog-request-params"] ||= request_params_header
364
+
365
+ options.apply_defaults timeout: @config.rpcs.get_instance.timeout,
366
+ metadata: metadata,
367
+ retry_policy: @config.rpcs.get_instance.retry_policy
368
+
369
+ options.apply_defaults timeout: @config.timeout,
370
+ metadata: @config.metadata,
371
+ retry_policy: @config.retry_policy
372
+
373
+ @bare_metal_solution_stub.call_rpc :get_instance, request, options: options do |response, operation|
374
+ yield response, operation if block_given?
375
+ return response
376
+ end
377
+ rescue ::GRPC::BadStatus => e
378
+ raise ::Google::Cloud::Error.from_error(e)
379
+ end
380
+
381
+ ##
382
+ # Update details of a single server.
383
+ #
384
+ # @overload update_instance(request, options = nil)
385
+ # Pass arguments to `update_instance` via a request object, either of type
386
+ # {::Google::Cloud::BareMetalSolution::V2::UpdateInstanceRequest} or an equivalent Hash.
387
+ #
388
+ # @param request [::Google::Cloud::BareMetalSolution::V2::UpdateInstanceRequest, ::Hash]
389
+ # A request object representing the call parameters. Required. To specify no
390
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
391
+ # @param options [::Gapic::CallOptions, ::Hash]
392
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
393
+ #
394
+ # @overload update_instance(instance: nil, update_mask: nil)
395
+ # Pass arguments to `update_instance` via keyword arguments. Note that at
396
+ # least one keyword argument is required. To specify no parameters, or to keep all
397
+ # the default parameter values, pass an empty Hash as a request object (see above).
398
+ #
399
+ # @param instance [::Google::Cloud::BareMetalSolution::V2::Instance, ::Hash]
400
+ # Required. The server to update.
401
+ #
402
+ # The `name` field is used to identify the instance to update.
403
+ # Format: projects/\\{project}/locations/\\{location}/instances/\\{instance}
404
+ # @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
405
+ # The list of fields to update.
406
+ # The currently supported fields are:
407
+ # `labels`
408
+ # `hyperthreading_enabled`
409
+ # `os_image`
410
+ #
411
+ # @yield [response, operation] Access the result along with the RPC operation
412
+ # @yieldparam response [::Gapic::Operation]
413
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
414
+ #
415
+ # @return [::Gapic::Operation]
416
+ #
417
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
418
+ #
419
+ # @example Basic example
420
+ # require "google/cloud/bare_metal_solution/v2"
421
+ #
422
+ # # Create a client object. The client can be reused for multiple calls.
423
+ # client = Google::Cloud::BareMetalSolution::V2::BareMetalSolution::Client.new
424
+ #
425
+ # # Create a request. To set request fields, pass in keyword arguments.
426
+ # request = Google::Cloud::BareMetalSolution::V2::UpdateInstanceRequest.new
427
+ #
428
+ # # Call the update_instance method.
429
+ # result = client.update_instance request
430
+ #
431
+ # # The returned object is of type Gapic::Operation. You can use this
432
+ # # object to check the status of an operation, cancel it, or wait
433
+ # # for results. Here is how to block until completion:
434
+ # result.wait_until_done! timeout: 60
435
+ # if result.response?
436
+ # p result.response
437
+ # else
438
+ # puts "Error!"
439
+ # end
440
+ #
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::BareMetalSolution::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
+ metadata = @config.rpcs.update_instance.metadata.to_h
451
+
452
+ # Set x-goog-api-client and x-goog-user-project headers
453
+ 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::BareMetalSolution::V2::VERSION
456
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
457
+
458
+ header_params = {}
459
+ if request.instance&.name
460
+ header_params["instance.name"] = request.instance.name
461
+ end
462
+
463
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
464
+ metadata[:"x-goog-request-params"] ||= request_params_header
465
+
466
+ options.apply_defaults timeout: @config.rpcs.update_instance.timeout,
467
+ metadata: metadata,
468
+ retry_policy: @config.rpcs.update_instance.retry_policy
469
+
470
+ options.apply_defaults timeout: @config.timeout,
471
+ metadata: @config.metadata,
472
+ retry_policy: @config.retry_policy
473
+
474
+ @bare_metal_solution_stub.call_rpc :update_instance, request, options: options do |response, operation|
475
+ response = ::Gapic::Operation.new response, @operations_client, options: options
476
+ yield response, operation if block_given?
477
+ return response
478
+ end
479
+ rescue ::GRPC::BadStatus => e
480
+ raise ::Google::Cloud::Error.from_error(e)
481
+ end
482
+
483
+ ##
484
+ # Perform an ungraceful, hard reset on a server. Equivalent to shutting the
485
+ # power off and then turning it back on.
486
+ #
487
+ # @overload reset_instance(request, options = nil)
488
+ # Pass arguments to `reset_instance` via a request object, either of type
489
+ # {::Google::Cloud::BareMetalSolution::V2::ResetInstanceRequest} or an equivalent Hash.
490
+ #
491
+ # @param request [::Google::Cloud::BareMetalSolution::V2::ResetInstanceRequest, ::Hash]
492
+ # A request object representing the call parameters. Required. To specify no
493
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
494
+ # @param options [::Gapic::CallOptions, ::Hash]
495
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
496
+ #
497
+ # @overload reset_instance(name: nil)
498
+ # Pass arguments to `reset_instance` via keyword arguments. Note that at
499
+ # least one keyword argument is required. To specify no parameters, or to keep all
500
+ # the default parameter values, pass an empty Hash as a request object (see above).
501
+ #
502
+ # @param name [::String]
503
+ # Required. Name of the resource.
504
+ #
505
+ # @yield [response, operation] Access the result along with the RPC operation
506
+ # @yieldparam response [::Gapic::Operation]
507
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
508
+ #
509
+ # @return [::Gapic::Operation]
510
+ #
511
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
512
+ #
513
+ # @example Basic example
514
+ # require "google/cloud/bare_metal_solution/v2"
515
+ #
516
+ # # Create a client object. The client can be reused for multiple calls.
517
+ # client = Google::Cloud::BareMetalSolution::V2::BareMetalSolution::Client.new
518
+ #
519
+ # # Create a request. To set request fields, pass in keyword arguments.
520
+ # request = Google::Cloud::BareMetalSolution::V2::ResetInstanceRequest.new
521
+ #
522
+ # # Call the reset_instance method.
523
+ # result = client.reset_instance request
524
+ #
525
+ # # The returned object is of type Gapic::Operation. You can use this
526
+ # # object to check the status of an operation, cancel it, or wait
527
+ # # for results. Here is how to block until completion:
528
+ # result.wait_until_done! timeout: 60
529
+ # if result.response?
530
+ # p result.response
531
+ # else
532
+ # puts "Error!"
533
+ # end
534
+ #
535
+ def reset_instance request, options = nil
536
+ raise ::ArgumentError, "request must be provided" if request.nil?
537
+
538
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::BareMetalSolution::V2::ResetInstanceRequest
539
+
540
+ # Converts hash and nil to an options object
541
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
542
+
543
+ # Customize the options with defaults
544
+ metadata = @config.rpcs.reset_instance.metadata.to_h
545
+
546
+ # Set x-goog-api-client and x-goog-user-project headers
547
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
548
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
549
+ gapic_version: ::Google::Cloud::BareMetalSolution::V2::VERSION
550
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
551
+
552
+ header_params = {}
553
+ if request.name
554
+ header_params["name"] = request.name
555
+ end
556
+
557
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
558
+ metadata[:"x-goog-request-params"] ||= request_params_header
559
+
560
+ options.apply_defaults timeout: @config.rpcs.reset_instance.timeout,
561
+ metadata: metadata,
562
+ retry_policy: @config.rpcs.reset_instance.retry_policy
563
+
564
+ options.apply_defaults timeout: @config.timeout,
565
+ metadata: @config.metadata,
566
+ retry_policy: @config.retry_policy
567
+
568
+ @bare_metal_solution_stub.call_rpc :reset_instance, request, options: options do |response, operation|
569
+ response = ::Gapic::Operation.new response, @operations_client, options: options
570
+ yield response, operation if block_given?
571
+ return response
572
+ end
573
+ rescue ::GRPC::BadStatus => e
574
+ raise ::Google::Cloud::Error.from_error(e)
575
+ end
576
+
577
+ ##
578
+ # Starts a server that was shutdown.
579
+ #
580
+ # @overload start_instance(request, options = nil)
581
+ # Pass arguments to `start_instance` via a request object, either of type
582
+ # {::Google::Cloud::BareMetalSolution::V2::StartInstanceRequest} or an equivalent Hash.
583
+ #
584
+ # @param request [::Google::Cloud::BareMetalSolution::V2::StartInstanceRequest, ::Hash]
585
+ # A request object representing the call parameters. Required. To specify no
586
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
587
+ # @param options [::Gapic::CallOptions, ::Hash]
588
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
589
+ #
590
+ # @overload start_instance(name: nil)
591
+ # Pass arguments to `start_instance` via keyword arguments. Note that at
592
+ # least one keyword argument is required. To specify no parameters, or to keep all
593
+ # the default parameter values, pass an empty Hash as a request object (see above).
594
+ #
595
+ # @param name [::String]
596
+ # Required. Name of the resource.
597
+ #
598
+ # @yield [response, operation] Access the result along with the RPC operation
599
+ # @yieldparam response [::Gapic::Operation]
600
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
601
+ #
602
+ # @return [::Gapic::Operation]
603
+ #
604
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
605
+ #
606
+ # @example Basic example
607
+ # require "google/cloud/bare_metal_solution/v2"
608
+ #
609
+ # # Create a client object. The client can be reused for multiple calls.
610
+ # client = Google::Cloud::BareMetalSolution::V2::BareMetalSolution::Client.new
611
+ #
612
+ # # Create a request. To set request fields, pass in keyword arguments.
613
+ # request = Google::Cloud::BareMetalSolution::V2::StartInstanceRequest.new
614
+ #
615
+ # # Call the start_instance method.
616
+ # result = client.start_instance request
617
+ #
618
+ # # The returned object is of type Gapic::Operation. You can use this
619
+ # # object to check the status of an operation, cancel it, or wait
620
+ # # for results. Here is how to block until completion:
621
+ # result.wait_until_done! timeout: 60
622
+ # if result.response?
623
+ # p result.response
624
+ # else
625
+ # puts "Error!"
626
+ # end
627
+ #
628
+ def start_instance request, options = nil
629
+ raise ::ArgumentError, "request must be provided" if request.nil?
630
+
631
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::BareMetalSolution::V2::StartInstanceRequest
632
+
633
+ # Converts hash and nil to an options object
634
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
635
+
636
+ # Customize the options with defaults
637
+ metadata = @config.rpcs.start_instance.metadata.to_h
638
+
639
+ # Set x-goog-api-client and x-goog-user-project headers
640
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
641
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
642
+ gapic_version: ::Google::Cloud::BareMetalSolution::V2::VERSION
643
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
644
+
645
+ header_params = {}
646
+ if request.name
647
+ header_params["name"] = request.name
648
+ end
649
+
650
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
651
+ metadata[:"x-goog-request-params"] ||= request_params_header
652
+
653
+ options.apply_defaults timeout: @config.rpcs.start_instance.timeout,
654
+ metadata: metadata,
655
+ retry_policy: @config.rpcs.start_instance.retry_policy
656
+
657
+ options.apply_defaults timeout: @config.timeout,
658
+ metadata: @config.metadata,
659
+ retry_policy: @config.retry_policy
660
+
661
+ @bare_metal_solution_stub.call_rpc :start_instance, request, options: options do |response, operation|
662
+ response = ::Gapic::Operation.new response, @operations_client, options: options
663
+ yield response, operation if block_given?
664
+ return response
665
+ end
666
+ rescue ::GRPC::BadStatus => e
667
+ raise ::Google::Cloud::Error.from_error(e)
668
+ end
669
+
670
+ ##
671
+ # Stop a running server.
672
+ #
673
+ # @overload stop_instance(request, options = nil)
674
+ # Pass arguments to `stop_instance` via a request object, either of type
675
+ # {::Google::Cloud::BareMetalSolution::V2::StopInstanceRequest} or an equivalent Hash.
676
+ #
677
+ # @param request [::Google::Cloud::BareMetalSolution::V2::StopInstanceRequest, ::Hash]
678
+ # A request object representing the call parameters. Required. To specify no
679
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
680
+ # @param options [::Gapic::CallOptions, ::Hash]
681
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
682
+ #
683
+ # @overload stop_instance(name: nil)
684
+ # Pass arguments to `stop_instance` via keyword arguments. Note that at
685
+ # least one keyword argument is required. To specify no parameters, or to keep all
686
+ # the default parameter values, pass an empty Hash as a request object (see above).
687
+ #
688
+ # @param name [::String]
689
+ # Required. Name of the resource.
690
+ #
691
+ # @yield [response, operation] Access the result along with the RPC operation
692
+ # @yieldparam response [::Gapic::Operation]
693
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
694
+ #
695
+ # @return [::Gapic::Operation]
696
+ #
697
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
698
+ #
699
+ # @example Basic example
700
+ # require "google/cloud/bare_metal_solution/v2"
701
+ #
702
+ # # Create a client object. The client can be reused for multiple calls.
703
+ # client = Google::Cloud::BareMetalSolution::V2::BareMetalSolution::Client.new
704
+ #
705
+ # # Create a request. To set request fields, pass in keyword arguments.
706
+ # request = Google::Cloud::BareMetalSolution::V2::StopInstanceRequest.new
707
+ #
708
+ # # Call the stop_instance method.
709
+ # result = client.stop_instance request
710
+ #
711
+ # # The returned object is of type Gapic::Operation. You can use this
712
+ # # object to check the status of an operation, cancel it, or wait
713
+ # # for results. Here is how to block until completion:
714
+ # result.wait_until_done! timeout: 60
715
+ # if result.response?
716
+ # p result.response
717
+ # else
718
+ # puts "Error!"
719
+ # end
720
+ #
721
+ def stop_instance request, options = nil
722
+ raise ::ArgumentError, "request must be provided" if request.nil?
723
+
724
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::BareMetalSolution::V2::StopInstanceRequest
725
+
726
+ # Converts hash and nil to an options object
727
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
728
+
729
+ # Customize the options with defaults
730
+ metadata = @config.rpcs.stop_instance.metadata.to_h
731
+
732
+ # Set x-goog-api-client and x-goog-user-project headers
733
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
734
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
735
+ gapic_version: ::Google::Cloud::BareMetalSolution::V2::VERSION
736
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
737
+
738
+ header_params = {}
739
+ if request.name
740
+ header_params["name"] = request.name
741
+ end
742
+
743
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
744
+ metadata[:"x-goog-request-params"] ||= request_params_header
745
+
746
+ options.apply_defaults timeout: @config.rpcs.stop_instance.timeout,
747
+ metadata: metadata,
748
+ retry_policy: @config.rpcs.stop_instance.retry_policy
749
+
750
+ options.apply_defaults timeout: @config.timeout,
751
+ metadata: @config.metadata,
752
+ retry_policy: @config.retry_policy
753
+
754
+ @bare_metal_solution_stub.call_rpc :stop_instance, request, options: options do |response, operation|
755
+ response = ::Gapic::Operation.new response, @operations_client, options: options
756
+ yield response, operation if block_given?
757
+ return response
758
+ end
759
+ rescue ::GRPC::BadStatus => e
760
+ raise ::Google::Cloud::Error.from_error(e)
761
+ end
762
+
763
+ ##
764
+ # Detach LUN from Instance.
765
+ #
766
+ # @overload detach_lun(request, options = nil)
767
+ # Pass arguments to `detach_lun` via a request object, either of type
768
+ # {::Google::Cloud::BareMetalSolution::V2::DetachLunRequest} or an equivalent Hash.
769
+ #
770
+ # @param request [::Google::Cloud::BareMetalSolution::V2::DetachLunRequest, ::Hash]
771
+ # A request object representing the call parameters. Required. To specify no
772
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
773
+ # @param options [::Gapic::CallOptions, ::Hash]
774
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
775
+ #
776
+ # @overload detach_lun(instance: nil, lun: nil)
777
+ # Pass arguments to `detach_lun` via keyword arguments. Note that at
778
+ # least one keyword argument is required. To specify no parameters, or to keep all
779
+ # the default parameter values, pass an empty Hash as a request object (see above).
780
+ #
781
+ # @param instance [::String]
782
+ # Required. Name of the instance.
783
+ # @param lun [::String]
784
+ # Required. Name of the Lun to detach.
785
+ #
786
+ # @yield [response, operation] Access the result along with the RPC operation
787
+ # @yieldparam response [::Gapic::Operation]
788
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
789
+ #
790
+ # @return [::Gapic::Operation]
791
+ #
792
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
793
+ #
794
+ # @example Basic example
795
+ # require "google/cloud/bare_metal_solution/v2"
796
+ #
797
+ # # Create a client object. The client can be reused for multiple calls.
798
+ # client = Google::Cloud::BareMetalSolution::V2::BareMetalSolution::Client.new
799
+ #
800
+ # # Create a request. To set request fields, pass in keyword arguments.
801
+ # request = Google::Cloud::BareMetalSolution::V2::DetachLunRequest.new
802
+ #
803
+ # # Call the detach_lun method.
804
+ # result = client.detach_lun request
805
+ #
806
+ # # The returned object is of type Gapic::Operation. You can use this
807
+ # # object to check the status of an operation, cancel it, or wait
808
+ # # for results. Here is how to block until completion:
809
+ # result.wait_until_done! timeout: 60
810
+ # if result.response?
811
+ # p result.response
812
+ # else
813
+ # puts "Error!"
814
+ # end
815
+ #
816
+ def detach_lun request, options = nil
817
+ raise ::ArgumentError, "request must be provided" if request.nil?
818
+
819
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::BareMetalSolution::V2::DetachLunRequest
820
+
821
+ # Converts hash and nil to an options object
822
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
823
+
824
+ # Customize the options with defaults
825
+ metadata = @config.rpcs.detach_lun.metadata.to_h
826
+
827
+ # Set x-goog-api-client and x-goog-user-project headers
828
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
829
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
830
+ gapic_version: ::Google::Cloud::BareMetalSolution::V2::VERSION
831
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
832
+
833
+ header_params = {}
834
+ if request.instance
835
+ header_params["instance"] = request.instance
836
+ end
837
+
838
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
839
+ metadata[:"x-goog-request-params"] ||= request_params_header
840
+
841
+ options.apply_defaults timeout: @config.rpcs.detach_lun.timeout,
842
+ metadata: metadata,
843
+ retry_policy: @config.rpcs.detach_lun.retry_policy
844
+
845
+ options.apply_defaults timeout: @config.timeout,
846
+ metadata: @config.metadata,
847
+ retry_policy: @config.retry_policy
848
+
849
+ @bare_metal_solution_stub.call_rpc :detach_lun, request, options: options do |response, operation|
850
+ response = ::Gapic::Operation.new response, @operations_client, options: options
851
+ yield response, operation if block_given?
852
+ return response
853
+ end
854
+ rescue ::GRPC::BadStatus => e
855
+ raise ::Google::Cloud::Error.from_error(e)
856
+ end
857
+
858
+ ##
859
+ # List storage volumes in a given project and location.
860
+ #
861
+ # @overload list_volumes(request, options = nil)
862
+ # Pass arguments to `list_volumes` via a request object, either of type
863
+ # {::Google::Cloud::BareMetalSolution::V2::ListVolumesRequest} or an equivalent Hash.
864
+ #
865
+ # @param request [::Google::Cloud::BareMetalSolution::V2::ListVolumesRequest, ::Hash]
866
+ # A request object representing the call parameters. Required. To specify no
867
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
868
+ # @param options [::Gapic::CallOptions, ::Hash]
869
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
870
+ #
871
+ # @overload list_volumes(parent: nil, page_size: nil, page_token: nil, filter: nil)
872
+ # Pass arguments to `list_volumes` via keyword arguments. Note that at
873
+ # least one keyword argument is required. To specify no parameters, or to keep all
874
+ # the default parameter values, pass an empty Hash as a request object (see above).
875
+ #
876
+ # @param parent [::String]
877
+ # Required. Parent value for ListVolumesRequest.
878
+ # @param page_size [::Integer]
879
+ # Requested page size. The server might return fewer items than requested.
880
+ # If unspecified, server will pick an appropriate default.
881
+ # @param page_token [::String]
882
+ # A token identifying a page of results from the server.
883
+ # @param filter [::String]
884
+ # List filter.
885
+ #
886
+ # @yield [response, operation] Access the result along with the RPC operation
887
+ # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::BareMetalSolution::V2::Volume>]
888
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
889
+ #
890
+ # @return [::Gapic::PagedEnumerable<::Google::Cloud::BareMetalSolution::V2::Volume>]
891
+ #
892
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
893
+ #
894
+ # @example Basic example
895
+ # require "google/cloud/bare_metal_solution/v2"
896
+ #
897
+ # # Create a client object. The client can be reused for multiple calls.
898
+ # client = Google::Cloud::BareMetalSolution::V2::BareMetalSolution::Client.new
899
+ #
900
+ # # Create a request. To set request fields, pass in keyword arguments.
901
+ # request = Google::Cloud::BareMetalSolution::V2::ListVolumesRequest.new
902
+ #
903
+ # # Call the list_volumes method.
904
+ # result = client.list_volumes request
905
+ #
906
+ # # The returned object is of type Gapic::PagedEnumerable. You can
907
+ # # iterate over all elements by calling #each, and the enumerable
908
+ # # will lazily make API calls to fetch subsequent pages. Other
909
+ # # methods are also available for managing paging directly.
910
+ # result.each do |response|
911
+ # # Each element is of type ::Google::Cloud::BareMetalSolution::V2::Volume.
912
+ # p response
913
+ # end
914
+ #
915
+ def list_volumes request, options = nil
916
+ raise ::ArgumentError, "request must be provided" if request.nil?
917
+
918
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::BareMetalSolution::V2::ListVolumesRequest
919
+
920
+ # Converts hash and nil to an options object
921
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
922
+
923
+ # Customize the options with defaults
924
+ metadata = @config.rpcs.list_volumes.metadata.to_h
925
+
926
+ # Set x-goog-api-client and x-goog-user-project headers
927
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
928
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
929
+ gapic_version: ::Google::Cloud::BareMetalSolution::V2::VERSION
930
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
931
+
932
+ header_params = {}
933
+ if request.parent
934
+ header_params["parent"] = request.parent
935
+ end
936
+
937
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
938
+ metadata[:"x-goog-request-params"] ||= request_params_header
939
+
940
+ options.apply_defaults timeout: @config.rpcs.list_volumes.timeout,
941
+ metadata: metadata,
942
+ retry_policy: @config.rpcs.list_volumes.retry_policy
943
+
944
+ options.apply_defaults timeout: @config.timeout,
945
+ metadata: @config.metadata,
946
+ retry_policy: @config.retry_policy
947
+
948
+ @bare_metal_solution_stub.call_rpc :list_volumes, request, options: options do |response, operation|
949
+ response = ::Gapic::PagedEnumerable.new @bare_metal_solution_stub, :list_volumes, request, response, operation, options
950
+ yield response, operation if block_given?
951
+ return response
952
+ end
953
+ rescue ::GRPC::BadStatus => e
954
+ raise ::Google::Cloud::Error.from_error(e)
955
+ end
956
+
957
+ ##
958
+ # Get details of a single storage volume.
959
+ #
960
+ # @overload get_volume(request, options = nil)
961
+ # Pass arguments to `get_volume` via a request object, either of type
962
+ # {::Google::Cloud::BareMetalSolution::V2::GetVolumeRequest} or an equivalent Hash.
963
+ #
964
+ # @param request [::Google::Cloud::BareMetalSolution::V2::GetVolumeRequest, ::Hash]
965
+ # A request object representing the call parameters. Required. To specify no
966
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
967
+ # @param options [::Gapic::CallOptions, ::Hash]
968
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
969
+ #
970
+ # @overload get_volume(name: nil)
971
+ # Pass arguments to `get_volume` via keyword arguments. Note that at
972
+ # least one keyword argument is required. To specify no parameters, or to keep all
973
+ # the default parameter values, pass an empty Hash as a request object (see above).
974
+ #
975
+ # @param name [::String]
976
+ # Required. Name of the resource.
977
+ #
978
+ # @yield [response, operation] Access the result along with the RPC operation
979
+ # @yieldparam response [::Google::Cloud::BareMetalSolution::V2::Volume]
980
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
981
+ #
982
+ # @return [::Google::Cloud::BareMetalSolution::V2::Volume]
983
+ #
984
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
985
+ #
986
+ # @example Basic example
987
+ # require "google/cloud/bare_metal_solution/v2"
988
+ #
989
+ # # Create a client object. The client can be reused for multiple calls.
990
+ # client = Google::Cloud::BareMetalSolution::V2::BareMetalSolution::Client.new
991
+ #
992
+ # # Create a request. To set request fields, pass in keyword arguments.
993
+ # request = Google::Cloud::BareMetalSolution::V2::GetVolumeRequest.new
994
+ #
995
+ # # Call the get_volume method.
996
+ # result = client.get_volume request
997
+ #
998
+ # # The returned object is of type Google::Cloud::BareMetalSolution::V2::Volume.
999
+ # p result
1000
+ #
1001
+ def get_volume request, options = nil
1002
+ raise ::ArgumentError, "request must be provided" if request.nil?
1003
+
1004
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::BareMetalSolution::V2::GetVolumeRequest
1005
+
1006
+ # Converts hash and nil to an options object
1007
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1008
+
1009
+ # Customize the options with defaults
1010
+ metadata = @config.rpcs.get_volume.metadata.to_h
1011
+
1012
+ # Set x-goog-api-client and x-goog-user-project headers
1013
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1014
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1015
+ gapic_version: ::Google::Cloud::BareMetalSolution::V2::VERSION
1016
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1017
+
1018
+ header_params = {}
1019
+ if request.name
1020
+ header_params["name"] = request.name
1021
+ end
1022
+
1023
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1024
+ metadata[:"x-goog-request-params"] ||= request_params_header
1025
+
1026
+ options.apply_defaults timeout: @config.rpcs.get_volume.timeout,
1027
+ metadata: metadata,
1028
+ retry_policy: @config.rpcs.get_volume.retry_policy
1029
+
1030
+ options.apply_defaults timeout: @config.timeout,
1031
+ metadata: @config.metadata,
1032
+ retry_policy: @config.retry_policy
1033
+
1034
+ @bare_metal_solution_stub.call_rpc :get_volume, request, options: options do |response, operation|
1035
+ yield response, operation if block_given?
1036
+ return response
1037
+ end
1038
+ rescue ::GRPC::BadStatus => e
1039
+ raise ::Google::Cloud::Error.from_error(e)
1040
+ end
1041
+
1042
+ ##
1043
+ # Update details of a single storage volume.
1044
+ #
1045
+ # @overload update_volume(request, options = nil)
1046
+ # Pass arguments to `update_volume` via a request object, either of type
1047
+ # {::Google::Cloud::BareMetalSolution::V2::UpdateVolumeRequest} or an equivalent Hash.
1048
+ #
1049
+ # @param request [::Google::Cloud::BareMetalSolution::V2::UpdateVolumeRequest, ::Hash]
1050
+ # A request object representing the call parameters. Required. To specify no
1051
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1052
+ # @param options [::Gapic::CallOptions, ::Hash]
1053
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
1054
+ #
1055
+ # @overload update_volume(volume: nil, update_mask: nil)
1056
+ # Pass arguments to `update_volume` via keyword arguments. Note that at
1057
+ # least one keyword argument is required. To specify no parameters, or to keep all
1058
+ # the default parameter values, pass an empty Hash as a request object (see above).
1059
+ #
1060
+ # @param volume [::Google::Cloud::BareMetalSolution::V2::Volume, ::Hash]
1061
+ # Required. The volume to update.
1062
+ #
1063
+ # The `name` field is used to identify the volume to update.
1064
+ # Format: projects/\\{project}/locations/\\{location}/volumes/\\{volume}
1065
+ # @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
1066
+ # The list of fields to update.
1067
+ # The only currently supported fields are:
1068
+ # `snapshot_auto_delete_behavior`
1069
+ # `snapshot_schedule_policy_name`
1070
+ # 'labels'
1071
+ # 'snapshot_enabled'
1072
+ # 'snapshot_reservation_detail.reserved_space_percent'
1073
+ #
1074
+ # @yield [response, operation] Access the result along with the RPC operation
1075
+ # @yieldparam response [::Gapic::Operation]
1076
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
1077
+ #
1078
+ # @return [::Gapic::Operation]
1079
+ #
1080
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
1081
+ #
1082
+ # @example Basic example
1083
+ # require "google/cloud/bare_metal_solution/v2"
1084
+ #
1085
+ # # Create a client object. The client can be reused for multiple calls.
1086
+ # client = Google::Cloud::BareMetalSolution::V2::BareMetalSolution::Client.new
1087
+ #
1088
+ # # Create a request. To set request fields, pass in keyword arguments.
1089
+ # request = Google::Cloud::BareMetalSolution::V2::UpdateVolumeRequest.new
1090
+ #
1091
+ # # Call the update_volume method.
1092
+ # result = client.update_volume request
1093
+ #
1094
+ # # The returned object is of type Gapic::Operation. You can use this
1095
+ # # object to check the status of an operation, cancel it, or wait
1096
+ # # for results. Here is how to block until completion:
1097
+ # result.wait_until_done! timeout: 60
1098
+ # if result.response?
1099
+ # p result.response
1100
+ # else
1101
+ # puts "Error!"
1102
+ # end
1103
+ #
1104
+ def update_volume request, options = nil
1105
+ raise ::ArgumentError, "request must be provided" if request.nil?
1106
+
1107
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::BareMetalSolution::V2::UpdateVolumeRequest
1108
+
1109
+ # Converts hash and nil to an options object
1110
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1111
+
1112
+ # Customize the options with defaults
1113
+ metadata = @config.rpcs.update_volume.metadata.to_h
1114
+
1115
+ # Set x-goog-api-client and x-goog-user-project headers
1116
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1117
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1118
+ gapic_version: ::Google::Cloud::BareMetalSolution::V2::VERSION
1119
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1120
+
1121
+ header_params = {}
1122
+ if request.volume&.name
1123
+ header_params["volume.name"] = request.volume.name
1124
+ end
1125
+
1126
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1127
+ metadata[:"x-goog-request-params"] ||= request_params_header
1128
+
1129
+ options.apply_defaults timeout: @config.rpcs.update_volume.timeout,
1130
+ metadata: metadata,
1131
+ retry_policy: @config.rpcs.update_volume.retry_policy
1132
+
1133
+ options.apply_defaults timeout: @config.timeout,
1134
+ metadata: @config.metadata,
1135
+ retry_policy: @config.retry_policy
1136
+
1137
+ @bare_metal_solution_stub.call_rpc :update_volume, request, options: options do |response, operation|
1138
+ response = ::Gapic::Operation.new response, @operations_client, options: options
1139
+ yield response, operation if block_given?
1140
+ return response
1141
+ end
1142
+ rescue ::GRPC::BadStatus => e
1143
+ raise ::Google::Cloud::Error.from_error(e)
1144
+ end
1145
+
1146
+ ##
1147
+ # Emergency Volume resize.
1148
+ #
1149
+ # @overload resize_volume(request, options = nil)
1150
+ # Pass arguments to `resize_volume` via a request object, either of type
1151
+ # {::Google::Cloud::BareMetalSolution::V2::ResizeVolumeRequest} or an equivalent Hash.
1152
+ #
1153
+ # @param request [::Google::Cloud::BareMetalSolution::V2::ResizeVolumeRequest, ::Hash]
1154
+ # A request object representing the call parameters. Required. To specify no
1155
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1156
+ # @param options [::Gapic::CallOptions, ::Hash]
1157
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
1158
+ #
1159
+ # @overload resize_volume(volume: nil, size_gib: nil)
1160
+ # Pass arguments to `resize_volume` via keyword arguments. Note that at
1161
+ # least one keyword argument is required. To specify no parameters, or to keep all
1162
+ # the default parameter values, pass an empty Hash as a request object (see above).
1163
+ #
1164
+ # @param volume [::String]
1165
+ # Required. Volume to resize.
1166
+ # @param size_gib [::Integer]
1167
+ # New Volume size, in GiB.
1168
+ #
1169
+ # @yield [response, operation] Access the result along with the RPC operation
1170
+ # @yieldparam response [::Gapic::Operation]
1171
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
1172
+ #
1173
+ # @return [::Gapic::Operation]
1174
+ #
1175
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
1176
+ #
1177
+ # @example Basic example
1178
+ # require "google/cloud/bare_metal_solution/v2"
1179
+ #
1180
+ # # Create a client object. The client can be reused for multiple calls.
1181
+ # client = Google::Cloud::BareMetalSolution::V2::BareMetalSolution::Client.new
1182
+ #
1183
+ # # Create a request. To set request fields, pass in keyword arguments.
1184
+ # request = Google::Cloud::BareMetalSolution::V2::ResizeVolumeRequest.new
1185
+ #
1186
+ # # Call the resize_volume method.
1187
+ # result = client.resize_volume request
1188
+ #
1189
+ # # The returned object is of type Gapic::Operation. You can use this
1190
+ # # object to check the status of an operation, cancel it, or wait
1191
+ # # for results. Here is how to block until completion:
1192
+ # result.wait_until_done! timeout: 60
1193
+ # if result.response?
1194
+ # p result.response
1195
+ # else
1196
+ # puts "Error!"
1197
+ # end
1198
+ #
1199
+ def resize_volume request, options = nil
1200
+ raise ::ArgumentError, "request must be provided" if request.nil?
1201
+
1202
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::BareMetalSolution::V2::ResizeVolumeRequest
1203
+
1204
+ # Converts hash and nil to an options object
1205
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1206
+
1207
+ # Customize the options with defaults
1208
+ metadata = @config.rpcs.resize_volume.metadata.to_h
1209
+
1210
+ # Set x-goog-api-client and x-goog-user-project headers
1211
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1212
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1213
+ gapic_version: ::Google::Cloud::BareMetalSolution::V2::VERSION
1214
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1215
+
1216
+ header_params = {}
1217
+ if request.volume
1218
+ header_params["volume"] = request.volume
1219
+ end
1220
+
1221
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1222
+ metadata[:"x-goog-request-params"] ||= request_params_header
1223
+
1224
+ options.apply_defaults timeout: @config.rpcs.resize_volume.timeout,
1225
+ metadata: metadata,
1226
+ retry_policy: @config.rpcs.resize_volume.retry_policy
1227
+
1228
+ options.apply_defaults timeout: @config.timeout,
1229
+ metadata: @config.metadata,
1230
+ retry_policy: @config.retry_policy
1231
+
1232
+ @bare_metal_solution_stub.call_rpc :resize_volume, request, options: options do |response, operation|
1233
+ response = ::Gapic::Operation.new response, @operations_client, options: options
1234
+ yield response, operation if block_given?
1235
+ return response
1236
+ end
1237
+ rescue ::GRPC::BadStatus => e
1238
+ raise ::Google::Cloud::Error.from_error(e)
1239
+ end
1240
+
1241
+ ##
1242
+ # List network in a given project and location.
1243
+ #
1244
+ # @overload list_networks(request, options = nil)
1245
+ # Pass arguments to `list_networks` via a request object, either of type
1246
+ # {::Google::Cloud::BareMetalSolution::V2::ListNetworksRequest} or an equivalent Hash.
1247
+ #
1248
+ # @param request [::Google::Cloud::BareMetalSolution::V2::ListNetworksRequest, ::Hash]
1249
+ # A request object representing the call parameters. Required. To specify no
1250
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1251
+ # @param options [::Gapic::CallOptions, ::Hash]
1252
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
1253
+ #
1254
+ # @overload list_networks(parent: nil, page_size: nil, page_token: nil, filter: nil)
1255
+ # Pass arguments to `list_networks` via keyword arguments. Note that at
1256
+ # least one keyword argument is required. To specify no parameters, or to keep all
1257
+ # the default parameter values, pass an empty Hash as a request object (see above).
1258
+ #
1259
+ # @param parent [::String]
1260
+ # Required. Parent value for ListNetworksRequest.
1261
+ # @param page_size [::Integer]
1262
+ # Requested page size. The server might return fewer items than requested.
1263
+ # If unspecified, server will pick an appropriate default.
1264
+ # @param page_token [::String]
1265
+ # A token identifying a page of results from the server.
1266
+ # @param filter [::String]
1267
+ # List filter.
1268
+ #
1269
+ # @yield [response, operation] Access the result along with the RPC operation
1270
+ # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::BareMetalSolution::V2::Network>]
1271
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
1272
+ #
1273
+ # @return [::Gapic::PagedEnumerable<::Google::Cloud::BareMetalSolution::V2::Network>]
1274
+ #
1275
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
1276
+ #
1277
+ # @example Basic example
1278
+ # require "google/cloud/bare_metal_solution/v2"
1279
+ #
1280
+ # # Create a client object. The client can be reused for multiple calls.
1281
+ # client = Google::Cloud::BareMetalSolution::V2::BareMetalSolution::Client.new
1282
+ #
1283
+ # # Create a request. To set request fields, pass in keyword arguments.
1284
+ # request = Google::Cloud::BareMetalSolution::V2::ListNetworksRequest.new
1285
+ #
1286
+ # # Call the list_networks method.
1287
+ # result = client.list_networks request
1288
+ #
1289
+ # # The returned object is of type Gapic::PagedEnumerable. You can
1290
+ # # iterate over all elements by calling #each, and the enumerable
1291
+ # # will lazily make API calls to fetch subsequent pages. Other
1292
+ # # methods are also available for managing paging directly.
1293
+ # result.each do |response|
1294
+ # # Each element is of type ::Google::Cloud::BareMetalSolution::V2::Network.
1295
+ # p response
1296
+ # end
1297
+ #
1298
+ def list_networks request, options = nil
1299
+ raise ::ArgumentError, "request must be provided" if request.nil?
1300
+
1301
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::BareMetalSolution::V2::ListNetworksRequest
1302
+
1303
+ # Converts hash and nil to an options object
1304
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1305
+
1306
+ # Customize the options with defaults
1307
+ metadata = @config.rpcs.list_networks.metadata.to_h
1308
+
1309
+ # Set x-goog-api-client and x-goog-user-project headers
1310
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1311
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1312
+ gapic_version: ::Google::Cloud::BareMetalSolution::V2::VERSION
1313
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1314
+
1315
+ header_params = {}
1316
+ if request.parent
1317
+ header_params["parent"] = request.parent
1318
+ end
1319
+
1320
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1321
+ metadata[:"x-goog-request-params"] ||= request_params_header
1322
+
1323
+ options.apply_defaults timeout: @config.rpcs.list_networks.timeout,
1324
+ metadata: metadata,
1325
+ retry_policy: @config.rpcs.list_networks.retry_policy
1326
+
1327
+ options.apply_defaults timeout: @config.timeout,
1328
+ metadata: @config.metadata,
1329
+ retry_policy: @config.retry_policy
1330
+
1331
+ @bare_metal_solution_stub.call_rpc :list_networks, request, options: options do |response, operation|
1332
+ response = ::Gapic::PagedEnumerable.new @bare_metal_solution_stub, :list_networks, request, response, operation, options
1333
+ yield response, operation if block_given?
1334
+ return response
1335
+ end
1336
+ rescue ::GRPC::BadStatus => e
1337
+ raise ::Google::Cloud::Error.from_error(e)
1338
+ end
1339
+
1340
+ ##
1341
+ # List all Networks (and used IPs for each Network) in the vendor account
1342
+ # associated with the specified project.
1343
+ #
1344
+ # @overload list_network_usage(request, options = nil)
1345
+ # Pass arguments to `list_network_usage` via a request object, either of type
1346
+ # {::Google::Cloud::BareMetalSolution::V2::ListNetworkUsageRequest} or an equivalent Hash.
1347
+ #
1348
+ # @param request [::Google::Cloud::BareMetalSolution::V2::ListNetworkUsageRequest, ::Hash]
1349
+ # A request object representing the call parameters. Required. To specify no
1350
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1351
+ # @param options [::Gapic::CallOptions, ::Hash]
1352
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
1353
+ #
1354
+ # @overload list_network_usage(location: nil)
1355
+ # Pass arguments to `list_network_usage` via keyword arguments. Note that at
1356
+ # least one keyword argument is required. To specify no parameters, or to keep all
1357
+ # the default parameter values, pass an empty Hash as a request object (see above).
1358
+ #
1359
+ # @param location [::String]
1360
+ # Required. Parent value (project and location).
1361
+ #
1362
+ # @yield [response, operation] Access the result along with the RPC operation
1363
+ # @yieldparam response [::Google::Cloud::BareMetalSolution::V2::ListNetworkUsageResponse]
1364
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
1365
+ #
1366
+ # @return [::Google::Cloud::BareMetalSolution::V2::ListNetworkUsageResponse]
1367
+ #
1368
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
1369
+ #
1370
+ # @example Basic example
1371
+ # require "google/cloud/bare_metal_solution/v2"
1372
+ #
1373
+ # # Create a client object. The client can be reused for multiple calls.
1374
+ # client = Google::Cloud::BareMetalSolution::V2::BareMetalSolution::Client.new
1375
+ #
1376
+ # # Create a request. To set request fields, pass in keyword arguments.
1377
+ # request = Google::Cloud::BareMetalSolution::V2::ListNetworkUsageRequest.new
1378
+ #
1379
+ # # Call the list_network_usage method.
1380
+ # result = client.list_network_usage request
1381
+ #
1382
+ # # The returned object is of type Google::Cloud::BareMetalSolution::V2::ListNetworkUsageResponse.
1383
+ # p result
1384
+ #
1385
+ def list_network_usage request, options = nil
1386
+ raise ::ArgumentError, "request must be provided" if request.nil?
1387
+
1388
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::BareMetalSolution::V2::ListNetworkUsageRequest
1389
+
1390
+ # Converts hash and nil to an options object
1391
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1392
+
1393
+ # Customize the options with defaults
1394
+ metadata = @config.rpcs.list_network_usage.metadata.to_h
1395
+
1396
+ # Set x-goog-api-client and x-goog-user-project headers
1397
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1398
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1399
+ gapic_version: ::Google::Cloud::BareMetalSolution::V2::VERSION
1400
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1401
+
1402
+ header_params = {}
1403
+ if request.location
1404
+ header_params["location"] = request.location
1405
+ end
1406
+
1407
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1408
+ metadata[:"x-goog-request-params"] ||= request_params_header
1409
+
1410
+ options.apply_defaults timeout: @config.rpcs.list_network_usage.timeout,
1411
+ metadata: metadata,
1412
+ retry_policy: @config.rpcs.list_network_usage.retry_policy
1413
+
1414
+ options.apply_defaults timeout: @config.timeout,
1415
+ metadata: @config.metadata,
1416
+ retry_policy: @config.retry_policy
1417
+
1418
+ @bare_metal_solution_stub.call_rpc :list_network_usage, request, options: options do |response, operation|
1419
+ yield response, operation if block_given?
1420
+ return response
1421
+ end
1422
+ rescue ::GRPC::BadStatus => e
1423
+ raise ::Google::Cloud::Error.from_error(e)
1424
+ end
1425
+
1426
+ ##
1427
+ # Get details of a single network.
1428
+ #
1429
+ # @overload get_network(request, options = nil)
1430
+ # Pass arguments to `get_network` via a request object, either of type
1431
+ # {::Google::Cloud::BareMetalSolution::V2::GetNetworkRequest} or an equivalent Hash.
1432
+ #
1433
+ # @param request [::Google::Cloud::BareMetalSolution::V2::GetNetworkRequest, ::Hash]
1434
+ # A request object representing the call parameters. Required. To specify no
1435
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1436
+ # @param options [::Gapic::CallOptions, ::Hash]
1437
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
1438
+ #
1439
+ # @overload get_network(name: nil)
1440
+ # Pass arguments to `get_network` via keyword arguments. Note that at
1441
+ # least one keyword argument is required. To specify no parameters, or to keep all
1442
+ # the default parameter values, pass an empty Hash as a request object (see above).
1443
+ #
1444
+ # @param name [::String]
1445
+ # Required. Name of the resource.
1446
+ #
1447
+ # @yield [response, operation] Access the result along with the RPC operation
1448
+ # @yieldparam response [::Google::Cloud::BareMetalSolution::V2::Network]
1449
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
1450
+ #
1451
+ # @return [::Google::Cloud::BareMetalSolution::V2::Network]
1452
+ #
1453
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
1454
+ #
1455
+ # @example Basic example
1456
+ # require "google/cloud/bare_metal_solution/v2"
1457
+ #
1458
+ # # Create a client object. The client can be reused for multiple calls.
1459
+ # client = Google::Cloud::BareMetalSolution::V2::BareMetalSolution::Client.new
1460
+ #
1461
+ # # Create a request. To set request fields, pass in keyword arguments.
1462
+ # request = Google::Cloud::BareMetalSolution::V2::GetNetworkRequest.new
1463
+ #
1464
+ # # Call the get_network method.
1465
+ # result = client.get_network request
1466
+ #
1467
+ # # The returned object is of type Google::Cloud::BareMetalSolution::V2::Network.
1468
+ # p result
1469
+ #
1470
+ def get_network request, options = nil
1471
+ raise ::ArgumentError, "request must be provided" if request.nil?
1472
+
1473
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::BareMetalSolution::V2::GetNetworkRequest
1474
+
1475
+ # Converts hash and nil to an options object
1476
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1477
+
1478
+ # Customize the options with defaults
1479
+ metadata = @config.rpcs.get_network.metadata.to_h
1480
+
1481
+ # Set x-goog-api-client and x-goog-user-project headers
1482
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1483
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1484
+ gapic_version: ::Google::Cloud::BareMetalSolution::V2::VERSION
1485
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1486
+
1487
+ header_params = {}
1488
+ if request.name
1489
+ header_params["name"] = request.name
1490
+ end
1491
+
1492
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1493
+ metadata[:"x-goog-request-params"] ||= request_params_header
1494
+
1495
+ options.apply_defaults timeout: @config.rpcs.get_network.timeout,
1496
+ metadata: metadata,
1497
+ retry_policy: @config.rpcs.get_network.retry_policy
1498
+
1499
+ options.apply_defaults timeout: @config.timeout,
1500
+ metadata: @config.metadata,
1501
+ retry_policy: @config.retry_policy
1502
+
1503
+ @bare_metal_solution_stub.call_rpc :get_network, request, options: options do |response, operation|
1504
+ yield response, operation if block_given?
1505
+ return response
1506
+ end
1507
+ rescue ::GRPC::BadStatus => e
1508
+ raise ::Google::Cloud::Error.from_error(e)
1509
+ end
1510
+
1511
+ ##
1512
+ # Update details of a single network.
1513
+ #
1514
+ # @overload update_network(request, options = nil)
1515
+ # Pass arguments to `update_network` via a request object, either of type
1516
+ # {::Google::Cloud::BareMetalSolution::V2::UpdateNetworkRequest} or an equivalent Hash.
1517
+ #
1518
+ # @param request [::Google::Cloud::BareMetalSolution::V2::UpdateNetworkRequest, ::Hash]
1519
+ # A request object representing the call parameters. Required. To specify no
1520
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1521
+ # @param options [::Gapic::CallOptions, ::Hash]
1522
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
1523
+ #
1524
+ # @overload update_network(network: nil, update_mask: nil)
1525
+ # Pass arguments to `update_network` via keyword arguments. Note that at
1526
+ # least one keyword argument is required. To specify no parameters, or to keep all
1527
+ # the default parameter values, pass an empty Hash as a request object (see above).
1528
+ #
1529
+ # @param network [::Google::Cloud::BareMetalSolution::V2::Network, ::Hash]
1530
+ # Required. The network to update.
1531
+ #
1532
+ # The `name` field is used to identify the instance to update.
1533
+ # Format: projects/\\{project}/locations/\\{location}/networks/\\{network}
1534
+ # @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
1535
+ # The list of fields to update.
1536
+ # The only currently supported fields are:
1537
+ # `labels`, `reservations`
1538
+ #
1539
+ # @yield [response, operation] Access the result along with the RPC operation
1540
+ # @yieldparam response [::Gapic::Operation]
1541
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
1542
+ #
1543
+ # @return [::Gapic::Operation]
1544
+ #
1545
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
1546
+ #
1547
+ # @example Basic example
1548
+ # require "google/cloud/bare_metal_solution/v2"
1549
+ #
1550
+ # # Create a client object. The client can be reused for multiple calls.
1551
+ # client = Google::Cloud::BareMetalSolution::V2::BareMetalSolution::Client.new
1552
+ #
1553
+ # # Create a request. To set request fields, pass in keyword arguments.
1554
+ # request = Google::Cloud::BareMetalSolution::V2::UpdateNetworkRequest.new
1555
+ #
1556
+ # # Call the update_network method.
1557
+ # result = client.update_network request
1558
+ #
1559
+ # # The returned object is of type Gapic::Operation. You can use this
1560
+ # # object to check the status of an operation, cancel it, or wait
1561
+ # # for results. Here is how to block until completion:
1562
+ # result.wait_until_done! timeout: 60
1563
+ # if result.response?
1564
+ # p result.response
1565
+ # else
1566
+ # puts "Error!"
1567
+ # end
1568
+ #
1569
+ def update_network request, options = nil
1570
+ raise ::ArgumentError, "request must be provided" if request.nil?
1571
+
1572
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::BareMetalSolution::V2::UpdateNetworkRequest
1573
+
1574
+ # Converts hash and nil to an options object
1575
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1576
+
1577
+ # Customize the options with defaults
1578
+ metadata = @config.rpcs.update_network.metadata.to_h
1579
+
1580
+ # Set x-goog-api-client and x-goog-user-project headers
1581
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1582
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1583
+ gapic_version: ::Google::Cloud::BareMetalSolution::V2::VERSION
1584
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1585
+
1586
+ header_params = {}
1587
+ if request.network&.name
1588
+ header_params["network.name"] = request.network.name
1589
+ end
1590
+
1591
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1592
+ metadata[:"x-goog-request-params"] ||= request_params_header
1593
+
1594
+ options.apply_defaults timeout: @config.rpcs.update_network.timeout,
1595
+ metadata: metadata,
1596
+ retry_policy: @config.rpcs.update_network.retry_policy
1597
+
1598
+ options.apply_defaults timeout: @config.timeout,
1599
+ metadata: @config.metadata,
1600
+ retry_policy: @config.retry_policy
1601
+
1602
+ @bare_metal_solution_stub.call_rpc :update_network, request, options: options do |response, operation|
1603
+ response = ::Gapic::Operation.new response, @operations_client, options: options
1604
+ yield response, operation if block_given?
1605
+ return response
1606
+ end
1607
+ rescue ::GRPC::BadStatus => e
1608
+ raise ::Google::Cloud::Error.from_error(e)
1609
+ end
1610
+
1611
+ ##
1612
+ # Get details of a single storage logical unit number(LUN).
1613
+ #
1614
+ # @overload get_lun(request, options = nil)
1615
+ # Pass arguments to `get_lun` via a request object, either of type
1616
+ # {::Google::Cloud::BareMetalSolution::V2::GetLunRequest} or an equivalent Hash.
1617
+ #
1618
+ # @param request [::Google::Cloud::BareMetalSolution::V2::GetLunRequest, ::Hash]
1619
+ # A request object representing the call parameters. Required. To specify no
1620
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1621
+ # @param options [::Gapic::CallOptions, ::Hash]
1622
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
1623
+ #
1624
+ # @overload get_lun(name: nil)
1625
+ # Pass arguments to `get_lun` via keyword arguments. Note that at
1626
+ # least one keyword argument is required. To specify no parameters, or to keep all
1627
+ # the default parameter values, pass an empty Hash as a request object (see above).
1628
+ #
1629
+ # @param name [::String]
1630
+ # Required. Name of the resource.
1631
+ #
1632
+ # @yield [response, operation] Access the result along with the RPC operation
1633
+ # @yieldparam response [::Google::Cloud::BareMetalSolution::V2::Lun]
1634
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
1635
+ #
1636
+ # @return [::Google::Cloud::BareMetalSolution::V2::Lun]
1637
+ #
1638
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
1639
+ #
1640
+ # @example Basic example
1641
+ # require "google/cloud/bare_metal_solution/v2"
1642
+ #
1643
+ # # Create a client object. The client can be reused for multiple calls.
1644
+ # client = Google::Cloud::BareMetalSolution::V2::BareMetalSolution::Client.new
1645
+ #
1646
+ # # Create a request. To set request fields, pass in keyword arguments.
1647
+ # request = Google::Cloud::BareMetalSolution::V2::GetLunRequest.new
1648
+ #
1649
+ # # Call the get_lun method.
1650
+ # result = client.get_lun request
1651
+ #
1652
+ # # The returned object is of type Google::Cloud::BareMetalSolution::V2::Lun.
1653
+ # p result
1654
+ #
1655
+ def get_lun request, options = nil
1656
+ raise ::ArgumentError, "request must be provided" if request.nil?
1657
+
1658
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::BareMetalSolution::V2::GetLunRequest
1659
+
1660
+ # Converts hash and nil to an options object
1661
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1662
+
1663
+ # Customize the options with defaults
1664
+ metadata = @config.rpcs.get_lun.metadata.to_h
1665
+
1666
+ # Set x-goog-api-client and x-goog-user-project headers
1667
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1668
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1669
+ gapic_version: ::Google::Cloud::BareMetalSolution::V2::VERSION
1670
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1671
+
1672
+ header_params = {}
1673
+ if request.name
1674
+ header_params["name"] = request.name
1675
+ end
1676
+
1677
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1678
+ metadata[:"x-goog-request-params"] ||= request_params_header
1679
+
1680
+ options.apply_defaults timeout: @config.rpcs.get_lun.timeout,
1681
+ metadata: metadata,
1682
+ retry_policy: @config.rpcs.get_lun.retry_policy
1683
+
1684
+ options.apply_defaults timeout: @config.timeout,
1685
+ metadata: @config.metadata,
1686
+ retry_policy: @config.retry_policy
1687
+
1688
+ @bare_metal_solution_stub.call_rpc :get_lun, request, options: options do |response, operation|
1689
+ yield response, operation if block_given?
1690
+ return response
1691
+ end
1692
+ rescue ::GRPC::BadStatus => e
1693
+ raise ::Google::Cloud::Error.from_error(e)
1694
+ end
1695
+
1696
+ ##
1697
+ # List storage volume luns for given storage volume.
1698
+ #
1699
+ # @overload list_luns(request, options = nil)
1700
+ # Pass arguments to `list_luns` via a request object, either of type
1701
+ # {::Google::Cloud::BareMetalSolution::V2::ListLunsRequest} or an equivalent Hash.
1702
+ #
1703
+ # @param request [::Google::Cloud::BareMetalSolution::V2::ListLunsRequest, ::Hash]
1704
+ # A request object representing the call parameters. Required. To specify no
1705
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1706
+ # @param options [::Gapic::CallOptions, ::Hash]
1707
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
1708
+ #
1709
+ # @overload list_luns(parent: nil, page_size: nil, page_token: nil)
1710
+ # Pass arguments to `list_luns` via keyword arguments. Note that at
1711
+ # least one keyword argument is required. To specify no parameters, or to keep all
1712
+ # the default parameter values, pass an empty Hash as a request object (see above).
1713
+ #
1714
+ # @param parent [::String]
1715
+ # Required. Parent value for ListLunsRequest.
1716
+ # @param page_size [::Integer]
1717
+ # Requested page size. The server might return fewer items than requested.
1718
+ # If unspecified, server will pick an appropriate default.
1719
+ # @param page_token [::String]
1720
+ # A token identifying a page of results from the server.
1721
+ #
1722
+ # @yield [response, operation] Access the result along with the RPC operation
1723
+ # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::BareMetalSolution::V2::Lun>]
1724
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
1725
+ #
1726
+ # @return [::Gapic::PagedEnumerable<::Google::Cloud::BareMetalSolution::V2::Lun>]
1727
+ #
1728
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
1729
+ #
1730
+ # @example Basic example
1731
+ # require "google/cloud/bare_metal_solution/v2"
1732
+ #
1733
+ # # Create a client object. The client can be reused for multiple calls.
1734
+ # client = Google::Cloud::BareMetalSolution::V2::BareMetalSolution::Client.new
1735
+ #
1736
+ # # Create a request. To set request fields, pass in keyword arguments.
1737
+ # request = Google::Cloud::BareMetalSolution::V2::ListLunsRequest.new
1738
+ #
1739
+ # # Call the list_luns method.
1740
+ # result = client.list_luns request
1741
+ #
1742
+ # # The returned object is of type Gapic::PagedEnumerable. You can
1743
+ # # iterate over all elements by calling #each, and the enumerable
1744
+ # # will lazily make API calls to fetch subsequent pages. Other
1745
+ # # methods are also available for managing paging directly.
1746
+ # result.each do |response|
1747
+ # # Each element is of type ::Google::Cloud::BareMetalSolution::V2::Lun.
1748
+ # p response
1749
+ # end
1750
+ #
1751
+ def list_luns request, options = nil
1752
+ raise ::ArgumentError, "request must be provided" if request.nil?
1753
+
1754
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::BareMetalSolution::V2::ListLunsRequest
1755
+
1756
+ # Converts hash and nil to an options object
1757
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1758
+
1759
+ # Customize the options with defaults
1760
+ metadata = @config.rpcs.list_luns.metadata.to_h
1761
+
1762
+ # Set x-goog-api-client and x-goog-user-project headers
1763
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1764
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1765
+ gapic_version: ::Google::Cloud::BareMetalSolution::V2::VERSION
1766
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1767
+
1768
+ header_params = {}
1769
+ if request.parent
1770
+ header_params["parent"] = request.parent
1771
+ end
1772
+
1773
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1774
+ metadata[:"x-goog-request-params"] ||= request_params_header
1775
+
1776
+ options.apply_defaults timeout: @config.rpcs.list_luns.timeout,
1777
+ metadata: metadata,
1778
+ retry_policy: @config.rpcs.list_luns.retry_policy
1779
+
1780
+ options.apply_defaults timeout: @config.timeout,
1781
+ metadata: @config.metadata,
1782
+ retry_policy: @config.retry_policy
1783
+
1784
+ @bare_metal_solution_stub.call_rpc :list_luns, request, options: options do |response, operation|
1785
+ response = ::Gapic::PagedEnumerable.new @bare_metal_solution_stub, :list_luns, request, response, operation, options
1786
+ yield response, operation if block_given?
1787
+ return response
1788
+ end
1789
+ rescue ::GRPC::BadStatus => e
1790
+ raise ::Google::Cloud::Error.from_error(e)
1791
+ end
1792
+
1793
+ ##
1794
+ # Get details of a single NFS share.
1795
+ #
1796
+ # @overload get_nfs_share(request, options = nil)
1797
+ # Pass arguments to `get_nfs_share` via a request object, either of type
1798
+ # {::Google::Cloud::BareMetalSolution::V2::GetNfsShareRequest} or an equivalent Hash.
1799
+ #
1800
+ # @param request [::Google::Cloud::BareMetalSolution::V2::GetNfsShareRequest, ::Hash]
1801
+ # A request object representing the call parameters. Required. To specify no
1802
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1803
+ # @param options [::Gapic::CallOptions, ::Hash]
1804
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
1805
+ #
1806
+ # @overload get_nfs_share(name: nil)
1807
+ # Pass arguments to `get_nfs_share` via keyword arguments. Note that at
1808
+ # least one keyword argument is required. To specify no parameters, or to keep all
1809
+ # the default parameter values, pass an empty Hash as a request object (see above).
1810
+ #
1811
+ # @param name [::String]
1812
+ # Required. Name of the resource.
1813
+ #
1814
+ # @yield [response, operation] Access the result along with the RPC operation
1815
+ # @yieldparam response [::Google::Cloud::BareMetalSolution::V2::NfsShare]
1816
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
1817
+ #
1818
+ # @return [::Google::Cloud::BareMetalSolution::V2::NfsShare]
1819
+ #
1820
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
1821
+ #
1822
+ # @example Basic example
1823
+ # require "google/cloud/bare_metal_solution/v2"
1824
+ #
1825
+ # # Create a client object. The client can be reused for multiple calls.
1826
+ # client = Google::Cloud::BareMetalSolution::V2::BareMetalSolution::Client.new
1827
+ #
1828
+ # # Create a request. To set request fields, pass in keyword arguments.
1829
+ # request = Google::Cloud::BareMetalSolution::V2::GetNfsShareRequest.new
1830
+ #
1831
+ # # Call the get_nfs_share method.
1832
+ # result = client.get_nfs_share request
1833
+ #
1834
+ # # The returned object is of type Google::Cloud::BareMetalSolution::V2::NfsShare.
1835
+ # p result
1836
+ #
1837
+ def get_nfs_share request, options = nil
1838
+ raise ::ArgumentError, "request must be provided" if request.nil?
1839
+
1840
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::BareMetalSolution::V2::GetNfsShareRequest
1841
+
1842
+ # Converts hash and nil to an options object
1843
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1844
+
1845
+ # Customize the options with defaults
1846
+ metadata = @config.rpcs.get_nfs_share.metadata.to_h
1847
+
1848
+ # Set x-goog-api-client and x-goog-user-project headers
1849
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1850
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1851
+ gapic_version: ::Google::Cloud::BareMetalSolution::V2::VERSION
1852
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1853
+
1854
+ header_params = {}
1855
+ if request.name
1856
+ header_params["name"] = request.name
1857
+ end
1858
+
1859
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1860
+ metadata[:"x-goog-request-params"] ||= request_params_header
1861
+
1862
+ options.apply_defaults timeout: @config.rpcs.get_nfs_share.timeout,
1863
+ metadata: metadata,
1864
+ retry_policy: @config.rpcs.get_nfs_share.retry_policy
1865
+
1866
+ options.apply_defaults timeout: @config.timeout,
1867
+ metadata: @config.metadata,
1868
+ retry_policy: @config.retry_policy
1869
+
1870
+ @bare_metal_solution_stub.call_rpc :get_nfs_share, request, options: options do |response, operation|
1871
+ yield response, operation if block_given?
1872
+ return response
1873
+ end
1874
+ rescue ::GRPC::BadStatus => e
1875
+ raise ::Google::Cloud::Error.from_error(e)
1876
+ end
1877
+
1878
+ ##
1879
+ # List NFS shares.
1880
+ #
1881
+ # @overload list_nfs_shares(request, options = nil)
1882
+ # Pass arguments to `list_nfs_shares` via a request object, either of type
1883
+ # {::Google::Cloud::BareMetalSolution::V2::ListNfsSharesRequest} or an equivalent Hash.
1884
+ #
1885
+ # @param request [::Google::Cloud::BareMetalSolution::V2::ListNfsSharesRequest, ::Hash]
1886
+ # A request object representing the call parameters. Required. To specify no
1887
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1888
+ # @param options [::Gapic::CallOptions, ::Hash]
1889
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
1890
+ #
1891
+ # @overload list_nfs_shares(parent: nil, page_size: nil, page_token: nil, filter: nil)
1892
+ # Pass arguments to `list_nfs_shares` via keyword arguments. Note that at
1893
+ # least one keyword argument is required. To specify no parameters, or to keep all
1894
+ # the default parameter values, pass an empty Hash as a request object (see above).
1895
+ #
1896
+ # @param parent [::String]
1897
+ # Required. Parent value for ListNfsSharesRequest.
1898
+ # @param page_size [::Integer]
1899
+ # Requested page size. The server might return fewer items than requested.
1900
+ # If unspecified, server will pick an appropriate default.
1901
+ # @param page_token [::String]
1902
+ # A token identifying a page of results from the server.
1903
+ # @param filter [::String]
1904
+ # List filter.
1905
+ #
1906
+ # @yield [response, operation] Access the result along with the RPC operation
1907
+ # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::BareMetalSolution::V2::NfsShare>]
1908
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
1909
+ #
1910
+ # @return [::Gapic::PagedEnumerable<::Google::Cloud::BareMetalSolution::V2::NfsShare>]
1911
+ #
1912
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
1913
+ #
1914
+ # @example Basic example
1915
+ # require "google/cloud/bare_metal_solution/v2"
1916
+ #
1917
+ # # Create a client object. The client can be reused for multiple calls.
1918
+ # client = Google::Cloud::BareMetalSolution::V2::BareMetalSolution::Client.new
1919
+ #
1920
+ # # Create a request. To set request fields, pass in keyword arguments.
1921
+ # request = Google::Cloud::BareMetalSolution::V2::ListNfsSharesRequest.new
1922
+ #
1923
+ # # Call the list_nfs_shares method.
1924
+ # result = client.list_nfs_shares request
1925
+ #
1926
+ # # The returned object is of type Gapic::PagedEnumerable. You can
1927
+ # # iterate over all elements by calling #each, and the enumerable
1928
+ # # will lazily make API calls to fetch subsequent pages. Other
1929
+ # # methods are also available for managing paging directly.
1930
+ # result.each do |response|
1931
+ # # Each element is of type ::Google::Cloud::BareMetalSolution::V2::NfsShare.
1932
+ # p response
1933
+ # end
1934
+ #
1935
+ def list_nfs_shares request, options = nil
1936
+ raise ::ArgumentError, "request must be provided" if request.nil?
1937
+
1938
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::BareMetalSolution::V2::ListNfsSharesRequest
1939
+
1940
+ # Converts hash and nil to an options object
1941
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1942
+
1943
+ # Customize the options with defaults
1944
+ metadata = @config.rpcs.list_nfs_shares.metadata.to_h
1945
+
1946
+ # Set x-goog-api-client and x-goog-user-project headers
1947
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1948
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1949
+ gapic_version: ::Google::Cloud::BareMetalSolution::V2::VERSION
1950
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1951
+
1952
+ header_params = {}
1953
+ if request.parent
1954
+ header_params["parent"] = request.parent
1955
+ end
1956
+
1957
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1958
+ metadata[:"x-goog-request-params"] ||= request_params_header
1959
+
1960
+ options.apply_defaults timeout: @config.rpcs.list_nfs_shares.timeout,
1961
+ metadata: metadata,
1962
+ retry_policy: @config.rpcs.list_nfs_shares.retry_policy
1963
+
1964
+ options.apply_defaults timeout: @config.timeout,
1965
+ metadata: @config.metadata,
1966
+ retry_policy: @config.retry_policy
1967
+
1968
+ @bare_metal_solution_stub.call_rpc :list_nfs_shares, request, options: options do |response, operation|
1969
+ response = ::Gapic::PagedEnumerable.new @bare_metal_solution_stub, :list_nfs_shares, request, response, operation, options
1970
+ yield response, operation if block_given?
1971
+ return response
1972
+ end
1973
+ rescue ::GRPC::BadStatus => e
1974
+ raise ::Google::Cloud::Error.from_error(e)
1975
+ end
1976
+
1977
+ ##
1978
+ # Update details of a single NFS share.
1979
+ #
1980
+ # @overload update_nfs_share(request, options = nil)
1981
+ # Pass arguments to `update_nfs_share` via a request object, either of type
1982
+ # {::Google::Cloud::BareMetalSolution::V2::UpdateNfsShareRequest} or an equivalent Hash.
1983
+ #
1984
+ # @param request [::Google::Cloud::BareMetalSolution::V2::UpdateNfsShareRequest, ::Hash]
1985
+ # A request object representing the call parameters. Required. To specify no
1986
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1987
+ # @param options [::Gapic::CallOptions, ::Hash]
1988
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
1989
+ #
1990
+ # @overload update_nfs_share(nfs_share: nil, update_mask: nil)
1991
+ # Pass arguments to `update_nfs_share` via keyword arguments. Note that at
1992
+ # least one keyword argument is required. To specify no parameters, or to keep all
1993
+ # the default parameter values, pass an empty Hash as a request object (see above).
1994
+ #
1995
+ # @param nfs_share [::Google::Cloud::BareMetalSolution::V2::NfsShare, ::Hash]
1996
+ # Required. The NFS share to update.
1997
+ #
1998
+ # The `name` field is used to identify the NFS share to update.
1999
+ # Format: projects/\\{project}/locations/\\{location}/nfsShares/\\{nfs_share}
2000
+ # @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
2001
+ # The list of fields to update.
2002
+ # The only currently supported fields are:
2003
+ # `labels`
2004
+ #
2005
+ # @yield [response, operation] Access the result along with the RPC operation
2006
+ # @yieldparam response [::Gapic::Operation]
2007
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
2008
+ #
2009
+ # @return [::Gapic::Operation]
2010
+ #
2011
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
2012
+ #
2013
+ # @example Basic example
2014
+ # require "google/cloud/bare_metal_solution/v2"
2015
+ #
2016
+ # # Create a client object. The client can be reused for multiple calls.
2017
+ # client = Google::Cloud::BareMetalSolution::V2::BareMetalSolution::Client.new
2018
+ #
2019
+ # # Create a request. To set request fields, pass in keyword arguments.
2020
+ # request = Google::Cloud::BareMetalSolution::V2::UpdateNfsShareRequest.new
2021
+ #
2022
+ # # Call the update_nfs_share method.
2023
+ # result = client.update_nfs_share request
2024
+ #
2025
+ # # The returned object is of type Gapic::Operation. You can use this
2026
+ # # object to check the status of an operation, cancel it, or wait
2027
+ # # for results. Here is how to block until completion:
2028
+ # result.wait_until_done! timeout: 60
2029
+ # if result.response?
2030
+ # p result.response
2031
+ # else
2032
+ # puts "Error!"
2033
+ # end
2034
+ #
2035
+ def update_nfs_share request, options = nil
2036
+ raise ::ArgumentError, "request must be provided" if request.nil?
2037
+
2038
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::BareMetalSolution::V2::UpdateNfsShareRequest
2039
+
2040
+ # Converts hash and nil to an options object
2041
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
2042
+
2043
+ # Customize the options with defaults
2044
+ metadata = @config.rpcs.update_nfs_share.metadata.to_h
2045
+
2046
+ # Set x-goog-api-client and x-goog-user-project headers
2047
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
2048
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
2049
+ gapic_version: ::Google::Cloud::BareMetalSolution::V2::VERSION
2050
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
2051
+
2052
+ header_params = {}
2053
+ if request.nfs_share&.name
2054
+ header_params["nfs_share.name"] = request.nfs_share.name
2055
+ end
2056
+
2057
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
2058
+ metadata[:"x-goog-request-params"] ||= request_params_header
2059
+
2060
+ options.apply_defaults timeout: @config.rpcs.update_nfs_share.timeout,
2061
+ metadata: metadata,
2062
+ retry_policy: @config.rpcs.update_nfs_share.retry_policy
2063
+
2064
+ options.apply_defaults timeout: @config.timeout,
2065
+ metadata: @config.metadata,
2066
+ retry_policy: @config.retry_policy
2067
+
2068
+ @bare_metal_solution_stub.call_rpc :update_nfs_share, request, options: options do |response, operation|
2069
+ response = ::Gapic::Operation.new response, @operations_client, options: options
2070
+ yield response, operation if block_given?
2071
+ return response
2072
+ end
2073
+ rescue ::GRPC::BadStatus => e
2074
+ raise ::Google::Cloud::Error.from_error(e)
2075
+ end
2076
+
2077
+ ##
2078
+ # Configuration class for the BareMetalSolution API.
2079
+ #
2080
+ # This class represents the configuration for BareMetalSolution,
2081
+ # providing control over timeouts, retry behavior, logging, transport
2082
+ # parameters, and other low-level controls. Certain parameters can also be
2083
+ # applied individually to specific RPCs. See
2084
+ # {::Google::Cloud::BareMetalSolution::V2::BareMetalSolution::Client::Configuration::Rpcs}
2085
+ # for a list of RPCs that can be configured independently.
2086
+ #
2087
+ # Configuration can be applied globally to all clients, or to a single client
2088
+ # on construction.
2089
+ #
2090
+ # @example
2091
+ #
2092
+ # # Modify the global config, setting the timeout for
2093
+ # # list_instances to 20 seconds,
2094
+ # # and all remaining timeouts to 10 seconds.
2095
+ # ::Google::Cloud::BareMetalSolution::V2::BareMetalSolution::Client.configure do |config|
2096
+ # config.timeout = 10.0
2097
+ # config.rpcs.list_instances.timeout = 20.0
2098
+ # end
2099
+ #
2100
+ # # Apply the above configuration only to a new client.
2101
+ # client = ::Google::Cloud::BareMetalSolution::V2::BareMetalSolution::Client.new do |config|
2102
+ # config.timeout = 10.0
2103
+ # config.rpcs.list_instances.timeout = 20.0
2104
+ # end
2105
+ #
2106
+ # @!attribute [rw] endpoint
2107
+ # The hostname or hostname:port of the service endpoint.
2108
+ # Defaults to `"baremetalsolution.googleapis.com"`.
2109
+ # @return [::String]
2110
+ # @!attribute [rw] credentials
2111
+ # Credentials to send with calls. You may provide any of the following types:
2112
+ # * (`String`) The path to a service account key file in JSON format
2113
+ # * (`Hash`) A service account key as a Hash
2114
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
2115
+ # (see the [googleauth docs](https://googleapis.dev/ruby/googleauth/latest/index.html))
2116
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
2117
+ # (see the [signet docs](https://googleapis.dev/ruby/signet/latest/Signet/OAuth2/Client.html))
2118
+ # * (`GRPC::Core::Channel`) a gRPC channel with included credentials
2119
+ # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
2120
+ # * (`nil`) indicating no credentials
2121
+ # @return [::Object]
2122
+ # @!attribute [rw] scope
2123
+ # The OAuth scopes
2124
+ # @return [::Array<::String>]
2125
+ # @!attribute [rw] lib_name
2126
+ # The library name as recorded in instrumentation and logging
2127
+ # @return [::String]
2128
+ # @!attribute [rw] lib_version
2129
+ # The library version as recorded in instrumentation and logging
2130
+ # @return [::String]
2131
+ # @!attribute [rw] channel_args
2132
+ # Extra parameters passed to the gRPC channel. Note: this is ignored if a
2133
+ # `GRPC::Core::Channel` object is provided as the credential.
2134
+ # @return [::Hash]
2135
+ # @!attribute [rw] interceptors
2136
+ # An array of interceptors that are run before calls are executed.
2137
+ # @return [::Array<::GRPC::ClientInterceptor>]
2138
+ # @!attribute [rw] timeout
2139
+ # The call timeout in seconds.
2140
+ # @return [::Numeric]
2141
+ # @!attribute [rw] metadata
2142
+ # Additional gRPC headers to be sent with the call.
2143
+ # @return [::Hash{::Symbol=>::String}]
2144
+ # @!attribute [rw] retry_policy
2145
+ # The retry policy. The value is a hash with the following keys:
2146
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
2147
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
2148
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
2149
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
2150
+ # trigger a retry.
2151
+ # @return [::Hash]
2152
+ # @!attribute [rw] quota_project
2153
+ # A separate project against which to charge quota.
2154
+ # @return [::String]
2155
+ #
2156
+ class Configuration
2157
+ extend ::Gapic::Config
2158
+
2159
+ config_attr :endpoint, "baremetalsolution.googleapis.com", ::String
2160
+ config_attr :credentials, nil do |value|
2161
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
2162
+ allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
2163
+ allowed.any? { |klass| klass === value }
2164
+ end
2165
+ config_attr :scope, nil, ::String, ::Array, nil
2166
+ config_attr :lib_name, nil, ::String, nil
2167
+ config_attr :lib_version, nil, ::String, nil
2168
+ config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
2169
+ config_attr :interceptors, nil, ::Array, nil
2170
+ config_attr :timeout, nil, ::Numeric, nil
2171
+ config_attr :metadata, nil, ::Hash, nil
2172
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
2173
+ config_attr :quota_project, nil, ::String, nil
2174
+
2175
+ # @private
2176
+ def initialize parent_config = nil
2177
+ @parent_config = parent_config unless parent_config.nil?
2178
+
2179
+ yield self if block_given?
2180
+ end
2181
+
2182
+ ##
2183
+ # Configurations for individual RPCs
2184
+ # @return [Rpcs]
2185
+ #
2186
+ def rpcs
2187
+ @rpcs ||= begin
2188
+ parent_rpcs = nil
2189
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
2190
+ Rpcs.new parent_rpcs
2191
+ end
2192
+ end
2193
+
2194
+ ##
2195
+ # Configuration RPC class for the BareMetalSolution API.
2196
+ #
2197
+ # Includes fields providing the configuration for each RPC in this service.
2198
+ # Each configuration object is of type `Gapic::Config::Method` and includes
2199
+ # the following configuration fields:
2200
+ #
2201
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
2202
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
2203
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
2204
+ # include the following keys:
2205
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
2206
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
2207
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
2208
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
2209
+ # trigger a retry.
2210
+ #
2211
+ class Rpcs
2212
+ ##
2213
+ # RPC-specific configuration for `list_instances`
2214
+ # @return [::Gapic::Config::Method]
2215
+ #
2216
+ attr_reader :list_instances
2217
+ ##
2218
+ # RPC-specific configuration for `get_instance`
2219
+ # @return [::Gapic::Config::Method]
2220
+ #
2221
+ attr_reader :get_instance
2222
+ ##
2223
+ # RPC-specific configuration for `update_instance`
2224
+ # @return [::Gapic::Config::Method]
2225
+ #
2226
+ attr_reader :update_instance
2227
+ ##
2228
+ # RPC-specific configuration for `reset_instance`
2229
+ # @return [::Gapic::Config::Method]
2230
+ #
2231
+ attr_reader :reset_instance
2232
+ ##
2233
+ # RPC-specific configuration for `start_instance`
2234
+ # @return [::Gapic::Config::Method]
2235
+ #
2236
+ attr_reader :start_instance
2237
+ ##
2238
+ # RPC-specific configuration for `stop_instance`
2239
+ # @return [::Gapic::Config::Method]
2240
+ #
2241
+ attr_reader :stop_instance
2242
+ ##
2243
+ # RPC-specific configuration for `detach_lun`
2244
+ # @return [::Gapic::Config::Method]
2245
+ #
2246
+ attr_reader :detach_lun
2247
+ ##
2248
+ # RPC-specific configuration for `list_volumes`
2249
+ # @return [::Gapic::Config::Method]
2250
+ #
2251
+ attr_reader :list_volumes
2252
+ ##
2253
+ # RPC-specific configuration for `get_volume`
2254
+ # @return [::Gapic::Config::Method]
2255
+ #
2256
+ attr_reader :get_volume
2257
+ ##
2258
+ # RPC-specific configuration for `update_volume`
2259
+ # @return [::Gapic::Config::Method]
2260
+ #
2261
+ attr_reader :update_volume
2262
+ ##
2263
+ # RPC-specific configuration for `resize_volume`
2264
+ # @return [::Gapic::Config::Method]
2265
+ #
2266
+ attr_reader :resize_volume
2267
+ ##
2268
+ # RPC-specific configuration for `list_networks`
2269
+ # @return [::Gapic::Config::Method]
2270
+ #
2271
+ attr_reader :list_networks
2272
+ ##
2273
+ # RPC-specific configuration for `list_network_usage`
2274
+ # @return [::Gapic::Config::Method]
2275
+ #
2276
+ attr_reader :list_network_usage
2277
+ ##
2278
+ # RPC-specific configuration for `get_network`
2279
+ # @return [::Gapic::Config::Method]
2280
+ #
2281
+ attr_reader :get_network
2282
+ ##
2283
+ # RPC-specific configuration for `update_network`
2284
+ # @return [::Gapic::Config::Method]
2285
+ #
2286
+ attr_reader :update_network
2287
+ ##
2288
+ # RPC-specific configuration for `get_lun`
2289
+ # @return [::Gapic::Config::Method]
2290
+ #
2291
+ attr_reader :get_lun
2292
+ ##
2293
+ # RPC-specific configuration for `list_luns`
2294
+ # @return [::Gapic::Config::Method]
2295
+ #
2296
+ attr_reader :list_luns
2297
+ ##
2298
+ # RPC-specific configuration for `get_nfs_share`
2299
+ # @return [::Gapic::Config::Method]
2300
+ #
2301
+ attr_reader :get_nfs_share
2302
+ ##
2303
+ # RPC-specific configuration for `list_nfs_shares`
2304
+ # @return [::Gapic::Config::Method]
2305
+ #
2306
+ attr_reader :list_nfs_shares
2307
+ ##
2308
+ # RPC-specific configuration for `update_nfs_share`
2309
+ # @return [::Gapic::Config::Method]
2310
+ #
2311
+ attr_reader :update_nfs_share
2312
+
2313
+ # @private
2314
+ def initialize parent_rpcs = nil
2315
+ list_instances_config = parent_rpcs.list_instances if parent_rpcs.respond_to? :list_instances
2316
+ @list_instances = ::Gapic::Config::Method.new list_instances_config
2317
+ get_instance_config = parent_rpcs.get_instance if parent_rpcs.respond_to? :get_instance
2318
+ @get_instance = ::Gapic::Config::Method.new get_instance_config
2319
+ update_instance_config = parent_rpcs.update_instance if parent_rpcs.respond_to? :update_instance
2320
+ @update_instance = ::Gapic::Config::Method.new update_instance_config
2321
+ reset_instance_config = parent_rpcs.reset_instance if parent_rpcs.respond_to? :reset_instance
2322
+ @reset_instance = ::Gapic::Config::Method.new reset_instance_config
2323
+ start_instance_config = parent_rpcs.start_instance if parent_rpcs.respond_to? :start_instance
2324
+ @start_instance = ::Gapic::Config::Method.new start_instance_config
2325
+ stop_instance_config = parent_rpcs.stop_instance if parent_rpcs.respond_to? :stop_instance
2326
+ @stop_instance = ::Gapic::Config::Method.new stop_instance_config
2327
+ detach_lun_config = parent_rpcs.detach_lun if parent_rpcs.respond_to? :detach_lun
2328
+ @detach_lun = ::Gapic::Config::Method.new detach_lun_config
2329
+ list_volumes_config = parent_rpcs.list_volumes if parent_rpcs.respond_to? :list_volumes
2330
+ @list_volumes = ::Gapic::Config::Method.new list_volumes_config
2331
+ get_volume_config = parent_rpcs.get_volume if parent_rpcs.respond_to? :get_volume
2332
+ @get_volume = ::Gapic::Config::Method.new get_volume_config
2333
+ update_volume_config = parent_rpcs.update_volume if parent_rpcs.respond_to? :update_volume
2334
+ @update_volume = ::Gapic::Config::Method.new update_volume_config
2335
+ resize_volume_config = parent_rpcs.resize_volume if parent_rpcs.respond_to? :resize_volume
2336
+ @resize_volume = ::Gapic::Config::Method.new resize_volume_config
2337
+ list_networks_config = parent_rpcs.list_networks if parent_rpcs.respond_to? :list_networks
2338
+ @list_networks = ::Gapic::Config::Method.new list_networks_config
2339
+ list_network_usage_config = parent_rpcs.list_network_usage if parent_rpcs.respond_to? :list_network_usage
2340
+ @list_network_usage = ::Gapic::Config::Method.new list_network_usage_config
2341
+ get_network_config = parent_rpcs.get_network if parent_rpcs.respond_to? :get_network
2342
+ @get_network = ::Gapic::Config::Method.new get_network_config
2343
+ update_network_config = parent_rpcs.update_network if parent_rpcs.respond_to? :update_network
2344
+ @update_network = ::Gapic::Config::Method.new update_network_config
2345
+ get_lun_config = parent_rpcs.get_lun if parent_rpcs.respond_to? :get_lun
2346
+ @get_lun = ::Gapic::Config::Method.new get_lun_config
2347
+ list_luns_config = parent_rpcs.list_luns if parent_rpcs.respond_to? :list_luns
2348
+ @list_luns = ::Gapic::Config::Method.new list_luns_config
2349
+ get_nfs_share_config = parent_rpcs.get_nfs_share if parent_rpcs.respond_to? :get_nfs_share
2350
+ @get_nfs_share = ::Gapic::Config::Method.new get_nfs_share_config
2351
+ list_nfs_shares_config = parent_rpcs.list_nfs_shares if parent_rpcs.respond_to? :list_nfs_shares
2352
+ @list_nfs_shares = ::Gapic::Config::Method.new list_nfs_shares_config
2353
+ update_nfs_share_config = parent_rpcs.update_nfs_share if parent_rpcs.respond_to? :update_nfs_share
2354
+ @update_nfs_share = ::Gapic::Config::Method.new update_nfs_share_config
2355
+
2356
+ yield self if block_given?
2357
+ end
2358
+ end
2359
+ end
2360
+ end
2361
+ end
2362
+ end
2363
+ end
2364
+ end
2365
+ end