Struct google_api_proto::google::cloud::bigquery::reservation::v1::reservation_service_client::ReservationServiceClient
source · pub struct ReservationServiceClient<T> { /* private fields */ }
Expand 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
.
Implementations§
source§impl<T> ReservationServiceClient<T>where
T: GrpcService<BoxBody>,
T::Error: Into<StdError>,
T::ResponseBody: Body<Data = Bytes> + Send + 'static,
<T::ResponseBody as Body>::Error: Into<StdError> + Send,
impl<T> ReservationServiceClient<T>where
T: GrpcService<BoxBody>,
T::Error: Into<StdError>,
T::ResponseBody: Body<Data = Bytes> + Send + 'static,
<T::ResponseBody as Body>::Error: Into<StdError> + Send,
pub fn new(inner: T) -> Self
pub fn with_origin(inner: T, origin: Uri) -> Self
pub fn with_interceptor<F>(
inner: T,
interceptor: F,
) -> ReservationServiceClient<InterceptedService<T, F>>where
F: Interceptor,
T::ResponseBody: Default,
T: Service<Request<BoxBody>, Response = Response<<T as GrpcService<BoxBody>>::ResponseBody>>,
<T as Service<Request<BoxBody>>>::Error: Into<StdError> + Send + Sync,
sourcepub fn send_compressed(self, encoding: CompressionEncoding) -> Self
pub fn send_compressed(self, encoding: CompressionEncoding) -> Self
Compress requests with the given encoding.
This requires the server to support it otherwise it might respond with an error.
sourcepub fn accept_compressed(self, encoding: CompressionEncoding) -> Self
pub fn accept_compressed(self, encoding: CompressionEncoding) -> Self
Enable decompressing responses.
sourcepub fn max_decoding_message_size(self, limit: usize) -> Self
pub fn max_decoding_message_size(self, limit: usize) -> Self
Limits the maximum size of a decoded message.
Default: 4MB
sourcepub fn max_encoding_message_size(self, limit: usize) -> Self
pub fn max_encoding_message_size(self, limit: usize) -> Self
Limits the maximum size of an encoded message.
Default: usize::MAX
sourcepub async fn create_reservation(
&mut self,
request: impl IntoRequest<CreateReservationRequest>,
) -> Result<Response<Reservation>, Status>
pub async fn create_reservation( &mut self, request: impl IntoRequest<CreateReservationRequest>, ) -> Result<Response<Reservation>, Status>
Creates a new reservation resource.
sourcepub async fn list_reservations(
&mut self,
request: impl IntoRequest<ListReservationsRequest>,
) -> Result<Response<ListReservationsResponse>, Status>
pub async fn list_reservations( &mut self, request: impl IntoRequest<ListReservationsRequest>, ) -> Result<Response<ListReservationsResponse>, Status>
Lists all the reservations for the project in the specified location.
sourcepub async fn get_reservation(
&mut self,
request: impl IntoRequest<GetReservationRequest>,
) -> Result<Response<Reservation>, Status>
pub async fn get_reservation( &mut self, request: impl IntoRequest<GetReservationRequest>, ) -> Result<Response<Reservation>, Status>
Returns information about the reservation.
sourcepub async fn delete_reservation(
&mut self,
request: impl IntoRequest<DeleteReservationRequest>,
) -> Result<Response<()>, Status>
pub async fn delete_reservation( &mut self, request: impl IntoRequest<DeleteReservationRequest>, ) -> Result<Response<()>, Status>
Deletes a reservation.
Returns google.rpc.Code.FAILED_PRECONDITION
when reservation has
assignments.
sourcepub async fn update_reservation(
&mut self,
request: impl IntoRequest<UpdateReservationRequest>,
) -> Result<Response<Reservation>, Status>
pub async fn update_reservation( &mut self, request: impl IntoRequest<UpdateReservationRequest>, ) -> Result<Response<Reservation>, Status>
Updates an existing reservation resource.
sourcepub async fn create_capacity_commitment(
&mut self,
request: impl IntoRequest<CreateCapacityCommitmentRequest>,
) -> Result<Response<CapacityCommitment>, Status>
pub async fn create_capacity_commitment( &mut self, request: impl IntoRequest<CreateCapacityCommitmentRequest>, ) -> Result<Response<CapacityCommitment>, Status>
Creates a new capacity commitment resource.
sourcepub async fn list_capacity_commitments(
&mut self,
request: impl IntoRequest<ListCapacityCommitmentsRequest>,
) -> Result<Response<ListCapacityCommitmentsResponse>, Status>
pub async fn list_capacity_commitments( &mut self, request: impl IntoRequest<ListCapacityCommitmentsRequest>, ) -> Result<Response<ListCapacityCommitmentsResponse>, Status>
Lists all the capacity commitments for the admin project.
sourcepub async fn get_capacity_commitment(
&mut self,
request: impl IntoRequest<GetCapacityCommitmentRequest>,
) -> Result<Response<CapacityCommitment>, Status>
pub async fn get_capacity_commitment( &mut self, request: impl IntoRequest<GetCapacityCommitmentRequest>, ) -> Result<Response<CapacityCommitment>, Status>
Returns information about the capacity commitment.
sourcepub async fn delete_capacity_commitment(
&mut self,
request: impl IntoRequest<DeleteCapacityCommitmentRequest>,
) -> Result<Response<()>, Status>
pub async fn delete_capacity_commitment( &mut self, request: impl IntoRequest<DeleteCapacityCommitmentRequest>, ) -> Result<Response<()>, Status>
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
.
sourcepub async fn update_capacity_commitment(
&mut self,
request: impl IntoRequest<UpdateCapacityCommitmentRequest>,
) -> Result<Response<CapacityCommitment>, Status>
pub async fn update_capacity_commitment( &mut self, request: impl IntoRequest<UpdateCapacityCommitmentRequest>, ) -> Result<Response<CapacityCommitment>, Status>
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
.
sourcepub async fn split_capacity_commitment(
&mut self,
request: impl IntoRequest<SplitCapacityCommitmentRequest>,
) -> Result<Response<SplitCapacityCommitmentResponse>, Status>
pub async fn split_capacity_commitment( &mut self, request: impl IntoRequest<SplitCapacityCommitmentRequest>, ) -> Result<Response<SplitCapacityCommitmentResponse>, Status>
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.
sourcepub async fn merge_capacity_commitments(
&mut self,
request: impl IntoRequest<MergeCapacityCommitmentsRequest>,
) -> Result<Response<CapacityCommitment>, Status>
pub async fn merge_capacity_commitments( &mut self, request: impl IntoRequest<MergeCapacityCommitmentsRequest>, ) -> Result<Response<CapacityCommitment>, Status>
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
.
sourcepub async fn create_assignment(
&mut self,
request: impl IntoRequest<CreateAssignmentRequest>,
) -> Result<Response<Assignment>, Status>
pub async fn create_assignment( &mut self, request: impl IntoRequest<CreateAssignmentRequest>, ) -> Result<Response<Assignment>, Status>
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.
sourcepub async fn list_assignments(
&mut self,
request: impl IntoRequest<ListAssignmentsRequest>,
) -> Result<Response<ListAssignmentsResponse>, Status>
pub async fn list_assignments( &mut self, request: impl IntoRequest<ListAssignmentsRequest>, ) -> Result<Response<ListAssignmentsResponse>, Status>
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.
sourcepub async fn delete_assignment(
&mut self,
request: impl IntoRequest<DeleteAssignmentRequest>,
) -> Result<Response<()>, Status>
pub async fn delete_assignment( &mut self, request: impl IntoRequest<DeleteAssignmentRequest>, ) -> Result<Response<()>, Status>
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.
sourcepub async fn search_assignments(
&mut self,
request: impl IntoRequest<SearchAssignmentsRequest>,
) -> Result<Response<SearchAssignmentsResponse>, Status>
pub async fn search_assignments( &mut self, request: impl IntoRequest<SearchAssignmentsRequest>, ) -> Result<Response<SearchAssignmentsResponse>, Status>
Deprecated: Looks up assignments for a specified resource for a particular region. If the request is about a project:
- Assignments created on the project will be returned if they exist.
- Otherwise assignments created on the closest ancestor will be returned.
- 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:
- permission on the assignee will be verified in this API.
- Hierarchy lookup (project->folder->organization) happens in this API.
- Parent here is
projects/*/locations/*
, instead ofprojects/*/locations/*reservations/*
.
Note “-” cannot be used for projects nor locations.
sourcepub async fn search_all_assignments(
&mut self,
request: impl IntoRequest<SearchAllAssignmentsRequest>,
) -> Result<Response<SearchAllAssignmentsResponse>, Status>
pub async fn search_all_assignments( &mut self, request: impl IntoRequest<SearchAllAssignmentsRequest>, ) -> Result<Response<SearchAllAssignmentsResponse>, Status>
Looks up assignments for a specified resource for a particular region. If the request is about a project:
- Assignments created on the project will be returned if they exist.
- Otherwise assignments created on the closest ancestor will be returned.
- 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:
- permission on the assignee will be verified in this API.
- Hierarchy lookup (project->folder->organization) happens in this API.
- Parent here is
projects/*/locations/*
, instead ofprojects/*/locations/*reservations/*
.
sourcepub async fn move_assignment(
&mut self,
request: impl IntoRequest<MoveAssignmentRequest>,
) -> Result<Response<Assignment>, Status>
pub async fn move_assignment( &mut self, request: impl IntoRequest<MoveAssignmentRequest>, ) -> Result<Response<Assignment>, Status>
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.
sourcepub async fn update_assignment(
&mut self,
request: impl IntoRequest<UpdateAssignmentRequest>,
) -> Result<Response<Assignment>, Status>
pub async fn update_assignment( &mut self, request: impl IntoRequest<UpdateAssignmentRequest>, ) -> Result<Response<Assignment>, Status>
Updates an existing assignment.
Only the priority
field can be updated.
sourcepub async fn get_bi_reservation(
&mut self,
request: impl IntoRequest<GetBiReservationRequest>,
) -> Result<Response<BiReservation>, Status>
pub async fn get_bi_reservation( &mut self, request: impl IntoRequest<GetBiReservationRequest>, ) -> Result<Response<BiReservation>, Status>
Retrieves a BI reservation.
sourcepub async fn update_bi_reservation(
&mut self,
request: impl IntoRequest<UpdateBiReservationRequest>,
) -> Result<Response<BiReservation>, Status>
pub async fn update_bi_reservation( &mut self, request: impl IntoRequest<UpdateBiReservationRequest>, ) -> Result<Response<BiReservation>, Status>
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.
Trait Implementations§
source§impl<T: Clone> Clone for ReservationServiceClient<T>
impl<T: Clone> Clone for ReservationServiceClient<T>
source§fn clone(&self) -> ReservationServiceClient<T>
fn clone(&self) -> ReservationServiceClient<T>
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreAuto Trait Implementations§
impl<T> !Freeze for ReservationServiceClient<T>
impl<T> RefUnwindSafe for ReservationServiceClient<T>where
T: RefUnwindSafe,
impl<T> Send for ReservationServiceClient<T>where
T: Send,
impl<T> Sync for ReservationServiceClient<T>where
T: Sync,
impl<T> Unpin for ReservationServiceClient<T>where
T: Unpin,
impl<T> UnwindSafe for ReservationServiceClient<T>where
T: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T
in a tonic::Request