- 2.56.0 (latest)
- 2.55.0
- 2.54.0
- 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
GitHub Repository | Product Reference |
Service Description: This API allows users to manage their 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:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (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().
Method | Description | Method Variants |
---|---|---|
CreateReservation |
Creates a new reservation resource. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
ListReservations |
Lists all the reservations for the project in the specified location. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
GetReservation |
Returns information about the reservation. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
DeleteReservation |
Deletes a reservation. Returns |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
UpdateReservation |
Updates an existing reservation resource. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
FailoverReservation |
Fail over a reservation to the secondary location. The operation should be done in the current secondary location, which will be promoted to the new primary location for the reservation. Attempting to failover a reservation in the current primary location will fail with the error code |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
CreateCapacityCommitment |
Creates a new capacity commitment resource. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
ListCapacityCommitments |
Lists all the capacity commitments for the admin project. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
GetCapacityCommitment |
Returns information about the capacity commitment. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
DeleteCapacityCommitment |
Deletes a capacity commitment. Attempting to delete capacity commitment before its commitment_end_time will fail with the error code |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
UpdateCapacityCommitment |
Updates an existing capacity commitment. Only 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 |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
SplitCapacityCommitment |
Splits capacity commitment to two commitments of the same plan and 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 delete the first one after the commitment end time passes. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
MergeCapacityCommitments |
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 |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
CreateAssignment |
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:
"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: Returns Returns |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
ListAssignments |
Lists assignments. Only explicitly created assignments will be returned. Example:
In this example, ListAssignments will just return the above two assignments for reservation 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. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
DeleteAssignment |
Deletes a assignment. No expansion will happen. Example:
In this example, deletion of the |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
SearchAssignments |
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 **Note** "-" cannot be used for projects nor locations. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
SearchAllAssignments |
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 |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
MoveAssignment |
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. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
UpdateAssignment |
Updates an existing assignment. Only the |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
GetBiReservation |
Retrieves a BI reservation. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
UpdateBiReservation |
Updates a BI reservation. Only fields specified in the 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. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
See the individual methods for example code.
Many parameters require resource names to be formatted in a particular way. To assist with these names, this class includes a format method for each type of name, and additionally a parse method to extract the individual identifiers contained within names that are returned.
This class can be customized by passing in a custom instance of ReservationServiceSettings to create(). For example:
To customize credentials:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
ReservationServiceSettings reservationServiceSettings =
ReservationServiceSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
.build();
ReservationServiceClient reservationServiceClient =
ReservationServiceClient.create(reservationServiceSettings);
To customize the endpoint:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
ReservationServiceSettings reservationServiceSettings =
ReservationServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
ReservationServiceClient reservationServiceClient =
ReservationServiceClient.create(reservationServiceSettings);
To use REST (HTTP1.1/JSON) transport (instead of gRPC) for sending and receiving requests over the wire:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
ReservationServiceSettings reservationServiceSettings =
ReservationServiceSettings.newHttpJsonBuilder().build();
ReservationServiceClient reservationServiceClient =
ReservationServiceClient.create(reservationServiceSettings);
Please refer to the GitHub repository's samples for more quickstart code snippets.
Static Methods
create()
public static final ReservationServiceClient create()
Constructs an instance of ReservationServiceClient with default settings.
Returns | |
---|---|
Type | Description |
ReservationServiceClient |
Exceptions | |
---|---|
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.
Parameter | |
---|---|
Name | Description |
settings |
ReservationServiceSettings |
Returns | |
---|---|
Type | Description |
ReservationServiceClient |
Exceptions | |
---|---|
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).
Parameter | |
---|---|
Name | Description |
stub |
ReservationServiceStub |
Returns | |
---|---|
Type | Description |
ReservationServiceClient |
Constructors
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.
Parameter | |
---|---|
Name | Description |
settings |
ReservationServiceSettings |
ReservationServiceClient(ReservationServiceStub stub)
protected ReservationServiceClient(ReservationServiceStub stub)
Parameter | |
---|---|
Name | Description |
stub |
ReservationServiceStub |
Methods
awaitTermination(long duration, TimeUnit unit)
public boolean awaitTermination(long duration, TimeUnit unit)
Parameters | |
---|---|
Name | Description |
duration |
long |
unit |
TimeUnit |
Returns | |
---|---|
Type | Description |
boolean |
Exceptions | |
---|---|
Type | Description |
InterruptedException |
close()
public final void close()
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:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (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);
}
Parameter | |
---|---|
Name | Description |
request |
CreateAssignmentRequest The request object containing all of the parameters for the API call. |
Returns | |
---|---|
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:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
ReservationName parent = ReservationName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]");
Assignment assignment = Assignment.newBuilder().build();
Assignment response = reservationServiceClient.createAssignment(parent, assignment);
}
Parameters | |
---|---|
Name | Description |
parent |
ReservationName Required. The parent resource name of the assignment E.g.
|
assignment |
Assignment Assignment resource to create. |
Returns | |
---|---|
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:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
String parent = ReservationName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]").toString();
Assignment assignment = Assignment.newBuilder().build();
Assignment response = reservationServiceClient.createAssignment(parent, assignment);
}
Parameters | |
---|---|
Name | Description |
parent |
String Required. The parent resource name of the assignment E.g.
|
assignment |
Assignment Assignment resource to create. |
Returns | |
---|---|
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:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
CreateAssignmentRequest request =
CreateAssignmentRequest.newBuilder()
.setParent(ReservationName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]").toString())
.setAssignment(Assignment.newBuilder().build())
.setAssignmentId("assignmentId-1603989304")
.build();
ApiFuture<Assignment> future =
reservationServiceClient.createAssignmentCallable().futureCall(request);
// Do something.
Assignment response = future.get();
}
Returns | |
---|---|
Type | Description |
UnaryCallable<CreateAssignmentRequest,Assignment> |
createCapacityCommitment(CreateCapacityCommitmentRequest request)
public final CapacityCommitment createCapacityCommitment(CreateCapacityCommitmentRequest request)
Creates a new capacity commitment resource.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (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);
}
Parameter | |
---|---|
Name | Description |
request |
CreateCapacityCommitmentRequest The request object containing all of the parameters for the API call. |
Returns | |
---|---|
Type | Description |
CapacityCommitment |
createCapacityCommitment(LocationName parent, CapacityCommitment capacityCommitment)
public final CapacityCommitment createCapacityCommitment(LocationName parent, CapacityCommitment capacityCommitment)
Creates a new capacity commitment resource.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
CapacityCommitment capacityCommitment = CapacityCommitment.newBuilder().build();
CapacityCommitment response =
reservationServiceClient.createCapacityCommitment(parent, capacityCommitment);
}
Parameters | |
---|---|
Name | Description |
parent |
LocationName Required. Resource name of the parent reservation. E.g.,
|
capacityCommitment |
CapacityCommitment Content of the capacity commitment to create. |
Returns | |
---|---|
Type | Description |
CapacityCommitment |
createCapacityCommitment(String parent, CapacityCommitment capacityCommitment)
public final CapacityCommitment createCapacityCommitment(String parent, CapacityCommitment capacityCommitment)
Creates a new capacity commitment resource.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
CapacityCommitment capacityCommitment = CapacityCommitment.newBuilder().build();
CapacityCommitment response =
reservationServiceClient.createCapacityCommitment(parent, capacityCommitment);
}
Parameters | |
---|---|
Name | Description |
parent |
String Required. Resource name of the parent reservation. E.g.,
|
capacityCommitment |
CapacityCommitment Content of the capacity commitment to create. |
Returns | |
---|---|
Type | Description |
CapacityCommitment |
createCapacityCommitmentCallable()
public final UnaryCallable<CreateCapacityCommitmentRequest,CapacityCommitment> createCapacityCommitmentCallable()
Creates a new capacity commitment resource.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
CreateCapacityCommitmentRequest request =
CreateCapacityCommitmentRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.setCapacityCommitment(CapacityCommitment.newBuilder().build())
.setEnforceSingleAdminProjectPerOrg(true)
.setCapacityCommitmentId("capacityCommitmentId1185645802")
.build();
ApiFuture<CapacityCommitment> future =
reservationServiceClient.createCapacityCommitmentCallable().futureCall(request);
// Do something.
CapacityCommitment response = future.get();
}
Returns | |
---|---|
Type | Description |
UnaryCallable<CreateCapacityCommitmentRequest,CapacityCommitment> |
createReservation(CreateReservationRequest request)
public final Reservation createReservation(CreateReservationRequest request)
Creates a new reservation resource.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (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);
}
Parameter | |
---|---|
Name | Description |
request |
CreateReservationRequest The request object containing all of the parameters for the API call. |
Returns | |
---|---|
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:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (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);
}
Parameters | |
---|---|
Name | Description |
parent |
LocationName Required. Project, location. E.g., |
reservation |
Reservation Definition of the new reservation to create. |
reservationId |
String The reservation ID. It must only contain lower case alphanumeric characters or dashes. It must start with a letter and must not end with a dash. Its maximum length is 64 characters. |
Returns | |
---|---|
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:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (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);
}
Parameters | |
---|---|
Name | Description |
parent |
String Required. Project, location. E.g., |
reservation |
Reservation Definition of the new reservation to create. |
reservationId |
String The reservation ID. It must only contain lower case alphanumeric characters or dashes. It must start with a letter and must not end with a dash. Its maximum length is 64 characters. |
Returns | |
---|---|
Type | Description |
Reservation |
createReservationCallable()
public final UnaryCallable<CreateReservationRequest,Reservation> createReservationCallable()
Creates a new reservation resource.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
CreateReservationRequest request =
CreateReservationRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.setReservationId("reservationId1116965383")
.setReservation(Reservation.newBuilder().build())
.build();
ApiFuture<Reservation> future =
reservationServiceClient.createReservationCallable().futureCall(request);
// Do something.
Reservation response = future.get();
}
Returns | |
---|---|
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:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
AssignmentName name =
AssignmentName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]", "[ASSIGNMENT]");
reservationServiceClient.deleteAssignment(name);
}
Parameter | |
---|---|
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:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
DeleteAssignmentRequest request =
DeleteAssignmentRequest.newBuilder()
.setName(
AssignmentName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]", "[ASSIGNMENT]")
.toString())
.build();
reservationServiceClient.deleteAssignment(request);
}
Parameter | |
---|---|
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:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
String name =
AssignmentName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]", "[ASSIGNMENT]").toString();
reservationServiceClient.deleteAssignment(name);
}
Parameter | |
---|---|
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:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
DeleteAssignmentRequest request =
DeleteAssignmentRequest.newBuilder()
.setName(
AssignmentName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]", "[ASSIGNMENT]")
.toString())
.build();
ApiFuture<Empty> future =
reservationServiceClient.deleteAssignmentCallable().futureCall(request);
// Do something.
future.get();
}
Returns | |
---|---|
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:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
CapacityCommitmentName name =
CapacityCommitmentName.of("[PROJECT]", "[LOCATION]", "[CAPACITY_COMMITMENT]");
reservationServiceClient.deleteCapacityCommitment(name);
}
Parameter | |
---|---|
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:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
DeleteCapacityCommitmentRequest request =
DeleteCapacityCommitmentRequest.newBuilder()
.setName(
CapacityCommitmentName.of("[PROJECT]", "[LOCATION]", "[CAPACITY_COMMITMENT]")
.toString())
.setForce(true)
.build();
reservationServiceClient.deleteCapacityCommitment(request);
}
Parameter | |
---|---|
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:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
String name =
CapacityCommitmentName.of("[PROJECT]", "[LOCATION]", "[CAPACITY_COMMITMENT]").toString();
reservationServiceClient.deleteCapacityCommitment(name);
}
Parameter | |
---|---|
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:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
DeleteCapacityCommitmentRequest request =
DeleteCapacityCommitmentRequest.newBuilder()
.setName(
CapacityCommitmentName.of("[PROJECT]", "[LOCATION]", "[CAPACITY_COMMITMENT]")
.toString())
.setForce(true)
.build();
ApiFuture<Empty> future =
reservationServiceClient.deleteCapacityCommitmentCallable().futureCall(request);
// Do something.
future.get();
}
Returns | |
---|---|
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:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
DeleteReservationRequest request =
DeleteReservationRequest.newBuilder()
.setName(ReservationName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]").toString())
.build();
reservationServiceClient.deleteReservation(request);
}
Parameter | |
---|---|
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:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
ReservationName name = ReservationName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]");
reservationServiceClient.deleteReservation(name);
}
Parameter | |
---|---|
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:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
String name = ReservationName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]").toString();
reservationServiceClient.deleteReservation(name);
}
Parameter | |
---|---|
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:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
DeleteReservationRequest request =
DeleteReservationRequest.newBuilder()
.setName(ReservationName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]").toString())
.build();
ApiFuture<Empty> future =
reservationServiceClient.deleteReservationCallable().futureCall(request);
// Do something.
future.get();
}
Returns | |
---|---|
Type | Description |
UnaryCallable<DeleteReservationRequest,Empty> |
failoverReservation(FailoverReservationRequest request)
public final Reservation failoverReservation(FailoverReservationRequest request)
Fail over a reservation to the secondary location. The operation should be done in the current
secondary location, which will be promoted to the new primary location for the reservation.
Attempting to failover a reservation in the current primary location will fail with the error
code google.rpc.Code.FAILED_PRECONDITION
.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
FailoverReservationRequest request =
FailoverReservationRequest.newBuilder()
.setName(ReservationName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]").toString())
.build();
Reservation response = reservationServiceClient.failoverReservation(request);
}
Parameter | |
---|---|
Name | Description |
request |
FailoverReservationRequest The request object containing all of the parameters for the API call. |
Returns | |
---|---|
Type | Description |
Reservation |
failoverReservationCallable()
public final UnaryCallable<FailoverReservationRequest,Reservation> failoverReservationCallable()
Fail over a reservation to the secondary location. The operation should be done in the current
secondary location, which will be promoted to the new primary location for the reservation.
Attempting to failover a reservation in the current primary location will fail with the error
code google.rpc.Code.FAILED_PRECONDITION
.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
FailoverReservationRequest request =
FailoverReservationRequest.newBuilder()
.setName(ReservationName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]").toString())
.build();
ApiFuture<Reservation> future =
reservationServiceClient.failoverReservationCallable().futureCall(request);
// Do something.
Reservation response = future.get();
}
Returns | |
---|---|
Type | Description |
UnaryCallable<FailoverReservationRequest,Reservation> |
getBiReservation(BiReservationName name)
public final BiReservation getBiReservation(BiReservationName name)
Retrieves a BI reservation.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
BiReservationName name = BiReservationName.of("[PROJECT]", "[LOCATION]");
BiReservation response = reservationServiceClient.getBiReservation(name);
}
Parameter | |
---|---|
Name | Description |
name |
BiReservationName Required. Name of the requested reservation, for example:
|
Returns | |
---|---|
Type | Description |
BiReservation |
getBiReservation(GetBiReservationRequest request)
public final BiReservation getBiReservation(GetBiReservationRequest request)
Retrieves a BI reservation.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
GetBiReservationRequest request =
GetBiReservationRequest.newBuilder()
.setName(BiReservationName.of("[PROJECT]", "[LOCATION]").toString())
.build();
BiReservation response = reservationServiceClient.getBiReservation(request);
}
Parameter | |
---|---|
Name | Description |
request |
GetBiReservationRequest The request object containing all of the parameters for the API call. |
Returns | |
---|---|
Type | Description |
BiReservation |
getBiReservation(String name)
public final BiReservation getBiReservation(String name)
Retrieves a BI reservation.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
String name = BiReservationName.of("[PROJECT]", "[LOCATION]").toString();
BiReservation response = reservationServiceClient.getBiReservation(name);
}
Parameter | |
---|---|
Name | Description |
name |
String Required. Name of the requested reservation, for example:
|
Returns | |
---|---|
Type | Description |
BiReservation |
getBiReservationCallable()
public final UnaryCallable<GetBiReservationRequest,BiReservation> getBiReservationCallable()
Retrieves a BI reservation.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
GetBiReservationRequest request =
GetBiReservationRequest.newBuilder()
.setName(BiReservationName.of("[PROJECT]", "[LOCATION]").toString())
.build();
ApiFuture<BiReservation> future =
reservationServiceClient.getBiReservationCallable().futureCall(request);
// Do something.
BiReservation response = future.get();
}
Returns | |
---|---|
Type | Description |
UnaryCallable<GetBiReservationRequest,BiReservation> |
getCapacityCommitment(CapacityCommitmentName name)
public final CapacityCommitment getCapacityCommitment(CapacityCommitmentName name)
Returns information about the capacity commitment.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
CapacityCommitmentName name =
CapacityCommitmentName.of("[PROJECT]", "[LOCATION]", "[CAPACITY_COMMITMENT]");
CapacityCommitment response = reservationServiceClient.getCapacityCommitment(name);
}
Parameter | |
---|---|
Name | Description |
name |
CapacityCommitmentName Required. Resource name of the capacity commitment to retrieve. E.g.,
|
Returns | |
---|---|
Type | Description |
CapacityCommitment |
getCapacityCommitment(GetCapacityCommitmentRequest request)
public final CapacityCommitment getCapacityCommitment(GetCapacityCommitmentRequest request)
Returns information about the capacity commitment.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
GetCapacityCommitmentRequest request =
GetCapacityCommitmentRequest.newBuilder()
.setName(
CapacityCommitmentName.of("[PROJECT]", "[LOCATION]", "[CAPACITY_COMMITMENT]")
.toString())
.build();
CapacityCommitment response = reservationServiceClient.getCapacityCommitment(request);
}
Parameter | |
---|---|
Name | Description |
request |
GetCapacityCommitmentRequest The request object containing all of the parameters for the API call. |
Returns | |
---|---|
Type | Description |
CapacityCommitment |
getCapacityCommitment(String name)
public final CapacityCommitment getCapacityCommitment(String name)
Returns information about the capacity commitment.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
String name =
CapacityCommitmentName.of("[PROJECT]", "[LOCATION]", "[CAPACITY_COMMITMENT]").toString();
CapacityCommitment response = reservationServiceClient.getCapacityCommitment(name);
}
Parameter | |
---|---|
Name | Description |
name |
String Required. Resource name of the capacity commitment to retrieve. E.g.,
|
Returns | |
---|---|
Type | Description |
CapacityCommitment |
getCapacityCommitmentCallable()
public final UnaryCallable<GetCapacityCommitmentRequest,CapacityCommitment> getCapacityCommitmentCallable()
Returns information about the capacity commitment.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
GetCapacityCommitmentRequest request =
GetCapacityCommitmentRequest.newBuilder()
.setName(
CapacityCommitmentName.of("[PROJECT]", "[LOCATION]", "[CAPACITY_COMMITMENT]")
.toString())
.build();
ApiFuture<CapacityCommitment> future =
reservationServiceClient.getCapacityCommitmentCallable().futureCall(request);
// Do something.
CapacityCommitment response = future.get();
}
Returns | |
---|---|
Type | Description |
UnaryCallable<GetCapacityCommitmentRequest,CapacityCommitment> |
getReservation(GetReservationRequest request)
public final Reservation getReservation(GetReservationRequest request)
Returns information about the reservation.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
GetReservationRequest request =
GetReservationRequest.newBuilder()
.setName(ReservationName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]").toString())
.build();
Reservation response = reservationServiceClient.getReservation(request);
}
Parameter | |
---|---|
Name | Description |
request |
GetReservationRequest The request object containing all of the parameters for the API call. |
Returns | |
---|---|
Type | Description |
Reservation |
getReservation(ReservationName name)
public final Reservation getReservation(ReservationName name)
Returns information about the reservation.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
ReservationName name = ReservationName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]");
Reservation response = reservationServiceClient.getReservation(name);
}
Parameter | |
---|---|
Name | Description |
name |
ReservationName Required. Resource name of the reservation to retrieve. E.g.,
|
Returns | |
---|---|
Type | Description |
Reservation |
getReservation(String name)
public final Reservation getReservation(String name)
Returns information about the reservation.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
String name = ReservationName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]").toString();
Reservation response = reservationServiceClient.getReservation(name);
}
Parameter | |
---|---|
Name | Description |
name |
String Required. Resource name of the reservation to retrieve. E.g.,
|
Returns | |
---|---|
Type | Description |
Reservation |
getReservationCallable()
public final UnaryCallable<GetReservationRequest,Reservation> getReservationCallable()
Returns information about the reservation.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
GetReservationRequest request =
GetReservationRequest.newBuilder()
.setName(ReservationName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]").toString())
.build();
ApiFuture<Reservation> future =
reservationServiceClient.getReservationCallable().futureCall(request);
// Do something.
Reservation response = future.get();
}
Returns | |
---|---|
Type | Description |
UnaryCallable<GetReservationRequest,Reservation> |
getSettings()
public final ReservationServiceSettings getSettings()
Returns | |
---|---|
Type | Description |
ReservationServiceSettings |
getStub()
public ReservationServiceStub getStub()
Returns | |
---|---|
Type | Description |
ReservationServiceStub |
isShutdown()
public boolean isShutdown()
Returns | |
---|---|
Type | Description |
boolean |
isTerminated()
public boolean isTerminated()
Returns | |
---|---|
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:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (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);
}
}
Parameter | |
---|---|
Name | Description |
request |
ListAssignmentsRequest The request object containing all of the parameters for the API call. |
Returns | |
---|---|
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:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
ReservationName parent = ReservationName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]");
for (Assignment element : reservationServiceClient.listAssignments(parent).iterateAll()) {
// doThingsWith(element);
}
}
Parameter | |
---|---|
Name | Description |
parent |
ReservationName Required. The parent resource name e.g.:
Or:
|
Returns | |
---|---|
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:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
String parent = ReservationName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]").toString();
for (Assignment element : reservationServiceClient.listAssignments(parent).iterateAll()) {
// doThingsWith(element);
}
}
Parameter | |
---|---|
Name | Description |
parent |
String Required. The parent resource name e.g.:
Or:
|
Returns | |
---|---|
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:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (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.getAssignmentsList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
Returns | |
---|---|
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:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
ListAssignmentsRequest request =
ListAssignmentsRequest.newBuilder()
.setParent(ReservationName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
ApiFuture<Assignment> future =
reservationServiceClient.listAssignmentsPagedCallable().futureCall(request);
// Do something.
for (Assignment element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
Returns | |
---|---|
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:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (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);
}
}
Parameter | |
---|---|
Name | Description |
request |
ListCapacityCommitmentsRequest The request object containing all of the parameters for the API call. |
Returns | |
---|---|
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:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
for (CapacityCommitment element :
reservationServiceClient.listCapacityCommitments(parent).iterateAll()) {
// doThingsWith(element);
}
}
Parameter | |
---|---|
Name | Description |
parent |
LocationName Required. Resource name of the parent reservation. E.g.,
|
Returns | |
---|---|
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:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
for (CapacityCommitment element :
reservationServiceClient.listCapacityCommitments(parent).iterateAll()) {
// doThingsWith(element);
}
}
Parameter | |
---|---|
Name | Description |
parent |
String Required. Resource name of the parent reservation. E.g.,
|
Returns | |
---|---|
Type | Description |
ReservationServiceClient.ListCapacityCommitmentsPagedResponse |
listCapacityCommitmentsCallable()
public final UnaryCallable<ListCapacityCommitmentsRequest,ListCapacityCommitmentsResponse> listCapacityCommitmentsCallable()
Lists all the capacity commitments for the admin project.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (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.getCapacityCommitmentsList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
Returns | |
---|---|
Type | Description |
UnaryCallable<ListCapacityCommitmentsRequest,ListCapacityCommitmentsResponse> |
listCapacityCommitmentsPagedCallable()
public final UnaryCallable<ListCapacityCommitmentsRequest,ReservationServiceClient.ListCapacityCommitmentsPagedResponse> listCapacityCommitmentsPagedCallable()
Lists all the capacity commitments for the admin project.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
ListCapacityCommitmentsRequest request =
ListCapacityCommitmentsRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
ApiFuture<CapacityCommitment> future =
reservationServiceClient.listCapacityCommitmentsPagedCallable().futureCall(request);
// Do something.
for (CapacityCommitment element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
Returns | |
---|---|
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:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (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);
}
}
Parameter | |
---|---|
Name | Description |
request |
ListReservationsRequest The request object containing all of the parameters for the API call. |
Returns | |
---|---|
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:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
for (Reservation element : reservationServiceClient.listReservations(parent).iterateAll()) {
// doThingsWith(element);
}
}
Parameter | |
---|---|
Name | Description |
parent |
LocationName Required. The parent resource name containing project and location, e.g.:
|
Returns | |
---|---|
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:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
for (Reservation element : reservationServiceClient.listReservations(parent).iterateAll()) {
// doThingsWith(element);
}
}
Parameter | |
---|---|
Name | Description |
parent |
String Required. The parent resource name containing project and location, e.g.:
|
Returns | |
---|---|
Type | Description |
ReservationServiceClient.ListReservationsPagedResponse |
listReservationsCallable()
public final UnaryCallable<ListReservationsRequest,ListReservationsResponse> listReservationsCallable()
Lists all the reservations for the project in the specified location.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (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.getReservationsList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
Returns | |
---|---|
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:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
ListReservationsRequest request =
ListReservationsRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
ApiFuture<Reservation> future =
reservationServiceClient.listReservationsPagedCallable().futureCall(request);
// Do something.
for (Reservation element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
Returns | |
---|---|
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:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
List<String> capacityCommitmentIds = new ArrayList<>();
CapacityCommitment response =
reservationServiceClient.mergeCapacityCommitments(parent, capacityCommitmentIds);
}
Parameters | |
---|---|
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 |
Returns | |
---|---|
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:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
MergeCapacityCommitmentsRequest request =
MergeCapacityCommitmentsRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.addAllCapacityCommitmentIds(new ArrayList<String>())
.build();
CapacityCommitment response = reservationServiceClient.mergeCapacityCommitments(request);
}
Parameter | |
---|---|
Name | Description |
request |
MergeCapacityCommitmentsRequest The request object containing all of the parameters for the API call. |
Returns | |
---|---|
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:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
List<String> capacityCommitmentIds = new ArrayList<>();
CapacityCommitment response =
reservationServiceClient.mergeCapacityCommitments(parent, capacityCommitmentIds);
}
Parameters | |
---|---|
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 |
Returns | |
---|---|
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:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
MergeCapacityCommitmentsRequest request =
MergeCapacityCommitmentsRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.addAllCapacityCommitmentIds(new ArrayList<String>())
.build();
ApiFuture<CapacityCommitment> future =
reservationServiceClient.mergeCapacityCommitmentsCallable().futureCall(request);
// Do something.
CapacityCommitment response = future.get();
}
Returns | |
---|---|
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:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (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);
}
Parameters | |
---|---|
Name | Description |
name |
AssignmentName Required. The resource name of the assignment, e.g.
|
destinationId |
ReservationName The new reservation ID, e.g.:
|
Returns | |
---|---|
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:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (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);
}
Parameters | |
---|---|
Name | Description |
name |
AssignmentName Required. The resource name of the assignment, e.g.
|
destinationId |
String The new reservation ID, e.g.:
|
Returns | |
---|---|
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:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
MoveAssignmentRequest request =
MoveAssignmentRequest.newBuilder()
.setName(
AssignmentName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]", "[ASSIGNMENT]")
.toString())
.setDestinationId(
ReservationName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]").toString())
.setAssignmentId("assignmentId-1603989304")
.build();
Assignment response = reservationServiceClient.moveAssignment(request);
}
Parameter | |
---|---|
Name | Description |
request |
MoveAssignmentRequest The request object containing all of the parameters for the API call. |
Returns | |
---|---|
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:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (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);
}
Parameters | |
---|---|
Name | Description |
name |
String Required. The resource name of the assignment, e.g.
|
destinationId |
ReservationName The new reservation ID, e.g.:
|
Returns | |
---|---|
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:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (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);
}
Parameters | |
---|---|
Name | Description |
name |
String Required. The resource name of the assignment, e.g.
|
destinationId |
String The new reservation ID, e.g.:
|
Returns | |
---|---|
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:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
MoveAssignmentRequest request =
MoveAssignmentRequest.newBuilder()
.setName(
AssignmentName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]", "[ASSIGNMENT]")
.toString())
.setDestinationId(
ReservationName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]").toString())
.setAssignmentId("assignmentId-1603989304")
.build();
ApiFuture<Assignment> future =
reservationServiceClient.moveAssignmentCallable().futureCall(request);
// Do something.
Assignment response = future.get();
}
Returns | |
---|---|
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:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
String query = "query107944136";
for (Assignment element :
reservationServiceClient.searchAllAssignments(parent, query).iterateAll()) {
// doThingsWith(element);
}
}
Parameters | |
---|---|
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:
|
Returns | |
---|---|
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:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (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);
}
}
Parameter | |
---|---|
Name | Description |
request |
SearchAllAssignmentsRequest The request object containing all of the parameters for the API call. |
Returns | |
---|---|
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:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
String query = "query107944136";
for (Assignment element :
reservationServiceClient.searchAllAssignments(parent, query).iterateAll()) {
// doThingsWith(element);
}
}
Parameters | |
---|---|
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:
|
Returns | |
---|---|
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:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (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.getAssignmentsList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
Returns | |
---|---|
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:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
SearchAllAssignmentsRequest request =
SearchAllAssignmentsRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.setQuery("query107944136")
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
ApiFuture<Assignment> future =
reservationServiceClient.searchAllAssignmentsPagedCallable().futureCall(request);
// Do something.
for (Assignment element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
Returns | |
---|---|
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:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
String query = "query107944136";
for (Assignment element :
reservationServiceClient.searchAssignments(parent, query).iterateAll()) {
// doThingsWith(element);
}
}
Parameters | |
---|---|
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:
|
Returns | |
---|---|
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:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (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);
}
}
Parameter | |
---|---|
Name | Description |
request |
SearchAssignmentsRequest The request object containing all of the parameters for the API call. |
Returns | |
---|---|
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:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
String query = "query107944136";
for (Assignment element :
reservationServiceClient.searchAssignments(parent, query).iterateAll()) {
// doThingsWith(element);
}
}
Parameters | |
---|---|
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:
|
Returns | |
---|---|
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:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (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.getAssignmentsList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
Returns | |
---|---|
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:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
SearchAssignmentsRequest request =
SearchAssignmentsRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.setQuery("query107944136")
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
ApiFuture<Assignment> future =
reservationServiceClient.searchAssignmentsPagedCallable().futureCall(request);
// Do something.
for (Assignment element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
Returns | |
---|---|
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 delete the first one after the commitment end time passes.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
CapacityCommitmentName name =
CapacityCommitmentName.of("[PROJECT]", "[LOCATION]", "[CAPACITY_COMMITMENT]");
long slotCount = -191518834;
SplitCapacityCommitmentResponse response =
reservationServiceClient.splitCapacityCommitment(name, slotCount);
}
Parameters | |
---|---|
Name | Description |
name |
CapacityCommitmentName Required. The resource name e.g.,:
|
slotCount |
long Number of slots in the capacity commitment after the split. |
Returns | |
---|---|
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 delete the first one after the commitment end time passes.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
SplitCapacityCommitmentRequest request =
SplitCapacityCommitmentRequest.newBuilder()
.setName(
CapacityCommitmentName.of("[PROJECT]", "[LOCATION]", "[CAPACITY_COMMITMENT]")
.toString())
.setSlotCount(-191518834)
.build();
SplitCapacityCommitmentResponse response =
reservationServiceClient.splitCapacityCommitment(request);
}
Parameter | |
---|---|
Name | Description |
request |
SplitCapacityCommitmentRequest The request object containing all of the parameters for the API call. |
Returns | |
---|---|
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 delete the first one after the commitment end time passes.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
String name =
CapacityCommitmentName.of("[PROJECT]", "[LOCATION]", "[CAPACITY_COMMITMENT]").toString();
long slotCount = -191518834;
SplitCapacityCommitmentResponse response =
reservationServiceClient.splitCapacityCommitment(name, slotCount);
}
Parameters | |
---|---|
Name | Description |
name |
String Required. The resource name e.g.,:
|
slotCount |
long Number of slots in the capacity commitment after the split. |
Returns | |
---|---|
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 delete the first one after the commitment end time passes.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
SplitCapacityCommitmentRequest request =
SplitCapacityCommitmentRequest.newBuilder()
.setName(
CapacityCommitmentName.of("[PROJECT]", "[LOCATION]", "[CAPACITY_COMMITMENT]")
.toString())
.setSlotCount(-191518834)
.build();
ApiFuture<SplitCapacityCommitmentResponse> future =
reservationServiceClient.splitCapacityCommitmentCallable().futureCall(request);
// Do something.
SplitCapacityCommitmentResponse response = future.get();
}
Returns | |
---|---|
Type | Description |
UnaryCallable<SplitCapacityCommitmentRequest,SplitCapacityCommitmentResponse> |
updateAssignment(Assignment assignment, FieldMask updateMask)
public final Assignment updateAssignment(Assignment assignment, FieldMask updateMask)
Updates an existing assignment.
Only the priority
field can be updated.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
Assignment assignment = Assignment.newBuilder().build();
FieldMask updateMask = FieldMask.newBuilder().build();
Assignment response = reservationServiceClient.updateAssignment(assignment, updateMask);
}
Parameters | |
---|---|
Name | Description |
assignment |
Assignment Content of the assignment to update. |
updateMask |
FieldMask Standard field mask for the set of fields to be updated. |
Returns | |
---|---|
Type | Description |
Assignment |
updateAssignment(UpdateAssignmentRequest request)
public final Assignment updateAssignment(UpdateAssignmentRequest request)
Updates an existing assignment.
Only the priority
field can be updated.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
UpdateAssignmentRequest request =
UpdateAssignmentRequest.newBuilder()
.setAssignment(Assignment.newBuilder().build())
.setUpdateMask(FieldMask.newBuilder().build())
.build();
Assignment response = reservationServiceClient.updateAssignment(request);
}
Parameter | |
---|---|
Name | Description |
request |
UpdateAssignmentRequest The request object containing all of the parameters for the API call. |
Returns | |
---|---|
Type | Description |
Assignment |
updateAssignmentCallable()
public final UnaryCallable<UpdateAssignmentRequest,Assignment> updateAssignmentCallable()
Updates an existing assignment.
Only the priority
field can be updated.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
UpdateAssignmentRequest request =
UpdateAssignmentRequest.newBuilder()
.setAssignment(Assignment.newBuilder().build())
.setUpdateMask(FieldMask.newBuilder().build())
.build();
ApiFuture<Assignment> future =
reservationServiceClient.updateAssignmentCallable().futureCall(request);
// Do something.
Assignment response = future.get();
}
Returns | |
---|---|
Type | Description |
UnaryCallable<UpdateAssignmentRequest,Assignment> |
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:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
BiReservation biReservation = BiReservation.newBuilder().build();
FieldMask updateMask = FieldMask.newBuilder().build();
BiReservation response =
reservationServiceClient.updateBiReservation(biReservation, updateMask);
}
Parameters | |
---|---|
Name | Description |
biReservation |
BiReservation A reservation to update. |
updateMask |
FieldMask A list of fields to be updated in this request. |
Returns | |
---|---|
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:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
UpdateBiReservationRequest request =
UpdateBiReservationRequest.newBuilder()
.setBiReservation(BiReservation.newBuilder().build())
.setUpdateMask(FieldMask.newBuilder().build())
.build();
BiReservation response = reservationServiceClient.updateBiReservation(request);
}
Parameter | |
---|---|
Name | Description |
request |
UpdateBiReservationRequest The request object containing all of the parameters for the API call. |
Returns | |
---|---|
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:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
UpdateBiReservationRequest request =
UpdateBiReservationRequest.newBuilder()
.setBiReservation(BiReservation.newBuilder().build())
.setUpdateMask(FieldMask.newBuilder().build())
.build();
ApiFuture<BiReservation> future =
reservationServiceClient.updateBiReservationCallable().futureCall(request);
// Do something.
BiReservation response = future.get();
}
Returns | |
---|---|
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:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
CapacityCommitment capacityCommitment = CapacityCommitment.newBuilder().build();
FieldMask updateMask = FieldMask.newBuilder().build();
CapacityCommitment response =
reservationServiceClient.updateCapacityCommitment(capacityCommitment, updateMask);
}
Parameters | |
---|---|
Name | Description |
capacityCommitment |
CapacityCommitment Content of the capacity commitment to update. |
updateMask |
FieldMask Standard field mask for the set of fields to be updated. |
Returns | |
---|---|
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:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
UpdateCapacityCommitmentRequest request =
UpdateCapacityCommitmentRequest.newBuilder()
.setCapacityCommitment(CapacityCommitment.newBuilder().build())
.setUpdateMask(FieldMask.newBuilder().build())
.build();
CapacityCommitment response = reservationServiceClient.updateCapacityCommitment(request);
}
Parameter | |
---|---|
Name | Description |
request |
UpdateCapacityCommitmentRequest The request object containing all of the parameters for the API call. |
Returns | |
---|---|
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:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
UpdateCapacityCommitmentRequest request =
UpdateCapacityCommitmentRequest.newBuilder()
.setCapacityCommitment(CapacityCommitment.newBuilder().build())
.setUpdateMask(FieldMask.newBuilder().build())
.build();
ApiFuture<CapacityCommitment> future =
reservationServiceClient.updateCapacityCommitmentCallable().futureCall(request);
// Do something.
CapacityCommitment response = future.get();
}
Returns | |
---|---|
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:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
Reservation reservation = Reservation.newBuilder().build();
FieldMask updateMask = FieldMask.newBuilder().build();
Reservation response = reservationServiceClient.updateReservation(reservation, updateMask);
}
Parameters | |
---|---|
Name | Description |
reservation |
Reservation Content of the reservation to update. |
updateMask |
FieldMask Standard field mask for the set of fields to be updated. |
Returns | |
---|---|
Type | Description |
Reservation |
updateReservation(UpdateReservationRequest request)
public final Reservation updateReservation(UpdateReservationRequest request)
Updates an existing reservation resource.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
UpdateReservationRequest request =
UpdateReservationRequest.newBuilder()
.setReservation(Reservation.newBuilder().build())
.setUpdateMask(FieldMask.newBuilder().build())
.build();
Reservation response = reservationServiceClient.updateReservation(request);
}
Parameter | |
---|---|
Name | Description |
request |
UpdateReservationRequest The request object containing all of the parameters for the API call. |
Returns | |
---|---|
Type | Description |
Reservation |
updateReservationCallable()
public final UnaryCallable<UpdateReservationRequest,Reservation> updateReservationCallable()
Updates an existing reservation resource.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
UpdateReservationRequest request =
UpdateReservationRequest.newBuilder()
.setReservation(Reservation.newBuilder().build())
.setUpdateMask(FieldMask.newBuilder().build())
.build();
ApiFuture<Reservation> future =
reservationServiceClient.updateReservationCallable().futureCall(request);
// Do something.
Reservation response = future.get();
}
Returns | |
---|---|
Type | Description |
UnaryCallable<UpdateReservationRequest,Reservation> |