google-cloud-compute-v1 3.5.0 → 3.6.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 (54) hide show
  1. checksums.yaml +4 -4
  2. data/lib/google/cloud/compute/v1/backend_buckets/rest/client.rb +375 -0
  3. data/lib/google/cloud/compute/v1/backend_buckets/rest/service_stub.rb +122 -0
  4. data/lib/google/cloud/compute/v1/compute_pb.rb +94 -1
  5. data/lib/google/cloud/compute/v1/disks/rest/client.rb +118 -0
  6. data/lib/google/cloud/compute/v1/disks/rest/service_stub.rb +64 -0
  7. data/lib/google/cloud/compute/v1/instant_snapshot_groups/credentials.rb +52 -0
  8. data/lib/google/cloud/compute/v1/instant_snapshot_groups/rest/client.rb +1145 -0
  9. data/lib/google/cloud/compute/v1/instant_snapshot_groups/rest/service_stub.rb +523 -0
  10. data/lib/google/cloud/compute/v1/instant_snapshot_groups/rest.rb +51 -0
  11. data/lib/google/cloud/compute/v1/instant_snapshot_groups.rb +47 -0
  12. data/lib/google/cloud/compute/v1/region_backend_buckets/credentials.rb +52 -0
  13. data/lib/google/cloud/compute/v1/region_backend_buckets/rest/client.rb +1450 -0
  14. data/lib/google/cloud/compute/v1/region_backend_buckets/rest/service_stub.rb +649 -0
  15. data/lib/google/cloud/compute/v1/region_backend_buckets/rest.rb +51 -0
  16. data/lib/google/cloud/compute/v1/region_backend_buckets.rb +47 -0
  17. data/lib/google/cloud/compute/v1/region_composite_health_checks/rest/client.rb +95 -0
  18. data/lib/google/cloud/compute/v1/region_composite_health_checks/rest/service_stub.rb +63 -0
  19. data/lib/google/cloud/compute/v1/region_disks/rest/client.rb +118 -0
  20. data/lib/google/cloud/compute/v1/region_disks/rest/service_stub.rb +64 -0
  21. data/lib/google/cloud/compute/v1/region_health_sources/rest/client.rb +95 -0
  22. data/lib/google/cloud/compute/v1/region_health_sources/rest/service_stub.rb +63 -0
  23. data/lib/google/cloud/compute/v1/region_instance_group_manager_resize_requests/credentials.rb +52 -0
  24. data/lib/google/cloud/compute/v1/region_instance_group_manager_resize_requests/rest/client.rb +1002 -0
  25. data/lib/google/cloud/compute/v1/region_instance_group_manager_resize_requests/rest/service_stub.rb +400 -0
  26. data/lib/google/cloud/compute/v1/region_instance_group_manager_resize_requests/rest.rb +51 -0
  27. data/lib/google/cloud/compute/v1/region_instance_group_manager_resize_requests.rb +47 -0
  28. data/lib/google/cloud/compute/v1/region_instant_snapshot_groups/credentials.rb +52 -0
  29. data/lib/google/cloud/compute/v1/region_instant_snapshot_groups/rest/client.rb +1146 -0
  30. data/lib/google/cloud/compute/v1/region_instant_snapshot_groups/rest/service_stub.rb +523 -0
  31. data/lib/google/cloud/compute/v1/region_instant_snapshot_groups/rest.rb +51 -0
  32. data/lib/google/cloud/compute/v1/region_instant_snapshot_groups.rb +47 -0
  33. data/lib/google/cloud/compute/v1/region_snapshot_settings/credentials.rb +52 -0
  34. data/lib/google/cloud/compute/v1/region_snapshot_settings/rest/client.rb +561 -0
  35. data/lib/google/cloud/compute/v1/region_snapshot_settings/rest/service_stub.rb +206 -0
  36. data/lib/google/cloud/compute/v1/region_snapshot_settings/rest.rb +51 -0
  37. data/lib/google/cloud/compute/v1/region_snapshot_settings.rb +47 -0
  38. data/lib/google/cloud/compute/v1/region_snapshots/credentials.rb +52 -0
  39. data/lib/google/cloud/compute/v1/region_snapshots/rest/client.rb +1388 -0
  40. data/lib/google/cloud/compute/v1/region_snapshots/rest/service_stub.rb +651 -0
  41. data/lib/google/cloud/compute/v1/region_snapshots/rest.rb +51 -0
  42. data/lib/google/cloud/compute/v1/region_snapshots.rb +47 -0
  43. data/lib/google/cloud/compute/v1/rest.rb +7 -0
  44. data/lib/google/cloud/compute/v1/snapshots/rest/client.rb +115 -0
  45. data/lib/google/cloud/compute/v1/snapshots/rest/service_stub.rb +63 -0
  46. data/lib/google/cloud/compute/v1/version.rb +1 -1
  47. data/lib/google/cloud/compute/v1/zone_vm_extension_policies/credentials.rb +52 -0
  48. data/lib/google/cloud/compute/v1/zone_vm_extension_policies/rest/client.rb +975 -0
  49. data/lib/google/cloud/compute/v1/zone_vm_extension_policies/rest/service_stub.rb +396 -0
  50. data/lib/google/cloud/compute/v1/zone_vm_extension_policies/rest.rb +51 -0
  51. data/lib/google/cloud/compute/v1/zone_vm_extension_policies.rb +47 -0
  52. data/lib/google/cloud/compute/v1.rb +7 -0
  53. data/proto_docs/google/cloud/compute/v1/compute.rb +4753 -1599
  54. metadata +36 -1
