google-cloud-network_management-v1 0.1.0

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