google_bigquery2/api.rs
1#![allow(clippy::ptr_arg)]
2
3use std::collections::{BTreeSet, HashMap};
4
5use tokio::time::sleep;
6
7// ##############
8// UTILITIES ###
9// ############
10
11/// Identifies the an OAuth2 authorization scope.
12/// A scope is needed when requesting an
13/// [authorization token](https://developers.google.com/youtube/v3/guides/authentication).
14#[derive(PartialEq, Eq, Ord, PartialOrd, Hash, Debug, Clone, Copy)]
15pub enum Scope {
16 /// View and manage your data in Google BigQuery and see the email address for your Google Account
17 Full,
18
19 /// Insert data into Google BigQuery
20 Insertdata,
21
22 /// See, edit, configure, and delete your Google Cloud data and see the email address for your Google Account.
23 CloudPlatform,
24
25 /// View your data across Google Cloud services and see the email address of your Google Account
26 CloudPlatformReadOnly,
27
28 /// Manage your data and permissions in Cloud Storage and see the email address for your Google Account
29 DevstorageFullControl,
30
31 /// View your data in Google Cloud Storage
32 DevstorageReadOnly,
33
34 /// Manage your data in Cloud Storage and see the email address of your Google Account
35 DevstorageReadWrite,
36}
37
38impl AsRef<str> for Scope {
39 fn as_ref(&self) -> &str {
40 match *self {
41 Scope::Full => "https://www.googleapis.com/auth/bigquery",
42 Scope::Insertdata => "https://www.googleapis.com/auth/bigquery.insertdata",
43 Scope::CloudPlatform => "https://www.googleapis.com/auth/cloud-platform",
44 Scope::CloudPlatformReadOnly => {
45 "https://www.googleapis.com/auth/cloud-platform.read-only"
46 }
47 Scope::DevstorageFullControl => {
48 "https://www.googleapis.com/auth/devstorage.full_control"
49 }
50 Scope::DevstorageReadOnly => "https://www.googleapis.com/auth/devstorage.read_only",
51 Scope::DevstorageReadWrite => "https://www.googleapis.com/auth/devstorage.read_write",
52 }
53 }
54}
55
56#[allow(clippy::derivable_impls)]
57impl Default for Scope {
58 fn default() -> Scope {
59 Scope::Full
60 }
61}
62
63// ########
64// HUB ###
65// ######
66
67/// Central instance to access all Bigquery related resource activities
68///
69/// # Examples
70///
71/// Instantiate a new hub
72///
73/// ```test_harness,no_run
74/// extern crate hyper;
75/// extern crate hyper_rustls;
76/// extern crate google_bigquery2 as bigquery2;
77/// use bigquery2::{Result, Error};
78/// # async fn dox() {
79/// use bigquery2::{Bigquery, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
80///
81/// // Get an ApplicationSecret instance by some means. It contains the `client_id` and
82/// // `client_secret`, among other things.
83/// let secret: yup_oauth2::ApplicationSecret = Default::default();
84/// // Instantiate the authenticator. It will choose a suitable authentication flow for you,
85/// // unless you replace `None` with the desired Flow.
86/// // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about
87/// // what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and
88/// // retrieve them from storage.
89/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
90/// .with_native_roots()
91/// .unwrap()
92/// .https_only()
93/// .enable_http2()
94/// .build();
95///
96/// let executor = hyper_util::rt::TokioExecutor::new();
97/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
98/// secret,
99/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
100/// yup_oauth2::client::CustomHyperClientBuilder::from(
101/// hyper_util::client::legacy::Client::builder(executor).build(connector),
102/// ),
103/// ).build().await.unwrap();
104///
105/// let client = hyper_util::client::legacy::Client::builder(
106/// hyper_util::rt::TokioExecutor::new()
107/// )
108/// .build(
109/// hyper_rustls::HttpsConnectorBuilder::new()
110/// .with_native_roots()
111/// .unwrap()
112/// .https_or_http()
113/// .enable_http2()
114/// .build()
115/// );
116/// let mut hub = Bigquery::new(client, auth);
117/// // You can configure optional parameters by calling the respective setters at will, and
118/// // execute the final call using `doit()`.
119/// // Values shown here are possibly random and not representative !
120/// let result = hub.tables().get("projectId", "datasetId", "tableId")
121/// .view("gubergren")
122/// .selected_fields("Lorem")
123/// .doit().await;
124///
125/// match result {
126/// Err(e) => match e {
127/// // The Error enum provides details about what exactly happened.
128/// // You can also just use its `Debug`, `Display` or `Error` traits
129/// Error::HttpError(_)
130/// |Error::Io(_)
131/// |Error::MissingAPIKey
132/// |Error::MissingToken(_)
133/// |Error::Cancelled
134/// |Error::UploadSizeLimitExceeded(_, _)
135/// |Error::Failure(_)
136/// |Error::BadRequest(_)
137/// |Error::FieldClash(_)
138/// |Error::JsonDecodeError(_, _) => println!("{}", e),
139/// },
140/// Ok(res) => println!("Success: {:?}", res),
141/// }
142/// # }
143/// ```
144#[derive(Clone)]
145pub struct Bigquery<C> {
146 pub client: common::Client<C>,
147 pub auth: Box<dyn common::GetToken>,
148 _user_agent: String,
149 _base_url: String,
150 _root_url: String,
151}
152
153impl<C> common::Hub for Bigquery<C> {}
154
155impl<'a, C> Bigquery<C> {
156 pub fn new<A: 'static + common::GetToken>(client: common::Client<C>, auth: A) -> Bigquery<C> {
157 Bigquery {
158 client,
159 auth: Box::new(auth),
160 _user_agent: "google-api-rust-client/7.0.0".to_string(),
161 _base_url: "https://bigquery.googleapis.com/bigquery/v2/".to_string(),
162 _root_url: "https://bigquery.googleapis.com/".to_string(),
163 }
164 }
165
166 pub fn datasets(&'a self) -> DatasetMethods<'a, C> {
167 DatasetMethods { hub: self }
168 }
169 pub fn jobs(&'a self) -> JobMethods<'a, C> {
170 JobMethods { hub: self }
171 }
172 pub fn models(&'a self) -> ModelMethods<'a, C> {
173 ModelMethods { hub: self }
174 }
175 pub fn projects(&'a self) -> ProjectMethods<'a, C> {
176 ProjectMethods { hub: self }
177 }
178 pub fn routines(&'a self) -> RoutineMethods<'a, C> {
179 RoutineMethods { hub: self }
180 }
181 pub fn row_access_policies(&'a self) -> RowAccessPolicyMethods<'a, C> {
182 RowAccessPolicyMethods { hub: self }
183 }
184 pub fn tabledata(&'a self) -> TabledataMethods<'a, C> {
185 TabledataMethods { hub: self }
186 }
187 pub fn tables(&'a self) -> TableMethods<'a, C> {
188 TableMethods { hub: self }
189 }
190
191 /// Set the user-agent header field to use in all requests to the server.
192 /// It defaults to `google-api-rust-client/7.0.0`.
193 ///
194 /// Returns the previously set user-agent.
195 pub fn user_agent(&mut self, agent_name: String) -> String {
196 std::mem::replace(&mut self._user_agent, agent_name)
197 }
198
199 /// Set the base url to use in all requests to the server.
200 /// It defaults to `https://bigquery.googleapis.com/bigquery/v2/`.
201 ///
202 /// Returns the previously set base url.
203 pub fn base_url(&mut self, new_base_url: String) -> String {
204 std::mem::replace(&mut self._base_url, new_base_url)
205 }
206
207 /// Set the root url to use in all requests to the server.
208 /// It defaults to `https://bigquery.googleapis.com/`.
209 ///
210 /// Returns the previously set root url.
211 pub fn root_url(&mut self, new_root_url: String) -> String {
212 std::mem::replace(&mut self._root_url, new_root_url)
213 }
214}
215
216// ############
217// SCHEMAS ###
218// ##########
219/// Aggregate metrics for classification/classifier models. For multi-class models, the metrics are either macro-averaged or micro-averaged. When macro-averaged, the metrics are calculated for each label and then an unweighted average is taken of those values. When micro-averaged, the metric is calculated globally by counting the total number of correctly predicted rows.
220///
221/// This type is not used in any activity, and only used as *part* of another schema.
222///
223#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
224#[serde_with::serde_as]
225#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
226pub struct AggregateClassificationMetrics {
227 /// Accuracy is the fraction of predictions given the correct label. For multiclass this is a micro-averaged metric.
228 pub accuracy: Option<f64>,
229 /// The F1 score is an average of recall and precision. For multiclass this is a macro-averaged metric.
230 #[serde(rename = "f1Score")]
231 pub f1_score: Option<f64>,
232 /// Logarithmic Loss. For multiclass this is a macro-averaged metric.
233 #[serde(rename = "logLoss")]
234 pub log_loss: Option<f64>,
235 /// Precision is the fraction of actual positive predictions that had positive actual labels. For multiclass this is a macro-averaged metric treating each class as a binary classifier.
236 pub precision: Option<f64>,
237 /// Recall is the fraction of actual positive labels that were given a positive prediction. For multiclass this is a macro-averaged metric.
238 pub recall: Option<f64>,
239 /// Area Under a ROC Curve. For multiclass this is a macro-averaged metric.
240 #[serde(rename = "rocAuc")]
241 pub roc_auc: Option<f64>,
242 /// Threshold at which the metrics are computed. For binary classification models this is the positive class threshold. For multi-class classification models this is the confidence threshold.
243 pub threshold: Option<f64>,
244}
245
246impl common::Part for AggregateClassificationMetrics {}
247
248/// Represents privacy policy associated with "aggregation threshold" method.
249///
250/// This type is not used in any activity, and only used as *part* of another schema.
251///
252#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
253#[serde_with::serde_as]
254#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
255pub struct AggregationThresholdPolicy {
256 /// Optional. The privacy unit column(s) associated with this policy. For now, only one column per data source object (table, view) is allowed as a privacy unit column. Representing as a repeated field in metadata for extensibility to multiple columns in future. Duplicates and Repeated struct fields are not allowed. For nested fields, use dot notation ("outer.inner")
257 #[serde(rename = "privacyUnitColumns")]
258 pub privacy_unit_columns: Option<Vec<String>>,
259 /// Optional. The threshold for the "aggregation threshold" policy.
260 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
261 pub threshold: Option<i64>,
262}
263
264impl common::Part for AggregationThresholdPolicy {}
265
266/// Input/output argument of a function or a stored procedure.
267///
268/// This type is not used in any activity, and only used as *part* of another schema.
269///
270#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
271#[serde_with::serde_as]
272#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
273pub struct Argument {
274 /// Optional. Defaults to FIXED_TYPE.
275 #[serde(rename = "argumentKind")]
276 pub argument_kind: Option<String>,
277 /// Set if argument_kind == FIXED_TYPE.
278 #[serde(rename = "dataType")]
279 pub data_type: Option<StandardSqlDataType>,
280 /// Optional. Whether the argument is an aggregate function parameter. Must be Unset for routine types other than AGGREGATE_FUNCTION. For AGGREGATE_FUNCTION, if set to false, it is equivalent to adding "NOT AGGREGATE" clause in DDL; Otherwise, it is equivalent to omitting "NOT AGGREGATE" clause in DDL.
281 #[serde(rename = "isAggregate")]
282 pub is_aggregate: Option<bool>,
283 /// Optional. Specifies whether the argument is input or output. Can be set for procedures only.
284 pub mode: Option<String>,
285 /// Optional. The name of this argument. Can be absent for function return argument.
286 pub name: Option<String>,
287}
288
289impl common::Part for Argument {}
290
291/// Arima coefficients.
292///
293/// This type is not used in any activity, and only used as *part* of another schema.
294///
295#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
296#[serde_with::serde_as]
297#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
298pub struct ArimaCoefficients {
299 /// Auto-regressive coefficients, an array of double.
300 #[serde(rename = "autoRegressiveCoefficients")]
301 pub auto_regressive_coefficients: Option<Vec<f64>>,
302 /// Intercept coefficient, just a double not an array.
303 #[serde(rename = "interceptCoefficient")]
304 pub intercept_coefficient: Option<f64>,
305 /// Moving-average coefficients, an array of double.
306 #[serde(rename = "movingAverageCoefficients")]
307 pub moving_average_coefficients: Option<Vec<f64>>,
308}
309
310impl common::Part for ArimaCoefficients {}
311
312/// ARIMA model fitting metrics.
313///
314/// This type is not used in any activity, and only used as *part* of another schema.
315///
316#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
317#[serde_with::serde_as]
318#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
319pub struct ArimaFittingMetrics {
320 /// AIC.
321 pub aic: Option<f64>,
322 /// Log-likelihood.
323 #[serde(rename = "logLikelihood")]
324 pub log_likelihood: Option<f64>,
325 /// Variance.
326 pub variance: Option<f64>,
327}
328
329impl common::Part for ArimaFittingMetrics {}
330
331/// Model evaluation metrics for ARIMA forecasting models.
332///
333/// This type is not used in any activity, and only used as *part* of another schema.
334///
335#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
336#[serde_with::serde_as]
337#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
338pub struct ArimaForecastingMetrics {
339 /// Arima model fitting metrics.
340 #[serde(rename = "arimaFittingMetrics")]
341 pub arima_fitting_metrics: Option<Vec<ArimaFittingMetrics>>,
342 /// Repeated as there can be many metric sets (one for each model) in auto-arima and the large-scale case.
343 #[serde(rename = "arimaSingleModelForecastingMetrics")]
344 pub arima_single_model_forecasting_metrics: Option<Vec<ArimaSingleModelForecastingMetrics>>,
345 /// Whether Arima model fitted with drift or not. It is always false when d is not 1.
346 #[serde(rename = "hasDrift")]
347 pub has_drift: Option<Vec<bool>>,
348 /// Non-seasonal order.
349 #[serde(rename = "nonSeasonalOrder")]
350 pub non_seasonal_order: Option<Vec<ArimaOrder>>,
351 /// Seasonal periods. Repeated because multiple periods are supported for one time series.
352 #[serde(rename = "seasonalPeriods")]
353 pub seasonal_periods: Option<Vec<String>>,
354 /// Id to differentiate different time series for the large-scale case.
355 #[serde(rename = "timeSeriesId")]
356 pub time_series_id: Option<Vec<String>>,
357}
358
359impl common::Part for ArimaForecastingMetrics {}
360
361/// Arima model information.
362///
363/// This type is not used in any activity, and only used as *part* of another schema.
364///
365#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
366#[serde_with::serde_as]
367#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
368pub struct ArimaModelInfo {
369 /// Arima coefficients.
370 #[serde(rename = "arimaCoefficients")]
371 pub arima_coefficients: Option<ArimaCoefficients>,
372 /// Arima fitting metrics.
373 #[serde(rename = "arimaFittingMetrics")]
374 pub arima_fitting_metrics: Option<ArimaFittingMetrics>,
375 /// Whether Arima model fitted with drift or not. It is always false when d is not 1.
376 #[serde(rename = "hasDrift")]
377 pub has_drift: Option<bool>,
378 /// If true, holiday_effect is a part of time series decomposition result.
379 #[serde(rename = "hasHolidayEffect")]
380 pub has_holiday_effect: Option<bool>,
381 /// If true, spikes_and_dips is a part of time series decomposition result.
382 #[serde(rename = "hasSpikesAndDips")]
383 pub has_spikes_and_dips: Option<bool>,
384 /// If true, step_changes is a part of time series decomposition result.
385 #[serde(rename = "hasStepChanges")]
386 pub has_step_changes: Option<bool>,
387 /// Non-seasonal order.
388 #[serde(rename = "nonSeasonalOrder")]
389 pub non_seasonal_order: Option<ArimaOrder>,
390 /// Seasonal periods. Repeated because multiple periods are supported for one time series.
391 #[serde(rename = "seasonalPeriods")]
392 pub seasonal_periods: Option<Vec<String>>,
393 /// The time_series_id value for this time series. It will be one of the unique values from the time_series_id_column specified during ARIMA model training. Only present when time_series_id_column training option was used.
394 #[serde(rename = "timeSeriesId")]
395 pub time_series_id: Option<String>,
396 /// The tuple of time_series_ids identifying this time series. It will be one of the unique tuples of values present in the time_series_id_columns specified during ARIMA model training. Only present when time_series_id_columns training option was used and the order of values here are same as the order of time_series_id_columns.
397 #[serde(rename = "timeSeriesIds")]
398 pub time_series_ids: Option<Vec<String>>,
399}
400
401impl common::Part for ArimaModelInfo {}
402
403/// Arima order, can be used for both non-seasonal and seasonal parts.
404///
405/// This type is not used in any activity, and only used as *part* of another schema.
406///
407#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
408#[serde_with::serde_as]
409#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
410pub struct ArimaOrder {
411 /// Order of the differencing part.
412 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
413 pub d: Option<i64>,
414 /// Order of the autoregressive part.
415 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
416 pub p: Option<i64>,
417 /// Order of the moving-average part.
418 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
419 pub q: Option<i64>,
420}
421
422impl common::Part for ArimaOrder {}
423
424/// (Auto-)arima fitting result. Wrap everything in ArimaResult for easier refactoring if we want to use model-specific iteration results.
425///
426/// This type is not used in any activity, and only used as *part* of another schema.
427///
428#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
429#[serde_with::serde_as]
430#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
431pub struct ArimaResult {
432 /// This message is repeated because there are multiple arima models fitted in auto-arima. For non-auto-arima model, its size is one.
433 #[serde(rename = "arimaModelInfo")]
434 pub arima_model_info: Option<Vec<ArimaModelInfo>>,
435 /// Seasonal periods. Repeated because multiple periods are supported for one time series.
436 #[serde(rename = "seasonalPeriods")]
437 pub seasonal_periods: Option<Vec<String>>,
438}
439
440impl common::Part for ArimaResult {}
441
442/// Model evaluation metrics for a single ARIMA forecasting model.
443///
444/// This type is not used in any activity, and only used as *part* of another schema.
445///
446#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
447#[serde_with::serde_as]
448#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
449pub struct ArimaSingleModelForecastingMetrics {
450 /// Arima fitting metrics.
451 #[serde(rename = "arimaFittingMetrics")]
452 pub arima_fitting_metrics: Option<ArimaFittingMetrics>,
453 /// Is arima model fitted with drift or not. It is always false when d is not 1.
454 #[serde(rename = "hasDrift")]
455 pub has_drift: Option<bool>,
456 /// If true, holiday_effect is a part of time series decomposition result.
457 #[serde(rename = "hasHolidayEffect")]
458 pub has_holiday_effect: Option<bool>,
459 /// If true, spikes_and_dips is a part of time series decomposition result.
460 #[serde(rename = "hasSpikesAndDips")]
461 pub has_spikes_and_dips: Option<bool>,
462 /// If true, step_changes is a part of time series decomposition result.
463 #[serde(rename = "hasStepChanges")]
464 pub has_step_changes: Option<bool>,
465 /// Non-seasonal order.
466 #[serde(rename = "nonSeasonalOrder")]
467 pub non_seasonal_order: Option<ArimaOrder>,
468 /// Seasonal periods. Repeated because multiple periods are supported for one time series.
469 #[serde(rename = "seasonalPeriods")]
470 pub seasonal_periods: Option<Vec<String>>,
471 /// The time_series_id value for this time series. It will be one of the unique values from the time_series_id_column specified during ARIMA model training. Only present when time_series_id_column training option was used.
472 #[serde(rename = "timeSeriesId")]
473 pub time_series_id: Option<String>,
474 /// The tuple of time_series_ids identifying this time series. It will be one of the unique tuples of values present in the time_series_id_columns specified during ARIMA model training. Only present when time_series_id_columns training option was used and the order of values here are same as the order of time_series_id_columns.
475 #[serde(rename = "timeSeriesIds")]
476 pub time_series_ids: Option<Vec<String>>,
477}
478
479impl common::Part for ArimaSingleModelForecastingMetrics {}
480
481/// Specifies the audit configuration for a service. The configuration determines which permission types are logged, and what identities, if any, are exempted from logging. An AuditConfig must have one or more AuditLogConfigs. If there are AuditConfigs for both `allServices` and a specific service, the union of the two AuditConfigs is used for that service: the log_types specified in each AuditConfig are enabled, and the exempted_members in each AuditLogConfig are exempted. Example Policy with multiple AuditConfigs: { "audit_configs": [ { "service": "allServices", "audit_log_configs": [ { "log_type": "DATA_READ", "exempted_members": [ "user:jose@example.com" ] }, { "log_type": "DATA_WRITE" }, { "log_type": "ADMIN_READ" } ] }, { "service": "sampleservice.googleapis.com", "audit_log_configs": [ { "log_type": "DATA_READ" }, { "log_type": "DATA_WRITE", "exempted_members": [ "user:aliya@example.com" ] } ] } ] } For sampleservice, this policy enables DATA_READ, DATA_WRITE and ADMIN_READ logging. It also exempts `jose@example.com` from DATA_READ logging, and `aliya@example.com` from DATA_WRITE logging.
482///
483/// This type is not used in any activity, and only used as *part* of another schema.
484///
485#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
486#[serde_with::serde_as]
487#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
488pub struct AuditConfig {
489 /// The configuration for logging of each type of permission.
490 #[serde(rename = "auditLogConfigs")]
491 pub audit_log_configs: Option<Vec<AuditLogConfig>>,
492 /// Specifies a service that will be enabled for audit logging. For example, `storage.googleapis.com`, `cloudsql.googleapis.com`. `allServices` is a special value that covers all services.
493 pub service: Option<String>,
494}
495
496impl common::Part for AuditConfig {}
497
498/// Provides the configuration for logging a type of permissions. Example: { "audit_log_configs": [ { "log_type": "DATA_READ", "exempted_members": [ "user:jose@example.com" ] }, { "log_type": "DATA_WRITE" } ] } This enables 'DATA_READ' and 'DATA_WRITE' logging, while exempting jose@example.com from DATA_READ logging.
499///
500/// This type is not used in any activity, and only used as *part* of another schema.
501///
502#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
503#[serde_with::serde_as]
504#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
505pub struct AuditLogConfig {
506 /// Specifies the identities that do not cause logging for this type of permission. Follows the same format of Binding.members.
507 #[serde(rename = "exemptedMembers")]
508 pub exempted_members: Option<Vec<String>>,
509 /// The log type that this config enables.
510 #[serde(rename = "logType")]
511 pub log_type: Option<String>,
512}
513
514impl common::Part for AuditLogConfig {}
515
516/// Options for external data sources.
517///
518/// This type is not used in any activity, and only used as *part* of another schema.
519///
520#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
521#[serde_with::serde_as]
522#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
523pub struct AvroOptions {
524 /// Optional. If sourceFormat is set to "AVRO", indicates whether to interpret logical types as the corresponding BigQuery data type (for example, TIMESTAMP), instead of using the raw type (for example, INTEGER).
525 #[serde(rename = "useAvroLogicalTypes")]
526 pub use_avro_logical_types: Option<bool>,
527}
528
529impl common::Part for AvroOptions {}
530
531/// Request message for the BatchDeleteRowAccessPoliciesRequest method.
532///
533/// # Activities
534///
535/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
536/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
537///
538/// * [batch delete row access policies](RowAccessPolicyBatchDeleteCall) (request)
539#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
540#[serde_with::serde_as]
541#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
542pub struct BatchDeleteRowAccessPoliciesRequest {
543 /// If set to true, it deletes the row access policy even if it's the last row access policy on the table and the deletion will widen the access rather narrowing it.
544 pub force: Option<bool>,
545 /// Required. Policy IDs of the row access policies.
546 #[serde(rename = "policyIds")]
547 pub policy_ids: Option<Vec<String>>,
548}
549
550impl common::RequestValue for BatchDeleteRowAccessPoliciesRequest {}
551
552/// Reason why BI Engine didn't accelerate the query (or sub-query).
553///
554/// This type is not used in any activity, and only used as *part* of another schema.
555///
556#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
557#[serde_with::serde_as]
558#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
559pub struct BiEngineReason {
560 /// Output only. High-level BI Engine reason for partial or disabled acceleration
561 pub code: Option<String>,
562 /// Output only. Free form human-readable reason for partial or disabled acceleration.
563 pub message: Option<String>,
564}
565
566impl common::Part for BiEngineReason {}
567
568/// Statistics for a BI Engine specific query. Populated as part of JobStatistics2
569///
570/// This type is not used in any activity, and only used as *part* of another schema.
571///
572#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
573#[serde_with::serde_as]
574#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
575pub struct BiEngineStatistics {
576 /// Output only. Specifies which mode of BI Engine acceleration was performed (if any).
577 #[serde(rename = "accelerationMode")]
578 pub acceleration_mode: Option<String>,
579 /// Output only. Specifies which mode of BI Engine acceleration was performed (if any).
580 #[serde(rename = "biEngineMode")]
581 pub bi_engine_mode: Option<String>,
582 /// In case of DISABLED or PARTIAL bi_engine_mode, these contain the explanatory reasons as to why BI Engine could not accelerate. In case the full query was accelerated, this field is not populated.
583 #[serde(rename = "biEngineReasons")]
584 pub bi_engine_reasons: Option<Vec<BiEngineReason>>,
585}
586
587impl common::Part for BiEngineStatistics {}
588
589/// Configuration for BigQuery tables for Apache Iceberg (formerly BigLake managed tables.)
590///
591/// This type is not used in any activity, and only used as *part* of another schema.
592///
593#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
594#[serde_with::serde_as]
595#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
596pub struct BigLakeConfiguration {
597 /// Optional. The connection specifying the credentials to be used to read and write to external storage, such as Cloud Storage. The connection_id can have the form `{project}.{location}.{connection_id}` or `projects/{project}/locations/{location}/connections/{connection_id}".
598 #[serde(rename = "connectionId")]
599 pub connection_id: Option<String>,
600 /// Optional. The file format the table data is stored in.
601 #[serde(rename = "fileFormat")]
602 pub file_format: Option<String>,
603 /// Optional. The fully qualified location prefix of the external folder where table data is stored. The '*' wildcard character is not allowed. The URI should be in the format `gs://bucket/path_to_table/`
604 #[serde(rename = "storageUri")]
605 pub storage_uri: Option<String>,
606 /// Optional. The table format the metadata only snapshots are stored in.
607 #[serde(rename = "tableFormat")]
608 pub table_format: Option<String>,
609}
610
611impl common::Part for BigLakeConfiguration {}
612
613/// There is no detailed description.
614///
615/// This type is not used in any activity, and only used as *part* of another schema.
616///
617#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
618#[serde_with::serde_as]
619#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
620pub struct BigQueryModelTraining {
621 /// Deprecated.
622 #[serde(rename = "currentIteration")]
623 pub current_iteration: Option<i32>,
624 /// Deprecated.
625 #[serde(rename = "expectedTotalIterations")]
626 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
627 pub expected_total_iterations: Option<i64>,
628}
629
630impl common::Part for BigQueryModelTraining {}
631
632/// Information related to a Bigtable column.
633///
634/// This type is not used in any activity, and only used as *part* of another schema.
635///
636#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
637#[serde_with::serde_as]
638#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
639pub struct BigtableColumn {
640 /// Optional. The encoding of the values when the type is not STRING. Acceptable encoding values are: TEXT - indicates values are alphanumeric text strings. BINARY - indicates values are encoded using HBase Bytes.toBytes family of functions. PROTO_BINARY - indicates values are encoded using serialized proto messages. This can only be used in combination with JSON type. 'encoding' can also be set at the column family level. However, the setting at this level takes precedence if 'encoding' is set at both levels.
641 pub encoding: Option<String>,
642 /// Optional. If the qualifier is not a valid BigQuery field identifier i.e. does not match a-zA-Z*, a valid identifier must be provided as the column field name and is used as field name in queries.
643 #[serde(rename = "fieldName")]
644 pub field_name: Option<String>,
645 /// Optional. If this is set, only the latest version of value in this column are exposed. 'onlyReadLatest' can also be set at the column family level. However, the setting at this level takes precedence if 'onlyReadLatest' is set at both levels.
646 #[serde(rename = "onlyReadLatest")]
647 pub only_read_latest: Option<bool>,
648 /// Optional. Protobuf-specific configurations, only takes effect when the encoding is PROTO_BINARY.
649 #[serde(rename = "protoConfig")]
650 pub proto_config: Option<BigtableProtoConfig>,
651 /// [Required] Qualifier of the column. Columns in the parent column family that has this exact qualifier are exposed as `.` field. If the qualifier is valid UTF-8 string, it can be specified in the qualifier_string field. Otherwise, a base-64 encoded value must be set to qualifier_encoded. The column field name is the same as the column qualifier. However, if the qualifier is not a valid BigQuery field identifier i.e. does not match a-zA-Z*, a valid identifier must be provided as field_name.
652 #[serde(rename = "qualifierEncoded")]
653 #[serde_as(as = "Option<common::serde::standard_base64::Wrapper>")]
654 pub qualifier_encoded: Option<Vec<u8>>,
655 /// Qualifier string.
656 #[serde(rename = "qualifierString")]
657 pub qualifier_string: Option<String>,
658 /// Optional. The type to convert the value in cells of this column. The values are expected to be encoded using HBase Bytes.toBytes function when using the BINARY encoding value. Following BigQuery types are allowed (case-sensitive): * BYTES * STRING * INTEGER * FLOAT * BOOLEAN * JSON Default type is BYTES. 'type' can also be set at the column family level. However, the setting at this level takes precedence if 'type' is set at both levels.
659 #[serde(rename = "type")]
660 pub type_: Option<String>,
661}
662
663impl common::Part for BigtableColumn {}
664
665/// Information related to a Bigtable column family.
666///
667/// This type is not used in any activity, and only used as *part* of another schema.
668///
669#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
670#[serde_with::serde_as]
671#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
672pub struct BigtableColumnFamily {
673 /// Optional. Lists of columns that should be exposed as individual fields as opposed to a list of (column name, value) pairs. All columns whose qualifier matches a qualifier in this list can be accessed as `.`. Other columns can be accessed as a list through the `.Column` field.
674 pub columns: Option<Vec<BigtableColumn>>,
675 /// Optional. The encoding of the values when the type is not STRING. Acceptable encoding values are: TEXT - indicates values are alphanumeric text strings. BINARY - indicates values are encoded using HBase Bytes.toBytes family of functions. PROTO_BINARY - indicates values are encoded using serialized proto messages. This can only be used in combination with JSON type. This can be overridden for a specific column by listing that column in 'columns' and specifying an encoding for it.
676 pub encoding: Option<String>,
677 /// Identifier of the column family.
678 #[serde(rename = "familyId")]
679 pub family_id: Option<String>,
680 /// Optional. If this is set only the latest version of value are exposed for all columns in this column family. This can be overridden for a specific column by listing that column in 'columns' and specifying a different setting for that column.
681 #[serde(rename = "onlyReadLatest")]
682 pub only_read_latest: Option<bool>,
683 /// Optional. Protobuf-specific configurations, only takes effect when the encoding is PROTO_BINARY.
684 #[serde(rename = "protoConfig")]
685 pub proto_config: Option<BigtableProtoConfig>,
686 /// Optional. The type to convert the value in cells of this column family. The values are expected to be encoded using HBase Bytes.toBytes function when using the BINARY encoding value. Following BigQuery types are allowed (case-sensitive): * BYTES * STRING * INTEGER * FLOAT * BOOLEAN * JSON Default type is BYTES. This can be overridden for a specific column by listing that column in 'columns' and specifying a type for it.
687 #[serde(rename = "type")]
688 pub type_: Option<String>,
689}
690
691impl common::Part for BigtableColumnFamily {}
692
693/// Options specific to Google Cloud Bigtable data sources.
694///
695/// This type is not used in any activity, and only used as *part* of another schema.
696///
697#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
698#[serde_with::serde_as]
699#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
700pub struct BigtableOptions {
701 /// Optional. List of column families to expose in the table schema along with their types. This list restricts the column families that can be referenced in queries and specifies their value types. You can use this list to do type conversions - see the 'type' field for more details. If you leave this list empty, all column families are present in the table schema and their values are read as BYTES. During a query only the column families referenced in that query are read from Bigtable.
702 #[serde(rename = "columnFamilies")]
703 pub column_families: Option<Vec<BigtableColumnFamily>>,
704 /// Optional. If field is true, then the column families that are not specified in columnFamilies list are not exposed in the table schema. Otherwise, they are read with BYTES type values. The default value is false.
705 #[serde(rename = "ignoreUnspecifiedColumnFamilies")]
706 pub ignore_unspecified_column_families: Option<bool>,
707 /// Optional. If field is true, then each column family will be read as a single JSON column. Otherwise they are read as a repeated cell structure containing timestamp/value tuples. The default value is false.
708 #[serde(rename = "outputColumnFamiliesAsJson")]
709 pub output_column_families_as_json: Option<bool>,
710 /// Optional. If field is true, then the rowkey column families will be read and converted to string. Otherwise they are read with BYTES type values and users need to manually cast them with CAST if necessary. The default value is false.
711 #[serde(rename = "readRowkeyAsString")]
712 pub read_rowkey_as_string: Option<bool>,
713}
714
715impl common::Part for BigtableOptions {}
716
717/// Information related to a Bigtable protobuf column.
718///
719/// This type is not used in any activity, and only used as *part* of another schema.
720///
721#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
722#[serde_with::serde_as]
723#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
724pub struct BigtableProtoConfig {
725 /// Optional. The fully qualified proto message name of the protobuf. In the format of "foo.bar.Message".
726 #[serde(rename = "protoMessageName")]
727 pub proto_message_name: Option<String>,
728 /// Optional. The ID of the Bigtable SchemaBundle resource associated with this protobuf. The ID should be referred to within the parent table, e.g., `foo` rather than `projects/{project}/instances/{instance}/tables/{table}/schemaBundles/foo`. See [more details on Bigtable SchemaBundles](https://docs.cloud.google.com/bigtable/docs/create-manage-protobuf-schemas).
729 #[serde(rename = "schemaBundleId")]
730 pub schema_bundle_id: Option<String>,
731}
732
733impl common::Part for BigtableProtoConfig {}
734
735/// Evaluation metrics for binary classification/classifier models.
736///
737/// This type is not used in any activity, and only used as *part* of another schema.
738///
739#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
740#[serde_with::serde_as]
741#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
742pub struct BinaryClassificationMetrics {
743 /// Aggregate classification metrics.
744 #[serde(rename = "aggregateClassificationMetrics")]
745 pub aggregate_classification_metrics: Option<AggregateClassificationMetrics>,
746 /// Binary confusion matrix at multiple thresholds.
747 #[serde(rename = "binaryConfusionMatrixList")]
748 pub binary_confusion_matrix_list: Option<Vec<BinaryConfusionMatrix>>,
749 /// Label representing the negative class.
750 #[serde(rename = "negativeLabel")]
751 pub negative_label: Option<String>,
752 /// Label representing the positive class.
753 #[serde(rename = "positiveLabel")]
754 pub positive_label: Option<String>,
755}
756
757impl common::Part for BinaryClassificationMetrics {}
758
759/// Confusion matrix for binary classification models.
760///
761/// This type is not used in any activity, and only used as *part* of another schema.
762///
763#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
764#[serde_with::serde_as]
765#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
766pub struct BinaryConfusionMatrix {
767 /// The fraction of predictions given the correct label.
768 pub accuracy: Option<f64>,
769 /// The equally weighted average of recall and precision.
770 #[serde(rename = "f1Score")]
771 pub f1_score: Option<f64>,
772 /// Number of false samples predicted as false.
773 #[serde(rename = "falseNegatives")]
774 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
775 pub false_negatives: Option<i64>,
776 /// Number of false samples predicted as true.
777 #[serde(rename = "falsePositives")]
778 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
779 pub false_positives: Option<i64>,
780 /// Threshold value used when computing each of the following metric.
781 #[serde(rename = "positiveClassThreshold")]
782 pub positive_class_threshold: Option<f64>,
783 /// The fraction of actual positive predictions that had positive actual labels.
784 pub precision: Option<f64>,
785 /// The fraction of actual positive labels that were given a positive prediction.
786 pub recall: Option<f64>,
787 /// Number of true samples predicted as false.
788 #[serde(rename = "trueNegatives")]
789 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
790 pub true_negatives: Option<i64>,
791 /// Number of true samples predicted as true.
792 #[serde(rename = "truePositives")]
793 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
794 pub true_positives: Option<i64>,
795}
796
797impl common::Part for BinaryConfusionMatrix {}
798
799/// Associates `members`, or principals, with a `role`.
800///
801/// This type is not used in any activity, and only used as *part* of another schema.
802///
803#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
804#[serde_with::serde_as]
805#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
806pub struct Binding {
807 /// The condition that is associated with this binding. If the condition evaluates to `true`, then this binding applies to the current request. If the condition evaluates to `false`, then this binding does not apply to the current request. However, a different role binding might grant the same role to one or more of the principals in this binding. To learn which resources support conditions in their IAM policies, see the [IAM documentation](https://cloud.google.com/iam/help/conditions/resource-policies).
808 pub condition: Option<Expr>,
809 /// Specifies the principals requesting access for a Google Cloud resource. `members` can have the following values: * `allUsers`: A special identifier that represents anyone who is on the internet; with or without a Google account. * `allAuthenticatedUsers`: A special identifier that represents anyone who is authenticated with a Google account or a service account. Does not include identities that come from external identity providers (IdPs) through identity federation. * `user:{emailid}`: An email address that represents a specific Google account. For example, `alice@example.com` . * `serviceAccount:{emailid}`: An email address that represents a Google service account. For example, `my-other-app@appspot.gserviceaccount.com`. * `serviceAccount:{projectid}.svc.id.goog[{namespace}/{kubernetes-sa}]`: An identifier for a [Kubernetes service account](https://cloud.google.com/kubernetes-engine/docs/how-to/kubernetes-service-accounts). For example, `my-project.svc.id.goog[my-namespace/my-kubernetes-sa]`. * `group:{emailid}`: An email address that represents a Google group. For example, `admins@example.com`. * `domain:{domain}`: The G Suite domain (primary) that represents all the users of that domain. For example, `google.com` or `example.com`. * `principal://iam.googleapis.com/locations/global/workforcePools/{pool_id}/subject/{subject_attribute_value}`: A single identity in a workforce identity pool. * `principalSet://iam.googleapis.com/locations/global/workforcePools/{pool_id}/group/{group_id}`: All workforce identities in a group. * `principalSet://iam.googleapis.com/locations/global/workforcePools/{pool_id}/attribute.{attribute_name}/{attribute_value}`: All workforce identities with a specific attribute value. * `principalSet://iam.googleapis.com/locations/global/workforcePools/{pool_id}/*`: All identities in a workforce identity pool. * `principal://iam.googleapis.com/projects/{project_number}/locations/global/workloadIdentityPools/{pool_id}/subject/{subject_attribute_value}`: A single identity in a workload identity pool. * `principalSet://iam.googleapis.com/projects/{project_number}/locations/global/workloadIdentityPools/{pool_id}/group/{group_id}`: A workload identity pool group. * `principalSet://iam.googleapis.com/projects/{project_number}/locations/global/workloadIdentityPools/{pool_id}/attribute.{attribute_name}/{attribute_value}`: All identities in a workload identity pool with a certain attribute. * `principalSet://iam.googleapis.com/projects/{project_number}/locations/global/workloadIdentityPools/{pool_id}/*`: All identities in a workload identity pool. * `deleted:user:{emailid}?uid={uniqueid}`: An email address (plus unique identifier) representing a user that has been recently deleted. For example, `alice@example.com?uid=123456789012345678901`. If the user is recovered, this value reverts to `user:{emailid}` and the recovered user retains the role in the binding. * `deleted:serviceAccount:{emailid}?uid={uniqueid}`: An email address (plus unique identifier) representing a service account that has been recently deleted. For example, `my-other-app@appspot.gserviceaccount.com?uid=123456789012345678901`. If the service account is undeleted, this value reverts to `serviceAccount:{emailid}` and the undeleted service account retains the role in the binding. * `deleted:group:{emailid}?uid={uniqueid}`: An email address (plus unique identifier) representing a Google group that has been recently deleted. For example, `admins@example.com?uid=123456789012345678901`. If the group is recovered, this value reverts to `group:{emailid}` and the recovered group retains the role in the binding. * `deleted:principal://iam.googleapis.com/locations/global/workforcePools/{pool_id}/subject/{subject_attribute_value}`: Deleted single identity in a workforce identity pool. For example, `deleted:principal://iam.googleapis.com/locations/global/workforcePools/my-pool-id/subject/my-subject-attribute-value`.
810 pub members: Option<Vec<String>>,
811 /// Role that is assigned to the list of `members`, or principals. For example, `roles/viewer`, `roles/editor`, or `roles/owner`. For an overview of the IAM roles and permissions, see the [IAM documentation](https://cloud.google.com/iam/docs/roles-overview). For a list of the available pre-defined roles, see [here](https://cloud.google.com/iam/docs/understanding-roles).
812 pub role: Option<String>,
813}
814
815impl common::Part for Binding {}
816
817/// There is no detailed description.
818///
819/// This type is not used in any activity, and only used as *part* of another schema.
820///
821#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
822#[serde_with::serde_as]
823#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
824pub struct BqmlIterationResult {
825 /// Deprecated.
826 #[serde(rename = "durationMs")]
827 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
828 pub duration_ms: Option<i64>,
829 /// Deprecated.
830 #[serde(rename = "evalLoss")]
831 pub eval_loss: Option<f64>,
832 /// Deprecated.
833 pub index: Option<i32>,
834 /// Deprecated.
835 #[serde(rename = "learnRate")]
836 pub learn_rate: Option<f64>,
837 /// Deprecated.
838 #[serde(rename = "trainingLoss")]
839 pub training_loss: Option<f64>,
840}
841
842impl common::Part for BqmlIterationResult {}
843
844/// There is no detailed description.
845///
846/// This type is not used in any activity, and only used as *part* of another schema.
847///
848#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
849#[serde_with::serde_as]
850#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
851pub struct BqmlTrainingRun {
852 /// Deprecated.
853 #[serde(rename = "iterationResults")]
854 pub iteration_results: Option<Vec<BqmlIterationResult>>,
855 /// Deprecated.
856 #[serde(rename = "startTime")]
857 pub start_time: Option<chrono::DateTime<chrono::offset::Utc>>,
858 /// Deprecated.
859 pub state: Option<String>,
860 /// Deprecated.
861 #[serde(rename = "trainingOptions")]
862 pub training_options: Option<BqmlTrainingRunTrainingOptions>,
863}
864
865impl common::Part for BqmlTrainingRun {}
866
867/// Representative value of a categorical feature.
868///
869/// This type is not used in any activity, and only used as *part* of another schema.
870///
871#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
872#[serde_with::serde_as]
873#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
874pub struct CategoricalValue {
875 /// Counts of all categories for the categorical feature. If there are more than ten categories, we return top ten (by count) and return one more CategoryCount with category "_OTHER_" and count as aggregate counts of remaining categories.
876 #[serde(rename = "categoryCounts")]
877 pub category_counts: Option<Vec<CategoryCount>>,
878}
879
880impl common::Part for CategoricalValue {}
881
882/// Represents the count of a single category within the cluster.
883///
884/// This type is not used in any activity, and only used as *part* of another schema.
885///
886#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
887#[serde_with::serde_as]
888#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
889pub struct CategoryCount {
890 /// The name of category.
891 pub category: Option<String>,
892 /// The count of training samples matching the category within the cluster.
893 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
894 pub count: Option<i64>,
895}
896
897impl common::Part for CategoryCount {}
898
899/// Information about base table and clone time of a table clone.
900///
901/// This type is not used in any activity, and only used as *part* of another schema.
902///
903#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
904#[serde_with::serde_as]
905#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
906pub struct CloneDefinition {
907 /// Required. Reference describing the ID of the table that was cloned.
908 #[serde(rename = "baseTableReference")]
909 pub base_table_reference: Option<TableReference>,
910 /// Required. The time at which the base table was cloned. This value is reported in the JSON response using RFC3339 format.
911 #[serde(rename = "cloneTime")]
912 pub clone_time: Option<chrono::DateTime<chrono::offset::Utc>>,
913}
914
915impl common::Part for CloneDefinition {}
916
917/// Message containing the information about one cluster.
918///
919/// This type is not used in any activity, and only used as *part* of another schema.
920///
921#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
922#[serde_with::serde_as]
923#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
924pub struct Cluster {
925 /// Centroid id.
926 #[serde(rename = "centroidId")]
927 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
928 pub centroid_id: Option<i64>,
929 /// Count of training data rows that were assigned to this cluster.
930 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
931 pub count: Option<i64>,
932 /// Values of highly variant features for this cluster.
933 #[serde(rename = "featureValues")]
934 pub feature_values: Option<Vec<FeatureValue>>,
935}
936
937impl common::Part for Cluster {}
938
939/// Information about a single cluster for clustering model.
940///
941/// This type is not used in any activity, and only used as *part* of another schema.
942///
943#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
944#[serde_with::serde_as]
945#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
946pub struct ClusterInfo {
947 /// Centroid id.
948 #[serde(rename = "centroidId")]
949 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
950 pub centroid_id: Option<i64>,
951 /// Cluster radius, the average distance from centroid to each point assigned to the cluster.
952 #[serde(rename = "clusterRadius")]
953 pub cluster_radius: Option<f64>,
954 /// Cluster size, the total number of points assigned to the cluster.
955 #[serde(rename = "clusterSize")]
956 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
957 pub cluster_size: Option<i64>,
958}
959
960impl common::Part for ClusterInfo {}
961
962/// Configures table clustering.
963///
964/// This type is not used in any activity, and only used as *part* of another schema.
965///
966#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
967#[serde_with::serde_as]
968#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
969pub struct Clustering {
970 /// One or more fields on which data should be clustered. Only top-level, non-repeated, simple-type fields are supported. The ordering of the clustering fields should be prioritized from most to least important for filtering purposes. For additional information, see [Introduction to clustered tables](https://cloud.google.com/bigquery/docs/clustered-tables#limitations).
971 pub fields: Option<Vec<String>>,
972}
973
974impl common::Part for Clustering {}
975
976/// Evaluation metrics for clustering models.
977///
978/// This type is not used in any activity, and only used as *part* of another schema.
979///
980#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
981#[serde_with::serde_as]
982#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
983pub struct ClusteringMetrics {
984 /// Information for all clusters.
985 pub clusters: Option<Vec<Cluster>>,
986 /// Davies-Bouldin index.
987 #[serde(rename = "daviesBouldinIndex")]
988 pub davies_bouldin_index: Option<f64>,
989 /// Mean of squared distances between each sample to its cluster centroid.
990 #[serde(rename = "meanSquaredDistance")]
991 pub mean_squared_distance: Option<f64>,
992}
993
994impl common::Part for ClusteringMetrics {}
995
996/// Confusion matrix for multi-class classification models.
997///
998/// This type is not used in any activity, and only used as *part* of another schema.
999///
1000#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1001#[serde_with::serde_as]
1002#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1003pub struct ConfusionMatrix {
1004 /// Confidence threshold used when computing the entries of the confusion matrix.
1005 #[serde(rename = "confidenceThreshold")]
1006 pub confidence_threshold: Option<f64>,
1007 /// One row per actual label.
1008 pub rows: Option<Vec<Row>>,
1009}
1010
1011impl common::Part for ConfusionMatrix {}
1012
1013/// A connection-level property to customize query behavior. Under JDBC, these correspond directly to connection properties passed to the DriverManager. Under ODBC, these correspond to properties in the connection string. Currently supported connection properties: * **dataset_project_id**: represents the default project for datasets that are used in the query. Setting the system variable `@@dataset_project_id` achieves the same behavior. For more information about system variables, see: https://cloud.google.com/bigquery/docs/reference/system-variables * **time_zone**: represents the default timezone used to run the query. * **session_id**: associates the query with a given session. * **query_label**: associates the query with a given job label. If set, all subsequent queries in a script or session will have this label. For the format in which a you can specify a query label, see labels in the JobConfiguration resource type: https://cloud.google.com/bigquery/docs/reference/rest/v2/Job#jobconfiguration * **service_account**: indicates the service account to use to run a continuous query. If set, the query job uses the service account to access Google Cloud resources. Service account access is bounded by the IAM permissions that you have granted to the service account. Additional properties are allowed, but ignored. Specifying multiple connection properties with the same key returns an error.
1014///
1015/// This type is not used in any activity, and only used as *part* of another schema.
1016///
1017#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1018#[serde_with::serde_as]
1019#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1020pub struct ConnectionProperty {
1021 /// The key of the property to set.
1022 pub key: Option<String>,
1023 /// The value of the property to set.
1024 pub value: Option<String>,
1025}
1026
1027impl common::Part for ConnectionProperty {}
1028
1029/// Information related to a CSV data source.
1030///
1031/// This type is not used in any activity, and only used as *part* of another schema.
1032///
1033#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1034#[serde_with::serde_as]
1035#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1036pub struct CsvOptions {
1037 /// Optional. Indicates if BigQuery should accept rows that are missing trailing optional columns. If true, BigQuery treats missing trailing columns as null values. If false, records with missing trailing columns are treated as bad records, and if there are too many bad records, an invalid error is returned in the job result. The default value is false.
1038 #[serde(rename = "allowJaggedRows")]
1039 pub allow_jagged_rows: Option<bool>,
1040 /// Optional. Indicates if BigQuery should allow quoted data sections that contain newline characters in a CSV file. The default value is false.
1041 #[serde(rename = "allowQuotedNewlines")]
1042 pub allow_quoted_newlines: Option<bool>,
1043 /// Optional. The character encoding of the data. The supported values are UTF-8, ISO-8859-1, UTF-16BE, UTF-16LE, UTF-32BE, and UTF-32LE. The default value is UTF-8. BigQuery decodes the data after the raw, binary data has been split using the values of the quote and fieldDelimiter properties.
1044 pub encoding: Option<String>,
1045 /// Optional. The separator character for fields in a CSV file. The separator is interpreted as a single byte. For files encoded in ISO-8859-1, any single character can be used as a separator. For files encoded in UTF-8, characters represented in decimal range 1-127 (U+0001-U+007F) can be used without any modification. UTF-8 characters encoded with multiple bytes (i.e. U+0080 and above) will have only the first byte used for separating fields. The remaining bytes will be treated as a part of the field. BigQuery also supports the escape sequence "\t" (U+0009) to specify a tab separator. The default value is comma (",", U+002C).
1046 #[serde(rename = "fieldDelimiter")]
1047 pub field_delimiter: Option<String>,
1048 /// Optional. Specifies a string that represents a null value in a CSV file. For example, if you specify "\N", BigQuery interprets "\N" as a null value when querying a CSV file. The default value is the empty string. If you set this property to a custom value, BigQuery throws an error if an empty string is present for all data types except for STRING and BYTE. For STRING and BYTE columns, BigQuery interprets the empty string as an empty value.
1049 #[serde(rename = "nullMarker")]
1050 pub null_marker: Option<String>,
1051 /// Optional. A list of strings represented as SQL NULL value in a CSV file. null_marker and null_markers can't be set at the same time. If null_marker is set, null_markers has to be not set. If null_markers is set, null_marker has to be not set. If both null_marker and null_markers are set at the same time, a user error would be thrown. Any strings listed in null_markers, including empty string would be interpreted as SQL NULL. This applies to all column types.
1052 #[serde(rename = "nullMarkers")]
1053 pub null_markers: Option<Vec<String>>,
1054 /// Optional. Indicates if the embedded ASCII control characters (the first 32 characters in the ASCII-table, from '\x00' to '\x1F') are preserved.
1055 #[serde(rename = "preserveAsciiControlCharacters")]
1056 pub preserve_ascii_control_characters: Option<bool>,
1057 /// Optional. The value that is used to quote data sections in a CSV file. BigQuery converts the string to ISO-8859-1 encoding, and then uses the first byte of the encoded string to split the data in its raw, binary state. The default value is a double-quote ("). If your data does not contain quoted sections, set the property value to an empty string. If your data contains quoted newline characters, you must also set the allowQuotedNewlines property to true. To include the specific quote character within a quoted value, precede it with an additional matching quote character. For example, if you want to escape the default character ' " ', use ' "" '.
1058 pub quote: Option<String>,
1059 /// Optional. The number of rows at the top of a CSV file that BigQuery will skip when reading the data. The default value is 0. This property is useful if you have header rows in the file that should be skipped. When autodetect is on, the behavior is the following: * skipLeadingRows unspecified - Autodetect tries to detect headers in the first row. If they are not detected, the row is read as data. Otherwise data is read starting from the second row. * skipLeadingRows is 0 - Instructs autodetect that there are no headers and data should be read starting from the first row. * skipLeadingRows = N > 0 - Autodetect skips N-1 rows and tries to detect headers in row N. If headers are not detected, row N is just skipped. Otherwise row N is used to extract column names for the detected schema.
1060 #[serde(rename = "skipLeadingRows")]
1061 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1062 pub skip_leading_rows: Option<i64>,
1063 /// Optional. Controls the strategy used to match loaded columns to the schema. If not set, a sensible default is chosen based on how the schema is provided. If autodetect is used, then columns are matched by name. Otherwise, columns are matched by position. This is done to keep the behavior backward-compatible. Acceptable values are: POSITION - matches by position. This assumes that the columns are ordered the same way as the schema. NAME - matches by name. This reads the header row as column names and reorders columns to match the field names in the schema.
1064 #[serde(rename = "sourceColumnMatch")]
1065 pub source_column_match: Option<String>,
1066}
1067
1068impl common::Part for CsvOptions {}
1069
1070/// Options for data format adjustments.
1071///
1072/// This type is not used in any activity, and only used as *part* of another schema.
1073///
1074#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1075#[serde_with::serde_as]
1076#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1077pub struct DataFormatOptions {
1078 /// Optional. The API output format for a timestamp. This offers more explicit control over the timestamp output format as compared to the existing `use_int64_timestamp` option.
1079 #[serde(rename = "timestampOutputFormat")]
1080 pub timestamp_output_format: Option<String>,
1081 /// Optional. Output timestamp as usec int64. Default is false.
1082 #[serde(rename = "useInt64Timestamp")]
1083 pub use_int64_timestamp: Option<bool>,
1084}
1085
1086impl common::Part for DataFormatOptions {}
1087
1088/// Statistics for data-masking.
1089///
1090/// This type is not used in any activity, and only used as *part* of another schema.
1091///
1092#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1093#[serde_with::serde_as]
1094#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1095pub struct DataMaskingStatistics {
1096 /// Whether any accessed data was protected by the data masking.
1097 #[serde(rename = "dataMaskingApplied")]
1098 pub data_masking_applied: Option<bool>,
1099}
1100
1101impl common::Part for DataMaskingStatistics {}
1102
1103/// Data policy option. For more information, see [Mask data by applying data policies to a column](https://cloud.google.com/bigquery/docs/column-data-masking#data-policies-on-column/).
1104///
1105/// This type is not used in any activity, and only used as *part* of another schema.
1106///
1107#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1108#[serde_with::serde_as]
1109#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1110pub struct DataPolicyOption {
1111 /// Data policy resource name in the form of projects/project_id/locations/location_id/dataPolicies/data_policy_id.
1112 pub name: Option<String>,
1113}
1114
1115impl common::Part for DataPolicyOption {}
1116
1117/// Data split result. This contains references to the training and evaluation data tables that were used to train the model.
1118///
1119/// This type is not used in any activity, and only used as *part* of another schema.
1120///
1121#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1122#[serde_with::serde_as]
1123#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1124pub struct DataSplitResult {
1125 /// Table reference of the evaluation data after split.
1126 #[serde(rename = "evaluationTable")]
1127 pub evaluation_table: Option<TableReference>,
1128 /// Table reference of the test data after split.
1129 #[serde(rename = "testTable")]
1130 pub test_table: Option<TableReference>,
1131 /// Table reference of the training data after split.
1132 #[serde(rename = "trainingTable")]
1133 pub training_table: Option<TableReference>,
1134}
1135
1136impl common::Part for DataSplitResult {}
1137
1138/// Represents a BigQuery dataset.
1139///
1140/// # Activities
1141///
1142/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1143/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1144///
1145/// * [delete datasets](DatasetDeleteCall) (none)
1146/// * [get datasets](DatasetGetCall) (response)
1147/// * [insert datasets](DatasetInsertCall) (request|response)
1148/// * [list datasets](DatasetListCall) (none)
1149/// * [patch datasets](DatasetPatchCall) (request|response)
1150/// * [undelete datasets](DatasetUndeleteCall) (response)
1151/// * [update datasets](DatasetUpdateCall) (request|response)
1152#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1153#[serde_with::serde_as]
1154#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1155pub struct Dataset {
1156 /// Optional. An array of objects that define dataset access for one or more entities. You can set this property when inserting or updating a dataset in order to control who is allowed to access the data. If unspecified at dataset creation time, BigQuery adds default dataset access for the following entities: access.specialGroup: projectReaders; access.role: READER; access.specialGroup: projectWriters; access.role: WRITER; access.specialGroup: projectOwners; access.role: OWNER; access.userByEmail: [dataset creator email]; access.role: OWNER; If you patch a dataset, then this field is overwritten by the patched dataset's access field. To add entities, you must supply the entire existing access array in addition to any new entities that you want to add.
1157 pub access: Option<Vec<DatasetAccess>>,
1158 /// Output only. The time when this dataset was created, in milliseconds since the epoch.
1159 #[serde(rename = "creationTime")]
1160 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1161 pub creation_time: Option<i64>,
1162 /// Required. A reference that identifies the dataset.
1163 #[serde(rename = "datasetReference")]
1164 pub dataset_reference: Option<DatasetReference>,
1165 /// Optional. Defines the default collation specification of future tables created in the dataset. If a table is created in this dataset without table-level default collation, then the table inherits the dataset default collation, which is applied to the string fields that do not have explicit collation specified. A change to this field affects only tables created afterwards, and does not alter the existing tables. The following values are supported: * 'und:ci': undetermined locale, case insensitive. * '': empty string. Default to case-sensitive behavior.
1166 #[serde(rename = "defaultCollation")]
1167 pub default_collation: Option<String>,
1168 /// The default encryption key for all tables in the dataset. After this property is set, the encryption key of all newly-created tables in the dataset is set to this value unless the table creation request or query explicitly overrides the key.
1169 #[serde(rename = "defaultEncryptionConfiguration")]
1170 pub default_encryption_configuration: Option<EncryptionConfiguration>,
1171 /// This default partition expiration, expressed in milliseconds. When new time-partitioned tables are created in a dataset where this property is set, the table will inherit this value, propagated as the `TimePartitioning.expirationMs` property on the new table. If you set `TimePartitioning.expirationMs` explicitly when creating a table, the `defaultPartitionExpirationMs` of the containing dataset is ignored. When creating a partitioned table, if `defaultPartitionExpirationMs` is set, the `defaultTableExpirationMs` value is ignored and the table will not be inherit a table expiration deadline.
1172 #[serde(rename = "defaultPartitionExpirationMs")]
1173 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1174 pub default_partition_expiration_ms: Option<i64>,
1175 /// Optional. Defines the default rounding mode specification of new tables created within this dataset. During table creation, if this field is specified, the table within this dataset will inherit the default rounding mode of the dataset. Setting the default rounding mode on a table overrides this option. Existing tables in the dataset are unaffected. If columns are defined during that table creation, they will immediately inherit the table's default rounding mode, unless otherwise specified.
1176 #[serde(rename = "defaultRoundingMode")]
1177 pub default_rounding_mode: Option<String>,
1178 /// Optional. The default lifetime of all tables in the dataset, in milliseconds. The minimum lifetime value is 3600000 milliseconds (one hour). To clear an existing default expiration with a PATCH request, set to 0. Once this property is set, all newly-created tables in the dataset will have an expirationTime property set to the creation time plus the value in this property, and changing the value will only affect new tables, not existing ones. When the expirationTime for a given table is reached, that table will be deleted automatically. If a table's expirationTime is modified or removed before the table expires, or if you provide an explicit expirationTime when creating a table, that value takes precedence over the default expiration time indicated by this property.
1179 #[serde(rename = "defaultTableExpirationMs")]
1180 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1181 pub default_table_expiration_ms: Option<i64>,
1182 /// Optional. A user-friendly description of the dataset.
1183 pub description: Option<String>,
1184 /// Output only. A hash of the resource.
1185 pub etag: Option<String>,
1186 /// Optional. Options defining open source compatible datasets living in the BigQuery catalog. Contains metadata of open source database, schema or namespace represented by the current dataset.
1187 #[serde(rename = "externalCatalogDatasetOptions")]
1188 pub external_catalog_dataset_options: Option<ExternalCatalogDatasetOptions>,
1189 /// Optional. Reference to a read-only external dataset defined in data catalogs outside of BigQuery. Filled out when the dataset type is EXTERNAL.
1190 #[serde(rename = "externalDatasetReference")]
1191 pub external_dataset_reference: Option<ExternalDatasetReference>,
1192 /// Optional. A descriptive name for the dataset.
1193 #[serde(rename = "friendlyName")]
1194 pub friendly_name: Option<String>,
1195 /// Output only. The fully-qualified unique name of the dataset in the format projectId:datasetId. The dataset name without the project name is given in the datasetId field. When creating a new dataset, leave this field blank, and instead specify the datasetId field.
1196 pub id: Option<String>,
1197 /// Optional. TRUE if the dataset and its table names are case-insensitive, otherwise FALSE. By default, this is FALSE, which means the dataset and its table names are case-sensitive. This field does not affect routine references.
1198 #[serde(rename = "isCaseInsensitive")]
1199 pub is_case_insensitive: Option<bool>,
1200 /// Output only. The resource type.
1201 pub kind: Option<String>,
1202 /// The labels associated with this dataset. You can use these to organize and group your datasets. You can set this property when inserting or updating a dataset. See [Creating and Updating Dataset Labels](https://cloud.google.com/bigquery/docs/creating-managing-labels#creating_and_updating_dataset_labels) for more information.
1203 pub labels: Option<HashMap<String, String>>,
1204 /// Output only. The date when this dataset was last modified, in milliseconds since the epoch.
1205 #[serde(rename = "lastModifiedTime")]
1206 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1207 pub last_modified_time: Option<i64>,
1208 /// Output only. Metadata about the LinkedDataset. Filled out when the dataset type is LINKED.
1209 #[serde(rename = "linkedDatasetMetadata")]
1210 pub linked_dataset_metadata: Option<LinkedDatasetMetadata>,
1211 /// Optional. The source dataset reference when the dataset is of type LINKED. For all other dataset types it is not set. This field cannot be updated once it is set. Any attempt to update this field using Update and Patch API Operations will be ignored.
1212 #[serde(rename = "linkedDatasetSource")]
1213 pub linked_dataset_source: Option<LinkedDatasetSource>,
1214 /// The geographic location where the dataset should reside. See https://cloud.google.com/bigquery/docs/locations for supported locations.
1215 pub location: Option<String>,
1216 /// Optional. Defines the time travel window in hours. The value can be from 48 to 168 hours (2 to 7 days). The default value is 168 hours if this is not set.
1217 #[serde(rename = "maxTimeTravelHours")]
1218 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1219 pub max_time_travel_hours: Option<i64>,
1220 /// Optional. The [tags](https://cloud.google.com/bigquery/docs/tags) attached to this dataset. Tag keys are globally unique. Tag key is expected to be in the namespaced format, for example "123456789012/environment" where 123456789012 is the ID of the parent organization or project resource for this tag key. Tag value is expected to be the short name, for example "Production". See [Tag definitions](https://cloud.google.com/iam/docs/tags-access-control#definitions) for more details.
1221 #[serde(rename = "resourceTags")]
1222 pub resource_tags: Option<HashMap<String, String>>,
1223 /// Optional. Output only. Restriction config for all tables and dataset. If set, restrict certain accesses on the dataset and all its tables based on the config. See [Data egress](https://cloud.google.com/bigquery/docs/analytics-hub-introduction#data_egress) for more details.
1224 pub restrictions: Option<RestrictionConfig>,
1225 /// Output only. Reserved for future use.
1226 #[serde(rename = "satisfiesPzi")]
1227 pub satisfies_pzi: Option<bool>,
1228 /// Output only. Reserved for future use.
1229 #[serde(rename = "satisfiesPzs")]
1230 pub satisfies_pzs: Option<bool>,
1231 /// Output only. A URL that can be used to access the resource again. You can use this URL in Get or Update requests to the resource.
1232 #[serde(rename = "selfLink")]
1233 pub self_link: Option<String>,
1234 /// Optional. Updates storage_billing_model for the dataset.
1235 #[serde(rename = "storageBillingModel")]
1236 pub storage_billing_model: Option<String>,
1237 /// Output only. Tags for the dataset. To provide tags as inputs, use the `resourceTags` field.
1238 pub tags: Option<Vec<DatasetTags>>,
1239 /// Output only. Same as `type` in `ListFormatDataset`. The type of the dataset, one of: * DEFAULT - only accessible by owner and authorized accounts, * PUBLIC - accessible by everyone, * LINKED - linked dataset, * EXTERNAL - dataset with definition in external metadata catalog.
1240 #[serde(rename = "type")]
1241 pub type_: Option<String>,
1242}
1243
1244impl common::RequestValue for Dataset {}
1245impl common::Resource for Dataset {}
1246impl common::ResponseResult for Dataset {}
1247
1248/// Grants all resources of particular types in a particular dataset read access to the current dataset. Similar to how individually authorized views work, updates to any resource granted through its dataset (including creation of new resources) requires read permission to referenced resources, plus write permission to the authorizing dataset.
1249///
1250/// This type is not used in any activity, and only used as *part* of another schema.
1251///
1252#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1253#[serde_with::serde_as]
1254#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1255pub struct DatasetAccessEntry {
1256 /// The dataset this entry applies to
1257 pub dataset: Option<DatasetReference>,
1258 /// Which resources in the dataset this entry applies to. Currently, only views are supported, but additional target types may be added in the future.
1259 #[serde(rename = "targetTypes")]
1260 pub target_types: Option<Vec<String>>,
1261}
1262
1263impl common::Part for DatasetAccessEntry {}
1264
1265/// Response format for a page of results when listing datasets.
1266///
1267/// # Activities
1268///
1269/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1270/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1271///
1272/// * [list datasets](DatasetListCall) (response)
1273#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1274#[serde_with::serde_as]
1275#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1276pub struct DatasetList {
1277 /// An array of the dataset resources in the project. Each resource contains basic information. For full information about a particular dataset resource, use the Datasets: get method. This property is omitted when there are no datasets in the project.
1278 pub datasets: Option<Vec<DatasetListDatasets>>,
1279 /// Output only. A hash value of the results page. You can use this property to determine if the page has changed since the last request.
1280 pub etag: Option<String>,
1281 /// Output only. The resource type. This property always returns the value "bigquery#datasetList"
1282 pub kind: Option<String>,
1283 /// A token that can be used to request the next results page. This property is omitted on the final results page.
1284 #[serde(rename = "nextPageToken")]
1285 pub next_page_token: Option<String>,
1286 /// A list of skipped locations that were unreachable. For more information about BigQuery locations, see: https://cloud.google.com/bigquery/docs/locations. Example: "europe-west5"
1287 pub unreachable: Option<Vec<String>>,
1288}
1289
1290impl common::ResponseResult for DatasetList {}
1291
1292/// Identifier for a dataset.
1293///
1294/// This type is not used in any activity, and only used as *part* of another schema.
1295///
1296#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1297#[serde_with::serde_as]
1298#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1299pub struct DatasetReference {
1300 /// Required. A unique ID for this dataset, without the project name. The ID must contain only letters (a-z, A-Z), numbers (0-9), or underscores (_). The maximum length is 1,024 characters.
1301 #[serde(rename = "datasetId")]
1302 pub dataset_id: Option<String>,
1303 /// Optional. The ID of the project containing this dataset.
1304 #[serde(rename = "projectId")]
1305 pub project_id: Option<String>,
1306}
1307
1308impl common::Part for DatasetReference {}
1309
1310/// Properties for the destination table.
1311///
1312/// This type is not used in any activity, and only used as *part* of another schema.
1313///
1314#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1315#[serde_with::serde_as]
1316#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1317pub struct DestinationTableProperties {
1318 /// Optional. The description for the destination table. This will only be used if the destination table is newly created. If the table already exists and a value different than the current description is provided, the job will fail.
1319 pub description: Option<String>,
1320 /// Internal use only.
1321 #[serde(rename = "expirationTime")]
1322 pub expiration_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1323 /// Optional. Friendly name for the destination table. If the table already exists, it should be same as the existing friendly name.
1324 #[serde(rename = "friendlyName")]
1325 pub friendly_name: Option<String>,
1326 /// Optional. The labels associated with this table. You can use these to organize and group your tables. This will only be used if the destination table is newly created. If the table already exists and labels are different than the current labels are provided, the job will fail.
1327 pub labels: Option<HashMap<String, String>>,
1328}
1329
1330impl common::Part for DestinationTableProperties {}
1331
1332/// Represents privacy policy associated with "differential privacy" method.
1333///
1334/// This type is not used in any activity, and only used as *part* of another schema.
1335///
1336#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1337#[serde_with::serde_as]
1338#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1339pub struct DifferentialPrivacyPolicy {
1340 /// Optional. The total delta budget for all queries against the privacy-protected view. Each subscriber query against this view charges the amount of delta that is pre-defined by the contributor through the privacy policy delta_per_query field. If there is sufficient budget, then the subscriber query attempts to complete. It might still fail due to other reasons, in which case the charge is refunded. If there is insufficient budget the query is rejected. There might be multiple charge attempts if a single query references multiple views. In this case there must be sufficient budget for all charges or the query is rejected and charges are refunded in best effort. The budget does not have a refresh policy and can only be updated via ALTER VIEW or circumvented by creating a new view that can be queried with a fresh budget.
1341 #[serde(rename = "deltaBudget")]
1342 pub delta_budget: Option<f64>,
1343 /// Output only. The delta budget remaining. If budget is exhausted, no more queries are allowed. Note that the budget for queries that are in progress is deducted before the query executes. If the query fails or is cancelled then the budget is refunded. In this case the amount of budget remaining can increase.
1344 #[serde(rename = "deltaBudgetRemaining")]
1345 pub delta_budget_remaining: Option<f64>,
1346 /// Optional. The delta value that is used per query. Delta represents the probability that any row will fail to be epsilon differentially private. Indicates the risk associated with exposing aggregate rows in the result of a query.
1347 #[serde(rename = "deltaPerQuery")]
1348 pub delta_per_query: Option<f64>,
1349 /// Optional. The total epsilon budget for all queries against the privacy-protected view. Each subscriber query against this view charges the amount of epsilon they request in their query. If there is sufficient budget, then the subscriber query attempts to complete. It might still fail due to other reasons, in which case the charge is refunded. If there is insufficient budget the query is rejected. There might be multiple charge attempts if a single query references multiple views. In this case there must be sufficient budget for all charges or the query is rejected and charges are refunded in best effort. The budget does not have a refresh policy and can only be updated via ALTER VIEW or circumvented by creating a new view that can be queried with a fresh budget.
1350 #[serde(rename = "epsilonBudget")]
1351 pub epsilon_budget: Option<f64>,
1352 /// Output only. The epsilon budget remaining. If budget is exhausted, no more queries are allowed. Note that the budget for queries that are in progress is deducted before the query executes. If the query fails or is cancelled then the budget is refunded. In this case the amount of budget remaining can increase.
1353 #[serde(rename = "epsilonBudgetRemaining")]
1354 pub epsilon_budget_remaining: Option<f64>,
1355 /// Optional. The maximum epsilon value that a query can consume. If the subscriber specifies epsilon as a parameter in a SELECT query, it must be less than or equal to this value. The epsilon parameter controls the amount of noise that is added to the groups — a higher epsilon means less noise.
1356 #[serde(rename = "maxEpsilonPerQuery")]
1357 pub max_epsilon_per_query: Option<f64>,
1358 /// Optional. The maximum groups contributed value that is used per query. Represents the maximum number of groups to which each protected entity can contribute. Changing this value does not improve or worsen privacy. The best value for accuracy and utility depends on the query and data.
1359 #[serde(rename = "maxGroupsContributed")]
1360 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1361 pub max_groups_contributed: Option<i64>,
1362 /// Optional. The privacy unit column associated with this policy. Differential privacy policies can only have one privacy unit column per data source object (table, view).
1363 #[serde(rename = "privacyUnitColumn")]
1364 pub privacy_unit_column: Option<String>,
1365}
1366
1367impl common::Part for DifferentialPrivacyPolicy {}
1368
1369/// Model evaluation metrics for dimensionality reduction models.
1370///
1371/// This type is not used in any activity, and only used as *part* of another schema.
1372///
1373#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1374#[serde_with::serde_as]
1375#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1376pub struct DimensionalityReductionMetrics {
1377 /// Total percentage of variance explained by the selected principal components.
1378 #[serde(rename = "totalExplainedVarianceRatio")]
1379 pub total_explained_variance_ratio: Option<f64>,
1380}
1381
1382impl common::Part for DimensionalityReductionMetrics {}
1383
1384/// Detailed statistics for DML statements
1385///
1386/// This type is not used in any activity, and only used as *part* of another schema.
1387///
1388#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1389#[serde_with::serde_as]
1390#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1391pub struct DmlStatistics {
1392 /// Output only. Number of deleted Rows. populated by DML DELETE, MERGE and TRUNCATE statements.
1393 #[serde(rename = "deletedRowCount")]
1394 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1395 pub deleted_row_count: Option<i64>,
1396 /// Output only. Number of inserted Rows. Populated by DML INSERT and MERGE statements
1397 #[serde(rename = "insertedRowCount")]
1398 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1399 pub inserted_row_count: Option<i64>,
1400 /// Output only. Number of updated Rows. Populated by DML UPDATE and MERGE statements.
1401 #[serde(rename = "updatedRowCount")]
1402 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1403 pub updated_row_count: Option<i64>,
1404}
1405
1406impl common::Part for DmlStatistics {}
1407
1408/// Discrete candidates of a double hyperparameter.
1409///
1410/// This type is not used in any activity, and only used as *part* of another schema.
1411///
1412#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1413#[serde_with::serde_as]
1414#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1415pub struct DoubleCandidates {
1416 /// Candidates for the double parameter in increasing order.
1417 pub candidates: Option<Vec<f64>>,
1418}
1419
1420impl common::Part for DoubleCandidates {}
1421
1422/// Search space for a double hyperparameter.
1423///
1424/// This type is not used in any activity, and only used as *part* of another schema.
1425///
1426#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1427#[serde_with::serde_as]
1428#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1429pub struct DoubleHparamSearchSpace {
1430 /// Candidates of the double hyperparameter.
1431 pub candidates: Option<DoubleCandidates>,
1432 /// Range of the double hyperparameter.
1433 pub range: Option<DoubleRange>,
1434}
1435
1436impl common::Part for DoubleHparamSearchSpace {}
1437
1438/// Range of a double hyperparameter.
1439///
1440/// This type is not used in any activity, and only used as *part* of another schema.
1441///
1442#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1443#[serde_with::serde_as]
1444#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1445pub struct DoubleRange {
1446 /// Max value of the double parameter.
1447 pub max: Option<f64>,
1448 /// Min value of the double parameter.
1449 pub min: Option<f64>,
1450}
1451
1452impl common::Part for DoubleRange {}
1453
1454/// Configuration for Cloud KMS encryption settings.
1455///
1456/// This type is not used in any activity, and only used as *part* of another schema.
1457///
1458#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1459#[serde_with::serde_as]
1460#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1461pub struct EncryptionConfiguration {
1462 /// Optional. Describes the Cloud KMS encryption key that will be used to protect destination BigQuery table. The BigQuery Service Account associated with your project requires access to this encryption key.
1463 #[serde(rename = "kmsKeyName")]
1464 pub kms_key_name: Option<String>,
1465}
1466
1467impl common::Part for EncryptionConfiguration {}
1468
1469/// A single entry in the confusion matrix.
1470///
1471/// This type is not used in any activity, and only used as *part* of another schema.
1472///
1473#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1474#[serde_with::serde_as]
1475#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1476pub struct Entry {
1477 /// Number of items being predicted as this label.
1478 #[serde(rename = "itemCount")]
1479 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1480 pub item_count: Option<i64>,
1481 /// The predicted label. For confidence_threshold > 0, we will also add an entry indicating the number of items under the confidence threshold.
1482 #[serde(rename = "predictedLabel")]
1483 pub predicted_label: Option<String>,
1484}
1485
1486impl common::Part for Entry {}
1487
1488/// Error details.
1489///
1490/// This type is not used in any activity, and only used as *part* of another schema.
1491///
1492#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1493#[serde_with::serde_as]
1494#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1495pub struct ErrorProto {
1496 /// Debugging information. This property is internal to Google and should not be used.
1497 #[serde(rename = "debugInfo")]
1498 pub debug_info: Option<String>,
1499 /// Specifies where the error occurred, if present.
1500 pub location: Option<String>,
1501 /// A human-readable description of the error.
1502 pub message: Option<String>,
1503 /// A short error code that summarizes the error.
1504 pub reason: Option<String>,
1505}
1506
1507impl common::Part for ErrorProto {}
1508
1509/// Evaluation metrics of a model. These are either computed on all training data or just the eval data based on whether eval data was used during training. These are not present for imported models.
1510///
1511/// This type is not used in any activity, and only used as *part* of another schema.
1512///
1513#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1514#[serde_with::serde_as]
1515#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1516pub struct EvaluationMetrics {
1517 /// Populated for ARIMA models.
1518 #[serde(rename = "arimaForecastingMetrics")]
1519 pub arima_forecasting_metrics: Option<ArimaForecastingMetrics>,
1520 /// Populated for binary classification/classifier models.
1521 #[serde(rename = "binaryClassificationMetrics")]
1522 pub binary_classification_metrics: Option<BinaryClassificationMetrics>,
1523 /// Populated for clustering models.
1524 #[serde(rename = "clusteringMetrics")]
1525 pub clustering_metrics: Option<ClusteringMetrics>,
1526 /// Evaluation metrics when the model is a dimensionality reduction model, which currently includes PCA.
1527 #[serde(rename = "dimensionalityReductionMetrics")]
1528 pub dimensionality_reduction_metrics: Option<DimensionalityReductionMetrics>,
1529 /// Populated for multi-class classification/classifier models.
1530 #[serde(rename = "multiClassClassificationMetrics")]
1531 pub multi_class_classification_metrics: Option<MultiClassClassificationMetrics>,
1532 /// Populated for implicit feedback type matrix factorization models.
1533 #[serde(rename = "rankingMetrics")]
1534 pub ranking_metrics: Option<RankingMetrics>,
1535 /// Populated for regression models and explicit feedback type matrix factorization models.
1536 #[serde(rename = "regressionMetrics")]
1537 pub regression_metrics: Option<RegressionMetrics>,
1538}
1539
1540impl common::Part for EvaluationMetrics {}
1541
1542/// A single stage of query execution.
1543///
1544/// This type is not used in any activity, and only used as *part* of another schema.
1545///
1546#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1547#[serde_with::serde_as]
1548#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1549pub struct ExplainQueryStage {
1550 /// Number of parallel input segments completed.
1551 #[serde(rename = "completedParallelInputs")]
1552 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1553 pub completed_parallel_inputs: Option<i64>,
1554 /// Output only. Compute mode for this stage.
1555 #[serde(rename = "computeMode")]
1556 pub compute_mode: Option<String>,
1557 /// Milliseconds the average shard spent on CPU-bound tasks.
1558 #[serde(rename = "computeMsAvg")]
1559 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1560 pub compute_ms_avg: Option<i64>,
1561 /// Milliseconds the slowest shard spent on CPU-bound tasks.
1562 #[serde(rename = "computeMsMax")]
1563 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1564 pub compute_ms_max: Option<i64>,
1565 /// Relative amount of time the average shard spent on CPU-bound tasks.
1566 #[serde(rename = "computeRatioAvg")]
1567 pub compute_ratio_avg: Option<f64>,
1568 /// Relative amount of time the slowest shard spent on CPU-bound tasks.
1569 #[serde(rename = "computeRatioMax")]
1570 pub compute_ratio_max: Option<f64>,
1571 /// Stage end time represented as milliseconds since the epoch.
1572 #[serde(rename = "endMs")]
1573 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1574 pub end_ms: Option<i64>,
1575 /// Unique ID for the stage within the plan.
1576 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1577 pub id: Option<i64>,
1578 /// IDs for stages that are inputs to this stage.
1579 #[serde(rename = "inputStages")]
1580 #[serde_as(as = "Option<Vec<serde_with::DisplayFromStr>>")]
1581 pub input_stages: Option<Vec<i64>>,
1582 /// Human-readable name for the stage.
1583 pub name: Option<String>,
1584 /// Number of parallel input segments to be processed
1585 #[serde(rename = "parallelInputs")]
1586 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1587 pub parallel_inputs: Option<i64>,
1588 /// Milliseconds the average shard spent reading input.
1589 #[serde(rename = "readMsAvg")]
1590 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1591 pub read_ms_avg: Option<i64>,
1592 /// Milliseconds the slowest shard spent reading input.
1593 #[serde(rename = "readMsMax")]
1594 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1595 pub read_ms_max: Option<i64>,
1596 /// Relative amount of time the average shard spent reading input.
1597 #[serde(rename = "readRatioAvg")]
1598 pub read_ratio_avg: Option<f64>,
1599 /// Relative amount of time the slowest shard spent reading input.
1600 #[serde(rename = "readRatioMax")]
1601 pub read_ratio_max: Option<f64>,
1602 /// Number of records read into the stage.
1603 #[serde(rename = "recordsRead")]
1604 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1605 pub records_read: Option<i64>,
1606 /// Number of records written by the stage.
1607 #[serde(rename = "recordsWritten")]
1608 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1609 pub records_written: Option<i64>,
1610 /// Total number of bytes written to shuffle.
1611 #[serde(rename = "shuffleOutputBytes")]
1612 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1613 pub shuffle_output_bytes: Option<i64>,
1614 /// Total number of bytes written to shuffle and spilled to disk.
1615 #[serde(rename = "shuffleOutputBytesSpilled")]
1616 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1617 pub shuffle_output_bytes_spilled: Option<i64>,
1618 /// Slot-milliseconds used by the stage.
1619 #[serde(rename = "slotMs")]
1620 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1621 pub slot_ms: Option<i64>,
1622 /// Stage start time represented as milliseconds since the epoch.
1623 #[serde(rename = "startMs")]
1624 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1625 pub start_ms: Option<i64>,
1626 /// Current status for this stage.
1627 pub status: Option<String>,
1628 /// List of operations within the stage in dependency order (approximately chronological).
1629 pub steps: Option<Vec<ExplainQueryStep>>,
1630 /// Milliseconds the average shard spent waiting to be scheduled.
1631 #[serde(rename = "waitMsAvg")]
1632 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1633 pub wait_ms_avg: Option<i64>,
1634 /// Milliseconds the slowest shard spent waiting to be scheduled.
1635 #[serde(rename = "waitMsMax")]
1636 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1637 pub wait_ms_max: Option<i64>,
1638 /// Relative amount of time the average shard spent waiting to be scheduled.
1639 #[serde(rename = "waitRatioAvg")]
1640 pub wait_ratio_avg: Option<f64>,
1641 /// Relative amount of time the slowest shard spent waiting to be scheduled.
1642 #[serde(rename = "waitRatioMax")]
1643 pub wait_ratio_max: Option<f64>,
1644 /// Milliseconds the average shard spent on writing output.
1645 #[serde(rename = "writeMsAvg")]
1646 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1647 pub write_ms_avg: Option<i64>,
1648 /// Milliseconds the slowest shard spent on writing output.
1649 #[serde(rename = "writeMsMax")]
1650 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1651 pub write_ms_max: Option<i64>,
1652 /// Relative amount of time the average shard spent on writing output.
1653 #[serde(rename = "writeRatioAvg")]
1654 pub write_ratio_avg: Option<f64>,
1655 /// Relative amount of time the slowest shard spent on writing output.
1656 #[serde(rename = "writeRatioMax")]
1657 pub write_ratio_max: Option<f64>,
1658}
1659
1660impl common::Part for ExplainQueryStage {}
1661
1662/// An operation within a stage.
1663///
1664/// This type is not used in any activity, and only used as *part* of another schema.
1665///
1666#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1667#[serde_with::serde_as]
1668#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1669pub struct ExplainQueryStep {
1670 /// Machine-readable operation type.
1671 pub kind: Option<String>,
1672 /// Human-readable description of the step(s).
1673 pub substeps: Option<Vec<String>>,
1674}
1675
1676impl common::Part for ExplainQueryStep {}
1677
1678/// Explanation for a single feature.
1679///
1680/// This type is not used in any activity, and only used as *part* of another schema.
1681///
1682#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1683#[serde_with::serde_as]
1684#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1685pub struct Explanation {
1686 /// Attribution of feature.
1687 pub attribution: Option<f64>,
1688 /// The full feature name. For non-numerical features, will be formatted like `.`. Overall size of feature name will always be truncated to first 120 characters.
1689 #[serde(rename = "featureName")]
1690 pub feature_name: Option<String>,
1691}
1692
1693impl common::Part for Explanation {}
1694
1695/// Statistics for the EXPORT DATA statement as part of Query Job. EXTRACT JOB statistics are populated in JobStatistics4.
1696///
1697/// This type is not used in any activity, and only used as *part* of another schema.
1698///
1699#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1700#[serde_with::serde_as]
1701#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1702pub struct ExportDataStatistics {
1703 /// Number of destination files generated in case of EXPORT DATA statement only.
1704 #[serde(rename = "fileCount")]
1705 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1706 pub file_count: Option<i64>,
1707 /// [Alpha] Number of destination rows generated in case of EXPORT DATA statement only.
1708 #[serde(rename = "rowCount")]
1709 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1710 pub row_count: Option<i64>,
1711}
1712
1713impl common::Part for ExportDataStatistics {}
1714
1715/// Represents a textual expression in the Common Expression Language (CEL) syntax. CEL is a C-like expression language. The syntax and semantics of CEL are documented at https://github.com/google/cel-spec. Example (Comparison): title: "Summary size limit" description: "Determines if a summary is less than 100 chars" expression: "document.summary.size() < 100" Example (Equality): title: "Requestor is owner" description: "Determines if requestor is the document owner" expression: "document.owner == request.auth.claims.email" Example (Logic): title: "Public documents" description: "Determine whether the document should be publicly visible" expression: "document.type != 'private' && document.type != 'internal'" Example (Data Manipulation): title: "Notification string" description: "Create a notification string with a timestamp." expression: "'New message received at ' + string(document.create_time)" The exact variables and functions that may be referenced within an expression are determined by the service that evaluates it. See the service documentation for additional information.
1716///
1717/// This type is not used in any activity, and only used as *part* of another schema.
1718///
1719#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1720#[serde_with::serde_as]
1721#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1722pub struct Expr {
1723 /// Optional. Description of the expression. This is a longer text which describes the expression, e.g. when hovered over it in a UI.
1724 pub description: Option<String>,
1725 /// Textual representation of an expression in Common Expression Language syntax.
1726 pub expression: Option<String>,
1727 /// Optional. String indicating the location of the expression for error reporting, e.g. a file name and a position in the file.
1728 pub location: Option<String>,
1729 /// Optional. Title for the expression, i.e. a short string describing its purpose. This can be used e.g. in UIs which allow to enter the expression.
1730 pub title: Option<String>,
1731}
1732
1733impl common::Part for Expr {}
1734
1735/// Options defining open source compatible datasets living in the BigQuery catalog. Contains metadata of open source database, schema, or namespace represented by the current dataset.
1736///
1737/// This type is not used in any activity, and only used as *part* of another schema.
1738///
1739#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1740#[serde_with::serde_as]
1741#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1742pub struct ExternalCatalogDatasetOptions {
1743 /// Optional. The storage location URI for all tables in the dataset. Equivalent to hive metastore's database locationUri. Maximum length of 1024 characters.
1744 #[serde(rename = "defaultStorageLocationUri")]
1745 pub default_storage_location_uri: Option<String>,
1746 /// Optional. A map of key value pairs defining the parameters and properties of the open source schema. Maximum size of 2MiB.
1747 pub parameters: Option<HashMap<String, String>>,
1748}
1749
1750impl common::Part for ExternalCatalogDatasetOptions {}
1751
1752/// Metadata about open source compatible table. The fields contained in these options correspond to Hive metastore's table-level properties.
1753///
1754/// This type is not used in any activity, and only used as *part* of another schema.
1755///
1756#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1757#[serde_with::serde_as]
1758#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1759pub struct ExternalCatalogTableOptions {
1760 /// Optional. A connection ID that specifies the credentials to be used to read external storage, such as Azure Blob, Cloud Storage, or Amazon S3. This connection is needed to read the open source table from BigQuery. The connection_id format must be either `..` or `projects//locations//connections/`.
1761 #[serde(rename = "connectionId")]
1762 pub connection_id: Option<String>,
1763 /// Optional. A map of the key-value pairs defining the parameters and properties of the open source table. Corresponds with Hive metastore table parameters. Maximum size of 4MiB.
1764 pub parameters: Option<HashMap<String, String>>,
1765 /// Optional. A storage descriptor containing information about the physical storage of this table.
1766 #[serde(rename = "storageDescriptor")]
1767 pub storage_descriptor: Option<StorageDescriptor>,
1768}
1769
1770impl common::Part for ExternalCatalogTableOptions {}
1771
1772/// There is no detailed description.
1773///
1774/// This type is not used in any activity, and only used as *part* of another schema.
1775///
1776#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1777#[serde_with::serde_as]
1778#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1779pub struct ExternalDataConfiguration {
1780 /// Try to detect schema and format options automatically. Any option specified explicitly will be honored.
1781 pub autodetect: Option<bool>,
1782 /// Optional. Additional properties to set if sourceFormat is set to AVRO.
1783 #[serde(rename = "avroOptions")]
1784 pub avro_options: Option<AvroOptions>,
1785 /// Optional. Additional options if sourceFormat is set to BIGTABLE.
1786 #[serde(rename = "bigtableOptions")]
1787 pub bigtable_options: Option<BigtableOptions>,
1788 /// Optional. The compression type of the data source. Possible values include GZIP and NONE. The default value is NONE. This setting is ignored for Google Cloud Bigtable, Google Cloud Datastore backups, Avro, ORC and Parquet formats. An empty string is an invalid value.
1789 pub compression: Option<String>,
1790 /// Optional. The connection specifying the credentials to be used to read external storage, such as Azure Blob, Cloud Storage, or S3. The connection_id can have the form `{project_id}.{location_id};{connection_id}` or `projects/{project_id}/locations/{location_id}/connections/{connection_id}`.
1791 #[serde(rename = "connectionId")]
1792 pub connection_id: Option<String>,
1793 /// Optional. Additional properties to set if sourceFormat is set to CSV.
1794 #[serde(rename = "csvOptions")]
1795 pub csv_options: Option<CsvOptions>,
1796 /// Optional. Format used to parse DATE values. Supports C-style and SQL-style values.
1797 #[serde(rename = "dateFormat")]
1798 pub date_format: Option<String>,
1799 /// Optional. Format used to parse DATETIME values. Supports C-style and SQL-style values.
1800 #[serde(rename = "datetimeFormat")]
1801 pub datetime_format: Option<String>,
1802 /// Defines the list of possible SQL data types to which the source decimal values are converted. This list and the precision and the scale parameters of the decimal field determine the target type. In the order of NUMERIC, BIGNUMERIC, and STRING, a type is picked if it is in the specified list and if it supports the precision and the scale. STRING supports all precision and scale values. If none of the listed types supports the precision and the scale, the type supporting the widest range in the specified list is picked, and if a value exceeds the supported range when reading the data, an error will be thrown. Example: Suppose the value of this field is ["NUMERIC", "BIGNUMERIC"]. If (precision,scale) is: * (38,9) -> NUMERIC; * (39,9) -> BIGNUMERIC (NUMERIC cannot hold 30 integer digits); * (38,10) -> BIGNUMERIC (NUMERIC cannot hold 10 fractional digits); * (76,38) -> BIGNUMERIC; * (77,38) -> BIGNUMERIC (error if value exceeds supported range). This field cannot contain duplicate types. The order of the types in this field is ignored. For example, ["BIGNUMERIC", "NUMERIC"] is the same as ["NUMERIC", "BIGNUMERIC"] and NUMERIC always takes precedence over BIGNUMERIC. Defaults to ["NUMERIC", "STRING"] for ORC and ["NUMERIC"] for the other file formats.
1803 #[serde(rename = "decimalTargetTypes")]
1804 pub decimal_target_types: Option<Vec<String>>,
1805 /// Optional. Specifies how source URIs are interpreted for constructing the file set to load. By default source URIs are expanded against the underlying storage. Other options include specifying manifest files. Only applicable to object storage systems.
1806 #[serde(rename = "fileSetSpecType")]
1807 pub file_set_spec_type: Option<String>,
1808 /// Optional. Additional options if sourceFormat is set to GOOGLE_SHEETS.
1809 #[serde(rename = "googleSheetsOptions")]
1810 pub google_sheets_options: Option<GoogleSheetsOptions>,
1811 /// Optional. When set, configures hive partitioning support. Not all storage formats support hive partitioning -- requesting hive partitioning on an unsupported format will lead to an error, as will providing an invalid specification.
1812 #[serde(rename = "hivePartitioningOptions")]
1813 pub hive_partitioning_options: Option<HivePartitioningOptions>,
1814 /// Optional. Indicates if BigQuery should allow extra values that are not represented in the table schema. If true, the extra values are ignored. If false, records with extra columns are treated as bad records, and if there are too many bad records, an invalid error is returned in the job result. The default value is false. The sourceFormat property determines what BigQuery treats as an extra value: CSV: Trailing columns JSON: Named values that don't match any column names Google Cloud Bigtable: This setting is ignored. Google Cloud Datastore backups: This setting is ignored. Avro: This setting is ignored. ORC: This setting is ignored. Parquet: This setting is ignored.
1815 #[serde(rename = "ignoreUnknownValues")]
1816 pub ignore_unknown_values: Option<bool>,
1817 /// Optional. Load option to be used together with source_format newline-delimited JSON to indicate that a variant of JSON is being loaded. To load newline-delimited GeoJSON, specify GEOJSON (and source_format must be set to NEWLINE_DELIMITED_JSON).
1818 #[serde(rename = "jsonExtension")]
1819 pub json_extension: Option<String>,
1820 /// Optional. Additional properties to set if sourceFormat is set to JSON.
1821 #[serde(rename = "jsonOptions")]
1822 pub json_options: Option<JsonOptions>,
1823 /// Optional. The maximum number of bad records that BigQuery can ignore when reading data. If the number of bad records exceeds this value, an invalid error is returned in the job result. The default value is 0, which requires that all records are valid. This setting is ignored for Google Cloud Bigtable, Google Cloud Datastore backups, Avro, ORC and Parquet formats.
1824 #[serde(rename = "maxBadRecords")]
1825 pub max_bad_records: Option<i32>,
1826 /// Optional. Metadata Cache Mode for the table. Set this to enable caching of metadata from external data source.
1827 #[serde(rename = "metadataCacheMode")]
1828 pub metadata_cache_mode: Option<String>,
1829 /// Optional. ObjectMetadata is used to create Object Tables. Object Tables contain a listing of objects (with their metadata) found at the source_uris. If ObjectMetadata is set, source_format should be omitted. Currently SIMPLE is the only supported Object Metadata type.
1830 #[serde(rename = "objectMetadata")]
1831 pub object_metadata: Option<String>,
1832 /// Optional. Additional properties to set if sourceFormat is set to PARQUET.
1833 #[serde(rename = "parquetOptions")]
1834 pub parquet_options: Option<ParquetOptions>,
1835 /// Optional. When creating an external table, the user can provide a reference file with the table schema. This is enabled for the following formats: AVRO, PARQUET, ORC.
1836 #[serde(rename = "referenceFileSchemaUri")]
1837 pub reference_file_schema_uri: Option<String>,
1838 /// Optional. The schema for the data. Schema is required for CSV and JSON formats if autodetect is not on. Schema is disallowed for Google Cloud Bigtable, Cloud Datastore backups, Avro, ORC and Parquet formats.
1839 pub schema: Option<TableSchema>,
1840 /// [Required] The data format. For CSV files, specify "CSV". For Google sheets, specify "GOOGLE_SHEETS". For newline-delimited JSON, specify "NEWLINE_DELIMITED_JSON". For Avro files, specify "AVRO". For Google Cloud Datastore backups, specify "DATASTORE_BACKUP". For Apache Iceberg tables, specify "ICEBERG". For ORC files, specify "ORC". For Parquet files, specify "PARQUET". [Beta] For Google Cloud Bigtable, specify "BIGTABLE".
1841 #[serde(rename = "sourceFormat")]
1842 pub source_format: Option<String>,
1843 /// [Required] The fully-qualified URIs that point to your data in Google Cloud. For Google Cloud Storage URIs: Each URI can contain one '*' wildcard character and it must come after the 'bucket' name. Size limits related to load jobs apply to external data sources. For Google Cloud Bigtable URIs: Exactly one URI can be specified and it has be a fully specified and valid HTTPS URL for a Google Cloud Bigtable table. For Google Cloud Datastore backups, exactly one URI can be specified. Also, the '*' wildcard character is not allowed.
1844 #[serde(rename = "sourceUris")]
1845 pub source_uris: Option<Vec<String>>,
1846 /// Optional. Format used to parse TIME values. Supports C-style and SQL-style values.
1847 #[serde(rename = "timeFormat")]
1848 pub time_format: Option<String>,
1849 /// Optional. Time zone used when parsing timestamp values that do not have specific time zone information (e.g. 2024-04-20 12:34:56). The expected format is a IANA timezone string (e.g. America/Los_Angeles).
1850 #[serde(rename = "timeZone")]
1851 pub time_zone: Option<String>,
1852 /// Optional. Format used to parse TIMESTAMP values. Supports C-style and SQL-style values.
1853 #[serde(rename = "timestampFormat")]
1854 pub timestamp_format: Option<String>,
1855 /// Precisions (maximum number of total digits in base 10) for seconds of TIMESTAMP types that are allowed to the destination table for autodetection mode. Available for the formats: CSV. For the CSV Format, Possible values include: Not Specified, [], or [6]: timestamp(6) for all auto detected TIMESTAMP columns [6, 12]: timestamp(6) for all auto detected TIMESTAMP columns that have less than 6 digits of subseconds. timestamp(12) for all auto detected TIMESTAMP columns that have more than 6 digits of subseconds. [12]: timestamp(12) for all auto detected TIMESTAMP columns. The order of the elements in this array is ignored. Inputs that have higher precision than the highest target precision in this array will be truncated.
1856 #[serde(rename = "timestampTargetPrecision")]
1857 pub timestamp_target_precision: Option<Vec<i32>>,
1858}
1859
1860impl common::Part for ExternalDataConfiguration {}
1861
1862/// Configures the access a dataset defined in an external metadata storage.
1863///
1864/// This type is not used in any activity, and only used as *part* of another schema.
1865///
1866#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1867#[serde_with::serde_as]
1868#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1869pub struct ExternalDatasetReference {
1870 /// Required. The connection id that is used to access the external_source. Format: projects/{project_id}/locations/{location_id}/connections/{connection_id}
1871 pub connection: Option<String>,
1872 /// Required. External source that backs this dataset.
1873 #[serde(rename = "externalSource")]
1874 pub external_source: Option<String>,
1875}
1876
1877impl common::Part for ExternalDatasetReference {}
1878
1879/// Options for the runtime of the external system.
1880///
1881/// This type is not used in any activity, and only used as *part* of another schema.
1882///
1883#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1884#[serde_with::serde_as]
1885#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1886pub struct ExternalRuntimeOptions {
1887 /// Optional. Amount of CPU provisioned for a Python UDF container instance. For more information, see [Configure container limits for Python UDFs](https://cloud.google.com/bigquery/docs/user-defined-functions-python#configure-container-limits)
1888 #[serde(rename = "containerCpu")]
1889 pub container_cpu: Option<f64>,
1890 /// Optional. Amount of memory provisioned for a Python UDF container instance. Format: {number}{unit} where unit is one of "M", "G", "Mi" and "Gi" (e.g. 1G, 512Mi). If not specified, the default value is 512Mi. For more information, see [Configure container limits for Python UDFs](https://cloud.google.com/bigquery/docs/user-defined-functions-python#configure-container-limits)
1891 #[serde(rename = "containerMemory")]
1892 pub container_memory: Option<String>,
1893 /// Optional. Maximum number of rows in each batch sent to the external runtime. If absent or if 0, BigQuery dynamically decides the number of rows in a batch.
1894 #[serde(rename = "maxBatchingRows")]
1895 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1896 pub max_batching_rows: Option<i64>,
1897 /// Optional. Fully qualified name of the connection whose service account will be used to execute the code in the container. Format: ```"projects/{project_id}/locations/{location_id}/connections/{connection_id}"```
1898 #[serde(rename = "runtimeConnection")]
1899 pub runtime_connection: Option<String>,
1900 /// Optional. Language runtime version. Example: `python-3.11`.
1901 #[serde(rename = "runtimeVersion")]
1902 pub runtime_version: Option<String>,
1903}
1904
1905impl common::Part for ExternalRuntimeOptions {}
1906
1907/// The external service cost is a portion of the total cost, these costs are not additive with total_bytes_billed. Moreover, this field only track external service costs that will show up as BigQuery costs (e.g. training BigQuery ML job with google cloud CAIP or Automl Tables services), not other costs which may be accrued by running the query (e.g. reading from Bigtable or Cloud Storage). The external service costs with different billing sku (e.g. CAIP job is charged based on VM usage) are converted to BigQuery billed_bytes and slot_ms with equivalent amount of US dollars. Services may not directly correlate to these metrics, but these are the equivalents for billing purposes. Output only.
1908///
1909/// This type is not used in any activity, and only used as *part* of another schema.
1910///
1911#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1912#[serde_with::serde_as]
1913#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1914pub struct ExternalServiceCost {
1915 /// The billing method used for the external job. This field, set to `SERVICES_SKU`, is only used when billing under the services SKU. Otherwise, it is unspecified for backward compatibility.
1916 #[serde(rename = "billingMethod")]
1917 pub billing_method: Option<String>,
1918 /// External service cost in terms of bigquery bytes billed.
1919 #[serde(rename = "bytesBilled")]
1920 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1921 pub bytes_billed: Option<i64>,
1922 /// External service cost in terms of bigquery bytes processed.
1923 #[serde(rename = "bytesProcessed")]
1924 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1925 pub bytes_processed: Option<i64>,
1926 /// External service name.
1927 #[serde(rename = "externalService")]
1928 pub external_service: Option<String>,
1929 /// Non-preemptable reserved slots used for external job. For example, reserved slots for Cloua AI Platform job are the VM usages converted to BigQuery slot with equivalent mount of price.
1930 #[serde(rename = "reservedSlotCount")]
1931 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1932 pub reserved_slot_count: Option<i64>,
1933 /// External service cost in terms of bigquery slot milliseconds.
1934 #[serde(rename = "slotMs")]
1935 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1936 pub slot_ms: Option<i64>,
1937}
1938
1939impl common::Part for ExternalServiceCost {}
1940
1941/// Representative value of a single feature within the cluster.
1942///
1943/// This type is not used in any activity, and only used as *part* of another schema.
1944///
1945#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1946#[serde_with::serde_as]
1947#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1948pub struct FeatureValue {
1949 /// The categorical feature value.
1950 #[serde(rename = "categoricalValue")]
1951 pub categorical_value: Option<CategoricalValue>,
1952 /// The feature column name.
1953 #[serde(rename = "featureColumn")]
1954 pub feature_column: Option<String>,
1955 /// The numerical feature value. This is the centroid value for this feature.
1956 #[serde(rename = "numericalValue")]
1957 pub numerical_value: Option<f64>,
1958}
1959
1960impl common::Part for FeatureValue {}
1961
1962/// Metadata about the foreign data type definition such as the system in which the type is defined.
1963///
1964/// This type is not used in any activity, and only used as *part* of another schema.
1965///
1966#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1967#[serde_with::serde_as]
1968#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1969pub struct ForeignTypeInfo {
1970 /// Required. Specifies the system which defines the foreign data type.
1971 #[serde(rename = "typeSystem")]
1972 pub type_system: Option<String>,
1973}
1974
1975impl common::Part for ForeignTypeInfo {}
1976
1977/// A view can be represented in multiple ways. Each representation has its own dialect. This message stores the metadata required for these representations.
1978///
1979/// This type is not used in any activity, and only used as *part* of another schema.
1980///
1981#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1982#[serde_with::serde_as]
1983#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1984pub struct ForeignViewDefinition {
1985 /// Optional. Represents the dialect of the query.
1986 pub dialect: Option<String>,
1987 /// Required. The query that defines the view.
1988 pub query: Option<String>,
1989}
1990
1991impl common::Part for ForeignViewDefinition {}
1992
1993/// Request message for `GetIamPolicy` method.
1994///
1995/// # Activities
1996///
1997/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1998/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1999///
2000/// * [get iam policy routines](RoutineGetIamPolicyCall) (request)
2001/// * [get iam policy row access policies](RowAccessPolicyGetIamPolicyCall) (request)
2002/// * [get iam policy tables](TableGetIamPolicyCall) (request)
2003#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2004#[serde_with::serde_as]
2005#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2006pub struct GetIamPolicyRequest {
2007 /// OPTIONAL: A `GetPolicyOptions` object for specifying options to `GetIamPolicy`.
2008 pub options: Option<GetPolicyOptions>,
2009}
2010
2011impl common::RequestValue for GetIamPolicyRequest {}
2012
2013/// Encapsulates settings provided to GetIamPolicy.
2014///
2015/// This type is not used in any activity, and only used as *part* of another schema.
2016///
2017#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2018#[serde_with::serde_as]
2019#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2020pub struct GetPolicyOptions {
2021 /// Optional. The maximum policy version that will be used to format the policy. Valid values are 0, 1, and 3. Requests specifying an invalid value will be rejected. Requests for policies with any conditional role bindings must specify version 3. Policies with no conditional role bindings may specify any valid value or leave the field unset. The policy in the response might use the policy version that you specified, or it might use a lower policy version. For example, if you specify version 3, but the policy has no conditional role bindings, the response uses version 1. To learn which resources support conditions in their IAM policies, see the [IAM documentation](https://cloud.google.com/iam/help/conditions/resource-policies).
2022 #[serde(rename = "requestedPolicyVersion")]
2023 pub requested_policy_version: Option<i32>,
2024}
2025
2026impl common::Part for GetPolicyOptions {}
2027
2028/// Response object of GetQueryResults.
2029///
2030/// # Activities
2031///
2032/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2033/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2034///
2035/// * [get query results jobs](JobGetQueryResultCall) (response)
2036#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2037#[serde_with::serde_as]
2038#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2039pub struct GetQueryResultsResponse {
2040 /// Whether the query result was fetched from the query cache.
2041 #[serde(rename = "cacheHit")]
2042 pub cache_hit: Option<bool>,
2043 /// Output only. The first errors or warnings encountered during the running of the job. The final message includes the number of errors that caused the process to stop. Errors here do not necessarily mean that the job has completed or was unsuccessful. For more information about error messages, see [Error messages](https://cloud.google.com/bigquery/docs/error-messages).
2044 pub errors: Option<Vec<ErrorProto>>,
2045 /// A hash of this response.
2046 pub etag: Option<String>,
2047 /// Whether the query has completed or not. If rows or totalRows are present, this will always be true. If this is false, totalRows will not be available.
2048 #[serde(rename = "jobComplete")]
2049 pub job_complete: Option<bool>,
2050 /// Reference to the BigQuery Job that was created to run the query. This field will be present even if the original request timed out, in which case GetQueryResults can be used to read the results once the query has completed. Since this API only returns the first page of results, subsequent pages can be fetched via the same mechanism (GetQueryResults).
2051 #[serde(rename = "jobReference")]
2052 pub job_reference: Option<JobReference>,
2053 /// The resource type of the response.
2054 pub kind: Option<String>,
2055 /// Output only. The number of rows affected by a DML statement. Present only for DML statements INSERT, UPDATE or DELETE.
2056 #[serde(rename = "numDmlAffectedRows")]
2057 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
2058 pub num_dml_affected_rows: Option<i64>,
2059 /// A token used for paging results. When this token is non-empty, it indicates additional results are available.
2060 #[serde(rename = "pageToken")]
2061 pub page_token: Option<String>,
2062 /// An object with as many results as can be contained within the maximum permitted reply size. To get any additional rows, you can call GetQueryResults and specify the jobReference returned above. Present only when the query completes successfully. The REST-based representation of this data leverages a series of JSON f,v objects for indicating fields and values.
2063 pub rows: Option<Vec<TableRow>>,
2064 /// The schema of the results. Present only when the query completes successfully.
2065 pub schema: Option<TableSchema>,
2066 /// The total number of bytes processed for this query.
2067 #[serde(rename = "totalBytesProcessed")]
2068 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
2069 pub total_bytes_processed: Option<i64>,
2070 /// The total number of rows in the complete query result set, which can be more than the number of rows in this single page of results. Present only when the query completes successfully.
2071 #[serde(rename = "totalRows")]
2072 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
2073 pub total_rows: Option<u64>,
2074}
2075
2076impl common::ResponseResult for GetQueryResultsResponse {}
2077
2078/// Response object of GetServiceAccount
2079///
2080/// # Activities
2081///
2082/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2083/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2084///
2085/// * [get service account projects](ProjectGetServiceAccountCall) (response)
2086#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2087#[serde_with::serde_as]
2088#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2089pub struct GetServiceAccountResponse {
2090 /// The service account email address.
2091 pub email: Option<String>,
2092 /// The resource type of the response.
2093 pub kind: Option<String>,
2094}
2095
2096impl common::ResponseResult for GetServiceAccountResponse {}
2097
2098/// Global explanations containing the top most important features after training.
2099///
2100/// This type is not used in any activity, and only used as *part* of another schema.
2101///
2102#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2103#[serde_with::serde_as]
2104#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2105pub struct GlobalExplanation {
2106 /// Class label for this set of global explanations. Will be empty/null for binary logistic and linear regression models. Sorted alphabetically in descending order.
2107 #[serde(rename = "classLabel")]
2108 pub class_label: Option<String>,
2109 /// A list of the top global explanations. Sorted by absolute value of attribution in descending order.
2110 pub explanations: Option<Vec<Explanation>>,
2111}
2112
2113impl common::Part for GlobalExplanation {}
2114
2115/// Options specific to Google Sheets data sources.
2116///
2117/// This type is not used in any activity, and only used as *part* of another schema.
2118///
2119#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2120#[serde_with::serde_as]
2121#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2122pub struct GoogleSheetsOptions {
2123 /// Optional. Range of a sheet to query from. Only used when non-empty. Typical format: sheet_name!top_left_cell_id:bottom_right_cell_id For example: sheet1!A1:B20
2124 pub range: Option<String>,
2125 /// Optional. The number of rows at the top of a sheet that BigQuery will skip when reading the data. The default value is 0. This property is useful if you have header rows that should be skipped. When autodetect is on, the behavior is the following: * skipLeadingRows unspecified - Autodetect tries to detect headers in the first row. If they are not detected, the row is read as data. Otherwise data is read starting from the second row. * skipLeadingRows is 0 - Instructs autodetect that there are no headers and data should be read starting from the first row. * skipLeadingRows = N > 0 - Autodetect skips N-1 rows and tries to detect headers in row N. If headers are not detected, row N is just skipped. Otherwise row N is used to extract column names for the detected schema.
2126 #[serde(rename = "skipLeadingRows")]
2127 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
2128 pub skip_leading_rows: Option<i64>,
2129}
2130
2131impl common::Part for GoogleSheetsOptions {}
2132
2133/// High cardinality join detailed information.
2134///
2135/// This type is not used in any activity, and only used as *part* of another schema.
2136///
2137#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2138#[serde_with::serde_as]
2139#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2140pub struct HighCardinalityJoin {
2141 /// Output only. Count of left input rows.
2142 #[serde(rename = "leftRows")]
2143 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
2144 pub left_rows: Option<i64>,
2145 /// Output only. Count of the output rows.
2146 #[serde(rename = "outputRows")]
2147 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
2148 pub output_rows: Option<i64>,
2149 /// Output only. Count of right input rows.
2150 #[serde(rename = "rightRows")]
2151 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
2152 pub right_rows: Option<i64>,
2153 /// Output only. The index of the join operator in the ExplainQueryStep lists.
2154 #[serde(rename = "stepIndex")]
2155 pub step_index: Option<i32>,
2156}
2157
2158impl common::Part for HighCardinalityJoin {}
2159
2160/// Options for configuring hive partitioning detect.
2161///
2162/// This type is not used in any activity, and only used as *part* of another schema.
2163///
2164#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2165#[serde_with::serde_as]
2166#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2167pub struct HivePartitioningOptions {
2168 /// Output only. For permanent external tables, this field is populated with the hive partition keys in the order they were inferred. The types of the partition keys can be deduced by checking the table schema (which will include the partition keys). Not every API will populate this field in the output. For example, Tables.Get will populate it, but Tables.List will not contain this field.
2169 pub fields: Option<Vec<String>>,
2170 /// Optional. When set, what mode of hive partitioning to use when reading data. The following modes are supported: * AUTO: automatically infer partition key name(s) and type(s). * STRINGS: automatically infer partition key name(s). All types are strings. * CUSTOM: partition key schema is encoded in the source URI prefix. Not all storage formats support hive partitioning. Requesting hive partitioning on an unsupported format will lead to an error. Currently supported formats are: JSON, CSV, ORC, Avro and Parquet.
2171 pub mode: Option<String>,
2172 /// Optional. If set to true, queries over this table require a partition filter that can be used for partition elimination to be specified. Note that this field should only be true when creating a permanent external table or querying a temporary external table. Hive-partitioned loads with require_partition_filter explicitly set to true will fail.
2173 #[serde(rename = "requirePartitionFilter")]
2174 pub require_partition_filter: Option<bool>,
2175 /// Optional. When hive partition detection is requested, a common prefix for all source uris must be required. The prefix must end immediately before the partition key encoding begins. For example, consider files following this data layout: gs://bucket/path_to_table/dt=2019-06-01/country=USA/id=7/file.avro gs://bucket/path_to_table/dt=2019-05-31/country=CA/id=3/file.avro When hive partitioning is requested with either AUTO or STRINGS detection, the common prefix can be either of gs://bucket/path_to_table or gs://bucket/path_to_table/. CUSTOM detection requires encoding the partitioning schema immediately after the common prefix. For CUSTOM, any of * gs://bucket/path_to_table/{dt:DATE}/{country:STRING}/{id:INTEGER} * gs://bucket/path_to_table/{dt:STRING}/{country:STRING}/{id:INTEGER} * gs://bucket/path_to_table/{dt:DATE}/{country:STRING}/{id:STRING} would all be valid source URI prefixes.
2176 #[serde(rename = "sourceUriPrefix")]
2177 pub source_uri_prefix: Option<String>,
2178}
2179
2180impl common::Part for HivePartitioningOptions {}
2181
2182/// Hyperparameter search spaces. These should be a subset of training_options.
2183///
2184/// This type is not used in any activity, and only used as *part* of another schema.
2185///
2186#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2187#[serde_with::serde_as]
2188#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2189pub struct HparamSearchSpaces {
2190 /// Activation functions of neural network models.
2191 #[serde(rename = "activationFn")]
2192 pub activation_fn: Option<StringHparamSearchSpace>,
2193 /// Mini batch sample size.
2194 #[serde(rename = "batchSize")]
2195 pub batch_size: Option<IntHparamSearchSpace>,
2196 /// Booster type for boosted tree models.
2197 #[serde(rename = "boosterType")]
2198 pub booster_type: Option<StringHparamSearchSpace>,
2199 /// Subsample ratio of columns for each level for boosted tree models.
2200 #[serde(rename = "colsampleBylevel")]
2201 pub colsample_bylevel: Option<DoubleHparamSearchSpace>,
2202 /// Subsample ratio of columns for each node(split) for boosted tree models.
2203 #[serde(rename = "colsampleBynode")]
2204 pub colsample_bynode: Option<DoubleHparamSearchSpace>,
2205 /// Subsample ratio of columns when constructing each tree for boosted tree models.
2206 #[serde(rename = "colsampleBytree")]
2207 pub colsample_bytree: Option<DoubleHparamSearchSpace>,
2208 /// Dart normalization type for boosted tree models.
2209 #[serde(rename = "dartNormalizeType")]
2210 pub dart_normalize_type: Option<StringHparamSearchSpace>,
2211 /// Dropout probability for dnn model training and boosted tree models using dart booster.
2212 pub dropout: Option<DoubleHparamSearchSpace>,
2213 /// Hidden units for neural network models.
2214 #[serde(rename = "hiddenUnits")]
2215 pub hidden_units: Option<IntArrayHparamSearchSpace>,
2216 /// L1 regularization coefficient.
2217 #[serde(rename = "l1Reg")]
2218 pub l1_reg: Option<DoubleHparamSearchSpace>,
2219 /// L2 regularization coefficient.
2220 #[serde(rename = "l2Reg")]
2221 pub l2_reg: Option<DoubleHparamSearchSpace>,
2222 /// Learning rate of training jobs.
2223 #[serde(rename = "learnRate")]
2224 pub learn_rate: Option<DoubleHparamSearchSpace>,
2225 /// Maximum depth of a tree for boosted tree models.
2226 #[serde(rename = "maxTreeDepth")]
2227 pub max_tree_depth: Option<IntHparamSearchSpace>,
2228 /// Minimum split loss for boosted tree models.
2229 #[serde(rename = "minSplitLoss")]
2230 pub min_split_loss: Option<DoubleHparamSearchSpace>,
2231 /// Minimum sum of instance weight needed in a child for boosted tree models.
2232 #[serde(rename = "minTreeChildWeight")]
2233 pub min_tree_child_weight: Option<IntHparamSearchSpace>,
2234 /// Number of clusters for k-means.
2235 #[serde(rename = "numClusters")]
2236 pub num_clusters: Option<IntHparamSearchSpace>,
2237 /// Number of latent factors to train on.
2238 #[serde(rename = "numFactors")]
2239 pub num_factors: Option<IntHparamSearchSpace>,
2240 /// Number of parallel trees for boosted tree models.
2241 #[serde(rename = "numParallelTree")]
2242 pub num_parallel_tree: Option<IntHparamSearchSpace>,
2243 /// Optimizer of TF models.
2244 pub optimizer: Option<StringHparamSearchSpace>,
2245 /// Subsample the training data to grow tree to prevent overfitting for boosted tree models.
2246 pub subsample: Option<DoubleHparamSearchSpace>,
2247 /// Tree construction algorithm for boosted tree models.
2248 #[serde(rename = "treeMethod")]
2249 pub tree_method: Option<StringHparamSearchSpace>,
2250 /// Hyperparameter for matrix factoration when implicit feedback type is specified.
2251 #[serde(rename = "walsAlpha")]
2252 pub wals_alpha: Option<DoubleHparamSearchSpace>,
2253}
2254
2255impl common::Part for HparamSearchSpaces {}
2256
2257/// Training info of a trial in [hyperparameter tuning](https://cloud.google.com/bigquery-ml/docs/reference/standard-sql/bigqueryml-syntax-hp-tuning-overview) models.
2258///
2259/// This type is not used in any activity, and only used as *part* of another schema.
2260///
2261#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2262#[serde_with::serde_as]
2263#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2264pub struct HparamTuningTrial {
2265 /// Ending time of the trial.
2266 #[serde(rename = "endTimeMs")]
2267 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
2268 pub end_time_ms: Option<i64>,
2269 /// Error message for FAILED and INFEASIBLE trial.
2270 #[serde(rename = "errorMessage")]
2271 pub error_message: Option<String>,
2272 /// Loss computed on the eval data at the end of trial.
2273 #[serde(rename = "evalLoss")]
2274 pub eval_loss: Option<f64>,
2275 /// Evaluation metrics of this trial calculated on the test data. Empty in Job API.
2276 #[serde(rename = "evaluationMetrics")]
2277 pub evaluation_metrics: Option<EvaluationMetrics>,
2278 /// Hyperparameter tuning evaluation metrics of this trial calculated on the eval data. Unlike evaluation_metrics, only the fields corresponding to the hparam_tuning_objectives are set.
2279 #[serde(rename = "hparamTuningEvaluationMetrics")]
2280 pub hparam_tuning_evaluation_metrics: Option<EvaluationMetrics>,
2281 /// The hyperprameters selected for this trial.
2282 pub hparams: Option<TrainingOptions>,
2283 /// Starting time of the trial.
2284 #[serde(rename = "startTimeMs")]
2285 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
2286 pub start_time_ms: Option<i64>,
2287 /// The status of the trial.
2288 pub status: Option<String>,
2289 /// Loss computed on the training data at the end of trial.
2290 #[serde(rename = "trainingLoss")]
2291 pub training_loss: Option<f64>,
2292 /// 1-based index of the trial.
2293 #[serde(rename = "trialId")]
2294 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
2295 pub trial_id: Option<i64>,
2296}
2297
2298impl common::Part for HparamTuningTrial {}
2299
2300/// Statistics related to Incremental Query Results. Populated as part of JobStatistics2. This feature is not yet available.
2301///
2302/// This type is not used in any activity, and only used as *part* of another schema.
2303///
2304#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2305#[serde_with::serde_as]
2306#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2307pub struct IncrementalResultStats {
2308 /// Reason why incremental query results are/were not written by the query.
2309 #[serde(rename = "disabledReason")]
2310 pub disabled_reason: Option<String>,
2311 /// The time at which the result table's contents were modified. May be absent if no results have been written or the query has completed.
2312 #[serde(rename = "resultSetLastModifyTime")]
2313 pub result_set_last_modify_time: Option<chrono::DateTime<chrono::offset::Utc>>,
2314 /// The time at which the result table's contents were completely replaced. May be absent if no results have been written or the query has completed.
2315 #[serde(rename = "resultSetLastReplaceTime")]
2316 pub result_set_last_replace_time: Option<chrono::DateTime<chrono::offset::Utc>>,
2317}
2318
2319impl common::Part for IncrementalResultStats {}
2320
2321/// Statistics for index pruning.
2322///
2323/// This type is not used in any activity, and only used as *part* of another schema.
2324///
2325#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2326#[serde_with::serde_as]
2327#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2328pub struct IndexPruningStats {
2329 /// The base table reference.
2330 #[serde(rename = "baseTable")]
2331 pub base_table: Option<TableReference>,
2332 /// The index id.
2333 #[serde(rename = "indexId")]
2334 pub index_id: Option<String>,
2335 /// The number of parallel inputs after index pruning.
2336 #[serde(rename = "postIndexPruningParallelInputCount")]
2337 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
2338 pub post_index_pruning_parallel_input_count: Option<i64>,
2339 /// The number of parallel inputs before index pruning.
2340 #[serde(rename = "preIndexPruningParallelInputCount")]
2341 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
2342 pub pre_index_pruning_parallel_input_count: Option<i64>,
2343}
2344
2345impl common::Part for IndexPruningStats {}
2346
2347/// Reason about why no search index was used in the search query (or sub-query).
2348///
2349/// This type is not used in any activity, and only used as *part* of another schema.
2350///
2351#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2352#[serde_with::serde_as]
2353#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2354pub struct IndexUnusedReason {
2355 /// Specifies the base table involved in the reason that no search index was used.
2356 #[serde(rename = "baseTable")]
2357 pub base_table: Option<TableReference>,
2358 /// Specifies the high-level reason for the scenario when no search index was used.
2359 pub code: Option<String>,
2360 /// Specifies the name of the unused search index, if available.
2361 #[serde(rename = "indexName")]
2362 pub index_name: Option<String>,
2363 /// Free form human-readable reason for the scenario when no search index was used.
2364 pub message: Option<String>,
2365}
2366
2367impl common::Part for IndexUnusedReason {}
2368
2369/// Details about the input data change insight.
2370///
2371/// This type is not used in any activity, and only used as *part* of another schema.
2372///
2373#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2374#[serde_with::serde_as]
2375#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2376pub struct InputDataChange {
2377 /// Output only. Records read difference percentage compared to a previous run.
2378 #[serde(rename = "recordsReadDiffPercentage")]
2379 pub records_read_diff_percentage: Option<f32>,
2380}
2381
2382impl common::Part for InputDataChange {}
2383
2384/// An array of int.
2385///
2386/// This type is not used in any activity, and only used as *part* of another schema.
2387///
2388#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2389#[serde_with::serde_as]
2390#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2391pub struct IntArray {
2392 /// Elements in the int array.
2393 #[serde_as(as = "Option<Vec<serde_with::DisplayFromStr>>")]
2394 pub elements: Option<Vec<i64>>,
2395}
2396
2397impl common::Part for IntArray {}
2398
2399/// Search space for int array.
2400///
2401/// This type is not used in any activity, and only used as *part* of another schema.
2402///
2403#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2404#[serde_with::serde_as]
2405#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2406pub struct IntArrayHparamSearchSpace {
2407 /// Candidates for the int array parameter.
2408 pub candidates: Option<Vec<IntArray>>,
2409}
2410
2411impl common::Part for IntArrayHparamSearchSpace {}
2412
2413/// Discrete candidates of an int hyperparameter.
2414///
2415/// This type is not used in any activity, and only used as *part* of another schema.
2416///
2417#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2418#[serde_with::serde_as]
2419#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2420pub struct IntCandidates {
2421 /// Candidates for the int parameter in increasing order.
2422 #[serde_as(as = "Option<Vec<serde_with::DisplayFromStr>>")]
2423 pub candidates: Option<Vec<i64>>,
2424}
2425
2426impl common::Part for IntCandidates {}
2427
2428/// Search space for an int hyperparameter.
2429///
2430/// This type is not used in any activity, and only used as *part* of another schema.
2431///
2432#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2433#[serde_with::serde_as]
2434#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2435pub struct IntHparamSearchSpace {
2436 /// Candidates of the int hyperparameter.
2437 pub candidates: Option<IntCandidates>,
2438 /// Range of the int hyperparameter.
2439 pub range: Option<IntRange>,
2440}
2441
2442impl common::Part for IntHparamSearchSpace {}
2443
2444/// Range of an int hyperparameter.
2445///
2446/// This type is not used in any activity, and only used as *part* of another schema.
2447///
2448#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2449#[serde_with::serde_as]
2450#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2451pub struct IntRange {
2452 /// Max value of the int parameter.
2453 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
2454 pub max: Option<i64>,
2455 /// Min value of the int parameter.
2456 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
2457 pub min: Option<i64>,
2458}
2459
2460impl common::Part for IntRange {}
2461
2462/// Information about a single iteration of the training run.
2463///
2464/// This type is not used in any activity, and only used as *part* of another schema.
2465///
2466#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2467#[serde_with::serde_as]
2468#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2469pub struct IterationResult {
2470 /// Arima result.
2471 #[serde(rename = "arimaResult")]
2472 pub arima_result: Option<ArimaResult>,
2473 /// Information about top clusters for clustering models.
2474 #[serde(rename = "clusterInfos")]
2475 pub cluster_infos: Option<Vec<ClusterInfo>>,
2476 /// Time taken to run the iteration in milliseconds.
2477 #[serde(rename = "durationMs")]
2478 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
2479 pub duration_ms: Option<i64>,
2480 /// Loss computed on the eval data at the end of iteration.
2481 #[serde(rename = "evalLoss")]
2482 pub eval_loss: Option<f64>,
2483 /// Index of the iteration, 0 based.
2484 pub index: Option<i32>,
2485 /// Learn rate used for this iteration.
2486 #[serde(rename = "learnRate")]
2487 pub learn_rate: Option<f64>,
2488 /// The information of the principal components.
2489 #[serde(rename = "principalComponentInfos")]
2490 pub principal_component_infos: Option<Vec<PrincipalComponentInfo>>,
2491 /// Loss computed on the training data at the end of iteration.
2492 #[serde(rename = "trainingLoss")]
2493 pub training_loss: Option<f64>,
2494}
2495
2496impl common::Part for IterationResult {}
2497
2498/// There is no detailed description.
2499///
2500/// # Activities
2501///
2502/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2503/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2504///
2505/// * [cancel jobs](JobCancelCall) (none)
2506/// * [delete jobs](JobDeleteCall) (none)
2507/// * [get jobs](JobGetCall) (response)
2508/// * [get query results jobs](JobGetQueryResultCall) (none)
2509/// * [insert jobs](JobInsertCall) (request|response)
2510/// * [list jobs](JobListCall) (none)
2511/// * [query jobs](JobQueryCall) (none)
2512#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2513#[serde_with::serde_as]
2514#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2515pub struct Job {
2516 /// Required. Describes the job configuration.
2517 pub configuration: Option<JobConfiguration>,
2518 /// Output only. A hash of this resource.
2519 pub etag: Option<String>,
2520 /// Output only. Opaque ID field of the job.
2521 pub id: Option<String>,
2522 /// Output only. The reason why a Job was created.
2523 #[serde(rename = "jobCreationReason")]
2524 pub job_creation_reason: Option<JobCreationReason>,
2525 /// Optional. Reference describing the unique-per-user name of the job.
2526 #[serde(rename = "jobReference")]
2527 pub job_reference: Option<JobReference>,
2528 /// Output only. The type of the resource.
2529 pub kind: Option<String>,
2530 /// Output only. [Full-projection-only] String representation of identity of requesting party. Populated for both first- and third-party identities. Only present for APIs that support third-party identities.
2531 pub principal_subject: Option<String>,
2532 /// Output only. A URL that can be used to access the resource again.
2533 #[serde(rename = "selfLink")]
2534 pub self_link: Option<String>,
2535 /// Output only. Information about the job, including starting time and ending time of the job.
2536 pub statistics: Option<JobStatistics>,
2537 /// Output only. The status of this job. Examine this value when polling an asynchronous job to see if the job is complete.
2538 pub status: Option<JobStatus>,
2539 /// Output only. Email address of the user who ran the job.
2540 pub user_email: Option<String>,
2541}
2542
2543impl common::RequestValue for Job {}
2544impl common::Resource for Job {}
2545impl common::ResponseResult for Job {}
2546
2547/// Describes format of a jobs cancellation response.
2548///
2549/// # Activities
2550///
2551/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2552/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2553///
2554/// * [cancel jobs](JobCancelCall) (response)
2555#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2556#[serde_with::serde_as]
2557#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2558pub struct JobCancelResponse {
2559 /// The final state of the job.
2560 pub job: Option<Job>,
2561 /// The resource type of the response.
2562 pub kind: Option<String>,
2563}
2564
2565impl common::ResponseResult for JobCancelResponse {}
2566
2567/// There is no detailed description.
2568///
2569/// This type is not used in any activity, and only used as *part* of another schema.
2570///
2571#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2572#[serde_with::serde_as]
2573#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2574pub struct JobConfiguration {
2575 /// [Pick one] Copies a table.
2576 pub copy: Option<JobConfigurationTableCopy>,
2577 /// Optional. If set, don't actually run this job. A valid query will return a mostly empty response with some processing statistics, while an invalid query will return the same error it would if it wasn't a dry run. Behavior of non-query jobs is undefined.
2578 #[serde(rename = "dryRun")]
2579 pub dry_run: Option<bool>,
2580 /// [Pick one] Configures an extract job.
2581 pub extract: Option<JobConfigurationExtract>,
2582 /// Optional. Job timeout in milliseconds relative to the job creation time. If this time limit is exceeded, BigQuery attempts to stop the job, but might not always succeed in canceling it before the job completes. For example, a job that takes more than 60 seconds to complete has a better chance of being stopped than a job that takes 10 seconds to complete.
2583 #[serde(rename = "jobTimeoutMs")]
2584 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
2585 pub job_timeout_ms: Option<i64>,
2586 /// Output only. The type of the job. Can be QUERY, LOAD, EXTRACT, COPY or UNKNOWN.
2587 #[serde(rename = "jobType")]
2588 pub job_type: Option<String>,
2589 /// The labels associated with this job. You can use these to organize and group your jobs. Label keys and values can be no longer than 63 characters, can only contain lowercase letters, numeric characters, underscores and dashes. International characters are allowed. Label values are optional. Label keys must start with a letter and each label in the list must have a different key.
2590 pub labels: Option<HashMap<String, String>>,
2591 /// [Pick one] Configures a load job.
2592 pub load: Option<JobConfigurationLoad>,
2593 /// Optional. A target limit on the rate of slot consumption by this job. If set to a value > 0, BigQuery will attempt to limit the rate of slot consumption by this job to keep it below the configured limit, even if the job is eligible for more slots based on fair scheduling. The unused slots will be available for other jobs and queries to use. Note: This feature is not yet generally available.
2594 #[serde(rename = "maxSlots")]
2595 pub max_slots: Option<i32>,
2596 /// [Pick one] Configures a query job.
2597 pub query: Option<JobConfigurationQuery>,
2598 /// Optional. The reservation that job would use. User can specify a reservation to execute the job. If reservation is not set, reservation is determined based on the rules defined by the reservation assignments. The expected format is `projects/{project}/locations/{location}/reservations/{reservation}`.
2599 pub reservation: Option<String>,
2600}
2601
2602impl common::Part for JobConfiguration {}
2603
2604/// JobConfigurationExtract configures a job that exports data from a BigQuery table into Google Cloud Storage.
2605///
2606/// This type is not used in any activity, and only used as *part* of another schema.
2607///
2608#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2609#[serde_with::serde_as]
2610#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2611pub struct JobConfigurationExtract {
2612 /// Optional. The compression type to use for exported files. Possible values include DEFLATE, GZIP, NONE, SNAPPY, and ZSTD. The default value is NONE. Not all compression formats are support for all file formats. DEFLATE is only supported for Avro. ZSTD is only supported for Parquet. Not applicable when extracting models.
2613 pub compression: Option<String>,
2614 /// Optional. The exported file format. Possible values include CSV, NEWLINE_DELIMITED_JSON, PARQUET, or AVRO for tables and ML_TF_SAVED_MODEL or ML_XGBOOST_BOOSTER for models. The default value for tables is CSV. Tables with nested or repeated fields cannot be exported as CSV. The default value for models is ML_TF_SAVED_MODEL.
2615 #[serde(rename = "destinationFormat")]
2616 pub destination_format: Option<String>,
2617 /// [Pick one] DEPRECATED: Use destinationUris instead, passing only one URI as necessary. The fully-qualified Google Cloud Storage URI where the extracted table should be written.
2618 #[serde(rename = "destinationUri")]
2619 pub destination_uri: Option<String>,
2620 /// [Pick one] A list of fully-qualified Google Cloud Storage URIs where the extracted table should be written.
2621 #[serde(rename = "destinationUris")]
2622 pub destination_uris: Option<Vec<String>>,
2623 /// Optional. When extracting data in CSV format, this defines the delimiter to use between fields in the exported data. Default is ','. Not applicable when extracting models.
2624 #[serde(rename = "fieldDelimiter")]
2625 pub field_delimiter: Option<String>,
2626 /// Optional. Model extract options only applicable when extracting models.
2627 #[serde(rename = "modelExtractOptions")]
2628 pub model_extract_options: Option<ModelExtractOptions>,
2629 /// Optional. Whether to print out a header row in the results. Default is true. Not applicable when extracting models.
2630 #[serde(rename = "printHeader")]
2631 pub print_header: Option<bool>,
2632 /// A reference to the model being exported.
2633 #[serde(rename = "sourceModel")]
2634 pub source_model: Option<ModelReference>,
2635 /// A reference to the table being exported.
2636 #[serde(rename = "sourceTable")]
2637 pub source_table: Option<TableReference>,
2638 /// Whether to use logical types when extracting to AVRO format. Not applicable when extracting models.
2639 #[serde(rename = "useAvroLogicalTypes")]
2640 pub use_avro_logical_types: Option<bool>,
2641}
2642
2643impl common::Part for JobConfigurationExtract {}
2644
2645/// JobConfigurationLoad contains the configuration properties for loading data into a destination table.
2646///
2647/// This type is not used in any activity, and only used as *part* of another schema.
2648///
2649#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2650#[serde_with::serde_as]
2651#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2652pub struct JobConfigurationLoad {
2653 /// Optional. Accept rows that are missing trailing optional columns. The missing values are treated as nulls. If false, records with missing trailing columns are treated as bad records, and if there are too many bad records, an invalid error is returned in the job result. The default value is false. Only applicable to CSV, ignored for other formats.
2654 #[serde(rename = "allowJaggedRows")]
2655 pub allow_jagged_rows: Option<bool>,
2656 /// Indicates if BigQuery should allow quoted data sections that contain newline characters in a CSV file. The default value is false.
2657 #[serde(rename = "allowQuotedNewlines")]
2658 pub allow_quoted_newlines: Option<bool>,
2659 /// Optional. Indicates if we should automatically infer the options and schema for CSV and JSON sources.
2660 pub autodetect: Option<bool>,
2661 /// Clustering specification for the destination table.
2662 pub clustering: Option<Clustering>,
2663 /// Optional. Character map supported for column names in CSV/Parquet loads. Defaults to STRICT and can be overridden by Project Config Service. Using this option with unsupporting load formats will result in an error.
2664 #[serde(rename = "columnNameCharacterMap")]
2665 pub column_name_character_map: Option<String>,
2666 /// Optional. Connection properties which can modify the load job behavior. Currently, only the 'session_id' connection property is supported, and is used to resolve _SESSION appearing as the dataset id.
2667 #[serde(rename = "connectionProperties")]
2668 pub connection_properties: Option<Vec<ConnectionProperty>>,
2669 /// Optional. [Experimental] Configures the load job to copy files directly to the destination BigLake managed table, bypassing file content reading and rewriting. Copying files only is supported when all the following are true: * `source_uris` are located in the same Cloud Storage location as the destination table's `storage_uri` location. * `source_format` is `PARQUET`. * `destination_table` is an existing BigLake managed table. The table's schema does not have flexible column names. The table's columns do not have type parameters other than precision and scale. * No options other than the above are specified.
2670 #[serde(rename = "copyFilesOnly")]
2671 pub copy_files_only: Option<bool>,
2672 /// Optional. Specifies whether the job is allowed to create new tables. The following values are supported: * CREATE_IF_NEEDED: If the table does not exist, BigQuery creates the table. * CREATE_NEVER: The table must already exist. If it does not, a 'notFound' error is returned in the job result. The default value is CREATE_IF_NEEDED. Creation, truncation and append actions occur as one atomic update upon job completion.
2673 #[serde(rename = "createDisposition")]
2674 pub create_disposition: Option<String>,
2675 /// Optional. If this property is true, the job creates a new session using a randomly generated session_id. To continue using a created session with subsequent queries, pass the existing session identifier as a `ConnectionProperty` value. The session identifier is returned as part of the `SessionInfo` message within the query statistics. The new session's location will be set to `Job.JobReference.location` if it is present, otherwise it's set to the default location based on existing routing logic.
2676 #[serde(rename = "createSession")]
2677 pub create_session: Option<bool>,
2678 /// Optional. Date format used for parsing DATE values.
2679 #[serde(rename = "dateFormat")]
2680 pub date_format: Option<String>,
2681 /// Optional. Date format used for parsing DATETIME values.
2682 #[serde(rename = "datetimeFormat")]
2683 pub datetime_format: Option<String>,
2684 /// Defines the list of possible SQL data types to which the source decimal values are converted. This list and the precision and the scale parameters of the decimal field determine the target type. In the order of NUMERIC, BIGNUMERIC, and STRING, a type is picked if it is in the specified list and if it supports the precision and the scale. STRING supports all precision and scale values. If none of the listed types supports the precision and the scale, the type supporting the widest range in the specified list is picked, and if a value exceeds the supported range when reading the data, an error will be thrown. Example: Suppose the value of this field is ["NUMERIC", "BIGNUMERIC"]. If (precision,scale) is: * (38,9) -> NUMERIC; * (39,9) -> BIGNUMERIC (NUMERIC cannot hold 30 integer digits); * (38,10) -> BIGNUMERIC (NUMERIC cannot hold 10 fractional digits); * (76,38) -> BIGNUMERIC; * (77,38) -> BIGNUMERIC (error if value exceeds supported range). This field cannot contain duplicate types. The order of the types in this field is ignored. For example, ["BIGNUMERIC", "NUMERIC"] is the same as ["NUMERIC", "BIGNUMERIC"] and NUMERIC always takes precedence over BIGNUMERIC. Defaults to ["NUMERIC", "STRING"] for ORC and ["NUMERIC"] for the other file formats.
2685 #[serde(rename = "decimalTargetTypes")]
2686 pub decimal_target_types: Option<Vec<String>>,
2687 /// Custom encryption configuration (e.g., Cloud KMS keys)
2688 #[serde(rename = "destinationEncryptionConfiguration")]
2689 pub destination_encryption_configuration: Option<EncryptionConfiguration>,
2690 /// [Required] The destination table to load the data into.
2691 #[serde(rename = "destinationTable")]
2692 pub destination_table: Option<TableReference>,
2693 /// Optional. [Experimental] Properties with which to create the destination table if it is new.
2694 #[serde(rename = "destinationTableProperties")]
2695 pub destination_table_properties: Option<DestinationTableProperties>,
2696 /// Optional. The character encoding of the data. The supported values are UTF-8, ISO-8859-1, UTF-16BE, UTF-16LE, UTF-32BE, and UTF-32LE. The default value is UTF-8. BigQuery decodes the data after the raw, binary data has been split using the values of the `quote` and `fieldDelimiter` properties. If you don't specify an encoding, or if you specify a UTF-8 encoding when the CSV file is not UTF-8 encoded, BigQuery attempts to convert the data to UTF-8. Generally, your data loads successfully, but it may not match byte-for-byte what you expect. To avoid this, specify the correct encoding by using the `--encoding` flag. If BigQuery can't convert a character other than the ASCII `0` character, BigQuery converts the character to the standard Unicode replacement character: �.
2697 pub encoding: Option<String>,
2698 /// Optional. The separator character for fields in a CSV file. The separator is interpreted as a single byte. For files encoded in ISO-8859-1, any single character can be used as a separator. For files encoded in UTF-8, characters represented in decimal range 1-127 (U+0001-U+007F) can be used without any modification. UTF-8 characters encoded with multiple bytes (i.e. U+0080 and above) will have only the first byte used for separating fields. The remaining bytes will be treated as a part of the field. BigQuery also supports the escape sequence "\t" (U+0009) to specify a tab separator. The default value is comma (",", U+002C).
2699 #[serde(rename = "fieldDelimiter")]
2700 pub field_delimiter: Option<String>,
2701 /// Optional. Specifies how source URIs are interpreted for constructing the file set to load. By default, source URIs are expanded against the underlying storage. You can also specify manifest files to control how the file set is constructed. This option is only applicable to object storage systems.
2702 #[serde(rename = "fileSetSpecType")]
2703 pub file_set_spec_type: Option<String>,
2704 /// Optional. When set, configures hive partitioning support. Not all storage formats support hive partitioning -- requesting hive partitioning on an unsupported format will lead to an error, as will providing an invalid specification.
2705 #[serde(rename = "hivePartitioningOptions")]
2706 pub hive_partitioning_options: Option<HivePartitioningOptions>,
2707 /// Optional. Indicates if BigQuery should allow extra values that are not represented in the table schema. If true, the extra values are ignored. If false, records with extra columns are treated as bad records, and if there are too many bad records, an invalid error is returned in the job result. The default value is false. The sourceFormat property determines what BigQuery treats as an extra value: CSV: Trailing columns JSON: Named values that don't match any column names in the table schema Avro, Parquet, ORC: Fields in the file schema that don't exist in the table schema.
2708 #[serde(rename = "ignoreUnknownValues")]
2709 pub ignore_unknown_values: Option<bool>,
2710 /// Optional. Load option to be used together with source_format newline-delimited JSON to indicate that a variant of JSON is being loaded. To load newline-delimited GeoJSON, specify GEOJSON (and source_format must be set to NEWLINE_DELIMITED_JSON).
2711 #[serde(rename = "jsonExtension")]
2712 pub json_extension: Option<String>,
2713 /// Optional. The maximum number of bad records that BigQuery can ignore when running the job. If the number of bad records exceeds this value, an invalid error is returned in the job result. The default value is 0, which requires that all records are valid. This is only supported for CSV and NEWLINE_DELIMITED_JSON file formats.
2714 #[serde(rename = "maxBadRecords")]
2715 pub max_bad_records: Option<i32>,
2716 /// Optional. Specifies a string that represents a null value in a CSV file. For example, if you specify "\N", BigQuery interprets "\N" as a null value when loading a CSV file. The default value is the empty string. If you set this property to a custom value, BigQuery throws an error if an empty string is present for all data types except for STRING and BYTE. For STRING and BYTE columns, BigQuery interprets the empty string as an empty value.
2717 #[serde(rename = "nullMarker")]
2718 pub null_marker: Option<String>,
2719 /// Optional. A list of strings represented as SQL NULL value in a CSV file. null_marker and null_markers can't be set at the same time. If null_marker is set, null_markers has to be not set. If null_markers is set, null_marker has to be not set. If both null_marker and null_markers are set at the same time, a user error would be thrown. Any strings listed in null_markers, including empty string would be interpreted as SQL NULL. This applies to all column types.
2720 #[serde(rename = "nullMarkers")]
2721 pub null_markers: Option<Vec<String>>,
2722 /// Optional. Additional properties to set if sourceFormat is set to PARQUET.
2723 #[serde(rename = "parquetOptions")]
2724 pub parquet_options: Option<ParquetOptions>,
2725 /// Optional. When sourceFormat is set to "CSV", this indicates whether the embedded ASCII control characters (the first 32 characters in the ASCII-table, from '\x00' to '\x1F') are preserved.
2726 #[serde(rename = "preserveAsciiControlCharacters")]
2727 pub preserve_ascii_control_characters: Option<bool>,
2728 /// If sourceFormat is set to "DATASTORE_BACKUP", indicates which entity properties to load into BigQuery from a Cloud Datastore backup. Property names are case sensitive and must be top-level properties. If no properties are specified, BigQuery loads all properties. If any named property isn't found in the Cloud Datastore backup, an invalid error is returned in the job result.
2729 #[serde(rename = "projectionFields")]
2730 pub projection_fields: Option<Vec<String>>,
2731 /// Optional. The value that is used to quote data sections in a CSV file. BigQuery converts the string to ISO-8859-1 encoding, and then uses the first byte of the encoded string to split the data in its raw, binary state. The default value is a double-quote ('"'). If your data does not contain quoted sections, set the property value to an empty string. If your data contains quoted newline characters, you must also set the allowQuotedNewlines property to true. To include the specific quote character within a quoted value, precede it with an additional matching quote character. For example, if you want to escape the default character ' " ', use ' "" '. @default "
2732 pub quote: Option<String>,
2733 /// Range partitioning specification for the destination table. Only one of timePartitioning and rangePartitioning should be specified.
2734 #[serde(rename = "rangePartitioning")]
2735 pub range_partitioning: Option<RangePartitioning>,
2736 /// Optional. The user can provide a reference file with the reader schema. This file is only loaded if it is part of source URIs, but is not loaded otherwise. It is enabled for the following formats: AVRO, PARQUET, ORC.
2737 #[serde(rename = "referenceFileSchemaUri")]
2738 pub reference_file_schema_uri: Option<String>,
2739 /// Optional. The schema for the destination table. The schema can be omitted if the destination table already exists, or if you're loading data from Google Cloud Datastore.
2740 pub schema: Option<TableSchema>,
2741 /// [Deprecated] The inline schema. For CSV schemas, specify as "Field1:Type1[,Field2:Type2]*". For example, "foo:STRING, bar:INTEGER, baz:FLOAT".
2742 #[serde(rename = "schemaInline")]
2743 pub schema_inline: Option<String>,
2744 /// [Deprecated] The format of the schemaInline property.
2745 #[serde(rename = "schemaInlineFormat")]
2746 pub schema_inline_format: Option<String>,
2747 /// Allows the schema of the destination table to be updated as a side effect of the load job if a schema is autodetected or supplied in the job configuration. Schema update options are supported in three cases: when writeDisposition is WRITE_APPEND; when writeDisposition is WRITE_TRUNCATE_DATA; when writeDisposition is WRITE_TRUNCATE and the destination table is a partition of a table, specified by partition decorators. For normal tables, WRITE_TRUNCATE will always overwrite the schema. One or more of the following values are specified: * ALLOW_FIELD_ADDITION: allow adding a nullable field to the schema. * ALLOW_FIELD_RELAXATION: allow relaxing a required field in the original schema to nullable.
2748 #[serde(rename = "schemaUpdateOptions")]
2749 pub schema_update_options: Option<Vec<String>>,
2750 /// Optional. The number of rows at the top of a CSV file that BigQuery will skip when loading the data. The default value is 0. This property is useful if you have header rows in the file that should be skipped. When autodetect is on, the behavior is the following: * skipLeadingRows unspecified - Autodetect tries to detect headers in the first row. If they are not detected, the row is read as data. Otherwise data is read starting from the second row. * skipLeadingRows is 0 - Instructs autodetect that there are no headers and data should be read starting from the first row. * skipLeadingRows = N > 0 - Autodetect skips N-1 rows and tries to detect headers in row N. If headers are not detected, row N is just skipped. Otherwise row N is used to extract column names for the detected schema.
2751 #[serde(rename = "skipLeadingRows")]
2752 pub skip_leading_rows: Option<i32>,
2753 /// Optional. Controls the strategy used to match loaded columns to the schema. If not set, a sensible default is chosen based on how the schema is provided. If autodetect is used, then columns are matched by name. Otherwise, columns are matched by position. This is done to keep the behavior backward-compatible.
2754 #[serde(rename = "sourceColumnMatch")]
2755 pub source_column_match: Option<String>,
2756 /// Optional. The format of the data files. For CSV files, specify "CSV". For datastore backups, specify "DATASTORE_BACKUP". For newline-delimited JSON, specify "NEWLINE_DELIMITED_JSON". For Avro, specify "AVRO". For parquet, specify "PARQUET". For orc, specify "ORC". The default value is CSV.
2757 #[serde(rename = "sourceFormat")]
2758 pub source_format: Option<String>,
2759 /// [Required] The fully-qualified URIs that point to your data in Google Cloud. For Google Cloud Storage URIs: Each URI can contain one '*' wildcard character and it must come after the 'bucket' name. Size limits related to load jobs apply to external data sources. For Google Cloud Bigtable URIs: Exactly one URI can be specified and it has be a fully specified and valid HTTPS URL for a Google Cloud Bigtable table. For Google Cloud Datastore backups: Exactly one URI can be specified. Also, the '*' wildcard character is not allowed.
2760 #[serde(rename = "sourceUris")]
2761 pub source_uris: Option<Vec<String>>,
2762 /// Optional. Date format used for parsing TIME values.
2763 #[serde(rename = "timeFormat")]
2764 pub time_format: Option<String>,
2765 /// Time-based partitioning specification for the destination table. Only one of timePartitioning and rangePartitioning should be specified.
2766 #[serde(rename = "timePartitioning")]
2767 pub time_partitioning: Option<TimePartitioning>,
2768 /// Optional. Default time zone that will apply when parsing timestamp values that have no specific time zone.
2769 #[serde(rename = "timeZone")]
2770 pub time_zone: Option<String>,
2771 /// Optional. Date format used for parsing TIMESTAMP values.
2772 #[serde(rename = "timestampFormat")]
2773 pub timestamp_format: Option<String>,
2774 /// Precisions (maximum number of total digits in base 10) for seconds of TIMESTAMP types that are allowed to the destination table for autodetection mode. Available for the formats: CSV. For the CSV Format, Possible values include: Not Specified, [], or [6]: timestamp(6) for all auto detected TIMESTAMP columns [6, 12]: timestamp(6) for all auto detected TIMESTAMP columns that have less than 6 digits of subseconds. timestamp(12) for all auto detected TIMESTAMP columns that have more than 6 digits of subseconds. [12]: timestamp(12) for all auto detected TIMESTAMP columns. The order of the elements in this array is ignored. Inputs that have higher precision than the highest target precision in this array will be truncated.
2775 #[serde(rename = "timestampTargetPrecision")]
2776 pub timestamp_target_precision: Option<Vec<i32>>,
2777 /// Optional. If sourceFormat is set to "AVRO", indicates whether to interpret logical types as the corresponding BigQuery data type (for example, TIMESTAMP), instead of using the raw type (for example, INTEGER).
2778 #[serde(rename = "useAvroLogicalTypes")]
2779 pub use_avro_logical_types: Option<bool>,
2780 /// Optional. Specifies the action that occurs if the destination table already exists. The following values are supported: * WRITE_TRUNCATE: If the table already exists, BigQuery overwrites the data, removes the constraints and uses the schema from the load job. * WRITE_TRUNCATE_DATA: If the table already exists, BigQuery overwrites the data, but keeps the constraints and schema of the existing table. * WRITE_APPEND: If the table already exists, BigQuery appends the data to the table. * WRITE_EMPTY: If the table already exists and contains data, a 'duplicate' error is returned in the job result. The default value is WRITE_APPEND. Each action is atomic and only occurs if BigQuery is able to complete the job successfully. Creation, truncation and append actions occur as one atomic update upon job completion.
2781 #[serde(rename = "writeDisposition")]
2782 pub write_disposition: Option<String>,
2783}
2784
2785impl common::Part for JobConfigurationLoad {}
2786
2787/// JobConfigurationQuery configures a BigQuery query job.
2788///
2789/// This type is not used in any activity, and only used as *part* of another schema.
2790///
2791#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2792#[serde_with::serde_as]
2793#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2794pub struct JobConfigurationQuery {
2795 /// Optional. If true and query uses legacy SQL dialect, allows the query to produce arbitrarily large result tables at a slight cost in performance. Requires destinationTable to be set. For GoogleSQL queries, this flag is ignored and large results are always allowed. However, you must still set destinationTable when result size exceeds the allowed maximum response size.
2796 #[serde(rename = "allowLargeResults")]
2797 pub allow_large_results: Option<bool>,
2798 /// Clustering specification for the destination table.
2799 pub clustering: Option<Clustering>,
2800 /// Connection properties which can modify the query behavior.
2801 #[serde(rename = "connectionProperties")]
2802 pub connection_properties: Option<Vec<ConnectionProperty>>,
2803 /// [Optional] Specifies whether the query should be executed as a continuous query. The default value is false.
2804 pub continuous: Option<bool>,
2805 /// Optional. Specifies whether the job is allowed to create new tables. The following values are supported: * CREATE_IF_NEEDED: If the table does not exist, BigQuery creates the table. * CREATE_NEVER: The table must already exist. If it does not, a 'notFound' error is returned in the job result. The default value is CREATE_IF_NEEDED. Creation, truncation and append actions occur as one atomic update upon job completion.
2806 #[serde(rename = "createDisposition")]
2807 pub create_disposition: Option<String>,
2808 /// If this property is true, the job creates a new session using a randomly generated session_id. To continue using a created session with subsequent queries, pass the existing session identifier as a `ConnectionProperty` value. The session identifier is returned as part of the `SessionInfo` message within the query statistics. The new session's location will be set to `Job.JobReference.location` if it is present, otherwise it's set to the default location based on existing routing logic.
2809 #[serde(rename = "createSession")]
2810 pub create_session: Option<bool>,
2811 /// Optional. Specifies the default dataset to use for unqualified table names in the query. This setting does not alter behavior of unqualified dataset names. Setting the system variable `@@dataset_id` achieves the same behavior. See https://cloud.google.com/bigquery/docs/reference/system-variables for more information on system variables.
2812 #[serde(rename = "defaultDataset")]
2813 pub default_dataset: Option<DatasetReference>,
2814 /// Custom encryption configuration (e.g., Cloud KMS keys)
2815 #[serde(rename = "destinationEncryptionConfiguration")]
2816 pub destination_encryption_configuration: Option<EncryptionConfiguration>,
2817 /// Optional. Describes the table where the query results should be stored. This property must be set for large results that exceed the maximum response size. For queries that produce anonymous (cached) results, this field will be populated by BigQuery.
2818 #[serde(rename = "destinationTable")]
2819 pub destination_table: Option<TableReference>,
2820 /// Optional. If true and query uses legacy SQL dialect, flattens all nested and repeated fields in the query results. allowLargeResults must be true if this is set to false. For GoogleSQL queries, this flag is ignored and results are never flattened.
2821 #[serde(rename = "flattenResults")]
2822 pub flatten_results: Option<bool>,
2823 /// Optional. [Deprecated] Maximum billing tier allowed for this query. The billing tier controls the amount of compute resources allotted to the query, and multiplies the on-demand cost of the query accordingly. A query that runs within its allotted resources will succeed and indicate its billing tier in statistics.query.billingTier, but if the query exceeds its allotted resources, it will fail with billingTierLimitExceeded. WARNING: The billed byte amount can be multiplied by an amount up to this number! Most users should not need to alter this setting, and we recommend that you avoid introducing new uses of it.
2824 #[serde(rename = "maximumBillingTier")]
2825 pub maximum_billing_tier: Option<i32>,
2826 /// Limits the bytes billed for this job. Queries that will have bytes billed beyond this limit will fail (without incurring a charge). If unspecified, this will be set to your project default.
2827 #[serde(rename = "maximumBytesBilled")]
2828 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
2829 pub maximum_bytes_billed: Option<i64>,
2830 /// GoogleSQL only. Set to POSITIONAL to use positional (?) query parameters or to NAMED to use named (@myparam) query parameters in this query.
2831 #[serde(rename = "parameterMode")]
2832 pub parameter_mode: Option<String>,
2833 /// [Deprecated] This property is deprecated.
2834 #[serde(rename = "preserveNulls")]
2835 pub preserve_nulls: Option<bool>,
2836 /// Optional. Specifies a priority for the query. Possible values include INTERACTIVE and BATCH. The default value is INTERACTIVE.
2837 pub priority: Option<String>,
2838 /// [Required] SQL query text to execute. The useLegacySql field can be used to indicate whether the query uses legacy SQL or GoogleSQL.
2839 pub query: Option<String>,
2840 /// Query parameters for GoogleSQL queries.
2841 #[serde(rename = "queryParameters")]
2842 pub query_parameters: Option<Vec<QueryParameter>>,
2843 /// Range partitioning specification for the destination table. Only one of timePartitioning and rangePartitioning should be specified.
2844 #[serde(rename = "rangePartitioning")]
2845 pub range_partitioning: Option<RangePartitioning>,
2846 /// Allows the schema of the destination table to be updated as a side effect of the query job. Schema update options are supported in three cases: when writeDisposition is WRITE_APPEND; when writeDisposition is WRITE_TRUNCATE_DATA; when writeDisposition is WRITE_TRUNCATE and the destination table is a partition of a table, specified by partition decorators. For normal tables, WRITE_TRUNCATE will always overwrite the schema. One or more of the following values are specified: * ALLOW_FIELD_ADDITION: allow adding a nullable field to the schema. * ALLOW_FIELD_RELAXATION: allow relaxing a required field in the original schema to nullable.
2847 #[serde(rename = "schemaUpdateOptions")]
2848 pub schema_update_options: Option<Vec<String>>,
2849 /// Options controlling the execution of scripts.
2850 #[serde(rename = "scriptOptions")]
2851 pub script_options: Option<ScriptOptions>,
2852 /// Output only. System variables for GoogleSQL queries. A system variable is output if the variable is settable and its value differs from the system default. "@@" prefix is not included in the name of the System variables.
2853 #[serde(rename = "systemVariables")]
2854 pub system_variables: Option<SystemVariables>,
2855 /// Optional. You can specify external table definitions, which operate as ephemeral tables that can be queried. These definitions are configured using a JSON map, where the string key represents the table identifier, and the value is the corresponding external data configuration object.
2856 #[serde(rename = "tableDefinitions")]
2857 pub table_definitions: Option<HashMap<String, ExternalDataConfiguration>>,
2858 /// Time-based partitioning specification for the destination table. Only one of timePartitioning and rangePartitioning should be specified.
2859 #[serde(rename = "timePartitioning")]
2860 pub time_partitioning: Option<TimePartitioning>,
2861 /// Optional. Specifies whether to use BigQuery's legacy SQL dialect for this query. The default value is true. If set to false, the query will use BigQuery's GoogleSQL: https://cloud.google.com/bigquery/sql-reference/ When useLegacySql is set to false, the value of flattenResults is ignored; query will be run as if flattenResults is false.
2862 #[serde(rename = "useLegacySql")]
2863 pub use_legacy_sql: Option<bool>,
2864 /// Optional. Whether to look for the result in the query cache. The query cache is a best-effort cache that will be flushed whenever tables in the query are modified. Moreover, the query cache is only available when a query does not have a destination table specified. The default value is true.
2865 #[serde(rename = "useQueryCache")]
2866 pub use_query_cache: Option<bool>,
2867 /// Describes user-defined function resources used in the query.
2868 #[serde(rename = "userDefinedFunctionResources")]
2869 pub user_defined_function_resources: Option<Vec<UserDefinedFunctionResource>>,
2870 /// Optional. Specifies the action that occurs if the destination table already exists. The following values are supported: * WRITE_TRUNCATE: If the table already exists, BigQuery overwrites the data, removes the constraints, and uses the schema from the query result. * WRITE_TRUNCATE_DATA: If the table already exists, BigQuery overwrites the data, but keeps the constraints and schema of the existing table. * WRITE_APPEND: If the table already exists, BigQuery appends the data to the table. * WRITE_EMPTY: If the table already exists and contains data, a 'duplicate' error is returned in the job result. The default value is WRITE_EMPTY. Each action is atomic and only occurs if BigQuery is able to complete the job successfully. Creation, truncation and append actions occur as one atomic update upon job completion.
2871 #[serde(rename = "writeDisposition")]
2872 pub write_disposition: Option<String>,
2873 /// Optional. This is only supported for a SELECT query using a temporary table. If set, the query is allowed to write results incrementally to the temporary result table. This may incur a performance penalty. This option cannot be used with Legacy SQL. This feature is not yet available.
2874 #[serde(rename = "writeIncrementalResults")]
2875 pub write_incremental_results: Option<bool>,
2876}
2877
2878impl common::Part for JobConfigurationQuery {}
2879
2880/// JobConfigurationTableCopy configures a job that copies data from one table to another. For more information on copying tables, see [Copy a table](https://cloud.google.com/bigquery/docs/managing-tables#copy-table).
2881///
2882/// This type is not used in any activity, and only used as *part* of another schema.
2883///
2884#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2885#[serde_with::serde_as]
2886#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2887pub struct JobConfigurationTableCopy {
2888 /// Optional. Specifies whether the job is allowed to create new tables. The following values are supported: * CREATE_IF_NEEDED: If the table does not exist, BigQuery creates the table. * CREATE_NEVER: The table must already exist. If it does not, a 'notFound' error is returned in the job result. The default value is CREATE_IF_NEEDED. Creation, truncation and append actions occur as one atomic update upon job completion.
2889 #[serde(rename = "createDisposition")]
2890 pub create_disposition: Option<String>,
2891 /// Custom encryption configuration (e.g., Cloud KMS keys).
2892 #[serde(rename = "destinationEncryptionConfiguration")]
2893 pub destination_encryption_configuration: Option<EncryptionConfiguration>,
2894 /// Optional. The time when the destination table expires. Expired tables will be deleted and their storage reclaimed.
2895 #[serde(rename = "destinationExpirationTime")]
2896 pub destination_expiration_time: Option<chrono::DateTime<chrono::offset::Utc>>,
2897 /// [Required] The destination table.
2898 #[serde(rename = "destinationTable")]
2899 pub destination_table: Option<TableReference>,
2900 /// Optional. Supported operation types in table copy job.
2901 #[serde(rename = "operationType")]
2902 pub operation_type: Option<String>,
2903 /// [Pick one] Source table to copy.
2904 #[serde(rename = "sourceTable")]
2905 pub source_table: Option<TableReference>,
2906 /// [Pick one] Source tables to copy.
2907 #[serde(rename = "sourceTables")]
2908 pub source_tables: Option<Vec<TableReference>>,
2909 /// Optional. Specifies the action that occurs if the destination table already exists. The following values are supported: * WRITE_TRUNCATE: If the table already exists, BigQuery overwrites the table data and uses the schema and table constraints from the source table. * WRITE_APPEND: If the table already exists, BigQuery appends the data to the table. * WRITE_EMPTY: If the table already exists and contains data, a 'duplicate' error is returned in the job result. The default value is WRITE_EMPTY. Each action is atomic and only occurs if BigQuery is able to complete the job successfully. Creation, truncation and append actions occur as one atomic update upon job completion.
2910 #[serde(rename = "writeDisposition")]
2911 pub write_disposition: Option<String>,
2912}
2913
2914impl common::Part for JobConfigurationTableCopy {}
2915
2916/// Reason about why a Job was created from a [`jobs.query`](https://cloud.google.com/bigquery/docs/reference/rest/v2/jobs/query) method when used with `JOB_CREATION_OPTIONAL` Job creation mode. For [`jobs.insert`](https://cloud.google.com/bigquery/docs/reference/rest/v2/jobs/insert) method calls it will always be `REQUESTED`.
2917///
2918/// This type is not used in any activity, and only used as *part* of another schema.
2919///
2920#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2921#[serde_with::serde_as]
2922#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2923pub struct JobCreationReason {
2924 /// Output only. Specifies the high level reason why a Job was created.
2925 pub code: Option<String>,
2926}
2927
2928impl common::Part for JobCreationReason {}
2929
2930/// JobList is the response format for a jobs.list call.
2931///
2932/// # Activities
2933///
2934/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2935/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2936///
2937/// * [list jobs](JobListCall) (response)
2938#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2939#[serde_with::serde_as]
2940#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2941pub struct JobList {
2942 /// A hash of this page of results.
2943 pub etag: Option<String>,
2944 /// List of jobs that were requested.
2945 pub jobs: Option<Vec<JobListJobs>>,
2946 /// The resource type of the response.
2947 pub kind: Option<String>,
2948 /// A token to request the next page of results.
2949 #[serde(rename = "nextPageToken")]
2950 pub next_page_token: Option<String>,
2951 /// A list of skipped locations that were unreachable. For more information about BigQuery locations, see: https://cloud.google.com/bigquery/docs/locations. Example: "europe-west5"
2952 pub unreachable: Option<Vec<String>>,
2953}
2954
2955impl common::ResponseResult for JobList {}
2956
2957/// A job reference is a fully qualified identifier for referring to a job.
2958///
2959/// This type is not used in any activity, and only used as *part* of another schema.
2960///
2961#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2962#[serde_with::serde_as]
2963#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2964pub struct JobReference {
2965 /// Required. The ID of the job. The ID must contain only letters (a-z, A-Z), numbers (0-9), underscores (_), or dashes (-). The maximum length is 1,024 characters.
2966 #[serde(rename = "jobId")]
2967 pub job_id: Option<String>,
2968 /// Optional. The geographic location of the job. The default value is US. For more information about BigQuery locations, see: https://cloud.google.com/bigquery/docs/locations
2969 pub location: Option<String>,
2970 /// Required. The ID of the project containing this job.
2971 #[serde(rename = "projectId")]
2972 pub project_id: Option<String>,
2973}
2974
2975impl common::Part for JobReference {}
2976
2977/// Statistics for a single job execution.
2978///
2979/// This type is not used in any activity, and only used as *part* of another schema.
2980///
2981#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2982#[serde_with::serde_as]
2983#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2984pub struct JobStatistics {
2985 /// Output only. [TrustedTester] Job progress (0.0 -> 1.0) for LOAD and EXTRACT jobs.
2986 #[serde(rename = "completionRatio")]
2987 pub completion_ratio: Option<f64>,
2988 /// Output only. Statistics for a copy job.
2989 pub copy: Option<JobStatistics5>,
2990 /// Output only. Creation time of this job, in milliseconds since the epoch. This field will be present on all jobs.
2991 #[serde(rename = "creationTime")]
2992 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
2993 pub creation_time: Option<i64>,
2994 /// Output only. Statistics for data-masking. Present only for query and extract jobs.
2995 #[serde(rename = "dataMaskingStatistics")]
2996 pub data_masking_statistics: Option<DataMaskingStatistics>,
2997 /// Output only. Name of edition corresponding to the reservation for this job at the time of this update.
2998 pub edition: Option<String>,
2999 /// Output only. End time of this job, in milliseconds since the epoch. This field will be present whenever a job is in the DONE state.
3000 #[serde(rename = "endTime")]
3001 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
3002 pub end_time: Option<i64>,
3003 /// Output only. Statistics for an extract job.
3004 pub extract: Option<JobStatistics4>,
3005 /// Output only. The duration in milliseconds of the execution of the final attempt of this job, as BigQuery may internally re-attempt to execute the job.
3006 #[serde(rename = "finalExecutionDurationMs")]
3007 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
3008 pub final_execution_duration_ms: Option<i64>,
3009 /// Output only. Statistics for a load job.
3010 pub load: Option<JobStatistics3>,
3011 /// Output only. Number of child jobs executed.
3012 #[serde(rename = "numChildJobs")]
3013 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
3014 pub num_child_jobs: Option<i64>,
3015 /// Output only. If this is a child job, specifies the job ID of the parent.
3016 #[serde(rename = "parentJobId")]
3017 pub parent_job_id: Option<String>,
3018 /// Output only. Statistics for a query job.
3019 pub query: Option<JobStatistics2>,
3020 /// Output only. Quotas which delayed this job's start time.
3021 #[serde(rename = "quotaDeferments")]
3022 pub quota_deferments: Option<Vec<String>>,
3023 /// Output only. The reservation group path of the reservation assigned to this job. This field has a limit of 10 nested reservation groups. This is to maintain consistency between reservatins info schema and jobs info schema. The first reservation group is the root reservation group and the last is the leaf or lowest level reservation group.
3024 #[serde(rename = "reservationGroupPath")]
3025 pub reservation_group_path: Option<Vec<String>>,
3026 /// Output only. Job resource usage breakdown by reservation. This field reported misleading information and will no longer be populated.
3027 #[serde(rename = "reservationUsage")]
3028 pub reservation_usage: Option<Vec<JobStatisticsReservationUsage>>,
3029 /// Output only. Name of the primary reservation assigned to this job. Note that this could be different than reservations reported in the reservation usage field if parent reservations were used to execute this job.
3030 pub reservation_id: Option<String>,
3031 /// Output only. Statistics for row-level security. Present only for query and extract jobs.
3032 #[serde(rename = "rowLevelSecurityStatistics")]
3033 pub row_level_security_statistics: Option<RowLevelSecurityStatistics>,
3034 /// Output only. If this a child job of a script, specifies information about the context of this job within the script.
3035 #[serde(rename = "scriptStatistics")]
3036 pub script_statistics: Option<ScriptStatistics>,
3037 /// Output only. Information of the session if this job is part of one.
3038 #[serde(rename = "sessionInfo")]
3039 pub session_info: Option<SessionInfo>,
3040 /// Output only. Start time of this job, in milliseconds since the epoch. This field will be present when the job transitions from the PENDING state to either RUNNING or DONE.
3041 #[serde(rename = "startTime")]
3042 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
3043 pub start_time: Option<i64>,
3044 /// Output only. Total bytes processed for the job.
3045 #[serde(rename = "totalBytesProcessed")]
3046 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
3047 pub total_bytes_processed: Option<i64>,
3048 /// Output only. Slot-milliseconds for the job.
3049 #[serde(rename = "totalSlotMs")]
3050 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
3051 pub total_slot_ms: Option<i64>,
3052 /// Output only. [Alpha] Information of the multi-statement transaction if this job is part of one. This property is only expected on a child job or a job that is in a session. A script parent job is not part of the transaction started in the script.
3053 #[serde(rename = "transactionInfo")]
3054 pub transaction_info: Option<TransactionInfo>,
3055}
3056
3057impl common::Part for JobStatistics {}
3058
3059/// Statistics for a query job.
3060///
3061/// This type is not used in any activity, and only used as *part* of another schema.
3062///
3063#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3064#[serde_with::serde_as]
3065#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3066pub struct JobStatistics2 {
3067 /// Output only. BI Engine specific Statistics.
3068 #[serde(rename = "biEngineStatistics")]
3069 pub bi_engine_statistics: Option<BiEngineStatistics>,
3070 /// Output only. Billing tier for the job. This is a BigQuery-specific concept which is not related to the Google Cloud notion of "free tier". The value here is a measure of the query's resource consumption relative to the amount of data scanned. For on-demand queries, the limit is 100, and all queries within this limit are billed at the standard on-demand rates. On-demand queries that exceed this limit will fail with a billingTierLimitExceeded error.
3071 #[serde(rename = "billingTier")]
3072 pub billing_tier: Option<i32>,
3073 /// Output only. Whether the query result was fetched from the query cache.
3074 #[serde(rename = "cacheHit")]
3075 pub cache_hit: Option<bool>,
3076 /// Output only. Referenced dataset for DCL statement.
3077 #[serde(rename = "dclTargetDataset")]
3078 pub dcl_target_dataset: Option<DatasetReference>,
3079 /// Output only. Referenced table for DCL statement.
3080 #[serde(rename = "dclTargetTable")]
3081 pub dcl_target_table: Option<TableReference>,
3082 /// Output only. Referenced view for DCL statement.
3083 #[serde(rename = "dclTargetView")]
3084 pub dcl_target_view: Option<TableReference>,
3085 /// Output only. The number of row access policies affected by a DDL statement. Present only for DROP ALL ROW ACCESS POLICIES queries.
3086 #[serde(rename = "ddlAffectedRowAccessPolicyCount")]
3087 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
3088 pub ddl_affected_row_access_policy_count: Option<i64>,
3089 /// Output only. The table after rename. Present only for ALTER TABLE RENAME TO query.
3090 #[serde(rename = "ddlDestinationTable")]
3091 pub ddl_destination_table: Option<TableReference>,
3092 /// Output only. The DDL operation performed, possibly dependent on the pre-existence of the DDL target.
3093 #[serde(rename = "ddlOperationPerformed")]
3094 pub ddl_operation_performed: Option<String>,
3095 /// Output only. The DDL target dataset. Present only for CREATE/ALTER/DROP SCHEMA(dataset) queries.
3096 #[serde(rename = "ddlTargetDataset")]
3097 pub ddl_target_dataset: Option<DatasetReference>,
3098 /// Output only. [Beta] The DDL target routine. Present only for CREATE/DROP FUNCTION/PROCEDURE queries.
3099 #[serde(rename = "ddlTargetRoutine")]
3100 pub ddl_target_routine: Option<RoutineReference>,
3101 /// Output only. The DDL target row access policy. Present only for CREATE/DROP ROW ACCESS POLICY queries.
3102 #[serde(rename = "ddlTargetRowAccessPolicy")]
3103 pub ddl_target_row_access_policy: Option<RowAccessPolicyReference>,
3104 /// Output only. The DDL target table. Present only for CREATE/DROP TABLE/VIEW and DROP ALL ROW ACCESS POLICIES queries.
3105 #[serde(rename = "ddlTargetTable")]
3106 pub ddl_target_table: Option<TableReference>,
3107 /// Output only. Detailed statistics for DML statements INSERT, UPDATE, DELETE, MERGE or TRUNCATE.
3108 #[serde(rename = "dmlStats")]
3109 pub dml_stats: Option<DmlStatistics>,
3110 /// Output only. The original estimate of bytes processed for the job.
3111 #[serde(rename = "estimatedBytesProcessed")]
3112 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
3113 pub estimated_bytes_processed: Option<i64>,
3114 /// Output only. Stats for EXPORT DATA statement.
3115 #[serde(rename = "exportDataStatistics")]
3116 pub export_data_statistics: Option<ExportDataStatistics>,
3117 /// Output only. Job cost breakdown as bigquery internal cost and external service costs.
3118 #[serde(rename = "externalServiceCosts")]
3119 pub external_service_costs: Option<Vec<ExternalServiceCost>>,
3120 /// Output only. Statistics related to incremental query results, if enabled for the query. This feature is not yet available.
3121 #[serde(rename = "incrementalResultStats")]
3122 pub incremental_result_stats: Option<IncrementalResultStats>,
3123 /// Output only. Statistics for a LOAD query.
3124 #[serde(rename = "loadQueryStatistics")]
3125 pub load_query_statistics: Option<LoadQueryStatistics>,
3126 /// Output only. Statistics of materialized views of a query job.
3127 #[serde(rename = "materializedViewStatistics")]
3128 pub materialized_view_statistics: Option<MaterializedViewStatistics>,
3129 /// Output only. Statistics of metadata cache usage in a query for BigLake tables.
3130 #[serde(rename = "metadataCacheStatistics")]
3131 pub metadata_cache_statistics: Option<MetadataCacheStatistics>,
3132 /// Output only. Statistics of a BigQuery ML training job.
3133 #[serde(rename = "mlStatistics")]
3134 pub ml_statistics: Option<MlStatistics>,
3135 /// Deprecated.
3136 #[serde(rename = "modelTraining")]
3137 pub model_training: Option<BigQueryModelTraining>,
3138 /// Deprecated.
3139 #[serde(rename = "modelTrainingCurrentIteration")]
3140 pub model_training_current_iteration: Option<i32>,
3141 /// Deprecated.
3142 #[serde(rename = "modelTrainingExpectedTotalIteration")]
3143 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
3144 pub model_training_expected_total_iteration: Option<i64>,
3145 /// Output only. The number of rows affected by a DML statement. Present only for DML statements INSERT, UPDATE or DELETE.
3146 #[serde(rename = "numDmlAffectedRows")]
3147 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
3148 pub num_dml_affected_rows: Option<i64>,
3149 /// Output only. Performance insights.
3150 #[serde(rename = "performanceInsights")]
3151 pub performance_insights: Option<PerformanceInsights>,
3152 /// Output only. Query optimization information for a QUERY job.
3153 #[serde(rename = "queryInfo")]
3154 pub query_info: Option<QueryInfo>,
3155 /// Output only. Describes execution plan for the query.
3156 #[serde(rename = "queryPlan")]
3157 pub query_plan: Option<Vec<ExplainQueryStage>>,
3158 /// Output only. Referenced routines for the job.
3159 #[serde(rename = "referencedRoutines")]
3160 pub referenced_routines: Option<Vec<RoutineReference>>,
3161 /// Output only. Referenced tables for the job.
3162 #[serde(rename = "referencedTables")]
3163 pub referenced_tables: Option<Vec<TableReference>>,
3164 /// Output only. Job resource usage breakdown by reservation. This field reported misleading information and will no longer be populated.
3165 #[serde(rename = "reservationUsage")]
3166 pub reservation_usage: Option<Vec<JobStatistics2ReservationUsage>>,
3167 /// Output only. The schema of the results. Present only for successful dry run of non-legacy SQL queries.
3168 pub schema: Option<TableSchema>,
3169 /// Output only. Search query specific statistics.
3170 #[serde(rename = "searchStatistics")]
3171 pub search_statistics: Option<SearchStatistics>,
3172 /// Output only. Statistics of a Spark procedure job.
3173 #[serde(rename = "sparkStatistics")]
3174 pub spark_statistics: Option<SparkStatistics>,
3175 /// Output only. The type of query statement, if valid. Possible values: * `SELECT`: [`SELECT`](https://cloud.google.com/bigquery/docs/reference/standard-sql/query-syntax#select_list) statement. * `ASSERT`: [`ASSERT`](https://cloud.google.com/bigquery/docs/reference/standard-sql/debugging-statements#assert) statement. * `INSERT`: [`INSERT`](https://cloud.google.com/bigquery/docs/reference/standard-sql/dml-syntax#insert_statement) statement. * `UPDATE`: [`UPDATE`](https://cloud.google.com/bigquery/docs/reference/standard-sql/dml-syntax#update_statement) statement. * `DELETE`: [`DELETE`](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-manipulation-language) statement. * `MERGE`: [`MERGE`](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-manipulation-language) statement. * `CREATE_TABLE`: [`CREATE TABLE`](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#create_table_statement) statement, without `AS SELECT`. * `CREATE_TABLE_AS_SELECT`: [`CREATE TABLE AS SELECT`](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#create_table_statement) statement. * `CREATE_VIEW`: [`CREATE VIEW`](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#create_view_statement) statement. * `CREATE_MODEL`: [`CREATE MODEL`](https://cloud.google.com/bigquery-ml/docs/reference/standard-sql/bigqueryml-syntax-create#create_model_statement) statement. * `CREATE_MATERIALIZED_VIEW`: [`CREATE MATERIALIZED VIEW`](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#create_materialized_view_statement) statement. * `CREATE_FUNCTION`: [`CREATE FUNCTION`](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#create_function_statement) statement. * `CREATE_TABLE_FUNCTION`: [`CREATE TABLE FUNCTION`](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#create_table_function_statement) statement. * `CREATE_PROCEDURE`: [`CREATE PROCEDURE`](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#create_procedure) statement. * `CREATE_ROW_ACCESS_POLICY`: [`CREATE ROW ACCESS POLICY`](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#create_row_access_policy_statement) statement. * `CREATE_SCHEMA`: [`CREATE SCHEMA`](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#create_schema_statement) statement. * `CREATE_SNAPSHOT_TABLE`: [`CREATE SNAPSHOT TABLE`](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#create_snapshot_table_statement) statement. * `CREATE_SEARCH_INDEX`: [`CREATE SEARCH INDEX`](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#create_search_index_statement) statement. * `DROP_TABLE`: [`DROP TABLE`](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#drop_table_statement) statement. * `DROP_EXTERNAL_TABLE`: [`DROP EXTERNAL TABLE`](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#drop_external_table_statement) statement. * `DROP_VIEW`: [`DROP VIEW`](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#drop_view_statement) statement. * `DROP_MODEL`: [`DROP MODEL`](https://cloud.google.com/bigquery-ml/docs/reference/standard-sql/bigqueryml-syntax-drop-model) statement. * `DROP_MATERIALIZED_VIEW`: [`DROP MATERIALIZED VIEW`](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#drop_materialized_view_statement) statement. * `DROP_FUNCTION` : [`DROP FUNCTION`](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#drop_function_statement) statement. * `DROP_TABLE_FUNCTION` : [`DROP TABLE FUNCTION`](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#drop_table_function) statement. * `DROP_PROCEDURE`: [`DROP PROCEDURE`](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#drop_procedure_statement) statement. * `DROP_SEARCH_INDEX`: [`DROP SEARCH INDEX`](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#drop_search_index) statement. * `DROP_SCHEMA`: [`DROP SCHEMA`](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#drop_schema_statement) statement. * `DROP_SNAPSHOT_TABLE`: [`DROP SNAPSHOT TABLE`](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#drop_snapshot_table_statement) statement. * `DROP_ROW_ACCESS_POLICY`: [`DROP [ALL] ROW ACCESS POLICY|POLICIES`](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#drop_row_access_policy_statement) statement. * `ALTER_TABLE`: [`ALTER TABLE`](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#alter_table_set_options_statement) statement. * `ALTER_VIEW`: [`ALTER VIEW`](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#alter_view_set_options_statement) statement. * `ALTER_MATERIALIZED_VIEW`: [`ALTER MATERIALIZED VIEW`](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#alter_materialized_view_set_options_statement) statement. * `ALTER_SCHEMA`: [`ALTER SCHEMA`](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#alter_schema_set_options_statement) statement. * `SCRIPT`: [`SCRIPT`](https://cloud.google.com/bigquery/docs/reference/standard-sql/procedural-language). * `TRUNCATE_TABLE`: [`TRUNCATE TABLE`](https://cloud.google.com/bigquery/docs/reference/standard-sql/dml-syntax#truncate_table_statement) statement. * `CREATE_EXTERNAL_TABLE`: [`CREATE EXTERNAL TABLE`](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#create_external_table_statement) statement. * `EXPORT_DATA`: [`EXPORT DATA`](https://cloud.google.com/bigquery/docs/reference/standard-sql/other-statements#export_data_statement) statement. * `EXPORT_MODEL`: [`EXPORT MODEL`](https://cloud.google.com/bigquery-ml/docs/reference/standard-sql/bigqueryml-syntax-export-model) statement. * `LOAD_DATA`: [`LOAD DATA`](https://cloud.google.com/bigquery/docs/reference/standard-sql/other-statements#load_data_statement) statement. * `CALL`: [`CALL`](https://cloud.google.com/bigquery/docs/reference/standard-sql/procedural-language#call) statement.
3176 #[serde(rename = "statementType")]
3177 pub statement_type: Option<String>,
3178 /// Output only. Describes a timeline of job execution.
3179 pub timeline: Option<Vec<QueryTimelineSample>>,
3180 /// Output only. If the project is configured to use on-demand pricing, then this field contains the total bytes billed for the job. If the project is configured to use flat-rate pricing, then you are not billed for bytes and this field is informational only.
3181 #[serde(rename = "totalBytesBilled")]
3182 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
3183 pub total_bytes_billed: Option<i64>,
3184 /// Output only. Total bytes processed for the job.
3185 #[serde(rename = "totalBytesProcessed")]
3186 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
3187 pub total_bytes_processed: Option<i64>,
3188 /// Output only. For dry-run jobs, totalBytesProcessed is an estimate and this field specifies the accuracy of the estimate. Possible values can be: UNKNOWN: accuracy of the estimate is unknown. PRECISE: estimate is precise. LOWER_BOUND: estimate is lower bound of what the query would cost. UPPER_BOUND: estimate is upper bound of what the query would cost.
3189 #[serde(rename = "totalBytesProcessedAccuracy")]
3190 pub total_bytes_processed_accuracy: Option<String>,
3191 /// Output only. Total number of partitions processed from all partitioned tables referenced in the job.
3192 #[serde(rename = "totalPartitionsProcessed")]
3193 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
3194 pub total_partitions_processed: Option<i64>,
3195 /// Output only. Total slot milliseconds for the job that ran on external services and billed on the services SKU. This field is only populated for jobs that have external service costs, and is the total of the usage for costs whose billing method is `"SERVICES_SKU"`.
3196 #[serde(rename = "totalServicesSkuSlotMs")]
3197 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
3198 pub total_services_sku_slot_ms: Option<i64>,
3199 /// Output only. Slot-milliseconds for the job.
3200 #[serde(rename = "totalSlotMs")]
3201 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
3202 pub total_slot_ms: Option<i64>,
3203 /// Output only. Total bytes transferred for cross-cloud queries such as Cross Cloud Transfer and CREATE TABLE AS SELECT (CTAS).
3204 #[serde(rename = "transferredBytes")]
3205 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
3206 pub transferred_bytes: Option<i64>,
3207 /// Output only. GoogleSQL only: list of undeclared query parameters detected during a dry run validation.
3208 #[serde(rename = "undeclaredQueryParameters")]
3209 pub undeclared_query_parameters: Option<Vec<QueryParameter>>,
3210 /// Output only. Vector Search query specific statistics.
3211 #[serde(rename = "vectorSearchStatistics")]
3212 pub vector_search_statistics: Option<VectorSearchStatistics>,
3213}
3214
3215impl common::Part for JobStatistics2 {}
3216
3217/// Statistics for a load job.
3218///
3219/// This type is not used in any activity, and only used as *part* of another schema.
3220///
3221#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3222#[serde_with::serde_as]
3223#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3224pub struct JobStatistics3 {
3225 /// Output only. The number of bad records encountered. Note that if the job has failed because of more bad records encountered than the maximum allowed in the load job configuration, then this number can be less than the total number of bad records present in the input data.
3226 #[serde(rename = "badRecords")]
3227 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
3228 pub bad_records: Option<i64>,
3229 /// Output only. Number of bytes of source data in a load job.
3230 #[serde(rename = "inputFileBytes")]
3231 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
3232 pub input_file_bytes: Option<i64>,
3233 /// Output only. Number of source files in a load job.
3234 #[serde(rename = "inputFiles")]
3235 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
3236 pub input_files: Option<i64>,
3237 /// Output only. Size of the loaded data in bytes. Note that while a load job is in the running state, this value may change.
3238 #[serde(rename = "outputBytes")]
3239 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
3240 pub output_bytes: Option<i64>,
3241 /// Output only. Number of rows imported in a load job. Note that while an import job is in the running state, this value may change.
3242 #[serde(rename = "outputRows")]
3243 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
3244 pub output_rows: Option<i64>,
3245 /// Output only. Describes a timeline of job execution.
3246 pub timeline: Option<Vec<QueryTimelineSample>>,
3247}
3248
3249impl common::Part for JobStatistics3 {}
3250
3251/// Statistics for an extract job.
3252///
3253/// This type is not used in any activity, and only used as *part* of another schema.
3254///
3255#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3256#[serde_with::serde_as]
3257#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3258pub struct JobStatistics4 {
3259 /// Output only. Number of files per destination URI or URI pattern specified in the extract configuration. These values will be in the same order as the URIs specified in the 'destinationUris' field.
3260 #[serde(rename = "destinationUriFileCounts")]
3261 #[serde_as(as = "Option<Vec<serde_with::DisplayFromStr>>")]
3262 pub destination_uri_file_counts: Option<Vec<i64>>,
3263 /// Output only. Number of user bytes extracted into the result. This is the byte count as computed by BigQuery for billing purposes and doesn't have any relationship with the number of actual result bytes extracted in the desired format.
3264 #[serde(rename = "inputBytes")]
3265 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
3266 pub input_bytes: Option<i64>,
3267 /// Output only. Describes a timeline of job execution.
3268 pub timeline: Option<Vec<QueryTimelineSample>>,
3269}
3270
3271impl common::Part for JobStatistics4 {}
3272
3273/// Statistics for a copy job.
3274///
3275/// This type is not used in any activity, and only used as *part* of another schema.
3276///
3277#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3278#[serde_with::serde_as]
3279#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3280pub struct JobStatistics5 {
3281 /// Output only. Number of logical bytes copied to the destination table.
3282 #[serde(rename = "copiedLogicalBytes")]
3283 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
3284 pub copied_logical_bytes: Option<i64>,
3285 /// Output only. Number of rows copied to the destination table.
3286 #[serde(rename = "copiedRows")]
3287 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
3288 pub copied_rows: Option<i64>,
3289}
3290
3291impl common::Part for JobStatistics5 {}
3292
3293/// There is no detailed description.
3294///
3295/// This type is not used in any activity, and only used as *part* of another schema.
3296///
3297#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3298#[serde_with::serde_as]
3299#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3300pub struct JobStatus {
3301 /// Output only. Final error result of the job. If present, indicates that the job has completed and was unsuccessful.
3302 #[serde(rename = "errorResult")]
3303 pub error_result: Option<ErrorProto>,
3304 /// Output only. The first errors encountered during the running of the job. The final message includes the number of errors that caused the process to stop. Errors here do not necessarily mean that the job has not completed or was unsuccessful.
3305 pub errors: Option<Vec<ErrorProto>>,
3306 /// Output only. Running state of the job. Valid states include 'PENDING', 'RUNNING', and 'DONE'.
3307 pub state: Option<String>,
3308}
3309
3310impl common::Part for JobStatus {}
3311
3312/// Represents privacy policy associated with "join restrictions". Join restriction gives data providers the ability to enforce joins on the 'join_allowed_columns' when data is queried from a privacy protected view.
3313///
3314/// This type is not used in any activity, and only used as *part* of another schema.
3315///
3316#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3317#[serde_with::serde_as]
3318#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3319pub struct JoinRestrictionPolicy {
3320 /// Optional. The only columns that joins are allowed on. This field is must be specified for join_conditions JOIN_ANY and JOIN_ALL and it cannot be set for JOIN_BLOCKED.
3321 #[serde(rename = "joinAllowedColumns")]
3322 pub join_allowed_columns: Option<Vec<String>>,
3323 /// Optional. Specifies if a join is required or not on queries for the view. Default is JOIN_CONDITION_UNSPECIFIED.
3324 #[serde(rename = "joinCondition")]
3325 pub join_condition: Option<String>,
3326}
3327
3328impl common::Part for JoinRestrictionPolicy {}
3329
3330/// Represents a single JSON object.
3331///
3332/// This type is not used in any activity, and only used as *part* of another schema.
3333///
3334#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3335#[serde_with::serde_as]
3336#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3337pub struct JsonObject(pub Option<HashMap<String, JsonValue>>);
3338
3339impl common::Part for JsonObject {}
3340
3341/// Json Options for load and make external tables.
3342///
3343/// This type is not used in any activity, and only used as *part* of another schema.
3344///
3345#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3346#[serde_with::serde_as]
3347#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3348pub struct JsonOptions {
3349 /// Optional. The character encoding of the data. The supported values are UTF-8, UTF-16BE, UTF-16LE, UTF-32BE, and UTF-32LE. The default value is UTF-8.
3350 pub encoding: Option<String>,
3351}
3352
3353impl common::Part for JsonOptions {}
3354
3355/// There is no detailed description.
3356///
3357/// This type is not used in any activity, and only used as *part* of another schema.
3358///
3359/// The contained type is `Option<serde_json::Value>`.
3360///
3361#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3362#[serde_with::serde_as]
3363#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
3364pub struct JsonValue(pub serde_json::Value);
3365
3366impl Default for JsonValue {
3367 fn default() -> JsonValue {
3368 JsonValue(serde_json::Value::Null)
3369 }
3370}
3371
3372impl common::Part for JsonValue {}
3373
3374/// Metadata about the Linked Dataset.
3375///
3376/// This type is not used in any activity, and only used as *part* of another schema.
3377///
3378#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3379#[serde_with::serde_as]
3380#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3381pub struct LinkedDatasetMetadata {
3382 /// Output only. Specifies whether Linked Dataset is currently in a linked state or not.
3383 #[serde(rename = "linkState")]
3384 pub link_state: Option<String>,
3385}
3386
3387impl common::Part for LinkedDatasetMetadata {}
3388
3389/// A dataset source type which refers to another BigQuery dataset.
3390///
3391/// This type is not used in any activity, and only used as *part* of another schema.
3392///
3393#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3394#[serde_with::serde_as]
3395#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3396pub struct LinkedDatasetSource {
3397 /// The source dataset reference contains project numbers and not project ids.
3398 #[serde(rename = "sourceDataset")]
3399 pub source_dataset: Option<DatasetReference>,
3400}
3401
3402impl common::Part for LinkedDatasetSource {}
3403
3404/// Response format for a single page when listing BigQuery ML models.
3405///
3406/// # Activities
3407///
3408/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
3409/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
3410///
3411/// * [list models](ModelListCall) (response)
3412#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3413#[serde_with::serde_as]
3414#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3415pub struct ListModelsResponse {
3416 /// Models in the requested dataset. Only the following fields are populated: model_reference, model_type, creation_time, last_modified_time and labels.
3417 pub models: Option<Vec<Model>>,
3418 /// A token to request the next page of results.
3419 #[serde(rename = "nextPageToken")]
3420 pub next_page_token: Option<String>,
3421}
3422
3423impl common::ResponseResult for ListModelsResponse {}
3424
3425/// Describes the format of a single result page when listing routines.
3426///
3427/// # Activities
3428///
3429/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
3430/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
3431///
3432/// * [list routines](RoutineListCall) (response)
3433#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3434#[serde_with::serde_as]
3435#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3436pub struct ListRoutinesResponse {
3437 /// A token to request the next page of results.
3438 #[serde(rename = "nextPageToken")]
3439 pub next_page_token: Option<String>,
3440 /// Routines in the requested dataset. Unless read_mask is set in the request, only the following fields are populated: etag, project_id, dataset_id, routine_id, routine_type, creation_time, last_modified_time, language, and remote_function_options.
3441 pub routines: Option<Vec<Routine>>,
3442}
3443
3444impl common::ResponseResult for ListRoutinesResponse {}
3445
3446/// Response message for the ListRowAccessPolicies method.
3447///
3448/// # Activities
3449///
3450/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
3451/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
3452///
3453/// * [list row access policies](RowAccessPolicyListCall) (response)
3454#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3455#[serde_with::serde_as]
3456#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3457pub struct ListRowAccessPoliciesResponse {
3458 /// A token to request the next page of results.
3459 #[serde(rename = "nextPageToken")]
3460 pub next_page_token: Option<String>,
3461 /// Row access policies on the requested table.
3462 #[serde(rename = "rowAccessPolicies")]
3463 pub row_access_policies: Option<Vec<RowAccessPolicy>>,
3464}
3465
3466impl common::ResponseResult for ListRowAccessPoliciesResponse {}
3467
3468/// Statistics for a LOAD query.
3469///
3470/// This type is not used in any activity, and only used as *part* of another schema.
3471///
3472#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3473#[serde_with::serde_as]
3474#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3475pub struct LoadQueryStatistics {
3476 /// Output only. The number of bad records encountered while processing a LOAD query. Note that if the job has failed because of more bad records encountered than the maximum allowed in the load job configuration, then this number can be less than the total number of bad records present in the input data.
3477 #[serde(rename = "badRecords")]
3478 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
3479 pub bad_records: Option<i64>,
3480 /// Output only. This field is deprecated. The number of bytes of source data copied over the network for a `LOAD` query. `transferred_bytes` has the canonical value for physical transferred bytes, which is used for BigQuery Omni billing.
3481 #[serde(rename = "bytesTransferred")]
3482 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
3483 pub bytes_transferred: Option<i64>,
3484 /// Output only. Number of bytes of source data in a LOAD query.
3485 #[serde(rename = "inputFileBytes")]
3486 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
3487 pub input_file_bytes: Option<i64>,
3488 /// Output only. Number of source files in a LOAD query.
3489 #[serde(rename = "inputFiles")]
3490 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
3491 pub input_files: Option<i64>,
3492 /// Output only. Size of the loaded data in bytes. Note that while a LOAD query is in the running state, this value may change.
3493 #[serde(rename = "outputBytes")]
3494 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
3495 pub output_bytes: Option<i64>,
3496 /// Output only. Number of rows imported in a LOAD query. Note that while a LOAD query is in the running state, this value may change.
3497 #[serde(rename = "outputRows")]
3498 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
3499 pub output_rows: Option<i64>,
3500}
3501
3502impl common::Part for LoadQueryStatistics {}
3503
3504/// A materialized view considered for a query job.
3505///
3506/// This type is not used in any activity, and only used as *part* of another schema.
3507///
3508#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3509#[serde_with::serde_as]
3510#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3511pub struct MaterializedView {
3512 /// Whether the materialized view is chosen for the query. A materialized view can be chosen to rewrite multiple parts of the same query. If a materialized view is chosen to rewrite any part of the query, then this field is true, even if the materialized view was not chosen to rewrite others parts.
3513 pub chosen: Option<bool>,
3514 /// If present, specifies a best-effort estimation of the bytes saved by using the materialized view rather than its base tables.
3515 #[serde(rename = "estimatedBytesSaved")]
3516 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
3517 pub estimated_bytes_saved: Option<i64>,
3518 /// If present, specifies the reason why the materialized view was not chosen for the query.
3519 #[serde(rename = "rejectedReason")]
3520 pub rejected_reason: Option<String>,
3521 /// The candidate materialized view.
3522 #[serde(rename = "tableReference")]
3523 pub table_reference: Option<TableReference>,
3524}
3525
3526impl common::Part for MaterializedView {}
3527
3528/// Definition and configuration of a materialized view.
3529///
3530/// This type is not used in any activity, and only used as *part* of another schema.
3531///
3532#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3533#[serde_with::serde_as]
3534#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3535pub struct MaterializedViewDefinition {
3536 /// Optional. This option declares the intention to construct a materialized view that isn't refreshed incrementally. Non-incremental materialized views support an expanded range of SQL queries. The `allow_non_incremental_definition` option can't be changed after the materialized view is created.
3537 #[serde(rename = "allowNonIncrementalDefinition")]
3538 pub allow_non_incremental_definition: Option<bool>,
3539 /// Optional. Enable automatic refresh of the materialized view when the base table is updated. The default value is "true".
3540 #[serde(rename = "enableRefresh")]
3541 pub enable_refresh: Option<bool>,
3542 /// Output only. The time when this materialized view was last refreshed, in milliseconds since the epoch.
3543 #[serde(rename = "lastRefreshTime")]
3544 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
3545 pub last_refresh_time: Option<i64>,
3546 /// [Optional] Max staleness of data that could be returned when materizlized view is queried (formatted as Google SQL Interval type).
3547 #[serde(rename = "maxStaleness")]
3548 #[serde_as(as = "Option<common::serde::standard_base64::Wrapper>")]
3549 pub max_staleness: Option<Vec<u8>>,
3550 /// Required. A query whose results are persisted.
3551 pub query: Option<String>,
3552 /// Optional. The maximum frequency at which this materialized view will be refreshed. The default value is "1800000" (30 minutes).
3553 #[serde(rename = "refreshIntervalMs")]
3554 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
3555 pub refresh_interval_ms: Option<i64>,
3556}
3557
3558impl common::Part for MaterializedViewDefinition {}
3559
3560/// Statistics of materialized views considered in a query job.
3561///
3562/// This type is not used in any activity, and only used as *part* of another schema.
3563///
3564#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3565#[serde_with::serde_as]
3566#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3567pub struct MaterializedViewStatistics {
3568 /// Materialized views considered for the query job. Only certain materialized views are used. For a detailed list, see the child message. If many materialized views are considered, then the list might be incomplete.
3569 #[serde(rename = "materializedView")]
3570 pub materialized_view: Option<Vec<MaterializedView>>,
3571}
3572
3573impl common::Part for MaterializedViewStatistics {}
3574
3575/// Status of a materialized view. The last refresh timestamp status is omitted here, but is present in the MaterializedViewDefinition message.
3576///
3577/// This type is not used in any activity, and only used as *part* of another schema.
3578///
3579#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3580#[serde_with::serde_as]
3581#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3582pub struct MaterializedViewStatus {
3583 /// Output only. Error result of the last automatic refresh. If present, indicates that the last automatic refresh was unsuccessful.
3584 #[serde(rename = "lastRefreshStatus")]
3585 pub last_refresh_status: Option<ErrorProto>,
3586 /// Output only. Refresh watermark of materialized view. The base tables' data were collected into the materialized view cache until this time.
3587 #[serde(rename = "refreshWatermark")]
3588 pub refresh_watermark: Option<chrono::DateTime<chrono::offset::Utc>>,
3589}
3590
3591impl common::Part for MaterializedViewStatus {}
3592
3593/// Statistics for metadata caching in queried tables.
3594///
3595/// This type is not used in any activity, and only used as *part* of another schema.
3596///
3597#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3598#[serde_with::serde_as]
3599#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3600pub struct MetadataCacheStatistics {
3601 /// Set for the Metadata caching eligible tables referenced in the query.
3602 #[serde(rename = "tableMetadataCacheUsage")]
3603 pub table_metadata_cache_usage: Option<Vec<TableMetadataCacheUsage>>,
3604}
3605
3606impl common::Part for MetadataCacheStatistics {}
3607
3608/// Job statistics specific to a BigQuery ML training job.
3609///
3610/// This type is not used in any activity, and only used as *part* of another schema.
3611///
3612#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3613#[serde_with::serde_as]
3614#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3615pub struct MlStatistics {
3616 /// Output only. Trials of a [hyperparameter tuning job](https://cloud.google.com/bigquery-ml/docs/reference/standard-sql/bigqueryml-syntax-hp-tuning-overview) sorted by trial_id.
3617 #[serde(rename = "hparamTrials")]
3618 pub hparam_trials: Option<Vec<HparamTuningTrial>>,
3619 /// Results for all completed iterations. Empty for [hyperparameter tuning jobs](https://cloud.google.com/bigquery-ml/docs/reference/standard-sql/bigqueryml-syntax-hp-tuning-overview).
3620 #[serde(rename = "iterationResults")]
3621 pub iteration_results: Option<Vec<IterationResult>>,
3622 /// Output only. Maximum number of iterations specified as max_iterations in the 'CREATE MODEL' query. The actual number of iterations may be less than this number due to early stop.
3623 #[serde(rename = "maxIterations")]
3624 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
3625 pub max_iterations: Option<i64>,
3626 /// Output only. The type of the model that is being trained.
3627 #[serde(rename = "modelType")]
3628 pub model_type: Option<String>,
3629 /// Output only. Training type of the job.
3630 #[serde(rename = "trainingType")]
3631 pub training_type: Option<String>,
3632}
3633
3634impl common::Part for MlStatistics {}
3635
3636/// There is no detailed description.
3637///
3638/// # Activities
3639///
3640/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
3641/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
3642///
3643/// * [delete models](ModelDeleteCall) (none)
3644/// * [get models](ModelGetCall) (response)
3645/// * [list models](ModelListCall) (none)
3646/// * [patch models](ModelPatchCall) (request|response)
3647#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3648#[serde_with::serde_as]
3649#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3650pub struct Model {
3651 /// The best trial_id across all training runs.
3652 #[serde(rename = "bestTrialId")]
3653 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
3654 pub best_trial_id: Option<i64>,
3655 /// Output only. The time when this model was created, in millisecs since the epoch.
3656 #[serde(rename = "creationTime")]
3657 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
3658 pub creation_time: Option<i64>,
3659 /// Output only. The default trial_id to use in TVFs when the trial_id is not passed in. For single-objective [hyperparameter tuning](https://cloud.google.com/bigquery-ml/docs/reference/standard-sql/bigqueryml-syntax-hp-tuning-overview) models, this is the best trial ID. For multi-objective [hyperparameter tuning](https://cloud.google.com/bigquery-ml/docs/reference/standard-sql/bigqueryml-syntax-hp-tuning-overview) models, this is the smallest trial ID among all Pareto optimal trials.
3660 #[serde(rename = "defaultTrialId")]
3661 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
3662 pub default_trial_id: Option<i64>,
3663 /// Optional. A user-friendly description of this model.
3664 pub description: Option<String>,
3665 /// Custom encryption configuration (e.g., Cloud KMS keys). This shows the encryption configuration of the model data while stored in BigQuery storage. This field can be used with PatchModel to update encryption key for an already encrypted model.
3666 #[serde(rename = "encryptionConfiguration")]
3667 pub encryption_configuration: Option<EncryptionConfiguration>,
3668 /// Output only. A hash of this resource.
3669 pub etag: Option<String>,
3670 /// Optional. The time when this model expires, in milliseconds since the epoch. If not present, the model will persist indefinitely. Expired models will be deleted and their storage reclaimed. The defaultTableExpirationMs property of the encapsulating dataset can be used to set a default expirationTime on newly created models.
3671 #[serde(rename = "expirationTime")]
3672 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
3673 pub expiration_time: Option<i64>,
3674 /// Output only. Input feature columns for the model inference. If the model is trained with TRANSFORM clause, these are the input of the TRANSFORM clause.
3675 #[serde(rename = "featureColumns")]
3676 pub feature_columns: Option<Vec<StandardSqlField>>,
3677 /// Optional. A descriptive name for this model.
3678 #[serde(rename = "friendlyName")]
3679 pub friendly_name: Option<String>,
3680 /// Output only. All hyperparameter search spaces in this model.
3681 #[serde(rename = "hparamSearchSpaces")]
3682 pub hparam_search_spaces: Option<HparamSearchSpaces>,
3683 /// Output only. Trials of a [hyperparameter tuning](https://cloud.google.com/bigquery-ml/docs/reference/standard-sql/bigqueryml-syntax-hp-tuning-overview) model sorted by trial_id.
3684 #[serde(rename = "hparamTrials")]
3685 pub hparam_trials: Option<Vec<HparamTuningTrial>>,
3686 /// Output only. Label columns that were used to train this model. The output of the model will have a "predicted_" prefix to these columns.
3687 #[serde(rename = "labelColumns")]
3688 pub label_columns: Option<Vec<StandardSqlField>>,
3689 /// The labels associated with this model. You can use these to organize and group your models. Label keys and values can be no longer than 63 characters, can only contain lowercase letters, numeric characters, underscores and dashes. International characters are allowed. Label values are optional. Label keys must start with a letter and each label in the list must have a different key.
3690 pub labels: Option<HashMap<String, String>>,
3691 /// Output only. The time when this model was last modified, in millisecs since the epoch.
3692 #[serde(rename = "lastModifiedTime")]
3693 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
3694 pub last_modified_time: Option<i64>,
3695 /// Output only. The geographic location where the model resides. This value is inherited from the dataset.
3696 pub location: Option<String>,
3697 /// Required. Unique identifier for this model.
3698 #[serde(rename = "modelReference")]
3699 pub model_reference: Option<ModelReference>,
3700 /// Output only. Type of the model resource.
3701 #[serde(rename = "modelType")]
3702 pub model_type: Option<String>,
3703 /// Output only. For single-objective [hyperparameter tuning](https://cloud.google.com/bigquery-ml/docs/reference/standard-sql/bigqueryml-syntax-hp-tuning-overview) models, it only contains the best trial. For multi-objective [hyperparameter tuning](https://cloud.google.com/bigquery-ml/docs/reference/standard-sql/bigqueryml-syntax-hp-tuning-overview) models, it contains all Pareto optimal trials sorted by trial_id.
3704 #[serde(rename = "optimalTrialIds")]
3705 #[serde_as(as = "Option<Vec<serde_with::DisplayFromStr>>")]
3706 pub optimal_trial_ids: Option<Vec<i64>>,
3707 /// Output only. Remote model info
3708 #[serde(rename = "remoteModelInfo")]
3709 pub remote_model_info: Option<RemoteModelInfo>,
3710 /// Information for all training runs in increasing order of start_time.
3711 #[serde(rename = "trainingRuns")]
3712 pub training_runs: Option<Vec<TrainingRun>>,
3713 /// Output only. This field will be populated if a TRANSFORM clause was used to train a model. TRANSFORM clause (if used) takes feature_columns as input and outputs transform_columns. transform_columns then are used to train the model.
3714 #[serde(rename = "transformColumns")]
3715 pub transform_columns: Option<Vec<TransformColumn>>,
3716}
3717
3718impl common::RequestValue for Model {}
3719impl common::Resource for Model {}
3720impl common::ResponseResult for Model {}
3721
3722/// There is no detailed description.
3723///
3724/// This type is not used in any activity, and only used as *part* of another schema.
3725///
3726#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3727#[serde_with::serde_as]
3728#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3729pub struct ModelDefinition {
3730 /// Deprecated.
3731 #[serde(rename = "modelOptions")]
3732 pub model_options: Option<ModelDefinitionModelOptions>,
3733 /// Deprecated.
3734 #[serde(rename = "trainingRuns")]
3735 pub training_runs: Option<Vec<BqmlTrainingRun>>,
3736}
3737
3738impl common::Part for ModelDefinition {}
3739
3740/// Options related to model extraction.
3741///
3742/// This type is not used in any activity, and only used as *part* of another schema.
3743///
3744#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3745#[serde_with::serde_as]
3746#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3747pub struct ModelExtractOptions {
3748 /// The 1-based ID of the trial to be exported from a hyperparameter tuning model. If not specified, the trial with id = [Model](https://cloud.google.com/bigquery/docs/reference/rest/v2/models#resource:-model).defaultTrialId is exported. This field is ignored for models not trained with hyperparameter tuning.
3749 #[serde(rename = "trialId")]
3750 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
3751 pub trial_id: Option<i64>,
3752}
3753
3754impl common::Part for ModelExtractOptions {}
3755
3756/// Id path of a model.
3757///
3758/// This type is not used in any activity, and only used as *part* of another schema.
3759///
3760#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3761#[serde_with::serde_as]
3762#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3763pub struct ModelReference {
3764 /// Required. The ID of the dataset containing this model.
3765 #[serde(rename = "datasetId")]
3766 pub dataset_id: Option<String>,
3767 /// Required. The ID of the model. The ID must contain only letters (a-z, A-Z), numbers (0-9), or underscores (_). The maximum length is 1,024 characters.
3768 #[serde(rename = "modelId")]
3769 pub model_id: Option<String>,
3770 /// Required. The ID of the project containing this model.
3771 #[serde(rename = "projectId")]
3772 pub project_id: Option<String>,
3773}
3774
3775impl common::Part for ModelReference {}
3776
3777/// Evaluation metrics for multi-class classification/classifier models.
3778///
3779/// This type is not used in any activity, and only used as *part* of another schema.
3780///
3781#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3782#[serde_with::serde_as]
3783#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3784pub struct MultiClassClassificationMetrics {
3785 /// Aggregate classification metrics.
3786 #[serde(rename = "aggregateClassificationMetrics")]
3787 pub aggregate_classification_metrics: Option<AggregateClassificationMetrics>,
3788 /// Confusion matrix at different thresholds.
3789 #[serde(rename = "confusionMatrixList")]
3790 pub confusion_matrix_list: Option<Vec<ConfusionMatrix>>,
3791}
3792
3793impl common::Part for MultiClassClassificationMetrics {}
3794
3795/// Parquet Options for load and make external tables.
3796///
3797/// This type is not used in any activity, and only used as *part* of another schema.
3798///
3799#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3800#[serde_with::serde_as]
3801#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3802pub struct ParquetOptions {
3803 /// Optional. Indicates whether to use schema inference specifically for Parquet LIST logical type.
3804 #[serde(rename = "enableListInference")]
3805 pub enable_list_inference: Option<bool>,
3806 /// Optional. Indicates whether to infer Parquet ENUM logical type as STRING instead of BYTES by default.
3807 #[serde(rename = "enumAsString")]
3808 pub enum_as_string: Option<bool>,
3809 /// Optional. Indicates how to represent a Parquet map if present.
3810 #[serde(rename = "mapTargetType")]
3811 pub map_target_type: Option<String>,
3812}
3813
3814impl common::Part for ParquetOptions {}
3815
3816/// Partition skew detailed information.
3817///
3818/// This type is not used in any activity, and only used as *part* of another schema.
3819///
3820#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3821#[serde_with::serde_as]
3822#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3823pub struct PartitionSkew {
3824 /// Output only. Source stages which produce skewed data.
3825 #[serde(rename = "skewSources")]
3826 pub skew_sources: Option<Vec<SkewSource>>,
3827}
3828
3829impl common::Part for PartitionSkew {}
3830
3831/// The partitioning column information.
3832///
3833/// This type is not used in any activity, and only used as *part* of another schema.
3834///
3835#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3836#[serde_with::serde_as]
3837#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3838pub struct PartitionedColumn {
3839 /// Required. The name of the partition column.
3840 pub field: Option<String>,
3841}
3842
3843impl common::Part for PartitionedColumn {}
3844
3845/// The partitioning information, which includes managed table, external table and metastore partitioned table partition information.
3846///
3847/// This type is not used in any activity, and only used as *part* of another schema.
3848///
3849#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3850#[serde_with::serde_as]
3851#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3852pub struct PartitioningDefinition {
3853 /// Optional. Details about each partitioning column. This field is output only for all partitioning types other than metastore partitioned tables. BigQuery native tables only support 1 partitioning column. Other table types may support 0, 1 or more partitioning columns. For metastore partitioned tables, the order must match the definition order in the Hive Metastore, where it must match the physical layout of the table. For example, CREATE TABLE a_table(id BIGINT, name STRING) PARTITIONED BY (city STRING, state STRING). In this case the values must be ['city', 'state'] in that order.
3854 #[serde(rename = "partitionedColumn")]
3855 pub partitioned_column: Option<Vec<PartitionedColumn>>,
3856}
3857
3858impl common::Part for PartitioningDefinition {}
3859
3860/// Performance insights for the job.
3861///
3862/// This type is not used in any activity, and only used as *part* of another schema.
3863///
3864#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3865#[serde_with::serde_as]
3866#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3867pub struct PerformanceInsights {
3868 /// Output only. Average execution ms of previous runs. Indicates the job ran slow compared to previous executions. To find previous executions, use INFORMATION_SCHEMA tables and filter jobs with same query hash.
3869 #[serde(rename = "avgPreviousExecutionMs")]
3870 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
3871 pub avg_previous_execution_ms: Option<i64>,
3872 /// Output only. Query stage performance insights compared to previous runs, for diagnosing performance regression.
3873 #[serde(rename = "stagePerformanceChangeInsights")]
3874 pub stage_performance_change_insights: Option<Vec<StagePerformanceChangeInsight>>,
3875 /// Output only. Standalone query stage performance insights, for exploring potential improvements.
3876 #[serde(rename = "stagePerformanceStandaloneInsights")]
3877 pub stage_performance_standalone_insights: Option<Vec<StagePerformanceStandaloneInsight>>,
3878}
3879
3880impl common::Part for PerformanceInsights {}
3881
3882/// An Identity and Access Management (IAM) policy, which specifies access controls for Google Cloud resources. A `Policy` is a collection of `bindings`. A `binding` binds one or more `members`, or principals, to a single `role`. Principals can be user accounts, service accounts, Google groups, and domains (such as G Suite). A `role` is a named list of permissions; each `role` can be an IAM predefined role or a user-created custom role. For some types of Google Cloud resources, a `binding` can also specify a `condition`, which is a logical expression that allows access to a resource only if the expression evaluates to `true`. A condition can add constraints based on attributes of the request, the resource, or both. To learn which resources support conditions in their IAM policies, see the [IAM documentation](https://cloud.google.com/iam/help/conditions/resource-policies). **JSON example:** `{ "bindings": [ { "role": "roles/resourcemanager.organizationAdmin", "members": [ "user:mike@example.com", "group:admins@example.com", "domain:google.com", "serviceAccount:my-project-id@appspot.gserviceaccount.com" ] }, { "role": "roles/resourcemanager.organizationViewer", "members": [ "user:eve@example.com" ], "condition": { "title": "expirable access", "description": "Does not grant access after Sep 2020", "expression": "request.time < timestamp('2020-10-01T00:00:00.000Z')", } } ], "etag": "BwWWja0YfJA=", "version": 3 }` **YAML example:** `bindings: - members: - user:mike@example.com - group:admins@example.com - domain:google.com - serviceAccount:my-project-id@appspot.gserviceaccount.com role: roles/resourcemanager.organizationAdmin - members: - user:eve@example.com role: roles/resourcemanager.organizationViewer condition: title: expirable access description: Does not grant access after Sep 2020 expression: request.time < timestamp('2020-10-01T00:00:00.000Z') etag: BwWWja0YfJA= version: 3` For a description of IAM and its features, see the [IAM documentation](https://cloud.google.com/iam/docs/).
3883///
3884/// # Activities
3885///
3886/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
3887/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
3888///
3889/// * [get iam policy routines](RoutineGetIamPolicyCall) (response)
3890/// * [set iam policy routines](RoutineSetIamPolicyCall) (response)
3891/// * [get iam policy row access policies](RowAccessPolicyGetIamPolicyCall) (response)
3892/// * [get iam policy tables](TableGetIamPolicyCall) (response)
3893/// * [set iam policy tables](TableSetIamPolicyCall) (response)
3894#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3895#[serde_with::serde_as]
3896#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3897pub struct Policy {
3898 /// Specifies cloud audit logging configuration for this policy.
3899 #[serde(rename = "auditConfigs")]
3900 pub audit_configs: Option<Vec<AuditConfig>>,
3901 /// Associates a list of `members`, or principals, with a `role`. Optionally, may specify a `condition` that determines how and when the `bindings` are applied. Each of the `bindings` must contain at least one principal. The `bindings` in a `Policy` can refer to up to 1,500 principals; up to 250 of these principals can be Google groups. Each occurrence of a principal counts towards these limits. For example, if the `bindings` grant 50 different roles to `user:alice@example.com`, and not to any other principal, then you can add another 1,450 principals to the `bindings` in the `Policy`.
3902 pub bindings: Option<Vec<Binding>>,
3903 /// `etag` is used for optimistic concurrency control as a way to help prevent simultaneous updates of a policy from overwriting each other. It is strongly suggested that systems make use of the `etag` in the read-modify-write cycle to perform policy updates in order to avoid race conditions: An `etag` is returned in the response to `getIamPolicy`, and systems are expected to put that etag in the request to `setIamPolicy` to ensure that their change will be applied to the same version of the policy. **Important:** If you use IAM Conditions, you must include the `etag` field whenever you call `setIamPolicy`. If you omit this field, then IAM allows you to overwrite a version `3` policy with a version `1` policy, and all of the conditions in the version `3` policy are lost.
3904 #[serde_as(as = "Option<common::serde::standard_base64::Wrapper>")]
3905 pub etag: Option<Vec<u8>>,
3906 /// Specifies the format of the policy. Valid values are `0`, `1`, and `3`. Requests that specify an invalid value are rejected. Any operation that affects conditional role bindings must specify version `3`. This requirement applies to the following operations: * Getting a policy that includes a conditional role binding * Adding a conditional role binding to a policy * Changing a conditional role binding in a policy * Removing any role binding, with or without a condition, from a policy that includes conditions **Important:** If you use IAM Conditions, you must include the `etag` field whenever you call `setIamPolicy`. If you omit this field, then IAM allows you to overwrite a version `3` policy with a version `1` policy, and all of the conditions in the version `3` policy are lost. If a policy does not include any conditions, operations on that policy may specify any valid version or leave the field unset. To learn which resources support conditions in their IAM policies, see the [IAM documentation](https://cloud.google.com/iam/help/conditions/resource-policies).
3907 pub version: Option<i32>,
3908}
3909
3910impl common::ResponseResult for Policy {}
3911
3912/// Principal component infos, used only for eigen decomposition based models, e.g., PCA. Ordered by explained_variance in the descending order.
3913///
3914/// This type is not used in any activity, and only used as *part* of another schema.
3915///
3916#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3917#[serde_with::serde_as]
3918#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3919pub struct PrincipalComponentInfo {
3920 /// The explained_variance is pre-ordered in the descending order to compute the cumulative explained variance ratio.
3921 #[serde(rename = "cumulativeExplainedVarianceRatio")]
3922 pub cumulative_explained_variance_ratio: Option<f64>,
3923 /// Explained variance by this principal component, which is simply the eigenvalue.
3924 #[serde(rename = "explainedVariance")]
3925 pub explained_variance: Option<f64>,
3926 /// Explained_variance over the total explained variance.
3927 #[serde(rename = "explainedVarianceRatio")]
3928 pub explained_variance_ratio: Option<f64>,
3929 /// Id of the principal component.
3930 #[serde(rename = "principalComponentId")]
3931 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
3932 pub principal_component_id: Option<i64>,
3933}
3934
3935impl common::Part for PrincipalComponentInfo {}
3936
3937/// Represents privacy policy that contains the privacy requirements specified by the data owner. Currently, this is only supported on views.
3938///
3939/// This type is not used in any activity, and only used as *part* of another schema.
3940///
3941#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3942#[serde_with::serde_as]
3943#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3944pub struct PrivacyPolicy {
3945 /// Optional. Policy used for aggregation thresholds.
3946 #[serde(rename = "aggregationThresholdPolicy")]
3947 pub aggregation_threshold_policy: Option<AggregationThresholdPolicy>,
3948 /// Optional. Policy used for differential privacy.
3949 #[serde(rename = "differentialPrivacyPolicy")]
3950 pub differential_privacy_policy: Option<DifferentialPrivacyPolicy>,
3951 /// Optional. Join restriction policy is outside of the one of policies, since this policy can be set along with other policies. This policy gives data providers the ability to enforce joins on the 'join_allowed_columns' when data is queried from a privacy protected view.
3952 #[serde(rename = "joinRestrictionPolicy")]
3953 pub join_restriction_policy: Option<JoinRestrictionPolicy>,
3954}
3955
3956impl common::Part for PrivacyPolicy {}
3957
3958/// Response object of ListProjects
3959///
3960/// # Activities
3961///
3962/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
3963/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
3964///
3965/// * [list projects](ProjectListCall) (response)
3966#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3967#[serde_with::serde_as]
3968#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3969pub struct ProjectList {
3970 /// A hash of the page of results.
3971 pub etag: Option<String>,
3972 /// The resource type of the response.
3973 pub kind: Option<String>,
3974 /// Use this token to request the next page of results.
3975 #[serde(rename = "nextPageToken")]
3976 pub next_page_token: Option<String>,
3977 /// Projects to which the user has at least READ access.
3978 pub projects: Option<Vec<ProjectListProjects>>,
3979 /// The total number of projects in the page. A wrapper is used here because the field should still be in the response when the value is 0.
3980 #[serde(rename = "totalItems")]
3981 pub total_items: Option<i32>,
3982}
3983
3984impl common::ResponseResult for ProjectList {}
3985
3986/// A unique reference to a project.
3987///
3988/// This type is not used in any activity, and only used as *part* of another schema.
3989///
3990#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3991#[serde_with::serde_as]
3992#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3993pub struct ProjectReference {
3994 /// Required. ID of the project. Can be either the numeric ID or the assigned ID of the project.
3995 #[serde(rename = "projectId")]
3996 pub project_id: Option<String>,
3997}
3998
3999impl common::Part for ProjectReference {}
4000
4001/// The column metadata index pruning statistics.
4002///
4003/// This type is not used in any activity, and only used as *part* of another schema.
4004///
4005#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4006#[serde_with::serde_as]
4007#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4008pub struct PruningStats {
4009 /// The number of parallel inputs matched.
4010 #[serde(rename = "postCmetaPruningParallelInputCount")]
4011 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
4012 pub post_cmeta_pruning_parallel_input_count: Option<i64>,
4013 /// The number of partitions matched.
4014 #[serde(rename = "postCmetaPruningPartitionCount")]
4015 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
4016 pub post_cmeta_pruning_partition_count: Option<i64>,
4017 /// The number of parallel inputs scanned.
4018 #[serde(rename = "preCmetaPruningParallelInputCount")]
4019 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
4020 pub pre_cmeta_pruning_parallel_input_count: Option<i64>,
4021}
4022
4023impl common::Part for PruningStats {}
4024
4025/// Options for a user-defined Python function.
4026///
4027/// This type is not used in any activity, and only used as *part* of another schema.
4028///
4029#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4030#[serde_with::serde_as]
4031#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4032pub struct PythonOptions {
4033 /// Required. The name of the function defined in Python code as the entry point when the Python UDF is invoked.
4034 #[serde(rename = "entryPoint")]
4035 pub entry_point: Option<String>,
4036 /// Optional. A list of Python package names along with versions to be installed. Example: ["pandas>=2.1", "google-cloud-translate==3.11"]. For more information, see [Use third-party packages](https://cloud.google.com/bigquery/docs/user-defined-functions-python#third-party-packages).
4037 pub packages: Option<Vec<String>>,
4038}
4039
4040impl common::Part for PythonOptions {}
4041
4042/// Query optimization information for a QUERY job.
4043///
4044/// This type is not used in any activity, and only used as *part* of another schema.
4045///
4046#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4047#[serde_with::serde_as]
4048#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4049pub struct QueryInfo {
4050 /// Output only. Information about query optimizations.
4051 #[serde(rename = "optimizationDetails")]
4052 pub optimization_details: Option<HashMap<String, serde_json::Value>>,
4053}
4054
4055impl common::Part for QueryInfo {}
4056
4057/// A parameter given to a query.
4058///
4059/// This type is not used in any activity, and only used as *part* of another schema.
4060///
4061#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4062#[serde_with::serde_as]
4063#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4064pub struct QueryParameter {
4065 /// Optional. If unset, this is a positional parameter. Otherwise, should be unique within a query.
4066 pub name: Option<String>,
4067 /// Required. The type of this parameter.
4068 #[serde(rename = "parameterType")]
4069 pub parameter_type: Option<QueryParameterType>,
4070 /// Required. The value of this parameter.
4071 #[serde(rename = "parameterValue")]
4072 pub parameter_value: Option<QueryParameterValue>,
4073}
4074
4075impl common::Part for QueryParameter {}
4076
4077/// The type of a query parameter.
4078///
4079/// This type is not used in any activity, and only used as *part* of another schema.
4080///
4081#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4082#[serde_with::serde_as]
4083#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4084pub struct QueryParameterType {
4085 /// Optional. The type of the array's elements, if this is an array.
4086 #[serde(rename = "arrayType")]
4087 pub array_type: Option<Option<Box<QueryParameterType>>>,
4088 /// Optional. The element type of the range, if this is a range.
4089 #[serde(rename = "rangeElementType")]
4090 pub range_element_type: Option<Option<Box<QueryParameterType>>>,
4091 /// Optional. The types of the fields of this struct, in order, if this is a struct.
4092 #[serde(rename = "structTypes")]
4093 pub struct_types: Option<Vec<QueryParameterTypeStructTypes>>,
4094 /// Optional. Precision (maximum number of total digits in base 10) for seconds of TIMESTAMP type. Possible values include: * 6 (Default, for TIMESTAMP type with microsecond precision) * 12 (For TIMESTAMP type with picosecond precision)
4095 #[serde(rename = "timestampPrecision")]
4096 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
4097 pub timestamp_precision: Option<i64>,
4098 /// Required. The top level type of this field.
4099 #[serde(rename = "type")]
4100 pub type_: Option<String>,
4101}
4102
4103impl common::Part for QueryParameterType {}
4104
4105/// The value of a query parameter.
4106///
4107/// This type is not used in any activity, and only used as *part* of another schema.
4108///
4109#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4110#[serde_with::serde_as]
4111#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4112pub struct QueryParameterValue {
4113 /// Optional. The array values, if this is an array type.
4114 #[serde(rename = "arrayValues")]
4115 pub array_values: Option<Vec<QueryParameterValue>>,
4116 /// Optional. The range value, if this is a range type.
4117 #[serde(rename = "rangeValue")]
4118 pub range_value: Option<RangeValue>,
4119 /// The struct field values.
4120 #[serde(rename = "structValues")]
4121 pub struct_values: Option<HashMap<String, QueryParameterValue>>,
4122 /// Optional. The value of this value, if a simple scalar type.
4123 pub value: Option<String>,
4124}
4125
4126impl common::Part for QueryParameterValue {}
4127
4128/// Describes the format of the jobs.query request.
4129///
4130/// # Activities
4131///
4132/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
4133/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
4134///
4135/// * [query jobs](JobQueryCall) (request)
4136#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4137#[serde_with::serde_as]
4138#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4139pub struct QueryRequest {
4140 /// Optional. Connection properties which can modify the query behavior.
4141 #[serde(rename = "connectionProperties")]
4142 pub connection_properties: Option<Vec<ConnectionProperty>>,
4143 /// [Optional] Specifies whether the query should be executed as a continuous query. The default value is false.
4144 pub continuous: Option<bool>,
4145 /// Optional. If true, creates a new session using a randomly generated session_id. If false, runs query with an existing session_id passed in ConnectionProperty, otherwise runs query in non-session mode. The session location will be set to QueryRequest.location if it is present, otherwise it's set to the default location based on existing routing logic.
4146 #[serde(rename = "createSession")]
4147 pub create_session: Option<bool>,
4148 /// Optional. Specifies the default datasetId and projectId to assume for any unqualified table names in the query. If not set, all table names in the query string must be qualified in the format 'datasetId.tableId'.
4149 #[serde(rename = "defaultDataset")]
4150 pub default_dataset: Option<DatasetReference>,
4151 /// Optional. Custom encryption configuration (e.g., Cloud KMS keys)
4152 #[serde(rename = "destinationEncryptionConfiguration")]
4153 pub destination_encryption_configuration: Option<EncryptionConfiguration>,
4154 /// Optional. If set to true, BigQuery doesn't run the job. Instead, if the query is valid, BigQuery returns statistics about the job such as how many bytes would be processed. If the query is invalid, an error returns. The default value is false.
4155 #[serde(rename = "dryRun")]
4156 pub dry_run: Option<bool>,
4157 /// Optional. Output format adjustments.
4158 #[serde(rename = "formatOptions")]
4159 pub format_options: Option<DataFormatOptions>,
4160 /// Optional. If not set, jobs are always required. If set, the query request will follow the behavior described JobCreationMode.
4161 #[serde(rename = "jobCreationMode")]
4162 pub job_creation_mode: Option<String>,
4163 /// Optional. Job timeout in milliseconds. If this time limit is exceeded, BigQuery will attempt to stop a longer job, but may not always succeed in canceling it before the job completes. For example, a job that takes more than 60 seconds to complete has a better chance of being stopped than a job that takes 10 seconds to complete. This timeout applies to the query even if a job does not need to be created.
4164 #[serde(rename = "jobTimeoutMs")]
4165 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
4166 pub job_timeout_ms: Option<i64>,
4167 /// The resource type of the request.
4168 pub kind: Option<String>,
4169 /// Optional. The labels associated with this query. Labels can be used to organize and group query jobs. Label keys and values can be no longer than 63 characters, can only contain lowercase letters, numeric characters, underscores and dashes. International characters are allowed. Label keys must start with a letter and each label in the list must have a different key.
4170 pub labels: Option<HashMap<String, String>>,
4171 /// The geographic location where the job should run. For more information, see how to [specify locations](https://cloud.google.com/bigquery/docs/locations#specify_locations).
4172 pub location: Option<String>,
4173 /// Optional. The maximum number of rows of data to return per page of results. Setting this flag to a small value such as 1000 and then paging through results might improve reliability when the query result set is large. In addition to this limit, responses are also limited to 10 MB. By default, there is no maximum row count, and only the byte limit applies.
4174 #[serde(rename = "maxResults")]
4175 pub max_results: Option<u32>,
4176 /// Optional. A target limit on the rate of slot consumption by this query. If set to a value > 0, BigQuery will attempt to limit the rate of slot consumption by this query to keep it below the configured limit, even if the query is eligible for more slots based on fair scheduling. The unused slots will be available for other jobs and queries to use. Note: This feature is not yet generally available.
4177 #[serde(rename = "maxSlots")]
4178 pub max_slots: Option<i32>,
4179 /// Optional. Limits the bytes billed for this query. Queries with bytes billed above this limit will fail (without incurring a charge). If unspecified, the project default is used.
4180 #[serde(rename = "maximumBytesBilled")]
4181 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
4182 pub maximum_bytes_billed: Option<i64>,
4183 /// GoogleSQL only. Set to POSITIONAL to use positional (?) query parameters or to NAMED to use named (@myparam) query parameters in this query.
4184 #[serde(rename = "parameterMode")]
4185 pub parameter_mode: Option<String>,
4186 /// This property is deprecated.
4187 #[serde(rename = "preserveNulls")]
4188 pub preserve_nulls: Option<bool>,
4189 /// Required. A query string to execute, using Google Standard SQL or legacy SQL syntax. Example: "SELECT COUNT(f1) FROM myProjectId.myDatasetId.myTableId".
4190 pub query: Option<String>,
4191 /// Query parameters for GoogleSQL queries.
4192 #[serde(rename = "queryParameters")]
4193 pub query_parameters: Option<Vec<QueryParameter>>,
4194 /// Optional. A unique user provided identifier to ensure idempotent behavior for queries. Note that this is different from the job_id. It has the following properties: 1. It is case-sensitive, limited to up to 36 ASCII characters. A UUID is recommended. 2. Read only queries can ignore this token since they are nullipotent by definition. 3. For the purposes of idempotency ensured by the request_id, a request is considered duplicate of another only if they have the same request_id and are actually duplicates. When determining whether a request is a duplicate of another request, all parameters in the request that may affect the result are considered. For example, query, connection_properties, query_parameters, use_legacy_sql are parameters that affect the result and are considered when determining whether a request is a duplicate, but properties like timeout_ms don't affect the result and are thus not considered. Dry run query requests are never considered duplicate of another request. 4. When a duplicate mutating query request is detected, it returns: a. the results of the mutation if it completes successfully within the timeout. b. the running operation if it is still in progress at the end of the timeout. 5. Its lifetime is limited to 15 minutes. In other words, if two requests are sent with the same request_id, but more than 15 minutes apart, idempotency is not guaranteed.
4195 #[serde(rename = "requestId")]
4196 pub request_id: Option<String>,
4197 /// Optional. The reservation that jobs.query request would use. User can specify a reservation to execute the job.query. The expected format is `projects/{project}/locations/{location}/reservations/{reservation}`.
4198 pub reservation: Option<String>,
4199 /// Optional. Optional: Specifies the maximum amount of time, in milliseconds, that the client is willing to wait for the query to complete. By default, this limit is 10 seconds (10,000 milliseconds). If the query is complete, the jobComplete field in the response is true. If the query has not yet completed, jobComplete is false. You can request a longer timeout period in the timeoutMs field. However, the call is not guaranteed to wait for the specified timeout; it typically returns after around 200 seconds (200,000 milliseconds), even if the query is not complete. If jobComplete is false, you can continue to wait for the query to complete by calling the getQueryResults method until the jobComplete field in the getQueryResults response is true.
4200 #[serde(rename = "timeoutMs")]
4201 pub timeout_ms: Option<u32>,
4202 /// Specifies whether to use BigQuery's legacy SQL dialect for this query. The default value is true. If set to false, the query will use BigQuery's GoogleSQL: https://cloud.google.com/bigquery/sql-reference/ When useLegacySql is set to false, the value of flattenResults is ignored; query will be run as if flattenResults is false.
4203 #[serde(rename = "useLegacySql")]
4204 pub use_legacy_sql: Option<bool>,
4205 /// Optional. Whether to look for the result in the query cache. The query cache is a best-effort cache that will be flushed whenever tables in the query are modified. The default value is true.
4206 #[serde(rename = "useQueryCache")]
4207 pub use_query_cache: Option<bool>,
4208 /// Optional. This is only supported for SELECT query. If set, the query is allowed to write results incrementally to the temporary result table. This may incur a performance penalty. This option cannot be used with Legacy SQL. This feature is not yet available.
4209 #[serde(rename = "writeIncrementalResults")]
4210 pub write_incremental_results: Option<bool>,
4211}
4212
4213impl common::RequestValue for QueryRequest {}
4214
4215/// There is no detailed description.
4216///
4217/// # Activities
4218///
4219/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
4220/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
4221///
4222/// * [query jobs](JobQueryCall) (response)
4223#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4224#[serde_with::serde_as]
4225#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4226pub struct QueryResponse {
4227 /// Whether the query result was fetched from the query cache.
4228 #[serde(rename = "cacheHit")]
4229 pub cache_hit: Option<bool>,
4230 /// Output only. Creation time of this query, in milliseconds since the epoch. This field will be present on all queries.
4231 #[serde(rename = "creationTime")]
4232 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
4233 pub creation_time: Option<i64>,
4234 /// Output only. Detailed statistics for DML statements INSERT, UPDATE, DELETE, MERGE or TRUNCATE.
4235 #[serde(rename = "dmlStats")]
4236 pub dml_stats: Option<DmlStatistics>,
4237 /// Output only. End time of this query, in milliseconds since the epoch. This field will be present whenever a query job is in the DONE state.
4238 #[serde(rename = "endTime")]
4239 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
4240 pub end_time: Option<i64>,
4241 /// Output only. The first errors or warnings encountered during the running of the job. The final message includes the number of errors that caused the process to stop. Errors here do not necessarily mean that the job has completed or was unsuccessful. For more information about error messages, see [Error messages](https://cloud.google.com/bigquery/docs/error-messages).
4242 pub errors: Option<Vec<ErrorProto>>,
4243 /// Whether the query has completed or not. If rows or totalRows are present, this will always be true. If this is false, totalRows will not be available.
4244 #[serde(rename = "jobComplete")]
4245 pub job_complete: Option<bool>,
4246 /// Optional. The reason why a Job was created. Only relevant when a job_reference is present in the response. If job_reference is not present it will always be unset.
4247 #[serde(rename = "jobCreationReason")]
4248 pub job_creation_reason: Option<JobCreationReason>,
4249 /// Reference to the Job that was created to run the query. This field will be present even if the original request timed out, in which case GetQueryResults can be used to read the results once the query has completed. Since this API only returns the first page of results, subsequent pages can be fetched via the same mechanism (GetQueryResults). If job_creation_mode was set to `JOB_CREATION_OPTIONAL` and the query completes without creating a job, this field will be empty.
4250 #[serde(rename = "jobReference")]
4251 pub job_reference: Option<JobReference>,
4252 /// The resource type.
4253 pub kind: Option<String>,
4254 /// Output only. The geographic location of the query. For more information about BigQuery locations, see: https://cloud.google.com/bigquery/docs/locations
4255 pub location: Option<String>,
4256 /// Output only. The number of rows affected by a DML statement. Present only for DML statements INSERT, UPDATE or DELETE.
4257 #[serde(rename = "numDmlAffectedRows")]
4258 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
4259 pub num_dml_affected_rows: Option<i64>,
4260 /// A token used for paging results. A non-empty token indicates that additional results are available. To see additional results, query the [`jobs.getQueryResults`](https://cloud.google.com/bigquery/docs/reference/rest/v2/jobs/getQueryResults) method. For more information, see [Paging through table data](https://cloud.google.com/bigquery/docs/paging-results).
4261 #[serde(rename = "pageToken")]
4262 pub page_token: Option<String>,
4263 /// Auto-generated ID for the query.
4264 #[serde(rename = "queryId")]
4265 pub query_id: Option<String>,
4266 /// An object with as many results as can be contained within the maximum permitted reply size. To get any additional rows, you can call GetQueryResults and specify the jobReference returned above.
4267 pub rows: Option<Vec<TableRow>>,
4268 /// The schema of the results. Present only when the query completes successfully.
4269 pub schema: Option<TableSchema>,
4270 /// Output only. Information of the session if this job is part of one.
4271 #[serde(rename = "sessionInfo")]
4272 pub session_info: Option<SessionInfo>,
4273 /// Output only. Start time of this query, in milliseconds since the epoch. This field will be present when the query job transitions from the PENDING state to either RUNNING or DONE.
4274 #[serde(rename = "startTime")]
4275 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
4276 pub start_time: Option<i64>,
4277 /// Output only. If the project is configured to use on-demand pricing, then this field contains the total bytes billed for the job. If the project is configured to use flat-rate pricing, then you are not billed for bytes and this field is informational only.
4278 #[serde(rename = "totalBytesBilled")]
4279 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
4280 pub total_bytes_billed: Option<i64>,
4281 /// The total number of bytes processed for this query. If this query was a dry run, this is the number of bytes that would be processed if the query were run.
4282 #[serde(rename = "totalBytesProcessed")]
4283 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
4284 pub total_bytes_processed: Option<i64>,
4285 /// The total number of rows in the complete query result set, which can be more than the number of rows in this single page of results.
4286 #[serde(rename = "totalRows")]
4287 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
4288 pub total_rows: Option<u64>,
4289 /// Output only. Number of slot ms the user is actually billed for.
4290 #[serde(rename = "totalSlotMs")]
4291 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
4292 pub total_slot_ms: Option<i64>,
4293}
4294
4295impl common::ResponseResult for QueryResponse {}
4296
4297/// Summary of the state of query execution at a given time.
4298///
4299/// This type is not used in any activity, and only used as *part* of another schema.
4300///
4301#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4302#[serde_with::serde_as]
4303#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4304pub struct QueryTimelineSample {
4305 /// Total number of active workers. This does not correspond directly to slot usage. This is the largest value observed since the last sample.
4306 #[serde(rename = "activeUnits")]
4307 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
4308 pub active_units: Option<i64>,
4309 /// Total parallel units of work completed by this query.
4310 #[serde(rename = "completedUnits")]
4311 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
4312 pub completed_units: Option<i64>,
4313 /// Milliseconds elapsed since the start of query execution.
4314 #[serde(rename = "elapsedMs")]
4315 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
4316 pub elapsed_ms: Option<i64>,
4317 /// Units of work that can be scheduled immediately. Providing additional slots for these units of work will accelerate the query, if no other query in the reservation needs additional slots.
4318 #[serde(rename = "estimatedRunnableUnits")]
4319 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
4320 pub estimated_runnable_units: Option<i64>,
4321 /// Total units of work remaining for the query. This number can be revised (increased or decreased) while the query is running.
4322 #[serde(rename = "pendingUnits")]
4323 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
4324 pub pending_units: Option<i64>,
4325 /// Total shuffle usage ratio in shuffle RAM per reservation of this query. This will be provided for reservation customers only.
4326 #[serde(rename = "shuffleRamUsageRatio")]
4327 pub shuffle_ram_usage_ratio: Option<f64>,
4328 /// Cumulative slot-ms consumed by the query.
4329 #[serde(rename = "totalSlotMs")]
4330 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
4331 pub total_slot_ms: Option<i64>,
4332}
4333
4334impl common::Part for QueryTimelineSample {}
4335
4336/// There is no detailed description.
4337///
4338/// This type is not used in any activity, and only used as *part* of another schema.
4339///
4340#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4341#[serde_with::serde_as]
4342#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4343pub struct RangePartitioning {
4344 /// Required. The name of the column to partition the table on. It must be a top-level, INT64 column whose mode is NULLABLE or REQUIRED.
4345 pub field: Option<String>,
4346 /// [Experimental] Defines the ranges for range partitioning.
4347 pub range: Option<RangePartitioningRange>,
4348}
4349
4350impl common::Part for RangePartitioning {}
4351
4352/// Represents the value of a range.
4353///
4354/// This type is not used in any activity, and only used as *part* of another schema.
4355///
4356#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4357#[serde_with::serde_as]
4358#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4359pub struct RangeValue {
4360 _never_set: Option<bool>,
4361}
4362
4363impl common::Part for RangeValue {}
4364
4365/// Evaluation metrics used by weighted-ALS models specified by feedback_type=implicit.
4366///
4367/// This type is not used in any activity, and only used as *part* of another schema.
4368///
4369#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4370#[serde_with::serde_as]
4371#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4372pub struct RankingMetrics {
4373 /// Determines the goodness of a ranking by computing the percentile rank from the predicted confidence and dividing it by the original rank.
4374 #[serde(rename = "averageRank")]
4375 pub average_rank: Option<f64>,
4376 /// Calculates a precision per user for all the items by ranking them and then averages all the precisions across all the users.
4377 #[serde(rename = "meanAveragePrecision")]
4378 pub mean_average_precision: Option<f64>,
4379 /// Similar to the mean squared error computed in regression and explicit recommendation models except instead of computing the rating directly, the output from evaluate is computed against a preference which is 1 or 0 depending on if the rating exists or not.
4380 #[serde(rename = "meanSquaredError")]
4381 pub mean_squared_error: Option<f64>,
4382 /// A metric to determine the goodness of a ranking calculated from the predicted confidence by comparing it to an ideal rank measured by the original ratings.
4383 #[serde(rename = "normalizedDiscountedCumulativeGain")]
4384 pub normalized_discounted_cumulative_gain: Option<f64>,
4385}
4386
4387impl common::Part for RankingMetrics {}
4388
4389/// Evaluation metrics for regression and explicit feedback type matrix factorization models.
4390///
4391/// This type is not used in any activity, and only used as *part* of another schema.
4392///
4393#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4394#[serde_with::serde_as]
4395#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4396pub struct RegressionMetrics {
4397 /// Mean absolute error.
4398 #[serde(rename = "meanAbsoluteError")]
4399 pub mean_absolute_error: Option<f64>,
4400 /// Mean squared error.
4401 #[serde(rename = "meanSquaredError")]
4402 pub mean_squared_error: Option<f64>,
4403 /// Mean squared log error.
4404 #[serde(rename = "meanSquaredLogError")]
4405 pub mean_squared_log_error: Option<f64>,
4406 /// Median absolute error.
4407 #[serde(rename = "medianAbsoluteError")]
4408 pub median_absolute_error: Option<f64>,
4409 /// R^2 score. This corresponds to r2_score in ML.EVALUATE.
4410 #[serde(rename = "rSquared")]
4411 pub r_squared: Option<f64>,
4412}
4413
4414impl common::Part for RegressionMetrics {}
4415
4416/// Options for a remote user-defined function.
4417///
4418/// This type is not used in any activity, and only used as *part* of another schema.
4419///
4420#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4421#[serde_with::serde_as]
4422#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4423pub struct RemoteFunctionOptions {
4424 /// Fully qualified name of the user-provided connection object which holds the authentication information to send requests to the remote service. Format: ```"projects/{projectId}/locations/{locationId}/connections/{connectionId}"```
4425 pub connection: Option<String>,
4426 /// Endpoint of the user-provided remote service, e.g. ```https://us-east1-my_gcf_project.cloudfunctions.net/remote_add```
4427 pub endpoint: Option<String>,
4428 /// Max number of rows in each batch sent to the remote service. If absent or if 0, BigQuery dynamically decides the number of rows in a batch.
4429 #[serde(rename = "maxBatchingRows")]
4430 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
4431 pub max_batching_rows: Option<i64>,
4432 /// User-defined context as a set of key/value pairs, which will be sent as function invocation context together with batched arguments in the requests to the remote service. The total number of bytes of keys and values must be less than 8KB.
4433 #[serde(rename = "userDefinedContext")]
4434 pub user_defined_context: Option<HashMap<String, String>>,
4435}
4436
4437impl common::Part for RemoteFunctionOptions {}
4438
4439/// Remote Model Info
4440///
4441/// This type is not used in any activity, and only used as *part* of another schema.
4442///
4443#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4444#[serde_with::serde_as]
4445#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4446pub struct RemoteModelInfo {
4447 /// Output only. Fully qualified name of the user-provided connection object of the remote model. Format: ```"projects/{project_id}/locations/{location_id}/connections/{connection_id}"```
4448 pub connection: Option<String>,
4449 /// Output only. The endpoint for remote model.
4450 pub endpoint: Option<String>,
4451 /// Output only. Max number of rows in each batch sent to the remote service. If unset, the number of rows in each batch is set dynamically.
4452 #[serde(rename = "maxBatchingRows")]
4453 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
4454 pub max_batching_rows: Option<i64>,
4455 /// Output only. The model version for LLM.
4456 #[serde(rename = "remoteModelVersion")]
4457 pub remote_model_version: Option<String>,
4458 /// Output only. The remote service type for remote model.
4459 #[serde(rename = "remoteServiceType")]
4460 pub remote_service_type: Option<String>,
4461 /// Output only. The name of the speech recognizer to use for speech recognition. The expected format is `projects/{project}/locations/{location}/recognizers/{recognizer}`. Customers can specify this field at model creation. If not specified, a default recognizer `projects/{model project}/locations/global/recognizers/_` will be used. See more details at [recognizers](https://cloud.google.com/speech-to-text/v2/docs/reference/rest/v2/projects.locations.recognizers)
4462 #[serde(rename = "speechRecognizer")]
4463 pub speech_recognizer: Option<String>,
4464}
4465
4466impl common::Part for RemoteModelInfo {}
4467
4468/// There is no detailed description.
4469///
4470/// This type is not used in any activity, and only used as *part* of another schema.
4471///
4472#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4473#[serde_with::serde_as]
4474#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4475pub struct RestrictionConfig {
4476 /// Output only. Specifies the type of dataset/table restriction.
4477 #[serde(rename = "type")]
4478 pub type_: Option<String>,
4479}
4480
4481impl common::Part for RestrictionConfig {}
4482
4483/// A user-defined function or a stored procedure.
4484///
4485/// # Activities
4486///
4487/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
4488/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
4489///
4490/// * [delete routines](RoutineDeleteCall) (none)
4491/// * [get routines](RoutineGetCall) (response)
4492/// * [get iam policy routines](RoutineGetIamPolicyCall) (none)
4493/// * [insert routines](RoutineInsertCall) (request|response)
4494/// * [list routines](RoutineListCall) (none)
4495/// * [set iam policy routines](RoutineSetIamPolicyCall) (none)
4496/// * [test iam permissions routines](RoutineTestIamPermissionCall) (none)
4497/// * [update routines](RoutineUpdateCall) (request|response)
4498#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4499#[serde_with::serde_as]
4500#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4501pub struct Routine {
4502 /// Optional.
4503 pub arguments: Option<Vec<Argument>>,
4504 /// Output only. The time when this routine was created, in milliseconds since the epoch.
4505 #[serde(rename = "creationTime")]
4506 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
4507 pub creation_time: Option<i64>,
4508 /// Optional. If set to `DATA_MASKING`, the function is validated and made available as a masking function. For more information, see [Create custom masking routines](https://cloud.google.com/bigquery/docs/user-defined-functions#custom-mask).
4509 #[serde(rename = "dataGovernanceType")]
4510 pub data_governance_type: Option<String>,
4511 /// Required. The body of the routine. For functions, this is the expression in the AS clause. If `language = "SQL"`, it is the substring inside (but excluding) the parentheses. For example, for the function created with the following statement: `CREATE FUNCTION JoinLines(x string, y string) as (concat(x, "\n", y))` The definition_body is `concat(x, "\n", y)` (\n is not replaced with linebreak). If `language="JAVASCRIPT"`, it is the evaluated string in the AS clause. For example, for the function created with the following statement: `CREATE FUNCTION f() RETURNS STRING LANGUAGE js AS 'return "\n";\n'` The definition_body is `return "\n";\n` Note that both \n are replaced with linebreaks. If `definition_body` references another routine, then that routine must be fully qualified with its project ID.
4512 #[serde(rename = "definitionBody")]
4513 pub definition_body: Option<String>,
4514 /// Optional. The description of the routine, if defined.
4515 pub description: Option<String>,
4516 /// Optional. The determinism level of the JavaScript UDF, if defined.
4517 #[serde(rename = "determinismLevel")]
4518 pub determinism_level: Option<String>,
4519 /// Output only. A hash of this resource.
4520 pub etag: Option<String>,
4521 /// Optional. Options for the runtime of the external system executing the routine. This field is only applicable for Python UDFs. [Preview](https://cloud.google.com/products/#product-launch-stages)
4522 #[serde(rename = "externalRuntimeOptions")]
4523 pub external_runtime_options: Option<ExternalRuntimeOptions>,
4524 /// Optional. If language = "JAVASCRIPT", this field stores the path of the imported JAVASCRIPT libraries.
4525 #[serde(rename = "importedLibraries")]
4526 pub imported_libraries: Option<Vec<String>>,
4527 /// Optional. Defaults to "SQL" if remote_function_options field is absent, not set otherwise.
4528 pub language: Option<String>,
4529 /// Output only. The time when this routine was last modified, in milliseconds since the epoch.
4530 #[serde(rename = "lastModifiedTime")]
4531 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
4532 pub last_modified_time: Option<i64>,
4533 /// Optional. Options for the Python UDF. [Preview](https://cloud.google.com/products/#product-launch-stages)
4534 #[serde(rename = "pythonOptions")]
4535 pub python_options: Option<PythonOptions>,
4536 /// Optional. Remote function specific options.
4537 #[serde(rename = "remoteFunctionOptions")]
4538 pub remote_function_options: Option<RemoteFunctionOptions>,
4539 /// Optional. Can be set only if routine_type = "TABLE_VALUED_FUNCTION". If absent, the return table type is inferred from definition_body at query time in each query that references this routine. If present, then the columns in the evaluated table result will be cast to match the column types specified in return table type, at query time.
4540 #[serde(rename = "returnTableType")]
4541 pub return_table_type: Option<StandardSqlTableType>,
4542 /// Optional if language = "SQL"; required otherwise. Cannot be set if routine_type = "TABLE_VALUED_FUNCTION". If absent, the return type is inferred from definition_body at query time in each query that references this routine. If present, then the evaluated result will be cast to the specified returned type at query time. For example, for the functions created with the following statements: * `CREATE FUNCTION Add(x FLOAT64, y FLOAT64) RETURNS FLOAT64 AS (x + y);` * `CREATE FUNCTION Increment(x FLOAT64) AS (Add(x, 1));` * `CREATE FUNCTION Decrement(x FLOAT64) RETURNS FLOAT64 AS (Add(x, -1));` The return_type is `{type_kind: "FLOAT64"}` for `Add` and `Decrement`, and is absent for `Increment` (inferred as FLOAT64 at query time). Suppose the function `Add` is replaced by `CREATE OR REPLACE FUNCTION Add(x INT64, y INT64) AS (x + y);` Then the inferred return type of `Increment` is automatically changed to INT64 at query time, while the return type of `Decrement` remains FLOAT64.
4543 #[serde(rename = "returnType")]
4544 pub return_type: Option<StandardSqlDataType>,
4545 /// Required. Reference describing the ID of this routine.
4546 #[serde(rename = "routineReference")]
4547 pub routine_reference: Option<RoutineReference>,
4548 /// Required. The type of routine.
4549 #[serde(rename = "routineType")]
4550 pub routine_type: Option<String>,
4551 /// Optional. The security mode of the routine, if defined. If not defined, the security mode is automatically determined from the routine's configuration.
4552 #[serde(rename = "securityMode")]
4553 pub security_mode: Option<String>,
4554 /// Optional. Spark specific options.
4555 #[serde(rename = "sparkOptions")]
4556 pub spark_options: Option<SparkOptions>,
4557 /// Optional. Use this option to catch many common errors. Error checking is not exhaustive, and successfully creating a procedure doesn't guarantee that the procedure will successfully execute at runtime. If `strictMode` is set to `TRUE`, the procedure body is further checked for errors such as non-existent tables or columns. The `CREATE PROCEDURE` statement fails if the body fails any of these checks. If `strictMode` is set to `FALSE`, the procedure body is checked only for syntax. For procedures that invoke themselves recursively, specify `strictMode=FALSE` to avoid non-existent procedure errors during validation. Default value is `TRUE`.
4558 #[serde(rename = "strictMode")]
4559 pub strict_mode: Option<bool>,
4560}
4561
4562impl common::RequestValue for Routine {}
4563impl common::Resource for Routine {}
4564impl common::ResponseResult for Routine {}
4565
4566/// Id path of a routine.
4567///
4568/// This type is not used in any activity, and only used as *part* of another schema.
4569///
4570#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4571#[serde_with::serde_as]
4572#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4573pub struct RoutineReference {
4574 /// Required. The ID of the dataset containing this routine.
4575 #[serde(rename = "datasetId")]
4576 pub dataset_id: Option<String>,
4577 /// Required. The ID of the project containing this routine.
4578 #[serde(rename = "projectId")]
4579 pub project_id: Option<String>,
4580 /// Required. The ID of the routine. The ID must contain only letters (a-z, A-Z), numbers (0-9), or underscores (_). The maximum length is 256 characters.
4581 #[serde(rename = "routineId")]
4582 pub routine_id: Option<String>,
4583}
4584
4585impl common::Part for RoutineReference {}
4586
4587/// A single row in the confusion matrix.
4588///
4589/// This type is not used in any activity, and only used as *part* of another schema.
4590///
4591#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4592#[serde_with::serde_as]
4593#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4594pub struct Row {
4595 /// The original label of this row.
4596 #[serde(rename = "actualLabel")]
4597 pub actual_label: Option<String>,
4598 /// Info describing predicted label distribution.
4599 pub entries: Option<Vec<Entry>>,
4600}
4601
4602impl common::Part for Row {}
4603
4604/// Represents access on a subset of rows on the specified table, defined by its filter predicate. Access to the subset of rows is controlled by its IAM policy.
4605///
4606/// # Activities
4607///
4608/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
4609/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
4610///
4611/// * [get row access policies](RowAccessPolicyGetCall) (response)
4612/// * [insert row access policies](RowAccessPolicyInsertCall) (request|response)
4613/// * [update row access policies](RowAccessPolicyUpdateCall) (request|response)
4614#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4615#[serde_with::serde_as]
4616#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4617pub struct RowAccessPolicy {
4618 /// Output only. The time when this row access policy was created, in milliseconds since the epoch.
4619 #[serde(rename = "creationTime")]
4620 pub creation_time: Option<chrono::DateTime<chrono::offset::Utc>>,
4621 /// Output only. A hash of this resource.
4622 pub etag: Option<String>,
4623 /// Required. A SQL boolean expression that represents the rows defined by this row access policy, similar to the boolean expression in a WHERE clause of a SELECT query on a table. References to other tables, routines, and temporary functions are not supported. Examples: region="EU" date_field = CAST('2019-9-27' as DATE) nullable_field is not NULL numeric_field BETWEEN 1.0 AND 5.0
4624 #[serde(rename = "filterPredicate")]
4625 pub filter_predicate: Option<String>,
4626 /// Optional. Input only. The optional list of iam_member users or groups that specifies the initial members that the row-level access policy should be created with. grantees types: - "user:alice@example.com": An email address that represents a specific Google account. - "serviceAccount:my-other-app@appspot.gserviceaccount.com": An email address that represents a service account. - "group:admins@example.com": An email address that represents a Google group. - "domain:example.com":The Google Workspace domain (primary) that represents all the users of that domain. - "allAuthenticatedUsers": A special identifier that represents all service accounts and all users on the internet who have authenticated with a Google Account. This identifier includes accounts that aren't connected to a Google Workspace or Cloud Identity domain, such as personal Gmail accounts. Users who aren't authenticated, such as anonymous visitors, aren't included. - "allUsers":A special identifier that represents anyone who is on the internet, including authenticated and unauthenticated users. Because BigQuery requires authentication before a user can access the service, allUsers includes only authenticated users.
4627 pub grantees: Option<Vec<String>>,
4628 /// Output only. The time when this row access policy was last modified, in milliseconds since the epoch.
4629 #[serde(rename = "lastModifiedTime")]
4630 pub last_modified_time: Option<chrono::DateTime<chrono::offset::Utc>>,
4631 /// Required. Reference describing the ID of this row access policy.
4632 #[serde(rename = "rowAccessPolicyReference")]
4633 pub row_access_policy_reference: Option<RowAccessPolicyReference>,
4634}
4635
4636impl common::RequestValue for RowAccessPolicy {}
4637impl common::ResponseResult for RowAccessPolicy {}
4638
4639/// Id path of a row access policy.
4640///
4641/// This type is not used in any activity, and only used as *part* of another schema.
4642///
4643#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4644#[serde_with::serde_as]
4645#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4646pub struct RowAccessPolicyReference {
4647 /// Required. The ID of the dataset containing this row access policy.
4648 #[serde(rename = "datasetId")]
4649 pub dataset_id: Option<String>,
4650 /// Required. The ID of the row access policy. The ID must contain only letters (a-z, A-Z), numbers (0-9), or underscores (_). The maximum length is 256 characters.
4651 #[serde(rename = "policyId")]
4652 pub policy_id: Option<String>,
4653 /// Required. The ID of the project containing this row access policy.
4654 #[serde(rename = "projectId")]
4655 pub project_id: Option<String>,
4656 /// Required. The ID of the table containing this row access policy.
4657 #[serde(rename = "tableId")]
4658 pub table_id: Option<String>,
4659}
4660
4661impl common::Part for RowAccessPolicyReference {}
4662
4663/// Statistics for row-level security.
4664///
4665/// This type is not used in any activity, and only used as *part* of another schema.
4666///
4667#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4668#[serde_with::serde_as]
4669#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4670pub struct RowLevelSecurityStatistics {
4671 /// Whether any accessed data was protected by row access policies.
4672 #[serde(rename = "rowLevelSecurityApplied")]
4673 pub row_level_security_applied: Option<bool>,
4674}
4675
4676impl common::Part for RowLevelSecurityStatistics {}
4677
4678/// Options related to script execution.
4679///
4680/// This type is not used in any activity, and only used as *part* of another schema.
4681///
4682#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4683#[serde_with::serde_as]
4684#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4685pub struct ScriptOptions {
4686 /// Determines which statement in the script represents the "key result", used to populate the schema and query results of the script job. Default is LAST.
4687 #[serde(rename = "keyResultStatement")]
4688 pub key_result_statement: Option<String>,
4689 /// Limit on the number of bytes billed per statement. Exceeding this budget results in an error.
4690 #[serde(rename = "statementByteBudget")]
4691 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
4692 pub statement_byte_budget: Option<i64>,
4693 /// Timeout period for each statement in a script.
4694 #[serde(rename = "statementTimeoutMs")]
4695 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
4696 pub statement_timeout_ms: Option<i64>,
4697}
4698
4699impl common::Part for ScriptOptions {}
4700
4701/// Represents the location of the statement/expression being evaluated. Line and column numbers are defined as follows: - Line and column numbers start with one. That is, line 1 column 1 denotes the start of the script. - When inside a stored procedure, all line/column numbers are relative to the procedure body, not the script in which the procedure was defined. - Start/end positions exclude leading/trailing comments and whitespace. The end position always ends with a ";", when present. - Multi-byte Unicode characters are treated as just one column. - If the original script (or procedure definition) contains TAB characters, a tab "snaps" the indentation forward to the nearest multiple of 8 characters, plus 1. For example, a TAB on column 1, 2, 3, 4, 5, 6 , or 8 will advance the next character to column 9. A TAB on column 9, 10, 11, 12, 13, 14, 15, or 16 will advance the next character to column 17.
4702///
4703/// This type is not used in any activity, and only used as *part* of another schema.
4704///
4705#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4706#[serde_with::serde_as]
4707#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4708pub struct ScriptStackFrame {
4709 /// Output only. One-based end column.
4710 #[serde(rename = "endColumn")]
4711 pub end_column: Option<i32>,
4712 /// Output only. One-based end line.
4713 #[serde(rename = "endLine")]
4714 pub end_line: Option<i32>,
4715 /// Output only. Name of the active procedure, empty if in a top-level script.
4716 #[serde(rename = "procedureId")]
4717 pub procedure_id: Option<String>,
4718 /// Output only. One-based start column.
4719 #[serde(rename = "startColumn")]
4720 pub start_column: Option<i32>,
4721 /// Output only. One-based start line.
4722 #[serde(rename = "startLine")]
4723 pub start_line: Option<i32>,
4724 /// Output only. Text of the current statement/expression.
4725 pub text: Option<String>,
4726}
4727
4728impl common::Part for ScriptStackFrame {}
4729
4730/// Job statistics specific to the child job of a script.
4731///
4732/// This type is not used in any activity, and only used as *part* of another schema.
4733///
4734#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4735#[serde_with::serde_as]
4736#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4737pub struct ScriptStatistics {
4738 /// Whether this child job was a statement or expression.
4739 #[serde(rename = "evaluationKind")]
4740 pub evaluation_kind: Option<String>,
4741 /// Stack trace showing the line/column/procedure name of each frame on the stack at the point where the current evaluation happened. The leaf frame is first, the primary script is last. Never empty.
4742 #[serde(rename = "stackFrames")]
4743 pub stack_frames: Option<Vec<ScriptStackFrame>>,
4744}
4745
4746impl common::Part for ScriptStatistics {}
4747
4748/// Statistics for a search query. Populated as part of JobStatistics2.
4749///
4750/// This type is not used in any activity, and only used as *part* of another schema.
4751///
4752#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4753#[serde_with::serde_as]
4754#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4755pub struct SearchStatistics {
4756 /// Search index pruning statistics, one for each base table that has a search index. If a base table does not have a search index or the index does not help with pruning on the base table, then there is no pruning statistics for that table.
4757 #[serde(rename = "indexPruningStats")]
4758 pub index_pruning_stats: Option<Vec<IndexPruningStats>>,
4759 /// When `indexUsageMode` is `UNUSED` or `PARTIALLY_USED`, this field explains why indexes were not used in all or part of the search query. If `indexUsageMode` is `FULLY_USED`, this field is not populated.
4760 #[serde(rename = "indexUnusedReasons")]
4761 pub index_unused_reasons: Option<Vec<IndexUnusedReason>>,
4762 /// Specifies the index usage mode for the query.
4763 #[serde(rename = "indexUsageMode")]
4764 pub index_usage_mode: Option<String>,
4765}
4766
4767impl common::Part for SearchStatistics {}
4768
4769/// Serializer and deserializer information.
4770///
4771/// This type is not used in any activity, and only used as *part* of another schema.
4772///
4773#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4774#[serde_with::serde_as]
4775#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4776pub struct SerDeInfo {
4777 /// Optional. Name of the SerDe. The maximum length is 256 characters.
4778 pub name: Option<String>,
4779 /// Optional. Key-value pairs that define the initialization parameters for the serialization library. Maximum size 10 Kib.
4780 pub parameters: Option<HashMap<String, String>>,
4781 /// Required. Specifies a fully-qualified class name of the serialization library that is responsible for the translation of data between table representation and the underlying low-level input and output format structures. The maximum length is 256 characters.
4782 #[serde(rename = "serializationLibrary")]
4783 pub serialization_library: Option<String>,
4784}
4785
4786impl common::Part for SerDeInfo {}
4787
4788/// [Preview] Information related to sessions.
4789///
4790/// This type is not used in any activity, and only used as *part* of another schema.
4791///
4792#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4793#[serde_with::serde_as]
4794#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4795pub struct SessionInfo {
4796 /// Output only. The id of the session.
4797 #[serde(rename = "sessionId")]
4798 pub session_id: Option<String>,
4799}
4800
4801impl common::Part for SessionInfo {}
4802
4803/// Request message for `SetIamPolicy` method.
4804///
4805/// # Activities
4806///
4807/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
4808/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
4809///
4810/// * [set iam policy routines](RoutineSetIamPolicyCall) (request)
4811/// * [set iam policy tables](TableSetIamPolicyCall) (request)
4812#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4813#[serde_with::serde_as]
4814#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4815pub struct SetIamPolicyRequest {
4816 /// REQUIRED: The complete policy to be applied to the `resource`. The size of the policy is limited to a few 10s of KB. An empty policy is a valid policy but certain Google Cloud services (such as Projects) might reject them.
4817 pub policy: Option<Policy>,
4818 /// OPTIONAL: A FieldMask specifying which fields of the policy to modify. Only the fields in the mask will be modified. If no mask is provided, the following default mask is used: `paths: "bindings, etag"`
4819 #[serde(rename = "updateMask")]
4820 pub update_mask: Option<common::FieldMask>,
4821}
4822
4823impl common::RequestValue for SetIamPolicyRequest {}
4824
4825/// Details about source stages which produce skewed data.
4826///
4827/// This type is not used in any activity, and only used as *part* of another schema.
4828///
4829#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4830#[serde_with::serde_as]
4831#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4832pub struct SkewSource {
4833 /// Output only. Stage id of the skew source stage.
4834 #[serde(rename = "stageId")]
4835 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
4836 pub stage_id: Option<i64>,
4837}
4838
4839impl common::Part for SkewSource {}
4840
4841/// Information about base table and snapshot time of the snapshot.
4842///
4843/// This type is not used in any activity, and only used as *part* of another schema.
4844///
4845#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4846#[serde_with::serde_as]
4847#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4848pub struct SnapshotDefinition {
4849 /// Required. Reference describing the ID of the table that was snapshot.
4850 #[serde(rename = "baseTableReference")]
4851 pub base_table_reference: Option<TableReference>,
4852 /// Required. The time at which the base table was snapshot. This value is reported in the JSON response using RFC3339 format.
4853 #[serde(rename = "snapshotTime")]
4854 pub snapshot_time: Option<chrono::DateTime<chrono::offset::Utc>>,
4855}
4856
4857impl common::Part for SnapshotDefinition {}
4858
4859/// Spark job logs can be filtered by these fields in Cloud Logging.
4860///
4861/// This type is not used in any activity, and only used as *part* of another schema.
4862///
4863#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4864#[serde_with::serde_as]
4865#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4866pub struct SparkLoggingInfo {
4867 /// Output only. Project ID where the Spark logs were written.
4868 #[serde(rename = "projectId")]
4869 pub project_id: Option<String>,
4870 /// Output only. Resource type used for logging.
4871 #[serde(rename = "resourceType")]
4872 pub resource_type: Option<String>,
4873}
4874
4875impl common::Part for SparkLoggingInfo {}
4876
4877/// Options for a user-defined Spark routine.
4878///
4879/// This type is not used in any activity, and only used as *part* of another schema.
4880///
4881#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4882#[serde_with::serde_as]
4883#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4884pub struct SparkOptions {
4885 /// Archive files to be extracted into the working directory of each executor. For more information about Apache Spark, see [Apache Spark](https://spark.apache.org/docs/latest/index.html).
4886 #[serde(rename = "archiveUris")]
4887 pub archive_uris: Option<Vec<String>>,
4888 /// Fully qualified name of the user-provided Spark connection object. Format: ```"projects/{project_id}/locations/{location_id}/connections/{connection_id}"```
4889 pub connection: Option<String>,
4890 /// Custom container image for the runtime environment.
4891 #[serde(rename = "containerImage")]
4892 pub container_image: Option<String>,
4893 /// Files to be placed in the working directory of each executor. For more information about Apache Spark, see [Apache Spark](https://spark.apache.org/docs/latest/index.html).
4894 #[serde(rename = "fileUris")]
4895 pub file_uris: Option<Vec<String>>,
4896 /// JARs to include on the driver and executor CLASSPATH. For more information about Apache Spark, see [Apache Spark](https://spark.apache.org/docs/latest/index.html).
4897 #[serde(rename = "jarUris")]
4898 pub jar_uris: Option<Vec<String>>,
4899 /// The fully qualified name of a class in jar_uris, for example, com.example.wordcount. Exactly one of main_class and main_jar_uri field should be set for Java/Scala language type.
4900 #[serde(rename = "mainClass")]
4901 pub main_class: Option<String>,
4902 /// The main file/jar URI of the Spark application. Exactly one of the definition_body field and the main_file_uri field must be set for Python. Exactly one of main_class and main_file_uri field should be set for Java/Scala language type.
4903 #[serde(rename = "mainFileUri")]
4904 pub main_file_uri: Option<String>,
4905 /// Configuration properties as a set of key/value pairs, which will be passed on to the Spark application. For more information, see [Apache Spark](https://spark.apache.org/docs/latest/index.html) and the [procedure option list](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#procedure_option_list).
4906 pub properties: Option<HashMap<String, String>>,
4907 /// Python files to be placed on the PYTHONPATH for PySpark application. Supported file types: `.py`, `.egg`, and `.zip`. For more information about Apache Spark, see [Apache Spark](https://spark.apache.org/docs/latest/index.html).
4908 #[serde(rename = "pyFileUris")]
4909 pub py_file_uris: Option<Vec<String>>,
4910 /// Runtime version. If not specified, the default runtime version is used.
4911 #[serde(rename = "runtimeVersion")]
4912 pub runtime_version: Option<String>,
4913}
4914
4915impl common::Part for SparkOptions {}
4916
4917/// Statistics for a BigSpark query. Populated as part of JobStatistics2
4918///
4919/// This type is not used in any activity, and only used as *part* of another schema.
4920///
4921#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4922#[serde_with::serde_as]
4923#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4924pub struct SparkStatistics {
4925 /// Output only. Endpoints returned from Dataproc. Key list: - history_server_endpoint: A link to Spark job UI.
4926 pub endpoints: Option<HashMap<String, String>>,
4927 /// Output only. The Google Cloud Storage bucket that is used as the default file system by the Spark application. This field is only filled when the Spark procedure uses the invoker security mode. The `gcsStagingBucket` bucket is inferred from the `@@spark_proc_properties.staging_bucket` system variable (if it is provided). Otherwise, BigQuery creates a default staging bucket for the job and returns the bucket name in this field. Example: * `gs://[bucket_name]`
4928 #[serde(rename = "gcsStagingBucket")]
4929 pub gcs_staging_bucket: Option<String>,
4930 /// Output only. The Cloud KMS encryption key that is used to protect the resources created by the Spark job. If the Spark procedure uses the invoker security mode, the Cloud KMS encryption key is either inferred from the provided system variable, `@@spark_proc_properties.kms_key_name`, or the default key of the BigQuery job's project (if the CMEK organization policy is enforced). Otherwise, the Cloud KMS key is either inferred from the Spark connection associated with the procedure (if it is provided), or from the default key of the Spark connection's project if the CMEK organization policy is enforced. Example: * `projects/[kms_project_id]/locations/[region]/keyRings/[key_region]/cryptoKeys/[key]`
4931 #[serde(rename = "kmsKeyName")]
4932 pub kms_key_name: Option<String>,
4933 /// Output only. Logging info is used to generate a link to Cloud Logging.
4934 #[serde(rename = "loggingInfo")]
4935 pub logging_info: Option<SparkLoggingInfo>,
4936 /// Output only. Spark job ID if a Spark job is created successfully.
4937 #[serde(rename = "sparkJobId")]
4938 pub spark_job_id: Option<String>,
4939 /// Output only. Location where the Spark job is executed. A location is selected by BigQueury for jobs configured to run in a multi-region.
4940 #[serde(rename = "sparkJobLocation")]
4941 pub spark_job_location: Option<String>,
4942}
4943
4944impl common::Part for SparkStatistics {}
4945
4946/// Performance insights compared to the previous executions for a specific stage.
4947///
4948/// This type is not used in any activity, and only used as *part* of another schema.
4949///
4950#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4951#[serde_with::serde_as]
4952#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4953pub struct StagePerformanceChangeInsight {
4954 /// Output only. Input data change insight of the query stage.
4955 #[serde(rename = "inputDataChange")]
4956 pub input_data_change: Option<InputDataChange>,
4957 /// Output only. The stage id that the insight mapped to.
4958 #[serde(rename = "stageId")]
4959 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
4960 pub stage_id: Option<i64>,
4961}
4962
4963impl common::Part for StagePerformanceChangeInsight {}
4964
4965/// Standalone performance insights for a specific stage.
4966///
4967/// This type is not used in any activity, and only used as *part* of another schema.
4968///
4969#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4970#[serde_with::serde_as]
4971#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4972pub struct StagePerformanceStandaloneInsight {
4973 /// Output only. If present, the stage had the following reasons for being disqualified from BI Engine execution.
4974 #[serde(rename = "biEngineReasons")]
4975 pub bi_engine_reasons: Option<Vec<BiEngineReason>>,
4976 /// Output only. High cardinality joins in the stage.
4977 #[serde(rename = "highCardinalityJoins")]
4978 pub high_cardinality_joins: Option<Vec<HighCardinalityJoin>>,
4979 /// Output only. True if the stage has insufficient shuffle quota.
4980 #[serde(rename = "insufficientShuffleQuota")]
4981 pub insufficient_shuffle_quota: Option<bool>,
4982 /// Output only. Partition skew in the stage.
4983 #[serde(rename = "partitionSkew")]
4984 pub partition_skew: Option<PartitionSkew>,
4985 /// Output only. True if the stage has a slot contention issue.
4986 #[serde(rename = "slotContention")]
4987 pub slot_contention: Option<bool>,
4988 /// Output only. The stage id that the insight mapped to.
4989 #[serde(rename = "stageId")]
4990 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
4991 pub stage_id: Option<i64>,
4992}
4993
4994impl common::Part for StagePerformanceStandaloneInsight {}
4995
4996/// The data type of a variable such as a function argument. Examples include: * INT64: `{"typeKind": "INT64"}` * ARRAY: { "typeKind": "ARRAY", "arrayElementType": {"typeKind": "STRING"} } * STRUCT>: { "typeKind": "STRUCT", "structType": { "fields": [ { "name": "x", "type": {"typeKind": "STRING"} }, { "name": "y", "type": { "typeKind": "ARRAY", "arrayElementType": {"typeKind": "DATE"} } } ] } } * RANGE: { "typeKind": "RANGE", "rangeElementType": {"typeKind": "DATE"} }
4997///
4998/// This type is not used in any activity, and only used as *part* of another schema.
4999///
5000#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5001#[serde_with::serde_as]
5002#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5003pub struct StandardSqlDataType {
5004 /// The type of the array's elements, if type_kind = "ARRAY".
5005 #[serde(rename = "arrayElementType")]
5006 pub array_element_type: Option<Option<Box<StandardSqlDataType>>>,
5007 /// The type of the range's elements, if type_kind = "RANGE".
5008 #[serde(rename = "rangeElementType")]
5009 pub range_element_type: Option<Option<Box<StandardSqlDataType>>>,
5010 /// The fields of this struct, in order, if type_kind = "STRUCT".
5011 #[serde(rename = "structType")]
5012 pub struct_type: Option<StandardSqlStructType>,
5013 /// Required. The top level type of this field. Can be any GoogleSQL data type (e.g., "INT64", "DATE", "ARRAY").
5014 #[serde(rename = "typeKind")]
5015 pub type_kind: Option<String>,
5016}
5017
5018impl common::Part for StandardSqlDataType {}
5019
5020/// A field or a column.
5021///
5022/// This type is not used in any activity, and only used as *part* of another schema.
5023///
5024#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5025#[serde_with::serde_as]
5026#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5027pub struct StandardSqlField {
5028 /// Optional. The name of this field. Can be absent for struct fields.
5029 pub name: Option<String>,
5030 /// Optional. The type of this parameter. Absent if not explicitly specified (e.g., CREATE FUNCTION statement can omit the return type; in this case the output parameter does not have this "type" field).
5031 #[serde(rename = "type")]
5032 pub type_: Option<StandardSqlDataType>,
5033}
5034
5035impl common::Part for StandardSqlField {}
5036
5037/// The representation of a SQL STRUCT type.
5038///
5039/// This type is not used in any activity, and only used as *part* of another schema.
5040///
5041#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5042#[serde_with::serde_as]
5043#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5044pub struct StandardSqlStructType {
5045 /// Fields within the struct.
5046 pub fields: Option<Vec<StandardSqlField>>,
5047}
5048
5049impl common::Part for StandardSqlStructType {}
5050
5051/// A table type
5052///
5053/// This type is not used in any activity, and only used as *part* of another schema.
5054///
5055#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5056#[serde_with::serde_as]
5057#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5058pub struct StandardSqlTableType {
5059 /// The columns in this table type
5060 pub columns: Option<Vec<StandardSqlField>>,
5061}
5062
5063impl common::Part for StandardSqlTableType {}
5064
5065/// Contains information about how a table's data is stored and accessed by open source query engines.
5066///
5067/// This type is not used in any activity, and only used as *part* of another schema.
5068///
5069#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5070#[serde_with::serde_as]
5071#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5072pub struct StorageDescriptor {
5073 /// Optional. Specifies the fully qualified class name of the InputFormat (e.g. "org.apache.hadoop.hive.ql.io.orc.OrcInputFormat"). The maximum length is 128 characters.
5074 #[serde(rename = "inputFormat")]
5075 pub input_format: Option<String>,
5076 /// Optional. The physical location of the table (e.g. `gs://spark-dataproc-data/pangea-data/case_sensitive/` or `gs://spark-dataproc-data/pangea-data/*`). The maximum length is 2056 bytes.
5077 #[serde(rename = "locationUri")]
5078 pub location_uri: Option<String>,
5079 /// Optional. Specifies the fully qualified class name of the OutputFormat (e.g. "org.apache.hadoop.hive.ql.io.orc.OrcOutputFormat"). The maximum length is 128 characters.
5080 #[serde(rename = "outputFormat")]
5081 pub output_format: Option<String>,
5082 /// Optional. Serializer and deserializer information.
5083 #[serde(rename = "serdeInfo")]
5084 pub serde_info: Option<SerDeInfo>,
5085}
5086
5087impl common::Part for StorageDescriptor {}
5088
5089/// If the stored column was not used, explain why.
5090///
5091/// This type is not used in any activity, and only used as *part* of another schema.
5092///
5093#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5094#[serde_with::serde_as]
5095#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5096pub struct StoredColumnsUnusedReason {
5097 /// Specifies the high-level reason for the unused scenario, each reason must have a code associated.
5098 pub code: Option<String>,
5099 /// Specifies the detailed description for the scenario.
5100 pub message: Option<String>,
5101 /// Specifies which columns were not covered by the stored columns for the specified code up to 20 columns. This is populated when the code is STORED_COLUMNS_COVER_INSUFFICIENT and BASE_TABLE_HAS_CLS.
5102 #[serde(rename = "uncoveredColumns")]
5103 pub uncovered_columns: Option<Vec<String>>,
5104}
5105
5106impl common::Part for StoredColumnsUnusedReason {}
5107
5108/// Indicates the stored columns usage in the query.
5109///
5110/// This type is not used in any activity, and only used as *part* of another schema.
5111///
5112#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5113#[serde_with::serde_as]
5114#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5115pub struct StoredColumnsUsage {
5116 /// Specifies the base table.
5117 #[serde(rename = "baseTable")]
5118 pub base_table: Option<TableReference>,
5119 /// Specifies whether the query was accelerated with stored columns.
5120 #[serde(rename = "isQueryAccelerated")]
5121 pub is_query_accelerated: Option<bool>,
5122 /// If stored columns were not used, explain why.
5123 #[serde(rename = "storedColumnsUnusedReasons")]
5124 pub stored_columns_unused_reasons: Option<Vec<StoredColumnsUnusedReason>>,
5125}
5126
5127impl common::Part for StoredColumnsUsage {}
5128
5129/// There is no detailed description.
5130///
5131/// This type is not used in any activity, and only used as *part* of another schema.
5132///
5133#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5134#[serde_with::serde_as]
5135#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5136pub struct Streamingbuffer {
5137 /// Output only. A lower-bound estimate of the number of bytes currently in the streaming buffer.
5138 #[serde(rename = "estimatedBytes")]
5139 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
5140 pub estimated_bytes: Option<u64>,
5141 /// Output only. A lower-bound estimate of the number of rows currently in the streaming buffer.
5142 #[serde(rename = "estimatedRows")]
5143 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
5144 pub estimated_rows: Option<u64>,
5145 /// Output only. Contains the timestamp of the oldest entry in the streaming buffer, in milliseconds since the epoch, if the streaming buffer is available.
5146 #[serde(rename = "oldestEntryTime")]
5147 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
5148 pub oldest_entry_time: Option<u64>,
5149}
5150
5151impl common::Part for Streamingbuffer {}
5152
5153/// Search space for string and enum.
5154///
5155/// This type is not used in any activity, and only used as *part* of another schema.
5156///
5157#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5158#[serde_with::serde_as]
5159#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5160pub struct StringHparamSearchSpace {
5161 /// Canididates for the string or enum parameter in lower case.
5162 pub candidates: Option<Vec<String>>,
5163}
5164
5165impl common::Part for StringHparamSearchSpace {}
5166
5167/// System variables given to a query.
5168///
5169/// This type is not used in any activity, and only used as *part* of another schema.
5170///
5171#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5172#[serde_with::serde_as]
5173#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5174pub struct SystemVariables {
5175 /// Output only. Data type for each system variable.
5176 pub types: Option<HashMap<String, StandardSqlDataType>>,
5177 /// Output only. Value for each system variable.
5178 pub values: Option<HashMap<String, serde_json::Value>>,
5179}
5180
5181impl common::Part for SystemVariables {}
5182
5183/// There is no detailed description.
5184///
5185/// # Activities
5186///
5187/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
5188/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
5189///
5190/// * [delete tables](TableDeleteCall) (none)
5191/// * [get tables](TableGetCall) (response)
5192/// * [get iam policy tables](TableGetIamPolicyCall) (none)
5193/// * [insert tables](TableInsertCall) (request|response)
5194/// * [list tables](TableListCall) (none)
5195/// * [patch tables](TablePatchCall) (request|response)
5196/// * [set iam policy tables](TableSetIamPolicyCall) (none)
5197/// * [test iam permissions tables](TableTestIamPermissionCall) (none)
5198/// * [update tables](TableUpdateCall) (request|response)
5199#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5200#[serde_with::serde_as]
5201#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5202pub struct Table {
5203 /// Optional. Specifies the configuration of a BigQuery table for Apache Iceberg.
5204 #[serde(rename = "biglakeConfiguration")]
5205 pub biglake_configuration: Option<BigLakeConfiguration>,
5206 /// Output only. Contains information about the clone. This value is set via the clone operation.
5207 #[serde(rename = "cloneDefinition")]
5208 pub clone_definition: Option<CloneDefinition>,
5209 /// Clustering specification for the table. Must be specified with time-based partitioning, data in the table will be first partitioned and subsequently clustered.
5210 pub clustering: Option<Clustering>,
5211 /// Output only. The time when this table was created, in milliseconds since the epoch.
5212 #[serde(rename = "creationTime")]
5213 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
5214 pub creation_time: Option<i64>,
5215 /// Optional. Defines the default collation specification of new STRING fields in the table. During table creation or update, if a STRING field is added to this table without explicit collation specified, then the table inherits the table default collation. A change to this field affects only fields added afterwards, and does not alter the existing fields. The following values are supported: * 'und:ci': undetermined locale, case insensitive. * '': empty string. Default to case-sensitive behavior.
5216 #[serde(rename = "defaultCollation")]
5217 pub default_collation: Option<String>,
5218 /// Optional. Defines the default rounding mode specification of new decimal fields (NUMERIC OR BIGNUMERIC) in the table. During table creation or update, if a decimal field is added to this table without an explicit rounding mode specified, then the field inherits the table default rounding mode. Changing this field doesn't affect existing fields.
5219 #[serde(rename = "defaultRoundingMode")]
5220 pub default_rounding_mode: Option<String>,
5221 /// Optional. A user-friendly description of this table.
5222 pub description: Option<String>,
5223 /// Custom encryption configuration (e.g., Cloud KMS keys).
5224 #[serde(rename = "encryptionConfiguration")]
5225 pub encryption_configuration: Option<EncryptionConfiguration>,
5226 /// Output only. A hash of this resource.
5227 pub etag: Option<String>,
5228 /// Optional. The time when this table expires, in milliseconds since the epoch. If not present, the table will persist indefinitely. Expired tables will be deleted and their storage reclaimed. The defaultTableExpirationMs property of the encapsulating dataset can be used to set a default expirationTime on newly created tables.
5229 #[serde(rename = "expirationTime")]
5230 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
5231 pub expiration_time: Option<i64>,
5232 /// Optional. Options defining open source compatible table.
5233 #[serde(rename = "externalCatalogTableOptions")]
5234 pub external_catalog_table_options: Option<ExternalCatalogTableOptions>,
5235 /// Optional. Describes the data format, location, and other properties of a table stored outside of BigQuery. By defining these properties, the data source can then be queried as if it were a standard BigQuery table.
5236 #[serde(rename = "externalDataConfiguration")]
5237 pub external_data_configuration: Option<ExternalDataConfiguration>,
5238 /// Optional. A descriptive name for this table.
5239 #[serde(rename = "friendlyName")]
5240 pub friendly_name: Option<String>,
5241 /// Output only. An opaque ID uniquely identifying the table.
5242 pub id: Option<String>,
5243 /// The type of resource ID.
5244 pub kind: Option<String>,
5245 /// The labels associated with this table. You can use these to organize and group your tables. Label keys and values can be no longer than 63 characters, can only contain lowercase letters, numeric characters, underscores and dashes. International characters are allowed. Label values are optional. Label keys must start with a letter and each label in the list must have a different key.
5246 pub labels: Option<HashMap<String, String>>,
5247 /// Output only. The time when this table was last modified, in milliseconds since the epoch.
5248 #[serde(rename = "lastModifiedTime")]
5249 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
5250 pub last_modified_time: Option<u64>,
5251 /// Output only. The geographic location where the table resides. This value is inherited from the dataset.
5252 pub location: Option<String>,
5253 /// Optional. If set, overrides the default managed table type configured in the dataset.
5254 #[serde(rename = "managedTableType")]
5255 pub managed_table_type: Option<String>,
5256 /// Optional. The materialized view definition.
5257 #[serde(rename = "materializedView")]
5258 pub materialized_view: Option<MaterializedViewDefinition>,
5259 /// Output only. The materialized view status.
5260 #[serde(rename = "materializedViewStatus")]
5261 pub materialized_view_status: Option<MaterializedViewStatus>,
5262 /// Optional. The maximum staleness of data that could be returned when the table (or stale MV) is queried. Staleness encoded as a string encoding of sql IntervalValue type.
5263 #[serde(rename = "maxStaleness")]
5264 pub max_staleness: Option<String>,
5265 /// Deprecated.
5266 pub model: Option<ModelDefinition>,
5267 /// Output only. Number of logical bytes that are less than 90 days old.
5268 #[serde(rename = "numActiveLogicalBytes")]
5269 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
5270 pub num_active_logical_bytes: Option<i64>,
5271 /// Output only. Number of physical bytes less than 90 days old. This data is not kept in real time, and might be delayed by a few seconds to a few minutes.
5272 #[serde(rename = "numActivePhysicalBytes")]
5273 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
5274 pub num_active_physical_bytes: Option<i64>,
5275 /// Output only. The size of this table in logical bytes, excluding any data in the streaming buffer.
5276 #[serde(rename = "numBytes")]
5277 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
5278 pub num_bytes: Option<i64>,
5279 /// Output only. Number of physical bytes used by current live data storage. This data is not kept in real time, and might be delayed by a few seconds to a few minutes.
5280 #[serde(rename = "numCurrentPhysicalBytes")]
5281 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
5282 pub num_current_physical_bytes: Option<i64>,
5283 /// Output only. The number of logical bytes in the table that are considered "long-term storage".
5284 #[serde(rename = "numLongTermBytes")]
5285 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
5286 pub num_long_term_bytes: Option<i64>,
5287 /// Output only. Number of logical bytes that are more than 90 days old.
5288 #[serde(rename = "numLongTermLogicalBytes")]
5289 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
5290 pub num_long_term_logical_bytes: Option<i64>,
5291 /// Output only. Number of physical bytes more than 90 days old. This data is not kept in real time, and might be delayed by a few seconds to a few minutes.
5292 #[serde(rename = "numLongTermPhysicalBytes")]
5293 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
5294 pub num_long_term_physical_bytes: Option<i64>,
5295 /// Output only. The number of partitions present in the table or materialized view. This data is not kept in real time, and might be delayed by a few seconds to a few minutes.
5296 #[serde(rename = "numPartitions")]
5297 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
5298 pub num_partitions: Option<i64>,
5299 /// Output only. The physical size of this table in bytes. This includes storage used for time travel.
5300 #[serde(rename = "numPhysicalBytes")]
5301 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
5302 pub num_physical_bytes: Option<i64>,
5303 /// Output only. The number of rows of data in this table, excluding any data in the streaming buffer.
5304 #[serde(rename = "numRows")]
5305 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
5306 pub num_rows: Option<u64>,
5307 /// Output only. Number of physical bytes used by time travel storage (deleted or changed data). This data is not kept in real time, and might be delayed by a few seconds to a few minutes.
5308 #[serde(rename = "numTimeTravelPhysicalBytes")]
5309 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
5310 pub num_time_travel_physical_bytes: Option<i64>,
5311 /// Output only. Total number of logical bytes in the table or materialized view.
5312 #[serde(rename = "numTotalLogicalBytes")]
5313 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
5314 pub num_total_logical_bytes: Option<i64>,
5315 /// Output only. The physical size of this table in bytes. This also includes storage used for time travel. This data is not kept in real time, and might be delayed by a few seconds to a few minutes.
5316 #[serde(rename = "numTotalPhysicalBytes")]
5317 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
5318 pub num_total_physical_bytes: Option<i64>,
5319 /// Optional. The partition information for all table formats, including managed partitioned tables, hive partitioned tables, iceberg partitioned, and metastore partitioned tables. This field is only populated for metastore partitioned tables. For other table formats, this is an output only field.
5320 #[serde(rename = "partitionDefinition")]
5321 pub partition_definition: Option<PartitioningDefinition>,
5322 /// If specified, configures range partitioning for this table.
5323 #[serde(rename = "rangePartitioning")]
5324 pub range_partitioning: Option<RangePartitioning>,
5325 /// Optional. Output only. Table references of all replicas currently active on the table.
5326 pub replicas: Option<Vec<TableReference>>,
5327 /// Optional. If set to true, queries over this table require a partition filter that can be used for partition elimination to be specified.
5328 #[serde(rename = "requirePartitionFilter")]
5329 pub require_partition_filter: Option<bool>,
5330 /// [Optional] The tags associated with this table. Tag keys are globally unique. See additional information on [tags](https://cloud.google.com/iam/docs/tags-access-control#definitions). An object containing a list of "key": value pairs. The key is the namespaced friendly name of the tag key, e.g. "12345/environment" where 12345 is parent id. The value is the friendly short name of the tag value, e.g. "production".
5331 #[serde(rename = "resourceTags")]
5332 pub resource_tags: Option<HashMap<String, String>>,
5333 /// Optional. Output only. Restriction config for table. If set, restrict certain accesses on the table based on the config. See [Data egress](https://cloud.google.com/bigquery/docs/analytics-hub-introduction#data_egress) for more details.
5334 pub restrictions: Option<RestrictionConfig>,
5335 /// Optional. Describes the schema of this table.
5336 pub schema: Option<TableSchema>,
5337 /// Output only. A URL that can be used to access this resource again.
5338 #[serde(rename = "selfLink")]
5339 pub self_link: Option<String>,
5340 /// Output only. Contains information about the snapshot. This value is set via snapshot creation.
5341 #[serde(rename = "snapshotDefinition")]
5342 pub snapshot_definition: Option<SnapshotDefinition>,
5343 /// Output only. Contains information regarding this table's streaming buffer, if one is present. This field will be absent if the table is not being streamed to or if there is no data in the streaming buffer.
5344 #[serde(rename = "streamingBuffer")]
5345 pub streaming_buffer: Option<Streamingbuffer>,
5346 /// Optional. Tables Primary Key and Foreign Key information
5347 #[serde(rename = "tableConstraints")]
5348 pub table_constraints: Option<TableConstraints>,
5349 /// Required. Reference describing the ID of this table.
5350 #[serde(rename = "tableReference")]
5351 pub table_reference: Option<TableReference>,
5352 /// Optional. Table replication info for table created `AS REPLICA` DDL like: `CREATE MATERIALIZED VIEW mv1 AS REPLICA OF src_mv`
5353 #[serde(rename = "tableReplicationInfo")]
5354 pub table_replication_info: Option<TableReplicationInfo>,
5355 /// If specified, configures time-based partitioning for this table.
5356 #[serde(rename = "timePartitioning")]
5357 pub time_partitioning: Option<TimePartitioning>,
5358 /// Output only. Describes the table type. The following values are supported: * `TABLE`: A normal BigQuery table. * `VIEW`: A virtual table defined by a SQL query. * `EXTERNAL`: A table that references data stored in an external storage system, such as Google Cloud Storage. * `MATERIALIZED_VIEW`: A precomputed view defined by a SQL query. * `SNAPSHOT`: An immutable BigQuery table that preserves the contents of a base table at a particular time. See additional information on [table snapshots](https://cloud.google.com/bigquery/docs/table-snapshots-intro). The default value is `TABLE`.
5359 #[serde(rename = "type")]
5360 pub type_: Option<String>,
5361 /// Optional. The view definition.
5362 pub view: Option<ViewDefinition>,
5363}
5364
5365impl common::RequestValue for Table {}
5366impl common::Resource for Table {}
5367impl common::ResponseResult for Table {}
5368
5369/// There is no detailed description.
5370///
5371/// This type is not used in any activity, and only used as *part* of another schema.
5372///
5373#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5374#[serde_with::serde_as]
5375#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5376pub struct TableCell {
5377 /// no description provided
5378 pub v: Option<serde_json::Value>,
5379}
5380
5381impl common::Part for TableCell {}
5382
5383/// The TableConstraints defines the primary key and foreign key.
5384///
5385/// This type is not used in any activity, and only used as *part* of another schema.
5386///
5387#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5388#[serde_with::serde_as]
5389#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5390pub struct TableConstraints {
5391 /// Optional. Present only if the table has a foreign key. The foreign key is not enforced.
5392 #[serde(rename = "foreignKeys")]
5393 pub foreign_keys: Option<Vec<TableConstraintsForeignKeys>>,
5394 /// Represents the primary key constraint on a table's columns.
5395 #[serde(rename = "primaryKey")]
5396 pub primary_key: Option<TableConstraintsPrimaryKey>,
5397}
5398
5399impl common::Part for TableConstraints {}
5400
5401/// Request for sending a single streaming insert.
5402///
5403/// # Activities
5404///
5405/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
5406/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
5407///
5408/// * [insert all tabledata](TabledataInsertAllCall) (request)
5409#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5410#[serde_with::serde_as]
5411#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5412pub struct TableDataInsertAllRequest {
5413 /// Optional. Accept rows that contain values that do not match the schema. The unknown values are ignored. Default is false, which treats unknown values as errors.
5414 #[serde(rename = "ignoreUnknownValues")]
5415 pub ignore_unknown_values: Option<bool>,
5416 /// Optional. The resource type of the response. The value is not checked at the backend. Historically, it has been set to "bigquery#tableDataInsertAllRequest" but you are not required to set it.
5417 pub kind: Option<String>,
5418 /// no description provided
5419 pub rows: Option<Vec<TableDataInsertAllRequestRows>>,
5420 /// Optional. Insert all valid rows of a request, even if invalid rows exist. The default value is false, which causes the entire request to fail if any invalid rows exist.
5421 #[serde(rename = "skipInvalidRows")]
5422 pub skip_invalid_rows: Option<bool>,
5423 /// Optional. If specified, treats the destination table as a base template, and inserts the rows into an instance table named "{destination}{templateSuffix}". BigQuery will manage creation of the instance table, using the schema of the base template table. See https://cloud.google.com/bigquery/streaming-data-into-bigquery#template-tables for considerations when working with templates tables.
5424 #[serde(rename = "templateSuffix")]
5425 pub template_suffix: Option<String>,
5426 /// Optional. Unique request trace id. Used for debugging purposes only. It is case-sensitive, limited to up to 36 ASCII characters. A UUID is recommended.
5427 #[serde(rename = "traceId")]
5428 pub trace_id: Option<String>,
5429}
5430
5431impl common::RequestValue for TableDataInsertAllRequest {}
5432
5433/// Describes the format of a streaming insert response.
5434///
5435/// # Activities
5436///
5437/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
5438/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
5439///
5440/// * [insert all tabledata](TabledataInsertAllCall) (response)
5441#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5442#[serde_with::serde_as]
5443#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5444pub struct TableDataInsertAllResponse {
5445 /// Describes specific errors encountered while processing the request.
5446 #[serde(rename = "insertErrors")]
5447 pub insert_errors: Option<Vec<TableDataInsertAllResponseInsertErrors>>,
5448 /// Returns "bigquery#tableDataInsertAllResponse".
5449 pub kind: Option<String>,
5450}
5451
5452impl common::ResponseResult for TableDataInsertAllResponse {}
5453
5454/// There is no detailed description.
5455///
5456/// # Activities
5457///
5458/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
5459/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
5460///
5461/// * [list tabledata](TabledataListCall) (response)
5462#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5463#[serde_with::serde_as]
5464#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5465pub struct TableDataList {
5466 /// A hash of this page of results.
5467 pub etag: Option<String>,
5468 /// The resource type of the response.
5469 pub kind: Option<String>,
5470 /// A token used for paging results. Providing this token instead of the startIndex parameter can help you retrieve stable results when an underlying table is changing.
5471 #[serde(rename = "pageToken")]
5472 pub page_token: Option<String>,
5473 /// Rows of results.
5474 pub rows: Option<Vec<TableRow>>,
5475 /// Total rows of the entire table. In order to show default value 0 we have to present it as string.
5476 #[serde(rename = "totalRows")]
5477 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
5478 pub total_rows: Option<i64>,
5479}
5480
5481impl common::ResponseResult for TableDataList {}
5482
5483/// A field in TableSchema
5484///
5485/// This type is not used in any activity, and only used as *part* of another schema.
5486///
5487#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5488#[serde_with::serde_as]
5489#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5490pub struct TableFieldSchema {
5491 /// Deprecated.
5492 pub categories: Option<TableFieldSchemaCategories>,
5493 /// Optional. Field collation can be set only when the type of field is STRING. The following values are supported: * 'und:ci': undetermined locale, case insensitive. * '': empty string. Default to case-sensitive behavior.
5494 pub collation: Option<String>,
5495 /// Optional. Data policies attached to this field, used for field-level access control.
5496 #[serde(rename = "dataPolicies")]
5497 pub data_policies: Option<Vec<DataPolicyOption>>,
5498 /// Optional. A SQL expression to specify the [default value] (https://cloud.google.com/bigquery/docs/default-values) for this field.
5499 #[serde(rename = "defaultValueExpression")]
5500 pub default_value_expression: Option<String>,
5501 /// Optional. The field description. The maximum length is 1,024 characters.
5502 pub description: Option<String>,
5503 /// Optional. Describes the nested schema fields if the type property is set to RECORD.
5504 pub fields: Option<Vec<TableFieldSchema>>,
5505 /// Optional. Definition of the foreign data type. Only valid for top-level schema fields (not nested fields). If the type is FOREIGN, this field is required.
5506 #[serde(rename = "foreignTypeDefinition")]
5507 pub foreign_type_definition: Option<String>,
5508 /// Optional. Maximum length of values of this field for STRINGS or BYTES. If max_length is not specified, no maximum length constraint is imposed on this field. If type = "STRING", then max_length represents the maximum UTF-8 length of strings in this field. If type = "BYTES", then max_length represents the maximum number of bytes in this field. It is invalid to set this field if type ≠"STRING" and ≠"BYTES".
5509 #[serde(rename = "maxLength")]
5510 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
5511 pub max_length: Option<i64>,
5512 /// Optional. The field mode. Possible values include NULLABLE, REQUIRED and REPEATED. The default value is NULLABLE.
5513 pub mode: Option<String>,
5514 /// Required. The field name. The name must contain only letters (a-z, A-Z), numbers (0-9), or underscores (_), and must start with a letter or underscore. The maximum length is 300 characters.
5515 pub name: Option<String>,
5516 /// Optional. The policy tags attached to this field, used for field-level access control. If not set, defaults to empty policy_tags.
5517 #[serde(rename = "policyTags")]
5518 pub policy_tags: Option<TableFieldSchemaPolicyTags>,
5519 /// Optional. Precision (maximum number of total digits in base 10) and scale (maximum number of digits in the fractional part in base 10) constraints for values of this field for NUMERIC or BIGNUMERIC. It is invalid to set precision or scale if type ≠"NUMERIC" and ≠"BIGNUMERIC". If precision and scale are not specified, no value range constraint is imposed on this field insofar as values are permitted by the type. Values of this NUMERIC or BIGNUMERIC field must be in this range when: * Precision (P) and scale (S) are specified: [-10P-S + 10-S, 10P-S - 10-S] * Precision (P) is specified but not scale (and thus scale is interpreted to be equal to zero): [-10P + 1, 10P - 1]. Acceptable values for precision and scale if both are specified: * If type = "NUMERIC": 1 ≤ precision - scale ≤ 29 and 0 ≤ scale ≤ 9. * If type = "BIGNUMERIC": 1 ≤ precision - scale ≤ 38 and 0 ≤ scale ≤ 38. Acceptable values for precision if only precision is specified but not scale (and thus scale is interpreted to be equal to zero): * If type = "NUMERIC": 1 ≤ precision ≤ 29. * If type = "BIGNUMERIC": 1 ≤ precision ≤ 38. If scale is specified but not precision, then it is invalid.
5520 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
5521 pub precision: Option<i64>,
5522 /// Represents the type of a field element.
5523 #[serde(rename = "rangeElementType")]
5524 pub range_element_type: Option<TableFieldSchemaRangeElementType>,
5525 /// Optional. Specifies the rounding mode to be used when storing values of NUMERIC and BIGNUMERIC type.
5526 #[serde(rename = "roundingMode")]
5527 pub rounding_mode: Option<String>,
5528 /// Optional. See documentation for precision.
5529 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
5530 pub scale: Option<i64>,
5531 /// Optional. Precision (maximum number of total digits in base 10) for seconds of TIMESTAMP type. Possible values include: * 6 (Default, for TIMESTAMP type with microsecond precision) * 12 (For TIMESTAMP type with picosecond precision)
5532 #[serde(rename = "timestampPrecision")]
5533 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
5534 pub timestamp_precision: Option<i64>,
5535 /// Required. The field data type. Possible values include: * STRING * BYTES * INTEGER (or INT64) * FLOAT (or FLOAT64) * BOOLEAN (or BOOL) * TIMESTAMP * DATE * TIME * DATETIME * GEOGRAPHY * NUMERIC * BIGNUMERIC * JSON * RECORD (or STRUCT) * RANGE Use of RECORD/STRUCT indicates that the field contains a nested schema.
5536 #[serde(rename = "type")]
5537 pub type_: Option<String>,
5538}
5539
5540impl common::Part for TableFieldSchema {}
5541
5542/// Partial projection of the metadata for a given table in a list response.
5543///
5544/// # Activities
5545///
5546/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
5547/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
5548///
5549/// * [list tables](TableListCall) (response)
5550#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5551#[serde_with::serde_as]
5552#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5553pub struct TableList {
5554 /// A hash of this page of results.
5555 pub etag: Option<String>,
5556 /// The type of list.
5557 pub kind: Option<String>,
5558 /// A token to request the next page of results.
5559 #[serde(rename = "nextPageToken")]
5560 pub next_page_token: Option<String>,
5561 /// Tables in the requested dataset.
5562 pub tables: Option<Vec<TableListTables>>,
5563 /// The total number of tables in the dataset.
5564 #[serde(rename = "totalItems")]
5565 pub total_items: Option<i32>,
5566}
5567
5568impl common::ResponseResult for TableList {}
5569
5570/// Table level detail on the usage of metadata caching. Only set for Metadata caching eligible tables referenced in the query.
5571///
5572/// This type is not used in any activity, and only used as *part* of another schema.
5573///
5574#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5575#[serde_with::serde_as]
5576#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5577pub struct TableMetadataCacheUsage {
5578 /// Free form human-readable reason metadata caching was unused for the job.
5579 pub explanation: Option<String>,
5580 /// The column metadata index pruning statistics.
5581 #[serde(rename = "pruningStats")]
5582 pub pruning_stats: Option<PruningStats>,
5583 /// Duration since last refresh as of this job for managed tables (indicates metadata cache staleness as seen by this job).
5584 #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
5585 pub staleness: Option<chrono::Duration>,
5586 /// Metadata caching eligible table referenced in the query.
5587 #[serde(rename = "tableReference")]
5588 pub table_reference: Option<TableReference>,
5589 /// [Table type](https://cloud.google.com/bigquery/docs/reference/rest/v2/tables#Table.FIELDS.type).
5590 #[serde(rename = "tableType")]
5591 pub table_type: Option<String>,
5592 /// Reason for not using metadata caching for the table.
5593 #[serde(rename = "unusedReason")]
5594 pub unused_reason: Option<String>,
5595}
5596
5597impl common::Part for TableMetadataCacheUsage {}
5598
5599/// There is no detailed description.
5600///
5601/// This type is not used in any activity, and only used as *part* of another schema.
5602///
5603#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5604#[serde_with::serde_as]
5605#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5606pub struct TableReference {
5607 /// Required. The ID of the dataset containing this table.
5608 #[serde(rename = "datasetId")]
5609 pub dataset_id: Option<String>,
5610 /// Required. The ID of the project containing this table.
5611 #[serde(rename = "projectId")]
5612 pub project_id: Option<String>,
5613 /// Required. The ID of the table. The ID can contain Unicode characters in category L (letter), M (mark), N (number), Pc (connector, including underscore), Pd (dash), and Zs (space). For more information, see [General Category](https://wikipedia.org/wiki/Unicode_character_property#General_Category). The maximum length is 1,024 characters. Certain operations allow suffixing of the table ID with a partition decorator, such as `sample_table$20190123`.
5614 #[serde(rename = "tableId")]
5615 pub table_id: Option<String>,
5616}
5617
5618impl common::Part for TableReference {}
5619
5620/// Replication info of a table created using `AS REPLICA` DDL like: `CREATE MATERIALIZED VIEW mv1 AS REPLICA OF src_mv`
5621///
5622/// This type is not used in any activity, and only used as *part* of another schema.
5623///
5624#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5625#[serde_with::serde_as]
5626#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5627pub struct TableReplicationInfo {
5628 /// Optional. Output only. If source is a materialized view, this field signifies the last refresh time of the source.
5629 #[serde(rename = "replicatedSourceLastRefreshTime")]
5630 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
5631 pub replicated_source_last_refresh_time: Option<i64>,
5632 /// Optional. Output only. Replication error that will permanently stopped table replication.
5633 #[serde(rename = "replicationError")]
5634 pub replication_error: Option<ErrorProto>,
5635 /// Optional. Specifies the interval at which the source table is polled for updates. It's Optional. If not specified, default replication interval would be applied.
5636 #[serde(rename = "replicationIntervalMs")]
5637 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
5638 pub replication_interval_ms: Option<i64>,
5639 /// Optional. Output only. Replication status of configured replication.
5640 #[serde(rename = "replicationStatus")]
5641 pub replication_status: Option<String>,
5642 /// Required. Source table reference that is replicated.
5643 #[serde(rename = "sourceTable")]
5644 pub source_table: Option<TableReference>,
5645}
5646
5647impl common::Part for TableReplicationInfo {}
5648
5649/// There is no detailed description.
5650///
5651/// This type is not used in any activity, and only used as *part* of another schema.
5652///
5653#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5654#[serde_with::serde_as]
5655#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5656pub struct TableRow {
5657 /// Represents a single row in the result set, consisting of one or more fields.
5658 pub f: Option<Vec<TableCell>>,
5659}
5660
5661impl common::Part for TableRow {}
5662
5663/// Schema of a table
5664///
5665/// This type is not used in any activity, and only used as *part* of another schema.
5666///
5667#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5668#[serde_with::serde_as]
5669#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5670pub struct TableSchema {
5671 /// Describes the fields in a table.
5672 pub fields: Option<Vec<TableFieldSchema>>,
5673 /// Optional. Specifies metadata of the foreign data type definition in field schema (TableFieldSchema.foreign_type_definition).
5674 #[serde(rename = "foreignTypeInfo")]
5675 pub foreign_type_info: Option<ForeignTypeInfo>,
5676}
5677
5678impl common::Part for TableSchema {}
5679
5680/// Request message for `TestIamPermissions` method.
5681///
5682/// # Activities
5683///
5684/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
5685/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
5686///
5687/// * [test iam permissions routines](RoutineTestIamPermissionCall) (request)
5688/// * [test iam permissions row access policies](RowAccessPolicyTestIamPermissionCall) (request)
5689/// * [test iam permissions tables](TableTestIamPermissionCall) (request)
5690#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5691#[serde_with::serde_as]
5692#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5693pub struct TestIamPermissionsRequest {
5694 /// The set of permissions to check for the `resource`. Permissions with wildcards (such as `*` or `storage.*`) are not allowed. For more information see [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions).
5695 pub permissions: Option<Vec<String>>,
5696}
5697
5698impl common::RequestValue for TestIamPermissionsRequest {}
5699
5700/// Response message for `TestIamPermissions` method.
5701///
5702/// # Activities
5703///
5704/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
5705/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
5706///
5707/// * [test iam permissions routines](RoutineTestIamPermissionCall) (response)
5708/// * [test iam permissions row access policies](RowAccessPolicyTestIamPermissionCall) (response)
5709/// * [test iam permissions tables](TableTestIamPermissionCall) (response)
5710#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5711#[serde_with::serde_as]
5712#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5713pub struct TestIamPermissionsResponse {
5714 /// A subset of `TestPermissionsRequest.permissions` that the caller is allowed.
5715 pub permissions: Option<Vec<String>>,
5716}
5717
5718impl common::ResponseResult for TestIamPermissionsResponse {}
5719
5720/// There is no detailed description.
5721///
5722/// This type is not used in any activity, and only used as *part* of another schema.
5723///
5724#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5725#[serde_with::serde_as]
5726#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5727pub struct TimePartitioning {
5728 /// Optional. Number of milliseconds for which to keep the storage for a partition. A wrapper is used here because 0 is an invalid value.
5729 #[serde(rename = "expirationMs")]
5730 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
5731 pub expiration_ms: Option<i64>,
5732 /// Optional. If not set, the table is partitioned by pseudo column '_PARTITIONTIME'; if set, the table is partitioned by this field. The field must be a top-level TIMESTAMP or DATE field. Its mode must be NULLABLE or REQUIRED. A wrapper is used here because an empty string is an invalid value.
5733 pub field: Option<String>,
5734 /// If set to true, queries over this table require a partition filter that can be used for partition elimination to be specified. This field is deprecated; please set the field with the same name on the table itself instead. This field needs a wrapper because we want to output the default value, false, if the user explicitly set it.
5735 #[serde(rename = "requirePartitionFilter")]
5736 pub require_partition_filter: Option<bool>,
5737 /// Required. The supported types are DAY, HOUR, MONTH, and YEAR, which will generate one partition per day, hour, month, and year, respectively.
5738 #[serde(rename = "type")]
5739 pub type_: Option<String>,
5740}
5741
5742impl common::Part for TimePartitioning {}
5743
5744/// Options used in model training.
5745///
5746/// This type is not used in any activity, and only used as *part* of another schema.
5747///
5748#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5749#[serde_with::serde_as]
5750#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5751pub struct TrainingOptions {
5752 /// Activation function of the neural nets.
5753 #[serde(rename = "activationFn")]
5754 pub activation_fn: Option<String>,
5755 /// If true, detect step changes and make data adjustment in the input time series.
5756 #[serde(rename = "adjustStepChanges")]
5757 pub adjust_step_changes: Option<bool>,
5758 /// Whether to use approximate feature contribution method in XGBoost model explanation for global explain.
5759 #[serde(rename = "approxGlobalFeatureContrib")]
5760 pub approx_global_feature_contrib: Option<bool>,
5761 /// Whether to enable auto ARIMA or not.
5762 #[serde(rename = "autoArima")]
5763 pub auto_arima: Option<bool>,
5764 /// The max value of the sum of non-seasonal p and q.
5765 #[serde(rename = "autoArimaMaxOrder")]
5766 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
5767 pub auto_arima_max_order: Option<i64>,
5768 /// The min value of the sum of non-seasonal p and q.
5769 #[serde(rename = "autoArimaMinOrder")]
5770 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
5771 pub auto_arima_min_order: Option<i64>,
5772 /// Whether to calculate class weights automatically based on the popularity of each label.
5773 #[serde(rename = "autoClassWeights")]
5774 pub auto_class_weights: Option<bool>,
5775 /// Batch size for dnn models.
5776 #[serde(rename = "batchSize")]
5777 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
5778 pub batch_size: Option<i64>,
5779 /// Booster type for boosted tree models.
5780 #[serde(rename = "boosterType")]
5781 pub booster_type: Option<String>,
5782 /// Budget in hours for AutoML training.
5783 #[serde(rename = "budgetHours")]
5784 pub budget_hours: Option<f64>,
5785 /// Whether or not p-value test should be computed for this model. Only available for linear and logistic regression models.
5786 #[serde(rename = "calculatePValues")]
5787 pub calculate_p_values: Option<bool>,
5788 /// Categorical feature encoding method.
5789 #[serde(rename = "categoryEncodingMethod")]
5790 pub category_encoding_method: Option<String>,
5791 /// If true, clean spikes and dips in the input time series.
5792 #[serde(rename = "cleanSpikesAndDips")]
5793 pub clean_spikes_and_dips: Option<bool>,
5794 /// Enums for color space, used for processing images in Object Table. See more details at https://www.tensorflow.org/io/tutorials/colorspace.
5795 #[serde(rename = "colorSpace")]
5796 pub color_space: Option<String>,
5797 /// Subsample ratio of columns for each level for boosted tree models.
5798 #[serde(rename = "colsampleBylevel")]
5799 pub colsample_bylevel: Option<f64>,
5800 /// Subsample ratio of columns for each node(split) for boosted tree models.
5801 #[serde(rename = "colsampleBynode")]
5802 pub colsample_bynode: Option<f64>,
5803 /// Subsample ratio of columns when constructing each tree for boosted tree models.
5804 #[serde(rename = "colsampleBytree")]
5805 pub colsample_bytree: Option<f64>,
5806 /// The contribution metric. Applies to contribution analysis models. Allowed formats supported are for summable and summable ratio contribution metrics. These include expressions such as `SUM(x)` or `SUM(x)/SUM(y)`, where x and y are column names from the base table.
5807 #[serde(rename = "contributionMetric")]
5808 pub contribution_metric: Option<String>,
5809 /// Type of normalization algorithm for boosted tree models using dart booster.
5810 #[serde(rename = "dartNormalizeType")]
5811 pub dart_normalize_type: Option<String>,
5812 /// The data frequency of a time series.
5813 #[serde(rename = "dataFrequency")]
5814 pub data_frequency: Option<String>,
5815 /// The column to split data with. This column won't be used as a feature. 1. When data_split_method is CUSTOM, the corresponding column should be boolean. The rows with true value tag are eval data, and the false are training data. 2. When data_split_method is SEQ, the first DATA_SPLIT_EVAL_FRACTION rows (from smallest to largest) in the corresponding column are used as training data, and the rest are eval data. It respects the order in Orderable data types: https://cloud.google.com/bigquery/docs/reference/standard-sql/data-types#data_type_properties
5816 #[serde(rename = "dataSplitColumn")]
5817 pub data_split_column: Option<String>,
5818 /// The fraction of evaluation data over the whole input data. The rest of data will be used as training data. The format should be double. Accurate to two decimal places. Default value is 0.2.
5819 #[serde(rename = "dataSplitEvalFraction")]
5820 pub data_split_eval_fraction: Option<f64>,
5821 /// The data split type for training and evaluation, e.g. RANDOM.
5822 #[serde(rename = "dataSplitMethod")]
5823 pub data_split_method: Option<String>,
5824 /// If true, perform decompose time series and save the results.
5825 #[serde(rename = "decomposeTimeSeries")]
5826 pub decompose_time_series: Option<bool>,
5827 /// Optional. Names of the columns to slice on. Applies to contribution analysis models.
5828 #[serde(rename = "dimensionIdColumns")]
5829 pub dimension_id_columns: Option<Vec<String>>,
5830 /// Distance type for clustering models.
5831 #[serde(rename = "distanceType")]
5832 pub distance_type: Option<String>,
5833 /// Dropout probability for dnn models.
5834 pub dropout: Option<f64>,
5835 /// Whether to stop early when the loss doesn't improve significantly any more (compared to min_relative_progress). Used only for iterative training algorithms.
5836 #[serde(rename = "earlyStop")]
5837 pub early_stop: Option<bool>,
5838 /// If true, enable global explanation during training.
5839 #[serde(rename = "enableGlobalExplain")]
5840 pub enable_global_explain: Option<bool>,
5841 /// The idle TTL of the endpoint before the resources get destroyed. The default value is 6.5 hours.
5842 #[serde(rename = "endpointIdleTtl")]
5843 #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
5844 pub endpoint_idle_ttl: Option<chrono::Duration>,
5845 /// Feedback type that specifies which algorithm to run for matrix factorization.
5846 #[serde(rename = "feedbackType")]
5847 pub feedback_type: Option<String>,
5848 /// Whether the model should include intercept during model training.
5849 #[serde(rename = "fitIntercept")]
5850 pub fit_intercept: Option<bool>,
5851 /// The forecast limit lower bound that was used during ARIMA model training with limits. To see more details of the algorithm: https://otexts.com/fpp2/limits.html
5852 #[serde(rename = "forecastLimitLowerBound")]
5853 pub forecast_limit_lower_bound: Option<f64>,
5854 /// The forecast limit upper bound that was used during ARIMA model training with limits.
5855 #[serde(rename = "forecastLimitUpperBound")]
5856 pub forecast_limit_upper_bound: Option<f64>,
5857 /// Hidden units for dnn models.
5858 #[serde(rename = "hiddenUnits")]
5859 #[serde_as(as = "Option<Vec<serde_with::DisplayFromStr>>")]
5860 pub hidden_units: Option<Vec<i64>>,
5861 /// The geographical region based on which the holidays are considered in time series modeling. If a valid value is specified, then holiday effects modeling is enabled.
5862 #[serde(rename = "holidayRegion")]
5863 pub holiday_region: Option<String>,
5864 /// A list of geographical regions that are used for time series modeling.
5865 #[serde(rename = "holidayRegions")]
5866 pub holiday_regions: Option<Vec<String>>,
5867 /// The number of periods ahead that need to be forecasted.
5868 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
5869 pub horizon: Option<i64>,
5870 /// The target evaluation metrics to optimize the hyperparameters for.
5871 #[serde(rename = "hparamTuningObjectives")]
5872 pub hparam_tuning_objectives: Option<Vec<String>>,
5873 /// The id of a Hugging Face model. For example, `google/gemma-2-2b-it`.
5874 #[serde(rename = "huggingFaceModelId")]
5875 pub hugging_face_model_id: Option<String>,
5876 /// Include drift when fitting an ARIMA model.
5877 #[serde(rename = "includeDrift")]
5878 pub include_drift: Option<bool>,
5879 /// Specifies the initial learning rate for the line search learn rate strategy.
5880 #[serde(rename = "initialLearnRate")]
5881 pub initial_learn_rate: Option<f64>,
5882 /// Name of input label columns in training data.
5883 #[serde(rename = "inputLabelColumns")]
5884 pub input_label_columns: Option<Vec<String>>,
5885 /// Name of the instance weight column for training data. This column isn't be used as a feature.
5886 #[serde(rename = "instanceWeightColumn")]
5887 pub instance_weight_column: Option<String>,
5888 /// Number of integral steps for the integrated gradients explain method.
5889 #[serde(rename = "integratedGradientsNumSteps")]
5890 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
5891 pub integrated_gradients_num_steps: Option<i64>,
5892 /// Name of the column used to determine the rows corresponding to control and test. Applies to contribution analysis models.
5893 #[serde(rename = "isTestColumn")]
5894 pub is_test_column: Option<String>,
5895 /// Item column specified for matrix factorization models.
5896 #[serde(rename = "itemColumn")]
5897 pub item_column: Option<String>,
5898 /// The column used to provide the initial centroids for kmeans algorithm when kmeans_initialization_method is CUSTOM.
5899 #[serde(rename = "kmeansInitializationColumn")]
5900 pub kmeans_initialization_column: Option<String>,
5901 /// The method used to initialize the centroids for kmeans algorithm.
5902 #[serde(rename = "kmeansInitializationMethod")]
5903 pub kmeans_initialization_method: Option<String>,
5904 /// L1 regularization coefficient to activations.
5905 #[serde(rename = "l1RegActivation")]
5906 pub l1_reg_activation: Option<f64>,
5907 /// L1 regularization coefficient.
5908 #[serde(rename = "l1Regularization")]
5909 pub l1_regularization: Option<f64>,
5910 /// L2 regularization coefficient.
5911 #[serde(rename = "l2Regularization")]
5912 pub l2_regularization: Option<f64>,
5913 /// Weights associated with each label class, for rebalancing the training data. Only applicable for classification models.
5914 #[serde(rename = "labelClassWeights")]
5915 pub label_class_weights: Option<HashMap<String, f64>>,
5916 /// Learning rate in training. Used only for iterative training algorithms.
5917 #[serde(rename = "learnRate")]
5918 pub learn_rate: Option<f64>,
5919 /// The strategy to determine learn rate for the current iteration.
5920 #[serde(rename = "learnRateStrategy")]
5921 pub learn_rate_strategy: Option<String>,
5922 /// Type of loss function used during training run.
5923 #[serde(rename = "lossType")]
5924 pub loss_type: Option<String>,
5925 /// The type of the machine used to deploy and serve the model.
5926 #[serde(rename = "machineType")]
5927 pub machine_type: Option<String>,
5928 /// The maximum number of iterations in training. Used only for iterative training algorithms.
5929 #[serde(rename = "maxIterations")]
5930 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
5931 pub max_iterations: Option<i64>,
5932 /// Maximum number of trials to run in parallel.
5933 #[serde(rename = "maxParallelTrials")]
5934 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
5935 pub max_parallel_trials: Option<i64>,
5936 /// The maximum number of machine replicas that will be deployed on an endpoint. The default value is equal to min_replica_count.
5937 #[serde(rename = "maxReplicaCount")]
5938 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
5939 pub max_replica_count: Option<i64>,
5940 /// The maximum number of time points in a time series that can be used in modeling the trend component of the time series. Don't use this option with the `timeSeriesLengthFraction` or `minTimeSeriesLength` options.
5941 #[serde(rename = "maxTimeSeriesLength")]
5942 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
5943 pub max_time_series_length: Option<i64>,
5944 /// Maximum depth of a tree for boosted tree models.
5945 #[serde(rename = "maxTreeDepth")]
5946 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
5947 pub max_tree_depth: Option<i64>,
5948 /// The apriori support minimum. Applies to contribution analysis models.
5949 #[serde(rename = "minAprioriSupport")]
5950 pub min_apriori_support: Option<f64>,
5951 /// When early_stop is true, stops training when accuracy improvement is less than 'min_relative_progress'. Used only for iterative training algorithms.
5952 #[serde(rename = "minRelativeProgress")]
5953 pub min_relative_progress: Option<f64>,
5954 /// The minimum number of machine replicas that will be always deployed on an endpoint. This value must be greater than or equal to 1. The default value is 1.
5955 #[serde(rename = "minReplicaCount")]
5956 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
5957 pub min_replica_count: Option<i64>,
5958 /// Minimum split loss for boosted tree models.
5959 #[serde(rename = "minSplitLoss")]
5960 pub min_split_loss: Option<f64>,
5961 /// The minimum number of time points in a time series that are used in modeling the trend component of the time series. If you use this option you must also set the `timeSeriesLengthFraction` option. This training option ensures that enough time points are available when you use `timeSeriesLengthFraction` in trend modeling. This is particularly important when forecasting multiple time series in a single query using `timeSeriesIdColumn`. If the total number of time points is less than the `minTimeSeriesLength` value, then the query uses all available time points.
5962 #[serde(rename = "minTimeSeriesLength")]
5963 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
5964 pub min_time_series_length: Option<i64>,
5965 /// Minimum sum of instance weight needed in a child for boosted tree models.
5966 #[serde(rename = "minTreeChildWeight")]
5967 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
5968 pub min_tree_child_weight: Option<i64>,
5969 /// The name of a Vertex model garden publisher model. Format is `publishers/{publisher}/models/{model}@{optional_version_id}`.
5970 #[serde(rename = "modelGardenModelName")]
5971 pub model_garden_model_name: Option<String>,
5972 /// The model registry.
5973 #[serde(rename = "modelRegistry")]
5974 pub model_registry: Option<String>,
5975 /// Google Cloud Storage URI from which the model was imported. Only applicable for imported models.
5976 #[serde(rename = "modelUri")]
5977 pub model_uri: Option<String>,
5978 /// A specification of the non-seasonal part of the ARIMA model: the three components (p, d, q) are the AR order, the degree of differencing, and the MA order.
5979 #[serde(rename = "nonSeasonalOrder")]
5980 pub non_seasonal_order: Option<ArimaOrder>,
5981 /// Number of clusters for clustering models.
5982 #[serde(rename = "numClusters")]
5983 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
5984 pub num_clusters: Option<i64>,
5985 /// Num factors specified for matrix factorization models.
5986 #[serde(rename = "numFactors")]
5987 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
5988 pub num_factors: Option<i64>,
5989 /// Number of parallel trees constructed during each iteration for boosted tree models.
5990 #[serde(rename = "numParallelTree")]
5991 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
5992 pub num_parallel_tree: Option<i64>,
5993 /// Number of principal components to keep in the PCA model. Must be <= the number of features.
5994 #[serde(rename = "numPrincipalComponents")]
5995 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
5996 pub num_principal_components: Option<i64>,
5997 /// Number of trials to run this hyperparameter tuning job.
5998 #[serde(rename = "numTrials")]
5999 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
6000 pub num_trials: Option<i64>,
6001 /// Optimization strategy for training linear regression models.
6002 #[serde(rename = "optimizationStrategy")]
6003 pub optimization_strategy: Option<String>,
6004 /// Optimizer used for training the neural nets.
6005 pub optimizer: Option<String>,
6006 /// The minimum ratio of cumulative explained variance that needs to be given by the PCA model.
6007 #[serde(rename = "pcaExplainedVarianceRatio")]
6008 pub pca_explained_variance_ratio: Option<f64>,
6009 /// The solver for PCA.
6010 #[serde(rename = "pcaSolver")]
6011 pub pca_solver: Option<String>,
6012 /// Corresponds to the label key of a reservation resource used by Vertex AI. To target a SPECIFIC_RESERVATION by name, use `compute.googleapis.com/reservation-name` as the key and specify the name of your reservation as its value.
6013 #[serde(rename = "reservationAffinityKey")]
6014 pub reservation_affinity_key: Option<String>,
6015 /// Specifies the reservation affinity type used to configure a Vertex AI resource. The default value is `NO_RESERVATION`.
6016 #[serde(rename = "reservationAffinityType")]
6017 pub reservation_affinity_type: Option<String>,
6018 /// Corresponds to the label values of a reservation resource used by Vertex AI. This must be the full resource name of the reservation or reservation block.
6019 #[serde(rename = "reservationAffinityValues")]
6020 pub reservation_affinity_values: Option<Vec<String>>,
6021 /// Number of paths for the sampled Shapley explain method.
6022 #[serde(rename = "sampledShapleyNumPaths")]
6023 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
6024 pub sampled_shapley_num_paths: Option<i64>,
6025 /// If true, scale the feature values by dividing the feature standard deviation. Currently only apply to PCA.
6026 #[serde(rename = "scaleFeatures")]
6027 pub scale_features: Option<bool>,
6028 /// Whether to standardize numerical features. Default to true.
6029 #[serde(rename = "standardizeFeatures")]
6030 pub standardize_features: Option<bool>,
6031 /// Subsample fraction of the training data to grow tree to prevent overfitting for boosted tree models.
6032 pub subsample: Option<f64>,
6033 /// Based on the selected TF version, the corresponding docker image is used to train external models.
6034 #[serde(rename = "tfVersion")]
6035 pub tf_version: Option<String>,
6036 /// Column to be designated as time series data for ARIMA model.
6037 #[serde(rename = "timeSeriesDataColumn")]
6038 pub time_series_data_column: Option<String>,
6039 /// The time series id column that was used during ARIMA model training.
6040 #[serde(rename = "timeSeriesIdColumn")]
6041 pub time_series_id_column: Option<String>,
6042 /// The time series id columns that were used during ARIMA model training.
6043 #[serde(rename = "timeSeriesIdColumns")]
6044 pub time_series_id_columns: Option<Vec<String>>,
6045 /// The fraction of the interpolated length of the time series that's used to model the time series trend component. All of the time points of the time series are used to model the non-trend component. This training option accelerates modeling training without sacrificing much forecasting accuracy. You can use this option with `minTimeSeriesLength` but not with `maxTimeSeriesLength`.
6046 #[serde(rename = "timeSeriesLengthFraction")]
6047 pub time_series_length_fraction: Option<f64>,
6048 /// Column to be designated as time series timestamp for ARIMA model.
6049 #[serde(rename = "timeSeriesTimestampColumn")]
6050 pub time_series_timestamp_column: Option<String>,
6051 /// Tree construction algorithm for boosted tree models.
6052 #[serde(rename = "treeMethod")]
6053 pub tree_method: Option<String>,
6054 /// Smoothing window size for the trend component. When a positive value is specified, a center moving average smoothing is applied on the history trend. When the smoothing window is out of the boundary at the beginning or the end of the trend, the first element or the last element is padded to fill the smoothing window before the average is applied.
6055 #[serde(rename = "trendSmoothingWindowSize")]
6056 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
6057 pub trend_smoothing_window_size: Option<i64>,
6058 /// User column specified for matrix factorization models.
6059 #[serde(rename = "userColumn")]
6060 pub user_column: Option<String>,
6061 /// The version aliases to apply in Vertex AI model registry. Always overwrite if the version aliases exists in a existing model.
6062 #[serde(rename = "vertexAiModelVersionAliases")]
6063 pub vertex_ai_model_version_aliases: Option<Vec<String>>,
6064 /// Hyperparameter for matrix factoration when implicit feedback type is specified.
6065 #[serde(rename = "walsAlpha")]
6066 pub wals_alpha: Option<f64>,
6067 /// Whether to train a model from the last checkpoint.
6068 #[serde(rename = "warmStart")]
6069 pub warm_start: Option<bool>,
6070 /// User-selected XGBoost versions for training of XGBoost models.
6071 #[serde(rename = "xgboostVersion")]
6072 pub xgboost_version: Option<String>,
6073}
6074
6075impl common::Part for TrainingOptions {}
6076
6077/// Information about a single training query run for the model.
6078///
6079/// This type is not used in any activity, and only used as *part* of another schema.
6080///
6081#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
6082#[serde_with::serde_as]
6083#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
6084pub struct TrainingRun {
6085 /// Output only. Global explanation contains the explanation of top features on the class level. Applies to classification models only.
6086 #[serde(rename = "classLevelGlobalExplanations")]
6087 pub class_level_global_explanations: Option<Vec<GlobalExplanation>>,
6088 /// Output only. Data split result of the training run. Only set when the input data is actually split.
6089 #[serde(rename = "dataSplitResult")]
6090 pub data_split_result: Option<DataSplitResult>,
6091 /// Output only. The evaluation metrics over training/eval data that were computed at the end of training.
6092 #[serde(rename = "evaluationMetrics")]
6093 pub evaluation_metrics: Option<EvaluationMetrics>,
6094 /// Output only. Global explanation contains the explanation of top features on the model level. Applies to both regression and classification models.
6095 #[serde(rename = "modelLevelGlobalExplanation")]
6096 pub model_level_global_explanation: Option<GlobalExplanation>,
6097 /// Output only. Output of each iteration run, results.size() <= max_iterations.
6098 pub results: Option<Vec<IterationResult>>,
6099 /// Output only. The start time of this training run.
6100 #[serde(rename = "startTime")]
6101 pub start_time: Option<chrono::DateTime<chrono::offset::Utc>>,
6102 /// Output only. Options that were used for this training run, includes user specified and default options that were used.
6103 #[serde(rename = "trainingOptions")]
6104 pub training_options: Option<TrainingOptions>,
6105 /// Output only. The start time of this training run, in milliseconds since epoch.
6106 #[serde(rename = "trainingStartTime")]
6107 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
6108 pub training_start_time: Option<i64>,
6109 /// The model id in the [Vertex AI Model Registry](https://cloud.google.com/vertex-ai/docs/model-registry/introduction) for this training run.
6110 #[serde(rename = "vertexAiModelId")]
6111 pub vertex_ai_model_id: Option<String>,
6112 /// Output only. The model version in the [Vertex AI Model Registry](https://cloud.google.com/vertex-ai/docs/model-registry/introduction) for this training run.
6113 #[serde(rename = "vertexAiModelVersion")]
6114 pub vertex_ai_model_version: Option<String>,
6115}
6116
6117impl common::Part for TrainingRun {}
6118
6119/// [Alpha] Information of a multi-statement transaction.
6120///
6121/// This type is not used in any activity, and only used as *part* of another schema.
6122///
6123#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
6124#[serde_with::serde_as]
6125#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
6126pub struct TransactionInfo {
6127 /// Output only. [Alpha] Id of the transaction.
6128 #[serde(rename = "transactionId")]
6129 pub transaction_id: Option<String>,
6130}
6131
6132impl common::Part for TransactionInfo {}
6133
6134/// Information about a single transform column.
6135///
6136/// This type is not used in any activity, and only used as *part* of another schema.
6137///
6138#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
6139#[serde_with::serde_as]
6140#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
6141pub struct TransformColumn {
6142 /// Output only. Name of the column.
6143 pub name: Option<String>,
6144 /// Output only. The SQL expression used in the column transform.
6145 #[serde(rename = "transformSql")]
6146 pub transform_sql: Option<String>,
6147 /// Output only. Data type of the column after the transform.
6148 #[serde(rename = "type")]
6149 pub type_: Option<StandardSqlDataType>,
6150}
6151
6152impl common::Part for TransformColumn {}
6153
6154/// Request format for undeleting a dataset.
6155///
6156/// # Activities
6157///
6158/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
6159/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
6160///
6161/// * [undelete datasets](DatasetUndeleteCall) (request)
6162#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
6163#[serde_with::serde_as]
6164#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
6165pub struct UndeleteDatasetRequest {
6166 /// Optional. The exact time when the dataset was deleted. If not specified, the most recently deleted version is undeleted. Undeleting a dataset using deletion time is not supported.
6167 #[serde(rename = "deletionTime")]
6168 pub deletion_time: Option<chrono::DateTime<chrono::offset::Utc>>,
6169}
6170
6171impl common::RequestValue for UndeleteDatasetRequest {}
6172
6173/// This is used for defining User Defined Function (UDF) resources only when using legacy SQL. Users of GoogleSQL should leverage either DDL (e.g. CREATE [TEMPORARY] FUNCTION ... ) or the Routines API to define UDF resources. For additional information on migrating, see: https://cloud.google.com/bigquery/docs/reference/standard-sql/migrating-from-legacy-sql#differences_in_user-defined_javascript_functions
6174///
6175/// This type is not used in any activity, and only used as *part* of another schema.
6176///
6177#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
6178#[serde_with::serde_as]
6179#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
6180pub struct UserDefinedFunctionResource {
6181 /// [Pick one] An inline resource that contains code for a user-defined function (UDF). Providing a inline code resource is equivalent to providing a URI for a file containing the same code.
6182 #[serde(rename = "inlineCode")]
6183 pub inline_code: Option<String>,
6184 /// [Pick one] A code resource to load from a Google Cloud Storage URI (gs://bucket/path).
6185 #[serde(rename = "resourceUri")]
6186 pub resource_uri: Option<String>,
6187}
6188
6189impl common::Part for UserDefinedFunctionResource {}
6190
6191/// Statistics for a vector search query. Populated as part of JobStatistics2.
6192///
6193/// This type is not used in any activity, and only used as *part* of another schema.
6194///
6195#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
6196#[serde_with::serde_as]
6197#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
6198pub struct VectorSearchStatistics {
6199 /// When `indexUsageMode` is `UNUSED` or `PARTIALLY_USED`, this field explains why indexes were not used in all or part of the vector search query. If `indexUsageMode` is `FULLY_USED`, this field is not populated.
6200 #[serde(rename = "indexUnusedReasons")]
6201 pub index_unused_reasons: Option<Vec<IndexUnusedReason>>,
6202 /// Specifies the index usage mode for the query.
6203 #[serde(rename = "indexUsageMode")]
6204 pub index_usage_mode: Option<String>,
6205 /// Specifies the usage of stored columns in the query when stored columns are used in the query.
6206 #[serde(rename = "storedColumnsUsages")]
6207 pub stored_columns_usages: Option<Vec<StoredColumnsUsage>>,
6208}
6209
6210impl common::Part for VectorSearchStatistics {}
6211
6212/// Describes the definition of a logical view.
6213///
6214/// This type is not used in any activity, and only used as *part* of another schema.
6215///
6216#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
6217#[serde_with::serde_as]
6218#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
6219pub struct ViewDefinition {
6220 /// Optional. Foreign view representations.
6221 #[serde(rename = "foreignDefinitions")]
6222 pub foreign_definitions: Option<Vec<ForeignViewDefinition>>,
6223 /// Optional. Specifies the privacy policy for the view.
6224 #[serde(rename = "privacyPolicy")]
6225 pub privacy_policy: Option<PrivacyPolicy>,
6226 /// Required. A query that BigQuery executes when the view is referenced.
6227 pub query: Option<String>,
6228 /// True if the column names are explicitly specified. For example by using the 'CREATE VIEW v(c1, c2) AS ...' syntax. Can only be set for GoogleSQL views.
6229 #[serde(rename = "useExplicitColumnNames")]
6230 pub use_explicit_column_names: Option<bool>,
6231 /// Specifies whether to use BigQuery's legacy SQL for this view. The default value is true. If set to false, the view will use BigQuery's GoogleSQL: https://cloud.google.com/bigquery/sql-reference/ Queries and views that reference this view must use the same flag value. A wrapper is used here because the default value is True.
6232 #[serde(rename = "useLegacySql")]
6233 pub use_legacy_sql: Option<bool>,
6234 /// Describes user-defined function resources used in the query.
6235 #[serde(rename = "userDefinedFunctionResources")]
6236 pub user_defined_function_resources: Option<Vec<UserDefinedFunctionResource>>,
6237}
6238
6239impl common::Part for ViewDefinition {}
6240
6241/// Deprecated.
6242///
6243/// This type is not used in any activity, and only used as *part* of another schema.
6244///
6245#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
6246#[serde_with::serde_as]
6247#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
6248pub struct BqmlTrainingRunTrainingOptions {
6249 /// no description provided
6250 #[serde(rename = "earlyStop")]
6251 pub early_stop: Option<bool>,
6252 /// no description provided
6253 #[serde(rename = "l1Reg")]
6254 pub l1_reg: Option<f64>,
6255 /// no description provided
6256 #[serde(rename = "l2Reg")]
6257 pub l2_reg: Option<f64>,
6258 /// no description provided
6259 #[serde(rename = "learnRate")]
6260 pub learn_rate: Option<f64>,
6261 /// no description provided
6262 #[serde(rename = "learnRateStrategy")]
6263 pub learn_rate_strategy: Option<String>,
6264 /// no description provided
6265 #[serde(rename = "lineSearchInitLearnRate")]
6266 pub line_search_init_learn_rate: Option<f64>,
6267 /// no description provided
6268 #[serde(rename = "maxIteration")]
6269 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
6270 pub max_iteration: Option<i64>,
6271 /// no description provided
6272 #[serde(rename = "minRelProgress")]
6273 pub min_rel_progress: Option<f64>,
6274 /// no description provided
6275 #[serde(rename = "warmStart")]
6276 pub warm_start: Option<bool>,
6277}
6278
6279impl common::NestedType for BqmlTrainingRunTrainingOptions {}
6280impl common::Part for BqmlTrainingRunTrainingOptions {}
6281
6282/// An object that defines dataset access for an entity.
6283///
6284/// This type is not used in any activity, and only used as *part* of another schema.
6285///
6286#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
6287#[serde_with::serde_as]
6288#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
6289pub struct DatasetAccess {
6290 /// Optional. condition for the binding. If CEL expression in this field is true, this access binding will be considered
6291 pub condition: Option<Expr>,
6292 /// [Pick one] A grant authorizing all resources of a particular type in a particular dataset access to this dataset. Only views are supported for now. The role field is not required when this field is set. If that dataset is deleted and re-created, its access needs to be granted again via an update operation.
6293 pub dataset: Option<DatasetAccessEntry>,
6294 /// [Pick one] A domain to grant access to. Any users signed in with the domain specified will be granted the specified access. Example: "example.com". Maps to IAM policy member "domain:DOMAIN".
6295 pub domain: Option<String>,
6296 /// [Pick one] An email address of a Google Group to grant access to. Maps to IAM policy member "group:GROUP".
6297 #[serde(rename = "groupByEmail")]
6298 pub group_by_email: Option<String>,
6299 /// [Pick one] Some other type of member that appears in the IAM Policy but isn't a user, group, domain, or special group.
6300 #[serde(rename = "iamMember")]
6301 pub iam_member: Option<String>,
6302 /// An IAM role ID that should be granted to the user, group, or domain specified in this access entry. The following legacy mappings will be applied: * `OWNER`: `roles/bigquery.dataOwner` * `WRITER`: `roles/bigquery.dataEditor` * `READER`: `roles/bigquery.dataViewer` This field will accept any of the above formats, but will return only the legacy format. For example, if you set this field to "roles/bigquery.dataOwner", it will be returned back as "OWNER".
6303 pub role: Option<String>,
6304 /// [Pick one] A routine from a different dataset to grant access to. Queries executed against that routine will have read access to views/tables/routines in this dataset. Only UDF is supported for now. The role field is not required when this field is set. If that routine is updated by any user, access to the routine needs to be granted again via an update operation.
6305 pub routine: Option<RoutineReference>,
6306 /// [Pick one] A special group to grant access to. Possible values include: * projectOwners: Owners of the enclosing project. * projectReaders: Readers of the enclosing project. * projectWriters: Writers of the enclosing project. * allAuthenticatedUsers: All authenticated BigQuery users. Maps to similarly-named IAM members.
6307 #[serde(rename = "specialGroup")]
6308 pub special_group: Option<String>,
6309 /// [Pick one] An email address of a user to grant access to. For example: fred@example.com. Maps to IAM policy member "user:EMAIL" or "serviceAccount:EMAIL".
6310 #[serde(rename = "userByEmail")]
6311 pub user_by_email: Option<String>,
6312 /// [Pick one] A view from a different dataset to grant access to. Queries executed against that view will have read access to views/tables/routines in this dataset. The role field is not required when this field is set. If that view is updated by any user, access to the view needs to be granted again via an update operation.
6313 pub view: Option<TableReference>,
6314}
6315
6316impl common::NestedType for DatasetAccess {}
6317impl common::Part for DatasetAccess {}
6318
6319/// A global tag managed by Resource Manager. https://cloud.google.com/iam/docs/tags-access-control#definitions
6320///
6321/// This type is not used in any activity, and only used as *part* of another schema.
6322///
6323#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
6324#[serde_with::serde_as]
6325#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
6326pub struct DatasetTags {
6327 /// Required. The namespaced friendly name of the tag key, e.g. "12345/environment" where 12345 is org id.
6328 #[serde(rename = "tagKey")]
6329 pub tag_key: Option<String>,
6330 /// Required. The friendly short name of the tag value, e.g. "production".
6331 #[serde(rename = "tagValue")]
6332 pub tag_value: Option<String>,
6333}
6334
6335impl common::NestedType for DatasetTags {}
6336impl common::Part for DatasetTags {}
6337
6338/// A dataset resource with only a subset of fields, to be returned in a list of datasets.
6339///
6340/// This type is not used in any activity, and only used as *part* of another schema.
6341///
6342#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
6343#[serde_with::serde_as]
6344#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
6345pub struct DatasetListDatasets {
6346 /// The dataset reference. Use this property to access specific parts of the dataset's ID, such as project ID or dataset ID.
6347 #[serde(rename = "datasetReference")]
6348 pub dataset_reference: Option<DatasetReference>,
6349 /// Output only. Reference to a read-only external dataset defined in data catalogs outside of BigQuery. Filled out when the dataset type is EXTERNAL.
6350 #[serde(rename = "externalDatasetReference")]
6351 pub external_dataset_reference: Option<ExternalDatasetReference>,
6352 /// An alternate name for the dataset. The friendly name is purely decorative in nature.
6353 #[serde(rename = "friendlyName")]
6354 pub friendly_name: Option<String>,
6355 /// The fully-qualified, unique, opaque ID of the dataset.
6356 pub id: Option<String>,
6357 /// The resource type. This property always returns the value "bigquery#dataset"
6358 pub kind: Option<String>,
6359 /// The labels associated with this dataset. You can use these to organize and group your datasets.
6360 pub labels: Option<HashMap<String, String>>,
6361 /// The geographic location where the dataset resides.
6362 pub location: Option<String>,
6363}
6364
6365impl common::NestedType for DatasetListDatasets {}
6366impl common::Part for DatasetListDatasets {}
6367
6368/// ListFormatJob is a partial projection of job information returned as part of a jobs.list response.
6369///
6370/// This type is not used in any activity, and only used as *part* of another schema.
6371///
6372#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
6373#[serde_with::serde_as]
6374#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
6375pub struct JobListJobs {
6376 /// Required. Describes the job configuration.
6377 pub configuration: Option<JobConfiguration>,
6378 /// A result object that will be present only if the job has failed.
6379 #[serde(rename = "errorResult")]
6380 pub error_result: Option<ErrorProto>,
6381 /// Unique opaque ID of the job.
6382 pub id: Option<String>,
6383 /// Unique opaque ID of the job.
6384 #[serde(rename = "jobReference")]
6385 pub job_reference: Option<JobReference>,
6386 /// The resource type.
6387 pub kind: Option<String>,
6388 /// [Full-projection-only] String representation of identity of requesting party. Populated for both first- and third-party identities. Only present for APIs that support third-party identities.
6389 pub principal_subject: Option<String>,
6390 /// Running state of the job. When the state is DONE, errorResult can be checked to determine whether the job succeeded or failed.
6391 pub state: Option<String>,
6392 /// Output only. Information about the job, including starting time and ending time of the job.
6393 pub statistics: Option<JobStatistics>,
6394 /// [Full-projection-only] Describes the status of this job.
6395 pub status: Option<JobStatus>,
6396 /// [Full-projection-only] Email address of the user who ran the job.
6397 pub user_email: Option<String>,
6398}
6399
6400impl common::NestedType for JobListJobs {}
6401impl common::Part for JobListJobs {}
6402
6403/// Job resource usage breakdown by reservation.
6404///
6405/// This type is not used in any activity, and only used as *part* of another schema.
6406///
6407#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
6408#[serde_with::serde_as]
6409#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
6410pub struct JobStatisticsReservationUsage {
6411 /// Reservation name or "unreserved" for on-demand resource usage and multi-statement queries.
6412 pub name: Option<String>,
6413 /// Total slot milliseconds used by the reservation for a particular job.
6414 #[serde(rename = "slotMs")]
6415 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
6416 pub slot_ms: Option<i64>,
6417}
6418
6419impl common::NestedType for JobStatisticsReservationUsage {}
6420impl common::Part for JobStatisticsReservationUsage {}
6421
6422/// Job resource usage breakdown by reservation.
6423///
6424/// This type is not used in any activity, and only used as *part* of another schema.
6425///
6426#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
6427#[serde_with::serde_as]
6428#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
6429pub struct JobStatistics2ReservationUsage {
6430 /// Reservation name or "unreserved" for on-demand resource usage and multi-statement queries.
6431 pub name: Option<String>,
6432 /// Total slot milliseconds used by the reservation for a particular job.
6433 #[serde(rename = "slotMs")]
6434 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
6435 pub slot_ms: Option<i64>,
6436}
6437
6438impl common::NestedType for JobStatistics2ReservationUsage {}
6439impl common::Part for JobStatistics2ReservationUsage {}
6440
6441/// Deprecated.
6442///
6443/// This type is not used in any activity, and only used as *part* of another schema.
6444///
6445#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
6446#[serde_with::serde_as]
6447#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
6448pub struct ModelDefinitionModelOptions {
6449 /// no description provided
6450 pub labels: Option<Vec<String>>,
6451 /// no description provided
6452 #[serde(rename = "lossType")]
6453 pub loss_type: Option<String>,
6454 /// no description provided
6455 #[serde(rename = "modelType")]
6456 pub model_type: Option<String>,
6457}
6458
6459impl common::NestedType for ModelDefinitionModelOptions {}
6460impl common::Part for ModelDefinitionModelOptions {}
6461
6462/// Information about a single project.
6463///
6464/// This type is not used in any activity, and only used as *part* of another schema.
6465///
6466#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
6467#[serde_with::serde_as]
6468#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
6469pub struct ProjectListProjects {
6470 /// A descriptive name for this project. A wrapper is used here because friendlyName can be set to the empty string.
6471 #[serde(rename = "friendlyName")]
6472 pub friendly_name: Option<String>,
6473 /// An opaque ID of this project.
6474 pub id: Option<String>,
6475 /// The resource type.
6476 pub kind: Option<String>,
6477 /// The numeric ID of this project.
6478 #[serde(rename = "numericId")]
6479 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
6480 pub numeric_id: Option<u64>,
6481 /// A unique reference to this project.
6482 #[serde(rename = "projectReference")]
6483 pub project_reference: Option<ProjectReference>,
6484}
6485
6486impl common::NestedType for ProjectListProjects {}
6487impl common::Part for ProjectListProjects {}
6488
6489/// The type of a struct parameter.
6490///
6491/// This type is not used in any activity, and only used as *part* of another schema.
6492///
6493#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
6494#[serde_with::serde_as]
6495#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
6496pub struct QueryParameterTypeStructTypes {
6497 /// Optional. Human-oriented description of the field.
6498 pub description: Option<String>,
6499 /// Optional. The name of this field.
6500 pub name: Option<String>,
6501 /// Required. The type of this field.
6502 #[serde(rename = "type")]
6503 pub type_: Option<QueryParameterType>,
6504}
6505
6506impl common::NestedType for QueryParameterTypeStructTypes {}
6507impl common::Part for QueryParameterTypeStructTypes {}
6508
6509/// [Experimental] Defines the ranges for range partitioning.
6510///
6511/// This type is not used in any activity, and only used as *part* of another schema.
6512///
6513#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
6514#[serde_with::serde_as]
6515#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
6516pub struct RangePartitioningRange {
6517 /// [Experimental] The end of range partitioning, exclusive.
6518 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
6519 pub end: Option<i64>,
6520 /// [Experimental] The width of each interval.
6521 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
6522 pub interval: Option<i64>,
6523 /// [Experimental] The start of range partitioning, inclusive.
6524 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
6525 pub start: Option<i64>,
6526}
6527
6528impl common::NestedType for RangePartitioningRange {}
6529impl common::Part for RangePartitioningRange {}
6530
6531/// Represents a foreign key constraint on a table's columns.
6532///
6533/// This type is not used in any activity, and only used as *part* of another schema.
6534///
6535#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
6536#[serde_with::serde_as]
6537#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
6538pub struct TableConstraintsForeignKeys {
6539 /// Required. The columns that compose the foreign key.
6540 #[serde(rename = "columnReferences")]
6541 pub column_references: Option<Vec<TableConstraintsForeignKeysColumnReferences>>,
6542 /// Optional. Set only if the foreign key constraint is named.
6543 pub name: Option<String>,
6544 /// no description provided
6545 #[serde(rename = "referencedTable")]
6546 pub referenced_table: Option<TableConstraintsForeignKeysReferencedTable>,
6547}
6548
6549impl common::NestedType for TableConstraintsForeignKeys {}
6550impl common::Part for TableConstraintsForeignKeys {}
6551
6552/// The pair of the foreign key column and primary key column.
6553///
6554/// This type is not used in any activity, and only used as *part* of another schema.
6555///
6556#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
6557#[serde_with::serde_as]
6558#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
6559pub struct TableConstraintsForeignKeysColumnReferences {
6560 /// Required. The column in the primary key that are referenced by the referencing_column.
6561 #[serde(rename = "referencedColumn")]
6562 pub referenced_column: Option<String>,
6563 /// Required. The column that composes the foreign key.
6564 #[serde(rename = "referencingColumn")]
6565 pub referencing_column: Option<String>,
6566}
6567
6568impl common::NestedType for TableConstraintsForeignKeysColumnReferences {}
6569impl common::Part for TableConstraintsForeignKeysColumnReferences {}
6570
6571/// There is no detailed description.
6572///
6573/// This type is not used in any activity, and only used as *part* of another schema.
6574///
6575#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
6576#[serde_with::serde_as]
6577#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
6578pub struct TableConstraintsForeignKeysReferencedTable {
6579 /// no description provided
6580 #[serde(rename = "datasetId")]
6581 pub dataset_id: Option<String>,
6582 /// no description provided
6583 #[serde(rename = "projectId")]
6584 pub project_id: Option<String>,
6585 /// no description provided
6586 #[serde(rename = "tableId")]
6587 pub table_id: Option<String>,
6588}
6589
6590impl common::NestedType for TableConstraintsForeignKeysReferencedTable {}
6591impl common::Part for TableConstraintsForeignKeysReferencedTable {}
6592
6593/// Represents the primary key constraint on a table's columns.
6594///
6595/// This type is not used in any activity, and only used as *part* of another schema.
6596///
6597#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
6598#[serde_with::serde_as]
6599#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
6600pub struct TableConstraintsPrimaryKey {
6601 /// Required. The columns that are composed of the primary key constraint.
6602 pub columns: Option<Vec<String>>,
6603}
6604
6605impl common::NestedType for TableConstraintsPrimaryKey {}
6606impl common::Part for TableConstraintsPrimaryKey {}
6607
6608/// Data for a single insertion row.
6609///
6610/// This type is not used in any activity, and only used as *part* of another schema.
6611///
6612#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
6613#[serde_with::serde_as]
6614#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
6615pub struct TableDataInsertAllRequestRows {
6616 /// Insertion ID for best-effort deduplication. This feature is not recommended, and users seeking stronger insertion semantics are encouraged to use other mechanisms such as the BigQuery Write API.
6617 #[serde(rename = "insertId")]
6618 pub insert_id: Option<String>,
6619 /// Data for a single row.
6620 pub json: Option<JsonObject>,
6621}
6622
6623impl common::NestedType for TableDataInsertAllRequestRows {}
6624impl common::Part for TableDataInsertAllRequestRows {}
6625
6626/// Error details about a single row's insertion.
6627///
6628/// This type is not used in any activity, and only used as *part* of another schema.
6629///
6630#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
6631#[serde_with::serde_as]
6632#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
6633pub struct TableDataInsertAllResponseInsertErrors {
6634 /// Error information for the row indicated by the index property.
6635 pub errors: Option<Vec<ErrorProto>>,
6636 /// The index of the row that error applies to.
6637 pub index: Option<u32>,
6638}
6639
6640impl common::NestedType for TableDataInsertAllResponseInsertErrors {}
6641impl common::Part for TableDataInsertAllResponseInsertErrors {}
6642
6643/// Deprecated.
6644///
6645/// This type is not used in any activity, and only used as *part* of another schema.
6646///
6647#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
6648#[serde_with::serde_as]
6649#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
6650pub struct TableFieldSchemaCategories {
6651 /// Deprecated.
6652 pub names: Option<Vec<String>>,
6653}
6654
6655impl common::NestedType for TableFieldSchemaCategories {}
6656impl common::Part for TableFieldSchemaCategories {}
6657
6658/// Optional. The policy tags attached to this field, used for field-level access control. If not set, defaults to empty policy_tags.
6659///
6660/// This type is not used in any activity, and only used as *part* of another schema.
6661///
6662#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
6663#[serde_with::serde_as]
6664#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
6665pub struct TableFieldSchemaPolicyTags {
6666 /// A list of policy tag resource names. For example, "projects/1/locations/eu/taxonomies/2/policyTags/3". At most 1 policy tag is currently allowed.
6667 pub names: Option<Vec<String>>,
6668}
6669
6670impl common::NestedType for TableFieldSchemaPolicyTags {}
6671impl common::Part for TableFieldSchemaPolicyTags {}
6672
6673/// Represents the type of a field element.
6674///
6675/// This type is not used in any activity, and only used as *part* of another schema.
6676///
6677#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
6678#[serde_with::serde_as]
6679#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
6680pub struct TableFieldSchemaRangeElementType {
6681 /// Required. The type of a field element. For more information, see TableFieldSchema.type.
6682 #[serde(rename = "type")]
6683 pub type_: Option<String>,
6684}
6685
6686impl common::NestedType for TableFieldSchemaRangeElementType {}
6687impl common::Part for TableFieldSchemaRangeElementType {}
6688
6689/// Tables in the requested dataset.
6690///
6691/// This type is not used in any activity, and only used as *part* of another schema.
6692///
6693#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
6694#[serde_with::serde_as]
6695#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
6696pub struct TableListTables {
6697 /// Clustering specification for this table, if configured.
6698 pub clustering: Option<Clustering>,
6699 /// Output only. The time when this table was created, in milliseconds since the epoch.
6700 #[serde(rename = "creationTime")]
6701 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
6702 pub creation_time: Option<i64>,
6703 /// The time when this table expires, in milliseconds since the epoch. If not present, the table will persist indefinitely. Expired tables will be deleted and their storage reclaimed.
6704 #[serde(rename = "expirationTime")]
6705 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
6706 pub expiration_time: Option<i64>,
6707 /// The user-friendly name for this table.
6708 #[serde(rename = "friendlyName")]
6709 pub friendly_name: Option<String>,
6710 /// An opaque ID of the table.
6711 pub id: Option<String>,
6712 /// The resource type.
6713 pub kind: Option<String>,
6714 /// The labels associated with this table. You can use these to organize and group your tables.
6715 pub labels: Option<HashMap<String, String>>,
6716 /// The range partitioning for this table.
6717 #[serde(rename = "rangePartitioning")]
6718 pub range_partitioning: Option<RangePartitioning>,
6719 /// Optional. If set to true, queries including this table must specify a partition filter. This filter is used for partition elimination.
6720 #[serde(rename = "requirePartitionFilter")]
6721 pub require_partition_filter: Option<bool>,
6722 /// A reference uniquely identifying table.
6723 #[serde(rename = "tableReference")]
6724 pub table_reference: Option<TableReference>,
6725 /// The time-based partitioning for this table.
6726 #[serde(rename = "timePartitioning")]
6727 pub time_partitioning: Option<TimePartitioning>,
6728 /// The type of table.
6729 #[serde(rename = "type")]
6730 pub type_: Option<String>,
6731 /// Information about a logical view.
6732 pub view: Option<TableListTablesView>,
6733}
6734
6735impl common::NestedType for TableListTables {}
6736impl common::Part for TableListTables {}
6737
6738/// Information about a logical view.
6739///
6740/// This type is not used in any activity, and only used as *part* of another schema.
6741///
6742#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
6743#[serde_with::serde_as]
6744#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
6745pub struct TableListTablesView {
6746 /// Specifies the privacy policy for the view.
6747 #[serde(rename = "privacyPolicy")]
6748 pub privacy_policy: Option<PrivacyPolicy>,
6749 /// True if view is defined in legacy SQL dialect, false if in GoogleSQL.
6750 #[serde(rename = "useLegacySql")]
6751 pub use_legacy_sql: Option<bool>,
6752}
6753
6754impl common::NestedType for TableListTablesView {}
6755impl common::Part for TableListTablesView {}
6756
6757// ###################
6758// MethodBuilders ###
6759// #################
6760
6761/// A builder providing access to all methods supported on *dataset* resources.
6762/// It is not used directly, but through the [`Bigquery`] hub.
6763///
6764/// # Example
6765///
6766/// Instantiate a resource builder
6767///
6768/// ```test_harness,no_run
6769/// extern crate hyper;
6770/// extern crate hyper_rustls;
6771/// extern crate google_bigquery2 as bigquery2;
6772///
6773/// # async fn dox() {
6774/// use bigquery2::{Bigquery, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6775///
6776/// let secret: yup_oauth2::ApplicationSecret = Default::default();
6777/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
6778/// .with_native_roots()
6779/// .unwrap()
6780/// .https_only()
6781/// .enable_http2()
6782/// .build();
6783///
6784/// let executor = hyper_util::rt::TokioExecutor::new();
6785/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
6786/// secret,
6787/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6788/// yup_oauth2::client::CustomHyperClientBuilder::from(
6789/// hyper_util::client::legacy::Client::builder(executor).build(connector),
6790/// ),
6791/// ).build().await.unwrap();
6792///
6793/// let client = hyper_util::client::legacy::Client::builder(
6794/// hyper_util::rt::TokioExecutor::new()
6795/// )
6796/// .build(
6797/// hyper_rustls::HttpsConnectorBuilder::new()
6798/// .with_native_roots()
6799/// .unwrap()
6800/// .https_or_http()
6801/// .enable_http2()
6802/// .build()
6803/// );
6804/// let mut hub = Bigquery::new(client, auth);
6805/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
6806/// // like `delete(...)`, `get(...)`, `insert(...)`, `list(...)`, `patch(...)`, `undelete(...)` and `update(...)`
6807/// // to build up your call.
6808/// let rb = hub.datasets();
6809/// # }
6810/// ```
6811pub struct DatasetMethods<'a, C>
6812where
6813 C: 'a,
6814{
6815 hub: &'a Bigquery<C>,
6816}
6817
6818impl<'a, C> common::MethodsBuilder for DatasetMethods<'a, C> {}
6819
6820impl<'a, C> DatasetMethods<'a, C> {
6821 /// Create a builder to help you perform the following task:
6822 ///
6823 /// Deletes the dataset specified by the datasetId value. Before you can delete a dataset, you must delete all its tables, either manually or by specifying deleteContents. Immediately after deletion, you can create another dataset with the same name.
6824 ///
6825 /// # Arguments
6826 ///
6827 /// * `projectId` - Required. Project ID of the dataset being deleted
6828 /// * `datasetId` - Required. Dataset ID of dataset being deleted
6829 pub fn delete(&self, project_id: &str, dataset_id: &str) -> DatasetDeleteCall<'a, C> {
6830 DatasetDeleteCall {
6831 hub: self.hub,
6832 _project_id: project_id.to_string(),
6833 _dataset_id: dataset_id.to_string(),
6834 _delete_contents: Default::default(),
6835 _delegate: Default::default(),
6836 _additional_params: Default::default(),
6837 _scopes: Default::default(),
6838 }
6839 }
6840
6841 /// Create a builder to help you perform the following task:
6842 ///
6843 /// Returns the dataset specified by datasetID.
6844 ///
6845 /// # Arguments
6846 ///
6847 /// * `projectId` - Required. Project ID of the requested dataset
6848 /// * `datasetId` - Required. Dataset ID of the requested dataset
6849 pub fn get(&self, project_id: &str, dataset_id: &str) -> DatasetGetCall<'a, C> {
6850 DatasetGetCall {
6851 hub: self.hub,
6852 _project_id: project_id.to_string(),
6853 _dataset_id: dataset_id.to_string(),
6854 _dataset_view: Default::default(),
6855 _access_policy_version: Default::default(),
6856 _delegate: Default::default(),
6857 _additional_params: Default::default(),
6858 _scopes: Default::default(),
6859 }
6860 }
6861
6862 /// Create a builder to help you perform the following task:
6863 ///
6864 /// Creates a new empty dataset.
6865 ///
6866 /// # Arguments
6867 ///
6868 /// * `request` - No description provided.
6869 /// * `projectId` - Required. Project ID of the new dataset
6870 pub fn insert(&self, request: Dataset, project_id: &str) -> DatasetInsertCall<'a, C> {
6871 DatasetInsertCall {
6872 hub: self.hub,
6873 _request: request,
6874 _project_id: project_id.to_string(),
6875 _access_policy_version: Default::default(),
6876 _delegate: Default::default(),
6877 _additional_params: Default::default(),
6878 _scopes: Default::default(),
6879 }
6880 }
6881
6882 /// Create a builder to help you perform the following task:
6883 ///
6884 /// Lists all datasets in the specified project to which the user has been granted the READER dataset role.
6885 ///
6886 /// # Arguments
6887 ///
6888 /// * `projectId` - Required. Project ID of the datasets to be listed
6889 pub fn list(&self, project_id: &str) -> DatasetListCall<'a, C> {
6890 DatasetListCall {
6891 hub: self.hub,
6892 _project_id: project_id.to_string(),
6893 _page_token: Default::default(),
6894 _max_results: Default::default(),
6895 _filter: Default::default(),
6896 _all: Default::default(),
6897 _delegate: Default::default(),
6898 _additional_params: Default::default(),
6899 _scopes: Default::default(),
6900 }
6901 }
6902
6903 /// Create a builder to help you perform the following task:
6904 ///
6905 /// Updates information in an existing dataset. The update method replaces the entire dataset resource, whereas the patch method only replaces fields that are provided in the submitted dataset resource. This method supports RFC5789 patch semantics.
6906 ///
6907 /// # Arguments
6908 ///
6909 /// * `request` - No description provided.
6910 /// * `projectId` - Required. Project ID of the dataset being updated
6911 /// * `datasetId` - Required. Dataset ID of the dataset being updated
6912 pub fn patch(
6913 &self,
6914 request: Dataset,
6915 project_id: &str,
6916 dataset_id: &str,
6917 ) -> DatasetPatchCall<'a, C> {
6918 DatasetPatchCall {
6919 hub: self.hub,
6920 _request: request,
6921 _project_id: project_id.to_string(),
6922 _dataset_id: dataset_id.to_string(),
6923 _update_mode: Default::default(),
6924 _access_policy_version: Default::default(),
6925 _delegate: Default::default(),
6926 _additional_params: Default::default(),
6927 _scopes: Default::default(),
6928 }
6929 }
6930
6931 /// Create a builder to help you perform the following task:
6932 ///
6933 /// Undeletes a dataset which is within time travel window based on datasetId. If a time is specified, the dataset version deleted at that time is undeleted, else the last live version is undeleted.
6934 ///
6935 /// # Arguments
6936 ///
6937 /// * `request` - No description provided.
6938 /// * `projectId` - Required. Project ID of the dataset to be undeleted
6939 /// * `datasetId` - Required. Dataset ID of dataset being deleted
6940 pub fn undelete(
6941 &self,
6942 request: UndeleteDatasetRequest,
6943 project_id: &str,
6944 dataset_id: &str,
6945 ) -> DatasetUndeleteCall<'a, C> {
6946 DatasetUndeleteCall {
6947 hub: self.hub,
6948 _request: request,
6949 _project_id: project_id.to_string(),
6950 _dataset_id: dataset_id.to_string(),
6951 _delegate: Default::default(),
6952 _additional_params: Default::default(),
6953 _scopes: Default::default(),
6954 }
6955 }
6956
6957 /// Create a builder to help you perform the following task:
6958 ///
6959 /// Updates information in an existing dataset. The update method replaces the entire dataset resource, whereas the patch method only replaces fields that are provided in the submitted dataset resource.
6960 ///
6961 /// # Arguments
6962 ///
6963 /// * `request` - No description provided.
6964 /// * `projectId` - Required. Project ID of the dataset being updated
6965 /// * `datasetId` - Required. Dataset ID of the dataset being updated
6966 pub fn update(
6967 &self,
6968 request: Dataset,
6969 project_id: &str,
6970 dataset_id: &str,
6971 ) -> DatasetUpdateCall<'a, C> {
6972 DatasetUpdateCall {
6973 hub: self.hub,
6974 _request: request,
6975 _project_id: project_id.to_string(),
6976 _dataset_id: dataset_id.to_string(),
6977 _update_mode: Default::default(),
6978 _access_policy_version: Default::default(),
6979 _delegate: Default::default(),
6980 _additional_params: Default::default(),
6981 _scopes: Default::default(),
6982 }
6983 }
6984}
6985
6986/// A builder providing access to all methods supported on *job* resources.
6987/// It is not used directly, but through the [`Bigquery`] hub.
6988///
6989/// # Example
6990///
6991/// Instantiate a resource builder
6992///
6993/// ```test_harness,no_run
6994/// extern crate hyper;
6995/// extern crate hyper_rustls;
6996/// extern crate google_bigquery2 as bigquery2;
6997///
6998/// # async fn dox() {
6999/// use bigquery2::{Bigquery, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7000///
7001/// let secret: yup_oauth2::ApplicationSecret = Default::default();
7002/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
7003/// .with_native_roots()
7004/// .unwrap()
7005/// .https_only()
7006/// .enable_http2()
7007/// .build();
7008///
7009/// let executor = hyper_util::rt::TokioExecutor::new();
7010/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
7011/// secret,
7012/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7013/// yup_oauth2::client::CustomHyperClientBuilder::from(
7014/// hyper_util::client::legacy::Client::builder(executor).build(connector),
7015/// ),
7016/// ).build().await.unwrap();
7017///
7018/// let client = hyper_util::client::legacy::Client::builder(
7019/// hyper_util::rt::TokioExecutor::new()
7020/// )
7021/// .build(
7022/// hyper_rustls::HttpsConnectorBuilder::new()
7023/// .with_native_roots()
7024/// .unwrap()
7025/// .https_or_http()
7026/// .enable_http2()
7027/// .build()
7028/// );
7029/// let mut hub = Bigquery::new(client, auth);
7030/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
7031/// // like `cancel(...)`, `delete(...)`, `get(...)`, `get_query_results(...)`, `insert(...)`, `list(...)` and `query(...)`
7032/// // to build up your call.
7033/// let rb = hub.jobs();
7034/// # }
7035/// ```
7036pub struct JobMethods<'a, C>
7037where
7038 C: 'a,
7039{
7040 hub: &'a Bigquery<C>,
7041}
7042
7043impl<'a, C> common::MethodsBuilder for JobMethods<'a, C> {}
7044
7045impl<'a, C> JobMethods<'a, C> {
7046 /// Create a builder to help you perform the following task:
7047 ///
7048 /// Requests that a job be cancelled. This call will return immediately, and the client will need to poll for the job status to see if the cancel completed successfully. Cancelled jobs may still incur costs.
7049 ///
7050 /// # Arguments
7051 ///
7052 /// * `projectId` - Required. Project ID of the job to cancel
7053 /// * `jobId` - Required. Job ID of the job to cancel
7054 pub fn cancel(&self, project_id: &str, job_id: &str) -> JobCancelCall<'a, C> {
7055 JobCancelCall {
7056 hub: self.hub,
7057 _project_id: project_id.to_string(),
7058 _job_id: job_id.to_string(),
7059 _location: Default::default(),
7060 _delegate: Default::default(),
7061 _additional_params: Default::default(),
7062 _scopes: Default::default(),
7063 }
7064 }
7065
7066 /// Create a builder to help you perform the following task:
7067 ///
7068 /// Requests the deletion of the metadata of a job. This call returns when the job's metadata is deleted.
7069 ///
7070 /// # Arguments
7071 ///
7072 /// * `projectId` - Required. Project ID of the job for which metadata is to be deleted.
7073 /// * `jobId` - Required. Job ID of the job for which metadata is to be deleted. If this is a parent job which has child jobs, the metadata from all child jobs will be deleted as well. Direct deletion of the metadata of child jobs is not allowed.
7074 pub fn delete(&self, project_id: &str, job_id: &str) -> JobDeleteCall<'a, C> {
7075 JobDeleteCall {
7076 hub: self.hub,
7077 _project_id: project_id.to_string(),
7078 _job_id: job_id.to_string(),
7079 _location: Default::default(),
7080 _delegate: Default::default(),
7081 _additional_params: Default::default(),
7082 _scopes: Default::default(),
7083 }
7084 }
7085
7086 /// Create a builder to help you perform the following task:
7087 ///
7088 /// Returns information about a specific job. Job information is available for a six month period after creation. Requires that you're the person who ran the job, or have the Is Owner project role.
7089 ///
7090 /// # Arguments
7091 ///
7092 /// * `projectId` - Required. Project ID of the requested job.
7093 /// * `jobId` - Required. Job ID of the requested job.
7094 pub fn get(&self, project_id: &str, job_id: &str) -> JobGetCall<'a, C> {
7095 JobGetCall {
7096 hub: self.hub,
7097 _project_id: project_id.to_string(),
7098 _job_id: job_id.to_string(),
7099 _location: Default::default(),
7100 _delegate: Default::default(),
7101 _additional_params: Default::default(),
7102 _scopes: Default::default(),
7103 }
7104 }
7105
7106 /// Create a builder to help you perform the following task:
7107 ///
7108 /// RPC to get the results of a query job.
7109 ///
7110 /// # Arguments
7111 ///
7112 /// * `projectId` - Required. Project ID of the query job.
7113 /// * `jobId` - Required. Job ID of the query job.
7114 pub fn get_query_results(
7115 &self,
7116 project_id: &str,
7117 job_id: &str,
7118 ) -> JobGetQueryResultCall<'a, C> {
7119 JobGetQueryResultCall {
7120 hub: self.hub,
7121 _project_id: project_id.to_string(),
7122 _job_id: job_id.to_string(),
7123 _timeout_ms: Default::default(),
7124 _start_index: Default::default(),
7125 _page_token: Default::default(),
7126 _max_results: Default::default(),
7127 _location: Default::default(),
7128 _format_options_use_int64_timestamp: Default::default(),
7129 _format_options_timestamp_output_format: Default::default(),
7130 _delegate: Default::default(),
7131 _additional_params: Default::default(),
7132 _scopes: Default::default(),
7133 }
7134 }
7135
7136 /// Create a builder to help you perform the following task:
7137 ///
7138 /// Starts a new asynchronous job. This API has two different kinds of endpoint URIs, as this method supports a variety of use cases. * The *Metadata* URI is used for most interactions, as it accepts the job configuration directly. * The *Upload* URI is ONLY for the case when you're sending both a load job configuration and a data stream together. In this case, the Upload URI accepts the job configuration and the data as two distinct multipart MIME parts.
7139 ///
7140 /// # Arguments
7141 ///
7142 /// * `request` - No description provided.
7143 /// * `projectId` - Project ID of project that will be billed for the job.
7144 pub fn insert(&self, request: Job, project_id: &str) -> JobInsertCall<'a, C> {
7145 JobInsertCall {
7146 hub: self.hub,
7147 _request: request,
7148 _project_id: project_id.to_string(),
7149 _delegate: Default::default(),
7150 _additional_params: Default::default(),
7151 _scopes: Default::default(),
7152 }
7153 }
7154
7155 /// Create a builder to help you perform the following task:
7156 ///
7157 /// Lists all jobs that you started in the specified project. Job information is available for a six month period after creation. The job list is sorted in reverse chronological order, by job creation time. Requires the Can View project role, or the Is Owner project role if you set the allUsers property.
7158 ///
7159 /// # Arguments
7160 ///
7161 /// * `projectId` - Project ID of the jobs to list.
7162 pub fn list(&self, project_id: &str) -> JobListCall<'a, C> {
7163 JobListCall {
7164 hub: self.hub,
7165 _project_id: project_id.to_string(),
7166 _state_filter: Default::default(),
7167 _projection: Default::default(),
7168 _parent_job_id: Default::default(),
7169 _page_token: Default::default(),
7170 _min_creation_time: Default::default(),
7171 _max_results: Default::default(),
7172 _max_creation_time: Default::default(),
7173 _all_users: Default::default(),
7174 _delegate: Default::default(),
7175 _additional_params: Default::default(),
7176 _scopes: Default::default(),
7177 }
7178 }
7179
7180 /// Create a builder to help you perform the following task:
7181 ///
7182 /// Runs a BigQuery SQL query synchronously and returns query results if the query completes within a specified timeout.
7183 ///
7184 /// # Arguments
7185 ///
7186 /// * `request` - No description provided.
7187 /// * `projectId` - Required. Project ID of the query request.
7188 pub fn query(&self, request: QueryRequest, project_id: &str) -> JobQueryCall<'a, C> {
7189 JobQueryCall {
7190 hub: self.hub,
7191 _request: request,
7192 _project_id: project_id.to_string(),
7193 _delegate: Default::default(),
7194 _additional_params: Default::default(),
7195 _scopes: Default::default(),
7196 }
7197 }
7198}
7199
7200/// A builder providing access to all methods supported on *model* resources.
7201/// It is not used directly, but through the [`Bigquery`] hub.
7202///
7203/// # Example
7204///
7205/// Instantiate a resource builder
7206///
7207/// ```test_harness,no_run
7208/// extern crate hyper;
7209/// extern crate hyper_rustls;
7210/// extern crate google_bigquery2 as bigquery2;
7211///
7212/// # async fn dox() {
7213/// use bigquery2::{Bigquery, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7214///
7215/// let secret: yup_oauth2::ApplicationSecret = Default::default();
7216/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
7217/// .with_native_roots()
7218/// .unwrap()
7219/// .https_only()
7220/// .enable_http2()
7221/// .build();
7222///
7223/// let executor = hyper_util::rt::TokioExecutor::new();
7224/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
7225/// secret,
7226/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7227/// yup_oauth2::client::CustomHyperClientBuilder::from(
7228/// hyper_util::client::legacy::Client::builder(executor).build(connector),
7229/// ),
7230/// ).build().await.unwrap();
7231///
7232/// let client = hyper_util::client::legacy::Client::builder(
7233/// hyper_util::rt::TokioExecutor::new()
7234/// )
7235/// .build(
7236/// hyper_rustls::HttpsConnectorBuilder::new()
7237/// .with_native_roots()
7238/// .unwrap()
7239/// .https_or_http()
7240/// .enable_http2()
7241/// .build()
7242/// );
7243/// let mut hub = Bigquery::new(client, auth);
7244/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
7245/// // like `delete(...)`, `get(...)`, `list(...)` and `patch(...)`
7246/// // to build up your call.
7247/// let rb = hub.models();
7248/// # }
7249/// ```
7250pub struct ModelMethods<'a, C>
7251where
7252 C: 'a,
7253{
7254 hub: &'a Bigquery<C>,
7255}
7256
7257impl<'a, C> common::MethodsBuilder for ModelMethods<'a, C> {}
7258
7259impl<'a, C> ModelMethods<'a, C> {
7260 /// Create a builder to help you perform the following task:
7261 ///
7262 /// Deletes the model specified by modelId from the dataset.
7263 ///
7264 /// # Arguments
7265 ///
7266 /// * `projectId` - Required. Project ID of the model to delete.
7267 /// * `datasetId` - Required. Dataset ID of the model to delete.
7268 /// * `modelId` - Required. Model ID of the model to delete.
7269 pub fn delete(
7270 &self,
7271 project_id: &str,
7272 dataset_id: &str,
7273 model_id: &str,
7274 ) -> ModelDeleteCall<'a, C> {
7275 ModelDeleteCall {
7276 hub: self.hub,
7277 _project_id: project_id.to_string(),
7278 _dataset_id: dataset_id.to_string(),
7279 _model_id: model_id.to_string(),
7280 _delegate: Default::default(),
7281 _additional_params: Default::default(),
7282 _scopes: Default::default(),
7283 }
7284 }
7285
7286 /// Create a builder to help you perform the following task:
7287 ///
7288 /// Gets the specified model resource by model ID.
7289 ///
7290 /// # Arguments
7291 ///
7292 /// * `projectId` - Required. Project ID of the requested model.
7293 /// * `datasetId` - Required. Dataset ID of the requested model.
7294 /// * `modelId` - Required. Model ID of the requested model.
7295 pub fn get(&self, project_id: &str, dataset_id: &str, model_id: &str) -> ModelGetCall<'a, C> {
7296 ModelGetCall {
7297 hub: self.hub,
7298 _project_id: project_id.to_string(),
7299 _dataset_id: dataset_id.to_string(),
7300 _model_id: model_id.to_string(),
7301 _delegate: Default::default(),
7302 _additional_params: Default::default(),
7303 _scopes: Default::default(),
7304 }
7305 }
7306
7307 /// Create a builder to help you perform the following task:
7308 ///
7309 /// Lists all models in the specified dataset. Requires the READER dataset role. After retrieving the list of models, you can get information about a particular model by calling the models.get method.
7310 ///
7311 /// # Arguments
7312 ///
7313 /// * `projectId` - Required. Project ID of the models to list.
7314 /// * `datasetId` - Required. Dataset ID of the models to list.
7315 pub fn list(&self, project_id: &str, dataset_id: &str) -> ModelListCall<'a, C> {
7316 ModelListCall {
7317 hub: self.hub,
7318 _project_id: project_id.to_string(),
7319 _dataset_id: dataset_id.to_string(),
7320 _page_token: Default::default(),
7321 _max_results: Default::default(),
7322 _delegate: Default::default(),
7323 _additional_params: Default::default(),
7324 _scopes: Default::default(),
7325 }
7326 }
7327
7328 /// Create a builder to help you perform the following task:
7329 ///
7330 /// Patch specific fields in the specified model.
7331 ///
7332 /// # Arguments
7333 ///
7334 /// * `request` - No description provided.
7335 /// * `projectId` - Required. Project ID of the model to patch.
7336 /// * `datasetId` - Required. Dataset ID of the model to patch.
7337 /// * `modelId` - Required. Model ID of the model to patch.
7338 pub fn patch(
7339 &self,
7340 request: Model,
7341 project_id: &str,
7342 dataset_id: &str,
7343 model_id: &str,
7344 ) -> ModelPatchCall<'a, C> {
7345 ModelPatchCall {
7346 hub: self.hub,
7347 _request: request,
7348 _project_id: project_id.to_string(),
7349 _dataset_id: dataset_id.to_string(),
7350 _model_id: model_id.to_string(),
7351 _delegate: Default::default(),
7352 _additional_params: Default::default(),
7353 _scopes: Default::default(),
7354 }
7355 }
7356}
7357
7358/// A builder providing access to all methods supported on *project* resources.
7359/// It is not used directly, but through the [`Bigquery`] hub.
7360///
7361/// # Example
7362///
7363/// Instantiate a resource builder
7364///
7365/// ```test_harness,no_run
7366/// extern crate hyper;
7367/// extern crate hyper_rustls;
7368/// extern crate google_bigquery2 as bigquery2;
7369///
7370/// # async fn dox() {
7371/// use bigquery2::{Bigquery, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7372///
7373/// let secret: yup_oauth2::ApplicationSecret = Default::default();
7374/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
7375/// .with_native_roots()
7376/// .unwrap()
7377/// .https_only()
7378/// .enable_http2()
7379/// .build();
7380///
7381/// let executor = hyper_util::rt::TokioExecutor::new();
7382/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
7383/// secret,
7384/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7385/// yup_oauth2::client::CustomHyperClientBuilder::from(
7386/// hyper_util::client::legacy::Client::builder(executor).build(connector),
7387/// ),
7388/// ).build().await.unwrap();
7389///
7390/// let client = hyper_util::client::legacy::Client::builder(
7391/// hyper_util::rt::TokioExecutor::new()
7392/// )
7393/// .build(
7394/// hyper_rustls::HttpsConnectorBuilder::new()
7395/// .with_native_roots()
7396/// .unwrap()
7397/// .https_or_http()
7398/// .enable_http2()
7399/// .build()
7400/// );
7401/// let mut hub = Bigquery::new(client, auth);
7402/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
7403/// // like `get_service_account(...)` and `list(...)`
7404/// // to build up your call.
7405/// let rb = hub.projects();
7406/// # }
7407/// ```
7408pub struct ProjectMethods<'a, C>
7409where
7410 C: 'a,
7411{
7412 hub: &'a Bigquery<C>,
7413}
7414
7415impl<'a, C> common::MethodsBuilder for ProjectMethods<'a, C> {}
7416
7417impl<'a, C> ProjectMethods<'a, C> {
7418 /// Create a builder to help you perform the following task:
7419 ///
7420 /// RPC to get the service account for a project used for interactions with Google Cloud KMS
7421 ///
7422 /// # Arguments
7423 ///
7424 /// * `projectId` - Required. ID of the project.
7425 pub fn get_service_account(&self, project_id: &str) -> ProjectGetServiceAccountCall<'a, C> {
7426 ProjectGetServiceAccountCall {
7427 hub: self.hub,
7428 _project_id: project_id.to_string(),
7429 _delegate: Default::default(),
7430 _additional_params: Default::default(),
7431 _scopes: Default::default(),
7432 }
7433 }
7434
7435 /// Create a builder to help you perform the following task:
7436 ///
7437 /// RPC to list projects to which the user has been granted any project role. Users of this method are encouraged to consider the [Resource Manager](https://cloud.google.com/resource-manager/docs/) API, which provides the underlying data for this method and has more capabilities.
7438 pub fn list(&self) -> ProjectListCall<'a, C> {
7439 ProjectListCall {
7440 hub: self.hub,
7441 _page_token: Default::default(),
7442 _max_results: Default::default(),
7443 _delegate: Default::default(),
7444 _additional_params: Default::default(),
7445 _scopes: Default::default(),
7446 }
7447 }
7448}
7449
7450/// A builder providing access to all methods supported on *routine* resources.
7451/// It is not used directly, but through the [`Bigquery`] hub.
7452///
7453/// # Example
7454///
7455/// Instantiate a resource builder
7456///
7457/// ```test_harness,no_run
7458/// extern crate hyper;
7459/// extern crate hyper_rustls;
7460/// extern crate google_bigquery2 as bigquery2;
7461///
7462/// # async fn dox() {
7463/// use bigquery2::{Bigquery, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7464///
7465/// let secret: yup_oauth2::ApplicationSecret = Default::default();
7466/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
7467/// .with_native_roots()
7468/// .unwrap()
7469/// .https_only()
7470/// .enable_http2()
7471/// .build();
7472///
7473/// let executor = hyper_util::rt::TokioExecutor::new();
7474/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
7475/// secret,
7476/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7477/// yup_oauth2::client::CustomHyperClientBuilder::from(
7478/// hyper_util::client::legacy::Client::builder(executor).build(connector),
7479/// ),
7480/// ).build().await.unwrap();
7481///
7482/// let client = hyper_util::client::legacy::Client::builder(
7483/// hyper_util::rt::TokioExecutor::new()
7484/// )
7485/// .build(
7486/// hyper_rustls::HttpsConnectorBuilder::new()
7487/// .with_native_roots()
7488/// .unwrap()
7489/// .https_or_http()
7490/// .enable_http2()
7491/// .build()
7492/// );
7493/// let mut hub = Bigquery::new(client, auth);
7494/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
7495/// // like `delete(...)`, `get(...)`, `get_iam_policy(...)`, `insert(...)`, `list(...)`, `set_iam_policy(...)`, `test_iam_permissions(...)` and `update(...)`
7496/// // to build up your call.
7497/// let rb = hub.routines();
7498/// # }
7499/// ```
7500pub struct RoutineMethods<'a, C>
7501where
7502 C: 'a,
7503{
7504 hub: &'a Bigquery<C>,
7505}
7506
7507impl<'a, C> common::MethodsBuilder for RoutineMethods<'a, C> {}
7508
7509impl<'a, C> RoutineMethods<'a, C> {
7510 /// Create a builder to help you perform the following task:
7511 ///
7512 /// Deletes the routine specified by routineId from the dataset.
7513 ///
7514 /// # Arguments
7515 ///
7516 /// * `projectId` - Required. Project ID of the routine to delete
7517 /// * `datasetId` - Required. Dataset ID of the routine to delete
7518 /// * `routineId` - Required. Routine ID of the routine to delete
7519 pub fn delete(
7520 &self,
7521 project_id: &str,
7522 dataset_id: &str,
7523 routine_id: &str,
7524 ) -> RoutineDeleteCall<'a, C> {
7525 RoutineDeleteCall {
7526 hub: self.hub,
7527 _project_id: project_id.to_string(),
7528 _dataset_id: dataset_id.to_string(),
7529 _routine_id: routine_id.to_string(),
7530 _delegate: Default::default(),
7531 _additional_params: Default::default(),
7532 _scopes: Default::default(),
7533 }
7534 }
7535
7536 /// Create a builder to help you perform the following task:
7537 ///
7538 /// Gets the specified routine resource by routine ID.
7539 ///
7540 /// # Arguments
7541 ///
7542 /// * `projectId` - Required. Project ID of the requested routine
7543 /// * `datasetId` - Required. Dataset ID of the requested routine
7544 /// * `routineId` - Required. Routine ID of the requested routine
7545 pub fn get(
7546 &self,
7547 project_id: &str,
7548 dataset_id: &str,
7549 routine_id: &str,
7550 ) -> RoutineGetCall<'a, C> {
7551 RoutineGetCall {
7552 hub: self.hub,
7553 _project_id: project_id.to_string(),
7554 _dataset_id: dataset_id.to_string(),
7555 _routine_id: routine_id.to_string(),
7556 _read_mask: Default::default(),
7557 _delegate: Default::default(),
7558 _additional_params: Default::default(),
7559 _scopes: Default::default(),
7560 }
7561 }
7562
7563 /// Create a builder to help you perform the following task:
7564 ///
7565 /// Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.
7566 ///
7567 /// # Arguments
7568 ///
7569 /// * `request` - No description provided.
7570 /// * `resource` - REQUIRED: The resource for which the policy is being requested. See [Resource names](https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
7571 pub fn get_iam_policy(
7572 &self,
7573 request: GetIamPolicyRequest,
7574 resource: &str,
7575 ) -> RoutineGetIamPolicyCall<'a, C> {
7576 RoutineGetIamPolicyCall {
7577 hub: self.hub,
7578 _request: request,
7579 _resource: resource.to_string(),
7580 _delegate: Default::default(),
7581 _additional_params: Default::default(),
7582 _scopes: Default::default(),
7583 }
7584 }
7585
7586 /// Create a builder to help you perform the following task:
7587 ///
7588 /// Creates a new routine in the dataset.
7589 ///
7590 /// # Arguments
7591 ///
7592 /// * `request` - No description provided.
7593 /// * `projectId` - Required. Project ID of the new routine
7594 /// * `datasetId` - Required. Dataset ID of the new routine
7595 pub fn insert(
7596 &self,
7597 request: Routine,
7598 project_id: &str,
7599 dataset_id: &str,
7600 ) -> RoutineInsertCall<'a, C> {
7601 RoutineInsertCall {
7602 hub: self.hub,
7603 _request: request,
7604 _project_id: project_id.to_string(),
7605 _dataset_id: dataset_id.to_string(),
7606 _delegate: Default::default(),
7607 _additional_params: Default::default(),
7608 _scopes: Default::default(),
7609 }
7610 }
7611
7612 /// Create a builder to help you perform the following task:
7613 ///
7614 /// Lists all routines in the specified dataset. Requires the READER dataset role.
7615 ///
7616 /// # Arguments
7617 ///
7618 /// * `projectId` - Required. Project ID of the routines to list
7619 /// * `datasetId` - Required. Dataset ID of the routines to list
7620 pub fn list(&self, project_id: &str, dataset_id: &str) -> RoutineListCall<'a, C> {
7621 RoutineListCall {
7622 hub: self.hub,
7623 _project_id: project_id.to_string(),
7624 _dataset_id: dataset_id.to_string(),
7625 _read_mask: Default::default(),
7626 _page_token: Default::default(),
7627 _max_results: Default::default(),
7628 _filter: Default::default(),
7629 _delegate: Default::default(),
7630 _additional_params: Default::default(),
7631 _scopes: Default::default(),
7632 }
7633 }
7634
7635 /// Create a builder to help you perform the following task:
7636 ///
7637 /// Sets the access control policy on the specified resource. Replaces any existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` errors.
7638 ///
7639 /// # Arguments
7640 ///
7641 /// * `request` - No description provided.
7642 /// * `resource` - REQUIRED: The resource for which the policy is being specified. See [Resource names](https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
7643 pub fn set_iam_policy(
7644 &self,
7645 request: SetIamPolicyRequest,
7646 resource: &str,
7647 ) -> RoutineSetIamPolicyCall<'a, C> {
7648 RoutineSetIamPolicyCall {
7649 hub: self.hub,
7650 _request: request,
7651 _resource: resource.to_string(),
7652 _delegate: Default::default(),
7653 _additional_params: Default::default(),
7654 _scopes: Default::default(),
7655 }
7656 }
7657
7658 /// Create a builder to help you perform the following task:
7659 ///
7660 /// Returns permissions that a caller has on the specified resource. If the resource does not exist, this will return an empty set of permissions, not a `NOT_FOUND` error. Note: This operation is designed to be used for building permission-aware UIs and command-line tools, not for authorization checking. This operation may "fail open" without warning.
7661 ///
7662 /// # Arguments
7663 ///
7664 /// * `request` - No description provided.
7665 /// * `resource` - REQUIRED: The resource for which the policy detail is being requested. See [Resource names](https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
7666 pub fn test_iam_permissions(
7667 &self,
7668 request: TestIamPermissionsRequest,
7669 resource: &str,
7670 ) -> RoutineTestIamPermissionCall<'a, C> {
7671 RoutineTestIamPermissionCall {
7672 hub: self.hub,
7673 _request: request,
7674 _resource: resource.to_string(),
7675 _delegate: Default::default(),
7676 _additional_params: Default::default(),
7677 _scopes: Default::default(),
7678 }
7679 }
7680
7681 /// Create a builder to help you perform the following task:
7682 ///
7683 /// Updates information in an existing routine. The update method replaces the entire Routine resource.
7684 ///
7685 /// # Arguments
7686 ///
7687 /// * `request` - No description provided.
7688 /// * `projectId` - Required. Project ID of the routine to update
7689 /// * `datasetId` - Required. Dataset ID of the routine to update
7690 /// * `routineId` - Required. Routine ID of the routine to update
7691 pub fn update(
7692 &self,
7693 request: Routine,
7694 project_id: &str,
7695 dataset_id: &str,
7696 routine_id: &str,
7697 ) -> RoutineUpdateCall<'a, C> {
7698 RoutineUpdateCall {
7699 hub: self.hub,
7700 _request: request,
7701 _project_id: project_id.to_string(),
7702 _dataset_id: dataset_id.to_string(),
7703 _routine_id: routine_id.to_string(),
7704 _delegate: Default::default(),
7705 _additional_params: Default::default(),
7706 _scopes: Default::default(),
7707 }
7708 }
7709}
7710
7711/// A builder providing access to all methods supported on *rowAccessPolicy* resources.
7712/// It is not used directly, but through the [`Bigquery`] hub.
7713///
7714/// # Example
7715///
7716/// Instantiate a resource builder
7717///
7718/// ```test_harness,no_run
7719/// extern crate hyper;
7720/// extern crate hyper_rustls;
7721/// extern crate google_bigquery2 as bigquery2;
7722///
7723/// # async fn dox() {
7724/// use bigquery2::{Bigquery, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7725///
7726/// let secret: yup_oauth2::ApplicationSecret = Default::default();
7727/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
7728/// .with_native_roots()
7729/// .unwrap()
7730/// .https_only()
7731/// .enable_http2()
7732/// .build();
7733///
7734/// let executor = hyper_util::rt::TokioExecutor::new();
7735/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
7736/// secret,
7737/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7738/// yup_oauth2::client::CustomHyperClientBuilder::from(
7739/// hyper_util::client::legacy::Client::builder(executor).build(connector),
7740/// ),
7741/// ).build().await.unwrap();
7742///
7743/// let client = hyper_util::client::legacy::Client::builder(
7744/// hyper_util::rt::TokioExecutor::new()
7745/// )
7746/// .build(
7747/// hyper_rustls::HttpsConnectorBuilder::new()
7748/// .with_native_roots()
7749/// .unwrap()
7750/// .https_or_http()
7751/// .enable_http2()
7752/// .build()
7753/// );
7754/// let mut hub = Bigquery::new(client, auth);
7755/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
7756/// // like `batch_delete(...)`, `delete(...)`, `get(...)`, `get_iam_policy(...)`, `insert(...)`, `list(...)`, `test_iam_permissions(...)` and `update(...)`
7757/// // to build up your call.
7758/// let rb = hub.row_access_policies();
7759/// # }
7760/// ```
7761pub struct RowAccessPolicyMethods<'a, C>
7762where
7763 C: 'a,
7764{
7765 hub: &'a Bigquery<C>,
7766}
7767
7768impl<'a, C> common::MethodsBuilder for RowAccessPolicyMethods<'a, C> {}
7769
7770impl<'a, C> RowAccessPolicyMethods<'a, C> {
7771 /// Create a builder to help you perform the following task:
7772 ///
7773 /// Deletes provided row access policies.
7774 ///
7775 /// # Arguments
7776 ///
7777 /// * `request` - No description provided.
7778 /// * `projectId` - Required. Project ID of the table to delete the row access policies.
7779 /// * `datasetId` - Required. Dataset ID of the table to delete the row access policies.
7780 /// * `tableId` - Required. Table ID of the table to delete the row access policies.
7781 pub fn batch_delete(
7782 &self,
7783 request: BatchDeleteRowAccessPoliciesRequest,
7784 project_id: &str,
7785 dataset_id: &str,
7786 table_id: &str,
7787 ) -> RowAccessPolicyBatchDeleteCall<'a, C> {
7788 RowAccessPolicyBatchDeleteCall {
7789 hub: self.hub,
7790 _request: request,
7791 _project_id: project_id.to_string(),
7792 _dataset_id: dataset_id.to_string(),
7793 _table_id: table_id.to_string(),
7794 _delegate: Default::default(),
7795 _additional_params: Default::default(),
7796 _scopes: Default::default(),
7797 }
7798 }
7799
7800 /// Create a builder to help you perform the following task:
7801 ///
7802 /// Deletes a row access policy.
7803 ///
7804 /// # Arguments
7805 ///
7806 /// * `projectId` - Required. Project ID of the table to delete the row access policy.
7807 /// * `datasetId` - Required. Dataset ID of the table to delete the row access policy.
7808 /// * `tableId` - Required. Table ID of the table to delete the row access policy.
7809 /// * `policyId` - Required. Policy ID of the row access policy.
7810 pub fn delete(
7811 &self,
7812 project_id: &str,
7813 dataset_id: &str,
7814 table_id: &str,
7815 policy_id: &str,
7816 ) -> RowAccessPolicyDeleteCall<'a, C> {
7817 RowAccessPolicyDeleteCall {
7818 hub: self.hub,
7819 _project_id: project_id.to_string(),
7820 _dataset_id: dataset_id.to_string(),
7821 _table_id: table_id.to_string(),
7822 _policy_id: policy_id.to_string(),
7823 _force: Default::default(),
7824 _delegate: Default::default(),
7825 _additional_params: Default::default(),
7826 _scopes: Default::default(),
7827 }
7828 }
7829
7830 /// Create a builder to help you perform the following task:
7831 ///
7832 /// Gets the specified row access policy by policy ID.
7833 ///
7834 /// # Arguments
7835 ///
7836 /// * `projectId` - Required. Project ID of the table to get the row access policy.
7837 /// * `datasetId` - Required. Dataset ID of the table to get the row access policy.
7838 /// * `tableId` - Required. Table ID of the table to get the row access policy.
7839 /// * `policyId` - Required. Policy ID of the row access policy.
7840 pub fn get(
7841 &self,
7842 project_id: &str,
7843 dataset_id: &str,
7844 table_id: &str,
7845 policy_id: &str,
7846 ) -> RowAccessPolicyGetCall<'a, C> {
7847 RowAccessPolicyGetCall {
7848 hub: self.hub,
7849 _project_id: project_id.to_string(),
7850 _dataset_id: dataset_id.to_string(),
7851 _table_id: table_id.to_string(),
7852 _policy_id: policy_id.to_string(),
7853 _delegate: Default::default(),
7854 _additional_params: Default::default(),
7855 _scopes: Default::default(),
7856 }
7857 }
7858
7859 /// Create a builder to help you perform the following task:
7860 ///
7861 /// Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.
7862 ///
7863 /// # Arguments
7864 ///
7865 /// * `request` - No description provided.
7866 /// * `resource` - REQUIRED: The resource for which the policy is being requested. See [Resource names](https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
7867 pub fn get_iam_policy(
7868 &self,
7869 request: GetIamPolicyRequest,
7870 resource: &str,
7871 ) -> RowAccessPolicyGetIamPolicyCall<'a, C> {
7872 RowAccessPolicyGetIamPolicyCall {
7873 hub: self.hub,
7874 _request: request,
7875 _resource: resource.to_string(),
7876 _delegate: Default::default(),
7877 _additional_params: Default::default(),
7878 _scopes: Default::default(),
7879 }
7880 }
7881
7882 /// Create a builder to help you perform the following task:
7883 ///
7884 /// Creates a row access policy.
7885 ///
7886 /// # Arguments
7887 ///
7888 /// * `request` - No description provided.
7889 /// * `projectId` - Required. Project ID of the table to get the row access policy.
7890 /// * `datasetId` - Required. Dataset ID of the table to get the row access policy.
7891 /// * `tableId` - Required. Table ID of the table to get the row access policy.
7892 pub fn insert(
7893 &self,
7894 request: RowAccessPolicy,
7895 project_id: &str,
7896 dataset_id: &str,
7897 table_id: &str,
7898 ) -> RowAccessPolicyInsertCall<'a, C> {
7899 RowAccessPolicyInsertCall {
7900 hub: self.hub,
7901 _request: request,
7902 _project_id: project_id.to_string(),
7903 _dataset_id: dataset_id.to_string(),
7904 _table_id: table_id.to_string(),
7905 _delegate: Default::default(),
7906 _additional_params: Default::default(),
7907 _scopes: Default::default(),
7908 }
7909 }
7910
7911 /// Create a builder to help you perform the following task:
7912 ///
7913 /// Lists all row access policies on the specified table.
7914 ///
7915 /// # Arguments
7916 ///
7917 /// * `projectId` - Required. Project ID of the row access policies to list.
7918 /// * `datasetId` - Required. Dataset ID of row access policies to list.
7919 /// * `tableId` - Required. Table ID of the table to list row access policies.
7920 pub fn list(
7921 &self,
7922 project_id: &str,
7923 dataset_id: &str,
7924 table_id: &str,
7925 ) -> RowAccessPolicyListCall<'a, C> {
7926 RowAccessPolicyListCall {
7927 hub: self.hub,
7928 _project_id: project_id.to_string(),
7929 _dataset_id: dataset_id.to_string(),
7930 _table_id: table_id.to_string(),
7931 _page_token: Default::default(),
7932 _page_size: Default::default(),
7933 _delegate: Default::default(),
7934 _additional_params: Default::default(),
7935 _scopes: Default::default(),
7936 }
7937 }
7938
7939 /// Create a builder to help you perform the following task:
7940 ///
7941 /// Returns permissions that a caller has on the specified resource. If the resource does not exist, this will return an empty set of permissions, not a `NOT_FOUND` error. Note: This operation is designed to be used for building permission-aware UIs and command-line tools, not for authorization checking. This operation may "fail open" without warning.
7942 ///
7943 /// # Arguments
7944 ///
7945 /// * `request` - No description provided.
7946 /// * `resource` - REQUIRED: The resource for which the policy detail is being requested. See [Resource names](https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
7947 pub fn test_iam_permissions(
7948 &self,
7949 request: TestIamPermissionsRequest,
7950 resource: &str,
7951 ) -> RowAccessPolicyTestIamPermissionCall<'a, C> {
7952 RowAccessPolicyTestIamPermissionCall {
7953 hub: self.hub,
7954 _request: request,
7955 _resource: resource.to_string(),
7956 _delegate: Default::default(),
7957 _additional_params: Default::default(),
7958 _scopes: Default::default(),
7959 }
7960 }
7961
7962 /// Create a builder to help you perform the following task:
7963 ///
7964 /// Updates a row access policy.
7965 ///
7966 /// # Arguments
7967 ///
7968 /// * `request` - No description provided.
7969 /// * `projectId` - Required. Project ID of the table to get the row access policy.
7970 /// * `datasetId` - Required. Dataset ID of the table to get the row access policy.
7971 /// * `tableId` - Required. Table ID of the table to get the row access policy.
7972 /// * `policyId` - Required. Policy ID of the row access policy.
7973 pub fn update(
7974 &self,
7975 request: RowAccessPolicy,
7976 project_id: &str,
7977 dataset_id: &str,
7978 table_id: &str,
7979 policy_id: &str,
7980 ) -> RowAccessPolicyUpdateCall<'a, C> {
7981 RowAccessPolicyUpdateCall {
7982 hub: self.hub,
7983 _request: request,
7984 _project_id: project_id.to_string(),
7985 _dataset_id: dataset_id.to_string(),
7986 _table_id: table_id.to_string(),
7987 _policy_id: policy_id.to_string(),
7988 _delegate: Default::default(),
7989 _additional_params: Default::default(),
7990 _scopes: Default::default(),
7991 }
7992 }
7993}
7994
7995/// A builder providing access to all methods supported on *tabledata* resources.
7996/// It is not used directly, but through the [`Bigquery`] hub.
7997///
7998/// # Example
7999///
8000/// Instantiate a resource builder
8001///
8002/// ```test_harness,no_run
8003/// extern crate hyper;
8004/// extern crate hyper_rustls;
8005/// extern crate google_bigquery2 as bigquery2;
8006///
8007/// # async fn dox() {
8008/// use bigquery2::{Bigquery, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8009///
8010/// let secret: yup_oauth2::ApplicationSecret = Default::default();
8011/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
8012/// .with_native_roots()
8013/// .unwrap()
8014/// .https_only()
8015/// .enable_http2()
8016/// .build();
8017///
8018/// let executor = hyper_util::rt::TokioExecutor::new();
8019/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
8020/// secret,
8021/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8022/// yup_oauth2::client::CustomHyperClientBuilder::from(
8023/// hyper_util::client::legacy::Client::builder(executor).build(connector),
8024/// ),
8025/// ).build().await.unwrap();
8026///
8027/// let client = hyper_util::client::legacy::Client::builder(
8028/// hyper_util::rt::TokioExecutor::new()
8029/// )
8030/// .build(
8031/// hyper_rustls::HttpsConnectorBuilder::new()
8032/// .with_native_roots()
8033/// .unwrap()
8034/// .https_or_http()
8035/// .enable_http2()
8036/// .build()
8037/// );
8038/// let mut hub = Bigquery::new(client, auth);
8039/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
8040/// // like `insert_all(...)` and `list(...)`
8041/// // to build up your call.
8042/// let rb = hub.tabledata();
8043/// # }
8044/// ```
8045pub struct TabledataMethods<'a, C>
8046where
8047 C: 'a,
8048{
8049 hub: &'a Bigquery<C>,
8050}
8051
8052impl<'a, C> common::MethodsBuilder for TabledataMethods<'a, C> {}
8053
8054impl<'a, C> TabledataMethods<'a, C> {
8055 /// Create a builder to help you perform the following task:
8056 ///
8057 /// Streams data into BigQuery one record at a time without needing to run a load job.
8058 ///
8059 /// # Arguments
8060 ///
8061 /// * `request` - No description provided.
8062 /// * `projectId` - Required. Project ID of the destination.
8063 /// * `datasetId` - Required. Dataset ID of the destination.
8064 /// * `tableId` - Required. Table ID of the destination.
8065 pub fn insert_all(
8066 &self,
8067 request: TableDataInsertAllRequest,
8068 project_id: &str,
8069 dataset_id: &str,
8070 table_id: &str,
8071 ) -> TabledataInsertAllCall<'a, C> {
8072 TabledataInsertAllCall {
8073 hub: self.hub,
8074 _request: request,
8075 _project_id: project_id.to_string(),
8076 _dataset_id: dataset_id.to_string(),
8077 _table_id: table_id.to_string(),
8078 _delegate: Default::default(),
8079 _additional_params: Default::default(),
8080 _scopes: Default::default(),
8081 }
8082 }
8083
8084 /// Create a builder to help you perform the following task:
8085 ///
8086 /// List the content of a table in rows.
8087 ///
8088 /// # Arguments
8089 ///
8090 /// * `projectId` - Required. Project id of the table to list.
8091 /// * `datasetId` - Required. Dataset id of the table to list.
8092 /// * `tableId` - Required. Table id of the table to list.
8093 pub fn list(
8094 &self,
8095 project_id: &str,
8096 dataset_id: &str,
8097 table_id: &str,
8098 ) -> TabledataListCall<'a, C> {
8099 TabledataListCall {
8100 hub: self.hub,
8101 _project_id: project_id.to_string(),
8102 _dataset_id: dataset_id.to_string(),
8103 _table_id: table_id.to_string(),
8104 _start_index: Default::default(),
8105 _selected_fields: Default::default(),
8106 _page_token: Default::default(),
8107 _max_results: Default::default(),
8108 _format_options_use_int64_timestamp: Default::default(),
8109 _format_options_timestamp_output_format: Default::default(),
8110 _delegate: Default::default(),
8111 _additional_params: Default::default(),
8112 _scopes: Default::default(),
8113 }
8114 }
8115}
8116
8117/// A builder providing access to all methods supported on *table* resources.
8118/// It is not used directly, but through the [`Bigquery`] hub.
8119///
8120/// # Example
8121///
8122/// Instantiate a resource builder
8123///
8124/// ```test_harness,no_run
8125/// extern crate hyper;
8126/// extern crate hyper_rustls;
8127/// extern crate google_bigquery2 as bigquery2;
8128///
8129/// # async fn dox() {
8130/// use bigquery2::{Bigquery, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8131///
8132/// let secret: yup_oauth2::ApplicationSecret = Default::default();
8133/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
8134/// .with_native_roots()
8135/// .unwrap()
8136/// .https_only()
8137/// .enable_http2()
8138/// .build();
8139///
8140/// let executor = hyper_util::rt::TokioExecutor::new();
8141/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
8142/// secret,
8143/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8144/// yup_oauth2::client::CustomHyperClientBuilder::from(
8145/// hyper_util::client::legacy::Client::builder(executor).build(connector),
8146/// ),
8147/// ).build().await.unwrap();
8148///
8149/// let client = hyper_util::client::legacy::Client::builder(
8150/// hyper_util::rt::TokioExecutor::new()
8151/// )
8152/// .build(
8153/// hyper_rustls::HttpsConnectorBuilder::new()
8154/// .with_native_roots()
8155/// .unwrap()
8156/// .https_or_http()
8157/// .enable_http2()
8158/// .build()
8159/// );
8160/// let mut hub = Bigquery::new(client, auth);
8161/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
8162/// // like `delete(...)`, `get(...)`, `get_iam_policy(...)`, `insert(...)`, `list(...)`, `patch(...)`, `set_iam_policy(...)`, `test_iam_permissions(...)` and `update(...)`
8163/// // to build up your call.
8164/// let rb = hub.tables();
8165/// # }
8166/// ```
8167pub struct TableMethods<'a, C>
8168where
8169 C: 'a,
8170{
8171 hub: &'a Bigquery<C>,
8172}
8173
8174impl<'a, C> common::MethodsBuilder for TableMethods<'a, C> {}
8175
8176impl<'a, C> TableMethods<'a, C> {
8177 /// Create a builder to help you perform the following task:
8178 ///
8179 /// Deletes the table specified by tableId from the dataset. If the table contains data, all the data will be deleted.
8180 ///
8181 /// # Arguments
8182 ///
8183 /// * `projectId` - Required. Project ID of the table to delete
8184 /// * `datasetId` - Required. Dataset ID of the table to delete
8185 /// * `tableId` - Required. Table ID of the table to delete
8186 pub fn delete(
8187 &self,
8188 project_id: &str,
8189 dataset_id: &str,
8190 table_id: &str,
8191 ) -> TableDeleteCall<'a, C> {
8192 TableDeleteCall {
8193 hub: self.hub,
8194 _project_id: project_id.to_string(),
8195 _dataset_id: dataset_id.to_string(),
8196 _table_id: table_id.to_string(),
8197 _delegate: Default::default(),
8198 _additional_params: Default::default(),
8199 _scopes: Default::default(),
8200 }
8201 }
8202
8203 /// Create a builder to help you perform the following task:
8204 ///
8205 /// Gets the specified table resource by table ID. This method does not return the data in the table, it only returns the table resource, which describes the structure of this table.
8206 ///
8207 /// # Arguments
8208 ///
8209 /// * `projectId` - Required. Project ID of the requested table
8210 /// * `datasetId` - Required. Dataset ID of the requested table
8211 /// * `tableId` - Required. Table ID of the requested table
8212 pub fn get(&self, project_id: &str, dataset_id: &str, table_id: &str) -> TableGetCall<'a, C> {
8213 TableGetCall {
8214 hub: self.hub,
8215 _project_id: project_id.to_string(),
8216 _dataset_id: dataset_id.to_string(),
8217 _table_id: table_id.to_string(),
8218 _view: Default::default(),
8219 _selected_fields: Default::default(),
8220 _delegate: Default::default(),
8221 _additional_params: Default::default(),
8222 _scopes: Default::default(),
8223 }
8224 }
8225
8226 /// Create a builder to help you perform the following task:
8227 ///
8228 /// Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.
8229 ///
8230 /// # Arguments
8231 ///
8232 /// * `request` - No description provided.
8233 /// * `resource` - REQUIRED: The resource for which the policy is being requested. See [Resource names](https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
8234 pub fn get_iam_policy(
8235 &self,
8236 request: GetIamPolicyRequest,
8237 resource: &str,
8238 ) -> TableGetIamPolicyCall<'a, C> {
8239 TableGetIamPolicyCall {
8240 hub: self.hub,
8241 _request: request,
8242 _resource: resource.to_string(),
8243 _delegate: Default::default(),
8244 _additional_params: Default::default(),
8245 _scopes: Default::default(),
8246 }
8247 }
8248
8249 /// Create a builder to help you perform the following task:
8250 ///
8251 /// Creates a new, empty table in the dataset.
8252 ///
8253 /// # Arguments
8254 ///
8255 /// * `request` - No description provided.
8256 /// * `projectId` - Required. Project ID of the new table
8257 /// * `datasetId` - Required. Dataset ID of the new table
8258 pub fn insert(
8259 &self,
8260 request: Table,
8261 project_id: &str,
8262 dataset_id: &str,
8263 ) -> TableInsertCall<'a, C> {
8264 TableInsertCall {
8265 hub: self.hub,
8266 _request: request,
8267 _project_id: project_id.to_string(),
8268 _dataset_id: dataset_id.to_string(),
8269 _delegate: Default::default(),
8270 _additional_params: Default::default(),
8271 _scopes: Default::default(),
8272 }
8273 }
8274
8275 /// Create a builder to help you perform the following task:
8276 ///
8277 /// Lists all tables in the specified dataset. Requires the READER dataset role.
8278 ///
8279 /// # Arguments
8280 ///
8281 /// * `projectId` - Required. Project ID of the tables to list
8282 /// * `datasetId` - Required. Dataset ID of the tables to list
8283 pub fn list(&self, project_id: &str, dataset_id: &str) -> TableListCall<'a, C> {
8284 TableListCall {
8285 hub: self.hub,
8286 _project_id: project_id.to_string(),
8287 _dataset_id: dataset_id.to_string(),
8288 _page_token: Default::default(),
8289 _max_results: Default::default(),
8290 _delegate: Default::default(),
8291 _additional_params: Default::default(),
8292 _scopes: Default::default(),
8293 }
8294 }
8295
8296 /// Create a builder to help you perform the following task:
8297 ///
8298 /// Updates information in an existing table. The update method replaces the entire table resource, whereas the patch method only replaces fields that are provided in the submitted table resource. This method supports RFC5789 patch semantics.
8299 ///
8300 /// # Arguments
8301 ///
8302 /// * `request` - No description provided.
8303 /// * `projectId` - Required. Project ID of the table to update
8304 /// * `datasetId` - Required. Dataset ID of the table to update
8305 /// * `tableId` - Required. Table ID of the table to update
8306 pub fn patch(
8307 &self,
8308 request: Table,
8309 project_id: &str,
8310 dataset_id: &str,
8311 table_id: &str,
8312 ) -> TablePatchCall<'a, C> {
8313 TablePatchCall {
8314 hub: self.hub,
8315 _request: request,
8316 _project_id: project_id.to_string(),
8317 _dataset_id: dataset_id.to_string(),
8318 _table_id: table_id.to_string(),
8319 _autodetect_schema: Default::default(),
8320 _delegate: Default::default(),
8321 _additional_params: Default::default(),
8322 _scopes: Default::default(),
8323 }
8324 }
8325
8326 /// Create a builder to help you perform the following task:
8327 ///
8328 /// Sets the access control policy on the specified resource. Replaces any existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` errors.
8329 ///
8330 /// # Arguments
8331 ///
8332 /// * `request` - No description provided.
8333 /// * `resource` - REQUIRED: The resource for which the policy is being specified. See [Resource names](https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
8334 pub fn set_iam_policy(
8335 &self,
8336 request: SetIamPolicyRequest,
8337 resource: &str,
8338 ) -> TableSetIamPolicyCall<'a, C> {
8339 TableSetIamPolicyCall {
8340 hub: self.hub,
8341 _request: request,
8342 _resource: resource.to_string(),
8343 _delegate: Default::default(),
8344 _additional_params: Default::default(),
8345 _scopes: Default::default(),
8346 }
8347 }
8348
8349 /// Create a builder to help you perform the following task:
8350 ///
8351 /// Returns permissions that a caller has on the specified resource. If the resource does not exist, this will return an empty set of permissions, not a `NOT_FOUND` error. Note: This operation is designed to be used for building permission-aware UIs and command-line tools, not for authorization checking. This operation may "fail open" without warning.
8352 ///
8353 /// # Arguments
8354 ///
8355 /// * `request` - No description provided.
8356 /// * `resource` - REQUIRED: The resource for which the policy detail is being requested. See [Resource names](https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
8357 pub fn test_iam_permissions(
8358 &self,
8359 request: TestIamPermissionsRequest,
8360 resource: &str,
8361 ) -> TableTestIamPermissionCall<'a, C> {
8362 TableTestIamPermissionCall {
8363 hub: self.hub,
8364 _request: request,
8365 _resource: resource.to_string(),
8366 _delegate: Default::default(),
8367 _additional_params: Default::default(),
8368 _scopes: Default::default(),
8369 }
8370 }
8371
8372 /// Create a builder to help you perform the following task:
8373 ///
8374 /// Updates information in an existing table. The update method replaces the entire Table resource, whereas the patch method only replaces fields that are provided in the submitted Table resource.
8375 ///
8376 /// # Arguments
8377 ///
8378 /// * `request` - No description provided.
8379 /// * `projectId` - Required. Project ID of the table to update
8380 /// * `datasetId` - Required. Dataset ID of the table to update
8381 /// * `tableId` - Required. Table ID of the table to update
8382 pub fn update(
8383 &self,
8384 request: Table,
8385 project_id: &str,
8386 dataset_id: &str,
8387 table_id: &str,
8388 ) -> TableUpdateCall<'a, C> {
8389 TableUpdateCall {
8390 hub: self.hub,
8391 _request: request,
8392 _project_id: project_id.to_string(),
8393 _dataset_id: dataset_id.to_string(),
8394 _table_id: table_id.to_string(),
8395 _autodetect_schema: Default::default(),
8396 _delegate: Default::default(),
8397 _additional_params: Default::default(),
8398 _scopes: Default::default(),
8399 }
8400 }
8401}
8402
8403// ###################
8404// CallBuilders ###
8405// #################
8406
8407/// Deletes the dataset specified by the datasetId value. Before you can delete a dataset, you must delete all its tables, either manually or by specifying deleteContents. Immediately after deletion, you can create another dataset with the same name.
8408///
8409/// A builder for the *delete* method supported by a *dataset* resource.
8410/// It is not used directly, but through a [`DatasetMethods`] instance.
8411///
8412/// # Example
8413///
8414/// Instantiate a resource method builder
8415///
8416/// ```test_harness,no_run
8417/// # extern crate hyper;
8418/// # extern crate hyper_rustls;
8419/// # extern crate google_bigquery2 as bigquery2;
8420/// # async fn dox() {
8421/// # use bigquery2::{Bigquery, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8422///
8423/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
8424/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
8425/// # .with_native_roots()
8426/// # .unwrap()
8427/// # .https_only()
8428/// # .enable_http2()
8429/// # .build();
8430///
8431/// # let executor = hyper_util::rt::TokioExecutor::new();
8432/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
8433/// # secret,
8434/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8435/// # yup_oauth2::client::CustomHyperClientBuilder::from(
8436/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
8437/// # ),
8438/// # ).build().await.unwrap();
8439///
8440/// # let client = hyper_util::client::legacy::Client::builder(
8441/// # hyper_util::rt::TokioExecutor::new()
8442/// # )
8443/// # .build(
8444/// # hyper_rustls::HttpsConnectorBuilder::new()
8445/// # .with_native_roots()
8446/// # .unwrap()
8447/// # .https_or_http()
8448/// # .enable_http2()
8449/// # .build()
8450/// # );
8451/// # let mut hub = Bigquery::new(client, auth);
8452/// // You can configure optional parameters by calling the respective setters at will, and
8453/// // execute the final call using `doit()`.
8454/// // Values shown here are possibly random and not representative !
8455/// let result = hub.datasets().delete("projectId", "datasetId")
8456/// .delete_contents(true)
8457/// .doit().await;
8458/// # }
8459/// ```
8460pub struct DatasetDeleteCall<'a, C>
8461where
8462 C: 'a,
8463{
8464 hub: &'a Bigquery<C>,
8465 _project_id: String,
8466 _dataset_id: String,
8467 _delete_contents: Option<bool>,
8468 _delegate: Option<&'a mut dyn common::Delegate>,
8469 _additional_params: HashMap<String, String>,
8470 _scopes: BTreeSet<String>,
8471}
8472
8473impl<'a, C> common::CallBuilder for DatasetDeleteCall<'a, C> {}
8474
8475impl<'a, C> DatasetDeleteCall<'a, C>
8476where
8477 C: common::Connector,
8478{
8479 /// Perform the operation you have build so far.
8480 pub async fn doit(mut self) -> common::Result<common::Response> {
8481 use std::borrow::Cow;
8482 use std::io::{Read, Seek};
8483
8484 use common::{url::Params, ToParts};
8485 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
8486
8487 let mut dd = common::DefaultDelegate;
8488 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
8489 dlg.begin(common::MethodInfo {
8490 id: "bigquery.datasets.delete",
8491 http_method: hyper::Method::DELETE,
8492 });
8493
8494 for &field in ["projectId", "datasetId", "deleteContents"].iter() {
8495 if self._additional_params.contains_key(field) {
8496 dlg.finished(false);
8497 return Err(common::Error::FieldClash(field));
8498 }
8499 }
8500
8501 let mut params = Params::with_capacity(4 + self._additional_params.len());
8502 params.push("projectId", self._project_id);
8503 params.push("datasetId", self._dataset_id);
8504 if let Some(value) = self._delete_contents.as_ref() {
8505 params.push("deleteContents", value.to_string());
8506 }
8507
8508 params.extend(self._additional_params.iter());
8509
8510 let mut url = self.hub._base_url.clone() + "projects/{+projectId}/datasets/{+datasetId}";
8511 if self._scopes.is_empty() {
8512 self._scopes
8513 .insert(Scope::CloudPlatform.as_ref().to_string());
8514 }
8515
8516 #[allow(clippy::single_element_loop)]
8517 for &(find_this, param_name) in
8518 [("{+projectId}", "projectId"), ("{+datasetId}", "datasetId")].iter()
8519 {
8520 url = params.uri_replacement(url, param_name, find_this, true);
8521 }
8522 {
8523 let to_remove = ["datasetId", "projectId"];
8524 params.remove_params(&to_remove);
8525 }
8526
8527 let url = params.parse_with_url(&url);
8528
8529 loop {
8530 let token = match self
8531 .hub
8532 .auth
8533 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
8534 .await
8535 {
8536 Ok(token) => token,
8537 Err(e) => match dlg.token(e) {
8538 Ok(token) => token,
8539 Err(e) => {
8540 dlg.finished(false);
8541 return Err(common::Error::MissingToken(e));
8542 }
8543 },
8544 };
8545 let mut req_result = {
8546 let client = &self.hub.client;
8547 dlg.pre_request();
8548 let mut req_builder = hyper::Request::builder()
8549 .method(hyper::Method::DELETE)
8550 .uri(url.as_str())
8551 .header(USER_AGENT, self.hub._user_agent.clone());
8552
8553 if let Some(token) = token.as_ref() {
8554 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8555 }
8556
8557 let request = req_builder
8558 .header(CONTENT_LENGTH, 0_u64)
8559 .body(common::to_body::<String>(None));
8560
8561 client.request(request.unwrap()).await
8562 };
8563
8564 match req_result {
8565 Err(err) => {
8566 if let common::Retry::After(d) = dlg.http_error(&err) {
8567 sleep(d).await;
8568 continue;
8569 }
8570 dlg.finished(false);
8571 return Err(common::Error::HttpError(err));
8572 }
8573 Ok(res) => {
8574 let (mut parts, body) = res.into_parts();
8575 let mut body = common::Body::new(body);
8576 if !parts.status.is_success() {
8577 let bytes = common::to_bytes(body).await.unwrap_or_default();
8578 let error = serde_json::from_str(&common::to_string(&bytes));
8579 let response = common::to_response(parts, bytes.into());
8580
8581 if let common::Retry::After(d) =
8582 dlg.http_failure(&response, error.as_ref().ok())
8583 {
8584 sleep(d).await;
8585 continue;
8586 }
8587
8588 dlg.finished(false);
8589
8590 return Err(match error {
8591 Ok(value) => common::Error::BadRequest(value),
8592 _ => common::Error::Failure(response),
8593 });
8594 }
8595 let response = common::Response::from_parts(parts, body);
8596
8597 dlg.finished(true);
8598 return Ok(response);
8599 }
8600 }
8601 }
8602 }
8603
8604 /// Required. Project ID of the dataset being deleted
8605 ///
8606 /// Sets the *project id* path property to the given value.
8607 ///
8608 /// Even though the property as already been set when instantiating this call,
8609 /// we provide this method for API completeness.
8610 pub fn project_id(mut self, new_value: &str) -> DatasetDeleteCall<'a, C> {
8611 self._project_id = new_value.to_string();
8612 self
8613 }
8614 /// Required. Dataset ID of dataset being deleted
8615 ///
8616 /// Sets the *dataset id* path property to the given value.
8617 ///
8618 /// Even though the property as already been set when instantiating this call,
8619 /// we provide this method for API completeness.
8620 pub fn dataset_id(mut self, new_value: &str) -> DatasetDeleteCall<'a, C> {
8621 self._dataset_id = new_value.to_string();
8622 self
8623 }
8624 /// If True, delete all the tables in the dataset. If False and the dataset contains tables, the request will fail. Default is False
8625 ///
8626 /// Sets the *delete contents* query property to the given value.
8627 pub fn delete_contents(mut self, new_value: bool) -> DatasetDeleteCall<'a, C> {
8628 self._delete_contents = Some(new_value);
8629 self
8630 }
8631 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8632 /// while executing the actual API request.
8633 ///
8634 /// ````text
8635 /// It should be used to handle progress information, and to implement a certain level of resilience.
8636 /// ````
8637 ///
8638 /// Sets the *delegate* property to the given value.
8639 pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> DatasetDeleteCall<'a, C> {
8640 self._delegate = Some(new_value);
8641 self
8642 }
8643
8644 /// Set any additional parameter of the query string used in the request.
8645 /// It should be used to set parameters which are not yet available through their own
8646 /// setters.
8647 ///
8648 /// Please note that this method must not be used to set any of the known parameters
8649 /// which have their own setter method. If done anyway, the request will fail.
8650 ///
8651 /// # Additional Parameters
8652 ///
8653 /// * *$.xgafv* (query-string) - V1 error format.
8654 /// * *access_token* (query-string) - OAuth access token.
8655 /// * *alt* (query-string) - Data format for response.
8656 /// * *callback* (query-string) - JSONP
8657 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8658 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
8659 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8660 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8661 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
8662 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8663 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8664 pub fn param<T>(mut self, name: T, value: T) -> DatasetDeleteCall<'a, C>
8665 where
8666 T: AsRef<str>,
8667 {
8668 self._additional_params
8669 .insert(name.as_ref().to_string(), value.as_ref().to_string());
8670 self
8671 }
8672
8673 /// Identifies the authorization scope for the method you are building.
8674 ///
8675 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
8676 /// [`Scope::CloudPlatform`].
8677 ///
8678 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
8679 /// tokens for more than one scope.
8680 ///
8681 /// Usually there is more than one suitable scope to authorize an operation, some of which may
8682 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
8683 /// sufficient, a read-write scope will do as well.
8684 pub fn add_scope<St>(mut self, scope: St) -> DatasetDeleteCall<'a, C>
8685 where
8686 St: AsRef<str>,
8687 {
8688 self._scopes.insert(String::from(scope.as_ref()));
8689 self
8690 }
8691 /// Identifies the authorization scope(s) for the method you are building.
8692 ///
8693 /// See [`Self::add_scope()`] for details.
8694 pub fn add_scopes<I, St>(mut self, scopes: I) -> DatasetDeleteCall<'a, C>
8695 where
8696 I: IntoIterator<Item = St>,
8697 St: AsRef<str>,
8698 {
8699 self._scopes
8700 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
8701 self
8702 }
8703
8704 /// Removes all scopes, and no default scope will be used either.
8705 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
8706 /// for details).
8707 pub fn clear_scopes(mut self) -> DatasetDeleteCall<'a, C> {
8708 self._scopes.clear();
8709 self
8710 }
8711}
8712
8713/// Returns the dataset specified by datasetID.
8714///
8715/// A builder for the *get* method supported by a *dataset* resource.
8716/// It is not used directly, but through a [`DatasetMethods`] instance.
8717///
8718/// # Example
8719///
8720/// Instantiate a resource method builder
8721///
8722/// ```test_harness,no_run
8723/// # extern crate hyper;
8724/// # extern crate hyper_rustls;
8725/// # extern crate google_bigquery2 as bigquery2;
8726/// # async fn dox() {
8727/// # use bigquery2::{Bigquery, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8728///
8729/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
8730/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
8731/// # .with_native_roots()
8732/// # .unwrap()
8733/// # .https_only()
8734/// # .enable_http2()
8735/// # .build();
8736///
8737/// # let executor = hyper_util::rt::TokioExecutor::new();
8738/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
8739/// # secret,
8740/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8741/// # yup_oauth2::client::CustomHyperClientBuilder::from(
8742/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
8743/// # ),
8744/// # ).build().await.unwrap();
8745///
8746/// # let client = hyper_util::client::legacy::Client::builder(
8747/// # hyper_util::rt::TokioExecutor::new()
8748/// # )
8749/// # .build(
8750/// # hyper_rustls::HttpsConnectorBuilder::new()
8751/// # .with_native_roots()
8752/// # .unwrap()
8753/// # .https_or_http()
8754/// # .enable_http2()
8755/// # .build()
8756/// # );
8757/// # let mut hub = Bigquery::new(client, auth);
8758/// // You can configure optional parameters by calling the respective setters at will, and
8759/// // execute the final call using `doit()`.
8760/// // Values shown here are possibly random and not representative !
8761/// let result = hub.datasets().get("projectId", "datasetId")
8762/// .dataset_view("duo")
8763/// .access_policy_version(-50)
8764/// .doit().await;
8765/// # }
8766/// ```
8767pub struct DatasetGetCall<'a, C>
8768where
8769 C: 'a,
8770{
8771 hub: &'a Bigquery<C>,
8772 _project_id: String,
8773 _dataset_id: String,
8774 _dataset_view: Option<String>,
8775 _access_policy_version: Option<i32>,
8776 _delegate: Option<&'a mut dyn common::Delegate>,
8777 _additional_params: HashMap<String, String>,
8778 _scopes: BTreeSet<String>,
8779}
8780
8781impl<'a, C> common::CallBuilder for DatasetGetCall<'a, C> {}
8782
8783impl<'a, C> DatasetGetCall<'a, C>
8784where
8785 C: common::Connector,
8786{
8787 /// Perform the operation you have build so far.
8788 pub async fn doit(mut self) -> common::Result<(common::Response, Dataset)> {
8789 use std::borrow::Cow;
8790 use std::io::{Read, Seek};
8791
8792 use common::{url::Params, ToParts};
8793 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
8794
8795 let mut dd = common::DefaultDelegate;
8796 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
8797 dlg.begin(common::MethodInfo {
8798 id: "bigquery.datasets.get",
8799 http_method: hyper::Method::GET,
8800 });
8801
8802 for &field in [
8803 "alt",
8804 "projectId",
8805 "datasetId",
8806 "datasetView",
8807 "accessPolicyVersion",
8808 ]
8809 .iter()
8810 {
8811 if self._additional_params.contains_key(field) {
8812 dlg.finished(false);
8813 return Err(common::Error::FieldClash(field));
8814 }
8815 }
8816
8817 let mut params = Params::with_capacity(6 + self._additional_params.len());
8818 params.push("projectId", self._project_id);
8819 params.push("datasetId", self._dataset_id);
8820 if let Some(value) = self._dataset_view.as_ref() {
8821 params.push("datasetView", value);
8822 }
8823 if let Some(value) = self._access_policy_version.as_ref() {
8824 params.push("accessPolicyVersion", value.to_string());
8825 }
8826
8827 params.extend(self._additional_params.iter());
8828
8829 params.push("alt", "json");
8830 let mut url = self.hub._base_url.clone() + "projects/{+projectId}/datasets/{+datasetId}";
8831 if self._scopes.is_empty() {
8832 self._scopes
8833 .insert(Scope::CloudPlatformReadOnly.as_ref().to_string());
8834 }
8835
8836 #[allow(clippy::single_element_loop)]
8837 for &(find_this, param_name) in
8838 [("{+projectId}", "projectId"), ("{+datasetId}", "datasetId")].iter()
8839 {
8840 url = params.uri_replacement(url, param_name, find_this, true);
8841 }
8842 {
8843 let to_remove = ["datasetId", "projectId"];
8844 params.remove_params(&to_remove);
8845 }
8846
8847 let url = params.parse_with_url(&url);
8848
8849 loop {
8850 let token = match self
8851 .hub
8852 .auth
8853 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
8854 .await
8855 {
8856 Ok(token) => token,
8857 Err(e) => match dlg.token(e) {
8858 Ok(token) => token,
8859 Err(e) => {
8860 dlg.finished(false);
8861 return Err(common::Error::MissingToken(e));
8862 }
8863 },
8864 };
8865 let mut req_result = {
8866 let client = &self.hub.client;
8867 dlg.pre_request();
8868 let mut req_builder = hyper::Request::builder()
8869 .method(hyper::Method::GET)
8870 .uri(url.as_str())
8871 .header(USER_AGENT, self.hub._user_agent.clone());
8872
8873 if let Some(token) = token.as_ref() {
8874 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8875 }
8876
8877 let request = req_builder
8878 .header(CONTENT_LENGTH, 0_u64)
8879 .body(common::to_body::<String>(None));
8880
8881 client.request(request.unwrap()).await
8882 };
8883
8884 match req_result {
8885 Err(err) => {
8886 if let common::Retry::After(d) = dlg.http_error(&err) {
8887 sleep(d).await;
8888 continue;
8889 }
8890 dlg.finished(false);
8891 return Err(common::Error::HttpError(err));
8892 }
8893 Ok(res) => {
8894 let (mut parts, body) = res.into_parts();
8895 let mut body = common::Body::new(body);
8896 if !parts.status.is_success() {
8897 let bytes = common::to_bytes(body).await.unwrap_or_default();
8898 let error = serde_json::from_str(&common::to_string(&bytes));
8899 let response = common::to_response(parts, bytes.into());
8900
8901 if let common::Retry::After(d) =
8902 dlg.http_failure(&response, error.as_ref().ok())
8903 {
8904 sleep(d).await;
8905 continue;
8906 }
8907
8908 dlg.finished(false);
8909
8910 return Err(match error {
8911 Ok(value) => common::Error::BadRequest(value),
8912 _ => common::Error::Failure(response),
8913 });
8914 }
8915 let response = {
8916 let bytes = common::to_bytes(body).await.unwrap_or_default();
8917 let encoded = common::to_string(&bytes);
8918 match serde_json::from_str(&encoded) {
8919 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8920 Err(error) => {
8921 dlg.response_json_decode_error(&encoded, &error);
8922 return Err(common::Error::JsonDecodeError(
8923 encoded.to_string(),
8924 error,
8925 ));
8926 }
8927 }
8928 };
8929
8930 dlg.finished(true);
8931 return Ok(response);
8932 }
8933 }
8934 }
8935 }
8936
8937 /// Required. Project ID of the requested dataset
8938 ///
8939 /// Sets the *project id* path property to the given value.
8940 ///
8941 /// Even though the property as already been set when instantiating this call,
8942 /// we provide this method for API completeness.
8943 pub fn project_id(mut self, new_value: &str) -> DatasetGetCall<'a, C> {
8944 self._project_id = new_value.to_string();
8945 self
8946 }
8947 /// Required. Dataset ID of the requested dataset
8948 ///
8949 /// Sets the *dataset id* path property to the given value.
8950 ///
8951 /// Even though the property as already been set when instantiating this call,
8952 /// we provide this method for API completeness.
8953 pub fn dataset_id(mut self, new_value: &str) -> DatasetGetCall<'a, C> {
8954 self._dataset_id = new_value.to_string();
8955 self
8956 }
8957 /// Optional. Specifies the view that determines which dataset information is returned. By default, metadata and ACL information are returned.
8958 ///
8959 /// Sets the *dataset view* query property to the given value.
8960 pub fn dataset_view(mut self, new_value: &str) -> DatasetGetCall<'a, C> {
8961 self._dataset_view = Some(new_value.to_string());
8962 self
8963 }
8964 /// Optional. The version of the access policy schema to fetch. Valid values are 0, 1, and 3. Requests specifying an invalid value will be rejected. Requests for conditional access policy binding in datasets must specify version 3. Dataset with no conditional role bindings in access policy may specify any valid value or leave the field unset. This field will be mapped to [IAM Policy version] (https://cloud.google.com/iam/docs/policies#versions) and will be used to fetch policy from IAM. If unset or if 0 or 1 value is used for dataset with conditional bindings, access entry with condition will have role string appended by 'withcond' string followed by a hash value. For example : { "access": [ { "role": "roles/bigquery.dataViewer_with_conditionalbinding_7a34awqsda", "userByEmail": "user@example.com", } ] } Please refer https://cloud.google.com/iam/docs/troubleshooting-withcond for more details.
8965 ///
8966 /// Sets the *access policy version* query property to the given value.
8967 pub fn access_policy_version(mut self, new_value: i32) -> DatasetGetCall<'a, C> {
8968 self._access_policy_version = Some(new_value);
8969 self
8970 }
8971 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8972 /// while executing the actual API request.
8973 ///
8974 /// ````text
8975 /// It should be used to handle progress information, and to implement a certain level of resilience.
8976 /// ````
8977 ///
8978 /// Sets the *delegate* property to the given value.
8979 pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> DatasetGetCall<'a, C> {
8980 self._delegate = Some(new_value);
8981 self
8982 }
8983
8984 /// Set any additional parameter of the query string used in the request.
8985 /// It should be used to set parameters which are not yet available through their own
8986 /// setters.
8987 ///
8988 /// Please note that this method must not be used to set any of the known parameters
8989 /// which have their own setter method. If done anyway, the request will fail.
8990 ///
8991 /// # Additional Parameters
8992 ///
8993 /// * *$.xgafv* (query-string) - V1 error format.
8994 /// * *access_token* (query-string) - OAuth access token.
8995 /// * *alt* (query-string) - Data format for response.
8996 /// * *callback* (query-string) - JSONP
8997 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8998 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
8999 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
9000 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
9001 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
9002 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
9003 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
9004 pub fn param<T>(mut self, name: T, value: T) -> DatasetGetCall<'a, C>
9005 where
9006 T: AsRef<str>,
9007 {
9008 self._additional_params
9009 .insert(name.as_ref().to_string(), value.as_ref().to_string());
9010 self
9011 }
9012
9013 /// Identifies the authorization scope for the method you are building.
9014 ///
9015 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
9016 /// [`Scope::CloudPlatformReadOnly`].
9017 ///
9018 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
9019 /// tokens for more than one scope.
9020 ///
9021 /// Usually there is more than one suitable scope to authorize an operation, some of which may
9022 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
9023 /// sufficient, a read-write scope will do as well.
9024 pub fn add_scope<St>(mut self, scope: St) -> DatasetGetCall<'a, C>
9025 where
9026 St: AsRef<str>,
9027 {
9028 self._scopes.insert(String::from(scope.as_ref()));
9029 self
9030 }
9031 /// Identifies the authorization scope(s) for the method you are building.
9032 ///
9033 /// See [`Self::add_scope()`] for details.
9034 pub fn add_scopes<I, St>(mut self, scopes: I) -> DatasetGetCall<'a, C>
9035 where
9036 I: IntoIterator<Item = St>,
9037 St: AsRef<str>,
9038 {
9039 self._scopes
9040 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
9041 self
9042 }
9043
9044 /// Removes all scopes, and no default scope will be used either.
9045 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
9046 /// for details).
9047 pub fn clear_scopes(mut self) -> DatasetGetCall<'a, C> {
9048 self._scopes.clear();
9049 self
9050 }
9051}
9052
9053/// Creates a new empty dataset.
9054///
9055/// A builder for the *insert* method supported by a *dataset* resource.
9056/// It is not used directly, but through a [`DatasetMethods`] instance.
9057///
9058/// # Example
9059///
9060/// Instantiate a resource method builder
9061///
9062/// ```test_harness,no_run
9063/// # extern crate hyper;
9064/// # extern crate hyper_rustls;
9065/// # extern crate google_bigquery2 as bigquery2;
9066/// use bigquery2::api::Dataset;
9067/// # async fn dox() {
9068/// # use bigquery2::{Bigquery, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9069///
9070/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
9071/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
9072/// # .with_native_roots()
9073/// # .unwrap()
9074/// # .https_only()
9075/// # .enable_http2()
9076/// # .build();
9077///
9078/// # let executor = hyper_util::rt::TokioExecutor::new();
9079/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
9080/// # secret,
9081/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9082/// # yup_oauth2::client::CustomHyperClientBuilder::from(
9083/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
9084/// # ),
9085/// # ).build().await.unwrap();
9086///
9087/// # let client = hyper_util::client::legacy::Client::builder(
9088/// # hyper_util::rt::TokioExecutor::new()
9089/// # )
9090/// # .build(
9091/// # hyper_rustls::HttpsConnectorBuilder::new()
9092/// # .with_native_roots()
9093/// # .unwrap()
9094/// # .https_or_http()
9095/// # .enable_http2()
9096/// # .build()
9097/// # );
9098/// # let mut hub = Bigquery::new(client, auth);
9099/// // As the method needs a request, you would usually fill it with the desired information
9100/// // into the respective structure. Some of the parts shown here might not be applicable !
9101/// // Values shown here are possibly random and not representative !
9102/// let mut req = Dataset::default();
9103///
9104/// // You can configure optional parameters by calling the respective setters at will, and
9105/// // execute the final call using `doit()`.
9106/// // Values shown here are possibly random and not representative !
9107/// let result = hub.datasets().insert(req, "projectId")
9108/// .access_policy_version(-37)
9109/// .doit().await;
9110/// # }
9111/// ```
9112pub struct DatasetInsertCall<'a, C>
9113where
9114 C: 'a,
9115{
9116 hub: &'a Bigquery<C>,
9117 _request: Dataset,
9118 _project_id: String,
9119 _access_policy_version: Option<i32>,
9120 _delegate: Option<&'a mut dyn common::Delegate>,
9121 _additional_params: HashMap<String, String>,
9122 _scopes: BTreeSet<String>,
9123}
9124
9125impl<'a, C> common::CallBuilder for DatasetInsertCall<'a, C> {}
9126
9127impl<'a, C> DatasetInsertCall<'a, C>
9128where
9129 C: common::Connector,
9130{
9131 /// Perform the operation you have build so far.
9132 pub async fn doit(mut self) -> common::Result<(common::Response, Dataset)> {
9133 use std::borrow::Cow;
9134 use std::io::{Read, Seek};
9135
9136 use common::{url::Params, ToParts};
9137 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
9138
9139 let mut dd = common::DefaultDelegate;
9140 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
9141 dlg.begin(common::MethodInfo {
9142 id: "bigquery.datasets.insert",
9143 http_method: hyper::Method::POST,
9144 });
9145
9146 for &field in ["alt", "projectId", "accessPolicyVersion"].iter() {
9147 if self._additional_params.contains_key(field) {
9148 dlg.finished(false);
9149 return Err(common::Error::FieldClash(field));
9150 }
9151 }
9152
9153 let mut params = Params::with_capacity(5 + self._additional_params.len());
9154 params.push("projectId", self._project_id);
9155 if let Some(value) = self._access_policy_version.as_ref() {
9156 params.push("accessPolicyVersion", value.to_string());
9157 }
9158
9159 params.extend(self._additional_params.iter());
9160
9161 params.push("alt", "json");
9162 let mut url = self.hub._base_url.clone() + "projects/{+projectId}/datasets";
9163 if self._scopes.is_empty() {
9164 self._scopes
9165 .insert(Scope::CloudPlatform.as_ref().to_string());
9166 }
9167
9168 #[allow(clippy::single_element_loop)]
9169 for &(find_this, param_name) in [("{+projectId}", "projectId")].iter() {
9170 url = params.uri_replacement(url, param_name, find_this, true);
9171 }
9172 {
9173 let to_remove = ["projectId"];
9174 params.remove_params(&to_remove);
9175 }
9176
9177 let url = params.parse_with_url(&url);
9178
9179 let mut json_mime_type = mime::APPLICATION_JSON;
9180 let mut request_value_reader = {
9181 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
9182 common::remove_json_null_values(&mut value);
9183 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
9184 serde_json::to_writer(&mut dst, &value).unwrap();
9185 dst
9186 };
9187 let request_size = request_value_reader
9188 .seek(std::io::SeekFrom::End(0))
9189 .unwrap();
9190 request_value_reader
9191 .seek(std::io::SeekFrom::Start(0))
9192 .unwrap();
9193
9194 loop {
9195 let token = match self
9196 .hub
9197 .auth
9198 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
9199 .await
9200 {
9201 Ok(token) => token,
9202 Err(e) => match dlg.token(e) {
9203 Ok(token) => token,
9204 Err(e) => {
9205 dlg.finished(false);
9206 return Err(common::Error::MissingToken(e));
9207 }
9208 },
9209 };
9210 request_value_reader
9211 .seek(std::io::SeekFrom::Start(0))
9212 .unwrap();
9213 let mut req_result = {
9214 let client = &self.hub.client;
9215 dlg.pre_request();
9216 let mut req_builder = hyper::Request::builder()
9217 .method(hyper::Method::POST)
9218 .uri(url.as_str())
9219 .header(USER_AGENT, self.hub._user_agent.clone());
9220
9221 if let Some(token) = token.as_ref() {
9222 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
9223 }
9224
9225 let request = req_builder
9226 .header(CONTENT_TYPE, json_mime_type.to_string())
9227 .header(CONTENT_LENGTH, request_size as u64)
9228 .body(common::to_body(
9229 request_value_reader.get_ref().clone().into(),
9230 ));
9231
9232 client.request(request.unwrap()).await
9233 };
9234
9235 match req_result {
9236 Err(err) => {
9237 if let common::Retry::After(d) = dlg.http_error(&err) {
9238 sleep(d).await;
9239 continue;
9240 }
9241 dlg.finished(false);
9242 return Err(common::Error::HttpError(err));
9243 }
9244 Ok(res) => {
9245 let (mut parts, body) = res.into_parts();
9246 let mut body = common::Body::new(body);
9247 if !parts.status.is_success() {
9248 let bytes = common::to_bytes(body).await.unwrap_or_default();
9249 let error = serde_json::from_str(&common::to_string(&bytes));
9250 let response = common::to_response(parts, bytes.into());
9251
9252 if let common::Retry::After(d) =
9253 dlg.http_failure(&response, error.as_ref().ok())
9254 {
9255 sleep(d).await;
9256 continue;
9257 }
9258
9259 dlg.finished(false);
9260
9261 return Err(match error {
9262 Ok(value) => common::Error::BadRequest(value),
9263 _ => common::Error::Failure(response),
9264 });
9265 }
9266 let response = {
9267 let bytes = common::to_bytes(body).await.unwrap_or_default();
9268 let encoded = common::to_string(&bytes);
9269 match serde_json::from_str(&encoded) {
9270 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
9271 Err(error) => {
9272 dlg.response_json_decode_error(&encoded, &error);
9273 return Err(common::Error::JsonDecodeError(
9274 encoded.to_string(),
9275 error,
9276 ));
9277 }
9278 }
9279 };
9280
9281 dlg.finished(true);
9282 return Ok(response);
9283 }
9284 }
9285 }
9286 }
9287
9288 ///
9289 /// Sets the *request* property to the given value.
9290 ///
9291 /// Even though the property as already been set when instantiating this call,
9292 /// we provide this method for API completeness.
9293 pub fn request(mut self, new_value: Dataset) -> DatasetInsertCall<'a, C> {
9294 self._request = new_value;
9295 self
9296 }
9297 /// Required. Project ID of the new dataset
9298 ///
9299 /// Sets the *project id* path property to the given value.
9300 ///
9301 /// Even though the property as already been set when instantiating this call,
9302 /// we provide this method for API completeness.
9303 pub fn project_id(mut self, new_value: &str) -> DatasetInsertCall<'a, C> {
9304 self._project_id = new_value.to_string();
9305 self
9306 }
9307 /// Optional. The version of the provided access policy schema. Valid values are 0, 1, and 3. Requests specifying an invalid value will be rejected. This version refers to the schema version of the access policy and not the version of access policy. This field's value can be equal or more than the access policy schema provided in the request. For example, * Requests with conditional access policy binding in datasets must specify version 3. * But dataset with no conditional role bindings in access policy may specify any valid value or leave the field unset. If unset or if 0 or 1 value is used for dataset with conditional bindings, request will be rejected. This field will be mapped to IAM Policy version (https://cloud.google.com/iam/docs/policies#versions) and will be used to set policy in IAM.
9308 ///
9309 /// Sets the *access policy version* query property to the given value.
9310 pub fn access_policy_version(mut self, new_value: i32) -> DatasetInsertCall<'a, C> {
9311 self._access_policy_version = Some(new_value);
9312 self
9313 }
9314 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
9315 /// while executing the actual API request.
9316 ///
9317 /// ````text
9318 /// It should be used to handle progress information, and to implement a certain level of resilience.
9319 /// ````
9320 ///
9321 /// Sets the *delegate* property to the given value.
9322 pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> DatasetInsertCall<'a, C> {
9323 self._delegate = Some(new_value);
9324 self
9325 }
9326
9327 /// Set any additional parameter of the query string used in the request.
9328 /// It should be used to set parameters which are not yet available through their own
9329 /// setters.
9330 ///
9331 /// Please note that this method must not be used to set any of the known parameters
9332 /// which have their own setter method. If done anyway, the request will fail.
9333 ///
9334 /// # Additional Parameters
9335 ///
9336 /// * *$.xgafv* (query-string) - V1 error format.
9337 /// * *access_token* (query-string) - OAuth access token.
9338 /// * *alt* (query-string) - Data format for response.
9339 /// * *callback* (query-string) - JSONP
9340 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
9341 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
9342 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
9343 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
9344 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
9345 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
9346 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
9347 pub fn param<T>(mut self, name: T, value: T) -> DatasetInsertCall<'a, C>
9348 where
9349 T: AsRef<str>,
9350 {
9351 self._additional_params
9352 .insert(name.as_ref().to_string(), value.as_ref().to_string());
9353 self
9354 }
9355
9356 /// Identifies the authorization scope for the method you are building.
9357 ///
9358 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
9359 /// [`Scope::CloudPlatform`].
9360 ///
9361 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
9362 /// tokens for more than one scope.
9363 ///
9364 /// Usually there is more than one suitable scope to authorize an operation, some of which may
9365 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
9366 /// sufficient, a read-write scope will do as well.
9367 pub fn add_scope<St>(mut self, scope: St) -> DatasetInsertCall<'a, C>
9368 where
9369 St: AsRef<str>,
9370 {
9371 self._scopes.insert(String::from(scope.as_ref()));
9372 self
9373 }
9374 /// Identifies the authorization scope(s) for the method you are building.
9375 ///
9376 /// See [`Self::add_scope()`] for details.
9377 pub fn add_scopes<I, St>(mut self, scopes: I) -> DatasetInsertCall<'a, C>
9378 where
9379 I: IntoIterator<Item = St>,
9380 St: AsRef<str>,
9381 {
9382 self._scopes
9383 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
9384 self
9385 }
9386
9387 /// Removes all scopes, and no default scope will be used either.
9388 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
9389 /// for details).
9390 pub fn clear_scopes(mut self) -> DatasetInsertCall<'a, C> {
9391 self._scopes.clear();
9392 self
9393 }
9394}
9395
9396/// Lists all datasets in the specified project to which the user has been granted the READER dataset role.
9397///
9398/// A builder for the *list* method supported by a *dataset* resource.
9399/// It is not used directly, but through a [`DatasetMethods`] instance.
9400///
9401/// # Example
9402///
9403/// Instantiate a resource method builder
9404///
9405/// ```test_harness,no_run
9406/// # extern crate hyper;
9407/// # extern crate hyper_rustls;
9408/// # extern crate google_bigquery2 as bigquery2;
9409/// # async fn dox() {
9410/// # use bigquery2::{Bigquery, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9411///
9412/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
9413/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
9414/// # .with_native_roots()
9415/// # .unwrap()
9416/// # .https_only()
9417/// # .enable_http2()
9418/// # .build();
9419///
9420/// # let executor = hyper_util::rt::TokioExecutor::new();
9421/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
9422/// # secret,
9423/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9424/// # yup_oauth2::client::CustomHyperClientBuilder::from(
9425/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
9426/// # ),
9427/// # ).build().await.unwrap();
9428///
9429/// # let client = hyper_util::client::legacy::Client::builder(
9430/// # hyper_util::rt::TokioExecutor::new()
9431/// # )
9432/// # .build(
9433/// # hyper_rustls::HttpsConnectorBuilder::new()
9434/// # .with_native_roots()
9435/// # .unwrap()
9436/// # .https_or_http()
9437/// # .enable_http2()
9438/// # .build()
9439/// # );
9440/// # let mut hub = Bigquery::new(client, auth);
9441/// // You can configure optional parameters by calling the respective setters at will, and
9442/// // execute the final call using `doit()`.
9443/// // Values shown here are possibly random and not representative !
9444/// let result = hub.datasets().list("projectId")
9445/// .page_token("rebum.")
9446/// .max_results(44)
9447/// .filter("ipsum")
9448/// .all(true)
9449/// .doit().await;
9450/// # }
9451/// ```
9452pub struct DatasetListCall<'a, C>
9453where
9454 C: 'a,
9455{
9456 hub: &'a Bigquery<C>,
9457 _project_id: String,
9458 _page_token: Option<String>,
9459 _max_results: Option<u32>,
9460 _filter: Option<String>,
9461 _all: Option<bool>,
9462 _delegate: Option<&'a mut dyn common::Delegate>,
9463 _additional_params: HashMap<String, String>,
9464 _scopes: BTreeSet<String>,
9465}
9466
9467impl<'a, C> common::CallBuilder for DatasetListCall<'a, C> {}
9468
9469impl<'a, C> DatasetListCall<'a, C>
9470where
9471 C: common::Connector,
9472{
9473 /// Perform the operation you have build so far.
9474 pub async fn doit(mut self) -> common::Result<(common::Response, DatasetList)> {
9475 use std::borrow::Cow;
9476 use std::io::{Read, Seek};
9477
9478 use common::{url::Params, ToParts};
9479 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
9480
9481 let mut dd = common::DefaultDelegate;
9482 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
9483 dlg.begin(common::MethodInfo {
9484 id: "bigquery.datasets.list",
9485 http_method: hyper::Method::GET,
9486 });
9487
9488 for &field in [
9489 "alt",
9490 "projectId",
9491 "pageToken",
9492 "maxResults",
9493 "filter",
9494 "all",
9495 ]
9496 .iter()
9497 {
9498 if self._additional_params.contains_key(field) {
9499 dlg.finished(false);
9500 return Err(common::Error::FieldClash(field));
9501 }
9502 }
9503
9504 let mut params = Params::with_capacity(7 + self._additional_params.len());
9505 params.push("projectId", self._project_id);
9506 if let Some(value) = self._page_token.as_ref() {
9507 params.push("pageToken", value);
9508 }
9509 if let Some(value) = self._max_results.as_ref() {
9510 params.push("maxResults", value.to_string());
9511 }
9512 if let Some(value) = self._filter.as_ref() {
9513 params.push("filter", value);
9514 }
9515 if let Some(value) = self._all.as_ref() {
9516 params.push("all", value.to_string());
9517 }
9518
9519 params.extend(self._additional_params.iter());
9520
9521 params.push("alt", "json");
9522 let mut url = self.hub._base_url.clone() + "projects/{+projectId}/datasets";
9523 if self._scopes.is_empty() {
9524 self._scopes
9525 .insert(Scope::CloudPlatformReadOnly.as_ref().to_string());
9526 }
9527
9528 #[allow(clippy::single_element_loop)]
9529 for &(find_this, param_name) in [("{+projectId}", "projectId")].iter() {
9530 url = params.uri_replacement(url, param_name, find_this, true);
9531 }
9532 {
9533 let to_remove = ["projectId"];
9534 params.remove_params(&to_remove);
9535 }
9536
9537 let url = params.parse_with_url(&url);
9538
9539 loop {
9540 let token = match self
9541 .hub
9542 .auth
9543 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
9544 .await
9545 {
9546 Ok(token) => token,
9547 Err(e) => match dlg.token(e) {
9548 Ok(token) => token,
9549 Err(e) => {
9550 dlg.finished(false);
9551 return Err(common::Error::MissingToken(e));
9552 }
9553 },
9554 };
9555 let mut req_result = {
9556 let client = &self.hub.client;
9557 dlg.pre_request();
9558 let mut req_builder = hyper::Request::builder()
9559 .method(hyper::Method::GET)
9560 .uri(url.as_str())
9561 .header(USER_AGENT, self.hub._user_agent.clone());
9562
9563 if let Some(token) = token.as_ref() {
9564 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
9565 }
9566
9567 let request = req_builder
9568 .header(CONTENT_LENGTH, 0_u64)
9569 .body(common::to_body::<String>(None));
9570
9571 client.request(request.unwrap()).await
9572 };
9573
9574 match req_result {
9575 Err(err) => {
9576 if let common::Retry::After(d) = dlg.http_error(&err) {
9577 sleep(d).await;
9578 continue;
9579 }
9580 dlg.finished(false);
9581 return Err(common::Error::HttpError(err));
9582 }
9583 Ok(res) => {
9584 let (mut parts, body) = res.into_parts();
9585 let mut body = common::Body::new(body);
9586 if !parts.status.is_success() {
9587 let bytes = common::to_bytes(body).await.unwrap_or_default();
9588 let error = serde_json::from_str(&common::to_string(&bytes));
9589 let response = common::to_response(parts, bytes.into());
9590
9591 if let common::Retry::After(d) =
9592 dlg.http_failure(&response, error.as_ref().ok())
9593 {
9594 sleep(d).await;
9595 continue;
9596 }
9597
9598 dlg.finished(false);
9599
9600 return Err(match error {
9601 Ok(value) => common::Error::BadRequest(value),
9602 _ => common::Error::Failure(response),
9603 });
9604 }
9605 let response = {
9606 let bytes = common::to_bytes(body).await.unwrap_or_default();
9607 let encoded = common::to_string(&bytes);
9608 match serde_json::from_str(&encoded) {
9609 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
9610 Err(error) => {
9611 dlg.response_json_decode_error(&encoded, &error);
9612 return Err(common::Error::JsonDecodeError(
9613 encoded.to_string(),
9614 error,
9615 ));
9616 }
9617 }
9618 };
9619
9620 dlg.finished(true);
9621 return Ok(response);
9622 }
9623 }
9624 }
9625 }
9626
9627 /// Required. Project ID of the datasets to be listed
9628 ///
9629 /// Sets the *project id* path property to the given value.
9630 ///
9631 /// Even though the property as already been set when instantiating this call,
9632 /// we provide this method for API completeness.
9633 pub fn project_id(mut self, new_value: &str) -> DatasetListCall<'a, C> {
9634 self._project_id = new_value.to_string();
9635 self
9636 }
9637 /// Page token, returned by a previous call, to request the next page of results
9638 ///
9639 /// Sets the *page token* query property to the given value.
9640 pub fn page_token(mut self, new_value: &str) -> DatasetListCall<'a, C> {
9641 self._page_token = Some(new_value.to_string());
9642 self
9643 }
9644 /// The maximum number of results to return in a single response page. Leverage the page tokens to iterate through the entire collection.
9645 ///
9646 /// Sets the *max results* query property to the given value.
9647 pub fn max_results(mut self, new_value: u32) -> DatasetListCall<'a, C> {
9648 self._max_results = Some(new_value);
9649 self
9650 }
9651 /// An expression for filtering the results of the request by label. The syntax is `labels.[:]`. Multiple filters can be AND-ed together by connecting with a space. Example: `labels.department:receiving labels.active`. See [Filtering datasets using labels](https://cloud.google.com/bigquery/docs/filtering-labels#filtering_datasets_using_labels) for details.
9652 ///
9653 /// Sets the *filter* query property to the given value.
9654 pub fn filter(mut self, new_value: &str) -> DatasetListCall<'a, C> {
9655 self._filter = Some(new_value.to_string());
9656 self
9657 }
9658 /// Whether to list all datasets, including hidden ones
9659 ///
9660 /// Sets the *all* query property to the given value.
9661 pub fn all(mut self, new_value: bool) -> DatasetListCall<'a, C> {
9662 self._all = Some(new_value);
9663 self
9664 }
9665 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
9666 /// while executing the actual API request.
9667 ///
9668 /// ````text
9669 /// It should be used to handle progress information, and to implement a certain level of resilience.
9670 /// ````
9671 ///
9672 /// Sets the *delegate* property to the given value.
9673 pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> DatasetListCall<'a, C> {
9674 self._delegate = Some(new_value);
9675 self
9676 }
9677
9678 /// Set any additional parameter of the query string used in the request.
9679 /// It should be used to set parameters which are not yet available through their own
9680 /// setters.
9681 ///
9682 /// Please note that this method must not be used to set any of the known parameters
9683 /// which have their own setter method. If done anyway, the request will fail.
9684 ///
9685 /// # Additional Parameters
9686 ///
9687 /// * *$.xgafv* (query-string) - V1 error format.
9688 /// * *access_token* (query-string) - OAuth access token.
9689 /// * *alt* (query-string) - Data format for response.
9690 /// * *callback* (query-string) - JSONP
9691 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
9692 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
9693 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
9694 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
9695 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
9696 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
9697 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
9698 pub fn param<T>(mut self, name: T, value: T) -> DatasetListCall<'a, C>
9699 where
9700 T: AsRef<str>,
9701 {
9702 self._additional_params
9703 .insert(name.as_ref().to_string(), value.as_ref().to_string());
9704 self
9705 }
9706
9707 /// Identifies the authorization scope for the method you are building.
9708 ///
9709 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
9710 /// [`Scope::CloudPlatformReadOnly`].
9711 ///
9712 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
9713 /// tokens for more than one scope.
9714 ///
9715 /// Usually there is more than one suitable scope to authorize an operation, some of which may
9716 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
9717 /// sufficient, a read-write scope will do as well.
9718 pub fn add_scope<St>(mut self, scope: St) -> DatasetListCall<'a, C>
9719 where
9720 St: AsRef<str>,
9721 {
9722 self._scopes.insert(String::from(scope.as_ref()));
9723 self
9724 }
9725 /// Identifies the authorization scope(s) for the method you are building.
9726 ///
9727 /// See [`Self::add_scope()`] for details.
9728 pub fn add_scopes<I, St>(mut self, scopes: I) -> DatasetListCall<'a, C>
9729 where
9730 I: IntoIterator<Item = St>,
9731 St: AsRef<str>,
9732 {
9733 self._scopes
9734 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
9735 self
9736 }
9737
9738 /// Removes all scopes, and no default scope will be used either.
9739 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
9740 /// for details).
9741 pub fn clear_scopes(mut self) -> DatasetListCall<'a, C> {
9742 self._scopes.clear();
9743 self
9744 }
9745}
9746
9747/// Updates information in an existing dataset. The update method replaces the entire dataset resource, whereas the patch method only replaces fields that are provided in the submitted dataset resource. This method supports RFC5789 patch semantics.
9748///
9749/// A builder for the *patch* method supported by a *dataset* resource.
9750/// It is not used directly, but through a [`DatasetMethods`] instance.
9751///
9752/// # Example
9753///
9754/// Instantiate a resource method builder
9755///
9756/// ```test_harness,no_run
9757/// # extern crate hyper;
9758/// # extern crate hyper_rustls;
9759/// # extern crate google_bigquery2 as bigquery2;
9760/// use bigquery2::api::Dataset;
9761/// # async fn dox() {
9762/// # use bigquery2::{Bigquery, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9763///
9764/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
9765/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
9766/// # .with_native_roots()
9767/// # .unwrap()
9768/// # .https_only()
9769/// # .enable_http2()
9770/// # .build();
9771///
9772/// # let executor = hyper_util::rt::TokioExecutor::new();
9773/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
9774/// # secret,
9775/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9776/// # yup_oauth2::client::CustomHyperClientBuilder::from(
9777/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
9778/// # ),
9779/// # ).build().await.unwrap();
9780///
9781/// # let client = hyper_util::client::legacy::Client::builder(
9782/// # hyper_util::rt::TokioExecutor::new()
9783/// # )
9784/// # .build(
9785/// # hyper_rustls::HttpsConnectorBuilder::new()
9786/// # .with_native_roots()
9787/// # .unwrap()
9788/// # .https_or_http()
9789/// # .enable_http2()
9790/// # .build()
9791/// # );
9792/// # let mut hub = Bigquery::new(client, auth);
9793/// // As the method needs a request, you would usually fill it with the desired information
9794/// // into the respective structure. Some of the parts shown here might not be applicable !
9795/// // Values shown here are possibly random and not representative !
9796/// let mut req = Dataset::default();
9797///
9798/// // You can configure optional parameters by calling the respective setters at will, and
9799/// // execute the final call using `doit()`.
9800/// // Values shown here are possibly random and not representative !
9801/// let result = hub.datasets().patch(req, "projectId", "datasetId")
9802/// .update_mode("ea")
9803/// .access_policy_version(-99)
9804/// .doit().await;
9805/// # }
9806/// ```
9807pub struct DatasetPatchCall<'a, C>
9808where
9809 C: 'a,
9810{
9811 hub: &'a Bigquery<C>,
9812 _request: Dataset,
9813 _project_id: String,
9814 _dataset_id: String,
9815 _update_mode: Option<String>,
9816 _access_policy_version: Option<i32>,
9817 _delegate: Option<&'a mut dyn common::Delegate>,
9818 _additional_params: HashMap<String, String>,
9819 _scopes: BTreeSet<String>,
9820}
9821
9822impl<'a, C> common::CallBuilder for DatasetPatchCall<'a, C> {}
9823
9824impl<'a, C> DatasetPatchCall<'a, C>
9825where
9826 C: common::Connector,
9827{
9828 /// Perform the operation you have build so far.
9829 pub async fn doit(mut self) -> common::Result<(common::Response, Dataset)> {
9830 use std::borrow::Cow;
9831 use std::io::{Read, Seek};
9832
9833 use common::{url::Params, ToParts};
9834 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
9835
9836 let mut dd = common::DefaultDelegate;
9837 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
9838 dlg.begin(common::MethodInfo {
9839 id: "bigquery.datasets.patch",
9840 http_method: hyper::Method::PATCH,
9841 });
9842
9843 for &field in [
9844 "alt",
9845 "projectId",
9846 "datasetId",
9847 "updateMode",
9848 "accessPolicyVersion",
9849 ]
9850 .iter()
9851 {
9852 if self._additional_params.contains_key(field) {
9853 dlg.finished(false);
9854 return Err(common::Error::FieldClash(field));
9855 }
9856 }
9857
9858 let mut params = Params::with_capacity(7 + self._additional_params.len());
9859 params.push("projectId", self._project_id);
9860 params.push("datasetId", self._dataset_id);
9861 if let Some(value) = self._update_mode.as_ref() {
9862 params.push("updateMode", value);
9863 }
9864 if let Some(value) = self._access_policy_version.as_ref() {
9865 params.push("accessPolicyVersion", value.to_string());
9866 }
9867
9868 params.extend(self._additional_params.iter());
9869
9870 params.push("alt", "json");
9871 let mut url = self.hub._base_url.clone() + "projects/{+projectId}/datasets/{+datasetId}";
9872 if self._scopes.is_empty() {
9873 self._scopes
9874 .insert(Scope::CloudPlatform.as_ref().to_string());
9875 }
9876
9877 #[allow(clippy::single_element_loop)]
9878 for &(find_this, param_name) in
9879 [("{+projectId}", "projectId"), ("{+datasetId}", "datasetId")].iter()
9880 {
9881 url = params.uri_replacement(url, param_name, find_this, true);
9882 }
9883 {
9884 let to_remove = ["datasetId", "projectId"];
9885 params.remove_params(&to_remove);
9886 }
9887
9888 let url = params.parse_with_url(&url);
9889
9890 let mut json_mime_type = mime::APPLICATION_JSON;
9891 let mut request_value_reader = {
9892 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
9893 common::remove_json_null_values(&mut value);
9894 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
9895 serde_json::to_writer(&mut dst, &value).unwrap();
9896 dst
9897 };
9898 let request_size = request_value_reader
9899 .seek(std::io::SeekFrom::End(0))
9900 .unwrap();
9901 request_value_reader
9902 .seek(std::io::SeekFrom::Start(0))
9903 .unwrap();
9904
9905 loop {
9906 let token = match self
9907 .hub
9908 .auth
9909 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
9910 .await
9911 {
9912 Ok(token) => token,
9913 Err(e) => match dlg.token(e) {
9914 Ok(token) => token,
9915 Err(e) => {
9916 dlg.finished(false);
9917 return Err(common::Error::MissingToken(e));
9918 }
9919 },
9920 };
9921 request_value_reader
9922 .seek(std::io::SeekFrom::Start(0))
9923 .unwrap();
9924 let mut req_result = {
9925 let client = &self.hub.client;
9926 dlg.pre_request();
9927 let mut req_builder = hyper::Request::builder()
9928 .method(hyper::Method::PATCH)
9929 .uri(url.as_str())
9930 .header(USER_AGENT, self.hub._user_agent.clone());
9931
9932 if let Some(token) = token.as_ref() {
9933 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
9934 }
9935
9936 let request = req_builder
9937 .header(CONTENT_TYPE, json_mime_type.to_string())
9938 .header(CONTENT_LENGTH, request_size as u64)
9939 .body(common::to_body(
9940 request_value_reader.get_ref().clone().into(),
9941 ));
9942
9943 client.request(request.unwrap()).await
9944 };
9945
9946 match req_result {
9947 Err(err) => {
9948 if let common::Retry::After(d) = dlg.http_error(&err) {
9949 sleep(d).await;
9950 continue;
9951 }
9952 dlg.finished(false);
9953 return Err(common::Error::HttpError(err));
9954 }
9955 Ok(res) => {
9956 let (mut parts, body) = res.into_parts();
9957 let mut body = common::Body::new(body);
9958 if !parts.status.is_success() {
9959 let bytes = common::to_bytes(body).await.unwrap_or_default();
9960 let error = serde_json::from_str(&common::to_string(&bytes));
9961 let response = common::to_response(parts, bytes.into());
9962
9963 if let common::Retry::After(d) =
9964 dlg.http_failure(&response, error.as_ref().ok())
9965 {
9966 sleep(d).await;
9967 continue;
9968 }
9969
9970 dlg.finished(false);
9971
9972 return Err(match error {
9973 Ok(value) => common::Error::BadRequest(value),
9974 _ => common::Error::Failure(response),
9975 });
9976 }
9977 let response = {
9978 let bytes = common::to_bytes(body).await.unwrap_or_default();
9979 let encoded = common::to_string(&bytes);
9980 match serde_json::from_str(&encoded) {
9981 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
9982 Err(error) => {
9983 dlg.response_json_decode_error(&encoded, &error);
9984 return Err(common::Error::JsonDecodeError(
9985 encoded.to_string(),
9986 error,
9987 ));
9988 }
9989 }
9990 };
9991
9992 dlg.finished(true);
9993 return Ok(response);
9994 }
9995 }
9996 }
9997 }
9998
9999 ///
10000 /// Sets the *request* property to the given value.
10001 ///
10002 /// Even though the property as already been set when instantiating this call,
10003 /// we provide this method for API completeness.
10004 pub fn request(mut self, new_value: Dataset) -> DatasetPatchCall<'a, C> {
10005 self._request = new_value;
10006 self
10007 }
10008 /// Required. Project ID of the dataset being updated
10009 ///
10010 /// Sets the *project id* path property to the given value.
10011 ///
10012 /// Even though the property as already been set when instantiating this call,
10013 /// we provide this method for API completeness.
10014 pub fn project_id(mut self, new_value: &str) -> DatasetPatchCall<'a, C> {
10015 self._project_id = new_value.to_string();
10016 self
10017 }
10018 /// Required. Dataset ID of the dataset being updated
10019 ///
10020 /// Sets the *dataset id* path property to the given value.
10021 ///
10022 /// Even though the property as already been set when instantiating this call,
10023 /// we provide this method for API completeness.
10024 pub fn dataset_id(mut self, new_value: &str) -> DatasetPatchCall<'a, C> {
10025 self._dataset_id = new_value.to_string();
10026 self
10027 }
10028 /// Optional. Specifies the fields of dataset that update/patch operation is targeting By default, both metadata and ACL fields are updated.
10029 ///
10030 /// Sets the *update mode* query property to the given value.
10031 pub fn update_mode(mut self, new_value: &str) -> DatasetPatchCall<'a, C> {
10032 self._update_mode = Some(new_value.to_string());
10033 self
10034 }
10035 /// Optional. The version of the provided access policy schema. Valid values are 0, 1, and 3. Requests specifying an invalid value will be rejected. This version refers to the schema version of the access policy and not the version of access policy. This field's value can be equal or more than the access policy schema provided in the request. For example, * Operations updating conditional access policy binding in datasets must specify version 3. Some of the operations are : - Adding a new access policy entry with condition. - Removing an access policy entry with condition. - Updating an access policy entry with condition. * But dataset with no conditional role bindings in access policy may specify any valid value or leave the field unset. If unset or if 0 or 1 value is used for dataset with conditional bindings, request will be rejected. This field will be mapped to IAM Policy version (https://cloud.google.com/iam/docs/policies#versions) and will be used to set policy in IAM.
10036 ///
10037 /// Sets the *access policy version* query property to the given value.
10038 pub fn access_policy_version(mut self, new_value: i32) -> DatasetPatchCall<'a, C> {
10039 self._access_policy_version = Some(new_value);
10040 self
10041 }
10042 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
10043 /// while executing the actual API request.
10044 ///
10045 /// ````text
10046 /// It should be used to handle progress information, and to implement a certain level of resilience.
10047 /// ````
10048 ///
10049 /// Sets the *delegate* property to the given value.
10050 pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> DatasetPatchCall<'a, C> {
10051 self._delegate = Some(new_value);
10052 self
10053 }
10054
10055 /// Set any additional parameter of the query string used in the request.
10056 /// It should be used to set parameters which are not yet available through their own
10057 /// setters.
10058 ///
10059 /// Please note that this method must not be used to set any of the known parameters
10060 /// which have their own setter method. If done anyway, the request will fail.
10061 ///
10062 /// # Additional Parameters
10063 ///
10064 /// * *$.xgafv* (query-string) - V1 error format.
10065 /// * *access_token* (query-string) - OAuth access token.
10066 /// * *alt* (query-string) - Data format for response.
10067 /// * *callback* (query-string) - JSONP
10068 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
10069 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
10070 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
10071 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
10072 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
10073 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
10074 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
10075 pub fn param<T>(mut self, name: T, value: T) -> DatasetPatchCall<'a, C>
10076 where
10077 T: AsRef<str>,
10078 {
10079 self._additional_params
10080 .insert(name.as_ref().to_string(), value.as_ref().to_string());
10081 self
10082 }
10083
10084 /// Identifies the authorization scope for the method you are building.
10085 ///
10086 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
10087 /// [`Scope::CloudPlatform`].
10088 ///
10089 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
10090 /// tokens for more than one scope.
10091 ///
10092 /// Usually there is more than one suitable scope to authorize an operation, some of which may
10093 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
10094 /// sufficient, a read-write scope will do as well.
10095 pub fn add_scope<St>(mut self, scope: St) -> DatasetPatchCall<'a, C>
10096 where
10097 St: AsRef<str>,
10098 {
10099 self._scopes.insert(String::from(scope.as_ref()));
10100 self
10101 }
10102 /// Identifies the authorization scope(s) for the method you are building.
10103 ///
10104 /// See [`Self::add_scope()`] for details.
10105 pub fn add_scopes<I, St>(mut self, scopes: I) -> DatasetPatchCall<'a, C>
10106 where
10107 I: IntoIterator<Item = St>,
10108 St: AsRef<str>,
10109 {
10110 self._scopes
10111 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
10112 self
10113 }
10114
10115 /// Removes all scopes, and no default scope will be used either.
10116 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
10117 /// for details).
10118 pub fn clear_scopes(mut self) -> DatasetPatchCall<'a, C> {
10119 self._scopes.clear();
10120 self
10121 }
10122}
10123
10124/// Undeletes a dataset which is within time travel window based on datasetId. If a time is specified, the dataset version deleted at that time is undeleted, else the last live version is undeleted.
10125///
10126/// A builder for the *undelete* method supported by a *dataset* resource.
10127/// It is not used directly, but through a [`DatasetMethods`] instance.
10128///
10129/// # Example
10130///
10131/// Instantiate a resource method builder
10132///
10133/// ```test_harness,no_run
10134/// # extern crate hyper;
10135/// # extern crate hyper_rustls;
10136/// # extern crate google_bigquery2 as bigquery2;
10137/// use bigquery2::api::UndeleteDatasetRequest;
10138/// # async fn dox() {
10139/// # use bigquery2::{Bigquery, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
10140///
10141/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
10142/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
10143/// # .with_native_roots()
10144/// # .unwrap()
10145/// # .https_only()
10146/// # .enable_http2()
10147/// # .build();
10148///
10149/// # let executor = hyper_util::rt::TokioExecutor::new();
10150/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
10151/// # secret,
10152/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
10153/// # yup_oauth2::client::CustomHyperClientBuilder::from(
10154/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
10155/// # ),
10156/// # ).build().await.unwrap();
10157///
10158/// # let client = hyper_util::client::legacy::Client::builder(
10159/// # hyper_util::rt::TokioExecutor::new()
10160/// # )
10161/// # .build(
10162/// # hyper_rustls::HttpsConnectorBuilder::new()
10163/// # .with_native_roots()
10164/// # .unwrap()
10165/// # .https_or_http()
10166/// # .enable_http2()
10167/// # .build()
10168/// # );
10169/// # let mut hub = Bigquery::new(client, auth);
10170/// // As the method needs a request, you would usually fill it with the desired information
10171/// // into the respective structure. Some of the parts shown here might not be applicable !
10172/// // Values shown here are possibly random and not representative !
10173/// let mut req = UndeleteDatasetRequest::default();
10174///
10175/// // You can configure optional parameters by calling the respective setters at will, and
10176/// // execute the final call using `doit()`.
10177/// // Values shown here are possibly random and not representative !
10178/// let result = hub.datasets().undelete(req, "projectId", "datasetId")
10179/// .doit().await;
10180/// # }
10181/// ```
10182pub struct DatasetUndeleteCall<'a, C>
10183where
10184 C: 'a,
10185{
10186 hub: &'a Bigquery<C>,
10187 _request: UndeleteDatasetRequest,
10188 _project_id: String,
10189 _dataset_id: String,
10190 _delegate: Option<&'a mut dyn common::Delegate>,
10191 _additional_params: HashMap<String, String>,
10192 _scopes: BTreeSet<String>,
10193}
10194
10195impl<'a, C> common::CallBuilder for DatasetUndeleteCall<'a, C> {}
10196
10197impl<'a, C> DatasetUndeleteCall<'a, C>
10198where
10199 C: common::Connector,
10200{
10201 /// Perform the operation you have build so far.
10202 pub async fn doit(mut self) -> common::Result<(common::Response, Dataset)> {
10203 use std::borrow::Cow;
10204 use std::io::{Read, Seek};
10205
10206 use common::{url::Params, ToParts};
10207 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
10208
10209 let mut dd = common::DefaultDelegate;
10210 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
10211 dlg.begin(common::MethodInfo {
10212 id: "bigquery.datasets.undelete",
10213 http_method: hyper::Method::POST,
10214 });
10215
10216 for &field in ["alt", "projectId", "datasetId"].iter() {
10217 if self._additional_params.contains_key(field) {
10218 dlg.finished(false);
10219 return Err(common::Error::FieldClash(field));
10220 }
10221 }
10222
10223 let mut params = Params::with_capacity(5 + self._additional_params.len());
10224 params.push("projectId", self._project_id);
10225 params.push("datasetId", self._dataset_id);
10226
10227 params.extend(self._additional_params.iter());
10228
10229 params.push("alt", "json");
10230 let mut url =
10231 self.hub._base_url.clone() + "projects/{+projectId}/datasets/{+datasetId}:undelete";
10232 if self._scopes.is_empty() {
10233 self._scopes
10234 .insert(Scope::CloudPlatform.as_ref().to_string());
10235 }
10236
10237 #[allow(clippy::single_element_loop)]
10238 for &(find_this, param_name) in
10239 [("{+projectId}", "projectId"), ("{+datasetId}", "datasetId")].iter()
10240 {
10241 url = params.uri_replacement(url, param_name, find_this, true);
10242 }
10243 {
10244 let to_remove = ["datasetId", "projectId"];
10245 params.remove_params(&to_remove);
10246 }
10247
10248 let url = params.parse_with_url(&url);
10249
10250 let mut json_mime_type = mime::APPLICATION_JSON;
10251 let mut request_value_reader = {
10252 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
10253 common::remove_json_null_values(&mut value);
10254 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
10255 serde_json::to_writer(&mut dst, &value).unwrap();
10256 dst
10257 };
10258 let request_size = request_value_reader
10259 .seek(std::io::SeekFrom::End(0))
10260 .unwrap();
10261 request_value_reader
10262 .seek(std::io::SeekFrom::Start(0))
10263 .unwrap();
10264
10265 loop {
10266 let token = match self
10267 .hub
10268 .auth
10269 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
10270 .await
10271 {
10272 Ok(token) => token,
10273 Err(e) => match dlg.token(e) {
10274 Ok(token) => token,
10275 Err(e) => {
10276 dlg.finished(false);
10277 return Err(common::Error::MissingToken(e));
10278 }
10279 },
10280 };
10281 request_value_reader
10282 .seek(std::io::SeekFrom::Start(0))
10283 .unwrap();
10284 let mut req_result = {
10285 let client = &self.hub.client;
10286 dlg.pre_request();
10287 let mut req_builder = hyper::Request::builder()
10288 .method(hyper::Method::POST)
10289 .uri(url.as_str())
10290 .header(USER_AGENT, self.hub._user_agent.clone());
10291
10292 if let Some(token) = token.as_ref() {
10293 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
10294 }
10295
10296 let request = req_builder
10297 .header(CONTENT_TYPE, json_mime_type.to_string())
10298 .header(CONTENT_LENGTH, request_size as u64)
10299 .body(common::to_body(
10300 request_value_reader.get_ref().clone().into(),
10301 ));
10302
10303 client.request(request.unwrap()).await
10304 };
10305
10306 match req_result {
10307 Err(err) => {
10308 if let common::Retry::After(d) = dlg.http_error(&err) {
10309 sleep(d).await;
10310 continue;
10311 }
10312 dlg.finished(false);
10313 return Err(common::Error::HttpError(err));
10314 }
10315 Ok(res) => {
10316 let (mut parts, body) = res.into_parts();
10317 let mut body = common::Body::new(body);
10318 if !parts.status.is_success() {
10319 let bytes = common::to_bytes(body).await.unwrap_or_default();
10320 let error = serde_json::from_str(&common::to_string(&bytes));
10321 let response = common::to_response(parts, bytes.into());
10322
10323 if let common::Retry::After(d) =
10324 dlg.http_failure(&response, error.as_ref().ok())
10325 {
10326 sleep(d).await;
10327 continue;
10328 }
10329
10330 dlg.finished(false);
10331
10332 return Err(match error {
10333 Ok(value) => common::Error::BadRequest(value),
10334 _ => common::Error::Failure(response),
10335 });
10336 }
10337 let response = {
10338 let bytes = common::to_bytes(body).await.unwrap_or_default();
10339 let encoded = common::to_string(&bytes);
10340 match serde_json::from_str(&encoded) {
10341 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
10342 Err(error) => {
10343 dlg.response_json_decode_error(&encoded, &error);
10344 return Err(common::Error::JsonDecodeError(
10345 encoded.to_string(),
10346 error,
10347 ));
10348 }
10349 }
10350 };
10351
10352 dlg.finished(true);
10353 return Ok(response);
10354 }
10355 }
10356 }
10357 }
10358
10359 ///
10360 /// Sets the *request* property to the given value.
10361 ///
10362 /// Even though the property as already been set when instantiating this call,
10363 /// we provide this method for API completeness.
10364 pub fn request(mut self, new_value: UndeleteDatasetRequest) -> DatasetUndeleteCall<'a, C> {
10365 self._request = new_value;
10366 self
10367 }
10368 /// Required. Project ID of the dataset to be undeleted
10369 ///
10370 /// Sets the *project id* path property to the given value.
10371 ///
10372 /// Even though the property as already been set when instantiating this call,
10373 /// we provide this method for API completeness.
10374 pub fn project_id(mut self, new_value: &str) -> DatasetUndeleteCall<'a, C> {
10375 self._project_id = new_value.to_string();
10376 self
10377 }
10378 /// Required. Dataset ID of dataset being deleted
10379 ///
10380 /// Sets the *dataset id* path property to the given value.
10381 ///
10382 /// Even though the property as already been set when instantiating this call,
10383 /// we provide this method for API completeness.
10384 pub fn dataset_id(mut self, new_value: &str) -> DatasetUndeleteCall<'a, C> {
10385 self._dataset_id = new_value.to_string();
10386 self
10387 }
10388 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
10389 /// while executing the actual API request.
10390 ///
10391 /// ````text
10392 /// It should be used to handle progress information, and to implement a certain level of resilience.
10393 /// ````
10394 ///
10395 /// Sets the *delegate* property to the given value.
10396 pub fn delegate(
10397 mut self,
10398 new_value: &'a mut dyn common::Delegate,
10399 ) -> DatasetUndeleteCall<'a, C> {
10400 self._delegate = Some(new_value);
10401 self
10402 }
10403
10404 /// Set any additional parameter of the query string used in the request.
10405 /// It should be used to set parameters which are not yet available through their own
10406 /// setters.
10407 ///
10408 /// Please note that this method must not be used to set any of the known parameters
10409 /// which have their own setter method. If done anyway, the request will fail.
10410 ///
10411 /// # Additional Parameters
10412 ///
10413 /// * *$.xgafv* (query-string) - V1 error format.
10414 /// * *access_token* (query-string) - OAuth access token.
10415 /// * *alt* (query-string) - Data format for response.
10416 /// * *callback* (query-string) - JSONP
10417 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
10418 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
10419 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
10420 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
10421 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
10422 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
10423 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
10424 pub fn param<T>(mut self, name: T, value: T) -> DatasetUndeleteCall<'a, C>
10425 where
10426 T: AsRef<str>,
10427 {
10428 self._additional_params
10429 .insert(name.as_ref().to_string(), value.as_ref().to_string());
10430 self
10431 }
10432
10433 /// Identifies the authorization scope for the method you are building.
10434 ///
10435 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
10436 /// [`Scope::CloudPlatform`].
10437 ///
10438 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
10439 /// tokens for more than one scope.
10440 ///
10441 /// Usually there is more than one suitable scope to authorize an operation, some of which may
10442 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
10443 /// sufficient, a read-write scope will do as well.
10444 pub fn add_scope<St>(mut self, scope: St) -> DatasetUndeleteCall<'a, C>
10445 where
10446 St: AsRef<str>,
10447 {
10448 self._scopes.insert(String::from(scope.as_ref()));
10449 self
10450 }
10451 /// Identifies the authorization scope(s) for the method you are building.
10452 ///
10453 /// See [`Self::add_scope()`] for details.
10454 pub fn add_scopes<I, St>(mut self, scopes: I) -> DatasetUndeleteCall<'a, C>
10455 where
10456 I: IntoIterator<Item = St>,
10457 St: AsRef<str>,
10458 {
10459 self._scopes
10460 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
10461 self
10462 }
10463
10464 /// Removes all scopes, and no default scope will be used either.
10465 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
10466 /// for details).
10467 pub fn clear_scopes(mut self) -> DatasetUndeleteCall<'a, C> {
10468 self._scopes.clear();
10469 self
10470 }
10471}
10472
10473/// Updates information in an existing dataset. The update method replaces the entire dataset resource, whereas the patch method only replaces fields that are provided in the submitted dataset resource.
10474///
10475/// A builder for the *update* method supported by a *dataset* resource.
10476/// It is not used directly, but through a [`DatasetMethods`] instance.
10477///
10478/// # Example
10479///
10480/// Instantiate a resource method builder
10481///
10482/// ```test_harness,no_run
10483/// # extern crate hyper;
10484/// # extern crate hyper_rustls;
10485/// # extern crate google_bigquery2 as bigquery2;
10486/// use bigquery2::api::Dataset;
10487/// # async fn dox() {
10488/// # use bigquery2::{Bigquery, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
10489///
10490/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
10491/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
10492/// # .with_native_roots()
10493/// # .unwrap()
10494/// # .https_only()
10495/// # .enable_http2()
10496/// # .build();
10497///
10498/// # let executor = hyper_util::rt::TokioExecutor::new();
10499/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
10500/// # secret,
10501/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
10502/// # yup_oauth2::client::CustomHyperClientBuilder::from(
10503/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
10504/// # ),
10505/// # ).build().await.unwrap();
10506///
10507/// # let client = hyper_util::client::legacy::Client::builder(
10508/// # hyper_util::rt::TokioExecutor::new()
10509/// # )
10510/// # .build(
10511/// # hyper_rustls::HttpsConnectorBuilder::new()
10512/// # .with_native_roots()
10513/// # .unwrap()
10514/// # .https_or_http()
10515/// # .enable_http2()
10516/// # .build()
10517/// # );
10518/// # let mut hub = Bigquery::new(client, auth);
10519/// // As the method needs a request, you would usually fill it with the desired information
10520/// // into the respective structure. Some of the parts shown here might not be applicable !
10521/// // Values shown here are possibly random and not representative !
10522/// let mut req = Dataset::default();
10523///
10524/// // You can configure optional parameters by calling the respective setters at will, and
10525/// // execute the final call using `doit()`.
10526/// // Values shown here are possibly random and not representative !
10527/// let result = hub.datasets().update(req, "projectId", "datasetId")
10528/// .update_mode("duo")
10529/// .access_policy_version(-80)
10530/// .doit().await;
10531/// # }
10532/// ```
10533pub struct DatasetUpdateCall<'a, C>
10534where
10535 C: 'a,
10536{
10537 hub: &'a Bigquery<C>,
10538 _request: Dataset,
10539 _project_id: String,
10540 _dataset_id: String,
10541 _update_mode: Option<String>,
10542 _access_policy_version: Option<i32>,
10543 _delegate: Option<&'a mut dyn common::Delegate>,
10544 _additional_params: HashMap<String, String>,
10545 _scopes: BTreeSet<String>,
10546}
10547
10548impl<'a, C> common::CallBuilder for DatasetUpdateCall<'a, C> {}
10549
10550impl<'a, C> DatasetUpdateCall<'a, C>
10551where
10552 C: common::Connector,
10553{
10554 /// Perform the operation you have build so far.
10555 pub async fn doit(mut self) -> common::Result<(common::Response, Dataset)> {
10556 use std::borrow::Cow;
10557 use std::io::{Read, Seek};
10558
10559 use common::{url::Params, ToParts};
10560 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
10561
10562 let mut dd = common::DefaultDelegate;
10563 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
10564 dlg.begin(common::MethodInfo {
10565 id: "bigquery.datasets.update",
10566 http_method: hyper::Method::PUT,
10567 });
10568
10569 for &field in [
10570 "alt",
10571 "projectId",
10572 "datasetId",
10573 "updateMode",
10574 "accessPolicyVersion",
10575 ]
10576 .iter()
10577 {
10578 if self._additional_params.contains_key(field) {
10579 dlg.finished(false);
10580 return Err(common::Error::FieldClash(field));
10581 }
10582 }
10583
10584 let mut params = Params::with_capacity(7 + self._additional_params.len());
10585 params.push("projectId", self._project_id);
10586 params.push("datasetId", self._dataset_id);
10587 if let Some(value) = self._update_mode.as_ref() {
10588 params.push("updateMode", value);
10589 }
10590 if let Some(value) = self._access_policy_version.as_ref() {
10591 params.push("accessPolicyVersion", value.to_string());
10592 }
10593
10594 params.extend(self._additional_params.iter());
10595
10596 params.push("alt", "json");
10597 let mut url = self.hub._base_url.clone() + "projects/{+projectId}/datasets/{+datasetId}";
10598 if self._scopes.is_empty() {
10599 self._scopes
10600 .insert(Scope::CloudPlatform.as_ref().to_string());
10601 }
10602
10603 #[allow(clippy::single_element_loop)]
10604 for &(find_this, param_name) in
10605 [("{+projectId}", "projectId"), ("{+datasetId}", "datasetId")].iter()
10606 {
10607 url = params.uri_replacement(url, param_name, find_this, true);
10608 }
10609 {
10610 let to_remove = ["datasetId", "projectId"];
10611 params.remove_params(&to_remove);
10612 }
10613
10614 let url = params.parse_with_url(&url);
10615
10616 let mut json_mime_type = mime::APPLICATION_JSON;
10617 let mut request_value_reader = {
10618 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
10619 common::remove_json_null_values(&mut value);
10620 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
10621 serde_json::to_writer(&mut dst, &value).unwrap();
10622 dst
10623 };
10624 let request_size = request_value_reader
10625 .seek(std::io::SeekFrom::End(0))
10626 .unwrap();
10627 request_value_reader
10628 .seek(std::io::SeekFrom::Start(0))
10629 .unwrap();
10630
10631 loop {
10632 let token = match self
10633 .hub
10634 .auth
10635 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
10636 .await
10637 {
10638 Ok(token) => token,
10639 Err(e) => match dlg.token(e) {
10640 Ok(token) => token,
10641 Err(e) => {
10642 dlg.finished(false);
10643 return Err(common::Error::MissingToken(e));
10644 }
10645 },
10646 };
10647 request_value_reader
10648 .seek(std::io::SeekFrom::Start(0))
10649 .unwrap();
10650 let mut req_result = {
10651 let client = &self.hub.client;
10652 dlg.pre_request();
10653 let mut req_builder = hyper::Request::builder()
10654 .method(hyper::Method::PUT)
10655 .uri(url.as_str())
10656 .header(USER_AGENT, self.hub._user_agent.clone());
10657
10658 if let Some(token) = token.as_ref() {
10659 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
10660 }
10661
10662 let request = req_builder
10663 .header(CONTENT_TYPE, json_mime_type.to_string())
10664 .header(CONTENT_LENGTH, request_size as u64)
10665 .body(common::to_body(
10666 request_value_reader.get_ref().clone().into(),
10667 ));
10668
10669 client.request(request.unwrap()).await
10670 };
10671
10672 match req_result {
10673 Err(err) => {
10674 if let common::Retry::After(d) = dlg.http_error(&err) {
10675 sleep(d).await;
10676 continue;
10677 }
10678 dlg.finished(false);
10679 return Err(common::Error::HttpError(err));
10680 }
10681 Ok(res) => {
10682 let (mut parts, body) = res.into_parts();
10683 let mut body = common::Body::new(body);
10684 if !parts.status.is_success() {
10685 let bytes = common::to_bytes(body).await.unwrap_or_default();
10686 let error = serde_json::from_str(&common::to_string(&bytes));
10687 let response = common::to_response(parts, bytes.into());
10688
10689 if let common::Retry::After(d) =
10690 dlg.http_failure(&response, error.as_ref().ok())
10691 {
10692 sleep(d).await;
10693 continue;
10694 }
10695
10696 dlg.finished(false);
10697
10698 return Err(match error {
10699 Ok(value) => common::Error::BadRequest(value),
10700 _ => common::Error::Failure(response),
10701 });
10702 }
10703 let response = {
10704 let bytes = common::to_bytes(body).await.unwrap_or_default();
10705 let encoded = common::to_string(&bytes);
10706 match serde_json::from_str(&encoded) {
10707 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
10708 Err(error) => {
10709 dlg.response_json_decode_error(&encoded, &error);
10710 return Err(common::Error::JsonDecodeError(
10711 encoded.to_string(),
10712 error,
10713 ));
10714 }
10715 }
10716 };
10717
10718 dlg.finished(true);
10719 return Ok(response);
10720 }
10721 }
10722 }
10723 }
10724
10725 ///
10726 /// Sets the *request* property to the given value.
10727 ///
10728 /// Even though the property as already been set when instantiating this call,
10729 /// we provide this method for API completeness.
10730 pub fn request(mut self, new_value: Dataset) -> DatasetUpdateCall<'a, C> {
10731 self._request = new_value;
10732 self
10733 }
10734 /// Required. Project ID of the dataset being updated
10735 ///
10736 /// Sets the *project id* path property to the given value.
10737 ///
10738 /// Even though the property as already been set when instantiating this call,
10739 /// we provide this method for API completeness.
10740 pub fn project_id(mut self, new_value: &str) -> DatasetUpdateCall<'a, C> {
10741 self._project_id = new_value.to_string();
10742 self
10743 }
10744 /// Required. Dataset ID of the dataset being updated
10745 ///
10746 /// Sets the *dataset id* path property to the given value.
10747 ///
10748 /// Even though the property as already been set when instantiating this call,
10749 /// we provide this method for API completeness.
10750 pub fn dataset_id(mut self, new_value: &str) -> DatasetUpdateCall<'a, C> {
10751 self._dataset_id = new_value.to_string();
10752 self
10753 }
10754 /// Optional. Specifies the fields of dataset that update/patch operation is targeting By default, both metadata and ACL fields are updated.
10755 ///
10756 /// Sets the *update mode* query property to the given value.
10757 pub fn update_mode(mut self, new_value: &str) -> DatasetUpdateCall<'a, C> {
10758 self._update_mode = Some(new_value.to_string());
10759 self
10760 }
10761 /// Optional. The version of the provided access policy schema. Valid values are 0, 1, and 3. Requests specifying an invalid value will be rejected. This version refers to the schema version of the access policy and not the version of access policy. This field's value can be equal or more than the access policy schema provided in the request. For example, * Operations updating conditional access policy binding in datasets must specify version 3. Some of the operations are : - Adding a new access policy entry with condition. - Removing an access policy entry with condition. - Updating an access policy entry with condition. * But dataset with no conditional role bindings in access policy may specify any valid value or leave the field unset. If unset or if 0 or 1 value is used for dataset with conditional bindings, request will be rejected. This field will be mapped to IAM Policy version (https://cloud.google.com/iam/docs/policies#versions) and will be used to set policy in IAM.
10762 ///
10763 /// Sets the *access policy version* query property to the given value.
10764 pub fn access_policy_version(mut self, new_value: i32) -> DatasetUpdateCall<'a, C> {
10765 self._access_policy_version = Some(new_value);
10766 self
10767 }
10768 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
10769 /// while executing the actual API request.
10770 ///
10771 /// ````text
10772 /// It should be used to handle progress information, and to implement a certain level of resilience.
10773 /// ````
10774 ///
10775 /// Sets the *delegate* property to the given value.
10776 pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> DatasetUpdateCall<'a, C> {
10777 self._delegate = Some(new_value);
10778 self
10779 }
10780
10781 /// Set any additional parameter of the query string used in the request.
10782 /// It should be used to set parameters which are not yet available through their own
10783 /// setters.
10784 ///
10785 /// Please note that this method must not be used to set any of the known parameters
10786 /// which have their own setter method. If done anyway, the request will fail.
10787 ///
10788 /// # Additional Parameters
10789 ///
10790 /// * *$.xgafv* (query-string) - V1 error format.
10791 /// * *access_token* (query-string) - OAuth access token.
10792 /// * *alt* (query-string) - Data format for response.
10793 /// * *callback* (query-string) - JSONP
10794 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
10795 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
10796 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
10797 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
10798 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
10799 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
10800 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
10801 pub fn param<T>(mut self, name: T, value: T) -> DatasetUpdateCall<'a, C>
10802 where
10803 T: AsRef<str>,
10804 {
10805 self._additional_params
10806 .insert(name.as_ref().to_string(), value.as_ref().to_string());
10807 self
10808 }
10809
10810 /// Identifies the authorization scope for the method you are building.
10811 ///
10812 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
10813 /// [`Scope::CloudPlatform`].
10814 ///
10815 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
10816 /// tokens for more than one scope.
10817 ///
10818 /// Usually there is more than one suitable scope to authorize an operation, some of which may
10819 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
10820 /// sufficient, a read-write scope will do as well.
10821 pub fn add_scope<St>(mut self, scope: St) -> DatasetUpdateCall<'a, C>
10822 where
10823 St: AsRef<str>,
10824 {
10825 self._scopes.insert(String::from(scope.as_ref()));
10826 self
10827 }
10828 /// Identifies the authorization scope(s) for the method you are building.
10829 ///
10830 /// See [`Self::add_scope()`] for details.
10831 pub fn add_scopes<I, St>(mut self, scopes: I) -> DatasetUpdateCall<'a, C>
10832 where
10833 I: IntoIterator<Item = St>,
10834 St: AsRef<str>,
10835 {
10836 self._scopes
10837 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
10838 self
10839 }
10840
10841 /// Removes all scopes, and no default scope will be used either.
10842 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
10843 /// for details).
10844 pub fn clear_scopes(mut self) -> DatasetUpdateCall<'a, C> {
10845 self._scopes.clear();
10846 self
10847 }
10848}
10849
10850/// Requests that a job be cancelled. This call will return immediately, and the client will need to poll for the job status to see if the cancel completed successfully. Cancelled jobs may still incur costs.
10851///
10852/// A builder for the *cancel* method supported by a *job* resource.
10853/// It is not used directly, but through a [`JobMethods`] instance.
10854///
10855/// # Example
10856///
10857/// Instantiate a resource method builder
10858///
10859/// ```test_harness,no_run
10860/// # extern crate hyper;
10861/// # extern crate hyper_rustls;
10862/// # extern crate google_bigquery2 as bigquery2;
10863/// # async fn dox() {
10864/// # use bigquery2::{Bigquery, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
10865///
10866/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
10867/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
10868/// # .with_native_roots()
10869/// # .unwrap()
10870/// # .https_only()
10871/// # .enable_http2()
10872/// # .build();
10873///
10874/// # let executor = hyper_util::rt::TokioExecutor::new();
10875/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
10876/// # secret,
10877/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
10878/// # yup_oauth2::client::CustomHyperClientBuilder::from(
10879/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
10880/// # ),
10881/// # ).build().await.unwrap();
10882///
10883/// # let client = hyper_util::client::legacy::Client::builder(
10884/// # hyper_util::rt::TokioExecutor::new()
10885/// # )
10886/// # .build(
10887/// # hyper_rustls::HttpsConnectorBuilder::new()
10888/// # .with_native_roots()
10889/// # .unwrap()
10890/// # .https_or_http()
10891/// # .enable_http2()
10892/// # .build()
10893/// # );
10894/// # let mut hub = Bigquery::new(client, auth);
10895/// // You can configure optional parameters by calling the respective setters at will, and
10896/// // execute the final call using `doit()`.
10897/// // Values shown here are possibly random and not representative !
10898/// let result = hub.jobs().cancel("projectId", "jobId")
10899/// .location("kasd")
10900/// .doit().await;
10901/// # }
10902/// ```
10903pub struct JobCancelCall<'a, C>
10904where
10905 C: 'a,
10906{
10907 hub: &'a Bigquery<C>,
10908 _project_id: String,
10909 _job_id: String,
10910 _location: Option<String>,
10911 _delegate: Option<&'a mut dyn common::Delegate>,
10912 _additional_params: HashMap<String, String>,
10913 _scopes: BTreeSet<String>,
10914}
10915
10916impl<'a, C> common::CallBuilder for JobCancelCall<'a, C> {}
10917
10918impl<'a, C> JobCancelCall<'a, C>
10919where
10920 C: common::Connector,
10921{
10922 /// Perform the operation you have build so far.
10923 pub async fn doit(mut self) -> common::Result<(common::Response, JobCancelResponse)> {
10924 use std::borrow::Cow;
10925 use std::io::{Read, Seek};
10926
10927 use common::{url::Params, ToParts};
10928 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
10929
10930 let mut dd = common::DefaultDelegate;
10931 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
10932 dlg.begin(common::MethodInfo {
10933 id: "bigquery.jobs.cancel",
10934 http_method: hyper::Method::POST,
10935 });
10936
10937 for &field in ["alt", "projectId", "jobId", "location"].iter() {
10938 if self._additional_params.contains_key(field) {
10939 dlg.finished(false);
10940 return Err(common::Error::FieldClash(field));
10941 }
10942 }
10943
10944 let mut params = Params::with_capacity(5 + self._additional_params.len());
10945 params.push("projectId", self._project_id);
10946 params.push("jobId", self._job_id);
10947 if let Some(value) = self._location.as_ref() {
10948 params.push("location", value);
10949 }
10950
10951 params.extend(self._additional_params.iter());
10952
10953 params.push("alt", "json");
10954 let mut url = self.hub._base_url.clone() + "projects/{+projectId}/jobs/{+jobId}/cancel";
10955 if self._scopes.is_empty() {
10956 self._scopes
10957 .insert(Scope::CloudPlatform.as_ref().to_string());
10958 }
10959
10960 #[allow(clippy::single_element_loop)]
10961 for &(find_this, param_name) in
10962 [("{+projectId}", "projectId"), ("{+jobId}", "jobId")].iter()
10963 {
10964 url = params.uri_replacement(url, param_name, find_this, true);
10965 }
10966 {
10967 let to_remove = ["jobId", "projectId"];
10968 params.remove_params(&to_remove);
10969 }
10970
10971 let url = params.parse_with_url(&url);
10972
10973 loop {
10974 let token = match self
10975 .hub
10976 .auth
10977 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
10978 .await
10979 {
10980 Ok(token) => token,
10981 Err(e) => match dlg.token(e) {
10982 Ok(token) => token,
10983 Err(e) => {
10984 dlg.finished(false);
10985 return Err(common::Error::MissingToken(e));
10986 }
10987 },
10988 };
10989 let mut req_result = {
10990 let client = &self.hub.client;
10991 dlg.pre_request();
10992 let mut req_builder = hyper::Request::builder()
10993 .method(hyper::Method::POST)
10994 .uri(url.as_str())
10995 .header(USER_AGENT, self.hub._user_agent.clone());
10996
10997 if let Some(token) = token.as_ref() {
10998 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
10999 }
11000
11001 let request = req_builder
11002 .header(CONTENT_LENGTH, 0_u64)
11003 .body(common::to_body::<String>(None));
11004
11005 client.request(request.unwrap()).await
11006 };
11007
11008 match req_result {
11009 Err(err) => {
11010 if let common::Retry::After(d) = dlg.http_error(&err) {
11011 sleep(d).await;
11012 continue;
11013 }
11014 dlg.finished(false);
11015 return Err(common::Error::HttpError(err));
11016 }
11017 Ok(res) => {
11018 let (mut parts, body) = res.into_parts();
11019 let mut body = common::Body::new(body);
11020 if !parts.status.is_success() {
11021 let bytes = common::to_bytes(body).await.unwrap_or_default();
11022 let error = serde_json::from_str(&common::to_string(&bytes));
11023 let response = common::to_response(parts, bytes.into());
11024
11025 if let common::Retry::After(d) =
11026 dlg.http_failure(&response, error.as_ref().ok())
11027 {
11028 sleep(d).await;
11029 continue;
11030 }
11031
11032 dlg.finished(false);
11033
11034 return Err(match error {
11035 Ok(value) => common::Error::BadRequest(value),
11036 _ => common::Error::Failure(response),
11037 });
11038 }
11039 let response = {
11040 let bytes = common::to_bytes(body).await.unwrap_or_default();
11041 let encoded = common::to_string(&bytes);
11042 match serde_json::from_str(&encoded) {
11043 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
11044 Err(error) => {
11045 dlg.response_json_decode_error(&encoded, &error);
11046 return Err(common::Error::JsonDecodeError(
11047 encoded.to_string(),
11048 error,
11049 ));
11050 }
11051 }
11052 };
11053
11054 dlg.finished(true);
11055 return Ok(response);
11056 }
11057 }
11058 }
11059 }
11060
11061 /// Required. Project ID of the job to cancel
11062 ///
11063 /// Sets the *project id* path property to the given value.
11064 ///
11065 /// Even though the property as already been set when instantiating this call,
11066 /// we provide this method for API completeness.
11067 pub fn project_id(mut self, new_value: &str) -> JobCancelCall<'a, C> {
11068 self._project_id = new_value.to_string();
11069 self
11070 }
11071 /// Required. Job ID of the job to cancel
11072 ///
11073 /// Sets the *job id* path property to the given value.
11074 ///
11075 /// Even though the property as already been set when instantiating this call,
11076 /// we provide this method for API completeness.
11077 pub fn job_id(mut self, new_value: &str) -> JobCancelCall<'a, C> {
11078 self._job_id = new_value.to_string();
11079 self
11080 }
11081 /// The geographic location of the job. You must [specify the location](https://cloud.google.com/bigquery/docs/locations#specify_locations) to run the job for the following scenarios: * If the location to run a job is not in the `us` or the `eu` multi-regional location * If the job's location is in a single region (for example, `us-central1`)
11082 ///
11083 /// Sets the *location* query property to the given value.
11084 pub fn location(mut self, new_value: &str) -> JobCancelCall<'a, C> {
11085 self._location = Some(new_value.to_string());
11086 self
11087 }
11088 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
11089 /// while executing the actual API request.
11090 ///
11091 /// ````text
11092 /// It should be used to handle progress information, and to implement a certain level of resilience.
11093 /// ````
11094 ///
11095 /// Sets the *delegate* property to the given value.
11096 pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> JobCancelCall<'a, C> {
11097 self._delegate = Some(new_value);
11098 self
11099 }
11100
11101 /// Set any additional parameter of the query string used in the request.
11102 /// It should be used to set parameters which are not yet available through their own
11103 /// setters.
11104 ///
11105 /// Please note that this method must not be used to set any of the known parameters
11106 /// which have their own setter method. If done anyway, the request will fail.
11107 ///
11108 /// # Additional Parameters
11109 ///
11110 /// * *$.xgafv* (query-string) - V1 error format.
11111 /// * *access_token* (query-string) - OAuth access token.
11112 /// * *alt* (query-string) - Data format for response.
11113 /// * *callback* (query-string) - JSONP
11114 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
11115 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
11116 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
11117 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
11118 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
11119 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
11120 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
11121 pub fn param<T>(mut self, name: T, value: T) -> JobCancelCall<'a, C>
11122 where
11123 T: AsRef<str>,
11124 {
11125 self._additional_params
11126 .insert(name.as_ref().to_string(), value.as_ref().to_string());
11127 self
11128 }
11129
11130 /// Identifies the authorization scope for the method you are building.
11131 ///
11132 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
11133 /// [`Scope::CloudPlatform`].
11134 ///
11135 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
11136 /// tokens for more than one scope.
11137 ///
11138 /// Usually there is more than one suitable scope to authorize an operation, some of which may
11139 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
11140 /// sufficient, a read-write scope will do as well.
11141 pub fn add_scope<St>(mut self, scope: St) -> JobCancelCall<'a, C>
11142 where
11143 St: AsRef<str>,
11144 {
11145 self._scopes.insert(String::from(scope.as_ref()));
11146 self
11147 }
11148 /// Identifies the authorization scope(s) for the method you are building.
11149 ///
11150 /// See [`Self::add_scope()`] for details.
11151 pub fn add_scopes<I, St>(mut self, scopes: I) -> JobCancelCall<'a, C>
11152 where
11153 I: IntoIterator<Item = St>,
11154 St: AsRef<str>,
11155 {
11156 self._scopes
11157 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
11158 self
11159 }
11160
11161 /// Removes all scopes, and no default scope will be used either.
11162 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
11163 /// for details).
11164 pub fn clear_scopes(mut self) -> JobCancelCall<'a, C> {
11165 self._scopes.clear();
11166 self
11167 }
11168}
11169
11170/// Requests the deletion of the metadata of a job. This call returns when the job's metadata is deleted.
11171///
11172/// A builder for the *delete* method supported by a *job* resource.
11173/// It is not used directly, but through a [`JobMethods`] instance.
11174///
11175/// # Example
11176///
11177/// Instantiate a resource method builder
11178///
11179/// ```test_harness,no_run
11180/// # extern crate hyper;
11181/// # extern crate hyper_rustls;
11182/// # extern crate google_bigquery2 as bigquery2;
11183/// # async fn dox() {
11184/// # use bigquery2::{Bigquery, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
11185///
11186/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
11187/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
11188/// # .with_native_roots()
11189/// # .unwrap()
11190/// # .https_only()
11191/// # .enable_http2()
11192/// # .build();
11193///
11194/// # let executor = hyper_util::rt::TokioExecutor::new();
11195/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
11196/// # secret,
11197/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
11198/// # yup_oauth2::client::CustomHyperClientBuilder::from(
11199/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
11200/// # ),
11201/// # ).build().await.unwrap();
11202///
11203/// # let client = hyper_util::client::legacy::Client::builder(
11204/// # hyper_util::rt::TokioExecutor::new()
11205/// # )
11206/// # .build(
11207/// # hyper_rustls::HttpsConnectorBuilder::new()
11208/// # .with_native_roots()
11209/// # .unwrap()
11210/// # .https_or_http()
11211/// # .enable_http2()
11212/// # .build()
11213/// # );
11214/// # let mut hub = Bigquery::new(client, auth);
11215/// // You can configure optional parameters by calling the respective setters at will, and
11216/// // execute the final call using `doit()`.
11217/// // Values shown here are possibly random and not representative !
11218/// let result = hub.jobs().delete("projectId", "jobId")
11219/// .location("et")
11220/// .doit().await;
11221/// # }
11222/// ```
11223pub struct JobDeleteCall<'a, C>
11224where
11225 C: 'a,
11226{
11227 hub: &'a Bigquery<C>,
11228 _project_id: String,
11229 _job_id: String,
11230 _location: Option<String>,
11231 _delegate: Option<&'a mut dyn common::Delegate>,
11232 _additional_params: HashMap<String, String>,
11233 _scopes: BTreeSet<String>,
11234}
11235
11236impl<'a, C> common::CallBuilder for JobDeleteCall<'a, C> {}
11237
11238impl<'a, C> JobDeleteCall<'a, C>
11239where
11240 C: common::Connector,
11241{
11242 /// Perform the operation you have build so far.
11243 pub async fn doit(mut self) -> common::Result<common::Response> {
11244 use std::borrow::Cow;
11245 use std::io::{Read, Seek};
11246
11247 use common::{url::Params, ToParts};
11248 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
11249
11250 let mut dd = common::DefaultDelegate;
11251 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
11252 dlg.begin(common::MethodInfo {
11253 id: "bigquery.jobs.delete",
11254 http_method: hyper::Method::DELETE,
11255 });
11256
11257 for &field in ["projectId", "jobId", "location"].iter() {
11258 if self._additional_params.contains_key(field) {
11259 dlg.finished(false);
11260 return Err(common::Error::FieldClash(field));
11261 }
11262 }
11263
11264 let mut params = Params::with_capacity(4 + self._additional_params.len());
11265 params.push("projectId", self._project_id);
11266 params.push("jobId", self._job_id);
11267 if let Some(value) = self._location.as_ref() {
11268 params.push("location", value);
11269 }
11270
11271 params.extend(self._additional_params.iter());
11272
11273 let mut url = self.hub._base_url.clone() + "projects/{+projectId}/jobs/{+jobId}/delete";
11274 if self._scopes.is_empty() {
11275 self._scopes
11276 .insert(Scope::CloudPlatform.as_ref().to_string());
11277 }
11278
11279 #[allow(clippy::single_element_loop)]
11280 for &(find_this, param_name) in
11281 [("{+projectId}", "projectId"), ("{+jobId}", "jobId")].iter()
11282 {
11283 url = params.uri_replacement(url, param_name, find_this, true);
11284 }
11285 {
11286 let to_remove = ["jobId", "projectId"];
11287 params.remove_params(&to_remove);
11288 }
11289
11290 let url = params.parse_with_url(&url);
11291
11292 loop {
11293 let token = match self
11294 .hub
11295 .auth
11296 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
11297 .await
11298 {
11299 Ok(token) => token,
11300 Err(e) => match dlg.token(e) {
11301 Ok(token) => token,
11302 Err(e) => {
11303 dlg.finished(false);
11304 return Err(common::Error::MissingToken(e));
11305 }
11306 },
11307 };
11308 let mut req_result = {
11309 let client = &self.hub.client;
11310 dlg.pre_request();
11311 let mut req_builder = hyper::Request::builder()
11312 .method(hyper::Method::DELETE)
11313 .uri(url.as_str())
11314 .header(USER_AGENT, self.hub._user_agent.clone());
11315
11316 if let Some(token) = token.as_ref() {
11317 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
11318 }
11319
11320 let request = req_builder
11321 .header(CONTENT_LENGTH, 0_u64)
11322 .body(common::to_body::<String>(None));
11323
11324 client.request(request.unwrap()).await
11325 };
11326
11327 match req_result {
11328 Err(err) => {
11329 if let common::Retry::After(d) = dlg.http_error(&err) {
11330 sleep(d).await;
11331 continue;
11332 }
11333 dlg.finished(false);
11334 return Err(common::Error::HttpError(err));
11335 }
11336 Ok(res) => {
11337 let (mut parts, body) = res.into_parts();
11338 let mut body = common::Body::new(body);
11339 if !parts.status.is_success() {
11340 let bytes = common::to_bytes(body).await.unwrap_or_default();
11341 let error = serde_json::from_str(&common::to_string(&bytes));
11342 let response = common::to_response(parts, bytes.into());
11343
11344 if let common::Retry::After(d) =
11345 dlg.http_failure(&response, error.as_ref().ok())
11346 {
11347 sleep(d).await;
11348 continue;
11349 }
11350
11351 dlg.finished(false);
11352
11353 return Err(match error {
11354 Ok(value) => common::Error::BadRequest(value),
11355 _ => common::Error::Failure(response),
11356 });
11357 }
11358 let response = common::Response::from_parts(parts, body);
11359
11360 dlg.finished(true);
11361 return Ok(response);
11362 }
11363 }
11364 }
11365 }
11366
11367 /// Required. Project ID of the job for which metadata is to be deleted.
11368 ///
11369 /// Sets the *project id* path property to the given value.
11370 ///
11371 /// Even though the property as already been set when instantiating this call,
11372 /// we provide this method for API completeness.
11373 pub fn project_id(mut self, new_value: &str) -> JobDeleteCall<'a, C> {
11374 self._project_id = new_value.to_string();
11375 self
11376 }
11377 /// Required. Job ID of the job for which metadata is to be deleted. If this is a parent job which has child jobs, the metadata from all child jobs will be deleted as well. Direct deletion of the metadata of child jobs is not allowed.
11378 ///
11379 /// Sets the *job id* path property to the given value.
11380 ///
11381 /// Even though the property as already been set when instantiating this call,
11382 /// we provide this method for API completeness.
11383 pub fn job_id(mut self, new_value: &str) -> JobDeleteCall<'a, C> {
11384 self._job_id = new_value.to_string();
11385 self
11386 }
11387 /// The geographic location of the job. Required. For more information, see how to [specify locations](https://cloud.google.com/bigquery/docs/locations#specify_locations).
11388 ///
11389 /// Sets the *location* query property to the given value.
11390 pub fn location(mut self, new_value: &str) -> JobDeleteCall<'a, C> {
11391 self._location = Some(new_value.to_string());
11392 self
11393 }
11394 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
11395 /// while executing the actual API request.
11396 ///
11397 /// ````text
11398 /// It should be used to handle progress information, and to implement a certain level of resilience.
11399 /// ````
11400 ///
11401 /// Sets the *delegate* property to the given value.
11402 pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> JobDeleteCall<'a, C> {
11403 self._delegate = Some(new_value);
11404 self
11405 }
11406
11407 /// Set any additional parameter of the query string used in the request.
11408 /// It should be used to set parameters which are not yet available through their own
11409 /// setters.
11410 ///
11411 /// Please note that this method must not be used to set any of the known parameters
11412 /// which have their own setter method. If done anyway, the request will fail.
11413 ///
11414 /// # Additional Parameters
11415 ///
11416 /// * *$.xgafv* (query-string) - V1 error format.
11417 /// * *access_token* (query-string) - OAuth access token.
11418 /// * *alt* (query-string) - Data format for response.
11419 /// * *callback* (query-string) - JSONP
11420 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
11421 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
11422 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
11423 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
11424 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
11425 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
11426 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
11427 pub fn param<T>(mut self, name: T, value: T) -> JobDeleteCall<'a, C>
11428 where
11429 T: AsRef<str>,
11430 {
11431 self._additional_params
11432 .insert(name.as_ref().to_string(), value.as_ref().to_string());
11433 self
11434 }
11435
11436 /// Identifies the authorization scope for the method you are building.
11437 ///
11438 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
11439 /// [`Scope::CloudPlatform`].
11440 ///
11441 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
11442 /// tokens for more than one scope.
11443 ///
11444 /// Usually there is more than one suitable scope to authorize an operation, some of which may
11445 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
11446 /// sufficient, a read-write scope will do as well.
11447 pub fn add_scope<St>(mut self, scope: St) -> JobDeleteCall<'a, C>
11448 where
11449 St: AsRef<str>,
11450 {
11451 self._scopes.insert(String::from(scope.as_ref()));
11452 self
11453 }
11454 /// Identifies the authorization scope(s) for the method you are building.
11455 ///
11456 /// See [`Self::add_scope()`] for details.
11457 pub fn add_scopes<I, St>(mut self, scopes: I) -> JobDeleteCall<'a, C>
11458 where
11459 I: IntoIterator<Item = St>,
11460 St: AsRef<str>,
11461 {
11462 self._scopes
11463 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
11464 self
11465 }
11466
11467 /// Removes all scopes, and no default scope will be used either.
11468 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
11469 /// for details).
11470 pub fn clear_scopes(mut self) -> JobDeleteCall<'a, C> {
11471 self._scopes.clear();
11472 self
11473 }
11474}
11475
11476/// Returns information about a specific job. Job information is available for a six month period after creation. Requires that you're the person who ran the job, or have the Is Owner project role.
11477///
11478/// A builder for the *get* method supported by a *job* resource.
11479/// It is not used directly, but through a [`JobMethods`] instance.
11480///
11481/// # Example
11482///
11483/// Instantiate a resource method builder
11484///
11485/// ```test_harness,no_run
11486/// # extern crate hyper;
11487/// # extern crate hyper_rustls;
11488/// # extern crate google_bigquery2 as bigquery2;
11489/// # async fn dox() {
11490/// # use bigquery2::{Bigquery, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
11491///
11492/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
11493/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
11494/// # .with_native_roots()
11495/// # .unwrap()
11496/// # .https_only()
11497/// # .enable_http2()
11498/// # .build();
11499///
11500/// # let executor = hyper_util::rt::TokioExecutor::new();
11501/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
11502/// # secret,
11503/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
11504/// # yup_oauth2::client::CustomHyperClientBuilder::from(
11505/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
11506/// # ),
11507/// # ).build().await.unwrap();
11508///
11509/// # let client = hyper_util::client::legacy::Client::builder(
11510/// # hyper_util::rt::TokioExecutor::new()
11511/// # )
11512/// # .build(
11513/// # hyper_rustls::HttpsConnectorBuilder::new()
11514/// # .with_native_roots()
11515/// # .unwrap()
11516/// # .https_or_http()
11517/// # .enable_http2()
11518/// # .build()
11519/// # );
11520/// # let mut hub = Bigquery::new(client, auth);
11521/// // You can configure optional parameters by calling the respective setters at will, and
11522/// // execute the final call using `doit()`.
11523/// // Values shown here are possibly random and not representative !
11524/// let result = hub.jobs().get("projectId", "jobId")
11525/// .location("erat")
11526/// .doit().await;
11527/// # }
11528/// ```
11529pub struct JobGetCall<'a, C>
11530where
11531 C: 'a,
11532{
11533 hub: &'a Bigquery<C>,
11534 _project_id: String,
11535 _job_id: String,
11536 _location: Option<String>,
11537 _delegate: Option<&'a mut dyn common::Delegate>,
11538 _additional_params: HashMap<String, String>,
11539 _scopes: BTreeSet<String>,
11540}
11541
11542impl<'a, C> common::CallBuilder for JobGetCall<'a, C> {}
11543
11544impl<'a, C> JobGetCall<'a, C>
11545where
11546 C: common::Connector,
11547{
11548 /// Perform the operation you have build so far.
11549 pub async fn doit(mut self) -> common::Result<(common::Response, Job)> {
11550 use std::borrow::Cow;
11551 use std::io::{Read, Seek};
11552
11553 use common::{url::Params, ToParts};
11554 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
11555
11556 let mut dd = common::DefaultDelegate;
11557 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
11558 dlg.begin(common::MethodInfo {
11559 id: "bigquery.jobs.get",
11560 http_method: hyper::Method::GET,
11561 });
11562
11563 for &field in ["alt", "projectId", "jobId", "location"].iter() {
11564 if self._additional_params.contains_key(field) {
11565 dlg.finished(false);
11566 return Err(common::Error::FieldClash(field));
11567 }
11568 }
11569
11570 let mut params = Params::with_capacity(5 + self._additional_params.len());
11571 params.push("projectId", self._project_id);
11572 params.push("jobId", self._job_id);
11573 if let Some(value) = self._location.as_ref() {
11574 params.push("location", value);
11575 }
11576
11577 params.extend(self._additional_params.iter());
11578
11579 params.push("alt", "json");
11580 let mut url = self.hub._base_url.clone() + "projects/{+projectId}/jobs/{+jobId}";
11581 if self._scopes.is_empty() {
11582 self._scopes
11583 .insert(Scope::CloudPlatformReadOnly.as_ref().to_string());
11584 }
11585
11586 #[allow(clippy::single_element_loop)]
11587 for &(find_this, param_name) in
11588 [("{+projectId}", "projectId"), ("{+jobId}", "jobId")].iter()
11589 {
11590 url = params.uri_replacement(url, param_name, find_this, true);
11591 }
11592 {
11593 let to_remove = ["jobId", "projectId"];
11594 params.remove_params(&to_remove);
11595 }
11596
11597 let url = params.parse_with_url(&url);
11598
11599 loop {
11600 let token = match self
11601 .hub
11602 .auth
11603 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
11604 .await
11605 {
11606 Ok(token) => token,
11607 Err(e) => match dlg.token(e) {
11608 Ok(token) => token,
11609 Err(e) => {
11610 dlg.finished(false);
11611 return Err(common::Error::MissingToken(e));
11612 }
11613 },
11614 };
11615 let mut req_result = {
11616 let client = &self.hub.client;
11617 dlg.pre_request();
11618 let mut req_builder = hyper::Request::builder()
11619 .method(hyper::Method::GET)
11620 .uri(url.as_str())
11621 .header(USER_AGENT, self.hub._user_agent.clone());
11622
11623 if let Some(token) = token.as_ref() {
11624 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
11625 }
11626
11627 let request = req_builder
11628 .header(CONTENT_LENGTH, 0_u64)
11629 .body(common::to_body::<String>(None));
11630
11631 client.request(request.unwrap()).await
11632 };
11633
11634 match req_result {
11635 Err(err) => {
11636 if let common::Retry::After(d) = dlg.http_error(&err) {
11637 sleep(d).await;
11638 continue;
11639 }
11640 dlg.finished(false);
11641 return Err(common::Error::HttpError(err));
11642 }
11643 Ok(res) => {
11644 let (mut parts, body) = res.into_parts();
11645 let mut body = common::Body::new(body);
11646 if !parts.status.is_success() {
11647 let bytes = common::to_bytes(body).await.unwrap_or_default();
11648 let error = serde_json::from_str(&common::to_string(&bytes));
11649 let response = common::to_response(parts, bytes.into());
11650
11651 if let common::Retry::After(d) =
11652 dlg.http_failure(&response, error.as_ref().ok())
11653 {
11654 sleep(d).await;
11655 continue;
11656 }
11657
11658 dlg.finished(false);
11659
11660 return Err(match error {
11661 Ok(value) => common::Error::BadRequest(value),
11662 _ => common::Error::Failure(response),
11663 });
11664 }
11665 let response = {
11666 let bytes = common::to_bytes(body).await.unwrap_or_default();
11667 let encoded = common::to_string(&bytes);
11668 match serde_json::from_str(&encoded) {
11669 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
11670 Err(error) => {
11671 dlg.response_json_decode_error(&encoded, &error);
11672 return Err(common::Error::JsonDecodeError(
11673 encoded.to_string(),
11674 error,
11675 ));
11676 }
11677 }
11678 };
11679
11680 dlg.finished(true);
11681 return Ok(response);
11682 }
11683 }
11684 }
11685 }
11686
11687 /// Required. Project ID of the requested job.
11688 ///
11689 /// Sets the *project id* path property to the given value.
11690 ///
11691 /// Even though the property as already been set when instantiating this call,
11692 /// we provide this method for API completeness.
11693 pub fn project_id(mut self, new_value: &str) -> JobGetCall<'a, C> {
11694 self._project_id = new_value.to_string();
11695 self
11696 }
11697 /// Required. Job ID of the requested job.
11698 ///
11699 /// Sets the *job id* path property to the given value.
11700 ///
11701 /// Even though the property as already been set when instantiating this call,
11702 /// we provide this method for API completeness.
11703 pub fn job_id(mut self, new_value: &str) -> JobGetCall<'a, C> {
11704 self._job_id = new_value.to_string();
11705 self
11706 }
11707 /// The geographic location of the job. You must specify the location to run the job for the following scenarios: * If the location to run a job is not in the `us` or the `eu` multi-regional location * If the job's location is in a single region (for example, `us-central1`) For more information, see how to [specify locations](https://cloud.google.com/bigquery/docs/locations#specify_locations).
11708 ///
11709 /// Sets the *location* query property to the given value.
11710 pub fn location(mut self, new_value: &str) -> JobGetCall<'a, C> {
11711 self._location = Some(new_value.to_string());
11712 self
11713 }
11714 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
11715 /// while executing the actual API request.
11716 ///
11717 /// ````text
11718 /// It should be used to handle progress information, and to implement a certain level of resilience.
11719 /// ````
11720 ///
11721 /// Sets the *delegate* property to the given value.
11722 pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> JobGetCall<'a, C> {
11723 self._delegate = Some(new_value);
11724 self
11725 }
11726
11727 /// Set any additional parameter of the query string used in the request.
11728 /// It should be used to set parameters which are not yet available through their own
11729 /// setters.
11730 ///
11731 /// Please note that this method must not be used to set any of the known parameters
11732 /// which have their own setter method. If done anyway, the request will fail.
11733 ///
11734 /// # Additional Parameters
11735 ///
11736 /// * *$.xgafv* (query-string) - V1 error format.
11737 /// * *access_token* (query-string) - OAuth access token.
11738 /// * *alt* (query-string) - Data format for response.
11739 /// * *callback* (query-string) - JSONP
11740 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
11741 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
11742 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
11743 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
11744 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
11745 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
11746 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
11747 pub fn param<T>(mut self, name: T, value: T) -> JobGetCall<'a, C>
11748 where
11749 T: AsRef<str>,
11750 {
11751 self._additional_params
11752 .insert(name.as_ref().to_string(), value.as_ref().to_string());
11753 self
11754 }
11755
11756 /// Identifies the authorization scope for the method you are building.
11757 ///
11758 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
11759 /// [`Scope::CloudPlatformReadOnly`].
11760 ///
11761 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
11762 /// tokens for more than one scope.
11763 ///
11764 /// Usually there is more than one suitable scope to authorize an operation, some of which may
11765 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
11766 /// sufficient, a read-write scope will do as well.
11767 pub fn add_scope<St>(mut self, scope: St) -> JobGetCall<'a, C>
11768 where
11769 St: AsRef<str>,
11770 {
11771 self._scopes.insert(String::from(scope.as_ref()));
11772 self
11773 }
11774 /// Identifies the authorization scope(s) for the method you are building.
11775 ///
11776 /// See [`Self::add_scope()`] for details.
11777 pub fn add_scopes<I, St>(mut self, scopes: I) -> JobGetCall<'a, C>
11778 where
11779 I: IntoIterator<Item = St>,
11780 St: AsRef<str>,
11781 {
11782 self._scopes
11783 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
11784 self
11785 }
11786
11787 /// Removes all scopes, and no default scope will be used either.
11788 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
11789 /// for details).
11790 pub fn clear_scopes(mut self) -> JobGetCall<'a, C> {
11791 self._scopes.clear();
11792 self
11793 }
11794}
11795
11796/// RPC to get the results of a query job.
11797///
11798/// A builder for the *getQueryResults* method supported by a *job* resource.
11799/// It is not used directly, but through a [`JobMethods`] instance.
11800///
11801/// # Example
11802///
11803/// Instantiate a resource method builder
11804///
11805/// ```test_harness,no_run
11806/// # extern crate hyper;
11807/// # extern crate hyper_rustls;
11808/// # extern crate google_bigquery2 as bigquery2;
11809/// # async fn dox() {
11810/// # use bigquery2::{Bigquery, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
11811///
11812/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
11813/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
11814/// # .with_native_roots()
11815/// # .unwrap()
11816/// # .https_only()
11817/// # .enable_http2()
11818/// # .build();
11819///
11820/// # let executor = hyper_util::rt::TokioExecutor::new();
11821/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
11822/// # secret,
11823/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
11824/// # yup_oauth2::client::CustomHyperClientBuilder::from(
11825/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
11826/// # ),
11827/// # ).build().await.unwrap();
11828///
11829/// # let client = hyper_util::client::legacy::Client::builder(
11830/// # hyper_util::rt::TokioExecutor::new()
11831/// # )
11832/// # .build(
11833/// # hyper_rustls::HttpsConnectorBuilder::new()
11834/// # .with_native_roots()
11835/// # .unwrap()
11836/// # .https_or_http()
11837/// # .enable_http2()
11838/// # .build()
11839/// # );
11840/// # let mut hub = Bigquery::new(client, auth);
11841/// // You can configure optional parameters by calling the respective setters at will, and
11842/// // execute the final call using `doit()`.
11843/// // Values shown here are possibly random and not representative !
11844/// let result = hub.jobs().get_query_results("projectId", "jobId")
11845/// .timeout_ms(67)
11846/// .start_index(79)
11847/// .page_token("voluptua.")
11848/// .max_results(99)
11849/// .location("consetetur")
11850/// .format_options_use_int64_timestamp(false)
11851/// .format_options_timestamp_output_format("dolor")
11852/// .doit().await;
11853/// # }
11854/// ```
11855pub struct JobGetQueryResultCall<'a, C>
11856where
11857 C: 'a,
11858{
11859 hub: &'a Bigquery<C>,
11860 _project_id: String,
11861 _job_id: String,
11862 _timeout_ms: Option<u32>,
11863 _start_index: Option<u64>,
11864 _page_token: Option<String>,
11865 _max_results: Option<u32>,
11866 _location: Option<String>,
11867 _format_options_use_int64_timestamp: Option<bool>,
11868 _format_options_timestamp_output_format: Option<String>,
11869 _delegate: Option<&'a mut dyn common::Delegate>,
11870 _additional_params: HashMap<String, String>,
11871 _scopes: BTreeSet<String>,
11872}
11873
11874impl<'a, C> common::CallBuilder for JobGetQueryResultCall<'a, C> {}
11875
11876impl<'a, C> JobGetQueryResultCall<'a, C>
11877where
11878 C: common::Connector,
11879{
11880 /// Perform the operation you have build so far.
11881 pub async fn doit(mut self) -> common::Result<(common::Response, GetQueryResultsResponse)> {
11882 use std::borrow::Cow;
11883 use std::io::{Read, Seek};
11884
11885 use common::{url::Params, ToParts};
11886 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
11887
11888 let mut dd = common::DefaultDelegate;
11889 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
11890 dlg.begin(common::MethodInfo {
11891 id: "bigquery.jobs.getQueryResults",
11892 http_method: hyper::Method::GET,
11893 });
11894
11895 for &field in [
11896 "alt",
11897 "projectId",
11898 "jobId",
11899 "timeoutMs",
11900 "startIndex",
11901 "pageToken",
11902 "maxResults",
11903 "location",
11904 "formatOptions.useInt64Timestamp",
11905 "formatOptions.timestampOutputFormat",
11906 ]
11907 .iter()
11908 {
11909 if self._additional_params.contains_key(field) {
11910 dlg.finished(false);
11911 return Err(common::Error::FieldClash(field));
11912 }
11913 }
11914
11915 let mut params = Params::with_capacity(11 + self._additional_params.len());
11916 params.push("projectId", self._project_id);
11917 params.push("jobId", self._job_id);
11918 if let Some(value) = self._timeout_ms.as_ref() {
11919 params.push("timeoutMs", value.to_string());
11920 }
11921 if let Some(value) = self._start_index.as_ref() {
11922 params.push("startIndex", value.to_string());
11923 }
11924 if let Some(value) = self._page_token.as_ref() {
11925 params.push("pageToken", value);
11926 }
11927 if let Some(value) = self._max_results.as_ref() {
11928 params.push("maxResults", value.to_string());
11929 }
11930 if let Some(value) = self._location.as_ref() {
11931 params.push("location", value);
11932 }
11933 if let Some(value) = self._format_options_use_int64_timestamp.as_ref() {
11934 params.push("formatOptions.useInt64Timestamp", value.to_string());
11935 }
11936 if let Some(value) = self._format_options_timestamp_output_format.as_ref() {
11937 params.push("formatOptions.timestampOutputFormat", value);
11938 }
11939
11940 params.extend(self._additional_params.iter());
11941
11942 params.push("alt", "json");
11943 let mut url = self.hub._base_url.clone() + "projects/{+projectId}/queries/{+jobId}";
11944 if self._scopes.is_empty() {
11945 self._scopes
11946 .insert(Scope::CloudPlatformReadOnly.as_ref().to_string());
11947 }
11948
11949 #[allow(clippy::single_element_loop)]
11950 for &(find_this, param_name) in
11951 [("{+projectId}", "projectId"), ("{+jobId}", "jobId")].iter()
11952 {
11953 url = params.uri_replacement(url, param_name, find_this, true);
11954 }
11955 {
11956 let to_remove = ["jobId", "projectId"];
11957 params.remove_params(&to_remove);
11958 }
11959
11960 let url = params.parse_with_url(&url);
11961
11962 loop {
11963 let token = match self
11964 .hub
11965 .auth
11966 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
11967 .await
11968 {
11969 Ok(token) => token,
11970 Err(e) => match dlg.token(e) {
11971 Ok(token) => token,
11972 Err(e) => {
11973 dlg.finished(false);
11974 return Err(common::Error::MissingToken(e));
11975 }
11976 },
11977 };
11978 let mut req_result = {
11979 let client = &self.hub.client;
11980 dlg.pre_request();
11981 let mut req_builder = hyper::Request::builder()
11982 .method(hyper::Method::GET)
11983 .uri(url.as_str())
11984 .header(USER_AGENT, self.hub._user_agent.clone());
11985
11986 if let Some(token) = token.as_ref() {
11987 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
11988 }
11989
11990 let request = req_builder
11991 .header(CONTENT_LENGTH, 0_u64)
11992 .body(common::to_body::<String>(None));
11993
11994 client.request(request.unwrap()).await
11995 };
11996
11997 match req_result {
11998 Err(err) => {
11999 if let common::Retry::After(d) = dlg.http_error(&err) {
12000 sleep(d).await;
12001 continue;
12002 }
12003 dlg.finished(false);
12004 return Err(common::Error::HttpError(err));
12005 }
12006 Ok(res) => {
12007 let (mut parts, body) = res.into_parts();
12008 let mut body = common::Body::new(body);
12009 if !parts.status.is_success() {
12010 let bytes = common::to_bytes(body).await.unwrap_or_default();
12011 let error = serde_json::from_str(&common::to_string(&bytes));
12012 let response = common::to_response(parts, bytes.into());
12013
12014 if let common::Retry::After(d) =
12015 dlg.http_failure(&response, error.as_ref().ok())
12016 {
12017 sleep(d).await;
12018 continue;
12019 }
12020
12021 dlg.finished(false);
12022
12023 return Err(match error {
12024 Ok(value) => common::Error::BadRequest(value),
12025 _ => common::Error::Failure(response),
12026 });
12027 }
12028 let response = {
12029 let bytes = common::to_bytes(body).await.unwrap_or_default();
12030 let encoded = common::to_string(&bytes);
12031 match serde_json::from_str(&encoded) {
12032 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
12033 Err(error) => {
12034 dlg.response_json_decode_error(&encoded, &error);
12035 return Err(common::Error::JsonDecodeError(
12036 encoded.to_string(),
12037 error,
12038 ));
12039 }
12040 }
12041 };
12042
12043 dlg.finished(true);
12044 return Ok(response);
12045 }
12046 }
12047 }
12048 }
12049
12050 /// Required. Project ID of the query job.
12051 ///
12052 /// Sets the *project id* path property to the given value.
12053 ///
12054 /// Even though the property as already been set when instantiating this call,
12055 /// we provide this method for API completeness.
12056 pub fn project_id(mut self, new_value: &str) -> JobGetQueryResultCall<'a, C> {
12057 self._project_id = new_value.to_string();
12058 self
12059 }
12060 /// Required. Job ID of the query job.
12061 ///
12062 /// Sets the *job id* path property to the given value.
12063 ///
12064 /// Even though the property as already been set when instantiating this call,
12065 /// we provide this method for API completeness.
12066 pub fn job_id(mut self, new_value: &str) -> JobGetQueryResultCall<'a, C> {
12067 self._job_id = new_value.to_string();
12068 self
12069 }
12070 /// Optional: Specifies the maximum amount of time, in milliseconds, that the client is willing to wait for the query to complete. By default, this limit is 10 seconds (10,000 milliseconds). If the query is complete, the jobComplete field in the response is true. If the query has not yet completed, jobComplete is false. You can request a longer timeout period in the timeoutMs field. However, the call is not guaranteed to wait for the specified timeout; it typically returns after around 200 seconds (200,000 milliseconds), even if the query is not complete. If jobComplete is false, you can continue to wait for the query to complete by calling the getQueryResults method until the jobComplete field in the getQueryResults response is true.
12071 ///
12072 /// Sets the *timeout ms* query property to the given value.
12073 pub fn timeout_ms(mut self, new_value: u32) -> JobGetQueryResultCall<'a, C> {
12074 self._timeout_ms = Some(new_value);
12075 self
12076 }
12077 /// Zero-based index of the starting row.
12078 ///
12079 /// Sets the *start index* query property to the given value.
12080 pub fn start_index(mut self, new_value: u64) -> JobGetQueryResultCall<'a, C> {
12081 self._start_index = Some(new_value);
12082 self
12083 }
12084 /// Page token, returned by a previous call, to request the next page of results.
12085 ///
12086 /// Sets the *page token* query property to the given value.
12087 pub fn page_token(mut self, new_value: &str) -> JobGetQueryResultCall<'a, C> {
12088 self._page_token = Some(new_value.to_string());
12089 self
12090 }
12091 /// Maximum number of results to read.
12092 ///
12093 /// Sets the *max results* query property to the given value.
12094 pub fn max_results(mut self, new_value: u32) -> JobGetQueryResultCall<'a, C> {
12095 self._max_results = Some(new_value);
12096 self
12097 }
12098 /// The geographic location of the job. You must specify the location to run the job for the following scenarios: * If the location to run a job is not in the `us` or the `eu` multi-regional location * If the job's location is in a single region (for example, `us-central1`) For more information, see how to [specify locations](https://cloud.google.com/bigquery/docs/locations#specify_locations).
12099 ///
12100 /// Sets the *location* query property to the given value.
12101 pub fn location(mut self, new_value: &str) -> JobGetQueryResultCall<'a, C> {
12102 self._location = Some(new_value.to_string());
12103 self
12104 }
12105 /// Optional. Output timestamp as usec int64. Default is false.
12106 ///
12107 /// Sets the *format options.use int64 timestamp* query property to the given value.
12108 pub fn format_options_use_int64_timestamp(
12109 mut self,
12110 new_value: bool,
12111 ) -> JobGetQueryResultCall<'a, C> {
12112 self._format_options_use_int64_timestamp = Some(new_value);
12113 self
12114 }
12115 /// Optional. The API output format for a timestamp. This offers more explicit control over the timestamp output format as compared to the existing `use_int64_timestamp` option.
12116 ///
12117 /// Sets the *format options.timestamp output format* query property to the given value.
12118 pub fn format_options_timestamp_output_format(
12119 mut self,
12120 new_value: &str,
12121 ) -> JobGetQueryResultCall<'a, C> {
12122 self._format_options_timestamp_output_format = Some(new_value.to_string());
12123 self
12124 }
12125 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
12126 /// while executing the actual API request.
12127 ///
12128 /// ````text
12129 /// It should be used to handle progress information, and to implement a certain level of resilience.
12130 /// ````
12131 ///
12132 /// Sets the *delegate* property to the given value.
12133 pub fn delegate(
12134 mut self,
12135 new_value: &'a mut dyn common::Delegate,
12136 ) -> JobGetQueryResultCall<'a, C> {
12137 self._delegate = Some(new_value);
12138 self
12139 }
12140
12141 /// Set any additional parameter of the query string used in the request.
12142 /// It should be used to set parameters which are not yet available through their own
12143 /// setters.
12144 ///
12145 /// Please note that this method must not be used to set any of the known parameters
12146 /// which have their own setter method. If done anyway, the request will fail.
12147 ///
12148 /// # Additional Parameters
12149 ///
12150 /// * *$.xgafv* (query-string) - V1 error format.
12151 /// * *access_token* (query-string) - OAuth access token.
12152 /// * *alt* (query-string) - Data format for response.
12153 /// * *callback* (query-string) - JSONP
12154 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
12155 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
12156 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
12157 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
12158 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
12159 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
12160 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
12161 pub fn param<T>(mut self, name: T, value: T) -> JobGetQueryResultCall<'a, C>
12162 where
12163 T: AsRef<str>,
12164 {
12165 self._additional_params
12166 .insert(name.as_ref().to_string(), value.as_ref().to_string());
12167 self
12168 }
12169
12170 /// Identifies the authorization scope for the method you are building.
12171 ///
12172 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
12173 /// [`Scope::CloudPlatformReadOnly`].
12174 ///
12175 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
12176 /// tokens for more than one scope.
12177 ///
12178 /// Usually there is more than one suitable scope to authorize an operation, some of which may
12179 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
12180 /// sufficient, a read-write scope will do as well.
12181 pub fn add_scope<St>(mut self, scope: St) -> JobGetQueryResultCall<'a, C>
12182 where
12183 St: AsRef<str>,
12184 {
12185 self._scopes.insert(String::from(scope.as_ref()));
12186 self
12187 }
12188 /// Identifies the authorization scope(s) for the method you are building.
12189 ///
12190 /// See [`Self::add_scope()`] for details.
12191 pub fn add_scopes<I, St>(mut self, scopes: I) -> JobGetQueryResultCall<'a, C>
12192 where
12193 I: IntoIterator<Item = St>,
12194 St: AsRef<str>,
12195 {
12196 self._scopes
12197 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
12198 self
12199 }
12200
12201 /// Removes all scopes, and no default scope will be used either.
12202 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
12203 /// for details).
12204 pub fn clear_scopes(mut self) -> JobGetQueryResultCall<'a, C> {
12205 self._scopes.clear();
12206 self
12207 }
12208}
12209
12210/// Starts a new asynchronous job. This API has two different kinds of endpoint URIs, as this method supports a variety of use cases. * The *Metadata* URI is used for most interactions, as it accepts the job configuration directly. * The *Upload* URI is ONLY for the case when you're sending both a load job configuration and a data stream together. In this case, the Upload URI accepts the job configuration and the data as two distinct multipart MIME parts.
12211///
12212/// A builder for the *insert* method supported by a *job* resource.
12213/// It is not used directly, but through a [`JobMethods`] instance.
12214///
12215/// # Example
12216///
12217/// Instantiate a resource method builder
12218///
12219/// ```test_harness,no_run
12220/// # extern crate hyper;
12221/// # extern crate hyper_rustls;
12222/// # extern crate google_bigquery2 as bigquery2;
12223/// use bigquery2::api::Job;
12224/// use std::fs;
12225/// # async fn dox() {
12226/// # use bigquery2::{Bigquery, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
12227///
12228/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
12229/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
12230/// # .with_native_roots()
12231/// # .unwrap()
12232/// # .https_only()
12233/// # .enable_http2()
12234/// # .build();
12235///
12236/// # let executor = hyper_util::rt::TokioExecutor::new();
12237/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
12238/// # secret,
12239/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
12240/// # yup_oauth2::client::CustomHyperClientBuilder::from(
12241/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
12242/// # ),
12243/// # ).build().await.unwrap();
12244///
12245/// # let client = hyper_util::client::legacy::Client::builder(
12246/// # hyper_util::rt::TokioExecutor::new()
12247/// # )
12248/// # .build(
12249/// # hyper_rustls::HttpsConnectorBuilder::new()
12250/// # .with_native_roots()
12251/// # .unwrap()
12252/// # .https_or_http()
12253/// # .enable_http2()
12254/// # .build()
12255/// # );
12256/// # let mut hub = Bigquery::new(client, auth);
12257/// // As the method needs a request, you would usually fill it with the desired information
12258/// // into the respective structure. Some of the parts shown here might not be applicable !
12259/// // Values shown here are possibly random and not representative !
12260/// let mut req = Job::default();
12261///
12262/// // You can configure optional parameters by calling the respective setters at will, and
12263/// // execute the final call using `upload_resumable(...)`.
12264/// // Values shown here are possibly random and not representative !
12265/// let result = hub.jobs().insert(req, "projectId")
12266/// .upload_resumable(fs::File::open("file.ext").unwrap(), "application/octet-stream".parse().unwrap()).await;
12267/// # }
12268/// ```
12269pub struct JobInsertCall<'a, C>
12270where
12271 C: 'a,
12272{
12273 hub: &'a Bigquery<C>,
12274 _request: Job,
12275 _project_id: String,
12276 _delegate: Option<&'a mut dyn common::Delegate>,
12277 _additional_params: HashMap<String, String>,
12278 _scopes: BTreeSet<String>,
12279}
12280
12281impl<'a, C> common::CallBuilder for JobInsertCall<'a, C> {}
12282
12283impl<'a, C> JobInsertCall<'a, C>
12284where
12285 C: common::Connector,
12286{
12287 /// Perform the operation you have build so far, but without uploading. This is used to e.g. renaming or updating the description for a file
12288 pub async fn doit_without_upload(mut self) -> common::Result<(common::Response, Job)> {
12289 use std::borrow::Cow;
12290 use std::io::{Read, Seek};
12291
12292 use common::{url::Params, ToParts};
12293 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
12294
12295 let mut dd = common::DefaultDelegate;
12296 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
12297 dlg.begin(common::MethodInfo {
12298 id: "bigquery.jobs.insert",
12299 http_method: hyper::Method::POST,
12300 });
12301
12302 for &field in ["alt", "projectId"].iter() {
12303 if self._additional_params.contains_key(field) {
12304 dlg.finished(false);
12305 return Err(common::Error::FieldClash(field));
12306 }
12307 }
12308
12309 let mut params = Params::with_capacity(4 + self._additional_params.len());
12310 params.push("projectId", self._project_id);
12311
12312 params.extend(self._additional_params.iter());
12313
12314 params.push("alt", "json");
12315 let mut url = self.hub._base_url.clone() + "projects/{+projectId}/jobs";
12316 if self._scopes.is_empty() {
12317 self._scopes
12318 .insert(Scope::DevstorageReadOnly.as_ref().to_string());
12319 }
12320
12321 #[allow(clippy::single_element_loop)]
12322 for &(find_this, param_name) in [("{+projectId}", "projectId")].iter() {
12323 url = params.uri_replacement(url, param_name, find_this, true);
12324 }
12325 {
12326 let to_remove = ["projectId"];
12327 params.remove_params(&to_remove);
12328 }
12329
12330 let url = params.parse_with_url(&url);
12331
12332 let mut json_mime_type = mime::APPLICATION_JSON;
12333 let mut request_value_reader = {
12334 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
12335 common::remove_json_null_values(&mut value);
12336 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
12337 serde_json::to_writer(&mut dst, &value).unwrap();
12338 dst
12339 };
12340 let request_size = request_value_reader
12341 .seek(std::io::SeekFrom::End(0))
12342 .unwrap();
12343 request_value_reader
12344 .seek(std::io::SeekFrom::Start(0))
12345 .unwrap();
12346
12347 loop {
12348 let token = match self
12349 .hub
12350 .auth
12351 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
12352 .await
12353 {
12354 Ok(token) => token,
12355 Err(e) => match dlg.token(e) {
12356 Ok(token) => token,
12357 Err(e) => {
12358 dlg.finished(false);
12359 return Err(common::Error::MissingToken(e));
12360 }
12361 },
12362 };
12363 request_value_reader
12364 .seek(std::io::SeekFrom::Start(0))
12365 .unwrap();
12366 let mut req_result = {
12367 let client = &self.hub.client;
12368 dlg.pre_request();
12369 let mut req_builder = hyper::Request::builder()
12370 .method(hyper::Method::POST)
12371 .uri(url.as_str())
12372 .header(USER_AGENT, self.hub._user_agent.clone());
12373
12374 if let Some(token) = token.as_ref() {
12375 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
12376 }
12377
12378 let request = req_builder
12379 .header(CONTENT_TYPE, json_mime_type.to_string())
12380 .header(CONTENT_LENGTH, request_size as u64)
12381 .body(common::to_body(
12382 request_value_reader.get_ref().clone().into(),
12383 ));
12384
12385 client.request(request.unwrap()).await
12386 };
12387
12388 match req_result {
12389 Err(err) => {
12390 if let common::Retry::After(d) = dlg.http_error(&err) {
12391 sleep(d).await;
12392 continue;
12393 }
12394 dlg.finished(false);
12395 return Err(common::Error::HttpError(err));
12396 }
12397 Ok(res) => {
12398 let (mut parts, body) = res.into_parts();
12399 let mut body = common::Body::new(body);
12400 if !parts.status.is_success() {
12401 let bytes = common::to_bytes(body).await.unwrap_or_default();
12402 let error = serde_json::from_str(&common::to_string(&bytes));
12403 let response = common::to_response(parts, bytes.into());
12404
12405 if let common::Retry::After(d) =
12406 dlg.http_failure(&response, error.as_ref().ok())
12407 {
12408 sleep(d).await;
12409 continue;
12410 }
12411
12412 dlg.finished(false);
12413
12414 return Err(match error {
12415 Ok(value) => common::Error::BadRequest(value),
12416 _ => common::Error::Failure(response),
12417 });
12418 }
12419 let response = {
12420 let bytes = common::to_bytes(body).await.unwrap_or_default();
12421 let encoded = common::to_string(&bytes);
12422 match serde_json::from_str(&encoded) {
12423 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
12424 Err(error) => {
12425 dlg.response_json_decode_error(&encoded, &error);
12426 return Err(common::Error::JsonDecodeError(
12427 encoded.to_string(),
12428 error,
12429 ));
12430 }
12431 }
12432 };
12433
12434 dlg.finished(true);
12435 return Ok(response);
12436 }
12437 }
12438 }
12439 }
12440
12441 /// Perform the operation you have build so far.
12442 async fn doit<RS>(
12443 mut self,
12444 mut reader: RS,
12445 reader_mime_type: mime::Mime,
12446 protocol: common::UploadProtocol,
12447 ) -> common::Result<(common::Response, Job)>
12448 where
12449 RS: common::ReadSeek,
12450 {
12451 use std::borrow::Cow;
12452 use std::io::{Read, Seek};
12453
12454 use common::{url::Params, ToParts};
12455 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
12456
12457 let mut dd = common::DefaultDelegate;
12458 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
12459 dlg.begin(common::MethodInfo {
12460 id: "bigquery.jobs.insert",
12461 http_method: hyper::Method::POST,
12462 });
12463
12464 for &field in ["alt", "projectId"].iter() {
12465 if self._additional_params.contains_key(field) {
12466 dlg.finished(false);
12467 return Err(common::Error::FieldClash(field));
12468 }
12469 }
12470
12471 let mut params = Params::with_capacity(4 + self._additional_params.len());
12472 params.push("projectId", self._project_id);
12473
12474 params.extend(self._additional_params.iter());
12475
12476 params.push("alt", "json");
12477 let (mut url, upload_type) = if protocol == common::UploadProtocol::Resumable {
12478 (
12479 self.hub._root_url.clone()
12480 + "resumable/upload/bigquery/v2/projects/{+projectId}/jobs",
12481 "resumable",
12482 )
12483 } else if protocol == common::UploadProtocol::Simple {
12484 (
12485 self.hub._root_url.clone() + "upload/bigquery/v2/projects/{+projectId}/jobs",
12486 "multipart",
12487 )
12488 } else {
12489 unreachable!()
12490 };
12491 params.push("uploadType", upload_type);
12492 if self._scopes.is_empty() {
12493 self._scopes
12494 .insert(Scope::DevstorageReadOnly.as_ref().to_string());
12495 }
12496
12497 #[allow(clippy::single_element_loop)]
12498 for &(find_this, param_name) in [("{+projectId}", "projectId")].iter() {
12499 url = params.uri_replacement(url, param_name, find_this, true);
12500 }
12501 {
12502 let to_remove = ["projectId"];
12503 params.remove_params(&to_remove);
12504 }
12505
12506 let url = params.parse_with_url(&url);
12507
12508 let mut json_mime_type = mime::APPLICATION_JSON;
12509 let mut request_value_reader = {
12510 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
12511 common::remove_json_null_values(&mut value);
12512 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
12513 serde_json::to_writer(&mut dst, &value).unwrap();
12514 dst
12515 };
12516 let request_size = request_value_reader
12517 .seek(std::io::SeekFrom::End(0))
12518 .unwrap();
12519 request_value_reader
12520 .seek(std::io::SeekFrom::Start(0))
12521 .unwrap();
12522
12523 let mut upload_url_from_server;
12524
12525 loop {
12526 let token = match self
12527 .hub
12528 .auth
12529 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
12530 .await
12531 {
12532 Ok(token) => token,
12533 Err(e) => match dlg.token(e) {
12534 Ok(token) => token,
12535 Err(e) => {
12536 dlg.finished(false);
12537 return Err(common::Error::MissingToken(e));
12538 }
12539 },
12540 };
12541 request_value_reader
12542 .seek(std::io::SeekFrom::Start(0))
12543 .unwrap();
12544 let mut req_result = {
12545 let mut mp_reader: common::MultiPartReader = Default::default();
12546 let (mut body_reader, content_type) = match protocol {
12547 common::UploadProtocol::Simple => {
12548 mp_reader.reserve_exact(2);
12549 let size = reader.seek(std::io::SeekFrom::End(0)).unwrap();
12550 reader.seek(std::io::SeekFrom::Start(0)).unwrap();
12551
12552 mp_reader
12553 .add_part(
12554 &mut request_value_reader,
12555 request_size,
12556 json_mime_type.clone(),
12557 )
12558 .add_part(&mut reader, size, reader_mime_type.clone());
12559 (
12560 &mut mp_reader as &mut (dyn std::io::Read + Send),
12561 common::MultiPartReader::mime_type(),
12562 )
12563 }
12564 _ => (
12565 &mut request_value_reader as &mut (dyn std::io::Read + Send),
12566 json_mime_type.clone(),
12567 ),
12568 };
12569 let client = &self.hub.client;
12570 dlg.pre_request();
12571 let mut req_builder = hyper::Request::builder()
12572 .method(hyper::Method::POST)
12573 .uri(url.as_str())
12574 .header(USER_AGENT, self.hub._user_agent.clone());
12575
12576 if let Some(token) = token.as_ref() {
12577 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
12578 }
12579
12580 upload_url_from_server = true;
12581 if protocol == common::UploadProtocol::Resumable {
12582 req_builder = req_builder
12583 .header("X-Upload-Content-Type", format!("{}", reader_mime_type));
12584 }
12585
12586 let mut body_reader_bytes = vec![];
12587 body_reader.read_to_end(&mut body_reader_bytes).unwrap();
12588 let request = req_builder
12589 .header(CONTENT_TYPE, content_type.to_string())
12590 .body(common::to_body(body_reader_bytes.into()));
12591
12592 client.request(request.unwrap()).await
12593 };
12594
12595 match req_result {
12596 Err(err) => {
12597 if let common::Retry::After(d) = dlg.http_error(&err) {
12598 sleep(d).await;
12599 continue;
12600 }
12601 dlg.finished(false);
12602 return Err(common::Error::HttpError(err));
12603 }
12604 Ok(res) => {
12605 let (mut parts, body) = res.into_parts();
12606 let mut body = common::Body::new(body);
12607 if !parts.status.is_success() {
12608 let bytes = common::to_bytes(body).await.unwrap_or_default();
12609 let error = serde_json::from_str(&common::to_string(&bytes));
12610 let response = common::to_response(parts, bytes.into());
12611
12612 if let common::Retry::After(d) =
12613 dlg.http_failure(&response, error.as_ref().ok())
12614 {
12615 sleep(d).await;
12616 continue;
12617 }
12618
12619 dlg.finished(false);
12620
12621 return Err(match error {
12622 Ok(value) => common::Error::BadRequest(value),
12623 _ => common::Error::Failure(response),
12624 });
12625 }
12626 if protocol == common::UploadProtocol::Resumable {
12627 let size = reader.seek(std::io::SeekFrom::End(0)).unwrap();
12628 reader.seek(std::io::SeekFrom::Start(0)).unwrap();
12629
12630 let upload_result = {
12631 let url_str = &parts
12632 .headers
12633 .get("Location")
12634 .expect("LOCATION header is part of protocol")
12635 .to_str()
12636 .unwrap();
12637 if upload_url_from_server {
12638 dlg.store_upload_url(Some(url_str));
12639 }
12640
12641 common::ResumableUploadHelper {
12642 client: &self.hub.client,
12643 delegate: dlg,
12644 start_at: if upload_url_from_server {
12645 Some(0)
12646 } else {
12647 None
12648 },
12649 auth: &self.hub.auth,
12650 user_agent: &self.hub._user_agent,
12651 // TODO: Check this assumption
12652 auth_header: format!(
12653 "Bearer {}",
12654 token
12655 .ok_or_else(|| common::Error::MissingToken(
12656 "resumable upload requires token".into()
12657 ))?
12658 .as_str()
12659 ),
12660 url: url_str,
12661 reader: &mut reader,
12662 media_type: reader_mime_type.clone(),
12663 content_length: size,
12664 }
12665 .upload()
12666 .await
12667 };
12668 match upload_result {
12669 None => {
12670 dlg.finished(false);
12671 return Err(common::Error::Cancelled);
12672 }
12673 Some(Err(err)) => {
12674 dlg.finished(false);
12675 return Err(common::Error::HttpError(err));
12676 }
12677 Some(Ok(response)) => {
12678 (parts, body) = response.into_parts();
12679 if !parts.status.is_success() {
12680 dlg.store_upload_url(None);
12681 dlg.finished(false);
12682 return Err(common::Error::Failure(
12683 common::Response::from_parts(parts, body),
12684 ));
12685 }
12686 }
12687 }
12688 }
12689 let response = {
12690 let bytes = common::to_bytes(body).await.unwrap_or_default();
12691 let encoded = common::to_string(&bytes);
12692 match serde_json::from_str(&encoded) {
12693 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
12694 Err(error) => {
12695 dlg.response_json_decode_error(&encoded, &error);
12696 return Err(common::Error::JsonDecodeError(
12697 encoded.to_string(),
12698 error,
12699 ));
12700 }
12701 }
12702 };
12703
12704 dlg.finished(true);
12705 return Ok(response);
12706 }
12707 }
12708 }
12709 }
12710
12711 /// Upload media in a resumable fashion.
12712 /// Even if the upload fails or is interrupted, it can be resumed for a
12713 /// certain amount of time as the server maintains state temporarily.
12714 ///
12715 /// The delegate will be asked for an `upload_url()`, and if not provided, will be asked to store an upload URL
12716 /// that was provided by the server, using `store_upload_url(...)`. The upload will be done in chunks, the delegate
12717 /// may specify the `chunk_size()` and may cancel the operation before each chunk is uploaded, using
12718 /// `cancel_chunk_upload(...)`.
12719 ///
12720 /// * *multipart*: yes
12721 /// * *max size*: 0kb
12722 /// * *valid mime types*: '*/*'
12723 pub async fn upload_resumable<RS>(
12724 self,
12725 resumeable_stream: RS,
12726 mime_type: mime::Mime,
12727 ) -> common::Result<(common::Response, Job)>
12728 where
12729 RS: common::ReadSeek,
12730 {
12731 self.doit(
12732 resumeable_stream,
12733 mime_type,
12734 common::UploadProtocol::Resumable,
12735 )
12736 .await
12737 }
12738 /// Upload media all at once.
12739 /// If the upload fails for whichever reason, all progress is lost.
12740 ///
12741 /// * *multipart*: yes
12742 /// * *max size*: 0kb
12743 /// * *valid mime types*: '*/*'
12744 pub async fn upload<RS>(
12745 self,
12746 stream: RS,
12747 mime_type: mime::Mime,
12748 ) -> common::Result<(common::Response, Job)>
12749 where
12750 RS: common::ReadSeek,
12751 {
12752 self.doit(stream, mime_type, common::UploadProtocol::Simple)
12753 .await
12754 }
12755
12756 ///
12757 /// Sets the *request* property to the given value.
12758 ///
12759 /// Even though the property as already been set when instantiating this call,
12760 /// we provide this method for API completeness.
12761 pub fn request(mut self, new_value: Job) -> JobInsertCall<'a, C> {
12762 self._request = new_value;
12763 self
12764 }
12765 /// Project ID of project that will be billed for the job.
12766 ///
12767 /// Sets the *project id* path property to the given value.
12768 ///
12769 /// Even though the property as already been set when instantiating this call,
12770 /// we provide this method for API completeness.
12771 pub fn project_id(mut self, new_value: &str) -> JobInsertCall<'a, C> {
12772 self._project_id = new_value.to_string();
12773 self
12774 }
12775 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
12776 /// while executing the actual API request.
12777 ///
12778 /// ````text
12779 /// It should be used to handle progress information, and to implement a certain level of resilience.
12780 /// ````
12781 ///
12782 /// Sets the *delegate* property to the given value.
12783 pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> JobInsertCall<'a, C> {
12784 self._delegate = Some(new_value);
12785 self
12786 }
12787
12788 /// Set any additional parameter of the query string used in the request.
12789 /// It should be used to set parameters which are not yet available through their own
12790 /// setters.
12791 ///
12792 /// Please note that this method must not be used to set any of the known parameters
12793 /// which have their own setter method. If done anyway, the request will fail.
12794 ///
12795 /// # Additional Parameters
12796 ///
12797 /// * *$.xgafv* (query-string) - V1 error format.
12798 /// * *access_token* (query-string) - OAuth access token.
12799 /// * *alt* (query-string) - Data format for response.
12800 /// * *callback* (query-string) - JSONP
12801 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
12802 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
12803 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
12804 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
12805 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
12806 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
12807 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
12808 pub fn param<T>(mut self, name: T, value: T) -> JobInsertCall<'a, C>
12809 where
12810 T: AsRef<str>,
12811 {
12812 self._additional_params
12813 .insert(name.as_ref().to_string(), value.as_ref().to_string());
12814 self
12815 }
12816
12817 /// Identifies the authorization scope for the method you are building.
12818 ///
12819 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
12820 /// [`Scope::DevstorageReadOnly`].
12821 ///
12822 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
12823 /// tokens for more than one scope.
12824 ///
12825 /// Usually there is more than one suitable scope to authorize an operation, some of which may
12826 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
12827 /// sufficient, a read-write scope will do as well.
12828 pub fn add_scope<St>(mut self, scope: St) -> JobInsertCall<'a, C>
12829 where
12830 St: AsRef<str>,
12831 {
12832 self._scopes.insert(String::from(scope.as_ref()));
12833 self
12834 }
12835 /// Identifies the authorization scope(s) for the method you are building.
12836 ///
12837 /// See [`Self::add_scope()`] for details.
12838 pub fn add_scopes<I, St>(mut self, scopes: I) -> JobInsertCall<'a, C>
12839 where
12840 I: IntoIterator<Item = St>,
12841 St: AsRef<str>,
12842 {
12843 self._scopes
12844 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
12845 self
12846 }
12847
12848 /// Removes all scopes, and no default scope will be used either.
12849 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
12850 /// for details).
12851 pub fn clear_scopes(mut self) -> JobInsertCall<'a, C> {
12852 self._scopes.clear();
12853 self
12854 }
12855}
12856
12857/// Lists all jobs that you started in the specified project. Job information is available for a six month period after creation. The job list is sorted in reverse chronological order, by job creation time. Requires the Can View project role, or the Is Owner project role if you set the allUsers property.
12858///
12859/// A builder for the *list* method supported by a *job* resource.
12860/// It is not used directly, but through a [`JobMethods`] instance.
12861///
12862/// # Example
12863///
12864/// Instantiate a resource method builder
12865///
12866/// ```test_harness,no_run
12867/// # extern crate hyper;
12868/// # extern crate hyper_rustls;
12869/// # extern crate google_bigquery2 as bigquery2;
12870/// # async fn dox() {
12871/// # use bigquery2::{Bigquery, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
12872///
12873/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
12874/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
12875/// # .with_native_roots()
12876/// # .unwrap()
12877/// # .https_only()
12878/// # .enable_http2()
12879/// # .build();
12880///
12881/// # let executor = hyper_util::rt::TokioExecutor::new();
12882/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
12883/// # secret,
12884/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
12885/// # yup_oauth2::client::CustomHyperClientBuilder::from(
12886/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
12887/// # ),
12888/// # ).build().await.unwrap();
12889///
12890/// # let client = hyper_util::client::legacy::Client::builder(
12891/// # hyper_util::rt::TokioExecutor::new()
12892/// # )
12893/// # .build(
12894/// # hyper_rustls::HttpsConnectorBuilder::new()
12895/// # .with_native_roots()
12896/// # .unwrap()
12897/// # .https_or_http()
12898/// # .enable_http2()
12899/// # .build()
12900/// # );
12901/// # let mut hub = Bigquery::new(client, auth);
12902/// // You can configure optional parameters by calling the respective setters at will, and
12903/// // execute the final call using `doit()`.
12904/// // Values shown here are possibly random and not representative !
12905/// let result = hub.jobs().list("projectId")
12906/// .add_state_filter("sadipscing")
12907/// .projection("Stet")
12908/// .parent_job_id("dolor")
12909/// .page_token("duo")
12910/// .min_creation_time(25)
12911/// .max_results(25)
12912/// .max_creation_time(13)
12913/// .all_users(true)
12914/// .doit().await;
12915/// # }
12916/// ```
12917pub struct JobListCall<'a, C>
12918where
12919 C: 'a,
12920{
12921 hub: &'a Bigquery<C>,
12922 _project_id: String,
12923 _state_filter: Vec<String>,
12924 _projection: Option<String>,
12925 _parent_job_id: Option<String>,
12926 _page_token: Option<String>,
12927 _min_creation_time: Option<u64>,
12928 _max_results: Option<u32>,
12929 _max_creation_time: Option<u64>,
12930 _all_users: Option<bool>,
12931 _delegate: Option<&'a mut dyn common::Delegate>,
12932 _additional_params: HashMap<String, String>,
12933 _scopes: BTreeSet<String>,
12934}
12935
12936impl<'a, C> common::CallBuilder for JobListCall<'a, C> {}
12937
12938impl<'a, C> JobListCall<'a, C>
12939where
12940 C: common::Connector,
12941{
12942 /// Perform the operation you have build so far.
12943 pub async fn doit(mut self) -> common::Result<(common::Response, JobList)> {
12944 use std::borrow::Cow;
12945 use std::io::{Read, Seek};
12946
12947 use common::{url::Params, ToParts};
12948 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
12949
12950 let mut dd = common::DefaultDelegate;
12951 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
12952 dlg.begin(common::MethodInfo {
12953 id: "bigquery.jobs.list",
12954 http_method: hyper::Method::GET,
12955 });
12956
12957 for &field in [
12958 "alt",
12959 "projectId",
12960 "stateFilter",
12961 "projection",
12962 "parentJobId",
12963 "pageToken",
12964 "minCreationTime",
12965 "maxResults",
12966 "maxCreationTime",
12967 "allUsers",
12968 ]
12969 .iter()
12970 {
12971 if self._additional_params.contains_key(field) {
12972 dlg.finished(false);
12973 return Err(common::Error::FieldClash(field));
12974 }
12975 }
12976
12977 let mut params = Params::with_capacity(11 + self._additional_params.len());
12978 params.push("projectId", self._project_id);
12979 if !self._state_filter.is_empty() {
12980 for f in self._state_filter.iter() {
12981 params.push("stateFilter", f);
12982 }
12983 }
12984 if let Some(value) = self._projection.as_ref() {
12985 params.push("projection", value);
12986 }
12987 if let Some(value) = self._parent_job_id.as_ref() {
12988 params.push("parentJobId", value);
12989 }
12990 if let Some(value) = self._page_token.as_ref() {
12991 params.push("pageToken", value);
12992 }
12993 if let Some(value) = self._min_creation_time.as_ref() {
12994 params.push("minCreationTime", value.to_string());
12995 }
12996 if let Some(value) = self._max_results.as_ref() {
12997 params.push("maxResults", value.to_string());
12998 }
12999 if let Some(value) = self._max_creation_time.as_ref() {
13000 params.push("maxCreationTime", value.to_string());
13001 }
13002 if let Some(value) = self._all_users.as_ref() {
13003 params.push("allUsers", value.to_string());
13004 }
13005
13006 params.extend(self._additional_params.iter());
13007
13008 params.push("alt", "json");
13009 let mut url = self.hub._base_url.clone() + "projects/{+projectId}/jobs";
13010 if self._scopes.is_empty() {
13011 self._scopes
13012 .insert(Scope::CloudPlatformReadOnly.as_ref().to_string());
13013 }
13014
13015 #[allow(clippy::single_element_loop)]
13016 for &(find_this, param_name) in [("{+projectId}", "projectId")].iter() {
13017 url = params.uri_replacement(url, param_name, find_this, true);
13018 }
13019 {
13020 let to_remove = ["projectId"];
13021 params.remove_params(&to_remove);
13022 }
13023
13024 let url = params.parse_with_url(&url);
13025
13026 loop {
13027 let token = match self
13028 .hub
13029 .auth
13030 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
13031 .await
13032 {
13033 Ok(token) => token,
13034 Err(e) => match dlg.token(e) {
13035 Ok(token) => token,
13036 Err(e) => {
13037 dlg.finished(false);
13038 return Err(common::Error::MissingToken(e));
13039 }
13040 },
13041 };
13042 let mut req_result = {
13043 let client = &self.hub.client;
13044 dlg.pre_request();
13045 let mut req_builder = hyper::Request::builder()
13046 .method(hyper::Method::GET)
13047 .uri(url.as_str())
13048 .header(USER_AGENT, self.hub._user_agent.clone());
13049
13050 if let Some(token) = token.as_ref() {
13051 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
13052 }
13053
13054 let request = req_builder
13055 .header(CONTENT_LENGTH, 0_u64)
13056 .body(common::to_body::<String>(None));
13057
13058 client.request(request.unwrap()).await
13059 };
13060
13061 match req_result {
13062 Err(err) => {
13063 if let common::Retry::After(d) = dlg.http_error(&err) {
13064 sleep(d).await;
13065 continue;
13066 }
13067 dlg.finished(false);
13068 return Err(common::Error::HttpError(err));
13069 }
13070 Ok(res) => {
13071 let (mut parts, body) = res.into_parts();
13072 let mut body = common::Body::new(body);
13073 if !parts.status.is_success() {
13074 let bytes = common::to_bytes(body).await.unwrap_or_default();
13075 let error = serde_json::from_str(&common::to_string(&bytes));
13076 let response = common::to_response(parts, bytes.into());
13077
13078 if let common::Retry::After(d) =
13079 dlg.http_failure(&response, error.as_ref().ok())
13080 {
13081 sleep(d).await;
13082 continue;
13083 }
13084
13085 dlg.finished(false);
13086
13087 return Err(match error {
13088 Ok(value) => common::Error::BadRequest(value),
13089 _ => common::Error::Failure(response),
13090 });
13091 }
13092 let response = {
13093 let bytes = common::to_bytes(body).await.unwrap_or_default();
13094 let encoded = common::to_string(&bytes);
13095 match serde_json::from_str(&encoded) {
13096 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
13097 Err(error) => {
13098 dlg.response_json_decode_error(&encoded, &error);
13099 return Err(common::Error::JsonDecodeError(
13100 encoded.to_string(),
13101 error,
13102 ));
13103 }
13104 }
13105 };
13106
13107 dlg.finished(true);
13108 return Ok(response);
13109 }
13110 }
13111 }
13112 }
13113
13114 /// Project ID of the jobs to list.
13115 ///
13116 /// Sets the *project id* path property to the given value.
13117 ///
13118 /// Even though the property as already been set when instantiating this call,
13119 /// we provide this method for API completeness.
13120 pub fn project_id(mut self, new_value: &str) -> JobListCall<'a, C> {
13121 self._project_id = new_value.to_string();
13122 self
13123 }
13124 /// Filter for job state
13125 ///
13126 /// Append the given value to the *state filter* query property.
13127 /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
13128 pub fn add_state_filter(mut self, new_value: &str) -> JobListCall<'a, C> {
13129 self._state_filter.push(new_value.to_string());
13130 self
13131 }
13132 /// Restrict information returned to a set of selected fields
13133 ///
13134 /// Sets the *projection* query property to the given value.
13135 pub fn projection(mut self, new_value: &str) -> JobListCall<'a, C> {
13136 self._projection = Some(new_value.to_string());
13137 self
13138 }
13139 /// If set, show only child jobs of the specified parent. Otherwise, show all top-level jobs.
13140 ///
13141 /// Sets the *parent job id* query property to the given value.
13142 pub fn parent_job_id(mut self, new_value: &str) -> JobListCall<'a, C> {
13143 self._parent_job_id = Some(new_value.to_string());
13144 self
13145 }
13146 /// Page token, returned by a previous call, to request the next page of results.
13147 ///
13148 /// Sets the *page token* query property to the given value.
13149 pub fn page_token(mut self, new_value: &str) -> JobListCall<'a, C> {
13150 self._page_token = Some(new_value.to_string());
13151 self
13152 }
13153 /// Min value for job creation time, in milliseconds since the POSIX epoch. If set, only jobs created after or at this timestamp are returned.
13154 ///
13155 /// Sets the *min creation time* query property to the given value.
13156 pub fn min_creation_time(mut self, new_value: u64) -> JobListCall<'a, C> {
13157 self._min_creation_time = Some(new_value);
13158 self
13159 }
13160 /// The maximum number of results to return in a single response page. Leverage the page tokens to iterate through the entire collection.
13161 ///
13162 /// Sets the *max results* query property to the given value.
13163 pub fn max_results(mut self, new_value: u32) -> JobListCall<'a, C> {
13164 self._max_results = Some(new_value);
13165 self
13166 }
13167 /// Max value for job creation time, in milliseconds since the POSIX epoch. If set, only jobs created before or at this timestamp are returned.
13168 ///
13169 /// Sets the *max creation time* query property to the given value.
13170 pub fn max_creation_time(mut self, new_value: u64) -> JobListCall<'a, C> {
13171 self._max_creation_time = Some(new_value);
13172 self
13173 }
13174 /// Whether to display jobs owned by all users in the project. Default False.
13175 ///
13176 /// Sets the *all users* query property to the given value.
13177 pub fn all_users(mut self, new_value: bool) -> JobListCall<'a, C> {
13178 self._all_users = Some(new_value);
13179 self
13180 }
13181 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
13182 /// while executing the actual API request.
13183 ///
13184 /// ````text
13185 /// It should be used to handle progress information, and to implement a certain level of resilience.
13186 /// ````
13187 ///
13188 /// Sets the *delegate* property to the given value.
13189 pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> JobListCall<'a, C> {
13190 self._delegate = Some(new_value);
13191 self
13192 }
13193
13194 /// Set any additional parameter of the query string used in the request.
13195 /// It should be used to set parameters which are not yet available through their own
13196 /// setters.
13197 ///
13198 /// Please note that this method must not be used to set any of the known parameters
13199 /// which have their own setter method. If done anyway, the request will fail.
13200 ///
13201 /// # Additional Parameters
13202 ///
13203 /// * *$.xgafv* (query-string) - V1 error format.
13204 /// * *access_token* (query-string) - OAuth access token.
13205 /// * *alt* (query-string) - Data format for response.
13206 /// * *callback* (query-string) - JSONP
13207 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
13208 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
13209 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
13210 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
13211 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
13212 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
13213 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
13214 pub fn param<T>(mut self, name: T, value: T) -> JobListCall<'a, C>
13215 where
13216 T: AsRef<str>,
13217 {
13218 self._additional_params
13219 .insert(name.as_ref().to_string(), value.as_ref().to_string());
13220 self
13221 }
13222
13223 /// Identifies the authorization scope for the method you are building.
13224 ///
13225 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
13226 /// [`Scope::CloudPlatformReadOnly`].
13227 ///
13228 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
13229 /// tokens for more than one scope.
13230 ///
13231 /// Usually there is more than one suitable scope to authorize an operation, some of which may
13232 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
13233 /// sufficient, a read-write scope will do as well.
13234 pub fn add_scope<St>(mut self, scope: St) -> JobListCall<'a, C>
13235 where
13236 St: AsRef<str>,
13237 {
13238 self._scopes.insert(String::from(scope.as_ref()));
13239 self
13240 }
13241 /// Identifies the authorization scope(s) for the method you are building.
13242 ///
13243 /// See [`Self::add_scope()`] for details.
13244 pub fn add_scopes<I, St>(mut self, scopes: I) -> JobListCall<'a, C>
13245 where
13246 I: IntoIterator<Item = St>,
13247 St: AsRef<str>,
13248 {
13249 self._scopes
13250 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
13251 self
13252 }
13253
13254 /// Removes all scopes, and no default scope will be used either.
13255 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
13256 /// for details).
13257 pub fn clear_scopes(mut self) -> JobListCall<'a, C> {
13258 self._scopes.clear();
13259 self
13260 }
13261}
13262
13263/// Runs a BigQuery SQL query synchronously and returns query results if the query completes within a specified timeout.
13264///
13265/// A builder for the *query* method supported by a *job* resource.
13266/// It is not used directly, but through a [`JobMethods`] instance.
13267///
13268/// # Example
13269///
13270/// Instantiate a resource method builder
13271///
13272/// ```test_harness,no_run
13273/// # extern crate hyper;
13274/// # extern crate hyper_rustls;
13275/// # extern crate google_bigquery2 as bigquery2;
13276/// use bigquery2::api::QueryRequest;
13277/// # async fn dox() {
13278/// # use bigquery2::{Bigquery, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
13279///
13280/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
13281/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
13282/// # .with_native_roots()
13283/// # .unwrap()
13284/// # .https_only()
13285/// # .enable_http2()
13286/// # .build();
13287///
13288/// # let executor = hyper_util::rt::TokioExecutor::new();
13289/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
13290/// # secret,
13291/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
13292/// # yup_oauth2::client::CustomHyperClientBuilder::from(
13293/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
13294/// # ),
13295/// # ).build().await.unwrap();
13296///
13297/// # let client = hyper_util::client::legacy::Client::builder(
13298/// # hyper_util::rt::TokioExecutor::new()
13299/// # )
13300/// # .build(
13301/// # hyper_rustls::HttpsConnectorBuilder::new()
13302/// # .with_native_roots()
13303/// # .unwrap()
13304/// # .https_or_http()
13305/// # .enable_http2()
13306/// # .build()
13307/// # );
13308/// # let mut hub = Bigquery::new(client, auth);
13309/// // As the method needs a request, you would usually fill it with the desired information
13310/// // into the respective structure. Some of the parts shown here might not be applicable !
13311/// // Values shown here are possibly random and not representative !
13312/// let mut req = QueryRequest::default();
13313///
13314/// // You can configure optional parameters by calling the respective setters at will, and
13315/// // execute the final call using `doit()`.
13316/// // Values shown here are possibly random and not representative !
13317/// let result = hub.jobs().query(req, "projectId")
13318/// .doit().await;
13319/// # }
13320/// ```
13321pub struct JobQueryCall<'a, C>
13322where
13323 C: 'a,
13324{
13325 hub: &'a Bigquery<C>,
13326 _request: QueryRequest,
13327 _project_id: String,
13328 _delegate: Option<&'a mut dyn common::Delegate>,
13329 _additional_params: HashMap<String, String>,
13330 _scopes: BTreeSet<String>,
13331}
13332
13333impl<'a, C> common::CallBuilder for JobQueryCall<'a, C> {}
13334
13335impl<'a, C> JobQueryCall<'a, C>
13336where
13337 C: common::Connector,
13338{
13339 /// Perform the operation you have build so far.
13340 pub async fn doit(mut self) -> common::Result<(common::Response, QueryResponse)> {
13341 use std::borrow::Cow;
13342 use std::io::{Read, Seek};
13343
13344 use common::{url::Params, ToParts};
13345 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
13346
13347 let mut dd = common::DefaultDelegate;
13348 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
13349 dlg.begin(common::MethodInfo {
13350 id: "bigquery.jobs.query",
13351 http_method: hyper::Method::POST,
13352 });
13353
13354 for &field in ["alt", "projectId"].iter() {
13355 if self._additional_params.contains_key(field) {
13356 dlg.finished(false);
13357 return Err(common::Error::FieldClash(field));
13358 }
13359 }
13360
13361 let mut params = Params::with_capacity(4 + self._additional_params.len());
13362 params.push("projectId", self._project_id);
13363
13364 params.extend(self._additional_params.iter());
13365
13366 params.push("alt", "json");
13367 let mut url = self.hub._base_url.clone() + "projects/{+projectId}/queries";
13368 if self._scopes.is_empty() {
13369 self._scopes
13370 .insert(Scope::CloudPlatformReadOnly.as_ref().to_string());
13371 }
13372
13373 #[allow(clippy::single_element_loop)]
13374 for &(find_this, param_name) in [("{+projectId}", "projectId")].iter() {
13375 url = params.uri_replacement(url, param_name, find_this, true);
13376 }
13377 {
13378 let to_remove = ["projectId"];
13379 params.remove_params(&to_remove);
13380 }
13381
13382 let url = params.parse_with_url(&url);
13383
13384 let mut json_mime_type = mime::APPLICATION_JSON;
13385 let mut request_value_reader = {
13386 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
13387 common::remove_json_null_values(&mut value);
13388 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
13389 serde_json::to_writer(&mut dst, &value).unwrap();
13390 dst
13391 };
13392 let request_size = request_value_reader
13393 .seek(std::io::SeekFrom::End(0))
13394 .unwrap();
13395 request_value_reader
13396 .seek(std::io::SeekFrom::Start(0))
13397 .unwrap();
13398
13399 loop {
13400 let token = match self
13401 .hub
13402 .auth
13403 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
13404 .await
13405 {
13406 Ok(token) => token,
13407 Err(e) => match dlg.token(e) {
13408 Ok(token) => token,
13409 Err(e) => {
13410 dlg.finished(false);
13411 return Err(common::Error::MissingToken(e));
13412 }
13413 },
13414 };
13415 request_value_reader
13416 .seek(std::io::SeekFrom::Start(0))
13417 .unwrap();
13418 let mut req_result = {
13419 let client = &self.hub.client;
13420 dlg.pre_request();
13421 let mut req_builder = hyper::Request::builder()
13422 .method(hyper::Method::POST)
13423 .uri(url.as_str())
13424 .header(USER_AGENT, self.hub._user_agent.clone());
13425
13426 if let Some(token) = token.as_ref() {
13427 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
13428 }
13429
13430 let request = req_builder
13431 .header(CONTENT_TYPE, json_mime_type.to_string())
13432 .header(CONTENT_LENGTH, request_size as u64)
13433 .body(common::to_body(
13434 request_value_reader.get_ref().clone().into(),
13435 ));
13436
13437 client.request(request.unwrap()).await
13438 };
13439
13440 match req_result {
13441 Err(err) => {
13442 if let common::Retry::After(d) = dlg.http_error(&err) {
13443 sleep(d).await;
13444 continue;
13445 }
13446 dlg.finished(false);
13447 return Err(common::Error::HttpError(err));
13448 }
13449 Ok(res) => {
13450 let (mut parts, body) = res.into_parts();
13451 let mut body = common::Body::new(body);
13452 if !parts.status.is_success() {
13453 let bytes = common::to_bytes(body).await.unwrap_or_default();
13454 let error = serde_json::from_str(&common::to_string(&bytes));
13455 let response = common::to_response(parts, bytes.into());
13456
13457 if let common::Retry::After(d) =
13458 dlg.http_failure(&response, error.as_ref().ok())
13459 {
13460 sleep(d).await;
13461 continue;
13462 }
13463
13464 dlg.finished(false);
13465
13466 return Err(match error {
13467 Ok(value) => common::Error::BadRequest(value),
13468 _ => common::Error::Failure(response),
13469 });
13470 }
13471 let response = {
13472 let bytes = common::to_bytes(body).await.unwrap_or_default();
13473 let encoded = common::to_string(&bytes);
13474 match serde_json::from_str(&encoded) {
13475 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
13476 Err(error) => {
13477 dlg.response_json_decode_error(&encoded, &error);
13478 return Err(common::Error::JsonDecodeError(
13479 encoded.to_string(),
13480 error,
13481 ));
13482 }
13483 }
13484 };
13485
13486 dlg.finished(true);
13487 return Ok(response);
13488 }
13489 }
13490 }
13491 }
13492
13493 ///
13494 /// Sets the *request* property to the given value.
13495 ///
13496 /// Even though the property as already been set when instantiating this call,
13497 /// we provide this method for API completeness.
13498 pub fn request(mut self, new_value: QueryRequest) -> JobQueryCall<'a, C> {
13499 self._request = new_value;
13500 self
13501 }
13502 /// Required. Project ID of the query request.
13503 ///
13504 /// Sets the *project id* path property to the given value.
13505 ///
13506 /// Even though the property as already been set when instantiating this call,
13507 /// we provide this method for API completeness.
13508 pub fn project_id(mut self, new_value: &str) -> JobQueryCall<'a, C> {
13509 self._project_id = new_value.to_string();
13510 self
13511 }
13512 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
13513 /// while executing the actual API request.
13514 ///
13515 /// ````text
13516 /// It should be used to handle progress information, and to implement a certain level of resilience.
13517 /// ````
13518 ///
13519 /// Sets the *delegate* property to the given value.
13520 pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> JobQueryCall<'a, C> {
13521 self._delegate = Some(new_value);
13522 self
13523 }
13524
13525 /// Set any additional parameter of the query string used in the request.
13526 /// It should be used to set parameters which are not yet available through their own
13527 /// setters.
13528 ///
13529 /// Please note that this method must not be used to set any of the known parameters
13530 /// which have their own setter method. If done anyway, the request will fail.
13531 ///
13532 /// # Additional Parameters
13533 ///
13534 /// * *$.xgafv* (query-string) - V1 error format.
13535 /// * *access_token* (query-string) - OAuth access token.
13536 /// * *alt* (query-string) - Data format for response.
13537 /// * *callback* (query-string) - JSONP
13538 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
13539 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
13540 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
13541 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
13542 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
13543 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
13544 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
13545 pub fn param<T>(mut self, name: T, value: T) -> JobQueryCall<'a, C>
13546 where
13547 T: AsRef<str>,
13548 {
13549 self._additional_params
13550 .insert(name.as_ref().to_string(), value.as_ref().to_string());
13551 self
13552 }
13553
13554 /// Identifies the authorization scope for the method you are building.
13555 ///
13556 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
13557 /// [`Scope::CloudPlatformReadOnly`].
13558 ///
13559 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
13560 /// tokens for more than one scope.
13561 ///
13562 /// Usually there is more than one suitable scope to authorize an operation, some of which may
13563 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
13564 /// sufficient, a read-write scope will do as well.
13565 pub fn add_scope<St>(mut self, scope: St) -> JobQueryCall<'a, C>
13566 where
13567 St: AsRef<str>,
13568 {
13569 self._scopes.insert(String::from(scope.as_ref()));
13570 self
13571 }
13572 /// Identifies the authorization scope(s) for the method you are building.
13573 ///
13574 /// See [`Self::add_scope()`] for details.
13575 pub fn add_scopes<I, St>(mut self, scopes: I) -> JobQueryCall<'a, C>
13576 where
13577 I: IntoIterator<Item = St>,
13578 St: AsRef<str>,
13579 {
13580 self._scopes
13581 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
13582 self
13583 }
13584
13585 /// Removes all scopes, and no default scope will be used either.
13586 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
13587 /// for details).
13588 pub fn clear_scopes(mut self) -> JobQueryCall<'a, C> {
13589 self._scopes.clear();
13590 self
13591 }
13592}
13593
13594/// Deletes the model specified by modelId from the dataset.
13595///
13596/// A builder for the *delete* method supported by a *model* resource.
13597/// It is not used directly, but through a [`ModelMethods`] instance.
13598///
13599/// # Example
13600///
13601/// Instantiate a resource method builder
13602///
13603/// ```test_harness,no_run
13604/// # extern crate hyper;
13605/// # extern crate hyper_rustls;
13606/// # extern crate google_bigquery2 as bigquery2;
13607/// # async fn dox() {
13608/// # use bigquery2::{Bigquery, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
13609///
13610/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
13611/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
13612/// # .with_native_roots()
13613/// # .unwrap()
13614/// # .https_only()
13615/// # .enable_http2()
13616/// # .build();
13617///
13618/// # let executor = hyper_util::rt::TokioExecutor::new();
13619/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
13620/// # secret,
13621/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
13622/// # yup_oauth2::client::CustomHyperClientBuilder::from(
13623/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
13624/// # ),
13625/// # ).build().await.unwrap();
13626///
13627/// # let client = hyper_util::client::legacy::Client::builder(
13628/// # hyper_util::rt::TokioExecutor::new()
13629/// # )
13630/// # .build(
13631/// # hyper_rustls::HttpsConnectorBuilder::new()
13632/// # .with_native_roots()
13633/// # .unwrap()
13634/// # .https_or_http()
13635/// # .enable_http2()
13636/// # .build()
13637/// # );
13638/// # let mut hub = Bigquery::new(client, auth);
13639/// // You can configure optional parameters by calling the respective setters at will, and
13640/// // execute the final call using `doit()`.
13641/// // Values shown here are possibly random and not representative !
13642/// let result = hub.models().delete("projectId", "datasetId", "modelId")
13643/// .doit().await;
13644/// # }
13645/// ```
13646pub struct ModelDeleteCall<'a, C>
13647where
13648 C: 'a,
13649{
13650 hub: &'a Bigquery<C>,
13651 _project_id: String,
13652 _dataset_id: String,
13653 _model_id: String,
13654 _delegate: Option<&'a mut dyn common::Delegate>,
13655 _additional_params: HashMap<String, String>,
13656 _scopes: BTreeSet<String>,
13657}
13658
13659impl<'a, C> common::CallBuilder for ModelDeleteCall<'a, C> {}
13660
13661impl<'a, C> ModelDeleteCall<'a, C>
13662where
13663 C: common::Connector,
13664{
13665 /// Perform the operation you have build so far.
13666 pub async fn doit(mut self) -> common::Result<common::Response> {
13667 use std::borrow::Cow;
13668 use std::io::{Read, Seek};
13669
13670 use common::{url::Params, ToParts};
13671 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
13672
13673 let mut dd = common::DefaultDelegate;
13674 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
13675 dlg.begin(common::MethodInfo {
13676 id: "bigquery.models.delete",
13677 http_method: hyper::Method::DELETE,
13678 });
13679
13680 for &field in ["projectId", "datasetId", "modelId"].iter() {
13681 if self._additional_params.contains_key(field) {
13682 dlg.finished(false);
13683 return Err(common::Error::FieldClash(field));
13684 }
13685 }
13686
13687 let mut params = Params::with_capacity(4 + self._additional_params.len());
13688 params.push("projectId", self._project_id);
13689 params.push("datasetId", self._dataset_id);
13690 params.push("modelId", self._model_id);
13691
13692 params.extend(self._additional_params.iter());
13693
13694 let mut url = self.hub._base_url.clone()
13695 + "projects/{+projectId}/datasets/{+datasetId}/models/{+modelId}";
13696 if self._scopes.is_empty() {
13697 self._scopes
13698 .insert(Scope::CloudPlatform.as_ref().to_string());
13699 }
13700
13701 #[allow(clippy::single_element_loop)]
13702 for &(find_this, param_name) in [
13703 ("{+projectId}", "projectId"),
13704 ("{+datasetId}", "datasetId"),
13705 ("{+modelId}", "modelId"),
13706 ]
13707 .iter()
13708 {
13709 url = params.uri_replacement(url, param_name, find_this, true);
13710 }
13711 {
13712 let to_remove = ["modelId", "datasetId", "projectId"];
13713 params.remove_params(&to_remove);
13714 }
13715
13716 let url = params.parse_with_url(&url);
13717
13718 loop {
13719 let token = match self
13720 .hub
13721 .auth
13722 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
13723 .await
13724 {
13725 Ok(token) => token,
13726 Err(e) => match dlg.token(e) {
13727 Ok(token) => token,
13728 Err(e) => {
13729 dlg.finished(false);
13730 return Err(common::Error::MissingToken(e));
13731 }
13732 },
13733 };
13734 let mut req_result = {
13735 let client = &self.hub.client;
13736 dlg.pre_request();
13737 let mut req_builder = hyper::Request::builder()
13738 .method(hyper::Method::DELETE)
13739 .uri(url.as_str())
13740 .header(USER_AGENT, self.hub._user_agent.clone());
13741
13742 if let Some(token) = token.as_ref() {
13743 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
13744 }
13745
13746 let request = req_builder
13747 .header(CONTENT_LENGTH, 0_u64)
13748 .body(common::to_body::<String>(None));
13749
13750 client.request(request.unwrap()).await
13751 };
13752
13753 match req_result {
13754 Err(err) => {
13755 if let common::Retry::After(d) = dlg.http_error(&err) {
13756 sleep(d).await;
13757 continue;
13758 }
13759 dlg.finished(false);
13760 return Err(common::Error::HttpError(err));
13761 }
13762 Ok(res) => {
13763 let (mut parts, body) = res.into_parts();
13764 let mut body = common::Body::new(body);
13765 if !parts.status.is_success() {
13766 let bytes = common::to_bytes(body).await.unwrap_or_default();
13767 let error = serde_json::from_str(&common::to_string(&bytes));
13768 let response = common::to_response(parts, bytes.into());
13769
13770 if let common::Retry::After(d) =
13771 dlg.http_failure(&response, error.as_ref().ok())
13772 {
13773 sleep(d).await;
13774 continue;
13775 }
13776
13777 dlg.finished(false);
13778
13779 return Err(match error {
13780 Ok(value) => common::Error::BadRequest(value),
13781 _ => common::Error::Failure(response),
13782 });
13783 }
13784 let response = common::Response::from_parts(parts, body);
13785
13786 dlg.finished(true);
13787 return Ok(response);
13788 }
13789 }
13790 }
13791 }
13792
13793 /// Required. Project ID of the model to delete.
13794 ///
13795 /// Sets the *project id* path property to the given value.
13796 ///
13797 /// Even though the property as already been set when instantiating this call,
13798 /// we provide this method for API completeness.
13799 pub fn project_id(mut self, new_value: &str) -> ModelDeleteCall<'a, C> {
13800 self._project_id = new_value.to_string();
13801 self
13802 }
13803 /// Required. Dataset ID of the model to delete.
13804 ///
13805 /// Sets the *dataset id* path property to the given value.
13806 ///
13807 /// Even though the property as already been set when instantiating this call,
13808 /// we provide this method for API completeness.
13809 pub fn dataset_id(mut self, new_value: &str) -> ModelDeleteCall<'a, C> {
13810 self._dataset_id = new_value.to_string();
13811 self
13812 }
13813 /// Required. Model ID of the model to delete.
13814 ///
13815 /// Sets the *model id* path property to the given value.
13816 ///
13817 /// Even though the property as already been set when instantiating this call,
13818 /// we provide this method for API completeness.
13819 pub fn model_id(mut self, new_value: &str) -> ModelDeleteCall<'a, C> {
13820 self._model_id = new_value.to_string();
13821 self
13822 }
13823 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
13824 /// while executing the actual API request.
13825 ///
13826 /// ````text
13827 /// It should be used to handle progress information, and to implement a certain level of resilience.
13828 /// ````
13829 ///
13830 /// Sets the *delegate* property to the given value.
13831 pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> ModelDeleteCall<'a, C> {
13832 self._delegate = Some(new_value);
13833 self
13834 }
13835
13836 /// Set any additional parameter of the query string used in the request.
13837 /// It should be used to set parameters which are not yet available through their own
13838 /// setters.
13839 ///
13840 /// Please note that this method must not be used to set any of the known parameters
13841 /// which have their own setter method. If done anyway, the request will fail.
13842 ///
13843 /// # Additional Parameters
13844 ///
13845 /// * *$.xgafv* (query-string) - V1 error format.
13846 /// * *access_token* (query-string) - OAuth access token.
13847 /// * *alt* (query-string) - Data format for response.
13848 /// * *callback* (query-string) - JSONP
13849 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
13850 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
13851 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
13852 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
13853 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
13854 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
13855 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
13856 pub fn param<T>(mut self, name: T, value: T) -> ModelDeleteCall<'a, C>
13857 where
13858 T: AsRef<str>,
13859 {
13860 self._additional_params
13861 .insert(name.as_ref().to_string(), value.as_ref().to_string());
13862 self
13863 }
13864
13865 /// Identifies the authorization scope for the method you are building.
13866 ///
13867 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
13868 /// [`Scope::CloudPlatform`].
13869 ///
13870 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
13871 /// tokens for more than one scope.
13872 ///
13873 /// Usually there is more than one suitable scope to authorize an operation, some of which may
13874 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
13875 /// sufficient, a read-write scope will do as well.
13876 pub fn add_scope<St>(mut self, scope: St) -> ModelDeleteCall<'a, C>
13877 where
13878 St: AsRef<str>,
13879 {
13880 self._scopes.insert(String::from(scope.as_ref()));
13881 self
13882 }
13883 /// Identifies the authorization scope(s) for the method you are building.
13884 ///
13885 /// See [`Self::add_scope()`] for details.
13886 pub fn add_scopes<I, St>(mut self, scopes: I) -> ModelDeleteCall<'a, C>
13887 where
13888 I: IntoIterator<Item = St>,
13889 St: AsRef<str>,
13890 {
13891 self._scopes
13892 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
13893 self
13894 }
13895
13896 /// Removes all scopes, and no default scope will be used either.
13897 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
13898 /// for details).
13899 pub fn clear_scopes(mut self) -> ModelDeleteCall<'a, C> {
13900 self._scopes.clear();
13901 self
13902 }
13903}
13904
13905/// Gets the specified model resource by model ID.
13906///
13907/// A builder for the *get* method supported by a *model* resource.
13908/// It is not used directly, but through a [`ModelMethods`] instance.
13909///
13910/// # Example
13911///
13912/// Instantiate a resource method builder
13913///
13914/// ```test_harness,no_run
13915/// # extern crate hyper;
13916/// # extern crate hyper_rustls;
13917/// # extern crate google_bigquery2 as bigquery2;
13918/// # async fn dox() {
13919/// # use bigquery2::{Bigquery, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
13920///
13921/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
13922/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
13923/// # .with_native_roots()
13924/// # .unwrap()
13925/// # .https_only()
13926/// # .enable_http2()
13927/// # .build();
13928///
13929/// # let executor = hyper_util::rt::TokioExecutor::new();
13930/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
13931/// # secret,
13932/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
13933/// # yup_oauth2::client::CustomHyperClientBuilder::from(
13934/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
13935/// # ),
13936/// # ).build().await.unwrap();
13937///
13938/// # let client = hyper_util::client::legacy::Client::builder(
13939/// # hyper_util::rt::TokioExecutor::new()
13940/// # )
13941/// # .build(
13942/// # hyper_rustls::HttpsConnectorBuilder::new()
13943/// # .with_native_roots()
13944/// # .unwrap()
13945/// # .https_or_http()
13946/// # .enable_http2()
13947/// # .build()
13948/// # );
13949/// # let mut hub = Bigquery::new(client, auth);
13950/// // You can configure optional parameters by calling the respective setters at will, and
13951/// // execute the final call using `doit()`.
13952/// // Values shown here are possibly random and not representative !
13953/// let result = hub.models().get("projectId", "datasetId", "modelId")
13954/// .doit().await;
13955/// # }
13956/// ```
13957pub struct ModelGetCall<'a, C>
13958where
13959 C: 'a,
13960{
13961 hub: &'a Bigquery<C>,
13962 _project_id: String,
13963 _dataset_id: String,
13964 _model_id: String,
13965 _delegate: Option<&'a mut dyn common::Delegate>,
13966 _additional_params: HashMap<String, String>,
13967 _scopes: BTreeSet<String>,
13968}
13969
13970impl<'a, C> common::CallBuilder for ModelGetCall<'a, C> {}
13971
13972impl<'a, C> ModelGetCall<'a, C>
13973where
13974 C: common::Connector,
13975{
13976 /// Perform the operation you have build so far.
13977 pub async fn doit(mut self) -> common::Result<(common::Response, Model)> {
13978 use std::borrow::Cow;
13979 use std::io::{Read, Seek};
13980
13981 use common::{url::Params, ToParts};
13982 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
13983
13984 let mut dd = common::DefaultDelegate;
13985 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
13986 dlg.begin(common::MethodInfo {
13987 id: "bigquery.models.get",
13988 http_method: hyper::Method::GET,
13989 });
13990
13991 for &field in ["alt", "projectId", "datasetId", "modelId"].iter() {
13992 if self._additional_params.contains_key(field) {
13993 dlg.finished(false);
13994 return Err(common::Error::FieldClash(field));
13995 }
13996 }
13997
13998 let mut params = Params::with_capacity(5 + self._additional_params.len());
13999 params.push("projectId", self._project_id);
14000 params.push("datasetId", self._dataset_id);
14001 params.push("modelId", self._model_id);
14002
14003 params.extend(self._additional_params.iter());
14004
14005 params.push("alt", "json");
14006 let mut url = self.hub._base_url.clone()
14007 + "projects/{+projectId}/datasets/{+datasetId}/models/{+modelId}";
14008 if self._scopes.is_empty() {
14009 self._scopes
14010 .insert(Scope::CloudPlatformReadOnly.as_ref().to_string());
14011 }
14012
14013 #[allow(clippy::single_element_loop)]
14014 for &(find_this, param_name) in [
14015 ("{+projectId}", "projectId"),
14016 ("{+datasetId}", "datasetId"),
14017 ("{+modelId}", "modelId"),
14018 ]
14019 .iter()
14020 {
14021 url = params.uri_replacement(url, param_name, find_this, true);
14022 }
14023 {
14024 let to_remove = ["modelId", "datasetId", "projectId"];
14025 params.remove_params(&to_remove);
14026 }
14027
14028 let url = params.parse_with_url(&url);
14029
14030 loop {
14031 let token = match self
14032 .hub
14033 .auth
14034 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
14035 .await
14036 {
14037 Ok(token) => token,
14038 Err(e) => match dlg.token(e) {
14039 Ok(token) => token,
14040 Err(e) => {
14041 dlg.finished(false);
14042 return Err(common::Error::MissingToken(e));
14043 }
14044 },
14045 };
14046 let mut req_result = {
14047 let client = &self.hub.client;
14048 dlg.pre_request();
14049 let mut req_builder = hyper::Request::builder()
14050 .method(hyper::Method::GET)
14051 .uri(url.as_str())
14052 .header(USER_AGENT, self.hub._user_agent.clone());
14053
14054 if let Some(token) = token.as_ref() {
14055 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
14056 }
14057
14058 let request = req_builder
14059 .header(CONTENT_LENGTH, 0_u64)
14060 .body(common::to_body::<String>(None));
14061
14062 client.request(request.unwrap()).await
14063 };
14064
14065 match req_result {
14066 Err(err) => {
14067 if let common::Retry::After(d) = dlg.http_error(&err) {
14068 sleep(d).await;
14069 continue;
14070 }
14071 dlg.finished(false);
14072 return Err(common::Error::HttpError(err));
14073 }
14074 Ok(res) => {
14075 let (mut parts, body) = res.into_parts();
14076 let mut body = common::Body::new(body);
14077 if !parts.status.is_success() {
14078 let bytes = common::to_bytes(body).await.unwrap_or_default();
14079 let error = serde_json::from_str(&common::to_string(&bytes));
14080 let response = common::to_response(parts, bytes.into());
14081
14082 if let common::Retry::After(d) =
14083 dlg.http_failure(&response, error.as_ref().ok())
14084 {
14085 sleep(d).await;
14086 continue;
14087 }
14088
14089 dlg.finished(false);
14090
14091 return Err(match error {
14092 Ok(value) => common::Error::BadRequest(value),
14093 _ => common::Error::Failure(response),
14094 });
14095 }
14096 let response = {
14097 let bytes = common::to_bytes(body).await.unwrap_or_default();
14098 let encoded = common::to_string(&bytes);
14099 match serde_json::from_str(&encoded) {
14100 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
14101 Err(error) => {
14102 dlg.response_json_decode_error(&encoded, &error);
14103 return Err(common::Error::JsonDecodeError(
14104 encoded.to_string(),
14105 error,
14106 ));
14107 }
14108 }
14109 };
14110
14111 dlg.finished(true);
14112 return Ok(response);
14113 }
14114 }
14115 }
14116 }
14117
14118 /// Required. Project ID of the requested model.
14119 ///
14120 /// Sets the *project id* path property to the given value.
14121 ///
14122 /// Even though the property as already been set when instantiating this call,
14123 /// we provide this method for API completeness.
14124 pub fn project_id(mut self, new_value: &str) -> ModelGetCall<'a, C> {
14125 self._project_id = new_value.to_string();
14126 self
14127 }
14128 /// Required. Dataset ID of the requested model.
14129 ///
14130 /// Sets the *dataset id* path property to the given value.
14131 ///
14132 /// Even though the property as already been set when instantiating this call,
14133 /// we provide this method for API completeness.
14134 pub fn dataset_id(mut self, new_value: &str) -> ModelGetCall<'a, C> {
14135 self._dataset_id = new_value.to_string();
14136 self
14137 }
14138 /// Required. Model ID of the requested model.
14139 ///
14140 /// Sets the *model id* path property to the given value.
14141 ///
14142 /// Even though the property as already been set when instantiating this call,
14143 /// we provide this method for API completeness.
14144 pub fn model_id(mut self, new_value: &str) -> ModelGetCall<'a, C> {
14145 self._model_id = new_value.to_string();
14146 self
14147 }
14148 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
14149 /// while executing the actual API request.
14150 ///
14151 /// ````text
14152 /// It should be used to handle progress information, and to implement a certain level of resilience.
14153 /// ````
14154 ///
14155 /// Sets the *delegate* property to the given value.
14156 pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> ModelGetCall<'a, C> {
14157 self._delegate = Some(new_value);
14158 self
14159 }
14160
14161 /// Set any additional parameter of the query string used in the request.
14162 /// It should be used to set parameters which are not yet available through their own
14163 /// setters.
14164 ///
14165 /// Please note that this method must not be used to set any of the known parameters
14166 /// which have their own setter method. If done anyway, the request will fail.
14167 ///
14168 /// # Additional Parameters
14169 ///
14170 /// * *$.xgafv* (query-string) - V1 error format.
14171 /// * *access_token* (query-string) - OAuth access token.
14172 /// * *alt* (query-string) - Data format for response.
14173 /// * *callback* (query-string) - JSONP
14174 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
14175 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
14176 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
14177 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
14178 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
14179 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
14180 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
14181 pub fn param<T>(mut self, name: T, value: T) -> ModelGetCall<'a, C>
14182 where
14183 T: AsRef<str>,
14184 {
14185 self._additional_params
14186 .insert(name.as_ref().to_string(), value.as_ref().to_string());
14187 self
14188 }
14189
14190 /// Identifies the authorization scope for the method you are building.
14191 ///
14192 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
14193 /// [`Scope::CloudPlatformReadOnly`].
14194 ///
14195 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
14196 /// tokens for more than one scope.
14197 ///
14198 /// Usually there is more than one suitable scope to authorize an operation, some of which may
14199 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
14200 /// sufficient, a read-write scope will do as well.
14201 pub fn add_scope<St>(mut self, scope: St) -> ModelGetCall<'a, C>
14202 where
14203 St: AsRef<str>,
14204 {
14205 self._scopes.insert(String::from(scope.as_ref()));
14206 self
14207 }
14208 /// Identifies the authorization scope(s) for the method you are building.
14209 ///
14210 /// See [`Self::add_scope()`] for details.
14211 pub fn add_scopes<I, St>(mut self, scopes: I) -> ModelGetCall<'a, C>
14212 where
14213 I: IntoIterator<Item = St>,
14214 St: AsRef<str>,
14215 {
14216 self._scopes
14217 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
14218 self
14219 }
14220
14221 /// Removes all scopes, and no default scope will be used either.
14222 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
14223 /// for details).
14224 pub fn clear_scopes(mut self) -> ModelGetCall<'a, C> {
14225 self._scopes.clear();
14226 self
14227 }
14228}
14229
14230/// Lists all models in the specified dataset. Requires the READER dataset role. After retrieving the list of models, you can get information about a particular model by calling the models.get method.
14231///
14232/// A builder for the *list* method supported by a *model* resource.
14233/// It is not used directly, but through a [`ModelMethods`] instance.
14234///
14235/// # Example
14236///
14237/// Instantiate a resource method builder
14238///
14239/// ```test_harness,no_run
14240/// # extern crate hyper;
14241/// # extern crate hyper_rustls;
14242/// # extern crate google_bigquery2 as bigquery2;
14243/// # async fn dox() {
14244/// # use bigquery2::{Bigquery, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
14245///
14246/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
14247/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
14248/// # .with_native_roots()
14249/// # .unwrap()
14250/// # .https_only()
14251/// # .enable_http2()
14252/// # .build();
14253///
14254/// # let executor = hyper_util::rt::TokioExecutor::new();
14255/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
14256/// # secret,
14257/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
14258/// # yup_oauth2::client::CustomHyperClientBuilder::from(
14259/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
14260/// # ),
14261/// # ).build().await.unwrap();
14262///
14263/// # let client = hyper_util::client::legacy::Client::builder(
14264/// # hyper_util::rt::TokioExecutor::new()
14265/// # )
14266/// # .build(
14267/// # hyper_rustls::HttpsConnectorBuilder::new()
14268/// # .with_native_roots()
14269/// # .unwrap()
14270/// # .https_or_http()
14271/// # .enable_http2()
14272/// # .build()
14273/// # );
14274/// # let mut hub = Bigquery::new(client, auth);
14275/// // You can configure optional parameters by calling the respective setters at will, and
14276/// // execute the final call using `doit()`.
14277/// // Values shown here are possibly random and not representative !
14278/// let result = hub.models().list("projectId", "datasetId")
14279/// .page_token("voluptua.")
14280/// .max_results(29)
14281/// .doit().await;
14282/// # }
14283/// ```
14284pub struct ModelListCall<'a, C>
14285where
14286 C: 'a,
14287{
14288 hub: &'a Bigquery<C>,
14289 _project_id: String,
14290 _dataset_id: String,
14291 _page_token: Option<String>,
14292 _max_results: Option<u32>,
14293 _delegate: Option<&'a mut dyn common::Delegate>,
14294 _additional_params: HashMap<String, String>,
14295 _scopes: BTreeSet<String>,
14296}
14297
14298impl<'a, C> common::CallBuilder for ModelListCall<'a, C> {}
14299
14300impl<'a, C> ModelListCall<'a, C>
14301where
14302 C: common::Connector,
14303{
14304 /// Perform the operation you have build so far.
14305 pub async fn doit(mut self) -> common::Result<(common::Response, ListModelsResponse)> {
14306 use std::borrow::Cow;
14307 use std::io::{Read, Seek};
14308
14309 use common::{url::Params, ToParts};
14310 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
14311
14312 let mut dd = common::DefaultDelegate;
14313 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
14314 dlg.begin(common::MethodInfo {
14315 id: "bigquery.models.list",
14316 http_method: hyper::Method::GET,
14317 });
14318
14319 for &field in ["alt", "projectId", "datasetId", "pageToken", "maxResults"].iter() {
14320 if self._additional_params.contains_key(field) {
14321 dlg.finished(false);
14322 return Err(common::Error::FieldClash(field));
14323 }
14324 }
14325
14326 let mut params = Params::with_capacity(6 + self._additional_params.len());
14327 params.push("projectId", self._project_id);
14328 params.push("datasetId", self._dataset_id);
14329 if let Some(value) = self._page_token.as_ref() {
14330 params.push("pageToken", value);
14331 }
14332 if let Some(value) = self._max_results.as_ref() {
14333 params.push("maxResults", value.to_string());
14334 }
14335
14336 params.extend(self._additional_params.iter());
14337
14338 params.push("alt", "json");
14339 let mut url =
14340 self.hub._base_url.clone() + "projects/{+projectId}/datasets/{+datasetId}/models";
14341 if self._scopes.is_empty() {
14342 self._scopes
14343 .insert(Scope::CloudPlatformReadOnly.as_ref().to_string());
14344 }
14345
14346 #[allow(clippy::single_element_loop)]
14347 for &(find_this, param_name) in
14348 [("{+projectId}", "projectId"), ("{+datasetId}", "datasetId")].iter()
14349 {
14350 url = params.uri_replacement(url, param_name, find_this, true);
14351 }
14352 {
14353 let to_remove = ["datasetId", "projectId"];
14354 params.remove_params(&to_remove);
14355 }
14356
14357 let url = params.parse_with_url(&url);
14358
14359 loop {
14360 let token = match self
14361 .hub
14362 .auth
14363 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
14364 .await
14365 {
14366 Ok(token) => token,
14367 Err(e) => match dlg.token(e) {
14368 Ok(token) => token,
14369 Err(e) => {
14370 dlg.finished(false);
14371 return Err(common::Error::MissingToken(e));
14372 }
14373 },
14374 };
14375 let mut req_result = {
14376 let client = &self.hub.client;
14377 dlg.pre_request();
14378 let mut req_builder = hyper::Request::builder()
14379 .method(hyper::Method::GET)
14380 .uri(url.as_str())
14381 .header(USER_AGENT, self.hub._user_agent.clone());
14382
14383 if let Some(token) = token.as_ref() {
14384 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
14385 }
14386
14387 let request = req_builder
14388 .header(CONTENT_LENGTH, 0_u64)
14389 .body(common::to_body::<String>(None));
14390
14391 client.request(request.unwrap()).await
14392 };
14393
14394 match req_result {
14395 Err(err) => {
14396 if let common::Retry::After(d) = dlg.http_error(&err) {
14397 sleep(d).await;
14398 continue;
14399 }
14400 dlg.finished(false);
14401 return Err(common::Error::HttpError(err));
14402 }
14403 Ok(res) => {
14404 let (mut parts, body) = res.into_parts();
14405 let mut body = common::Body::new(body);
14406 if !parts.status.is_success() {
14407 let bytes = common::to_bytes(body).await.unwrap_or_default();
14408 let error = serde_json::from_str(&common::to_string(&bytes));
14409 let response = common::to_response(parts, bytes.into());
14410
14411 if let common::Retry::After(d) =
14412 dlg.http_failure(&response, error.as_ref().ok())
14413 {
14414 sleep(d).await;
14415 continue;
14416 }
14417
14418 dlg.finished(false);
14419
14420 return Err(match error {
14421 Ok(value) => common::Error::BadRequest(value),
14422 _ => common::Error::Failure(response),
14423 });
14424 }
14425 let response = {
14426 let bytes = common::to_bytes(body).await.unwrap_or_default();
14427 let encoded = common::to_string(&bytes);
14428 match serde_json::from_str(&encoded) {
14429 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
14430 Err(error) => {
14431 dlg.response_json_decode_error(&encoded, &error);
14432 return Err(common::Error::JsonDecodeError(
14433 encoded.to_string(),
14434 error,
14435 ));
14436 }
14437 }
14438 };
14439
14440 dlg.finished(true);
14441 return Ok(response);
14442 }
14443 }
14444 }
14445 }
14446
14447 /// Required. Project ID of the models to list.
14448 ///
14449 /// Sets the *project id* path property to the given value.
14450 ///
14451 /// Even though the property as already been set when instantiating this call,
14452 /// we provide this method for API completeness.
14453 pub fn project_id(mut self, new_value: &str) -> ModelListCall<'a, C> {
14454 self._project_id = new_value.to_string();
14455 self
14456 }
14457 /// Required. Dataset ID of the models to list.
14458 ///
14459 /// Sets the *dataset id* path property to the given value.
14460 ///
14461 /// Even though the property as already been set when instantiating this call,
14462 /// we provide this method for API completeness.
14463 pub fn dataset_id(mut self, new_value: &str) -> ModelListCall<'a, C> {
14464 self._dataset_id = new_value.to_string();
14465 self
14466 }
14467 /// Page token, returned by a previous call to request the next page of results
14468 ///
14469 /// Sets the *page token* query property to the given value.
14470 pub fn page_token(mut self, new_value: &str) -> ModelListCall<'a, C> {
14471 self._page_token = Some(new_value.to_string());
14472 self
14473 }
14474 /// The maximum number of results to return in a single response page. Leverage the page tokens to iterate through the entire collection.
14475 ///
14476 /// Sets the *max results* query property to the given value.
14477 pub fn max_results(mut self, new_value: u32) -> ModelListCall<'a, C> {
14478 self._max_results = Some(new_value);
14479 self
14480 }
14481 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
14482 /// while executing the actual API request.
14483 ///
14484 /// ````text
14485 /// It should be used to handle progress information, and to implement a certain level of resilience.
14486 /// ````
14487 ///
14488 /// Sets the *delegate* property to the given value.
14489 pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> ModelListCall<'a, C> {
14490 self._delegate = Some(new_value);
14491 self
14492 }
14493
14494 /// Set any additional parameter of the query string used in the request.
14495 /// It should be used to set parameters which are not yet available through their own
14496 /// setters.
14497 ///
14498 /// Please note that this method must not be used to set any of the known parameters
14499 /// which have their own setter method. If done anyway, the request will fail.
14500 ///
14501 /// # Additional Parameters
14502 ///
14503 /// * *$.xgafv* (query-string) - V1 error format.
14504 /// * *access_token* (query-string) - OAuth access token.
14505 /// * *alt* (query-string) - Data format for response.
14506 /// * *callback* (query-string) - JSONP
14507 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
14508 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
14509 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
14510 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
14511 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
14512 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
14513 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
14514 pub fn param<T>(mut self, name: T, value: T) -> ModelListCall<'a, C>
14515 where
14516 T: AsRef<str>,
14517 {
14518 self._additional_params
14519 .insert(name.as_ref().to_string(), value.as_ref().to_string());
14520 self
14521 }
14522
14523 /// Identifies the authorization scope for the method you are building.
14524 ///
14525 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
14526 /// [`Scope::CloudPlatformReadOnly`].
14527 ///
14528 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
14529 /// tokens for more than one scope.
14530 ///
14531 /// Usually there is more than one suitable scope to authorize an operation, some of which may
14532 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
14533 /// sufficient, a read-write scope will do as well.
14534 pub fn add_scope<St>(mut self, scope: St) -> ModelListCall<'a, C>
14535 where
14536 St: AsRef<str>,
14537 {
14538 self._scopes.insert(String::from(scope.as_ref()));
14539 self
14540 }
14541 /// Identifies the authorization scope(s) for the method you are building.
14542 ///
14543 /// See [`Self::add_scope()`] for details.
14544 pub fn add_scopes<I, St>(mut self, scopes: I) -> ModelListCall<'a, C>
14545 where
14546 I: IntoIterator<Item = St>,
14547 St: AsRef<str>,
14548 {
14549 self._scopes
14550 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
14551 self
14552 }
14553
14554 /// Removes all scopes, and no default scope will be used either.
14555 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
14556 /// for details).
14557 pub fn clear_scopes(mut self) -> ModelListCall<'a, C> {
14558 self._scopes.clear();
14559 self
14560 }
14561}
14562
14563/// Patch specific fields in the specified model.
14564///
14565/// A builder for the *patch* method supported by a *model* resource.
14566/// It is not used directly, but through a [`ModelMethods`] instance.
14567///
14568/// # Example
14569///
14570/// Instantiate a resource method builder
14571///
14572/// ```test_harness,no_run
14573/// # extern crate hyper;
14574/// # extern crate hyper_rustls;
14575/// # extern crate google_bigquery2 as bigquery2;
14576/// use bigquery2::api::Model;
14577/// # async fn dox() {
14578/// # use bigquery2::{Bigquery, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
14579///
14580/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
14581/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
14582/// # .with_native_roots()
14583/// # .unwrap()
14584/// # .https_only()
14585/// # .enable_http2()
14586/// # .build();
14587///
14588/// # let executor = hyper_util::rt::TokioExecutor::new();
14589/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
14590/// # secret,
14591/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
14592/// # yup_oauth2::client::CustomHyperClientBuilder::from(
14593/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
14594/// # ),
14595/// # ).build().await.unwrap();
14596///
14597/// # let client = hyper_util::client::legacy::Client::builder(
14598/// # hyper_util::rt::TokioExecutor::new()
14599/// # )
14600/// # .build(
14601/// # hyper_rustls::HttpsConnectorBuilder::new()
14602/// # .with_native_roots()
14603/// # .unwrap()
14604/// # .https_or_http()
14605/// # .enable_http2()
14606/// # .build()
14607/// # );
14608/// # let mut hub = Bigquery::new(client, auth);
14609/// // As the method needs a request, you would usually fill it with the desired information
14610/// // into the respective structure. Some of the parts shown here might not be applicable !
14611/// // Values shown here are possibly random and not representative !
14612/// let mut req = Model::default();
14613///
14614/// // You can configure optional parameters by calling the respective setters at will, and
14615/// // execute the final call using `doit()`.
14616/// // Values shown here are possibly random and not representative !
14617/// let result = hub.models().patch(req, "projectId", "datasetId", "modelId")
14618/// .doit().await;
14619/// # }
14620/// ```
14621pub struct ModelPatchCall<'a, C>
14622where
14623 C: 'a,
14624{
14625 hub: &'a Bigquery<C>,
14626 _request: Model,
14627 _project_id: String,
14628 _dataset_id: String,
14629 _model_id: String,
14630 _delegate: Option<&'a mut dyn common::Delegate>,
14631 _additional_params: HashMap<String, String>,
14632 _scopes: BTreeSet<String>,
14633}
14634
14635impl<'a, C> common::CallBuilder for ModelPatchCall<'a, C> {}
14636
14637impl<'a, C> ModelPatchCall<'a, C>
14638where
14639 C: common::Connector,
14640{
14641 /// Perform the operation you have build so far.
14642 pub async fn doit(mut self) -> common::Result<(common::Response, Model)> {
14643 use std::borrow::Cow;
14644 use std::io::{Read, Seek};
14645
14646 use common::{url::Params, ToParts};
14647 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
14648
14649 let mut dd = common::DefaultDelegate;
14650 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
14651 dlg.begin(common::MethodInfo {
14652 id: "bigquery.models.patch",
14653 http_method: hyper::Method::PATCH,
14654 });
14655
14656 for &field in ["alt", "projectId", "datasetId", "modelId"].iter() {
14657 if self._additional_params.contains_key(field) {
14658 dlg.finished(false);
14659 return Err(common::Error::FieldClash(field));
14660 }
14661 }
14662
14663 let mut params = Params::with_capacity(6 + self._additional_params.len());
14664 params.push("projectId", self._project_id);
14665 params.push("datasetId", self._dataset_id);
14666 params.push("modelId", self._model_id);
14667
14668 params.extend(self._additional_params.iter());
14669
14670 params.push("alt", "json");
14671 let mut url = self.hub._base_url.clone()
14672 + "projects/{+projectId}/datasets/{+datasetId}/models/{+modelId}";
14673 if self._scopes.is_empty() {
14674 self._scopes
14675 .insert(Scope::CloudPlatform.as_ref().to_string());
14676 }
14677
14678 #[allow(clippy::single_element_loop)]
14679 for &(find_this, param_name) in [
14680 ("{+projectId}", "projectId"),
14681 ("{+datasetId}", "datasetId"),
14682 ("{+modelId}", "modelId"),
14683 ]
14684 .iter()
14685 {
14686 url = params.uri_replacement(url, param_name, find_this, true);
14687 }
14688 {
14689 let to_remove = ["modelId", "datasetId", "projectId"];
14690 params.remove_params(&to_remove);
14691 }
14692
14693 let url = params.parse_with_url(&url);
14694
14695 let mut json_mime_type = mime::APPLICATION_JSON;
14696 let mut request_value_reader = {
14697 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
14698 common::remove_json_null_values(&mut value);
14699 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
14700 serde_json::to_writer(&mut dst, &value).unwrap();
14701 dst
14702 };
14703 let request_size = request_value_reader
14704 .seek(std::io::SeekFrom::End(0))
14705 .unwrap();
14706 request_value_reader
14707 .seek(std::io::SeekFrom::Start(0))
14708 .unwrap();
14709
14710 loop {
14711 let token = match self
14712 .hub
14713 .auth
14714 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
14715 .await
14716 {
14717 Ok(token) => token,
14718 Err(e) => match dlg.token(e) {
14719 Ok(token) => token,
14720 Err(e) => {
14721 dlg.finished(false);
14722 return Err(common::Error::MissingToken(e));
14723 }
14724 },
14725 };
14726 request_value_reader
14727 .seek(std::io::SeekFrom::Start(0))
14728 .unwrap();
14729 let mut req_result = {
14730 let client = &self.hub.client;
14731 dlg.pre_request();
14732 let mut req_builder = hyper::Request::builder()
14733 .method(hyper::Method::PATCH)
14734 .uri(url.as_str())
14735 .header(USER_AGENT, self.hub._user_agent.clone());
14736
14737 if let Some(token) = token.as_ref() {
14738 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
14739 }
14740
14741 let request = req_builder
14742 .header(CONTENT_TYPE, json_mime_type.to_string())
14743 .header(CONTENT_LENGTH, request_size as u64)
14744 .body(common::to_body(
14745 request_value_reader.get_ref().clone().into(),
14746 ));
14747
14748 client.request(request.unwrap()).await
14749 };
14750
14751 match req_result {
14752 Err(err) => {
14753 if let common::Retry::After(d) = dlg.http_error(&err) {
14754 sleep(d).await;
14755 continue;
14756 }
14757 dlg.finished(false);
14758 return Err(common::Error::HttpError(err));
14759 }
14760 Ok(res) => {
14761 let (mut parts, body) = res.into_parts();
14762 let mut body = common::Body::new(body);
14763 if !parts.status.is_success() {
14764 let bytes = common::to_bytes(body).await.unwrap_or_default();
14765 let error = serde_json::from_str(&common::to_string(&bytes));
14766 let response = common::to_response(parts, bytes.into());
14767
14768 if let common::Retry::After(d) =
14769 dlg.http_failure(&response, error.as_ref().ok())
14770 {
14771 sleep(d).await;
14772 continue;
14773 }
14774
14775 dlg.finished(false);
14776
14777 return Err(match error {
14778 Ok(value) => common::Error::BadRequest(value),
14779 _ => common::Error::Failure(response),
14780 });
14781 }
14782 let response = {
14783 let bytes = common::to_bytes(body).await.unwrap_or_default();
14784 let encoded = common::to_string(&bytes);
14785 match serde_json::from_str(&encoded) {
14786 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
14787 Err(error) => {
14788 dlg.response_json_decode_error(&encoded, &error);
14789 return Err(common::Error::JsonDecodeError(
14790 encoded.to_string(),
14791 error,
14792 ));
14793 }
14794 }
14795 };
14796
14797 dlg.finished(true);
14798 return Ok(response);
14799 }
14800 }
14801 }
14802 }
14803
14804 ///
14805 /// Sets the *request* property to the given value.
14806 ///
14807 /// Even though the property as already been set when instantiating this call,
14808 /// we provide this method for API completeness.
14809 pub fn request(mut self, new_value: Model) -> ModelPatchCall<'a, C> {
14810 self._request = new_value;
14811 self
14812 }
14813 /// Required. Project ID of the model to patch.
14814 ///
14815 /// Sets the *project id* path property to the given value.
14816 ///
14817 /// Even though the property as already been set when instantiating this call,
14818 /// we provide this method for API completeness.
14819 pub fn project_id(mut self, new_value: &str) -> ModelPatchCall<'a, C> {
14820 self._project_id = new_value.to_string();
14821 self
14822 }
14823 /// Required. Dataset ID of the model to patch.
14824 ///
14825 /// Sets the *dataset id* path property to the given value.
14826 ///
14827 /// Even though the property as already been set when instantiating this call,
14828 /// we provide this method for API completeness.
14829 pub fn dataset_id(mut self, new_value: &str) -> ModelPatchCall<'a, C> {
14830 self._dataset_id = new_value.to_string();
14831 self
14832 }
14833 /// Required. Model ID of the model to patch.
14834 ///
14835 /// Sets the *model id* path property to the given value.
14836 ///
14837 /// Even though the property as already been set when instantiating this call,
14838 /// we provide this method for API completeness.
14839 pub fn model_id(mut self, new_value: &str) -> ModelPatchCall<'a, C> {
14840 self._model_id = new_value.to_string();
14841 self
14842 }
14843 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
14844 /// while executing the actual API request.
14845 ///
14846 /// ````text
14847 /// It should be used to handle progress information, and to implement a certain level of resilience.
14848 /// ````
14849 ///
14850 /// Sets the *delegate* property to the given value.
14851 pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> ModelPatchCall<'a, C> {
14852 self._delegate = Some(new_value);
14853 self
14854 }
14855
14856 /// Set any additional parameter of the query string used in the request.
14857 /// It should be used to set parameters which are not yet available through their own
14858 /// setters.
14859 ///
14860 /// Please note that this method must not be used to set any of the known parameters
14861 /// which have their own setter method. If done anyway, the request will fail.
14862 ///
14863 /// # Additional Parameters
14864 ///
14865 /// * *$.xgafv* (query-string) - V1 error format.
14866 /// * *access_token* (query-string) - OAuth access token.
14867 /// * *alt* (query-string) - Data format for response.
14868 /// * *callback* (query-string) - JSONP
14869 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
14870 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
14871 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
14872 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
14873 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
14874 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
14875 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
14876 pub fn param<T>(mut self, name: T, value: T) -> ModelPatchCall<'a, C>
14877 where
14878 T: AsRef<str>,
14879 {
14880 self._additional_params
14881 .insert(name.as_ref().to_string(), value.as_ref().to_string());
14882 self
14883 }
14884
14885 /// Identifies the authorization scope for the method you are building.
14886 ///
14887 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
14888 /// [`Scope::CloudPlatform`].
14889 ///
14890 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
14891 /// tokens for more than one scope.
14892 ///
14893 /// Usually there is more than one suitable scope to authorize an operation, some of which may
14894 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
14895 /// sufficient, a read-write scope will do as well.
14896 pub fn add_scope<St>(mut self, scope: St) -> ModelPatchCall<'a, C>
14897 where
14898 St: AsRef<str>,
14899 {
14900 self._scopes.insert(String::from(scope.as_ref()));
14901 self
14902 }
14903 /// Identifies the authorization scope(s) for the method you are building.
14904 ///
14905 /// See [`Self::add_scope()`] for details.
14906 pub fn add_scopes<I, St>(mut self, scopes: I) -> ModelPatchCall<'a, C>
14907 where
14908 I: IntoIterator<Item = St>,
14909 St: AsRef<str>,
14910 {
14911 self._scopes
14912 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
14913 self
14914 }
14915
14916 /// Removes all scopes, and no default scope will be used either.
14917 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
14918 /// for details).
14919 pub fn clear_scopes(mut self) -> ModelPatchCall<'a, C> {
14920 self._scopes.clear();
14921 self
14922 }
14923}
14924
14925/// RPC to get the service account for a project used for interactions with Google Cloud KMS
14926///
14927/// A builder for the *getServiceAccount* method supported by a *project* resource.
14928/// It is not used directly, but through a [`ProjectMethods`] instance.
14929///
14930/// # Example
14931///
14932/// Instantiate a resource method builder
14933///
14934/// ```test_harness,no_run
14935/// # extern crate hyper;
14936/// # extern crate hyper_rustls;
14937/// # extern crate google_bigquery2 as bigquery2;
14938/// # async fn dox() {
14939/// # use bigquery2::{Bigquery, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
14940///
14941/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
14942/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
14943/// # .with_native_roots()
14944/// # .unwrap()
14945/// # .https_only()
14946/// # .enable_http2()
14947/// # .build();
14948///
14949/// # let executor = hyper_util::rt::TokioExecutor::new();
14950/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
14951/// # secret,
14952/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
14953/// # yup_oauth2::client::CustomHyperClientBuilder::from(
14954/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
14955/// # ),
14956/// # ).build().await.unwrap();
14957///
14958/// # let client = hyper_util::client::legacy::Client::builder(
14959/// # hyper_util::rt::TokioExecutor::new()
14960/// # )
14961/// # .build(
14962/// # hyper_rustls::HttpsConnectorBuilder::new()
14963/// # .with_native_roots()
14964/// # .unwrap()
14965/// # .https_or_http()
14966/// # .enable_http2()
14967/// # .build()
14968/// # );
14969/// # let mut hub = Bigquery::new(client, auth);
14970/// // You can configure optional parameters by calling the respective setters at will, and
14971/// // execute the final call using `doit()`.
14972/// // Values shown here are possibly random and not representative !
14973/// let result = hub.projects().get_service_account("projectId")
14974/// .doit().await;
14975/// # }
14976/// ```
14977pub struct ProjectGetServiceAccountCall<'a, C>
14978where
14979 C: 'a,
14980{
14981 hub: &'a Bigquery<C>,
14982 _project_id: String,
14983 _delegate: Option<&'a mut dyn common::Delegate>,
14984 _additional_params: HashMap<String, String>,
14985 _scopes: BTreeSet<String>,
14986}
14987
14988impl<'a, C> common::CallBuilder for ProjectGetServiceAccountCall<'a, C> {}
14989
14990impl<'a, C> ProjectGetServiceAccountCall<'a, C>
14991where
14992 C: common::Connector,
14993{
14994 /// Perform the operation you have build so far.
14995 pub async fn doit(mut self) -> common::Result<(common::Response, GetServiceAccountResponse)> {
14996 use std::borrow::Cow;
14997 use std::io::{Read, Seek};
14998
14999 use common::{url::Params, ToParts};
15000 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
15001
15002 let mut dd = common::DefaultDelegate;
15003 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
15004 dlg.begin(common::MethodInfo {
15005 id: "bigquery.projects.getServiceAccount",
15006 http_method: hyper::Method::GET,
15007 });
15008
15009 for &field in ["alt", "projectId"].iter() {
15010 if self._additional_params.contains_key(field) {
15011 dlg.finished(false);
15012 return Err(common::Error::FieldClash(field));
15013 }
15014 }
15015
15016 let mut params = Params::with_capacity(3 + self._additional_params.len());
15017 params.push("projectId", self._project_id);
15018
15019 params.extend(self._additional_params.iter());
15020
15021 params.push("alt", "json");
15022 let mut url = self.hub._base_url.clone() + "projects/{+projectId}/serviceAccount";
15023 if self._scopes.is_empty() {
15024 self._scopes
15025 .insert(Scope::CloudPlatformReadOnly.as_ref().to_string());
15026 }
15027
15028 #[allow(clippy::single_element_loop)]
15029 for &(find_this, param_name) in [("{+projectId}", "projectId")].iter() {
15030 url = params.uri_replacement(url, param_name, find_this, true);
15031 }
15032 {
15033 let to_remove = ["projectId"];
15034 params.remove_params(&to_remove);
15035 }
15036
15037 let url = params.parse_with_url(&url);
15038
15039 loop {
15040 let token = match self
15041 .hub
15042 .auth
15043 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
15044 .await
15045 {
15046 Ok(token) => token,
15047 Err(e) => match dlg.token(e) {
15048 Ok(token) => token,
15049 Err(e) => {
15050 dlg.finished(false);
15051 return Err(common::Error::MissingToken(e));
15052 }
15053 },
15054 };
15055 let mut req_result = {
15056 let client = &self.hub.client;
15057 dlg.pre_request();
15058 let mut req_builder = hyper::Request::builder()
15059 .method(hyper::Method::GET)
15060 .uri(url.as_str())
15061 .header(USER_AGENT, self.hub._user_agent.clone());
15062
15063 if let Some(token) = token.as_ref() {
15064 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
15065 }
15066
15067 let request = req_builder
15068 .header(CONTENT_LENGTH, 0_u64)
15069 .body(common::to_body::<String>(None));
15070
15071 client.request(request.unwrap()).await
15072 };
15073
15074 match req_result {
15075 Err(err) => {
15076 if let common::Retry::After(d) = dlg.http_error(&err) {
15077 sleep(d).await;
15078 continue;
15079 }
15080 dlg.finished(false);
15081 return Err(common::Error::HttpError(err));
15082 }
15083 Ok(res) => {
15084 let (mut parts, body) = res.into_parts();
15085 let mut body = common::Body::new(body);
15086 if !parts.status.is_success() {
15087 let bytes = common::to_bytes(body).await.unwrap_or_default();
15088 let error = serde_json::from_str(&common::to_string(&bytes));
15089 let response = common::to_response(parts, bytes.into());
15090
15091 if let common::Retry::After(d) =
15092 dlg.http_failure(&response, error.as_ref().ok())
15093 {
15094 sleep(d).await;
15095 continue;
15096 }
15097
15098 dlg.finished(false);
15099
15100 return Err(match error {
15101 Ok(value) => common::Error::BadRequest(value),
15102 _ => common::Error::Failure(response),
15103 });
15104 }
15105 let response = {
15106 let bytes = common::to_bytes(body).await.unwrap_or_default();
15107 let encoded = common::to_string(&bytes);
15108 match serde_json::from_str(&encoded) {
15109 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
15110 Err(error) => {
15111 dlg.response_json_decode_error(&encoded, &error);
15112 return Err(common::Error::JsonDecodeError(
15113 encoded.to_string(),
15114 error,
15115 ));
15116 }
15117 }
15118 };
15119
15120 dlg.finished(true);
15121 return Ok(response);
15122 }
15123 }
15124 }
15125 }
15126
15127 /// Required. ID of the project.
15128 ///
15129 /// Sets the *project id* path property to the given value.
15130 ///
15131 /// Even though the property as already been set when instantiating this call,
15132 /// we provide this method for API completeness.
15133 pub fn project_id(mut self, new_value: &str) -> ProjectGetServiceAccountCall<'a, C> {
15134 self._project_id = new_value.to_string();
15135 self
15136 }
15137 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
15138 /// while executing the actual API request.
15139 ///
15140 /// ````text
15141 /// It should be used to handle progress information, and to implement a certain level of resilience.
15142 /// ````
15143 ///
15144 /// Sets the *delegate* property to the given value.
15145 pub fn delegate(
15146 mut self,
15147 new_value: &'a mut dyn common::Delegate,
15148 ) -> ProjectGetServiceAccountCall<'a, C> {
15149 self._delegate = Some(new_value);
15150 self
15151 }
15152
15153 /// Set any additional parameter of the query string used in the request.
15154 /// It should be used to set parameters which are not yet available through their own
15155 /// setters.
15156 ///
15157 /// Please note that this method must not be used to set any of the known parameters
15158 /// which have their own setter method. If done anyway, the request will fail.
15159 ///
15160 /// # Additional Parameters
15161 ///
15162 /// * *$.xgafv* (query-string) - V1 error format.
15163 /// * *access_token* (query-string) - OAuth access token.
15164 /// * *alt* (query-string) - Data format for response.
15165 /// * *callback* (query-string) - JSONP
15166 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
15167 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
15168 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
15169 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
15170 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
15171 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
15172 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
15173 pub fn param<T>(mut self, name: T, value: T) -> ProjectGetServiceAccountCall<'a, C>
15174 where
15175 T: AsRef<str>,
15176 {
15177 self._additional_params
15178 .insert(name.as_ref().to_string(), value.as_ref().to_string());
15179 self
15180 }
15181
15182 /// Identifies the authorization scope for the method you are building.
15183 ///
15184 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
15185 /// [`Scope::CloudPlatformReadOnly`].
15186 ///
15187 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
15188 /// tokens for more than one scope.
15189 ///
15190 /// Usually there is more than one suitable scope to authorize an operation, some of which may
15191 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
15192 /// sufficient, a read-write scope will do as well.
15193 pub fn add_scope<St>(mut self, scope: St) -> ProjectGetServiceAccountCall<'a, C>
15194 where
15195 St: AsRef<str>,
15196 {
15197 self._scopes.insert(String::from(scope.as_ref()));
15198 self
15199 }
15200 /// Identifies the authorization scope(s) for the method you are building.
15201 ///
15202 /// See [`Self::add_scope()`] for details.
15203 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectGetServiceAccountCall<'a, C>
15204 where
15205 I: IntoIterator<Item = St>,
15206 St: AsRef<str>,
15207 {
15208 self._scopes
15209 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
15210 self
15211 }
15212
15213 /// Removes all scopes, and no default scope will be used either.
15214 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
15215 /// for details).
15216 pub fn clear_scopes(mut self) -> ProjectGetServiceAccountCall<'a, C> {
15217 self._scopes.clear();
15218 self
15219 }
15220}
15221
15222/// RPC to list projects to which the user has been granted any project role. Users of this method are encouraged to consider the [Resource Manager](https://cloud.google.com/resource-manager/docs/) API, which provides the underlying data for this method and has more capabilities.
15223///
15224/// A builder for the *list* method supported by a *project* resource.
15225/// It is not used directly, but through a [`ProjectMethods`] instance.
15226///
15227/// # Example
15228///
15229/// Instantiate a resource method builder
15230///
15231/// ```test_harness,no_run
15232/// # extern crate hyper;
15233/// # extern crate hyper_rustls;
15234/// # extern crate google_bigquery2 as bigquery2;
15235/// # async fn dox() {
15236/// # use bigquery2::{Bigquery, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
15237///
15238/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
15239/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
15240/// # .with_native_roots()
15241/// # .unwrap()
15242/// # .https_only()
15243/// # .enable_http2()
15244/// # .build();
15245///
15246/// # let executor = hyper_util::rt::TokioExecutor::new();
15247/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
15248/// # secret,
15249/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
15250/// # yup_oauth2::client::CustomHyperClientBuilder::from(
15251/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
15252/// # ),
15253/// # ).build().await.unwrap();
15254///
15255/// # let client = hyper_util::client::legacy::Client::builder(
15256/// # hyper_util::rt::TokioExecutor::new()
15257/// # )
15258/// # .build(
15259/// # hyper_rustls::HttpsConnectorBuilder::new()
15260/// # .with_native_roots()
15261/// # .unwrap()
15262/// # .https_or_http()
15263/// # .enable_http2()
15264/// # .build()
15265/// # );
15266/// # let mut hub = Bigquery::new(client, auth);
15267/// // You can configure optional parameters by calling the respective setters at will, and
15268/// // execute the final call using `doit()`.
15269/// // Values shown here are possibly random and not representative !
15270/// let result = hub.projects().list()
15271/// .page_token("takimata")
15272/// .max_results(82)
15273/// .doit().await;
15274/// # }
15275/// ```
15276pub struct ProjectListCall<'a, C>
15277where
15278 C: 'a,
15279{
15280 hub: &'a Bigquery<C>,
15281 _page_token: Option<String>,
15282 _max_results: Option<u32>,
15283 _delegate: Option<&'a mut dyn common::Delegate>,
15284 _additional_params: HashMap<String, String>,
15285 _scopes: BTreeSet<String>,
15286}
15287
15288impl<'a, C> common::CallBuilder for ProjectListCall<'a, C> {}
15289
15290impl<'a, C> ProjectListCall<'a, C>
15291where
15292 C: common::Connector,
15293{
15294 /// Perform the operation you have build so far.
15295 pub async fn doit(mut self) -> common::Result<(common::Response, ProjectList)> {
15296 use std::borrow::Cow;
15297 use std::io::{Read, Seek};
15298
15299 use common::{url::Params, ToParts};
15300 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
15301
15302 let mut dd = common::DefaultDelegate;
15303 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
15304 dlg.begin(common::MethodInfo {
15305 id: "bigquery.projects.list",
15306 http_method: hyper::Method::GET,
15307 });
15308
15309 for &field in ["alt", "pageToken", "maxResults"].iter() {
15310 if self._additional_params.contains_key(field) {
15311 dlg.finished(false);
15312 return Err(common::Error::FieldClash(field));
15313 }
15314 }
15315
15316 let mut params = Params::with_capacity(4 + self._additional_params.len());
15317 if let Some(value) = self._page_token.as_ref() {
15318 params.push("pageToken", value);
15319 }
15320 if let Some(value) = self._max_results.as_ref() {
15321 params.push("maxResults", value.to_string());
15322 }
15323
15324 params.extend(self._additional_params.iter());
15325
15326 params.push("alt", "json");
15327 let mut url = self.hub._base_url.clone() + "projects";
15328 if self._scopes.is_empty() {
15329 self._scopes
15330 .insert(Scope::CloudPlatformReadOnly.as_ref().to_string());
15331 }
15332
15333 let url = params.parse_with_url(&url);
15334
15335 loop {
15336 let token = match self
15337 .hub
15338 .auth
15339 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
15340 .await
15341 {
15342 Ok(token) => token,
15343 Err(e) => match dlg.token(e) {
15344 Ok(token) => token,
15345 Err(e) => {
15346 dlg.finished(false);
15347 return Err(common::Error::MissingToken(e));
15348 }
15349 },
15350 };
15351 let mut req_result = {
15352 let client = &self.hub.client;
15353 dlg.pre_request();
15354 let mut req_builder = hyper::Request::builder()
15355 .method(hyper::Method::GET)
15356 .uri(url.as_str())
15357 .header(USER_AGENT, self.hub._user_agent.clone());
15358
15359 if let Some(token) = token.as_ref() {
15360 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
15361 }
15362
15363 let request = req_builder
15364 .header(CONTENT_LENGTH, 0_u64)
15365 .body(common::to_body::<String>(None));
15366
15367 client.request(request.unwrap()).await
15368 };
15369
15370 match req_result {
15371 Err(err) => {
15372 if let common::Retry::After(d) = dlg.http_error(&err) {
15373 sleep(d).await;
15374 continue;
15375 }
15376 dlg.finished(false);
15377 return Err(common::Error::HttpError(err));
15378 }
15379 Ok(res) => {
15380 let (mut parts, body) = res.into_parts();
15381 let mut body = common::Body::new(body);
15382 if !parts.status.is_success() {
15383 let bytes = common::to_bytes(body).await.unwrap_or_default();
15384 let error = serde_json::from_str(&common::to_string(&bytes));
15385 let response = common::to_response(parts, bytes.into());
15386
15387 if let common::Retry::After(d) =
15388 dlg.http_failure(&response, error.as_ref().ok())
15389 {
15390 sleep(d).await;
15391 continue;
15392 }
15393
15394 dlg.finished(false);
15395
15396 return Err(match error {
15397 Ok(value) => common::Error::BadRequest(value),
15398 _ => common::Error::Failure(response),
15399 });
15400 }
15401 let response = {
15402 let bytes = common::to_bytes(body).await.unwrap_or_default();
15403 let encoded = common::to_string(&bytes);
15404 match serde_json::from_str(&encoded) {
15405 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
15406 Err(error) => {
15407 dlg.response_json_decode_error(&encoded, &error);
15408 return Err(common::Error::JsonDecodeError(
15409 encoded.to_string(),
15410 error,
15411 ));
15412 }
15413 }
15414 };
15415
15416 dlg.finished(true);
15417 return Ok(response);
15418 }
15419 }
15420 }
15421 }
15422
15423 /// Page token, returned by a previous call, to request the next page of results. If not present, no further pages are present.
15424 ///
15425 /// Sets the *page token* query property to the given value.
15426 pub fn page_token(mut self, new_value: &str) -> ProjectListCall<'a, C> {
15427 self._page_token = Some(new_value.to_string());
15428 self
15429 }
15430 /// `maxResults` unset returns all results, up to 50 per page. Additionally, the number of projects in a page may be fewer than `maxResults` because projects are retrieved and then filtered to only projects with the BigQuery API enabled.
15431 ///
15432 /// Sets the *max results* query property to the given value.
15433 pub fn max_results(mut self, new_value: u32) -> ProjectListCall<'a, C> {
15434 self._max_results = Some(new_value);
15435 self
15436 }
15437 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
15438 /// while executing the actual API request.
15439 ///
15440 /// ````text
15441 /// It should be used to handle progress information, and to implement a certain level of resilience.
15442 /// ````
15443 ///
15444 /// Sets the *delegate* property to the given value.
15445 pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> ProjectListCall<'a, C> {
15446 self._delegate = Some(new_value);
15447 self
15448 }
15449
15450 /// Set any additional parameter of the query string used in the request.
15451 /// It should be used to set parameters which are not yet available through their own
15452 /// setters.
15453 ///
15454 /// Please note that this method must not be used to set any of the known parameters
15455 /// which have their own setter method. If done anyway, the request will fail.
15456 ///
15457 /// # Additional Parameters
15458 ///
15459 /// * *$.xgafv* (query-string) - V1 error format.
15460 /// * *access_token* (query-string) - OAuth access token.
15461 /// * *alt* (query-string) - Data format for response.
15462 /// * *callback* (query-string) - JSONP
15463 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
15464 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
15465 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
15466 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
15467 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
15468 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
15469 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
15470 pub fn param<T>(mut self, name: T, value: T) -> ProjectListCall<'a, C>
15471 where
15472 T: AsRef<str>,
15473 {
15474 self._additional_params
15475 .insert(name.as_ref().to_string(), value.as_ref().to_string());
15476 self
15477 }
15478
15479 /// Identifies the authorization scope for the method you are building.
15480 ///
15481 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
15482 /// [`Scope::CloudPlatformReadOnly`].
15483 ///
15484 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
15485 /// tokens for more than one scope.
15486 ///
15487 /// Usually there is more than one suitable scope to authorize an operation, some of which may
15488 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
15489 /// sufficient, a read-write scope will do as well.
15490 pub fn add_scope<St>(mut self, scope: St) -> ProjectListCall<'a, C>
15491 where
15492 St: AsRef<str>,
15493 {
15494 self._scopes.insert(String::from(scope.as_ref()));
15495 self
15496 }
15497 /// Identifies the authorization scope(s) for the method you are building.
15498 ///
15499 /// See [`Self::add_scope()`] for details.
15500 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectListCall<'a, C>
15501 where
15502 I: IntoIterator<Item = St>,
15503 St: AsRef<str>,
15504 {
15505 self._scopes
15506 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
15507 self
15508 }
15509
15510 /// Removes all scopes, and no default scope will be used either.
15511 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
15512 /// for details).
15513 pub fn clear_scopes(mut self) -> ProjectListCall<'a, C> {
15514 self._scopes.clear();
15515 self
15516 }
15517}
15518
15519/// Deletes the routine specified by routineId from the dataset.
15520///
15521/// A builder for the *delete* method supported by a *routine* resource.
15522/// It is not used directly, but through a [`RoutineMethods`] instance.
15523///
15524/// # Example
15525///
15526/// Instantiate a resource method builder
15527///
15528/// ```test_harness,no_run
15529/// # extern crate hyper;
15530/// # extern crate hyper_rustls;
15531/// # extern crate google_bigquery2 as bigquery2;
15532/// # async fn dox() {
15533/// # use bigquery2::{Bigquery, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
15534///
15535/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
15536/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
15537/// # .with_native_roots()
15538/// # .unwrap()
15539/// # .https_only()
15540/// # .enable_http2()
15541/// # .build();
15542///
15543/// # let executor = hyper_util::rt::TokioExecutor::new();
15544/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
15545/// # secret,
15546/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
15547/// # yup_oauth2::client::CustomHyperClientBuilder::from(
15548/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
15549/// # ),
15550/// # ).build().await.unwrap();
15551///
15552/// # let client = hyper_util::client::legacy::Client::builder(
15553/// # hyper_util::rt::TokioExecutor::new()
15554/// # )
15555/// # .build(
15556/// # hyper_rustls::HttpsConnectorBuilder::new()
15557/// # .with_native_roots()
15558/// # .unwrap()
15559/// # .https_or_http()
15560/// # .enable_http2()
15561/// # .build()
15562/// # );
15563/// # let mut hub = Bigquery::new(client, auth);
15564/// // You can configure optional parameters by calling the respective setters at will, and
15565/// // execute the final call using `doit()`.
15566/// // Values shown here are possibly random and not representative !
15567/// let result = hub.routines().delete("projectId", "datasetId", "routineId")
15568/// .doit().await;
15569/// # }
15570/// ```
15571pub struct RoutineDeleteCall<'a, C>
15572where
15573 C: 'a,
15574{
15575 hub: &'a Bigquery<C>,
15576 _project_id: String,
15577 _dataset_id: String,
15578 _routine_id: String,
15579 _delegate: Option<&'a mut dyn common::Delegate>,
15580 _additional_params: HashMap<String, String>,
15581 _scopes: BTreeSet<String>,
15582}
15583
15584impl<'a, C> common::CallBuilder for RoutineDeleteCall<'a, C> {}
15585
15586impl<'a, C> RoutineDeleteCall<'a, C>
15587where
15588 C: common::Connector,
15589{
15590 /// Perform the operation you have build so far.
15591 pub async fn doit(mut self) -> common::Result<common::Response> {
15592 use std::borrow::Cow;
15593 use std::io::{Read, Seek};
15594
15595 use common::{url::Params, ToParts};
15596 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
15597
15598 let mut dd = common::DefaultDelegate;
15599 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
15600 dlg.begin(common::MethodInfo {
15601 id: "bigquery.routines.delete",
15602 http_method: hyper::Method::DELETE,
15603 });
15604
15605 for &field in ["projectId", "datasetId", "routineId"].iter() {
15606 if self._additional_params.contains_key(field) {
15607 dlg.finished(false);
15608 return Err(common::Error::FieldClash(field));
15609 }
15610 }
15611
15612 let mut params = Params::with_capacity(4 + self._additional_params.len());
15613 params.push("projectId", self._project_id);
15614 params.push("datasetId", self._dataset_id);
15615 params.push("routineId", self._routine_id);
15616
15617 params.extend(self._additional_params.iter());
15618
15619 let mut url = self.hub._base_url.clone()
15620 + "projects/{+projectId}/datasets/{+datasetId}/routines/{+routineId}";
15621 if self._scopes.is_empty() {
15622 self._scopes
15623 .insert(Scope::CloudPlatform.as_ref().to_string());
15624 }
15625
15626 #[allow(clippy::single_element_loop)]
15627 for &(find_this, param_name) in [
15628 ("{+projectId}", "projectId"),
15629 ("{+datasetId}", "datasetId"),
15630 ("{+routineId}", "routineId"),
15631 ]
15632 .iter()
15633 {
15634 url = params.uri_replacement(url, param_name, find_this, true);
15635 }
15636 {
15637 let to_remove = ["routineId", "datasetId", "projectId"];
15638 params.remove_params(&to_remove);
15639 }
15640
15641 let url = params.parse_with_url(&url);
15642
15643 loop {
15644 let token = match self
15645 .hub
15646 .auth
15647 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
15648 .await
15649 {
15650 Ok(token) => token,
15651 Err(e) => match dlg.token(e) {
15652 Ok(token) => token,
15653 Err(e) => {
15654 dlg.finished(false);
15655 return Err(common::Error::MissingToken(e));
15656 }
15657 },
15658 };
15659 let mut req_result = {
15660 let client = &self.hub.client;
15661 dlg.pre_request();
15662 let mut req_builder = hyper::Request::builder()
15663 .method(hyper::Method::DELETE)
15664 .uri(url.as_str())
15665 .header(USER_AGENT, self.hub._user_agent.clone());
15666
15667 if let Some(token) = token.as_ref() {
15668 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
15669 }
15670
15671 let request = req_builder
15672 .header(CONTENT_LENGTH, 0_u64)
15673 .body(common::to_body::<String>(None));
15674
15675 client.request(request.unwrap()).await
15676 };
15677
15678 match req_result {
15679 Err(err) => {
15680 if let common::Retry::After(d) = dlg.http_error(&err) {
15681 sleep(d).await;
15682 continue;
15683 }
15684 dlg.finished(false);
15685 return Err(common::Error::HttpError(err));
15686 }
15687 Ok(res) => {
15688 let (mut parts, body) = res.into_parts();
15689 let mut body = common::Body::new(body);
15690 if !parts.status.is_success() {
15691 let bytes = common::to_bytes(body).await.unwrap_or_default();
15692 let error = serde_json::from_str(&common::to_string(&bytes));
15693 let response = common::to_response(parts, bytes.into());
15694
15695 if let common::Retry::After(d) =
15696 dlg.http_failure(&response, error.as_ref().ok())
15697 {
15698 sleep(d).await;
15699 continue;
15700 }
15701
15702 dlg.finished(false);
15703
15704 return Err(match error {
15705 Ok(value) => common::Error::BadRequest(value),
15706 _ => common::Error::Failure(response),
15707 });
15708 }
15709 let response = common::Response::from_parts(parts, body);
15710
15711 dlg.finished(true);
15712 return Ok(response);
15713 }
15714 }
15715 }
15716 }
15717
15718 /// Required. Project ID of the routine to delete
15719 ///
15720 /// Sets the *project id* path property to the given value.
15721 ///
15722 /// Even though the property as already been set when instantiating this call,
15723 /// we provide this method for API completeness.
15724 pub fn project_id(mut self, new_value: &str) -> RoutineDeleteCall<'a, C> {
15725 self._project_id = new_value.to_string();
15726 self
15727 }
15728 /// Required. Dataset ID of the routine to delete
15729 ///
15730 /// Sets the *dataset id* path property to the given value.
15731 ///
15732 /// Even though the property as already been set when instantiating this call,
15733 /// we provide this method for API completeness.
15734 pub fn dataset_id(mut self, new_value: &str) -> RoutineDeleteCall<'a, C> {
15735 self._dataset_id = new_value.to_string();
15736 self
15737 }
15738 /// Required. Routine ID of the routine to delete
15739 ///
15740 /// Sets the *routine id* path property to the given value.
15741 ///
15742 /// Even though the property as already been set when instantiating this call,
15743 /// we provide this method for API completeness.
15744 pub fn routine_id(mut self, new_value: &str) -> RoutineDeleteCall<'a, C> {
15745 self._routine_id = new_value.to_string();
15746 self
15747 }
15748 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
15749 /// while executing the actual API request.
15750 ///
15751 /// ````text
15752 /// It should be used to handle progress information, and to implement a certain level of resilience.
15753 /// ````
15754 ///
15755 /// Sets the *delegate* property to the given value.
15756 pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> RoutineDeleteCall<'a, C> {
15757 self._delegate = Some(new_value);
15758 self
15759 }
15760
15761 /// Set any additional parameter of the query string used in the request.
15762 /// It should be used to set parameters which are not yet available through their own
15763 /// setters.
15764 ///
15765 /// Please note that this method must not be used to set any of the known parameters
15766 /// which have their own setter method. If done anyway, the request will fail.
15767 ///
15768 /// # Additional Parameters
15769 ///
15770 /// * *$.xgafv* (query-string) - V1 error format.
15771 /// * *access_token* (query-string) - OAuth access token.
15772 /// * *alt* (query-string) - Data format for response.
15773 /// * *callback* (query-string) - JSONP
15774 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
15775 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
15776 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
15777 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
15778 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
15779 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
15780 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
15781 pub fn param<T>(mut self, name: T, value: T) -> RoutineDeleteCall<'a, C>
15782 where
15783 T: AsRef<str>,
15784 {
15785 self._additional_params
15786 .insert(name.as_ref().to_string(), value.as_ref().to_string());
15787 self
15788 }
15789
15790 /// Identifies the authorization scope for the method you are building.
15791 ///
15792 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
15793 /// [`Scope::CloudPlatform`].
15794 ///
15795 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
15796 /// tokens for more than one scope.
15797 ///
15798 /// Usually there is more than one suitable scope to authorize an operation, some of which may
15799 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
15800 /// sufficient, a read-write scope will do as well.
15801 pub fn add_scope<St>(mut self, scope: St) -> RoutineDeleteCall<'a, C>
15802 where
15803 St: AsRef<str>,
15804 {
15805 self._scopes.insert(String::from(scope.as_ref()));
15806 self
15807 }
15808 /// Identifies the authorization scope(s) for the method you are building.
15809 ///
15810 /// See [`Self::add_scope()`] for details.
15811 pub fn add_scopes<I, St>(mut self, scopes: I) -> RoutineDeleteCall<'a, C>
15812 where
15813 I: IntoIterator<Item = St>,
15814 St: AsRef<str>,
15815 {
15816 self._scopes
15817 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
15818 self
15819 }
15820
15821 /// Removes all scopes, and no default scope will be used either.
15822 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
15823 /// for details).
15824 pub fn clear_scopes(mut self) -> RoutineDeleteCall<'a, C> {
15825 self._scopes.clear();
15826 self
15827 }
15828}
15829
15830/// Gets the specified routine resource by routine ID.
15831///
15832/// A builder for the *get* method supported by a *routine* resource.
15833/// It is not used directly, but through a [`RoutineMethods`] instance.
15834///
15835/// # Example
15836///
15837/// Instantiate a resource method builder
15838///
15839/// ```test_harness,no_run
15840/// # extern crate hyper;
15841/// # extern crate hyper_rustls;
15842/// # extern crate google_bigquery2 as bigquery2;
15843/// # async fn dox() {
15844/// # use bigquery2::{Bigquery, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
15845///
15846/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
15847/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
15848/// # .with_native_roots()
15849/// # .unwrap()
15850/// # .https_only()
15851/// # .enable_http2()
15852/// # .build();
15853///
15854/// # let executor = hyper_util::rt::TokioExecutor::new();
15855/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
15856/// # secret,
15857/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
15858/// # yup_oauth2::client::CustomHyperClientBuilder::from(
15859/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
15860/// # ),
15861/// # ).build().await.unwrap();
15862///
15863/// # let client = hyper_util::client::legacy::Client::builder(
15864/// # hyper_util::rt::TokioExecutor::new()
15865/// # )
15866/// # .build(
15867/// # hyper_rustls::HttpsConnectorBuilder::new()
15868/// # .with_native_roots()
15869/// # .unwrap()
15870/// # .https_or_http()
15871/// # .enable_http2()
15872/// # .build()
15873/// # );
15874/// # let mut hub = Bigquery::new(client, auth);
15875/// // You can configure optional parameters by calling the respective setters at will, and
15876/// // execute the final call using `doit()`.
15877/// // Values shown here are possibly random and not representative !
15878/// let result = hub.routines().get("projectId", "datasetId", "routineId")
15879/// .read_mask(FieldMask::new::<&str>(&[]))
15880/// .doit().await;
15881/// # }
15882/// ```
15883pub struct RoutineGetCall<'a, C>
15884where
15885 C: 'a,
15886{
15887 hub: &'a Bigquery<C>,
15888 _project_id: String,
15889 _dataset_id: String,
15890 _routine_id: String,
15891 _read_mask: Option<common::FieldMask>,
15892 _delegate: Option<&'a mut dyn common::Delegate>,
15893 _additional_params: HashMap<String, String>,
15894 _scopes: BTreeSet<String>,
15895}
15896
15897impl<'a, C> common::CallBuilder for RoutineGetCall<'a, C> {}
15898
15899impl<'a, C> RoutineGetCall<'a, C>
15900where
15901 C: common::Connector,
15902{
15903 /// Perform the operation you have build so far.
15904 pub async fn doit(mut self) -> common::Result<(common::Response, Routine)> {
15905 use std::borrow::Cow;
15906 use std::io::{Read, Seek};
15907
15908 use common::{url::Params, ToParts};
15909 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
15910
15911 let mut dd = common::DefaultDelegate;
15912 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
15913 dlg.begin(common::MethodInfo {
15914 id: "bigquery.routines.get",
15915 http_method: hyper::Method::GET,
15916 });
15917
15918 for &field in ["alt", "projectId", "datasetId", "routineId", "readMask"].iter() {
15919 if self._additional_params.contains_key(field) {
15920 dlg.finished(false);
15921 return Err(common::Error::FieldClash(field));
15922 }
15923 }
15924
15925 let mut params = Params::with_capacity(6 + self._additional_params.len());
15926 params.push("projectId", self._project_id);
15927 params.push("datasetId", self._dataset_id);
15928 params.push("routineId", self._routine_id);
15929 if let Some(value) = self._read_mask.as_ref() {
15930 params.push("readMask", value.to_string());
15931 }
15932
15933 params.extend(self._additional_params.iter());
15934
15935 params.push("alt", "json");
15936 let mut url = self.hub._base_url.clone()
15937 + "projects/{+projectId}/datasets/{+datasetId}/routines/{+routineId}";
15938 if self._scopes.is_empty() {
15939 self._scopes
15940 .insert(Scope::CloudPlatformReadOnly.as_ref().to_string());
15941 }
15942
15943 #[allow(clippy::single_element_loop)]
15944 for &(find_this, param_name) in [
15945 ("{+projectId}", "projectId"),
15946 ("{+datasetId}", "datasetId"),
15947 ("{+routineId}", "routineId"),
15948 ]
15949 .iter()
15950 {
15951 url = params.uri_replacement(url, param_name, find_this, true);
15952 }
15953 {
15954 let to_remove = ["routineId", "datasetId", "projectId"];
15955 params.remove_params(&to_remove);
15956 }
15957
15958 let url = params.parse_with_url(&url);
15959
15960 loop {
15961 let token = match self
15962 .hub
15963 .auth
15964 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
15965 .await
15966 {
15967 Ok(token) => token,
15968 Err(e) => match dlg.token(e) {
15969 Ok(token) => token,
15970 Err(e) => {
15971 dlg.finished(false);
15972 return Err(common::Error::MissingToken(e));
15973 }
15974 },
15975 };
15976 let mut req_result = {
15977 let client = &self.hub.client;
15978 dlg.pre_request();
15979 let mut req_builder = hyper::Request::builder()
15980 .method(hyper::Method::GET)
15981 .uri(url.as_str())
15982 .header(USER_AGENT, self.hub._user_agent.clone());
15983
15984 if let Some(token) = token.as_ref() {
15985 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
15986 }
15987
15988 let request = req_builder
15989 .header(CONTENT_LENGTH, 0_u64)
15990 .body(common::to_body::<String>(None));
15991
15992 client.request(request.unwrap()).await
15993 };
15994
15995 match req_result {
15996 Err(err) => {
15997 if let common::Retry::After(d) = dlg.http_error(&err) {
15998 sleep(d).await;
15999 continue;
16000 }
16001 dlg.finished(false);
16002 return Err(common::Error::HttpError(err));
16003 }
16004 Ok(res) => {
16005 let (mut parts, body) = res.into_parts();
16006 let mut body = common::Body::new(body);
16007 if !parts.status.is_success() {
16008 let bytes = common::to_bytes(body).await.unwrap_or_default();
16009 let error = serde_json::from_str(&common::to_string(&bytes));
16010 let response = common::to_response(parts, bytes.into());
16011
16012 if let common::Retry::After(d) =
16013 dlg.http_failure(&response, error.as_ref().ok())
16014 {
16015 sleep(d).await;
16016 continue;
16017 }
16018
16019 dlg.finished(false);
16020
16021 return Err(match error {
16022 Ok(value) => common::Error::BadRequest(value),
16023 _ => common::Error::Failure(response),
16024 });
16025 }
16026 let response = {
16027 let bytes = common::to_bytes(body).await.unwrap_or_default();
16028 let encoded = common::to_string(&bytes);
16029 match serde_json::from_str(&encoded) {
16030 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
16031 Err(error) => {
16032 dlg.response_json_decode_error(&encoded, &error);
16033 return Err(common::Error::JsonDecodeError(
16034 encoded.to_string(),
16035 error,
16036 ));
16037 }
16038 }
16039 };
16040
16041 dlg.finished(true);
16042 return Ok(response);
16043 }
16044 }
16045 }
16046 }
16047
16048 /// Required. Project ID of the requested routine
16049 ///
16050 /// Sets the *project id* path property to the given value.
16051 ///
16052 /// Even though the property as already been set when instantiating this call,
16053 /// we provide this method for API completeness.
16054 pub fn project_id(mut self, new_value: &str) -> RoutineGetCall<'a, C> {
16055 self._project_id = new_value.to_string();
16056 self
16057 }
16058 /// Required. Dataset ID of the requested routine
16059 ///
16060 /// Sets the *dataset id* path property to the given value.
16061 ///
16062 /// Even though the property as already been set when instantiating this call,
16063 /// we provide this method for API completeness.
16064 pub fn dataset_id(mut self, new_value: &str) -> RoutineGetCall<'a, C> {
16065 self._dataset_id = new_value.to_string();
16066 self
16067 }
16068 /// Required. Routine ID of the requested routine
16069 ///
16070 /// Sets the *routine id* path property to the given value.
16071 ///
16072 /// Even though the property as already been set when instantiating this call,
16073 /// we provide this method for API completeness.
16074 pub fn routine_id(mut self, new_value: &str) -> RoutineGetCall<'a, C> {
16075 self._routine_id = new_value.to_string();
16076 self
16077 }
16078 /// If set, only the Routine fields in the field mask are returned in the response. If unset, all Routine fields are returned.
16079 ///
16080 /// Sets the *read mask* query property to the given value.
16081 pub fn read_mask(mut self, new_value: common::FieldMask) -> RoutineGetCall<'a, C> {
16082 self._read_mask = Some(new_value);
16083 self
16084 }
16085 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
16086 /// while executing the actual API request.
16087 ///
16088 /// ````text
16089 /// It should be used to handle progress information, and to implement a certain level of resilience.
16090 /// ````
16091 ///
16092 /// Sets the *delegate* property to the given value.
16093 pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> RoutineGetCall<'a, C> {
16094 self._delegate = Some(new_value);
16095 self
16096 }
16097
16098 /// Set any additional parameter of the query string used in the request.
16099 /// It should be used to set parameters which are not yet available through their own
16100 /// setters.
16101 ///
16102 /// Please note that this method must not be used to set any of the known parameters
16103 /// which have their own setter method. If done anyway, the request will fail.
16104 ///
16105 /// # Additional Parameters
16106 ///
16107 /// * *$.xgafv* (query-string) - V1 error format.
16108 /// * *access_token* (query-string) - OAuth access token.
16109 /// * *alt* (query-string) - Data format for response.
16110 /// * *callback* (query-string) - JSONP
16111 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
16112 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
16113 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
16114 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
16115 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
16116 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
16117 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
16118 pub fn param<T>(mut self, name: T, value: T) -> RoutineGetCall<'a, C>
16119 where
16120 T: AsRef<str>,
16121 {
16122 self._additional_params
16123 .insert(name.as_ref().to_string(), value.as_ref().to_string());
16124 self
16125 }
16126
16127 /// Identifies the authorization scope for the method you are building.
16128 ///
16129 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
16130 /// [`Scope::CloudPlatformReadOnly`].
16131 ///
16132 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
16133 /// tokens for more than one scope.
16134 ///
16135 /// Usually there is more than one suitable scope to authorize an operation, some of which may
16136 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
16137 /// sufficient, a read-write scope will do as well.
16138 pub fn add_scope<St>(mut self, scope: St) -> RoutineGetCall<'a, C>
16139 where
16140 St: AsRef<str>,
16141 {
16142 self._scopes.insert(String::from(scope.as_ref()));
16143 self
16144 }
16145 /// Identifies the authorization scope(s) for the method you are building.
16146 ///
16147 /// See [`Self::add_scope()`] for details.
16148 pub fn add_scopes<I, St>(mut self, scopes: I) -> RoutineGetCall<'a, C>
16149 where
16150 I: IntoIterator<Item = St>,
16151 St: AsRef<str>,
16152 {
16153 self._scopes
16154 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
16155 self
16156 }
16157
16158 /// Removes all scopes, and no default scope will be used either.
16159 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
16160 /// for details).
16161 pub fn clear_scopes(mut self) -> RoutineGetCall<'a, C> {
16162 self._scopes.clear();
16163 self
16164 }
16165}
16166
16167/// Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.
16168///
16169/// A builder for the *getIamPolicy* method supported by a *routine* resource.
16170/// It is not used directly, but through a [`RoutineMethods`] instance.
16171///
16172/// # Example
16173///
16174/// Instantiate a resource method builder
16175///
16176/// ```test_harness,no_run
16177/// # extern crate hyper;
16178/// # extern crate hyper_rustls;
16179/// # extern crate google_bigquery2 as bigquery2;
16180/// use bigquery2::api::GetIamPolicyRequest;
16181/// # async fn dox() {
16182/// # use bigquery2::{Bigquery, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
16183///
16184/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
16185/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
16186/// # .with_native_roots()
16187/// # .unwrap()
16188/// # .https_only()
16189/// # .enable_http2()
16190/// # .build();
16191///
16192/// # let executor = hyper_util::rt::TokioExecutor::new();
16193/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
16194/// # secret,
16195/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
16196/// # yup_oauth2::client::CustomHyperClientBuilder::from(
16197/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
16198/// # ),
16199/// # ).build().await.unwrap();
16200///
16201/// # let client = hyper_util::client::legacy::Client::builder(
16202/// # hyper_util::rt::TokioExecutor::new()
16203/// # )
16204/// # .build(
16205/// # hyper_rustls::HttpsConnectorBuilder::new()
16206/// # .with_native_roots()
16207/// # .unwrap()
16208/// # .https_or_http()
16209/// # .enable_http2()
16210/// # .build()
16211/// # );
16212/// # let mut hub = Bigquery::new(client, auth);
16213/// // As the method needs a request, you would usually fill it with the desired information
16214/// // into the respective structure. Some of the parts shown here might not be applicable !
16215/// // Values shown here are possibly random and not representative !
16216/// let mut req = GetIamPolicyRequest::default();
16217///
16218/// // You can configure optional parameters by calling the respective setters at will, and
16219/// // execute the final call using `doit()`.
16220/// // Values shown here are possibly random and not representative !
16221/// let result = hub.routines().get_iam_policy(req, "resource")
16222/// .doit().await;
16223/// # }
16224/// ```
16225pub struct RoutineGetIamPolicyCall<'a, C>
16226where
16227 C: 'a,
16228{
16229 hub: &'a Bigquery<C>,
16230 _request: GetIamPolicyRequest,
16231 _resource: String,
16232 _delegate: Option<&'a mut dyn common::Delegate>,
16233 _additional_params: HashMap<String, String>,
16234 _scopes: BTreeSet<String>,
16235}
16236
16237impl<'a, C> common::CallBuilder for RoutineGetIamPolicyCall<'a, C> {}
16238
16239impl<'a, C> RoutineGetIamPolicyCall<'a, C>
16240where
16241 C: common::Connector,
16242{
16243 /// Perform the operation you have build so far.
16244 pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
16245 use std::borrow::Cow;
16246 use std::io::{Read, Seek};
16247
16248 use common::{url::Params, ToParts};
16249 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
16250
16251 let mut dd = common::DefaultDelegate;
16252 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
16253 dlg.begin(common::MethodInfo {
16254 id: "bigquery.routines.getIamPolicy",
16255 http_method: hyper::Method::POST,
16256 });
16257
16258 for &field in ["alt", "resource"].iter() {
16259 if self._additional_params.contains_key(field) {
16260 dlg.finished(false);
16261 return Err(common::Error::FieldClash(field));
16262 }
16263 }
16264
16265 let mut params = Params::with_capacity(4 + self._additional_params.len());
16266 params.push("resource", self._resource);
16267
16268 params.extend(self._additional_params.iter());
16269
16270 params.push("alt", "json");
16271 let mut url = self.hub._base_url.clone() + "{+resource}:getIamPolicy";
16272 if self._scopes.is_empty() {
16273 self._scopes
16274 .insert(Scope::CloudPlatformReadOnly.as_ref().to_string());
16275 }
16276
16277 #[allow(clippy::single_element_loop)]
16278 for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
16279 url = params.uri_replacement(url, param_name, find_this, true);
16280 }
16281 {
16282 let to_remove = ["resource"];
16283 params.remove_params(&to_remove);
16284 }
16285
16286 let url = params.parse_with_url(&url);
16287
16288 let mut json_mime_type = mime::APPLICATION_JSON;
16289 let mut request_value_reader = {
16290 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
16291 common::remove_json_null_values(&mut value);
16292 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
16293 serde_json::to_writer(&mut dst, &value).unwrap();
16294 dst
16295 };
16296 let request_size = request_value_reader
16297 .seek(std::io::SeekFrom::End(0))
16298 .unwrap();
16299 request_value_reader
16300 .seek(std::io::SeekFrom::Start(0))
16301 .unwrap();
16302
16303 loop {
16304 let token = match self
16305 .hub
16306 .auth
16307 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
16308 .await
16309 {
16310 Ok(token) => token,
16311 Err(e) => match dlg.token(e) {
16312 Ok(token) => token,
16313 Err(e) => {
16314 dlg.finished(false);
16315 return Err(common::Error::MissingToken(e));
16316 }
16317 },
16318 };
16319 request_value_reader
16320 .seek(std::io::SeekFrom::Start(0))
16321 .unwrap();
16322 let mut req_result = {
16323 let client = &self.hub.client;
16324 dlg.pre_request();
16325 let mut req_builder = hyper::Request::builder()
16326 .method(hyper::Method::POST)
16327 .uri(url.as_str())
16328 .header(USER_AGENT, self.hub._user_agent.clone());
16329
16330 if let Some(token) = token.as_ref() {
16331 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
16332 }
16333
16334 let request = req_builder
16335 .header(CONTENT_TYPE, json_mime_type.to_string())
16336 .header(CONTENT_LENGTH, request_size as u64)
16337 .body(common::to_body(
16338 request_value_reader.get_ref().clone().into(),
16339 ));
16340
16341 client.request(request.unwrap()).await
16342 };
16343
16344 match req_result {
16345 Err(err) => {
16346 if let common::Retry::After(d) = dlg.http_error(&err) {
16347 sleep(d).await;
16348 continue;
16349 }
16350 dlg.finished(false);
16351 return Err(common::Error::HttpError(err));
16352 }
16353 Ok(res) => {
16354 let (mut parts, body) = res.into_parts();
16355 let mut body = common::Body::new(body);
16356 if !parts.status.is_success() {
16357 let bytes = common::to_bytes(body).await.unwrap_or_default();
16358 let error = serde_json::from_str(&common::to_string(&bytes));
16359 let response = common::to_response(parts, bytes.into());
16360
16361 if let common::Retry::After(d) =
16362 dlg.http_failure(&response, error.as_ref().ok())
16363 {
16364 sleep(d).await;
16365 continue;
16366 }
16367
16368 dlg.finished(false);
16369
16370 return Err(match error {
16371 Ok(value) => common::Error::BadRequest(value),
16372 _ => common::Error::Failure(response),
16373 });
16374 }
16375 let response = {
16376 let bytes = common::to_bytes(body).await.unwrap_or_default();
16377 let encoded = common::to_string(&bytes);
16378 match serde_json::from_str(&encoded) {
16379 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
16380 Err(error) => {
16381 dlg.response_json_decode_error(&encoded, &error);
16382 return Err(common::Error::JsonDecodeError(
16383 encoded.to_string(),
16384 error,
16385 ));
16386 }
16387 }
16388 };
16389
16390 dlg.finished(true);
16391 return Ok(response);
16392 }
16393 }
16394 }
16395 }
16396
16397 ///
16398 /// Sets the *request* property to the given value.
16399 ///
16400 /// Even though the property as already been set when instantiating this call,
16401 /// we provide this method for API completeness.
16402 pub fn request(mut self, new_value: GetIamPolicyRequest) -> RoutineGetIamPolicyCall<'a, C> {
16403 self._request = new_value;
16404 self
16405 }
16406 /// REQUIRED: The resource for which the policy is being requested. See [Resource names](https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
16407 ///
16408 /// Sets the *resource* path property to the given value.
16409 ///
16410 /// Even though the property as already been set when instantiating this call,
16411 /// we provide this method for API completeness.
16412 pub fn resource(mut self, new_value: &str) -> RoutineGetIamPolicyCall<'a, C> {
16413 self._resource = new_value.to_string();
16414 self
16415 }
16416 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
16417 /// while executing the actual API request.
16418 ///
16419 /// ````text
16420 /// It should be used to handle progress information, and to implement a certain level of resilience.
16421 /// ````
16422 ///
16423 /// Sets the *delegate* property to the given value.
16424 pub fn delegate(
16425 mut self,
16426 new_value: &'a mut dyn common::Delegate,
16427 ) -> RoutineGetIamPolicyCall<'a, C> {
16428 self._delegate = Some(new_value);
16429 self
16430 }
16431
16432 /// Set any additional parameter of the query string used in the request.
16433 /// It should be used to set parameters which are not yet available through their own
16434 /// setters.
16435 ///
16436 /// Please note that this method must not be used to set any of the known parameters
16437 /// which have their own setter method. If done anyway, the request will fail.
16438 ///
16439 /// # Additional Parameters
16440 ///
16441 /// * *$.xgafv* (query-string) - V1 error format.
16442 /// * *access_token* (query-string) - OAuth access token.
16443 /// * *alt* (query-string) - Data format for response.
16444 /// * *callback* (query-string) - JSONP
16445 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
16446 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
16447 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
16448 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
16449 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
16450 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
16451 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
16452 pub fn param<T>(mut self, name: T, value: T) -> RoutineGetIamPolicyCall<'a, C>
16453 where
16454 T: AsRef<str>,
16455 {
16456 self._additional_params
16457 .insert(name.as_ref().to_string(), value.as_ref().to_string());
16458 self
16459 }
16460
16461 /// Identifies the authorization scope for the method you are building.
16462 ///
16463 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
16464 /// [`Scope::CloudPlatformReadOnly`].
16465 ///
16466 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
16467 /// tokens for more than one scope.
16468 ///
16469 /// Usually there is more than one suitable scope to authorize an operation, some of which may
16470 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
16471 /// sufficient, a read-write scope will do as well.
16472 pub fn add_scope<St>(mut self, scope: St) -> RoutineGetIamPolicyCall<'a, C>
16473 where
16474 St: AsRef<str>,
16475 {
16476 self._scopes.insert(String::from(scope.as_ref()));
16477 self
16478 }
16479 /// Identifies the authorization scope(s) for the method you are building.
16480 ///
16481 /// See [`Self::add_scope()`] for details.
16482 pub fn add_scopes<I, St>(mut self, scopes: I) -> RoutineGetIamPolicyCall<'a, C>
16483 where
16484 I: IntoIterator<Item = St>,
16485 St: AsRef<str>,
16486 {
16487 self._scopes
16488 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
16489 self
16490 }
16491
16492 /// Removes all scopes, and no default scope will be used either.
16493 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
16494 /// for details).
16495 pub fn clear_scopes(mut self) -> RoutineGetIamPolicyCall<'a, C> {
16496 self._scopes.clear();
16497 self
16498 }
16499}
16500
16501/// Creates a new routine in the dataset.
16502///
16503/// A builder for the *insert* method supported by a *routine* resource.
16504/// It is not used directly, but through a [`RoutineMethods`] instance.
16505///
16506/// # Example
16507///
16508/// Instantiate a resource method builder
16509///
16510/// ```test_harness,no_run
16511/// # extern crate hyper;
16512/// # extern crate hyper_rustls;
16513/// # extern crate google_bigquery2 as bigquery2;
16514/// use bigquery2::api::Routine;
16515/// # async fn dox() {
16516/// # use bigquery2::{Bigquery, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
16517///
16518/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
16519/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
16520/// # .with_native_roots()
16521/// # .unwrap()
16522/// # .https_only()
16523/// # .enable_http2()
16524/// # .build();
16525///
16526/// # let executor = hyper_util::rt::TokioExecutor::new();
16527/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
16528/// # secret,
16529/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
16530/// # yup_oauth2::client::CustomHyperClientBuilder::from(
16531/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
16532/// # ),
16533/// # ).build().await.unwrap();
16534///
16535/// # let client = hyper_util::client::legacy::Client::builder(
16536/// # hyper_util::rt::TokioExecutor::new()
16537/// # )
16538/// # .build(
16539/// # hyper_rustls::HttpsConnectorBuilder::new()
16540/// # .with_native_roots()
16541/// # .unwrap()
16542/// # .https_or_http()
16543/// # .enable_http2()
16544/// # .build()
16545/// # );
16546/// # let mut hub = Bigquery::new(client, auth);
16547/// // As the method needs a request, you would usually fill it with the desired information
16548/// // into the respective structure. Some of the parts shown here might not be applicable !
16549/// // Values shown here are possibly random and not representative !
16550/// let mut req = Routine::default();
16551///
16552/// // You can configure optional parameters by calling the respective setters at will, and
16553/// // execute the final call using `doit()`.
16554/// // Values shown here are possibly random and not representative !
16555/// let result = hub.routines().insert(req, "projectId", "datasetId")
16556/// .doit().await;
16557/// # }
16558/// ```
16559pub struct RoutineInsertCall<'a, C>
16560where
16561 C: 'a,
16562{
16563 hub: &'a Bigquery<C>,
16564 _request: Routine,
16565 _project_id: String,
16566 _dataset_id: String,
16567 _delegate: Option<&'a mut dyn common::Delegate>,
16568 _additional_params: HashMap<String, String>,
16569 _scopes: BTreeSet<String>,
16570}
16571
16572impl<'a, C> common::CallBuilder for RoutineInsertCall<'a, C> {}
16573
16574impl<'a, C> RoutineInsertCall<'a, C>
16575where
16576 C: common::Connector,
16577{
16578 /// Perform the operation you have build so far.
16579 pub async fn doit(mut self) -> common::Result<(common::Response, Routine)> {
16580 use std::borrow::Cow;
16581 use std::io::{Read, Seek};
16582
16583 use common::{url::Params, ToParts};
16584 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
16585
16586 let mut dd = common::DefaultDelegate;
16587 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
16588 dlg.begin(common::MethodInfo {
16589 id: "bigquery.routines.insert",
16590 http_method: hyper::Method::POST,
16591 });
16592
16593 for &field in ["alt", "projectId", "datasetId"].iter() {
16594 if self._additional_params.contains_key(field) {
16595 dlg.finished(false);
16596 return Err(common::Error::FieldClash(field));
16597 }
16598 }
16599
16600 let mut params = Params::with_capacity(5 + self._additional_params.len());
16601 params.push("projectId", self._project_id);
16602 params.push("datasetId", self._dataset_id);
16603
16604 params.extend(self._additional_params.iter());
16605
16606 params.push("alt", "json");
16607 let mut url =
16608 self.hub._base_url.clone() + "projects/{+projectId}/datasets/{+datasetId}/routines";
16609 if self._scopes.is_empty() {
16610 self._scopes
16611 .insert(Scope::CloudPlatform.as_ref().to_string());
16612 }
16613
16614 #[allow(clippy::single_element_loop)]
16615 for &(find_this, param_name) in
16616 [("{+projectId}", "projectId"), ("{+datasetId}", "datasetId")].iter()
16617 {
16618 url = params.uri_replacement(url, param_name, find_this, true);
16619 }
16620 {
16621 let to_remove = ["datasetId", "projectId"];
16622 params.remove_params(&to_remove);
16623 }
16624
16625 let url = params.parse_with_url(&url);
16626
16627 let mut json_mime_type = mime::APPLICATION_JSON;
16628 let mut request_value_reader = {
16629 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
16630 common::remove_json_null_values(&mut value);
16631 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
16632 serde_json::to_writer(&mut dst, &value).unwrap();
16633 dst
16634 };
16635 let request_size = request_value_reader
16636 .seek(std::io::SeekFrom::End(0))
16637 .unwrap();
16638 request_value_reader
16639 .seek(std::io::SeekFrom::Start(0))
16640 .unwrap();
16641
16642 loop {
16643 let token = match self
16644 .hub
16645 .auth
16646 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
16647 .await
16648 {
16649 Ok(token) => token,
16650 Err(e) => match dlg.token(e) {
16651 Ok(token) => token,
16652 Err(e) => {
16653 dlg.finished(false);
16654 return Err(common::Error::MissingToken(e));
16655 }
16656 },
16657 };
16658 request_value_reader
16659 .seek(std::io::SeekFrom::Start(0))
16660 .unwrap();
16661 let mut req_result = {
16662 let client = &self.hub.client;
16663 dlg.pre_request();
16664 let mut req_builder = hyper::Request::builder()
16665 .method(hyper::Method::POST)
16666 .uri(url.as_str())
16667 .header(USER_AGENT, self.hub._user_agent.clone());
16668
16669 if let Some(token) = token.as_ref() {
16670 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
16671 }
16672
16673 let request = req_builder
16674 .header(CONTENT_TYPE, json_mime_type.to_string())
16675 .header(CONTENT_LENGTH, request_size as u64)
16676 .body(common::to_body(
16677 request_value_reader.get_ref().clone().into(),
16678 ));
16679
16680 client.request(request.unwrap()).await
16681 };
16682
16683 match req_result {
16684 Err(err) => {
16685 if let common::Retry::After(d) = dlg.http_error(&err) {
16686 sleep(d).await;
16687 continue;
16688 }
16689 dlg.finished(false);
16690 return Err(common::Error::HttpError(err));
16691 }
16692 Ok(res) => {
16693 let (mut parts, body) = res.into_parts();
16694 let mut body = common::Body::new(body);
16695 if !parts.status.is_success() {
16696 let bytes = common::to_bytes(body).await.unwrap_or_default();
16697 let error = serde_json::from_str(&common::to_string(&bytes));
16698 let response = common::to_response(parts, bytes.into());
16699
16700 if let common::Retry::After(d) =
16701 dlg.http_failure(&response, error.as_ref().ok())
16702 {
16703 sleep(d).await;
16704 continue;
16705 }
16706
16707 dlg.finished(false);
16708
16709 return Err(match error {
16710 Ok(value) => common::Error::BadRequest(value),
16711 _ => common::Error::Failure(response),
16712 });
16713 }
16714 let response = {
16715 let bytes = common::to_bytes(body).await.unwrap_or_default();
16716 let encoded = common::to_string(&bytes);
16717 match serde_json::from_str(&encoded) {
16718 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
16719 Err(error) => {
16720 dlg.response_json_decode_error(&encoded, &error);
16721 return Err(common::Error::JsonDecodeError(
16722 encoded.to_string(),
16723 error,
16724 ));
16725 }
16726 }
16727 };
16728
16729 dlg.finished(true);
16730 return Ok(response);
16731 }
16732 }
16733 }
16734 }
16735
16736 ///
16737 /// Sets the *request* property to the given value.
16738 ///
16739 /// Even though the property as already been set when instantiating this call,
16740 /// we provide this method for API completeness.
16741 pub fn request(mut self, new_value: Routine) -> RoutineInsertCall<'a, C> {
16742 self._request = new_value;
16743 self
16744 }
16745 /// Required. Project ID of the new routine
16746 ///
16747 /// Sets the *project id* path property to the given value.
16748 ///
16749 /// Even though the property as already been set when instantiating this call,
16750 /// we provide this method for API completeness.
16751 pub fn project_id(mut self, new_value: &str) -> RoutineInsertCall<'a, C> {
16752 self._project_id = new_value.to_string();
16753 self
16754 }
16755 /// Required. Dataset ID of the new routine
16756 ///
16757 /// Sets the *dataset id* path property to the given value.
16758 ///
16759 /// Even though the property as already been set when instantiating this call,
16760 /// we provide this method for API completeness.
16761 pub fn dataset_id(mut self, new_value: &str) -> RoutineInsertCall<'a, C> {
16762 self._dataset_id = new_value.to_string();
16763 self
16764 }
16765 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
16766 /// while executing the actual API request.
16767 ///
16768 /// ````text
16769 /// It should be used to handle progress information, and to implement a certain level of resilience.
16770 /// ````
16771 ///
16772 /// Sets the *delegate* property to the given value.
16773 pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> RoutineInsertCall<'a, C> {
16774 self._delegate = Some(new_value);
16775 self
16776 }
16777
16778 /// Set any additional parameter of the query string used in the request.
16779 /// It should be used to set parameters which are not yet available through their own
16780 /// setters.
16781 ///
16782 /// Please note that this method must not be used to set any of the known parameters
16783 /// which have their own setter method. If done anyway, the request will fail.
16784 ///
16785 /// # Additional Parameters
16786 ///
16787 /// * *$.xgafv* (query-string) - V1 error format.
16788 /// * *access_token* (query-string) - OAuth access token.
16789 /// * *alt* (query-string) - Data format for response.
16790 /// * *callback* (query-string) - JSONP
16791 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
16792 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
16793 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
16794 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
16795 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
16796 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
16797 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
16798 pub fn param<T>(mut self, name: T, value: T) -> RoutineInsertCall<'a, C>
16799 where
16800 T: AsRef<str>,
16801 {
16802 self._additional_params
16803 .insert(name.as_ref().to_string(), value.as_ref().to_string());
16804 self
16805 }
16806
16807 /// Identifies the authorization scope for the method you are building.
16808 ///
16809 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
16810 /// [`Scope::CloudPlatform`].
16811 ///
16812 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
16813 /// tokens for more than one scope.
16814 ///
16815 /// Usually there is more than one suitable scope to authorize an operation, some of which may
16816 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
16817 /// sufficient, a read-write scope will do as well.
16818 pub fn add_scope<St>(mut self, scope: St) -> RoutineInsertCall<'a, C>
16819 where
16820 St: AsRef<str>,
16821 {
16822 self._scopes.insert(String::from(scope.as_ref()));
16823 self
16824 }
16825 /// Identifies the authorization scope(s) for the method you are building.
16826 ///
16827 /// See [`Self::add_scope()`] for details.
16828 pub fn add_scopes<I, St>(mut self, scopes: I) -> RoutineInsertCall<'a, C>
16829 where
16830 I: IntoIterator<Item = St>,
16831 St: AsRef<str>,
16832 {
16833 self._scopes
16834 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
16835 self
16836 }
16837
16838 /// Removes all scopes, and no default scope will be used either.
16839 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
16840 /// for details).
16841 pub fn clear_scopes(mut self) -> RoutineInsertCall<'a, C> {
16842 self._scopes.clear();
16843 self
16844 }
16845}
16846
16847/// Lists all routines in the specified dataset. Requires the READER dataset role.
16848///
16849/// A builder for the *list* method supported by a *routine* resource.
16850/// It is not used directly, but through a [`RoutineMethods`] instance.
16851///
16852/// # Example
16853///
16854/// Instantiate a resource method builder
16855///
16856/// ```test_harness,no_run
16857/// # extern crate hyper;
16858/// # extern crate hyper_rustls;
16859/// # extern crate google_bigquery2 as bigquery2;
16860/// # async fn dox() {
16861/// # use bigquery2::{Bigquery, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
16862///
16863/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
16864/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
16865/// # .with_native_roots()
16866/// # .unwrap()
16867/// # .https_only()
16868/// # .enable_http2()
16869/// # .build();
16870///
16871/// # let executor = hyper_util::rt::TokioExecutor::new();
16872/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
16873/// # secret,
16874/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
16875/// # yup_oauth2::client::CustomHyperClientBuilder::from(
16876/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
16877/// # ),
16878/// # ).build().await.unwrap();
16879///
16880/// # let client = hyper_util::client::legacy::Client::builder(
16881/// # hyper_util::rt::TokioExecutor::new()
16882/// # )
16883/// # .build(
16884/// # hyper_rustls::HttpsConnectorBuilder::new()
16885/// # .with_native_roots()
16886/// # .unwrap()
16887/// # .https_or_http()
16888/// # .enable_http2()
16889/// # .build()
16890/// # );
16891/// # let mut hub = Bigquery::new(client, auth);
16892/// // You can configure optional parameters by calling the respective setters at will, and
16893/// // execute the final call using `doit()`.
16894/// // Values shown here are possibly random and not representative !
16895/// let result = hub.routines().list("projectId", "datasetId")
16896/// .read_mask(FieldMask::new::<&str>(&[]))
16897/// .page_token("Lorem")
16898/// .max_results(63)
16899/// .filter("no")
16900/// .doit().await;
16901/// # }
16902/// ```
16903pub struct RoutineListCall<'a, C>
16904where
16905 C: 'a,
16906{
16907 hub: &'a Bigquery<C>,
16908 _project_id: String,
16909 _dataset_id: String,
16910 _read_mask: Option<common::FieldMask>,
16911 _page_token: Option<String>,
16912 _max_results: Option<u32>,
16913 _filter: Option<String>,
16914 _delegate: Option<&'a mut dyn common::Delegate>,
16915 _additional_params: HashMap<String, String>,
16916 _scopes: BTreeSet<String>,
16917}
16918
16919impl<'a, C> common::CallBuilder for RoutineListCall<'a, C> {}
16920
16921impl<'a, C> RoutineListCall<'a, C>
16922where
16923 C: common::Connector,
16924{
16925 /// Perform the operation you have build so far.
16926 pub async fn doit(mut self) -> common::Result<(common::Response, ListRoutinesResponse)> {
16927 use std::borrow::Cow;
16928 use std::io::{Read, Seek};
16929
16930 use common::{url::Params, ToParts};
16931 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
16932
16933 let mut dd = common::DefaultDelegate;
16934 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
16935 dlg.begin(common::MethodInfo {
16936 id: "bigquery.routines.list",
16937 http_method: hyper::Method::GET,
16938 });
16939
16940 for &field in [
16941 "alt",
16942 "projectId",
16943 "datasetId",
16944 "readMask",
16945 "pageToken",
16946 "maxResults",
16947 "filter",
16948 ]
16949 .iter()
16950 {
16951 if self._additional_params.contains_key(field) {
16952 dlg.finished(false);
16953 return Err(common::Error::FieldClash(field));
16954 }
16955 }
16956
16957 let mut params = Params::with_capacity(8 + self._additional_params.len());
16958 params.push("projectId", self._project_id);
16959 params.push("datasetId", self._dataset_id);
16960 if let Some(value) = self._read_mask.as_ref() {
16961 params.push("readMask", value.to_string());
16962 }
16963 if let Some(value) = self._page_token.as_ref() {
16964 params.push("pageToken", value);
16965 }
16966 if let Some(value) = self._max_results.as_ref() {
16967 params.push("maxResults", value.to_string());
16968 }
16969 if let Some(value) = self._filter.as_ref() {
16970 params.push("filter", value);
16971 }
16972
16973 params.extend(self._additional_params.iter());
16974
16975 params.push("alt", "json");
16976 let mut url =
16977 self.hub._base_url.clone() + "projects/{+projectId}/datasets/{+datasetId}/routines";
16978 if self._scopes.is_empty() {
16979 self._scopes
16980 .insert(Scope::CloudPlatformReadOnly.as_ref().to_string());
16981 }
16982
16983 #[allow(clippy::single_element_loop)]
16984 for &(find_this, param_name) in
16985 [("{+projectId}", "projectId"), ("{+datasetId}", "datasetId")].iter()
16986 {
16987 url = params.uri_replacement(url, param_name, find_this, true);
16988 }
16989 {
16990 let to_remove = ["datasetId", "projectId"];
16991 params.remove_params(&to_remove);
16992 }
16993
16994 let url = params.parse_with_url(&url);
16995
16996 loop {
16997 let token = match self
16998 .hub
16999 .auth
17000 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
17001 .await
17002 {
17003 Ok(token) => token,
17004 Err(e) => match dlg.token(e) {
17005 Ok(token) => token,
17006 Err(e) => {
17007 dlg.finished(false);
17008 return Err(common::Error::MissingToken(e));
17009 }
17010 },
17011 };
17012 let mut req_result = {
17013 let client = &self.hub.client;
17014 dlg.pre_request();
17015 let mut req_builder = hyper::Request::builder()
17016 .method(hyper::Method::GET)
17017 .uri(url.as_str())
17018 .header(USER_AGENT, self.hub._user_agent.clone());
17019
17020 if let Some(token) = token.as_ref() {
17021 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
17022 }
17023
17024 let request = req_builder
17025 .header(CONTENT_LENGTH, 0_u64)
17026 .body(common::to_body::<String>(None));
17027
17028 client.request(request.unwrap()).await
17029 };
17030
17031 match req_result {
17032 Err(err) => {
17033 if let common::Retry::After(d) = dlg.http_error(&err) {
17034 sleep(d).await;
17035 continue;
17036 }
17037 dlg.finished(false);
17038 return Err(common::Error::HttpError(err));
17039 }
17040 Ok(res) => {
17041 let (mut parts, body) = res.into_parts();
17042 let mut body = common::Body::new(body);
17043 if !parts.status.is_success() {
17044 let bytes = common::to_bytes(body).await.unwrap_or_default();
17045 let error = serde_json::from_str(&common::to_string(&bytes));
17046 let response = common::to_response(parts, bytes.into());
17047
17048 if let common::Retry::After(d) =
17049 dlg.http_failure(&response, error.as_ref().ok())
17050 {
17051 sleep(d).await;
17052 continue;
17053 }
17054
17055 dlg.finished(false);
17056
17057 return Err(match error {
17058 Ok(value) => common::Error::BadRequest(value),
17059 _ => common::Error::Failure(response),
17060 });
17061 }
17062 let response = {
17063 let bytes = common::to_bytes(body).await.unwrap_or_default();
17064 let encoded = common::to_string(&bytes);
17065 match serde_json::from_str(&encoded) {
17066 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
17067 Err(error) => {
17068 dlg.response_json_decode_error(&encoded, &error);
17069 return Err(common::Error::JsonDecodeError(
17070 encoded.to_string(),
17071 error,
17072 ));
17073 }
17074 }
17075 };
17076
17077 dlg.finished(true);
17078 return Ok(response);
17079 }
17080 }
17081 }
17082 }
17083
17084 /// Required. Project ID of the routines to list
17085 ///
17086 /// Sets the *project id* path property to the given value.
17087 ///
17088 /// Even though the property as already been set when instantiating this call,
17089 /// we provide this method for API completeness.
17090 pub fn project_id(mut self, new_value: &str) -> RoutineListCall<'a, C> {
17091 self._project_id = new_value.to_string();
17092 self
17093 }
17094 /// Required. Dataset ID of the routines to list
17095 ///
17096 /// Sets the *dataset id* path property to the given value.
17097 ///
17098 /// Even though the property as already been set when instantiating this call,
17099 /// we provide this method for API completeness.
17100 pub fn dataset_id(mut self, new_value: &str) -> RoutineListCall<'a, C> {
17101 self._dataset_id = new_value.to_string();
17102 self
17103 }
17104 /// If set, then only the Routine fields in the field mask, as well as project_id, dataset_id and routine_id, are returned in the response. If unset, then the following Routine fields are returned: etag, project_id, dataset_id, routine_id, routine_type, creation_time, last_modified_time, and language.
17105 ///
17106 /// Sets the *read mask* query property to the given value.
17107 pub fn read_mask(mut self, new_value: common::FieldMask) -> RoutineListCall<'a, C> {
17108 self._read_mask = Some(new_value);
17109 self
17110 }
17111 /// Page token, returned by a previous call, to request the next page of results
17112 ///
17113 /// Sets the *page token* query property to the given value.
17114 pub fn page_token(mut self, new_value: &str) -> RoutineListCall<'a, C> {
17115 self._page_token = Some(new_value.to_string());
17116 self
17117 }
17118 /// The maximum number of results to return in a single response page. Leverage the page tokens to iterate through the entire collection.
17119 ///
17120 /// Sets the *max results* query property to the given value.
17121 pub fn max_results(mut self, new_value: u32) -> RoutineListCall<'a, C> {
17122 self._max_results = Some(new_value);
17123 self
17124 }
17125 /// If set, then only the Routines matching this filter are returned. The supported format is `routineType:{RoutineType}`, where `{RoutineType}` is a RoutineType enum. For example: `routineType:SCALAR_FUNCTION`.
17126 ///
17127 /// Sets the *filter* query property to the given value.
17128 pub fn filter(mut self, new_value: &str) -> RoutineListCall<'a, C> {
17129 self._filter = Some(new_value.to_string());
17130 self
17131 }
17132 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
17133 /// while executing the actual API request.
17134 ///
17135 /// ````text
17136 /// It should be used to handle progress information, and to implement a certain level of resilience.
17137 /// ````
17138 ///
17139 /// Sets the *delegate* property to the given value.
17140 pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> RoutineListCall<'a, C> {
17141 self._delegate = Some(new_value);
17142 self
17143 }
17144
17145 /// Set any additional parameter of the query string used in the request.
17146 /// It should be used to set parameters which are not yet available through their own
17147 /// setters.
17148 ///
17149 /// Please note that this method must not be used to set any of the known parameters
17150 /// which have their own setter method. If done anyway, the request will fail.
17151 ///
17152 /// # Additional Parameters
17153 ///
17154 /// * *$.xgafv* (query-string) - V1 error format.
17155 /// * *access_token* (query-string) - OAuth access token.
17156 /// * *alt* (query-string) - Data format for response.
17157 /// * *callback* (query-string) - JSONP
17158 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
17159 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
17160 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
17161 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
17162 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
17163 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
17164 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
17165 pub fn param<T>(mut self, name: T, value: T) -> RoutineListCall<'a, C>
17166 where
17167 T: AsRef<str>,
17168 {
17169 self._additional_params
17170 .insert(name.as_ref().to_string(), value.as_ref().to_string());
17171 self
17172 }
17173
17174 /// Identifies the authorization scope for the method you are building.
17175 ///
17176 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
17177 /// [`Scope::CloudPlatformReadOnly`].
17178 ///
17179 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
17180 /// tokens for more than one scope.
17181 ///
17182 /// Usually there is more than one suitable scope to authorize an operation, some of which may
17183 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
17184 /// sufficient, a read-write scope will do as well.
17185 pub fn add_scope<St>(mut self, scope: St) -> RoutineListCall<'a, C>
17186 where
17187 St: AsRef<str>,
17188 {
17189 self._scopes.insert(String::from(scope.as_ref()));
17190 self
17191 }
17192 /// Identifies the authorization scope(s) for the method you are building.
17193 ///
17194 /// See [`Self::add_scope()`] for details.
17195 pub fn add_scopes<I, St>(mut self, scopes: I) -> RoutineListCall<'a, C>
17196 where
17197 I: IntoIterator<Item = St>,
17198 St: AsRef<str>,
17199 {
17200 self._scopes
17201 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
17202 self
17203 }
17204
17205 /// Removes all scopes, and no default scope will be used either.
17206 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
17207 /// for details).
17208 pub fn clear_scopes(mut self) -> RoutineListCall<'a, C> {
17209 self._scopes.clear();
17210 self
17211 }
17212}
17213
17214/// Sets the access control policy on the specified resource. Replaces any existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` errors.
17215///
17216/// A builder for the *setIamPolicy* method supported by a *routine* resource.
17217/// It is not used directly, but through a [`RoutineMethods`] instance.
17218///
17219/// # Example
17220///
17221/// Instantiate a resource method builder
17222///
17223/// ```test_harness,no_run
17224/// # extern crate hyper;
17225/// # extern crate hyper_rustls;
17226/// # extern crate google_bigquery2 as bigquery2;
17227/// use bigquery2::api::SetIamPolicyRequest;
17228/// # async fn dox() {
17229/// # use bigquery2::{Bigquery, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
17230///
17231/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
17232/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
17233/// # .with_native_roots()
17234/// # .unwrap()
17235/// # .https_only()
17236/// # .enable_http2()
17237/// # .build();
17238///
17239/// # let executor = hyper_util::rt::TokioExecutor::new();
17240/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
17241/// # secret,
17242/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
17243/// # yup_oauth2::client::CustomHyperClientBuilder::from(
17244/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
17245/// # ),
17246/// # ).build().await.unwrap();
17247///
17248/// # let client = hyper_util::client::legacy::Client::builder(
17249/// # hyper_util::rt::TokioExecutor::new()
17250/// # )
17251/// # .build(
17252/// # hyper_rustls::HttpsConnectorBuilder::new()
17253/// # .with_native_roots()
17254/// # .unwrap()
17255/// # .https_or_http()
17256/// # .enable_http2()
17257/// # .build()
17258/// # );
17259/// # let mut hub = Bigquery::new(client, auth);
17260/// // As the method needs a request, you would usually fill it with the desired information
17261/// // into the respective structure. Some of the parts shown here might not be applicable !
17262/// // Values shown here are possibly random and not representative !
17263/// let mut req = SetIamPolicyRequest::default();
17264///
17265/// // You can configure optional parameters by calling the respective setters at will, and
17266/// // execute the final call using `doit()`.
17267/// // Values shown here are possibly random and not representative !
17268/// let result = hub.routines().set_iam_policy(req, "resource")
17269/// .doit().await;
17270/// # }
17271/// ```
17272pub struct RoutineSetIamPolicyCall<'a, C>
17273where
17274 C: 'a,
17275{
17276 hub: &'a Bigquery<C>,
17277 _request: SetIamPolicyRequest,
17278 _resource: String,
17279 _delegate: Option<&'a mut dyn common::Delegate>,
17280 _additional_params: HashMap<String, String>,
17281 _scopes: BTreeSet<String>,
17282}
17283
17284impl<'a, C> common::CallBuilder for RoutineSetIamPolicyCall<'a, C> {}
17285
17286impl<'a, C> RoutineSetIamPolicyCall<'a, C>
17287where
17288 C: common::Connector,
17289{
17290 /// Perform the operation you have build so far.
17291 pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
17292 use std::borrow::Cow;
17293 use std::io::{Read, Seek};
17294
17295 use common::{url::Params, ToParts};
17296 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
17297
17298 let mut dd = common::DefaultDelegate;
17299 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
17300 dlg.begin(common::MethodInfo {
17301 id: "bigquery.routines.setIamPolicy",
17302 http_method: hyper::Method::POST,
17303 });
17304
17305 for &field in ["alt", "resource"].iter() {
17306 if self._additional_params.contains_key(field) {
17307 dlg.finished(false);
17308 return Err(common::Error::FieldClash(field));
17309 }
17310 }
17311
17312 let mut params = Params::with_capacity(4 + self._additional_params.len());
17313 params.push("resource", self._resource);
17314
17315 params.extend(self._additional_params.iter());
17316
17317 params.push("alt", "json");
17318 let mut url = self.hub._base_url.clone() + "{+resource}:setIamPolicy";
17319 if self._scopes.is_empty() {
17320 self._scopes
17321 .insert(Scope::CloudPlatform.as_ref().to_string());
17322 }
17323
17324 #[allow(clippy::single_element_loop)]
17325 for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
17326 url = params.uri_replacement(url, param_name, find_this, true);
17327 }
17328 {
17329 let to_remove = ["resource"];
17330 params.remove_params(&to_remove);
17331 }
17332
17333 let url = params.parse_with_url(&url);
17334
17335 let mut json_mime_type = mime::APPLICATION_JSON;
17336 let mut request_value_reader = {
17337 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
17338 common::remove_json_null_values(&mut value);
17339 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
17340 serde_json::to_writer(&mut dst, &value).unwrap();
17341 dst
17342 };
17343 let request_size = request_value_reader
17344 .seek(std::io::SeekFrom::End(0))
17345 .unwrap();
17346 request_value_reader
17347 .seek(std::io::SeekFrom::Start(0))
17348 .unwrap();
17349
17350 loop {
17351 let token = match self
17352 .hub
17353 .auth
17354 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
17355 .await
17356 {
17357 Ok(token) => token,
17358 Err(e) => match dlg.token(e) {
17359 Ok(token) => token,
17360 Err(e) => {
17361 dlg.finished(false);
17362 return Err(common::Error::MissingToken(e));
17363 }
17364 },
17365 };
17366 request_value_reader
17367 .seek(std::io::SeekFrom::Start(0))
17368 .unwrap();
17369 let mut req_result = {
17370 let client = &self.hub.client;
17371 dlg.pre_request();
17372 let mut req_builder = hyper::Request::builder()
17373 .method(hyper::Method::POST)
17374 .uri(url.as_str())
17375 .header(USER_AGENT, self.hub._user_agent.clone());
17376
17377 if let Some(token) = token.as_ref() {
17378 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
17379 }
17380
17381 let request = req_builder
17382 .header(CONTENT_TYPE, json_mime_type.to_string())
17383 .header(CONTENT_LENGTH, request_size as u64)
17384 .body(common::to_body(
17385 request_value_reader.get_ref().clone().into(),
17386 ));
17387
17388 client.request(request.unwrap()).await
17389 };
17390
17391 match req_result {
17392 Err(err) => {
17393 if let common::Retry::After(d) = dlg.http_error(&err) {
17394 sleep(d).await;
17395 continue;
17396 }
17397 dlg.finished(false);
17398 return Err(common::Error::HttpError(err));
17399 }
17400 Ok(res) => {
17401 let (mut parts, body) = res.into_parts();
17402 let mut body = common::Body::new(body);
17403 if !parts.status.is_success() {
17404 let bytes = common::to_bytes(body).await.unwrap_or_default();
17405 let error = serde_json::from_str(&common::to_string(&bytes));
17406 let response = common::to_response(parts, bytes.into());
17407
17408 if let common::Retry::After(d) =
17409 dlg.http_failure(&response, error.as_ref().ok())
17410 {
17411 sleep(d).await;
17412 continue;
17413 }
17414
17415 dlg.finished(false);
17416
17417 return Err(match error {
17418 Ok(value) => common::Error::BadRequest(value),
17419 _ => common::Error::Failure(response),
17420 });
17421 }
17422 let response = {
17423 let bytes = common::to_bytes(body).await.unwrap_or_default();
17424 let encoded = common::to_string(&bytes);
17425 match serde_json::from_str(&encoded) {
17426 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
17427 Err(error) => {
17428 dlg.response_json_decode_error(&encoded, &error);
17429 return Err(common::Error::JsonDecodeError(
17430 encoded.to_string(),
17431 error,
17432 ));
17433 }
17434 }
17435 };
17436
17437 dlg.finished(true);
17438 return Ok(response);
17439 }
17440 }
17441 }
17442 }
17443
17444 ///
17445 /// Sets the *request* property to the given value.
17446 ///
17447 /// Even though the property as already been set when instantiating this call,
17448 /// we provide this method for API completeness.
17449 pub fn request(mut self, new_value: SetIamPolicyRequest) -> RoutineSetIamPolicyCall<'a, C> {
17450 self._request = new_value;
17451 self
17452 }
17453 /// REQUIRED: The resource for which the policy is being specified. See [Resource names](https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
17454 ///
17455 /// Sets the *resource* path property to the given value.
17456 ///
17457 /// Even though the property as already been set when instantiating this call,
17458 /// we provide this method for API completeness.
17459 pub fn resource(mut self, new_value: &str) -> RoutineSetIamPolicyCall<'a, C> {
17460 self._resource = new_value.to_string();
17461 self
17462 }
17463 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
17464 /// while executing the actual API request.
17465 ///
17466 /// ````text
17467 /// It should be used to handle progress information, and to implement a certain level of resilience.
17468 /// ````
17469 ///
17470 /// Sets the *delegate* property to the given value.
17471 pub fn delegate(
17472 mut self,
17473 new_value: &'a mut dyn common::Delegate,
17474 ) -> RoutineSetIamPolicyCall<'a, C> {
17475 self._delegate = Some(new_value);
17476 self
17477 }
17478
17479 /// Set any additional parameter of the query string used in the request.
17480 /// It should be used to set parameters which are not yet available through their own
17481 /// setters.
17482 ///
17483 /// Please note that this method must not be used to set any of the known parameters
17484 /// which have their own setter method. If done anyway, the request will fail.
17485 ///
17486 /// # Additional Parameters
17487 ///
17488 /// * *$.xgafv* (query-string) - V1 error format.
17489 /// * *access_token* (query-string) - OAuth access token.
17490 /// * *alt* (query-string) - Data format for response.
17491 /// * *callback* (query-string) - JSONP
17492 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
17493 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
17494 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
17495 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
17496 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
17497 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
17498 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
17499 pub fn param<T>(mut self, name: T, value: T) -> RoutineSetIamPolicyCall<'a, C>
17500 where
17501 T: AsRef<str>,
17502 {
17503 self._additional_params
17504 .insert(name.as_ref().to_string(), value.as_ref().to_string());
17505 self
17506 }
17507
17508 /// Identifies the authorization scope for the method you are building.
17509 ///
17510 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
17511 /// [`Scope::CloudPlatform`].
17512 ///
17513 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
17514 /// tokens for more than one scope.
17515 ///
17516 /// Usually there is more than one suitable scope to authorize an operation, some of which may
17517 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
17518 /// sufficient, a read-write scope will do as well.
17519 pub fn add_scope<St>(mut self, scope: St) -> RoutineSetIamPolicyCall<'a, C>
17520 where
17521 St: AsRef<str>,
17522 {
17523 self._scopes.insert(String::from(scope.as_ref()));
17524 self
17525 }
17526 /// Identifies the authorization scope(s) for the method you are building.
17527 ///
17528 /// See [`Self::add_scope()`] for details.
17529 pub fn add_scopes<I, St>(mut self, scopes: I) -> RoutineSetIamPolicyCall<'a, C>
17530 where
17531 I: IntoIterator<Item = St>,
17532 St: AsRef<str>,
17533 {
17534 self._scopes
17535 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
17536 self
17537 }
17538
17539 /// Removes all scopes, and no default scope will be used either.
17540 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
17541 /// for details).
17542 pub fn clear_scopes(mut self) -> RoutineSetIamPolicyCall<'a, C> {
17543 self._scopes.clear();
17544 self
17545 }
17546}
17547
17548/// Returns permissions that a caller has on the specified resource. If the resource does not exist, this will return an empty set of permissions, not a `NOT_FOUND` error. Note: This operation is designed to be used for building permission-aware UIs and command-line tools, not for authorization checking. This operation may "fail open" without warning.
17549///
17550/// A builder for the *testIamPermissions* method supported by a *routine* resource.
17551/// It is not used directly, but through a [`RoutineMethods`] instance.
17552///
17553/// # Example
17554///
17555/// Instantiate a resource method builder
17556///
17557/// ```test_harness,no_run
17558/// # extern crate hyper;
17559/// # extern crate hyper_rustls;
17560/// # extern crate google_bigquery2 as bigquery2;
17561/// use bigquery2::api::TestIamPermissionsRequest;
17562/// # async fn dox() {
17563/// # use bigquery2::{Bigquery, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
17564///
17565/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
17566/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
17567/// # .with_native_roots()
17568/// # .unwrap()
17569/// # .https_only()
17570/// # .enable_http2()
17571/// # .build();
17572///
17573/// # let executor = hyper_util::rt::TokioExecutor::new();
17574/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
17575/// # secret,
17576/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
17577/// # yup_oauth2::client::CustomHyperClientBuilder::from(
17578/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
17579/// # ),
17580/// # ).build().await.unwrap();
17581///
17582/// # let client = hyper_util::client::legacy::Client::builder(
17583/// # hyper_util::rt::TokioExecutor::new()
17584/// # )
17585/// # .build(
17586/// # hyper_rustls::HttpsConnectorBuilder::new()
17587/// # .with_native_roots()
17588/// # .unwrap()
17589/// # .https_or_http()
17590/// # .enable_http2()
17591/// # .build()
17592/// # );
17593/// # let mut hub = Bigquery::new(client, auth);
17594/// // As the method needs a request, you would usually fill it with the desired information
17595/// // into the respective structure. Some of the parts shown here might not be applicable !
17596/// // Values shown here are possibly random and not representative !
17597/// let mut req = TestIamPermissionsRequest::default();
17598///
17599/// // You can configure optional parameters by calling the respective setters at will, and
17600/// // execute the final call using `doit()`.
17601/// // Values shown here are possibly random and not representative !
17602/// let result = hub.routines().test_iam_permissions(req, "resource")
17603/// .doit().await;
17604/// # }
17605/// ```
17606pub struct RoutineTestIamPermissionCall<'a, C>
17607where
17608 C: 'a,
17609{
17610 hub: &'a Bigquery<C>,
17611 _request: TestIamPermissionsRequest,
17612 _resource: String,
17613 _delegate: Option<&'a mut dyn common::Delegate>,
17614 _additional_params: HashMap<String, String>,
17615 _scopes: BTreeSet<String>,
17616}
17617
17618impl<'a, C> common::CallBuilder for RoutineTestIamPermissionCall<'a, C> {}
17619
17620impl<'a, C> RoutineTestIamPermissionCall<'a, C>
17621where
17622 C: common::Connector,
17623{
17624 /// Perform the operation you have build so far.
17625 pub async fn doit(mut self) -> common::Result<(common::Response, TestIamPermissionsResponse)> {
17626 use std::borrow::Cow;
17627 use std::io::{Read, Seek};
17628
17629 use common::{url::Params, ToParts};
17630 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
17631
17632 let mut dd = common::DefaultDelegate;
17633 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
17634 dlg.begin(common::MethodInfo {
17635 id: "bigquery.routines.testIamPermissions",
17636 http_method: hyper::Method::POST,
17637 });
17638
17639 for &field in ["alt", "resource"].iter() {
17640 if self._additional_params.contains_key(field) {
17641 dlg.finished(false);
17642 return Err(common::Error::FieldClash(field));
17643 }
17644 }
17645
17646 let mut params = Params::with_capacity(4 + self._additional_params.len());
17647 params.push("resource", self._resource);
17648
17649 params.extend(self._additional_params.iter());
17650
17651 params.push("alt", "json");
17652 let mut url = self.hub._base_url.clone() + "{+resource}:testIamPermissions";
17653 if self._scopes.is_empty() {
17654 self._scopes
17655 .insert(Scope::CloudPlatformReadOnly.as_ref().to_string());
17656 }
17657
17658 #[allow(clippy::single_element_loop)]
17659 for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
17660 url = params.uri_replacement(url, param_name, find_this, true);
17661 }
17662 {
17663 let to_remove = ["resource"];
17664 params.remove_params(&to_remove);
17665 }
17666
17667 let url = params.parse_with_url(&url);
17668
17669 let mut json_mime_type = mime::APPLICATION_JSON;
17670 let mut request_value_reader = {
17671 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
17672 common::remove_json_null_values(&mut value);
17673 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
17674 serde_json::to_writer(&mut dst, &value).unwrap();
17675 dst
17676 };
17677 let request_size = request_value_reader
17678 .seek(std::io::SeekFrom::End(0))
17679 .unwrap();
17680 request_value_reader
17681 .seek(std::io::SeekFrom::Start(0))
17682 .unwrap();
17683
17684 loop {
17685 let token = match self
17686 .hub
17687 .auth
17688 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
17689 .await
17690 {
17691 Ok(token) => token,
17692 Err(e) => match dlg.token(e) {
17693 Ok(token) => token,
17694 Err(e) => {
17695 dlg.finished(false);
17696 return Err(common::Error::MissingToken(e));
17697 }
17698 },
17699 };
17700 request_value_reader
17701 .seek(std::io::SeekFrom::Start(0))
17702 .unwrap();
17703 let mut req_result = {
17704 let client = &self.hub.client;
17705 dlg.pre_request();
17706 let mut req_builder = hyper::Request::builder()
17707 .method(hyper::Method::POST)
17708 .uri(url.as_str())
17709 .header(USER_AGENT, self.hub._user_agent.clone());
17710
17711 if let Some(token) = token.as_ref() {
17712 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
17713 }
17714
17715 let request = req_builder
17716 .header(CONTENT_TYPE, json_mime_type.to_string())
17717 .header(CONTENT_LENGTH, request_size as u64)
17718 .body(common::to_body(
17719 request_value_reader.get_ref().clone().into(),
17720 ));
17721
17722 client.request(request.unwrap()).await
17723 };
17724
17725 match req_result {
17726 Err(err) => {
17727 if let common::Retry::After(d) = dlg.http_error(&err) {
17728 sleep(d).await;
17729 continue;
17730 }
17731 dlg.finished(false);
17732 return Err(common::Error::HttpError(err));
17733 }
17734 Ok(res) => {
17735 let (mut parts, body) = res.into_parts();
17736 let mut body = common::Body::new(body);
17737 if !parts.status.is_success() {
17738 let bytes = common::to_bytes(body).await.unwrap_or_default();
17739 let error = serde_json::from_str(&common::to_string(&bytes));
17740 let response = common::to_response(parts, bytes.into());
17741
17742 if let common::Retry::After(d) =
17743 dlg.http_failure(&response, error.as_ref().ok())
17744 {
17745 sleep(d).await;
17746 continue;
17747 }
17748
17749 dlg.finished(false);
17750
17751 return Err(match error {
17752 Ok(value) => common::Error::BadRequest(value),
17753 _ => common::Error::Failure(response),
17754 });
17755 }
17756 let response = {
17757 let bytes = common::to_bytes(body).await.unwrap_or_default();
17758 let encoded = common::to_string(&bytes);
17759 match serde_json::from_str(&encoded) {
17760 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
17761 Err(error) => {
17762 dlg.response_json_decode_error(&encoded, &error);
17763 return Err(common::Error::JsonDecodeError(
17764 encoded.to_string(),
17765 error,
17766 ));
17767 }
17768 }
17769 };
17770
17771 dlg.finished(true);
17772 return Ok(response);
17773 }
17774 }
17775 }
17776 }
17777
17778 ///
17779 /// Sets the *request* property to the given value.
17780 ///
17781 /// Even though the property as already been set when instantiating this call,
17782 /// we provide this method for API completeness.
17783 pub fn request(
17784 mut self,
17785 new_value: TestIamPermissionsRequest,
17786 ) -> RoutineTestIamPermissionCall<'a, C> {
17787 self._request = new_value;
17788 self
17789 }
17790 /// REQUIRED: The resource for which the policy detail is being requested. See [Resource names](https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
17791 ///
17792 /// Sets the *resource* path property to the given value.
17793 ///
17794 /// Even though the property as already been set when instantiating this call,
17795 /// we provide this method for API completeness.
17796 pub fn resource(mut self, new_value: &str) -> RoutineTestIamPermissionCall<'a, C> {
17797 self._resource = new_value.to_string();
17798 self
17799 }
17800 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
17801 /// while executing the actual API request.
17802 ///
17803 /// ````text
17804 /// It should be used to handle progress information, and to implement a certain level of resilience.
17805 /// ````
17806 ///
17807 /// Sets the *delegate* property to the given value.
17808 pub fn delegate(
17809 mut self,
17810 new_value: &'a mut dyn common::Delegate,
17811 ) -> RoutineTestIamPermissionCall<'a, C> {
17812 self._delegate = Some(new_value);
17813 self
17814 }
17815
17816 /// Set any additional parameter of the query string used in the request.
17817 /// It should be used to set parameters which are not yet available through their own
17818 /// setters.
17819 ///
17820 /// Please note that this method must not be used to set any of the known parameters
17821 /// which have their own setter method. If done anyway, the request will fail.
17822 ///
17823 /// # Additional Parameters
17824 ///
17825 /// * *$.xgafv* (query-string) - V1 error format.
17826 /// * *access_token* (query-string) - OAuth access token.
17827 /// * *alt* (query-string) - Data format for response.
17828 /// * *callback* (query-string) - JSONP
17829 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
17830 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
17831 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
17832 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
17833 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
17834 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
17835 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
17836 pub fn param<T>(mut self, name: T, value: T) -> RoutineTestIamPermissionCall<'a, C>
17837 where
17838 T: AsRef<str>,
17839 {
17840 self._additional_params
17841 .insert(name.as_ref().to_string(), value.as_ref().to_string());
17842 self
17843 }
17844
17845 /// Identifies the authorization scope for the method you are building.
17846 ///
17847 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
17848 /// [`Scope::CloudPlatformReadOnly`].
17849 ///
17850 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
17851 /// tokens for more than one scope.
17852 ///
17853 /// Usually there is more than one suitable scope to authorize an operation, some of which may
17854 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
17855 /// sufficient, a read-write scope will do as well.
17856 pub fn add_scope<St>(mut self, scope: St) -> RoutineTestIamPermissionCall<'a, C>
17857 where
17858 St: AsRef<str>,
17859 {
17860 self._scopes.insert(String::from(scope.as_ref()));
17861 self
17862 }
17863 /// Identifies the authorization scope(s) for the method you are building.
17864 ///
17865 /// See [`Self::add_scope()`] for details.
17866 pub fn add_scopes<I, St>(mut self, scopes: I) -> RoutineTestIamPermissionCall<'a, C>
17867 where
17868 I: IntoIterator<Item = St>,
17869 St: AsRef<str>,
17870 {
17871 self._scopes
17872 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
17873 self
17874 }
17875
17876 /// Removes all scopes, and no default scope will be used either.
17877 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
17878 /// for details).
17879 pub fn clear_scopes(mut self) -> RoutineTestIamPermissionCall<'a, C> {
17880 self._scopes.clear();
17881 self
17882 }
17883}
17884
17885/// Updates information in an existing routine. The update method replaces the entire Routine resource.
17886///
17887/// A builder for the *update* method supported by a *routine* resource.
17888/// It is not used directly, but through a [`RoutineMethods`] instance.
17889///
17890/// # Example
17891///
17892/// Instantiate a resource method builder
17893///
17894/// ```test_harness,no_run
17895/// # extern crate hyper;
17896/// # extern crate hyper_rustls;
17897/// # extern crate google_bigquery2 as bigquery2;
17898/// use bigquery2::api::Routine;
17899/// # async fn dox() {
17900/// # use bigquery2::{Bigquery, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
17901///
17902/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
17903/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
17904/// # .with_native_roots()
17905/// # .unwrap()
17906/// # .https_only()
17907/// # .enable_http2()
17908/// # .build();
17909///
17910/// # let executor = hyper_util::rt::TokioExecutor::new();
17911/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
17912/// # secret,
17913/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
17914/// # yup_oauth2::client::CustomHyperClientBuilder::from(
17915/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
17916/// # ),
17917/// # ).build().await.unwrap();
17918///
17919/// # let client = hyper_util::client::legacy::Client::builder(
17920/// # hyper_util::rt::TokioExecutor::new()
17921/// # )
17922/// # .build(
17923/// # hyper_rustls::HttpsConnectorBuilder::new()
17924/// # .with_native_roots()
17925/// # .unwrap()
17926/// # .https_or_http()
17927/// # .enable_http2()
17928/// # .build()
17929/// # );
17930/// # let mut hub = Bigquery::new(client, auth);
17931/// // As the method needs a request, you would usually fill it with the desired information
17932/// // into the respective structure. Some of the parts shown here might not be applicable !
17933/// // Values shown here are possibly random and not representative !
17934/// let mut req = Routine::default();
17935///
17936/// // You can configure optional parameters by calling the respective setters at will, and
17937/// // execute the final call using `doit()`.
17938/// // Values shown here are possibly random and not representative !
17939/// let result = hub.routines().update(req, "projectId", "datasetId", "routineId")
17940/// .doit().await;
17941/// # }
17942/// ```
17943pub struct RoutineUpdateCall<'a, C>
17944where
17945 C: 'a,
17946{
17947 hub: &'a Bigquery<C>,
17948 _request: Routine,
17949 _project_id: String,
17950 _dataset_id: String,
17951 _routine_id: String,
17952 _delegate: Option<&'a mut dyn common::Delegate>,
17953 _additional_params: HashMap<String, String>,
17954 _scopes: BTreeSet<String>,
17955}
17956
17957impl<'a, C> common::CallBuilder for RoutineUpdateCall<'a, C> {}
17958
17959impl<'a, C> RoutineUpdateCall<'a, C>
17960where
17961 C: common::Connector,
17962{
17963 /// Perform the operation you have build so far.
17964 pub async fn doit(mut self) -> common::Result<(common::Response, Routine)> {
17965 use std::borrow::Cow;
17966 use std::io::{Read, Seek};
17967
17968 use common::{url::Params, ToParts};
17969 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
17970
17971 let mut dd = common::DefaultDelegate;
17972 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
17973 dlg.begin(common::MethodInfo {
17974 id: "bigquery.routines.update",
17975 http_method: hyper::Method::PUT,
17976 });
17977
17978 for &field in ["alt", "projectId", "datasetId", "routineId"].iter() {
17979 if self._additional_params.contains_key(field) {
17980 dlg.finished(false);
17981 return Err(common::Error::FieldClash(field));
17982 }
17983 }
17984
17985 let mut params = Params::with_capacity(6 + self._additional_params.len());
17986 params.push("projectId", self._project_id);
17987 params.push("datasetId", self._dataset_id);
17988 params.push("routineId", self._routine_id);
17989
17990 params.extend(self._additional_params.iter());
17991
17992 params.push("alt", "json");
17993 let mut url = self.hub._base_url.clone()
17994 + "projects/{+projectId}/datasets/{+datasetId}/routines/{+routineId}";
17995 if self._scopes.is_empty() {
17996 self._scopes
17997 .insert(Scope::CloudPlatform.as_ref().to_string());
17998 }
17999
18000 #[allow(clippy::single_element_loop)]
18001 for &(find_this, param_name) in [
18002 ("{+projectId}", "projectId"),
18003 ("{+datasetId}", "datasetId"),
18004 ("{+routineId}", "routineId"),
18005 ]
18006 .iter()
18007 {
18008 url = params.uri_replacement(url, param_name, find_this, true);
18009 }
18010 {
18011 let to_remove = ["routineId", "datasetId", "projectId"];
18012 params.remove_params(&to_remove);
18013 }
18014
18015 let url = params.parse_with_url(&url);
18016
18017 let mut json_mime_type = mime::APPLICATION_JSON;
18018 let mut request_value_reader = {
18019 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
18020 common::remove_json_null_values(&mut value);
18021 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
18022 serde_json::to_writer(&mut dst, &value).unwrap();
18023 dst
18024 };
18025 let request_size = request_value_reader
18026 .seek(std::io::SeekFrom::End(0))
18027 .unwrap();
18028 request_value_reader
18029 .seek(std::io::SeekFrom::Start(0))
18030 .unwrap();
18031
18032 loop {
18033 let token = match self
18034 .hub
18035 .auth
18036 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
18037 .await
18038 {
18039 Ok(token) => token,
18040 Err(e) => match dlg.token(e) {
18041 Ok(token) => token,
18042 Err(e) => {
18043 dlg.finished(false);
18044 return Err(common::Error::MissingToken(e));
18045 }
18046 },
18047 };
18048 request_value_reader
18049 .seek(std::io::SeekFrom::Start(0))
18050 .unwrap();
18051 let mut req_result = {
18052 let client = &self.hub.client;
18053 dlg.pre_request();
18054 let mut req_builder = hyper::Request::builder()
18055 .method(hyper::Method::PUT)
18056 .uri(url.as_str())
18057 .header(USER_AGENT, self.hub._user_agent.clone());
18058
18059 if let Some(token) = token.as_ref() {
18060 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
18061 }
18062
18063 let request = req_builder
18064 .header(CONTENT_TYPE, json_mime_type.to_string())
18065 .header(CONTENT_LENGTH, request_size as u64)
18066 .body(common::to_body(
18067 request_value_reader.get_ref().clone().into(),
18068 ));
18069
18070 client.request(request.unwrap()).await
18071 };
18072
18073 match req_result {
18074 Err(err) => {
18075 if let common::Retry::After(d) = dlg.http_error(&err) {
18076 sleep(d).await;
18077 continue;
18078 }
18079 dlg.finished(false);
18080 return Err(common::Error::HttpError(err));
18081 }
18082 Ok(res) => {
18083 let (mut parts, body) = res.into_parts();
18084 let mut body = common::Body::new(body);
18085 if !parts.status.is_success() {
18086 let bytes = common::to_bytes(body).await.unwrap_or_default();
18087 let error = serde_json::from_str(&common::to_string(&bytes));
18088 let response = common::to_response(parts, bytes.into());
18089
18090 if let common::Retry::After(d) =
18091 dlg.http_failure(&response, error.as_ref().ok())
18092 {
18093 sleep(d).await;
18094 continue;
18095 }
18096
18097 dlg.finished(false);
18098
18099 return Err(match error {
18100 Ok(value) => common::Error::BadRequest(value),
18101 _ => common::Error::Failure(response),
18102 });
18103 }
18104 let response = {
18105 let bytes = common::to_bytes(body).await.unwrap_or_default();
18106 let encoded = common::to_string(&bytes);
18107 match serde_json::from_str(&encoded) {
18108 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
18109 Err(error) => {
18110 dlg.response_json_decode_error(&encoded, &error);
18111 return Err(common::Error::JsonDecodeError(
18112 encoded.to_string(),
18113 error,
18114 ));
18115 }
18116 }
18117 };
18118
18119 dlg.finished(true);
18120 return Ok(response);
18121 }
18122 }
18123 }
18124 }
18125
18126 ///
18127 /// Sets the *request* property to the given value.
18128 ///
18129 /// Even though the property as already been set when instantiating this call,
18130 /// we provide this method for API completeness.
18131 pub fn request(mut self, new_value: Routine) -> RoutineUpdateCall<'a, C> {
18132 self._request = new_value;
18133 self
18134 }
18135 /// Required. Project ID of the routine to update
18136 ///
18137 /// Sets the *project id* path property to the given value.
18138 ///
18139 /// Even though the property as already been set when instantiating this call,
18140 /// we provide this method for API completeness.
18141 pub fn project_id(mut self, new_value: &str) -> RoutineUpdateCall<'a, C> {
18142 self._project_id = new_value.to_string();
18143 self
18144 }
18145 /// Required. Dataset ID of the routine to update
18146 ///
18147 /// Sets the *dataset id* path property to the given value.
18148 ///
18149 /// Even though the property as already been set when instantiating this call,
18150 /// we provide this method for API completeness.
18151 pub fn dataset_id(mut self, new_value: &str) -> RoutineUpdateCall<'a, C> {
18152 self._dataset_id = new_value.to_string();
18153 self
18154 }
18155 /// Required. Routine ID of the routine to update
18156 ///
18157 /// Sets the *routine id* path property to the given value.
18158 ///
18159 /// Even though the property as already been set when instantiating this call,
18160 /// we provide this method for API completeness.
18161 pub fn routine_id(mut self, new_value: &str) -> RoutineUpdateCall<'a, C> {
18162 self._routine_id = new_value.to_string();
18163 self
18164 }
18165 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
18166 /// while executing the actual API request.
18167 ///
18168 /// ````text
18169 /// It should be used to handle progress information, and to implement a certain level of resilience.
18170 /// ````
18171 ///
18172 /// Sets the *delegate* property to the given value.
18173 pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> RoutineUpdateCall<'a, C> {
18174 self._delegate = Some(new_value);
18175 self
18176 }
18177
18178 /// Set any additional parameter of the query string used in the request.
18179 /// It should be used to set parameters which are not yet available through their own
18180 /// setters.
18181 ///
18182 /// Please note that this method must not be used to set any of the known parameters
18183 /// which have their own setter method. If done anyway, the request will fail.
18184 ///
18185 /// # Additional Parameters
18186 ///
18187 /// * *$.xgafv* (query-string) - V1 error format.
18188 /// * *access_token* (query-string) - OAuth access token.
18189 /// * *alt* (query-string) - Data format for response.
18190 /// * *callback* (query-string) - JSONP
18191 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
18192 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
18193 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
18194 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
18195 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
18196 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
18197 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
18198 pub fn param<T>(mut self, name: T, value: T) -> RoutineUpdateCall<'a, C>
18199 where
18200 T: AsRef<str>,
18201 {
18202 self._additional_params
18203 .insert(name.as_ref().to_string(), value.as_ref().to_string());
18204 self
18205 }
18206
18207 /// Identifies the authorization scope for the method you are building.
18208 ///
18209 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
18210 /// [`Scope::CloudPlatform`].
18211 ///
18212 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
18213 /// tokens for more than one scope.
18214 ///
18215 /// Usually there is more than one suitable scope to authorize an operation, some of which may
18216 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
18217 /// sufficient, a read-write scope will do as well.
18218 pub fn add_scope<St>(mut self, scope: St) -> RoutineUpdateCall<'a, C>
18219 where
18220 St: AsRef<str>,
18221 {
18222 self._scopes.insert(String::from(scope.as_ref()));
18223 self
18224 }
18225 /// Identifies the authorization scope(s) for the method you are building.
18226 ///
18227 /// See [`Self::add_scope()`] for details.
18228 pub fn add_scopes<I, St>(mut self, scopes: I) -> RoutineUpdateCall<'a, C>
18229 where
18230 I: IntoIterator<Item = St>,
18231 St: AsRef<str>,
18232 {
18233 self._scopes
18234 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
18235 self
18236 }
18237
18238 /// Removes all scopes, and no default scope will be used either.
18239 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
18240 /// for details).
18241 pub fn clear_scopes(mut self) -> RoutineUpdateCall<'a, C> {
18242 self._scopes.clear();
18243 self
18244 }
18245}
18246
18247/// Deletes provided row access policies.
18248///
18249/// A builder for the *batchDelete* method supported by a *rowAccessPolicy* resource.
18250/// It is not used directly, but through a [`RowAccessPolicyMethods`] instance.
18251///
18252/// # Example
18253///
18254/// Instantiate a resource method builder
18255///
18256/// ```test_harness,no_run
18257/// # extern crate hyper;
18258/// # extern crate hyper_rustls;
18259/// # extern crate google_bigquery2 as bigquery2;
18260/// use bigquery2::api::BatchDeleteRowAccessPoliciesRequest;
18261/// # async fn dox() {
18262/// # use bigquery2::{Bigquery, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
18263///
18264/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
18265/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
18266/// # .with_native_roots()
18267/// # .unwrap()
18268/// # .https_only()
18269/// # .enable_http2()
18270/// # .build();
18271///
18272/// # let executor = hyper_util::rt::TokioExecutor::new();
18273/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
18274/// # secret,
18275/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
18276/// # yup_oauth2::client::CustomHyperClientBuilder::from(
18277/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
18278/// # ),
18279/// # ).build().await.unwrap();
18280///
18281/// # let client = hyper_util::client::legacy::Client::builder(
18282/// # hyper_util::rt::TokioExecutor::new()
18283/// # )
18284/// # .build(
18285/// # hyper_rustls::HttpsConnectorBuilder::new()
18286/// # .with_native_roots()
18287/// # .unwrap()
18288/// # .https_or_http()
18289/// # .enable_http2()
18290/// # .build()
18291/// # );
18292/// # let mut hub = Bigquery::new(client, auth);
18293/// // As the method needs a request, you would usually fill it with the desired information
18294/// // into the respective structure. Some of the parts shown here might not be applicable !
18295/// // Values shown here are possibly random and not representative !
18296/// let mut req = BatchDeleteRowAccessPoliciesRequest::default();
18297///
18298/// // You can configure optional parameters by calling the respective setters at will, and
18299/// // execute the final call using `doit()`.
18300/// // Values shown here are possibly random and not representative !
18301/// let result = hub.row_access_policies().batch_delete(req, "projectId", "datasetId", "tableId")
18302/// .doit().await;
18303/// # }
18304/// ```
18305pub struct RowAccessPolicyBatchDeleteCall<'a, C>
18306where
18307 C: 'a,
18308{
18309 hub: &'a Bigquery<C>,
18310 _request: BatchDeleteRowAccessPoliciesRequest,
18311 _project_id: String,
18312 _dataset_id: String,
18313 _table_id: String,
18314 _delegate: Option<&'a mut dyn common::Delegate>,
18315 _additional_params: HashMap<String, String>,
18316 _scopes: BTreeSet<String>,
18317}
18318
18319impl<'a, C> common::CallBuilder for RowAccessPolicyBatchDeleteCall<'a, C> {}
18320
18321impl<'a, C> RowAccessPolicyBatchDeleteCall<'a, C>
18322where
18323 C: common::Connector,
18324{
18325 /// Perform the operation you have build so far.
18326 pub async fn doit(mut self) -> common::Result<common::Response> {
18327 use std::borrow::Cow;
18328 use std::io::{Read, Seek};
18329
18330 use common::{url::Params, ToParts};
18331 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
18332
18333 let mut dd = common::DefaultDelegate;
18334 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
18335 dlg.begin(common::MethodInfo {
18336 id: "bigquery.rowAccessPolicies.batchDelete",
18337 http_method: hyper::Method::POST,
18338 });
18339
18340 for &field in ["projectId", "datasetId", "tableId"].iter() {
18341 if self._additional_params.contains_key(field) {
18342 dlg.finished(false);
18343 return Err(common::Error::FieldClash(field));
18344 }
18345 }
18346
18347 let mut params = Params::with_capacity(5 + self._additional_params.len());
18348 params.push("projectId", self._project_id);
18349 params.push("datasetId", self._dataset_id);
18350 params.push("tableId", self._table_id);
18351
18352 params.extend(self._additional_params.iter());
18353
18354 let mut url = self.hub._base_url.clone() + "projects/{+projectId}/datasets/{+datasetId}/tables/{+tableId}/rowAccessPolicies:batchDelete";
18355 if self._scopes.is_empty() {
18356 self._scopes
18357 .insert(Scope::CloudPlatform.as_ref().to_string());
18358 }
18359
18360 #[allow(clippy::single_element_loop)]
18361 for &(find_this, param_name) in [
18362 ("{+projectId}", "projectId"),
18363 ("{+datasetId}", "datasetId"),
18364 ("{+tableId}", "tableId"),
18365 ]
18366 .iter()
18367 {
18368 url = params.uri_replacement(url, param_name, find_this, true);
18369 }
18370 {
18371 let to_remove = ["tableId", "datasetId", "projectId"];
18372 params.remove_params(&to_remove);
18373 }
18374
18375 let url = params.parse_with_url(&url);
18376
18377 let mut json_mime_type = mime::APPLICATION_JSON;
18378 let mut request_value_reader = {
18379 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
18380 common::remove_json_null_values(&mut value);
18381 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
18382 serde_json::to_writer(&mut dst, &value).unwrap();
18383 dst
18384 };
18385 let request_size = request_value_reader
18386 .seek(std::io::SeekFrom::End(0))
18387 .unwrap();
18388 request_value_reader
18389 .seek(std::io::SeekFrom::Start(0))
18390 .unwrap();
18391
18392 loop {
18393 let token = match self
18394 .hub
18395 .auth
18396 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
18397 .await
18398 {
18399 Ok(token) => token,
18400 Err(e) => match dlg.token(e) {
18401 Ok(token) => token,
18402 Err(e) => {
18403 dlg.finished(false);
18404 return Err(common::Error::MissingToken(e));
18405 }
18406 },
18407 };
18408 request_value_reader
18409 .seek(std::io::SeekFrom::Start(0))
18410 .unwrap();
18411 let mut req_result = {
18412 let client = &self.hub.client;
18413 dlg.pre_request();
18414 let mut req_builder = hyper::Request::builder()
18415 .method(hyper::Method::POST)
18416 .uri(url.as_str())
18417 .header(USER_AGENT, self.hub._user_agent.clone());
18418
18419 if let Some(token) = token.as_ref() {
18420 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
18421 }
18422
18423 let request = req_builder
18424 .header(CONTENT_TYPE, json_mime_type.to_string())
18425 .header(CONTENT_LENGTH, request_size as u64)
18426 .body(common::to_body(
18427 request_value_reader.get_ref().clone().into(),
18428 ));
18429
18430 client.request(request.unwrap()).await
18431 };
18432
18433 match req_result {
18434 Err(err) => {
18435 if let common::Retry::After(d) = dlg.http_error(&err) {
18436 sleep(d).await;
18437 continue;
18438 }
18439 dlg.finished(false);
18440 return Err(common::Error::HttpError(err));
18441 }
18442 Ok(res) => {
18443 let (mut parts, body) = res.into_parts();
18444 let mut body = common::Body::new(body);
18445 if !parts.status.is_success() {
18446 let bytes = common::to_bytes(body).await.unwrap_or_default();
18447 let error = serde_json::from_str(&common::to_string(&bytes));
18448 let response = common::to_response(parts, bytes.into());
18449
18450 if let common::Retry::After(d) =
18451 dlg.http_failure(&response, error.as_ref().ok())
18452 {
18453 sleep(d).await;
18454 continue;
18455 }
18456
18457 dlg.finished(false);
18458
18459 return Err(match error {
18460 Ok(value) => common::Error::BadRequest(value),
18461 _ => common::Error::Failure(response),
18462 });
18463 }
18464 let response = common::Response::from_parts(parts, body);
18465
18466 dlg.finished(true);
18467 return Ok(response);
18468 }
18469 }
18470 }
18471 }
18472
18473 ///
18474 /// Sets the *request* property to the given value.
18475 ///
18476 /// Even though the property as already been set when instantiating this call,
18477 /// we provide this method for API completeness.
18478 pub fn request(
18479 mut self,
18480 new_value: BatchDeleteRowAccessPoliciesRequest,
18481 ) -> RowAccessPolicyBatchDeleteCall<'a, C> {
18482 self._request = new_value;
18483 self
18484 }
18485 /// Required. Project ID of the table to delete the row access policies.
18486 ///
18487 /// Sets the *project id* path property to the given value.
18488 ///
18489 /// Even though the property as already been set when instantiating this call,
18490 /// we provide this method for API completeness.
18491 pub fn project_id(mut self, new_value: &str) -> RowAccessPolicyBatchDeleteCall<'a, C> {
18492 self._project_id = new_value.to_string();
18493 self
18494 }
18495 /// Required. Dataset ID of the table to delete the row access policies.
18496 ///
18497 /// Sets the *dataset id* path property to the given value.
18498 ///
18499 /// Even though the property as already been set when instantiating this call,
18500 /// we provide this method for API completeness.
18501 pub fn dataset_id(mut self, new_value: &str) -> RowAccessPolicyBatchDeleteCall<'a, C> {
18502 self._dataset_id = new_value.to_string();
18503 self
18504 }
18505 /// Required. Table ID of the table to delete the row access policies.
18506 ///
18507 /// Sets the *table id* path property to the given value.
18508 ///
18509 /// Even though the property as already been set when instantiating this call,
18510 /// we provide this method for API completeness.
18511 pub fn table_id(mut self, new_value: &str) -> RowAccessPolicyBatchDeleteCall<'a, C> {
18512 self._table_id = new_value.to_string();
18513 self
18514 }
18515 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
18516 /// while executing the actual API request.
18517 ///
18518 /// ````text
18519 /// It should be used to handle progress information, and to implement a certain level of resilience.
18520 /// ````
18521 ///
18522 /// Sets the *delegate* property to the given value.
18523 pub fn delegate(
18524 mut self,
18525 new_value: &'a mut dyn common::Delegate,
18526 ) -> RowAccessPolicyBatchDeleteCall<'a, C> {
18527 self._delegate = Some(new_value);
18528 self
18529 }
18530
18531 /// Set any additional parameter of the query string used in the request.
18532 /// It should be used to set parameters which are not yet available through their own
18533 /// setters.
18534 ///
18535 /// Please note that this method must not be used to set any of the known parameters
18536 /// which have their own setter method. If done anyway, the request will fail.
18537 ///
18538 /// # Additional Parameters
18539 ///
18540 /// * *$.xgafv* (query-string) - V1 error format.
18541 /// * *access_token* (query-string) - OAuth access token.
18542 /// * *alt* (query-string) - Data format for response.
18543 /// * *callback* (query-string) - JSONP
18544 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
18545 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
18546 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
18547 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
18548 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
18549 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
18550 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
18551 pub fn param<T>(mut self, name: T, value: T) -> RowAccessPolicyBatchDeleteCall<'a, C>
18552 where
18553 T: AsRef<str>,
18554 {
18555 self._additional_params
18556 .insert(name.as_ref().to_string(), value.as_ref().to_string());
18557 self
18558 }
18559
18560 /// Identifies the authorization scope for the method you are building.
18561 ///
18562 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
18563 /// [`Scope::CloudPlatform`].
18564 ///
18565 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
18566 /// tokens for more than one scope.
18567 ///
18568 /// Usually there is more than one suitable scope to authorize an operation, some of which may
18569 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
18570 /// sufficient, a read-write scope will do as well.
18571 pub fn add_scope<St>(mut self, scope: St) -> RowAccessPolicyBatchDeleteCall<'a, C>
18572 where
18573 St: AsRef<str>,
18574 {
18575 self._scopes.insert(String::from(scope.as_ref()));
18576 self
18577 }
18578 /// Identifies the authorization scope(s) for the method you are building.
18579 ///
18580 /// See [`Self::add_scope()`] for details.
18581 pub fn add_scopes<I, St>(mut self, scopes: I) -> RowAccessPolicyBatchDeleteCall<'a, C>
18582 where
18583 I: IntoIterator<Item = St>,
18584 St: AsRef<str>,
18585 {
18586 self._scopes
18587 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
18588 self
18589 }
18590
18591 /// Removes all scopes, and no default scope will be used either.
18592 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
18593 /// for details).
18594 pub fn clear_scopes(mut self) -> RowAccessPolicyBatchDeleteCall<'a, C> {
18595 self._scopes.clear();
18596 self
18597 }
18598}
18599
18600/// Deletes a row access policy.
18601///
18602/// A builder for the *delete* method supported by a *rowAccessPolicy* resource.
18603/// It is not used directly, but through a [`RowAccessPolicyMethods`] instance.
18604///
18605/// # Example
18606///
18607/// Instantiate a resource method builder
18608///
18609/// ```test_harness,no_run
18610/// # extern crate hyper;
18611/// # extern crate hyper_rustls;
18612/// # extern crate google_bigquery2 as bigquery2;
18613/// # async fn dox() {
18614/// # use bigquery2::{Bigquery, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
18615///
18616/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
18617/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
18618/// # .with_native_roots()
18619/// # .unwrap()
18620/// # .https_only()
18621/// # .enable_http2()
18622/// # .build();
18623///
18624/// # let executor = hyper_util::rt::TokioExecutor::new();
18625/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
18626/// # secret,
18627/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
18628/// # yup_oauth2::client::CustomHyperClientBuilder::from(
18629/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
18630/// # ),
18631/// # ).build().await.unwrap();
18632///
18633/// # let client = hyper_util::client::legacy::Client::builder(
18634/// # hyper_util::rt::TokioExecutor::new()
18635/// # )
18636/// # .build(
18637/// # hyper_rustls::HttpsConnectorBuilder::new()
18638/// # .with_native_roots()
18639/// # .unwrap()
18640/// # .https_or_http()
18641/// # .enable_http2()
18642/// # .build()
18643/// # );
18644/// # let mut hub = Bigquery::new(client, auth);
18645/// // You can configure optional parameters by calling the respective setters at will, and
18646/// // execute the final call using `doit()`.
18647/// // Values shown here are possibly random and not representative !
18648/// let result = hub.row_access_policies().delete("projectId", "datasetId", "tableId", "policyId")
18649/// .force(true)
18650/// .doit().await;
18651/// # }
18652/// ```
18653pub struct RowAccessPolicyDeleteCall<'a, C>
18654where
18655 C: 'a,
18656{
18657 hub: &'a Bigquery<C>,
18658 _project_id: String,
18659 _dataset_id: String,
18660 _table_id: String,
18661 _policy_id: String,
18662 _force: Option<bool>,
18663 _delegate: Option<&'a mut dyn common::Delegate>,
18664 _additional_params: HashMap<String, String>,
18665 _scopes: BTreeSet<String>,
18666}
18667
18668impl<'a, C> common::CallBuilder for RowAccessPolicyDeleteCall<'a, C> {}
18669
18670impl<'a, C> RowAccessPolicyDeleteCall<'a, C>
18671where
18672 C: common::Connector,
18673{
18674 /// Perform the operation you have build so far.
18675 pub async fn doit(mut self) -> common::Result<common::Response> {
18676 use std::borrow::Cow;
18677 use std::io::{Read, Seek};
18678
18679 use common::{url::Params, ToParts};
18680 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
18681
18682 let mut dd = common::DefaultDelegate;
18683 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
18684 dlg.begin(common::MethodInfo {
18685 id: "bigquery.rowAccessPolicies.delete",
18686 http_method: hyper::Method::DELETE,
18687 });
18688
18689 for &field in ["projectId", "datasetId", "tableId", "policyId", "force"].iter() {
18690 if self._additional_params.contains_key(field) {
18691 dlg.finished(false);
18692 return Err(common::Error::FieldClash(field));
18693 }
18694 }
18695
18696 let mut params = Params::with_capacity(6 + self._additional_params.len());
18697 params.push("projectId", self._project_id);
18698 params.push("datasetId", self._dataset_id);
18699 params.push("tableId", self._table_id);
18700 params.push("policyId", self._policy_id);
18701 if let Some(value) = self._force.as_ref() {
18702 params.push("force", value.to_string());
18703 }
18704
18705 params.extend(self._additional_params.iter());
18706
18707 let mut url = self.hub._base_url.clone() + "projects/{+projectId}/datasets/{+datasetId}/tables/{+tableId}/rowAccessPolicies/{+policyId}";
18708 if self._scopes.is_empty() {
18709 self._scopes
18710 .insert(Scope::CloudPlatform.as_ref().to_string());
18711 }
18712
18713 #[allow(clippy::single_element_loop)]
18714 for &(find_this, param_name) in [
18715 ("{+projectId}", "projectId"),
18716 ("{+datasetId}", "datasetId"),
18717 ("{+tableId}", "tableId"),
18718 ("{+policyId}", "policyId"),
18719 ]
18720 .iter()
18721 {
18722 url = params.uri_replacement(url, param_name, find_this, true);
18723 }
18724 {
18725 let to_remove = ["policyId", "tableId", "datasetId", "projectId"];
18726 params.remove_params(&to_remove);
18727 }
18728
18729 let url = params.parse_with_url(&url);
18730
18731 loop {
18732 let token = match self
18733 .hub
18734 .auth
18735 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
18736 .await
18737 {
18738 Ok(token) => token,
18739 Err(e) => match dlg.token(e) {
18740 Ok(token) => token,
18741 Err(e) => {
18742 dlg.finished(false);
18743 return Err(common::Error::MissingToken(e));
18744 }
18745 },
18746 };
18747 let mut req_result = {
18748 let client = &self.hub.client;
18749 dlg.pre_request();
18750 let mut req_builder = hyper::Request::builder()
18751 .method(hyper::Method::DELETE)
18752 .uri(url.as_str())
18753 .header(USER_AGENT, self.hub._user_agent.clone());
18754
18755 if let Some(token) = token.as_ref() {
18756 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
18757 }
18758
18759 let request = req_builder
18760 .header(CONTENT_LENGTH, 0_u64)
18761 .body(common::to_body::<String>(None));
18762
18763 client.request(request.unwrap()).await
18764 };
18765
18766 match req_result {
18767 Err(err) => {
18768 if let common::Retry::After(d) = dlg.http_error(&err) {
18769 sleep(d).await;
18770 continue;
18771 }
18772 dlg.finished(false);
18773 return Err(common::Error::HttpError(err));
18774 }
18775 Ok(res) => {
18776 let (mut parts, body) = res.into_parts();
18777 let mut body = common::Body::new(body);
18778 if !parts.status.is_success() {
18779 let bytes = common::to_bytes(body).await.unwrap_or_default();
18780 let error = serde_json::from_str(&common::to_string(&bytes));
18781 let response = common::to_response(parts, bytes.into());
18782
18783 if let common::Retry::After(d) =
18784 dlg.http_failure(&response, error.as_ref().ok())
18785 {
18786 sleep(d).await;
18787 continue;
18788 }
18789
18790 dlg.finished(false);
18791
18792 return Err(match error {
18793 Ok(value) => common::Error::BadRequest(value),
18794 _ => common::Error::Failure(response),
18795 });
18796 }
18797 let response = common::Response::from_parts(parts, body);
18798
18799 dlg.finished(true);
18800 return Ok(response);
18801 }
18802 }
18803 }
18804 }
18805
18806 /// Required. Project ID of the table to delete the row access policy.
18807 ///
18808 /// Sets the *project id* path property to the given value.
18809 ///
18810 /// Even though the property as already been set when instantiating this call,
18811 /// we provide this method for API completeness.
18812 pub fn project_id(mut self, new_value: &str) -> RowAccessPolicyDeleteCall<'a, C> {
18813 self._project_id = new_value.to_string();
18814 self
18815 }
18816 /// Required. Dataset ID of the table to delete the row access policy.
18817 ///
18818 /// Sets the *dataset id* path property to the given value.
18819 ///
18820 /// Even though the property as already been set when instantiating this call,
18821 /// we provide this method for API completeness.
18822 pub fn dataset_id(mut self, new_value: &str) -> RowAccessPolicyDeleteCall<'a, C> {
18823 self._dataset_id = new_value.to_string();
18824 self
18825 }
18826 /// Required. Table ID of the table to delete the row access policy.
18827 ///
18828 /// Sets the *table id* path property to the given value.
18829 ///
18830 /// Even though the property as already been set when instantiating this call,
18831 /// we provide this method for API completeness.
18832 pub fn table_id(mut self, new_value: &str) -> RowAccessPolicyDeleteCall<'a, C> {
18833 self._table_id = new_value.to_string();
18834 self
18835 }
18836 /// Required. Policy ID of the row access policy.
18837 ///
18838 /// Sets the *policy id* path property to the given value.
18839 ///
18840 /// Even though the property as already been set when instantiating this call,
18841 /// we provide this method for API completeness.
18842 pub fn policy_id(mut self, new_value: &str) -> RowAccessPolicyDeleteCall<'a, C> {
18843 self._policy_id = new_value.to_string();
18844 self
18845 }
18846 /// If set to true, it deletes the row access policy even if it's the last row access policy on the table and the deletion will widen the access rather narrowing it.
18847 ///
18848 /// Sets the *force* query property to the given value.
18849 pub fn force(mut self, new_value: bool) -> RowAccessPolicyDeleteCall<'a, C> {
18850 self._force = Some(new_value);
18851 self
18852 }
18853 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
18854 /// while executing the actual API request.
18855 ///
18856 /// ````text
18857 /// It should be used to handle progress information, and to implement a certain level of resilience.
18858 /// ````
18859 ///
18860 /// Sets the *delegate* property to the given value.
18861 pub fn delegate(
18862 mut self,
18863 new_value: &'a mut dyn common::Delegate,
18864 ) -> RowAccessPolicyDeleteCall<'a, C> {
18865 self._delegate = Some(new_value);
18866 self
18867 }
18868
18869 /// Set any additional parameter of the query string used in the request.
18870 /// It should be used to set parameters which are not yet available through their own
18871 /// setters.
18872 ///
18873 /// Please note that this method must not be used to set any of the known parameters
18874 /// which have their own setter method. If done anyway, the request will fail.
18875 ///
18876 /// # Additional Parameters
18877 ///
18878 /// * *$.xgafv* (query-string) - V1 error format.
18879 /// * *access_token* (query-string) - OAuth access token.
18880 /// * *alt* (query-string) - Data format for response.
18881 /// * *callback* (query-string) - JSONP
18882 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
18883 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
18884 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
18885 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
18886 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
18887 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
18888 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
18889 pub fn param<T>(mut self, name: T, value: T) -> RowAccessPolicyDeleteCall<'a, C>
18890 where
18891 T: AsRef<str>,
18892 {
18893 self._additional_params
18894 .insert(name.as_ref().to_string(), value.as_ref().to_string());
18895 self
18896 }
18897
18898 /// Identifies the authorization scope for the method you are building.
18899 ///
18900 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
18901 /// [`Scope::CloudPlatform`].
18902 ///
18903 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
18904 /// tokens for more than one scope.
18905 ///
18906 /// Usually there is more than one suitable scope to authorize an operation, some of which may
18907 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
18908 /// sufficient, a read-write scope will do as well.
18909 pub fn add_scope<St>(mut self, scope: St) -> RowAccessPolicyDeleteCall<'a, C>
18910 where
18911 St: AsRef<str>,
18912 {
18913 self._scopes.insert(String::from(scope.as_ref()));
18914 self
18915 }
18916 /// Identifies the authorization scope(s) for the method you are building.
18917 ///
18918 /// See [`Self::add_scope()`] for details.
18919 pub fn add_scopes<I, St>(mut self, scopes: I) -> RowAccessPolicyDeleteCall<'a, C>
18920 where
18921 I: IntoIterator<Item = St>,
18922 St: AsRef<str>,
18923 {
18924 self._scopes
18925 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
18926 self
18927 }
18928
18929 /// Removes all scopes, and no default scope will be used either.
18930 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
18931 /// for details).
18932 pub fn clear_scopes(mut self) -> RowAccessPolicyDeleteCall<'a, C> {
18933 self._scopes.clear();
18934 self
18935 }
18936}
18937
18938/// Gets the specified row access policy by policy ID.
18939///
18940/// A builder for the *get* method supported by a *rowAccessPolicy* resource.
18941/// It is not used directly, but through a [`RowAccessPolicyMethods`] instance.
18942///
18943/// # Example
18944///
18945/// Instantiate a resource method builder
18946///
18947/// ```test_harness,no_run
18948/// # extern crate hyper;
18949/// # extern crate hyper_rustls;
18950/// # extern crate google_bigquery2 as bigquery2;
18951/// # async fn dox() {
18952/// # use bigquery2::{Bigquery, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
18953///
18954/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
18955/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
18956/// # .with_native_roots()
18957/// # .unwrap()
18958/// # .https_only()
18959/// # .enable_http2()
18960/// # .build();
18961///
18962/// # let executor = hyper_util::rt::TokioExecutor::new();
18963/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
18964/// # secret,
18965/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
18966/// # yup_oauth2::client::CustomHyperClientBuilder::from(
18967/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
18968/// # ),
18969/// # ).build().await.unwrap();
18970///
18971/// # let client = hyper_util::client::legacy::Client::builder(
18972/// # hyper_util::rt::TokioExecutor::new()
18973/// # )
18974/// # .build(
18975/// # hyper_rustls::HttpsConnectorBuilder::new()
18976/// # .with_native_roots()
18977/// # .unwrap()
18978/// # .https_or_http()
18979/// # .enable_http2()
18980/// # .build()
18981/// # );
18982/// # let mut hub = Bigquery::new(client, auth);
18983/// // You can configure optional parameters by calling the respective setters at will, and
18984/// // execute the final call using `doit()`.
18985/// // Values shown here are possibly random and not representative !
18986/// let result = hub.row_access_policies().get("projectId", "datasetId", "tableId", "policyId")
18987/// .doit().await;
18988/// # }
18989/// ```
18990pub struct RowAccessPolicyGetCall<'a, C>
18991where
18992 C: 'a,
18993{
18994 hub: &'a Bigquery<C>,
18995 _project_id: String,
18996 _dataset_id: String,
18997 _table_id: String,
18998 _policy_id: String,
18999 _delegate: Option<&'a mut dyn common::Delegate>,
19000 _additional_params: HashMap<String, String>,
19001 _scopes: BTreeSet<String>,
19002}
19003
19004impl<'a, C> common::CallBuilder for RowAccessPolicyGetCall<'a, C> {}
19005
19006impl<'a, C> RowAccessPolicyGetCall<'a, C>
19007where
19008 C: common::Connector,
19009{
19010 /// Perform the operation you have build so far.
19011 pub async fn doit(mut self) -> common::Result<(common::Response, RowAccessPolicy)> {
19012 use std::borrow::Cow;
19013 use std::io::{Read, Seek};
19014
19015 use common::{url::Params, ToParts};
19016 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
19017
19018 let mut dd = common::DefaultDelegate;
19019 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
19020 dlg.begin(common::MethodInfo {
19021 id: "bigquery.rowAccessPolicies.get",
19022 http_method: hyper::Method::GET,
19023 });
19024
19025 for &field in ["alt", "projectId", "datasetId", "tableId", "policyId"].iter() {
19026 if self._additional_params.contains_key(field) {
19027 dlg.finished(false);
19028 return Err(common::Error::FieldClash(field));
19029 }
19030 }
19031
19032 let mut params = Params::with_capacity(6 + self._additional_params.len());
19033 params.push("projectId", self._project_id);
19034 params.push("datasetId", self._dataset_id);
19035 params.push("tableId", self._table_id);
19036 params.push("policyId", self._policy_id);
19037
19038 params.extend(self._additional_params.iter());
19039
19040 params.push("alt", "json");
19041 let mut url = self.hub._base_url.clone() + "projects/{+projectId}/datasets/{+datasetId}/tables/{+tableId}/rowAccessPolicies/{+policyId}";
19042 if self._scopes.is_empty() {
19043 self._scopes
19044 .insert(Scope::CloudPlatformReadOnly.as_ref().to_string());
19045 }
19046
19047 #[allow(clippy::single_element_loop)]
19048 for &(find_this, param_name) in [
19049 ("{+projectId}", "projectId"),
19050 ("{+datasetId}", "datasetId"),
19051 ("{+tableId}", "tableId"),
19052 ("{+policyId}", "policyId"),
19053 ]
19054 .iter()
19055 {
19056 url = params.uri_replacement(url, param_name, find_this, true);
19057 }
19058 {
19059 let to_remove = ["policyId", "tableId", "datasetId", "projectId"];
19060 params.remove_params(&to_remove);
19061 }
19062
19063 let url = params.parse_with_url(&url);
19064
19065 loop {
19066 let token = match self
19067 .hub
19068 .auth
19069 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
19070 .await
19071 {
19072 Ok(token) => token,
19073 Err(e) => match dlg.token(e) {
19074 Ok(token) => token,
19075 Err(e) => {
19076 dlg.finished(false);
19077 return Err(common::Error::MissingToken(e));
19078 }
19079 },
19080 };
19081 let mut req_result = {
19082 let client = &self.hub.client;
19083 dlg.pre_request();
19084 let mut req_builder = hyper::Request::builder()
19085 .method(hyper::Method::GET)
19086 .uri(url.as_str())
19087 .header(USER_AGENT, self.hub._user_agent.clone());
19088
19089 if let Some(token) = token.as_ref() {
19090 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
19091 }
19092
19093 let request = req_builder
19094 .header(CONTENT_LENGTH, 0_u64)
19095 .body(common::to_body::<String>(None));
19096
19097 client.request(request.unwrap()).await
19098 };
19099
19100 match req_result {
19101 Err(err) => {
19102 if let common::Retry::After(d) = dlg.http_error(&err) {
19103 sleep(d).await;
19104 continue;
19105 }
19106 dlg.finished(false);
19107 return Err(common::Error::HttpError(err));
19108 }
19109 Ok(res) => {
19110 let (mut parts, body) = res.into_parts();
19111 let mut body = common::Body::new(body);
19112 if !parts.status.is_success() {
19113 let bytes = common::to_bytes(body).await.unwrap_or_default();
19114 let error = serde_json::from_str(&common::to_string(&bytes));
19115 let response = common::to_response(parts, bytes.into());
19116
19117 if let common::Retry::After(d) =
19118 dlg.http_failure(&response, error.as_ref().ok())
19119 {
19120 sleep(d).await;
19121 continue;
19122 }
19123
19124 dlg.finished(false);
19125
19126 return Err(match error {
19127 Ok(value) => common::Error::BadRequest(value),
19128 _ => common::Error::Failure(response),
19129 });
19130 }
19131 let response = {
19132 let bytes = common::to_bytes(body).await.unwrap_or_default();
19133 let encoded = common::to_string(&bytes);
19134 match serde_json::from_str(&encoded) {
19135 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
19136 Err(error) => {
19137 dlg.response_json_decode_error(&encoded, &error);
19138 return Err(common::Error::JsonDecodeError(
19139 encoded.to_string(),
19140 error,
19141 ));
19142 }
19143 }
19144 };
19145
19146 dlg.finished(true);
19147 return Ok(response);
19148 }
19149 }
19150 }
19151 }
19152
19153 /// Required. Project ID of the table to get the row access policy.
19154 ///
19155 /// Sets the *project id* path property to the given value.
19156 ///
19157 /// Even though the property as already been set when instantiating this call,
19158 /// we provide this method for API completeness.
19159 pub fn project_id(mut self, new_value: &str) -> RowAccessPolicyGetCall<'a, C> {
19160 self._project_id = new_value.to_string();
19161 self
19162 }
19163 /// Required. Dataset ID of the table to get the row access policy.
19164 ///
19165 /// Sets the *dataset id* path property to the given value.
19166 ///
19167 /// Even though the property as already been set when instantiating this call,
19168 /// we provide this method for API completeness.
19169 pub fn dataset_id(mut self, new_value: &str) -> RowAccessPolicyGetCall<'a, C> {
19170 self._dataset_id = new_value.to_string();
19171 self
19172 }
19173 /// Required. Table ID of the table to get the row access policy.
19174 ///
19175 /// Sets the *table id* path property to the given value.
19176 ///
19177 /// Even though the property as already been set when instantiating this call,
19178 /// we provide this method for API completeness.
19179 pub fn table_id(mut self, new_value: &str) -> RowAccessPolicyGetCall<'a, C> {
19180 self._table_id = new_value.to_string();
19181 self
19182 }
19183 /// Required. Policy ID of the row access policy.
19184 ///
19185 /// Sets the *policy id* path property to the given value.
19186 ///
19187 /// Even though the property as already been set when instantiating this call,
19188 /// we provide this method for API completeness.
19189 pub fn policy_id(mut self, new_value: &str) -> RowAccessPolicyGetCall<'a, C> {
19190 self._policy_id = new_value.to_string();
19191 self
19192 }
19193 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
19194 /// while executing the actual API request.
19195 ///
19196 /// ````text
19197 /// It should be used to handle progress information, and to implement a certain level of resilience.
19198 /// ````
19199 ///
19200 /// Sets the *delegate* property to the given value.
19201 pub fn delegate(
19202 mut self,
19203 new_value: &'a mut dyn common::Delegate,
19204 ) -> RowAccessPolicyGetCall<'a, C> {
19205 self._delegate = Some(new_value);
19206 self
19207 }
19208
19209 /// Set any additional parameter of the query string used in the request.
19210 /// It should be used to set parameters which are not yet available through their own
19211 /// setters.
19212 ///
19213 /// Please note that this method must not be used to set any of the known parameters
19214 /// which have their own setter method. If done anyway, the request will fail.
19215 ///
19216 /// # Additional Parameters
19217 ///
19218 /// * *$.xgafv* (query-string) - V1 error format.
19219 /// * *access_token* (query-string) - OAuth access token.
19220 /// * *alt* (query-string) - Data format for response.
19221 /// * *callback* (query-string) - JSONP
19222 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
19223 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
19224 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
19225 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
19226 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
19227 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
19228 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
19229 pub fn param<T>(mut self, name: T, value: T) -> RowAccessPolicyGetCall<'a, C>
19230 where
19231 T: AsRef<str>,
19232 {
19233 self._additional_params
19234 .insert(name.as_ref().to_string(), value.as_ref().to_string());
19235 self
19236 }
19237
19238 /// Identifies the authorization scope for the method you are building.
19239 ///
19240 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
19241 /// [`Scope::CloudPlatformReadOnly`].
19242 ///
19243 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
19244 /// tokens for more than one scope.
19245 ///
19246 /// Usually there is more than one suitable scope to authorize an operation, some of which may
19247 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
19248 /// sufficient, a read-write scope will do as well.
19249 pub fn add_scope<St>(mut self, scope: St) -> RowAccessPolicyGetCall<'a, C>
19250 where
19251 St: AsRef<str>,
19252 {
19253 self._scopes.insert(String::from(scope.as_ref()));
19254 self
19255 }
19256 /// Identifies the authorization scope(s) for the method you are building.
19257 ///
19258 /// See [`Self::add_scope()`] for details.
19259 pub fn add_scopes<I, St>(mut self, scopes: I) -> RowAccessPolicyGetCall<'a, C>
19260 where
19261 I: IntoIterator<Item = St>,
19262 St: AsRef<str>,
19263 {
19264 self._scopes
19265 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
19266 self
19267 }
19268
19269 /// Removes all scopes, and no default scope will be used either.
19270 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
19271 /// for details).
19272 pub fn clear_scopes(mut self) -> RowAccessPolicyGetCall<'a, C> {
19273 self._scopes.clear();
19274 self
19275 }
19276}
19277
19278/// Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.
19279///
19280/// A builder for the *getIamPolicy* method supported by a *rowAccessPolicy* resource.
19281/// It is not used directly, but through a [`RowAccessPolicyMethods`] instance.
19282///
19283/// # Example
19284///
19285/// Instantiate a resource method builder
19286///
19287/// ```test_harness,no_run
19288/// # extern crate hyper;
19289/// # extern crate hyper_rustls;
19290/// # extern crate google_bigquery2 as bigquery2;
19291/// use bigquery2::api::GetIamPolicyRequest;
19292/// # async fn dox() {
19293/// # use bigquery2::{Bigquery, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
19294///
19295/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
19296/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
19297/// # .with_native_roots()
19298/// # .unwrap()
19299/// # .https_only()
19300/// # .enable_http2()
19301/// # .build();
19302///
19303/// # let executor = hyper_util::rt::TokioExecutor::new();
19304/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
19305/// # secret,
19306/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
19307/// # yup_oauth2::client::CustomHyperClientBuilder::from(
19308/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
19309/// # ),
19310/// # ).build().await.unwrap();
19311///
19312/// # let client = hyper_util::client::legacy::Client::builder(
19313/// # hyper_util::rt::TokioExecutor::new()
19314/// # )
19315/// # .build(
19316/// # hyper_rustls::HttpsConnectorBuilder::new()
19317/// # .with_native_roots()
19318/// # .unwrap()
19319/// # .https_or_http()
19320/// # .enable_http2()
19321/// # .build()
19322/// # );
19323/// # let mut hub = Bigquery::new(client, auth);
19324/// // As the method needs a request, you would usually fill it with the desired information
19325/// // into the respective structure. Some of the parts shown here might not be applicable !
19326/// // Values shown here are possibly random and not representative !
19327/// let mut req = GetIamPolicyRequest::default();
19328///
19329/// // You can configure optional parameters by calling the respective setters at will, and
19330/// // execute the final call using `doit()`.
19331/// // Values shown here are possibly random and not representative !
19332/// let result = hub.row_access_policies().get_iam_policy(req, "resource")
19333/// .doit().await;
19334/// # }
19335/// ```
19336pub struct RowAccessPolicyGetIamPolicyCall<'a, C>
19337where
19338 C: 'a,
19339{
19340 hub: &'a Bigquery<C>,
19341 _request: GetIamPolicyRequest,
19342 _resource: String,
19343 _delegate: Option<&'a mut dyn common::Delegate>,
19344 _additional_params: HashMap<String, String>,
19345 _scopes: BTreeSet<String>,
19346}
19347
19348impl<'a, C> common::CallBuilder for RowAccessPolicyGetIamPolicyCall<'a, C> {}
19349
19350impl<'a, C> RowAccessPolicyGetIamPolicyCall<'a, C>
19351where
19352 C: common::Connector,
19353{
19354 /// Perform the operation you have build so far.
19355 pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
19356 use std::borrow::Cow;
19357 use std::io::{Read, Seek};
19358
19359 use common::{url::Params, ToParts};
19360 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
19361
19362 let mut dd = common::DefaultDelegate;
19363 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
19364 dlg.begin(common::MethodInfo {
19365 id: "bigquery.rowAccessPolicies.getIamPolicy",
19366 http_method: hyper::Method::POST,
19367 });
19368
19369 for &field in ["alt", "resource"].iter() {
19370 if self._additional_params.contains_key(field) {
19371 dlg.finished(false);
19372 return Err(common::Error::FieldClash(field));
19373 }
19374 }
19375
19376 let mut params = Params::with_capacity(4 + self._additional_params.len());
19377 params.push("resource", self._resource);
19378
19379 params.extend(self._additional_params.iter());
19380
19381 params.push("alt", "json");
19382 let mut url = self.hub._base_url.clone() + "{+resource}:getIamPolicy";
19383 if self._scopes.is_empty() {
19384 self._scopes
19385 .insert(Scope::CloudPlatformReadOnly.as_ref().to_string());
19386 }
19387
19388 #[allow(clippy::single_element_loop)]
19389 for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
19390 url = params.uri_replacement(url, param_name, find_this, true);
19391 }
19392 {
19393 let to_remove = ["resource"];
19394 params.remove_params(&to_remove);
19395 }
19396
19397 let url = params.parse_with_url(&url);
19398
19399 let mut json_mime_type = mime::APPLICATION_JSON;
19400 let mut request_value_reader = {
19401 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
19402 common::remove_json_null_values(&mut value);
19403 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
19404 serde_json::to_writer(&mut dst, &value).unwrap();
19405 dst
19406 };
19407 let request_size = request_value_reader
19408 .seek(std::io::SeekFrom::End(0))
19409 .unwrap();
19410 request_value_reader
19411 .seek(std::io::SeekFrom::Start(0))
19412 .unwrap();
19413
19414 loop {
19415 let token = match self
19416 .hub
19417 .auth
19418 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
19419 .await
19420 {
19421 Ok(token) => token,
19422 Err(e) => match dlg.token(e) {
19423 Ok(token) => token,
19424 Err(e) => {
19425 dlg.finished(false);
19426 return Err(common::Error::MissingToken(e));
19427 }
19428 },
19429 };
19430 request_value_reader
19431 .seek(std::io::SeekFrom::Start(0))
19432 .unwrap();
19433 let mut req_result = {
19434 let client = &self.hub.client;
19435 dlg.pre_request();
19436 let mut req_builder = hyper::Request::builder()
19437 .method(hyper::Method::POST)
19438 .uri(url.as_str())
19439 .header(USER_AGENT, self.hub._user_agent.clone());
19440
19441 if let Some(token) = token.as_ref() {
19442 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
19443 }
19444
19445 let request = req_builder
19446 .header(CONTENT_TYPE, json_mime_type.to_string())
19447 .header(CONTENT_LENGTH, request_size as u64)
19448 .body(common::to_body(
19449 request_value_reader.get_ref().clone().into(),
19450 ));
19451
19452 client.request(request.unwrap()).await
19453 };
19454
19455 match req_result {
19456 Err(err) => {
19457 if let common::Retry::After(d) = dlg.http_error(&err) {
19458 sleep(d).await;
19459 continue;
19460 }
19461 dlg.finished(false);
19462 return Err(common::Error::HttpError(err));
19463 }
19464 Ok(res) => {
19465 let (mut parts, body) = res.into_parts();
19466 let mut body = common::Body::new(body);
19467 if !parts.status.is_success() {
19468 let bytes = common::to_bytes(body).await.unwrap_or_default();
19469 let error = serde_json::from_str(&common::to_string(&bytes));
19470 let response = common::to_response(parts, bytes.into());
19471
19472 if let common::Retry::After(d) =
19473 dlg.http_failure(&response, error.as_ref().ok())
19474 {
19475 sleep(d).await;
19476 continue;
19477 }
19478
19479 dlg.finished(false);
19480
19481 return Err(match error {
19482 Ok(value) => common::Error::BadRequest(value),
19483 _ => common::Error::Failure(response),
19484 });
19485 }
19486 let response = {
19487 let bytes = common::to_bytes(body).await.unwrap_or_default();
19488 let encoded = common::to_string(&bytes);
19489 match serde_json::from_str(&encoded) {
19490 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
19491 Err(error) => {
19492 dlg.response_json_decode_error(&encoded, &error);
19493 return Err(common::Error::JsonDecodeError(
19494 encoded.to_string(),
19495 error,
19496 ));
19497 }
19498 }
19499 };
19500
19501 dlg.finished(true);
19502 return Ok(response);
19503 }
19504 }
19505 }
19506 }
19507
19508 ///
19509 /// Sets the *request* property to the given value.
19510 ///
19511 /// Even though the property as already been set when instantiating this call,
19512 /// we provide this method for API completeness.
19513 pub fn request(
19514 mut self,
19515 new_value: GetIamPolicyRequest,
19516 ) -> RowAccessPolicyGetIamPolicyCall<'a, C> {
19517 self._request = new_value;
19518 self
19519 }
19520 /// REQUIRED: The resource for which the policy is being requested. See [Resource names](https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
19521 ///
19522 /// Sets the *resource* path property to the given value.
19523 ///
19524 /// Even though the property as already been set when instantiating this call,
19525 /// we provide this method for API completeness.
19526 pub fn resource(mut self, new_value: &str) -> RowAccessPolicyGetIamPolicyCall<'a, C> {
19527 self._resource = new_value.to_string();
19528 self
19529 }
19530 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
19531 /// while executing the actual API request.
19532 ///
19533 /// ````text
19534 /// It should be used to handle progress information, and to implement a certain level of resilience.
19535 /// ````
19536 ///
19537 /// Sets the *delegate* property to the given value.
19538 pub fn delegate(
19539 mut self,
19540 new_value: &'a mut dyn common::Delegate,
19541 ) -> RowAccessPolicyGetIamPolicyCall<'a, C> {
19542 self._delegate = Some(new_value);
19543 self
19544 }
19545
19546 /// Set any additional parameter of the query string used in the request.
19547 /// It should be used to set parameters which are not yet available through their own
19548 /// setters.
19549 ///
19550 /// Please note that this method must not be used to set any of the known parameters
19551 /// which have their own setter method. If done anyway, the request will fail.
19552 ///
19553 /// # Additional Parameters
19554 ///
19555 /// * *$.xgafv* (query-string) - V1 error format.
19556 /// * *access_token* (query-string) - OAuth access token.
19557 /// * *alt* (query-string) - Data format for response.
19558 /// * *callback* (query-string) - JSONP
19559 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
19560 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
19561 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
19562 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
19563 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
19564 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
19565 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
19566 pub fn param<T>(mut self, name: T, value: T) -> RowAccessPolicyGetIamPolicyCall<'a, C>
19567 where
19568 T: AsRef<str>,
19569 {
19570 self._additional_params
19571 .insert(name.as_ref().to_string(), value.as_ref().to_string());
19572 self
19573 }
19574
19575 /// Identifies the authorization scope for the method you are building.
19576 ///
19577 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
19578 /// [`Scope::CloudPlatformReadOnly`].
19579 ///
19580 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
19581 /// tokens for more than one scope.
19582 ///
19583 /// Usually there is more than one suitable scope to authorize an operation, some of which may
19584 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
19585 /// sufficient, a read-write scope will do as well.
19586 pub fn add_scope<St>(mut self, scope: St) -> RowAccessPolicyGetIamPolicyCall<'a, C>
19587 where
19588 St: AsRef<str>,
19589 {
19590 self._scopes.insert(String::from(scope.as_ref()));
19591 self
19592 }
19593 /// Identifies the authorization scope(s) for the method you are building.
19594 ///
19595 /// See [`Self::add_scope()`] for details.
19596 pub fn add_scopes<I, St>(mut self, scopes: I) -> RowAccessPolicyGetIamPolicyCall<'a, C>
19597 where
19598 I: IntoIterator<Item = St>,
19599 St: AsRef<str>,
19600 {
19601 self._scopes
19602 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
19603 self
19604 }
19605
19606 /// Removes all scopes, and no default scope will be used either.
19607 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
19608 /// for details).
19609 pub fn clear_scopes(mut self) -> RowAccessPolicyGetIamPolicyCall<'a, C> {
19610 self._scopes.clear();
19611 self
19612 }
19613}
19614
19615/// Creates a row access policy.
19616///
19617/// A builder for the *insert* method supported by a *rowAccessPolicy* resource.
19618/// It is not used directly, but through a [`RowAccessPolicyMethods`] instance.
19619///
19620/// # Example
19621///
19622/// Instantiate a resource method builder
19623///
19624/// ```test_harness,no_run
19625/// # extern crate hyper;
19626/// # extern crate hyper_rustls;
19627/// # extern crate google_bigquery2 as bigquery2;
19628/// use bigquery2::api::RowAccessPolicy;
19629/// # async fn dox() {
19630/// # use bigquery2::{Bigquery, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
19631///
19632/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
19633/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
19634/// # .with_native_roots()
19635/// # .unwrap()
19636/// # .https_only()
19637/// # .enable_http2()
19638/// # .build();
19639///
19640/// # let executor = hyper_util::rt::TokioExecutor::new();
19641/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
19642/// # secret,
19643/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
19644/// # yup_oauth2::client::CustomHyperClientBuilder::from(
19645/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
19646/// # ),
19647/// # ).build().await.unwrap();
19648///
19649/// # let client = hyper_util::client::legacy::Client::builder(
19650/// # hyper_util::rt::TokioExecutor::new()
19651/// # )
19652/// # .build(
19653/// # hyper_rustls::HttpsConnectorBuilder::new()
19654/// # .with_native_roots()
19655/// # .unwrap()
19656/// # .https_or_http()
19657/// # .enable_http2()
19658/// # .build()
19659/// # );
19660/// # let mut hub = Bigquery::new(client, auth);
19661/// // As the method needs a request, you would usually fill it with the desired information
19662/// // into the respective structure. Some of the parts shown here might not be applicable !
19663/// // Values shown here are possibly random and not representative !
19664/// let mut req = RowAccessPolicy::default();
19665///
19666/// // You can configure optional parameters by calling the respective setters at will, and
19667/// // execute the final call using `doit()`.
19668/// // Values shown here are possibly random and not representative !
19669/// let result = hub.row_access_policies().insert(req, "projectId", "datasetId", "tableId")
19670/// .doit().await;
19671/// # }
19672/// ```
19673pub struct RowAccessPolicyInsertCall<'a, C>
19674where
19675 C: 'a,
19676{
19677 hub: &'a Bigquery<C>,
19678 _request: RowAccessPolicy,
19679 _project_id: String,
19680 _dataset_id: String,
19681 _table_id: String,
19682 _delegate: Option<&'a mut dyn common::Delegate>,
19683 _additional_params: HashMap<String, String>,
19684 _scopes: BTreeSet<String>,
19685}
19686
19687impl<'a, C> common::CallBuilder for RowAccessPolicyInsertCall<'a, C> {}
19688
19689impl<'a, C> RowAccessPolicyInsertCall<'a, C>
19690where
19691 C: common::Connector,
19692{
19693 /// Perform the operation you have build so far.
19694 pub async fn doit(mut self) -> common::Result<(common::Response, RowAccessPolicy)> {
19695 use std::borrow::Cow;
19696 use std::io::{Read, Seek};
19697
19698 use common::{url::Params, ToParts};
19699 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
19700
19701 let mut dd = common::DefaultDelegate;
19702 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
19703 dlg.begin(common::MethodInfo {
19704 id: "bigquery.rowAccessPolicies.insert",
19705 http_method: hyper::Method::POST,
19706 });
19707
19708 for &field in ["alt", "projectId", "datasetId", "tableId"].iter() {
19709 if self._additional_params.contains_key(field) {
19710 dlg.finished(false);
19711 return Err(common::Error::FieldClash(field));
19712 }
19713 }
19714
19715 let mut params = Params::with_capacity(6 + self._additional_params.len());
19716 params.push("projectId", self._project_id);
19717 params.push("datasetId", self._dataset_id);
19718 params.push("tableId", self._table_id);
19719
19720 params.extend(self._additional_params.iter());
19721
19722 params.push("alt", "json");
19723 let mut url = self.hub._base_url.clone()
19724 + "projects/{+projectId}/datasets/{+datasetId}/tables/{+tableId}/rowAccessPolicies";
19725 if self._scopes.is_empty() {
19726 self._scopes
19727 .insert(Scope::CloudPlatform.as_ref().to_string());
19728 }
19729
19730 #[allow(clippy::single_element_loop)]
19731 for &(find_this, param_name) in [
19732 ("{+projectId}", "projectId"),
19733 ("{+datasetId}", "datasetId"),
19734 ("{+tableId}", "tableId"),
19735 ]
19736 .iter()
19737 {
19738 url = params.uri_replacement(url, param_name, find_this, true);
19739 }
19740 {
19741 let to_remove = ["tableId", "datasetId", "projectId"];
19742 params.remove_params(&to_remove);
19743 }
19744
19745 let url = params.parse_with_url(&url);
19746
19747 let mut json_mime_type = mime::APPLICATION_JSON;
19748 let mut request_value_reader = {
19749 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
19750 common::remove_json_null_values(&mut value);
19751 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
19752 serde_json::to_writer(&mut dst, &value).unwrap();
19753 dst
19754 };
19755 let request_size = request_value_reader
19756 .seek(std::io::SeekFrom::End(0))
19757 .unwrap();
19758 request_value_reader
19759 .seek(std::io::SeekFrom::Start(0))
19760 .unwrap();
19761
19762 loop {
19763 let token = match self
19764 .hub
19765 .auth
19766 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
19767 .await
19768 {
19769 Ok(token) => token,
19770 Err(e) => match dlg.token(e) {
19771 Ok(token) => token,
19772 Err(e) => {
19773 dlg.finished(false);
19774 return Err(common::Error::MissingToken(e));
19775 }
19776 },
19777 };
19778 request_value_reader
19779 .seek(std::io::SeekFrom::Start(0))
19780 .unwrap();
19781 let mut req_result = {
19782 let client = &self.hub.client;
19783 dlg.pre_request();
19784 let mut req_builder = hyper::Request::builder()
19785 .method(hyper::Method::POST)
19786 .uri(url.as_str())
19787 .header(USER_AGENT, self.hub._user_agent.clone());
19788
19789 if let Some(token) = token.as_ref() {
19790 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
19791 }
19792
19793 let request = req_builder
19794 .header(CONTENT_TYPE, json_mime_type.to_string())
19795 .header(CONTENT_LENGTH, request_size as u64)
19796 .body(common::to_body(
19797 request_value_reader.get_ref().clone().into(),
19798 ));
19799
19800 client.request(request.unwrap()).await
19801 };
19802
19803 match req_result {
19804 Err(err) => {
19805 if let common::Retry::After(d) = dlg.http_error(&err) {
19806 sleep(d).await;
19807 continue;
19808 }
19809 dlg.finished(false);
19810 return Err(common::Error::HttpError(err));
19811 }
19812 Ok(res) => {
19813 let (mut parts, body) = res.into_parts();
19814 let mut body = common::Body::new(body);
19815 if !parts.status.is_success() {
19816 let bytes = common::to_bytes(body).await.unwrap_or_default();
19817 let error = serde_json::from_str(&common::to_string(&bytes));
19818 let response = common::to_response(parts, bytes.into());
19819
19820 if let common::Retry::After(d) =
19821 dlg.http_failure(&response, error.as_ref().ok())
19822 {
19823 sleep(d).await;
19824 continue;
19825 }
19826
19827 dlg.finished(false);
19828
19829 return Err(match error {
19830 Ok(value) => common::Error::BadRequest(value),
19831 _ => common::Error::Failure(response),
19832 });
19833 }
19834 let response = {
19835 let bytes = common::to_bytes(body).await.unwrap_or_default();
19836 let encoded = common::to_string(&bytes);
19837 match serde_json::from_str(&encoded) {
19838 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
19839 Err(error) => {
19840 dlg.response_json_decode_error(&encoded, &error);
19841 return Err(common::Error::JsonDecodeError(
19842 encoded.to_string(),
19843 error,
19844 ));
19845 }
19846 }
19847 };
19848
19849 dlg.finished(true);
19850 return Ok(response);
19851 }
19852 }
19853 }
19854 }
19855
19856 ///
19857 /// Sets the *request* property to the given value.
19858 ///
19859 /// Even though the property as already been set when instantiating this call,
19860 /// we provide this method for API completeness.
19861 pub fn request(mut self, new_value: RowAccessPolicy) -> RowAccessPolicyInsertCall<'a, C> {
19862 self._request = new_value;
19863 self
19864 }
19865 /// Required. Project ID of the table to get the row access policy.
19866 ///
19867 /// Sets the *project id* path property to the given value.
19868 ///
19869 /// Even though the property as already been set when instantiating this call,
19870 /// we provide this method for API completeness.
19871 pub fn project_id(mut self, new_value: &str) -> RowAccessPolicyInsertCall<'a, C> {
19872 self._project_id = new_value.to_string();
19873 self
19874 }
19875 /// Required. Dataset ID of the table to get the row access policy.
19876 ///
19877 /// Sets the *dataset id* path property to the given value.
19878 ///
19879 /// Even though the property as already been set when instantiating this call,
19880 /// we provide this method for API completeness.
19881 pub fn dataset_id(mut self, new_value: &str) -> RowAccessPolicyInsertCall<'a, C> {
19882 self._dataset_id = new_value.to_string();
19883 self
19884 }
19885 /// Required. Table ID of the table to get the row access policy.
19886 ///
19887 /// Sets the *table id* path property to the given value.
19888 ///
19889 /// Even though the property as already been set when instantiating this call,
19890 /// we provide this method for API completeness.
19891 pub fn table_id(mut self, new_value: &str) -> RowAccessPolicyInsertCall<'a, C> {
19892 self._table_id = new_value.to_string();
19893 self
19894 }
19895 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
19896 /// while executing the actual API request.
19897 ///
19898 /// ````text
19899 /// It should be used to handle progress information, and to implement a certain level of resilience.
19900 /// ````
19901 ///
19902 /// Sets the *delegate* property to the given value.
19903 pub fn delegate(
19904 mut self,
19905 new_value: &'a mut dyn common::Delegate,
19906 ) -> RowAccessPolicyInsertCall<'a, C> {
19907 self._delegate = Some(new_value);
19908 self
19909 }
19910
19911 /// Set any additional parameter of the query string used in the request.
19912 /// It should be used to set parameters which are not yet available through their own
19913 /// setters.
19914 ///
19915 /// Please note that this method must not be used to set any of the known parameters
19916 /// which have their own setter method. If done anyway, the request will fail.
19917 ///
19918 /// # Additional Parameters
19919 ///
19920 /// * *$.xgafv* (query-string) - V1 error format.
19921 /// * *access_token* (query-string) - OAuth access token.
19922 /// * *alt* (query-string) - Data format for response.
19923 /// * *callback* (query-string) - JSONP
19924 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
19925 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
19926 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
19927 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
19928 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
19929 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
19930 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
19931 pub fn param<T>(mut self, name: T, value: T) -> RowAccessPolicyInsertCall<'a, C>
19932 where
19933 T: AsRef<str>,
19934 {
19935 self._additional_params
19936 .insert(name.as_ref().to_string(), value.as_ref().to_string());
19937 self
19938 }
19939
19940 /// Identifies the authorization scope for the method you are building.
19941 ///
19942 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
19943 /// [`Scope::CloudPlatform`].
19944 ///
19945 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
19946 /// tokens for more than one scope.
19947 ///
19948 /// Usually there is more than one suitable scope to authorize an operation, some of which may
19949 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
19950 /// sufficient, a read-write scope will do as well.
19951 pub fn add_scope<St>(mut self, scope: St) -> RowAccessPolicyInsertCall<'a, C>
19952 where
19953 St: AsRef<str>,
19954 {
19955 self._scopes.insert(String::from(scope.as_ref()));
19956 self
19957 }
19958 /// Identifies the authorization scope(s) for the method you are building.
19959 ///
19960 /// See [`Self::add_scope()`] for details.
19961 pub fn add_scopes<I, St>(mut self, scopes: I) -> RowAccessPolicyInsertCall<'a, C>
19962 where
19963 I: IntoIterator<Item = St>,
19964 St: AsRef<str>,
19965 {
19966 self._scopes
19967 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
19968 self
19969 }
19970
19971 /// Removes all scopes, and no default scope will be used either.
19972 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
19973 /// for details).
19974 pub fn clear_scopes(mut self) -> RowAccessPolicyInsertCall<'a, C> {
19975 self._scopes.clear();
19976 self
19977 }
19978}
19979
19980/// Lists all row access policies on the specified table.
19981///
19982/// A builder for the *list* method supported by a *rowAccessPolicy* resource.
19983/// It is not used directly, but through a [`RowAccessPolicyMethods`] instance.
19984///
19985/// # Example
19986///
19987/// Instantiate a resource method builder
19988///
19989/// ```test_harness,no_run
19990/// # extern crate hyper;
19991/// # extern crate hyper_rustls;
19992/// # extern crate google_bigquery2 as bigquery2;
19993/// # async fn dox() {
19994/// # use bigquery2::{Bigquery, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
19995///
19996/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
19997/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
19998/// # .with_native_roots()
19999/// # .unwrap()
20000/// # .https_only()
20001/// # .enable_http2()
20002/// # .build();
20003///
20004/// # let executor = hyper_util::rt::TokioExecutor::new();
20005/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
20006/// # secret,
20007/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
20008/// # yup_oauth2::client::CustomHyperClientBuilder::from(
20009/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
20010/// # ),
20011/// # ).build().await.unwrap();
20012///
20013/// # let client = hyper_util::client::legacy::Client::builder(
20014/// # hyper_util::rt::TokioExecutor::new()
20015/// # )
20016/// # .build(
20017/// # hyper_rustls::HttpsConnectorBuilder::new()
20018/// # .with_native_roots()
20019/// # .unwrap()
20020/// # .https_or_http()
20021/// # .enable_http2()
20022/// # .build()
20023/// # );
20024/// # let mut hub = Bigquery::new(client, auth);
20025/// // You can configure optional parameters by calling the respective setters at will, and
20026/// // execute the final call using `doit()`.
20027/// // Values shown here are possibly random and not representative !
20028/// let result = hub.row_access_policies().list("projectId", "datasetId", "tableId")
20029/// .page_token("dolores")
20030/// .page_size(-95)
20031/// .doit().await;
20032/// # }
20033/// ```
20034pub struct RowAccessPolicyListCall<'a, C>
20035where
20036 C: 'a,
20037{
20038 hub: &'a Bigquery<C>,
20039 _project_id: String,
20040 _dataset_id: String,
20041 _table_id: String,
20042 _page_token: Option<String>,
20043 _page_size: Option<i32>,
20044 _delegate: Option<&'a mut dyn common::Delegate>,
20045 _additional_params: HashMap<String, String>,
20046 _scopes: BTreeSet<String>,
20047}
20048
20049impl<'a, C> common::CallBuilder for RowAccessPolicyListCall<'a, C> {}
20050
20051impl<'a, C> RowAccessPolicyListCall<'a, C>
20052where
20053 C: common::Connector,
20054{
20055 /// Perform the operation you have build so far.
20056 pub async fn doit(
20057 mut self,
20058 ) -> common::Result<(common::Response, ListRowAccessPoliciesResponse)> {
20059 use std::borrow::Cow;
20060 use std::io::{Read, Seek};
20061
20062 use common::{url::Params, ToParts};
20063 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
20064
20065 let mut dd = common::DefaultDelegate;
20066 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
20067 dlg.begin(common::MethodInfo {
20068 id: "bigquery.rowAccessPolicies.list",
20069 http_method: hyper::Method::GET,
20070 });
20071
20072 for &field in [
20073 "alt",
20074 "projectId",
20075 "datasetId",
20076 "tableId",
20077 "pageToken",
20078 "pageSize",
20079 ]
20080 .iter()
20081 {
20082 if self._additional_params.contains_key(field) {
20083 dlg.finished(false);
20084 return Err(common::Error::FieldClash(field));
20085 }
20086 }
20087
20088 let mut params = Params::with_capacity(7 + self._additional_params.len());
20089 params.push("projectId", self._project_id);
20090 params.push("datasetId", self._dataset_id);
20091 params.push("tableId", self._table_id);
20092 if let Some(value) = self._page_token.as_ref() {
20093 params.push("pageToken", value);
20094 }
20095 if let Some(value) = self._page_size.as_ref() {
20096 params.push("pageSize", value.to_string());
20097 }
20098
20099 params.extend(self._additional_params.iter());
20100
20101 params.push("alt", "json");
20102 let mut url = self.hub._base_url.clone()
20103 + "projects/{+projectId}/datasets/{+datasetId}/tables/{+tableId}/rowAccessPolicies";
20104 if self._scopes.is_empty() {
20105 self._scopes
20106 .insert(Scope::CloudPlatformReadOnly.as_ref().to_string());
20107 }
20108
20109 #[allow(clippy::single_element_loop)]
20110 for &(find_this, param_name) in [
20111 ("{+projectId}", "projectId"),
20112 ("{+datasetId}", "datasetId"),
20113 ("{+tableId}", "tableId"),
20114 ]
20115 .iter()
20116 {
20117 url = params.uri_replacement(url, param_name, find_this, true);
20118 }
20119 {
20120 let to_remove = ["tableId", "datasetId", "projectId"];
20121 params.remove_params(&to_remove);
20122 }
20123
20124 let url = params.parse_with_url(&url);
20125
20126 loop {
20127 let token = match self
20128 .hub
20129 .auth
20130 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
20131 .await
20132 {
20133 Ok(token) => token,
20134 Err(e) => match dlg.token(e) {
20135 Ok(token) => token,
20136 Err(e) => {
20137 dlg.finished(false);
20138 return Err(common::Error::MissingToken(e));
20139 }
20140 },
20141 };
20142 let mut req_result = {
20143 let client = &self.hub.client;
20144 dlg.pre_request();
20145 let mut req_builder = hyper::Request::builder()
20146 .method(hyper::Method::GET)
20147 .uri(url.as_str())
20148 .header(USER_AGENT, self.hub._user_agent.clone());
20149
20150 if let Some(token) = token.as_ref() {
20151 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
20152 }
20153
20154 let request = req_builder
20155 .header(CONTENT_LENGTH, 0_u64)
20156 .body(common::to_body::<String>(None));
20157
20158 client.request(request.unwrap()).await
20159 };
20160
20161 match req_result {
20162 Err(err) => {
20163 if let common::Retry::After(d) = dlg.http_error(&err) {
20164 sleep(d).await;
20165 continue;
20166 }
20167 dlg.finished(false);
20168 return Err(common::Error::HttpError(err));
20169 }
20170 Ok(res) => {
20171 let (mut parts, body) = res.into_parts();
20172 let mut body = common::Body::new(body);
20173 if !parts.status.is_success() {
20174 let bytes = common::to_bytes(body).await.unwrap_or_default();
20175 let error = serde_json::from_str(&common::to_string(&bytes));
20176 let response = common::to_response(parts, bytes.into());
20177
20178 if let common::Retry::After(d) =
20179 dlg.http_failure(&response, error.as_ref().ok())
20180 {
20181 sleep(d).await;
20182 continue;
20183 }
20184
20185 dlg.finished(false);
20186
20187 return Err(match error {
20188 Ok(value) => common::Error::BadRequest(value),
20189 _ => common::Error::Failure(response),
20190 });
20191 }
20192 let response = {
20193 let bytes = common::to_bytes(body).await.unwrap_or_default();
20194 let encoded = common::to_string(&bytes);
20195 match serde_json::from_str(&encoded) {
20196 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
20197 Err(error) => {
20198 dlg.response_json_decode_error(&encoded, &error);
20199 return Err(common::Error::JsonDecodeError(
20200 encoded.to_string(),
20201 error,
20202 ));
20203 }
20204 }
20205 };
20206
20207 dlg.finished(true);
20208 return Ok(response);
20209 }
20210 }
20211 }
20212 }
20213
20214 /// Required. Project ID of the row access policies to list.
20215 ///
20216 /// Sets the *project id* path property to the given value.
20217 ///
20218 /// Even though the property as already been set when instantiating this call,
20219 /// we provide this method for API completeness.
20220 pub fn project_id(mut self, new_value: &str) -> RowAccessPolicyListCall<'a, C> {
20221 self._project_id = new_value.to_string();
20222 self
20223 }
20224 /// Required. Dataset ID of row access policies to list.
20225 ///
20226 /// Sets the *dataset id* path property to the given value.
20227 ///
20228 /// Even though the property as already been set when instantiating this call,
20229 /// we provide this method for API completeness.
20230 pub fn dataset_id(mut self, new_value: &str) -> RowAccessPolicyListCall<'a, C> {
20231 self._dataset_id = new_value.to_string();
20232 self
20233 }
20234 /// Required. Table ID of the table to list row access policies.
20235 ///
20236 /// Sets the *table id* path property to the given value.
20237 ///
20238 /// Even though the property as already been set when instantiating this call,
20239 /// we provide this method for API completeness.
20240 pub fn table_id(mut self, new_value: &str) -> RowAccessPolicyListCall<'a, C> {
20241 self._table_id = new_value.to_string();
20242 self
20243 }
20244 /// Page token, returned by a previous call, to request the next page of results.
20245 ///
20246 /// Sets the *page token* query property to the given value.
20247 pub fn page_token(mut self, new_value: &str) -> RowAccessPolicyListCall<'a, C> {
20248 self._page_token = Some(new_value.to_string());
20249 self
20250 }
20251 /// The maximum number of results to return in a single response page. Leverage the page tokens to iterate through the entire collection.
20252 ///
20253 /// Sets the *page size* query property to the given value.
20254 pub fn page_size(mut self, new_value: i32) -> RowAccessPolicyListCall<'a, C> {
20255 self._page_size = Some(new_value);
20256 self
20257 }
20258 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
20259 /// while executing the actual API request.
20260 ///
20261 /// ````text
20262 /// It should be used to handle progress information, and to implement a certain level of resilience.
20263 /// ````
20264 ///
20265 /// Sets the *delegate* property to the given value.
20266 pub fn delegate(
20267 mut self,
20268 new_value: &'a mut dyn common::Delegate,
20269 ) -> RowAccessPolicyListCall<'a, C> {
20270 self._delegate = Some(new_value);
20271 self
20272 }
20273
20274 /// Set any additional parameter of the query string used in the request.
20275 /// It should be used to set parameters which are not yet available through their own
20276 /// setters.
20277 ///
20278 /// Please note that this method must not be used to set any of the known parameters
20279 /// which have their own setter method. If done anyway, the request will fail.
20280 ///
20281 /// # Additional Parameters
20282 ///
20283 /// * *$.xgafv* (query-string) - V1 error format.
20284 /// * *access_token* (query-string) - OAuth access token.
20285 /// * *alt* (query-string) - Data format for response.
20286 /// * *callback* (query-string) - JSONP
20287 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
20288 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
20289 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
20290 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
20291 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
20292 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
20293 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
20294 pub fn param<T>(mut self, name: T, value: T) -> RowAccessPolicyListCall<'a, C>
20295 where
20296 T: AsRef<str>,
20297 {
20298 self._additional_params
20299 .insert(name.as_ref().to_string(), value.as_ref().to_string());
20300 self
20301 }
20302
20303 /// Identifies the authorization scope for the method you are building.
20304 ///
20305 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
20306 /// [`Scope::CloudPlatformReadOnly`].
20307 ///
20308 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
20309 /// tokens for more than one scope.
20310 ///
20311 /// Usually there is more than one suitable scope to authorize an operation, some of which may
20312 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
20313 /// sufficient, a read-write scope will do as well.
20314 pub fn add_scope<St>(mut self, scope: St) -> RowAccessPolicyListCall<'a, C>
20315 where
20316 St: AsRef<str>,
20317 {
20318 self._scopes.insert(String::from(scope.as_ref()));
20319 self
20320 }
20321 /// Identifies the authorization scope(s) for the method you are building.
20322 ///
20323 /// See [`Self::add_scope()`] for details.
20324 pub fn add_scopes<I, St>(mut self, scopes: I) -> RowAccessPolicyListCall<'a, C>
20325 where
20326 I: IntoIterator<Item = St>,
20327 St: AsRef<str>,
20328 {
20329 self._scopes
20330 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
20331 self
20332 }
20333
20334 /// Removes all scopes, and no default scope will be used either.
20335 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
20336 /// for details).
20337 pub fn clear_scopes(mut self) -> RowAccessPolicyListCall<'a, C> {
20338 self._scopes.clear();
20339 self
20340 }
20341}
20342
20343/// Returns permissions that a caller has on the specified resource. If the resource does not exist, this will return an empty set of permissions, not a `NOT_FOUND` error. Note: This operation is designed to be used for building permission-aware UIs and command-line tools, not for authorization checking. This operation may "fail open" without warning.
20344///
20345/// A builder for the *testIamPermissions* method supported by a *rowAccessPolicy* resource.
20346/// It is not used directly, but through a [`RowAccessPolicyMethods`] instance.
20347///
20348/// # Example
20349///
20350/// Instantiate a resource method builder
20351///
20352/// ```test_harness,no_run
20353/// # extern crate hyper;
20354/// # extern crate hyper_rustls;
20355/// # extern crate google_bigquery2 as bigquery2;
20356/// use bigquery2::api::TestIamPermissionsRequest;
20357/// # async fn dox() {
20358/// # use bigquery2::{Bigquery, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
20359///
20360/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
20361/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
20362/// # .with_native_roots()
20363/// # .unwrap()
20364/// # .https_only()
20365/// # .enable_http2()
20366/// # .build();
20367///
20368/// # let executor = hyper_util::rt::TokioExecutor::new();
20369/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
20370/// # secret,
20371/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
20372/// # yup_oauth2::client::CustomHyperClientBuilder::from(
20373/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
20374/// # ),
20375/// # ).build().await.unwrap();
20376///
20377/// # let client = hyper_util::client::legacy::Client::builder(
20378/// # hyper_util::rt::TokioExecutor::new()
20379/// # )
20380/// # .build(
20381/// # hyper_rustls::HttpsConnectorBuilder::new()
20382/// # .with_native_roots()
20383/// # .unwrap()
20384/// # .https_or_http()
20385/// # .enable_http2()
20386/// # .build()
20387/// # );
20388/// # let mut hub = Bigquery::new(client, auth);
20389/// // As the method needs a request, you would usually fill it with the desired information
20390/// // into the respective structure. Some of the parts shown here might not be applicable !
20391/// // Values shown here are possibly random and not representative !
20392/// let mut req = TestIamPermissionsRequest::default();
20393///
20394/// // You can configure optional parameters by calling the respective setters at will, and
20395/// // execute the final call using `doit()`.
20396/// // Values shown here are possibly random and not representative !
20397/// let result = hub.row_access_policies().test_iam_permissions(req, "resource")
20398/// .doit().await;
20399/// # }
20400/// ```
20401pub struct RowAccessPolicyTestIamPermissionCall<'a, C>
20402where
20403 C: 'a,
20404{
20405 hub: &'a Bigquery<C>,
20406 _request: TestIamPermissionsRequest,
20407 _resource: String,
20408 _delegate: Option<&'a mut dyn common::Delegate>,
20409 _additional_params: HashMap<String, String>,
20410 _scopes: BTreeSet<String>,
20411}
20412
20413impl<'a, C> common::CallBuilder for RowAccessPolicyTestIamPermissionCall<'a, C> {}
20414
20415impl<'a, C> RowAccessPolicyTestIamPermissionCall<'a, C>
20416where
20417 C: common::Connector,
20418{
20419 /// Perform the operation you have build so far.
20420 pub async fn doit(mut self) -> common::Result<(common::Response, TestIamPermissionsResponse)> {
20421 use std::borrow::Cow;
20422 use std::io::{Read, Seek};
20423
20424 use common::{url::Params, ToParts};
20425 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
20426
20427 let mut dd = common::DefaultDelegate;
20428 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
20429 dlg.begin(common::MethodInfo {
20430 id: "bigquery.rowAccessPolicies.testIamPermissions",
20431 http_method: hyper::Method::POST,
20432 });
20433
20434 for &field in ["alt", "resource"].iter() {
20435 if self._additional_params.contains_key(field) {
20436 dlg.finished(false);
20437 return Err(common::Error::FieldClash(field));
20438 }
20439 }
20440
20441 let mut params = Params::with_capacity(4 + self._additional_params.len());
20442 params.push("resource", self._resource);
20443
20444 params.extend(self._additional_params.iter());
20445
20446 params.push("alt", "json");
20447 let mut url = self.hub._base_url.clone() + "{+resource}:testIamPermissions";
20448 if self._scopes.is_empty() {
20449 self._scopes
20450 .insert(Scope::CloudPlatformReadOnly.as_ref().to_string());
20451 }
20452
20453 #[allow(clippy::single_element_loop)]
20454 for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
20455 url = params.uri_replacement(url, param_name, find_this, true);
20456 }
20457 {
20458 let to_remove = ["resource"];
20459 params.remove_params(&to_remove);
20460 }
20461
20462 let url = params.parse_with_url(&url);
20463
20464 let mut json_mime_type = mime::APPLICATION_JSON;
20465 let mut request_value_reader = {
20466 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
20467 common::remove_json_null_values(&mut value);
20468 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
20469 serde_json::to_writer(&mut dst, &value).unwrap();
20470 dst
20471 };
20472 let request_size = request_value_reader
20473 .seek(std::io::SeekFrom::End(0))
20474 .unwrap();
20475 request_value_reader
20476 .seek(std::io::SeekFrom::Start(0))
20477 .unwrap();
20478
20479 loop {
20480 let token = match self
20481 .hub
20482 .auth
20483 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
20484 .await
20485 {
20486 Ok(token) => token,
20487 Err(e) => match dlg.token(e) {
20488 Ok(token) => token,
20489 Err(e) => {
20490 dlg.finished(false);
20491 return Err(common::Error::MissingToken(e));
20492 }
20493 },
20494 };
20495 request_value_reader
20496 .seek(std::io::SeekFrom::Start(0))
20497 .unwrap();
20498 let mut req_result = {
20499 let client = &self.hub.client;
20500 dlg.pre_request();
20501 let mut req_builder = hyper::Request::builder()
20502 .method(hyper::Method::POST)
20503 .uri(url.as_str())
20504 .header(USER_AGENT, self.hub._user_agent.clone());
20505
20506 if let Some(token) = token.as_ref() {
20507 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
20508 }
20509
20510 let request = req_builder
20511 .header(CONTENT_TYPE, json_mime_type.to_string())
20512 .header(CONTENT_LENGTH, request_size as u64)
20513 .body(common::to_body(
20514 request_value_reader.get_ref().clone().into(),
20515 ));
20516
20517 client.request(request.unwrap()).await
20518 };
20519
20520 match req_result {
20521 Err(err) => {
20522 if let common::Retry::After(d) = dlg.http_error(&err) {
20523 sleep(d).await;
20524 continue;
20525 }
20526 dlg.finished(false);
20527 return Err(common::Error::HttpError(err));
20528 }
20529 Ok(res) => {
20530 let (mut parts, body) = res.into_parts();
20531 let mut body = common::Body::new(body);
20532 if !parts.status.is_success() {
20533 let bytes = common::to_bytes(body).await.unwrap_or_default();
20534 let error = serde_json::from_str(&common::to_string(&bytes));
20535 let response = common::to_response(parts, bytes.into());
20536
20537 if let common::Retry::After(d) =
20538 dlg.http_failure(&response, error.as_ref().ok())
20539 {
20540 sleep(d).await;
20541 continue;
20542 }
20543
20544 dlg.finished(false);
20545
20546 return Err(match error {
20547 Ok(value) => common::Error::BadRequest(value),
20548 _ => common::Error::Failure(response),
20549 });
20550 }
20551 let response = {
20552 let bytes = common::to_bytes(body).await.unwrap_or_default();
20553 let encoded = common::to_string(&bytes);
20554 match serde_json::from_str(&encoded) {
20555 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
20556 Err(error) => {
20557 dlg.response_json_decode_error(&encoded, &error);
20558 return Err(common::Error::JsonDecodeError(
20559 encoded.to_string(),
20560 error,
20561 ));
20562 }
20563 }
20564 };
20565
20566 dlg.finished(true);
20567 return Ok(response);
20568 }
20569 }
20570 }
20571 }
20572
20573 ///
20574 /// Sets the *request* property to the given value.
20575 ///
20576 /// Even though the property as already been set when instantiating this call,
20577 /// we provide this method for API completeness.
20578 pub fn request(
20579 mut self,
20580 new_value: TestIamPermissionsRequest,
20581 ) -> RowAccessPolicyTestIamPermissionCall<'a, C> {
20582 self._request = new_value;
20583 self
20584 }
20585 /// REQUIRED: The resource for which the policy detail is being requested. See [Resource names](https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
20586 ///
20587 /// Sets the *resource* path property to the given value.
20588 ///
20589 /// Even though the property as already been set when instantiating this call,
20590 /// we provide this method for API completeness.
20591 pub fn resource(mut self, new_value: &str) -> RowAccessPolicyTestIamPermissionCall<'a, C> {
20592 self._resource = new_value.to_string();
20593 self
20594 }
20595 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
20596 /// while executing the actual API request.
20597 ///
20598 /// ````text
20599 /// It should be used to handle progress information, and to implement a certain level of resilience.
20600 /// ````
20601 ///
20602 /// Sets the *delegate* property to the given value.
20603 pub fn delegate(
20604 mut self,
20605 new_value: &'a mut dyn common::Delegate,
20606 ) -> RowAccessPolicyTestIamPermissionCall<'a, C> {
20607 self._delegate = Some(new_value);
20608 self
20609 }
20610
20611 /// Set any additional parameter of the query string used in the request.
20612 /// It should be used to set parameters which are not yet available through their own
20613 /// setters.
20614 ///
20615 /// Please note that this method must not be used to set any of the known parameters
20616 /// which have their own setter method. If done anyway, the request will fail.
20617 ///
20618 /// # Additional Parameters
20619 ///
20620 /// * *$.xgafv* (query-string) - V1 error format.
20621 /// * *access_token* (query-string) - OAuth access token.
20622 /// * *alt* (query-string) - Data format for response.
20623 /// * *callback* (query-string) - JSONP
20624 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
20625 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
20626 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
20627 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
20628 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
20629 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
20630 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
20631 pub fn param<T>(mut self, name: T, value: T) -> RowAccessPolicyTestIamPermissionCall<'a, C>
20632 where
20633 T: AsRef<str>,
20634 {
20635 self._additional_params
20636 .insert(name.as_ref().to_string(), value.as_ref().to_string());
20637 self
20638 }
20639
20640 /// Identifies the authorization scope for the method you are building.
20641 ///
20642 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
20643 /// [`Scope::CloudPlatformReadOnly`].
20644 ///
20645 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
20646 /// tokens for more than one scope.
20647 ///
20648 /// Usually there is more than one suitable scope to authorize an operation, some of which may
20649 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
20650 /// sufficient, a read-write scope will do as well.
20651 pub fn add_scope<St>(mut self, scope: St) -> RowAccessPolicyTestIamPermissionCall<'a, C>
20652 where
20653 St: AsRef<str>,
20654 {
20655 self._scopes.insert(String::from(scope.as_ref()));
20656 self
20657 }
20658 /// Identifies the authorization scope(s) for the method you are building.
20659 ///
20660 /// See [`Self::add_scope()`] for details.
20661 pub fn add_scopes<I, St>(mut self, scopes: I) -> RowAccessPolicyTestIamPermissionCall<'a, C>
20662 where
20663 I: IntoIterator<Item = St>,
20664 St: AsRef<str>,
20665 {
20666 self._scopes
20667 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
20668 self
20669 }
20670
20671 /// Removes all scopes, and no default scope will be used either.
20672 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
20673 /// for details).
20674 pub fn clear_scopes(mut self) -> RowAccessPolicyTestIamPermissionCall<'a, C> {
20675 self._scopes.clear();
20676 self
20677 }
20678}
20679
20680/// Updates a row access policy.
20681///
20682/// A builder for the *update* method supported by a *rowAccessPolicy* resource.
20683/// It is not used directly, but through a [`RowAccessPolicyMethods`] instance.
20684///
20685/// # Example
20686///
20687/// Instantiate a resource method builder
20688///
20689/// ```test_harness,no_run
20690/// # extern crate hyper;
20691/// # extern crate hyper_rustls;
20692/// # extern crate google_bigquery2 as bigquery2;
20693/// use bigquery2::api::RowAccessPolicy;
20694/// # async fn dox() {
20695/// # use bigquery2::{Bigquery, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
20696///
20697/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
20698/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
20699/// # .with_native_roots()
20700/// # .unwrap()
20701/// # .https_only()
20702/// # .enable_http2()
20703/// # .build();
20704///
20705/// # let executor = hyper_util::rt::TokioExecutor::new();
20706/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
20707/// # secret,
20708/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
20709/// # yup_oauth2::client::CustomHyperClientBuilder::from(
20710/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
20711/// # ),
20712/// # ).build().await.unwrap();
20713///
20714/// # let client = hyper_util::client::legacy::Client::builder(
20715/// # hyper_util::rt::TokioExecutor::new()
20716/// # )
20717/// # .build(
20718/// # hyper_rustls::HttpsConnectorBuilder::new()
20719/// # .with_native_roots()
20720/// # .unwrap()
20721/// # .https_or_http()
20722/// # .enable_http2()
20723/// # .build()
20724/// # );
20725/// # let mut hub = Bigquery::new(client, auth);
20726/// // As the method needs a request, you would usually fill it with the desired information
20727/// // into the respective structure. Some of the parts shown here might not be applicable !
20728/// // Values shown here are possibly random and not representative !
20729/// let mut req = RowAccessPolicy::default();
20730///
20731/// // You can configure optional parameters by calling the respective setters at will, and
20732/// // execute the final call using `doit()`.
20733/// // Values shown here are possibly random and not representative !
20734/// let result = hub.row_access_policies().update(req, "projectId", "datasetId", "tableId", "policyId")
20735/// .doit().await;
20736/// # }
20737/// ```
20738pub struct RowAccessPolicyUpdateCall<'a, C>
20739where
20740 C: 'a,
20741{
20742 hub: &'a Bigquery<C>,
20743 _request: RowAccessPolicy,
20744 _project_id: String,
20745 _dataset_id: String,
20746 _table_id: String,
20747 _policy_id: String,
20748 _delegate: Option<&'a mut dyn common::Delegate>,
20749 _additional_params: HashMap<String, String>,
20750 _scopes: BTreeSet<String>,
20751}
20752
20753impl<'a, C> common::CallBuilder for RowAccessPolicyUpdateCall<'a, C> {}
20754
20755impl<'a, C> RowAccessPolicyUpdateCall<'a, C>
20756where
20757 C: common::Connector,
20758{
20759 /// Perform the operation you have build so far.
20760 pub async fn doit(mut self) -> common::Result<(common::Response, RowAccessPolicy)> {
20761 use std::borrow::Cow;
20762 use std::io::{Read, Seek};
20763
20764 use common::{url::Params, ToParts};
20765 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
20766
20767 let mut dd = common::DefaultDelegate;
20768 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
20769 dlg.begin(common::MethodInfo {
20770 id: "bigquery.rowAccessPolicies.update",
20771 http_method: hyper::Method::PUT,
20772 });
20773
20774 for &field in ["alt", "projectId", "datasetId", "tableId", "policyId"].iter() {
20775 if self._additional_params.contains_key(field) {
20776 dlg.finished(false);
20777 return Err(common::Error::FieldClash(field));
20778 }
20779 }
20780
20781 let mut params = Params::with_capacity(7 + self._additional_params.len());
20782 params.push("projectId", self._project_id);
20783 params.push("datasetId", self._dataset_id);
20784 params.push("tableId", self._table_id);
20785 params.push("policyId", self._policy_id);
20786
20787 params.extend(self._additional_params.iter());
20788
20789 params.push("alt", "json");
20790 let mut url = self.hub._base_url.clone() + "projects/{+projectId}/datasets/{+datasetId}/tables/{+tableId}/rowAccessPolicies/{+policyId}";
20791 if self._scopes.is_empty() {
20792 self._scopes
20793 .insert(Scope::CloudPlatform.as_ref().to_string());
20794 }
20795
20796 #[allow(clippy::single_element_loop)]
20797 for &(find_this, param_name) in [
20798 ("{+projectId}", "projectId"),
20799 ("{+datasetId}", "datasetId"),
20800 ("{+tableId}", "tableId"),
20801 ("{+policyId}", "policyId"),
20802 ]
20803 .iter()
20804 {
20805 url = params.uri_replacement(url, param_name, find_this, true);
20806 }
20807 {
20808 let to_remove = ["policyId", "tableId", "datasetId", "projectId"];
20809 params.remove_params(&to_remove);
20810 }
20811
20812 let url = params.parse_with_url(&url);
20813
20814 let mut json_mime_type = mime::APPLICATION_JSON;
20815 let mut request_value_reader = {
20816 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
20817 common::remove_json_null_values(&mut value);
20818 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
20819 serde_json::to_writer(&mut dst, &value).unwrap();
20820 dst
20821 };
20822 let request_size = request_value_reader
20823 .seek(std::io::SeekFrom::End(0))
20824 .unwrap();
20825 request_value_reader
20826 .seek(std::io::SeekFrom::Start(0))
20827 .unwrap();
20828
20829 loop {
20830 let token = match self
20831 .hub
20832 .auth
20833 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
20834 .await
20835 {
20836 Ok(token) => token,
20837 Err(e) => match dlg.token(e) {
20838 Ok(token) => token,
20839 Err(e) => {
20840 dlg.finished(false);
20841 return Err(common::Error::MissingToken(e));
20842 }
20843 },
20844 };
20845 request_value_reader
20846 .seek(std::io::SeekFrom::Start(0))
20847 .unwrap();
20848 let mut req_result = {
20849 let client = &self.hub.client;
20850 dlg.pre_request();
20851 let mut req_builder = hyper::Request::builder()
20852 .method(hyper::Method::PUT)
20853 .uri(url.as_str())
20854 .header(USER_AGENT, self.hub._user_agent.clone());
20855
20856 if let Some(token) = token.as_ref() {
20857 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
20858 }
20859
20860 let request = req_builder
20861 .header(CONTENT_TYPE, json_mime_type.to_string())
20862 .header(CONTENT_LENGTH, request_size as u64)
20863 .body(common::to_body(
20864 request_value_reader.get_ref().clone().into(),
20865 ));
20866
20867 client.request(request.unwrap()).await
20868 };
20869
20870 match req_result {
20871 Err(err) => {
20872 if let common::Retry::After(d) = dlg.http_error(&err) {
20873 sleep(d).await;
20874 continue;
20875 }
20876 dlg.finished(false);
20877 return Err(common::Error::HttpError(err));
20878 }
20879 Ok(res) => {
20880 let (mut parts, body) = res.into_parts();
20881 let mut body = common::Body::new(body);
20882 if !parts.status.is_success() {
20883 let bytes = common::to_bytes(body).await.unwrap_or_default();
20884 let error = serde_json::from_str(&common::to_string(&bytes));
20885 let response = common::to_response(parts, bytes.into());
20886
20887 if let common::Retry::After(d) =
20888 dlg.http_failure(&response, error.as_ref().ok())
20889 {
20890 sleep(d).await;
20891 continue;
20892 }
20893
20894 dlg.finished(false);
20895
20896 return Err(match error {
20897 Ok(value) => common::Error::BadRequest(value),
20898 _ => common::Error::Failure(response),
20899 });
20900 }
20901 let response = {
20902 let bytes = common::to_bytes(body).await.unwrap_or_default();
20903 let encoded = common::to_string(&bytes);
20904 match serde_json::from_str(&encoded) {
20905 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
20906 Err(error) => {
20907 dlg.response_json_decode_error(&encoded, &error);
20908 return Err(common::Error::JsonDecodeError(
20909 encoded.to_string(),
20910 error,
20911 ));
20912 }
20913 }
20914 };
20915
20916 dlg.finished(true);
20917 return Ok(response);
20918 }
20919 }
20920 }
20921 }
20922
20923 ///
20924 /// Sets the *request* property to the given value.
20925 ///
20926 /// Even though the property as already been set when instantiating this call,
20927 /// we provide this method for API completeness.
20928 pub fn request(mut self, new_value: RowAccessPolicy) -> RowAccessPolicyUpdateCall<'a, C> {
20929 self._request = new_value;
20930 self
20931 }
20932 /// Required. Project ID of the table to get the row access policy.
20933 ///
20934 /// Sets the *project id* path property to the given value.
20935 ///
20936 /// Even though the property as already been set when instantiating this call,
20937 /// we provide this method for API completeness.
20938 pub fn project_id(mut self, new_value: &str) -> RowAccessPolicyUpdateCall<'a, C> {
20939 self._project_id = new_value.to_string();
20940 self
20941 }
20942 /// Required. Dataset ID of the table to get the row access policy.
20943 ///
20944 /// Sets the *dataset id* path property to the given value.
20945 ///
20946 /// Even though the property as already been set when instantiating this call,
20947 /// we provide this method for API completeness.
20948 pub fn dataset_id(mut self, new_value: &str) -> RowAccessPolicyUpdateCall<'a, C> {
20949 self._dataset_id = new_value.to_string();
20950 self
20951 }
20952 /// Required. Table ID of the table to get the row access policy.
20953 ///
20954 /// Sets the *table id* path property to the given value.
20955 ///
20956 /// Even though the property as already been set when instantiating this call,
20957 /// we provide this method for API completeness.
20958 pub fn table_id(mut self, new_value: &str) -> RowAccessPolicyUpdateCall<'a, C> {
20959 self._table_id = new_value.to_string();
20960 self
20961 }
20962 /// Required. Policy ID of the row access policy.
20963 ///
20964 /// Sets the *policy id* path property to the given value.
20965 ///
20966 /// Even though the property as already been set when instantiating this call,
20967 /// we provide this method for API completeness.
20968 pub fn policy_id(mut self, new_value: &str) -> RowAccessPolicyUpdateCall<'a, C> {
20969 self._policy_id = new_value.to_string();
20970 self
20971 }
20972 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
20973 /// while executing the actual API request.
20974 ///
20975 /// ````text
20976 /// It should be used to handle progress information, and to implement a certain level of resilience.
20977 /// ````
20978 ///
20979 /// Sets the *delegate* property to the given value.
20980 pub fn delegate(
20981 mut self,
20982 new_value: &'a mut dyn common::Delegate,
20983 ) -> RowAccessPolicyUpdateCall<'a, C> {
20984 self._delegate = Some(new_value);
20985 self
20986 }
20987
20988 /// Set any additional parameter of the query string used in the request.
20989 /// It should be used to set parameters which are not yet available through their own
20990 /// setters.
20991 ///
20992 /// Please note that this method must not be used to set any of the known parameters
20993 /// which have their own setter method. If done anyway, the request will fail.
20994 ///
20995 /// # Additional Parameters
20996 ///
20997 /// * *$.xgafv* (query-string) - V1 error format.
20998 /// * *access_token* (query-string) - OAuth access token.
20999 /// * *alt* (query-string) - Data format for response.
21000 /// * *callback* (query-string) - JSONP
21001 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
21002 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
21003 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
21004 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
21005 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
21006 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
21007 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
21008 pub fn param<T>(mut self, name: T, value: T) -> RowAccessPolicyUpdateCall<'a, C>
21009 where
21010 T: AsRef<str>,
21011 {
21012 self._additional_params
21013 .insert(name.as_ref().to_string(), value.as_ref().to_string());
21014 self
21015 }
21016
21017 /// Identifies the authorization scope for the method you are building.
21018 ///
21019 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
21020 /// [`Scope::CloudPlatform`].
21021 ///
21022 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
21023 /// tokens for more than one scope.
21024 ///
21025 /// Usually there is more than one suitable scope to authorize an operation, some of which may
21026 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
21027 /// sufficient, a read-write scope will do as well.
21028 pub fn add_scope<St>(mut self, scope: St) -> RowAccessPolicyUpdateCall<'a, C>
21029 where
21030 St: AsRef<str>,
21031 {
21032 self._scopes.insert(String::from(scope.as_ref()));
21033 self
21034 }
21035 /// Identifies the authorization scope(s) for the method you are building.
21036 ///
21037 /// See [`Self::add_scope()`] for details.
21038 pub fn add_scopes<I, St>(mut self, scopes: I) -> RowAccessPolicyUpdateCall<'a, C>
21039 where
21040 I: IntoIterator<Item = St>,
21041 St: AsRef<str>,
21042 {
21043 self._scopes
21044 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
21045 self
21046 }
21047
21048 /// Removes all scopes, and no default scope will be used either.
21049 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
21050 /// for details).
21051 pub fn clear_scopes(mut self) -> RowAccessPolicyUpdateCall<'a, C> {
21052 self._scopes.clear();
21053 self
21054 }
21055}
21056
21057/// Streams data into BigQuery one record at a time without needing to run a load job.
21058///
21059/// A builder for the *insertAll* method supported by a *tabledata* resource.
21060/// It is not used directly, but through a [`TabledataMethods`] instance.
21061///
21062/// # Example
21063///
21064/// Instantiate a resource method builder
21065///
21066/// ```test_harness,no_run
21067/// # extern crate hyper;
21068/// # extern crate hyper_rustls;
21069/// # extern crate google_bigquery2 as bigquery2;
21070/// use bigquery2::api::TableDataInsertAllRequest;
21071/// # async fn dox() {
21072/// # use bigquery2::{Bigquery, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
21073///
21074/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
21075/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
21076/// # .with_native_roots()
21077/// # .unwrap()
21078/// # .https_only()
21079/// # .enable_http2()
21080/// # .build();
21081///
21082/// # let executor = hyper_util::rt::TokioExecutor::new();
21083/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
21084/// # secret,
21085/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
21086/// # yup_oauth2::client::CustomHyperClientBuilder::from(
21087/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
21088/// # ),
21089/// # ).build().await.unwrap();
21090///
21091/// # let client = hyper_util::client::legacy::Client::builder(
21092/// # hyper_util::rt::TokioExecutor::new()
21093/// # )
21094/// # .build(
21095/// # hyper_rustls::HttpsConnectorBuilder::new()
21096/// # .with_native_roots()
21097/// # .unwrap()
21098/// # .https_or_http()
21099/// # .enable_http2()
21100/// # .build()
21101/// # );
21102/// # let mut hub = Bigquery::new(client, auth);
21103/// // As the method needs a request, you would usually fill it with the desired information
21104/// // into the respective structure. Some of the parts shown here might not be applicable !
21105/// // Values shown here are possibly random and not representative !
21106/// let mut req = TableDataInsertAllRequest::default();
21107///
21108/// // You can configure optional parameters by calling the respective setters at will, and
21109/// // execute the final call using `doit()`.
21110/// // Values shown here are possibly random and not representative !
21111/// let result = hub.tabledata().insert_all(req, "projectId", "datasetId", "tableId")
21112/// .doit().await;
21113/// # }
21114/// ```
21115pub struct TabledataInsertAllCall<'a, C>
21116where
21117 C: 'a,
21118{
21119 hub: &'a Bigquery<C>,
21120 _request: TableDataInsertAllRequest,
21121 _project_id: String,
21122 _dataset_id: String,
21123 _table_id: String,
21124 _delegate: Option<&'a mut dyn common::Delegate>,
21125 _additional_params: HashMap<String, String>,
21126 _scopes: BTreeSet<String>,
21127}
21128
21129impl<'a, C> common::CallBuilder for TabledataInsertAllCall<'a, C> {}
21130
21131impl<'a, C> TabledataInsertAllCall<'a, C>
21132where
21133 C: common::Connector,
21134{
21135 /// Perform the operation you have build so far.
21136 pub async fn doit(mut self) -> common::Result<(common::Response, TableDataInsertAllResponse)> {
21137 use std::borrow::Cow;
21138 use std::io::{Read, Seek};
21139
21140 use common::{url::Params, ToParts};
21141 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
21142
21143 let mut dd = common::DefaultDelegate;
21144 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
21145 dlg.begin(common::MethodInfo {
21146 id: "bigquery.tabledata.insertAll",
21147 http_method: hyper::Method::POST,
21148 });
21149
21150 for &field in ["alt", "projectId", "datasetId", "tableId"].iter() {
21151 if self._additional_params.contains_key(field) {
21152 dlg.finished(false);
21153 return Err(common::Error::FieldClash(field));
21154 }
21155 }
21156
21157 let mut params = Params::with_capacity(6 + self._additional_params.len());
21158 params.push("projectId", self._project_id);
21159 params.push("datasetId", self._dataset_id);
21160 params.push("tableId", self._table_id);
21161
21162 params.extend(self._additional_params.iter());
21163
21164 params.push("alt", "json");
21165 let mut url = self.hub._base_url.clone()
21166 + "projects/{+projectId}/datasets/{+datasetId}/tables/{+tableId}/insertAll";
21167 if self._scopes.is_empty() {
21168 self._scopes
21169 .insert(Scope::CloudPlatform.as_ref().to_string());
21170 }
21171
21172 #[allow(clippy::single_element_loop)]
21173 for &(find_this, param_name) in [
21174 ("{+projectId}", "projectId"),
21175 ("{+datasetId}", "datasetId"),
21176 ("{+tableId}", "tableId"),
21177 ]
21178 .iter()
21179 {
21180 url = params.uri_replacement(url, param_name, find_this, true);
21181 }
21182 {
21183 let to_remove = ["tableId", "datasetId", "projectId"];
21184 params.remove_params(&to_remove);
21185 }
21186
21187 let url = params.parse_with_url(&url);
21188
21189 let mut json_mime_type = mime::APPLICATION_JSON;
21190 let mut request_value_reader = {
21191 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
21192 common::remove_json_null_values(&mut value);
21193 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
21194 serde_json::to_writer(&mut dst, &value).unwrap();
21195 dst
21196 };
21197 let request_size = request_value_reader
21198 .seek(std::io::SeekFrom::End(0))
21199 .unwrap();
21200 request_value_reader
21201 .seek(std::io::SeekFrom::Start(0))
21202 .unwrap();
21203
21204 loop {
21205 let token = match self
21206 .hub
21207 .auth
21208 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
21209 .await
21210 {
21211 Ok(token) => token,
21212 Err(e) => match dlg.token(e) {
21213 Ok(token) => token,
21214 Err(e) => {
21215 dlg.finished(false);
21216 return Err(common::Error::MissingToken(e));
21217 }
21218 },
21219 };
21220 request_value_reader
21221 .seek(std::io::SeekFrom::Start(0))
21222 .unwrap();
21223 let mut req_result = {
21224 let client = &self.hub.client;
21225 dlg.pre_request();
21226 let mut req_builder = hyper::Request::builder()
21227 .method(hyper::Method::POST)
21228 .uri(url.as_str())
21229 .header(USER_AGENT, self.hub._user_agent.clone());
21230
21231 if let Some(token) = token.as_ref() {
21232 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
21233 }
21234
21235 let request = req_builder
21236 .header(CONTENT_TYPE, json_mime_type.to_string())
21237 .header(CONTENT_LENGTH, request_size as u64)
21238 .body(common::to_body(
21239 request_value_reader.get_ref().clone().into(),
21240 ));
21241
21242 client.request(request.unwrap()).await
21243 };
21244
21245 match req_result {
21246 Err(err) => {
21247 if let common::Retry::After(d) = dlg.http_error(&err) {
21248 sleep(d).await;
21249 continue;
21250 }
21251 dlg.finished(false);
21252 return Err(common::Error::HttpError(err));
21253 }
21254 Ok(res) => {
21255 let (mut parts, body) = res.into_parts();
21256 let mut body = common::Body::new(body);
21257 if !parts.status.is_success() {
21258 let bytes = common::to_bytes(body).await.unwrap_or_default();
21259 let error = serde_json::from_str(&common::to_string(&bytes));
21260 let response = common::to_response(parts, bytes.into());
21261
21262 if let common::Retry::After(d) =
21263 dlg.http_failure(&response, error.as_ref().ok())
21264 {
21265 sleep(d).await;
21266 continue;
21267 }
21268
21269 dlg.finished(false);
21270
21271 return Err(match error {
21272 Ok(value) => common::Error::BadRequest(value),
21273 _ => common::Error::Failure(response),
21274 });
21275 }
21276 let response = {
21277 let bytes = common::to_bytes(body).await.unwrap_or_default();
21278 let encoded = common::to_string(&bytes);
21279 match serde_json::from_str(&encoded) {
21280 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
21281 Err(error) => {
21282 dlg.response_json_decode_error(&encoded, &error);
21283 return Err(common::Error::JsonDecodeError(
21284 encoded.to_string(),
21285 error,
21286 ));
21287 }
21288 }
21289 };
21290
21291 dlg.finished(true);
21292 return Ok(response);
21293 }
21294 }
21295 }
21296 }
21297
21298 ///
21299 /// Sets the *request* property to the given value.
21300 ///
21301 /// Even though the property as already been set when instantiating this call,
21302 /// we provide this method for API completeness.
21303 pub fn request(
21304 mut self,
21305 new_value: TableDataInsertAllRequest,
21306 ) -> TabledataInsertAllCall<'a, C> {
21307 self._request = new_value;
21308 self
21309 }
21310 /// Required. Project ID of the destination.
21311 ///
21312 /// Sets the *project id* path property to the given value.
21313 ///
21314 /// Even though the property as already been set when instantiating this call,
21315 /// we provide this method for API completeness.
21316 pub fn project_id(mut self, new_value: &str) -> TabledataInsertAllCall<'a, C> {
21317 self._project_id = new_value.to_string();
21318 self
21319 }
21320 /// Required. Dataset ID of the destination.
21321 ///
21322 /// Sets the *dataset id* path property to the given value.
21323 ///
21324 /// Even though the property as already been set when instantiating this call,
21325 /// we provide this method for API completeness.
21326 pub fn dataset_id(mut self, new_value: &str) -> TabledataInsertAllCall<'a, C> {
21327 self._dataset_id = new_value.to_string();
21328 self
21329 }
21330 /// Required. Table ID of the destination.
21331 ///
21332 /// Sets the *table id* path property to the given value.
21333 ///
21334 /// Even though the property as already been set when instantiating this call,
21335 /// we provide this method for API completeness.
21336 pub fn table_id(mut self, new_value: &str) -> TabledataInsertAllCall<'a, C> {
21337 self._table_id = new_value.to_string();
21338 self
21339 }
21340 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
21341 /// while executing the actual API request.
21342 ///
21343 /// ````text
21344 /// It should be used to handle progress information, and to implement a certain level of resilience.
21345 /// ````
21346 ///
21347 /// Sets the *delegate* property to the given value.
21348 pub fn delegate(
21349 mut self,
21350 new_value: &'a mut dyn common::Delegate,
21351 ) -> TabledataInsertAllCall<'a, C> {
21352 self._delegate = Some(new_value);
21353 self
21354 }
21355
21356 /// Set any additional parameter of the query string used in the request.
21357 /// It should be used to set parameters which are not yet available through their own
21358 /// setters.
21359 ///
21360 /// Please note that this method must not be used to set any of the known parameters
21361 /// which have their own setter method. If done anyway, the request will fail.
21362 ///
21363 /// # Additional Parameters
21364 ///
21365 /// * *$.xgafv* (query-string) - V1 error format.
21366 /// * *access_token* (query-string) - OAuth access token.
21367 /// * *alt* (query-string) - Data format for response.
21368 /// * *callback* (query-string) - JSONP
21369 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
21370 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
21371 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
21372 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
21373 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
21374 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
21375 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
21376 pub fn param<T>(mut self, name: T, value: T) -> TabledataInsertAllCall<'a, C>
21377 where
21378 T: AsRef<str>,
21379 {
21380 self._additional_params
21381 .insert(name.as_ref().to_string(), value.as_ref().to_string());
21382 self
21383 }
21384
21385 /// Identifies the authorization scope for the method you are building.
21386 ///
21387 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
21388 /// [`Scope::CloudPlatform`].
21389 ///
21390 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
21391 /// tokens for more than one scope.
21392 ///
21393 /// Usually there is more than one suitable scope to authorize an operation, some of which may
21394 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
21395 /// sufficient, a read-write scope will do as well.
21396 pub fn add_scope<St>(mut self, scope: St) -> TabledataInsertAllCall<'a, C>
21397 where
21398 St: AsRef<str>,
21399 {
21400 self._scopes.insert(String::from(scope.as_ref()));
21401 self
21402 }
21403 /// Identifies the authorization scope(s) for the method you are building.
21404 ///
21405 /// See [`Self::add_scope()`] for details.
21406 pub fn add_scopes<I, St>(mut self, scopes: I) -> TabledataInsertAllCall<'a, C>
21407 where
21408 I: IntoIterator<Item = St>,
21409 St: AsRef<str>,
21410 {
21411 self._scopes
21412 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
21413 self
21414 }
21415
21416 /// Removes all scopes, and no default scope will be used either.
21417 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
21418 /// for details).
21419 pub fn clear_scopes(mut self) -> TabledataInsertAllCall<'a, C> {
21420 self._scopes.clear();
21421 self
21422 }
21423}
21424
21425/// List the content of a table in rows.
21426///
21427/// A builder for the *list* method supported by a *tabledata* resource.
21428/// It is not used directly, but through a [`TabledataMethods`] instance.
21429///
21430/// # Example
21431///
21432/// Instantiate a resource method builder
21433///
21434/// ```test_harness,no_run
21435/// # extern crate hyper;
21436/// # extern crate hyper_rustls;
21437/// # extern crate google_bigquery2 as bigquery2;
21438/// # async fn dox() {
21439/// # use bigquery2::{Bigquery, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
21440///
21441/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
21442/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
21443/// # .with_native_roots()
21444/// # .unwrap()
21445/// # .https_only()
21446/// # .enable_http2()
21447/// # .build();
21448///
21449/// # let executor = hyper_util::rt::TokioExecutor::new();
21450/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
21451/// # secret,
21452/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
21453/// # yup_oauth2::client::CustomHyperClientBuilder::from(
21454/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
21455/// # ),
21456/// # ).build().await.unwrap();
21457///
21458/// # let client = hyper_util::client::legacy::Client::builder(
21459/// # hyper_util::rt::TokioExecutor::new()
21460/// # )
21461/// # .build(
21462/// # hyper_rustls::HttpsConnectorBuilder::new()
21463/// # .with_native_roots()
21464/// # .unwrap()
21465/// # .https_or_http()
21466/// # .enable_http2()
21467/// # .build()
21468/// # );
21469/// # let mut hub = Bigquery::new(client, auth);
21470/// // You can configure optional parameters by calling the respective setters at will, and
21471/// // execute the final call using `doit()`.
21472/// // Values shown here are possibly random and not representative !
21473/// let result = hub.tabledata().list("projectId", "datasetId", "tableId")
21474/// .start_index(7)
21475/// .selected_fields("duo")
21476/// .page_token("diam")
21477/// .max_results(44)
21478/// .format_options_use_int64_timestamp(true)
21479/// .format_options_timestamp_output_format("sed")
21480/// .doit().await;
21481/// # }
21482/// ```
21483pub struct TabledataListCall<'a, C>
21484where
21485 C: 'a,
21486{
21487 hub: &'a Bigquery<C>,
21488 _project_id: String,
21489 _dataset_id: String,
21490 _table_id: String,
21491 _start_index: Option<u64>,
21492 _selected_fields: Option<String>,
21493 _page_token: Option<String>,
21494 _max_results: Option<u32>,
21495 _format_options_use_int64_timestamp: Option<bool>,
21496 _format_options_timestamp_output_format: Option<String>,
21497 _delegate: Option<&'a mut dyn common::Delegate>,
21498 _additional_params: HashMap<String, String>,
21499 _scopes: BTreeSet<String>,
21500}
21501
21502impl<'a, C> common::CallBuilder for TabledataListCall<'a, C> {}
21503
21504impl<'a, C> TabledataListCall<'a, C>
21505where
21506 C: common::Connector,
21507{
21508 /// Perform the operation you have build so far.
21509 pub async fn doit(mut self) -> common::Result<(common::Response, TableDataList)> {
21510 use std::borrow::Cow;
21511 use std::io::{Read, Seek};
21512
21513 use common::{url::Params, ToParts};
21514 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
21515
21516 let mut dd = common::DefaultDelegate;
21517 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
21518 dlg.begin(common::MethodInfo {
21519 id: "bigquery.tabledata.list",
21520 http_method: hyper::Method::GET,
21521 });
21522
21523 for &field in [
21524 "alt",
21525 "projectId",
21526 "datasetId",
21527 "tableId",
21528 "startIndex",
21529 "selectedFields",
21530 "pageToken",
21531 "maxResults",
21532 "formatOptions.useInt64Timestamp",
21533 "formatOptions.timestampOutputFormat",
21534 ]
21535 .iter()
21536 {
21537 if self._additional_params.contains_key(field) {
21538 dlg.finished(false);
21539 return Err(common::Error::FieldClash(field));
21540 }
21541 }
21542
21543 let mut params = Params::with_capacity(11 + self._additional_params.len());
21544 params.push("projectId", self._project_id);
21545 params.push("datasetId", self._dataset_id);
21546 params.push("tableId", self._table_id);
21547 if let Some(value) = self._start_index.as_ref() {
21548 params.push("startIndex", value.to_string());
21549 }
21550 if let Some(value) = self._selected_fields.as_ref() {
21551 params.push("selectedFields", value);
21552 }
21553 if let Some(value) = self._page_token.as_ref() {
21554 params.push("pageToken", value);
21555 }
21556 if let Some(value) = self._max_results.as_ref() {
21557 params.push("maxResults", value.to_string());
21558 }
21559 if let Some(value) = self._format_options_use_int64_timestamp.as_ref() {
21560 params.push("formatOptions.useInt64Timestamp", value.to_string());
21561 }
21562 if let Some(value) = self._format_options_timestamp_output_format.as_ref() {
21563 params.push("formatOptions.timestampOutputFormat", value);
21564 }
21565
21566 params.extend(self._additional_params.iter());
21567
21568 params.push("alt", "json");
21569 let mut url = self.hub._base_url.clone()
21570 + "projects/{+projectId}/datasets/{+datasetId}/tables/{+tableId}/data";
21571 if self._scopes.is_empty() {
21572 self._scopes
21573 .insert(Scope::CloudPlatformReadOnly.as_ref().to_string());
21574 }
21575
21576 #[allow(clippy::single_element_loop)]
21577 for &(find_this, param_name) in [
21578 ("{+projectId}", "projectId"),
21579 ("{+datasetId}", "datasetId"),
21580 ("{+tableId}", "tableId"),
21581 ]
21582 .iter()
21583 {
21584 url = params.uri_replacement(url, param_name, find_this, true);
21585 }
21586 {
21587 let to_remove = ["tableId", "datasetId", "projectId"];
21588 params.remove_params(&to_remove);
21589 }
21590
21591 let url = params.parse_with_url(&url);
21592
21593 loop {
21594 let token = match self
21595 .hub
21596 .auth
21597 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
21598 .await
21599 {
21600 Ok(token) => token,
21601 Err(e) => match dlg.token(e) {
21602 Ok(token) => token,
21603 Err(e) => {
21604 dlg.finished(false);
21605 return Err(common::Error::MissingToken(e));
21606 }
21607 },
21608 };
21609 let mut req_result = {
21610 let client = &self.hub.client;
21611 dlg.pre_request();
21612 let mut req_builder = hyper::Request::builder()
21613 .method(hyper::Method::GET)
21614 .uri(url.as_str())
21615 .header(USER_AGENT, self.hub._user_agent.clone());
21616
21617 if let Some(token) = token.as_ref() {
21618 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
21619 }
21620
21621 let request = req_builder
21622 .header(CONTENT_LENGTH, 0_u64)
21623 .body(common::to_body::<String>(None));
21624
21625 client.request(request.unwrap()).await
21626 };
21627
21628 match req_result {
21629 Err(err) => {
21630 if let common::Retry::After(d) = dlg.http_error(&err) {
21631 sleep(d).await;
21632 continue;
21633 }
21634 dlg.finished(false);
21635 return Err(common::Error::HttpError(err));
21636 }
21637 Ok(res) => {
21638 let (mut parts, body) = res.into_parts();
21639 let mut body = common::Body::new(body);
21640 if !parts.status.is_success() {
21641 let bytes = common::to_bytes(body).await.unwrap_or_default();
21642 let error = serde_json::from_str(&common::to_string(&bytes));
21643 let response = common::to_response(parts, bytes.into());
21644
21645 if let common::Retry::After(d) =
21646 dlg.http_failure(&response, error.as_ref().ok())
21647 {
21648 sleep(d).await;
21649 continue;
21650 }
21651
21652 dlg.finished(false);
21653
21654 return Err(match error {
21655 Ok(value) => common::Error::BadRequest(value),
21656 _ => common::Error::Failure(response),
21657 });
21658 }
21659 let response = {
21660 let bytes = common::to_bytes(body).await.unwrap_or_default();
21661 let encoded = common::to_string(&bytes);
21662 match serde_json::from_str(&encoded) {
21663 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
21664 Err(error) => {
21665 dlg.response_json_decode_error(&encoded, &error);
21666 return Err(common::Error::JsonDecodeError(
21667 encoded.to_string(),
21668 error,
21669 ));
21670 }
21671 }
21672 };
21673
21674 dlg.finished(true);
21675 return Ok(response);
21676 }
21677 }
21678 }
21679 }
21680
21681 /// Required. Project id of the table to list.
21682 ///
21683 /// Sets the *project id* path property to the given value.
21684 ///
21685 /// Even though the property as already been set when instantiating this call,
21686 /// we provide this method for API completeness.
21687 pub fn project_id(mut self, new_value: &str) -> TabledataListCall<'a, C> {
21688 self._project_id = new_value.to_string();
21689 self
21690 }
21691 /// Required. Dataset id of the table to list.
21692 ///
21693 /// Sets the *dataset id* path property to the given value.
21694 ///
21695 /// Even though the property as already been set when instantiating this call,
21696 /// we provide this method for API completeness.
21697 pub fn dataset_id(mut self, new_value: &str) -> TabledataListCall<'a, C> {
21698 self._dataset_id = new_value.to_string();
21699 self
21700 }
21701 /// Required. Table id of the table to list.
21702 ///
21703 /// Sets the *table id* path property to the given value.
21704 ///
21705 /// Even though the property as already been set when instantiating this call,
21706 /// we provide this method for API completeness.
21707 pub fn table_id(mut self, new_value: &str) -> TabledataListCall<'a, C> {
21708 self._table_id = new_value.to_string();
21709 self
21710 }
21711 /// Start row index of the table.
21712 ///
21713 /// Sets the *start index* query property to the given value.
21714 pub fn start_index(mut self, new_value: u64) -> TabledataListCall<'a, C> {
21715 self._start_index = Some(new_value);
21716 self
21717 }
21718 /// Subset of fields to return, supports select into sub fields. Example: selected_fields = "a,e.d.f";
21719 ///
21720 /// Sets the *selected fields* query property to the given value.
21721 pub fn selected_fields(mut self, new_value: &str) -> TabledataListCall<'a, C> {
21722 self._selected_fields = Some(new_value.to_string());
21723 self
21724 }
21725 /// To retrieve the next page of table data, set this field to the string provided in the pageToken field of the response body from your previous call to tabledata.list.
21726 ///
21727 /// Sets the *page token* query property to the given value.
21728 pub fn page_token(mut self, new_value: &str) -> TabledataListCall<'a, C> {
21729 self._page_token = Some(new_value.to_string());
21730 self
21731 }
21732 /// Row limit of the table.
21733 ///
21734 /// Sets the *max results* query property to the given value.
21735 pub fn max_results(mut self, new_value: u32) -> TabledataListCall<'a, C> {
21736 self._max_results = Some(new_value);
21737 self
21738 }
21739 /// Optional. Output timestamp as usec int64. Default is false.
21740 ///
21741 /// Sets the *format options.use int64 timestamp* query property to the given value.
21742 pub fn format_options_use_int64_timestamp(
21743 mut self,
21744 new_value: bool,
21745 ) -> TabledataListCall<'a, C> {
21746 self._format_options_use_int64_timestamp = Some(new_value);
21747 self
21748 }
21749 /// Optional. The API output format for a timestamp. This offers more explicit control over the timestamp output format as compared to the existing `use_int64_timestamp` option.
21750 ///
21751 /// Sets the *format options.timestamp output format* query property to the given value.
21752 pub fn format_options_timestamp_output_format(
21753 mut self,
21754 new_value: &str,
21755 ) -> TabledataListCall<'a, C> {
21756 self._format_options_timestamp_output_format = Some(new_value.to_string());
21757 self
21758 }
21759 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
21760 /// while executing the actual API request.
21761 ///
21762 /// ````text
21763 /// It should be used to handle progress information, and to implement a certain level of resilience.
21764 /// ````
21765 ///
21766 /// Sets the *delegate* property to the given value.
21767 pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> TabledataListCall<'a, C> {
21768 self._delegate = Some(new_value);
21769 self
21770 }
21771
21772 /// Set any additional parameter of the query string used in the request.
21773 /// It should be used to set parameters which are not yet available through their own
21774 /// setters.
21775 ///
21776 /// Please note that this method must not be used to set any of the known parameters
21777 /// which have their own setter method. If done anyway, the request will fail.
21778 ///
21779 /// # Additional Parameters
21780 ///
21781 /// * *$.xgafv* (query-string) - V1 error format.
21782 /// * *access_token* (query-string) - OAuth access token.
21783 /// * *alt* (query-string) - Data format for response.
21784 /// * *callback* (query-string) - JSONP
21785 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
21786 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
21787 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
21788 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
21789 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
21790 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
21791 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
21792 pub fn param<T>(mut self, name: T, value: T) -> TabledataListCall<'a, C>
21793 where
21794 T: AsRef<str>,
21795 {
21796 self._additional_params
21797 .insert(name.as_ref().to_string(), value.as_ref().to_string());
21798 self
21799 }
21800
21801 /// Identifies the authorization scope for the method you are building.
21802 ///
21803 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
21804 /// [`Scope::CloudPlatformReadOnly`].
21805 ///
21806 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
21807 /// tokens for more than one scope.
21808 ///
21809 /// Usually there is more than one suitable scope to authorize an operation, some of which may
21810 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
21811 /// sufficient, a read-write scope will do as well.
21812 pub fn add_scope<St>(mut self, scope: St) -> TabledataListCall<'a, C>
21813 where
21814 St: AsRef<str>,
21815 {
21816 self._scopes.insert(String::from(scope.as_ref()));
21817 self
21818 }
21819 /// Identifies the authorization scope(s) for the method you are building.
21820 ///
21821 /// See [`Self::add_scope()`] for details.
21822 pub fn add_scopes<I, St>(mut self, scopes: I) -> TabledataListCall<'a, C>
21823 where
21824 I: IntoIterator<Item = St>,
21825 St: AsRef<str>,
21826 {
21827 self._scopes
21828 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
21829 self
21830 }
21831
21832 /// Removes all scopes, and no default scope will be used either.
21833 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
21834 /// for details).
21835 pub fn clear_scopes(mut self) -> TabledataListCall<'a, C> {
21836 self._scopes.clear();
21837 self
21838 }
21839}
21840
21841/// Deletes the table specified by tableId from the dataset. If the table contains data, all the data will be deleted.
21842///
21843/// A builder for the *delete* method supported by a *table* resource.
21844/// It is not used directly, but through a [`TableMethods`] instance.
21845///
21846/// # Example
21847///
21848/// Instantiate a resource method builder
21849///
21850/// ```test_harness,no_run
21851/// # extern crate hyper;
21852/// # extern crate hyper_rustls;
21853/// # extern crate google_bigquery2 as bigquery2;
21854/// # async fn dox() {
21855/// # use bigquery2::{Bigquery, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
21856///
21857/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
21858/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
21859/// # .with_native_roots()
21860/// # .unwrap()
21861/// # .https_only()
21862/// # .enable_http2()
21863/// # .build();
21864///
21865/// # let executor = hyper_util::rt::TokioExecutor::new();
21866/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
21867/// # secret,
21868/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
21869/// # yup_oauth2::client::CustomHyperClientBuilder::from(
21870/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
21871/// # ),
21872/// # ).build().await.unwrap();
21873///
21874/// # let client = hyper_util::client::legacy::Client::builder(
21875/// # hyper_util::rt::TokioExecutor::new()
21876/// # )
21877/// # .build(
21878/// # hyper_rustls::HttpsConnectorBuilder::new()
21879/// # .with_native_roots()
21880/// # .unwrap()
21881/// # .https_or_http()
21882/// # .enable_http2()
21883/// # .build()
21884/// # );
21885/// # let mut hub = Bigquery::new(client, auth);
21886/// // You can configure optional parameters by calling the respective setters at will, and
21887/// // execute the final call using `doit()`.
21888/// // Values shown here are possibly random and not representative !
21889/// let result = hub.tables().delete("projectId", "datasetId", "tableId")
21890/// .doit().await;
21891/// # }
21892/// ```
21893pub struct TableDeleteCall<'a, C>
21894where
21895 C: 'a,
21896{
21897 hub: &'a Bigquery<C>,
21898 _project_id: String,
21899 _dataset_id: String,
21900 _table_id: String,
21901 _delegate: Option<&'a mut dyn common::Delegate>,
21902 _additional_params: HashMap<String, String>,
21903 _scopes: BTreeSet<String>,
21904}
21905
21906impl<'a, C> common::CallBuilder for TableDeleteCall<'a, C> {}
21907
21908impl<'a, C> TableDeleteCall<'a, C>
21909where
21910 C: common::Connector,
21911{
21912 /// Perform the operation you have build so far.
21913 pub async fn doit(mut self) -> common::Result<common::Response> {
21914 use std::borrow::Cow;
21915 use std::io::{Read, Seek};
21916
21917 use common::{url::Params, ToParts};
21918 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
21919
21920 let mut dd = common::DefaultDelegate;
21921 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
21922 dlg.begin(common::MethodInfo {
21923 id: "bigquery.tables.delete",
21924 http_method: hyper::Method::DELETE,
21925 });
21926
21927 for &field in ["projectId", "datasetId", "tableId"].iter() {
21928 if self._additional_params.contains_key(field) {
21929 dlg.finished(false);
21930 return Err(common::Error::FieldClash(field));
21931 }
21932 }
21933
21934 let mut params = Params::with_capacity(4 + self._additional_params.len());
21935 params.push("projectId", self._project_id);
21936 params.push("datasetId", self._dataset_id);
21937 params.push("tableId", self._table_id);
21938
21939 params.extend(self._additional_params.iter());
21940
21941 let mut url = self.hub._base_url.clone()
21942 + "projects/{+projectId}/datasets/{+datasetId}/tables/{+tableId}";
21943 if self._scopes.is_empty() {
21944 self._scopes
21945 .insert(Scope::CloudPlatform.as_ref().to_string());
21946 }
21947
21948 #[allow(clippy::single_element_loop)]
21949 for &(find_this, param_name) in [
21950 ("{+projectId}", "projectId"),
21951 ("{+datasetId}", "datasetId"),
21952 ("{+tableId}", "tableId"),
21953 ]
21954 .iter()
21955 {
21956 url = params.uri_replacement(url, param_name, find_this, true);
21957 }
21958 {
21959 let to_remove = ["tableId", "datasetId", "projectId"];
21960 params.remove_params(&to_remove);
21961 }
21962
21963 let url = params.parse_with_url(&url);
21964
21965 loop {
21966 let token = match self
21967 .hub
21968 .auth
21969 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
21970 .await
21971 {
21972 Ok(token) => token,
21973 Err(e) => match dlg.token(e) {
21974 Ok(token) => token,
21975 Err(e) => {
21976 dlg.finished(false);
21977 return Err(common::Error::MissingToken(e));
21978 }
21979 },
21980 };
21981 let mut req_result = {
21982 let client = &self.hub.client;
21983 dlg.pre_request();
21984 let mut req_builder = hyper::Request::builder()
21985 .method(hyper::Method::DELETE)
21986 .uri(url.as_str())
21987 .header(USER_AGENT, self.hub._user_agent.clone());
21988
21989 if let Some(token) = token.as_ref() {
21990 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
21991 }
21992
21993 let request = req_builder
21994 .header(CONTENT_LENGTH, 0_u64)
21995 .body(common::to_body::<String>(None));
21996
21997 client.request(request.unwrap()).await
21998 };
21999
22000 match req_result {
22001 Err(err) => {
22002 if let common::Retry::After(d) = dlg.http_error(&err) {
22003 sleep(d).await;
22004 continue;
22005 }
22006 dlg.finished(false);
22007 return Err(common::Error::HttpError(err));
22008 }
22009 Ok(res) => {
22010 let (mut parts, body) = res.into_parts();
22011 let mut body = common::Body::new(body);
22012 if !parts.status.is_success() {
22013 let bytes = common::to_bytes(body).await.unwrap_or_default();
22014 let error = serde_json::from_str(&common::to_string(&bytes));
22015 let response = common::to_response(parts, bytes.into());
22016
22017 if let common::Retry::After(d) =
22018 dlg.http_failure(&response, error.as_ref().ok())
22019 {
22020 sleep(d).await;
22021 continue;
22022 }
22023
22024 dlg.finished(false);
22025
22026 return Err(match error {
22027 Ok(value) => common::Error::BadRequest(value),
22028 _ => common::Error::Failure(response),
22029 });
22030 }
22031 let response = common::Response::from_parts(parts, body);
22032
22033 dlg.finished(true);
22034 return Ok(response);
22035 }
22036 }
22037 }
22038 }
22039
22040 /// Required. Project ID of the table to delete
22041 ///
22042 /// Sets the *project id* path property to the given value.
22043 ///
22044 /// Even though the property as already been set when instantiating this call,
22045 /// we provide this method for API completeness.
22046 pub fn project_id(mut self, new_value: &str) -> TableDeleteCall<'a, C> {
22047 self._project_id = new_value.to_string();
22048 self
22049 }
22050 /// Required. Dataset ID of the table to delete
22051 ///
22052 /// Sets the *dataset id* path property to the given value.
22053 ///
22054 /// Even though the property as already been set when instantiating this call,
22055 /// we provide this method for API completeness.
22056 pub fn dataset_id(mut self, new_value: &str) -> TableDeleteCall<'a, C> {
22057 self._dataset_id = new_value.to_string();
22058 self
22059 }
22060 /// Required. Table ID of the table to delete
22061 ///
22062 /// Sets the *table id* path property to the given value.
22063 ///
22064 /// Even though the property as already been set when instantiating this call,
22065 /// we provide this method for API completeness.
22066 pub fn table_id(mut self, new_value: &str) -> TableDeleteCall<'a, C> {
22067 self._table_id = new_value.to_string();
22068 self
22069 }
22070 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
22071 /// while executing the actual API request.
22072 ///
22073 /// ````text
22074 /// It should be used to handle progress information, and to implement a certain level of resilience.
22075 /// ````
22076 ///
22077 /// Sets the *delegate* property to the given value.
22078 pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> TableDeleteCall<'a, C> {
22079 self._delegate = Some(new_value);
22080 self
22081 }
22082
22083 /// Set any additional parameter of the query string used in the request.
22084 /// It should be used to set parameters which are not yet available through their own
22085 /// setters.
22086 ///
22087 /// Please note that this method must not be used to set any of the known parameters
22088 /// which have their own setter method. If done anyway, the request will fail.
22089 ///
22090 /// # Additional Parameters
22091 ///
22092 /// * *$.xgafv* (query-string) - V1 error format.
22093 /// * *access_token* (query-string) - OAuth access token.
22094 /// * *alt* (query-string) - Data format for response.
22095 /// * *callback* (query-string) - JSONP
22096 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
22097 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
22098 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
22099 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
22100 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
22101 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
22102 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
22103 pub fn param<T>(mut self, name: T, value: T) -> TableDeleteCall<'a, C>
22104 where
22105 T: AsRef<str>,
22106 {
22107 self._additional_params
22108 .insert(name.as_ref().to_string(), value.as_ref().to_string());
22109 self
22110 }
22111
22112 /// Identifies the authorization scope for the method you are building.
22113 ///
22114 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
22115 /// [`Scope::CloudPlatform`].
22116 ///
22117 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
22118 /// tokens for more than one scope.
22119 ///
22120 /// Usually there is more than one suitable scope to authorize an operation, some of which may
22121 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
22122 /// sufficient, a read-write scope will do as well.
22123 pub fn add_scope<St>(mut self, scope: St) -> TableDeleteCall<'a, C>
22124 where
22125 St: AsRef<str>,
22126 {
22127 self._scopes.insert(String::from(scope.as_ref()));
22128 self
22129 }
22130 /// Identifies the authorization scope(s) for the method you are building.
22131 ///
22132 /// See [`Self::add_scope()`] for details.
22133 pub fn add_scopes<I, St>(mut self, scopes: I) -> TableDeleteCall<'a, C>
22134 where
22135 I: IntoIterator<Item = St>,
22136 St: AsRef<str>,
22137 {
22138 self._scopes
22139 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
22140 self
22141 }
22142
22143 /// Removes all scopes, and no default scope will be used either.
22144 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
22145 /// for details).
22146 pub fn clear_scopes(mut self) -> TableDeleteCall<'a, C> {
22147 self._scopes.clear();
22148 self
22149 }
22150}
22151
22152/// Gets the specified table resource by table ID. This method does not return the data in the table, it only returns the table resource, which describes the structure of this table.
22153///
22154/// A builder for the *get* method supported by a *table* resource.
22155/// It is not used directly, but through a [`TableMethods`] instance.
22156///
22157/// # Example
22158///
22159/// Instantiate a resource method builder
22160///
22161/// ```test_harness,no_run
22162/// # extern crate hyper;
22163/// # extern crate hyper_rustls;
22164/// # extern crate google_bigquery2 as bigquery2;
22165/// # async fn dox() {
22166/// # use bigquery2::{Bigquery, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
22167///
22168/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
22169/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
22170/// # .with_native_roots()
22171/// # .unwrap()
22172/// # .https_only()
22173/// # .enable_http2()
22174/// # .build();
22175///
22176/// # let executor = hyper_util::rt::TokioExecutor::new();
22177/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
22178/// # secret,
22179/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
22180/// # yup_oauth2::client::CustomHyperClientBuilder::from(
22181/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
22182/// # ),
22183/// # ).build().await.unwrap();
22184///
22185/// # let client = hyper_util::client::legacy::Client::builder(
22186/// # hyper_util::rt::TokioExecutor::new()
22187/// # )
22188/// # .build(
22189/// # hyper_rustls::HttpsConnectorBuilder::new()
22190/// # .with_native_roots()
22191/// # .unwrap()
22192/// # .https_or_http()
22193/// # .enable_http2()
22194/// # .build()
22195/// # );
22196/// # let mut hub = Bigquery::new(client, auth);
22197/// // You can configure optional parameters by calling the respective setters at will, and
22198/// // execute the final call using `doit()`.
22199/// // Values shown here are possibly random and not representative !
22200/// let result = hub.tables().get("projectId", "datasetId", "tableId")
22201/// .view("et")
22202/// .selected_fields("sea")
22203/// .doit().await;
22204/// # }
22205/// ```
22206pub struct TableGetCall<'a, C>
22207where
22208 C: 'a,
22209{
22210 hub: &'a Bigquery<C>,
22211 _project_id: String,
22212 _dataset_id: String,
22213 _table_id: String,
22214 _view: Option<String>,
22215 _selected_fields: Option<String>,
22216 _delegate: Option<&'a mut dyn common::Delegate>,
22217 _additional_params: HashMap<String, String>,
22218 _scopes: BTreeSet<String>,
22219}
22220
22221impl<'a, C> common::CallBuilder for TableGetCall<'a, C> {}
22222
22223impl<'a, C> TableGetCall<'a, C>
22224where
22225 C: common::Connector,
22226{
22227 /// Perform the operation you have build so far.
22228 pub async fn doit(mut self) -> common::Result<(common::Response, Table)> {
22229 use std::borrow::Cow;
22230 use std::io::{Read, Seek};
22231
22232 use common::{url::Params, ToParts};
22233 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
22234
22235 let mut dd = common::DefaultDelegate;
22236 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
22237 dlg.begin(common::MethodInfo {
22238 id: "bigquery.tables.get",
22239 http_method: hyper::Method::GET,
22240 });
22241
22242 for &field in [
22243 "alt",
22244 "projectId",
22245 "datasetId",
22246 "tableId",
22247 "view",
22248 "selectedFields",
22249 ]
22250 .iter()
22251 {
22252 if self._additional_params.contains_key(field) {
22253 dlg.finished(false);
22254 return Err(common::Error::FieldClash(field));
22255 }
22256 }
22257
22258 let mut params = Params::with_capacity(7 + self._additional_params.len());
22259 params.push("projectId", self._project_id);
22260 params.push("datasetId", self._dataset_id);
22261 params.push("tableId", self._table_id);
22262 if let Some(value) = self._view.as_ref() {
22263 params.push("view", value);
22264 }
22265 if let Some(value) = self._selected_fields.as_ref() {
22266 params.push("selectedFields", value);
22267 }
22268
22269 params.extend(self._additional_params.iter());
22270
22271 params.push("alt", "json");
22272 let mut url = self.hub._base_url.clone()
22273 + "projects/{+projectId}/datasets/{+datasetId}/tables/{+tableId}";
22274 if self._scopes.is_empty() {
22275 self._scopes
22276 .insert(Scope::CloudPlatformReadOnly.as_ref().to_string());
22277 }
22278
22279 #[allow(clippy::single_element_loop)]
22280 for &(find_this, param_name) in [
22281 ("{+projectId}", "projectId"),
22282 ("{+datasetId}", "datasetId"),
22283 ("{+tableId}", "tableId"),
22284 ]
22285 .iter()
22286 {
22287 url = params.uri_replacement(url, param_name, find_this, true);
22288 }
22289 {
22290 let to_remove = ["tableId", "datasetId", "projectId"];
22291 params.remove_params(&to_remove);
22292 }
22293
22294 let url = params.parse_with_url(&url);
22295
22296 loop {
22297 let token = match self
22298 .hub
22299 .auth
22300 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
22301 .await
22302 {
22303 Ok(token) => token,
22304 Err(e) => match dlg.token(e) {
22305 Ok(token) => token,
22306 Err(e) => {
22307 dlg.finished(false);
22308 return Err(common::Error::MissingToken(e));
22309 }
22310 },
22311 };
22312 let mut req_result = {
22313 let client = &self.hub.client;
22314 dlg.pre_request();
22315 let mut req_builder = hyper::Request::builder()
22316 .method(hyper::Method::GET)
22317 .uri(url.as_str())
22318 .header(USER_AGENT, self.hub._user_agent.clone());
22319
22320 if let Some(token) = token.as_ref() {
22321 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
22322 }
22323
22324 let request = req_builder
22325 .header(CONTENT_LENGTH, 0_u64)
22326 .body(common::to_body::<String>(None));
22327
22328 client.request(request.unwrap()).await
22329 };
22330
22331 match req_result {
22332 Err(err) => {
22333 if let common::Retry::After(d) = dlg.http_error(&err) {
22334 sleep(d).await;
22335 continue;
22336 }
22337 dlg.finished(false);
22338 return Err(common::Error::HttpError(err));
22339 }
22340 Ok(res) => {
22341 let (mut parts, body) = res.into_parts();
22342 let mut body = common::Body::new(body);
22343 if !parts.status.is_success() {
22344 let bytes = common::to_bytes(body).await.unwrap_or_default();
22345 let error = serde_json::from_str(&common::to_string(&bytes));
22346 let response = common::to_response(parts, bytes.into());
22347
22348 if let common::Retry::After(d) =
22349 dlg.http_failure(&response, error.as_ref().ok())
22350 {
22351 sleep(d).await;
22352 continue;
22353 }
22354
22355 dlg.finished(false);
22356
22357 return Err(match error {
22358 Ok(value) => common::Error::BadRequest(value),
22359 _ => common::Error::Failure(response),
22360 });
22361 }
22362 let response = {
22363 let bytes = common::to_bytes(body).await.unwrap_or_default();
22364 let encoded = common::to_string(&bytes);
22365 match serde_json::from_str(&encoded) {
22366 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
22367 Err(error) => {
22368 dlg.response_json_decode_error(&encoded, &error);
22369 return Err(common::Error::JsonDecodeError(
22370 encoded.to_string(),
22371 error,
22372 ));
22373 }
22374 }
22375 };
22376
22377 dlg.finished(true);
22378 return Ok(response);
22379 }
22380 }
22381 }
22382 }
22383
22384 /// Required. Project ID of the requested table
22385 ///
22386 /// Sets the *project id* path property to the given value.
22387 ///
22388 /// Even though the property as already been set when instantiating this call,
22389 /// we provide this method for API completeness.
22390 pub fn project_id(mut self, new_value: &str) -> TableGetCall<'a, C> {
22391 self._project_id = new_value.to_string();
22392 self
22393 }
22394 /// Required. Dataset ID of the requested table
22395 ///
22396 /// Sets the *dataset id* path property to the given value.
22397 ///
22398 /// Even though the property as already been set when instantiating this call,
22399 /// we provide this method for API completeness.
22400 pub fn dataset_id(mut self, new_value: &str) -> TableGetCall<'a, C> {
22401 self._dataset_id = new_value.to_string();
22402 self
22403 }
22404 /// Required. Table ID of the requested table
22405 ///
22406 /// Sets the *table id* path property to the given value.
22407 ///
22408 /// Even though the property as already been set when instantiating this call,
22409 /// we provide this method for API completeness.
22410 pub fn table_id(mut self, new_value: &str) -> TableGetCall<'a, C> {
22411 self._table_id = new_value.to_string();
22412 self
22413 }
22414 /// Optional. Specifies the view that determines which table information is returned. By default, basic table information and storage statistics (STORAGE_STATS) are returned.
22415 ///
22416 /// Sets the *view* query property to the given value.
22417 pub fn view(mut self, new_value: &str) -> TableGetCall<'a, C> {
22418 self._view = Some(new_value.to_string());
22419 self
22420 }
22421 /// List of table schema fields to return (comma-separated). If unspecified, all fields are returned. A fieldMask cannot be used here because the fields will automatically be converted from camelCase to snake_case and the conversion will fail if there are underscores. Since these are fields in BigQuery table schemas, underscores are allowed.
22422 ///
22423 /// Sets the *selected fields* query property to the given value.
22424 pub fn selected_fields(mut self, new_value: &str) -> TableGetCall<'a, C> {
22425 self._selected_fields = Some(new_value.to_string());
22426 self
22427 }
22428 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
22429 /// while executing the actual API request.
22430 ///
22431 /// ````text
22432 /// It should be used to handle progress information, and to implement a certain level of resilience.
22433 /// ````
22434 ///
22435 /// Sets the *delegate* property to the given value.
22436 pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> TableGetCall<'a, C> {
22437 self._delegate = Some(new_value);
22438 self
22439 }
22440
22441 /// Set any additional parameter of the query string used in the request.
22442 /// It should be used to set parameters which are not yet available through their own
22443 /// setters.
22444 ///
22445 /// Please note that this method must not be used to set any of the known parameters
22446 /// which have their own setter method. If done anyway, the request will fail.
22447 ///
22448 /// # Additional Parameters
22449 ///
22450 /// * *$.xgafv* (query-string) - V1 error format.
22451 /// * *access_token* (query-string) - OAuth access token.
22452 /// * *alt* (query-string) - Data format for response.
22453 /// * *callback* (query-string) - JSONP
22454 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
22455 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
22456 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
22457 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
22458 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
22459 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
22460 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
22461 pub fn param<T>(mut self, name: T, value: T) -> TableGetCall<'a, C>
22462 where
22463 T: AsRef<str>,
22464 {
22465 self._additional_params
22466 .insert(name.as_ref().to_string(), value.as_ref().to_string());
22467 self
22468 }
22469
22470 /// Identifies the authorization scope for the method you are building.
22471 ///
22472 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
22473 /// [`Scope::CloudPlatformReadOnly`].
22474 ///
22475 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
22476 /// tokens for more than one scope.
22477 ///
22478 /// Usually there is more than one suitable scope to authorize an operation, some of which may
22479 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
22480 /// sufficient, a read-write scope will do as well.
22481 pub fn add_scope<St>(mut self, scope: St) -> TableGetCall<'a, C>
22482 where
22483 St: AsRef<str>,
22484 {
22485 self._scopes.insert(String::from(scope.as_ref()));
22486 self
22487 }
22488 /// Identifies the authorization scope(s) for the method you are building.
22489 ///
22490 /// See [`Self::add_scope()`] for details.
22491 pub fn add_scopes<I, St>(mut self, scopes: I) -> TableGetCall<'a, C>
22492 where
22493 I: IntoIterator<Item = St>,
22494 St: AsRef<str>,
22495 {
22496 self._scopes
22497 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
22498 self
22499 }
22500
22501 /// Removes all scopes, and no default scope will be used either.
22502 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
22503 /// for details).
22504 pub fn clear_scopes(mut self) -> TableGetCall<'a, C> {
22505 self._scopes.clear();
22506 self
22507 }
22508}
22509
22510/// Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.
22511///
22512/// A builder for the *getIamPolicy* method supported by a *table* resource.
22513/// It is not used directly, but through a [`TableMethods`] instance.
22514///
22515/// # Example
22516///
22517/// Instantiate a resource method builder
22518///
22519/// ```test_harness,no_run
22520/// # extern crate hyper;
22521/// # extern crate hyper_rustls;
22522/// # extern crate google_bigquery2 as bigquery2;
22523/// use bigquery2::api::GetIamPolicyRequest;
22524/// # async fn dox() {
22525/// # use bigquery2::{Bigquery, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
22526///
22527/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
22528/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
22529/// # .with_native_roots()
22530/// # .unwrap()
22531/// # .https_only()
22532/// # .enable_http2()
22533/// # .build();
22534///
22535/// # let executor = hyper_util::rt::TokioExecutor::new();
22536/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
22537/// # secret,
22538/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
22539/// # yup_oauth2::client::CustomHyperClientBuilder::from(
22540/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
22541/// # ),
22542/// # ).build().await.unwrap();
22543///
22544/// # let client = hyper_util::client::legacy::Client::builder(
22545/// # hyper_util::rt::TokioExecutor::new()
22546/// # )
22547/// # .build(
22548/// # hyper_rustls::HttpsConnectorBuilder::new()
22549/// # .with_native_roots()
22550/// # .unwrap()
22551/// # .https_or_http()
22552/// # .enable_http2()
22553/// # .build()
22554/// # );
22555/// # let mut hub = Bigquery::new(client, auth);
22556/// // As the method needs a request, you would usually fill it with the desired information
22557/// // into the respective structure. Some of the parts shown here might not be applicable !
22558/// // Values shown here are possibly random and not representative !
22559/// let mut req = GetIamPolicyRequest::default();
22560///
22561/// // You can configure optional parameters by calling the respective setters at will, and
22562/// // execute the final call using `doit()`.
22563/// // Values shown here are possibly random and not representative !
22564/// let result = hub.tables().get_iam_policy(req, "resource")
22565/// .doit().await;
22566/// # }
22567/// ```
22568pub struct TableGetIamPolicyCall<'a, C>
22569where
22570 C: 'a,
22571{
22572 hub: &'a Bigquery<C>,
22573 _request: GetIamPolicyRequest,
22574 _resource: String,
22575 _delegate: Option<&'a mut dyn common::Delegate>,
22576 _additional_params: HashMap<String, String>,
22577 _scopes: BTreeSet<String>,
22578}
22579
22580impl<'a, C> common::CallBuilder for TableGetIamPolicyCall<'a, C> {}
22581
22582impl<'a, C> TableGetIamPolicyCall<'a, C>
22583where
22584 C: common::Connector,
22585{
22586 /// Perform the operation you have build so far.
22587 pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
22588 use std::borrow::Cow;
22589 use std::io::{Read, Seek};
22590
22591 use common::{url::Params, ToParts};
22592 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
22593
22594 let mut dd = common::DefaultDelegate;
22595 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
22596 dlg.begin(common::MethodInfo {
22597 id: "bigquery.tables.getIamPolicy",
22598 http_method: hyper::Method::POST,
22599 });
22600
22601 for &field in ["alt", "resource"].iter() {
22602 if self._additional_params.contains_key(field) {
22603 dlg.finished(false);
22604 return Err(common::Error::FieldClash(field));
22605 }
22606 }
22607
22608 let mut params = Params::with_capacity(4 + self._additional_params.len());
22609 params.push("resource", self._resource);
22610
22611 params.extend(self._additional_params.iter());
22612
22613 params.push("alt", "json");
22614 let mut url = self.hub._base_url.clone() + "{+resource}:getIamPolicy";
22615 if self._scopes.is_empty() {
22616 self._scopes
22617 .insert(Scope::CloudPlatformReadOnly.as_ref().to_string());
22618 }
22619
22620 #[allow(clippy::single_element_loop)]
22621 for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
22622 url = params.uri_replacement(url, param_name, find_this, true);
22623 }
22624 {
22625 let to_remove = ["resource"];
22626 params.remove_params(&to_remove);
22627 }
22628
22629 let url = params.parse_with_url(&url);
22630
22631 let mut json_mime_type = mime::APPLICATION_JSON;
22632 let mut request_value_reader = {
22633 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
22634 common::remove_json_null_values(&mut value);
22635 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
22636 serde_json::to_writer(&mut dst, &value).unwrap();
22637 dst
22638 };
22639 let request_size = request_value_reader
22640 .seek(std::io::SeekFrom::End(0))
22641 .unwrap();
22642 request_value_reader
22643 .seek(std::io::SeekFrom::Start(0))
22644 .unwrap();
22645
22646 loop {
22647 let token = match self
22648 .hub
22649 .auth
22650 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
22651 .await
22652 {
22653 Ok(token) => token,
22654 Err(e) => match dlg.token(e) {
22655 Ok(token) => token,
22656 Err(e) => {
22657 dlg.finished(false);
22658 return Err(common::Error::MissingToken(e));
22659 }
22660 },
22661 };
22662 request_value_reader
22663 .seek(std::io::SeekFrom::Start(0))
22664 .unwrap();
22665 let mut req_result = {
22666 let client = &self.hub.client;
22667 dlg.pre_request();
22668 let mut req_builder = hyper::Request::builder()
22669 .method(hyper::Method::POST)
22670 .uri(url.as_str())
22671 .header(USER_AGENT, self.hub._user_agent.clone());
22672
22673 if let Some(token) = token.as_ref() {
22674 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
22675 }
22676
22677 let request = req_builder
22678 .header(CONTENT_TYPE, json_mime_type.to_string())
22679 .header(CONTENT_LENGTH, request_size as u64)
22680 .body(common::to_body(
22681 request_value_reader.get_ref().clone().into(),
22682 ));
22683
22684 client.request(request.unwrap()).await
22685 };
22686
22687 match req_result {
22688 Err(err) => {
22689 if let common::Retry::After(d) = dlg.http_error(&err) {
22690 sleep(d).await;
22691 continue;
22692 }
22693 dlg.finished(false);
22694 return Err(common::Error::HttpError(err));
22695 }
22696 Ok(res) => {
22697 let (mut parts, body) = res.into_parts();
22698 let mut body = common::Body::new(body);
22699 if !parts.status.is_success() {
22700 let bytes = common::to_bytes(body).await.unwrap_or_default();
22701 let error = serde_json::from_str(&common::to_string(&bytes));
22702 let response = common::to_response(parts, bytes.into());
22703
22704 if let common::Retry::After(d) =
22705 dlg.http_failure(&response, error.as_ref().ok())
22706 {
22707 sleep(d).await;
22708 continue;
22709 }
22710
22711 dlg.finished(false);
22712
22713 return Err(match error {
22714 Ok(value) => common::Error::BadRequest(value),
22715 _ => common::Error::Failure(response),
22716 });
22717 }
22718 let response = {
22719 let bytes = common::to_bytes(body).await.unwrap_or_default();
22720 let encoded = common::to_string(&bytes);
22721 match serde_json::from_str(&encoded) {
22722 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
22723 Err(error) => {
22724 dlg.response_json_decode_error(&encoded, &error);
22725 return Err(common::Error::JsonDecodeError(
22726 encoded.to_string(),
22727 error,
22728 ));
22729 }
22730 }
22731 };
22732
22733 dlg.finished(true);
22734 return Ok(response);
22735 }
22736 }
22737 }
22738 }
22739
22740 ///
22741 /// Sets the *request* property to the given value.
22742 ///
22743 /// Even though the property as already been set when instantiating this call,
22744 /// we provide this method for API completeness.
22745 pub fn request(mut self, new_value: GetIamPolicyRequest) -> TableGetIamPolicyCall<'a, C> {
22746 self._request = new_value;
22747 self
22748 }
22749 /// REQUIRED: The resource for which the policy is being requested. See [Resource names](https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
22750 ///
22751 /// Sets the *resource* path property to the given value.
22752 ///
22753 /// Even though the property as already been set when instantiating this call,
22754 /// we provide this method for API completeness.
22755 pub fn resource(mut self, new_value: &str) -> TableGetIamPolicyCall<'a, C> {
22756 self._resource = new_value.to_string();
22757 self
22758 }
22759 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
22760 /// while executing the actual API request.
22761 ///
22762 /// ````text
22763 /// It should be used to handle progress information, and to implement a certain level of resilience.
22764 /// ````
22765 ///
22766 /// Sets the *delegate* property to the given value.
22767 pub fn delegate(
22768 mut self,
22769 new_value: &'a mut dyn common::Delegate,
22770 ) -> TableGetIamPolicyCall<'a, C> {
22771 self._delegate = Some(new_value);
22772 self
22773 }
22774
22775 /// Set any additional parameter of the query string used in the request.
22776 /// It should be used to set parameters which are not yet available through their own
22777 /// setters.
22778 ///
22779 /// Please note that this method must not be used to set any of the known parameters
22780 /// which have their own setter method. If done anyway, the request will fail.
22781 ///
22782 /// # Additional Parameters
22783 ///
22784 /// * *$.xgafv* (query-string) - V1 error format.
22785 /// * *access_token* (query-string) - OAuth access token.
22786 /// * *alt* (query-string) - Data format for response.
22787 /// * *callback* (query-string) - JSONP
22788 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
22789 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
22790 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
22791 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
22792 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
22793 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
22794 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
22795 pub fn param<T>(mut self, name: T, value: T) -> TableGetIamPolicyCall<'a, C>
22796 where
22797 T: AsRef<str>,
22798 {
22799 self._additional_params
22800 .insert(name.as_ref().to_string(), value.as_ref().to_string());
22801 self
22802 }
22803
22804 /// Identifies the authorization scope for the method you are building.
22805 ///
22806 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
22807 /// [`Scope::CloudPlatformReadOnly`].
22808 ///
22809 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
22810 /// tokens for more than one scope.
22811 ///
22812 /// Usually there is more than one suitable scope to authorize an operation, some of which may
22813 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
22814 /// sufficient, a read-write scope will do as well.
22815 pub fn add_scope<St>(mut self, scope: St) -> TableGetIamPolicyCall<'a, C>
22816 where
22817 St: AsRef<str>,
22818 {
22819 self._scopes.insert(String::from(scope.as_ref()));
22820 self
22821 }
22822 /// Identifies the authorization scope(s) for the method you are building.
22823 ///
22824 /// See [`Self::add_scope()`] for details.
22825 pub fn add_scopes<I, St>(mut self, scopes: I) -> TableGetIamPolicyCall<'a, C>
22826 where
22827 I: IntoIterator<Item = St>,
22828 St: AsRef<str>,
22829 {
22830 self._scopes
22831 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
22832 self
22833 }
22834
22835 /// Removes all scopes, and no default scope will be used either.
22836 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
22837 /// for details).
22838 pub fn clear_scopes(mut self) -> TableGetIamPolicyCall<'a, C> {
22839 self._scopes.clear();
22840 self
22841 }
22842}
22843
22844/// Creates a new, empty table in the dataset.
22845///
22846/// A builder for the *insert* method supported by a *table* resource.
22847/// It is not used directly, but through a [`TableMethods`] instance.
22848///
22849/// # Example
22850///
22851/// Instantiate a resource method builder
22852///
22853/// ```test_harness,no_run
22854/// # extern crate hyper;
22855/// # extern crate hyper_rustls;
22856/// # extern crate google_bigquery2 as bigquery2;
22857/// use bigquery2::api::Table;
22858/// # async fn dox() {
22859/// # use bigquery2::{Bigquery, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
22860///
22861/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
22862/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
22863/// # .with_native_roots()
22864/// # .unwrap()
22865/// # .https_only()
22866/// # .enable_http2()
22867/// # .build();
22868///
22869/// # let executor = hyper_util::rt::TokioExecutor::new();
22870/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
22871/// # secret,
22872/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
22873/// # yup_oauth2::client::CustomHyperClientBuilder::from(
22874/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
22875/// # ),
22876/// # ).build().await.unwrap();
22877///
22878/// # let client = hyper_util::client::legacy::Client::builder(
22879/// # hyper_util::rt::TokioExecutor::new()
22880/// # )
22881/// # .build(
22882/// # hyper_rustls::HttpsConnectorBuilder::new()
22883/// # .with_native_roots()
22884/// # .unwrap()
22885/// # .https_or_http()
22886/// # .enable_http2()
22887/// # .build()
22888/// # );
22889/// # let mut hub = Bigquery::new(client, auth);
22890/// // As the method needs a request, you would usually fill it with the desired information
22891/// // into the respective structure. Some of the parts shown here might not be applicable !
22892/// // Values shown here are possibly random and not representative !
22893/// let mut req = Table::default();
22894///
22895/// // You can configure optional parameters by calling the respective setters at will, and
22896/// // execute the final call using `doit()`.
22897/// // Values shown here are possibly random and not representative !
22898/// let result = hub.tables().insert(req, "projectId", "datasetId")
22899/// .doit().await;
22900/// # }
22901/// ```
22902pub struct TableInsertCall<'a, C>
22903where
22904 C: 'a,
22905{
22906 hub: &'a Bigquery<C>,
22907 _request: Table,
22908 _project_id: String,
22909 _dataset_id: String,
22910 _delegate: Option<&'a mut dyn common::Delegate>,
22911 _additional_params: HashMap<String, String>,
22912 _scopes: BTreeSet<String>,
22913}
22914
22915impl<'a, C> common::CallBuilder for TableInsertCall<'a, C> {}
22916
22917impl<'a, C> TableInsertCall<'a, C>
22918where
22919 C: common::Connector,
22920{
22921 /// Perform the operation you have build so far.
22922 pub async fn doit(mut self) -> common::Result<(common::Response, Table)> {
22923 use std::borrow::Cow;
22924 use std::io::{Read, Seek};
22925
22926 use common::{url::Params, ToParts};
22927 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
22928
22929 let mut dd = common::DefaultDelegate;
22930 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
22931 dlg.begin(common::MethodInfo {
22932 id: "bigquery.tables.insert",
22933 http_method: hyper::Method::POST,
22934 });
22935
22936 for &field in ["alt", "projectId", "datasetId"].iter() {
22937 if self._additional_params.contains_key(field) {
22938 dlg.finished(false);
22939 return Err(common::Error::FieldClash(field));
22940 }
22941 }
22942
22943 let mut params = Params::with_capacity(5 + self._additional_params.len());
22944 params.push("projectId", self._project_id);
22945 params.push("datasetId", self._dataset_id);
22946
22947 params.extend(self._additional_params.iter());
22948
22949 params.push("alt", "json");
22950 let mut url =
22951 self.hub._base_url.clone() + "projects/{+projectId}/datasets/{+datasetId}/tables";
22952 if self._scopes.is_empty() {
22953 self._scopes
22954 .insert(Scope::CloudPlatform.as_ref().to_string());
22955 }
22956
22957 #[allow(clippy::single_element_loop)]
22958 for &(find_this, param_name) in
22959 [("{+projectId}", "projectId"), ("{+datasetId}", "datasetId")].iter()
22960 {
22961 url = params.uri_replacement(url, param_name, find_this, true);
22962 }
22963 {
22964 let to_remove = ["datasetId", "projectId"];
22965 params.remove_params(&to_remove);
22966 }
22967
22968 let url = params.parse_with_url(&url);
22969
22970 let mut json_mime_type = mime::APPLICATION_JSON;
22971 let mut request_value_reader = {
22972 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
22973 common::remove_json_null_values(&mut value);
22974 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
22975 serde_json::to_writer(&mut dst, &value).unwrap();
22976 dst
22977 };
22978 let request_size = request_value_reader
22979 .seek(std::io::SeekFrom::End(0))
22980 .unwrap();
22981 request_value_reader
22982 .seek(std::io::SeekFrom::Start(0))
22983 .unwrap();
22984
22985 loop {
22986 let token = match self
22987 .hub
22988 .auth
22989 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
22990 .await
22991 {
22992 Ok(token) => token,
22993 Err(e) => match dlg.token(e) {
22994 Ok(token) => token,
22995 Err(e) => {
22996 dlg.finished(false);
22997 return Err(common::Error::MissingToken(e));
22998 }
22999 },
23000 };
23001 request_value_reader
23002 .seek(std::io::SeekFrom::Start(0))
23003 .unwrap();
23004 let mut req_result = {
23005 let client = &self.hub.client;
23006 dlg.pre_request();
23007 let mut req_builder = hyper::Request::builder()
23008 .method(hyper::Method::POST)
23009 .uri(url.as_str())
23010 .header(USER_AGENT, self.hub._user_agent.clone());
23011
23012 if let Some(token) = token.as_ref() {
23013 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
23014 }
23015
23016 let request = req_builder
23017 .header(CONTENT_TYPE, json_mime_type.to_string())
23018 .header(CONTENT_LENGTH, request_size as u64)
23019 .body(common::to_body(
23020 request_value_reader.get_ref().clone().into(),
23021 ));
23022
23023 client.request(request.unwrap()).await
23024 };
23025
23026 match req_result {
23027 Err(err) => {
23028 if let common::Retry::After(d) = dlg.http_error(&err) {
23029 sleep(d).await;
23030 continue;
23031 }
23032 dlg.finished(false);
23033 return Err(common::Error::HttpError(err));
23034 }
23035 Ok(res) => {
23036 let (mut parts, body) = res.into_parts();
23037 let mut body = common::Body::new(body);
23038 if !parts.status.is_success() {
23039 let bytes = common::to_bytes(body).await.unwrap_or_default();
23040 let error = serde_json::from_str(&common::to_string(&bytes));
23041 let response = common::to_response(parts, bytes.into());
23042
23043 if let common::Retry::After(d) =
23044 dlg.http_failure(&response, error.as_ref().ok())
23045 {
23046 sleep(d).await;
23047 continue;
23048 }
23049
23050 dlg.finished(false);
23051
23052 return Err(match error {
23053 Ok(value) => common::Error::BadRequest(value),
23054 _ => common::Error::Failure(response),
23055 });
23056 }
23057 let response = {
23058 let bytes = common::to_bytes(body).await.unwrap_or_default();
23059 let encoded = common::to_string(&bytes);
23060 match serde_json::from_str(&encoded) {
23061 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
23062 Err(error) => {
23063 dlg.response_json_decode_error(&encoded, &error);
23064 return Err(common::Error::JsonDecodeError(
23065 encoded.to_string(),
23066 error,
23067 ));
23068 }
23069 }
23070 };
23071
23072 dlg.finished(true);
23073 return Ok(response);
23074 }
23075 }
23076 }
23077 }
23078
23079 ///
23080 /// Sets the *request* property to the given value.
23081 ///
23082 /// Even though the property as already been set when instantiating this call,
23083 /// we provide this method for API completeness.
23084 pub fn request(mut self, new_value: Table) -> TableInsertCall<'a, C> {
23085 self._request = new_value;
23086 self
23087 }
23088 /// Required. Project ID of the new table
23089 ///
23090 /// Sets the *project id* path property to the given value.
23091 ///
23092 /// Even though the property as already been set when instantiating this call,
23093 /// we provide this method for API completeness.
23094 pub fn project_id(mut self, new_value: &str) -> TableInsertCall<'a, C> {
23095 self._project_id = new_value.to_string();
23096 self
23097 }
23098 /// Required. Dataset ID of the new table
23099 ///
23100 /// Sets the *dataset id* path property to the given value.
23101 ///
23102 /// Even though the property as already been set when instantiating this call,
23103 /// we provide this method for API completeness.
23104 pub fn dataset_id(mut self, new_value: &str) -> TableInsertCall<'a, C> {
23105 self._dataset_id = new_value.to_string();
23106 self
23107 }
23108 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
23109 /// while executing the actual API request.
23110 ///
23111 /// ````text
23112 /// It should be used to handle progress information, and to implement a certain level of resilience.
23113 /// ````
23114 ///
23115 /// Sets the *delegate* property to the given value.
23116 pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> TableInsertCall<'a, C> {
23117 self._delegate = Some(new_value);
23118 self
23119 }
23120
23121 /// Set any additional parameter of the query string used in the request.
23122 /// It should be used to set parameters which are not yet available through their own
23123 /// setters.
23124 ///
23125 /// Please note that this method must not be used to set any of the known parameters
23126 /// which have their own setter method. If done anyway, the request will fail.
23127 ///
23128 /// # Additional Parameters
23129 ///
23130 /// * *$.xgafv* (query-string) - V1 error format.
23131 /// * *access_token* (query-string) - OAuth access token.
23132 /// * *alt* (query-string) - Data format for response.
23133 /// * *callback* (query-string) - JSONP
23134 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
23135 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
23136 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
23137 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
23138 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
23139 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
23140 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
23141 pub fn param<T>(mut self, name: T, value: T) -> TableInsertCall<'a, C>
23142 where
23143 T: AsRef<str>,
23144 {
23145 self._additional_params
23146 .insert(name.as_ref().to_string(), value.as_ref().to_string());
23147 self
23148 }
23149
23150 /// Identifies the authorization scope for the method you are building.
23151 ///
23152 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
23153 /// [`Scope::CloudPlatform`].
23154 ///
23155 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
23156 /// tokens for more than one scope.
23157 ///
23158 /// Usually there is more than one suitable scope to authorize an operation, some of which may
23159 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
23160 /// sufficient, a read-write scope will do as well.
23161 pub fn add_scope<St>(mut self, scope: St) -> TableInsertCall<'a, C>
23162 where
23163 St: AsRef<str>,
23164 {
23165 self._scopes.insert(String::from(scope.as_ref()));
23166 self
23167 }
23168 /// Identifies the authorization scope(s) for the method you are building.
23169 ///
23170 /// See [`Self::add_scope()`] for details.
23171 pub fn add_scopes<I, St>(mut self, scopes: I) -> TableInsertCall<'a, C>
23172 where
23173 I: IntoIterator<Item = St>,
23174 St: AsRef<str>,
23175 {
23176 self._scopes
23177 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
23178 self
23179 }
23180
23181 /// Removes all scopes, and no default scope will be used either.
23182 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
23183 /// for details).
23184 pub fn clear_scopes(mut self) -> TableInsertCall<'a, C> {
23185 self._scopes.clear();
23186 self
23187 }
23188}
23189
23190/// Lists all tables in the specified dataset. Requires the READER dataset role.
23191///
23192/// A builder for the *list* method supported by a *table* resource.
23193/// It is not used directly, but through a [`TableMethods`] instance.
23194///
23195/// # Example
23196///
23197/// Instantiate a resource method builder
23198///
23199/// ```test_harness,no_run
23200/// # extern crate hyper;
23201/// # extern crate hyper_rustls;
23202/// # extern crate google_bigquery2 as bigquery2;
23203/// # async fn dox() {
23204/// # use bigquery2::{Bigquery, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
23205///
23206/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
23207/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
23208/// # .with_native_roots()
23209/// # .unwrap()
23210/// # .https_only()
23211/// # .enable_http2()
23212/// # .build();
23213///
23214/// # let executor = hyper_util::rt::TokioExecutor::new();
23215/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
23216/// # secret,
23217/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
23218/// # yup_oauth2::client::CustomHyperClientBuilder::from(
23219/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
23220/// # ),
23221/// # ).build().await.unwrap();
23222///
23223/// # let client = hyper_util::client::legacy::Client::builder(
23224/// # hyper_util::rt::TokioExecutor::new()
23225/// # )
23226/// # .build(
23227/// # hyper_rustls::HttpsConnectorBuilder::new()
23228/// # .with_native_roots()
23229/// # .unwrap()
23230/// # .https_or_http()
23231/// # .enable_http2()
23232/// # .build()
23233/// # );
23234/// # let mut hub = Bigquery::new(client, auth);
23235/// // You can configure optional parameters by calling the respective setters at will, and
23236/// // execute the final call using `doit()`.
23237/// // Values shown here are possibly random and not representative !
23238/// let result = hub.tables().list("projectId", "datasetId")
23239/// .page_token("accusam")
23240/// .max_results(54)
23241/// .doit().await;
23242/// # }
23243/// ```
23244pub struct TableListCall<'a, C>
23245where
23246 C: 'a,
23247{
23248 hub: &'a Bigquery<C>,
23249 _project_id: String,
23250 _dataset_id: String,
23251 _page_token: Option<String>,
23252 _max_results: Option<u32>,
23253 _delegate: Option<&'a mut dyn common::Delegate>,
23254 _additional_params: HashMap<String, String>,
23255 _scopes: BTreeSet<String>,
23256}
23257
23258impl<'a, C> common::CallBuilder for TableListCall<'a, C> {}
23259
23260impl<'a, C> TableListCall<'a, C>
23261where
23262 C: common::Connector,
23263{
23264 /// Perform the operation you have build so far.
23265 pub async fn doit(mut self) -> common::Result<(common::Response, TableList)> {
23266 use std::borrow::Cow;
23267 use std::io::{Read, Seek};
23268
23269 use common::{url::Params, ToParts};
23270 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
23271
23272 let mut dd = common::DefaultDelegate;
23273 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
23274 dlg.begin(common::MethodInfo {
23275 id: "bigquery.tables.list",
23276 http_method: hyper::Method::GET,
23277 });
23278
23279 for &field in ["alt", "projectId", "datasetId", "pageToken", "maxResults"].iter() {
23280 if self._additional_params.contains_key(field) {
23281 dlg.finished(false);
23282 return Err(common::Error::FieldClash(field));
23283 }
23284 }
23285
23286 let mut params = Params::with_capacity(6 + self._additional_params.len());
23287 params.push("projectId", self._project_id);
23288 params.push("datasetId", self._dataset_id);
23289 if let Some(value) = self._page_token.as_ref() {
23290 params.push("pageToken", value);
23291 }
23292 if let Some(value) = self._max_results.as_ref() {
23293 params.push("maxResults", value.to_string());
23294 }
23295
23296 params.extend(self._additional_params.iter());
23297
23298 params.push("alt", "json");
23299 let mut url =
23300 self.hub._base_url.clone() + "projects/{+projectId}/datasets/{+datasetId}/tables";
23301 if self._scopes.is_empty() {
23302 self._scopes
23303 .insert(Scope::CloudPlatformReadOnly.as_ref().to_string());
23304 }
23305
23306 #[allow(clippy::single_element_loop)]
23307 for &(find_this, param_name) in
23308 [("{+projectId}", "projectId"), ("{+datasetId}", "datasetId")].iter()
23309 {
23310 url = params.uri_replacement(url, param_name, find_this, true);
23311 }
23312 {
23313 let to_remove = ["datasetId", "projectId"];
23314 params.remove_params(&to_remove);
23315 }
23316
23317 let url = params.parse_with_url(&url);
23318
23319 loop {
23320 let token = match self
23321 .hub
23322 .auth
23323 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
23324 .await
23325 {
23326 Ok(token) => token,
23327 Err(e) => match dlg.token(e) {
23328 Ok(token) => token,
23329 Err(e) => {
23330 dlg.finished(false);
23331 return Err(common::Error::MissingToken(e));
23332 }
23333 },
23334 };
23335 let mut req_result = {
23336 let client = &self.hub.client;
23337 dlg.pre_request();
23338 let mut req_builder = hyper::Request::builder()
23339 .method(hyper::Method::GET)
23340 .uri(url.as_str())
23341 .header(USER_AGENT, self.hub._user_agent.clone());
23342
23343 if let Some(token) = token.as_ref() {
23344 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
23345 }
23346
23347 let request = req_builder
23348 .header(CONTENT_LENGTH, 0_u64)
23349 .body(common::to_body::<String>(None));
23350
23351 client.request(request.unwrap()).await
23352 };
23353
23354 match req_result {
23355 Err(err) => {
23356 if let common::Retry::After(d) = dlg.http_error(&err) {
23357 sleep(d).await;
23358 continue;
23359 }
23360 dlg.finished(false);
23361 return Err(common::Error::HttpError(err));
23362 }
23363 Ok(res) => {
23364 let (mut parts, body) = res.into_parts();
23365 let mut body = common::Body::new(body);
23366 if !parts.status.is_success() {
23367 let bytes = common::to_bytes(body).await.unwrap_or_default();
23368 let error = serde_json::from_str(&common::to_string(&bytes));
23369 let response = common::to_response(parts, bytes.into());
23370
23371 if let common::Retry::After(d) =
23372 dlg.http_failure(&response, error.as_ref().ok())
23373 {
23374 sleep(d).await;
23375 continue;
23376 }
23377
23378 dlg.finished(false);
23379
23380 return Err(match error {
23381 Ok(value) => common::Error::BadRequest(value),
23382 _ => common::Error::Failure(response),
23383 });
23384 }
23385 let response = {
23386 let bytes = common::to_bytes(body).await.unwrap_or_default();
23387 let encoded = common::to_string(&bytes);
23388 match serde_json::from_str(&encoded) {
23389 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
23390 Err(error) => {
23391 dlg.response_json_decode_error(&encoded, &error);
23392 return Err(common::Error::JsonDecodeError(
23393 encoded.to_string(),
23394 error,
23395 ));
23396 }
23397 }
23398 };
23399
23400 dlg.finished(true);
23401 return Ok(response);
23402 }
23403 }
23404 }
23405 }
23406
23407 /// Required. Project ID of the tables to list
23408 ///
23409 /// Sets the *project id* path property to the given value.
23410 ///
23411 /// Even though the property as already been set when instantiating this call,
23412 /// we provide this method for API completeness.
23413 pub fn project_id(mut self, new_value: &str) -> TableListCall<'a, C> {
23414 self._project_id = new_value.to_string();
23415 self
23416 }
23417 /// Required. Dataset ID of the tables to list
23418 ///
23419 /// Sets the *dataset id* path property to the given value.
23420 ///
23421 /// Even though the property as already been set when instantiating this call,
23422 /// we provide this method for API completeness.
23423 pub fn dataset_id(mut self, new_value: &str) -> TableListCall<'a, C> {
23424 self._dataset_id = new_value.to_string();
23425 self
23426 }
23427 /// Page token, returned by a previous call, to request the next page of results
23428 ///
23429 /// Sets the *page token* query property to the given value.
23430 pub fn page_token(mut self, new_value: &str) -> TableListCall<'a, C> {
23431 self._page_token = Some(new_value.to_string());
23432 self
23433 }
23434 /// The maximum number of results to return in a single response page. Leverage the page tokens to iterate through the entire collection.
23435 ///
23436 /// Sets the *max results* query property to the given value.
23437 pub fn max_results(mut self, new_value: u32) -> TableListCall<'a, C> {
23438 self._max_results = Some(new_value);
23439 self
23440 }
23441 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
23442 /// while executing the actual API request.
23443 ///
23444 /// ````text
23445 /// It should be used to handle progress information, and to implement a certain level of resilience.
23446 /// ````
23447 ///
23448 /// Sets the *delegate* property to the given value.
23449 pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> TableListCall<'a, C> {
23450 self._delegate = Some(new_value);
23451 self
23452 }
23453
23454 /// Set any additional parameter of the query string used in the request.
23455 /// It should be used to set parameters which are not yet available through their own
23456 /// setters.
23457 ///
23458 /// Please note that this method must not be used to set any of the known parameters
23459 /// which have their own setter method. If done anyway, the request will fail.
23460 ///
23461 /// # Additional Parameters
23462 ///
23463 /// * *$.xgafv* (query-string) - V1 error format.
23464 /// * *access_token* (query-string) - OAuth access token.
23465 /// * *alt* (query-string) - Data format for response.
23466 /// * *callback* (query-string) - JSONP
23467 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
23468 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
23469 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
23470 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
23471 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
23472 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
23473 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
23474 pub fn param<T>(mut self, name: T, value: T) -> TableListCall<'a, C>
23475 where
23476 T: AsRef<str>,
23477 {
23478 self._additional_params
23479 .insert(name.as_ref().to_string(), value.as_ref().to_string());
23480 self
23481 }
23482
23483 /// Identifies the authorization scope for the method you are building.
23484 ///
23485 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
23486 /// [`Scope::CloudPlatformReadOnly`].
23487 ///
23488 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
23489 /// tokens for more than one scope.
23490 ///
23491 /// Usually there is more than one suitable scope to authorize an operation, some of which may
23492 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
23493 /// sufficient, a read-write scope will do as well.
23494 pub fn add_scope<St>(mut self, scope: St) -> TableListCall<'a, C>
23495 where
23496 St: AsRef<str>,
23497 {
23498 self._scopes.insert(String::from(scope.as_ref()));
23499 self
23500 }
23501 /// Identifies the authorization scope(s) for the method you are building.
23502 ///
23503 /// See [`Self::add_scope()`] for details.
23504 pub fn add_scopes<I, St>(mut self, scopes: I) -> TableListCall<'a, C>
23505 where
23506 I: IntoIterator<Item = St>,
23507 St: AsRef<str>,
23508 {
23509 self._scopes
23510 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
23511 self
23512 }
23513
23514 /// Removes all scopes, and no default scope will be used either.
23515 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
23516 /// for details).
23517 pub fn clear_scopes(mut self) -> TableListCall<'a, C> {
23518 self._scopes.clear();
23519 self
23520 }
23521}
23522
23523/// Updates information in an existing table. The update method replaces the entire table resource, whereas the patch method only replaces fields that are provided in the submitted table resource. This method supports RFC5789 patch semantics.
23524///
23525/// A builder for the *patch* method supported by a *table* resource.
23526/// It is not used directly, but through a [`TableMethods`] instance.
23527///
23528/// # Example
23529///
23530/// Instantiate a resource method builder
23531///
23532/// ```test_harness,no_run
23533/// # extern crate hyper;
23534/// # extern crate hyper_rustls;
23535/// # extern crate google_bigquery2 as bigquery2;
23536/// use bigquery2::api::Table;
23537/// # async fn dox() {
23538/// # use bigquery2::{Bigquery, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
23539///
23540/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
23541/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
23542/// # .with_native_roots()
23543/// # .unwrap()
23544/// # .https_only()
23545/// # .enable_http2()
23546/// # .build();
23547///
23548/// # let executor = hyper_util::rt::TokioExecutor::new();
23549/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
23550/// # secret,
23551/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
23552/// # yup_oauth2::client::CustomHyperClientBuilder::from(
23553/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
23554/// # ),
23555/// # ).build().await.unwrap();
23556///
23557/// # let client = hyper_util::client::legacy::Client::builder(
23558/// # hyper_util::rt::TokioExecutor::new()
23559/// # )
23560/// # .build(
23561/// # hyper_rustls::HttpsConnectorBuilder::new()
23562/// # .with_native_roots()
23563/// # .unwrap()
23564/// # .https_or_http()
23565/// # .enable_http2()
23566/// # .build()
23567/// # );
23568/// # let mut hub = Bigquery::new(client, auth);
23569/// // As the method needs a request, you would usually fill it with the desired information
23570/// // into the respective structure. Some of the parts shown here might not be applicable !
23571/// // Values shown here are possibly random and not representative !
23572/// let mut req = Table::default();
23573///
23574/// // You can configure optional parameters by calling the respective setters at will, and
23575/// // execute the final call using `doit()`.
23576/// // Values shown here are possibly random and not representative !
23577/// let result = hub.tables().patch(req, "projectId", "datasetId", "tableId")
23578/// .autodetect_schema(false)
23579/// .doit().await;
23580/// # }
23581/// ```
23582pub struct TablePatchCall<'a, C>
23583where
23584 C: 'a,
23585{
23586 hub: &'a Bigquery<C>,
23587 _request: Table,
23588 _project_id: String,
23589 _dataset_id: String,
23590 _table_id: String,
23591 _autodetect_schema: Option<bool>,
23592 _delegate: Option<&'a mut dyn common::Delegate>,
23593 _additional_params: HashMap<String, String>,
23594 _scopes: BTreeSet<String>,
23595}
23596
23597impl<'a, C> common::CallBuilder for TablePatchCall<'a, C> {}
23598
23599impl<'a, C> TablePatchCall<'a, C>
23600where
23601 C: common::Connector,
23602{
23603 /// Perform the operation you have build so far.
23604 pub async fn doit(mut self) -> common::Result<(common::Response, Table)> {
23605 use std::borrow::Cow;
23606 use std::io::{Read, Seek};
23607
23608 use common::{url::Params, ToParts};
23609 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
23610
23611 let mut dd = common::DefaultDelegate;
23612 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
23613 dlg.begin(common::MethodInfo {
23614 id: "bigquery.tables.patch",
23615 http_method: hyper::Method::PATCH,
23616 });
23617
23618 for &field in [
23619 "alt",
23620 "projectId",
23621 "datasetId",
23622 "tableId",
23623 "autodetect_schema",
23624 ]
23625 .iter()
23626 {
23627 if self._additional_params.contains_key(field) {
23628 dlg.finished(false);
23629 return Err(common::Error::FieldClash(field));
23630 }
23631 }
23632
23633 let mut params = Params::with_capacity(7 + self._additional_params.len());
23634 params.push("projectId", self._project_id);
23635 params.push("datasetId", self._dataset_id);
23636 params.push("tableId", self._table_id);
23637 if let Some(value) = self._autodetect_schema.as_ref() {
23638 params.push("autodetect_schema", value.to_string());
23639 }
23640
23641 params.extend(self._additional_params.iter());
23642
23643 params.push("alt", "json");
23644 let mut url = self.hub._base_url.clone()
23645 + "projects/{+projectId}/datasets/{+datasetId}/tables/{+tableId}";
23646 if self._scopes.is_empty() {
23647 self._scopes
23648 .insert(Scope::CloudPlatform.as_ref().to_string());
23649 }
23650
23651 #[allow(clippy::single_element_loop)]
23652 for &(find_this, param_name) in [
23653 ("{+projectId}", "projectId"),
23654 ("{+datasetId}", "datasetId"),
23655 ("{+tableId}", "tableId"),
23656 ]
23657 .iter()
23658 {
23659 url = params.uri_replacement(url, param_name, find_this, true);
23660 }
23661 {
23662 let to_remove = ["tableId", "datasetId", "projectId"];
23663 params.remove_params(&to_remove);
23664 }
23665
23666 let url = params.parse_with_url(&url);
23667
23668 let mut json_mime_type = mime::APPLICATION_JSON;
23669 let mut request_value_reader = {
23670 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
23671 common::remove_json_null_values(&mut value);
23672 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
23673 serde_json::to_writer(&mut dst, &value).unwrap();
23674 dst
23675 };
23676 let request_size = request_value_reader
23677 .seek(std::io::SeekFrom::End(0))
23678 .unwrap();
23679 request_value_reader
23680 .seek(std::io::SeekFrom::Start(0))
23681 .unwrap();
23682
23683 loop {
23684 let token = match self
23685 .hub
23686 .auth
23687 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
23688 .await
23689 {
23690 Ok(token) => token,
23691 Err(e) => match dlg.token(e) {
23692 Ok(token) => token,
23693 Err(e) => {
23694 dlg.finished(false);
23695 return Err(common::Error::MissingToken(e));
23696 }
23697 },
23698 };
23699 request_value_reader
23700 .seek(std::io::SeekFrom::Start(0))
23701 .unwrap();
23702 let mut req_result = {
23703 let client = &self.hub.client;
23704 dlg.pre_request();
23705 let mut req_builder = hyper::Request::builder()
23706 .method(hyper::Method::PATCH)
23707 .uri(url.as_str())
23708 .header(USER_AGENT, self.hub._user_agent.clone());
23709
23710 if let Some(token) = token.as_ref() {
23711 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
23712 }
23713
23714 let request = req_builder
23715 .header(CONTENT_TYPE, json_mime_type.to_string())
23716 .header(CONTENT_LENGTH, request_size as u64)
23717 .body(common::to_body(
23718 request_value_reader.get_ref().clone().into(),
23719 ));
23720
23721 client.request(request.unwrap()).await
23722 };
23723
23724 match req_result {
23725 Err(err) => {
23726 if let common::Retry::After(d) = dlg.http_error(&err) {
23727 sleep(d).await;
23728 continue;
23729 }
23730 dlg.finished(false);
23731 return Err(common::Error::HttpError(err));
23732 }
23733 Ok(res) => {
23734 let (mut parts, body) = res.into_parts();
23735 let mut body = common::Body::new(body);
23736 if !parts.status.is_success() {
23737 let bytes = common::to_bytes(body).await.unwrap_or_default();
23738 let error = serde_json::from_str(&common::to_string(&bytes));
23739 let response = common::to_response(parts, bytes.into());
23740
23741 if let common::Retry::After(d) =
23742 dlg.http_failure(&response, error.as_ref().ok())
23743 {
23744 sleep(d).await;
23745 continue;
23746 }
23747
23748 dlg.finished(false);
23749
23750 return Err(match error {
23751 Ok(value) => common::Error::BadRequest(value),
23752 _ => common::Error::Failure(response),
23753 });
23754 }
23755 let response = {
23756 let bytes = common::to_bytes(body).await.unwrap_or_default();
23757 let encoded = common::to_string(&bytes);
23758 match serde_json::from_str(&encoded) {
23759 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
23760 Err(error) => {
23761 dlg.response_json_decode_error(&encoded, &error);
23762 return Err(common::Error::JsonDecodeError(
23763 encoded.to_string(),
23764 error,
23765 ));
23766 }
23767 }
23768 };
23769
23770 dlg.finished(true);
23771 return Ok(response);
23772 }
23773 }
23774 }
23775 }
23776
23777 ///
23778 /// Sets the *request* property to the given value.
23779 ///
23780 /// Even though the property as already been set when instantiating this call,
23781 /// we provide this method for API completeness.
23782 pub fn request(mut self, new_value: Table) -> TablePatchCall<'a, C> {
23783 self._request = new_value;
23784 self
23785 }
23786 /// Required. Project ID of the table to update
23787 ///
23788 /// Sets the *project id* path property to the given value.
23789 ///
23790 /// Even though the property as already been set when instantiating this call,
23791 /// we provide this method for API completeness.
23792 pub fn project_id(mut self, new_value: &str) -> TablePatchCall<'a, C> {
23793 self._project_id = new_value.to_string();
23794 self
23795 }
23796 /// Required. Dataset ID of the table to update
23797 ///
23798 /// Sets the *dataset id* path property to the given value.
23799 ///
23800 /// Even though the property as already been set when instantiating this call,
23801 /// we provide this method for API completeness.
23802 pub fn dataset_id(mut self, new_value: &str) -> TablePatchCall<'a, C> {
23803 self._dataset_id = new_value.to_string();
23804 self
23805 }
23806 /// Required. Table ID of the table to update
23807 ///
23808 /// Sets the *table id* path property to the given value.
23809 ///
23810 /// Even though the property as already been set when instantiating this call,
23811 /// we provide this method for API completeness.
23812 pub fn table_id(mut self, new_value: &str) -> TablePatchCall<'a, C> {
23813 self._table_id = new_value.to_string();
23814 self
23815 }
23816 /// Optional. When true will autodetect schema, else will keep original schema
23817 ///
23818 /// Sets the *autodetect_schema* query property to the given value.
23819 pub fn autodetect_schema(mut self, new_value: bool) -> TablePatchCall<'a, C> {
23820 self._autodetect_schema = Some(new_value);
23821 self
23822 }
23823 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
23824 /// while executing the actual API request.
23825 ///
23826 /// ````text
23827 /// It should be used to handle progress information, and to implement a certain level of resilience.
23828 /// ````
23829 ///
23830 /// Sets the *delegate* property to the given value.
23831 pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> TablePatchCall<'a, C> {
23832 self._delegate = Some(new_value);
23833 self
23834 }
23835
23836 /// Set any additional parameter of the query string used in the request.
23837 /// It should be used to set parameters which are not yet available through their own
23838 /// setters.
23839 ///
23840 /// Please note that this method must not be used to set any of the known parameters
23841 /// which have their own setter method. If done anyway, the request will fail.
23842 ///
23843 /// # Additional Parameters
23844 ///
23845 /// * *$.xgafv* (query-string) - V1 error format.
23846 /// * *access_token* (query-string) - OAuth access token.
23847 /// * *alt* (query-string) - Data format for response.
23848 /// * *callback* (query-string) - JSONP
23849 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
23850 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
23851 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
23852 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
23853 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
23854 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
23855 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
23856 pub fn param<T>(mut self, name: T, value: T) -> TablePatchCall<'a, C>
23857 where
23858 T: AsRef<str>,
23859 {
23860 self._additional_params
23861 .insert(name.as_ref().to_string(), value.as_ref().to_string());
23862 self
23863 }
23864
23865 /// Identifies the authorization scope for the method you are building.
23866 ///
23867 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
23868 /// [`Scope::CloudPlatform`].
23869 ///
23870 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
23871 /// tokens for more than one scope.
23872 ///
23873 /// Usually there is more than one suitable scope to authorize an operation, some of which may
23874 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
23875 /// sufficient, a read-write scope will do as well.
23876 pub fn add_scope<St>(mut self, scope: St) -> TablePatchCall<'a, C>
23877 where
23878 St: AsRef<str>,
23879 {
23880 self._scopes.insert(String::from(scope.as_ref()));
23881 self
23882 }
23883 /// Identifies the authorization scope(s) for the method you are building.
23884 ///
23885 /// See [`Self::add_scope()`] for details.
23886 pub fn add_scopes<I, St>(mut self, scopes: I) -> TablePatchCall<'a, C>
23887 where
23888 I: IntoIterator<Item = St>,
23889 St: AsRef<str>,
23890 {
23891 self._scopes
23892 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
23893 self
23894 }
23895
23896 /// Removes all scopes, and no default scope will be used either.
23897 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
23898 /// for details).
23899 pub fn clear_scopes(mut self) -> TablePatchCall<'a, C> {
23900 self._scopes.clear();
23901 self
23902 }
23903}
23904
23905/// Sets the access control policy on the specified resource. Replaces any existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` errors.
23906///
23907/// A builder for the *setIamPolicy* method supported by a *table* resource.
23908/// It is not used directly, but through a [`TableMethods`] instance.
23909///
23910/// # Example
23911///
23912/// Instantiate a resource method builder
23913///
23914/// ```test_harness,no_run
23915/// # extern crate hyper;
23916/// # extern crate hyper_rustls;
23917/// # extern crate google_bigquery2 as bigquery2;
23918/// use bigquery2::api::SetIamPolicyRequest;
23919/// # async fn dox() {
23920/// # use bigquery2::{Bigquery, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
23921///
23922/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
23923/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
23924/// # .with_native_roots()
23925/// # .unwrap()
23926/// # .https_only()
23927/// # .enable_http2()
23928/// # .build();
23929///
23930/// # let executor = hyper_util::rt::TokioExecutor::new();
23931/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
23932/// # secret,
23933/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
23934/// # yup_oauth2::client::CustomHyperClientBuilder::from(
23935/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
23936/// # ),
23937/// # ).build().await.unwrap();
23938///
23939/// # let client = hyper_util::client::legacy::Client::builder(
23940/// # hyper_util::rt::TokioExecutor::new()
23941/// # )
23942/// # .build(
23943/// # hyper_rustls::HttpsConnectorBuilder::new()
23944/// # .with_native_roots()
23945/// # .unwrap()
23946/// # .https_or_http()
23947/// # .enable_http2()
23948/// # .build()
23949/// # );
23950/// # let mut hub = Bigquery::new(client, auth);
23951/// // As the method needs a request, you would usually fill it with the desired information
23952/// // into the respective structure. Some of the parts shown here might not be applicable !
23953/// // Values shown here are possibly random and not representative !
23954/// let mut req = SetIamPolicyRequest::default();
23955///
23956/// // You can configure optional parameters by calling the respective setters at will, and
23957/// // execute the final call using `doit()`.
23958/// // Values shown here are possibly random and not representative !
23959/// let result = hub.tables().set_iam_policy(req, "resource")
23960/// .doit().await;
23961/// # }
23962/// ```
23963pub struct TableSetIamPolicyCall<'a, C>
23964where
23965 C: 'a,
23966{
23967 hub: &'a Bigquery<C>,
23968 _request: SetIamPolicyRequest,
23969 _resource: String,
23970 _delegate: Option<&'a mut dyn common::Delegate>,
23971 _additional_params: HashMap<String, String>,
23972 _scopes: BTreeSet<String>,
23973}
23974
23975impl<'a, C> common::CallBuilder for TableSetIamPolicyCall<'a, C> {}
23976
23977impl<'a, C> TableSetIamPolicyCall<'a, C>
23978where
23979 C: common::Connector,
23980{
23981 /// Perform the operation you have build so far.
23982 pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
23983 use std::borrow::Cow;
23984 use std::io::{Read, Seek};
23985
23986 use common::{url::Params, ToParts};
23987 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
23988
23989 let mut dd = common::DefaultDelegate;
23990 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
23991 dlg.begin(common::MethodInfo {
23992 id: "bigquery.tables.setIamPolicy",
23993 http_method: hyper::Method::POST,
23994 });
23995
23996 for &field in ["alt", "resource"].iter() {
23997 if self._additional_params.contains_key(field) {
23998 dlg.finished(false);
23999 return Err(common::Error::FieldClash(field));
24000 }
24001 }
24002
24003 let mut params = Params::with_capacity(4 + self._additional_params.len());
24004 params.push("resource", self._resource);
24005
24006 params.extend(self._additional_params.iter());
24007
24008 params.push("alt", "json");
24009 let mut url = self.hub._base_url.clone() + "{+resource}:setIamPolicy";
24010 if self._scopes.is_empty() {
24011 self._scopes
24012 .insert(Scope::CloudPlatform.as_ref().to_string());
24013 }
24014
24015 #[allow(clippy::single_element_loop)]
24016 for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
24017 url = params.uri_replacement(url, param_name, find_this, true);
24018 }
24019 {
24020 let to_remove = ["resource"];
24021 params.remove_params(&to_remove);
24022 }
24023
24024 let url = params.parse_with_url(&url);
24025
24026 let mut json_mime_type = mime::APPLICATION_JSON;
24027 let mut request_value_reader = {
24028 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
24029 common::remove_json_null_values(&mut value);
24030 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
24031 serde_json::to_writer(&mut dst, &value).unwrap();
24032 dst
24033 };
24034 let request_size = request_value_reader
24035 .seek(std::io::SeekFrom::End(0))
24036 .unwrap();
24037 request_value_reader
24038 .seek(std::io::SeekFrom::Start(0))
24039 .unwrap();
24040
24041 loop {
24042 let token = match self
24043 .hub
24044 .auth
24045 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
24046 .await
24047 {
24048 Ok(token) => token,
24049 Err(e) => match dlg.token(e) {
24050 Ok(token) => token,
24051 Err(e) => {
24052 dlg.finished(false);
24053 return Err(common::Error::MissingToken(e));
24054 }
24055 },
24056 };
24057 request_value_reader
24058 .seek(std::io::SeekFrom::Start(0))
24059 .unwrap();
24060 let mut req_result = {
24061 let client = &self.hub.client;
24062 dlg.pre_request();
24063 let mut req_builder = hyper::Request::builder()
24064 .method(hyper::Method::POST)
24065 .uri(url.as_str())
24066 .header(USER_AGENT, self.hub._user_agent.clone());
24067
24068 if let Some(token) = token.as_ref() {
24069 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
24070 }
24071
24072 let request = req_builder
24073 .header(CONTENT_TYPE, json_mime_type.to_string())
24074 .header(CONTENT_LENGTH, request_size as u64)
24075 .body(common::to_body(
24076 request_value_reader.get_ref().clone().into(),
24077 ));
24078
24079 client.request(request.unwrap()).await
24080 };
24081
24082 match req_result {
24083 Err(err) => {
24084 if let common::Retry::After(d) = dlg.http_error(&err) {
24085 sleep(d).await;
24086 continue;
24087 }
24088 dlg.finished(false);
24089 return Err(common::Error::HttpError(err));
24090 }
24091 Ok(res) => {
24092 let (mut parts, body) = res.into_parts();
24093 let mut body = common::Body::new(body);
24094 if !parts.status.is_success() {
24095 let bytes = common::to_bytes(body).await.unwrap_or_default();
24096 let error = serde_json::from_str(&common::to_string(&bytes));
24097 let response = common::to_response(parts, bytes.into());
24098
24099 if let common::Retry::After(d) =
24100 dlg.http_failure(&response, error.as_ref().ok())
24101 {
24102 sleep(d).await;
24103 continue;
24104 }
24105
24106 dlg.finished(false);
24107
24108 return Err(match error {
24109 Ok(value) => common::Error::BadRequest(value),
24110 _ => common::Error::Failure(response),
24111 });
24112 }
24113 let response = {
24114 let bytes = common::to_bytes(body).await.unwrap_or_default();
24115 let encoded = common::to_string(&bytes);
24116 match serde_json::from_str(&encoded) {
24117 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
24118 Err(error) => {
24119 dlg.response_json_decode_error(&encoded, &error);
24120 return Err(common::Error::JsonDecodeError(
24121 encoded.to_string(),
24122 error,
24123 ));
24124 }
24125 }
24126 };
24127
24128 dlg.finished(true);
24129 return Ok(response);
24130 }
24131 }
24132 }
24133 }
24134
24135 ///
24136 /// Sets the *request* property to the given value.
24137 ///
24138 /// Even though the property as already been set when instantiating this call,
24139 /// we provide this method for API completeness.
24140 pub fn request(mut self, new_value: SetIamPolicyRequest) -> TableSetIamPolicyCall<'a, C> {
24141 self._request = new_value;
24142 self
24143 }
24144 /// REQUIRED: The resource for which the policy is being specified. See [Resource names](https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
24145 ///
24146 /// Sets the *resource* path property to the given value.
24147 ///
24148 /// Even though the property as already been set when instantiating this call,
24149 /// we provide this method for API completeness.
24150 pub fn resource(mut self, new_value: &str) -> TableSetIamPolicyCall<'a, C> {
24151 self._resource = new_value.to_string();
24152 self
24153 }
24154 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
24155 /// while executing the actual API request.
24156 ///
24157 /// ````text
24158 /// It should be used to handle progress information, and to implement a certain level of resilience.
24159 /// ````
24160 ///
24161 /// Sets the *delegate* property to the given value.
24162 pub fn delegate(
24163 mut self,
24164 new_value: &'a mut dyn common::Delegate,
24165 ) -> TableSetIamPolicyCall<'a, C> {
24166 self._delegate = Some(new_value);
24167 self
24168 }
24169
24170 /// Set any additional parameter of the query string used in the request.
24171 /// It should be used to set parameters which are not yet available through their own
24172 /// setters.
24173 ///
24174 /// Please note that this method must not be used to set any of the known parameters
24175 /// which have their own setter method. If done anyway, the request will fail.
24176 ///
24177 /// # Additional Parameters
24178 ///
24179 /// * *$.xgafv* (query-string) - V1 error format.
24180 /// * *access_token* (query-string) - OAuth access token.
24181 /// * *alt* (query-string) - Data format for response.
24182 /// * *callback* (query-string) - JSONP
24183 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
24184 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
24185 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
24186 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
24187 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
24188 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
24189 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
24190 pub fn param<T>(mut self, name: T, value: T) -> TableSetIamPolicyCall<'a, C>
24191 where
24192 T: AsRef<str>,
24193 {
24194 self._additional_params
24195 .insert(name.as_ref().to_string(), value.as_ref().to_string());
24196 self
24197 }
24198
24199 /// Identifies the authorization scope for the method you are building.
24200 ///
24201 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
24202 /// [`Scope::CloudPlatform`].
24203 ///
24204 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
24205 /// tokens for more than one scope.
24206 ///
24207 /// Usually there is more than one suitable scope to authorize an operation, some of which may
24208 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
24209 /// sufficient, a read-write scope will do as well.
24210 pub fn add_scope<St>(mut self, scope: St) -> TableSetIamPolicyCall<'a, C>
24211 where
24212 St: AsRef<str>,
24213 {
24214 self._scopes.insert(String::from(scope.as_ref()));
24215 self
24216 }
24217 /// Identifies the authorization scope(s) for the method you are building.
24218 ///
24219 /// See [`Self::add_scope()`] for details.
24220 pub fn add_scopes<I, St>(mut self, scopes: I) -> TableSetIamPolicyCall<'a, C>
24221 where
24222 I: IntoIterator<Item = St>,
24223 St: AsRef<str>,
24224 {
24225 self._scopes
24226 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
24227 self
24228 }
24229
24230 /// Removes all scopes, and no default scope will be used either.
24231 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
24232 /// for details).
24233 pub fn clear_scopes(mut self) -> TableSetIamPolicyCall<'a, C> {
24234 self._scopes.clear();
24235 self
24236 }
24237}
24238
24239/// Returns permissions that a caller has on the specified resource. If the resource does not exist, this will return an empty set of permissions, not a `NOT_FOUND` error. Note: This operation is designed to be used for building permission-aware UIs and command-line tools, not for authorization checking. This operation may "fail open" without warning.
24240///
24241/// A builder for the *testIamPermissions* method supported by a *table* resource.
24242/// It is not used directly, but through a [`TableMethods`] instance.
24243///
24244/// # Example
24245///
24246/// Instantiate a resource method builder
24247///
24248/// ```test_harness,no_run
24249/// # extern crate hyper;
24250/// # extern crate hyper_rustls;
24251/// # extern crate google_bigquery2 as bigquery2;
24252/// use bigquery2::api::TestIamPermissionsRequest;
24253/// # async fn dox() {
24254/// # use bigquery2::{Bigquery, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
24255///
24256/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
24257/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
24258/// # .with_native_roots()
24259/// # .unwrap()
24260/// # .https_only()
24261/// # .enable_http2()
24262/// # .build();
24263///
24264/// # let executor = hyper_util::rt::TokioExecutor::new();
24265/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
24266/// # secret,
24267/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
24268/// # yup_oauth2::client::CustomHyperClientBuilder::from(
24269/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
24270/// # ),
24271/// # ).build().await.unwrap();
24272///
24273/// # let client = hyper_util::client::legacy::Client::builder(
24274/// # hyper_util::rt::TokioExecutor::new()
24275/// # )
24276/// # .build(
24277/// # hyper_rustls::HttpsConnectorBuilder::new()
24278/// # .with_native_roots()
24279/// # .unwrap()
24280/// # .https_or_http()
24281/// # .enable_http2()
24282/// # .build()
24283/// # );
24284/// # let mut hub = Bigquery::new(client, auth);
24285/// // As the method needs a request, you would usually fill it with the desired information
24286/// // into the respective structure. Some of the parts shown here might not be applicable !
24287/// // Values shown here are possibly random and not representative !
24288/// let mut req = TestIamPermissionsRequest::default();
24289///
24290/// // You can configure optional parameters by calling the respective setters at will, and
24291/// // execute the final call using `doit()`.
24292/// // Values shown here are possibly random and not representative !
24293/// let result = hub.tables().test_iam_permissions(req, "resource")
24294/// .doit().await;
24295/// # }
24296/// ```
24297pub struct TableTestIamPermissionCall<'a, C>
24298where
24299 C: 'a,
24300{
24301 hub: &'a Bigquery<C>,
24302 _request: TestIamPermissionsRequest,
24303 _resource: String,
24304 _delegate: Option<&'a mut dyn common::Delegate>,
24305 _additional_params: HashMap<String, String>,
24306 _scopes: BTreeSet<String>,
24307}
24308
24309impl<'a, C> common::CallBuilder for TableTestIamPermissionCall<'a, C> {}
24310
24311impl<'a, C> TableTestIamPermissionCall<'a, C>
24312where
24313 C: common::Connector,
24314{
24315 /// Perform the operation you have build so far.
24316 pub async fn doit(mut self) -> common::Result<(common::Response, TestIamPermissionsResponse)> {
24317 use std::borrow::Cow;
24318 use std::io::{Read, Seek};
24319
24320 use common::{url::Params, ToParts};
24321 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
24322
24323 let mut dd = common::DefaultDelegate;
24324 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
24325 dlg.begin(common::MethodInfo {
24326 id: "bigquery.tables.testIamPermissions",
24327 http_method: hyper::Method::POST,
24328 });
24329
24330 for &field in ["alt", "resource"].iter() {
24331 if self._additional_params.contains_key(field) {
24332 dlg.finished(false);
24333 return Err(common::Error::FieldClash(field));
24334 }
24335 }
24336
24337 let mut params = Params::with_capacity(4 + self._additional_params.len());
24338 params.push("resource", self._resource);
24339
24340 params.extend(self._additional_params.iter());
24341
24342 params.push("alt", "json");
24343 let mut url = self.hub._base_url.clone() + "{+resource}:testIamPermissions";
24344 if self._scopes.is_empty() {
24345 self._scopes
24346 .insert(Scope::CloudPlatformReadOnly.as_ref().to_string());
24347 }
24348
24349 #[allow(clippy::single_element_loop)]
24350 for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
24351 url = params.uri_replacement(url, param_name, find_this, true);
24352 }
24353 {
24354 let to_remove = ["resource"];
24355 params.remove_params(&to_remove);
24356 }
24357
24358 let url = params.parse_with_url(&url);
24359
24360 let mut json_mime_type = mime::APPLICATION_JSON;
24361 let mut request_value_reader = {
24362 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
24363 common::remove_json_null_values(&mut value);
24364 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
24365 serde_json::to_writer(&mut dst, &value).unwrap();
24366 dst
24367 };
24368 let request_size = request_value_reader
24369 .seek(std::io::SeekFrom::End(0))
24370 .unwrap();
24371 request_value_reader
24372 .seek(std::io::SeekFrom::Start(0))
24373 .unwrap();
24374
24375 loop {
24376 let token = match self
24377 .hub
24378 .auth
24379 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
24380 .await
24381 {
24382 Ok(token) => token,
24383 Err(e) => match dlg.token(e) {
24384 Ok(token) => token,
24385 Err(e) => {
24386 dlg.finished(false);
24387 return Err(common::Error::MissingToken(e));
24388 }
24389 },
24390 };
24391 request_value_reader
24392 .seek(std::io::SeekFrom::Start(0))
24393 .unwrap();
24394 let mut req_result = {
24395 let client = &self.hub.client;
24396 dlg.pre_request();
24397 let mut req_builder = hyper::Request::builder()
24398 .method(hyper::Method::POST)
24399 .uri(url.as_str())
24400 .header(USER_AGENT, self.hub._user_agent.clone());
24401
24402 if let Some(token) = token.as_ref() {
24403 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
24404 }
24405
24406 let request = req_builder
24407 .header(CONTENT_TYPE, json_mime_type.to_string())
24408 .header(CONTENT_LENGTH, request_size as u64)
24409 .body(common::to_body(
24410 request_value_reader.get_ref().clone().into(),
24411 ));
24412
24413 client.request(request.unwrap()).await
24414 };
24415
24416 match req_result {
24417 Err(err) => {
24418 if let common::Retry::After(d) = dlg.http_error(&err) {
24419 sleep(d).await;
24420 continue;
24421 }
24422 dlg.finished(false);
24423 return Err(common::Error::HttpError(err));
24424 }
24425 Ok(res) => {
24426 let (mut parts, body) = res.into_parts();
24427 let mut body = common::Body::new(body);
24428 if !parts.status.is_success() {
24429 let bytes = common::to_bytes(body).await.unwrap_or_default();
24430 let error = serde_json::from_str(&common::to_string(&bytes));
24431 let response = common::to_response(parts, bytes.into());
24432
24433 if let common::Retry::After(d) =
24434 dlg.http_failure(&response, error.as_ref().ok())
24435 {
24436 sleep(d).await;
24437 continue;
24438 }
24439
24440 dlg.finished(false);
24441
24442 return Err(match error {
24443 Ok(value) => common::Error::BadRequest(value),
24444 _ => common::Error::Failure(response),
24445 });
24446 }
24447 let response = {
24448 let bytes = common::to_bytes(body).await.unwrap_or_default();
24449 let encoded = common::to_string(&bytes);
24450 match serde_json::from_str(&encoded) {
24451 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
24452 Err(error) => {
24453 dlg.response_json_decode_error(&encoded, &error);
24454 return Err(common::Error::JsonDecodeError(
24455 encoded.to_string(),
24456 error,
24457 ));
24458 }
24459 }
24460 };
24461
24462 dlg.finished(true);
24463 return Ok(response);
24464 }
24465 }
24466 }
24467 }
24468
24469 ///
24470 /// Sets the *request* property to the given value.
24471 ///
24472 /// Even though the property as already been set when instantiating this call,
24473 /// we provide this method for API completeness.
24474 pub fn request(
24475 mut self,
24476 new_value: TestIamPermissionsRequest,
24477 ) -> TableTestIamPermissionCall<'a, C> {
24478 self._request = new_value;
24479 self
24480 }
24481 /// REQUIRED: The resource for which the policy detail is being requested. See [Resource names](https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
24482 ///
24483 /// Sets the *resource* path property to the given value.
24484 ///
24485 /// Even though the property as already been set when instantiating this call,
24486 /// we provide this method for API completeness.
24487 pub fn resource(mut self, new_value: &str) -> TableTestIamPermissionCall<'a, C> {
24488 self._resource = new_value.to_string();
24489 self
24490 }
24491 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
24492 /// while executing the actual API request.
24493 ///
24494 /// ````text
24495 /// It should be used to handle progress information, and to implement a certain level of resilience.
24496 /// ````
24497 ///
24498 /// Sets the *delegate* property to the given value.
24499 pub fn delegate(
24500 mut self,
24501 new_value: &'a mut dyn common::Delegate,
24502 ) -> TableTestIamPermissionCall<'a, C> {
24503 self._delegate = Some(new_value);
24504 self
24505 }
24506
24507 /// Set any additional parameter of the query string used in the request.
24508 /// It should be used to set parameters which are not yet available through their own
24509 /// setters.
24510 ///
24511 /// Please note that this method must not be used to set any of the known parameters
24512 /// which have their own setter method. If done anyway, the request will fail.
24513 ///
24514 /// # Additional Parameters
24515 ///
24516 /// * *$.xgafv* (query-string) - V1 error format.
24517 /// * *access_token* (query-string) - OAuth access token.
24518 /// * *alt* (query-string) - Data format for response.
24519 /// * *callback* (query-string) - JSONP
24520 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
24521 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
24522 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
24523 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
24524 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
24525 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
24526 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
24527 pub fn param<T>(mut self, name: T, value: T) -> TableTestIamPermissionCall<'a, C>
24528 where
24529 T: AsRef<str>,
24530 {
24531 self._additional_params
24532 .insert(name.as_ref().to_string(), value.as_ref().to_string());
24533 self
24534 }
24535
24536 /// Identifies the authorization scope for the method you are building.
24537 ///
24538 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
24539 /// [`Scope::CloudPlatformReadOnly`].
24540 ///
24541 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
24542 /// tokens for more than one scope.
24543 ///
24544 /// Usually there is more than one suitable scope to authorize an operation, some of which may
24545 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
24546 /// sufficient, a read-write scope will do as well.
24547 pub fn add_scope<St>(mut self, scope: St) -> TableTestIamPermissionCall<'a, C>
24548 where
24549 St: AsRef<str>,
24550 {
24551 self._scopes.insert(String::from(scope.as_ref()));
24552 self
24553 }
24554 /// Identifies the authorization scope(s) for the method you are building.
24555 ///
24556 /// See [`Self::add_scope()`] for details.
24557 pub fn add_scopes<I, St>(mut self, scopes: I) -> TableTestIamPermissionCall<'a, C>
24558 where
24559 I: IntoIterator<Item = St>,
24560 St: AsRef<str>,
24561 {
24562 self._scopes
24563 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
24564 self
24565 }
24566
24567 /// Removes all scopes, and no default scope will be used either.
24568 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
24569 /// for details).
24570 pub fn clear_scopes(mut self) -> TableTestIamPermissionCall<'a, C> {
24571 self._scopes.clear();
24572 self
24573 }
24574}
24575
24576/// Updates information in an existing table. The update method replaces the entire Table resource, whereas the patch method only replaces fields that are provided in the submitted Table resource.
24577///
24578/// A builder for the *update* method supported by a *table* resource.
24579/// It is not used directly, but through a [`TableMethods`] instance.
24580///
24581/// # Example
24582///
24583/// Instantiate a resource method builder
24584///
24585/// ```test_harness,no_run
24586/// # extern crate hyper;
24587/// # extern crate hyper_rustls;
24588/// # extern crate google_bigquery2 as bigquery2;
24589/// use bigquery2::api::Table;
24590/// # async fn dox() {
24591/// # use bigquery2::{Bigquery, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
24592///
24593/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
24594/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
24595/// # .with_native_roots()
24596/// # .unwrap()
24597/// # .https_only()
24598/// # .enable_http2()
24599/// # .build();
24600///
24601/// # let executor = hyper_util::rt::TokioExecutor::new();
24602/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
24603/// # secret,
24604/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
24605/// # yup_oauth2::client::CustomHyperClientBuilder::from(
24606/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
24607/// # ),
24608/// # ).build().await.unwrap();
24609///
24610/// # let client = hyper_util::client::legacy::Client::builder(
24611/// # hyper_util::rt::TokioExecutor::new()
24612/// # )
24613/// # .build(
24614/// # hyper_rustls::HttpsConnectorBuilder::new()
24615/// # .with_native_roots()
24616/// # .unwrap()
24617/// # .https_or_http()
24618/// # .enable_http2()
24619/// # .build()
24620/// # );
24621/// # let mut hub = Bigquery::new(client, auth);
24622/// // As the method needs a request, you would usually fill it with the desired information
24623/// // into the respective structure. Some of the parts shown here might not be applicable !
24624/// // Values shown here are possibly random and not representative !
24625/// let mut req = Table::default();
24626///
24627/// // You can configure optional parameters by calling the respective setters at will, and
24628/// // execute the final call using `doit()`.
24629/// // Values shown here are possibly random and not representative !
24630/// let result = hub.tables().update(req, "projectId", "datasetId", "tableId")
24631/// .autodetect_schema(true)
24632/// .doit().await;
24633/// # }
24634/// ```
24635pub struct TableUpdateCall<'a, C>
24636where
24637 C: 'a,
24638{
24639 hub: &'a Bigquery<C>,
24640 _request: Table,
24641 _project_id: String,
24642 _dataset_id: String,
24643 _table_id: String,
24644 _autodetect_schema: Option<bool>,
24645 _delegate: Option<&'a mut dyn common::Delegate>,
24646 _additional_params: HashMap<String, String>,
24647 _scopes: BTreeSet<String>,
24648}
24649
24650impl<'a, C> common::CallBuilder for TableUpdateCall<'a, C> {}
24651
24652impl<'a, C> TableUpdateCall<'a, C>
24653where
24654 C: common::Connector,
24655{
24656 /// Perform the operation you have build so far.
24657 pub async fn doit(mut self) -> common::Result<(common::Response, Table)> {
24658 use std::borrow::Cow;
24659 use std::io::{Read, Seek};
24660
24661 use common::{url::Params, ToParts};
24662 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
24663
24664 let mut dd = common::DefaultDelegate;
24665 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
24666 dlg.begin(common::MethodInfo {
24667 id: "bigquery.tables.update",
24668 http_method: hyper::Method::PUT,
24669 });
24670
24671 for &field in [
24672 "alt",
24673 "projectId",
24674 "datasetId",
24675 "tableId",
24676 "autodetect_schema",
24677 ]
24678 .iter()
24679 {
24680 if self._additional_params.contains_key(field) {
24681 dlg.finished(false);
24682 return Err(common::Error::FieldClash(field));
24683 }
24684 }
24685
24686 let mut params = Params::with_capacity(7 + self._additional_params.len());
24687 params.push("projectId", self._project_id);
24688 params.push("datasetId", self._dataset_id);
24689 params.push("tableId", self._table_id);
24690 if let Some(value) = self._autodetect_schema.as_ref() {
24691 params.push("autodetect_schema", value.to_string());
24692 }
24693
24694 params.extend(self._additional_params.iter());
24695
24696 params.push("alt", "json");
24697 let mut url = self.hub._base_url.clone()
24698 + "projects/{+projectId}/datasets/{+datasetId}/tables/{+tableId}";
24699 if self._scopes.is_empty() {
24700 self._scopes
24701 .insert(Scope::CloudPlatform.as_ref().to_string());
24702 }
24703
24704 #[allow(clippy::single_element_loop)]
24705 for &(find_this, param_name) in [
24706 ("{+projectId}", "projectId"),
24707 ("{+datasetId}", "datasetId"),
24708 ("{+tableId}", "tableId"),
24709 ]
24710 .iter()
24711 {
24712 url = params.uri_replacement(url, param_name, find_this, true);
24713 }
24714 {
24715 let to_remove = ["tableId", "datasetId", "projectId"];
24716 params.remove_params(&to_remove);
24717 }
24718
24719 let url = params.parse_with_url(&url);
24720
24721 let mut json_mime_type = mime::APPLICATION_JSON;
24722 let mut request_value_reader = {
24723 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
24724 common::remove_json_null_values(&mut value);
24725 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
24726 serde_json::to_writer(&mut dst, &value).unwrap();
24727 dst
24728 };
24729 let request_size = request_value_reader
24730 .seek(std::io::SeekFrom::End(0))
24731 .unwrap();
24732 request_value_reader
24733 .seek(std::io::SeekFrom::Start(0))
24734 .unwrap();
24735
24736 loop {
24737 let token = match self
24738 .hub
24739 .auth
24740 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
24741 .await
24742 {
24743 Ok(token) => token,
24744 Err(e) => match dlg.token(e) {
24745 Ok(token) => token,
24746 Err(e) => {
24747 dlg.finished(false);
24748 return Err(common::Error::MissingToken(e));
24749 }
24750 },
24751 };
24752 request_value_reader
24753 .seek(std::io::SeekFrom::Start(0))
24754 .unwrap();
24755 let mut req_result = {
24756 let client = &self.hub.client;
24757 dlg.pre_request();
24758 let mut req_builder = hyper::Request::builder()
24759 .method(hyper::Method::PUT)
24760 .uri(url.as_str())
24761 .header(USER_AGENT, self.hub._user_agent.clone());
24762
24763 if let Some(token) = token.as_ref() {
24764 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
24765 }
24766
24767 let request = req_builder
24768 .header(CONTENT_TYPE, json_mime_type.to_string())
24769 .header(CONTENT_LENGTH, request_size as u64)
24770 .body(common::to_body(
24771 request_value_reader.get_ref().clone().into(),
24772 ));
24773
24774 client.request(request.unwrap()).await
24775 };
24776
24777 match req_result {
24778 Err(err) => {
24779 if let common::Retry::After(d) = dlg.http_error(&err) {
24780 sleep(d).await;
24781 continue;
24782 }
24783 dlg.finished(false);
24784 return Err(common::Error::HttpError(err));
24785 }
24786 Ok(res) => {
24787 let (mut parts, body) = res.into_parts();
24788 let mut body = common::Body::new(body);
24789 if !parts.status.is_success() {
24790 let bytes = common::to_bytes(body).await.unwrap_or_default();
24791 let error = serde_json::from_str(&common::to_string(&bytes));
24792 let response = common::to_response(parts, bytes.into());
24793
24794 if let common::Retry::After(d) =
24795 dlg.http_failure(&response, error.as_ref().ok())
24796 {
24797 sleep(d).await;
24798 continue;
24799 }
24800
24801 dlg.finished(false);
24802
24803 return Err(match error {
24804 Ok(value) => common::Error::BadRequest(value),
24805 _ => common::Error::Failure(response),
24806 });
24807 }
24808 let response = {
24809 let bytes = common::to_bytes(body).await.unwrap_or_default();
24810 let encoded = common::to_string(&bytes);
24811 match serde_json::from_str(&encoded) {
24812 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
24813 Err(error) => {
24814 dlg.response_json_decode_error(&encoded, &error);
24815 return Err(common::Error::JsonDecodeError(
24816 encoded.to_string(),
24817 error,
24818 ));
24819 }
24820 }
24821 };
24822
24823 dlg.finished(true);
24824 return Ok(response);
24825 }
24826 }
24827 }
24828 }
24829
24830 ///
24831 /// Sets the *request* property to the given value.
24832 ///
24833 /// Even though the property as already been set when instantiating this call,
24834 /// we provide this method for API completeness.
24835 pub fn request(mut self, new_value: Table) -> TableUpdateCall<'a, C> {
24836 self._request = new_value;
24837 self
24838 }
24839 /// Required. Project ID of the table to update
24840 ///
24841 /// Sets the *project id* path property to the given value.
24842 ///
24843 /// Even though the property as already been set when instantiating this call,
24844 /// we provide this method for API completeness.
24845 pub fn project_id(mut self, new_value: &str) -> TableUpdateCall<'a, C> {
24846 self._project_id = new_value.to_string();
24847 self
24848 }
24849 /// Required. Dataset ID of the table to update
24850 ///
24851 /// Sets the *dataset id* path property to the given value.
24852 ///
24853 /// Even though the property as already been set when instantiating this call,
24854 /// we provide this method for API completeness.
24855 pub fn dataset_id(mut self, new_value: &str) -> TableUpdateCall<'a, C> {
24856 self._dataset_id = new_value.to_string();
24857 self
24858 }
24859 /// Required. Table ID of the table to update
24860 ///
24861 /// Sets the *table id* path property to the given value.
24862 ///
24863 /// Even though the property as already been set when instantiating this call,
24864 /// we provide this method for API completeness.
24865 pub fn table_id(mut self, new_value: &str) -> TableUpdateCall<'a, C> {
24866 self._table_id = new_value.to_string();
24867 self
24868 }
24869 /// Optional. When true will autodetect schema, else will keep original schema
24870 ///
24871 /// Sets the *autodetect_schema* query property to the given value.
24872 pub fn autodetect_schema(mut self, new_value: bool) -> TableUpdateCall<'a, C> {
24873 self._autodetect_schema = Some(new_value);
24874 self
24875 }
24876 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
24877 /// while executing the actual API request.
24878 ///
24879 /// ````text
24880 /// It should be used to handle progress information, and to implement a certain level of resilience.
24881 /// ````
24882 ///
24883 /// Sets the *delegate* property to the given value.
24884 pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> TableUpdateCall<'a, C> {
24885 self._delegate = Some(new_value);
24886 self
24887 }
24888
24889 /// Set any additional parameter of the query string used in the request.
24890 /// It should be used to set parameters which are not yet available through their own
24891 /// setters.
24892 ///
24893 /// Please note that this method must not be used to set any of the known parameters
24894 /// which have their own setter method. If done anyway, the request will fail.
24895 ///
24896 /// # Additional Parameters
24897 ///
24898 /// * *$.xgafv* (query-string) - V1 error format.
24899 /// * *access_token* (query-string) - OAuth access token.
24900 /// * *alt* (query-string) - Data format for response.
24901 /// * *callback* (query-string) - JSONP
24902 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
24903 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
24904 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
24905 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
24906 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
24907 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
24908 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
24909 pub fn param<T>(mut self, name: T, value: T) -> TableUpdateCall<'a, C>
24910 where
24911 T: AsRef<str>,
24912 {
24913 self._additional_params
24914 .insert(name.as_ref().to_string(), value.as_ref().to_string());
24915 self
24916 }
24917
24918 /// Identifies the authorization scope for the method you are building.
24919 ///
24920 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
24921 /// [`Scope::CloudPlatform`].
24922 ///
24923 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
24924 /// tokens for more than one scope.
24925 ///
24926 /// Usually there is more than one suitable scope to authorize an operation, some of which may
24927 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
24928 /// sufficient, a read-write scope will do as well.
24929 pub fn add_scope<St>(mut self, scope: St) -> TableUpdateCall<'a, C>
24930 where
24931 St: AsRef<str>,
24932 {
24933 self._scopes.insert(String::from(scope.as_ref()));
24934 self
24935 }
24936 /// Identifies the authorization scope(s) for the method you are building.
24937 ///
24938 /// See [`Self::add_scope()`] for details.
24939 pub fn add_scopes<I, St>(mut self, scopes: I) -> TableUpdateCall<'a, C>
24940 where
24941 I: IntoIterator<Item = St>,
24942 St: AsRef<str>,
24943 {
24944 self._scopes
24945 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
24946 self
24947 }
24948
24949 /// Removes all scopes, and no default scope will be used either.
24950 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
24951 /// for details).
24952 pub fn clear_scopes(mut self) -> TableUpdateCall<'a, C> {
24953 self._scopes.clear();
24954 self
24955 }
24956}