@BetaApi @Generated(value="by gapic-generator-java") public class MaintenanceClient 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 (MaintenanceClient maintenanceClient = MaintenanceClient.create()) {
ResourceMaintenanceName name =
ResourceMaintenanceName.of("[PROJECT]", "[LOCATION]", "[RESOURCE_MAINTENANCE]");
ResourceMaintenance response = maintenanceClient.getResourceMaintenance(name);
}
Note: close() needs to be called on the MaintenanceClient 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 |
|---|---|---|
SummarizeMaintenances |
Retrieves the statistics of a specific maintenance. |
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.
|
ListResourceMaintenances |
Retrieve a collection of resource maintenances. |
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.
|
GetResourceMaintenance |
Retrieve a single resource maintenance. |
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.
|
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.
|
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 MaintenanceSettings 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
MaintenanceSettings maintenanceSettings =
MaintenanceSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
.build();
MaintenanceClient maintenanceClient = MaintenanceClient.create(maintenanceSettings);
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
MaintenanceSettings maintenanceSettings =
MaintenanceSettings.newBuilder().setEndpoint(myEndpoint).build();
MaintenanceClient maintenanceClient = MaintenanceClient.create(maintenanceSettings);
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
MaintenanceSettings maintenanceSettings = MaintenanceSettings.newHttpJsonBuilder().build();
MaintenanceClient maintenanceClient = MaintenanceClient.create(maintenanceSettings);
Please refer to the GitHub repository's samples for more quickstart code snippets.
| Modifier and Type | Class and Description |
|---|---|
static class |
MaintenanceClient.ListLocationsFixedSizeCollection |
static class |
MaintenanceClient.ListLocationsPage |
static class |
MaintenanceClient.ListLocationsPagedResponse |
static class |
MaintenanceClient.ListResourceMaintenancesFixedSizeCollection |
static class |
MaintenanceClient.ListResourceMaintenancesPage |
static class |
MaintenanceClient.ListResourceMaintenancesPagedResponse |
static class |
MaintenanceClient.SummarizeMaintenancesFixedSizeCollection |
static class |
MaintenanceClient.SummarizeMaintenancesPage |
static class |
MaintenanceClient.SummarizeMaintenancesPagedResponse |
| Modifier | Constructor and Description |
|---|---|
protected |
MaintenanceClient(MaintenanceSettings settings)
Constructs an instance of MaintenanceClient, using the given settings.
|
protected |
MaintenanceClient(MaintenanceStub stub) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
awaitTermination(long duration,
TimeUnit unit) |
void |
close() |
static MaintenanceClient |
create()
Constructs an instance of MaintenanceClient with default settings.
|
static MaintenanceClient |
create(MaintenanceSettings settings)
Constructs an instance of MaintenanceClient, using the given settings.
|
static MaintenanceClient |
create(MaintenanceStub stub)
Constructs an instance of MaintenanceClient, using the given stub for making calls.
|
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.
|
ResourceMaintenance |
getResourceMaintenance(GetResourceMaintenanceRequest request)
Retrieve a single resource maintenance.
|
ResourceMaintenance |
getResourceMaintenance(ResourceMaintenanceName name)
Retrieve a single resource maintenance.
|
ResourceMaintenance |
getResourceMaintenance(String name)
Retrieve a single resource maintenance.
|
com.google.api.gax.rpc.UnaryCallable<GetResourceMaintenanceRequest,ResourceMaintenance> |
getResourceMaintenanceCallable()
Retrieve a single resource maintenance.
|
MaintenanceSettings |
getSettings() |
MaintenanceStub |
getStub() |
boolean |
isShutdown() |
boolean |
isTerminated() |
MaintenanceClient.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,MaintenanceClient.ListLocationsPagedResponse> |
listLocationsPagedCallable()
Lists information about the supported locations for this service.
|
MaintenanceClient.ListResourceMaintenancesPagedResponse |
listResourceMaintenances(ListResourceMaintenancesRequest request)
Retrieve a collection of resource maintenances.
|
MaintenanceClient.ListResourceMaintenancesPagedResponse |
listResourceMaintenances(LocationName parent)
Retrieve a collection of resource maintenances.
|
MaintenanceClient.ListResourceMaintenancesPagedResponse |
listResourceMaintenances(String parent)
Retrieve a collection of resource maintenances.
|
com.google.api.gax.rpc.UnaryCallable<ListResourceMaintenancesRequest,ListResourceMaintenancesResponse> |
listResourceMaintenancesCallable()
Retrieve a collection of resource maintenances.
|
com.google.api.gax.rpc.UnaryCallable<ListResourceMaintenancesRequest,MaintenanceClient.ListResourceMaintenancesPagedResponse> |
listResourceMaintenancesPagedCallable()
Retrieve a collection of resource maintenances.
|
void |
shutdown() |
void |
shutdownNow() |
MaintenanceClient.SummarizeMaintenancesPagedResponse |
summarizeMaintenances(LocationName parent)
Retrieves the statistics of a specific maintenance.
|
MaintenanceClient.SummarizeMaintenancesPagedResponse |
summarizeMaintenances(String parent)
Retrieves the statistics of a specific maintenance.
|
MaintenanceClient.SummarizeMaintenancesPagedResponse |
summarizeMaintenances(SummarizeMaintenancesRequest request)
Retrieves the statistics of a specific maintenance.
|
com.google.api.gax.rpc.UnaryCallable<SummarizeMaintenancesRequest,SummarizeMaintenancesResponse> |
summarizeMaintenancesCallable()
Retrieves the statistics of a specific maintenance.
|
com.google.api.gax.rpc.UnaryCallable<SummarizeMaintenancesRequest,MaintenanceClient.SummarizeMaintenancesPagedResponse> |
summarizeMaintenancesPagedCallable()
Retrieves the statistics of a specific maintenance.
|
protected MaintenanceClient(MaintenanceSettings settings) throws IOException
IOExceptionprotected MaintenanceClient(MaintenanceStub stub)
public static final MaintenanceClient create() throws IOException
IOExceptionpublic static final MaintenanceClient create(MaintenanceSettings settings) throws IOException
IOExceptionpublic static final MaintenanceClient create(MaintenanceStub stub)
public final MaintenanceSettings getSettings()
public MaintenanceStub getStub()
public final MaintenanceClient.SummarizeMaintenancesPagedResponse summarizeMaintenances(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 (MaintenanceClient maintenanceClient = MaintenanceClient.create()) {
LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
for (MaintenanceSummary element :
maintenanceClient.summarizeMaintenances(parent).iterateAll()) {
// doThingsWith(element);
}
}
parent - Required. The parent of the resource maintenance. eg.
`projects/123/locations/*`com.google.api.gax.rpc.ApiException - if the remote call failspublic final MaintenanceClient.SummarizeMaintenancesPagedResponse summarizeMaintenances(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 (MaintenanceClient maintenanceClient = MaintenanceClient.create()) {
String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
for (MaintenanceSummary element :
maintenanceClient.summarizeMaintenances(parent).iterateAll()) {
// doThingsWith(element);
}
}
parent - Required. The parent of the resource maintenance. eg.
`projects/123/locations/*`com.google.api.gax.rpc.ApiException - if the remote call failspublic final MaintenanceClient.SummarizeMaintenancesPagedResponse summarizeMaintenances(SummarizeMaintenancesRequest 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 (MaintenanceClient maintenanceClient = MaintenanceClient.create()) {
SummarizeMaintenancesRequest request =
SummarizeMaintenancesRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.setFilter("filter-1274492040")
.setOrderBy("orderBy-1207110587")
.build();
for (MaintenanceSummary element :
maintenanceClient.summarizeMaintenances(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<SummarizeMaintenancesRequest,MaintenanceClient.SummarizeMaintenancesPagedResponse> summarizeMaintenancesPagedCallable()
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 (MaintenanceClient maintenanceClient = MaintenanceClient.create()) {
SummarizeMaintenancesRequest request =
SummarizeMaintenancesRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.setFilter("filter-1274492040")
.setOrderBy("orderBy-1207110587")
.build();
ApiFuture<MaintenanceSummary> future =
maintenanceClient.summarizeMaintenancesPagedCallable().futureCall(request);
// Do something.
for (MaintenanceSummary element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
public final com.google.api.gax.rpc.UnaryCallable<SummarizeMaintenancesRequest,SummarizeMaintenancesResponse> summarizeMaintenancesCallable()
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 (MaintenanceClient maintenanceClient = MaintenanceClient.create()) {
SummarizeMaintenancesRequest request =
SummarizeMaintenancesRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.setFilter("filter-1274492040")
.setOrderBy("orderBy-1207110587")
.build();
while (true) {
SummarizeMaintenancesResponse response =
maintenanceClient.summarizeMaintenancesCallable().call(request);
for (MaintenanceSummary element : response.getMaintenancesList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
public final MaintenanceClient.ListResourceMaintenancesPagedResponse listResourceMaintenances(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 (MaintenanceClient maintenanceClient = MaintenanceClient.create()) {
LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
for (ResourceMaintenance element :
maintenanceClient.listResourceMaintenances(parent).iterateAll()) {
// doThingsWith(element);
}
}
parent - Required. The parent of the resource maintenance.com.google.api.gax.rpc.ApiException - if the remote call failspublic final MaintenanceClient.ListResourceMaintenancesPagedResponse listResourceMaintenances(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 (MaintenanceClient maintenanceClient = MaintenanceClient.create()) {
String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
for (ResourceMaintenance element :
maintenanceClient.listResourceMaintenances(parent).iterateAll()) {
// doThingsWith(element);
}
}
parent - Required. The parent of the resource maintenance.com.google.api.gax.rpc.ApiException - if the remote call failspublic final MaintenanceClient.ListResourceMaintenancesPagedResponse listResourceMaintenances(ListResourceMaintenancesRequest 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 (MaintenanceClient maintenanceClient = MaintenanceClient.create()) {
ListResourceMaintenancesRequest request =
ListResourceMaintenancesRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.setFilter("filter-1274492040")
.setOrderBy("orderBy-1207110587")
.build();
for (ResourceMaintenance element :
maintenanceClient.listResourceMaintenances(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<ListResourceMaintenancesRequest,MaintenanceClient.ListResourceMaintenancesPagedResponse> listResourceMaintenancesPagedCallable()
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 (MaintenanceClient maintenanceClient = MaintenanceClient.create()) {
ListResourceMaintenancesRequest request =
ListResourceMaintenancesRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.setFilter("filter-1274492040")
.setOrderBy("orderBy-1207110587")
.build();
ApiFuture<ResourceMaintenance> future =
maintenanceClient.listResourceMaintenancesPagedCallable().futureCall(request);
// Do something.
for (ResourceMaintenance element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
public final com.google.api.gax.rpc.UnaryCallable<ListResourceMaintenancesRequest,ListResourceMaintenancesResponse> listResourceMaintenancesCallable()
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 (MaintenanceClient maintenanceClient = MaintenanceClient.create()) {
ListResourceMaintenancesRequest request =
ListResourceMaintenancesRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.setFilter("filter-1274492040")
.setOrderBy("orderBy-1207110587")
.build();
while (true) {
ListResourceMaintenancesResponse response =
maintenanceClient.listResourceMaintenancesCallable().call(request);
for (ResourceMaintenance element : response.getResourceMaintenancesList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
public final ResourceMaintenance getResourceMaintenance(ResourceMaintenanceName 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 (MaintenanceClient maintenanceClient = MaintenanceClient.create()) {
ResourceMaintenanceName name =
ResourceMaintenanceName.of("[PROJECT]", "[LOCATION]", "[RESOURCE_MAINTENANCE]");
ResourceMaintenance response = maintenanceClient.getResourceMaintenance(name);
}
name - Required. The resource name of the resource within a service.com.google.api.gax.rpc.ApiException - if the remote call failspublic final ResourceMaintenance getResourceMaintenance(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 (MaintenanceClient maintenanceClient = MaintenanceClient.create()) {
String name =
ResourceMaintenanceName.of("[PROJECT]", "[LOCATION]", "[RESOURCE_MAINTENANCE]")
.toString();
ResourceMaintenance response = maintenanceClient.getResourceMaintenance(name);
}
name - Required. The resource name of the resource within a service.com.google.api.gax.rpc.ApiException - if the remote call failspublic final ResourceMaintenance getResourceMaintenance(GetResourceMaintenanceRequest 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 (MaintenanceClient maintenanceClient = MaintenanceClient.create()) {
GetResourceMaintenanceRequest request =
GetResourceMaintenanceRequest.newBuilder()
.setName(
ResourceMaintenanceName.of("[PROJECT]", "[LOCATION]", "[RESOURCE_MAINTENANCE]")
.toString())
.build();
ResourceMaintenance response = maintenanceClient.getResourceMaintenance(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<GetResourceMaintenanceRequest,ResourceMaintenance> getResourceMaintenanceCallable()
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 (MaintenanceClient maintenanceClient = MaintenanceClient.create()) {
GetResourceMaintenanceRequest request =
GetResourceMaintenanceRequest.newBuilder()
.setName(
ResourceMaintenanceName.of("[PROJECT]", "[LOCATION]", "[RESOURCE_MAINTENANCE]")
.toString())
.build();
ApiFuture<ResourceMaintenance> future =
maintenanceClient.getResourceMaintenanceCallable().futureCall(request);
// Do something.
ResourceMaintenance response = future.get();
}
public final MaintenanceClient.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 (MaintenanceClient maintenanceClient = MaintenanceClient.create()) {
ListLocationsRequest request =
ListLocationsRequest.newBuilder()
.setName("name3373707")
.setFilter("filter-1274492040")
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
for (Location element : maintenanceClient.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,MaintenanceClient.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 (MaintenanceClient maintenanceClient = MaintenanceClient.create()) {
ListLocationsRequest request =
ListLocationsRequest.newBuilder()
.setName("name3373707")
.setFilter("filter-1274492040")
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
ApiFuture<Location> future =
maintenanceClient.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 (MaintenanceClient maintenanceClient = MaintenanceClient.create()) {
ListLocationsRequest request =
ListLocationsRequest.newBuilder()
.setName("name3373707")
.setFilter("filter-1274492040")
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
while (true) {
ListLocationsResponse response = maintenanceClient.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 (MaintenanceClient maintenanceClient = MaintenanceClient.create()) {
GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
Location response = maintenanceClient.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 (MaintenanceClient maintenanceClient = MaintenanceClient.create()) {
GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
ApiFuture<Location> future = maintenanceClient.getLocationCallable().futureCall(request);
// Do something.
Location 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 © 2025 Google LLC. All rights reserved.