google-cloud-network_connectivity-v1beta 0.2.0 → 0.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. checksums.yaml +4 -4
  2. data/lib/google/cloud/network_connectivity/v1beta/bindings_override.rb +180 -0
  3. data/lib/google/cloud/network_connectivity/v1beta/data_transfer_service/rest/client.rb +1666 -0
  4. data/lib/google/cloud/network_connectivity/v1beta/data_transfer_service/rest/operations.rb +927 -0
  5. data/lib/google/cloud/network_connectivity/v1beta/data_transfer_service/rest/service_stub.rb +817 -0
  6. data/lib/google/cloud/network_connectivity/v1beta/data_transfer_service/rest.rb +54 -0
  7. data/lib/google/cloud/network_connectivity/v1beta/data_transfer_service.rb +6 -0
  8. data/lib/google/cloud/network_connectivity/v1beta/hub_service/rest/client.rb +3353 -0
  9. data/lib/google/cloud/network_connectivity/v1beta/hub_service/rest/operations.rb +927 -0
  10. data/lib/google/cloud/network_connectivity/v1beta/hub_service/rest/service_stub.rb +1800 -0
  11. data/lib/google/cloud/network_connectivity/v1beta/hub_service/rest.rb +56 -0
  12. data/lib/google/cloud/network_connectivity/v1beta/hub_service.rb +6 -0
  13. data/lib/google/cloud/network_connectivity/v1beta/policy_based_routing_service/rest/client.rb +817 -0
  14. data/lib/google/cloud/network_connectivity/v1beta/policy_based_routing_service/rest/operations.rb +927 -0
  15. data/lib/google/cloud/network_connectivity/v1beta/policy_based_routing_service/rest/service_stub.rb +326 -0
  16. data/lib/google/cloud/network_connectivity/v1beta/policy_based_routing_service/rest.rb +55 -0
  17. data/lib/google/cloud/network_connectivity/v1beta/policy_based_routing_service.rb +6 -0
  18. data/lib/google/cloud/network_connectivity/v1beta/rest.rb +41 -0
  19. data/lib/google/cloud/network_connectivity/v1beta/transport_manager/client.rb +98 -1
  20. data/lib/google/cloud/network_connectivity/v1beta/transport_manager/paths.rb +17 -0
  21. data/lib/google/cloud/network_connectivity/v1beta/transport_manager/rest/client.rb +1287 -0
  22. data/lib/google/cloud/network_connectivity/v1beta/transport_manager/rest/operations.rb +927 -0
  23. data/lib/google/cloud/network_connectivity/v1beta/transport_manager/rest/service_stub.rb +632 -0
  24. data/lib/google/cloud/network_connectivity/v1beta/transport_manager/rest.rb +54 -0
  25. data/lib/google/cloud/network_connectivity/v1beta/transport_manager.rb +6 -0
  26. data/lib/google/cloud/network_connectivity/v1beta/version.rb +1 -1
  27. data/lib/google/cloud/network_connectivity/v1beta.rb +5 -0
  28. data/lib/google/cloud/networkconnectivity/v1beta/hub_pb.rb +2 -1
  29. data/lib/google/cloud/networkconnectivity/v1beta/transport_manager_pb.rb +4 -1
  30. data/lib/google/cloud/networkconnectivity/v1beta/transport_manager_services_pb.rb +2 -0
  31. data/proto_docs/google/cloud/networkconnectivity/v1beta/hub.rb +65 -0
  32. data/proto_docs/google/cloud/networkconnectivity/v1beta/transport_manager.rb +70 -10
  33. data/proto_docs/google/protobuf/timestamp.rb +7 -6
  34. metadata +19 -2
  35. data/proto_docs/google/type/expr.rb +0 -75
