google-cloud-compute-v1 2.9.0 → 2.11.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (128) hide show
  1. checksums.yaml +4 -4
  2. data/lib/google/cloud/compute/v1/accelerator_types/rest/client.rb +3 -3
  3. data/lib/google/cloud/compute/v1/addresses/rest/client.rb +3 -3
  4. data/lib/google/cloud/compute/v1/autoscalers/rest/client.rb +3 -3
  5. data/lib/google/cloud/compute/v1/backend_buckets/rest/client.rb +1 -1
  6. data/lib/google/cloud/compute/v1/backend_services/rest/client.rb +4 -4
  7. data/lib/google/cloud/compute/v1/compute_pb.rb +82 -1
  8. data/lib/google/cloud/compute/v1/disk_types/rest/client.rb +3 -3
  9. data/lib/google/cloud/compute/v1/disks/rest/client.rb +3 -3
  10. data/lib/google/cloud/compute/v1/external_vpn_gateways/rest/client.rb +1 -1
  11. data/lib/google/cloud/compute/v1/firewall_policies/rest/client.rb +1 -1
  12. data/lib/google/cloud/compute/v1/firewalls/rest/client.rb +1 -1
  13. data/lib/google/cloud/compute/v1/forwarding_rules/rest/client.rb +3 -3
  14. data/lib/google/cloud/compute/v1/global_addresses/rest/client.rb +1 -1
  15. data/lib/google/cloud/compute/v1/global_forwarding_rules/rest/client.rb +1 -1
  16. data/lib/google/cloud/compute/v1/global_network_endpoint_groups/rest/client.rb +2 -2
  17. data/lib/google/cloud/compute/v1/global_operations/rest/client.rb +3 -3
  18. data/lib/google/cloud/compute/v1/global_organization_operations/rest/client.rb +1 -1
  19. data/lib/google/cloud/compute/v1/global_public_delegated_prefixes/rest/client.rb +1 -1
  20. data/lib/google/cloud/compute/v1/health_checks/rest/client.rb +3 -3
  21. data/lib/google/cloud/compute/v1/images/rest/client.rb +1 -1
  22. data/lib/google/cloud/compute/v1/instance_group_manager_resize_requests/credentials.rb +52 -0
  23. data/lib/google/cloud/compute/v1/instance_group_manager_resize_requests/rest/client.rb +829 -0
  24. data/lib/google/cloud/compute/v1/instance_group_manager_resize_requests/rest/service_stub.rb +378 -0
  25. data/lib/google/cloud/compute/v1/instance_group_manager_resize_requests/rest.rb +51 -0
  26. data/lib/google/cloud/compute/v1/instance_group_manager_resize_requests.rb +47 -0
  27. data/lib/google/cloud/compute/v1/instance_group_managers/rest/client.rb +6 -6
  28. data/lib/google/cloud/compute/v1/instance_groups/rest/client.rb +4 -4
  29. data/lib/google/cloud/compute/v1/instance_settings_service/credentials.rb +52 -0
  30. data/lib/google/cloud/compute/v1/instance_settings_service/rest/client.rb +512 -0
  31. data/lib/google/cloud/compute/v1/instance_settings_service/rest/service_stub.rb +190 -0
  32. data/lib/google/cloud/compute/v1/instance_settings_service/rest.rb +51 -0
  33. data/lib/google/cloud/compute/v1/instance_settings_service.rb +47 -0
  34. data/lib/google/cloud/compute/v1/instance_templates/rest/client.rb +3 -3
  35. data/lib/google/cloud/compute/v1/instances/rest/client.rb +4 -4
  36. data/lib/google/cloud/compute/v1/instant_snapshots/credentials.rb +52 -0
  37. data/lib/google/cloud/compute/v1/instant_snapshots/rest/client.rb +1208 -0
  38. data/lib/google/cloud/compute/v1/instant_snapshots/rest/service_stub.rb +618 -0
  39. data/lib/google/cloud/compute/v1/instant_snapshots/rest.rb +51 -0
  40. data/lib/google/cloud/compute/v1/instant_snapshots.rb +47 -0
  41. data/lib/google/cloud/compute/v1/interconnect_attachments/rest/client.rb +3 -3
  42. data/lib/google/cloud/compute/v1/interconnect_locations/rest/client.rb +1 -1
  43. data/lib/google/cloud/compute/v1/interconnect_remote_locations/rest/client.rb +1 -1
  44. data/lib/google/cloud/compute/v1/interconnects/rest/client.rb +1 -1
  45. data/lib/google/cloud/compute/v1/licenses/rest/client.rb +1 -1
  46. data/lib/google/cloud/compute/v1/machine_images/rest/client.rb +1 -1
  47. data/lib/google/cloud/compute/v1/machine_types/rest/client.rb +3 -3
  48. data/lib/google/cloud/compute/v1/network_attachments/rest/client.rb +3 -3
  49. data/lib/google/cloud/compute/v1/network_edge_security_services/rest/client.rb +2 -2
  50. data/lib/google/cloud/compute/v1/network_endpoint_groups/rest/client.rb +4 -4
  51. data/lib/google/cloud/compute/v1/network_firewall_policies/rest/client.rb +1 -1
  52. data/lib/google/cloud/compute/v1/networks/rest/client.rb +2 -2
  53. data/lib/google/cloud/compute/v1/node_groups/rest/client.rb +108 -4
  54. data/lib/google/cloud/compute/v1/node_groups/rest/service_stub.rb +62 -0
  55. data/lib/google/cloud/compute/v1/node_templates/rest/client.rb +3 -3
  56. data/lib/google/cloud/compute/v1/node_types/rest/client.rb +3 -3
  57. data/lib/google/cloud/compute/v1/packet_mirrorings/rest/client.rb +3 -3
  58. data/lib/google/cloud/compute/v1/projects/rest/client.rb +101 -2
  59. data/lib/google/cloud/compute/v1/projects/rest/service_stub.rb +60 -0
  60. data/lib/google/cloud/compute/v1/public_advertised_prefixes/rest/client.rb +1 -1
  61. data/lib/google/cloud/compute/v1/public_delegated_prefixes/rest/client.rb +3 -3
  62. data/lib/google/cloud/compute/v1/region_autoscalers/rest/client.rb +1 -1
  63. data/lib/google/cloud/compute/v1/region_backend_services/rest/client.rb +2 -2
  64. data/lib/google/cloud/compute/v1/region_commitments/rest/client.rb +3 -3
  65. data/lib/google/cloud/compute/v1/region_disk_types/rest/client.rb +1 -1
  66. data/lib/google/cloud/compute/v1/region_disks/rest/client.rb +1 -1
  67. data/lib/google/cloud/compute/v1/region_health_check_services/rest/client.rb +1 -1
  68. data/lib/google/cloud/compute/v1/region_health_checks/rest/client.rb +1 -1
  69. data/lib/google/cloud/compute/v1/region_instance_group_managers/rest/client.rb +4 -4
  70. data/lib/google/cloud/compute/v1/region_instance_groups/rest/client.rb +2 -2
  71. data/lib/google/cloud/compute/v1/region_instance_templates/rest/client.rb +1 -1
  72. data/lib/google/cloud/compute/v1/region_instant_snapshots/credentials.rb +52 -0
  73. data/lib/google/cloud/compute/v1/region_instant_snapshots/rest/client.rb +1103 -0
  74. data/lib/google/cloud/compute/v1/region_instant_snapshots/rest/service_stub.rb +559 -0
  75. data/lib/google/cloud/compute/v1/region_instant_snapshots/rest.rb +51 -0
  76. data/lib/google/cloud/compute/v1/region_instant_snapshots.rb +47 -0
  77. data/lib/google/cloud/compute/v1/region_network_endpoint_groups/rest/client.rb +2 -2
  78. data/lib/google/cloud/compute/v1/region_network_firewall_policies/rest/client.rb +1 -1
  79. data/lib/google/cloud/compute/v1/region_notification_endpoints/rest/client.rb +1 -1
  80. data/lib/google/cloud/compute/v1/region_operations/rest/client.rb +1 -1
  81. data/lib/google/cloud/compute/v1/region_security_policies/rest/client.rb +1 -1
  82. data/lib/google/cloud/compute/v1/region_ssl_certificates/rest/client.rb +1 -1
  83. data/lib/google/cloud/compute/v1/region_ssl_policies/rest/client.rb +2 -2
  84. data/lib/google/cloud/compute/v1/region_target_http_proxies/rest/client.rb +1 -1
  85. data/lib/google/cloud/compute/v1/region_target_https_proxies/rest/client.rb +1 -1
  86. data/lib/google/cloud/compute/v1/region_target_tcp_proxies/rest/client.rb +1 -1
  87. data/lib/google/cloud/compute/v1/region_url_maps/rest/client.rb +1 -1
  88. data/lib/google/cloud/compute/v1/region_zones/rest/client.rb +1 -1
  89. data/lib/google/cloud/compute/v1/regions/rest/client.rb +1 -1
  90. data/lib/google/cloud/compute/v1/reservations/rest/client.rb +3 -3
  91. data/lib/google/cloud/compute/v1/resource_policies/rest/client.rb +3 -3
  92. data/lib/google/cloud/compute/v1/rest.rb +6 -0
  93. data/lib/google/cloud/compute/v1/routers/rest/client.rb +4 -4
  94. data/lib/google/cloud/compute/v1/routes/rest/client.rb +1 -1
  95. data/lib/google/cloud/compute/v1/security_policies/rest/client.rb +4 -4
  96. data/lib/google/cloud/compute/v1/service_attachments/rest/client.rb +3 -3
  97. data/lib/google/cloud/compute/v1/snapshots/rest/client.rb +1 -1
  98. data/lib/google/cloud/compute/v1/ssl_certificates/rest/client.rb +3 -3
  99. data/lib/google/cloud/compute/v1/ssl_policies/rest/client.rb +4 -4
  100. data/lib/google/cloud/compute/v1/storage_pool_types/credentials.rb +53 -0
  101. data/lib/google/cloud/compute/v1/storage_pool_types/rest/client.rb +603 -0
  102. data/lib/google/cloud/compute/v1/storage_pool_types/rest/service_stub.rb +249 -0
  103. data/lib/google/cloud/compute/v1/storage_pool_types/rest.rb +51 -0
  104. data/lib/google/cloud/compute/v1/storage_pool_types.rb +47 -0
  105. data/lib/google/cloud/compute/v1/storage_pools/credentials.rb +52 -0
  106. data/lib/google/cloud/compute/v1/storage_pools/rest/client.rb +1313 -0
  107. data/lib/google/cloud/compute/v1/storage_pools/rest/service_stub.rb +679 -0
  108. data/lib/google/cloud/compute/v1/storage_pools/rest.rb +51 -0
  109. data/lib/google/cloud/compute/v1/storage_pools.rb +47 -0
  110. data/lib/google/cloud/compute/v1/subnetworks/rest/client.rb +4 -4
  111. data/lib/google/cloud/compute/v1/target_grpc_proxies/rest/client.rb +1 -1
  112. data/lib/google/cloud/compute/v1/target_http_proxies/rest/client.rb +3 -3
  113. data/lib/google/cloud/compute/v1/target_https_proxies/rest/client.rb +3 -3
  114. data/lib/google/cloud/compute/v1/target_instances/rest/client.rb +3 -3
  115. data/lib/google/cloud/compute/v1/target_pools/rest/client.rb +3 -3
  116. data/lib/google/cloud/compute/v1/target_ssl_proxies/rest/client.rb +1 -1
  117. data/lib/google/cloud/compute/v1/target_tcp_proxies/rest/client.rb +3 -3
  118. data/lib/google/cloud/compute/v1/target_vpn_gateways/rest/client.rb +3 -3
  119. data/lib/google/cloud/compute/v1/url_maps/rest/client.rb +3 -3
  120. data/lib/google/cloud/compute/v1/version.rb +1 -1
  121. data/lib/google/cloud/compute/v1/vpn_gateways/rest/client.rb +3 -3
  122. data/lib/google/cloud/compute/v1/vpn_tunnels/rest/client.rb +3 -3
  123. data/lib/google/cloud/compute/v1/zone_operations/rest/client.rb +1 -1
  124. data/lib/google/cloud/compute/v1/zones/rest/client.rb +1 -1
  125. data/lib/google/cloud/compute/v1.rb +6 -0
  126. data/proto_docs/google/api/client.rb +4 -0
  127. data/proto_docs/google/cloud/compute/v1/compute.rb +2128 -182
  128. metadata +32 -2
