google-cloud-compute-v1 1.2.0 → 1.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (33) hide show
  1. checksums.yaml +4 -4
  2. data/lib/google/cloud/compute/v1/compute_pb.rb +577 -1
  3. data/lib/google/cloud/compute/v1/disks/rest/client.rb +1 -1
  4. data/lib/google/cloud/compute/v1/firewall_policies/rest/service_stub.rb +1 -1
  5. data/lib/google/cloud/compute/v1/instances/rest/client.rb +3 -1
  6. data/lib/google/cloud/compute/v1/network_edge_security_services/credentials.rb +52 -0
  7. data/lib/google/cloud/compute/v1/network_edge_security_services/rest/client.rb +679 -0
  8. data/lib/google/cloud/compute/v1/network_edge_security_services/rest/service_stub.rb +279 -0
  9. data/lib/google/cloud/compute/v1/network_edge_security_services/rest.rb +33 -0
  10. data/lib/google/cloud/compute/v1/network_edge_security_services.rb +44 -0
  11. data/lib/google/cloud/compute/v1/network_firewall_policies/credentials.rb +52 -0
  12. data/lib/google/cloud/compute/v1/network_firewall_policies/rest/client.rb +1552 -0
  13. data/lib/google/cloud/compute/v1/network_firewall_policies/rest/service_stub.rb +778 -0
  14. data/lib/google/cloud/compute/v1/network_firewall_policies/rest.rb +33 -0
  15. data/lib/google/cloud/compute/v1/network_firewall_policies.rb +44 -0
  16. data/lib/google/cloud/compute/v1/region_network_firewall_policies/credentials.rb +52 -0
  17. data/lib/google/cloud/compute/v1/region_network_firewall_policies/rest/client.rb +1670 -0
  18. data/lib/google/cloud/compute/v1/region_network_firewall_policies/rest/service_stub.rb +823 -0
  19. data/lib/google/cloud/compute/v1/region_network_firewall_policies/rest.rb +33 -0
  20. data/lib/google/cloud/compute/v1/region_network_firewall_policies.rb +44 -0
  21. data/lib/google/cloud/compute/v1/region_security_policies/credentials.rb +52 -0
  22. data/lib/google/cloud/compute/v1/region_security_policies/rest/client.rb +676 -0
  23. data/lib/google/cloud/compute/v1/region_security_policies/rest/service_stub.rb +276 -0
  24. data/lib/google/cloud/compute/v1/region_security_policies/rest.rb +33 -0
  25. data/lib/google/cloud/compute/v1/region_security_policies.rb +44 -0
  26. data/lib/google/cloud/compute/v1/region_target_https_proxies/rest/client.rb +87 -0
  27. data/lib/google/cloud/compute/v1/region_target_https_proxies/rest/service_stub.rb +46 -0
  28. data/lib/google/cloud/compute/v1/security_policies/rest/client.rb +86 -0
  29. data/lib/google/cloud/compute/v1/security_policies/rest/service_stub.rb +50 -0
  30. data/lib/google/cloud/compute/v1/version.rb +1 -1
  31. data/lib/google/cloud/compute/v1.rb +4 -0
  32. data/proto_docs/google/cloud/compute/v1/compute.rb +1562 -65
  33. metadata +22 -2
