- 2.54.0 (latest)
- 2.53.0
- 2.52.0
- 2.50.0
- 2.49.0
- 2.48.0
- 2.47.0
- 2.46.0
- 2.45.0
- 2.44.0
- 2.43.0
- 2.42.0
- 2.41.0
- 2.40.0
- 2.38.0
- 2.37.0
- 2.36.0
- 2.35.0
- 2.34.0
- 2.33.0
- 2.32.0
- 2.31.0
- 2.30.0
- 2.29.0
- 2.28.0
- 2.25.0
- 2.24.0
- 2.23.0
- 2.22.0
- 2.21.0
- 2.20.0
- 2.19.0
- 2.18.0
- 2.17.0
- 2.16.0
- 2.15.0
- 2.14.0
- 2.13.0
- 2.12.0
- 2.11.0
- 2.10.0
- 2.9.0
- 2.8.0
- 2.7.0
- 2.6.0
- 2.5.0
- 2.4.6
- 2.3.1
- 2.2.7
- 2.1.4
public class ReservationServiceClient implements BackgroundResource
Service Description: This API allows users to manage their flat-rate BigQuery reservations.
A reservation provides computational resource guarantees, in the form of
slots, to users. A slot is a unit of
computational power in BigQuery, and serves as the basic unit of parallelism. In a scan of a
multi-partitioned table, a single slot operates on a single partition of the table. A reservation
resource exists as a child resource of the admin project and location, e.g.:
projects/myproject/locations/US/reservations/reservationName
.
A capacity commitment is a way to purchase compute capacity for BigQuery jobs (in the form of
slots) with some committed period of usage. A capacity commitment resource exists as a child
resource of the admin project and location, e.g.:
projects/myproject/locations/US/capacityCommitments/id
.
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 (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
Reservation reservation = Reservation.newBuilder().build();
String reservationId = "reservationId1116965383";
Reservation response =
reservationServiceClient.createReservation(parent, reservation, reservationId);
}
Note: close() needs to be called on the ReservationServiceClient 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:
- A "flattened" method. With this type of method, the fields of the request type have been converted into function parameters. It may be the case that not all fields are available as parameters, and not every API method will have a flattened method entry point.
- A "request object" method. This type of method only takes one parameter, a request object, which must be constructed before the call. Not every API method will have a request object method.
- A "callable" method. This type of method takes no parameters and returns 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 ReservationServiceSettings to create(). For example:
To customize credentials:
ReservationServiceSettings reservationServiceSettings =
ReservationServiceSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
.build();
ReservationServiceClient reservationServiceClient =
ReservationServiceClient.create(reservationServiceSettings);
To customize the endpoint:
ReservationServiceSettings reservationServiceSettings =
ReservationServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
ReservationServiceClient reservationServiceClient =
ReservationServiceClient.create(reservationServiceSettings);
Please refer to the GitHub repository's samples for more quickstart code snippets.
Implements
BackgroundResourceConstructors
ReservationServiceClient(ReservationServiceSettings settings)
protected ReservationServiceClient(ReservationServiceSettings settings)
Constructs an instance of ReservationServiceClient, using the given settings. This is protected so that it is easy to make a subclass, but otherwise, the static factory methods should be preferred.
Name | Description |
settings | ReservationServiceSettings |
ReservationServiceClient(ReservationServiceStub stub)
protected ReservationServiceClient(ReservationServiceStub stub)
Name | Description |
stub | ReservationServiceStub |
Methods
awaitTermination(long duration, TimeUnit unit)
public boolean awaitTermination(long duration, TimeUnit unit)
Name | Description |
duration | long |
unit | TimeUnit |
Type | Description |
boolean |
Type | Description |
InterruptedException |
close()
public final void close()
create()
public static final ReservationServiceClient create()
Constructs an instance of ReservationServiceClient with default settings.
Type | Description |
ReservationServiceClient |
Type | Description |
IOException |
create(ReservationServiceSettings settings)
public static final ReservationServiceClient create(ReservationServiceSettings settings)
Constructs an instance of ReservationServiceClient, using the given settings. The channels are created based on the settings passed in, or defaults for any settings that are not set.
Name | Description |
settings | ReservationServiceSettings |
Type | Description |
ReservationServiceClient |
Type | Description |
IOException |
create(ReservationServiceStub stub)
public static final ReservationServiceClient create(ReservationServiceStub stub)
Constructs an instance of ReservationServiceClient, using the given stub for making calls. This is for advanced usage - prefer using create(ReservationServiceSettings).
Name | Description |
stub | ReservationServiceStub |
Type | Description |
ReservationServiceClient |
createAssignment(CreateAssignmentRequest request)
public final Assignment createAssignment(CreateAssignmentRequest request)
Creates an assignment object which allows the given project to submit jobs of a certain type using slots from the specified reservation.
Currently a resource (project, folder, organization) can only have one assignment per each (job_type, location) combination, and that reservation will be used for all jobs of the matching type.
Different assignments can be created on different levels of the projects, folders or organization hierarchy. During query execution, the assignment is looked up at the project, folder and organization levels in that order. The first assignment found is applied to the query.
When creating assignments, it does not matter if other assignments exist at higher levels.
Example:
- The organization
organizationA
contains two projects,project1
andproject2
. - Assignments for all three entities (
organizationA
,project1
, andproject2
) could all be created and mapped to the same or different reservations.
"None" assignments represent an absence of the assignment. Projects assigned to None use
on-demand pricing. To create a "None" assignment, use "none" as a reservation_id in the parent.
Example parent: projects/myproject/locations/US/reservations/none
.
Returns google.rpc.Code.PERMISSION_DENIED
if user does not have 'bigquery.admin'
permissions on the project using the reservation and the project that owns this reservation.
Returns google.rpc.Code.INVALID_ARGUMENT
when location of the assignment does not match
location of the reservation.
Sample code:
try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
CreateAssignmentRequest request =
CreateAssignmentRequest.newBuilder()
.setParent(ReservationName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]").toString())
.setAssignment(Assignment.newBuilder().build())
.setAssignmentId("assignmentId-1603989304")
.build();
Assignment response = reservationServiceClient.createAssignment(request);
}
Name | Description |
request | CreateAssignmentRequest The request object containing all of the parameters for the API call. |
Type | Description |
Assignment |
createAssignment(ReservationName parent, Assignment assignment)
public final Assignment createAssignment(ReservationName parent, Assignment assignment)
Creates an assignment object which allows the given project to submit jobs of a certain type using slots from the specified reservation.
Currently a resource (project, folder, organization) can only have one assignment per each (job_type, location) combination, and that reservation will be used for all jobs of the matching type.
Different assignments can be created on different levels of the projects, folders or organization hierarchy. During query execution, the assignment is looked up at the project, folder and organization levels in that order. The first assignment found is applied to the query.
When creating assignments, it does not matter if other assignments exist at higher levels.
Example:
- The organization
organizationA
contains two projects,project1
andproject2
. - Assignments for all three entities (
organizationA
,project1
, andproject2
) could all be created and mapped to the same or different reservations.
"None" assignments represent an absence of the assignment. Projects assigned to None use
on-demand pricing. To create a "None" assignment, use "none" as a reservation_id in the parent.
Example parent: projects/myproject/locations/US/reservations/none
.
Returns google.rpc.Code.PERMISSION_DENIED
if user does not have 'bigquery.admin'
permissions on the project using the reservation and the project that owns this reservation.
Returns google.rpc.Code.INVALID_ARGUMENT
when location of the assignment does not match
location of the reservation.
Sample code:
try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
ReservationName parent = ReservationName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]");
Assignment assignment = Assignment.newBuilder().build();
Assignment response = reservationServiceClient.createAssignment(parent, assignment);
}
Name | Description |
parent | ReservationName Required. The parent resource name of the assignment E.g.
|
assignment | Assignment Assignment resource to create. |
Type | Description |
Assignment |
createAssignment(String parent, Assignment assignment)
public final Assignment createAssignment(String parent, Assignment assignment)
Creates an assignment object which allows the given project to submit jobs of a certain type using slots from the specified reservation.
Currently a resource (project, folder, organization) can only have one assignment per each (job_type, location) combination, and that reservation will be used for all jobs of the matching type.
Different assignments can be created on different levels of the projects, folders or organization hierarchy. During query execution, the assignment is looked up at the project, folder and organization levels in that order. The first assignment found is applied to the query.
When creating assignments, it does not matter if other assignments exist at higher levels.
Example:
- The organization
organizationA
contains two projects,project1
andproject2
. - Assignments for all three entities (
organizationA
,project1
, andproject2
) could all be created and mapped to the same or different reservations.
"None" assignments represent an absence of the assignment. Projects assigned to None use
on-demand pricing. To create a "None" assignment, use "none" as a reservation_id in the parent.
Example parent: projects/myproject/locations/US/reservations/none
.
Returns google.rpc.Code.PERMISSION_DENIED
if user does not have 'bigquery.admin'
permissions on the project using the reservation and the project that owns this reservation.
Returns google.rpc.Code.INVALID_ARGUMENT
when location of the assignment does not match
location of the reservation.
Sample code:
try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
String parent = ReservationName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]").toString();
Assignment assignment = Assignment.newBuilder().build();
Assignment response = reservationServiceClient.createAssignment(parent, assignment);
}
Name | Description |
parent | String Required. The parent resource name of the assignment E.g.
|
assignment | Assignment Assignment resource to create. |
Type | Description |
Assignment |
createAssignmentCallable()
public final UnaryCallable<CreateAssignmentRequest,Assignment> createAssignmentCallable()
Creates an assignment object which allows the given project to submit jobs of a certain type using slots from the specified reservation.
Currently a resource (project, folder, organization) can only have one assignment per each (job_type, location) combination, and that reservation will be used for all jobs of the matching type.
Different assignments can be created on different levels of the projects, folders or organization hierarchy. During query execution, the assignment is looked up at the project, folder and organization levels in that order. The first assignment found is applied to the query.
When creating assignments, it does not matter if other assignments exist at higher levels.
Example:
- The organization
organizationA
contains two projects,project1
andproject2
. - Assignments for all three entities (
organizationA
,project1
, andproject2
) could all be created and mapped to the same or different reservations.
"None" assignments represent an absence of the assignment. Projects assigned to None use
on-demand pricing. To create a "None" assignment, use "none" as a reservation_id in the parent.
Example parent: projects/myproject/locations/US/reservations/none
.
Returns google.rpc.Code.PERMISSION_DENIED
if user does not have 'bigquery.admin'
permissions on the project using the reservation and the project that owns this reservation.
Returns google.rpc.Code.INVALID_ARGUMENT
when location of the assignment does not match
location of the reservation.
Sample code:
try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
CreateAssignmentRequest request =
CreateAssignmentRequest.newBuilder()
.setParent(ReservationName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]").toString())
.setAssignment(Assignment.newBuilder().build())
.setAssignmentId("assignmentId-1603989304")
.build();
ApiFuture
Type | Description |
UnaryCallable<CreateAssignmentRequest,Assignment> |
createCapacityCommitment(CreateCapacityCommitmentRequest request)
public final CapacityCommitment createCapacityCommitment(CreateCapacityCommitmentRequest request)
Creates a new capacity commitment resource.
Sample code:
try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
CreateCapacityCommitmentRequest request =
CreateCapacityCommitmentRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.setCapacityCommitment(CapacityCommitment.newBuilder().build())
.setEnforceSingleAdminProjectPerOrg(true)
.setCapacityCommitmentId("capacityCommitmentId1185645802")
.build();
CapacityCommitment response = reservationServiceClient.createCapacityCommitment(request);
}
Name | Description |
request | CreateCapacityCommitmentRequest The request object containing all of the parameters for the API call. |
Type | Description |
CapacityCommitment |
createCapacityCommitment(LocationName parent, CapacityCommitment capacityCommitment)
public final CapacityCommitment createCapacityCommitment(LocationName parent, CapacityCommitment capacityCommitment)
Creates a new capacity commitment resource.
Sample code:
try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
CapacityCommitment capacityCommitment = CapacityCommitment.newBuilder().build();
CapacityCommitment response =
reservationServiceClient.createCapacityCommitment(parent, capacityCommitment);
}
Name | Description |
parent | LocationName Required. Resource name of the parent reservation. E.g.,
|
capacityCommitment | CapacityCommitment Content of the capacity commitment to create. |
Type | Description |
CapacityCommitment |
createCapacityCommitment(String parent, CapacityCommitment capacityCommitment)
public final CapacityCommitment createCapacityCommitment(String parent, CapacityCommitment capacityCommitment)
Creates a new capacity commitment resource.
Sample code:
try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
CapacityCommitment capacityCommitment = CapacityCommitment.newBuilder().build();
CapacityCommitment response =
reservationServiceClient.createCapacityCommitment(parent, capacityCommitment);
}
Name | Description |
parent | String Required. Resource name of the parent reservation. E.g.,
|
capacityCommitment | CapacityCommitment Content of the capacity commitment to create. |
Type | Description |
CapacityCommitment |
createCapacityCommitmentCallable()
public final UnaryCallable<CreateCapacityCommitmentRequest,CapacityCommitment> createCapacityCommitmentCallable()
Creates a new capacity commitment resource.
Sample code:
try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
CreateCapacityCommitmentRequest request =
CreateCapacityCommitmentRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.setCapacityCommitment(CapacityCommitment.newBuilder().build())
.setEnforceSingleAdminProjectPerOrg(true)
.setCapacityCommitmentId("capacityCommitmentId1185645802")
.build();
ApiFuture
Type | Description |
UnaryCallable<CreateCapacityCommitmentRequest,CapacityCommitment> |
createReservation(CreateReservationRequest request)
public final Reservation createReservation(CreateReservationRequest request)
Creates a new reservation resource.
Sample code:
try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
CreateReservationRequest request =
CreateReservationRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.setReservationId("reservationId1116965383")
.setReservation(Reservation.newBuilder().build())
.build();
Reservation response = reservationServiceClient.createReservation(request);
}
Name | Description |
request | CreateReservationRequest The request object containing all of the parameters for the API call. |
Type | Description |
Reservation |
createReservation(LocationName parent, Reservation reservation, String reservationId)
public final Reservation createReservation(LocationName parent, Reservation reservation, String reservationId)
Creates a new reservation resource.
Sample code:
try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
Reservation reservation = Reservation.newBuilder().build();
String reservationId = "reservationId1116965383";
Reservation response =
reservationServiceClient.createReservation(parent, reservation, reservationId);
}
Name | Description |
parent | LocationName Required. Project, location. E.g., |
reservation | Reservation Definition of the new reservation to create. |
reservationId | String The reservation ID. This field must only contain lower case alphanumeric characters or dash. Max length is 64 characters. |
Type | Description |
Reservation |
createReservation(String parent, Reservation reservation, String reservationId)
public final Reservation createReservation(String parent, Reservation reservation, String reservationId)
Creates a new reservation resource.
Sample code:
try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
Reservation reservation = Reservation.newBuilder().build();
String reservationId = "reservationId1116965383";
Reservation response =
reservationServiceClient.createReservation(parent, reservation, reservationId);
}
Name | Description |
parent | String Required. Project, location. E.g., |
reservation | Reservation Definition of the new reservation to create. |
reservationId | String The reservation ID. This field must only contain lower case alphanumeric characters or dash. Max length is 64 characters. |
Type | Description |
Reservation |
createReservationCallable()
public final UnaryCallable<CreateReservationRequest,Reservation> createReservationCallable()
Creates a new reservation resource.
Sample code:
try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
CreateReservationRequest request =
CreateReservationRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.setReservationId("reservationId1116965383")
.setReservation(Reservation.newBuilder().build())
.build();
ApiFuture
Type | Description |
UnaryCallable<CreateReservationRequest,Reservation> |
deleteAssignment(AssignmentName name)
public final void deleteAssignment(AssignmentName name)
Deletes a assignment. No expansion will happen.
Example:
- Organization
organizationA
contains two projects,project1
andproject2
. - Reservation
res1
exists and was created previously. - CreateAssignment was used previously to define the following associations between
entities and reservations:
<organizationA, res1>
and<project1, res1>
In this example, deletion of the <organizationA, res1>
assignment won't affect the
other assignment <project1, res1>
. After said deletion, queries from project1
will
still use res1
while queries from project2
will switch to use on-demand mode.
Sample code:
try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
AssignmentName name =
AssignmentName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]", "[ASSIGNMENT]");
reservationServiceClient.deleteAssignment(name);
}
Name | Description |
name | AssignmentName Required. Name of the resource, e.g.
|
deleteAssignment(DeleteAssignmentRequest request)
public final void deleteAssignment(DeleteAssignmentRequest request)
Deletes a assignment. No expansion will happen.
Example:
- Organization
organizationA
contains two projects,project1
andproject2
. - Reservation
res1
exists and was created previously. - CreateAssignment was used previously to define the following associations between
entities and reservations:
<organizationA, res1>
and<project1, res1>
In this example, deletion of the <organizationA, res1>
assignment won't affect the
other assignment <project1, res1>
. After said deletion, queries from project1
will
still use res1
while queries from project2
will switch to use on-demand mode.
Sample code:
try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
DeleteAssignmentRequest request =
DeleteAssignmentRequest.newBuilder()
.setName(
AssignmentName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]", "[ASSIGNMENT]")
.toString())
.build();
reservationServiceClient.deleteAssignment(request);
}
Name | Description |
request | DeleteAssignmentRequest The request object containing all of the parameters for the API call. |
deleteAssignment(String name)
public final void deleteAssignment(String name)
Deletes a assignment. No expansion will happen.
Example:
- Organization
organizationA
contains two projects,project1
andproject2
. - Reservation
res1
exists and was created previously. - CreateAssignment was used previously to define the following associations between
entities and reservations:
<organizationA, res1>
and<project1, res1>
In this example, deletion of the <organizationA, res1>
assignment won't affect the
other assignment <project1, res1>
. After said deletion, queries from project1
will
still use res1
while queries from project2
will switch to use on-demand mode.
Sample code:
try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
String name =
AssignmentName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]", "[ASSIGNMENT]").toString();
reservationServiceClient.deleteAssignment(name);
}
Name | Description |
name | String Required. Name of the resource, e.g.
|
deleteAssignmentCallable()
public final UnaryCallable<DeleteAssignmentRequest,Empty> deleteAssignmentCallable()
Deletes a assignment. No expansion will happen.
Example:
- Organization
organizationA
contains two projects,project1
andproject2
. - Reservation
res1
exists and was created previously. - CreateAssignment was used previously to define the following associations between
entities and reservations:
<organizationA, res1>
and<project1, res1>
In this example, deletion of the <organizationA, res1>
assignment won't affect the
other assignment <project1, res1>
. After said deletion, queries from project1
will
still use res1
while queries from project2
will switch to use on-demand mode.
Sample code:
try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
DeleteAssignmentRequest request =
DeleteAssignmentRequest.newBuilder()
.setName(
AssignmentName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]", "[ASSIGNMENT]")
.toString())
.build();
ApiFuture
Type | Description |
UnaryCallable<DeleteAssignmentRequest,Empty> |
deleteCapacityCommitment(CapacityCommitmentName name)
public final void deleteCapacityCommitment(CapacityCommitmentName name)
Deletes a capacity commitment. Attempting to delete capacity commitment before its
commitment_end_time will fail with the error code google.rpc.Code.FAILED_PRECONDITION
.
Sample code:
try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
CapacityCommitmentName name =
CapacityCommitmentName.of("[PROJECT]", "[LOCATION]", "[CAPACITY_COMMITMENT]");
reservationServiceClient.deleteCapacityCommitment(name);
}
Name | Description |
name | CapacityCommitmentName Required. Resource name of the capacity commitment to delete. E.g.,
|
deleteCapacityCommitment(DeleteCapacityCommitmentRequest request)
public final void deleteCapacityCommitment(DeleteCapacityCommitmentRequest request)
Deletes a capacity commitment. Attempting to delete capacity commitment before its
commitment_end_time will fail with the error code google.rpc.Code.FAILED_PRECONDITION
.
Sample code:
try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
DeleteCapacityCommitmentRequest request =
DeleteCapacityCommitmentRequest.newBuilder()
.setName(
CapacityCommitmentName.of("[PROJECT]", "[LOCATION]", "[CAPACITY_COMMITMENT]")
.toString())
.setForce(true)
.build();
reservationServiceClient.deleteCapacityCommitment(request);
}
Name | Description |
request | DeleteCapacityCommitmentRequest The request object containing all of the parameters for the API call. |
deleteCapacityCommitment(String name)
public final void deleteCapacityCommitment(String name)
Deletes a capacity commitment. Attempting to delete capacity commitment before its
commitment_end_time will fail with the error code google.rpc.Code.FAILED_PRECONDITION
.
Sample code:
try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
String name =
CapacityCommitmentName.of("[PROJECT]", "[LOCATION]", "[CAPACITY_COMMITMENT]").toString();
reservationServiceClient.deleteCapacityCommitment(name);
}
Name | Description |
name | String Required. Resource name of the capacity commitment to delete. E.g.,
|
deleteCapacityCommitmentCallable()
public final UnaryCallable<DeleteCapacityCommitmentRequest,Empty> deleteCapacityCommitmentCallable()
Deletes a capacity commitment. Attempting to delete capacity commitment before its
commitment_end_time will fail with the error code google.rpc.Code.FAILED_PRECONDITION
.
Sample code:
try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
DeleteCapacityCommitmentRequest request =
DeleteCapacityCommitmentRequest.newBuilder()
.setName(
CapacityCommitmentName.of("[PROJECT]", "[LOCATION]", "[CAPACITY_COMMITMENT]")
.toString())
.setForce(true)
.build();
ApiFuture
Type | Description |
UnaryCallable<DeleteCapacityCommitmentRequest,Empty> |
deleteReservation(DeleteReservationRequest request)
public final void deleteReservation(DeleteReservationRequest request)
Deletes a reservation. Returns google.rpc.Code.FAILED_PRECONDITION
when reservation has
assignments.
Sample code:
try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
DeleteReservationRequest request =
DeleteReservationRequest.newBuilder()
.setName(ReservationName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]").toString())
.build();
reservationServiceClient.deleteReservation(request);
}
Name | Description |
request | DeleteReservationRequest The request object containing all of the parameters for the API call. |
deleteReservation(ReservationName name)
public final void deleteReservation(ReservationName name)
Deletes a reservation. Returns google.rpc.Code.FAILED_PRECONDITION
when reservation has
assignments.
Sample code:
try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
ReservationName name = ReservationName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]");
reservationServiceClient.deleteReservation(name);
}
Name | Description |
name | ReservationName Required. Resource name of the reservation to retrieve. E.g.,
|
deleteReservation(String name)
public final void deleteReservation(String name)
Deletes a reservation. Returns google.rpc.Code.FAILED_PRECONDITION
when reservation has
assignments.
Sample code:
try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
String name = ReservationName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]").toString();
reservationServiceClient.deleteReservation(name);
}
Name | Description |
name | String Required. Resource name of the reservation to retrieve. E.g.,
|
deleteReservationCallable()
public final UnaryCallable<DeleteReservationRequest,Empty> deleteReservationCallable()
Deletes a reservation. Returns google.rpc.Code.FAILED_PRECONDITION
when reservation has
assignments.
Sample code:
try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
DeleteReservationRequest request =
DeleteReservationRequest.newBuilder()
.setName(ReservationName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]").toString())
.build();
ApiFuture
Type | Description |
UnaryCallable<DeleteReservationRequest,Empty> |
getBiReservation(BiReservationName name)
public final BiReservation getBiReservation(BiReservationName name)
Retrieves a BI reservation.
Sample code:
try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
BiReservationName name = BiReservationName.of("[PROJECT]", "[LOCATION]");
BiReservation response = reservationServiceClient.getBiReservation(name);
}
Name | Description |
name | BiReservationName Required. Name of the requested reservation, for example:
|
Type | Description |
BiReservation |
getBiReservation(GetBiReservationRequest request)
public final BiReservation getBiReservation(GetBiReservationRequest request)
Retrieves a BI reservation.
Sample code:
try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
GetBiReservationRequest request =
GetBiReservationRequest.newBuilder()
.setName(BiReservationName.of("[PROJECT]", "[LOCATION]").toString())
.build();
BiReservation response = reservationServiceClient.getBiReservation(request);
}
Name | Description |
request | GetBiReservationRequest The request object containing all of the parameters for the API call. |
Type | Description |
BiReservation |
getBiReservation(String name)
public final BiReservation getBiReservation(String name)
Retrieves a BI reservation.
Sample code:
try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
String name = BiReservationName.of("[PROJECT]", "[LOCATION]").toString();
BiReservation response = reservationServiceClient.getBiReservation(name);
}
Name | Description |
name | String Required. Name of the requested reservation, for example:
|
Type | Description |
BiReservation |
getBiReservationCallable()
public final UnaryCallable<GetBiReservationRequest,BiReservation> getBiReservationCallable()
Retrieves a BI reservation.
Sample code:
try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
GetBiReservationRequest request =
GetBiReservationRequest.newBuilder()
.setName(BiReservationName.of("[PROJECT]", "[LOCATION]").toString())
.build();
ApiFuture
Type | Description |
UnaryCallable<GetBiReservationRequest,BiReservation> |
getCapacityCommitment(CapacityCommitmentName name)
public final CapacityCommitment getCapacityCommitment(CapacityCommitmentName name)
Returns information about the capacity commitment.
Sample code:
try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
CapacityCommitmentName name =
CapacityCommitmentName.of("[PROJECT]", "[LOCATION]", "[CAPACITY_COMMITMENT]");
CapacityCommitment response = reservationServiceClient.getCapacityCommitment(name);
}
Name | Description |
name | CapacityCommitmentName Required. Resource name of the capacity commitment to retrieve. E.g.,
|
Type | Description |
CapacityCommitment |
getCapacityCommitment(GetCapacityCommitmentRequest request)
public final CapacityCommitment getCapacityCommitment(GetCapacityCommitmentRequest request)
Returns information about the capacity commitment.
Sample code:
try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
GetCapacityCommitmentRequest request =
GetCapacityCommitmentRequest.newBuilder()
.setName(
CapacityCommitmentName.of("[PROJECT]", "[LOCATION]", "[CAPACITY_COMMITMENT]")
.toString())
.build();
CapacityCommitment response = reservationServiceClient.getCapacityCommitment(request);
}
Name | Description |
request | GetCapacityCommitmentRequest The request object containing all of the parameters for the API call. |
Type | Description |
CapacityCommitment |
getCapacityCommitment(String name)
public final CapacityCommitment getCapacityCommitment(String name)
Returns information about the capacity commitment.
Sample code:
try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
String name =
CapacityCommitmentName.of("[PROJECT]", "[LOCATION]", "[CAPACITY_COMMITMENT]").toString();
CapacityCommitment response = reservationServiceClient.getCapacityCommitment(name);
}
Name | Description |
name | String Required. Resource name of the capacity commitment to retrieve. E.g.,
|
Type | Description |
CapacityCommitment |
getCapacityCommitmentCallable()
public final UnaryCallable<GetCapacityCommitmentRequest,CapacityCommitment> getCapacityCommitmentCallable()
Returns information about the capacity commitment.
Sample code:
try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
GetCapacityCommitmentRequest request =
GetCapacityCommitmentRequest.newBuilder()
.setName(
CapacityCommitmentName.of("[PROJECT]", "[LOCATION]", "[CAPACITY_COMMITMENT]")
.toString())
.build();
ApiFuture
Type | Description |
UnaryCallable<GetCapacityCommitmentRequest,CapacityCommitment> |
getReservation(GetReservationRequest request)
public final Reservation getReservation(GetReservationRequest request)
Returns information about the reservation.
Sample code:
try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
GetReservationRequest request =
GetReservationRequest.newBuilder()
.setName(ReservationName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]").toString())
.build();
Reservation response = reservationServiceClient.getReservation(request);
}
Name | Description |
request | GetReservationRequest The request object containing all of the parameters for the API call. |
Type | Description |
Reservation |
getReservation(ReservationName name)
public final Reservation getReservation(ReservationName name)
Returns information about the reservation.
Sample code:
try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
ReservationName name = ReservationName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]");
Reservation response = reservationServiceClient.getReservation(name);
}
Name | Description |
name | ReservationName Required. Resource name of the reservation to retrieve. E.g.,
|
Type | Description |
Reservation |
getReservation(String name)
public final Reservation getReservation(String name)
Returns information about the reservation.
Sample code:
try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
String name = ReservationName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]").toString();
Reservation response = reservationServiceClient.getReservation(name);
}
Name | Description |
name | String Required. Resource name of the reservation to retrieve. E.g.,
|
Type | Description |
Reservation |
getReservationCallable()
public final UnaryCallable<GetReservationRequest,Reservation> getReservationCallable()
Returns information about the reservation.
Sample code:
try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
GetReservationRequest request =
GetReservationRequest.newBuilder()
.setName(ReservationName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]").toString())
.build();
ApiFuture
Type | Description |
UnaryCallable<GetReservationRequest,Reservation> |
getSettings()
public final ReservationServiceSettings getSettings()
Type | Description |
ReservationServiceSettings |
getStub()
public ReservationServiceStub getStub()
Type | Description |
ReservationServiceStub |
isShutdown()
public boolean isShutdown()
Type | Description |
boolean |
isTerminated()
public boolean isTerminated()
Type | Description |
boolean |
listAssignments(ListAssignmentsRequest request)
public final ReservationServiceClient.ListAssignmentsPagedResponse listAssignments(ListAssignmentsRequest request)
Lists assignments.
Only explicitly created assignments will be returned.
Example:
- Organization
organizationA
contains two projects,project1
andproject2
. - Reservation
res1
exists and was created previously. - CreateAssignment was used previously to define the following associations between
entities and reservations:
<organizationA, res1>
and<project1, res1>
In this example, ListAssignments will just return the above two assignments for reservation
res1
, and no expansion/merge will happen.
The wildcard "-" can be used for reservations in the request. In that case all assignments belongs to the specified project and location will be listed.
**Note** "-" cannot be used for projects nor locations.
Sample code:
try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
ListAssignmentsRequest request =
ListAssignmentsRequest.newBuilder()
.setParent(ReservationName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
for (Assignment element : reservationServiceClient.listAssignments(request).iterateAll()) {
// doThingsWith(element);
}
}
Name | Description |
request | ListAssignmentsRequest The request object containing all of the parameters for the API call. |
Type | Description |
ReservationServiceClient.ListAssignmentsPagedResponse |
listAssignments(ReservationName parent)
public final ReservationServiceClient.ListAssignmentsPagedResponse listAssignments(ReservationName parent)
Lists assignments.
Only explicitly created assignments will be returned.
Example:
- Organization
organizationA
contains two projects,project1
andproject2
. - Reservation
res1
exists and was created previously. - CreateAssignment was used previously to define the following associations between
entities and reservations:
<organizationA, res1>
and<project1, res1>
In this example, ListAssignments will just return the above two assignments for reservation
res1
, and no expansion/merge will happen.
The wildcard "-" can be used for reservations in the request. In that case all assignments belongs to the specified project and location will be listed.
**Note** "-" cannot be used for projects nor locations.
Sample code:
try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
ReservationName parent = ReservationName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]");
for (Assignment element : reservationServiceClient.listAssignments(parent).iterateAll()) {
// doThingsWith(element);
}
}
Name | Description |
parent | ReservationName Required. The parent resource name e.g.:
Or:
|
Type | Description |
ReservationServiceClient.ListAssignmentsPagedResponse |
listAssignments(String parent)
public final ReservationServiceClient.ListAssignmentsPagedResponse listAssignments(String parent)
Lists assignments.
Only explicitly created assignments will be returned.
Example:
- Organization
organizationA
contains two projects,project1
andproject2
. - Reservation
res1
exists and was created previously. - CreateAssignment was used previously to define the following associations between
entities and reservations:
<organizationA, res1>
and<project1, res1>
In this example, ListAssignments will just return the above two assignments for reservation
res1
, and no expansion/merge will happen.
The wildcard "-" can be used for reservations in the request. In that case all assignments belongs to the specified project and location will be listed.
**Note** "-" cannot be used for projects nor locations.
Sample code:
try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
String parent = ReservationName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]").toString();
for (Assignment element : reservationServiceClient.listAssignments(parent).iterateAll()) {
// doThingsWith(element);
}
}
Name | Description |
parent | String Required. The parent resource name e.g.:
Or:
|
Type | Description |
ReservationServiceClient.ListAssignmentsPagedResponse |
listAssignmentsCallable()
public final UnaryCallable<ListAssignmentsRequest,ListAssignmentsResponse> listAssignmentsCallable()
Lists assignments.
Only explicitly created assignments will be returned.
Example:
- Organization
organizationA
contains two projects,project1
andproject2
. - Reservation
res1
exists and was created previously. - CreateAssignment was used previously to define the following associations between
entities and reservations:
<organizationA, res1>
and<project1, res1>
In this example, ListAssignments will just return the above two assignments for reservation
res1
, and no expansion/merge will happen.
The wildcard "-" can be used for reservations in the request. In that case all assignments belongs to the specified project and location will be listed.
**Note** "-" cannot be used for projects nor locations.
Sample code:
try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
ListAssignmentsRequest request =
ListAssignmentsRequest.newBuilder()
.setParent(ReservationName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
while (true) {
ListAssignmentsResponse response =
reservationServiceClient.listAssignmentsCallable().call(request);
for (Assignment element : response.getResponsesList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
Type | Description |
UnaryCallable<ListAssignmentsRequest,ListAssignmentsResponse> |
listAssignmentsPagedCallable()
public final UnaryCallable<ListAssignmentsRequest,ReservationServiceClient.ListAssignmentsPagedResponse> listAssignmentsPagedCallable()
Lists assignments.
Only explicitly created assignments will be returned.
Example:
- Organization
organizationA
contains two projects,project1
andproject2
. - Reservation
res1
exists and was created previously. - CreateAssignment was used previously to define the following associations between
entities and reservations:
<organizationA, res1>
and<project1, res1>
In this example, ListAssignments will just return the above two assignments for reservation
res1
, and no expansion/merge will happen.
The wildcard "-" can be used for reservations in the request. In that case all assignments belongs to the specified project and location will be listed.
**Note** "-" cannot be used for projects nor locations.
Sample code:
try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
ListAssignmentsRequest request =
ListAssignmentsRequest.newBuilder()
.setParent(ReservationName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
ApiFuture
Type | Description |
UnaryCallable<ListAssignmentsRequest,ListAssignmentsPagedResponse> |
listCapacityCommitments(ListCapacityCommitmentsRequest request)
public final ReservationServiceClient.ListCapacityCommitmentsPagedResponse listCapacityCommitments(ListCapacityCommitmentsRequest request)
Lists all the capacity commitments for the admin project.
Sample code:
try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
ListCapacityCommitmentsRequest request =
ListCapacityCommitmentsRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
for (CapacityCommitment element :
reservationServiceClient.listCapacityCommitments(request).iterateAll()) {
// doThingsWith(element);
}
}
Name | Description |
request | ListCapacityCommitmentsRequest The request object containing all of the parameters for the API call. |
Type | Description |
ReservationServiceClient.ListCapacityCommitmentsPagedResponse |
listCapacityCommitments(LocationName parent)
public final ReservationServiceClient.ListCapacityCommitmentsPagedResponse listCapacityCommitments(LocationName parent)
Lists all the capacity commitments for the admin project.
Sample code:
try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
for (CapacityCommitment element :
reservationServiceClient.listCapacityCommitments(parent).iterateAll()) {
// doThingsWith(element);
}
}
Name | Description |
parent | LocationName Required. Resource name of the parent reservation. E.g.,
|
Type | Description |
ReservationServiceClient.ListCapacityCommitmentsPagedResponse |
listCapacityCommitments(String parent)
public final ReservationServiceClient.ListCapacityCommitmentsPagedResponse listCapacityCommitments(String parent)
Lists all the capacity commitments for the admin project.
Sample code:
try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
for (CapacityCommitment element :
reservationServiceClient.listCapacityCommitments(parent).iterateAll()) {
// doThingsWith(element);
}
}
Name | Description |
parent | String Required. Resource name of the parent reservation. E.g.,
|
Type | Description |
ReservationServiceClient.ListCapacityCommitmentsPagedResponse |
listCapacityCommitmentsCallable()
public final UnaryCallable<ListCapacityCommitmentsRequest,ListCapacityCommitmentsResponse> listCapacityCommitmentsCallable()
Lists all the capacity commitments for the admin project.
Sample code:
try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
ListCapacityCommitmentsRequest request =
ListCapacityCommitmentsRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
while (true) {
ListCapacityCommitmentsResponse response =
reservationServiceClient.listCapacityCommitmentsCallable().call(request);
for (CapacityCommitment element : response.getResponsesList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
Type | Description |
UnaryCallable<ListCapacityCommitmentsRequest,ListCapacityCommitmentsResponse> |
listCapacityCommitmentsPagedCallable()
public final UnaryCallable<ListCapacityCommitmentsRequest,ReservationServiceClient.ListCapacityCommitmentsPagedResponse> listCapacityCommitmentsPagedCallable()
Lists all the capacity commitments for the admin project.
Sample code:
try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
ListCapacityCommitmentsRequest request =
ListCapacityCommitmentsRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
ApiFuture
Type | Description |
UnaryCallable<ListCapacityCommitmentsRequest,ListCapacityCommitmentsPagedResponse> |
listReservations(ListReservationsRequest request)
public final ReservationServiceClient.ListReservationsPagedResponse listReservations(ListReservationsRequest request)
Lists all the reservations for the project in the specified location.
Sample code:
try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
ListReservationsRequest request =
ListReservationsRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
for (Reservation element : reservationServiceClient.listReservations(request).iterateAll()) {
// doThingsWith(element);
}
}
Name | Description |
request | ListReservationsRequest The request object containing all of the parameters for the API call. |
Type | Description |
ReservationServiceClient.ListReservationsPagedResponse |
listReservations(LocationName parent)
public final ReservationServiceClient.ListReservationsPagedResponse listReservations(LocationName parent)
Lists all the reservations for the project in the specified location.
Sample code:
try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
for (Reservation element : reservationServiceClient.listReservations(parent).iterateAll()) {
// doThingsWith(element);
}
}
Name | Description |
parent | LocationName Required. The parent resource name containing project and location, e.g.:
|
Type | Description |
ReservationServiceClient.ListReservationsPagedResponse |
listReservations(String parent)
public final ReservationServiceClient.ListReservationsPagedResponse listReservations(String parent)
Lists all the reservations for the project in the specified location.
Sample code:
try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
for (Reservation element : reservationServiceClient.listReservations(parent).iterateAll()) {
// doThingsWith(element);
}
}
Name | Description |
parent | String Required. The parent resource name containing project and location, e.g.:
|
Type | Description |
ReservationServiceClient.ListReservationsPagedResponse |
listReservationsCallable()
public final UnaryCallable<ListReservationsRequest,ListReservationsResponse> listReservationsCallable()
Lists all the reservations for the project in the specified location.
Sample code:
try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
ListReservationsRequest request =
ListReservationsRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
while (true) {
ListReservationsResponse response =
reservationServiceClient.listReservationsCallable().call(request);
for (Reservation element : response.getResponsesList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
Type | Description |
UnaryCallable<ListReservationsRequest,ListReservationsResponse> |
listReservationsPagedCallable()
public final UnaryCallable<ListReservationsRequest,ReservationServiceClient.ListReservationsPagedResponse> listReservationsPagedCallable()
Lists all the reservations for the project in the specified location.
Sample code:
try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
ListReservationsRequest request =
ListReservationsRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
ApiFuture
Type | Description |
UnaryCallable<ListReservationsRequest,ListReservationsPagedResponse> |
mergeCapacityCommitments(LocationName parent, List<String> capacityCommitmentIds)
public final CapacityCommitment mergeCapacityCommitments(LocationName parent, List<String> capacityCommitmentIds)
Merges capacity commitments of the same plan into a single commitment.
The resulting capacity commitment has the greater commitment_end_time out of the to-be-merged capacity commitments.
Attempting to merge capacity commitments of different plan will fail with the error code
google.rpc.Code.FAILED_PRECONDITION
.
Sample code:
try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
List
Name | Description |
parent | LocationName Parent resource that identifies admin project and location e.g.,
|
capacityCommitmentIds | List<String> Ids of capacity commitments to merge. These capacity commitments must exist under admin project and location specified in the parent. ID is the last portion of capacity commitment name e.g., 'abc' for projects/myproject/locations/US/capacityCommitments/abc |
Type | Description |
CapacityCommitment |
mergeCapacityCommitments(MergeCapacityCommitmentsRequest request)
public final CapacityCommitment mergeCapacityCommitments(MergeCapacityCommitmentsRequest request)
Merges capacity commitments of the same plan into a single commitment.
The resulting capacity commitment has the greater commitment_end_time out of the to-be-merged capacity commitments.
Attempting to merge capacity commitments of different plan will fail with the error code
google.rpc.Code.FAILED_PRECONDITION
.
Sample code:
try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
MergeCapacityCommitmentsRequest request =
MergeCapacityCommitmentsRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.addAllCapacityCommitmentIds(new ArrayList
Name | Description |
request | MergeCapacityCommitmentsRequest The request object containing all of the parameters for the API call. |
Type | Description |
CapacityCommitment |
mergeCapacityCommitments(String parent, List<String> capacityCommitmentIds)
public final CapacityCommitment mergeCapacityCommitments(String parent, List<String> capacityCommitmentIds)
Merges capacity commitments of the same plan into a single commitment.
The resulting capacity commitment has the greater commitment_end_time out of the to-be-merged capacity commitments.
Attempting to merge capacity commitments of different plan will fail with the error code
google.rpc.Code.FAILED_PRECONDITION
.
Sample code:
try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
List
Name | Description |
parent | String Parent resource that identifies admin project and location e.g.,
|
capacityCommitmentIds | List<String> Ids of capacity commitments to merge. These capacity commitments must exist under admin project and location specified in the parent. ID is the last portion of capacity commitment name e.g., 'abc' for projects/myproject/locations/US/capacityCommitments/abc |
Type | Description |
CapacityCommitment |
mergeCapacityCommitmentsCallable()
public final UnaryCallable<MergeCapacityCommitmentsRequest,CapacityCommitment> mergeCapacityCommitmentsCallable()
Merges capacity commitments of the same plan into a single commitment.
The resulting capacity commitment has the greater commitment_end_time out of the to-be-merged capacity commitments.
Attempting to merge capacity commitments of different plan will fail with the error code
google.rpc.Code.FAILED_PRECONDITION
.
Sample code:
try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
MergeCapacityCommitmentsRequest request =
MergeCapacityCommitmentsRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.addAllCapacityCommitmentIds(new ArrayList
Type | Description |
UnaryCallable<MergeCapacityCommitmentsRequest,CapacityCommitment> |
moveAssignment(AssignmentName name, ReservationName destinationId)
public final Assignment moveAssignment(AssignmentName name, ReservationName destinationId)
Moves an assignment under a new reservation.
This differs from removing an existing assignment and recreating a new one by providing a transactional change that ensures an assignee always has an associated reservation.
Sample code:
try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
AssignmentName name =
AssignmentName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]", "[ASSIGNMENT]");
ReservationName destinationId =
ReservationName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]");
Assignment response = reservationServiceClient.moveAssignment(name, destinationId);
}
Name | Description |
name | AssignmentName Required. The resource name of the assignment, e.g.
|
destinationId | ReservationName The new reservation ID, e.g.:
|
Type | Description |
Assignment |
moveAssignment(AssignmentName name, String destinationId)
public final Assignment moveAssignment(AssignmentName name, String destinationId)
Moves an assignment under a new reservation.
This differs from removing an existing assignment and recreating a new one by providing a transactional change that ensures an assignee always has an associated reservation.
Sample code:
try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
AssignmentName name =
AssignmentName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]", "[ASSIGNMENT]");
String destinationId =
ReservationName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]").toString();
Assignment response = reservationServiceClient.moveAssignment(name, destinationId);
}
Name | Description |
name | AssignmentName Required. The resource name of the assignment, e.g.
|
destinationId | String The new reservation ID, e.g.:
|
Type | Description |
Assignment |
moveAssignment(MoveAssignmentRequest request)
public final Assignment moveAssignment(MoveAssignmentRequest request)
Moves an assignment under a new reservation.
This differs from removing an existing assignment and recreating a new one by providing a transactional change that ensures an assignee always has an associated reservation.
Sample code:
try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
MoveAssignmentRequest request =
MoveAssignmentRequest.newBuilder()
.setName(
AssignmentName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]", "[ASSIGNMENT]")
.toString())
.setDestinationId(
ReservationName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]").toString())
.build();
Assignment response = reservationServiceClient.moveAssignment(request);
}
Name | Description |
request | MoveAssignmentRequest The request object containing all of the parameters for the API call. |
Type | Description |
Assignment |
moveAssignment(String name, ReservationName destinationId)
public final Assignment moveAssignment(String name, ReservationName destinationId)
Moves an assignment under a new reservation.
This differs from removing an existing assignment and recreating a new one by providing a transactional change that ensures an assignee always has an associated reservation.
Sample code:
try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
String name =
AssignmentName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]", "[ASSIGNMENT]").toString();
ReservationName destinationId =
ReservationName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]");
Assignment response = reservationServiceClient.moveAssignment(name, destinationId);
}
Name | Description |
name | String Required. The resource name of the assignment, e.g.
|
destinationId | ReservationName The new reservation ID, e.g.:
|
Type | Description |
Assignment |
moveAssignment(String name, String destinationId)
public final Assignment moveAssignment(String name, String destinationId)
Moves an assignment under a new reservation.
This differs from removing an existing assignment and recreating a new one by providing a transactional change that ensures an assignee always has an associated reservation.
Sample code:
try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
String name =
AssignmentName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]", "[ASSIGNMENT]").toString();
String destinationId =
ReservationName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]").toString();
Assignment response = reservationServiceClient.moveAssignment(name, destinationId);
}
Name | Description |
name | String Required. The resource name of the assignment, e.g.
|
destinationId | String The new reservation ID, e.g.:
|
Type | Description |
Assignment |
moveAssignmentCallable()
public final UnaryCallable<MoveAssignmentRequest,Assignment> moveAssignmentCallable()
Moves an assignment under a new reservation.
This differs from removing an existing assignment and recreating a new one by providing a transactional change that ensures an assignee always has an associated reservation.
Sample code:
try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
MoveAssignmentRequest request =
MoveAssignmentRequest.newBuilder()
.setName(
AssignmentName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]", "[ASSIGNMENT]")
.toString())
.setDestinationId(
ReservationName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]").toString())
.build();
ApiFuture
Type | Description |
UnaryCallable<MoveAssignmentRequest,Assignment> |
searchAllAssignments(LocationName parent, String query)
public final ReservationServiceClient.SearchAllAssignmentsPagedResponse searchAllAssignments(LocationName parent, String query)
Looks up assignments for a specified resource for a particular region. If the request is about a project:
1. Assignments created on the project will be returned if they exist. 2. Otherwise assignments created on the closest ancestor will be returned. 3. Assignments for different JobTypes will all be returned.
The same logic applies if the request is about a folder.
If the request is about an organization, then assignments created on the organization will be returned (organization doesn't have ancestors).
Comparing to ListAssignments, there are some behavior differences:
1. permission on the assignee will be verified in this API. 2. Hierarchy lookup
(project->folder->organization) happens in this API. 3. Parent here is
projects/*/locations/*
, instead of
projects/*/locations/*reservations/*
.
Sample code:
try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
String query = "query107944136";
for (Assignment element :
reservationServiceClient.searchAllAssignments(parent, query).iterateAll()) {
// doThingsWith(element);
}
}
Name | Description |
parent | LocationName Required. The resource name with location (project name could be the wildcard
'-'), e.g.: |
query | String Please specify resource name as assignee in the query. Examples:
|
Type | Description |
ReservationServiceClient.SearchAllAssignmentsPagedResponse |
searchAllAssignments(SearchAllAssignmentsRequest request)
public final ReservationServiceClient.SearchAllAssignmentsPagedResponse searchAllAssignments(SearchAllAssignmentsRequest request)
Looks up assignments for a specified resource for a particular region. If the request is about a project:
1. Assignments created on the project will be returned if they exist. 2. Otherwise assignments created on the closest ancestor will be returned. 3. Assignments for different JobTypes will all be returned.
The same logic applies if the request is about a folder.
If the request is about an organization, then assignments created on the organization will be returned (organization doesn't have ancestors).
Comparing to ListAssignments, there are some behavior differences:
1. permission on the assignee will be verified in this API. 2. Hierarchy lookup
(project->folder->organization) happens in this API. 3. Parent here is
projects/*/locations/*
, instead of
projects/*/locations/*reservations/*
.
Sample code:
try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
SearchAllAssignmentsRequest request =
SearchAllAssignmentsRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.setQuery("query107944136")
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
for (Assignment element :
reservationServiceClient.searchAllAssignments(request).iterateAll()) {
// doThingsWith(element);
}
}
Name | Description |
request | SearchAllAssignmentsRequest The request object containing all of the parameters for the API call. |
Type | Description |
ReservationServiceClient.SearchAllAssignmentsPagedResponse |
searchAllAssignments(String parent, String query)
public final ReservationServiceClient.SearchAllAssignmentsPagedResponse searchAllAssignments(String parent, String query)
Looks up assignments for a specified resource for a particular region. If the request is about a project:
1. Assignments created on the project will be returned if they exist. 2. Otherwise assignments created on the closest ancestor will be returned. 3. Assignments for different JobTypes will all be returned.
The same logic applies if the request is about a folder.
If the request is about an organization, then assignments created on the organization will be returned (organization doesn't have ancestors).
Comparing to ListAssignments, there are some behavior differences:
1. permission on the assignee will be verified in this API. 2. Hierarchy lookup
(project->folder->organization) happens in this API. 3. Parent here is
projects/*/locations/*
, instead of
projects/*/locations/*reservations/*
.
Sample code:
try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
String query = "query107944136";
for (Assignment element :
reservationServiceClient.searchAllAssignments(parent, query).iterateAll()) {
// doThingsWith(element);
}
}
Name | Description |
parent | String Required. The resource name with location (project name could be the wildcard
'-'), e.g.: |
query | String Please specify resource name as assignee in the query. Examples:
|
Type | Description |
ReservationServiceClient.SearchAllAssignmentsPagedResponse |
searchAllAssignmentsCallable()
public final UnaryCallable<SearchAllAssignmentsRequest,SearchAllAssignmentsResponse> searchAllAssignmentsCallable()
Looks up assignments for a specified resource for a particular region. If the request is about a project:
1. Assignments created on the project will be returned if they exist. 2. Otherwise assignments created on the closest ancestor will be returned. 3. Assignments for different JobTypes will all be returned.
The same logic applies if the request is about a folder.
If the request is about an organization, then assignments created on the organization will be returned (organization doesn't have ancestors).
Comparing to ListAssignments, there are some behavior differences:
1. permission on the assignee will be verified in this API. 2. Hierarchy lookup
(project->folder->organization) happens in this API. 3. Parent here is
projects/*/locations/*
, instead of
projects/*/locations/*reservations/*
.
Sample code:
try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
SearchAllAssignmentsRequest request =
SearchAllAssignmentsRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.setQuery("query107944136")
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
while (true) {
SearchAllAssignmentsResponse response =
reservationServiceClient.searchAllAssignmentsCallable().call(request);
for (Assignment element : response.getResponsesList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
Type | Description |
UnaryCallable<SearchAllAssignmentsRequest,SearchAllAssignmentsResponse> |
searchAllAssignmentsPagedCallable()
public final UnaryCallable<SearchAllAssignmentsRequest,ReservationServiceClient.SearchAllAssignmentsPagedResponse> searchAllAssignmentsPagedCallable()
Looks up assignments for a specified resource for a particular region. If the request is about a project:
1. Assignments created on the project will be returned if they exist. 2. Otherwise assignments created on the closest ancestor will be returned. 3. Assignments for different JobTypes will all be returned.
The same logic applies if the request is about a folder.
If the request is about an organization, then assignments created on the organization will be returned (organization doesn't have ancestors).
Comparing to ListAssignments, there are some behavior differences:
1. permission on the assignee will be verified in this API. 2. Hierarchy lookup
(project->folder->organization) happens in this API. 3. Parent here is
projects/*/locations/*
, instead of
projects/*/locations/*reservations/*
.
Sample code:
try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
SearchAllAssignmentsRequest request =
SearchAllAssignmentsRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.setQuery("query107944136")
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
ApiFuture
Type | Description |
UnaryCallable<SearchAllAssignmentsRequest,SearchAllAssignmentsPagedResponse> |
searchAssignments(LocationName parent, String query) (deprecated)
public final ReservationServiceClient.SearchAssignmentsPagedResponse searchAssignments(LocationName parent, String query)
(deprecated) This method is deprecated and will be removed in the next major version update.
Deprecated: Looks up assignments for a specified resource for a particular region. If the request is about a project:
1. Assignments created on the project will be returned if they exist. 2. Otherwise assignments created on the closest ancestor will be returned. 3. Assignments for different JobTypes will all be returned.
The same logic applies if the request is about a folder.
If the request is about an organization, then assignments created on the organization will be returned (organization doesn't have ancestors).
Comparing to ListAssignments, there are some behavior differences:
1. permission on the assignee will be verified in this API. 2. Hierarchy lookup
(project->folder->organization) happens in this API. 3. Parent here is
projects/*/locations/*
, instead of
projects/*/locations/*reservations/*
.
**Note** "-" cannot be used for projects nor locations.
Sample code:
try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
String query = "query107944136";
for (Assignment element :
reservationServiceClient.searchAssignments(parent, query).iterateAll()) {
// doThingsWith(element);
}
}
Name | Description |
parent | LocationName Required. The resource name of the admin project(containing project and
location), e.g.: |
query | String Please specify resource name as assignee in the query. Examples:
|
Type | Description |
ReservationServiceClient.SearchAssignmentsPagedResponse |
searchAssignments(SearchAssignmentsRequest request) (deprecated)
public final ReservationServiceClient.SearchAssignmentsPagedResponse searchAssignments(SearchAssignmentsRequest request)
(deprecated) This method is deprecated and will be removed in the next major version update.
Deprecated: Looks up assignments for a specified resource for a particular region. If the request is about a project:
1. Assignments created on the project will be returned if they exist. 2. Otherwise assignments created on the closest ancestor will be returned. 3. Assignments for different JobTypes will all be returned.
The same logic applies if the request is about a folder.
If the request is about an organization, then assignments created on the organization will be returned (organization doesn't have ancestors).
Comparing to ListAssignments, there are some behavior differences:
1. permission on the assignee will be verified in this API. 2. Hierarchy lookup
(project->folder->organization) happens in this API. 3. Parent here is
projects/*/locations/*
, instead of
projects/*/locations/*reservations/*
.
**Note** "-" cannot be used for projects nor locations.
Sample code:
try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
SearchAssignmentsRequest request =
SearchAssignmentsRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.setQuery("query107944136")
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
for (Assignment element : reservationServiceClient.searchAssignments(request).iterateAll()) {
// doThingsWith(element);
}
}
Name | Description |
request | SearchAssignmentsRequest The request object containing all of the parameters for the API call. |
Type | Description |
ReservationServiceClient.SearchAssignmentsPagedResponse |
searchAssignments(String parent, String query) (deprecated)
public final ReservationServiceClient.SearchAssignmentsPagedResponse searchAssignments(String parent, String query)
(deprecated) This method is deprecated and will be removed in the next major version update.
Deprecated: Looks up assignments for a specified resource for a particular region. If the request is about a project:
1. Assignments created on the project will be returned if they exist. 2. Otherwise assignments created on the closest ancestor will be returned. 3. Assignments for different JobTypes will all be returned.
The same logic applies if the request is about a folder.
If the request is about an organization, then assignments created on the organization will be returned (organization doesn't have ancestors).
Comparing to ListAssignments, there are some behavior differences:
1. permission on the assignee will be verified in this API. 2. Hierarchy lookup
(project->folder->organization) happens in this API. 3. Parent here is
projects/*/locations/*
, instead of
projects/*/locations/*reservations/*
.
**Note** "-" cannot be used for projects nor locations.
Sample code:
try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
String query = "query107944136";
for (Assignment element :
reservationServiceClient.searchAssignments(parent, query).iterateAll()) {
// doThingsWith(element);
}
}
Name | Description |
parent | String Required. The resource name of the admin project(containing project and
location), e.g.: |
query | String Please specify resource name as assignee in the query. Examples:
|
Type | Description |
ReservationServiceClient.SearchAssignmentsPagedResponse |
searchAssignmentsCallable() (deprecated)
public final UnaryCallable<SearchAssignmentsRequest,SearchAssignmentsResponse> searchAssignmentsCallable()
(deprecated) This method is deprecated and will be removed in the next major version update.
Deprecated: Looks up assignments for a specified resource for a particular region. If the request is about a project:
1. Assignments created on the project will be returned if they exist. 2. Otherwise assignments created on the closest ancestor will be returned. 3. Assignments for different JobTypes will all be returned.
The same logic applies if the request is about a folder.
If the request is about an organization, then assignments created on the organization will be returned (organization doesn't have ancestors).
Comparing to ListAssignments, there are some behavior differences:
1. permission on the assignee will be verified in this API. 2. Hierarchy lookup
(project->folder->organization) happens in this API. 3. Parent here is
projects/*/locations/*
, instead of
projects/*/locations/*reservations/*
.
**Note** "-" cannot be used for projects nor locations.
Sample code:
try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
SearchAssignmentsRequest request =
SearchAssignmentsRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.setQuery("query107944136")
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
while (true) {
SearchAssignmentsResponse response =
reservationServiceClient.searchAssignmentsCallable().call(request);
for (Assignment element : response.getResponsesList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
Type | Description |
UnaryCallable<SearchAssignmentsRequest,SearchAssignmentsResponse> |
searchAssignmentsPagedCallable() (deprecated)
public final UnaryCallable<SearchAssignmentsRequest,ReservationServiceClient.SearchAssignmentsPagedResponse> searchAssignmentsPagedCallable()
(deprecated) This method is deprecated and will be removed in the next major version update.
Deprecated: Looks up assignments for a specified resource for a particular region. If the request is about a project:
1. Assignments created on the project will be returned if they exist. 2. Otherwise assignments created on the closest ancestor will be returned. 3. Assignments for different JobTypes will all be returned.
The same logic applies if the request is about a folder.
If the request is about an organization, then assignments created on the organization will be returned (organization doesn't have ancestors).
Comparing to ListAssignments, there are some behavior differences:
1. permission on the assignee will be verified in this API. 2. Hierarchy lookup
(project->folder->organization) happens in this API. 3. Parent here is
projects/*/locations/*
, instead of
projects/*/locations/*reservations/*
.
**Note** "-" cannot be used for projects nor locations.
Sample code:
try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
SearchAssignmentsRequest request =
SearchAssignmentsRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.setQuery("query107944136")
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
ApiFuture
Type | Description |
UnaryCallable<SearchAssignmentsRequest,SearchAssignmentsPagedResponse> |
shutdown()
public void shutdown()
shutdownNow()
public void shutdownNow()
splitCapacityCommitment(CapacityCommitmentName name, long slotCount)
public final SplitCapacityCommitmentResponse splitCapacityCommitment(CapacityCommitmentName name, long slotCount)
Splits capacity commitment to two commitments of the same plan and commitment_end_time
.
A common use case is to enable downgrading commitments.
For example, in order to downgrade from 10000 slots to 8000, you might split a 10000
capacity commitment into commitments of 2000 and 8000. Then, you would change the plan of the
first one to FLEX
and then delete it.
Sample code:
try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
CapacityCommitmentName name =
CapacityCommitmentName.of("[PROJECT]", "[LOCATION]", "[CAPACITY_COMMITMENT]");
long slotCount = -191518834;
SplitCapacityCommitmentResponse response =
reservationServiceClient.splitCapacityCommitment(name, slotCount);
}
Name | Description |
name | CapacityCommitmentName Required. The resource name e.g.,:
|
slotCount | long Number of slots in the capacity commitment after the split. |
Type | Description |
SplitCapacityCommitmentResponse |
splitCapacityCommitment(SplitCapacityCommitmentRequest request)
public final SplitCapacityCommitmentResponse splitCapacityCommitment(SplitCapacityCommitmentRequest request)
Splits capacity commitment to two commitments of the same plan and commitment_end_time
.
A common use case is to enable downgrading commitments.
For example, in order to downgrade from 10000 slots to 8000, you might split a 10000
capacity commitment into commitments of 2000 and 8000. Then, you would change the plan of the
first one to FLEX
and then delete it.
Sample code:
try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
SplitCapacityCommitmentRequest request =
SplitCapacityCommitmentRequest.newBuilder()
.setName(
CapacityCommitmentName.of("[PROJECT]", "[LOCATION]", "[CAPACITY_COMMITMENT]")
.toString())
.setSlotCount(-191518834)
.build();
SplitCapacityCommitmentResponse response =
reservationServiceClient.splitCapacityCommitment(request);
}
Name | Description |
request | SplitCapacityCommitmentRequest The request object containing all of the parameters for the API call. |
Type | Description |
SplitCapacityCommitmentResponse |
splitCapacityCommitment(String name, long slotCount)
public final SplitCapacityCommitmentResponse splitCapacityCommitment(String name, long slotCount)
Splits capacity commitment to two commitments of the same plan and commitment_end_time
.
A common use case is to enable downgrading commitments.
For example, in order to downgrade from 10000 slots to 8000, you might split a 10000
capacity commitment into commitments of 2000 and 8000. Then, you would change the plan of the
first one to FLEX
and then delete it.
Sample code:
try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
String name =
CapacityCommitmentName.of("[PROJECT]", "[LOCATION]", "[CAPACITY_COMMITMENT]").toString();
long slotCount = -191518834;
SplitCapacityCommitmentResponse response =
reservationServiceClient.splitCapacityCommitment(name, slotCount);
}
Name | Description |
name | String Required. The resource name e.g.,:
|
slotCount | long Number of slots in the capacity commitment after the split. |
Type | Description |
SplitCapacityCommitmentResponse |
splitCapacityCommitmentCallable()
public final UnaryCallable<SplitCapacityCommitmentRequest,SplitCapacityCommitmentResponse> splitCapacityCommitmentCallable()
Splits capacity commitment to two commitments of the same plan and commitment_end_time
.
A common use case is to enable downgrading commitments.
For example, in order to downgrade from 10000 slots to 8000, you might split a 10000
capacity commitment into commitments of 2000 and 8000. Then, you would change the plan of the
first one to FLEX
and then delete it.
Sample code:
try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
SplitCapacityCommitmentRequest request =
SplitCapacityCommitmentRequest.newBuilder()
.setName(
CapacityCommitmentName.of("[PROJECT]", "[LOCATION]", "[CAPACITY_COMMITMENT]")
.toString())
.setSlotCount(-191518834)
.build();
ApiFuture
Type | Description |
UnaryCallable<SplitCapacityCommitmentRequest,SplitCapacityCommitmentResponse> |
updateBiReservation(BiReservation biReservation, FieldMask updateMask)
public final BiReservation updateBiReservation(BiReservation biReservation, FieldMask updateMask)
Updates a BI reservation.
Only fields specified in the field_mask
are updated.
A singleton BI reservation always exists with default size 0. In order to reserve BI capacity it needs to be updated to an amount greater than 0. In order to release BI capacity reservation size must be set to 0.
Sample code:
try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
BiReservation biReservation = BiReservation.newBuilder().build();
FieldMask updateMask = FieldMask.newBuilder().build();
BiReservation response =
reservationServiceClient.updateBiReservation(biReservation, updateMask);
}
Name | Description |
biReservation | BiReservation A reservation to update. |
updateMask | FieldMask A list of fields to be updated in this request. |
Type | Description |
BiReservation |
updateBiReservation(UpdateBiReservationRequest request)
public final BiReservation updateBiReservation(UpdateBiReservationRequest request)
Updates a BI reservation.
Only fields specified in the field_mask
are updated.
A singleton BI reservation always exists with default size 0. In order to reserve BI capacity it needs to be updated to an amount greater than 0. In order to release BI capacity reservation size must be set to 0.
Sample code:
try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
UpdateBiReservationRequest request =
UpdateBiReservationRequest.newBuilder()
.setBiReservation(BiReservation.newBuilder().build())
.setUpdateMask(FieldMask.newBuilder().build())
.build();
BiReservation response = reservationServiceClient.updateBiReservation(request);
}
Name | Description |
request | UpdateBiReservationRequest The request object containing all of the parameters for the API call. |
Type | Description |
BiReservation |
updateBiReservationCallable()
public final UnaryCallable<UpdateBiReservationRequest,BiReservation> updateBiReservationCallable()
Updates a BI reservation.
Only fields specified in the field_mask
are updated.
A singleton BI reservation always exists with default size 0. In order to reserve BI capacity it needs to be updated to an amount greater than 0. In order to release BI capacity reservation size must be set to 0.
Sample code:
try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
UpdateBiReservationRequest request =
UpdateBiReservationRequest.newBuilder()
.setBiReservation(BiReservation.newBuilder().build())
.setUpdateMask(FieldMask.newBuilder().build())
.build();
ApiFuture
Type | Description |
UnaryCallable<UpdateBiReservationRequest,BiReservation> |
updateCapacityCommitment(CapacityCommitment capacityCommitment, FieldMask updateMask)
public final CapacityCommitment updateCapacityCommitment(CapacityCommitment capacityCommitment, FieldMask updateMask)
Updates an existing capacity commitment.
Only plan
and renewal_plan
fields can be updated.
Plan can only be changed to a plan of a longer commitment period. Attempting to change to a
plan with shorter commitment period will fail with the error code
google.rpc.Code.FAILED_PRECONDITION
.
Sample code:
try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
CapacityCommitment capacityCommitment = CapacityCommitment.newBuilder().build();
FieldMask updateMask = FieldMask.newBuilder().build();
CapacityCommitment response =
reservationServiceClient.updateCapacityCommitment(capacityCommitment, updateMask);
}
Name | Description |
capacityCommitment | CapacityCommitment Content of the capacity commitment to update. |
updateMask | FieldMask Standard field mask for the set of fields to be updated. |
Type | Description |
CapacityCommitment |
updateCapacityCommitment(UpdateCapacityCommitmentRequest request)
public final CapacityCommitment updateCapacityCommitment(UpdateCapacityCommitmentRequest request)
Updates an existing capacity commitment.
Only plan
and renewal_plan
fields can be updated.
Plan can only be changed to a plan of a longer commitment period. Attempting to change to a
plan with shorter commitment period will fail with the error code
google.rpc.Code.FAILED_PRECONDITION
.
Sample code:
try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
UpdateCapacityCommitmentRequest request =
UpdateCapacityCommitmentRequest.newBuilder()
.setCapacityCommitment(CapacityCommitment.newBuilder().build())
.setUpdateMask(FieldMask.newBuilder().build())
.build();
CapacityCommitment response = reservationServiceClient.updateCapacityCommitment(request);
}
Name | Description |
request | UpdateCapacityCommitmentRequest The request object containing all of the parameters for the API call. |
Type | Description |
CapacityCommitment |
updateCapacityCommitmentCallable()
public final UnaryCallable<UpdateCapacityCommitmentRequest,CapacityCommitment> updateCapacityCommitmentCallable()
Updates an existing capacity commitment.
Only plan
and renewal_plan
fields can be updated.
Plan can only be changed to a plan of a longer commitment period. Attempting to change to a
plan with shorter commitment period will fail with the error code
google.rpc.Code.FAILED_PRECONDITION
.
Sample code:
try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
UpdateCapacityCommitmentRequest request =
UpdateCapacityCommitmentRequest.newBuilder()
.setCapacityCommitment(CapacityCommitment.newBuilder().build())
.setUpdateMask(FieldMask.newBuilder().build())
.build();
ApiFuture
Type | Description |
UnaryCallable<UpdateCapacityCommitmentRequest,CapacityCommitment> |
updateReservation(Reservation reservation, FieldMask updateMask)
public final Reservation updateReservation(Reservation reservation, FieldMask updateMask)
Updates an existing reservation resource.
Sample code:
try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
Reservation reservation = Reservation.newBuilder().build();
FieldMask updateMask = FieldMask.newBuilder().build();
Reservation response = reservationServiceClient.updateReservation(reservation, updateMask);
}
Name | Description |
reservation | Reservation Content of the reservation to update. |
updateMask | FieldMask Standard field mask for the set of fields to be updated. |
Type | Description |
Reservation |
updateReservation(UpdateReservationRequest request)
public final Reservation updateReservation(UpdateReservationRequest request)
Updates an existing reservation resource.
Sample code:
try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
UpdateReservationRequest request =
UpdateReservationRequest.newBuilder()
.setReservation(Reservation.newBuilder().build())
.setUpdateMask(FieldMask.newBuilder().build())
.build();
Reservation response = reservationServiceClient.updateReservation(request);
}
Name | Description |
request | UpdateReservationRequest The request object containing all of the parameters for the API call. |
Type | Description |
Reservation |
updateReservationCallable()
public final UnaryCallable<UpdateReservationRequest,Reservation> updateReservationCallable()
Updates an existing reservation resource.
Sample code:
try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
UpdateReservationRequest request =
UpdateReservationRequest.newBuilder()
.setReservation(Reservation.newBuilder().build())
.setUpdateMask(FieldMask.newBuilder().build())
.build();
ApiFuture
Type | Description |
UnaryCallable<UpdateReservationRequest,Reservation> |