Skip to main content

gcp_client/google/cloud/bigquery/reservation/
v1.rs

1/// A reservation is a mechanism used to guarantee slots to users.
2#[derive(Clone, PartialEq, ::prost::Message)]
3pub struct Reservation {
4    /// The resource name of the reservation, e.g.,
5    /// `projects/*/locations/*/reservations/team1-prod`.
6    #[prost(string, tag="1")]
7    pub name: std::string::String,
8    /// Minimum slots available to this reservation. A slot is a unit of
9    /// computational power in BigQuery, and serves as the unit of parallelism.
10    ///
11    /// Queries using this reservation might use more slots during runtime if
12    /// ignore_idle_slots is set to false.
13    ///
14    /// If the new reservation's slot capacity exceed the parent's slot capacity or
15    /// if total slot capacity of the new reservation and its siblings exceeds the
16    /// parent's slot capacity, the request will fail with
17    /// `google.rpc.Code.RESOURCE_EXHAUSTED`.
18    #[prost(int64, tag="2")]
19    pub slot_capacity: i64,
20    /// If false, any query using this reservation will use idle slots from other
21    /// reservations within the same admin project. If true, a query using this
22    /// reservation will execute with the slot capacity specified above at most.
23    #[prost(bool, tag="4")]
24    pub ignore_idle_slots: bool,
25}
26/// Capacity commitment is a way to purchase compute capacity for BigQuery jobs
27/// (in the form of slots) with some committed period of usage. Annual
28/// commitments renew by default. Commitments can be removed after their
29/// commitment end time passes.
30///
31/// In order to remove annual commitment, its plan needs to be changed
32/// to monthly or flex first.
33///
34/// A capacity commitment resource exists as a child resource of the admin
35/// project.
36#[derive(Clone, PartialEq, ::prost::Message)]
37pub struct CapacityCommitment {
38    /// Output only. The resource name of the capacity commitment, e.g.,
39    /// `projects/myproject/locations/US/capacityCommitments/123`
40    #[prost(string, tag="1")]
41    pub name: std::string::String,
42    /// Number of slots in this commitment.
43    #[prost(int64, tag="2")]
44    pub slot_count: i64,
45    /// Capacity commitment commitment plan.
46    #[prost(enumeration="capacity_commitment::CommitmentPlan", tag="3")]
47    pub plan: i32,
48    /// Output only. State of the commitment.
49    #[prost(enumeration="capacity_commitment::State", tag="4")]
50    pub state: i32,
51    /// Output only. The end of the current commitment period. It is applicable
52    /// only for ACTIVE capacity commitments.
53    #[prost(message, optional, tag="5")]
54    pub commitment_end_time: ::std::option::Option<::prost_types::Timestamp>,
55    /// Output only. For FAILED commitment plan, provides the reason of failure.
56    #[prost(message, optional, tag="7")]
57    pub failure_status: ::std::option::Option<super::super::super::super::rpc::Status>,
58    /// The plan this capacity commitment is converted to after commitment_end_time
59    /// passes. Once the plan is changed, committed period is extended according to
60    /// commitment plan. Only applicable for ANNUAL and TRIAL commitments.
61    #[prost(enumeration="capacity_commitment::CommitmentPlan", tag="8")]
62    pub renewal_plan: i32,
63}
64pub mod capacity_commitment {
65    /// Commitment plan defines the current committed period. Capacity commitment
66    /// cannot be deleted during it's committed period.
67    #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
68    #[repr(i32)]
69    pub enum CommitmentPlan {
70        /// Invalid plan value. Requests with this value will be rejected with
71        /// error code `google.rpc.Code.INVALID_ARGUMENT`.
72        Unspecified = 0,
73        /// Flex commitments have committed period of 1 minute after becoming ACTIVE.
74        /// After that, they are not in a committed period anymore and can be removed
75        /// any time.
76        Flex = 3,
77        /// Trial commitments have a committed period of 182 days after becoming
78        /// ACTIVE. After that, they are converted to a new commitment based on the
79        /// `renewal_plan`. Default `renewal_plan` for Trial commitment is Flex so
80        /// that it can be deleted right after committed period ends.
81        Trial = 5,
82        /// Monthly commitments have a committed period of 30 days after becoming
83        /// ACTIVE. After that, they are not in a committed period anymore and can be
84        /// removed any time.
85        Monthly = 2,
86        /// Annual commitments have a committed period of 365 days after becoming
87        /// ACTIVE. After that they are converted to a new commitment based on the
88        /// renewal_plan.
89        Annual = 4,
90    }
91    /// Capacity commitment can either become ACTIVE right away or transition
92    /// from PENDING to ACTIVE or FAILED.
93    #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
94    #[repr(i32)]
95    pub enum State {
96        /// Invalid state value.
97        Unspecified = 0,
98        /// Capacity commitment is pending provisioning. Pending capacity commitment
99        /// does not contribute to the parent's slot_capacity.
100        Pending = 1,
101        /// Once slots are provisioned, capacity commitment becomes active.
102        /// slot_count is added to the parent's slot_capacity.
103        Active = 2,
104        /// Capacity commitment is failed to be activated by the backend.
105        Failed = 3,
106    }
107}
108/// The request for
109/// [ReservationService.CreateReservation][google.cloud.bigquery.reservation.v1.ReservationService.CreateReservation].
110#[derive(Clone, PartialEq, ::prost::Message)]
111pub struct CreateReservationRequest {
112    /// Required. Project, location. E.g.,
113    /// `projects/myproject/locations/US`
114    #[prost(string, tag="1")]
115    pub parent: std::string::String,
116    /// The reservation ID. This field must only contain lower case alphanumeric
117    /// characters or dash. Max length is 64 characters.
118    #[prost(string, tag="2")]
119    pub reservation_id: std::string::String,
120    /// Definition of the new reservation to create.
121    #[prost(message, optional, tag="3")]
122    pub reservation: ::std::option::Option<Reservation>,
123}
124/// The request for
125/// [ReservationService.ListReservations][google.cloud.bigquery.reservation.v1.ReservationService.ListReservations].
126#[derive(Clone, PartialEq, ::prost::Message)]
127pub struct ListReservationsRequest {
128    /// Required. The parent resource name containing project and location, e.g.:
129    ///   "projects/myproject/locations/US"
130    #[prost(string, tag="1")]
131    pub parent: std::string::String,
132    /// The maximum number of items to return per page.
133    #[prost(int32, tag="2")]
134    pub page_size: i32,
135    /// The next_page_token value returned from a previous List request, if any.
136    #[prost(string, tag="3")]
137    pub page_token: std::string::String,
138}
139/// The response for
140/// [ReservationService.ListReservations][google.cloud.bigquery.reservation.v1.ReservationService.ListReservations].
141#[derive(Clone, PartialEq, ::prost::Message)]
142pub struct ListReservationsResponse {
143    /// List of reservations visible to the user.
144    #[prost(message, repeated, tag="1")]
145    pub reservations: ::std::vec::Vec<Reservation>,
146    /// Token to retrieve the next page of results, or empty if there are no
147    /// more results in the list.
148    #[prost(string, tag="2")]
149    pub next_page_token: std::string::String,
150}
151/// The request for
152/// [ReservationService.GetReservation][google.cloud.bigquery.reservation.v1.ReservationService.GetReservation].
153#[derive(Clone, PartialEq, ::prost::Message)]
154pub struct GetReservationRequest {
155    /// Required. Resource name of the reservation to retrieve. E.g.,
156    ///    `projects/myproject/locations/US/reservations/team1-prod`
157    #[prost(string, tag="1")]
158    pub name: std::string::String,
159}
160/// The request for
161/// [ReservationService.DeleteReservation][google.cloud.bigquery.reservation.v1.ReservationService.DeleteReservation].
162#[derive(Clone, PartialEq, ::prost::Message)]
163pub struct DeleteReservationRequest {
164    /// Required. Resource name of the reservation to retrieve. E.g.,
165    ///    `projects/myproject/locations/US/reservations/team1-prod`
166    #[prost(string, tag="1")]
167    pub name: std::string::String,
168}
169/// The request for
170/// [ReservationService.UpdateReservation][google.cloud.bigquery.reservation.v1.ReservationService.UpdateReservation].
171#[derive(Clone, PartialEq, ::prost::Message)]
172pub struct UpdateReservationRequest {
173    /// Content of the reservation to update.
174    #[prost(message, optional, tag="1")]
175    pub reservation: ::std::option::Option<Reservation>,
176    /// Standard field mask for the set of fields to be updated.
177    #[prost(message, optional, tag="2")]
178    pub update_mask: ::std::option::Option<::prost_types::FieldMask>,
179}
180/// The request for
181/// [ReservationService.CreateCapacityCommitment][google.cloud.bigquery.reservation.v1.ReservationService.CreateCapacityCommitment].
182#[derive(Clone, PartialEq, ::prost::Message)]
183pub struct CreateCapacityCommitmentRequest {
184    /// Required. Resource name of the parent reservation. E.g.,
185    ///    projects/myproject/locations/US
186    #[prost(string, tag="1")]
187    pub parent: std::string::String,
188    /// Content of the capacity commitment to create.
189    #[prost(message, optional, tag="2")]
190    pub capacity_commitment: ::std::option::Option<CapacityCommitment>,
191    /// If true, fail the request if another project in the organization has a
192    /// capacity commitment.
193    #[prost(bool, tag="4")]
194    pub enforce_single_admin_project_per_org: bool,
195}
196/// The request for
197/// [ReservationService.ListCapacityCommitments][google.cloud.bigquery.reservation.v1.ReservationService.ListCapacityCommitments].
198#[derive(Clone, PartialEq, ::prost::Message)]
199pub struct ListCapacityCommitmentsRequest {
200    /// Required. Resource name of the parent reservation. E.g.,
201    ///    projects/myproject/locations/US
202    #[prost(string, tag="1")]
203    pub parent: std::string::String,
204    /// The maximum number of items to return.
205    #[prost(int32, tag="2")]
206    pub page_size: i32,
207    /// The next_page_token value returned from a previous List request, if any.
208    #[prost(string, tag="3")]
209    pub page_token: std::string::String,
210}
211/// The response for
212/// [ReservationService.ListCapacityCommitments][google.cloud.bigquery.reservation.v1.ReservationService.ListCapacityCommitments].
213#[derive(Clone, PartialEq, ::prost::Message)]
214pub struct ListCapacityCommitmentsResponse {
215    /// List of capacity commitments visible to the user.
216    #[prost(message, repeated, tag="1")]
217    pub capacity_commitments: ::std::vec::Vec<CapacityCommitment>,
218    /// Token to retrieve the next page of results, or empty if there are no
219    /// more results in the list.
220    #[prost(string, tag="2")]
221    pub next_page_token: std::string::String,
222}
223/// The request for
224/// [ReservationService.GetCapacityCommitment][google.cloud.bigquery.reservation.v1.ReservationService.GetCapacityCommitment].
225#[derive(Clone, PartialEq, ::prost::Message)]
226pub struct GetCapacityCommitmentRequest {
227    /// Required. Resource name of the capacity commitment to retrieve. E.g.,
228    ///    projects/myproject/locations/US/capacityCommitments/123
229    #[prost(string, tag="1")]
230    pub name: std::string::String,
231}
232/// The request for
233/// [ReservationService.DeleteCapacityCommitment][google.cloud.bigquery.reservation.v1.ReservationService.DeleteCapacityCommitment].
234#[derive(Clone, PartialEq, ::prost::Message)]
235pub struct DeleteCapacityCommitmentRequest {
236    /// Required. Resource name of the capacity commitment to delete. E.g.,
237    ///    projects/myproject/locations/US/capacityCommitments/123
238    #[prost(string, tag="1")]
239    pub name: std::string::String,
240}
241/// The request for
242/// [ReservationService.UpdateCapacityCommitment][google.cloud.bigquery.reservation.v1.ReservationService.UpdateCapacityCommitment].
243#[derive(Clone, PartialEq, ::prost::Message)]
244pub struct UpdateCapacityCommitmentRequest {
245    /// Content of the capacity commitment to update.
246    #[prost(message, optional, tag="1")]
247    pub capacity_commitment: ::std::option::Option<CapacityCommitment>,
248    /// Standard field mask for the set of fields to be updated.
249    #[prost(message, optional, tag="2")]
250    pub update_mask: ::std::option::Option<::prost_types::FieldMask>,
251}
252/// The request for
253/// [ReservationService.SplitCapacityCommitment][google.cloud.bigquery.reservation.v1.ReservationService.SplitCapacityCommitment].
254#[derive(Clone, PartialEq, ::prost::Message)]
255pub struct SplitCapacityCommitmentRequest {
256    /// Required. The resource name e.g.,:
257    ///   projects/myproject/locations/US/capacityCommitments/123
258    #[prost(string, tag="1")]
259    pub name: std::string::String,
260    /// Number of slots in the capacity commitment after the split.
261    #[prost(int64, tag="2")]
262    pub slot_count: i64,
263}
264/// The response for
265/// [ReservationService.SplitCapacityCommitment][google.cloud.bigquery.reservation.v1.ReservationService.SplitCapacityCommitment].
266#[derive(Clone, PartialEq, ::prost::Message)]
267pub struct SplitCapacityCommitmentResponse {
268    /// First capacity commitment, result of a split.
269    #[prost(message, optional, tag="1")]
270    pub first: ::std::option::Option<CapacityCommitment>,
271    /// Second capacity commitment, result of a split.
272    #[prost(message, optional, tag="2")]
273    pub second: ::std::option::Option<CapacityCommitment>,
274}
275/// The request for
276/// [ReservationService.MergeCapacityCommitments][google.cloud.bigquery.reservation.v1.ReservationService.MergeCapacityCommitments].
277#[derive(Clone, PartialEq, ::prost::Message)]
278pub struct MergeCapacityCommitmentsRequest {
279    /// Parent resource that identifies admin project and location e.g.,
280    /// projects/myproject/locations/us
281    #[prost(string, tag="1")]
282    pub parent: std::string::String,
283    /// Ids of capacity commitments to merge.
284    /// These capacity commitments must exist under admin project and location
285    /// specified in the parent.
286    #[prost(string, repeated, tag="2")]
287    pub capacity_commitment_ids: ::std::vec::Vec<std::string::String>,
288}
289/// A Assignment allows a project to submit jobs
290/// of a certain type using slots from the specified reservation.
291#[derive(Clone, PartialEq, ::prost::Message)]
292pub struct Assignment {
293    /// Output only. Name of the resource. E.g.:
294    /// `projects/myproject/locations/US/reservations/team1-prod/assignments/123`.
295    #[prost(string, tag="1")]
296    pub name: std::string::String,
297    /// The resource which will use the reservation. E.g.
298    /// `projects/myproject`, `folders/123`, or `organizations/456`.
299    #[prost(string, tag="4")]
300    pub assignee: std::string::String,
301    /// Which type of jobs will use the reservation.
302    #[prost(enumeration="assignment::JobType", tag="3")]
303    pub job_type: i32,
304    /// Output only. State of the assignment.
305    #[prost(enumeration="assignment::State", tag="6")]
306    pub state: i32,
307}
308pub mod assignment {
309    /// Types of job, which could be specified when using the reservation.
310    #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
311    #[repr(i32)]
312    pub enum JobType {
313        /// Invalid type. Requests with this value will be rejected with
314        /// error code `google.rpc.Code.INVALID_ARGUMENT`.
315        Unspecified = 0,
316        /// Pipeline (load/export) jobs from the project will use the reservation.
317        Pipeline = 1,
318        /// Query jobs from the project will use the reservation.
319        Query = 2,
320    }
321    /// Assignment will remain in PENDING state if no active capacity commitment is
322    /// present. It will become ACTIVE when some capacity commitment becomes
323    /// active.
324    #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
325    #[repr(i32)]
326    pub enum State {
327        /// Invalid state value.
328        Unspecified = 0,
329        /// Queries from assignee will be executed as on-demand, if related
330        /// assignment is pending.
331        Pending = 1,
332        /// Assignment is ready.
333        Active = 2,
334    }
335}
336/// The request for
337/// [ReservationService.CreateAssignment][google.cloud.bigquery.reservation.v1.ReservationService.CreateAssignment].
338/// Note: "bigquery.reservationAssignments.create" permission is required on the
339/// related assignee.
340#[derive(Clone, PartialEq, ::prost::Message)]
341pub struct CreateAssignmentRequest {
342    /// Required. The parent resource name of the assignment
343    /// E.g. `projects/myproject/locations/US/reservations/team1-prod`
344    #[prost(string, tag="1")]
345    pub parent: std::string::String,
346    /// Assignment resource to create.
347    #[prost(message, optional, tag="2")]
348    pub assignment: ::std::option::Option<Assignment>,
349}
350/// The request for
351/// [ReservationService.ListAssignments][google.cloud.bigquery.reservation.v1.ReservationService.ListAssignments].
352#[derive(Clone, PartialEq, ::prost::Message)]
353pub struct ListAssignmentsRequest {
354    /// Required. The parent resource name e.g.:
355    ///
356    /// `projects/myproject/locations/US/reservations/team1-prod`
357    ///
358    /// Or:
359    ///
360    /// `projects/myproject/locations/US/reservations/-`
361    #[prost(string, tag="1")]
362    pub parent: std::string::String,
363    /// The maximum number of items to return per page.
364    #[prost(int32, tag="2")]
365    pub page_size: i32,
366    /// The next_page_token value returned from a previous List request, if any.
367    #[prost(string, tag="3")]
368    pub page_token: std::string::String,
369}
370/// The response for
371/// [ReservationService.ListAssignments][google.cloud.bigquery.reservation.v1.ReservationService.ListAssignments].
372#[derive(Clone, PartialEq, ::prost::Message)]
373pub struct ListAssignmentsResponse {
374    /// List of assignments visible to the user.
375    #[prost(message, repeated, tag="1")]
376    pub assignments: ::std::vec::Vec<Assignment>,
377    /// Token to retrieve the next page of results, or empty if there are no
378    /// more results in the list.
379    #[prost(string, tag="2")]
380    pub next_page_token: std::string::String,
381}
382/// The request for
383/// [ReservationService.DeleteAssignment][google.cloud.bigquery.reservation.v1.ReservationService.DeleteAssignment].
384/// Note: "bigquery.reservationAssignments.delete" permission is required on the
385/// related assignee.
386#[derive(Clone, PartialEq, ::prost::Message)]
387pub struct DeleteAssignmentRequest {
388    /// Required. Name of the resource, e.g.
389    ///   `projects/myproject/locations/US/reservations/team1-prod/assignments/123`
390    #[prost(string, tag="1")]
391    pub name: std::string::String,
392}
393/// The request for
394/// [ReservationService.SearchAssignments][google.cloud.bigquery.reservation.v1.ReservationService.SearchAssignments].
395/// Note: "bigquery.reservationAssignments.search" permission is required on the
396/// related assignee.
397#[derive(Clone, PartialEq, ::prost::Message)]
398pub struct SearchAssignmentsRequest {
399    /// Required. The resource name of the admin project(containing project and
400    /// location), e.g.:
401    ///   "projects/myproject/locations/US".
402    #[prost(string, tag="1")]
403    pub parent: std::string::String,
404    /// Please specify resource name as assignee in the query.
405    ///
406    /// Examples:
407    ///
408    /// * `assignee=projects/myproject`
409    /// * `assignee=folders/123`
410    /// * `assignee=organizations/456`
411    #[prost(string, tag="2")]
412    pub query: std::string::String,
413    /// The maximum number of items to return per page.
414    #[prost(int32, tag="3")]
415    pub page_size: i32,
416    /// The next_page_token value returned from a previous List request, if any.
417    #[prost(string, tag="4")]
418    pub page_token: std::string::String,
419}
420/// The response for
421/// [ReservationService.SearchAssignments][google.cloud.bigquery.reservation.v1.ReservationService.SearchAssignments].
422#[derive(Clone, PartialEq, ::prost::Message)]
423pub struct SearchAssignmentsResponse {
424    /// List of assignments visible to the user.
425    #[prost(message, repeated, tag="1")]
426    pub assignments: ::std::vec::Vec<Assignment>,
427    /// Token to retrieve the next page of results, or empty if there are no
428    /// more results in the list.
429    #[prost(string, tag="2")]
430    pub next_page_token: std::string::String,
431}
432/// The request for
433/// [ReservationService.MoveAssignment][google.cloud.bigquery.reservation.v1.ReservationService.MoveAssignment].
434///
435/// **Note**: "bigquery.reservationAssignments.create" permission is required on
436/// the destination_id.
437///
438/// **Note**: "bigquery.reservationAssignments.create" and
439/// "bigquery.reservationAssignments.delete" permission are required on the
440/// related assignee.
441#[derive(Clone, PartialEq, ::prost::Message)]
442pub struct MoveAssignmentRequest {
443    /// Required. The resource name of the assignment,
444    /// e.g.
445    /// `projects/myproject/locations/US/reservations/team1-prod/assignments/123`
446    #[prost(string, tag="1")]
447    pub name: std::string::String,
448    /// The new reservation ID, e.g.:
449    ///   `projects/myotherproject/locations/US/reservations/team2-prod`
450    #[prost(string, tag="3")]
451    pub destination_id: std::string::String,
452}
453/// Represents a BI Reservation.
454#[derive(Clone, PartialEq, ::prost::Message)]
455pub struct BiReservation {
456    /// The resource name of the singleton BI reservation.
457    /// Reservation names have the form
458    /// `projects/{project_id}/locations/{location_id}/bireservation`.
459    #[prost(string, tag="1")]
460    pub name: std::string::String,
461    /// Output only. The last update timestamp of a reservation.
462    #[prost(message, optional, tag="3")]
463    pub update_time: ::std::option::Option<::prost_types::Timestamp>,
464    /// Size of a reservation, in bytes.
465    #[prost(int64, tag="4")]
466    pub size: i64,
467}
468/// A request to get a singleton BI reservation.
469#[derive(Clone, PartialEq, ::prost::Message)]
470pub struct GetBiReservationRequest {
471    /// Required. Name of the requested reservation, for example:
472    /// `projects/{project_id}/locations/{location_id}/bireservation`
473    #[prost(string, tag="1")]
474    pub name: std::string::String,
475}
476/// A request to update a BI reservation.
477#[derive(Clone, PartialEq, ::prost::Message)]
478pub struct UpdateBiReservationRequest {
479    /// A reservation to update.
480    #[prost(message, optional, tag="1")]
481    pub bi_reservation: ::std::option::Option<BiReservation>,
482    /// A list of fields to be updated in this request.
483    #[prost(message, optional, tag="2")]
484    pub update_mask: ::std::option::Option<::prost_types::FieldMask>,
485}
486# [ doc = r" Generated client implementations." ] pub mod reservation_service_client { # ! [ allow ( unused_variables , dead_code , missing_docs ) ] 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`." ] pub struct ReservationServiceClient < T > { inner : tonic :: client :: Grpc < T > , } impl < T > ReservationServiceClient < T > where T : tonic :: client :: GrpcService < tonic :: body :: BoxBody > , T :: ResponseBody : Body + HttpBody + Send + 'static , T :: Error : Into < StdError > , < T :: ResponseBody as HttpBody > :: Error : Into < StdError > + Send , { pub fn new ( inner : T ) -> Self { let inner = tonic :: client :: Grpc :: new ( inner ) ; Self { inner } } pub fn with_interceptor ( inner : T , interceptor : impl Into < tonic :: Interceptor > ) -> Self { let inner = tonic :: client :: Grpc :: with_interceptor ( inner , interceptor ) ; Self { inner } } # [ 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.v1.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.v1.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.v1.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.v1.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.v1.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.v1.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.v1.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.v1.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.v1.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.v1.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.v1.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.v1.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.v1.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.v1.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.v1.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.v1.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.v1.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.v1.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.v1.ReservationService/UpdateBiReservation" ) ; self . inner . unary ( request . into_request ( ) , path , codec ) . await } } impl < T : Clone > Clone for ReservationServiceClient < T > { fn clone ( & self ) -> Self { Self { inner : self . inner . clone ( ) , } } } impl < T > std :: fmt :: Debug for ReservationServiceClient < T > { fn fmt ( & self , f : & mut std :: fmt :: Formatter < '_ > ) -> std :: fmt :: Result { write ! ( f , "ReservationServiceClient {{ ... }}" ) } } }use serde :: { Serialize , Deserialize } ;