@@ -0,0 +1,1103 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2024 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_instant_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 RegionInstantSnapshots
29
+ module Rest
30
+ ##
31
+ # REST client for the RegionInstantSnapshots service.
32
+ #
33
+ # The RegionInstantSnapshots API.
34
+ #
35
+ class Client
36
+ # @private
37
+ DEFAULT_ENDPOINT_TEMPLATE = "compute.$UNIVERSE_DOMAIN$"
38
+
39
+ # @private
40
+ attr_reader :region_instant_snapshots_stub
41
+
42
+ ##
43
+ # Configure the RegionInstantSnapshots Client class.
44
+ #
45
+ # See {::Google::Cloud::Compute::V1::RegionInstantSnapshots::Rest::Client::Configuration}
46
+ # for a description of the configuration fields.
47
+ #
48
+ # @example
49
+ #
50
+ # # Modify the configuration for all RegionInstantSnapshots clients
51
+ # ::Google::Cloud::Compute::V1::RegionInstantSnapshots::Rest::Client.configure do |config|
52
+ # config.timeout = 10.0
53
+ # end
54
+ #
55
+ # @yield [config] Configure the Client client.
56
+ # @yieldparam config [Client::Configuration]
57
+ #
58
+ # @return [Client::Configuration]
59
+ #
60
+ def self.configure
61
+ @configure ||= begin
62
+ namespace = ["Google", "Cloud", "Compute", "V1"]
63
+ parent_config = while namespace.any?
64
+ parent_name = namespace.join "::"
65
+ parent_const = const_get parent_name
66
+ break parent_const.configure if parent_const.respond_to? :configure
67
+ namespace.pop
68
+ end
69
+ default_config = Client::Configuration.new parent_config
70
+
71
+ default_config.rpcs.delete.timeout = 600.0
72
+
73
+ default_config.rpcs.get.timeout = 600.0
74
+ default_config.rpcs.get.retry_policy = {
75
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14]
76
+ }
77
+
78
+ default_config.rpcs.get_iam_policy.timeout = 600.0
79
+ default_config.rpcs.get_iam_policy.retry_policy = {
80
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14]
81
+ }
82
+
83
+ default_config.rpcs.insert.timeout = 600.0
84
+
85
+ default_config.rpcs.list.timeout = 600.0
86
+ default_config.rpcs.list.retry_policy = {
87
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14]
88
+ }
89
+
90
+ default_config.rpcs.set_iam_policy.timeout = 600.0
91
+
92
+ default_config.rpcs.set_labels.timeout = 600.0
93
+
94
+ default_config.rpcs.test_iam_permissions.timeout = 600.0
95
+
96
+ default_config
97
+ end
98
+ yield @configure if block_given?
99
+ @configure
100
+ end
101
+
102
+ ##
103
+ # Configure the RegionInstantSnapshots Client instance.
104
+ #
105
+ # The configuration is set to the derived mode, meaning that values can be changed,
106
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
107
+ # should be made on {Client.configure}.
108
+ #
109
+ # See {::Google::Cloud::Compute::V1::RegionInstantSnapshots::Rest::Client::Configuration}
110
+ # for a description of the configuration fields.
111
+ #
112
+ # @yield [config] Configure the Client client.
113
+ # @yieldparam config [Client::Configuration]
114
+ #
115
+ # @return [Client::Configuration]
116
+ #
117
+ def configure
118
+ yield @config if block_given?
119
+ @config
120
+ end
121
+
122
+ ##
123
+ # The effective universe domain
124
+ #
125
+ # @return [String]
126
+ #
127
+ def universe_domain
128
+ @region_instant_snapshots_stub.universe_domain
129
+ end
130
+
131
+ ##
132
+ # Create a new RegionInstantSnapshots REST client object.
133
+ #
134
+ # @example
135
+ #
136
+ # # Create a client using the default configuration
137
+ # client = ::Google::Cloud::Compute::V1::RegionInstantSnapshots::Rest::Client.new
138
+ #
139
+ # # Create a client using a custom configuration
140
+ # client = ::Google::Cloud::Compute::V1::RegionInstantSnapshots::Rest::Client.new do |config|
141
+ # config.timeout = 10.0
142
+ # end
143
+ #
144
+ # @yield [config] Configure the RegionInstantSnapshots client.
145
+ # @yieldparam config [Client::Configuration]
146
+ #
147
+ def initialize
148
+ # Create the configuration object
149
+ @config = Configuration.new Client.configure
150
+
151
+ # Yield the configuration if needed
152
+ yield @config if block_given?
153
+
154
+ # Create credentials
155
+ credentials = @config.credentials
156
+ # Use self-signed JWT if the endpoint is unchanged from default,
157
+ # but only if the default endpoint does not have a region prefix.
158
+ enable_self_signed_jwt = @config.endpoint.nil? ||
159
+ (@config.endpoint == Configuration::DEFAULT_ENDPOINT &&
160
+ !@config.endpoint.split(".").first.include?("-"))
161
+ credentials ||= Credentials.default scope: @config.scope,
162
+ enable_self_signed_jwt: enable_self_signed_jwt
163
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
164
+ credentials = Credentials.new credentials, scope: @config.scope
165
+ end
166
+
167
+ @quota_project_id = @config.quota_project
168
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
169
+
170
+ @region_operations = ::Google::Cloud::Compute::V1::RegionOperations::Rest::Client.new do |config|
171
+ config.credentials = credentials
172
+ config.quota_project = @quota_project_id
173
+ config.endpoint = @config.endpoint
174
+ config.universe_domain = @config.universe_domain
175
+ end
176
+
177
+ @region_instant_snapshots_stub = ::Google::Cloud::Compute::V1::RegionInstantSnapshots::Rest::ServiceStub.new(
178
+ endpoint: @config.endpoint,
179
+ endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
180
+ universe_domain: @config.universe_domain,
181
+ credentials: credentials
182
+ )
183
+ end
184
+
185
+ ##
186
+ # Get the associated client for long-running operations via RegionOperations.
187
+ #
188
+ # @return [::Google::Cloud::Compute::V1::RegionOperations::Rest::Client]
189
+ #
190
+ attr_reader :region_operations
191
+
192
+ # Service calls
193
+
194
+ ##
195
+ # Deletes the specified InstantSnapshot resource. Keep in mind that deleting a single instantSnapshot might not necessarily delete all the data on that instantSnapshot. If any data on the instantSnapshot that is marked for deletion is needed for subsequent instantSnapshots, the data will be moved to the next corresponding instantSnapshot. For more information, see Deleting instantSnapshots.
196
+ #
197
+ # @overload delete(request, options = nil)
198
+ # Pass arguments to `delete` via a request object, either of type
199
+ # {::Google::Cloud::Compute::V1::DeleteRegionInstantSnapshotRequest} or an equivalent Hash.
200
+ #
201
+ # @param request [::Google::Cloud::Compute::V1::DeleteRegionInstantSnapshotRequest, ::Hash]
202
+ # A request object representing the call parameters. Required. To specify no
203
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
204
+ # @param options [::Gapic::CallOptions, ::Hash]
205
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
206
+ #
207
+ # @overload delete(instant_snapshot: nil, project: nil, region: nil, request_id: nil)
208
+ # Pass arguments to `delete` via keyword arguments. Note that at
209
+ # least one keyword argument is required. To specify no parameters, or to keep all
210
+ # the default parameter values, pass an empty Hash as a request object (see above).
211
+ #
212
+ # @param instant_snapshot [::String]
213
+ # Name of the InstantSnapshot resource to delete.
214
+ # @param project [::String]
215
+ # Project ID for this request.
216
+ # @param region [::String]
217
+ # The name of the region for this request.
218
+ # @param request_id [::String]
219
+ # 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).
220
+ # @yield [result, operation] Access the result along with the TransportOperation object
221
+ # @yieldparam result [::Gapic::GenericLRO::Operation]
222
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
223
+ #
224
+ # @return [::Gapic::GenericLRO::Operation]
225
+ #
226
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
227
+ #
228
+ # @example Basic example
229
+ # require "google/cloud/compute/v1"
230
+ #
231
+ # # Create a client object. The client can be reused for multiple calls.
232
+ # client = Google::Cloud::Compute::V1::RegionInstantSnapshots::Rest::Client.new
233
+ #
234
+ # # Create a request. To set request fields, pass in keyword arguments.
235
+ # request = Google::Cloud::Compute::V1::DeleteRegionInstantSnapshotRequest.new
236
+ #
237
+ # # Call the delete method.
238
+ # result = client.delete request
239
+ #
240
+ # # The returned object is of type Google::Cloud::Compute::V1::Operation.
241
+ # p result
242
+ #
243
+ def delete request, options = nil
244
+ raise ::ArgumentError, "request must be provided" if request.nil?
245
+
246
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Compute::V1::DeleteRegionInstantSnapshotRequest
247
+
248
+ # Converts hash and nil to an options object
249
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
250
+
251
+ # Customize the options with defaults
252
+ call_metadata = @config.rpcs.delete.metadata.to_h
253
+
254
+ # Set x-goog-api-client and x-goog-user-project headers
255
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
256
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
257
+ gapic_version: ::Google::Cloud::Compute::V1::VERSION,
258
+ transports_version_send: [:rest]
259
+
260
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
261
+
262
+ options.apply_defaults timeout: @config.rpcs.delete.timeout,
263
+ metadata: call_metadata,
264
+ retry_policy: @config.rpcs.delete.retry_policy
265
+
266
+ options.apply_defaults timeout: @config.timeout,
267
+ metadata: @config.metadata,
268
+ retry_policy: @config.retry_policy
269
+
270
+ @region_instant_snapshots_stub.delete request, options do |result, response|
271
+ result = ::Google::Cloud::Compute::V1::RegionOperations::Rest::NonstandardLro.create_operation(
272
+ operation: result,
273
+ client: region_operations,
274
+ request_values: {
275
+ "project" => request.project,
276
+ "region" => request.region
277
+ },
278
+ options: options
279
+ )
280
+ yield result, response if block_given?
281
+ return result
282
+ end
283
+ rescue ::Gapic::Rest::Error => e
284
+ raise ::Google::Cloud::Error.from_error(e)
285
+ end
286
+
287
+ ##
288
+ # Returns the specified InstantSnapshot resource in the specified region.
289
+ #
290
+ # @overload get(request, options = nil)
291
+ # Pass arguments to `get` via a request object, either of type
292
+ # {::Google::Cloud::Compute::V1::GetRegionInstantSnapshotRequest} or an equivalent Hash.
293
+ #
294
+ # @param request [::Google::Cloud::Compute::V1::GetRegionInstantSnapshotRequest, ::Hash]
295
+ # A request object representing the call parameters. Required. To specify no
296
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
297
+ # @param options [::Gapic::CallOptions, ::Hash]
298
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
299
+ #
300
+ # @overload get(instant_snapshot: nil, project: nil, region: nil)
301
+ # Pass arguments to `get` via keyword arguments. Note that at
302
+ # least one keyword argument is required. To specify no parameters, or to keep all
303
+ # the default parameter values, pass an empty Hash as a request object (see above).
304
+ #
305
+ # @param instant_snapshot [::String]
306
+ # Name of the InstantSnapshot resource to return.
307
+ # @param project [::String]
308
+ # Project ID for this request.
309
+ # @param region [::String]
310
+ # The name of the region for this request.
311
+ # @yield [result, operation] Access the result along with the TransportOperation object
312
+ # @yieldparam result [::Google::Cloud::Compute::V1::InstantSnapshot]
313
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
314
+ #
315
+ # @return [::Google::Cloud::Compute::V1::InstantSnapshot]
316
+ #
317
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
318
+ #
319
+ # @example Basic example
320
+ # require "google/cloud/compute/v1"
321
+ #
322
+ # # Create a client object. The client can be reused for multiple calls.
323
+ # client = Google::Cloud::Compute::V1::RegionInstantSnapshots::Rest::Client.new
324
+ #
325
+ # # Create a request. To set request fields, pass in keyword arguments.
326
+ # request = Google::Cloud::Compute::V1::GetRegionInstantSnapshotRequest.new
327
+ #
328
+ # # Call the get method.
329
+ # result = client.get request
330
+ #
331
+ # # The returned object is of type Google::Cloud::Compute::V1::InstantSnapshot.
332
+ # p result
333
+ #
334
+ def get request, options = nil
335
+ raise ::ArgumentError, "request must be provided" if request.nil?
336
+
337
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Compute::V1::GetRegionInstantSnapshotRequest
338
+
339
+ # Converts hash and nil to an options object
340
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
341
+
342
+ # Customize the options with defaults
343
+ call_metadata = @config.rpcs.get.metadata.to_h
344
+
345
+ # Set x-goog-api-client and x-goog-user-project headers
346
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
347
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
348
+ gapic_version: ::Google::Cloud::Compute::V1::VERSION,
349
+ transports_version_send: [:rest]
350
+
351
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
352
+
353
+ options.apply_defaults timeout: @config.rpcs.get.timeout,
354
+ metadata: call_metadata,
355
+ retry_policy: @config.rpcs.get.retry_policy
356
+
357
+ options.apply_defaults timeout: @config.timeout,
358
+ metadata: @config.metadata,
359
+ retry_policy: @config.retry_policy
360
+
361
+ @region_instant_snapshots_stub.get request, options do |result, operation|
362
+ yield result, operation if block_given?
363
+ return result
364
+ end
365
+ rescue ::Gapic::Rest::Error => e
366
+ raise ::Google::Cloud::Error.from_error(e)
367
+ end
368
+
369
+ ##
370
+ # Gets the access control policy for a resource. May be empty if no such policy or resource exists.
371
+ #
372
+ # @overload get_iam_policy(request, options = nil)
373
+ # Pass arguments to `get_iam_policy` via a request object, either of type
374
+ # {::Google::Cloud::Compute::V1::GetIamPolicyRegionInstantSnapshotRequest} or an equivalent Hash.
375
+ #
376
+ # @param request [::Google::Cloud::Compute::V1::GetIamPolicyRegionInstantSnapshotRequest, ::Hash]
377
+ # A request object representing the call parameters. Required. To specify no
378
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
379
+ # @param options [::Gapic::CallOptions, ::Hash]
380
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
381
+ #
382
+ # @overload get_iam_policy(options_requested_policy_version: nil, project: nil, region: nil, resource: nil)
383
+ # Pass arguments to `get_iam_policy` via keyword arguments. Note that at
384
+ # least one keyword argument is required. To specify no parameters, or to keep all
385
+ # the default parameter values, pass an empty Hash as a request object (see above).
386
+ #
387
+ # @param options_requested_policy_version [::Integer]
388
+ # Requested IAM Policy version.
389
+ # @param project [::String]
390
+ # Project ID for this request.
391
+ # @param region [::String]
392
+ # The name of the region for this request.
393
+ # @param resource [::String]
394
+ # Name or id of the resource for this request.
395
+ # @yield [result, operation] Access the result along with the TransportOperation object
396
+ # @yieldparam result [::Google::Cloud::Compute::V1::Policy]
397
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
398
+ #
399
+ # @return [::Google::Cloud::Compute::V1::Policy]
400
+ #
401
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
402
+ #
403
+ # @example Basic example
404
+ # require "google/cloud/compute/v1"
405
+ #
406
+ # # Create a client object. The client can be reused for multiple calls.
407
+ # client = Google::Cloud::Compute::V1::RegionInstantSnapshots::Rest::Client.new
408
+ #
409
+ # # Create a request. To set request fields, pass in keyword arguments.
410
+ # request = Google::Cloud::Compute::V1::GetIamPolicyRegionInstantSnapshotRequest.new
411
+ #
412
+ # # Call the get_iam_policy method.
413
+ # result = client.get_iam_policy request
414
+ #
415
+ # # The returned object is of type Google::Cloud::Compute::V1::Policy.
416
+ # p result
417
+ #
418
+ def get_iam_policy request, options = nil
419
+ raise ::ArgumentError, "request must be provided" if request.nil?
420
+
421
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Compute::V1::GetIamPolicyRegionInstantSnapshotRequest
422
+
423
+ # Converts hash and nil to an options object
424
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
425
+
426
+ # Customize the options with defaults
427
+ call_metadata = @config.rpcs.get_iam_policy.metadata.to_h
428
+
429
+ # Set x-goog-api-client and x-goog-user-project headers
430
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
431
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
432
+ gapic_version: ::Google::Cloud::Compute::V1::VERSION,
433
+ transports_version_send: [:rest]
434
+
435
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
436
+
437
+ options.apply_defaults timeout: @config.rpcs.get_iam_policy.timeout,
438
+ metadata: call_metadata,
439
+ retry_policy: @config.rpcs.get_iam_policy.retry_policy
440
+
441
+ options.apply_defaults timeout: @config.timeout,
442
+ metadata: @config.metadata,
443
+ retry_policy: @config.retry_policy
444
+
445
+ @region_instant_snapshots_stub.get_iam_policy request, options do |result, operation|
446
+ yield result, operation if block_given?
447
+ return result
448
+ end
449
+ rescue ::Gapic::Rest::Error => e
450
+ raise ::Google::Cloud::Error.from_error(e)
451
+ end
452
+
453
+ ##
454
+ # Creates an instant snapshot in the specified region.
455
+ #
456
+ # @overload insert(request, options = nil)
457
+ # Pass arguments to `insert` via a request object, either of type
458
+ # {::Google::Cloud::Compute::V1::InsertRegionInstantSnapshotRequest} or an equivalent Hash.
459
+ #
460
+ # @param request [::Google::Cloud::Compute::V1::InsertRegionInstantSnapshotRequest, ::Hash]
461
+ # A request object representing the call parameters. Required. To specify no
462
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
463
+ # @param options [::Gapic::CallOptions, ::Hash]
464
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
465
+ #
466
+ # @overload insert(instant_snapshot_resource: nil, project: nil, region: nil, request_id: nil)
467
+ # Pass arguments to `insert` via keyword arguments. Note that at
468
+ # least one keyword argument is required. To specify no parameters, or to keep all
469
+ # the default parameter values, pass an empty Hash as a request object (see above).
470
+ #
471
+ # @param instant_snapshot_resource [::Google::Cloud::Compute::V1::InstantSnapshot, ::Hash]
472
+ # The body resource for this request
473
+ # @param project [::String]
474
+ # Project ID for this request.
475
+ # @param region [::String]
476
+ # Name of the region for this request.
477
+ # @param request_id [::String]
478
+ # 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).
479
+ # @yield [result, operation] Access the result along with the TransportOperation object
480
+ # @yieldparam result [::Gapic::GenericLRO::Operation]
481
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
482
+ #
483
+ # @return [::Gapic::GenericLRO::Operation]
484
+ #
485
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
486
+ #
487
+ # @example Basic example
488
+ # require "google/cloud/compute/v1"
489
+ #
490
+ # # Create a client object. The client can be reused for multiple calls.
491
+ # client = Google::Cloud::Compute::V1::RegionInstantSnapshots::Rest::Client.new
492
+ #
493
+ # # Create a request. To set request fields, pass in keyword arguments.
494
+ # request = Google::Cloud::Compute::V1::InsertRegionInstantSnapshotRequest.new
495
+ #
496
+ # # Call the insert method.
497
+ # result = client.insert request
498
+ #
499
+ # # The returned object is of type Google::Cloud::Compute::V1::Operation.
500
+ # p result
501
+ #
502
+ def insert request, options = nil
503
+ raise ::ArgumentError, "request must be provided" if request.nil?
504
+
505
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Compute::V1::InsertRegionInstantSnapshotRequest
506
+
507
+ # Converts hash and nil to an options object
508
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
509
+
510
+ # Customize the options with defaults
511
+ call_metadata = @config.rpcs.insert.metadata.to_h
512
+
513
+ # Set x-goog-api-client and x-goog-user-project headers
514
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
515
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
516
+ gapic_version: ::Google::Cloud::Compute::V1::VERSION,
517
+ transports_version_send: [:rest]
518
+
519
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
520
+
521
+ options.apply_defaults timeout: @config.rpcs.insert.timeout,
522
+ metadata: call_metadata,
523
+ retry_policy: @config.rpcs.insert.retry_policy
524
+
525
+ options.apply_defaults timeout: @config.timeout,
526
+ metadata: @config.metadata,
527
+ retry_policy: @config.retry_policy
528
+
529
+ @region_instant_snapshots_stub.insert request, options do |result, response|
530
+ result = ::Google::Cloud::Compute::V1::RegionOperations::Rest::NonstandardLro.create_operation(
531
+ operation: result,
532
+ client: region_operations,
533
+ request_values: {
534
+ "project" => request.project,
535
+ "region" => request.region
536
+ },
537
+ options: options
538
+ )
539
+ yield result, response if block_given?
540
+ return result
541
+ end
542
+ rescue ::Gapic::Rest::Error => e
543
+ raise ::Google::Cloud::Error.from_error(e)
544
+ end
545
+
546
+ ##
547
+ # Retrieves the list of InstantSnapshot resources contained within the specified region.
548
+ #
549
+ # @overload list(request, options = nil)
550
+ # Pass arguments to `list` via a request object, either of type
551
+ # {::Google::Cloud::Compute::V1::ListRegionInstantSnapshotsRequest} or an equivalent Hash.
552
+ #
553
+ # @param request [::Google::Cloud::Compute::V1::ListRegionInstantSnapshotsRequest, ::Hash]
554
+ # A request object representing the call parameters. Required. To specify no
555
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
556
+ # @param options [::Gapic::CallOptions, ::Hash]
557
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
558
+ #
559
+ # @overload list(filter: nil, max_results: nil, order_by: nil, page_token: nil, project: nil, region: nil, return_partial_success: nil)
560
+ # Pass arguments to `list` via keyword arguments. Note that at
561
+ # least one keyword argument is required. To specify no parameters, or to keep all
562
+ # the default parameter values, pass an empty Hash as a request object (see above).
563
+ #
564
+ # @param filter [::String]
565
+ # 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.
566
+ # @param max_results [::Integer]
567
+ # 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`)
568
+ # @param order_by [::String]
569
+ # 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.
570
+ # @param page_token [::String]
571
+ # Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results.
572
+ # @param project [::String]
573
+ # Project ID for this request.
574
+ # @param region [::String]
575
+ # The name of the region for this request.
576
+ # @param return_partial_success [::Boolean]
577
+ # 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.
578
+ # @yield [result, operation] Access the result along with the TransportOperation object
579
+ # @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Compute::V1::InstantSnapshot>]
580
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
581
+ #
582
+ # @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Compute::V1::InstantSnapshot>]
583
+ #
584
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
585
+ #
586
+ # @example Basic example
587
+ # require "google/cloud/compute/v1"
588
+ #
589
+ # # Create a client object. The client can be reused for multiple calls.
590
+ # client = Google::Cloud::Compute::V1::RegionInstantSnapshots::Rest::Client.new
591
+ #
592
+ # # Create a request. To set request fields, pass in keyword arguments.
593
+ # request = Google::Cloud::Compute::V1::ListRegionInstantSnapshotsRequest.new
594
+ #
595
+ # # Call the list method.
596
+ # result = client.list request
597
+ #
598
+ # # The returned object is of type Google::Cloud::Compute::V1::InstantSnapshotList.
599
+ # p result
600
+ #
601
+ def list request, options = nil
602
+ raise ::ArgumentError, "request must be provided" if request.nil?
603
+
604
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Compute::V1::ListRegionInstantSnapshotsRequest
605
+
606
+ # Converts hash and nil to an options object
607
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
608
+
609
+ # Customize the options with defaults
610
+ call_metadata = @config.rpcs.list.metadata.to_h
611
+
612
+ # Set x-goog-api-client and x-goog-user-project headers
613
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
614
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
615
+ gapic_version: ::Google::Cloud::Compute::V1::VERSION,
616
+ transports_version_send: [:rest]
617
+
618
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
619
+
620
+ options.apply_defaults timeout: @config.rpcs.list.timeout,
621
+ metadata: call_metadata,
622
+ retry_policy: @config.rpcs.list.retry_policy
623
+
624
+ options.apply_defaults timeout: @config.timeout,
625
+ metadata: @config.metadata,
626
+ retry_policy: @config.retry_policy
627
+
628
+ @region_instant_snapshots_stub.list request, options do |result, operation|
629
+ result = ::Gapic::Rest::PagedEnumerable.new @region_instant_snapshots_stub, :list, "items", request, result, options
630
+ yield result, operation if block_given?
631
+ return result
632
+ end
633
+ rescue ::Gapic::Rest::Error => e
634
+ raise ::Google::Cloud::Error.from_error(e)
635
+ end
636
+
637
+ ##
638
+ # Sets the access control policy on the specified resource. Replaces any existing policy.
639
+ #
640
+ # @overload set_iam_policy(request, options = nil)
641
+ # Pass arguments to `set_iam_policy` via a request object, either of type
642
+ # {::Google::Cloud::Compute::V1::SetIamPolicyRegionInstantSnapshotRequest} or an equivalent Hash.
643
+ #
644
+ # @param request [::Google::Cloud::Compute::V1::SetIamPolicyRegionInstantSnapshotRequest, ::Hash]
645
+ # A request object representing the call parameters. Required. To specify no
646
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
647
+ # @param options [::Gapic::CallOptions, ::Hash]
648
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
649
+ #
650
+ # @overload set_iam_policy(project: nil, region: nil, region_set_policy_request_resource: nil, resource: nil)
651
+ # Pass arguments to `set_iam_policy` via keyword arguments. Note that at
652
+ # least one keyword argument is required. To specify no parameters, or to keep all
653
+ # the default parameter values, pass an empty Hash as a request object (see above).
654
+ #
655
+ # @param project [::String]
656
+ # Project ID for this request.
657
+ # @param region [::String]
658
+ # The name of the region for this request.
659
+ # @param region_set_policy_request_resource [::Google::Cloud::Compute::V1::RegionSetPolicyRequest, ::Hash]
660
+ # The body resource for this request
661
+ # @param resource [::String]
662
+ # Name or id of the resource for this request.
663
+ # @yield [result, operation] Access the result along with the TransportOperation object
664
+ # @yieldparam result [::Google::Cloud::Compute::V1::Policy]
665
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
666
+ #
667
+ # @return [::Google::Cloud::Compute::V1::Policy]
668
+ #
669
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
670
+ #
671
+ # @example Basic example
672
+ # require "google/cloud/compute/v1"
673
+ #
674
+ # # Create a client object. The client can be reused for multiple calls.
675
+ # client = Google::Cloud::Compute::V1::RegionInstantSnapshots::Rest::Client.new
676
+ #
677
+ # # Create a request. To set request fields, pass in keyword arguments.
678
+ # request = Google::Cloud::Compute::V1::SetIamPolicyRegionInstantSnapshotRequest.new
679
+ #
680
+ # # Call the set_iam_policy method.
681
+ # result = client.set_iam_policy request
682
+ #
683
+ # # The returned object is of type Google::Cloud::Compute::V1::Policy.
684
+ # p result
685
+ #
686
+ def set_iam_policy request, options = nil
687
+ raise ::ArgumentError, "request must be provided" if request.nil?
688
+
689
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Compute::V1::SetIamPolicyRegionInstantSnapshotRequest
690
+
691
+ # Converts hash and nil to an options object
692
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
693
+
694
+ # Customize the options with defaults
695
+ call_metadata = @config.rpcs.set_iam_policy.metadata.to_h
696
+
697
+ # Set x-goog-api-client and x-goog-user-project headers
698
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
699
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
700
+ gapic_version: ::Google::Cloud::Compute::V1::VERSION,
701
+ transports_version_send: [:rest]
702
+
703
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
704
+
705
+ options.apply_defaults timeout: @config.rpcs.set_iam_policy.timeout,
706
+ metadata: call_metadata,
707
+ retry_policy: @config.rpcs.set_iam_policy.retry_policy
708
+
709
+ options.apply_defaults timeout: @config.timeout,
710
+ metadata: @config.metadata,
711
+ retry_policy: @config.retry_policy
712
+
713
+ @region_instant_snapshots_stub.set_iam_policy request, options do |result, operation|
714
+ yield result, operation if block_given?
715
+ return result
716
+ end
717
+ rescue ::Gapic::Rest::Error => e
718
+ raise ::Google::Cloud::Error.from_error(e)
719
+ end
720
+
721
+ ##
722
+ # Sets the labels on a instantSnapshot in the given region. To learn more about labels, read the Labeling Resources documentation.
723
+ #
724
+ # @overload set_labels(request, options = nil)
725
+ # Pass arguments to `set_labels` via a request object, either of type
726
+ # {::Google::Cloud::Compute::V1::SetLabelsRegionInstantSnapshotRequest} or an equivalent Hash.
727
+ #
728
+ # @param request [::Google::Cloud::Compute::V1::SetLabelsRegionInstantSnapshotRequest, ::Hash]
729
+ # A request object representing the call parameters. Required. To specify no
730
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
731
+ # @param options [::Gapic::CallOptions, ::Hash]
732
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
733
+ #
734
+ # @overload set_labels(project: nil, region: nil, region_set_labels_request_resource: nil, request_id: nil, resource: nil)
735
+ # Pass arguments to `set_labels` via keyword arguments. Note that at
736
+ # least one keyword argument is required. To specify no parameters, or to keep all
737
+ # the default parameter values, pass an empty Hash as a request object (see above).
738
+ #
739
+ # @param project [::String]
740
+ # Project ID for this request.
741
+ # @param region [::String]
742
+ # The region for this request.
743
+ # @param region_set_labels_request_resource [::Google::Cloud::Compute::V1::RegionSetLabelsRequest, ::Hash]
744
+ # The body resource for this request
745
+ # @param request_id [::String]
746
+ # 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).
747
+ # @param resource [::String]
748
+ # Name or id of the resource for this request.
749
+ # @yield [result, operation] Access the result along with the TransportOperation object
750
+ # @yieldparam result [::Gapic::GenericLRO::Operation]
751
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
752
+ #
753
+ # @return [::Gapic::GenericLRO::Operation]
754
+ #
755
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
756
+ #
757
+ # @example Basic example
758
+ # require "google/cloud/compute/v1"
759
+ #
760
+ # # Create a client object. The client can be reused for multiple calls.
761
+ # client = Google::Cloud::Compute::V1::RegionInstantSnapshots::Rest::Client.new
762
+ #
763
+ # # Create a request. To set request fields, pass in keyword arguments.
764
+ # request = Google::Cloud::Compute::V1::SetLabelsRegionInstantSnapshotRequest.new
765
+ #
766
+ # # Call the set_labels method.
767
+ # result = client.set_labels request
768
+ #
769
+ # # The returned object is of type Google::Cloud::Compute::V1::Operation.
770
+ # p result
771
+ #
772
+ def set_labels request, options = nil
773
+ raise ::ArgumentError, "request must be provided" if request.nil?
774
+
775
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Compute::V1::SetLabelsRegionInstantSnapshotRequest
776
+
777
+ # Converts hash and nil to an options object
778
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
779
+
780
+ # Customize the options with defaults
781
+ call_metadata = @config.rpcs.set_labels.metadata.to_h
782
+
783
+ # Set x-goog-api-client and x-goog-user-project headers
784
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
785
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
786
+ gapic_version: ::Google::Cloud::Compute::V1::VERSION,
787
+ transports_version_send: [:rest]
788
+
789
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
790
+
791
+ options.apply_defaults timeout: @config.rpcs.set_labels.timeout,
792
+ metadata: call_metadata,
793
+ retry_policy: @config.rpcs.set_labels.retry_policy
794
+
795
+ options.apply_defaults timeout: @config.timeout,
796
+ metadata: @config.metadata,
797
+ retry_policy: @config.retry_policy
798
+
799
+ @region_instant_snapshots_stub.set_labels request, options do |result, response|
800
+ result = ::Google::Cloud::Compute::V1::RegionOperations::Rest::NonstandardLro.create_operation(
801
+ operation: result,
802
+ client: region_operations,
803
+ request_values: {
804
+ "project" => request.project,
805
+ "region" => request.region
806
+ },
807
+ options: options
808
+ )
809
+ yield result, response if block_given?
810
+ return result
811
+ end
812
+ rescue ::Gapic::Rest::Error => e
813
+ raise ::Google::Cloud::Error.from_error(e)
814
+ end
815
+
816
+ ##
817
+ # Returns permissions that a caller has on the specified resource.
818
+ #
819
+ # @overload test_iam_permissions(request, options = nil)
820
+ # Pass arguments to `test_iam_permissions` via a request object, either of type
821
+ # {::Google::Cloud::Compute::V1::TestIamPermissionsRegionInstantSnapshotRequest} or an equivalent Hash.
822
+ #
823
+ # @param request [::Google::Cloud::Compute::V1::TestIamPermissionsRegionInstantSnapshotRequest, ::Hash]
824
+ # A request object representing the call parameters. Required. To specify no
825
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
826
+ # @param options [::Gapic::CallOptions, ::Hash]
827
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
828
+ #
829
+ # @overload test_iam_permissions(project: nil, region: nil, resource: nil, test_permissions_request_resource: nil)
830
+ # Pass arguments to `test_iam_permissions` via keyword arguments. Note that at
831
+ # least one keyword argument is required. To specify no parameters, or to keep all
832
+ # the default parameter values, pass an empty Hash as a request object (see above).
833
+ #
834
+ # @param project [::String]
835
+ # Project ID for this request.
836
+ # @param region [::String]
837
+ # The name of the region for this request.
838
+ # @param resource [::String]
839
+ # Name or id of the resource for this request.
840
+ # @param test_permissions_request_resource [::Google::Cloud::Compute::V1::TestPermissionsRequest, ::Hash]
841
+ # The body resource for this request
842
+ # @yield [result, operation] Access the result along with the TransportOperation object
843
+ # @yieldparam result [::Google::Cloud::Compute::V1::TestPermissionsResponse]
844
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
845
+ #
846
+ # @return [::Google::Cloud::Compute::V1::TestPermissionsResponse]
847
+ #
848
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
849
+ #
850
+ # @example Basic example
851
+ # require "google/cloud/compute/v1"
852
+ #
853
+ # # Create a client object. The client can be reused for multiple calls.
854
+ # client = Google::Cloud::Compute::V1::RegionInstantSnapshots::Rest::Client.new
855
+ #
856
+ # # Create a request. To set request fields, pass in keyword arguments.
857
+ # request = Google::Cloud::Compute::V1::TestIamPermissionsRegionInstantSnapshotRequest.new
858
+ #
859
+ # # Call the test_iam_permissions method.
860
+ # result = client.test_iam_permissions request
861
+ #
862
+ # # The returned object is of type Google::Cloud::Compute::V1::TestPermissionsResponse.
863
+ # p result
864
+ #
865
+ def test_iam_permissions request, options = nil
866
+ raise ::ArgumentError, "request must be provided" if request.nil?
867
+
868
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Compute::V1::TestIamPermissionsRegionInstantSnapshotRequest
869
+
870
+ # Converts hash and nil to an options object
871
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
872
+
873
+ # Customize the options with defaults
874
+ call_metadata = @config.rpcs.test_iam_permissions.metadata.to_h
875
+
876
+ # Set x-goog-api-client and x-goog-user-project headers
877
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
878
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
879
+ gapic_version: ::Google::Cloud::Compute::V1::VERSION,
880
+ transports_version_send: [:rest]
881
+
882
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
883
+
884
+ options.apply_defaults timeout: @config.rpcs.test_iam_permissions.timeout,
885
+ metadata: call_metadata,
886
+ retry_policy: @config.rpcs.test_iam_permissions.retry_policy
887
+
888
+ options.apply_defaults timeout: @config.timeout,
889
+ metadata: @config.metadata,
890
+ retry_policy: @config.retry_policy
891
+
892
+ @region_instant_snapshots_stub.test_iam_permissions request, options do |result, operation|
893
+ yield result, operation if block_given?
894
+ return result
895
+ end
896
+ rescue ::Gapic::Rest::Error => e
897
+ raise ::Google::Cloud::Error.from_error(e)
898
+ end
899
+
900
+ ##
901
+ # Configuration class for the RegionInstantSnapshots REST API.
902
+ #
903
+ # This class represents the configuration for RegionInstantSnapshots REST,
904
+ # providing control over timeouts, retry behavior, logging, transport
905
+ # parameters, and other low-level controls. Certain parameters can also be
906
+ # applied individually to specific RPCs. See
907
+ # {::Google::Cloud::Compute::V1::RegionInstantSnapshots::Rest::Client::Configuration::Rpcs}
908
+ # for a list of RPCs that can be configured independently.
909
+ #
910
+ # Configuration can be applied globally to all clients, or to a single client
911
+ # on construction.
912
+ #
913
+ # @example
914
+ #
915
+ # # Modify the global config, setting the timeout for
916
+ # # delete to 20 seconds,
917
+ # # and all remaining timeouts to 10 seconds.
918
+ # ::Google::Cloud::Compute::V1::RegionInstantSnapshots::Rest::Client.configure do |config|
919
+ # config.timeout = 10.0
920
+ # config.rpcs.delete.timeout = 20.0
921
+ # end
922
+ #
923
+ # # Apply the above configuration only to a new client.
924
+ # client = ::Google::Cloud::Compute::V1::RegionInstantSnapshots::Rest::Client.new do |config|
925
+ # config.timeout = 10.0
926
+ # config.rpcs.delete.timeout = 20.0
927
+ # end
928
+ #
929
+ # @!attribute [rw] endpoint
930
+ # A custom service endpoint, as a hostname or hostname:port. The default is
931
+ # nil, indicating to use the default endpoint in the current universe domain.
932
+ # @return [::String,nil]
933
+ # @!attribute [rw] credentials
934
+ # Credentials to send with calls. You may provide any of the following types:
935
+ # * (`String`) The path to a service account key file in JSON format
936
+ # * (`Hash`) A service account key as a Hash
937
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
938
+ # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
939
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
940
+ # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
941
+ # * (`nil`) indicating no credentials
942
+ # @return [::Object]
943
+ # @!attribute [rw] scope
944
+ # The OAuth scopes
945
+ # @return [::Array<::String>]
946
+ # @!attribute [rw] lib_name
947
+ # The library name as recorded in instrumentation and logging
948
+ # @return [::String]
949
+ # @!attribute [rw] lib_version
950
+ # The library version as recorded in instrumentation and logging
951
+ # @return [::String]
952
+ # @!attribute [rw] timeout
953
+ # The call timeout in seconds.
954
+ # @return [::Numeric]
955
+ # @!attribute [rw] metadata
956
+ # Additional headers to be sent with the call.
957
+ # @return [::Hash{::Symbol=>::String}]
958
+ # @!attribute [rw] retry_policy
959
+ # The retry policy. The value is a hash with the following keys:
960
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
961
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
962
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
963
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
964
+ # trigger a retry.
965
+ # @return [::Hash]
966
+ # @!attribute [rw] quota_project
967
+ # A separate project against which to charge quota.
968
+ # @return [::String]
969
+ # @!attribute [rw] universe_domain
970
+ # The universe domain within which to make requests. This determines the
971
+ # default endpoint URL. The default value of nil uses the environment
972
+ # universe (usually the default "googleapis.com" universe).
973
+ # @return [::String,nil]
974
+ #
975
+ class Configuration
976
+ extend ::Gapic::Config
977
+
978
+ # @private
979
+ # The endpoint specific to the default "googleapis.com" universe. Deprecated.
980
+ DEFAULT_ENDPOINT = "compute.googleapis.com"
981
+
982
+ config_attr :endpoint, nil, ::String, nil
983
+ config_attr :credentials, nil do |value|
984
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
985
+ allowed.any? { |klass| klass === value }
986
+ end
987
+ config_attr :scope, nil, ::String, ::Array, nil
988
+ config_attr :lib_name, nil, ::String, nil
989
+ config_attr :lib_version, nil, ::String, nil
990
+ config_attr :timeout, nil, ::Numeric, nil
991
+ config_attr :metadata, nil, ::Hash, nil
992
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
993
+ config_attr :quota_project, nil, ::String, nil
994
+ config_attr :universe_domain, nil, ::String, nil
995
+
996
+ # @private
997
+ def initialize parent_config = nil
998
+ @parent_config = parent_config unless parent_config.nil?
999
+
1000
+ yield self if block_given?
1001
+ end
1002
+
1003
+ ##
1004
+ # Configurations for individual RPCs
1005
+ # @return [Rpcs]
1006
+ #
1007
+ def rpcs
1008
+ @rpcs ||= begin
1009
+ parent_rpcs = nil
1010
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
1011
+ Rpcs.new parent_rpcs
1012
+ end
1013
+ end
1014
+
1015
+ ##
1016
+ # Configuration RPC class for the RegionInstantSnapshots API.
1017
+ #
1018
+ # Includes fields providing the configuration for each RPC in this service.
1019
+ # Each configuration object is of type `Gapic::Config::Method` and includes
1020
+ # the following configuration fields:
1021
+ #
1022
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
1023
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers
1024
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
1025
+ # include the following keys:
1026
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
1027
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
1028
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
1029
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
1030
+ # trigger a retry.
1031
+ #
1032
+ class Rpcs
1033
+ ##
1034
+ # RPC-specific configuration for `delete`
1035
+ # @return [::Gapic::Config::Method]
1036
+ #
1037
+ attr_reader :delete
1038
+ ##
1039
+ # RPC-specific configuration for `get`
1040
+ # @return [::Gapic::Config::Method]
1041
+ #
1042
+ attr_reader :get
1043
+ ##
1044
+ # RPC-specific configuration for `get_iam_policy`
1045
+ # @return [::Gapic::Config::Method]
1046
+ #
1047
+ attr_reader :get_iam_policy
1048
+ ##
1049
+ # RPC-specific configuration for `insert`
1050
+ # @return [::Gapic::Config::Method]
1051
+ #
1052
+ attr_reader :insert
1053
+ ##
1054
+ # RPC-specific configuration for `list`
1055
+ # @return [::Gapic::Config::Method]
1056
+ #
1057
+ attr_reader :list
1058
+ ##
1059
+ # RPC-specific configuration for `set_iam_policy`
1060
+ # @return [::Gapic::Config::Method]
1061
+ #
1062
+ attr_reader :set_iam_policy
1063
+ ##
1064
+ # RPC-specific configuration for `set_labels`
1065
+ # @return [::Gapic::Config::Method]
1066
+ #
1067
+ attr_reader :set_labels
1068
+ ##
1069
+ # RPC-specific configuration for `test_iam_permissions`
1070
+ # @return [::Gapic::Config::Method]
1071
+ #
1072
+ attr_reader :test_iam_permissions
1073
+
1074
+ # @private
1075
+ def initialize parent_rpcs = nil
1076
+ delete_config = parent_rpcs.delete if parent_rpcs.respond_to? :delete
1077
+ @delete = ::Gapic::Config::Method.new delete_config
1078
+ get_config = parent_rpcs.get if parent_rpcs.respond_to? :get
1079
+ @get = ::Gapic::Config::Method.new get_config
1080
+ get_iam_policy_config = parent_rpcs.get_iam_policy if parent_rpcs.respond_to? :get_iam_policy
1081
+ @get_iam_policy = ::Gapic::Config::Method.new get_iam_policy_config
1082
+ insert_config = parent_rpcs.insert if parent_rpcs.respond_to? :insert
1083
+ @insert = ::Gapic::Config::Method.new insert_config
1084
+ list_config = parent_rpcs.list if parent_rpcs.respond_to? :list
1085
+ @list = ::Gapic::Config::Method.new list_config
1086
+ set_iam_policy_config = parent_rpcs.set_iam_policy if parent_rpcs.respond_to? :set_iam_policy
1087
+ @set_iam_policy = ::Gapic::Config::Method.new set_iam_policy_config
1088
+ set_labels_config = parent_rpcs.set_labels if parent_rpcs.respond_to? :set_labels
1089
+ @set_labels = ::Gapic::Config::Method.new set_labels_config
1090
+ test_iam_permissions_config = parent_rpcs.test_iam_permissions if parent_rpcs.respond_to? :test_iam_permissions
1091
+ @test_iam_permissions = ::Gapic::Config::Method.new test_iam_permissions_config
1092
+
1093
+ yield self if block_given?
1094
+ end
1095
+ end
1096
+ end
1097
+ end
1098
+ end
1099
+ end
1100
+ end
1101
+ end
1102
+ end
1103
+ end