Network Connectivity V1 API - Class Google::Cloud::NetworkConnectivity::V1::PolicyBasedRoutingService::Client (v1.10.0)

Reference documentation and code samples for the Network Connectivity V1 API class Google::Cloud::NetworkConnectivity::V1::PolicyBasedRoutingService::Client.

Client for the PolicyBasedRoutingService service.

Policy-Based Routing allows GCP customers to specify flexibile routing policies for Layer 4 traffic traversing through the connected service.

Inherits

  • Object

Methods

.configure

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

Configure the PolicyBasedRoutingService 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 PolicyBasedRoutingService clients
::Google::Cloud::NetworkConnectivity::V1::PolicyBasedRoutingService::Client.configuredo|config|
config.timeout=10.0
end

#configure

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

Configure the PolicyBasedRoutingService 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_policy_based_route

defcreate_policy_based_route(request,options=nil)->::Gapic::Operation
defcreate_policy_based_route(parent:nil,policy_based_route_id:nil,policy_based_route:nil,request_id:nil)->::Gapic::Operation

Creates a new policy-based route in a given project and location.

Overloads
defcreate_policy_based_route(request,options=nil)->::Gapic::Operation
Pass arguments to create_policy_based_route via a request object, either of type CreatePolicyBasedRouteRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::NetworkConnectivity::V1::CreatePolicyBasedRouteRequest, ::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.
defcreate_policy_based_route(parent:nil,policy_based_route_id:nil,policy_based_route:nil,request_id:nil)->::Gapic::Operation
Pass arguments to create_policy_based_route 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's name of the PolicyBasedRoute.
  • policy_based_route_id (::String) — Required. Unique id for the policy-based route to create. Provided by the client when the resource is created. The name must comply with https://google.aip.dev/122#resource-id-segments. Specifically, the name must be 1-63 characters long and match the regular expression a-z?. The first character must be a lowercase letter, and all following characters (except for the last character) must be a dash, lowercase letter, or digit. The last character must be a lowercase letter or digit.
  • policy_based_route (::Google::Cloud::NetworkConnectivity::V1::PolicyBasedRoute, ::Hash) — Required. Initial values for a new policy-based route.
  • request_id (::String) — Optional. An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server knows to ignore the request if it has already been completed. The server guarantees that for at least 60 minutes since the first request.

    For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, ignores the second request. This prevents clients from accidentally creating duplicate commitments.

    The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000).

Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
  • response (::Gapic::Operation)
  • operation (::GRPC::ActiveCall::Operation)
Returns
  • (::Gapic::Operation)
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

require"google/cloud/network_connectivity/v1"
# Create a client object. The client can be reused for multiple calls.
client=Google::Cloud::NetworkConnectivity::V1::PolicyBasedRoutingService::Client.new
# Create a request. To set request fields, pass in keyword arguments.
request=Google::Cloud::NetworkConnectivity::V1::CreatePolicyBasedRouteRequest.new
# Call the create_policy_based_route method.
result=client.create_policy_based_routerequest
# 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
ifresult.response?
presult.response
else
puts"No response received."
end

#delete_policy_based_route

defdelete_policy_based_route(request,options=nil)->::Gapic::Operation
defdelete_policy_based_route(name:nil,request_id:nil)->::Gapic::Operation

Deletes a single policy-based route.

Overloads
defdelete_policy_based_route(request,options=nil)->::Gapic::Operation
Pass arguments to delete_policy_based_route via a request object, either of type DeletePolicyBasedRouteRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::NetworkConnectivity::V1::DeletePolicyBasedRouteRequest, ::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.
defdelete_policy_based_route(name:nil,request_id:nil)->::Gapic::Operation
Pass arguments to delete_policy_based_route 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
  • name (::String) — Required. Name of the policy-based route resource to delete.
  • request_id (::String) — Optional. An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server knows to ignore the request if it has already been completed. The server guarantees that for at least 60 minutes after the first request.

    For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, ignores the second request. This prevents clients from accidentally creating duplicate commitments.

    The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000).

Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
  • response (::Gapic::Operation)
  • operation (::GRPC::ActiveCall::Operation)
Returns
  • (::Gapic::Operation)
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

require"google/cloud/network_connectivity/v1"
# Create a client object. The client can be reused for multiple calls.
client=Google::Cloud::NetworkConnectivity::V1::PolicyBasedRoutingService::Client.new
# Create a request. To set request fields, pass in keyword arguments.
request=Google::Cloud::NetworkConnectivity::V1::DeletePolicyBasedRouteRequest.new
# Call the delete_policy_based_route method.
result=client.delete_policy_based_routerequest
# 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
ifresult.response?
presult.response
else
puts"No response received."
end

