google-cloud-compute-v1 2.22.0 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. checksums.yaml +4 -4
  2. data/lib/google/cloud/compute/v1/compute_pb.rb +125 -2
  3. data/lib/google/cloud/compute/v1/disks/rest/client.rb +105 -0
  4. data/lib/google/cloud/compute/v1/disks/rest/service_stub.rb +63 -0
  5. data/lib/google/cloud/compute/v1/global_organization_operations/rest/client.rb +2 -2
  6. data/lib/google/cloud/compute/v1/interconnect_attachment_groups/credentials.rb +52 -0
  7. data/lib/google/cloud/compute/v1/interconnect_attachment_groups/rest/client.rb +1218 -0
  8. data/lib/google/cloud/compute/v1/interconnect_attachment_groups/rest/service_stub.rb +641 -0
  9. data/lib/google/cloud/compute/v1/interconnect_attachment_groups/rest.rb +51 -0
  10. data/lib/google/cloud/compute/v1/interconnect_attachment_groups.rb +47 -0
  11. data/lib/google/cloud/compute/v1/interconnect_groups/credentials.rb +52 -0
  12. data/lib/google/cloud/compute/v1/interconnect_groups/rest/client.rb +1318 -0
  13. data/lib/google/cloud/compute/v1/interconnect_groups/rest/service_stub.rb +704 -0
  14. data/lib/google/cloud/compute/v1/interconnect_groups/rest.rb +51 -0
  15. data/lib/google/cloud/compute/v1/interconnect_groups.rb +47 -0
  16. data/lib/google/cloud/compute/v1/licenses/rest/client.rb +104 -0
  17. data/lib/google/cloud/compute/v1/licenses/rest/service_stub.rb +63 -0
  18. data/lib/google/cloud/compute/v1/network_profiles/rest/client.rb +4 -2
  19. data/lib/google/cloud/compute/v1/networks/rest/client.rb +102 -0
  20. data/lib/google/cloud/compute/v1/networks/rest/service_stub.rb +63 -0
  21. data/lib/google/cloud/compute/v1/reservation_blocks/rest/client.rb +4 -1
  22. data/lib/google/cloud/compute/v1/reservation_sub_blocks/credentials.rb +52 -0
  23. data/lib/google/cloud/compute/v1/reservation_sub_blocks/rest/client.rb +659 -0
  24. data/lib/google/cloud/compute/v1/reservation_sub_blocks/rest/service_stub.rb +272 -0
  25. data/lib/google/cloud/compute/v1/reservation_sub_blocks/rest.rb +51 -0
  26. data/lib/google/cloud/compute/v1/reservation_sub_blocks.rb +47 -0
  27. data/lib/google/cloud/compute/v1/rest.rb +3 -0
  28. data/lib/google/cloud/compute/v1/routers/rest/client.rb +8 -4
  29. data/lib/google/cloud/compute/v1/storage_pools/rest/client.rb +8 -4
  30. data/lib/google/cloud/compute/v1/subnetworks/rest/client.rb +3 -1
  31. data/lib/google/cloud/compute/v1/version.rb +1 -1
  32. data/lib/google/cloud/compute/v1.rb +3 -0
  33. data/proto_docs/google/cloud/compute/v1/compute.rb +2265 -64
  34. metadata +19 -4