@@ -0,0 +1,817 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2026 Google LLC
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # https://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ # Auto-generated by gapic-generator-ruby. DO NOT EDIT!
18
+
19
+ require "google/cloud/errors"
20
+ require "google/cloud/networkconnectivity/v1beta/policy_based_routing_pb"
21
+ require "google/cloud/network_connectivity/v1beta/policy_based_routing_service/rest/service_stub"
22
+ require "google/cloud/location/rest"
23
+ require "google/iam/v1/rest"
24
+
25
+ module Google
26
+ module Cloud
27
+ module NetworkConnectivity
28
+ module V1beta
29
+ module PolicyBasedRoutingService
30
+ module Rest
31
+ ##
32
+ # REST client for the PolicyBasedRoutingService service.
33
+ #
34
+ # Policy-Based Routing allows GCP customers to specify flexibile routing
35
+ # policies for Layer 4 traffic traversing through the connected service.
36
+ #
37
+ class Client
38
+ # @private
39
+ API_VERSION = ""
40
+
41
+ # @private
42
+ DEFAULT_ENDPOINT_TEMPLATE = "networkconnectivity.$UNIVERSE_DOMAIN$"
43
+
44
+ include Paths
45
+
46
+ # @private
47
+ attr_reader :policy_based_routing_service_stub
48
+
49
+ ##
50
+ # Configure the PolicyBasedRoutingService Client class.
51
+ #
52
+ # See {::Google::Cloud::NetworkConnectivity::V1beta::PolicyBasedRoutingService::Rest::Client::Configuration}
53
+ # for a description of the configuration fields.
54
+ #
55
+ # @example
56
+ #
57
+ # # Modify the configuration for all PolicyBasedRoutingService clients
58
+ # ::Google::Cloud::NetworkConnectivity::V1beta::PolicyBasedRoutingService::Rest::Client.configure do |config|
59
+ # config.timeout = 10.0
60
+ # end
61
+ #
62
+ # @yield [config] Configure the Client client.
63
+ # @yieldparam config [Client::Configuration]
64
+ #
65
+ # @return [Client::Configuration]
66
+ #
67
+ def self.configure
68
+ @configure ||= begin
69
+ namespace = ["Google", "Cloud", "NetworkConnectivity", "V1beta"]
70
+ parent_config = while namespace.any?
71
+ parent_name = namespace.join "::"
72
+ parent_const = const_get parent_name
73
+ break parent_const.configure if parent_const.respond_to? :configure
74
+ namespace.pop
75
+ end
76
+ default_config = Client::Configuration.new parent_config
77
+
78
+ default_config.timeout = 60.0
79
+ default_config.retry_policy = {
80
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
81
+ }
82
+
83
+ default_config.rpcs.create_policy_based_route.timeout = 60.0
84
+
85
+ default_config.rpcs.delete_policy_based_route.timeout = 60.0
86
+
87
+ default_config
88
+ end
89
+ yield @configure if block_given?
90
+ @configure
91
+ end
92
+
93
+ ##
94
+ # Configure the PolicyBasedRoutingService Client instance.
95
+ #
96
+ # The configuration is set to the derived mode, meaning that values can be changed,
97
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
98
+ # should be made on {Client.configure}.
99
+ #
100
+ # See {::Google::Cloud::NetworkConnectivity::V1beta::PolicyBasedRoutingService::Rest::Client::Configuration}
101
+ # for a description of the configuration fields.
102
+ #
103
+ # @yield [config] Configure the Client client.
104
+ # @yieldparam config [Client::Configuration]
105
+ #
106
+ # @return [Client::Configuration]
107
+ #
108
+ def configure
109
+ yield @config if block_given?
110
+ @config
111
+ end
112
+
113
+ ##
114
+ # The effective universe domain
115
+ #
116
+ # @return [String]
117
+ #
118
+ def universe_domain
119
+ @policy_based_routing_service_stub.universe_domain
120
+ end
121
+
122
+ ##
123
+ # Create a new PolicyBasedRoutingService REST client object.
124
+ #
125
+ # @example
126
+ #
127
+ # # Create a client using the default configuration
128
+ # client = ::Google::Cloud::NetworkConnectivity::V1beta::PolicyBasedRoutingService::Rest::Client.new
129
+ #
130
+ # # Create a client using a custom configuration
131
+ # client = ::Google::Cloud::NetworkConnectivity::V1beta::PolicyBasedRoutingService::Rest::Client.new do |config|
132
+ # config.timeout = 10.0
133
+ # end
134
+ #
135
+ # @yield [config] Configure the PolicyBasedRoutingService client.
136
+ # @yieldparam config [Client::Configuration]
137
+ #
138
+ def initialize
139
+ # Create the configuration object
140
+ @config = Configuration.new Client.configure
141
+
142
+ # Yield the configuration if needed
143
+ yield @config if block_given?
144
+
145
+ # Create credentials
146
+ credentials = @config.credentials
147
+ # Use self-signed JWT if the endpoint is unchanged from default,
148
+ # but only if the default endpoint does not have a region prefix.
149
+ enable_self_signed_jwt = @config.endpoint.nil? ||
150
+ (@config.endpoint == Configuration::DEFAULT_ENDPOINT &&
151
+ !@config.endpoint.split(".").first.include?("-"))
152
+ credentials ||= Credentials.default scope: @config.scope,
153
+ enable_self_signed_jwt: enable_self_signed_jwt
154
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
155
+ credentials = Credentials.new credentials, scope: @config.scope
156
+ end
157
+
158
+ @quota_project_id = @config.quota_project
159
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
160
+
161
+ @operations_client = ::Google::Cloud::NetworkConnectivity::V1beta::PolicyBasedRoutingService::Rest::Operations.new do |config|
162
+ config.credentials = credentials
163
+ config.quota_project = @quota_project_id
164
+ config.endpoint = @config.endpoint
165
+ config.universe_domain = @config.universe_domain
166
+ end
167
+
168
+ @policy_based_routing_service_stub = ::Google::Cloud::NetworkConnectivity::V1beta::PolicyBasedRoutingService::Rest::ServiceStub.new(
169
+ endpoint: @config.endpoint,
170
+ endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
171
+ universe_domain: @config.universe_domain,
172
+ credentials: credentials,
173
+ logger: @config.logger
174
+ )
175
+
176
+ @policy_based_routing_service_stub.logger(stub: true)&.info do |entry|
177
+ entry.set_system_name
178
+ entry.set_service
179
+ entry.message = "Created client for #{entry.service}"
180
+ entry.set_credentials_fields credentials
181
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
182
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
183
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
184
+ end
185
+
186
+ @location_client = Google::Cloud::Location::Locations::Rest::Client.new do |config|
187
+ config.credentials = credentials
188
+ config.quota_project = @quota_project_id
189
+ config.endpoint = @policy_based_routing_service_stub.endpoint
190
+ config.universe_domain = @policy_based_routing_service_stub.universe_domain
191
+ config.bindings_override = @config.bindings_override
192
+ config.logger = @policy_based_routing_service_stub.logger if config.respond_to? :logger=
193
+ end
194
+
195
+ @iam_policy_client = Google::Iam::V1::IAMPolicy::Rest::Client.new do |config|
196
+ config.credentials = credentials
197
+ config.quota_project = @quota_project_id
198
+ config.endpoint = @policy_based_routing_service_stub.endpoint
199
+ config.universe_domain = @policy_based_routing_service_stub.universe_domain
200
+ config.bindings_override = @config.bindings_override
201
+ config.logger = @policy_based_routing_service_stub.logger if config.respond_to? :logger=
202
+ end
203
+ end
204
+
205
+ ##
206
+ # Get the associated client for long-running operations.
207
+ #
208
+ # @return [::Google::Cloud::NetworkConnectivity::V1beta::PolicyBasedRoutingService::Rest::Operations]
209
+ #
210
+ attr_reader :operations_client
211
+
212
+ ##
213
+ # Get the associated client for mix-in of the Locations.
214
+ #
215
+ # @return [Google::Cloud::Location::Locations::Rest::Client]
216
+ #
217
+ attr_reader :location_client
218
+
219
+ ##
220
+ # Get the associated client for mix-in of the IAMPolicy.
221
+ #
222
+ # @return [Google::Iam::V1::IAMPolicy::Rest::Client]
223
+ #
224
+ attr_reader :iam_policy_client
225
+
226
+ ##
227
+ # The logger used for request/response debug logging.
228
+ #
229
+ # @return [Logger]
230
+ #
231
+ def logger
232
+ @policy_based_routing_service_stub.logger
233
+ end
234
+
235
+ # Service calls
236
+
237
+ ##
238
+ # Lists policy-based routes in a given project and location.
239
+ #
240
+ # @overload list_policy_based_routes(request, options = nil)
241
+ # Pass arguments to `list_policy_based_routes` via a request object, either of type
242
+ # {::Google::Cloud::NetworkConnectivity::V1beta::ListPolicyBasedRoutesRequest} or an equivalent Hash.
243
+ #
244
+ # @param request [::Google::Cloud::NetworkConnectivity::V1beta::ListPolicyBasedRoutesRequest, ::Hash]
245
+ # A request object representing the call parameters. Required. To specify no
246
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
247
+ # @param options [::Gapic::CallOptions, ::Hash]
248
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
249
+ #
250
+ # @overload list_policy_based_routes(parent: nil, page_size: nil, page_token: nil, filter: nil, order_by: nil)
251
+ # Pass arguments to `list_policy_based_routes` via keyword arguments. Note that at
252
+ # least one keyword argument is required. To specify no parameters, or to keep all
253
+ # the default parameter values, pass an empty Hash as a request object (see above).
254
+ #
255
+ # @param parent [::String]
256
+ # Required. The parent resource's name.
257
+ # @param page_size [::Integer]
258
+ # The maximum number of results per page that should be returned.
259
+ # @param page_token [::String]
260
+ # The page token.
261
+ # @param filter [::String]
262
+ # A filter expression that filters the results listed in the response.
263
+ # @param order_by [::String]
264
+ # Sort the results by a certain order.
265
+ # @yield [result, operation] Access the result along with the TransportOperation object
266
+ # @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::NetworkConnectivity::V1beta::PolicyBasedRoute>]
267
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
268
+ #
269
+ # @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::NetworkConnectivity::V1beta::PolicyBasedRoute>]
270
+ #
271
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
272
+ #
273
+ # @example Basic example
274
+ # require "google/cloud/network_connectivity/v1beta"
275
+ #
276
+ # # Create a client object. The client can be reused for multiple calls.
277
+ # client = Google::Cloud::NetworkConnectivity::V1beta::PolicyBasedRoutingService::Rest::Client.new
278
+ #
279
+ # # Create a request. To set request fields, pass in keyword arguments.
280
+ # request = Google::Cloud::NetworkConnectivity::V1beta::ListPolicyBasedRoutesRequest.new
281
+ #
282
+ # # Call the list_policy_based_routes method.
283
+ # result = client.list_policy_based_routes request
284
+ #
285
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
286
+ # # over elements, and API calls will be issued to fetch pages as needed.
287
+ # result.each do |item|
288
+ # # Each element is of type ::Google::Cloud::NetworkConnectivity::V1beta::PolicyBasedRoute.
289
+ # p item
290
+ # end
291
+ #
292
+ def list_policy_based_routes request, options = nil
293
+ raise ::ArgumentError, "request must be provided" if request.nil?
294
+
295
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::NetworkConnectivity::V1beta::ListPolicyBasedRoutesRequest
296
+
297
+ # Converts hash and nil to an options object
298
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
299
+
300
+ # Customize the options with defaults
301
+ call_metadata = @config.rpcs.list_policy_based_routes.metadata.to_h
302
+
303
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
304
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
305
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
306
+ gapic_version: ::Google::Cloud::NetworkConnectivity::V1beta::VERSION,
307
+ transports_version_send: [:rest]
308
+
309
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
310
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
311
+
312
+ options.apply_defaults timeout: @config.rpcs.list_policy_based_routes.timeout,
313
+ metadata: call_metadata,
314
+ retry_policy: @config.rpcs.list_policy_based_routes.retry_policy
315
+
316
+ options.apply_defaults timeout: @config.timeout,
317
+ metadata: @config.metadata,
318
+ retry_policy: @config.retry_policy
319
+
320
+ @policy_based_routing_service_stub.list_policy_based_routes request, options do |result, operation|
321
+ result = ::Gapic::Rest::PagedEnumerable.new @policy_based_routing_service_stub, :list_policy_based_routes, "policy_based_routes", request, result, options
322
+ yield result, operation if block_given?
323
+ throw :response, result
324
+ end
325
+ rescue ::Gapic::Rest::Error => e
326
+ raise ::Google::Cloud::Error.from_error(e)
327
+ end
328
+
329
+ ##
330
+ # Gets details of a single policy-based route.
331
+ #
332
+ # @overload get_policy_based_route(request, options = nil)
333
+ # Pass arguments to `get_policy_based_route` via a request object, either of type
334
+ # {::Google::Cloud::NetworkConnectivity::V1beta::GetPolicyBasedRouteRequest} or an equivalent Hash.
335
+ #
336
+ # @param request [::Google::Cloud::NetworkConnectivity::V1beta::GetPolicyBasedRouteRequest, ::Hash]
337
+ # A request object representing the call parameters. Required. To specify no
338
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
339
+ # @param options [::Gapic::CallOptions, ::Hash]
340
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
341
+ #
342
+ # @overload get_policy_based_route(name: nil)
343
+ # Pass arguments to `get_policy_based_route` via keyword arguments. Note that at
344
+ # least one keyword argument is required. To specify no parameters, or to keep all
345
+ # the default parameter values, pass an empty Hash as a request object (see above).
346
+ #
347
+ # @param name [::String]
348
+ # Required. Name of the PolicyBasedRoute resource to get.
349
+ # @yield [result, operation] Access the result along with the TransportOperation object
350
+ # @yieldparam result [::Google::Cloud::NetworkConnectivity::V1beta::PolicyBasedRoute]
351
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
352
+ #
353
+ # @return [::Google::Cloud::NetworkConnectivity::V1beta::PolicyBasedRoute]
354
+ #
355
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
356
+ #
357
+ # @example Basic example
358
+ # require "google/cloud/network_connectivity/v1beta"
359
+ #
360
+ # # Create a client object. The client can be reused for multiple calls.
361
+ # client = Google::Cloud::NetworkConnectivity::V1beta::PolicyBasedRoutingService::Rest::Client.new
362
+ #
363
+ # # Create a request. To set request fields, pass in keyword arguments.
364
+ # request = Google::Cloud::NetworkConnectivity::V1beta::GetPolicyBasedRouteRequest.new
365
+ #
366
+ # # Call the get_policy_based_route method.
367
+ # result = client.get_policy_based_route request
368
+ #
369
+ # # The returned object is of type Google::Cloud::NetworkConnectivity::V1beta::PolicyBasedRoute.
370
+ # p result
371
+ #
372
+ def get_policy_based_route request, options = nil
373
+ raise ::ArgumentError, "request must be provided" if request.nil?
374
+
375
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::NetworkConnectivity::V1beta::GetPolicyBasedRouteRequest
376
+
377
+ # Converts hash and nil to an options object
378
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
379
+
380
+ # Customize the options with defaults
381
+ call_metadata = @config.rpcs.get_policy_based_route.metadata.to_h
382
+
383
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
384
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
385
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
386
+ gapic_version: ::Google::Cloud::NetworkConnectivity::V1beta::VERSION,
387
+ transports_version_send: [:rest]
388
+
389
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
390
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
391
+
392
+ options.apply_defaults timeout: @config.rpcs.get_policy_based_route.timeout,
393
+ metadata: call_metadata,
394
+ retry_policy: @config.rpcs.get_policy_based_route.retry_policy
395
+
396
+ options.apply_defaults timeout: @config.timeout,
397
+ metadata: @config.metadata,
398
+ retry_policy: @config.retry_policy
399
+
400
+ @policy_based_routing_service_stub.get_policy_based_route request, options do |result, operation|
401
+ yield result, operation if block_given?
402
+ end
403
+ rescue ::Gapic::Rest::Error => e
404
+ raise ::Google::Cloud::Error.from_error(e)
405
+ end
406
+
407
+ ##
408
+ # Creates a new policy-based route in a given project and location.
409
+ #
410
+ # @overload create_policy_based_route(request, options = nil)
411
+ # Pass arguments to `create_policy_based_route` via a request object, either of type
412
+ # {::Google::Cloud::NetworkConnectivity::V1beta::CreatePolicyBasedRouteRequest} or an equivalent Hash.
413
+ #
414
+ # @param request [::Google::Cloud::NetworkConnectivity::V1beta::CreatePolicyBasedRouteRequest, ::Hash]
415
+ # A request object representing the call parameters. Required. To specify no
416
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
417
+ # @param options [::Gapic::CallOptions, ::Hash]
418
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
419
+ #
420
+ # @overload create_policy_based_route(parent: nil, policy_based_route_id: nil, policy_based_route: nil, request_id: nil)
421
+ # Pass arguments to `create_policy_based_route` via keyword arguments. Note that at
422
+ # least one keyword argument is required. To specify no parameters, or to keep all
423
+ # the default parameter values, pass an empty Hash as a request object (see above).
424
+ #
425
+ # @param parent [::String]
426
+ # Required. The parent resource's name of the PolicyBasedRoute.
427
+ # @param policy_based_route_id [::String]
428
+ # Required. Unique id for the policy-based route to create. Provided by the
429
+ # client when the resource is created. The name must comply with
430
+ # https://google.aip.dev/122#resource-id-segments. Specifically, the name
431
+ # must be 1-63 characters long and match the regular expression
432
+ # [a-z]([a-z0-9-]*[a-z0-9])?. The first character must be a lowercase letter,
433
+ # and all following characters (except for the last character) must be a
434
+ # dash, lowercase letter, or digit. The last character must be a lowercase
435
+ # letter or digit.
436
+ # @param policy_based_route [::Google::Cloud::NetworkConnectivity::V1beta::PolicyBasedRoute, ::Hash]
437
+ # Required. Initial values for a new policy-based route.
438
+ # @param request_id [::String]
439
+ # Optional. An optional request ID to identify requests. Specify a unique
440
+ # request ID so that if you must retry your request, the server knows to
441
+ # ignore the request if it has already been completed. The server guarantees
442
+ # that for at least 60 minutes since the first request.
443
+ #
444
+ # For example, consider a situation where you make an initial request and
445
+ # the request times out. If you make the request again with the same request
446
+ # ID, the server can check if original operation with the same request ID
447
+ # was received, and if so, ignores the second request. This prevents clients
448
+ # from accidentally creating duplicate commitments.
449
+ #
450
+ # The request ID must be a valid UUID with the exception that zero UUID is
451
+ # not supported (00000000-0000-0000-0000-000000000000).
452
+ # @yield [result, operation] Access the result along with the TransportOperation object
453
+ # @yieldparam result [::Gapic::Operation]
454
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
455
+ #
456
+ # @return [::Gapic::Operation]
457
+ #
458
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
459
+ #
460
+ # @example Basic example
461
+ # require "google/cloud/network_connectivity/v1beta"
462
+ #
463
+ # # Create a client object. The client can be reused for multiple calls.
464
+ # client = Google::Cloud::NetworkConnectivity::V1beta::PolicyBasedRoutingService::Rest::Client.new
465
+ #
466
+ # # Create a request. To set request fields, pass in keyword arguments.
467
+ # request = Google::Cloud::NetworkConnectivity::V1beta::CreatePolicyBasedRouteRequest.new
468
+ #
469
+ # # Call the create_policy_based_route method.
470
+ # result = client.create_policy_based_route request
471
+ #
472
+ # # The returned object is of type Gapic::Operation. You can use it to
473
+ # # check the status of an operation, cancel it, or wait for results.
474
+ # # Here is how to wait for a response.
475
+ # result.wait_until_done! timeout: 60
476
+ # if result.response?
477
+ # p result.response
478
+ # else
479
+ # puts "No response received."
480
+ # end
481
+ #
482
+ def create_policy_based_route request, options = nil
483
+ raise ::ArgumentError, "request must be provided" if request.nil?
484
+
485
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::NetworkConnectivity::V1beta::CreatePolicyBasedRouteRequest
486
+
487
+ # Converts hash and nil to an options object
488
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
489
+
490
+ # Customize the options with defaults
491
+ call_metadata = @config.rpcs.create_policy_based_route.metadata.to_h
492
+
493
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
494
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
495
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
496
+ gapic_version: ::Google::Cloud::NetworkConnectivity::V1beta::VERSION,
497
+ transports_version_send: [:rest]
498
+
499
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
500
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
501
+
502
+ options.apply_defaults timeout: @config.rpcs.create_policy_based_route.timeout,
503
+ metadata: call_metadata,
504
+ retry_policy: @config.rpcs.create_policy_based_route.retry_policy
505
+
506
+ options.apply_defaults timeout: @config.timeout,
507
+ metadata: @config.metadata,
508
+ retry_policy: @config.retry_policy
509
+
510
+ @policy_based_routing_service_stub.create_policy_based_route request, options do |result, operation|
511
+ result = ::Gapic::Operation.new result, @operations_client, options: options
512
+ yield result, operation if block_given?
513
+ throw :response, result
514
+ end
515
+ rescue ::Gapic::Rest::Error => e
516
+ raise ::Google::Cloud::Error.from_error(e)
517
+ end
518
+
519
+ ##
520
+ # Deletes a single policy-based route.
521
+ #
522
+ # @overload delete_policy_based_route(request, options = nil)
523
+ # Pass arguments to `delete_policy_based_route` via a request object, either of type
524
+ # {::Google::Cloud::NetworkConnectivity::V1beta::DeletePolicyBasedRouteRequest} or an equivalent Hash.
525
+ #
526
+ # @param request [::Google::Cloud::NetworkConnectivity::V1beta::DeletePolicyBasedRouteRequest, ::Hash]
527
+ # A request object representing the call parameters. Required. To specify no
528
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
529
+ # @param options [::Gapic::CallOptions, ::Hash]
530
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
531
+ #
532
+ # @overload delete_policy_based_route(name: nil, request_id: nil)
533
+ # Pass arguments to `delete_policy_based_route` via keyword arguments. Note that at
534
+ # least one keyword argument is required. To specify no parameters, or to keep all
535
+ # the default parameter values, pass an empty Hash as a request object (see above).
536
+ #
537
+ # @param name [::String]
538
+ # Required. Name of the policy-based route resource to delete.
539
+ # @param request_id [::String]
540
+ # Optional. An optional request ID to identify requests. Specify a unique
541
+ # request ID so that if you must retry your request, the server knows to
542
+ # ignore the request if it has already been completed. The server guarantees
543
+ # that for at least 60 minutes after the first request.
544
+ #
545
+ # For example, consider a situation where you make an initial request and
546
+ # the request times out. If you make the request again with the same request
547
+ # ID, the server can check if original operation with the same request ID
548
+ # was received, and if so, ignores the second request. This prevents clients
549
+ # from accidentally creating duplicate commitments.
550
+ #
551
+ # The request ID must be a valid UUID with the exception that zero UUID is
552
+ # not supported (00000000-0000-0000-0000-000000000000).
553
+ # @yield [result, operation] Access the result along with the TransportOperation object
554
+ # @yieldparam result [::Gapic::Operation]
555
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
556
+ #
557
+ # @return [::Gapic::Operation]
558
+ #
559
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
560
+ #
561
+ # @example Basic example
562
+ # require "google/cloud/network_connectivity/v1beta"
563
+ #
564
+ # # Create a client object. The client can be reused for multiple calls.
565
+ # client = Google::Cloud::NetworkConnectivity::V1beta::PolicyBasedRoutingService::Rest::Client.new
566
+ #
567
+ # # Create a request. To set request fields, pass in keyword arguments.
568
+ # request = Google::Cloud::NetworkConnectivity::V1beta::DeletePolicyBasedRouteRequest.new
569
+ #
570
+ # # Call the delete_policy_based_route method.
571
+ # result = client.delete_policy_based_route request
572
+ #
573
+ # # The returned object is of type Gapic::Operation. You can use it to
574
+ # # check the status of an operation, cancel it, or wait for results.
575
+ # # Here is how to wait for a response.
576
+ # result.wait_until_done! timeout: 60
577
+ # if result.response?
578
+ # p result.response
579
+ # else
580
+ # puts "No response received."
581
+ # end
582
+ #
583
+ def delete_policy_based_route request, options = nil
584
+ raise ::ArgumentError, "request must be provided" if request.nil?
585
+
586
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::NetworkConnectivity::V1beta::DeletePolicyBasedRouteRequest
587
+
588
+ # Converts hash and nil to an options object
589
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
590
+
591
+ # Customize the options with defaults
592
+ call_metadata = @config.rpcs.delete_policy_based_route.metadata.to_h
593
+
594
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
595
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
596
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
597
+ gapic_version: ::Google::Cloud::NetworkConnectivity::V1beta::VERSION,
598
+ transports_version_send: [:rest]
599
+
600
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
601
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
602
+
603
+ options.apply_defaults timeout: @config.rpcs.delete_policy_based_route.timeout,
604
+ metadata: call_metadata,
605
+ retry_policy: @config.rpcs.delete_policy_based_route.retry_policy
606
+
607
+ options.apply_defaults timeout: @config.timeout,
608
+ metadata: @config.metadata,
609
+ retry_policy: @config.retry_policy
610
+
611
+ @policy_based_routing_service_stub.delete_policy_based_route request, options do |result, operation|
612
+ result = ::Gapic::Operation.new result, @operations_client, options: options
613
+ yield result, operation if block_given?
614
+ throw :response, result
615
+ end
616
+ rescue ::Gapic::Rest::Error => e
617
+ raise ::Google::Cloud::Error.from_error(e)
618
+ end
619
+
620
+ ##
621
+ # Configuration class for the PolicyBasedRoutingService REST API.
622
+ #
623
+ # This class represents the configuration for PolicyBasedRoutingService REST,
624
+ # providing control over timeouts, retry behavior, logging, transport
625
+ # parameters, and other low-level controls. Certain parameters can also be
626
+ # applied individually to specific RPCs. See
627
+ # {::Google::Cloud::NetworkConnectivity::V1beta::PolicyBasedRoutingService::Rest::Client::Configuration::Rpcs}
628
+ # for a list of RPCs that can be configured independently.
629
+ #
630
+ # Configuration can be applied globally to all clients, or to a single client
631
+ # on construction.
632
+ #
633
+ # @example
634
+ #
635
+ # # Modify the global config, setting the timeout for
636
+ # # list_policy_based_routes to 20 seconds,
637
+ # # and all remaining timeouts to 10 seconds.
638
+ # ::Google::Cloud::NetworkConnectivity::V1beta::PolicyBasedRoutingService::Rest::Client.configure do |config|
639
+ # config.timeout = 10.0
640
+ # config.rpcs.list_policy_based_routes.timeout = 20.0
641
+ # end
642
+ #
643
+ # # Apply the above configuration only to a new client.
644
+ # client = ::Google::Cloud::NetworkConnectivity::V1beta::PolicyBasedRoutingService::Rest::Client.new do |config|
645
+ # config.timeout = 10.0
646
+ # config.rpcs.list_policy_based_routes.timeout = 20.0
647
+ # end
648
+ #
649
+ # @!attribute [rw] endpoint
650
+ # A custom service endpoint, as a hostname or hostname:port. The default is
651
+ # nil, indicating to use the default endpoint in the current universe domain.
652
+ # @return [::String,nil]
653
+ # @!attribute [rw] credentials
654
+ # Credentials to send with calls. You may provide any of the following types:
655
+ # * (`String`) The path to a service account key file in JSON format
656
+ # * (`Hash`) A service account key as a Hash
657
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
658
+ # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
659
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
660
+ # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
661
+ # * (`nil`) indicating no credentials
662
+ #
663
+ # Warning: If you accept a credential configuration (JSON file or Hash) from an
664
+ # external source for authentication to Google Cloud, you must validate it before
665
+ # providing it to a Google API client library. Providing an unvalidated credential
666
+ # configuration to Google APIs can compromise the security of your systems and data.
667
+ # For more information, refer to [Validate credential configurations from external
668
+ # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
669
+ # @return [::Object]
670
+ # @!attribute [rw] scope
671
+ # The OAuth scopes
672
+ # @return [::Array<::String>]
673
+ # @!attribute [rw] lib_name
674
+ # The library name as recorded in instrumentation and logging
675
+ # @return [::String]
676
+ # @!attribute [rw] lib_version
677
+ # The library version as recorded in instrumentation and logging
678
+ # @return [::String]
679
+ # @!attribute [rw] timeout
680
+ # The call timeout in seconds.
681
+ # @return [::Numeric]
682
+ # @!attribute [rw] metadata
683
+ # Additional headers to be sent with the call.
684
+ # @return [::Hash{::Symbol=>::String}]
685
+ # @!attribute [rw] retry_policy
686
+ # The retry policy. The value is a hash with the following keys:
687
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
688
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
689
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
690
+ # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0.
691
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
692
+ # trigger a retry.
693
+ # @return [::Hash]
694
+ # @!attribute [rw] quota_project
695
+ # A separate project against which to charge quota.
696
+ # @return [::String]
697
+ # @!attribute [rw] universe_domain
698
+ # The universe domain within which to make requests. This determines the
699
+ # default endpoint URL. The default value of nil uses the environment
700
+ # universe (usually the default "googleapis.com" universe).
701
+ # @return [::String,nil]
702
+ # @!attribute [rw] logger
703
+ # A custom logger to use for request/response debug logging, or the value
704
+ # `:default` (the default) to construct a default logger, or `nil` to
705
+ # explicitly disable logging.
706
+ # @return [::Logger,:default,nil]
707
+ #
708
+ class Configuration
709
+ extend ::Gapic::Config
710
+
711
+ # @private
712
+ # The endpoint specific to the default "googleapis.com" universe. Deprecated.
713
+ DEFAULT_ENDPOINT = "networkconnectivity.googleapis.com"
714
+
715
+ config_attr :endpoint, nil, ::String, nil
716
+ config_attr :credentials, nil do |value|
717
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Google::Auth::BaseClient, ::Signet::OAuth2::Client, nil]
718
+ allowed.any? { |klass| klass === value }
719
+ end
720
+ config_attr :scope, nil, ::String, ::Array, nil
721
+ config_attr :lib_name, nil, ::String, nil
722
+ config_attr :lib_version, nil, ::String, nil
723
+ config_attr :timeout, nil, ::Numeric, nil
724
+ config_attr :metadata, nil, ::Hash, nil
725
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
726
+ config_attr :quota_project, nil, ::String, nil
727
+ config_attr :universe_domain, nil, ::String, nil
728
+
729
+ # @private
730
+ # Overrides for http bindings for the RPCs of this service
731
+ # are only used when this service is used as mixin, and only
732
+ # by the host service.
733
+ # @return [::Hash{::Symbol=>::Array<::Gapic::Rest::GrpcTranscoder::HttpBinding>}]
734
+ config_attr :bindings_override, {}, ::Hash, nil
735
+ config_attr :logger, :default, ::Logger, nil, :default
736
+
737
+ # @private
738
+ def initialize parent_config = nil
739
+ @parent_config = parent_config unless parent_config.nil?
740
+
741
+ yield self if block_given?
742
+ end
743
+
744
+ ##
745
+ # Configurations for individual RPCs
746
+ # @return [Rpcs]
747
+ #
748
+ def rpcs
749
+ @rpcs ||= begin
750
+ parent_rpcs = nil
751
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
752
+ Rpcs.new parent_rpcs
753
+ end
754
+ end
755
+
756
+ ##
757
+ # Configuration RPC class for the PolicyBasedRoutingService API.
758
+ #
759
+ # Includes fields providing the configuration for each RPC in this service.
760
+ # Each configuration object is of type `Gapic::Config::Method` and includes
761
+ # the following configuration fields:
762
+ #
763
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
764
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers
765
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
766
+ # include the following keys:
767
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
768
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
769
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
770
+ # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0.
771
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
772
+ # trigger a retry.
773
+ #
774
+ class Rpcs
775
+ ##
776
+ # RPC-specific configuration for `list_policy_based_routes`
777
+ # @return [::Gapic::Config::Method]
778
+ #
779
+ attr_reader :list_policy_based_routes
780
+ ##
781
+ # RPC-specific configuration for `get_policy_based_route`
782
+ # @return [::Gapic::Config::Method]
783
+ #
784
+ attr_reader :get_policy_based_route
785
+ ##
786
+ # RPC-specific configuration for `create_policy_based_route`
787
+ # @return [::Gapic::Config::Method]
788
+ #
789
+ attr_reader :create_policy_based_route
790
+ ##
791
+ # RPC-specific configuration for `delete_policy_based_route`
792
+ # @return [::Gapic::Config::Method]
793
+ #
794
+ attr_reader :delete_policy_based_route
795
+
796
+ # @private
797
+ def initialize parent_rpcs = nil
798
+ list_policy_based_routes_config = parent_rpcs.list_policy_based_routes if parent_rpcs.respond_to? :list_policy_based_routes
799
+ @list_policy_based_routes = ::Gapic::Config::Method.new list_policy_based_routes_config
800
+ get_policy_based_route_config = parent_rpcs.get_policy_based_route if parent_rpcs.respond_to? :get_policy_based_route
801
+ @get_policy_based_route = ::Gapic::Config::Method.new get_policy_based_route_config
802
+ create_policy_based_route_config = parent_rpcs.create_policy_based_route if parent_rpcs.respond_to? :create_policy_based_route
803
+ @create_policy_based_route = ::Gapic::Config::Method.new create_policy_based_route_config
804
+ delete_policy_based_route_config = parent_rpcs.delete_policy_based_route if parent_rpcs.respond_to? :delete_policy_based_route
805
+ @delete_policy_based_route = ::Gapic::Config::Method.new delete_policy_based_route_config
806
+
807
+ yield self if block_given?
808
+ end
809
+ end
810
+ end
811
+ end
812
+ end
813
+ end
814
+ end
815
+ end
816
+ end
817
+ end