#get_policy_based_route

defget_policy_based_route(request,options=nil)->::Google::Cloud::NetworkConnectivity::V1::PolicyBasedRoute
defget_policy_based_route(name:nil)->::Google::Cloud::NetworkConnectivity::V1::PolicyBasedRoute

Gets details of a single policy-based route.

Overloads
defget_policy_based_route(request,options=nil)->::Google::Cloud::NetworkConnectivity::V1::PolicyBasedRoute
Pass arguments to get_policy_based_route via a request object, either of type GetPolicyBasedRouteRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::NetworkConnectivity::V1::GetPolicyBasedRouteRequest, ::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.
defget_policy_based_route(name:nil)->::Google::Cloud::NetworkConnectivity::V1::PolicyBasedRoute
Pass arguments to get_policy_based_route 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. Name of the PolicyBasedRoute resource to get.
Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

require"google/cloud/network_connectivity/v1"
# Create a client object. The client can be reused for multiple calls.
client=Google::Cloud::NetworkConnectivity::V1::PolicyBasedRoutingService::Client.new
# Create a request. To set request fields, pass in keyword arguments.
request=Google::Cloud::NetworkConnectivity::V1::GetPolicyBasedRouteRequest.new
# Call the get_policy_based_route method.
result=client.get_policy_based_routerequest
# The returned object is of type Google::Cloud::NetworkConnectivity::V1::PolicyBasedRoute.
presult

#iam_policy_client

defiam_policy_client()->Google::Iam::V1::IAMPolicy::Client

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

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

#initialize

definitialize(){|config|...}->Client

Create a new PolicyBasedRoutingService client object.

Yields
  • (config) — Configure the PolicyBasedRoutingService client.
Yield Parameter
Returns
  • (Client) — a new instance of Client
Example
# Create a client using the default configuration
client=::Google::Cloud::NetworkConnectivity::V1::PolicyBasedRoutingService::Client.new
# Create a client using a custom configuration
client=::Google::Cloud::NetworkConnectivity::V1::PolicyBasedRoutingService::Client.newdo|config|
config.timeout=10.0
end

#list_policy_based_routes

deflist_policy_based_routes(request,options=nil)->::Gapic::PagedEnumerable<::Google::Cloud::NetworkConnectivity::V1::PolicyBasedRoute>
deflist_policy_based_routes(parent:nil,page_size:nil,page_token:nil,filter:nil,order_by:nil)->::Gapic::PagedEnumerable<::Google::Cloud::NetworkConnectivity::V1::PolicyBasedRoute>

Lists policy-based routes in a given project and location.

Overloads
deflist_policy_based_routes(request,options=nil)->::Gapic::PagedEnumerable<::Google::Cloud::NetworkConnectivity::V1::PolicyBasedRoute>
Pass arguments to list_policy_based_routes via a request object, either of type ListPolicyBasedRoutesRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::NetworkConnectivity::V1::ListPolicyBasedRoutesRequest, ::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.
deflist_policy_based_routes(parent:nil,page_size:nil,page_token:nil,filter:nil,order_by:nil)->::Gapic::PagedEnumerable<::Google::Cloud::NetworkConnectivity::V1::PolicyBasedRoute>
Pass arguments to list_policy_based_routes 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's name.
  • page_size (::Integer) — The maximum number of results per page that should be returned.
  • page_token (::String) — The page token.
  • filter (::String) — A filter expression that filters the results listed in the response.
  • order_by (::String) — Sort the results by a certain order.
Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

require"google/cloud/network_connectivity/v1"
# Create a client object. The client can be reused for multiple calls.
client=Google::Cloud::NetworkConnectivity::V1::PolicyBasedRoutingService::Client.new
# Create a request. To set request fields, pass in keyword arguments.
request=Google::Cloud::NetworkConnectivity::V1::ListPolicyBasedRoutesRequest.new
# Call the list_policy_based_routes method.
result=client.list_policy_based_routesrequest
# 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.eachdo|item|
# Each element is of type ::Google::Cloud::NetworkConnectivity::V1::PolicyBasedRoute.
pitem
end

#location_client

deflocation_client()->Google::Cloud::Location::Locations::Client

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

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

#logger

deflogger()->Logger

The logger used for request/response debug logging.

Returns
  • (Logger)

#operations_client

defoperations_client()->::Google::Cloud::NetworkConnectivity::V1::PolicyBasedRoutingService::Operations

Get the associated client for long-running operations.

#universe_domain

defuniverse_domain()->String

The effective universe domain

Returns
  • (String)

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025年10月30日 UTC.