@Generated(value="by gapic-generator-java") public class PolicyBasedRoutingServiceClient extends Object implements com.google.api.gax.core.BackgroundResource
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]", "[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().
| Method | Description | Method Variants |
|---|---|---|
| ListPolicyBasedRoutes | Lists PolicyBasedRoutes in a given project and location. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
| GetPolicyBasedRoute | Gets details of a single PolicyBasedRoute. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
| CreatePolicyBasedRoute | Creates a new PolicyBasedRoute in a given project and location. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
| DeletePolicyBasedRoute | Deletes a single PolicyBasedRoute. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
| ListLocations | Lists information about the supported locations for this service. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
| GetLocation | Gets information about a location. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
| SetIamPolicy | Sets the access control policy on the specified resource. Replacesany existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`errors. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
| GetIamPolicy | Gets the access control policy for a resource. Returns an empty policyif the resource exists and does not have a policy set. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
| TestIamPermissions | Returns permissions that a caller has on the specified resource. If theresource does not exist, this will return an empty set ofpermissions, not a `NOT_FOUND` error. Note: This operation is designed to be used for buildingpermission-aware UIs and command-line tools, not for authorizationchecking. This operation may "fail open" without warning. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Callable method variants take no parameters and return 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.
| Modifier and Type | Class and Description |
|---|---|
static class |
PolicyBasedRoutingServiceClient.ListLocationsFixedSizeCollection |
static class |
PolicyBasedRoutingServiceClient.ListLocationsPage |
static class |
PolicyBasedRoutingServiceClient.ListLocationsPagedResponse |
static class |
PolicyBasedRoutingServiceClient.ListPolicyBasedRoutesFixedSizeCollection |
static class |
PolicyBasedRoutingServiceClient.ListPolicyBasedRoutesPage |
static class |
PolicyBasedRoutingServiceClient.ListPolicyBasedRoutesPagedResponse |
| Modifier | Constructor and Description |
|---|---|
protected |
PolicyBasedRoutingServiceClient(PolicyBasedRoutingServiceSettings settings)
Constructs an instance of PolicyBasedRoutingServiceClient, using the given settings.
|
protected |
PolicyBasedRoutingServiceClient(PolicyBasedRoutingServiceStub stub) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
awaitTermination(long duration,
TimeUnit unit) |
void |
close() |
static PolicyBasedRoutingServiceClient |
create()
Constructs an instance of PolicyBasedRoutingServiceClient with default settings.
|
static PolicyBasedRoutingServiceClient |
create(PolicyBasedRoutingServiceSettings settings)
Constructs an instance of PolicyBasedRoutingServiceClient, using the given settings.
|
static PolicyBasedRoutingServiceClient |
create(PolicyBasedRoutingServiceStub stub)
Constructs an instance of PolicyBasedRoutingServiceClient, using the given stub for making
calls.
|
com.google.api.gax.longrunning.OperationFuture<PolicyBasedRoute,OperationMetadata> |
createPolicyBasedRouteAsync(CreatePolicyBasedRouteRequest request)
Creates a new PolicyBasedRoute in a given project and location.
|
com.google.api.gax.longrunning.OperationFuture<PolicyBasedRoute,OperationMetadata> |
createPolicyBasedRouteAsync(LocationName parent,
PolicyBasedRoute policyBasedRoute,
String policyBasedRouteId)
Creates a new PolicyBasedRoute in a given project and location.
|
com.google.api.gax.longrunning.OperationFuture<PolicyBasedRoute,OperationMetadata> |
createPolicyBasedRouteAsync(String parent,
PolicyBasedRoute policyBasedRoute,
String policyBasedRouteId)
Creates a new PolicyBasedRoute in a given project and location.
|
com.google.api.gax.rpc.UnaryCallable<CreatePolicyBasedRouteRequest,com.google.longrunning.Operation> |
createPolicyBasedRouteCallable()
Creates a new PolicyBasedRoute in a given project and location.
|
com.google.api.gax.rpc.OperationCallable<CreatePolicyBasedRouteRequest,PolicyBasedRoute,OperationMetadata> |
createPolicyBasedRouteOperationCallable()
Creates a new PolicyBasedRoute in a given project and location.
|
com.google.api.gax.longrunning.OperationFuture<com.google.protobuf.Empty,OperationMetadata> |
deletePolicyBasedRouteAsync(DeletePolicyBasedRouteRequest request)
Deletes a single PolicyBasedRoute.
|
com.google.api.gax.longrunning.OperationFuture<com.google.protobuf.Empty,OperationMetadata> |
deletePolicyBasedRouteAsync(PolicyBasedRouteName name)
Deletes a single PolicyBasedRoute.
|
com.google.api.gax.longrunning.OperationFuture<com.google.protobuf.Empty,OperationMetadata> |
deletePolicyBasedRouteAsync(String name)
Deletes a single PolicyBasedRoute.
|
com.google.api.gax.rpc.UnaryCallable<DeletePolicyBasedRouteRequest,com.google.longrunning.Operation> |
deletePolicyBasedRouteCallable()
Deletes a single PolicyBasedRoute.
|
com.google.api.gax.rpc.OperationCallable<DeletePolicyBasedRouteRequest,com.google.protobuf.Empty,OperationMetadata> |
deletePolicyBasedRouteOperationCallable()
Deletes a single PolicyBasedRoute.
|
com.google.iam.v1.Policy |
getIamPolicy(com.google.iam.v1.GetIamPolicyRequest request)
Gets the access control policy for a resource.
|
com.google.api.gax.rpc.UnaryCallable<com.google.iam.v1.GetIamPolicyRequest,com.google.iam.v1.Policy> |
getIamPolicyCallable()
Gets the access control policy for a resource.
|
com.google.cloud.location.Location |
getLocation(com.google.cloud.location.GetLocationRequest request)
Gets information about a location.
|
com.google.api.gax.rpc.UnaryCallable<com.google.cloud.location.GetLocationRequest,com.google.cloud.location.Location> |
getLocationCallable()
Gets information about a location.
|
com.google.longrunning.OperationsClient |
getOperationsClient()
Returns the OperationsClient that can be used to query the status of a long-running operation
returned by another API method call.
|
PolicyBasedRoute |
getPolicyBasedRoute(GetPolicyBasedRouteRequest request)
Gets details of a single PolicyBasedRoute.
|
PolicyBasedRoute |
getPolicyBasedRoute(PolicyBasedRouteName name)
Gets details of a single PolicyBasedRoute.
|
PolicyBasedRoute |
getPolicyBasedRoute(String name)
Gets details of a single PolicyBasedRoute.
|
com.google.api.gax.rpc.UnaryCallable<GetPolicyBasedRouteRequest,PolicyBasedRoute> |
getPolicyBasedRouteCallable()
Gets details of a single PolicyBasedRoute.
|
PolicyBasedRoutingServiceSettings |
getSettings() |
PolicyBasedRoutingServiceStub |
getStub() |
boolean |
isShutdown() |
boolean |
isTerminated() |
PolicyBasedRoutingServiceClient.ListLocationsPagedResponse |
listLocations(com.google.cloud.location.ListLocationsRequest request)
Lists information about the supported locations for this service.
|
com.google.api.gax.rpc.UnaryCallable<com.google.cloud.location.ListLocationsRequest,com.google.cloud.location.ListLocationsResponse> |
listLocationsCallable()
Lists information about the supported locations for this service.
|
com.google.api.gax.rpc.UnaryCallable<com.google.cloud.location.ListLocationsRequest,PolicyBasedRoutingServiceClient.ListLocationsPagedResponse> |
listLocationsPagedCallable()
Lists information about the supported locations for this service.
|
PolicyBasedRoutingServiceClient.ListPolicyBasedRoutesPagedResponse |
listPolicyBasedRoutes(ListPolicyBasedRoutesRequest request)
Lists PolicyBasedRoutes in a given project and location.
|
PolicyBasedRoutingServiceClient.ListPolicyBasedRoutesPagedResponse |
listPolicyBasedRoutes(LocationName parent)
Lists PolicyBasedRoutes in a given project and location.
|
PolicyBasedRoutingServiceClient.ListPolicyBasedRoutesPagedResponse |
listPolicyBasedRoutes(String parent)
Lists PolicyBasedRoutes in a given project and location.
|
com.google.api.gax.rpc.UnaryCallable<ListPolicyBasedRoutesRequest,ListPolicyBasedRoutesResponse> |
listPolicyBasedRoutesCallable()
Lists PolicyBasedRoutes in a given project and location.
|
com.google.api.gax.rpc.UnaryCallable<ListPolicyBasedRoutesRequest,PolicyBasedRoutingServiceClient.ListPolicyBasedRoutesPagedResponse> |
listPolicyBasedRoutesPagedCallable()
Lists PolicyBasedRoutes in a given project and location.
|
com.google.iam.v1.Policy |
setIamPolicy(com.google.iam.v1.SetIamPolicyRequest request)
Sets the access control policy on the specified resource.
|
com.google.api.gax.rpc.UnaryCallable<com.google.iam.v1.SetIamPolicyRequest,com.google.iam.v1.Policy> |
setIamPolicyCallable()
Sets the access control policy on the specified resource.
|
void |
shutdown() |
void |
shutdownNow() |
com.google.iam.v1.TestIamPermissionsResponse |
testIamPermissions(com.google.iam.v1.TestIamPermissionsRequest request)
Returns permissions that a caller has on the specified resource.
|
com.google.api.gax.rpc.UnaryCallable<com.google.iam.v1.TestIamPermissionsRequest,com.google.iam.v1.TestIamPermissionsResponse> |
testIamPermissionsCallable()
Returns permissions that a caller has on the specified resource.
|
protected PolicyBasedRoutingServiceClient(PolicyBasedRoutingServiceSettings settings) throws IOException
IOExceptionprotected PolicyBasedRoutingServiceClient(PolicyBasedRoutingServiceStub stub)
public static final PolicyBasedRoutingServiceClient create() throws IOException
IOExceptionpublic static final PolicyBasedRoutingServiceClient create(PolicyBasedRoutingServiceSettings settings) throws IOException
IOExceptionpublic static final PolicyBasedRoutingServiceClient create(PolicyBasedRoutingServiceStub stub)
public final PolicyBasedRoutingServiceSettings getSettings()
public PolicyBasedRoutingServiceStub getStub()
public final com.google.longrunning.OperationsClient getOperationsClient()
public final PolicyBasedRoutingServiceClient.ListPolicyBasedRoutesPagedResponse listPolicyBasedRoutes(LocationName parent)
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);
}
}
parent - Required. The parent resource's name.com.google.api.gax.rpc.ApiException - if the remote call failspublic final PolicyBasedRoutingServiceClient.ListPolicyBasedRoutesPagedResponse listPolicyBasedRoutes(String parent)
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);
}
}
parent - Required. The parent resource's name.com.google.api.gax.rpc.ApiException - if the remote call failspublic final PolicyBasedRoutingServiceClient.ListPolicyBasedRoutesPagedResponse listPolicyBasedRoutes(ListPolicyBasedRoutesRequest request)
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);
}
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<ListPolicyBasedRoutesRequest,PolicyBasedRoutingServiceClient.ListPolicyBasedRoutesPagedResponse> listPolicyBasedRoutesPagedCallable()
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);
}
}
public final com.google.api.gax.rpc.UnaryCallable<ListPolicyBasedRoutesRequest,ListPolicyBasedRoutesResponse> listPolicyBasedRoutesCallable()
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;
}
}
}
public final PolicyBasedRoute getPolicyBasedRoute(PolicyBasedRouteName name)
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]", "[POLICY_BASED_ROUTE]");
PolicyBasedRoute response = policyBasedRoutingServiceClient.getPolicyBasedRoute(name);
}
name - Required. Name of the PolicyBasedRoute resource to get.com.google.api.gax.rpc.ApiException - if the remote call failspublic final PolicyBasedRoute getPolicyBasedRoute(String name)
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]", "[POLICY_BASED_ROUTE]").toString();
PolicyBasedRoute response = policyBasedRoutingServiceClient.getPolicyBasedRoute(name);
}
name - Required. Name of the PolicyBasedRoute resource to get.com.google.api.gax.rpc.ApiException - if the remote call failspublic final PolicyBasedRoute getPolicyBasedRoute(GetPolicyBasedRouteRequest request)
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]", "[POLICY_BASED_ROUTE]").toString())
.build();
PolicyBasedRoute response = policyBasedRoutingServiceClient.getPolicyBasedRoute(request);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<GetPolicyBasedRouteRequest,PolicyBasedRoute> getPolicyBasedRouteCallable()
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]", "[POLICY_BASED_ROUTE]").toString())
.build();
ApiFuture<PolicyBasedRoute> future =
policyBasedRoutingServiceClient.getPolicyBasedRouteCallable().futureCall(request);
// Do something.
PolicyBasedRoute response = future.get();
}
public final com.google.api.gax.longrunning.OperationFuture<PolicyBasedRoute,OperationMetadata> createPolicyBasedRouteAsync(LocationName parent, PolicyBasedRoute policyBasedRoute, String policyBasedRouteId)
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();
}
parent - Required. The parent resource's name of the PolicyBasedRoute.policyBasedRoute - Required. Initial values for a new Policy Based Route.policyBasedRouteId - Required. Unique id for the Policy Based Route to create.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.longrunning.OperationFuture<PolicyBasedRoute,OperationMetadata> createPolicyBasedRouteAsync(String parent, PolicyBasedRoute policyBasedRoute, String policyBasedRouteId)
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();
}
parent - Required. The parent resource's name of the PolicyBasedRoute.policyBasedRoute - Required. Initial values for a new Policy Based Route.policyBasedRouteId - Required. Unique id for the Policy Based Route to create.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.longrunning.OperationFuture<PolicyBasedRoute,OperationMetadata> createPolicyBasedRouteAsync(CreatePolicyBasedRouteRequest request)
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();
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.OperationCallable<CreatePolicyBasedRouteRequest,PolicyBasedRoute,OperationMetadata> createPolicyBasedRouteOperationCallable()
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();
}
public final com.google.api.gax.rpc.UnaryCallable<CreatePolicyBasedRouteRequest,com.google.longrunning.Operation> createPolicyBasedRouteCallable()
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();
}
public final com.google.api.gax.longrunning.OperationFuture<com.google.protobuf.Empty,OperationMetadata> deletePolicyBasedRouteAsync(PolicyBasedRouteName name)
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]", "[POLICY_BASED_ROUTE]");
policyBasedRoutingServiceClient.deletePolicyBasedRouteAsync(name).get();
}
name - Required. Name of the PolicyBasedRoute resource to delete.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.longrunning.OperationFuture<com.google.protobuf.Empty,OperationMetadata> deletePolicyBasedRouteAsync(String name)
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]", "[POLICY_BASED_ROUTE]").toString();
policyBasedRoutingServiceClient.deletePolicyBasedRouteAsync(name).get();
}
name - Required. Name of the PolicyBasedRoute resource to delete.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.longrunning.OperationFuture<com.google.protobuf.Empty,OperationMetadata> deletePolicyBasedRouteAsync(DeletePolicyBasedRouteRequest request)
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]", "[POLICY_BASED_ROUTE]").toString())
.setRequestId("requestId693933066")
.build();
policyBasedRoutingServiceClient.deletePolicyBasedRouteAsync(request).get();
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.OperationCallable<DeletePolicyBasedRouteRequest,com.google.protobuf.Empty,OperationMetadata> deletePolicyBasedRouteOperationCallable()
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]", "[POLICY_BASED_ROUTE]").toString())
.setRequestId("requestId693933066")
.build();
OperationFuture<Empty, OperationMetadata> future =
policyBasedRoutingServiceClient
.deletePolicyBasedRouteOperationCallable()
.futureCall(request);
// Do something.
future.get();
}
public final com.google.api.gax.rpc.UnaryCallable<DeletePolicyBasedRouteRequest,com.google.longrunning.Operation> deletePolicyBasedRouteCallable()
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]", "[POLICY_BASED_ROUTE]").toString())
.setRequestId("requestId693933066")
.build();
ApiFuture<Operation> future =
policyBasedRoutingServiceClient.deletePolicyBasedRouteCallable().futureCall(request);
// Do something.
future.get();
}
public final PolicyBasedRoutingServiceClient.ListLocationsPagedResponse listLocations(com.google.cloud.location.ListLocationsRequest request)
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()) {
ListLocationsRequest request =
ListLocationsRequest.newBuilder()
.setName("name3373707")
.setFilter("filter-1274492040")
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
for (Location element : policyBasedRoutingServiceClient.listLocations(request).iterateAll()) {
// doThingsWith(element);
}
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<com.google.cloud.location.ListLocationsRequest,PolicyBasedRoutingServiceClient.ListLocationsPagedResponse> listLocationsPagedCallable()
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()) {
ListLocationsRequest request =
ListLocationsRequest.newBuilder()
.setName("name3373707")
.setFilter("filter-1274492040")
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
ApiFuture<Location> future =
policyBasedRoutingServiceClient.listLocationsPagedCallable().futureCall(request);
// Do something.
for (Location element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
public final com.google.api.gax.rpc.UnaryCallable<com.google.cloud.location.ListLocationsRequest,com.google.cloud.location.ListLocationsResponse> listLocationsCallable()
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()) {
ListLocationsRequest request =
ListLocationsRequest.newBuilder()
.setName("name3373707")
.setFilter("filter-1274492040")
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
while (true) {
ListLocationsResponse response =
policyBasedRoutingServiceClient.listLocationsCallable().call(request);
for (Location element : response.getLocationsList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
public final com.google.cloud.location.Location getLocation(com.google.cloud.location.GetLocationRequest request)
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()) {
GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
Location response = policyBasedRoutingServiceClient.getLocation(request);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<com.google.cloud.location.GetLocationRequest,com.google.cloud.location.Location> getLocationCallable()
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()) {
GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
ApiFuture<Location> future =
policyBasedRoutingServiceClient.getLocationCallable().futureCall(request);
// Do something.
Location response = future.get();
}
public final com.google.iam.v1.Policy setIamPolicy(com.google.iam.v1.SetIamPolicyRequest request)
Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`errors.
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()) {
SetIamPolicyRequest request =
SetIamPolicyRequest.newBuilder()
.setResource(GroupName.of("[PROJECT]", "[HUB]", "[GROUP]").toString())
.setPolicy(Policy.newBuilder().build())
.setUpdateMask(FieldMask.newBuilder().build())
.build();
Policy response = policyBasedRoutingServiceClient.setIamPolicy(request);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<com.google.iam.v1.SetIamPolicyRequest,com.google.iam.v1.Policy> setIamPolicyCallable()
Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`errors.
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()) {
SetIamPolicyRequest request =
SetIamPolicyRequest.newBuilder()
.setResource(GroupName.of("[PROJECT]", "[HUB]", "[GROUP]").toString())
.setPolicy(Policy.newBuilder().build())
.setUpdateMask(FieldMask.newBuilder().build())
.build();
ApiFuture<Policy> future =
policyBasedRoutingServiceClient.setIamPolicyCallable().futureCall(request);
// Do something.
Policy response = future.get();
}
public final com.google.iam.v1.Policy getIamPolicy(com.google.iam.v1.GetIamPolicyRequest request)
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()) {
GetIamPolicyRequest request =
GetIamPolicyRequest.newBuilder()
.setResource(GroupName.of("[PROJECT]", "[HUB]", "[GROUP]").toString())
.setOptions(GetPolicyOptions.newBuilder().build())
.build();
Policy response = policyBasedRoutingServiceClient.getIamPolicy(request);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<com.google.iam.v1.GetIamPolicyRequest,com.google.iam.v1.Policy> getIamPolicyCallable()
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()) {
GetIamPolicyRequest request =
GetIamPolicyRequest.newBuilder()
.setResource(GroupName.of("[PROJECT]", "[HUB]", "[GROUP]").toString())
.setOptions(GetPolicyOptions.newBuilder().build())
.build();
ApiFuture<Policy> future =
policyBasedRoutingServiceClient.getIamPolicyCallable().futureCall(request);
// Do something.
Policy response = future.get();
}
public final com.google.iam.v1.TestIamPermissionsResponse testIamPermissions(com.google.iam.v1.TestIamPermissionsRequest request)
Note: This operation is designed to be used for buildingpermission-aware UIs and command-line tools, not for authorizationchecking. This operation may "fail open" without warning.
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()) {
TestIamPermissionsRequest request =
TestIamPermissionsRequest.newBuilder()
.setResource(GroupName.of("[PROJECT]", "[HUB]", "[GROUP]").toString())
.addAllPermissions(new ArrayList<String>())
.build();
TestIamPermissionsResponse response =
policyBasedRoutingServiceClient.testIamPermissions(request);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<com.google.iam.v1.TestIamPermissionsRequest,com.google.iam.v1.TestIamPermissionsResponse> testIamPermissionsCallable()
Note: This operation is designed to be used for buildingpermission-aware UIs and command-line tools, not for authorizationchecking. This operation may "fail open" without warning.
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()) {
TestIamPermissionsRequest request =
TestIamPermissionsRequest.newBuilder()
.setResource(GroupName.of("[PROJECT]", "[HUB]", "[GROUP]").toString())
.addAllPermissions(new ArrayList<String>())
.build();
ApiFuture<TestIamPermissionsResponse> future =
policyBasedRoutingServiceClient.testIamPermissionsCallable().futureCall(request);
// Do something.
TestIamPermissionsResponse response = future.get();
}
public final void close()
close in interface AutoCloseablepublic void shutdown()
shutdown in interface com.google.api.gax.core.BackgroundResourcepublic boolean isShutdown()
isShutdown in interface com.google.api.gax.core.BackgroundResourcepublic boolean isTerminated()
isTerminated in interface com.google.api.gax.core.BackgroundResourcepublic void shutdownNow()
shutdownNow in interface com.google.api.gax.core.BackgroundResourcepublic boolean awaitTermination(long duration,
TimeUnit unit)
throws InterruptedException
awaitTermination in interface com.google.api.gax.core.BackgroundResourceInterruptedExceptionCopyright © 2024 Google LLC. All rights reserved.