@@ -0,0 +1,659 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2025 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/compute/v1/compute_pb"
21
+ require "google/cloud/compute/v1/reservation_sub_blocks/rest/service_stub"
22
+ require "google/cloud/compute/v1/zone_operations/rest"
23
+
24
+ module Google
25
+ module Cloud
26
+ module Compute
27
+ module V1
28
+ module ReservationSubBlocks
29
+ module Rest
30
+ ##
31
+ # REST client for the ReservationSubBlocks service.
32
+ #
33
+ # The ReservationSubBlocks API.
34
+ #
35
+ class Client
36
+ # @private
37
+ API_VERSION = ""
38
+
39
+ # @private
40
+ DEFAULT_ENDPOINT_TEMPLATE = "compute.$UNIVERSE_DOMAIN$"
41
+
42
+ # @private
43
+ attr_reader :reservation_sub_blocks_stub
44
+
45
+ ##
46
+ # Configure the ReservationSubBlocks Client class.
47
+ #
48
+ # See {::Google::Cloud::Compute::V1::ReservationSubBlocks::Rest::Client::Configuration}
49
+ # for a description of the configuration fields.
50
+ #
51
+ # @example
52
+ #
53
+ # # Modify the configuration for all ReservationSubBlocks clients
54
+ # ::Google::Cloud::Compute::V1::ReservationSubBlocks::Rest::Client.configure do |config|
55
+ # config.timeout = 10.0
56
+ # end
57
+ #
58
+ # @yield [config] Configure the Client client.
59
+ # @yieldparam config [Client::Configuration]
60
+ #
61
+ # @return [Client::Configuration]
62
+ #
63
+ def self.configure
64
+ @configure ||= begin
65
+ namespace = ["Google", "Cloud", "Compute", "V1"]
66
+ parent_config = while namespace.any?
67
+ parent_name = namespace.join "::"
68
+ parent_const = const_get parent_name
69
+ break parent_const.configure if parent_const.respond_to? :configure
70
+ namespace.pop
71
+ end
72
+ default_config = Client::Configuration.new parent_config
73
+
74
+ default_config.rpcs.get.timeout = 600.0
75
+ default_config.rpcs.get.retry_policy = {
76
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14]
77
+ }
78
+
79
+ default_config.rpcs.list.timeout = 600.0
80
+ default_config.rpcs.list.retry_policy = {
81
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14]
82
+ }
83
+
84
+ default_config.rpcs.perform_maintenance.timeout = 600.0
85
+
86
+ default_config
87
+ end
88
+ yield @configure if block_given?
89
+ @configure
90
+ end
91
+
92
+ ##
93
+ # Configure the ReservationSubBlocks Client instance.
94
+ #
95
+ # The configuration is set to the derived mode, meaning that values can be changed,
96
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
97
+ # should be made on {Client.configure}.
98
+ #
99
+ # See {::Google::Cloud::Compute::V1::ReservationSubBlocks::Rest::Client::Configuration}
100
+ # for a description of the configuration fields.
101
+ #
102
+ # @yield [config] Configure the Client client.
103
+ # @yieldparam config [Client::Configuration]
104
+ #
105
+ # @return [Client::Configuration]
106
+ #
107
+ def configure
108
+ yield @config if block_given?
109
+ @config
110
+ end
111
+
112
+ ##
113
+ # The effective universe domain
114
+ #
115
+ # @return [String]
116
+ #
117
+ def universe_domain
118
+ @reservation_sub_blocks_stub.universe_domain
119
+ end
120
+
121
+ ##
122
+ # Create a new ReservationSubBlocks REST client object.
123
+ #
124
+ # @example
125
+ #
126
+ # # Create a client using the default configuration
127
+ # client = ::Google::Cloud::Compute::V1::ReservationSubBlocks::Rest::Client.new
128
+ #
129
+ # # Create a client using a custom configuration
130
+ # client = ::Google::Cloud::Compute::V1::ReservationSubBlocks::Rest::Client.new do |config|
131
+ # config.timeout = 10.0
132
+ # end
133
+ #
134
+ # @yield [config] Configure the ReservationSubBlocks client.
135
+ # @yieldparam config [Client::Configuration]
136
+ #
137
+ def initialize
138
+ # Create the configuration object
139
+ @config = Configuration.new Client.configure
140
+
141
+ # Yield the configuration if needed
142
+ yield @config if block_given?
143
+
144
+ # Create credentials
145
+ credentials = @config.credentials
146
+ # Use self-signed JWT if the endpoint is unchanged from default,
147
+ # but only if the default endpoint does not have a region prefix.
148
+ enable_self_signed_jwt = @config.endpoint.nil? ||
149
+ (@config.endpoint == Configuration::DEFAULT_ENDPOINT &&
150
+ !@config.endpoint.split(".").first.include?("-"))
151
+ credentials ||= Credentials.default scope: @config.scope,
152
+ enable_self_signed_jwt: enable_self_signed_jwt
153
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
154
+ credentials = Credentials.new credentials, scope: @config.scope
155
+ end
156
+
157
+ @quota_project_id = @config.quota_project
158
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
159
+
160
+ @zone_operations = ::Google::Cloud::Compute::V1::ZoneOperations::Rest::Client.new do |config|
161
+ config.credentials = credentials
162
+ config.quota_project = @quota_project_id
163
+ config.endpoint = @config.endpoint
164
+ config.universe_domain = @config.universe_domain
165
+ end
166
+
167
+ @reservation_sub_blocks_stub = ::Google::Cloud::Compute::V1::ReservationSubBlocks::Rest::ServiceStub.new(
168
+ endpoint: @config.endpoint,
169
+ endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
170
+ universe_domain: @config.universe_domain,
171
+ credentials: credentials,
172
+ logger: @config.logger
173
+ )
174
+
175
+ @reservation_sub_blocks_stub.logger(stub: true)&.info do |entry|
176
+ entry.set_system_name
177
+ entry.set_service
178
+ entry.message = "Created client for #{entry.service}"
179
+ entry.set_credentials_fields credentials
180
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
181
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
182
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
183
+ end
184
+ end
185
+
186
+ ##
187
+ # Get the associated client for long-running operations via ZoneOperations.
188
+ #
189
+ # @return [::Google::Cloud::Compute::V1::ZoneOperations::Rest::Client]
190
+ #
191
+ attr_reader :zone_operations
192
+
193
+ ##
194
+ # The logger used for request/response debug logging.
195
+ #
196
+ # @return [Logger]
197
+ #
198
+ def logger
199
+ @reservation_sub_blocks_stub.logger
200
+ end
201
+
202
+ # Service calls
203
+
204
+ ##
205
+ # Retrieves information about the specified reservation subBlock.
206
+ #
207
+ # @overload get(request, options = nil)
208
+ # Pass arguments to `get` via a request object, either of type
209
+ # {::Google::Cloud::Compute::V1::GetReservationSubBlockRequest} or an equivalent Hash.
210
+ #
211
+ # @param request [::Google::Cloud::Compute::V1::GetReservationSubBlockRequest, ::Hash]
212
+ # A request object representing the call parameters. Required. To specify no
213
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
214
+ # @param options [::Gapic::CallOptions, ::Hash]
215
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
216
+ #
217
+ # @overload get(parent_name: nil, project: nil, reservation_sub_block: nil, zone: nil)
218
+ # Pass arguments to `get` via keyword arguments. Note that at
219
+ # least one keyword argument is required. To specify no parameters, or to keep all
220
+ # the default parameter values, pass an empty Hash as a request object (see above).
221
+ #
222
+ # @param parent_name [::String]
223
+ # The name of the parent reservation and parent block. In the format of reservations/\\{reservation_name}/reservationBlocks/\\{reservation_block_name}
224
+ # @param project [::String]
225
+ # Project ID for this request.
226
+ # @param reservation_sub_block [::String]
227
+ # The name of the reservation subBlock. Name should conform to RFC1035 or be a resource ID.
228
+ # @param zone [::String]
229
+ # Name of the zone for this request. Zone name should conform to RFC1035.
230
+ # @yield [result, operation] Access the result along with the TransportOperation object
231
+ # @yieldparam result [::Google::Cloud::Compute::V1::ReservationSubBlocksGetResponse]
232
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
233
+ #
234
+ # @return [::Google::Cloud::Compute::V1::ReservationSubBlocksGetResponse]
235
+ #
236
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
237
+ #
238
+ # @example Basic example
239
+ # require "google/cloud/compute/v1"
240
+ #
241
+ # # Create a client object. The client can be reused for multiple calls.
242
+ # client = Google::Cloud::Compute::V1::ReservationSubBlocks::Rest::Client.new
243
+ #
244
+ # # Create a request. To set request fields, pass in keyword arguments.
245
+ # request = Google::Cloud::Compute::V1::GetReservationSubBlockRequest.new
246
+ #
247
+ # # Call the get method.
248
+ # result = client.get request
249
+ #
250
+ # # The returned object is of type Google::Cloud::Compute::V1::ReservationSubBlocksGetResponse.
251
+ # p result
252
+ #
253
+ def get request, options = nil
254
+ raise ::ArgumentError, "request must be provided" if request.nil?
255
+
256
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Compute::V1::GetReservationSubBlockRequest
257
+
258
+ # Converts hash and nil to an options object
259
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
260
+
261
+ # Customize the options with defaults
262
+ call_metadata = @config.rpcs.get.metadata.to_h
263
+
264
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
265
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
266
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
267
+ gapic_version: ::Google::Cloud::Compute::V1::VERSION,
268
+ transports_version_send: [:rest]
269
+
270
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
271
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
272
+
273
+ options.apply_defaults timeout: @config.rpcs.get.timeout,
274
+ metadata: call_metadata,
275
+ retry_policy: @config.rpcs.get.retry_policy
276
+
277
+ options.apply_defaults timeout: @config.timeout,
278
+ metadata: @config.metadata,
279
+ retry_policy: @config.retry_policy
280
+
281
+ @reservation_sub_blocks_stub.get request, options do |result, operation|
282
+ yield result, operation if block_given?
283
+ end
284
+ rescue ::Gapic::Rest::Error => e
285
+ raise ::Google::Cloud::Error.from_error(e)
286
+ end
287
+
288
+ ##
289
+ # Retrieves a list of reservation subBlocks under a single reservation.
290
+ #
291
+ # @overload list(request, options = nil)
292
+ # Pass arguments to `list` via a request object, either of type
293
+ # {::Google::Cloud::Compute::V1::ListReservationSubBlocksRequest} or an equivalent Hash.
294
+ #
295
+ # @param request [::Google::Cloud::Compute::V1::ListReservationSubBlocksRequest, ::Hash]
296
+ # A request object representing the call parameters. Required. To specify no
297
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
298
+ # @param options [::Gapic::CallOptions, ::Hash]
299
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
300
+ #
301
+ # @overload list(filter: nil, max_results: nil, order_by: nil, page_token: nil, parent_name: nil, project: nil, return_partial_success: nil, zone: nil)
302
+ # Pass arguments to `list` via keyword arguments. Note that at
303
+ # least one keyword argument is required. To specify no parameters, or to keep all
304
+ # the default parameter values, pass an empty Hash as a request object (see above).
305
+ #
306
+ # @param filter [::String]
307
+ # A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. These two types of filter expressions cannot be mixed in one request. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ``` If you want to use a regular expression, use the `eq` (equal) or `ne` (not equal) operator against a single un-parenthesized expression with or without quotes or against multiple parenthesized expressions. Examples: `fieldname eq unquoted literal` `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"` `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is interpreted as a regular expression using Google RE2 library syntax. The literal value must match the entire field. For example, to filter for instances that do not end with name "instance", you would use `name ne .*instance`. You cannot combine constraints on multiple fields using regular expressions.
308
+ # @param max_results [::Integer]
309
+ # The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`)
310
+ # @param order_by [::String]
311
+ # Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported.
312
+ # @param page_token [::String]
313
+ # Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results.
314
+ # @param parent_name [::String]
315
+ # The name of the parent reservation and parent block. In the format of reservations/\\{reservation_name}/reservationBlocks/\\{reservation_block_name}
316
+ # @param project [::String]
317
+ # Project ID for this request.
318
+ # @param return_partial_success [::Boolean]
319
+ # Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code.
320
+ # @param zone [::String]
321
+ # Name of the zone for this request. Zone name should conform to RFC1035.
322
+ # @yield [result, operation] Access the result along with the TransportOperation object
323
+ # @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Compute::V1::ReservationSubBlock>]
324
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
325
+ #
326
+ # @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Compute::V1::ReservationSubBlock>]
327
+ #
328
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
329
+ #
330
+ # @example Basic example
331
+ # require "google/cloud/compute/v1"
332
+ #
333
+ # # Create a client object. The client can be reused for multiple calls.
334
+ # client = Google::Cloud::Compute::V1::ReservationSubBlocks::Rest::Client.new
335
+ #
336
+ # # Create a request. To set request fields, pass in keyword arguments.
337
+ # request = Google::Cloud::Compute::V1::ListReservationSubBlocksRequest.new
338
+ #
339
+ # # Call the list method.
340
+ # result = client.list request
341
+ #
342
+ # # The returned object is of type Google::Cloud::Compute::V1::ReservationSubBlocksListResponse.
343
+ # p result
344
+ #
345
+ def list request, options = nil
346
+ raise ::ArgumentError, "request must be provided" if request.nil?
347
+
348
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Compute::V1::ListReservationSubBlocksRequest
349
+
350
+ # Converts hash and nil to an options object
351
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
352
+
353
+ # Customize the options with defaults
354
+ call_metadata = @config.rpcs.list.metadata.to_h
355
+
356
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
357
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
358
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
359
+ gapic_version: ::Google::Cloud::Compute::V1::VERSION,
360
+ transports_version_send: [:rest]
361
+
362
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
363
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
364
+
365
+ options.apply_defaults timeout: @config.rpcs.list.timeout,
366
+ metadata: call_metadata,
367
+ retry_policy: @config.rpcs.list.retry_policy
368
+
369
+ options.apply_defaults timeout: @config.timeout,
370
+ metadata: @config.metadata,
371
+ retry_policy: @config.retry_policy
372
+
373
+ @reservation_sub_blocks_stub.list request, options do |result, operation|
374
+ result = ::Gapic::Rest::PagedEnumerable.new @reservation_sub_blocks_stub, :list, "items", request, result, options
375
+ yield result, operation if block_given?
376
+ throw :response, result
377
+ end
378
+ rescue ::Gapic::Rest::Error => e
379
+ raise ::Google::Cloud::Error.from_error(e)
380
+ end
381
+
382
+ ##
383
+ # Allows customers to perform maintenance on a reservation subBlock
384
+ #
385
+ # @overload perform_maintenance(request, options = nil)
386
+ # Pass arguments to `perform_maintenance` via a request object, either of type
387
+ # {::Google::Cloud::Compute::V1::PerformMaintenanceReservationSubBlockRequest} or an equivalent Hash.
388
+ #
389
+ # @param request [::Google::Cloud::Compute::V1::PerformMaintenanceReservationSubBlockRequest, ::Hash]
390
+ # A request object representing the call parameters. Required. To specify no
391
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
392
+ # @param options [::Gapic::CallOptions, ::Hash]
393
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
394
+ #
395
+ # @overload perform_maintenance(parent_name: nil, project: nil, request_id: nil, reservation_sub_block: nil, zone: nil)
396
+ # Pass arguments to `perform_maintenance` via keyword arguments. Note that at
397
+ # least one keyword argument is required. To specify no parameters, or to keep all
398
+ # the default parameter values, pass an empty Hash as a request object (see above).
399
+ #
400
+ # @param parent_name [::String]
401
+ # The name of the parent reservation and parent block. In the format of reservations/\\{reservation_name}/reservationBlocks/\\{reservation_block_name}
402
+ # @param project [::String]
403
+ # Project ID for this request.
404
+ # @param request_id [::String]
405
+ # An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported ( 00000000-0000-0000-0000-000000000000).
406
+ # @param reservation_sub_block [::String]
407
+ # The name of the reservation subBlock. Name should conform to RFC1035 or be a resource ID.
408
+ # @param zone [::String]
409
+ # Name of the zone for this request. Zone name should conform to RFC1035.
410
+ # @yield [result, operation] Access the result along with the TransportOperation object
411
+ # @yieldparam result [::Gapic::GenericLRO::Operation]
412
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
413
+ #
414
+ # @return [::Gapic::GenericLRO::Operation]
415
+ #
416
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
417
+ #
418
+ # @example Basic example
419
+ # require "google/cloud/compute/v1"
420
+ #
421
+ # # Create a client object. The client can be reused for multiple calls.
422
+ # client = Google::Cloud::Compute::V1::ReservationSubBlocks::Rest::Client.new
423
+ #
424
+ # # Create a request. To set request fields, pass in keyword arguments.
425
+ # request = Google::Cloud::Compute::V1::PerformMaintenanceReservationSubBlockRequest.new
426
+ #
427
+ # # Call the perform_maintenance method.
428
+ # result = client.perform_maintenance request
429
+ #
430
+ # # The returned object is of type Google::Cloud::Compute::V1::Operation.
431
+ # p result
432
+ #
433
+ def perform_maintenance request, options = nil
434
+ raise ::ArgumentError, "request must be provided" if request.nil?
435
+
436
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Compute::V1::PerformMaintenanceReservationSubBlockRequest
437
+
438
+ # Converts hash and nil to an options object
439
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
440
+
441
+ # Customize the options with defaults
442
+ call_metadata = @config.rpcs.perform_maintenance.metadata.to_h
443
+
444
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
445
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
446
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
447
+ gapic_version: ::Google::Cloud::Compute::V1::VERSION,
448
+ transports_version_send: [:rest]
449
+
450
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
451
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
452
+
453
+ options.apply_defaults timeout: @config.rpcs.perform_maintenance.timeout,
454
+ metadata: call_metadata,
455
+ retry_policy: @config.rpcs.perform_maintenance.retry_policy
456
+
457
+ options.apply_defaults timeout: @config.timeout,
458
+ metadata: @config.metadata,
459
+ retry_policy: @config.retry_policy
460
+
461
+ @reservation_sub_blocks_stub.perform_maintenance request, options do |result, response|
462
+ result = ::Google::Cloud::Compute::V1::ZoneOperations::Rest::NonstandardLro.create_operation(
463
+ operation: result,
464
+ client: zone_operations,
465
+ request_values: {
466
+ "project" => request.project,
467
+ "zone" => request.zone
468
+ },
469
+ options: options
470
+ )
471
+ yield result, response if block_given?
472
+ throw :response, result
473
+ end
474
+ rescue ::Gapic::Rest::Error => e
475
+ raise ::Google::Cloud::Error.from_error(e)
476
+ end
477
+
478
+ ##
479
+ # Configuration class for the ReservationSubBlocks REST API.
480
+ #
481
+ # This class represents the configuration for ReservationSubBlocks REST,
482
+ # providing control over timeouts, retry behavior, logging, transport
483
+ # parameters, and other low-level controls. Certain parameters can also be
484
+ # applied individually to specific RPCs. See
485
+ # {::Google::Cloud::Compute::V1::ReservationSubBlocks::Rest::Client::Configuration::Rpcs}
486
+ # for a list of RPCs that can be configured independently.
487
+ #
488
+ # Configuration can be applied globally to all clients, or to a single client
489
+ # on construction.
490
+ #
491
+ # @example
492
+ #
493
+ # # Modify the global config, setting the timeout for
494
+ # # get to 20 seconds,
495
+ # # and all remaining timeouts to 10 seconds.
496
+ # ::Google::Cloud::Compute::V1::ReservationSubBlocks::Rest::Client.configure do |config|
497
+ # config.timeout = 10.0
498
+ # config.rpcs.get.timeout = 20.0
499
+ # end
500
+ #
501
+ # # Apply the above configuration only to a new client.
502
+ # client = ::Google::Cloud::Compute::V1::ReservationSubBlocks::Rest::Client.new do |config|
503
+ # config.timeout = 10.0
504
+ # config.rpcs.get.timeout = 20.0
505
+ # end
506
+ #
507
+ # @!attribute [rw] endpoint
508
+ # A custom service endpoint, as a hostname or hostname:port. The default is
509
+ # nil, indicating to use the default endpoint in the current universe domain.
510
+ # @return [::String,nil]
511
+ # @!attribute [rw] credentials
512
+ # Credentials to send with calls. You may provide any of the following types:
513
+ # * (`String`) The path to a service account key file in JSON format
514
+ # * (`Hash`) A service account key as a Hash
515
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
516
+ # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
517
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
518
+ # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
519
+ # * (`nil`) indicating no credentials
520
+ #
521
+ # Warning: If you accept a credential configuration (JSON file or Hash) from an
522
+ # external source for authentication to Google Cloud, you must validate it before
523
+ # providing it to a Google API client library. Providing an unvalidated credential
524
+ # configuration to Google APIs can compromise the security of your systems and data.
525
+ # For more information, refer to [Validate credential configurations from external
526
+ # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
527
+ # @return [::Object]
528
+ # @!attribute [rw] scope
529
+ # The OAuth scopes
530
+ # @return [::Array<::String>]
531
+ # @!attribute [rw] lib_name
532
+ # The library name as recorded in instrumentation and logging
533
+ # @return [::String]
534
+ # @!attribute [rw] lib_version
535
+ # The library version as recorded in instrumentation and logging
536
+ # @return [::String]
537
+ # @!attribute [rw] timeout
538
+ # The call timeout in seconds.
539
+ # @return [::Numeric]
540
+ # @!attribute [rw] metadata
541
+ # Additional headers to be sent with the call.
542
+ # @return [::Hash{::Symbol=>::String}]
543
+ # @!attribute [rw] retry_policy
544
+ # The retry policy. The value is a hash with the following keys:
545
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
546
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
547
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
548
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
549
+ # trigger a retry.
550
+ # @return [::Hash]
551
+ # @!attribute [rw] quota_project
552
+ # A separate project against which to charge quota.
553
+ # @return [::String]
554
+ # @!attribute [rw] universe_domain
555
+ # The universe domain within which to make requests. This determines the
556
+ # default endpoint URL. The default value of nil uses the environment
557
+ # universe (usually the default "googleapis.com" universe).
558
+ # @return [::String,nil]
559
+ # @!attribute [rw] logger
560
+ # A custom logger to use for request/response debug logging, or the value
561
+ # `:default` (the default) to construct a default logger, or `nil` to
562
+ # explicitly disable logging.
563
+ # @return [::Logger,:default,nil]
564
+ #
565
+ class Configuration
566
+ extend ::Gapic::Config
567
+
568
+ # @private
569
+ # The endpoint specific to the default "googleapis.com" universe. Deprecated.
570
+ DEFAULT_ENDPOINT = "compute.googleapis.com"
571
+
572
+ config_attr :endpoint, nil, ::String, nil
573
+ config_attr :credentials, nil do |value|
574
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Google::Auth::BaseClient, ::Signet::OAuth2::Client, nil]
575
+ allowed.any? { |klass| klass === value }
576
+ end
577
+ config_attr :scope, nil, ::String, ::Array, nil
578
+ config_attr :lib_name, nil, ::String, nil
579
+ config_attr :lib_version, nil, ::String, nil
580
+ config_attr :timeout, nil, ::Numeric, nil
581
+ config_attr :metadata, nil, ::Hash, nil
582
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
583
+ config_attr :quota_project, nil, ::String, nil
584
+ config_attr :universe_domain, nil, ::String, nil
585
+ config_attr :logger, :default, ::Logger, nil, :default
586
+
587
+ # @private
588
+ def initialize parent_config = nil
589
+ @parent_config = parent_config unless parent_config.nil?
590
+
591
+ yield self if block_given?
592
+ end
593
+
594
+ ##
595
+ # Configurations for individual RPCs
596
+ # @return [Rpcs]
597
+ #
598
+ def rpcs
599
+ @rpcs ||= begin
600
+ parent_rpcs = nil
601
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
602
+ Rpcs.new parent_rpcs
603
+ end
604
+ end
605
+
606
+ ##
607
+ # Configuration RPC class for the ReservationSubBlocks API.
608
+ #
609
+ # Includes fields providing the configuration for each RPC in this service.
610
+ # Each configuration object is of type `Gapic::Config::Method` and includes
611
+ # the following configuration fields:
612
+ #
613
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
614
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers
615
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
616
+ # include the following keys:
617
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
618
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
619
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
620
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
621
+ # trigger a retry.
622
+ #
623
+ class Rpcs
624
+ ##
625
+ # RPC-specific configuration for `get`
626
+ # @return [::Gapic::Config::Method]
627
+ #
628
+ attr_reader :get
629
+ ##
630
+ # RPC-specific configuration for `list`
631
+ # @return [::Gapic::Config::Method]
632
+ #
633
+ attr_reader :list
634
+ ##
635
+ # RPC-specific configuration for `perform_maintenance`
636
+ # @return [::Gapic::Config::Method]
637
+ #
638
+ attr_reader :perform_maintenance
639
+
640
+ # @private
641
+ def initialize parent_rpcs = nil
642
+ get_config = parent_rpcs.get if parent_rpcs.respond_to? :get
643
+ @get = ::Gapic::Config::Method.new get_config
644
+ list_config = parent_rpcs.list if parent_rpcs.respond_to? :list
645
+ @list = ::Gapic::Config::Method.new list_config
646
+ perform_maintenance_config = parent_rpcs.perform_maintenance if parent_rpcs.respond_to? :perform_maintenance
647
+ @perform_maintenance = ::Gapic::Config::Method.new perform_maintenance_config
648
+
649
+ yield self if block_given?
650
+ end
651
+ end
652
+ end
653
+ end
654
+ end
655
+ end
656
+ end
657
+ end
658
+ end
659
+ end