#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Reservation {
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
#[prost(int64, tag = "2")]
pub slot_capacity: i64,
#[prost(bool, tag = "4")]
pub ignore_idle_slots: bool,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CapacityCommitment {
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
#[prost(int64, tag = "2")]
pub slot_count: i64,
#[prost(enumeration = "capacity_commitment::CommitmentPlan", tag = "3")]
pub plan: i32,
#[prost(enumeration = "capacity_commitment::State", tag = "4")]
pub state: i32,
#[prost(message, optional, tag = "5")]
pub commitment_end_time: ::core::option::Option<::prost_types::Timestamp>,
#[prost(message, optional, tag = "7")]
pub failure_status: ::core::option::Option<super::super::super::super::rpc::Status>,
#[prost(enumeration = "capacity_commitment::CommitmentPlan", tag = "8")]
pub renewal_plan: i32,
}
pub mod capacity_commitment {
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum CommitmentPlan {
Unspecified = 0,
Flex = 3,
Trial = 5,
Monthly = 2,
Annual = 4,
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum State {
Unspecified = 0,
Pending = 1,
Active = 2,
Failed = 3,
}
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CreateReservationRequest {
#[prost(string, tag = "1")]
pub parent: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub reservation_id: ::prost::alloc::string::String,
#[prost(message, optional, tag = "3")]
pub reservation: ::core::option::Option<Reservation>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListReservationsRequest {
#[prost(string, tag = "1")]
pub parent: ::prost::alloc::string::String,
#[prost(int32, tag = "2")]
pub page_size: i32,
#[prost(string, tag = "3")]
pub page_token: ::prost::alloc::string::String,
#[prost(string, tag = "4")]
pub filter: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListReservationsResponse {
#[prost(message, repeated, tag = "1")]
pub reservations: ::prost::alloc::vec::Vec<Reservation>,
#[prost(string, tag = "2")]
pub next_page_token: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetReservationRequest {
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct DeleteReservationRequest {
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct UpdateReservationRequest {
#[prost(message, optional, tag = "1")]
pub reservation: ::core::option::Option<Reservation>,
#[prost(message, optional, tag = "2")]
pub update_mask: ::core::option::Option<::prost_types::FieldMask>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CreateCapacityCommitmentRequest {
#[prost(string, tag = "1")]
pub parent: ::prost::alloc::string::String,
#[prost(message, optional, tag = "2")]
pub capacity_commitment: ::core::option::Option<CapacityCommitment>,
#[prost(bool, tag = "4")]
pub enforce_single_admin_project_per_org: bool,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListCapacityCommitmentsRequest {
#[prost(string, tag = "1")]
pub parent: ::prost::alloc::string::String,
#[prost(int32, tag = "2")]
pub page_size: i32,
#[prost(string, tag = "3")]
pub page_token: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListCapacityCommitmentsResponse {
#[prost(message, repeated, tag = "1")]
pub capacity_commitments: ::prost::alloc::vec::Vec<CapacityCommitment>,
#[prost(string, tag = "2")]
pub next_page_token: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetCapacityCommitmentRequest {
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct DeleteCapacityCommitmentRequest {
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct UpdateCapacityCommitmentRequest {
#[prost(message, optional, tag = "1")]
pub capacity_commitment: ::core::option::Option<CapacityCommitment>,
#[prost(message, optional, tag = "2")]
pub update_mask: ::core::option::Option<::prost_types::FieldMask>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SplitCapacityCommitmentRequest {
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
#[prost(int64, tag = "2")]
pub slot_count: i64,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SplitCapacityCommitmentResponse {
#[prost(message, optional, tag = "1")]
pub first: ::core::option::Option<CapacityCommitment>,
#[prost(message, optional, tag = "2")]
pub second: ::core::option::Option<CapacityCommitment>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct MergeCapacityCommitmentsRequest {
#[prost(string, tag = "1")]
pub parent: ::prost::alloc::string::String,
#[prost(string, repeated, tag = "2")]
pub capacity_commitment_ids: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Assignment {
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
#[prost(string, tag = "4")]
pub assignee: ::prost::alloc::string::String,
#[prost(enumeration = "assignment::JobType", tag = "3")]
pub job_type: i32,
#[prost(enumeration = "assignment::State", tag = "6")]
pub state: i32,
}
pub mod assignment {
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum JobType {
Unspecified = 0,
Pipeline = 1,
Query = 2,
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum State {
Unspecified = 0,
Pending = 1,
Active = 2,
}
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CreateAssignmentRequest {
#[prost(string, tag = "1")]
pub parent: ::prost::alloc::string::String,
#[prost(message, optional, tag = "2")]
pub assignment: ::core::option::Option<Assignment>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListAssignmentsRequest {
#[prost(string, tag = "1")]
pub parent: ::prost::alloc::string::String,
#[prost(int32, tag = "2")]
pub page_size: i32,
#[prost(string, tag = "3")]
pub page_token: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListAssignmentsResponse {
#[prost(message, repeated, tag = "1")]
pub assignments: ::prost::alloc::vec::Vec<Assignment>,
#[prost(string, tag = "2")]
pub next_page_token: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct DeleteAssignmentRequest {
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SearchAssignmentsRequest {
#[prost(string, tag = "1")]
pub parent: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub query: ::prost::alloc::string::String,
#[prost(int32, tag = "3")]
pub page_size: i32,
#[prost(string, tag = "4")]
pub page_token: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SearchAssignmentsResponse {
#[prost(message, repeated, tag = "1")]
pub assignments: ::prost::alloc::vec::Vec<Assignment>,
#[prost(string, tag = "2")]
pub next_page_token: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct MoveAssignmentRequest {
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
#[prost(string, tag = "3")]
pub destination_id: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct BiReservation {
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
#[prost(message, optional, tag = "3")]
pub update_time: ::core::option::Option<::prost_types::Timestamp>,
#[prost(int64, tag = "4")]
pub size: i64,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetBiReservationRequest {
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct UpdateBiReservationRequest {
#[prost(message, optional, tag = "1")]
pub reservation: ::core::option::Option<BiReservation>,
#[prost(message, optional, tag = "2")]
pub update_mask: ::core::option::Option<::prost_types::FieldMask>,
}
#[doc = r" Generated client implementations."]
pub mod reservation_service_client {
#![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
use tonic::codegen::*;
#[doc = " This API allows users to manage their flat-rate BigQuery reservations."]
#[doc = ""]
#[doc = " A reservation provides computational resource guarantees, in the form of"]
#[doc = " [slots](https://cloud.google.com/bigquery/docs/slots), to users. A slot is a"]
#[doc = " unit of computational power in BigQuery, and serves as the basic unit of"]
#[doc = " parallelism. In a scan of a multi-partitioned table, a single slot operates"]
#[doc = " on a single partition of the table. A reservation resource exists as a child"]
#[doc = " resource of the admin project and location, e.g.:"]
#[doc = " `projects/myproject/locations/US/reservations/reservationName`."]
#[doc = ""]
#[doc = " A capacity commitment is a way to purchase compute capacity for BigQuery jobs"]
#[doc = " (in the form of slots) with some committed period of usage. A capacity"]
#[doc = " commitment resource exists as a child resource of the admin project and"]
#[doc = " location, e.g.:"]
#[doc = " `projects/myproject/locations/US/capacityCommitments/id`."]
#[derive(Debug, Clone)]
pub struct ReservationServiceClient<T> {
inner: tonic::client::Grpc<T>,
}
impl<T> ReservationServiceClient<T>
where
T: tonic::client::GrpcService<tonic::body::BoxBody>,
T::ResponseBody: Body + Send + 'static,
T::Error: Into<StdError>,
<T::ResponseBody as Body>::Error: Into<StdError> + Send,
{
pub fn new(inner: T) -> Self {
let inner = tonic::client::Grpc::new(inner);
Self { inner }
}
pub fn with_interceptor<F>(
inner: T,
interceptor: F,
) -> ReservationServiceClient<InterceptedService<T, F>>
where
F: tonic::service::Interceptor,
T: tonic::codegen::Service<
http::Request<tonic::body::BoxBody>,
Response = http::Response<
<T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
>,
>,
<T as tonic::codegen::Service<http::Request<tonic::body::BoxBody>>>::Error:
Into<StdError> + Send + Sync,
{
ReservationServiceClient::new(InterceptedService::new(inner, interceptor))
}
#[doc = r" Compress requests with `gzip`."]
#[doc = r""]
#[doc = r" This requires the server to support it otherwise it might respond with an"]
#[doc = r" error."]
pub fn send_gzip(mut self) -> Self {
self.inner = self.inner.send_gzip();
self
}
#[doc = r" Enable decompressing responses with `gzip`."]
pub fn accept_gzip(mut self) -> Self {
self.inner = self.inner.accept_gzip();
self
}
#[doc = " Creates a new reservation resource."]
pub async fn create_reservation(
&mut self,
request: impl tonic::IntoRequest<super::CreateReservationRequest>,
) -> Result<tonic::Response<super::Reservation>, tonic::Status> {
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.cloud.bigquery.reservation.v1beta1.ReservationService/CreateReservation",
);
self.inner.unary(request.into_request(), path, codec).await
}
#[doc = " Lists all the reservations for the project in the specified location."]
pub async fn list_reservations(
&mut self,
request: impl tonic::IntoRequest<super::ListReservationsRequest>,
) -> Result<tonic::Response<super::ListReservationsResponse>, tonic::Status> {
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.cloud.bigquery.reservation.v1beta1.ReservationService/ListReservations",
);
self.inner.unary(request.into_request(), path, codec).await
}
#[doc = " Returns information about the reservation."]
pub async fn get_reservation(
&mut self,
request: impl tonic::IntoRequest<super::GetReservationRequest>,
) -> Result<tonic::Response<super::Reservation>, tonic::Status> {
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.cloud.bigquery.reservation.v1beta1.ReservationService/GetReservation",
);
self.inner.unary(request.into_request(), path, codec).await
}
#[doc = " Deletes a reservation."]
#[doc = " Returns `google.rpc.Code.FAILED_PRECONDITION` when reservation has"]
#[doc = " assignments."]
pub async fn delete_reservation(
&mut self,
request: impl tonic::IntoRequest<super::DeleteReservationRequest>,
) -> Result<tonic::Response<()>, tonic::Status> {
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.cloud.bigquery.reservation.v1beta1.ReservationService/DeleteReservation",
);
self.inner.unary(request.into_request(), path, codec).await
}
#[doc = " Updates an existing reservation resource."]
pub async fn update_reservation(
&mut self,
request: impl tonic::IntoRequest<super::UpdateReservationRequest>,
) -> Result<tonic::Response<super::Reservation>, tonic::Status> {
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.cloud.bigquery.reservation.v1beta1.ReservationService/UpdateReservation",
);
self.inner.unary(request.into_request(), path, codec).await
}
#[doc = " Creates a new capacity commitment resource."]
pub async fn create_capacity_commitment(
&mut self,
request: impl tonic::IntoRequest<super::CreateCapacityCommitmentRequest>,
) -> Result<tonic::Response<super::CapacityCommitment>, tonic::Status> {
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http :: uri :: PathAndQuery :: from_static ("/google.cloud.bigquery.reservation.v1beta1.ReservationService/CreateCapacityCommitment") ;
self.inner.unary(request.into_request(), path, codec).await
}
#[doc = " Lists all the capacity commitments for the admin project."]
pub async fn list_capacity_commitments(
&mut self,
request: impl tonic::IntoRequest<super::ListCapacityCommitmentsRequest>,
) -> Result<tonic::Response<super::ListCapacityCommitmentsResponse>, tonic::Status>
{
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http :: uri :: PathAndQuery :: from_static ("/google.cloud.bigquery.reservation.v1beta1.ReservationService/ListCapacityCommitments") ;
self.inner.unary(request.into_request(), path, codec).await
}
#[doc = " Returns information about the capacity commitment."]
pub async fn get_capacity_commitment(
&mut self,
request: impl tonic::IntoRequest<super::GetCapacityCommitmentRequest>,
) -> Result<tonic::Response<super::CapacityCommitment>, tonic::Status> {
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http :: uri :: PathAndQuery :: from_static ("/google.cloud.bigquery.reservation.v1beta1.ReservationService/GetCapacityCommitment") ;
self.inner.unary(request.into_request(), path, codec).await
}
#[doc = " Deletes a capacity commitment. Attempting to delete capacity commitment"]
#[doc = " before its commitment_end_time will fail with the error code"]
#[doc = " `google.rpc.Code.FAILED_PRECONDITION`."]
pub async fn delete_capacity_commitment(
&mut self,
request: impl tonic::IntoRequest<super::DeleteCapacityCommitmentRequest>,
) -> Result<tonic::Response<()>, tonic::Status> {
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http :: uri :: PathAndQuery :: from_static ("/google.cloud.bigquery.reservation.v1beta1.ReservationService/DeleteCapacityCommitment") ;
self.inner.unary(request.into_request(), path, codec).await
}
#[doc = " Updates an existing capacity commitment."]
#[doc = ""]
#[doc = " Only `plan` and `renewal_plan` fields can be updated."]
#[doc = ""]
#[doc = " Plan can only be changed to a plan of a longer commitment period."]
#[doc = " Attempting to change to a plan with shorter commitment period will fail"]
#[doc = " with the error code `google.rpc.Code.FAILED_PRECONDITION`."]
pub async fn update_capacity_commitment(
&mut self,
request: impl tonic::IntoRequest<super::UpdateCapacityCommitmentRequest>,
) -> Result<tonic::Response<super::CapacityCommitment>, tonic::Status> {
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http :: uri :: PathAndQuery :: from_static ("/google.cloud.bigquery.reservation.v1beta1.ReservationService/UpdateCapacityCommitment") ;
self.inner.unary(request.into_request(), path, codec).await
}
#[doc = " Splits capacity commitment to two commitments of the same plan and"]
#[doc = " `commitment_end_time`."]
#[doc = ""]
#[doc = " A common use case is to enable downgrading commitments."]
#[doc = ""]
#[doc = " For example, in order to downgrade from 10000 slots to 8000, you might"]
#[doc = " split a 10000 capacity commitment into commitments of 2000 and 8000. Then,"]
#[doc = " you would change the plan of the first one to `FLEX` and then delete it."]
pub async fn split_capacity_commitment(
&mut self,
request: impl tonic::IntoRequest<super::SplitCapacityCommitmentRequest>,
) -> Result<tonic::Response<super::SplitCapacityCommitmentResponse>, tonic::Status>
{
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http :: uri :: PathAndQuery :: from_static ("/google.cloud.bigquery.reservation.v1beta1.ReservationService/SplitCapacityCommitment") ;
self.inner.unary(request.into_request(), path, codec).await
}
#[doc = " Merges capacity commitments of the same plan into a single commitment."]
#[doc = ""]
#[doc = " The resulting capacity commitment has the greater commitment_end_time"]
#[doc = " out of the to-be-merged capacity commitments."]
#[doc = ""]
#[doc = " Attempting to merge capacity commitments of different plan will fail"]
#[doc = " with the error code `google.rpc.Code.FAILED_PRECONDITION`."]
pub async fn merge_capacity_commitments(
&mut self,
request: impl tonic::IntoRequest<super::MergeCapacityCommitmentsRequest>,
) -> Result<tonic::Response<super::CapacityCommitment>, tonic::Status> {
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http :: uri :: PathAndQuery :: from_static ("/google.cloud.bigquery.reservation.v1beta1.ReservationService/MergeCapacityCommitments") ;
self.inner.unary(request.into_request(), path, codec).await
}
#[doc = " Creates an assignment object which allows the given project to submit jobs"]
#[doc = " of a certain type using slots from the specified reservation."]
#[doc = ""]
#[doc = " Currently a"]
#[doc = " resource (project, folder, organization) can only have one assignment per"]
#[doc = " each (job_type, location) combination, and that reservation will be used"]
#[doc = " for all jobs of the matching type."]
#[doc = ""]
#[doc = " Different assignments can be created on different levels of the"]
#[doc = " projects, folders or organization hierarchy. During query execution,"]
#[doc = " the assignment is looked up at the project, folder and organization levels"]
#[doc = " in that order. The first assignment found is applied to the query."]
#[doc = ""]
#[doc = " When creating assignments, it does not matter if other assignments exist at"]
#[doc = " higher levels."]
#[doc = ""]
#[doc = " Example:"]
#[doc = ""]
#[doc = " * The organization `organizationA` contains two projects, `project1`"]
#[doc = " and `project2`."]
#[doc = " * Assignments for all three entities (`organizationA`, `project1`, and"]
#[doc = " `project2`) could all be created and mapped to the same or different"]
#[doc = " reservations."]
#[doc = ""]
#[doc = " Returns `google.rpc.Code.PERMISSION_DENIED` if user does not have"]
#[doc = " 'bigquery.admin' permissions on the project using the reservation"]
#[doc = " and the project that owns this reservation."]
#[doc = ""]
#[doc = " Returns `google.rpc.Code.INVALID_ARGUMENT` when location of the assignment"]
#[doc = " does not match location of the reservation."]
pub async fn create_assignment(
&mut self,
request: impl tonic::IntoRequest<super::CreateAssignmentRequest>,
) -> Result<tonic::Response<super::Assignment>, tonic::Status> {
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.cloud.bigquery.reservation.v1beta1.ReservationService/CreateAssignment",
);
self.inner.unary(request.into_request(), path, codec).await
}
#[doc = " Lists assignments."]
#[doc = ""]
#[doc = " Only explicitly created assignments will be returned."]
#[doc = ""]
#[doc = " Example:"]
#[doc = ""]
#[doc = " * Organization `organizationA` contains two projects, `project1` and"]
#[doc = " `project2`."]
#[doc = " * Reservation `res1` exists and was created previously."]
#[doc = " * CreateAssignment was used previously to define the following"]
#[doc = " associations between entities and reservations: `<organizationA, res1>`"]
#[doc = " and `<project1, res1>`"]
#[doc = ""]
#[doc = " In this example, ListAssignments will just return the above two assignments"]
#[doc = " for reservation `res1`, and no expansion/merge will happen."]
#[doc = ""]
#[doc = " The wildcard \"-\" can be used for"]
#[doc = " reservations in the request. In that case all assignments belongs to the"]
#[doc = " specified project and location will be listed."]
#[doc = ""]
#[doc = " **Note** \"-\" cannot be used for projects nor locations."]
pub async fn list_assignments(
&mut self,
request: impl tonic::IntoRequest<super::ListAssignmentsRequest>,
) -> Result<tonic::Response<super::ListAssignmentsResponse>, tonic::Status> {
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.cloud.bigquery.reservation.v1beta1.ReservationService/ListAssignments",
);
self.inner.unary(request.into_request(), path, codec).await
}
#[doc = " Deletes a assignment. No expansion will happen."]
#[doc = ""]
#[doc = " Example:"]
#[doc = ""]
#[doc = " * Organization `organizationA` contains two projects, `project1` and"]
#[doc = " `project2`."]
#[doc = " * Reservation `res1` exists and was created previously."]
#[doc = " * CreateAssignment was used previously to define the following"]
#[doc = " associations between entities and reservations: `<organizationA, res1>`"]
#[doc = " and `<project1, res1>`"]
#[doc = ""]
#[doc = " In this example, deletion of the `<organizationA, res1>` assignment won't"]
#[doc = " affect the other assignment `<project1, res1>`. After said deletion,"]
#[doc = " queries from `project1` will still use `res1` while queries from"]
#[doc = " `project2` will switch to use on-demand mode."]
pub async fn delete_assignment(
&mut self,
request: impl tonic::IntoRequest<super::DeleteAssignmentRequest>,
) -> Result<tonic::Response<()>, tonic::Status> {
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.cloud.bigquery.reservation.v1beta1.ReservationService/DeleteAssignment",
);
self.inner.unary(request.into_request(), path, codec).await
}
#[doc = " Looks up assignments for a specified resource for a particular region."]
#[doc = " If the request is about a project:"]
#[doc = ""]
#[doc = " 1. Assignments created on the project will be returned if they exist."]
#[doc = " 2. Otherwise assignments created on the closest ancestor will be"]
#[doc = " returned."]
#[doc = " 3. Assignments for different JobTypes will all be returned."]
#[doc = ""]
#[doc = " The same logic applies if the request is about a folder."]
#[doc = ""]
#[doc = " If the request is about an organization, then assignments created on the"]
#[doc = " organization will be returned (organization doesn't have ancestors)."]
#[doc = ""]
#[doc = " Comparing to ListAssignments, there are some behavior"]
#[doc = " differences:"]
#[doc = ""]
#[doc = " 1. permission on the assignee will be verified in this API."]
#[doc = " 2. Hierarchy lookup (project->folder->organization) happens in this API."]
#[doc = " 3. Parent here is `projects/*/locations/*`, instead of"]
#[doc = " `projects/*/locations/*reservations/*`."]
#[doc = ""]
#[doc = " **Note** \"-\" cannot be used for projects"]
#[doc = " nor locations."]
pub async fn search_assignments(
&mut self,
request: impl tonic::IntoRequest<super::SearchAssignmentsRequest>,
) -> Result<tonic::Response<super::SearchAssignmentsResponse>, tonic::Status> {
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.cloud.bigquery.reservation.v1beta1.ReservationService/SearchAssignments",
);
self.inner.unary(request.into_request(), path, codec).await
}
#[doc = " Moves an assignment under a new reservation."]
#[doc = ""]
#[doc = " This differs from removing an existing assignment and recreating a new one"]
#[doc = " by providing a transactional change that ensures an assignee always has an"]
#[doc = " associated reservation."]
pub async fn move_assignment(
&mut self,
request: impl tonic::IntoRequest<super::MoveAssignmentRequest>,
) -> Result<tonic::Response<super::Assignment>, tonic::Status> {
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.cloud.bigquery.reservation.v1beta1.ReservationService/MoveAssignment",
);
self.inner.unary(request.into_request(), path, codec).await
}
#[doc = " Retrieves a BI reservation."]
pub async fn get_bi_reservation(
&mut self,
request: impl tonic::IntoRequest<super::GetBiReservationRequest>,
) -> Result<tonic::Response<super::BiReservation>, tonic::Status> {
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.cloud.bigquery.reservation.v1beta1.ReservationService/GetBiReservation",
);
self.inner.unary(request.into_request(), path, codec).await
}
#[doc = " Updates a BI reservation."]
#[doc = ""]
#[doc = " Only fields specified in the `field_mask` are updated."]
#[doc = ""]
#[doc = " A singleton BI reservation always exists with default size 0."]
#[doc = " In order to reserve BI capacity it needs to be updated to an amount"]
#[doc = " greater than 0. In order to release BI capacity reservation size"]
#[doc = " must be set to 0."]
pub async fn update_bi_reservation(
&mut self,
request: impl tonic::IntoRequest<super::UpdateBiReservationRequest>,
) -> Result<tonic::Response<super::BiReservation>, tonic::Status> {
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.cloud.bigquery.reservation.v1beta1.ReservationService/UpdateBiReservation",
);
self.inner.unary(request.into_request(), path, codec).await
}
}
}