Class PolicyBasedRoutingServiceClient (1.8.0)

public class PolicyBasedRoutingServiceClient implements BackgroundResource

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

This class provides the ability to make remote calls to the backing service through method calls that map to API methods. Sample code to get started:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (PolicyBasedRoutingServiceClient policyBasedRoutingServiceClient =
     PolicyBasedRoutingServiceClient.create()) {
   PolicyBasedRouteName name =
       PolicyBasedRouteName.of("[PROJECT]", "[LOCATION]", "[POLICY_BASED_ROUTE]");
   PolicyBasedRoute response = policyBasedRoutingServiceClient.getPolicyBasedRoute(name);
 }
 

Note: close() needs to be called on the PolicyBasedRoutingServiceClient object to clean up resources such as threads. In the example above, try-with-resources is used, which automatically calls close().

The surface of this class includes several types of Java methods for each of the API's methods:

  1. A "flattened" method. With this type of method, the fields of the request type have been converted into function parameters. It may be the case that not all fields are available as parameters, and not every API method will have a flattened method entry point.
  2. A "request object" method. This type of method only takes one parameter, a request object, which must be constructed before the call. Not every API method will have a request object method.
  3. A "callable" method. This type of method takes no parameters and returns an immutable API callable object, which can be used to initiate calls to the service.

See the individual methods for example code.

Many parameters require resource names to be formatted in a particular way. To assist with these names, this class includes a format method for each type of name, and additionally a parse method to extract the individual identifiers contained within names that are returned.

This class can be customized by passing in a custom instance of PolicyBasedRoutingServiceSettings to create(). For example:

To customize credentials:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 PolicyBasedRoutingServiceSettings policyBasedRoutingServiceSettings =
     PolicyBasedRoutingServiceSettings.newBuilder()
         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
         .build();
 PolicyBasedRoutingServiceClient policyBasedRoutingServiceClient =
     PolicyBasedRoutingServiceClient.create(policyBasedRoutingServiceSettings);
 

To customize the endpoint:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 PolicyBasedRoutingServiceSettings policyBasedRoutingServiceSettings =
     PolicyBasedRoutingServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
 PolicyBasedRoutingServiceClient policyBasedRoutingServiceClient =
     PolicyBasedRoutingServiceClient.create(policyBasedRoutingServiceSettings);
 

Please refer to the GitHub repository's samples for more quickstart code snippets.

Inheritance

java.lang.Object > PolicyBasedRoutingServiceClient

Implements

BackgroundResource

Static Methods

create()

public static final PolicyBasedRoutingServiceClient create()

Constructs an instance of PolicyBasedRoutingServiceClient with default settings.

Returns
TypeDescription
PolicyBasedRoutingServiceClient
Exceptions
TypeDescription
IOException

create(PolicyBasedRoutingServiceSettings settings)

public static final PolicyBasedRoutingServiceClient create(PolicyBasedRoutingServiceSettings settings)

Constructs an instance of PolicyBasedRoutingServiceClient, using the given settings. The channels are created based on the settings passed in, or defaults for any settings that are not set.

Parameter
NameDescription
settingsPolicyBasedRoutingServiceSettings
Returns
TypeDescription
PolicyBasedRoutingServiceClient
Exceptions
TypeDescription
IOException

create(PolicyBasedRoutingServiceStub stub)

public static final PolicyBasedRoutingServiceClient create(PolicyBasedRoutingServiceStub stub)

Constructs an instance of PolicyBasedRoutingServiceClient, using the given stub for making calls. This is for advanced usage - prefer using create(PolicyBasedRoutingServiceSettings).

Parameter
NameDescription
stubPolicyBasedRoutingServiceStub
Returns
TypeDescription
PolicyBasedRoutingServiceClient

Constructors

PolicyBasedRoutingServiceClient(PolicyBasedRoutingServiceSettings settings)

protected PolicyBasedRoutingServiceClient(PolicyBasedRoutingServiceSettings settings)

