google-cloud-network_connectivity-v1beta 0.a → 0.1.0

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