google-cloud-compute-v1 2.10.0 → 2.12.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (123) hide show
  1. checksums.yaml +4 -4
  2. data/lib/google/cloud/compute/v1/accelerator_types/rest/client.rb +9 -3
  3. data/lib/google/cloud/compute/v1/addresses/rest/client.rb +17 -7
  4. data/lib/google/cloud/compute/v1/autoscalers/rest/client.rb +17 -7
  5. data/lib/google/cloud/compute/v1/backend_buckets/rest/client.rb +27 -12
  6. data/lib/google/cloud/compute/v1/backend_services/rest/client.rb +35 -16
  7. data/lib/google/cloud/compute/v1/compute_pb.rb +51 -1
  8. data/lib/google/cloud/compute/v1/disk_types/rest/client.rb +9 -3
  9. data/lib/google/cloud/compute/v1/disks/rest/client.rb +39 -18
  10. data/lib/google/cloud/compute/v1/external_vpn_gateways/rest/client.rb +15 -6
  11. data/lib/google/cloud/compute/v1/firewall_policies/rest/client.rb +39 -18
  12. data/lib/google/cloud/compute/v1/firewalls/rest/client.rb +15 -6
  13. data/lib/google/cloud/compute/v1/forwarding_rules/rest/client.rb +19 -8
  14. data/lib/google/cloud/compute/v1/global_addresses/rest/client.rb +15 -6
  15. data/lib/google/cloud/compute/v1/global_forwarding_rules/rest/client.rb +17 -7
  16. data/lib/google/cloud/compute/v1/global_network_endpoint_groups/rest/client.rb +17 -7
  17. data/lib/google/cloud/compute/v1/global_operations/rest/client.rb +13 -5
  18. data/lib/google/cloud/compute/v1/global_organization_operations/rest/client.rb +9 -3
  19. data/lib/google/cloud/compute/v1/global_public_delegated_prefixes/rest/client.rb +13 -5
  20. data/lib/google/cloud/compute/v1/health_checks/rest/client.rb +17 -7
  21. data/lib/google/cloud/compute/v1/image_family_views/rest/client.rb +5 -1
  22. data/lib/google/cloud/compute/v1/images/rest/client.rb +25 -11
  23. data/lib/google/cloud/compute/v1/instance_group_manager_resize_requests/credentials.rb +52 -0
  24. data/lib/google/cloud/compute/v1/instance_group_manager_resize_requests/rest/client.rb +837 -0
  25. data/lib/google/cloud/compute/v1/instance_group_manager_resize_requests/rest/service_stub.rb +378 -0
  26. data/lib/google/cloud/compute/v1/instance_group_manager_resize_requests/rest.rb +51 -0
  27. data/lib/google/cloud/compute/v1/instance_group_manager_resize_requests.rb +47 -0
  28. data/lib/google/cloud/compute/v1/instance_group_managers/rest/client.rb +43 -20
  29. data/lib/google/cloud/compute/v1/instance_groups/rest/client.rb +21 -9
  30. data/lib/google/cloud/compute/v1/instance_settings_service/credentials.rb +52 -0
  31. data/lib/google/cloud/compute/v1/instance_settings_service/rest/client.rb +517 -0
  32. data/lib/google/cloud/compute/v1/instance_settings_service/rest/service_stub.rb +190 -0
  33. data/lib/google/cloud/compute/v1/instance_settings_service/rest.rb +51 -0
  34. data/lib/google/cloud/compute/v1/instance_settings_service.rb +47 -0
  35. data/lib/google/cloud/compute/v1/instance_templates/rest/client.rb +19 -8
  36. data/lib/google/cloud/compute/v1/instances/rest/client.rb +99 -48
  37. data/lib/google/cloud/compute/v1/instant_snapshots/rest/client.rb +21 -9
  38. data/lib/google/cloud/compute/v1/interconnect_attachments/rest/client.rb +17 -7
  39. data/lib/google/cloud/compute/v1/interconnect_locations/rest/client.rb +7 -2
  40. data/lib/google/cloud/compute/v1/interconnect_remote_locations/rest/client.rb +7 -2
  41. data/lib/google/cloud/compute/v1/interconnects/rest/client.rb +19 -8
  42. data/lib/google/cloud/compute/v1/license_codes/rest/client.rb +7 -2
  43. data/lib/google/cloud/compute/v1/licenses/rest/client.rb +17 -7
  44. data/lib/google/cloud/compute/v1/machine_images/rest/client.rb +17 -7
  45. data/lib/google/cloud/compute/v1/machine_types/rest/client.rb +9 -3
  46. data/lib/google/cloud/compute/v1/network_attachments/rest/client.rb +21 -9
  47. data/lib/google/cloud/compute/v1/network_edge_security_services/rest/client.rb +13 -5
  48. data/lib/google/cloud/compute/v1/network_endpoint_groups/rest/client.rb +21 -9
  49. data/lib/google/cloud/compute/v1/network_firewall_policies/rest/client.rb +35 -16
  50. data/lib/google/cloud/compute/v1/networks/rest/client.rb +25 -11
  51. data/lib/google/cloud/compute/v1/node_groups/rest/client.rb +136 -14
  52. data/lib/google/cloud/compute/v1/node_groups/rest/service_stub.rb +62 -0
  53. data/lib/google/cloud/compute/v1/node_templates/rest/client.rb +19 -8
  54. data/lib/google/cloud/compute/v1/node_types/rest/client.rb +9 -3
  55. data/lib/google/cloud/compute/v1/packet_mirrorings/rest/client.rb +17 -7
  56. data/lib/google/cloud/compute/v1/projects/rest/client.rb +31 -14
  57. data/lib/google/cloud/compute/v1/public_advertised_prefixes/rest/client.rb +17 -7
  58. data/lib/google/cloud/compute/v1/public_delegated_prefixes/rest/client.rb +19 -8
  59. data/lib/google/cloud/compute/v1/region_autoscalers/rest/client.rb +15 -6
  60. data/lib/google/cloud/compute/v1/region_backend_services/rest/client.rb +27 -12
  61. data/lib/google/cloud/compute/v1/region_commitments/rest/client.rb +13 -5
  62. data/lib/google/cloud/compute/v1/region_disk_types/rest/client.rb +7 -2
  63. data/lib/google/cloud/compute/v1/region_disks/rest/client.rb +37 -17
  64. data/lib/google/cloud/compute/v1/region_health_check_services/rest/client.rb +13 -5
  65. data/lib/google/cloud/compute/v1/region_health_checks/rest/client.rb +15 -6
  66. data/lib/google/cloud/compute/v1/region_instance_group_managers/rest/client.rb +41 -19
  67. data/lib/google/cloud/compute/v1/region_instance_groups/rest/client.rb +11 -4
  68. data/lib/google/cloud/compute/v1/region_instance_templates/rest/client.rb +11 -4
  69. data/lib/google/cloud/compute/v1/region_instances/rest/client.rb +5 -1
  70. data/lib/google/cloud/compute/v1/region_instant_snapshots/rest/client.rb +19 -8
  71. data/lib/google/cloud/compute/v1/region_network_endpoint_groups/rest/client.rb +17 -7
  72. data/lib/google/cloud/compute/v1/region_network_firewall_policies/rest/client.rb +37 -17
  73. data/lib/google/cloud/compute/v1/region_notification_endpoints/rest/client.rb +11 -4
  74. data/lib/google/cloud/compute/v1/region_operations/rest/client.rb +11 -4
  75. data/lib/google/cloud/compute/v1/region_security_policies/rest/client.rb +21 -9
  76. data/lib/google/cloud/compute/v1/region_ssl_certificates/rest/client.rb +11 -4
  77. data/lib/google/cloud/compute/v1/region_ssl_policies/rest/client.rb +15 -6
  78. data/lib/google/cloud/compute/v1/region_target_http_proxies/rest/client.rb +13 -5
  79. data/lib/google/cloud/compute/v1/region_target_https_proxies/rest/client.rb +17 -7
  80. data/lib/google/cloud/compute/v1/region_target_tcp_proxies/rest/client.rb +11 -4
  81. data/lib/google/cloud/compute/v1/region_url_maps/rest/client.rb +17 -7
  82. data/lib/google/cloud/compute/v1/region_zones/rest/client.rb +5 -1
  83. data/lib/google/cloud/compute/v1/regions/rest/client.rb +7 -2
  84. data/lib/google/cloud/compute/v1/reservations/rest/client.rb +23 -10
  85. data/lib/google/cloud/compute/v1/resource_policies/rest/client.rb +21 -9
  86. data/lib/google/cloud/compute/v1/rest.rb +4 -0
  87. data/lib/google/cloud/compute/v1/routers/rest/client.rb +25 -11
  88. data/lib/google/cloud/compute/v1/routes/rest/client.rb +11 -4
  89. data/lib/google/cloud/compute/v1/security_policies/rest/client.rb +27 -12
  90. data/lib/google/cloud/compute/v1/service_attachments/rest/client.rb +21 -9
  91. data/lib/google/cloud/compute/v1/snapshot_settings_service/rest/client.rb +7 -2
  92. data/lib/google/cloud/compute/v1/snapshots/rest/client.rb +19 -8
  93. data/lib/google/cloud/compute/v1/ssl_certificates/rest/client.rb +13 -5
  94. data/lib/google/cloud/compute/v1/ssl_policies/rest/client.rb +17 -7
  95. data/lib/google/cloud/compute/v1/storage_pool_types/credentials.rb +53 -0
  96. data/lib/google/cloud/compute/v1/storage_pool_types/rest/client.rb +609 -0
  97. data/lib/google/cloud/compute/v1/storage_pool_types/rest/service_stub.rb +249 -0
  98. data/lib/google/cloud/compute/v1/storage_pool_types/rest.rb +51 -0
  99. data/lib/google/cloud/compute/v1/storage_pool_types.rb +47 -0
  100. data/lib/google/cloud/compute/v1/storage_pools/credentials.rb +52 -0
  101. data/lib/google/cloud/compute/v1/storage_pools/rest/client.rb +1326 -0
  102. data/lib/google/cloud/compute/v1/storage_pools/rest/service_stub.rb +679 -0
  103. data/lib/google/cloud/compute/v1/storage_pools/rest.rb +51 -0
  104. data/lib/google/cloud/compute/v1/storage_pools.rb +47 -0
  105. data/lib/google/cloud/compute/v1/subnetworks/rest/client.rb +27 -12
  106. data/lib/google/cloud/compute/v1/target_grpc_proxies/rest/client.rb +13 -5
  107. data/lib/google/cloud/compute/v1/target_http_proxies/rest/client.rb +17 -7
  108. data/lib/google/cloud/compute/v1/target_https_proxies/rest/client.rb +25 -11
  109. data/lib/google/cloud/compute/v1/target_instances/rest/client.rb +15 -6
  110. data/lib/google/cloud/compute/v1/target_pools/rest/client.rb +27 -12
  111. data/lib/google/cloud/compute/v1/target_ssl_proxies/rest/client.rb +21 -9
  112. data/lib/google/cloud/compute/v1/target_tcp_proxies/rest/client.rb +17 -7
  113. data/lib/google/cloud/compute/v1/target_vpn_gateways/rest/client.rb +15 -6
  114. data/lib/google/cloud/compute/v1/url_maps/rest/client.rb +21 -9
  115. data/lib/google/cloud/compute/v1/version.rb +1 -1
  116. data/lib/google/cloud/compute/v1/vpn_gateways/rest/client.rb +19 -8
  117. data/lib/google/cloud/compute/v1/vpn_tunnels/rest/client.rb +15 -6
  118. data/lib/google/cloud/compute/v1/zone_operations/rest/client.rb +11 -4
  119. data/lib/google/cloud/compute/v1/zones/rest/client.rb +7 -2
  120. data/lib/google/cloud/compute/v1.rb +4 -0
  121. data/proto_docs/google/api/client.rb +4 -0
  122. data/proto_docs/google/cloud/compute/v1/compute.rb +1333 -37
  123. metadata +22 -2