@@ -0,0 +1,1388 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2026 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/region_snapshots/rest/service_stub"
22
+ require "google/cloud/compute/v1/region_operations/rest"
23
+
24
+ module Google
25
+ module Cloud
26
+ module Compute
27
+ module V1
28
+ module RegionSnapshots
29
+ module Rest
30
+ ##
31
+ # REST client for the RegionSnapshots service.
32
+ #
33
+ # The RegionSnapshots 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 :region_snapshots_stub
44
+
45
+ ##
46
+ # Configure the RegionSnapshots Client class.
47
+ #
48
+ # See {::Google::Cloud::Compute::V1::RegionSnapshots::Rest::Client::Configuration}
49
+ # for a description of the configuration fields.
50
+ #
51
+ # @example
52
+ #
53
+ # # Modify the configuration for all RegionSnapshots clients
54
+ # ::Google::Cloud::Compute::V1::RegionSnapshots::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.delete.timeout = 600.0
75
+
76
+ default_config.rpcs.get.timeout = 600.0
77
+ default_config.rpcs.get.retry_policy = {
78
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14]
79
+ }
80
+
81
+ default_config.rpcs.get_iam_policy.timeout = 600.0
82
+ default_config.rpcs.get_iam_policy.retry_policy = {
83
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14]
84
+ }
85
+
86
+ default_config.rpcs.insert.timeout = 600.0
87
+
88
+ default_config.rpcs.list.timeout = 600.0
89
+ default_config.rpcs.list.retry_policy = {
90
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14]
91
+ }
92
+
93
+ default_config.rpcs.set_iam_policy.timeout = 600.0
94
+
95
+ default_config.rpcs.set_labels.timeout = 600.0
96
+
97
+ default_config.rpcs.test_iam_permissions.timeout = 600.0
98
+
99
+ default_config.rpcs.update_kms_key.timeout = 600.0
100
+
101
+ default_config
102
+ end
103
+ yield @configure if block_given?
104
+ @configure
105
+ end
106
+
107
+ ##
108
+ # Configure the RegionSnapshots Client instance.
109
+ #
110
+ # The configuration is set to the derived mode, meaning that values can be changed,
111
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
112
+ # should be made on {Client.configure}.
113
+ #
114
+ # See {::Google::Cloud::Compute::V1::RegionSnapshots::Rest::Client::Configuration}
115
+ # for a description of the configuration fields.
116
+ #
117
+ # @yield [config] Configure the Client client.
118
+ # @yieldparam config [Client::Configuration]
119
+ #
120
+ # @return [Client::Configuration]
121
+ #
122
+ def configure
123
+ yield @config if block_given?
124
+ @config
125
+ end
126
+
127
+ ##
128
+ # The effective universe domain
129
+ #
130
+ # @return [String]
131
+ #
132
+ def universe_domain
133
+ @region_snapshots_stub.universe_domain
134
+ end
135
+
136
+ ##
137
+ # Create a new RegionSnapshots REST client object.
138
+ #
139
+ # @example
140
+ #
141
+ # # Create a client using the default configuration
142
+ # client = ::Google::Cloud::Compute::V1::RegionSnapshots::Rest::Client.new
143
+ #
144
+ # # Create a client using a custom configuration
145
+ # client = ::Google::Cloud::Compute::V1::RegionSnapshots::Rest::Client.new do |config|
146
+ # config.timeout = 10.0
147
+ # end
148
+ #
149
+ # @yield [config] Configure the RegionSnapshots client.
150
+ # @yieldparam config [Client::Configuration]
151
+ #
152
+ def initialize
153
+ # Create the configuration object
154
+ @config = Configuration.new Client.configure
155
+
156
+ # Yield the configuration if needed
157
+ yield @config if block_given?
158
+
159
+ # Create credentials
160
+ credentials = @config.credentials
161
+ # Use self-signed JWT if the endpoint is unchanged from default,
162
+ # but only if the default endpoint does not have a region prefix.
163
+ enable_self_signed_jwt = @config.endpoint.nil? ||
164
+ (@config.endpoint == Configuration::DEFAULT_ENDPOINT &&
165
+ !@config.endpoint.split(".").first.include?("-"))
166
+ credentials ||= Credentials.default scope: @config.scope,
167
+ enable_self_signed_jwt: enable_self_signed_jwt
168
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
169
+ credentials = Credentials.new credentials, scope: @config.scope
170
+ end
171
+
172
+ @quota_project_id = @config.quota_project
173
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
174
+
175
+ @region_operations = ::Google::Cloud::Compute::V1::RegionOperations::Rest::Client.new do |config|
176
+ config.credentials = credentials
177
+ config.quota_project = @quota_project_id
178
+ config.endpoint = @config.endpoint
179
+ config.universe_domain = @config.universe_domain
180
+ end
181
+
182
+ @region_snapshots_stub = ::Google::Cloud::Compute::V1::RegionSnapshots::Rest::ServiceStub.new(
183
+ endpoint: @config.endpoint,
184
+ endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
185
+ universe_domain: @config.universe_domain,
186
+ credentials: credentials,
187
+ logger: @config.logger
188
+ )
189
+
190
+ @region_snapshots_stub.logger(stub: true)&.info do |entry|
191
+ entry.set_system_name
192
+ entry.set_service
193
+ entry.message = "Created client for #{entry.service}"
194
+ entry.set_credentials_fields credentials
195
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
196
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
197
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
198
+ end
199
+ end
200
+
201
+ ##
202
+ # Get the associated client for long-running operations via RegionOperations.
203
+ #
204
+ # @return [::Google::Cloud::Compute::V1::RegionOperations::Rest::Client]
205
+ #
206
+ attr_reader :region_operations
207
+
208
+ ##
209
+ # The logger used for request/response debug logging.
210
+ #
211
+ # @return [Logger]
212
+ #
213
+ def logger
214
+ @region_snapshots_stub.logger
215
+ end
216
+
217
+ # Service calls
218
+
219
+ ##
220
+ # Deletes the specified Snapshot resource. Keep in mind that deleting
221
+ # a single snapshot might not necessarily delete all the data on that
222
+ # snapshot. If any data on the snapshot that is marked for deletion is
223
+ # needed for subsequent snapshots, the data will be moved to the next
224
+ # corresponding snapshot.
225
+ #
226
+ # For more information, seeDeleting
227
+ # snapshots.
228
+ #
229
+ # @overload delete(request, options = nil)
230
+ # Pass arguments to `delete` via a request object, either of type
231
+ # {::Google::Cloud::Compute::V1::DeleteRegionSnapshotRequest} or an equivalent Hash.
232
+ #
233
+ # @param request [::Google::Cloud::Compute::V1::DeleteRegionSnapshotRequest, ::Hash]
234
+ # A request object representing the call parameters. Required. To specify no
235
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
236
+ # @param options [::Gapic::CallOptions, ::Hash]
237
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
238
+ #
239
+ # @overload delete(project: nil, region: nil, request_id: nil, snapshot: nil)
240
+ # Pass arguments to `delete` via keyword arguments. Note that at
241
+ # least one keyword argument is required. To specify no parameters, or to keep all
242
+ # the default parameter values, pass an empty Hash as a request object (see above).
243
+ #
244
+ # @param project [::String]
245
+ # Project ID for this request.
246
+ # @param region [::String]
247
+ # The name of the region for this request.
248
+ # @param request_id [::String]
249
+ # An optional request ID to identify requests. Specify a unique request ID so
250
+ # that if you must retry your request, the server will know to ignore the
251
+ # request if it has already been completed.
252
+ #
253
+ # For example, consider a situation where you make an initial request and
254
+ # the request times out. If you make the request again with the same
255
+ # request ID, the server can check if original operation with the same
256
+ # request ID was received, and if so, will ignore the second request. This
257
+ # prevents clients from accidentally creating duplicate commitments.
258
+ #
259
+ # The request ID must be
260
+ # a valid UUID with the exception that zero UUID is not supported
261
+ # (00000000-0000-0000-0000-000000000000).
262
+ # @param snapshot [::String]
263
+ # Name of the snapshot resource to delete.
264
+ # @yield [result, operation] Access the result along with the TransportOperation object
265
+ # @yieldparam result [::Gapic::GenericLRO::Operation]
266
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
267
+ #
268
+ # @return [::Gapic::GenericLRO::Operation]
269
+ #
270
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
271
+ #
272
+ # @example Basic example
273
+ # require "google/cloud/compute/v1"
274
+ #
275
+ # # Create a client object. The client can be reused for multiple calls.
276
+ # client = Google::Cloud::Compute::V1::RegionSnapshots::Rest::Client.new
277
+ #
278
+ # # Create a request. To set request fields, pass in keyword arguments.
279
+ # request = Google::Cloud::Compute::V1::DeleteRegionSnapshotRequest.new
280
+ #
281
+ # # Call the delete method.
282
+ # result = client.delete request
283
+ #
284
+ # # The returned object is of type Google::Cloud::Compute::V1::Operation.
285
+ # p result
286
+ #
287
+ def delete request, options = nil
288
+ raise ::ArgumentError, "request must be provided" if request.nil?
289
+
290
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Compute::V1::DeleteRegionSnapshotRequest
291
+
292
+ # Converts hash and nil to an options object
293
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
294
+
295
+ # Customize the options with defaults
296
+ call_metadata = @config.rpcs.delete.metadata.to_h
297
+
298
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
299
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
300
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
301
+ gapic_version: ::Google::Cloud::Compute::V1::VERSION,
302
+ transports_version_send: [:rest]
303
+
304
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
305
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
306
+
307
+ options.apply_defaults timeout: @config.rpcs.delete.timeout,
308
+ metadata: call_metadata,
309
+ retry_policy: @config.rpcs.delete.retry_policy
310
+
311
+ options.apply_defaults timeout: @config.timeout,
312
+ metadata: @config.metadata,
313
+ retry_policy: @config.retry_policy
314
+
315
+ @region_snapshots_stub.delete request, options do |result, response|
316
+ result = ::Google::Cloud::Compute::V1::RegionOperations::Rest::NonstandardLro.create_operation(
317
+ operation: result,
318
+ client: region_operations,
319
+ request_values: {
320
+ "project" => request.project,
321
+ "region" => request.region
322
+ },
323
+ options: options
324
+ )
325
+ yield result, response if block_given?
326
+ throw :response, result
327
+ end
328
+ rescue ::Gapic::Rest::Error => e
329
+ raise ::Google::Cloud::Error.from_error(e)
330
+ end
331
+
332
+ ##
333
+ # Returns the specified Snapshot resource.
334
+ #
335
+ # @overload get(request, options = nil)
336
+ # Pass arguments to `get` via a request object, either of type
337
+ # {::Google::Cloud::Compute::V1::GetRegionSnapshotRequest} or an equivalent Hash.
338
+ #
339
+ # @param request [::Google::Cloud::Compute::V1::GetRegionSnapshotRequest, ::Hash]
340
+ # A request object representing the call parameters. Required. To specify no
341
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
342
+ # @param options [::Gapic::CallOptions, ::Hash]
343
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
344
+ #
345
+ # @overload get(project: nil, region: nil, snapshot: nil)
346
+ # Pass arguments to `get` via keyword arguments. Note that at
347
+ # least one keyword argument is required. To specify no parameters, or to keep all
348
+ # the default parameter values, pass an empty Hash as a request object (see above).
349
+ #
350
+ # @param project [::String]
351
+ # Project ID for this request.
352
+ # @param region [::String]
353
+ # Name of the region for this request.
354
+ # @param snapshot [::String]
355
+ # Name of the Snapshot resource to return.
356
+ # @yield [result, operation] Access the result along with the TransportOperation object
357
+ # @yieldparam result [::Google::Cloud::Compute::V1::Snapshot]
358
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
359
+ #
360
+ # @return [::Google::Cloud::Compute::V1::Snapshot]
361
+ #
362
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
363
+ #
364
+ # @example Basic example
365
+ # require "google/cloud/compute/v1"
366
+ #
367
+ # # Create a client object. The client can be reused for multiple calls.
368
+ # client = Google::Cloud::Compute::V1::RegionSnapshots::Rest::Client.new
369
+ #
370
+ # # Create a request. To set request fields, pass in keyword arguments.
371
+ # request = Google::Cloud::Compute::V1::GetRegionSnapshotRequest.new
372
+ #
373
+ # # Call the get method.
374
+ # result = client.get request
375
+ #
376
+ # # The returned object is of type Google::Cloud::Compute::V1::Snapshot.
377
+ # p result
378
+ #
379
+ def get request, options = nil
380
+ raise ::ArgumentError, "request must be provided" if request.nil?
381
+
382
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Compute::V1::GetRegionSnapshotRequest
383
+
384
+ # Converts hash and nil to an options object
385
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
386
+
387
+ # Customize the options with defaults
388
+ call_metadata = @config.rpcs.get.metadata.to_h
389
+
390
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
391
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
392
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
393
+ gapic_version: ::Google::Cloud::Compute::V1::VERSION,
394
+ transports_version_send: [:rest]
395
+
396
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
397
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
398
+
399
+ options.apply_defaults timeout: @config.rpcs.get.timeout,
400
+ metadata: call_metadata,
401
+ retry_policy: @config.rpcs.get.retry_policy
402
+
403
+ options.apply_defaults timeout: @config.timeout,
404
+ metadata: @config.metadata,
405
+ retry_policy: @config.retry_policy
406
+
407
+ @region_snapshots_stub.get request, options do |result, operation|
408
+ yield result, operation if block_given?
409
+ end
410
+ rescue ::Gapic::Rest::Error => e
411
+ raise ::Google::Cloud::Error.from_error(e)
412
+ end
413
+
414
+ ##
415
+ # Gets the access control policy for a resource. May be empty if no such
416
+ # policy or resource exists.
417
+ #
418
+ # @overload get_iam_policy(request, options = nil)
419
+ # Pass arguments to `get_iam_policy` via a request object, either of type
420
+ # {::Google::Cloud::Compute::V1::GetIamPolicyRegionSnapshotRequest} or an equivalent Hash.
421
+ #
422
+ # @param request [::Google::Cloud::Compute::V1::GetIamPolicyRegionSnapshotRequest, ::Hash]
423
+ # A request object representing the call parameters. Required. To specify no
424
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
425
+ # @param options [::Gapic::CallOptions, ::Hash]
426
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
427
+ #
428
+ # @overload get_iam_policy(options_requested_policy_version: nil, project: nil, region: nil, resource: nil)
429
+ # Pass arguments to `get_iam_policy` via keyword arguments. Note that at
430
+ # least one keyword argument is required. To specify no parameters, or to keep all
431
+ # the default parameter values, pass an empty Hash as a request object (see above).
432
+ #
433
+ # @param options_requested_policy_version [::Integer]
434
+ # Requested IAM Policy version.
435
+ # @param project [::String]
436
+ # Project ID for this request.
437
+ # @param region [::String]
438
+ # The name of the region for this request.
439
+ # @param resource [::String]
440
+ # Name or id of the resource for this request.
441
+ # @yield [result, operation] Access the result along with the TransportOperation object
442
+ # @yieldparam result [::Google::Cloud::Compute::V1::Policy]
443
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
444
+ #
445
+ # @return [::Google::Cloud::Compute::V1::Policy]
446
+ #
447
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
448
+ #
449
+ # @example Basic example
450
+ # require "google/cloud/compute/v1"
451
+ #
452
+ # # Create a client object. The client can be reused for multiple calls.
453
+ # client = Google::Cloud::Compute::V1::RegionSnapshots::Rest::Client.new
454
+ #
455
+ # # Create a request. To set request fields, pass in keyword arguments.
456
+ # request = Google::Cloud::Compute::V1::GetIamPolicyRegionSnapshotRequest.new
457
+ #
458
+ # # Call the get_iam_policy method.
459
+ # result = client.get_iam_policy request
460
+ #
461
+ # # The returned object is of type Google::Cloud::Compute::V1::Policy.
462
+ # p result
463
+ #
464
+ def get_iam_policy request, options = nil
465
+ raise ::ArgumentError, "request must be provided" if request.nil?
466
+
467
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Compute::V1::GetIamPolicyRegionSnapshotRequest
468
+
469
+ # Converts hash and nil to an options object
470
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
471
+
472
+ # Customize the options with defaults
473
+ call_metadata = @config.rpcs.get_iam_policy.metadata.to_h
474
+
475
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
476
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
477
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
478
+ gapic_version: ::Google::Cloud::Compute::V1::VERSION,
479
+ transports_version_send: [:rest]
480
+
481
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
482
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
483
+
484
+ options.apply_defaults timeout: @config.rpcs.get_iam_policy.timeout,
485
+ metadata: call_metadata,
486
+ retry_policy: @config.rpcs.get_iam_policy.retry_policy
487
+
488
+ options.apply_defaults timeout: @config.timeout,
489
+ metadata: @config.metadata,
490
+ retry_policy: @config.retry_policy
491
+
492
+ @region_snapshots_stub.get_iam_policy request, options do |result, operation|
493
+ yield result, operation if block_given?
494
+ end
495
+ rescue ::Gapic::Rest::Error => e
496
+ raise ::Google::Cloud::Error.from_error(e)
497
+ end
498
+
499
+ ##
500
+ # Creates a snapshot in the specified region using the data included
501
+ # in the request.
502
+ #
503
+ # @overload insert(request, options = nil)
504
+ # Pass arguments to `insert` via a request object, either of type
505
+ # {::Google::Cloud::Compute::V1::InsertRegionSnapshotRequest} or an equivalent Hash.
506
+ #
507
+ # @param request [::Google::Cloud::Compute::V1::InsertRegionSnapshotRequest, ::Hash]
508
+ # A request object representing the call parameters. Required. To specify no
509
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
510
+ # @param options [::Gapic::CallOptions, ::Hash]
511
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
512
+ #
513
+ # @overload insert(project: nil, region: nil, request_id: nil, snapshot_resource: nil)
514
+ # Pass arguments to `insert` via keyword arguments. Note that at
515
+ # least one keyword argument is required. To specify no parameters, or to keep all
516
+ # the default parameter values, pass an empty Hash as a request object (see above).
517
+ #
518
+ # @param project [::String]
519
+ # Project ID for this request.
520
+ # @param region [::String]
521
+ # Name of the region for this request.
522
+ # @param request_id [::String]
523
+ # An optional request ID to identify requests. Specify a unique request ID so
524
+ # that if you must retry your request, the server will know to ignore the
525
+ # request if it has already been completed.
526
+ #
527
+ # For example, consider a situation where you make an initial request and
528
+ # the request times out. If you make the request again with the same
529
+ # request ID, the server can check if original operation with the same
530
+ # request ID was received, and if so, will ignore the second request. This
531
+ # prevents clients from accidentally creating duplicate commitments.
532
+ #
533
+ # The request ID must be
534
+ # a valid UUID with the exception that zero UUID is not supported
535
+ # (00000000-0000-0000-0000-000000000000).
536
+ # @param snapshot_resource [::Google::Cloud::Compute::V1::Snapshot, ::Hash]
537
+ # The body resource for this request
538
+ # @yield [result, operation] Access the result along with the TransportOperation object
539
+ # @yieldparam result [::Gapic::GenericLRO::Operation]
540
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
541
+ #
542
+ # @return [::Gapic::GenericLRO::Operation]
543
+ #
544
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
545
+ #
546
+ # @example Basic example
547
+ # require "google/cloud/compute/v1"
548
+ #
549
+ # # Create a client object. The client can be reused for multiple calls.
550
+ # client = Google::Cloud::Compute::V1::RegionSnapshots::Rest::Client.new
551
+ #
552
+ # # Create a request. To set request fields, pass in keyword arguments.
553
+ # request = Google::Cloud::Compute::V1::InsertRegionSnapshotRequest.new
554
+ #
555
+ # # Call the insert method.
556
+ # result = client.insert request
557
+ #
558
+ # # The returned object is of type Google::Cloud::Compute::V1::Operation.
559
+ # p result
560
+ #
561
+ def insert request, options = nil
562
+ raise ::ArgumentError, "request must be provided" if request.nil?
563
+
564
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Compute::V1::InsertRegionSnapshotRequest
565
+
566
+ # Converts hash and nil to an options object
567
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
568
+
569
+ # Customize the options with defaults
570
+ call_metadata = @config.rpcs.insert.metadata.to_h
571
+
572
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
573
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
574
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
575
+ gapic_version: ::Google::Cloud::Compute::V1::VERSION,
576
+ transports_version_send: [:rest]
577
+
578
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
579
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
580
+
581
+ options.apply_defaults timeout: @config.rpcs.insert.timeout,
582
+ metadata: call_metadata,
583
+ retry_policy: @config.rpcs.insert.retry_policy
584
+
585
+ options.apply_defaults timeout: @config.timeout,
586
+ metadata: @config.metadata,
587
+ retry_policy: @config.retry_policy
588
+
589
+ @region_snapshots_stub.insert request, options do |result, response|
590
+ result = ::Google::Cloud::Compute::V1::RegionOperations::Rest::NonstandardLro.create_operation(
591
+ operation: result,
592
+ client: region_operations,
593
+ request_values: {
594
+ "project" => request.project,
595
+ "region" => request.region
596
+ },
597
+ options: options
598
+ )
599
+ yield result, response if block_given?
600
+ throw :response, result
601
+ end
602
+ rescue ::Gapic::Rest::Error => e
603
+ raise ::Google::Cloud::Error.from_error(e)
604
+ end
605
+
606
+ ##
607
+ # Retrieves the list of Snapshot resources contained within
608
+ # the specified region.
609
+ #
610
+ # @overload list(request, options = nil)
611
+ # Pass arguments to `list` via a request object, either of type
612
+ # {::Google::Cloud::Compute::V1::ListRegionSnapshotsRequest} or an equivalent Hash.
613
+ #
614
+ # @param request [::Google::Cloud::Compute::V1::ListRegionSnapshotsRequest, ::Hash]
615
+ # A request object representing the call parameters. Required. To specify no
616
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
617
+ # @param options [::Gapic::CallOptions, ::Hash]
618
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
619
+ #
620
+ # @overload list(filter: nil, max_results: nil, order_by: nil, page_token: nil, project: nil, region: nil, return_partial_success: nil)
621
+ # Pass arguments to `list` via keyword arguments. Note that at
622
+ # least one keyword argument is required. To specify no parameters, or to keep all
623
+ # the default parameter values, pass an empty Hash as a request object (see above).
624
+ #
625
+ # @param filter [::String]
626
+ # A filter expression that filters resources listed in the response. Most
627
+ # Compute resources support two types of filter expressions:
628
+ # expressions that support regular expressions and expressions that follow
629
+ # API improvement proposal AIP-160.
630
+ # These two types of filter expressions cannot be mixed in one request.
631
+ #
632
+ # If you want to use AIP-160, your expression must specify the field name, an
633
+ # operator, and the value that you want to use for filtering. The value
634
+ # must be a string, a number, or a boolean. The operator
635
+ # must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`.
636
+ #
637
+ # For example, if you are filtering Compute Engine instances, you can
638
+ # exclude instances named `example-instance` by specifying
639
+ # `name != example-instance`.
640
+ #
641
+ # The `:*` comparison can be used to test whether a key has been defined.
642
+ # For example, to find all objects with `owner` label use:
643
+ # ```
644
+ # labels.owner:*
645
+ # ```
646
+ #
647
+ # You can also filter nested fields. For example, you could specify
648
+ # `scheduling.automaticRestart = false` to include instances only
649
+ # if they are not scheduled for automatic restarts. You can use filtering
650
+ # on nested fields to filter based onresource labels.
651
+ #
652
+ # To filter on multiple expressions, provide each separate expression within
653
+ # parentheses. For example:
654
+ # ```
655
+ # (scheduling.automaticRestart = true)
656
+ # (cpuPlatform = "Intel Skylake")
657
+ # ```
658
+ # By default, each expression is an `AND` expression. However, you
659
+ # can include `AND` and `OR` expressions explicitly.
660
+ # For example:
661
+ # ```
662
+ # (cpuPlatform = "Intel Skylake") OR
663
+ # (cpuPlatform = "Intel Broadwell") AND
664
+ # (scheduling.automaticRestart = true)
665
+ # ```
666
+ #
667
+ # If you want to use a regular expression, use the `eq` (equal) or `ne`
668
+ # (not equal) operator against a single un-parenthesized expression with or
669
+ # without quotes or against multiple parenthesized expressions. Examples:
670
+ #
671
+ # `fieldname eq unquoted literal`
672
+ # `fieldname eq 'single quoted literal'`
673
+ # `fieldname eq "double quoted literal"`
674
+ # `(fieldname1 eq literal) (fieldname2 ne "literal")`
675
+ #
676
+ # The literal value is interpreted as a regular expression using GoogleRE2 library syntax.
677
+ # The literal value must match the entire field.
678
+ #
679
+ # For example, to filter for instances that do not end with name "instance",
680
+ # you would use `name ne .*instance`.
681
+ #
682
+ # You cannot combine constraints on multiple fields using regular
683
+ # expressions.
684
+ # @param max_results [::Integer]
685
+ # The maximum number of results per page that should be returned.
686
+ # If the number of available results is larger than `maxResults`,
687
+ # Compute Engine returns a `nextPageToken` that can be used to get
688
+ # the next page of results in subsequent list requests. Acceptable values are
689
+ # `0` to `500`, inclusive. (Default: `500`)
690
+ # @param order_by [::String]
691
+ # Sorts list results by a certain order. By default, results
692
+ # are returned in alphanumerical order based on the resource name.
693
+ #
694
+ # You can also sort results in descending order based on the creation
695
+ # timestamp using `orderBy="creationTimestamp desc"`. This sorts
696
+ # results based on the `creationTimestamp` field in
697
+ # reverse chronological order (newest result first). Use this to sort
698
+ # resources like operations so that the newest operation is returned first.
699
+ #
700
+ # Currently, only sorting by `name` or
701
+ # `creationTimestamp desc` is supported.
702
+ # @param page_token [::String]
703
+ # Specifies a page token to use. Set `pageToken` to the
704
+ # `nextPageToken` returned by a previous list request to get
705
+ # the next page of results.
706
+ # @param project [::String]
707
+ # Project ID for this request.
708
+ # @param region [::String]
709
+ # Name of the region for this request.
710
+ # @param return_partial_success [::Boolean]
711
+ # Opt-in for partial success behavior which provides partial results in case
712
+ # of failure. The default value is false.
713
+ #
714
+ # For example, when partial success behavior is enabled, aggregatedList for a
715
+ # single zone scope either returns all resources in the zone or no resources,
716
+ # with an error code.
717
+ # @yield [result, operation] Access the result along with the TransportOperation object
718
+ # @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Compute::V1::Snapshot>]
719
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
720
+ #
721
+ # @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Compute::V1::Snapshot>]
722
+ #
723
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
724
+ #
725
+ # @example Basic example
726
+ # require "google/cloud/compute/v1"
727
+ #
728
+ # # Create a client object. The client can be reused for multiple calls.
729
+ # client = Google::Cloud::Compute::V1::RegionSnapshots::Rest::Client.new
730
+ #
731
+ # # Create a request. To set request fields, pass in keyword arguments.
732
+ # request = Google::Cloud::Compute::V1::ListRegionSnapshotsRequest.new
733
+ #
734
+ # # Call the list method.
735
+ # result = client.list request
736
+ #
737
+ # # The returned object is of type Google::Cloud::Compute::V1::SnapshotList.
738
+ # p result
739
+ #
740
+ def list request, options = nil
741
+ raise ::ArgumentError, "request must be provided" if request.nil?
742
+
743
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Compute::V1::ListRegionSnapshotsRequest
744
+
745
+ # Converts hash and nil to an options object
746
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
747
+
748
+ # Customize the options with defaults
749
+ call_metadata = @config.rpcs.list.metadata.to_h
750
+
751
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
752
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
753
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
754
+ gapic_version: ::Google::Cloud::Compute::V1::VERSION,
755
+ transports_version_send: [:rest]
756
+
757
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
758
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
759
+
760
+ options.apply_defaults timeout: @config.rpcs.list.timeout,
761
+ metadata: call_metadata,
762
+ retry_policy: @config.rpcs.list.retry_policy
763
+
764
+ options.apply_defaults timeout: @config.timeout,
765
+ metadata: @config.metadata,
766
+ retry_policy: @config.retry_policy
767
+
768
+ @region_snapshots_stub.list request, options do |result, operation|
769
+ result = ::Gapic::Rest::PagedEnumerable.new @region_snapshots_stub, :list, "items", request, result, options
770
+ yield result, operation if block_given?
771
+ throw :response, result
772
+ end
773
+ rescue ::Gapic::Rest::Error => e
774
+ raise ::Google::Cloud::Error.from_error(e)
775
+ end
776
+
777
+ ##
778
+ # Sets the access control policy on the specified resource.
779
+ # Replaces any existing policy.
780
+ #
781
+ # @overload set_iam_policy(request, options = nil)
782
+ # Pass arguments to `set_iam_policy` via a request object, either of type
783
+ # {::Google::Cloud::Compute::V1::SetIamPolicyRegionSnapshotRequest} or an equivalent Hash.
784
+ #
785
+ # @param request [::Google::Cloud::Compute::V1::SetIamPolicyRegionSnapshotRequest, ::Hash]
786
+ # A request object representing the call parameters. Required. To specify no
787
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
788
+ # @param options [::Gapic::CallOptions, ::Hash]
789
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
790
+ #
791
+ # @overload set_iam_policy(project: nil, region: nil, region_set_policy_request_resource: nil, resource: nil)
792
+ # Pass arguments to `set_iam_policy` via keyword arguments. Note that at
793
+ # least one keyword argument is required. To specify no parameters, or to keep all
794
+ # the default parameter values, pass an empty Hash as a request object (see above).
795
+ #
796
+ # @param project [::String]
797
+ # Project ID for this request.
798
+ # @param region [::String]
799
+ # The name of the region for this request.
800
+ # @param region_set_policy_request_resource [::Google::Cloud::Compute::V1::RegionSetPolicyRequest, ::Hash]
801
+ # The body resource for this request
802
+ # @param resource [::String]
803
+ # Name or id of the resource for this request.
804
+ # @yield [result, operation] Access the result along with the TransportOperation object
805
+ # @yieldparam result [::Google::Cloud::Compute::V1::Policy]
806
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
807
+ #
808
+ # @return [::Google::Cloud::Compute::V1::Policy]
809
+ #
810
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
811
+ #
812
+ # @example Basic example
813
+ # require "google/cloud/compute/v1"
814
+ #
815
+ # # Create a client object. The client can be reused for multiple calls.
816
+ # client = Google::Cloud::Compute::V1::RegionSnapshots::Rest::Client.new
817
+ #
818
+ # # Create a request. To set request fields, pass in keyword arguments.
819
+ # request = Google::Cloud::Compute::V1::SetIamPolicyRegionSnapshotRequest.new
820
+ #
821
+ # # Call the set_iam_policy method.
822
+ # result = client.set_iam_policy request
823
+ #
824
+ # # The returned object is of type Google::Cloud::Compute::V1::Policy.
825
+ # p result
826
+ #
827
+ def set_iam_policy request, options = nil
828
+ raise ::ArgumentError, "request must be provided" if request.nil?
829
+
830
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Compute::V1::SetIamPolicyRegionSnapshotRequest
831
+
832
+ # Converts hash and nil to an options object
833
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
834
+
835
+ # Customize the options with defaults
836
+ call_metadata = @config.rpcs.set_iam_policy.metadata.to_h
837
+
838
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
839
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
840
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
841
+ gapic_version: ::Google::Cloud::Compute::V1::VERSION,
842
+ transports_version_send: [:rest]
843
+
844
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
845
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
846
+
847
+ options.apply_defaults timeout: @config.rpcs.set_iam_policy.timeout,
848
+ metadata: call_metadata,
849
+ retry_policy: @config.rpcs.set_iam_policy.retry_policy
850
+
851
+ options.apply_defaults timeout: @config.timeout,
852
+ metadata: @config.metadata,
853
+ retry_policy: @config.retry_policy
854
+
855
+ @region_snapshots_stub.set_iam_policy request, options do |result, operation|
856
+ yield result, operation if block_given?
857
+ end
858
+ rescue ::Gapic::Rest::Error => e
859
+ raise ::Google::Cloud::Error.from_error(e)
860
+ end
861
+
862
+ ##
863
+ # Sets the labels on a regional snapshot. To learn more about labels, read
864
+ # the Labeling Resources
865
+ # documentation.
866
+ #
867
+ # @overload set_labels(request, options = nil)
868
+ # Pass arguments to `set_labels` via a request object, either of type
869
+ # {::Google::Cloud::Compute::V1::SetLabelsRegionSnapshotRequest} or an equivalent Hash.
870
+ #
871
+ # @param request [::Google::Cloud::Compute::V1::SetLabelsRegionSnapshotRequest, ::Hash]
872
+ # A request object representing the call parameters. Required. To specify no
873
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
874
+ # @param options [::Gapic::CallOptions, ::Hash]
875
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
876
+ #
877
+ # @overload set_labels(project: nil, region: nil, region_set_labels_request_resource: nil, request_id: nil, resource: nil)
878
+ # Pass arguments to `set_labels` via keyword arguments. Note that at
879
+ # least one keyword argument is required. To specify no parameters, or to keep all
880
+ # the default parameter values, pass an empty Hash as a request object (see above).
881
+ #
882
+ # @param project [::String]
883
+ # Project ID for this request.
884
+ # @param region [::String]
885
+ # The region for this request.
886
+ # @param region_set_labels_request_resource [::Google::Cloud::Compute::V1::RegionSetLabelsRequest, ::Hash]
887
+ # The body resource for this request
888
+ # @param request_id [::String]
889
+ # An optional request ID to identify requests. Specify a unique request ID so
890
+ # that if you must retry your request, the server will know to ignore the
891
+ # request if it has already been completed.
892
+ #
893
+ # For example, consider a situation where you make an initial request and
894
+ # the request times out. If you make the request again with the same
895
+ # request ID, the server can check if original operation with the same
896
+ # request ID was received, and if so, will ignore the second request. This
897
+ # prevents clients from accidentally creating duplicate commitments.
898
+ #
899
+ # The request ID must be
900
+ # a valid UUID with the exception that zero UUID is not supported
901
+ # (00000000-0000-0000-0000-000000000000).
902
+ # @param resource [::String]
903
+ # Name or id of the resource for this request.
904
+ # @yield [result, operation] Access the result along with the TransportOperation object
905
+ # @yieldparam result [::Gapic::GenericLRO::Operation]
906
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
907
+ #
908
+ # @return [::Gapic::GenericLRO::Operation]
909
+ #
910
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
911
+ #
912
+ # @example Basic example
913
+ # require "google/cloud/compute/v1"
914
+ #
915
+ # # Create a client object. The client can be reused for multiple calls.
916
+ # client = Google::Cloud::Compute::V1::RegionSnapshots::Rest::Client.new
917
+ #
918
+ # # Create a request. To set request fields, pass in keyword arguments.
919
+ # request = Google::Cloud::Compute::V1::SetLabelsRegionSnapshotRequest.new
920
+ #
921
+ # # Call the set_labels method.
922
+ # result = client.set_labels request
923
+ #
924
+ # # The returned object is of type Google::Cloud::Compute::V1::Operation.
925
+ # p result
926
+ #
927
+ def set_labels request, options = nil
928
+ raise ::ArgumentError, "request must be provided" if request.nil?
929
+
930
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Compute::V1::SetLabelsRegionSnapshotRequest
931
+
932
+ # Converts hash and nil to an options object
933
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
934
+
935
+ # Customize the options with defaults
936
+ call_metadata = @config.rpcs.set_labels.metadata.to_h
937
+
938
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
939
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
940
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
941
+ gapic_version: ::Google::Cloud::Compute::V1::VERSION,
942
+ transports_version_send: [:rest]
943
+
944
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
945
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
946
+
947
+ options.apply_defaults timeout: @config.rpcs.set_labels.timeout,
948
+ metadata: call_metadata,
949
+ retry_policy: @config.rpcs.set_labels.retry_policy
950
+
951
+ options.apply_defaults timeout: @config.timeout,
952
+ metadata: @config.metadata,
953
+ retry_policy: @config.retry_policy
954
+
955
+ @region_snapshots_stub.set_labels request, options do |result, response|
956
+ result = ::Google::Cloud::Compute::V1::RegionOperations::Rest::NonstandardLro.create_operation(
957
+ operation: result,
958
+ client: region_operations,
959
+ request_values: {
960
+ "project" => request.project,
961
+ "region" => request.region
962
+ },
963
+ options: options
964
+ )
965
+ yield result, response if block_given?
966
+ throw :response, result
967
+ end
968
+ rescue ::Gapic::Rest::Error => e
969
+ raise ::Google::Cloud::Error.from_error(e)
970
+ end
971
+
972
+ ##
973
+ # Returns permissions that a caller has on the specified resource.
974
+ #
975
+ # @overload test_iam_permissions(request, options = nil)
976
+ # Pass arguments to `test_iam_permissions` via a request object, either of type
977
+ # {::Google::Cloud::Compute::V1::TestIamPermissionsRegionSnapshotRequest} or an equivalent Hash.
978
+ #
979
+ # @param request [::Google::Cloud::Compute::V1::TestIamPermissionsRegionSnapshotRequest, ::Hash]
980
+ # A request object representing the call parameters. Required. To specify no
981
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
982
+ # @param options [::Gapic::CallOptions, ::Hash]
983
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
984
+ #
985
+ # @overload test_iam_permissions(project: nil, region: nil, resource: nil, test_permissions_request_resource: nil)
986
+ # Pass arguments to `test_iam_permissions` via keyword arguments. Note that at
987
+ # least one keyword argument is required. To specify no parameters, or to keep all
988
+ # the default parameter values, pass an empty Hash as a request object (see above).
989
+ #
990
+ # @param project [::String]
991
+ # Project ID for this request.
992
+ # @param region [::String]
993
+ # The name of the region for this request.
994
+ # @param resource [::String]
995
+ # Name or id of the resource for this request.
996
+ # @param test_permissions_request_resource [::Google::Cloud::Compute::V1::TestPermissionsRequest, ::Hash]
997
+ # The body resource for this request
998
+ # @yield [result, operation] Access the result along with the TransportOperation object
999
+ # @yieldparam result [::Google::Cloud::Compute::V1::TestPermissionsResponse]
1000
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
1001
+ #
1002
+ # @return [::Google::Cloud::Compute::V1::TestPermissionsResponse]
1003
+ #
1004
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
1005
+ #
1006
+ # @example Basic example
1007
+ # require "google/cloud/compute/v1"
1008
+ #
1009
+ # # Create a client object. The client can be reused for multiple calls.
1010
+ # client = Google::Cloud::Compute::V1::RegionSnapshots::Rest::Client.new
1011
+ #
1012
+ # # Create a request. To set request fields, pass in keyword arguments.
1013
+ # request = Google::Cloud::Compute::V1::TestIamPermissionsRegionSnapshotRequest.new
1014
+ #
1015
+ # # Call the test_iam_permissions method.
1016
+ # result = client.test_iam_permissions request
1017
+ #
1018
+ # # The returned object is of type Google::Cloud::Compute::V1::TestPermissionsResponse.
1019
+ # p result
1020
+ #
1021
+ def test_iam_permissions request, options = nil
1022
+ raise ::ArgumentError, "request must be provided" if request.nil?
1023
+
1024
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Compute::V1::TestIamPermissionsRegionSnapshotRequest
1025
+
1026
+ # Converts hash and nil to an options object
1027
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1028
+
1029
+ # Customize the options with defaults
1030
+ call_metadata = @config.rpcs.test_iam_permissions.metadata.to_h
1031
+
1032
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
1033
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1034
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1035
+ gapic_version: ::Google::Cloud::Compute::V1::VERSION,
1036
+ transports_version_send: [:rest]
1037
+
1038
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
1039
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1040
+
1041
+ options.apply_defaults timeout: @config.rpcs.test_iam_permissions.timeout,
1042
+ metadata: call_metadata,
1043
+ retry_policy: @config.rpcs.test_iam_permissions.retry_policy
1044
+
1045
+ options.apply_defaults timeout: @config.timeout,
1046
+ metadata: @config.metadata,
1047
+ retry_policy: @config.retry_policy
1048
+
1049
+ @region_snapshots_stub.test_iam_permissions request, options do |result, operation|
1050
+ yield result, operation if block_given?
1051
+ end
1052
+ rescue ::Gapic::Rest::Error => e
1053
+ raise ::Google::Cloud::Error.from_error(e)
1054
+ end
1055
+
1056
+ ##
1057
+ # Rotates the customer-managed
1058
+ # encryption key to the latest version for the specified snapshot.
1059
+ #
1060
+ # @overload update_kms_key(request, options = nil)
1061
+ # Pass arguments to `update_kms_key` via a request object, either of type
1062
+ # {::Google::Cloud::Compute::V1::UpdateKmsKeyRegionSnapshotRequest} or an equivalent Hash.
1063
+ #
1064
+ # @param request [::Google::Cloud::Compute::V1::UpdateKmsKeyRegionSnapshotRequest, ::Hash]
1065
+ # A request object representing the call parameters. Required. To specify no
1066
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1067
+ # @param options [::Gapic::CallOptions, ::Hash]
1068
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
1069
+ #
1070
+ # @overload update_kms_key(project: nil, region: nil, region_snapshot_update_kms_key_request_resource: nil, request_id: nil, snapshot: nil)
1071
+ # Pass arguments to `update_kms_key` via keyword arguments. Note that at
1072
+ # least one keyword argument is required. To specify no parameters, or to keep all
1073
+ # the default parameter values, pass an empty Hash as a request object (see above).
1074
+ #
1075
+ # @param project [::String]
1076
+ # Project ID for this request.
1077
+ # @param region [::String]
1078
+ # Name of the region for this request.
1079
+ # @param region_snapshot_update_kms_key_request_resource [::Google::Cloud::Compute::V1::RegionSnapshotUpdateKmsKeyRequest, ::Hash]
1080
+ # The body resource for this request
1081
+ # @param request_id [::String]
1082
+ # An optional request ID to identify requests. Specify a unique request ID so
1083
+ # that if you must retry your request, the server will know to ignore the
1084
+ # request if it has already been completed.
1085
+ #
1086
+ # For example, consider a situation where you make an initial request and
1087
+ # the request times out. If you make the request again with the same
1088
+ # request ID, the server can check if original operation with the same
1089
+ # request ID was received, and if so, will ignore the second request. This
1090
+ # prevents clients from accidentally creating duplicate commitments.
1091
+ #
1092
+ # The request ID must be
1093
+ # a valid UUID with the exception that zero UUID is not supported
1094
+ # (00000000-0000-0000-0000-000000000000).
1095
+ # @param snapshot [::String]
1096
+ # Name of the snapshot resource to update. Should conform to RFC1035.
1097
+ # @yield [result, operation] Access the result along with the TransportOperation object
1098
+ # @yieldparam result [::Gapic::GenericLRO::Operation]
1099
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
1100
+ #
1101
+ # @return [::Gapic::GenericLRO::Operation]
1102
+ #
1103
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
1104
+ #
1105
+ # @example Basic example
1106
+ # require "google/cloud/compute/v1"
1107
+ #
1108
+ # # Create a client object. The client can be reused for multiple calls.
1109
+ # client = Google::Cloud::Compute::V1::RegionSnapshots::Rest::Client.new
1110
+ #
1111
+ # # Create a request. To set request fields, pass in keyword arguments.
1112
+ # request = Google::Cloud::Compute::V1::UpdateKmsKeyRegionSnapshotRequest.new
1113
+ #
1114
+ # # Call the update_kms_key method.
1115
+ # result = client.update_kms_key request
1116
+ #
1117
+ # # The returned object is of type Google::Cloud::Compute::V1::Operation.
1118
+ # p result
1119
+ #
1120
+ def update_kms_key request, options = nil
1121
+ raise ::ArgumentError, "request must be provided" if request.nil?
1122
+
1123
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Compute::V1::UpdateKmsKeyRegionSnapshotRequest
1124
+
1125
+ # Converts hash and nil to an options object
1126
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1127
+
1128
+ # Customize the options with defaults
1129
+ call_metadata = @config.rpcs.update_kms_key.metadata.to_h
1130
+
1131
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
1132
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1133
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1134
+ gapic_version: ::Google::Cloud::Compute::V1::VERSION,
1135
+ transports_version_send: [:rest]
1136
+
1137
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
1138
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1139
+
1140
+ options.apply_defaults timeout: @config.rpcs.update_kms_key.timeout,
1141
+ metadata: call_metadata,
1142
+ retry_policy: @config.rpcs.update_kms_key.retry_policy
1143
+
1144
+ options.apply_defaults timeout: @config.timeout,
1145
+ metadata: @config.metadata,
1146
+ retry_policy: @config.retry_policy
1147
+
1148
+ @region_snapshots_stub.update_kms_key request, options do |result, response|
1149
+ result = ::Google::Cloud::Compute::V1::RegionOperations::Rest::NonstandardLro.create_operation(
1150
+ operation: result,
1151
+ client: region_operations,
1152
+ request_values: {
1153
+ "project" => request.project,
1154
+ "region" => request.region
1155
+ },
1156
+ options: options
1157
+ )
1158
+ yield result, response if block_given?
1159
+ throw :response, result
1160
+ end
1161
+ rescue ::Gapic::Rest::Error => e
1162
+ raise ::Google::Cloud::Error.from_error(e)
1163
+ end
1164
+
1165
+ ##
1166
+ # Configuration class for the RegionSnapshots REST API.
1167
+ #
1168
+ # This class represents the configuration for RegionSnapshots REST,
1169
+ # providing control over timeouts, retry behavior, logging, transport
1170
+ # parameters, and other low-level controls. Certain parameters can also be
1171
+ # applied individually to specific RPCs. See
1172
+ # {::Google::Cloud::Compute::V1::RegionSnapshots::Rest::Client::Configuration::Rpcs}
1173
+ # for a list of RPCs that can be configured independently.
1174
+ #
1175
+ # Configuration can be applied globally to all clients, or to a single client
1176
+ # on construction.
1177
+ #
1178
+ # @example
1179
+ #
1180
+ # # Modify the global config, setting the timeout for
1181
+ # # delete to 20 seconds,
1182
+ # # and all remaining timeouts to 10 seconds.
1183
+ # ::Google::Cloud::Compute::V1::RegionSnapshots::Rest::Client.configure do |config|
1184
+ # config.timeout = 10.0
1185
+ # config.rpcs.delete.timeout = 20.0
1186
+ # end
1187
+ #
1188
+ # # Apply the above configuration only to a new client.
1189
+ # client = ::Google::Cloud::Compute::V1::RegionSnapshots::Rest::Client.new do |config|
1190
+ # config.timeout = 10.0
1191
+ # config.rpcs.delete.timeout = 20.0
1192
+ # end
1193
+ #
1194
+ # @!attribute [rw] endpoint
1195
+ # A custom service endpoint, as a hostname or hostname:port. The default is
1196
+ # nil, indicating to use the default endpoint in the current universe domain.
1197
+ # @return [::String,nil]
1198
+ # @!attribute [rw] credentials
1199
+ # Credentials to send with calls. You may provide any of the following types:
1200
+ # * (`String`) The path to a service account key file in JSON format
1201
+ # * (`Hash`) A service account key as a Hash
1202
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
1203
+ # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
1204
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
1205
+ # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
1206
+ # * (`nil`) indicating no credentials
1207
+ #
1208
+ # Warning: If you accept a credential configuration (JSON file or Hash) from an
1209
+ # external source for authentication to Google Cloud, you must validate it before
1210
+ # providing it to a Google API client library. Providing an unvalidated credential
1211
+ # configuration to Google APIs can compromise the security of your systems and data.
1212
+ # For more information, refer to [Validate credential configurations from external
1213
+ # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
1214
+ # @return [::Object]
1215
+ # @!attribute [rw] scope
1216
+ # The OAuth scopes
1217
+ # @return [::Array<::String>]
1218
+ # @!attribute [rw] lib_name
1219
+ # The library name as recorded in instrumentation and logging
1220
+ # @return [::String]
1221
+ # @!attribute [rw] lib_version
1222
+ # The library version as recorded in instrumentation and logging
1223
+ # @return [::String]
1224
+ # @!attribute [rw] timeout
1225
+ # The call timeout in seconds.
1226
+ # @return [::Numeric]
1227
+ # @!attribute [rw] metadata
1228
+ # Additional headers to be sent with the call.
1229
+ # @return [::Hash{::Symbol=>::String}]
1230
+ # @!attribute [rw] retry_policy
1231
+ # The retry policy. The value is a hash with the following keys:
1232
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
1233
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
1234
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
1235
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
1236
+ # trigger a retry.
1237
+ # @return [::Hash]
1238
+ # @!attribute [rw] quota_project
1239
+ # A separate project against which to charge quota.
1240
+ # @return [::String]
1241
+ # @!attribute [rw] universe_domain
1242
+ # The universe domain within which to make requests. This determines the
1243
+ # default endpoint URL. The default value of nil uses the environment
1244
+ # universe (usually the default "googleapis.com" universe).
1245
+ # @return [::String,nil]
1246
+ # @!attribute [rw] logger
1247
+ # A custom logger to use for request/response debug logging, or the value
1248
+ # `:default` (the default) to construct a default logger, or `nil` to
1249
+ # explicitly disable logging.
1250
+ # @return [::Logger,:default,nil]
1251
+ #
1252
+ class Configuration
1253
+ extend ::Gapic::Config
1254
+
1255
+ # @private
1256
+ # The endpoint specific to the default "googleapis.com" universe. Deprecated.
1257
+ DEFAULT_ENDPOINT = "compute.googleapis.com"
1258
+
1259
+ config_attr :endpoint, nil, ::String, nil
1260
+ config_attr :credentials, nil do |value|
1261
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Google::Auth::BaseClient, ::Signet::OAuth2::Client, nil]
1262
+ allowed.any? { |klass| klass === value }
1263
+ end
1264
+ config_attr :scope, nil, ::String, ::Array, nil
1265
+ config_attr :lib_name, nil, ::String, nil
1266
+ config_attr :lib_version, nil, ::String, nil
1267
+ config_attr :timeout, nil, ::Numeric, nil
1268
+ config_attr :metadata, nil, ::Hash, nil
1269
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
1270
+ config_attr :quota_project, nil, ::String, nil
1271
+ config_attr :universe_domain, nil, ::String, nil
1272
+ config_attr :logger, :default, ::Logger, nil, :default
1273
+
1274
+ # @private
1275
+ def initialize parent_config = nil
1276
+ @parent_config = parent_config unless parent_config.nil?
1277
+
1278
+ yield self if block_given?
1279
+ end
1280
+
1281
+ ##
1282
+ # Configurations for individual RPCs
1283
+ # @return [Rpcs]
1284
+ #
1285
+ def rpcs
1286
+ @rpcs ||= begin
1287
+ parent_rpcs = nil
1288
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
1289
+ Rpcs.new parent_rpcs
1290
+ end
1291
+ end
1292
+
1293
+ ##
1294
+ # Configuration RPC class for the RegionSnapshots API.
1295
+ #
1296
+ # Includes fields providing the configuration for each RPC in this service.
1297
+ # Each configuration object is of type `Gapic::Config::Method` and includes
1298
+ # the following configuration fields:
1299
+ #
1300
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
1301
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers
1302
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
1303
+ # include the following keys:
1304
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
1305
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
1306
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
1307
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
1308
+ # trigger a retry.
1309
+ #
1310
+ class Rpcs
1311
+ ##
1312
+ # RPC-specific configuration for `delete`
1313
+ # @return [::Gapic::Config::Method]
1314
+ #
1315
+ attr_reader :delete
1316
+ ##
1317
+ # RPC-specific configuration for `get`
1318
+ # @return [::Gapic::Config::Method]
1319
+ #
1320
+ attr_reader :get
1321
+ ##
1322
+ # RPC-specific configuration for `get_iam_policy`
1323
+ # @return [::Gapic::Config::Method]
1324
+ #
1325
+ attr_reader :get_iam_policy
1326
+ ##
1327
+ # RPC-specific configuration for `insert`
1328
+ # @return [::Gapic::Config::Method]
1329
+ #
1330
+ attr_reader :insert
1331
+ ##
1332
+ # RPC-specific configuration for `list`
1333
+ # @return [::Gapic::Config::Method]
1334
+ #
1335
+ attr_reader :list
1336
+ ##
1337
+ # RPC-specific configuration for `set_iam_policy`
1338
+ # @return [::Gapic::Config::Method]
1339
+ #
1340
+ attr_reader :set_iam_policy
1341
+ ##
1342
+ # RPC-specific configuration for `set_labels`
1343
+ # @return [::Gapic::Config::Method]
1344
+ #
1345
+ attr_reader :set_labels
1346
+ ##
1347
+ # RPC-specific configuration for `test_iam_permissions`
1348
+ # @return [::Gapic::Config::Method]
1349
+ #
1350
+ attr_reader :test_iam_permissions
1351
+ ##
1352
+ # RPC-specific configuration for `update_kms_key`
1353
+ # @return [::Gapic::Config::Method]
1354
+ #
1355
+ attr_reader :update_kms_key
1356
+
1357
+ # @private
1358
+ def initialize parent_rpcs = nil
1359
+ delete_config = parent_rpcs.delete if parent_rpcs.respond_to? :delete
1360
+ @delete = ::Gapic::Config::Method.new delete_config
1361
+ get_config = parent_rpcs.get if parent_rpcs.respond_to? :get
1362
+ @get = ::Gapic::Config::Method.new get_config
1363
+ get_iam_policy_config = parent_rpcs.get_iam_policy if parent_rpcs.respond_to? :get_iam_policy
1364
+ @get_iam_policy = ::Gapic::Config::Method.new get_iam_policy_config
1365
+ insert_config = parent_rpcs.insert if parent_rpcs.respond_to? :insert
1366
+ @insert = ::Gapic::Config::Method.new insert_config
1367
+ list_config = parent_rpcs.list if parent_rpcs.respond_to? :list
1368
+ @list = ::Gapic::Config::Method.new list_config
1369
+ set_iam_policy_config = parent_rpcs.set_iam_policy if parent_rpcs.respond_to? :set_iam_policy
1370
+ @set_iam_policy = ::Gapic::Config::Method.new set_iam_policy_config
1371
+ set_labels_config = parent_rpcs.set_labels if parent_rpcs.respond_to? :set_labels
1372
+ @set_labels = ::Gapic::Config::Method.new set_labels_config
1373
+ test_iam_permissions_config = parent_rpcs.test_iam_permissions if parent_rpcs.respond_to? :test_iam_permissions
1374
+ @test_iam_permissions = ::Gapic::Config::Method.new test_iam_permissions_config
1375
+ update_kms_key_config = parent_rpcs.update_kms_key if parent_rpcs.respond_to? :update_kms_key
1376
+ @update_kms_key = ::Gapic::Config::Method.new update_kms_key_config
1377
+
1378
+ yield self if block_given?
1379
+ end
1380
+ end
1381
+ end
1382
+ end
1383
+ end
1384
+ end
1385
+ end
1386
+ end
1387
+ end
1388
+ end