Network Management V1 API - Class Google::Cloud::NetworkManagement::V1::ReachabilityService::Rest::Client (v1.3.0)

Reference documentation and code samples for the Network Management V1 API class Google::Cloud::NetworkManagement::V1::ReachabilityService::Rest::Client.

REST client for the ReachabilityService service.

The Reachability service in the Google Cloud Network Management API provides services that analyze the reachability within a single Google Virtual Private Cloud (VPC) network, between peered VPC networks, between VPC and on-premises networks, or between VPC networks and internet hosts. A reachability analysis is based on Google Cloud network configurations.

You can use the analysis results to verify these configurations and to troubleshoot connectivity issues.

Inherits

  • Object

Methods

.configure

def self.configure() { |config| ... } -> Client::Configuration

Configure the ReachabilityService Client class.

See Configuration for a description of the configuration fields.

Yields
  • (config) — Configure the Client client.
Yield Parameter
Example
# Modify the configuration for all ReachabilityService clients
::Google::Cloud::NetworkManagement::V1::ReachabilityService::Rest::Client.configure do |config|
  config.timeout = 10.0
end

#configure

def configure() { |config| ... } -> Client::Configuration

Configure the ReachabilityService Client instance.

The configuration is set to the derived mode, meaning that values can be changed, but structural changes (adding new fields, etc.) are not allowed. Structural changes should be made on Client.configure.

See Configuration for a description of the configuration fields.

Yields
  • (config) — Configure the Client client.
Yield Parameter

#create_connectivity_test

def create_connectivity_test(request, options = nil) -> ::Gapic::Operation
def create_connectivity_test(parent: nil, test_id: nil, resource: nil) -> ::Gapic::Operation

Creates a new Connectivity Test. After you create a test, the reachability analysis is performed as part of the long running operation, which completes when the analysis completes.

