@Generated(value="by gapic-generator") @BetaApi public class ReservationClient 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:
try (ReservationClient reservationClient = ReservationClient.create()) {
ProjectZoneReservationName reservation = ProjectZoneReservationName.of("[PROJECT]", "[ZONE]", "[RESERVATION]");
Operation response = reservationClient.deleteReservation(reservation);
}
Note: close() needs to be called on the reservationClient object to clean up resources such as threads. In the example above, try-with-resources is used, which automatically calls close().
The surface of this class includes several types of Java methods for each of the API's methods:
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 ReservationSettings to create(). For example:
To customize credentials:
ReservationSettings reservationSettings =
ReservationSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
.build();
ReservationClient reservationClient =
ReservationClient.create(reservationSettings);
To customize the endpoint:
ReservationSettings reservationSettings =
ReservationSettings.newBuilder().setEndpoint(myEndpoint).build();
ReservationClient reservationClient =
ReservationClient.create(reservationSettings);
Modifier and Type | Class and Description |
---|---|
static class |
ReservationClient.AggregatedListReservationsFixedSizeCollection |
static class |
ReservationClient.AggregatedListReservationsPage |
static class |
ReservationClient.AggregatedListReservationsPagedResponse |
static class |
ReservationClient.ListReservationsFixedSizeCollection |
static class |
ReservationClient.ListReservationsPage |
static class |
ReservationClient.ListReservationsPagedResponse |
Modifier | Constructor and Description |
---|---|
protected |
ReservationClient(ReservationSettings settings)
Constructs an instance of ReservationClient, using the given settings.
|
protected |
ReservationClient(ReservationStub stub) |
Modifier and Type | Method and Description |
---|---|
ReservationClient.AggregatedListReservationsPagedResponse |
aggregatedListReservations(AggregatedListReservationsHttpRequest request)
Retrieves an aggregated list of reservations.
|
ReservationClient.AggregatedListReservationsPagedResponse |
aggregatedListReservations(ProjectName project)
Retrieves an aggregated list of reservations.
|
ReservationClient.AggregatedListReservationsPagedResponse |
aggregatedListReservations(String project)
Retrieves an aggregated list of reservations.
|
com.google.api.gax.rpc.UnaryCallable<AggregatedListReservationsHttpRequest,ReservationAggregatedList> |
aggregatedListReservationsCallable()
Retrieves an aggregated list of reservations.
|
com.google.api.gax.rpc.UnaryCallable<AggregatedListReservationsHttpRequest,ReservationClient.AggregatedListReservationsPagedResponse> |
aggregatedListReservationsPagedCallable()
Retrieves an aggregated list of reservations.
|
boolean |
awaitTermination(long duration,
TimeUnit unit) |
void |
close() |
static ReservationClient |
create()
Constructs an instance of ReservationClient with default settings.
|
static ReservationClient |
create(ReservationSettings settings)
Constructs an instance of ReservationClient, using the given settings.
|
static ReservationClient |
create(ReservationStub stub)
Constructs an instance of ReservationClient, using the given stub for making calls.
|
Operation |
deleteReservation(DeleteReservationHttpRequest request)
Deletes the specified reservation.
|
Operation |
deleteReservation(ProjectZoneReservationName reservation)
Deletes the specified reservation.
|
Operation |
deleteReservation(String reservation)
Deletes the specified reservation.
|
com.google.api.gax.rpc.UnaryCallable<DeleteReservationHttpRequest,Operation> |
deleteReservationCallable()
Deletes the specified reservation.
|
Policy |
getIamPolicyReservation(GetIamPolicyReservationHttpRequest request)
Gets the access control policy for a resource.
|
Policy |
getIamPolicyReservation(ProjectZoneReservationResourceName resource)
Gets the access control policy for a resource.
|
Policy |
getIamPolicyReservation(String resource)
Gets the access control policy for a resource.
|
com.google.api.gax.rpc.UnaryCallable<GetIamPolicyReservationHttpRequest,Policy> |
getIamPolicyReservationCallable()
Gets the access control policy for a resource.
|
Reservation |
getReservation(GetReservationHttpRequest request)
Retrieves information about the specified reservation.
|
Reservation |
getReservation(ProjectZoneReservationName reservation)
Retrieves information about the specified reservation.
|
Reservation |
getReservation(String reservation)
Retrieves information about the specified reservation.
|
com.google.api.gax.rpc.UnaryCallable<GetReservationHttpRequest,Reservation> |
getReservationCallable()
Retrieves information about the specified reservation.
|
ReservationSettings |
getSettings() |
ReservationStub |
getStub() |
Operation |
insertReservation(InsertReservationHttpRequest request)
Creates a new reservation.
|
Operation |
insertReservation(ProjectZoneName zone,
Reservation reservationResource)
Creates a new reservation.
|
Operation |
insertReservation(String zone,
Reservation reservationResource)
Creates a new reservation.
|
com.google.api.gax.rpc.UnaryCallable<InsertReservationHttpRequest,Operation> |
insertReservationCallable()
Creates a new reservation.
|
boolean |
isShutdown() |
boolean |
isTerminated() |
ReservationClient.ListReservationsPagedResponse |
listReservations(ListReservationsHttpRequest request)
A list of all the reservations that have been configured for the specified project in specified
zone.
|
ReservationClient.ListReservationsPagedResponse |
listReservations(ProjectZoneName zone)
A list of all the reservations that have been configured for the specified project in specified
zone.
|
ReservationClient.ListReservationsPagedResponse |
listReservations(String zone)
A list of all the reservations that have been configured for the specified project in specified
zone.
|
com.google.api.gax.rpc.UnaryCallable<ListReservationsHttpRequest,ReservationList> |
listReservationsCallable()
A list of all the reservations that have been configured for the specified project in specified
zone.
|
com.google.api.gax.rpc.UnaryCallable<ListReservationsHttpRequest,ReservationClient.ListReservationsPagedResponse> |
listReservationsPagedCallable()
A list of all the reservations that have been configured for the specified project in specified
zone.
|
Operation |
resizeReservation(ProjectZoneReservationName reservation,
ReservationsResizeRequest reservationsResizeRequestResource)
Resizes the reservation (applicable to standalone reservations only).
|
Operation |
resizeReservation(ResizeReservationHttpRequest request)
Resizes the reservation (applicable to standalone reservations only).
|
Operation |
resizeReservation(String reservation,
ReservationsResizeRequest reservationsResizeRequestResource)
Resizes the reservation (applicable to standalone reservations only).
|
com.google.api.gax.rpc.UnaryCallable<ResizeReservationHttpRequest,Operation> |
resizeReservationCallable()
Resizes the reservation (applicable to standalone reservations only).
|
Policy |
setIamPolicyReservation(ProjectZoneReservationResourceName resource,
ZoneSetPolicyRequest zoneSetPolicyRequestResource)
Sets the access control policy on the specified resource.
|
Policy |
setIamPolicyReservation(SetIamPolicyReservationHttpRequest request)
Sets the access control policy on the specified resource.
|
Policy |
setIamPolicyReservation(String resource,
ZoneSetPolicyRequest zoneSetPolicyRequestResource)
Sets the access control policy on the specified resource.
|
com.google.api.gax.rpc.UnaryCallable<SetIamPolicyReservationHttpRequest,Policy> |
setIamPolicyReservationCallable()
Sets the access control policy on the specified resource.
|
void |
shutdown() |
void |
shutdownNow() |
TestPermissionsResponse |
testIamPermissionsReservation(ProjectZoneReservationResourceName resource,
TestPermissionsRequest testPermissionsRequestResource)
Returns permissions that a caller has on the specified resource.
|
TestPermissionsResponse |
testIamPermissionsReservation(String resource,
TestPermissionsRequest testPermissionsRequestResource)
Returns permissions that a caller has on the specified resource.
|
TestPermissionsResponse |
testIamPermissionsReservation(TestIamPermissionsReservationHttpRequest request)
Returns permissions that a caller has on the specified resource.
|
com.google.api.gax.rpc.UnaryCallable<TestIamPermissionsReservationHttpRequest,TestPermissionsResponse> |
testIamPermissionsReservationCallable()
Returns permissions that a caller has on the specified resource.
|
protected ReservationClient(ReservationSettings settings) throws IOException
IOException
@BetaApi(value="A restructuring of stub classes is planned, so this may break in the future") protected ReservationClient(ReservationStub stub)
public static final ReservationClient create() throws IOException
IOException
public static final ReservationClient create(ReservationSettings settings) throws IOException
IOException
@BetaApi(value="A restructuring of stub classes is planned, so this may break in the future") public static final ReservationClient create(ReservationStub stub)
public final ReservationSettings getSettings()
@BetaApi(value="A restructuring of stub classes is planned, so this may break in the future") public ReservationStub getStub()
@BetaApi public final ReservationClient.AggregatedListReservationsPagedResponse aggregatedListReservations(ProjectName project)
Sample code:
try (ReservationClient reservationClient = ReservationClient.create()) {
ProjectName project = ProjectName.of("[PROJECT]");
for (ReservationsScopedList element : reservationClient.aggregatedListReservations(project).iterateAll()) {
// doThingsWith(element);
}
}
project
- Project ID for this request.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final ReservationClient.AggregatedListReservationsPagedResponse aggregatedListReservations(String project)
Sample code:
try (ReservationClient reservationClient = ReservationClient.create()) {
ProjectName project = ProjectName.of("[PROJECT]");
for (ReservationsScopedList element : reservationClient.aggregatedListReservations(project.toString()).iterateAll()) {
// doThingsWith(element);
}
}
project
- Project ID for this request.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final ReservationClient.AggregatedListReservationsPagedResponse aggregatedListReservations(AggregatedListReservationsHttpRequest request)
Sample code:
try (ReservationClient reservationClient = ReservationClient.create()) {
String formattedProject = ProjectName.format("[PROJECT]");
AggregatedListReservationsHttpRequest request = AggregatedListReservationsHttpRequest.newBuilder()
.setProject(formattedProject)
.build();
for (ReservationsScopedList element : reservationClient.aggregatedListReservations(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 fails@BetaApi public final com.google.api.gax.rpc.UnaryCallable<AggregatedListReservationsHttpRequest,ReservationClient.AggregatedListReservationsPagedResponse> aggregatedListReservationsPagedCallable()
Sample code:
try (ReservationClient reservationClient = ReservationClient.create()) {
String formattedProject = ProjectName.format("[PROJECT]");
AggregatedListReservationsHttpRequest request = AggregatedListReservationsHttpRequest.newBuilder()
.setProject(formattedProject)
.build();
ApiFuture<AggregatedListReservationsPagedResponse> future = reservationClient.aggregatedListReservationsPagedCallable().futureCall(request);
// Do something
for (ReservationsScopedList element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
@BetaApi public final com.google.api.gax.rpc.UnaryCallable<AggregatedListReservationsHttpRequest,ReservationAggregatedList> aggregatedListReservationsCallable()
Sample code:
try (ReservationClient reservationClient = ReservationClient.create()) {
String formattedProject = ProjectName.format("[PROJECT]");
AggregatedListReservationsHttpRequest request = AggregatedListReservationsHttpRequest.newBuilder()
.setProject(formattedProject)
.build();
while (true) {
ReservationAggregatedList response = reservationClient.aggregatedListReservationsCallable().call(request);
for (ReservationsScopedList element : response.getItemsMap()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
@BetaApi public final Operation deleteReservation(ProjectZoneReservationName reservation)
Sample code:
try (ReservationClient reservationClient = ReservationClient.create()) {
ProjectZoneReservationName reservation = ProjectZoneReservationName.of("[PROJECT]", "[ZONE]", "[RESERVATION]");
Operation response = reservationClient.deleteReservation(reservation);
}
reservation
- Name of the reservation to delete.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Operation deleteReservation(String reservation)
Sample code:
try (ReservationClient reservationClient = ReservationClient.create()) {
ProjectZoneReservationName reservation = ProjectZoneReservationName.of("[PROJECT]", "[ZONE]", "[RESERVATION]");
Operation response = reservationClient.deleteReservation(reservation.toString());
}
reservation
- Name of the reservation to delete.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Operation deleteReservation(DeleteReservationHttpRequest request)
Sample code:
try (ReservationClient reservationClient = ReservationClient.create()) {
String formattedReservation = ProjectZoneReservationName.format("[PROJECT]", "[ZONE]", "[RESERVATION]");
DeleteReservationHttpRequest request = DeleteReservationHttpRequest.newBuilder()
.setReservation(formattedReservation)
.build();
Operation response = reservationClient.deleteReservation(request);
}
request
- The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final com.google.api.gax.rpc.UnaryCallable<DeleteReservationHttpRequest,Operation> deleteReservationCallable()
Sample code:
try (ReservationClient reservationClient = ReservationClient.create()) {
String formattedReservation = ProjectZoneReservationName.format("[PROJECT]", "[ZONE]", "[RESERVATION]");
DeleteReservationHttpRequest request = DeleteReservationHttpRequest.newBuilder()
.setReservation(formattedReservation)
.build();
ApiFuture<Operation> future = reservationClient.deleteReservationCallable().futureCall(request);
// Do something
Operation response = future.get();
}
@BetaApi public final Reservation getReservation(ProjectZoneReservationName reservation)
Sample code:
try (ReservationClient reservationClient = ReservationClient.create()) {
ProjectZoneReservationName reservation = ProjectZoneReservationName.of("[PROJECT]", "[ZONE]", "[RESERVATION]");
Reservation response = reservationClient.getReservation(reservation);
}
reservation
- Name of the reservation to retrieve.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Reservation getReservation(String reservation)
Sample code:
try (ReservationClient reservationClient = ReservationClient.create()) {
ProjectZoneReservationName reservation = ProjectZoneReservationName.of("[PROJECT]", "[ZONE]", "[RESERVATION]");
Reservation response = reservationClient.getReservation(reservation.toString());
}
reservation
- Name of the reservation to retrieve.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Reservation getReservation(GetReservationHttpRequest request)
Sample code:
try (ReservationClient reservationClient = ReservationClient.create()) {
String formattedReservation = ProjectZoneReservationName.format("[PROJECT]", "[ZONE]", "[RESERVATION]");
GetReservationHttpRequest request = GetReservationHttpRequest.newBuilder()
.setReservation(formattedReservation)
.build();
Reservation response = reservationClient.getReservation(request);
}
request
- The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final com.google.api.gax.rpc.UnaryCallable<GetReservationHttpRequest,Reservation> getReservationCallable()
Sample code:
try (ReservationClient reservationClient = ReservationClient.create()) {
String formattedReservation = ProjectZoneReservationName.format("[PROJECT]", "[ZONE]", "[RESERVATION]");
GetReservationHttpRequest request = GetReservationHttpRequest.newBuilder()
.setReservation(formattedReservation)
.build();
ApiFuture<Reservation> future = reservationClient.getReservationCallable().futureCall(request);
// Do something
Reservation response = future.get();
}
@BetaApi public final Policy getIamPolicyReservation(ProjectZoneReservationResourceName resource)
Sample code:
try (ReservationClient reservationClient = ReservationClient.create()) {
ProjectZoneReservationResourceName resource = ProjectZoneReservationResourceName.of("[PROJECT]", "[ZONE]", "[RESOURCE]");
Policy response = reservationClient.getIamPolicyReservation(resource);
}
resource
- Name or id of the resource for this request.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Policy getIamPolicyReservation(String resource)
Sample code:
try (ReservationClient reservationClient = ReservationClient.create()) {
ProjectZoneReservationResourceName resource = ProjectZoneReservationResourceName.of("[PROJECT]", "[ZONE]", "[RESOURCE]");
Policy response = reservationClient.getIamPolicyReservation(resource.toString());
}
resource
- Name or id of the resource for this request.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Policy getIamPolicyReservation(GetIamPolicyReservationHttpRequest request)
Sample code:
try (ReservationClient reservationClient = ReservationClient.create()) {
String formattedResource = ProjectZoneReservationResourceName.format("[PROJECT]", "[ZONE]", "[RESOURCE]");
GetIamPolicyReservationHttpRequest request = GetIamPolicyReservationHttpRequest.newBuilder()
.setResource(formattedResource)
.build();
Policy response = reservationClient.getIamPolicyReservation(request);
}
request
- The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final com.google.api.gax.rpc.UnaryCallable<GetIamPolicyReservationHttpRequest,Policy> getIamPolicyReservationCallable()
Sample code:
try (ReservationClient reservationClient = ReservationClient.create()) {
String formattedResource = ProjectZoneReservationResourceName.format("[PROJECT]", "[ZONE]", "[RESOURCE]");
GetIamPolicyReservationHttpRequest request = GetIamPolicyReservationHttpRequest.newBuilder()
.setResource(formattedResource)
.build();
ApiFuture<Policy> future = reservationClient.getIamPolicyReservationCallable().futureCall(request);
// Do something
Policy response = future.get();
}
@BetaApi public final Operation insertReservation(ProjectZoneName zone, Reservation reservationResource)
Sample code:
try (ReservationClient reservationClient = ReservationClient.create()) {
ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]");
Reservation reservationResource = Reservation.newBuilder().build();
Operation response = reservationClient.insertReservation(zone, reservationResource);
}
zone
- Name of the zone for this request.reservationResource
- Represents a reservation resource. A reservation ensures that
capacity is held in a specific zone even if the reserved VMs are not running. For more
information, read Reserving zonal resources. (== resource_for beta.reservations ==) (==
resource_for v1.reservations ==)com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Operation insertReservation(String zone, Reservation reservationResource)
Sample code:
try (ReservationClient reservationClient = ReservationClient.create()) {
ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]");
Reservation reservationResource = Reservation.newBuilder().build();
Operation response = reservationClient.insertReservation(zone.toString(), reservationResource);
}
zone
- Name of the zone for this request.reservationResource
- Represents a reservation resource. A reservation ensures that
capacity is held in a specific zone even if the reserved VMs are not running. For more
information, read Reserving zonal resources. (== resource_for beta.reservations ==) (==
resource_for v1.reservations ==)com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Operation insertReservation(InsertReservationHttpRequest request)
Sample code:
try (ReservationClient reservationClient = ReservationClient.create()) {
String formattedZone = ProjectZoneName.format("[PROJECT]", "[ZONE]");
Reservation reservationResource = Reservation.newBuilder().build();
InsertReservationHttpRequest request = InsertReservationHttpRequest.newBuilder()
.setZone(formattedZone)
.setReservationResource(reservationResource)
.build();
Operation response = reservationClient.insertReservation(request);
}
request
- The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final com.google.api.gax.rpc.UnaryCallable<InsertReservationHttpRequest,Operation> insertReservationCallable()
Sample code:
try (ReservationClient reservationClient = ReservationClient.create()) {
String formattedZone = ProjectZoneName.format("[PROJECT]", "[ZONE]");
Reservation reservationResource = Reservation.newBuilder().build();
InsertReservationHttpRequest request = InsertReservationHttpRequest.newBuilder()
.setZone(formattedZone)
.setReservationResource(reservationResource)
.build();
ApiFuture<Operation> future = reservationClient.insertReservationCallable().futureCall(request);
// Do something
Operation response = future.get();
}
@BetaApi public final ReservationClient.ListReservationsPagedResponse listReservations(ProjectZoneName zone)
Sample code:
try (ReservationClient reservationClient = ReservationClient.create()) {
ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]");
for (Reservation element : reservationClient.listReservations(zone).iterateAll()) {
// doThingsWith(element);
}
}
zone
- Name of the zone for this request.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final ReservationClient.ListReservationsPagedResponse listReservations(String zone)
Sample code:
try (ReservationClient reservationClient = ReservationClient.create()) {
ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]");
for (Reservation element : reservationClient.listReservations(zone.toString()).iterateAll()) {
// doThingsWith(element);
}
}
zone
- Name of the zone for this request.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final ReservationClient.ListReservationsPagedResponse listReservations(ListReservationsHttpRequest request)
Sample code:
try (ReservationClient reservationClient = ReservationClient.create()) {
String formattedZone = ProjectZoneName.format("[PROJECT]", "[ZONE]");
ListReservationsHttpRequest request = ListReservationsHttpRequest.newBuilder()
.setZone(formattedZone)
.build();
for (Reservation element : reservationClient.listReservations(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 fails@BetaApi public final com.google.api.gax.rpc.UnaryCallable<ListReservationsHttpRequest,ReservationClient.ListReservationsPagedResponse> listReservationsPagedCallable()
Sample code:
try (ReservationClient reservationClient = ReservationClient.create()) {
String formattedZone = ProjectZoneName.format("[PROJECT]", "[ZONE]");
ListReservationsHttpRequest request = ListReservationsHttpRequest.newBuilder()
.setZone(formattedZone)
.build();
ApiFuture<ListReservationsPagedResponse> future = reservationClient.listReservationsPagedCallable().futureCall(request);
// Do something
for (Reservation element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
@BetaApi public final com.google.api.gax.rpc.UnaryCallable<ListReservationsHttpRequest,ReservationList> listReservationsCallable()
Sample code:
try (ReservationClient reservationClient = ReservationClient.create()) {
String formattedZone = ProjectZoneName.format("[PROJECT]", "[ZONE]");
ListReservationsHttpRequest request = ListReservationsHttpRequest.newBuilder()
.setZone(formattedZone)
.build();
while (true) {
ReservationList response = reservationClient.listReservationsCallable().call(request);
for (Reservation element : response.getItemsList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
@BetaApi public final Operation resizeReservation(ProjectZoneReservationName reservation, ReservationsResizeRequest reservationsResizeRequestResource)
Sample code:
try (ReservationClient reservationClient = ReservationClient.create()) {
ProjectZoneReservationName reservation = ProjectZoneReservationName.of("[PROJECT]", "[ZONE]", "[RESERVATION]");
ReservationsResizeRequest reservationsResizeRequestResource = ReservationsResizeRequest.newBuilder().build();
Operation response = reservationClient.resizeReservation(reservation, reservationsResizeRequestResource);
}
reservation
- Name of the reservation to update.reservationsResizeRequestResource
- com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Operation resizeReservation(String reservation, ReservationsResizeRequest reservationsResizeRequestResource)
Sample code:
try (ReservationClient reservationClient = ReservationClient.create()) {
ProjectZoneReservationName reservation = ProjectZoneReservationName.of("[PROJECT]", "[ZONE]", "[RESERVATION]");
ReservationsResizeRequest reservationsResizeRequestResource = ReservationsResizeRequest.newBuilder().build();
Operation response = reservationClient.resizeReservation(reservation.toString(), reservationsResizeRequestResource);
}
reservation
- Name of the reservation to update.reservationsResizeRequestResource
- com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Operation resizeReservation(ResizeReservationHttpRequest request)
Sample code:
try (ReservationClient reservationClient = ReservationClient.create()) {
String formattedReservation = ProjectZoneReservationName.format("[PROJECT]", "[ZONE]", "[RESERVATION]");
ReservationsResizeRequest reservationsResizeRequestResource = ReservationsResizeRequest.newBuilder().build();
ResizeReservationHttpRequest request = ResizeReservationHttpRequest.newBuilder()
.setReservation(formattedReservation)
.setReservationsResizeRequestResource(reservationsResizeRequestResource)
.build();
Operation response = reservationClient.resizeReservation(request);
}
request
- The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final com.google.api.gax.rpc.UnaryCallable<ResizeReservationHttpRequest,Operation> resizeReservationCallable()
Sample code:
try (ReservationClient reservationClient = ReservationClient.create()) {
String formattedReservation = ProjectZoneReservationName.format("[PROJECT]", "[ZONE]", "[RESERVATION]");
ReservationsResizeRequest reservationsResizeRequestResource = ReservationsResizeRequest.newBuilder().build();
ResizeReservationHttpRequest request = ResizeReservationHttpRequest.newBuilder()
.setReservation(formattedReservation)
.setReservationsResizeRequestResource(reservationsResizeRequestResource)
.build();
ApiFuture<Operation> future = reservationClient.resizeReservationCallable().futureCall(request);
// Do something
Operation response = future.get();
}
@BetaApi public final Policy setIamPolicyReservation(ProjectZoneReservationResourceName resource, ZoneSetPolicyRequest zoneSetPolicyRequestResource)
Sample code:
try (ReservationClient reservationClient = ReservationClient.create()) {
ProjectZoneReservationResourceName resource = ProjectZoneReservationResourceName.of("[PROJECT]", "[ZONE]", "[RESOURCE]");
ZoneSetPolicyRequest zoneSetPolicyRequestResource = ZoneSetPolicyRequest.newBuilder().build();
Policy response = reservationClient.setIamPolicyReservation(resource, zoneSetPolicyRequestResource);
}
resource
- Name or id of the resource for this request.zoneSetPolicyRequestResource
- com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Policy setIamPolicyReservation(String resource, ZoneSetPolicyRequest zoneSetPolicyRequestResource)
Sample code:
try (ReservationClient reservationClient = ReservationClient.create()) {
ProjectZoneReservationResourceName resource = ProjectZoneReservationResourceName.of("[PROJECT]", "[ZONE]", "[RESOURCE]");
ZoneSetPolicyRequest zoneSetPolicyRequestResource = ZoneSetPolicyRequest.newBuilder().build();
Policy response = reservationClient.setIamPolicyReservation(resource.toString(), zoneSetPolicyRequestResource);
}
resource
- Name or id of the resource for this request.zoneSetPolicyRequestResource
- com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final Policy setIamPolicyReservation(SetIamPolicyReservationHttpRequest request)
Sample code:
try (ReservationClient reservationClient = ReservationClient.create()) {
String formattedResource = ProjectZoneReservationResourceName.format("[PROJECT]", "[ZONE]", "[RESOURCE]");
ZoneSetPolicyRequest zoneSetPolicyRequestResource = ZoneSetPolicyRequest.newBuilder().build();
SetIamPolicyReservationHttpRequest request = SetIamPolicyReservationHttpRequest.newBuilder()
.setResource(formattedResource)
.setZoneSetPolicyRequestResource(zoneSetPolicyRequestResource)
.build();
Policy response = reservationClient.setIamPolicyReservation(request);
}
request
- The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final com.google.api.gax.rpc.UnaryCallable<SetIamPolicyReservationHttpRequest,Policy> setIamPolicyReservationCallable()
Sample code:
try (ReservationClient reservationClient = ReservationClient.create()) {
String formattedResource = ProjectZoneReservationResourceName.format("[PROJECT]", "[ZONE]", "[RESOURCE]");
ZoneSetPolicyRequest zoneSetPolicyRequestResource = ZoneSetPolicyRequest.newBuilder().build();
SetIamPolicyReservationHttpRequest request = SetIamPolicyReservationHttpRequest.newBuilder()
.setResource(formattedResource)
.setZoneSetPolicyRequestResource(zoneSetPolicyRequestResource)
.build();
ApiFuture<Policy> future = reservationClient.setIamPolicyReservationCallable().futureCall(request);
// Do something
Policy response = future.get();
}
@BetaApi public final TestPermissionsResponse testIamPermissionsReservation(ProjectZoneReservationResourceName resource, TestPermissionsRequest testPermissionsRequestResource)
Sample code:
try (ReservationClient reservationClient = ReservationClient.create()) {
ProjectZoneReservationResourceName resource = ProjectZoneReservationResourceName.of("[PROJECT]", "[ZONE]", "[RESOURCE]");
TestPermissionsRequest testPermissionsRequestResource = TestPermissionsRequest.newBuilder().build();
TestPermissionsResponse response = reservationClient.testIamPermissionsReservation(resource, testPermissionsRequestResource);
}
resource
- Name or id of the resource for this request.testPermissionsRequestResource
- com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final TestPermissionsResponse testIamPermissionsReservation(String resource, TestPermissionsRequest testPermissionsRequestResource)
Sample code:
try (ReservationClient reservationClient = ReservationClient.create()) {
ProjectZoneReservationResourceName resource = ProjectZoneReservationResourceName.of("[PROJECT]", "[ZONE]", "[RESOURCE]");
TestPermissionsRequest testPermissionsRequestResource = TestPermissionsRequest.newBuilder().build();
TestPermissionsResponse response = reservationClient.testIamPermissionsReservation(resource.toString(), testPermissionsRequestResource);
}
resource
- Name or id of the resource for this request.testPermissionsRequestResource
- com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final TestPermissionsResponse testIamPermissionsReservation(TestIamPermissionsReservationHttpRequest request)
Sample code:
try (ReservationClient reservationClient = ReservationClient.create()) {
String formattedResource = ProjectZoneReservationResourceName.format("[PROJECT]", "[ZONE]", "[RESOURCE]");
TestPermissionsRequest testPermissionsRequestResource = TestPermissionsRequest.newBuilder().build();
TestIamPermissionsReservationHttpRequest request = TestIamPermissionsReservationHttpRequest.newBuilder()
.setResource(formattedResource)
.setTestPermissionsRequestResource(testPermissionsRequestResource)
.build();
TestPermissionsResponse response = reservationClient.testIamPermissionsReservation(request);
}
request
- The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi public final com.google.api.gax.rpc.UnaryCallable<TestIamPermissionsReservationHttpRequest,TestPermissionsResponse> testIamPermissionsReservationCallable()
Sample code:
try (ReservationClient reservationClient = ReservationClient.create()) {
String formattedResource = ProjectZoneReservationResourceName.format("[PROJECT]", "[ZONE]", "[RESOURCE]");
TestPermissionsRequest testPermissionsRequestResource = TestPermissionsRequest.newBuilder().build();
TestIamPermissionsReservationHttpRequest request = TestIamPermissionsReservationHttpRequest.newBuilder()
.setResource(formattedResource)
.setTestPermissionsRequestResource(testPermissionsRequestResource)
.build();
ApiFuture<TestPermissionsResponse> future = reservationClient.testIamPermissionsReservationCallable().futureCall(request);
// Do something
TestPermissionsResponse response = future.get();
}
public final void close()
close
in interface AutoCloseable
public void shutdown()
shutdown
in interface com.google.api.gax.core.BackgroundResource
public boolean isShutdown()
isShutdown
in interface com.google.api.gax.core.BackgroundResource
public boolean isTerminated()
isTerminated
in interface com.google.api.gax.core.BackgroundResource
public void shutdownNow()
shutdownNow
in interface com.google.api.gax.core.BackgroundResource
public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException
awaitTermination
in interface com.google.api.gax.core.BackgroundResource
InterruptedException
Copyright © 2019 Google LLC. All rights reserved.