@Generated(value="by gapic-generator-java") public class ReservationSubBlocksClient 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 (ReservationSubBlocksClient reservationSubBlocksClient =
ReservationSubBlocksClient.create()) {
String project = "project-309310695";
String zone = "zone3744684";
String parentName = "parentName-244870571";
String reservationSubBlock = "reservationSubBlock-1816847847";
ReservationSubBlocksGetResponse response =
reservationSubBlocksClient.get(project, zone, parentName, reservationSubBlock);
}
Note: close() needs to be called on the ReservationSubBlocksClient 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 |
|---|---|---|
Get |
Retrieves information about the specified reservation subBlock. |
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.
|
List |
Retrieves a list of reservation subBlocks under a single reservation. |
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.
|
PerformMaintenance |
Allows customers to perform maintenance on a reservation subBlock |
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.
|
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 ReservationSubBlocksSettings 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
ReservationSubBlocksSettings reservationSubBlocksSettings =
ReservationSubBlocksSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
.build();
ReservationSubBlocksClient reservationSubBlocksClient =
ReservationSubBlocksClient.create(reservationSubBlocksSettings);
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
ReservationSubBlocksSettings reservationSubBlocksSettings =
ReservationSubBlocksSettings.newBuilder().setEndpoint(myEndpoint).build();
ReservationSubBlocksClient reservationSubBlocksClient =
ReservationSubBlocksClient.create(reservationSubBlocksSettings);
Please refer to the GitHub repository's samples for more quickstart code snippets.
| Modifier and Type | Class and Description |
|---|---|
static class |
ReservationSubBlocksClient.ListFixedSizeCollection |
static class |
ReservationSubBlocksClient.ListPage |
static class |
ReservationSubBlocksClient.ListPagedResponse |
| Modifier | Constructor and Description |
|---|---|
protected |
ReservationSubBlocksClient(ReservationSubBlocksSettings settings)
Constructs an instance of ReservationSubBlocksClient, using the given settings.
|
protected |
ReservationSubBlocksClient(ReservationSubBlocksStub stub) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
awaitTermination(long duration,
TimeUnit unit) |
void |
close() |
static ReservationSubBlocksClient |
create()
Constructs an instance of ReservationSubBlocksClient with default settings.
|
static ReservationSubBlocksClient |
create(ReservationSubBlocksSettings settings)
Constructs an instance of ReservationSubBlocksClient, using the given settings.
|
static ReservationSubBlocksClient |
create(ReservationSubBlocksStub stub)
Constructs an instance of ReservationSubBlocksClient, using the given stub for making calls.
|
ReservationSubBlocksGetResponse |
get(GetReservationSubBlockRequest request)
Retrieves information about the specified reservation subBlock.
|
ReservationSubBlocksGetResponse |
get(String project,
String zone,
String parentName,
String reservationSubBlock)
Retrieves information about the specified reservation subBlock.
|
com.google.api.gax.rpc.UnaryCallable<GetReservationSubBlockRequest,ReservationSubBlocksGetResponse> |
getCallable()
Retrieves information about the specified reservation subBlock.
|
ReservationSubBlocksSettings |
getSettings() |
ReservationSubBlocksStub |
getStub() |
boolean |
isShutdown() |
boolean |
isTerminated() |
ReservationSubBlocksClient.ListPagedResponse |
list(ListReservationSubBlocksRequest request)
Retrieves a list of reservation subBlocks under a single reservation.
|
ReservationSubBlocksClient.ListPagedResponse |
list(String project,
String zone,
String parentName)
Retrieves a list of reservation subBlocks under a single reservation.
|
com.google.api.gax.rpc.UnaryCallable<ListReservationSubBlocksRequest,ReservationSubBlocksListResponse> |
listCallable()
Retrieves a list of reservation subBlocks under a single reservation.
|
com.google.api.gax.rpc.UnaryCallable<ListReservationSubBlocksRequest,ReservationSubBlocksClient.ListPagedResponse> |
listPagedCallable()
Retrieves a list of reservation subBlocks under a single reservation.
|
com.google.api.gax.longrunning.OperationFuture<Operation,Operation> |
performMaintenanceAsync(PerformMaintenanceReservationSubBlockRequest request)
Allows customers to perform maintenance on a reservation subBlock
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 (ReservationSubBlocksClient reservationSubBlocksClient =
ReservationSubBlocksClient.create()) {
PerformMaintenanceReservationSubBlockRequest request =
PerformMaintenanceReservationSubBlockRequest.newBuilder()
.setParentName("parentName-244870571")
.setProject("project-309310695")
.setRequestId("requestId693933066")
.setReservationSubBlock("reservationSubBlock-1816847847")
.setZone("zone3744684")
.build();
Operation response = reservationSubBlocksClient.performMaintenanceAsync(request).get();
}
|
com.google.api.gax.longrunning.OperationFuture<Operation,Operation> |
performMaintenanceAsync(String project,
String zone,
String parentName,
String reservationSubBlock)
Allows customers to perform maintenance on a reservation subBlock
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 (ReservationSubBlocksClient reservationSubBlocksClient =
ReservationSubBlocksClient.create()) {
String project = "project-309310695";
String zone = "zone3744684";
String parentName = "parentName-244870571";
String reservationSubBlock = "reservationSubBlock-1816847847";
Operation response =
reservationSubBlocksClient
.performMaintenanceAsync(project, zone, parentName, reservationSubBlock)
.get();
}
|
com.google.api.gax.rpc.UnaryCallable<PerformMaintenanceReservationSubBlockRequest,Operation> |
performMaintenanceCallable()
Allows customers to perform maintenance on a reservation subBlock
Sample code:
{@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 (ReservationSubBlocksClient reservationSubBlocksClient =
ReservationSubBlocksClient.create()) {
PerformMaintenanceReservationSubBlockRequest request =
PerformMaintenanceReservationSubBlockRequest.newBuilder()
.setParentName("parentName-244870571")
.setProject("project-309310695")
.setRequestId("requestId693933066")
.setReservationSubBlock("reservationSubBlock-1816847847")
.setZone("zone3744684")
.build();
ApiFuture
|
com.google.api.gax.rpc.OperationCallable<PerformMaintenanceReservationSubBlockRequest,Operation,Operation> |
performMaintenanceOperationCallable()
Allows customers to perform maintenance on a reservation subBlock
Sample code:
{@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 (ReservationSubBlocksClient reservationSubBlocksClient =
ReservationSubBlocksClient.create()) {
PerformMaintenanceReservationSubBlockRequest request =
PerformMaintenanceReservationSubBlockRequest.newBuilder()
.setParentName("parentName-244870571")
.setProject("project-309310695")
.setRequestId("requestId693933066")
.setReservationSubBlock("reservationSubBlock-1816847847")
.setZone("zone3744684")
.build();
OperationFuture
|
void |
shutdown() |
void |
shutdownNow() |
protected ReservationSubBlocksClient(ReservationSubBlocksSettings settings) throws IOException
IOExceptionprotected ReservationSubBlocksClient(ReservationSubBlocksStub stub)
public static final ReservationSubBlocksClient create() throws IOException
IOExceptionpublic static final ReservationSubBlocksClient create(ReservationSubBlocksSettings settings) throws IOException
IOExceptionpublic static final ReservationSubBlocksClient create(ReservationSubBlocksStub stub)
public final ReservationSubBlocksSettings getSettings()
public ReservationSubBlocksStub getStub()
public final ReservationSubBlocksGetResponse get(String project, String zone, String parentName, String reservationSubBlock)
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 (ReservationSubBlocksClient reservationSubBlocksClient =
ReservationSubBlocksClient.create()) {
String project = "project-309310695";
String zone = "zone3744684";
String parentName = "parentName-244870571";
String reservationSubBlock = "reservationSubBlock-1816847847";
ReservationSubBlocksGetResponse response =
reservationSubBlocksClient.get(project, zone, parentName, reservationSubBlock);
}
project - Project ID for this request.zone - Name of the zone for this request. Zone name should conform to RFC1035.parentName - The name of the parent reservation and parent block. In the format of
reservations/{reservation_name}/reservationBlocks/{reservation_block_name}reservationSubBlock - The name of the reservation subBlock. Name should conform to RFC1035
or be a resource ID.com.google.api.gax.rpc.ApiException - if the remote call failspublic final ReservationSubBlocksGetResponse get(GetReservationSubBlockRequest 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 (ReservationSubBlocksClient reservationSubBlocksClient =
ReservationSubBlocksClient.create()) {
GetReservationSubBlockRequest request =
GetReservationSubBlockRequest.newBuilder()
.setParentName("parentName-244870571")
.setProject("project-309310695")
.setReservationSubBlock("reservationSubBlock-1816847847")
.setZone("zone3744684")
.build();
ReservationSubBlocksGetResponse response = reservationSubBlocksClient.get(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<GetReservationSubBlockRequest,ReservationSubBlocksGetResponse> getCallable()
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 (ReservationSubBlocksClient reservationSubBlocksClient =
ReservationSubBlocksClient.create()) {
GetReservationSubBlockRequest request =
GetReservationSubBlockRequest.newBuilder()
.setParentName("parentName-244870571")
.setProject("project-309310695")
.setReservationSubBlock("reservationSubBlock-1816847847")
.setZone("zone3744684")
.build();
ApiFuture<ReservationSubBlocksGetResponse> future =
reservationSubBlocksClient.getCallable().futureCall(request);
// Do something.
ReservationSubBlocksGetResponse response = future.get();
}
public final ReservationSubBlocksClient.ListPagedResponse list(String project, String zone, String parentName)
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 (ReservationSubBlocksClient reservationSubBlocksClient =
ReservationSubBlocksClient.create()) {
String project = "project-309310695";
String zone = "zone3744684";
String parentName = "parentName-244870571";
for (ReservationSubBlock element :
reservationSubBlocksClient.list(project, zone, parentName).iterateAll()) {
// doThingsWith(element);
}
}
project - Project ID for this request.zone - Name of the zone for this request. Zone name should conform to RFC1035.parentName - The name of the parent reservation and parent block. In the format of
reservations/{reservation_name}/reservationBlocks/{reservation_block_name}com.google.api.gax.rpc.ApiException - if the remote call failspublic final ReservationSubBlocksClient.ListPagedResponse list(ListReservationSubBlocksRequest 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 (ReservationSubBlocksClient reservationSubBlocksClient =
ReservationSubBlocksClient.create()) {
ListReservationSubBlocksRequest request =
ListReservationSubBlocksRequest.newBuilder()
.setFilter("filter-1274492040")
.setMaxResults(1128457243)
.setOrderBy("orderBy-1207110587")
.setPageToken("pageToken873572522")
.setParentName("parentName-244870571")
.setProject("project-309310695")
.setReturnPartialSuccess(true)
.setZone("zone3744684")
.build();
for (ReservationSubBlock element : reservationSubBlocksClient.list(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<ListReservationSubBlocksRequest,ReservationSubBlocksClient.ListPagedResponse> listPagedCallable()
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 (ReservationSubBlocksClient reservationSubBlocksClient =
ReservationSubBlocksClient.create()) {
ListReservationSubBlocksRequest request =
ListReservationSubBlocksRequest.newBuilder()
.setFilter("filter-1274492040")
.setMaxResults(1128457243)
.setOrderBy("orderBy-1207110587")
.setPageToken("pageToken873572522")
.setParentName("parentName-244870571")
.setProject("project-309310695")
.setReturnPartialSuccess(true)
.setZone("zone3744684")
.build();
ApiFuture<ReservationSubBlock> future =
reservationSubBlocksClient.listPagedCallable().futureCall(request);
// Do something.
for (ReservationSubBlock element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
public final com.google.api.gax.rpc.UnaryCallable<ListReservationSubBlocksRequest,ReservationSubBlocksListResponse> listCallable()
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 (ReservationSubBlocksClient reservationSubBlocksClient =
ReservationSubBlocksClient.create()) {
ListReservationSubBlocksRequest request =
ListReservationSubBlocksRequest.newBuilder()
.setFilter("filter-1274492040")
.setMaxResults(1128457243)
.setOrderBy("orderBy-1207110587")
.setPageToken("pageToken873572522")
.setParentName("parentName-244870571")
.setProject("project-309310695")
.setReturnPartialSuccess(true)
.setZone("zone3744684")
.build();
while (true) {
ReservationSubBlocksListResponse response =
reservationSubBlocksClient.listCallable().call(request);
for (ReservationSubBlock element : response.getItemsList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
public final com.google.api.gax.longrunning.OperationFuture<Operation,Operation> performMaintenanceAsync(String project, String zone, String parentName, String reservationSubBlock)
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 (ReservationSubBlocksClient reservationSubBlocksClient =
ReservationSubBlocksClient.create()) {
String project = "project-309310695";
String zone = "zone3744684";
String parentName = "parentName-244870571";
String reservationSubBlock = "reservationSubBlock-1816847847";
Operation response =
reservationSubBlocksClient
.performMaintenanceAsync(project, zone, parentName, reservationSubBlock)
.get();
}
project - Project ID for this request.zone - Name of the zone for this request. Zone name should conform to RFC1035.parentName - The name of the parent reservation and parent block. In the format of
reservations/{reservation_name}/reservationBlocks/{reservation_block_name}reservationSubBlock - The name of the reservation subBlock. Name should conform to RFC1035
or be a resource ID.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.longrunning.OperationFuture<Operation,Operation> performMaintenanceAsync(PerformMaintenanceReservationSubBlockRequest 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 (ReservationSubBlocksClient reservationSubBlocksClient =
ReservationSubBlocksClient.create()) {
PerformMaintenanceReservationSubBlockRequest request =
PerformMaintenanceReservationSubBlockRequest.newBuilder()
.setParentName("parentName-244870571")
.setProject("project-309310695")
.setRequestId("requestId693933066")
.setReservationSubBlock("reservationSubBlock-1816847847")
.setZone("zone3744684")
.build();
Operation response = reservationSubBlocksClient.performMaintenanceAsync(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<PerformMaintenanceReservationSubBlockRequest,Operation,Operation> performMaintenanceOperationCallable()
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 (ReservationSubBlocksClient reservationSubBlocksClient =
ReservationSubBlocksClient.create()) {
PerformMaintenanceReservationSubBlockRequest request =
PerformMaintenanceReservationSubBlockRequest.newBuilder()
.setParentName("parentName-244870571")
.setProject("project-309310695")
.setRequestId("requestId693933066")
.setReservationSubBlock("reservationSubBlock-1816847847")
.setZone("zone3744684")
.build();
OperationFuture<Operation, Operation> future =
reservationSubBlocksClient.performMaintenanceOperationCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
public final com.google.api.gax.rpc.UnaryCallable<PerformMaintenanceReservationSubBlockRequest,Operation> performMaintenanceCallable()
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 (ReservationSubBlocksClient reservationSubBlocksClient =
ReservationSubBlocksClient.create()) {
PerformMaintenanceReservationSubBlockRequest request =
PerformMaintenanceReservationSubBlockRequest.newBuilder()
.setParentName("parentName-244870571")
.setProject("project-309310695")
.setRequestId("requestId693933066")
.setReservationSubBlock("reservationSubBlock-1816847847")
.setZone("zone3744684")
.build();
ApiFuture<Operation> future =
reservationSubBlocksClient.performMaintenanceCallable().futureCall(request);
// Do something.
Operation 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.