Constructs an instance of PolicyBasedRoutingServiceClient, using the given settings. This is protected so that it is easy to make a subclass, but otherwise, the static factory methods should be preferred.

Parameter
NameDescription
settingsPolicyBasedRoutingServiceSettings

PolicyBasedRoutingServiceClient(PolicyBasedRoutingServiceStub stub)

protected PolicyBasedRoutingServiceClient(PolicyBasedRoutingServiceStub stub)
Parameter
NameDescription
stubPolicyBasedRoutingServiceStub

Methods

awaitTermination(long duration, TimeUnit unit)

public boolean awaitTermination(long duration, TimeUnit unit)
Parameters
NameDescription
durationlong
unitTimeUnit
Returns
TypeDescription
boolean
Exceptions
TypeDescription
InterruptedException

close()

public final void close()

createPolicyBasedRouteAsync(CreatePolicyBasedRouteRequest request)

public final OperationFuture<PolicyBasedRoute,OperationMetadata> createPolicyBasedRouteAsync(CreatePolicyBasedRouteRequest request)

Creates a new PolicyBasedRoute in a given project and location.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (PolicyBasedRoutingServiceClient policyBasedRoutingServiceClient =
     PolicyBasedRoutingServiceClient.create()) {
   CreatePolicyBasedRouteRequest request =
       CreatePolicyBasedRouteRequest.newBuilder()
           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
           .setPolicyBasedRouteId("policyBasedRouteId-18034589")
           .setPolicyBasedRoute(PolicyBasedRoute.newBuilder().build())
           .setRequestId("requestId693933066")
           .build();
   PolicyBasedRoute response =
       policyBasedRoutingServiceClient.createPolicyBasedRouteAsync(request).get();
 }
 
Parameter
NameDescription
requestCreatePolicyBasedRouteRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
OperationFuture<PolicyBasedRoute,OperationMetadata>

createPolicyBasedRouteAsync(LocationName parent, PolicyBasedRoute policyBasedRoute, String policyBasedRouteId)

public final OperationFuture<PolicyBasedRoute,OperationMetadata> createPolicyBasedRouteAsync(LocationName parent, PolicyBasedRoute policyBasedRoute, String policyBasedRouteId)

Creates a new PolicyBasedRoute in a given project and location.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (PolicyBasedRoutingServiceClient policyBasedRoutingServiceClient =
     PolicyBasedRoutingServiceClient.create()) {
   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
   PolicyBasedRoute policyBasedRoute = PolicyBasedRoute.newBuilder().build();
   String policyBasedRouteId = "policyBasedRouteId-18034589";
   PolicyBasedRoute response =
       policyBasedRoutingServiceClient
           .createPolicyBasedRouteAsync(parent, policyBasedRoute, policyBasedRouteId)
           .get();
 }
 
Parameters
NameDescription
parentLocationName

Required. The parent resource's name of the PolicyBasedRoute.

policyBasedRoutePolicyBasedRoute

Required. Initial values for a new Policy Based Route.

policyBasedRouteIdString

Optional. Unique id for the Policy Based Route to create.

Returns
TypeDescription
OperationFuture<PolicyBasedRoute,OperationMetadata>

createPolicyBasedRouteAsync(String parent, PolicyBasedRoute policyBasedRoute, String policyBasedRouteId)

public final OperationFuture<PolicyBasedRoute,OperationMetadata> createPolicyBasedRouteAsync(String parent, PolicyBasedRoute policyBasedRoute, String policyBasedRouteId)

Creates a new PolicyBasedRoute in a given project and location.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (PolicyBasedRoutingServiceClient policyBasedRoutingServiceClient =
     PolicyBasedRoutingServiceClient.create()) {
   String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
   PolicyBasedRoute policyBasedRoute = PolicyBasedRoute.newBuilder().build();
   String policyBasedRouteId = "policyBasedRouteId-18034589";
   PolicyBasedRoute response =
       policyBasedRoutingServiceClient
           .createPolicyBasedRouteAsync(parent, policyBasedRoute, policyBasedRouteId)
           .get();
 }
 
