GitHub Repository | Product Reference | RPC Documentation |
Service Description: Service describing handlers for resources
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 (CloudLocationFinderClient cloudLocationFinderClient = CloudLocationFinderClient.create()) {
CloudLocationName name = CloudLocationName.of("[PROJECT]", "[LOCATION]", "[CLOUD_LOCATION]");
CloudLocation response = cloudLocationFinderClient.getCloudLocation(name);
}
Note: close() needs to be called on the CloudLocationFinderClient 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 |
---|---|---|
ListCloudLocations |
Lists cloud locations under 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.
|
GetCloudLocation |
Retrieves a resource containing information about a cloud 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.
|
SearchCloudLocations |
Searches for cloud locations from a given source 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.
|
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 CloudLocationFinderSettings 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
CloudLocationFinderSettings cloudLocationFinderSettings =
CloudLocationFinderSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
.build();
CloudLocationFinderClient cloudLocationFinderClient =
CloudLocationFinderClient.create(cloudLocationFinderSettings);
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
CloudLocationFinderSettings cloudLocationFinderSettings =
CloudLocationFinderSettings.newBuilder().setEndpoint(myEndpoint).build();
CloudLocationFinderClient cloudLocationFinderClient =
CloudLocationFinderClient.create(cloudLocationFinderSettings);
To use REST (HTTP1.1/JSON) transport (instead of gRPC) for sending and receiving requests over the wire:
// 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
CloudLocationFinderSettings cloudLocationFinderSettings =
CloudLocationFinderSettings.newHttpJsonBuilder().build();
CloudLocationFinderClient cloudLocationFinderClient =
CloudLocationFinderClient.create(cloudLocationFinderSettings);
Please refer to the GitHub repository's samples for more quickstart code snippets.
Static Methods
create()
public static final CloudLocationFinderClient create()
Constructs an instance of CloudLocationFinderClient with default settings.
Returns | |
---|---|
Type | Description |
CloudLocationFinderClient |
Exceptions | |
---|---|
Type | Description |
IOException |
create(CloudLocationFinderSettings settings)
public static final CloudLocationFinderClient create(CloudLocationFinderSettings settings)
Constructs an instance of CloudLocationFinderClient, using the given settings. The channels are created based on the settings passed in, or defaults for any settings that are not set.
Parameter | |
---|---|
Name | Description |
settings |
CloudLocationFinderSettings |
Returns | |
---|---|
Type | Description |
CloudLocationFinderClient |
Exceptions | |
---|---|
Type | Description |
IOException |
create(CloudLocationFinderStub stub)
public static final CloudLocationFinderClient create(CloudLocationFinderStub stub)
Constructs an instance of CloudLocationFinderClient, using the given stub for making calls. This is for advanced usage - prefer using create(CloudLocationFinderSettings).
Parameter | |
---|---|
Name | Description |
stub |
CloudLocationFinderStub |
Returns | |
---|---|
Type | Description |
CloudLocationFinderClient |
Constructors
CloudLocationFinderClient(CloudLocationFinderSettings settings)
protected CloudLocationFinderClient(CloudLocationFinderSettings settings)
Constructs an instance of CloudLocationFinderClient, 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 | |
---|---|
Name | Description |
settings |
CloudLocationFinderSettings |
CloudLocationFinderClient(CloudLocationFinderStub stub)
protected CloudLocationFinderClient(CloudLocationFinderStub stub)
Parameter | |
---|---|
Name | Description |
stub |
CloudLocationFinderStub |
Methods
awaitTermination(long duration, TimeUnit unit)
public boolean awaitTermination(long duration, TimeUnit unit)
Parameters | |
---|---|
Name | Description |
duration |
long |
unit |
TimeUnit |
Returns | |
---|---|
Type | Description |
boolean |
Exceptions | |
---|---|
Type | Description |
InterruptedException |
close()
public final void close()
getCloudLocation(CloudLocationName name)
public final CloudLocation getCloudLocation(CloudLocationName name)
Retrieves a resource containing information about a cloud 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 (CloudLocationFinderClient cloudLocationFinderClient = CloudLocationFinderClient.create()) {
CloudLocationName name = CloudLocationName.of("[PROJECT]", "[LOCATION]", "[CLOUD_LOCATION]");
CloudLocation response = cloudLocationFinderClient.getCloudLocation(name);
}
Parameter | |
---|---|
Name | Description |
name |
CloudLocationName Required. Name of the resource. |
Returns | |
---|---|
Type | Description |
CloudLocation |
getCloudLocation(GetCloudLocationRequest request)
public final CloudLocation getCloudLocation(GetCloudLocationRequest request)
Retrieves a resource containing information about a cloud 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 (CloudLocationFinderClient cloudLocationFinderClient = CloudLocationFinderClient.create()) {
GetCloudLocationRequest request =
GetCloudLocationRequest.newBuilder()
.setName(
CloudLocationName.of("[PROJECT]", "[LOCATION]", "[CLOUD_LOCATION]").toString())
.build();
CloudLocation response = cloudLocationFinderClient.getCloudLocation(request);
}
Parameter | |
---|---|
Name | Description |
request |
GetCloudLocationRequest The request object containing all of the parameters for the API call. |
Returns | |
---|---|
Type | Description |
CloudLocation |
getCloudLocation(String name)
public final CloudLocation getCloudLocation(String name)
Retrieves a resource containing information about a cloud 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 (CloudLocationFinderClient cloudLocationFinderClient = CloudLocationFinderClient.create()) {
String name = CloudLocationName.of("[PROJECT]", "[LOCATION]", "[CLOUD_LOCATION]").toString();
CloudLocation response = cloudLocationFinderClient.getCloudLocation(name);
}
Parameter | |
---|---|
Name | Description |
name |
String Required. Name of the resource. |
Returns | |
---|---|
Type | Description |
CloudLocation |
getCloudLocationCallable()
public final UnaryCallable<GetCloudLocationRequest,CloudLocation> getCloudLocationCallable()
Retrieves a resource containing information about a cloud 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 (CloudLocationFinderClient cloudLocationFinderClient = CloudLocationFinderClient.create()) {
GetCloudLocationRequest request =
GetCloudLocationRequest.newBuilder()
.setName(
CloudLocationName.of("[PROJECT]", "[LOCATION]", "[CLOUD_LOCATION]").toString())
.build();
ApiFuture<CloudLocation> future =
cloudLocationFinderClient.getCloudLocationCallable().futureCall(request);
// Do something.
CloudLocation response = future.get();
}
Returns | |
---|---|
Type | Description |
UnaryCallable<GetCloudLocationRequest,CloudLocation> |
getSettings()
public final CloudLocationFinderSettings getSettings()
Returns | |
---|---|
Type | Description |
CloudLocationFinderSettings |
getStub()
public CloudLocationFinderStub getStub()
Returns | |
---|---|
Type | Description |
CloudLocationFinderStub |
isShutdown()
public boolean isShutdown()
Returns | |
---|---|
Type | Description |
boolean |
isTerminated()
public boolean isTerminated()
Returns | |
---|---|
Type | Description |
boolean |
listCloudLocations(ListCloudLocationsRequest request)
public final CloudLocationFinderClient.ListCloudLocationsPagedResponse listCloudLocations(ListCloudLocationsRequest request)
Lists cloud locations under 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 (CloudLocationFinderClient cloudLocationFinderClient = CloudLocationFinderClient.create()) {
ListCloudLocationsRequest request =
ListCloudLocationsRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.setFilter("filter-1274492040")
.build();
for (CloudLocation element :
cloudLocationFinderClient.listCloudLocations(request).iterateAll()) {
// doThingsWith(element);
}
}
Parameter | |
---|---|
Name | Description |
request |
ListCloudLocationsRequest The request object containing all of the parameters for the API call. |
Returns | |
---|---|
Type | Description |
CloudLocationFinderClient.ListCloudLocationsPagedResponse |
listCloudLocations(LocationName parent)
public final CloudLocationFinderClient.ListCloudLocationsPagedResponse listCloudLocations(LocationName parent)
Lists cloud locations under 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 (CloudLocationFinderClient cloudLocationFinderClient = CloudLocationFinderClient.create()) {
LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
for (CloudLocation element :
cloudLocationFinderClient.listCloudLocations(parent).iterateAll()) {
// doThingsWith(element);
}
}
Parameter | |
---|---|
Name | Description |
parent |
LocationName Required. The parent, which owns this collection of cloud locations. Format: projects/{project}/locations/{location} |
Returns | |
---|---|
Type | Description |
CloudLocationFinderClient.ListCloudLocationsPagedResponse |
listCloudLocations(String parent)
public final CloudLocationFinderClient.ListCloudLocationsPagedResponse listCloudLocations(String parent)
Lists cloud locations under 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 (CloudLocationFinderClient cloudLocationFinderClient = CloudLocationFinderClient.create()) {
String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
for (CloudLocation element :
cloudLocationFinderClient.listCloudLocations(parent).iterateAll()) {
// doThingsWith(element);
}
}
Parameter | |
---|---|
Name | Description |
parent |
String Required. The parent, which owns this collection of cloud locations. Format: projects/{project}/locations/{location} |
Returns | |
---|---|
Type | Description |
CloudLocationFinderClient.ListCloudLocationsPagedResponse |
listCloudLocationsCallable()
public final UnaryCallable<ListCloudLocationsRequest,ListCloudLocationsResponse> listCloudLocationsCallable()
Lists cloud locations under 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 (CloudLocationFinderClient cloudLocationFinderClient = CloudLocationFinderClient.create()) {
ListCloudLocationsRequest request =
ListCloudLocationsRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.setFilter("filter-1274492040")
.build();
while (true) {
ListCloudLocationsResponse response =
cloudLocationFinderClient.listCloudLocationsCallable().call(request);
for (CloudLocation element : response.getCloudLocationsList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
Returns | |
---|---|
Type | Description |
UnaryCallable<ListCloudLocationsRequest,ListCloudLocationsResponse> |
listCloudLocationsPagedCallable()
public final UnaryCallable<ListCloudLocationsRequest,CloudLocationFinderClient.ListCloudLocationsPagedResponse> listCloudLocationsPagedCallable()
Lists cloud locations under 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 (CloudLocationFinderClient cloudLocationFinderClient = CloudLocationFinderClient.create()) {
ListCloudLocationsRequest request =
ListCloudLocationsRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.setFilter("filter-1274492040")
.build();
ApiFuture<CloudLocation> future =
cloudLocationFinderClient.listCloudLocationsPagedCallable().futureCall(request);
// Do something.
for (CloudLocation element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
Returns | |
---|---|
Type | Description |
UnaryCallable<ListCloudLocationsRequest,ListCloudLocationsPagedResponse> |
searchCloudLocations(LocationName parent, CloudLocationName sourceCloudLocation, String query)
public final CloudLocationFinderClient.SearchCloudLocationsPagedResponse searchCloudLocations(LocationName parent, CloudLocationName sourceCloudLocation, String query)
Searches for cloud locations from a given source 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 (CloudLocationFinderClient cloudLocationFinderClient = CloudLocationFinderClient.create()) {
LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
CloudLocationName sourceCloudLocation =
CloudLocationName.of("[PROJECT]", "[LOCATION]", "[CLOUD_LOCATION]");
String query = "query107944136";
for (CloudLocation element :
cloudLocationFinderClient
.searchCloudLocations(parent, sourceCloudLocation, query)
.iterateAll()) {
// doThingsWith(element);
}
}
Parameters | |
---|---|
Name | Description |
parent |
LocationName Required. The parent, which owns this collection of cloud locations. Format: projects/{project}/locations/{location} |
sourceCloudLocation |
CloudLocationName Required. The source cloud location to search from. Example search can be searching nearby cloud locations from the source cloud location by latency. |
query |
String Optional. The query string in search query syntax. While filter is used to filter the search results by attributes, query is used to specify the search requirements. |
Returns | |
---|---|
Type | Description |
CloudLocationFinderClient.SearchCloudLocationsPagedResponse |
searchCloudLocations(LocationName parent, String sourceCloudLocation, String query)
public final CloudLocationFinderClient.SearchCloudLocationsPagedResponse searchCloudLocations(LocationName parent, String sourceCloudLocation, String query)
Searches for cloud locations from a given source 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 (CloudLocationFinderClient cloudLocationFinderClient = CloudLocationFinderClient.create()) {
LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
String sourceCloudLocation =
CloudLocationName.of("[PROJECT]", "[LOCATION]", "[CLOUD_LOCATION]").toString();
String query = "query107944136";
for (CloudLocation element :
cloudLocationFinderClient
.searchCloudLocations(parent, sourceCloudLocation, query)
.iterateAll()) {
// doThingsWith(element);
}
}
Parameters | |
---|---|
Name | Description |
parent |
LocationName Required. The parent, which owns this collection of cloud locations. Format: projects/{project}/locations/{location} |
sourceCloudLocation |
String Required. The source cloud location to search from. Example search can be searching nearby cloud locations from the source cloud location by latency. |
query |
String Optional. The query string in search query syntax. While filter is used to filter the search results by attributes, query is used to specify the search requirements. |
Returns | |
---|---|
Type | Description |
CloudLocationFinderClient.SearchCloudLocationsPagedResponse |
searchCloudLocations(SearchCloudLocationsRequest request)
public final CloudLocationFinderClient.SearchCloudLocationsPagedResponse searchCloudLocations(SearchCloudLocationsRequest request)
Searches for cloud locations from a given source 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 (CloudLocationFinderClient cloudLocationFinderClient = CloudLocationFinderClient.create()) {
SearchCloudLocationsRequest request =
SearchCloudLocationsRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.setSourceCloudLocation(
CloudLocationName.of("[PROJECT]", "[LOCATION]", "[CLOUD_LOCATION]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.setQuery("query107944136")
.build();
for (CloudLocation element :
cloudLocationFinderClient.searchCloudLocations(request).iterateAll()) {
// doThingsWith(element);
}
}
Parameter | |
---|---|
Name | Description |
request |
SearchCloudLocationsRequest The request object containing all of the parameters for the API call. |
Returns | |
---|---|
Type | Description |
CloudLocationFinderClient.SearchCloudLocationsPagedResponse |
searchCloudLocations(String parent, CloudLocationName sourceCloudLocation, String query)
public final CloudLocationFinderClient.SearchCloudLocationsPagedResponse searchCloudLocations(String parent, CloudLocationName sourceCloudLocation, String query)
Searches for cloud locations from a given source 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 (CloudLocationFinderClient cloudLocationFinderClient = CloudLocationFinderClient.create()) {
String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
CloudLocationName sourceCloudLocation =
CloudLocationName.of("[PROJECT]", "[LOCATION]", "[CLOUD_LOCATION]");
String query = "query107944136";
for (CloudLocation element :
cloudLocationFinderClient
.searchCloudLocations(parent, sourceCloudLocation, query)
.iterateAll()) {
// doThingsWith(element);
}
}
Parameters | |
---|---|
Name | Description |
parent |
String Required. The parent, which owns this collection of cloud locations. Format: projects/{project}/locations/{location} |
sourceCloudLocation |
CloudLocationName Required. The source cloud location to search from. Example search can be searching nearby cloud locations from the source cloud location by latency. |
query |
String Optional. The query string in search query syntax. While filter is used to filter the search results by attributes, query is used to specify the search requirements. |
Returns | |
---|---|
Type | Description |
CloudLocationFinderClient.SearchCloudLocationsPagedResponse |
searchCloudLocations(String parent, String sourceCloudLocation, String query)
public final CloudLocationFinderClient.SearchCloudLocationsPagedResponse searchCloudLocations(String parent, String sourceCloudLocation, String query)
Searches for cloud locations from a given source 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 (CloudLocationFinderClient cloudLocationFinderClient = CloudLocationFinderClient.create()) {
String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
String sourceCloudLocation =
CloudLocationName.of("[PROJECT]", "[LOCATION]", "[CLOUD_LOCATION]").toString();
String query = "query107944136";
for (CloudLocation element :
cloudLocationFinderClient
.searchCloudLocations(parent, sourceCloudLocation, query)
.iterateAll()) {
// doThingsWith(element);
}
}
Parameters | |
---|---|
Name | Description |
parent |
String Required. The parent, which owns this collection of cloud locations. Format: projects/{project}/locations/{location} |
sourceCloudLocation |
String Required. The source cloud location to search from. Example search can be searching nearby cloud locations from the source cloud location by latency. |
query |
String Optional. The query string in search query syntax. While filter is used to filter the search results by attributes, query is used to specify the search requirements. |
Returns | |
---|---|
Type | Description |
CloudLocationFinderClient.SearchCloudLocationsPagedResponse |
searchCloudLocationsCallable()
public final UnaryCallable<SearchCloudLocationsRequest,SearchCloudLocationsResponse> searchCloudLocationsCallable()
Searches for cloud locations from a given source 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 (CloudLocationFinderClient cloudLocationFinderClient = CloudLocationFinderClient.create()) {
SearchCloudLocationsRequest request =
SearchCloudLocationsRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.setSourceCloudLocation(
CloudLocationName.of("[PROJECT]", "[LOCATION]", "[CLOUD_LOCATION]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.setQuery("query107944136")
.build();
while (true) {
SearchCloudLocationsResponse response =
cloudLocationFinderClient.searchCloudLocationsCallable().call(request);
for (CloudLocation element : response.getCloudLocationsList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
Returns | |
---|---|
Type | Description |
UnaryCallable<SearchCloudLocationsRequest,SearchCloudLocationsResponse> |
searchCloudLocationsPagedCallable()
public final UnaryCallable<SearchCloudLocationsRequest,CloudLocationFinderClient.SearchCloudLocationsPagedResponse> searchCloudLocationsPagedCallable()
Searches for cloud locations from a given source 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 (CloudLocationFinderClient cloudLocationFinderClient = CloudLocationFinderClient.create()) {
SearchCloudLocationsRequest request =
SearchCloudLocationsRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.setSourceCloudLocation(
CloudLocationName.of("[PROJECT]", "[LOCATION]", "[CLOUD_LOCATION]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.setQuery("query107944136")
.build();
ApiFuture<CloudLocation> future =
cloudLocationFinderClient.searchCloudLocationsPagedCallable().futureCall(request);
// Do something.
for (CloudLocation element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
Returns | |
---|---|
Type | Description |
UnaryCallable<SearchCloudLocationsRequest,SearchCloudLocationsPagedResponse> |
shutdown()
public void shutdown()
shutdownNow()
public void shutdownNow()