@@ -0,0 +1,676 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2022 Google LLC
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # https://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ # Auto-generated by gapic-generator-ruby. DO NOT EDIT!
18
+
19
+ require "google/cloud/errors"
20
+ require "google/cloud/compute/v1/compute_pb"
21
+ require "google/cloud/compute/v1/region_security_policies/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 RegionSecurityPolicies
29
+ module Rest
30
+ ##
31
+ # REST client for the RegionSecurityPolicies service.
32
+ #
33
+ # The RegionSecurityPolicies API.
34
+ #
35
+ class Client
36
+ # @private
37
+ attr_reader :region_security_policies_stub
38
+
39
+ ##
40
+ # Configure the RegionSecurityPolicies Client class.
41
+ #
42
+ # See {::Google::Cloud::Compute::V1::RegionSecurityPolicies::Rest::Client::Configuration}
43
+ # for a description of the configuration fields.
44
+ #
45
+ # @example
46
+ #
47
+ # # Modify the configuration for all RegionSecurityPolicies clients
48
+ # ::Google::Cloud::Compute::V1::RegionSecurityPolicies::Rest::Client.configure do |config|
49
+ # config.timeout = 10.0
50
+ # end
51
+ #
52
+ # @yield [config] Configure the Client client.
53
+ # @yieldparam config [Client::Configuration]
54
+ #
55
+ # @return [Client::Configuration]
56
+ #
57
+ def self.configure
58
+ @configure ||= begin
59
+ namespace = ["Google", "Cloud", "Compute", "V1"]
60
+ parent_config = while namespace.any?
61
+ parent_name = namespace.join "::"
62
+ parent_const = const_get parent_name
63
+ break parent_const.configure if parent_const.respond_to? :configure
64
+ namespace.pop
65
+ end
66
+ default_config = Client::Configuration.new parent_config
67
+
68
+ default_config.rpcs.delete.timeout = 600.0
69
+
70
+ default_config.rpcs.get.timeout = 600.0
71
+ default_config.rpcs.get.retry_policy = {
72
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14]
73
+ }
74
+
75
+ default_config.rpcs.insert.timeout = 600.0
76
+
77
+ default_config.rpcs.list.timeout = 600.0
78
+ default_config.rpcs.list.retry_policy = {
79
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14]
80
+ }
81
+
82
+ default_config.rpcs.patch.timeout = 600.0
83
+
84
+ default_config
85
+ end
86
+ yield @configure if block_given?
87
+ @configure
88
+ end
89
+
90
+ ##
91
+ # Configure the RegionSecurityPolicies Client instance.
92
+ #
93
+ # The configuration is set to the derived mode, meaning that values can be changed,
94
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
95
+ # should be made on {Client.configure}.
96
+ #
97
+ # See {::Google::Cloud::Compute::V1::RegionSecurityPolicies::Rest::Client::Configuration}
98
+ # for a description of the configuration fields.
99
+ #
100
+ # @yield [config] Configure the Client client.
101
+ # @yieldparam config [Client::Configuration]
102
+ #
103
+ # @return [Client::Configuration]
104
+ #
105
+ def configure
106
+ yield @config if block_given?
107
+ @config
108
+ end
109
+
110
+ ##
111
+ # Create a new RegionSecurityPolicies REST client object.
112
+ #
113
+ # @example
114
+ #
115
+ # # Create a client using the default configuration
116
+ # client = ::Google::Cloud::Compute::V1::RegionSecurityPolicies::Rest::Client.new
117
+ #
118
+ # # Create a client using a custom configuration
119
+ # client = ::Google::Cloud::Compute::V1::RegionSecurityPolicies::Rest::Client.new do |config|
120
+ # config.timeout = 10.0
121
+ # end
122
+ #
123
+ # @yield [config] Configure the RegionSecurityPolicies client.
124
+ # @yieldparam config [Client::Configuration]
125
+ #
126
+ def initialize
127
+ # Create the configuration object
128
+ @config = Configuration.new Client.configure
129
+
130
+ # Yield the configuration if needed
131
+ yield @config if block_given?
132
+
133
+ # Create credentials
134
+ credentials = @config.credentials
135
+ credentials ||= Credentials.default scope: @config.scope
136
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
137
+ credentials = Credentials.new credentials, scope: @config.scope
138
+ end
139
+
140
+ @region_operations = ::Google::Cloud::Compute::V1::RegionOperations::Rest::Client.new do |config|
141
+ config.credentials = credentials
142
+ config.endpoint = @config.endpoint
143
+ end
144
+
145
+ @region_security_policies_stub = ::Google::Cloud::Compute::V1::RegionSecurityPolicies::Rest::ServiceStub.new endpoint: @config.endpoint, credentials: credentials
146
+ end
147
+
148
+ ##
149
+ # Get the associated client for long-running operations via RegionOperations.
150
+ #
151
+ # @return [::Google::Cloud::Compute::V1::RegionOperations::Rest::Client]
152
+ #
153
+ attr_reader :region_operations
154
+
155
+ # Service calls
156
+
157
+ ##
158
+ # Deletes the specified policy.
159
+ #
160
+ # @overload delete(request, options = nil)
161
+ # Pass arguments to `delete` via a request object, either of type
162
+ # {::Google::Cloud::Compute::V1::DeleteRegionSecurityPolicyRequest} or an equivalent Hash.
163
+ #
164
+ # @param request [::Google::Cloud::Compute::V1::DeleteRegionSecurityPolicyRequest, ::Hash]
165
+ # A request object representing the call parameters. Required. To specify no
166
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
167
+ # @param options [::Gapic::CallOptions, ::Hash]
168
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
169
+ # Note: currently retry functionality is not implemented. While it is possible
170
+ # to set it using ::Gapic::CallOptions, it will not be applied
171
+ #
172
+ # @overload delete(project: nil, region: nil, request_id: nil, security_policy: nil)
173
+ # Pass arguments to `delete` via keyword arguments. Note that at
174
+ # least one keyword argument is required. To specify no parameters, or to keep all
175
+ # the default parameter values, pass an empty Hash as a request object (see above).
176
+ #
177
+ # @param project [::String]
178
+ # Project ID for this request.
179
+ # @param region [::String]
180
+ # Name of the region scoping this request.
181
+ # @param request_id [::String]
182
+ # 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).
183
+ # @param security_policy [::String]
184
+ # Name of the security policy to delete.
185
+ # @yield [result, response] Access the result along with the Faraday response object
186
+ # @yieldparam result [::Gapic::GenericLRO::Operation]
187
+ # @yieldparam response [::Faraday::Response]
188
+ #
189
+ # @return [::Gapic::GenericLRO::Operation]
190
+ #
191
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
192
+ def delete request, options = nil
193
+ raise ::ArgumentError, "request must be provided" if request.nil?
194
+
195
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Compute::V1::DeleteRegionSecurityPolicyRequest
196
+
197
+ # Converts hash and nil to an options object
198
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
199
+
200
+ # Customize the options with defaults
201
+ call_metadata = @config.rpcs.delete.metadata.to_h
202
+
203
+ # Set x-goog-api-client header
204
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
205
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
206
+ gapic_version: ::Google::Cloud::Compute::V1::VERSION,
207
+ transports_version_send: [:rest]
208
+
209
+ options.apply_defaults timeout: @config.rpcs.delete.timeout,
210
+ metadata: call_metadata
211
+
212
+ options.apply_defaults timeout: @config.timeout,
213
+ metadata: @config.metadata
214
+
215
+ @region_security_policies_stub.delete request, options do |result, response|
216
+ result = ::Google::Cloud::Compute::V1::RegionOperations::Rest::NonstandardLro.create_operation(
217
+ operation: result,
218
+ client: region_operations,
219
+ request_values: {
220
+ "project" => request.project,
221
+ "region" => request.region
222
+ },
223
+ options: options
224
+ )
225
+ yield result, response if block_given?
226
+ return result
227
+ end
228
+ rescue ::Faraday::Error => e
229
+ gapic_error = ::Gapic::Rest::Error.wrap_faraday_error e
230
+ raise ::Google::Cloud::Error.from_error(gapic_error)
231
+ end
232
+
233
+ ##
234
+ # List all of the ordered rules present in a single specified policy.
235
+ #
236
+ # @overload get(request, options = nil)
237
+ # Pass arguments to `get` via a request object, either of type
238
+ # {::Google::Cloud::Compute::V1::GetRegionSecurityPolicyRequest} or an equivalent Hash.
239
+ #
240
+ # @param request [::Google::Cloud::Compute::V1::GetRegionSecurityPolicyRequest, ::Hash]
241
+ # A request object representing the call parameters. Required. To specify no
242
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
243
+ # @param options [::Gapic::CallOptions, ::Hash]
244
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
245
+ # Note: currently retry functionality is not implemented. While it is possible
246
+ # to set it using ::Gapic::CallOptions, it will not be applied
247
+ #
248
+ # @overload get(project: nil, region: nil, security_policy: nil)
249
+ # Pass arguments to `get` via keyword arguments. Note that at
250
+ # least one keyword argument is required. To specify no parameters, or to keep all
251
+ # the default parameter values, pass an empty Hash as a request object (see above).
252
+ #
253
+ # @param project [::String]
254
+ # Project ID for this request.
255
+ # @param region [::String]
256
+ # Name of the region scoping this request.
257
+ # @param security_policy [::String]
258
+ # Name of the security policy to get.
259
+ # @yield [result, response] Access the result along with the Faraday response object
260
+ # @yieldparam result [::Google::Cloud::Compute::V1::SecurityPolicy]
261
+ # @yieldparam response [::Faraday::Response]
262
+ #
263
+ # @return [::Google::Cloud::Compute::V1::SecurityPolicy]
264
+ #
265
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
266
+ def get request, options = nil
267
+ raise ::ArgumentError, "request must be provided" if request.nil?
268
+
269
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Compute::V1::GetRegionSecurityPolicyRequest
270
+
271
+ # Converts hash and nil to an options object
272
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
273
+
274
+ # Customize the options with defaults
275
+ call_metadata = @config.rpcs.get.metadata.to_h
276
+
277
+ # Set x-goog-api-client header
278
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
279
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
280
+ gapic_version: ::Google::Cloud::Compute::V1::VERSION,
281
+ transports_version_send: [:rest]
282
+
283
+ options.apply_defaults timeout: @config.rpcs.get.timeout,
284
+ metadata: call_metadata
285
+
286
+ options.apply_defaults timeout: @config.timeout,
287
+ metadata: @config.metadata
288
+
289
+ @region_security_policies_stub.get request, options do |result, response|
290
+ yield result, response if block_given?
291
+ return result
292
+ end
293
+ rescue ::Faraday::Error => e
294
+ gapic_error = ::Gapic::Rest::Error.wrap_faraday_error e
295
+ raise ::Google::Cloud::Error.from_error(gapic_error)
296
+ end
297
+
298
+ ##
299
+ # Creates a new policy in the specified project using the data included in the request.
300
+ #
301
+ # @overload insert(request, options = nil)
302
+ # Pass arguments to `insert` via a request object, either of type
303
+ # {::Google::Cloud::Compute::V1::InsertRegionSecurityPolicyRequest} or an equivalent Hash.
304
+ #
305
+ # @param request [::Google::Cloud::Compute::V1::InsertRegionSecurityPolicyRequest, ::Hash]
306
+ # A request object representing the call parameters. Required. To specify no
307
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
308
+ # @param options [::Gapic::CallOptions, ::Hash]
309
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
310
+ # Note: currently retry functionality is not implemented. While it is possible
311
+ # to set it using ::Gapic::CallOptions, it will not be applied
312
+ #
313
+ # @overload insert(project: nil, region: nil, request_id: nil, security_policy_resource: nil, validate_only: nil)
314
+ # Pass arguments to `insert` via keyword arguments. Note that at
315
+ # least one keyword argument is required. To specify no parameters, or to keep all
316
+ # the default parameter values, pass an empty Hash as a request object (see above).
317
+ #
318
+ # @param project [::String]
319
+ # Project ID for this request.
320
+ # @param region [::String]
321
+ # Name of the region scoping this request.
322
+ # @param request_id [::String]
323
+ # 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).
324
+ # @param security_policy_resource [::Google::Cloud::Compute::V1::SecurityPolicy, ::Hash]
325
+ # The body resource for this request
326
+ # @param validate_only [::Boolean]
327
+ # If true, the request will not be committed.
328
+ # @yield [result, response] Access the result along with the Faraday response object
329
+ # @yieldparam result [::Gapic::GenericLRO::Operation]
330
+ # @yieldparam response [::Faraday::Response]
331
+ #
332
+ # @return [::Gapic::GenericLRO::Operation]
333
+ #
334
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
335
+ def insert request, options = nil
336
+ raise ::ArgumentError, "request must be provided" if request.nil?
337
+
338
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Compute::V1::InsertRegionSecurityPolicyRequest
339
+
340
+ # Converts hash and nil to an options object
341
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
342
+
343
+ # Customize the options with defaults
344
+ call_metadata = @config.rpcs.insert.metadata.to_h
345
+
346
+ # Set x-goog-api-client header
347
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
348
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
349
+ gapic_version: ::Google::Cloud::Compute::V1::VERSION,
350
+ transports_version_send: [:rest]
351
+
352
+ options.apply_defaults timeout: @config.rpcs.insert.timeout,
353
+ metadata: call_metadata
354
+
355
+ options.apply_defaults timeout: @config.timeout,
356
+ metadata: @config.metadata
357
+
358
+ @region_security_policies_stub.insert request, options do |result, response|
359
+ result = ::Google::Cloud::Compute::V1::RegionOperations::Rest::NonstandardLro.create_operation(
360
+ operation: result,
361
+ client: region_operations,
362
+ request_values: {
363
+ "project" => request.project,
364
+ "region" => request.region
365
+ },
366
+ options: options
367
+ )
368
+ yield result, response if block_given?
369
+ return result
370
+ end
371
+ rescue ::Faraday::Error => e
372
+ gapic_error = ::Gapic::Rest::Error.wrap_faraday_error e
373
+ raise ::Google::Cloud::Error.from_error(gapic_error)
374
+ end
375
+
376
+ ##
377
+ # List all the policies that have been configured for the specified project and region.
378
+ #
379
+ # @overload list(request, options = nil)
380
+ # Pass arguments to `list` via a request object, either of type
381
+ # {::Google::Cloud::Compute::V1::ListRegionSecurityPoliciesRequest} or an equivalent Hash.
382
+ #
383
+ # @param request [::Google::Cloud::Compute::V1::ListRegionSecurityPoliciesRequest, ::Hash]
384
+ # A request object representing the call parameters. Required. To specify no
385
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
386
+ # @param options [::Gapic::CallOptions, ::Hash]
387
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
388
+ # Note: currently retry functionality is not implemented. While it is possible
389
+ # to set it using ::Gapic::CallOptions, it will not be applied
390
+ #
391
+ # @overload list(filter: nil, max_results: nil, order_by: nil, page_token: nil, project: nil, region: nil, return_partial_success: nil)
392
+ # Pass arguments to `list` via keyword arguments. Note that at
393
+ # least one keyword argument is required. To specify no parameters, or to keep all
394
+ # the default parameter values, pass an empty Hash as a request object (see above).
395
+ #
396
+ # @param filter [::String]
397
+ # A filter expression that filters resources listed in the response. The 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 `:` operator can be used with string fields to match substrings. For non-string fields it is equivalent to the `=` operator. 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) ```
398
+ # @param max_results [::Integer]
399
+ # 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`)
400
+ # @param order_by [::String]
401
+ # 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.
402
+ # @param page_token [::String]
403
+ # Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results.
404
+ # @param project [::String]
405
+ # Project ID for this request.
406
+ # @param region [::String]
407
+ # Name of the region scoping this request.
408
+ # @param return_partial_success [::Boolean]
409
+ # Opt-in for partial success behavior which provides partial results in case of failure. The default value is false.
410
+ # @yield [result, response] Access the result along with the Faraday response object
411
+ # @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Compute::V1::SecurityPolicy>]
412
+ # @yieldparam response [::Faraday::Response]
413
+ #
414
+ # @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Compute::V1::SecurityPolicy>]
415
+ #
416
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
417
+ def list request, options = nil
418
+ raise ::ArgumentError, "request must be provided" if request.nil?
419
+
420
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Compute::V1::ListRegionSecurityPoliciesRequest
421
+
422
+ # Converts hash and nil to an options object
423
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
424
+
425
+ # Customize the options with defaults
426
+ call_metadata = @config.rpcs.list.metadata.to_h
427
+
428
+ # Set x-goog-api-client header
429
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
430
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
431
+ gapic_version: ::Google::Cloud::Compute::V1::VERSION,
432
+ transports_version_send: [:rest]
433
+
434
+ options.apply_defaults timeout: @config.rpcs.list.timeout,
435
+ metadata: call_metadata
436
+
437
+ options.apply_defaults timeout: @config.timeout,
438
+ metadata: @config.metadata
439
+
440
+ @region_security_policies_stub.list request, options do |result, response|
441
+ result = ::Gapic::Rest::PagedEnumerable.new @region_security_policies_stub, :list, "items", request, result, options
442
+ yield result, response if block_given?
443
+ return result
444
+ end
445
+ rescue ::Faraday::Error => e
446
+ gapic_error = ::Gapic::Rest::Error.wrap_faraday_error e
447
+ raise ::Google::Cloud::Error.from_error(gapic_error)
448
+ end
449
+
450
+ ##
451
+ # Patches the specified policy with the data included in the request.
452
+ #
453
+ # @overload patch(request, options = nil)
454
+ # Pass arguments to `patch` via a request object, either of type
455
+ # {::Google::Cloud::Compute::V1::PatchRegionSecurityPolicyRequest} or an equivalent Hash.
456
+ #
457
+ # @param request [::Google::Cloud::Compute::V1::PatchRegionSecurityPolicyRequest, ::Hash]
458
+ # A request object representing the call parameters. Required. To specify no
459
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
460
+ # @param options [::Gapic::CallOptions, ::Hash]
461
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
462
+ # Note: currently retry functionality is not implemented. While it is possible
463
+ # to set it using ::Gapic::CallOptions, it will not be applied
464
+ #
465
+ # @overload patch(project: nil, region: nil, request_id: nil, security_policy: nil, security_policy_resource: nil)
466
+ # Pass arguments to `patch` via keyword arguments. Note that at
467
+ # least one keyword argument is required. To specify no parameters, or to keep all
468
+ # the default parameter values, pass an empty Hash as a request object (see above).
469
+ #
470
+ # @param project [::String]
471
+ # Project ID for this request.
472
+ # @param region [::String]
473
+ # Name of the region scoping this request.
474
+ # @param request_id [::String]
475
+ # 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).
476
+ # @param security_policy [::String]
477
+ # Name of the security policy to update.
478
+ # @param security_policy_resource [::Google::Cloud::Compute::V1::SecurityPolicy, ::Hash]
479
+ # The body resource for this request
480
+ # @yield [result, response] Access the result along with the Faraday response object
481
+ # @yieldparam result [::Gapic::GenericLRO::Operation]
482
+ # @yieldparam response [::Faraday::Response]
483
+ #
484
+ # @return [::Gapic::GenericLRO::Operation]
485
+ #
486
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
487
+ def patch request, options = nil
488
+ raise ::ArgumentError, "request must be provided" if request.nil?
489
+
490
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Compute::V1::PatchRegionSecurityPolicyRequest
491
+
492
+ # Converts hash and nil to an options object
493
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
494
+
495
+ # Customize the options with defaults
496
+ call_metadata = @config.rpcs.patch.metadata.to_h
497
+
498
+ # Set x-goog-api-client header
499
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
500
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
501
+ gapic_version: ::Google::Cloud::Compute::V1::VERSION,
502
+ transports_version_send: [:rest]
503
+
504
+ options.apply_defaults timeout: @config.rpcs.patch.timeout,
505
+ metadata: call_metadata
506
+
507
+ options.apply_defaults timeout: @config.timeout,
508
+ metadata: @config.metadata
509
+
510
+ @region_security_policies_stub.patch request, options do |result, response|
511
+ result = ::Google::Cloud::Compute::V1::RegionOperations::Rest::NonstandardLro.create_operation(
512
+ operation: result,
513
+ client: region_operations,
514
+ request_values: {
515
+ "project" => request.project,
516
+ "region" => request.region
517
+ },
518
+ options: options
519
+ )
520
+ yield result, response if block_given?
521
+ return result
522
+ end
523
+ rescue ::Faraday::Error => e
524
+ gapic_error = ::Gapic::Rest::Error.wrap_faraday_error e
525
+ raise ::Google::Cloud::Error.from_error(gapic_error)
526
+ end
527
+
528
+ ##
529
+ # Configuration class for the RegionSecurityPolicies REST API.
530
+ #
531
+ # This class represents the configuration for RegionSecurityPolicies REST,
532
+ # providing control over credentials, timeouts, retry behavior, logging.
533
+ #
534
+ # Configuration can be applied globally to all clients, or to a single client
535
+ # on construction.
536
+ #
537
+ # # Examples
538
+ #
539
+ # To modify the global config, setting the timeout for all calls to 10 seconds:
540
+ #
541
+ # ::Google::Cloud::Compute::V1::RegionSecurityPolicies::Client.configure do |config|
542
+ # config.timeout = 10.0
543
+ # end
544
+ #
545
+ # To apply the above configuration only to a new client:
546
+ #
547
+ # client = ::Google::Cloud::Compute::V1::RegionSecurityPolicies::Client.new do |config|
548
+ # config.timeout = 10.0
549
+ # end
550
+ #
551
+ # @!attribute [rw] endpoint
552
+ # The hostname or hostname:port of the service endpoint.
553
+ # Defaults to `"compute.googleapis.com"`.
554
+ # @return [::String]
555
+ # @!attribute [rw] credentials
556
+ # Credentials to send with calls. You may provide any of the following types:
557
+ # * (`String`) The path to a service account key file in JSON format
558
+ # * (`Hash`) A service account key as a Hash
559
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
560
+ # (see the [googleauth docs](https://googleapis.dev/ruby/googleauth/latest/index.html))
561
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
562
+ # (see the [signet docs](https://googleapis.dev/ruby/signet/latest/Signet/OAuth2/Client.html))
563
+ # * (`nil`) indicating no credentials
564
+ # @return [::Object]
565
+ # @!attribute [rw] scope
566
+ # The OAuth scopes
567
+ # @return [::Array<::String>]
568
+ # @!attribute [rw] lib_name
569
+ # The library name as recorded in instrumentation and logging
570
+ # @return [::String]
571
+ # @!attribute [rw] lib_version
572
+ # The library version as recorded in instrumentation and logging
573
+ # @return [::String]
574
+ # @!attribute [rw] timeout
575
+ # The call timeout in seconds.
576
+ # @return [::Numeric]
577
+ # @!attribute [rw] metadata
578
+ # Additional REST headers to be sent with the call.
579
+ # @return [::Hash{::Symbol=>::String}]
580
+ #
581
+ class Configuration
582
+ extend ::Gapic::Config
583
+
584
+ config_attr :endpoint, "compute.googleapis.com", ::String
585
+ config_attr :credentials, nil do |value|
586
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
587
+ allowed.any? { |klass| klass === value }
588
+ end
589
+ config_attr :scope, nil, ::String, ::Array, nil
590
+ config_attr :lib_name, nil, ::String, nil
591
+ config_attr :lib_version, nil, ::String, nil
592
+ config_attr :timeout, nil, ::Numeric, nil
593
+ config_attr :metadata, nil, ::Hash, nil
594
+
595
+ # @private
596
+ def initialize parent_config = nil
597
+ @parent_config = parent_config unless parent_config.nil?
598
+
599
+ yield self if block_given?
600
+ end
601
+
602
+ ##
603
+ # Configurations for individual RPCs
604
+ # @return [Rpcs]
605
+ #
606
+ def rpcs
607
+ @rpcs ||= begin
608
+ parent_rpcs = nil
609
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
610
+ Rpcs.new parent_rpcs
611
+ end
612
+ end
613
+
614
+ ##
615
+ # Configuration RPC class for the RegionSecurityPolicies API.
616
+ #
617
+ # Includes fields providing the configuration for each RPC in this service.
618
+ # Each configuration object is of type `Gapic::Config::Method` and includes
619
+ # the following configuration fields:
620
+ #
621
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
622
+ #
623
+ # there is one other field (`retry_policy`) that can be set
624
+ # but is currently not supported for REST Gapic libraries.
625
+ #
626
+ class Rpcs
627
+ ##
628
+ # RPC-specific configuration for `delete`
629
+ # @return [::Gapic::Config::Method]
630
+ #
631
+ attr_reader :delete
632
+ ##
633
+ # RPC-specific configuration for `get`
634
+ # @return [::Gapic::Config::Method]
635
+ #
636
+ attr_reader :get
637
+ ##
638
+ # RPC-specific configuration for `insert`
639
+ # @return [::Gapic::Config::Method]
640
+ #
641
+ attr_reader :insert
642
+ ##
643
+ # RPC-specific configuration for `list`
644
+ # @return [::Gapic::Config::Method]
645
+ #
646
+ attr_reader :list
647
+ ##
648
+ # RPC-specific configuration for `patch`
649
+ # @return [::Gapic::Config::Method]
650
+ #
651
+ attr_reader :patch
652
+
653
+ # @private
654
+ def initialize parent_rpcs = nil
655
+ delete_config = parent_rpcs.delete if parent_rpcs.respond_to? :delete
656
+ @delete = ::Gapic::Config::Method.new delete_config
657
+ get_config = parent_rpcs.get if parent_rpcs.respond_to? :get
658
+ @get = ::Gapic::Config::Method.new get_config
659
+ insert_config = parent_rpcs.insert if parent_rpcs.respond_to? :insert
660
+ @insert = ::Gapic::Config::Method.new insert_config
661
+ list_config = parent_rpcs.list if parent_rpcs.respond_to? :list
662
+ @list = ::Gapic::Config::Method.new list_config
663
+ patch_config = parent_rpcs.patch if parent_rpcs.respond_to? :patch
664
+ @patch = ::Gapic::Config::Method.new patch_config
665
+
666
+ yield self if block_given?
667
+ end
668
+ end
669
+ end
670
+ end
671
+ end
672
+ end
673
+ end
674
+ end
675
+ end
676
+ end