Parameters
NameDescription
parentString

Required. The parent resource's name of the PolicyBasedRoute.

policyBasedRoutePolicyBasedRoute

Required. Initial values for a new Policy Based Route.

policyBasedRouteIdString

Optional. Unique id for the Policy Based Route to create.

Returns
TypeDescription
OperationFuture<PolicyBasedRoute,OperationMetadata>

createPolicyBasedRouteCallable()

public final UnaryCallable<CreatePolicyBasedRouteRequest,Operation> createPolicyBasedRouteCallable()

Creates a new PolicyBasedRoute in a given project and location.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (PolicyBasedRoutingServiceClient policyBasedRoutingServiceClient =
     PolicyBasedRoutingServiceClient.create()) {
   CreatePolicyBasedRouteRequest request =
       CreatePolicyBasedRouteRequest.newBuilder()
           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
           .setPolicyBasedRouteId("policyBasedRouteId-18034589")
           .setPolicyBasedRoute(PolicyBasedRoute.newBuilder().build())
           .setRequestId("requestId693933066")
           .build();
   ApiFuture<Operation> future =
       policyBasedRoutingServiceClient.createPolicyBasedRouteCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<CreatePolicyBasedRouteRequest,Operation>

createPolicyBasedRouteOperationCallable()

public final OperationCallable<CreatePolicyBasedRouteRequest,PolicyBasedRoute,OperationMetadata> createPolicyBasedRouteOperationCallable()

Creates a new PolicyBasedRoute in a given project and location.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (PolicyBasedRoutingServiceClient policyBasedRoutingServiceClient =
     PolicyBasedRoutingServiceClient.create()) {
   CreatePolicyBasedRouteRequest request =
       CreatePolicyBasedRouteRequest.newBuilder()
           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
           .setPolicyBasedRouteId("policyBasedRouteId-18034589")
           .setPolicyBasedRoute(PolicyBasedRoute.newBuilder().build())
           .setRequestId("requestId693933066")
           .build();
   OperationFuture<PolicyBasedRoute, OperationMetadata> future =
       policyBasedRoutingServiceClient
           .createPolicyBasedRouteOperationCallable()
           .futureCall(request);
   // Do something.
   PolicyBasedRoute response = future.get();
 }
 
Returns
TypeDescription
OperationCallable<CreatePolicyBasedRouteRequest,PolicyBasedRoute,OperationMetadata>

deletePolicyBasedRouteAsync(DeletePolicyBasedRouteRequest request)

public final OperationFuture<Empty,OperationMetadata> deletePolicyBasedRouteAsync(DeletePolicyBasedRouteRequest request)

Deletes a single PolicyBasedRoute.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (PolicyBasedRoutingServiceClient policyBasedRoutingServiceClient =
     PolicyBasedRoutingServiceClient.create()) {
   DeletePolicyBasedRouteRequest request =
       DeletePolicyBasedRouteRequest.newBuilder()
           .setName(
               PolicyBasedRouteName.of("[PROJECT]", "[LOCATION]", "[POLICY_BASED_ROUTE]")
                   .toString())
           .setRequestId("requestId693933066")
           .build();
   policyBasedRoutingServiceClient.deletePolicyBasedRouteAsync(request).get();
 }
 
Parameter
NameDescription
requestDeletePolicyBasedRouteRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
OperationFuture<Empty,OperationMetadata>

deletePolicyBasedRouteAsync(PolicyBasedRouteName name)

public final OperationFuture<Empty,OperationMetadata> deletePolicyBasedRouteAsync(PolicyBasedRouteName name)

Deletes a single PolicyBasedRoute.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (PolicyBasedRoutingServiceClient policyBasedRoutingServiceClient =
     PolicyBasedRoutingServiceClient.create()) {
   PolicyBasedRouteName name =
       PolicyBasedRouteName.of("[PROJECT]", "[LOCATION]", "[POLICY_BASED_ROUTE]");
   policyBasedRoutingServiceClient.deletePolicyBasedRouteAsync(name).get();
 }
 
Parameter
NameDescription
namePolicyBasedRouteName

Required. Name of the PolicyBasedRoute resource to delete.

Returns
TypeDescription
OperationFuture<Empty,OperationMetadata>

deletePolicyBasedRouteAsync(String name)

public final OperationFuture<Empty,OperationMetadata> deletePolicyBasedRouteAsync(String name)

Deletes a single PolicyBasedRoute.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (PolicyBasedRoutingServiceClient policyBasedRoutingServiceClient =
     PolicyBasedRoutingServiceClient.create()) {
   String name =
       PolicyBasedRouteName.of("[PROJECT]", "[LOCATION]", "[POLICY_BASED_ROUTE]").toString();
   policyBasedRoutingServiceClient.deletePolicyBasedRouteAsync(name).get();
 }
 
Parameter
NameDescription
nameString

Required. Name of the PolicyBasedRoute resource to delete.

Returns
TypeDescription
OperationFuture<Empty,OperationMetadata>

deletePolicyBasedRouteCallable()

public final UnaryCallable<DeletePolicyBasedRouteRequest,Operation> deletePolicyBasedRouteCallable()

Deletes a single PolicyBasedRoute.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (PolicyBasedRoutingServiceClient policyBasedRoutingServiceClient =
     PolicyBasedRoutingServiceClient.create()) {
   DeletePolicyBasedRouteRequest request =
       DeletePolicyBasedRouteRequest.newBuilder()
           .setName(
               PolicyBasedRouteName.of("[PROJECT]", "[LOCATION]", "[POLICY_BASED_ROUTE]")
                   .toString())
           .setRequestId("requestId693933066")
           .build();
   ApiFuture<Operation> future =
       policyBasedRoutingServiceClient.deletePolicyBasedRouteCallable().futureCall(request);
   // Do something.
   future.get();
 }
 
Returns
TypeDescription
UnaryCallable<DeletePolicyBasedRouteRequest,Operation>

deletePolicyBasedRouteOperationCallable()

public final OperationCallable<DeletePolicyBasedRouteRequest,Empty,OperationMetadata> deletePolicyBasedRouteOperationCallable()

Deletes a single PolicyBasedRoute.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (PolicyBasedRoutingServiceClient policyBasedRoutingServiceClient =
     PolicyBasedRoutingServiceClient.create()) {
   DeletePolicyBasedRouteRequest request =
       DeletePolicyBasedRouteRequest.newBuilder()
           .setName(
               PolicyBasedRouteName.of("[PROJECT]", "[LOCATION]", "[POLICY_BASED_ROUTE]")
                   .toString())
           .setRequestId("requestId693933066")
           .build();
   OperationFuture<Empty, OperationMetadata> future =
       policyBasedRoutingServiceClient
           .deletePolicyBasedRouteOperationCallable()
           .futureCall(request);
   // Do something.
   future.get();
 }
 
Returns
TypeDescription
OperationCallable<DeletePolicyBasedRouteRequest,Empty,OperationMetadata>

getOperationsClient()

public final OperationsClient getOperationsClient()

Returns the OperationsClient that can be used to query the status of a long-running operation returned by another API method call.

Returns
TypeDescription
OperationsClient

getPolicyBasedRoute(GetPolicyBasedRouteRequest request)

public final PolicyBasedRoute getPolicyBasedRoute(GetPolicyBasedRouteRequest request)

Gets details of a single PolicyBasedRoute.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (PolicyBasedRoutingServiceClient policyBasedRoutingServiceClient =
     PolicyBasedRoutingServiceClient.create()) {
   GetPolicyBasedRouteRequest request =
       GetPolicyBasedRouteRequest.newBuilder()
           .setName(
               PolicyBasedRouteName.of("[PROJECT]", "[LOCATION]", "[POLICY_BASED_ROUTE]")
                   .toString())
           .build();
   PolicyBasedRoute response = policyBasedRoutingServiceClient.getPolicyBasedRoute(request);
 }
 
Parameter
NameDescription
requestGetPolicyBasedRouteRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
PolicyBasedRoute

getPolicyBasedRoute(PolicyBasedRouteName name)

public final PolicyBasedRoute getPolicyBasedRoute(PolicyBasedRouteName name)

Gets details of a single PolicyBasedRoute.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (PolicyBasedRoutingServiceClient policyBasedRoutingServiceClient =
     PolicyBasedRoutingServiceClient.create()) {
   PolicyBasedRouteName name =
       PolicyBasedRouteName.of("[PROJECT]", "[LOCATION]", "[POLICY_BASED_ROUTE]");
   PolicyBasedRoute response = policyBasedRoutingServiceClient.getPolicyBasedRoute(name);
 }
 
Parameter
NameDescription
namePolicyBasedRouteName

Required. Name of the PolicyBasedRoute resource to get.

Returns
TypeDescription
PolicyBasedRoute

getPolicyBasedRoute(String name)

public final PolicyBasedRoute getPolicyBasedRoute(String name)

Gets details of a single PolicyBasedRoute.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (PolicyBasedRoutingServiceClient policyBasedRoutingServiceClient =
     PolicyBasedRoutingServiceClient.create()) {
   String name =
       PolicyBasedRouteName.of("[PROJECT]", "[LOCATION]", "[POLICY_BASED_ROUTE]").toString();
   PolicyBasedRoute response = policyBasedRoutingServiceClient.getPolicyBasedRoute(name);
 }
 
Parameter
NameDescription
nameString

Required. Name of the PolicyBasedRoute resource to get.

Returns
TypeDescription
PolicyBasedRoute

getPolicyBasedRouteCallable()

public final UnaryCallable<GetPolicyBasedRouteRequest,PolicyBasedRoute> getPolicyBasedRouteCallable()

Gets details of a single PolicyBasedRoute.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (PolicyBasedRoutingServiceClient policyBasedRoutingServiceClient =
     PolicyBasedRoutingServiceClient.create()) {
   GetPolicyBasedRouteRequest request =
       GetPolicyBasedRouteRequest.newBuilder()
           .setName(
               PolicyBasedRouteName.of("[PROJECT]", "[LOCATION]", "[POLICY_BASED_ROUTE]")
                   .toString())
           .build();
   ApiFuture<PolicyBasedRoute> future =
       policyBasedRoutingServiceClient.getPolicyBasedRouteCallable().futureCall(request);
   // Do something.
   PolicyBasedRoute response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<GetPolicyBasedRouteRequest,PolicyBasedRoute>

getSettings()

public final PolicyBasedRoutingServiceSettings getSettings()
Returns
TypeDescription
PolicyBasedRoutingServiceSettings

getStub()

public PolicyBasedRoutingServiceStub getStub()
Returns
TypeDescription
PolicyBasedRoutingServiceStub

isShutdown()

public boolean isShutdown()
Returns
TypeDescription
boolean

isTerminated()

public boolean isTerminated()
Returns
TypeDescription
boolean

listPolicyBasedRoutes(ListPolicyBasedRoutesRequest request)

public final PolicyBasedRoutingServiceClient.ListPolicyBasedRoutesPagedResponse listPolicyBasedRoutes(ListPolicyBasedRoutesRequest request)

Lists PolicyBasedRoutes in a given project and location.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (PolicyBasedRoutingServiceClient policyBasedRoutingServiceClient =
     PolicyBasedRoutingServiceClient.create()) {
   ListPolicyBasedRoutesRequest request =
       ListPolicyBasedRoutesRequest.newBuilder()
           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .setFilter("filter-1274492040")
           .setOrderBy("orderBy-1207110587")
           .build();
   for (PolicyBasedRoute element :
       policyBasedRoutingServiceClient.listPolicyBasedRoutes(request).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
NameDescription
requestListPolicyBasedRoutesRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
PolicyBasedRoutingServiceClient.ListPolicyBasedRoutesPagedResponse

listPolicyBasedRoutes(LocationName parent)

public final PolicyBasedRoutingServiceClient.ListPolicyBasedRoutesPagedResponse listPolicyBasedRoutes(LocationName parent)

Lists PolicyBasedRoutes in a given project and location.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (PolicyBasedRoutingServiceClient policyBasedRoutingServiceClient =
     PolicyBasedRoutingServiceClient.create()) {
   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
   for (PolicyBasedRoute element :
       policyBasedRoutingServiceClient.listPolicyBasedRoutes(parent).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
NameDescription
parentLocationName

Required. The parent resource's name.

Returns
TypeDescription
PolicyBasedRoutingServiceClient.ListPolicyBasedRoutesPagedResponse

listPolicyBasedRoutes(String parent)

public final PolicyBasedRoutingServiceClient.ListPolicyBasedRoutesPagedResponse listPolicyBasedRoutes(String parent)

Lists PolicyBasedRoutes in a given project and location.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (PolicyBasedRoutingServiceClient policyBasedRoutingServiceClient =
     PolicyBasedRoutingServiceClient.create()) {
   String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
   for (PolicyBasedRoute element :
       policyBasedRoutingServiceClient.listPolicyBasedRoutes(parent).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
NameDescription
parentString

Required. The parent resource's name.

Returns
TypeDescription
PolicyBasedRoutingServiceClient.ListPolicyBasedRoutesPagedResponse

listPolicyBasedRoutesCallable()

public final UnaryCallable<ListPolicyBasedRoutesRequest,ListPolicyBasedRoutesResponse> listPolicyBasedRoutesCallable()

Lists PolicyBasedRoutes in a given project and location.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (PolicyBasedRoutingServiceClient policyBasedRoutingServiceClient =
     PolicyBasedRoutingServiceClient.create()) {
   ListPolicyBasedRoutesRequest request =
       ListPolicyBasedRoutesRequest.newBuilder()
           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .setFilter("filter-1274492040")
           .setOrderBy("orderBy-1207110587")
           .build();
   while (true) {
     ListPolicyBasedRoutesResponse response =
         policyBasedRoutingServiceClient.listPolicyBasedRoutesCallable().call(request);
     for (PolicyBasedRoute element : response.getPolicyBasedRoutesList()) {
       // doThingsWith(element);
     }
     String nextPageToken = response.getNextPageToken();
     if (!Strings.isNullOrEmpty(nextPageToken)) {
       request = request.toBuilder().setPageToken(nextPageToken).build();
     } else {
       break;
     }
   }
 }
 
Returns
TypeDescription
UnaryCallable<ListPolicyBasedRoutesRequest,ListPolicyBasedRoutesResponse>

listPolicyBasedRoutesPagedCallable()

public final UnaryCallable<ListPolicyBasedRoutesRequest,PolicyBasedRoutingServiceClient.ListPolicyBasedRoutesPagedResponse> listPolicyBasedRoutesPagedCallable()

Lists PolicyBasedRoutes in a given project and location.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (PolicyBasedRoutingServiceClient policyBasedRoutingServiceClient =
     PolicyBasedRoutingServiceClient.create()) {
   ListPolicyBasedRoutesRequest request =
       ListPolicyBasedRoutesRequest.newBuilder()
           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .setFilter("filter-1274492040")
           .setOrderBy("orderBy-1207110587")
           .build();
   ApiFuture<PolicyBasedRoute> future =
       policyBasedRoutingServiceClient.listPolicyBasedRoutesPagedCallable().futureCall(request);
   // Do something.
   for (PolicyBasedRoute element : future.get().iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Returns
TypeDescription
UnaryCallable<ListPolicyBasedRoutesRequest,ListPolicyBasedRoutesPagedResponse>

shutdown()

public void shutdown()

shutdownNow()

public void shutdownNow()