If the endpoint specifications in ConnectivityTest are invalid (for example, containing non-existent resources in the network, or you don't have read permissions to the network configurations of listed projects), then the reachability result returns a value of UNKNOWN.

If the endpoint specifications in ConnectivityTest are incomplete, the reachability result returns a value of AMBIGUOUS. For more information, see the Connectivity Test documentation.

Overloads
def create_connectivity_test(request, options = nil) -> ::Gapic::Operation
Pass arguments to create_connectivity_test via a request object, either of type CreateConnectivityTestRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::NetworkManagement::V1::CreateConnectivityTestRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def create_connectivity_test(parent: nil, test_id: nil, resource: nil) -> ::Gapic::Operation
Pass arguments to create_connectivity_test via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameters
  • parent (::String) — Required. The parent resource of the Connectivity Test to create: projects/{project_id}/locations/global
  • test_id (::String) —

    Required. The logical name of the Connectivity Test in your project with the following restrictions:

    • Must contain only lowercase letters, numbers, and hyphens.
    • Must start with a letter.
    • Must be between 1-40 characters.
    • Must end with a number or a letter.
    • Must be unique within the customer project
  • resource (::Google::Cloud::NetworkManagement::V1::ConnectivityTest, ::Hash) — Required. A ConnectivityTest resource
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
  • result (::Gapic::Operation)
  • operation (::Gapic::Rest::TransportOperation)
Returns
  • (::Gapic::Operation)
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.
Example

Basic example

require "google/cloud/network_management/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::NetworkManagement::V1::ReachabilityService::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::NetworkManagement::V1::CreateConnectivityTestRequest.new

# Call the create_connectivity_test method.
result = client.create_connectivity_test request

# The returned object is of type Gapic::Operation. You can use it to
# check the status of an operation, cancel it, or wait for results.
# Here is how to wait for a response.
result.wait_until_done! timeout: 60
if result.response?
  p result.response
else
  puts "No response received."
end

#delete_connectivity_test

def delete_connectivity_test(request, options = nil) -> ::Gapic::Operation
def delete_connectivity_test(name: nil) -> ::Gapic::Operation

Deletes a specific ConnectivityTest.

Overloads
def delete_connectivity_test(request, options = nil) -> ::Gapic::Operation
Pass arguments to delete_connectivity_test via a request object, either of type DeleteConnectivityTestRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::NetworkManagement::V1::DeleteConnectivityTestRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def delete_connectivity_test(name: nil) -> ::Gapic::Operation
Pass arguments to delete_connectivity_test via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameter
  • name (::String) — Required. Connectivity Test resource name using the form: projects/{project_id}/locations/global/connectivityTests/{test_id}
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
  • result (::Gapic::Operation)
  • operation (::Gapic::Rest::TransportOperation)
Returns
  • (::Gapic::Operation)
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.
Example

Basic example

require "google/cloud/network_management/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::NetworkManagement::V1::ReachabilityService::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::NetworkManagement::V1::DeleteConnectivityTestRequest.new

# Call the delete_connectivity_test method.
result = client.delete_connectivity_test request

# The returned object is of type Gapic::Operation. You can use it to
# check the status of an operation, cancel it, or wait for results.
# Here is how to wait for a response.
result.wait_until_done! timeout: 60
if result.response?
  p result.response
else
  puts "No response received."
end

#get_connectivity_test

def get_connectivity_test(request, options = nil) -> ::Google::Cloud::NetworkManagement::V1::ConnectivityTest
def get_connectivity_test(name: nil) -> ::Google::Cloud::NetworkManagement::V1::ConnectivityTest

Gets the details of a specific Connectivity Test.

Overloads
def get_connectivity_test(request, options = nil) -> ::Google::Cloud::NetworkManagement::V1::ConnectivityTest
Pass arguments to get_connectivity_test via a request object, either of type GetConnectivityTestRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::NetworkManagement::V1::GetConnectivityTestRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def get_connectivity_test(name: nil) -> ::Google::Cloud::NetworkManagement::V1::ConnectivityTest
Pass arguments to get_connectivity_test via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameter
  • name (::String) — Required. ConnectivityTest resource name using the form: projects/{project_id}/locations/global/connectivityTests/{test_id}
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.
Example

Basic example

require "google/cloud/network_management/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::NetworkManagement::V1::ReachabilityService::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::NetworkManagement::V1::GetConnectivityTestRequest.new

# Call the get_connectivity_test method.
result = client.get_connectivity_test request

# The returned object is of type Google::Cloud::NetworkManagement::V1::ConnectivityTest.
p result

#iam_policy_client

def iam_policy_client() -> Google::Iam::V1::IAMPolicy::Rest::Client

Get the associated client for mix-in of the IAMPolicy.

Returns
  • (Google::Iam::V1::IAMPolicy::Rest::Client)

#initialize

def initialize() { |config| ... } -> Client

Create a new ReachabilityService REST client object.

Yields
  • (config) — Configure the ReachabilityService client.
Yield Parameter
Returns
  • (Client) — a new instance of Client
Example
# Create a client using the default configuration
client = ::Google::Cloud::NetworkManagement::V1::ReachabilityService::Rest::Client.new

# Create a client using a custom configuration
client = ::Google::Cloud::NetworkManagement::V1::ReachabilityService::Rest::Client.new do |config|
  config.timeout = 10.0
end

#list_connectivity_tests

def list_connectivity_tests(request, options = nil) -> ::Google::Cloud::NetworkManagement::V1::ListConnectivityTestsResponse
def list_connectivity_tests(parent: nil, page_size: nil, page_token: nil, filter: nil, order_by: nil) -> ::Google::Cloud::NetworkManagement::V1::ListConnectivityTestsResponse

Lists all Connectivity Tests owned by a project.

Overloads
def list_connectivity_tests(request, options = nil) -> ::Google::Cloud::NetworkManagement::V1::ListConnectivityTestsResponse
Pass arguments to list_connectivity_tests via a request object, either of type ListConnectivityTestsRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::NetworkManagement::V1::ListConnectivityTestsRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def list_connectivity_tests(parent: nil, page_size: nil, page_token: nil, filter: nil, order_by: nil) -> ::Google::Cloud::NetworkManagement::V1::ListConnectivityTestsResponse
Pass arguments to list_connectivity_tests via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameters
  • parent (::String) — Required. The parent resource of the Connectivity Tests: projects/{project_id}/locations/global
  • page_size (::Integer) — Number of ConnectivityTests to return.
  • page_token (::String) — Page token from an earlier query, as returned in next_page_token.
  • filter (::String) —

    Lists the ConnectivityTests that match the filter expression. A filter expression filters the resources listed in the response. The expression must be of the form <field> <operator> <value> where operators: <, >, <=, >=, !=, =, : are supported (colon : represents a HAS operator which is roughly synonymous with equality).

    Examples:

    • Filter by name: name = "projects/proj-1/locations/global/connectivityTests/test-1

    • Filter by labels:

      • Resources that have a key called foo labels.foo:*
      • Resources that have a key called foo whose value is bar labels.foo = bar
  • order_by (::String) — Field to use to sort the list.
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.
Example

Basic example

require "google/cloud/network_management/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::NetworkManagement::V1::ReachabilityService::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::NetworkManagement::V1::ListConnectivityTestsRequest.new

# Call the list_connectivity_tests method.
result = client.list_connectivity_tests request

# The returned object is of type Gapic::PagedEnumerable. You can iterate
# over elements, and API calls will be issued to fetch pages as needed.
result.each do |item|
  # Each element is of type ::Google::Cloud::NetworkManagement::V1::ConnectivityTest.
  p item
end

#location_client

def location_client() -> Google::Cloud::Location::Locations::Rest::Client

Get the associated client for mix-in of the Locations.

Returns
  • (Google::Cloud::Location::Locations::Rest::Client)

#operations_client

def operations_client() -> ::Google::Cloud::NetworkManagement::V1::ReachabilityService::Rest::Operations

Get the associated client for long-running operations.

#rerun_connectivity_test

def rerun_connectivity_test(request, options = nil) -> ::Gapic::Operation
def rerun_connectivity_test(name: nil) -> ::Gapic::Operation

Rerun an existing ConnectivityTest. After the user triggers the rerun, the reachability analysis is performed as part of the long running operation, which completes when the analysis completes.

Even though the test configuration remains the same, the reachability result may change due to underlying network configuration changes.

If the endpoint specifications in ConnectivityTest become invalid (for example, specified resources are deleted in the network, or you lost read permissions to the network configurations of listed projects), then the reachability result returns a value of UNKNOWN.

Overloads
def rerun_connectivity_test(request, options = nil) -> ::Gapic::Operation
Pass arguments to rerun_connectivity_test via a request object, either of type Google::Cloud::NetworkManagement::V1::RerunConnectivityTestRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::NetworkManagement::V1::RerunConnectivityTestRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def rerun_connectivity_test(name: nil) -> ::Gapic::Operation
Pass arguments to rerun_connectivity_test via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameter
  • name (::String) — Required. Connectivity Test resource name using the form: projects/{project_id}/locations/global/connectivityTests/{test_id}
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
  • result (::Gapic::Operation)
  • operation (::Gapic::Rest::TransportOperation)
Returns
  • (::Gapic::Operation)
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.
Example

Basic example

require "google/cloud/network_management/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::NetworkManagement::V1::ReachabilityService::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::NetworkManagement::V1::RerunConnectivityTestRequest.new

# Call the rerun_connectivity_test method.
result = client.rerun_connectivity_test request

# The returned object is of type Gapic::Operation. You can use it to
# check the status of an operation, cancel it, or wait for results.
# Here is how to wait for a response.
result.wait_until_done! timeout: 60
if result.response?
  p result.response
else
  puts "No response received."
end

#universe_domain

def universe_domain() -> String

The effective universe domain

Returns
  • (String)

#update_connectivity_test

def update_connectivity_test(request, options = nil) -> ::Gapic::Operation
def update_connectivity_test(update_mask: nil, resource: nil) -> ::Gapic::Operation

Updates the configuration of an existing ConnectivityTest. After you update a test, the reachability analysis is performed as part of the long running operation, which completes when the analysis completes. The Reachability state in the test resource is updated with the new result.

If the endpoint specifications in ConnectivityTest are invalid (for example, they contain non-existent resources in the network, or the user does not have read permissions to the network configurations of listed projects), then the reachability result returns a value of UNKNOWN.

If the endpoint specifications in ConnectivityTest are incomplete, the reachability result returns a value of AMBIGUOUS. See the documentation in ConnectivityTest for more details.

Overloads
def update_connectivity_test(request, options = nil) -> ::Gapic::Operation
Pass arguments to update_connectivity_test via a request object, either of type UpdateConnectivityTestRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::NetworkManagement::V1::UpdateConnectivityTestRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def update_connectivity_test(update_mask: nil, resource: nil) -> ::Gapic::Operation
Pass arguments to update_connectivity_test via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameters
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
  • result (::Gapic::Operation)
  • operation (::Gapic::Rest::TransportOperation)
Returns
  • (::Gapic::Operation)
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.
Example

Basic example

require "google/cloud/network_management/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::NetworkManagement::V1::ReachabilityService::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::NetworkManagement::V1::UpdateConnectivityTestRequest.new

# Call the update_connectivity_test method.
result = client.update_connectivity_test request

# The returned object is of type Gapic::Operation. You can use it to
# check the status of an operation, cancel it, or wait for results.
# Here is how to wait for a response.
result.wait_until_done! timeout: 60
if result.response?
  p result.response
else
  puts "No response received."
end