google-cloud-network_management-v1 0.3.0 → 0.5.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.
@@ -0,0 +1,795 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2023 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/networkmanagement/v1/reachability_pb"
21
+ require "google/cloud/network_management/v1/reachability_service/rest/service_stub"
22
+
23
+ module Google
24
+ module Cloud
25
+ module NetworkManagement
26
+ module V1
27
+ module ReachabilityService
28
+ module Rest
29
+ ##
30
+ # REST client for the ReachabilityService service.
31
+ #
32
+ # The Reachability service in the Google Cloud Network Management API provides
33
+ # services that analyze the reachability within a single Google Virtual Private
34
+ # Cloud (VPC) network, between peered VPC networks, between VPC and on-premises
35
+ # networks, or between VPC networks and internet hosts. A reachability analysis
36
+ # is based on Google Cloud network configurations.
37
+ #
38
+ # You can use the analysis results to verify these configurations and
39
+ # to troubleshoot connectivity issues.
40
+ #
41
+ class Client
42
+ include Paths
43
+
44
+ # @private
45
+ attr_reader :reachability_service_stub
46
+
47
+ ##
48
+ # Configure the ReachabilityService Client class.
49
+ #
50
+ # See {::Google::Cloud::NetworkManagement::V1::ReachabilityService::Rest::Client::Configuration}
51
+ # for a description of the configuration fields.
52
+ #
53
+ # @example
54
+ #
55
+ # # Modify the configuration for all ReachabilityService clients
56
+ # ::Google::Cloud::NetworkManagement::V1::ReachabilityService::Rest::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", "NetworkManagement", "V1"]
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
+
78
+ default_config
79
+ end
80
+ yield @configure if block_given?
81
+ @configure
82
+ end
83
+
84
+ ##
85
+ # Configure the ReachabilityService Client instance.
86
+ #
87
+ # The configuration is set to the derived mode, meaning that values can be changed,
88
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
89
+ # should be made on {Client.configure}.
90
+ #
91
+ # See {::Google::Cloud::NetworkManagement::V1::ReachabilityService::Rest::Client::Configuration}
92
+ # for a description of the configuration fields.
93
+ #
94
+ # @yield [config] Configure the Client client.
95
+ # @yieldparam config [Client::Configuration]
96
+ #
97
+ # @return [Client::Configuration]
98
+ #
99
+ def configure
100
+ yield @config if block_given?
101
+ @config
102
+ end
103
+
104
+ ##
105
+ # Create a new ReachabilityService REST client object.
106
+ #
107
+ # @example
108
+ #
109
+ # # Create a client using the default configuration
110
+ # client = ::Google::Cloud::NetworkManagement::V1::ReachabilityService::Rest::Client.new
111
+ #
112
+ # # Create a client using a custom configuration
113
+ # client = ::Google::Cloud::NetworkManagement::V1::ReachabilityService::Rest::Client.new do |config|
114
+ # config.timeout = 10.0
115
+ # end
116
+ #
117
+ # @yield [config] Configure the ReachabilityService client.
118
+ # @yieldparam config [Client::Configuration]
119
+ #
120
+ def initialize
121
+ # Create the configuration object
122
+ @config = Configuration.new Client.configure
123
+
124
+ # Yield the configuration if needed
125
+ yield @config if block_given?
126
+
127
+ # Create credentials
128
+ credentials = @config.credentials
129
+ # Use self-signed JWT if the endpoint is unchanged from default,
130
+ # but only if the default endpoint does not have a region prefix.
131
+ enable_self_signed_jwt = @config.endpoint == Client.configure.endpoint &&
132
+ !@config.endpoint.split(".").first.include?("-")
133
+ credentials ||= Credentials.default scope: @config.scope,
134
+ enable_self_signed_jwt: enable_self_signed_jwt
135
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
136
+ credentials = Credentials.new credentials, scope: @config.scope
137
+ end
138
+
139
+ @quota_project_id = @config.quota_project
140
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
141
+
142
+ @operations_client = ::Google::Cloud::NetworkManagement::V1::ReachabilityService::Rest::Operations.new do |config|
143
+ config.credentials = credentials
144
+ config.quota_project = @quota_project_id
145
+ config.endpoint = @config.endpoint
146
+ end
147
+
148
+ @reachability_service_stub = ::Google::Cloud::NetworkManagement::V1::ReachabilityService::Rest::ServiceStub.new endpoint: @config.endpoint, credentials: credentials
149
+ end
150
+
151
+ ##
152
+ # Get the associated client for long-running operations.
153
+ #
154
+ # @return [::Google::Cloud::NetworkManagement::V1::ReachabilityService::Rest::Operations]
155
+ #
156
+ attr_reader :operations_client
157
+
158
+ # Service calls
159
+
160
+ ##
161
+ # Lists all Connectivity Tests owned by a project.
162
+ #
163
+ # @overload list_connectivity_tests(request, options = nil)
164
+ # Pass arguments to `list_connectivity_tests` via a request object, either of type
165
+ # {::Google::Cloud::NetworkManagement::V1::ListConnectivityTestsRequest} or an equivalent Hash.
166
+ #
167
+ # @param request [::Google::Cloud::NetworkManagement::V1::ListConnectivityTestsRequest, ::Hash]
168
+ # A request object representing the call parameters. Required. To specify no
169
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
170
+ # @param options [::Gapic::CallOptions, ::Hash]
171
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
172
+ #
173
+ # @overload list_connectivity_tests(parent: nil, page_size: nil, page_token: nil, filter: nil, order_by: nil)
174
+ # Pass arguments to `list_connectivity_tests` via keyword arguments. Note that at
175
+ # least one keyword argument is required. To specify no parameters, or to keep all
176
+ # the default parameter values, pass an empty Hash as a request object (see above).
177
+ #
178
+ # @param parent [::String]
179
+ # Required. The parent resource of the Connectivity Tests:
180
+ # `projects/{project_id}/locations/global`
181
+ # @param page_size [::Integer]
182
+ # Number of `ConnectivityTests` to return.
183
+ # @param page_token [::String]
184
+ # Page token from an earlier query, as returned in `next_page_token`.
185
+ # @param filter [::String]
186
+ # Lists the `ConnectivityTests` that match the filter expression. A filter
187
+ # expression filters the resources listed in the response. The expression
188
+ # must be of the form `<field> <operator> <value>` where operators: `<`, `>`,
189
+ # `<=`,
190
+ # `>=`,
191
+ # `!=`, `=`, `:` are supported (colon `:` represents a HAS operator which is
192
+ # roughly synonymous with equality). <field> can refer to a proto or JSON
193
+ # field, or a synthetic field. Field names can be camelCase or snake_case.
194
+ #
195
+ # Examples:
196
+ # - Filter by name:
197
+ # name = "projects/proj-1/locations/global/connectivityTests/test-1
198
+ #
199
+ # - Filter by labels:
200
+ # - Resources that have a key called `foo`
201
+ # labels.foo:*
202
+ # - Resources that have a key called `foo` whose value is `bar`
203
+ # labels.foo = bar
204
+ # @param order_by [::String]
205
+ # Field to use to sort the list.
206
+ # @yield [result, operation] Access the result along with the TransportOperation object
207
+ # @yieldparam result [::Google::Cloud::NetworkManagement::V1::ListConnectivityTestsResponse]
208
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
209
+ #
210
+ # @return [::Google::Cloud::NetworkManagement::V1::ListConnectivityTestsResponse]
211
+ #
212
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
213
+ def list_connectivity_tests request, options = nil
214
+ raise ::ArgumentError, "request must be provided" if request.nil?
215
+
216
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::NetworkManagement::V1::ListConnectivityTestsRequest
217
+
218
+ # Converts hash and nil to an options object
219
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
220
+
221
+ # Customize the options with defaults
222
+ call_metadata = @config.rpcs.list_connectivity_tests.metadata.to_h
223
+
224
+ # Set x-goog-api-client and x-goog-user-project headers
225
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
226
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
227
+ gapic_version: ::Google::Cloud::NetworkManagement::V1::VERSION,
228
+ transports_version_send: [:rest]
229
+
230
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
231
+
232
+ options.apply_defaults timeout: @config.rpcs.list_connectivity_tests.timeout,
233
+ metadata: call_metadata,
234
+ retry_policy: @config.rpcs.list_connectivity_tests.retry_policy
235
+
236
+ options.apply_defaults timeout: @config.timeout,
237
+ metadata: @config.metadata,
238
+ retry_policy: @config.retry_policy
239
+
240
+ @reachability_service_stub.list_connectivity_tests request, options do |result, operation|
241
+ yield result, operation if block_given?
242
+ return result
243
+ end
244
+ rescue ::Gapic::Rest::Error => e
245
+ raise ::Google::Cloud::Error.from_error(e)
246
+ end
247
+
248
+ ##
249
+ # Gets the details of a specific Connectivity Test.
250
+ #
251
+ # @overload get_connectivity_test(request, options = nil)
252
+ # Pass arguments to `get_connectivity_test` via a request object, either of type
253
+ # {::Google::Cloud::NetworkManagement::V1::GetConnectivityTestRequest} or an equivalent Hash.
254
+ #
255
+ # @param request [::Google::Cloud::NetworkManagement::V1::GetConnectivityTestRequest, ::Hash]
256
+ # A request object representing the call parameters. Required. To specify no
257
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
258
+ # @param options [::Gapic::CallOptions, ::Hash]
259
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
260
+ #
261
+ # @overload get_connectivity_test(name: nil)
262
+ # Pass arguments to `get_connectivity_test` via keyword arguments. Note that at
263
+ # least one keyword argument is required. To specify no parameters, or to keep all
264
+ # the default parameter values, pass an empty Hash as a request object (see above).
265
+ #
266
+ # @param name [::String]
267
+ # Required. `ConnectivityTest` resource name using the form:
268
+ # `projects/{project_id}/locations/global/connectivityTests/{test_id}`
269
+ # @yield [result, operation] Access the result along with the TransportOperation object
270
+ # @yieldparam result [::Google::Cloud::NetworkManagement::V1::ConnectivityTest]
271
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
272
+ #
273
+ # @return [::Google::Cloud::NetworkManagement::V1::ConnectivityTest]
274
+ #
275
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
276
+ def get_connectivity_test request, options = nil
277
+ raise ::ArgumentError, "request must be provided" if request.nil?
278
+
279
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::NetworkManagement::V1::GetConnectivityTestRequest
280
+
281
+ # Converts hash and nil to an options object
282
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
283
+
284
+ # Customize the options with defaults
285
+ call_metadata = @config.rpcs.get_connectivity_test.metadata.to_h
286
+
287
+ # Set x-goog-api-client and x-goog-user-project headers
288
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
289
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
290
+ gapic_version: ::Google::Cloud::NetworkManagement::V1::VERSION,
291
+ transports_version_send: [:rest]
292
+
293
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
294
+
295
+ options.apply_defaults timeout: @config.rpcs.get_connectivity_test.timeout,
296
+ metadata: call_metadata,
297
+ retry_policy: @config.rpcs.get_connectivity_test.retry_policy
298
+
299
+ options.apply_defaults timeout: @config.timeout,
300
+ metadata: @config.metadata,
301
+ retry_policy: @config.retry_policy
302
+
303
+ @reachability_service_stub.get_connectivity_test request, options do |result, operation|
304
+ yield result, operation if block_given?
305
+ return result
306
+ end
307
+ rescue ::Gapic::Rest::Error => e
308
+ raise ::Google::Cloud::Error.from_error(e)
309
+ end
310
+
311
+ ##
312
+ # Creates a new Connectivity Test.
313
+ # After you create a test, the reachability analysis is performed as part
314
+ # of the long running operation, which completes when the analysis completes.
315
+ #
316
+ # If the endpoint specifications in `ConnectivityTest` are invalid
317
+ # (for example, containing non-existent resources in the network, or you
318
+ # don't have read permissions to the network configurations of listed
319
+ # projects), then the reachability result returns a value of `UNKNOWN`.
320
+ #
321
+ # If the endpoint specifications in `ConnectivityTest` are
322
+ # incomplete, the reachability result returns a value of
323
+ # <code>AMBIGUOUS</code>. For more information,
324
+ # see the Connectivity Test documentation.
325
+ #
326
+ # @overload create_connectivity_test(request, options = nil)
327
+ # Pass arguments to `create_connectivity_test` via a request object, either of type
328
+ # {::Google::Cloud::NetworkManagement::V1::CreateConnectivityTestRequest} or an equivalent Hash.
329
+ #
330
+ # @param request [::Google::Cloud::NetworkManagement::V1::CreateConnectivityTestRequest, ::Hash]
331
+ # A request object representing the call parameters. Required. To specify no
332
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
333
+ # @param options [::Gapic::CallOptions, ::Hash]
334
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
335
+ #
336
+ # @overload create_connectivity_test(parent: nil, test_id: nil, resource: nil)
337
+ # Pass arguments to `create_connectivity_test` via keyword arguments. Note that at
338
+ # least one keyword argument is required. To specify no parameters, or to keep all
339
+ # the default parameter values, pass an empty Hash as a request object (see above).
340
+ #
341
+ # @param parent [::String]
342
+ # Required. The parent resource of the Connectivity Test to create:
343
+ # `projects/{project_id}/locations/global`
344
+ # @param test_id [::String]
345
+ # Required. The logical name of the Connectivity Test in your project
346
+ # with the following restrictions:
347
+ #
348
+ # * Must contain only lowercase letters, numbers, and hyphens.
349
+ # * Must start with a letter.
350
+ # * Must be between 1-40 characters.
351
+ # * Must end with a number or a letter.
352
+ # * Must be unique within the customer project
353
+ # @param resource [::Google::Cloud::NetworkManagement::V1::ConnectivityTest, ::Hash]
354
+ # Required. A `ConnectivityTest` resource
355
+ # @yield [result, operation] Access the result along with the TransportOperation object
356
+ # @yieldparam result [::Gapic::Operation]
357
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
358
+ #
359
+ # @return [::Gapic::Operation]
360
+ #
361
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
362
+ def create_connectivity_test request, options = nil
363
+ raise ::ArgumentError, "request must be provided" if request.nil?
364
+
365
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::NetworkManagement::V1::CreateConnectivityTestRequest
366
+
367
+ # Converts hash and nil to an options object
368
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
369
+
370
+ # Customize the options with defaults
371
+ call_metadata = @config.rpcs.create_connectivity_test.metadata.to_h
372
+
373
+ # Set x-goog-api-client and x-goog-user-project headers
374
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
375
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
376
+ gapic_version: ::Google::Cloud::NetworkManagement::V1::VERSION,
377
+ transports_version_send: [:rest]
378
+
379
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
380
+
381
+ options.apply_defaults timeout: @config.rpcs.create_connectivity_test.timeout,
382
+ metadata: call_metadata,
383
+ retry_policy: @config.rpcs.create_connectivity_test.retry_policy
384
+
385
+ options.apply_defaults timeout: @config.timeout,
386
+ metadata: @config.metadata,
387
+ retry_policy: @config.retry_policy
388
+
389
+ @reachability_service_stub.create_connectivity_test request, options do |result, operation|
390
+ result = ::Gapic::Operation.new result, @operations_client, options: options
391
+ yield result, operation if block_given?
392
+ return result
393
+ end
394
+ rescue ::Gapic::Rest::Error => e
395
+ raise ::Google::Cloud::Error.from_error(e)
396
+ end
397
+
398
+ ##
399
+ # Updates the configuration of an existing `ConnectivityTest`.
400
+ # After you update a test, the reachability analysis is performed as part
401
+ # of the long running operation, which completes when the analysis completes.
402
+ # The Reachability state in the test resource is updated with the new result.
403
+ #
404
+ # If the endpoint specifications in `ConnectivityTest` are invalid
405
+ # (for example, they contain non-existent resources in the network, or the
406
+ # user does not have read permissions to the network configurations of
407
+ # listed projects), then the reachability result returns a value of
408
+ # <code>UNKNOWN</code>.
409
+ #
410
+ # If the endpoint specifications in `ConnectivityTest` are incomplete, the
411
+ # reachability result returns a value of `AMBIGUOUS`. See the documentation
412
+ # in `ConnectivityTest` for for more details.
413
+ #
414
+ # @overload update_connectivity_test(request, options = nil)
415
+ # Pass arguments to `update_connectivity_test` via a request object, either of type
416
+ # {::Google::Cloud::NetworkManagement::V1::UpdateConnectivityTestRequest} or an equivalent Hash.
417
+ #
418
+ # @param request [::Google::Cloud::NetworkManagement::V1::UpdateConnectivityTestRequest, ::Hash]
419
+ # A request object representing the call parameters. Required. To specify no
420
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
421
+ # @param options [::Gapic::CallOptions, ::Hash]
422
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
423
+ #
424
+ # @overload update_connectivity_test(update_mask: nil, resource: nil)
425
+ # Pass arguments to `update_connectivity_test` via keyword arguments. Note that at
426
+ # least one keyword argument is required. To specify no parameters, or to keep all
427
+ # the default parameter values, pass an empty Hash as a request object (see above).
428
+ #
429
+ # @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
430
+ # Required. Mask of fields to update. At least one path must be supplied in
431
+ # this field.
432
+ # @param resource [::Google::Cloud::NetworkManagement::V1::ConnectivityTest, ::Hash]
433
+ # Required. Only fields specified in update_mask are updated.
434
+ # @yield [result, operation] Access the result along with the TransportOperation object
435
+ # @yieldparam result [::Gapic::Operation]
436
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
437
+ #
438
+ # @return [::Gapic::Operation]
439
+ #
440
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
441
+ def update_connectivity_test request, options = nil
442
+ raise ::ArgumentError, "request must be provided" if request.nil?
443
+
444
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::NetworkManagement::V1::UpdateConnectivityTestRequest
445
+
446
+ # Converts hash and nil to an options object
447
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
448
+
449
+ # Customize the options with defaults
450
+ call_metadata = @config.rpcs.update_connectivity_test.metadata.to_h
451
+
452
+ # Set x-goog-api-client and x-goog-user-project headers
453
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
454
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
455
+ gapic_version: ::Google::Cloud::NetworkManagement::V1::VERSION,
456
+ transports_version_send: [:rest]
457
+
458
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
459
+
460
+ options.apply_defaults timeout: @config.rpcs.update_connectivity_test.timeout,
461
+ metadata: call_metadata,
462
+ retry_policy: @config.rpcs.update_connectivity_test.retry_policy
463
+
464
+ options.apply_defaults timeout: @config.timeout,
465
+ metadata: @config.metadata,
466
+ retry_policy: @config.retry_policy
467
+
468
+ @reachability_service_stub.update_connectivity_test request, options do |result, operation|
469
+ result = ::Gapic::Operation.new result, @operations_client, options: options
470
+ yield result, operation if block_given?
471
+ return result
472
+ end
473
+ rescue ::Gapic::Rest::Error => e
474
+ raise ::Google::Cloud::Error.from_error(e)
475
+ end
476
+
477
+ ##
478
+ # Rerun an existing `ConnectivityTest`.
479
+ # After the user triggers the rerun, the reachability analysis is performed
480
+ # as part of the long running operation, which completes when the analysis
481
+ # completes.
482
+ #
483
+ # Even though the test configuration remains the same, the reachability
484
+ # result may change due to underlying network configuration changes.
485
+ #
486
+ # If the endpoint specifications in `ConnectivityTest` become invalid (for
487
+ # example, specified resources are deleted in the network, or you lost
488
+ # read permissions to the network configurations of listed projects), then
489
+ # the reachability result returns a value of `UNKNOWN`.
490
+ #
491
+ # @overload rerun_connectivity_test(request, options = nil)
492
+ # Pass arguments to `rerun_connectivity_test` via a request object, either of type
493
+ # {::Google::Cloud::NetworkManagement::V1::RerunConnectivityTestRequest} or an equivalent Hash.
494
+ #
495
+ # @param request [::Google::Cloud::NetworkManagement::V1::RerunConnectivityTestRequest, ::Hash]
496
+ # A request object representing the call parameters. Required. To specify no
497
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
498
+ # @param options [::Gapic::CallOptions, ::Hash]
499
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
500
+ #
501
+ # @overload rerun_connectivity_test(name: nil)
502
+ # Pass arguments to `rerun_connectivity_test` via keyword arguments. Note that at
503
+ # least one keyword argument is required. To specify no parameters, or to keep all
504
+ # the default parameter values, pass an empty Hash as a request object (see above).
505
+ #
506
+ # @param name [::String]
507
+ # Required. Connectivity Test resource name using the form:
508
+ # `projects/{project_id}/locations/global/connectivityTests/{test_id}`
509
+ # @yield [result, operation] Access the result along with the TransportOperation object
510
+ # @yieldparam result [::Gapic::Operation]
511
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
512
+ #
513
+ # @return [::Gapic::Operation]
514
+ #
515
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
516
+ def rerun_connectivity_test request, options = nil
517
+ raise ::ArgumentError, "request must be provided" if request.nil?
518
+
519
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::NetworkManagement::V1::RerunConnectivityTestRequest
520
+
521
+ # Converts hash and nil to an options object
522
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
523
+
524
+ # Customize the options with defaults
525
+ call_metadata = @config.rpcs.rerun_connectivity_test.metadata.to_h
526
+
527
+ # Set x-goog-api-client and x-goog-user-project headers
528
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
529
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
530
+ gapic_version: ::Google::Cloud::NetworkManagement::V1::VERSION,
531
+ transports_version_send: [:rest]
532
+
533
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
534
+
535
+ options.apply_defaults timeout: @config.rpcs.rerun_connectivity_test.timeout,
536
+ metadata: call_metadata,
537
+ retry_policy: @config.rpcs.rerun_connectivity_test.retry_policy
538
+
539
+ options.apply_defaults timeout: @config.timeout,
540
+ metadata: @config.metadata,
541
+ retry_policy: @config.retry_policy
542
+
543
+ @reachability_service_stub.rerun_connectivity_test request, options do |result, operation|
544
+ result = ::Gapic::Operation.new result, @operations_client, options: options
545
+ yield result, operation if block_given?
546
+ return result
547
+ end
548
+ rescue ::Gapic::Rest::Error => e
549
+ raise ::Google::Cloud::Error.from_error(e)
550
+ end
551
+
552
+ ##
553
+ # Deletes a specific `ConnectivityTest`.
554
+ #
555
+ # @overload delete_connectivity_test(request, options = nil)
556
+ # Pass arguments to `delete_connectivity_test` via a request object, either of type
557
+ # {::Google::Cloud::NetworkManagement::V1::DeleteConnectivityTestRequest} or an equivalent Hash.
558
+ #
559
+ # @param request [::Google::Cloud::NetworkManagement::V1::DeleteConnectivityTestRequest, ::Hash]
560
+ # A request object representing the call parameters. Required. To specify no
561
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
562
+ # @param options [::Gapic::CallOptions, ::Hash]
563
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
564
+ #
565
+ # @overload delete_connectivity_test(name: nil)
566
+ # Pass arguments to `delete_connectivity_test` via keyword arguments. Note that at
567
+ # least one keyword argument is required. To specify no parameters, or to keep all
568
+ # the default parameter values, pass an empty Hash as a request object (see above).
569
+ #
570
+ # @param name [::String]
571
+ # Required. Connectivity Test resource name using the form:
572
+ # `projects/{project_id}/locations/global/connectivityTests/{test_id}`
573
+ # @yield [result, operation] Access the result along with the TransportOperation object
574
+ # @yieldparam result [::Gapic::Operation]
575
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
576
+ #
577
+ # @return [::Gapic::Operation]
578
+ #
579
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
580
+ def delete_connectivity_test request, options = nil
581
+ raise ::ArgumentError, "request must be provided" if request.nil?
582
+
583
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::NetworkManagement::V1::DeleteConnectivityTestRequest
584
+
585
+ # Converts hash and nil to an options object
586
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
587
+
588
+ # Customize the options with defaults
589
+ call_metadata = @config.rpcs.delete_connectivity_test.metadata.to_h
590
+
591
+ # Set x-goog-api-client and x-goog-user-project headers
592
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
593
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
594
+ gapic_version: ::Google::Cloud::NetworkManagement::V1::VERSION,
595
+ transports_version_send: [:rest]
596
+
597
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
598
+
599
+ options.apply_defaults timeout: @config.rpcs.delete_connectivity_test.timeout,
600
+ metadata: call_metadata,
601
+ retry_policy: @config.rpcs.delete_connectivity_test.retry_policy
602
+
603
+ options.apply_defaults timeout: @config.timeout,
604
+ metadata: @config.metadata,
605
+ retry_policy: @config.retry_policy
606
+
607
+ @reachability_service_stub.delete_connectivity_test request, options do |result, operation|
608
+ result = ::Gapic::Operation.new result, @operations_client, options: options
609
+ yield result, operation if block_given?
610
+ return result
611
+ end
612
+ rescue ::Gapic::Rest::Error => e
613
+ raise ::Google::Cloud::Error.from_error(e)
614
+ end
615
+
616
+ ##
617
+ # Configuration class for the ReachabilityService REST API.
618
+ #
619
+ # This class represents the configuration for ReachabilityService REST,
620
+ # providing control over timeouts, retry behavior, logging, transport
621
+ # parameters, and other low-level controls. Certain parameters can also be
622
+ # applied individually to specific RPCs. See
623
+ # {::Google::Cloud::NetworkManagement::V1::ReachabilityService::Rest::Client::Configuration::Rpcs}
624
+ # for a list of RPCs that can be configured independently.
625
+ #
626
+ # Configuration can be applied globally to all clients, or to a single client
627
+ # on construction.
628
+ #
629
+ # @example
630
+ #
631
+ # # Modify the global config, setting the timeout for
632
+ # # list_connectivity_tests to 20 seconds,
633
+ # # and all remaining timeouts to 10 seconds.
634
+ # ::Google::Cloud::NetworkManagement::V1::ReachabilityService::Rest::Client.configure do |config|
635
+ # config.timeout = 10.0
636
+ # config.rpcs.list_connectivity_tests.timeout = 20.0
637
+ # end
638
+ #
639
+ # # Apply the above configuration only to a new client.
640
+ # client = ::Google::Cloud::NetworkManagement::V1::ReachabilityService::Rest::Client.new do |config|
641
+ # config.timeout = 10.0
642
+ # config.rpcs.list_connectivity_tests.timeout = 20.0
643
+ # end
644
+ #
645
+ # @!attribute [rw] endpoint
646
+ # The hostname or hostname:port of the service endpoint.
647
+ # Defaults to `"networkmanagement.googleapis.com"`.
648
+ # @return [::String]
649
+ # @!attribute [rw] credentials
650
+ # Credentials to send with calls. You may provide any of the following types:
651
+ # * (`String`) The path to a service account key file in JSON format
652
+ # * (`Hash`) A service account key as a Hash
653
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
654
+ # (see the [googleauth docs](https://googleapis.dev/ruby/googleauth/latest/index.html))
655
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
656
+ # (see the [signet docs](https://googleapis.dev/ruby/signet/latest/Signet/OAuth2/Client.html))
657
+ # * (`nil`) indicating no credentials
658
+ # @return [::Object]
659
+ # @!attribute [rw] scope
660
+ # The OAuth scopes
661
+ # @return [::Array<::String>]
662
+ # @!attribute [rw] lib_name
663
+ # The library name as recorded in instrumentation and logging
664
+ # @return [::String]
665
+ # @!attribute [rw] lib_version
666
+ # The library version as recorded in instrumentation and logging
667
+ # @return [::String]
668
+ # @!attribute [rw] timeout
669
+ # The call timeout in seconds.
670
+ # @return [::Numeric]
671
+ # @!attribute [rw] metadata
672
+ # Additional headers to be sent with the call.
673
+ # @return [::Hash{::Symbol=>::String}]
674
+ # @!attribute [rw] retry_policy
675
+ # The retry policy. The value is a hash with the following keys:
676
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
677
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
678
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
679
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
680
+ # trigger a retry.
681
+ # @return [::Hash]
682
+ # @!attribute [rw] quota_project
683
+ # A separate project against which to charge quota.
684
+ # @return [::String]
685
+ #
686
+ class Configuration
687
+ extend ::Gapic::Config
688
+
689
+ config_attr :endpoint, "networkmanagement.googleapis.com", ::String
690
+ config_attr :credentials, nil do |value|
691
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
692
+ allowed.any? { |klass| klass === value }
693
+ end
694
+ config_attr :scope, nil, ::String, ::Array, nil
695
+ config_attr :lib_name, nil, ::String, nil
696
+ config_attr :lib_version, nil, ::String, nil
697
+ config_attr :timeout, nil, ::Numeric, nil
698
+ config_attr :metadata, nil, ::Hash, nil
699
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
700
+ config_attr :quota_project, nil, ::String, nil
701
+
702
+ # @private
703
+ def initialize parent_config = nil
704
+ @parent_config = parent_config unless parent_config.nil?
705
+
706
+ yield self if block_given?
707
+ end
708
+
709
+ ##
710
+ # Configurations for individual RPCs
711
+ # @return [Rpcs]
712
+ #
713
+ def rpcs
714
+ @rpcs ||= begin
715
+ parent_rpcs = nil
716
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
717
+ Rpcs.new parent_rpcs
718
+ end
719
+ end
720
+
721
+ ##
722
+ # Configuration RPC class for the ReachabilityService API.
723
+ #
724
+ # Includes fields providing the configuration for each RPC in this service.
725
+ # Each configuration object is of type `Gapic::Config::Method` and includes
726
+ # the following configuration fields:
727
+ #
728
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
729
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers
730
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
731
+ # include the following keys:
732
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
733
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
734
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
735
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
736
+ # trigger a retry.
737
+ #
738
+ class Rpcs
739
+ ##
740
+ # RPC-specific configuration for `list_connectivity_tests`
741
+ # @return [::Gapic::Config::Method]
742
+ #
743
+ attr_reader :list_connectivity_tests
744
+ ##
745
+ # RPC-specific configuration for `get_connectivity_test`
746
+ # @return [::Gapic::Config::Method]
747
+ #
748
+ attr_reader :get_connectivity_test
749
+ ##
750
+ # RPC-specific configuration for `create_connectivity_test`
751
+ # @return [::Gapic::Config::Method]
752
+ #
753
+ attr_reader :create_connectivity_test
754
+ ##
755
+ # RPC-specific configuration for `update_connectivity_test`
756
+ # @return [::Gapic::Config::Method]
757
+ #
758
+ attr_reader :update_connectivity_test
759
+ ##
760
+ # RPC-specific configuration for `rerun_connectivity_test`
761
+ # @return [::Gapic::Config::Method]
762
+ #
763
+ attr_reader :rerun_connectivity_test
764
+ ##
765
+ # RPC-specific configuration for `delete_connectivity_test`
766
+ # @return [::Gapic::Config::Method]
767
+ #
768
+ attr_reader :delete_connectivity_test
769
+
770
+ # @private
771
+ def initialize parent_rpcs = nil
772
+ list_connectivity_tests_config = parent_rpcs.list_connectivity_tests if parent_rpcs.respond_to? :list_connectivity_tests
773
+ @list_connectivity_tests = ::Gapic::Config::Method.new list_connectivity_tests_config
774
+ get_connectivity_test_config = parent_rpcs.get_connectivity_test if parent_rpcs.respond_to? :get_connectivity_test
775
+ @get_connectivity_test = ::Gapic::Config::Method.new get_connectivity_test_config
776
+ create_connectivity_test_config = parent_rpcs.create_connectivity_test if parent_rpcs.respond_to? :create_connectivity_test
777
+ @create_connectivity_test = ::Gapic::Config::Method.new create_connectivity_test_config
778
+ update_connectivity_test_config = parent_rpcs.update_connectivity_test if parent_rpcs.respond_to? :update_connectivity_test
779
+ @update_connectivity_test = ::Gapic::Config::Method.new update_connectivity_test_config
780
+ rerun_connectivity_test_config = parent_rpcs.rerun_connectivity_test if parent_rpcs.respond_to? :rerun_connectivity_test
781
+ @rerun_connectivity_test = ::Gapic::Config::Method.new rerun_connectivity_test_config
782
+ delete_connectivity_test_config = parent_rpcs.delete_connectivity_test if parent_rpcs.respond_to? :delete_connectivity_test
783
+ @delete_connectivity_test = ::Gapic::Config::Method.new delete_connectivity_test_config
784
+
785
+ yield self if block_given?
786
+ end
787
+ end
788
+ end
789
+ end
790
+ end
791
+ end
792
+ end
793
+ end
794
+ end
795
+ end