@@ -0,0 +1,517 @@
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/instance_settings_service/rest/service_stub"
22
+ require "google/cloud/compute/v1/zone_operations/rest"
23
+
24
+ module Google
25
+ module Cloud
26
+ module Compute
27
+ module V1
28
+ module InstanceSettingsService
29
+ module Rest
30
+ ##
31
+ # REST client for the InstanceSettingsService service.
32
+ #
33
+ # The InstanceSettings 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 :instance_settings_service_stub
44
+
45
+ ##
46
+ # Configure the InstanceSettingsService Client class.
47
+ #
48
+ # See {::Google::Cloud::Compute::V1::InstanceSettingsService::Rest::Client::Configuration}
49
+ # for a description of the configuration fields.
50
+ #
51
+ # @example
52
+ #
53
+ # # Modify the configuration for all InstanceSettingsService clients
54
+ # ::Google::Cloud::Compute::V1::InstanceSettingsService::Rest::Client.configure do |config|
55
+ # config.timeout = 10.0
56
+ # end
57
+ #
58
+ # @yield [config] Configure the Client client.
59
+ # @yieldparam config [Client::Configuration]
60
+ #
61
+ # @return [Client::Configuration]
62
+ #
63
+ def self.configure
64
+ @configure ||= begin
65
+ namespace = ["Google", "Cloud", "Compute", "V1"]
66
+ parent_config = while namespace.any?
67
+ parent_name = namespace.join "::"
68
+ parent_const = const_get parent_name
69
+ break parent_const.configure if parent_const.respond_to? :configure
70
+ namespace.pop
71
+ end
72
+ default_config = Client::Configuration.new parent_config
73
+
74
+ default_config.rpcs.get.timeout = 600.0
75
+ default_config.rpcs.get.retry_policy = {
76
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14]
77
+ }
78
+
79
+ default_config.rpcs.patch.timeout = 600.0
80
+
81
+ default_config
82
+ end
83
+ yield @configure if block_given?
84
+ @configure
85
+ end
86
+
87
+ ##
88
+ # Configure the InstanceSettingsService Client instance.
89
+ #
90
+ # The configuration is set to the derived mode, meaning that values can be changed,
91
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
92
+ # should be made on {Client.configure}.
93
+ #
94
+ # See {::Google::Cloud::Compute::V1::InstanceSettingsService::Rest::Client::Configuration}
95
+ # for a description of the configuration fields.
96
+ #
97
+ # @yield [config] Configure the Client client.
98
+ # @yieldparam config [Client::Configuration]
99
+ #
100
+ # @return [Client::Configuration]
101
+ #
102
+ def configure
103
+ yield @config if block_given?
104
+ @config
105
+ end
106
+
107
+ ##
108
+ # The effective universe domain
109
+ #
110
+ # @return [String]
111
+ #
112
+ def universe_domain
113
+ @instance_settings_service_stub.universe_domain
114
+ end
115
+
116
+ ##
117
+ # Create a new InstanceSettingsService REST client object.
118
+ #
119
+ # @example
120
+ #
121
+ # # Create a client using the default configuration
122
+ # client = ::Google::Cloud::Compute::V1::InstanceSettingsService::Rest::Client.new
123
+ #
124
+ # # Create a client using a custom configuration
125
+ # client = ::Google::Cloud::Compute::V1::InstanceSettingsService::Rest::Client.new do |config|
126
+ # config.timeout = 10.0
127
+ # end
128
+ #
129
+ # @yield [config] Configure the InstanceSettingsService client.
130
+ # @yieldparam config [Client::Configuration]
131
+ #
132
+ def initialize
133
+ # Create the configuration object
134
+ @config = Configuration.new Client.configure
135
+
136
+ # Yield the configuration if needed
137
+ yield @config if block_given?
138
+
139
+ # Create credentials
140
+ credentials = @config.credentials
141
+ # Use self-signed JWT if the endpoint is unchanged from default,
142
+ # but only if the default endpoint does not have a region prefix.
143
+ enable_self_signed_jwt = @config.endpoint.nil? ||
144
+ (@config.endpoint == Configuration::DEFAULT_ENDPOINT &&
145
+ !@config.endpoint.split(".").first.include?("-"))
146
+ credentials ||= Credentials.default scope: @config.scope,
147
+ enable_self_signed_jwt: enable_self_signed_jwt
148
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
149
+ credentials = Credentials.new credentials, scope: @config.scope
150
+ end
151
+
152
+ @quota_project_id = @config.quota_project
153
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
154
+
155
+ @zone_operations = ::Google::Cloud::Compute::V1::ZoneOperations::Rest::Client.new do |config|
156
+ config.credentials = credentials
157
+ config.quota_project = @quota_project_id
158
+ config.endpoint = @config.endpoint
159
+ config.universe_domain = @config.universe_domain
160
+ end
161
+
162
+ @instance_settings_service_stub = ::Google::Cloud::Compute::V1::InstanceSettingsService::Rest::ServiceStub.new(
163
+ endpoint: @config.endpoint,
164
+ endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
165
+ universe_domain: @config.universe_domain,
166
+ credentials: credentials
167
+ )
168
+ end
169
+
170
+ ##
171
+ # Get the associated client for long-running operations via ZoneOperations.
172
+ #
173
+ # @return [::Google::Cloud::Compute::V1::ZoneOperations::Rest::Client]
174
+ #
175
+ attr_reader :zone_operations
176
+
177
+ # Service calls
178
+
179
+ ##
180
+ # Get Instance settings.
181
+ #
182
+ # @overload get(request, options = nil)
183
+ # Pass arguments to `get` via a request object, either of type
184
+ # {::Google::Cloud::Compute::V1::GetInstanceSettingRequest} or an equivalent Hash.
185
+ #
186
+ # @param request [::Google::Cloud::Compute::V1::GetInstanceSettingRequest, ::Hash]
187
+ # A request object representing the call parameters. Required. To specify no
188
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
189
+ # @param options [::Gapic::CallOptions, ::Hash]
190
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
191
+ #
192
+ # @overload get(project: nil, zone: nil)
193
+ # Pass arguments to `get` via keyword arguments. Note that at
194
+ # least one keyword argument is required. To specify no parameters, or to keep all
195
+ # the default parameter values, pass an empty Hash as a request object (see above).
196
+ #
197
+ # @param project [::String]
198
+ # Project ID for this request.
199
+ # @param zone [::String]
200
+ # Name of the zone for this request.
201
+ # @yield [result, operation] Access the result along with the TransportOperation object
202
+ # @yieldparam result [::Google::Cloud::Compute::V1::InstanceSettings]
203
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
204
+ #
205
+ # @return [::Google::Cloud::Compute::V1::InstanceSettings]
206
+ #
207
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
208
+ #
209
+ # @example Basic example
210
+ # require "google/cloud/compute/v1"
211
+ #
212
+ # # Create a client object. The client can be reused for multiple calls.
213
+ # client = Google::Cloud::Compute::V1::InstanceSettingsService::Rest::Client.new
214
+ #
215
+ # # Create a request. To set request fields, pass in keyword arguments.
216
+ # request = Google::Cloud::Compute::V1::GetInstanceSettingRequest.new
217
+ #
218
+ # # Call the get method.
219
+ # result = client.get request
220
+ #
221
+ # # The returned object is of type Google::Cloud::Compute::V1::InstanceSettings.
222
+ # p result
223
+ #
224
+ def get request, options = nil
225
+ raise ::ArgumentError, "request must be provided" if request.nil?
226
+
227
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Compute::V1::GetInstanceSettingRequest
228
+
229
+ # Converts hash and nil to an options object
230
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
231
+
232
+ # Customize the options with defaults
233
+ call_metadata = @config.rpcs.get.metadata.to_h
234
+
235
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
236
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
237
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
238
+ gapic_version: ::Google::Cloud::Compute::V1::VERSION,
239
+ transports_version_send: [:rest]
240
+
241
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
242
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
243
+
244
+ options.apply_defaults timeout: @config.rpcs.get.timeout,
245
+ metadata: call_metadata,
246
+ retry_policy: @config.rpcs.get.retry_policy
247
+
248
+ options.apply_defaults timeout: @config.timeout,
249
+ metadata: @config.metadata,
250
+ retry_policy: @config.retry_policy
251
+
252
+ @instance_settings_service_stub.get request, options do |result, operation|
253
+ yield result, operation if block_given?
254
+ return result
255
+ end
256
+ rescue ::Gapic::Rest::Error => e
257
+ raise ::Google::Cloud::Error.from_error(e)
258
+ end
259
+
260
+ ##
261
+ # Patch Instance settings
262
+ #
263
+ # @overload patch(request, options = nil)
264
+ # Pass arguments to `patch` via a request object, either of type
265
+ # {::Google::Cloud::Compute::V1::PatchInstanceSettingRequest} or an equivalent Hash.
266
+ #
267
+ # @param request [::Google::Cloud::Compute::V1::PatchInstanceSettingRequest, ::Hash]
268
+ # A request object representing the call parameters. Required. To specify no
269
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
270
+ # @param options [::Gapic::CallOptions, ::Hash]
271
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
272
+ #
273
+ # @overload patch(instance_settings_resource: nil, project: nil, request_id: nil, update_mask: nil, zone: nil)
274
+ # Pass arguments to `patch` via keyword arguments. Note that at
275
+ # least one keyword argument is required. To specify no parameters, or to keep all
276
+ # the default parameter values, pass an empty Hash as a request object (see above).
277
+ #
278
+ # @param instance_settings_resource [::Google::Cloud::Compute::V1::InstanceSettings, ::Hash]
279
+ # The body resource for this request
280
+ # @param project [::String]
281
+ # Project ID for this request.
282
+ # @param request_id [::String]
283
+ # 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).
284
+ # @param update_mask [::String]
285
+ # update_mask indicates fields to be updated as part of this request.
286
+ # @param zone [::String]
287
+ # The zone scoping this request. It should conform to RFC1035.
288
+ # @yield [result, operation] Access the result along with the TransportOperation object
289
+ # @yieldparam result [::Gapic::GenericLRO::Operation]
290
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
291
+ #
292
+ # @return [::Gapic::GenericLRO::Operation]
293
+ #
294
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
295
+ #
296
+ # @example Basic example
297
+ # require "google/cloud/compute/v1"
298
+ #
299
+ # # Create a client object. The client can be reused for multiple calls.
300
+ # client = Google::Cloud::Compute::V1::InstanceSettingsService::Rest::Client.new
301
+ #
302
+ # # Create a request. To set request fields, pass in keyword arguments.
303
+ # request = Google::Cloud::Compute::V1::PatchInstanceSettingRequest.new
304
+ #
305
+ # # Call the patch method.
306
+ # result = client.patch request
307
+ #
308
+ # # The returned object is of type Google::Cloud::Compute::V1::Operation.
309
+ # p result
310
+ #
311
+ def patch request, options = nil
312
+ raise ::ArgumentError, "request must be provided" if request.nil?
313
+
314
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Compute::V1::PatchInstanceSettingRequest
315
+
316
+ # Converts hash and nil to an options object
317
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
318
+
319
+ # Customize the options with defaults
320
+ call_metadata = @config.rpcs.patch.metadata.to_h
321
+
322
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
323
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
324
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
325
+ gapic_version: ::Google::Cloud::Compute::V1::VERSION,
326
+ transports_version_send: [:rest]
327
+
328
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
329
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
330
+
331
+ options.apply_defaults timeout: @config.rpcs.patch.timeout,
332
+ metadata: call_metadata,
333
+ retry_policy: @config.rpcs.patch.retry_policy
334
+
335
+ options.apply_defaults timeout: @config.timeout,
336
+ metadata: @config.metadata,
337
+ retry_policy: @config.retry_policy
338
+
339
+ @instance_settings_service_stub.patch request, options do |result, response|
340
+ result = ::Google::Cloud::Compute::V1::ZoneOperations::Rest::NonstandardLro.create_operation(
341
+ operation: result,
342
+ client: zone_operations,
343
+ request_values: {
344
+ "project" => request.project,
345
+ "zone" => request.zone
346
+ },
347
+ options: options
348
+ )
349
+ yield result, response if block_given?
350
+ return result
351
+ end
352
+ rescue ::Gapic::Rest::Error => e
353
+ raise ::Google::Cloud::Error.from_error(e)
354
+ end
355
+
356
+ ##
357
+ # Configuration class for the InstanceSettingsService REST API.
358
+ #
359
+ # This class represents the configuration for InstanceSettingsService REST,
360
+ # providing control over timeouts, retry behavior, logging, transport
361
+ # parameters, and other low-level controls. Certain parameters can also be
362
+ # applied individually to specific RPCs. See
363
+ # {::Google::Cloud::Compute::V1::InstanceSettingsService::Rest::Client::Configuration::Rpcs}
364
+ # for a list of RPCs that can be configured independently.
365
+ #
366
+ # Configuration can be applied globally to all clients, or to a single client
367
+ # on construction.
368
+ #
369
+ # @example
370
+ #
371
+ # # Modify the global config, setting the timeout for
372
+ # # get to 20 seconds,
373
+ # # and all remaining timeouts to 10 seconds.
374
+ # ::Google::Cloud::Compute::V1::InstanceSettingsService::Rest::Client.configure do |config|
375
+ # config.timeout = 10.0
376
+ # config.rpcs.get.timeout = 20.0
377
+ # end
378
+ #
379
+ # # Apply the above configuration only to a new client.
380
+ # client = ::Google::Cloud::Compute::V1::InstanceSettingsService::Rest::Client.new do |config|
381
+ # config.timeout = 10.0
382
+ # config.rpcs.get.timeout = 20.0
383
+ # end
384
+ #
385
+ # @!attribute [rw] endpoint
386
+ # A custom service endpoint, as a hostname or hostname:port. The default is
387
+ # nil, indicating to use the default endpoint in the current universe domain.
388
+ # @return [::String,nil]
389
+ # @!attribute [rw] credentials
390
+ # Credentials to send with calls. You may provide any of the following types:
391
+ # * (`String`) The path to a service account key file in JSON format
392
+ # * (`Hash`) A service account key as a Hash
393
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
394
+ # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
395
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
396
+ # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
397
+ # * (`nil`) indicating no credentials
398
+ # @return [::Object]
399
+ # @!attribute [rw] scope
400
+ # The OAuth scopes
401
+ # @return [::Array<::String>]
402
+ # @!attribute [rw] lib_name
403
+ # The library name as recorded in instrumentation and logging
404
+ # @return [::String]
405
+ # @!attribute [rw] lib_version
406
+ # The library version as recorded in instrumentation and logging
407
+ # @return [::String]
408
+ # @!attribute [rw] timeout
409
+ # The call timeout in seconds.
410
+ # @return [::Numeric]
411
+ # @!attribute [rw] metadata
412
+ # Additional headers to be sent with the call.
413
+ # @return [::Hash{::Symbol=>::String}]
414
+ # @!attribute [rw] retry_policy
415
+ # The retry policy. The value is a hash with the following keys:
416
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
417
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
418
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
419
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
420
+ # trigger a retry.
421
+ # @return [::Hash]
422
+ # @!attribute [rw] quota_project
423
+ # A separate project against which to charge quota.
424
+ # @return [::String]
425
+ # @!attribute [rw] universe_domain
426
+ # The universe domain within which to make requests. This determines the
427
+ # default endpoint URL. The default value of nil uses the environment
428
+ # universe (usually the default "googleapis.com" universe).
429
+ # @return [::String,nil]
430
+ #
431
+ class Configuration
432
+ extend ::Gapic::Config
433
+
434
+ # @private
435
+ # The endpoint specific to the default "googleapis.com" universe. Deprecated.
436
+ DEFAULT_ENDPOINT = "compute.googleapis.com"
437
+
438
+ config_attr :endpoint, nil, ::String, nil
439
+ config_attr :credentials, nil do |value|
440
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
441
+ allowed.any? { |klass| klass === value }
442
+ end
443
+ config_attr :scope, nil, ::String, ::Array, nil
444
+ config_attr :lib_name, nil, ::String, nil
445
+ config_attr :lib_version, nil, ::String, nil
446
+ config_attr :timeout, nil, ::Numeric, nil
447
+ config_attr :metadata, nil, ::Hash, nil
448
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
449
+ config_attr :quota_project, nil, ::String, nil
450
+ config_attr :universe_domain, nil, ::String, nil
451
+
452
+ # @private
453
+ def initialize parent_config = nil
454
+ @parent_config = parent_config unless parent_config.nil?
455
+
456
+ yield self if block_given?
457
+ end
458
+
459
+ ##
460
+ # Configurations for individual RPCs
461
+ # @return [Rpcs]
462
+ #
463
+ def rpcs
464
+ @rpcs ||= begin
465
+ parent_rpcs = nil
466
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
467
+ Rpcs.new parent_rpcs
468
+ end
469
+ end
470
+
471
+ ##
472
+ # Configuration RPC class for the InstanceSettingsService API.
473
+ #
474
+ # Includes fields providing the configuration for each RPC in this service.
475
+ # Each configuration object is of type `Gapic::Config::Method` and includes
476
+ # the following configuration fields:
477
+ #
478
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
479
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers
480
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
481
+ # include the following keys:
482
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
483
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
484
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
485
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
486
+ # trigger a retry.
487
+ #
488
+ class Rpcs
489
+ ##
490
+ # RPC-specific configuration for `get`
491
+ # @return [::Gapic::Config::Method]
492
+ #
493
+ attr_reader :get
494
+ ##
495
+ # RPC-specific configuration for `patch`
496
+ # @return [::Gapic::Config::Method]
497
+ #
498
+ attr_reader :patch
499
+
500
+ # @private
501
+ def initialize parent_rpcs = nil
502
+ get_config = parent_rpcs.get if parent_rpcs.respond_to? :get
503
+ @get = ::Gapic::Config::Method.new get_config
504
+ patch_config = parent_rpcs.patch if parent_rpcs.respond_to? :patch
505
+ @patch = ::Gapic::Config::Method.new patch_config
506
+
507
+ yield self if block_given?
508
+ end
509
+ end
510
+ end
511
+ end
512
+ end
513
+ end
514
+ end
515
+ end
516
+ end
517
+ end