google_bigquerydatatransfer1/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 Bigquery,
18
19 /// See, edit, configure, and delete your Google Cloud data and see the email address for your Google Account.
20 CloudPlatform,
21
22 /// View your data across Google Cloud services and see the email address of your Google Account
23 CloudPlatformReadOnly,
24}
25
26impl AsRef<str> for Scope {
27 fn as_ref(&self) -> &str {
28 match *self {
29 Scope::Bigquery => "https://www.googleapis.com/auth/bigquery",
30 Scope::CloudPlatform => "https://www.googleapis.com/auth/cloud-platform",
31 Scope::CloudPlatformReadOnly => {
32 "https://www.googleapis.com/auth/cloud-platform.read-only"
33 }
34 }
35 }
36}
37
38#[allow(clippy::derivable_impls)]
39impl Default for Scope {
40 fn default() -> Scope {
41 Scope::Bigquery
42 }
43}
44
45// ########
46// HUB ###
47// ######
48
49/// Central instance to access all BigQueryDataTransfer related resource activities
50///
51/// # Examples
52///
53/// Instantiate a new hub
54///
55/// ```test_harness,no_run
56/// extern crate hyper;
57/// extern crate hyper_rustls;
58/// extern crate google_bigquerydatatransfer1 as bigquerydatatransfer1;
59/// use bigquerydatatransfer1::api::EnrollDataSourcesRequest;
60/// use bigquerydatatransfer1::{Result, Error};
61/// # async fn dox() {
62/// use bigquerydatatransfer1::{BigQueryDataTransfer, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
63///
64/// // Get an ApplicationSecret instance by some means. It contains the `client_id` and
65/// // `client_secret`, among other things.
66/// let secret: yup_oauth2::ApplicationSecret = Default::default();
67/// // Instantiate the authenticator. It will choose a suitable authentication flow for you,
68/// // unless you replace `None` with the desired Flow.
69/// // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about
70/// // what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and
71/// // retrieve them from storage.
72/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
73/// .with_native_roots()
74/// .unwrap()
75/// .https_only()
76/// .enable_http2()
77/// .build();
78///
79/// let executor = hyper_util::rt::TokioExecutor::new();
80/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
81/// secret,
82/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
83/// yup_oauth2::client::CustomHyperClientBuilder::from(
84/// hyper_util::client::legacy::Client::builder(executor).build(connector),
85/// ),
86/// ).build().await.unwrap();
87///
88/// let client = hyper_util::client::legacy::Client::builder(
89/// hyper_util::rt::TokioExecutor::new()
90/// )
91/// .build(
92/// hyper_rustls::HttpsConnectorBuilder::new()
93/// .with_native_roots()
94/// .unwrap()
95/// .https_or_http()
96/// .enable_http2()
97/// .build()
98/// );
99/// let mut hub = BigQueryDataTransfer::new(client, auth);
100/// // As the method needs a request, you would usually fill it with the desired information
101/// // into the respective structure. Some of the parts shown here might not be applicable !
102/// // Values shown here are possibly random and not representative !
103/// let mut req = EnrollDataSourcesRequest::default();
104///
105/// // You can configure optional parameters by calling the respective setters at will, and
106/// // execute the final call using `doit()`.
107/// // Values shown here are possibly random and not representative !
108/// let result = hub.projects().locations_enroll_data_sources(req, "name")
109/// .doit().await;
110///
111/// match result {
112/// Err(e) => match e {
113/// // The Error enum provides details about what exactly happened.
114/// // You can also just use its `Debug`, `Display` or `Error` traits
115/// Error::HttpError(_)
116/// |Error::Io(_)
117/// |Error::MissingAPIKey
118/// |Error::MissingToken(_)
119/// |Error::Cancelled
120/// |Error::UploadSizeLimitExceeded(_, _)
121/// |Error::Failure(_)
122/// |Error::BadRequest(_)
123/// |Error::FieldClash(_)
124/// |Error::JsonDecodeError(_, _) => println!("{}", e),
125/// },
126/// Ok(res) => println!("Success: {:?}", res),
127/// }
128/// # }
129/// ```
130#[derive(Clone)]
131pub struct BigQueryDataTransfer<C> {
132 pub client: common::Client<C>,
133 pub auth: Box<dyn common::GetToken>,
134 _user_agent: String,
135 _base_url: String,
136 _root_url: String,
137}
138
139impl<C> common::Hub for BigQueryDataTransfer<C> {}
140
141impl<'a, C> BigQueryDataTransfer<C> {
142 pub fn new<A: 'static + common::GetToken>(
143 client: common::Client<C>,
144 auth: A,
145 ) -> BigQueryDataTransfer<C> {
146 BigQueryDataTransfer {
147 client,
148 auth: Box::new(auth),
149 _user_agent: "google-api-rust-client/7.0.0".to_string(),
150 _base_url: "https://bigquerydatatransfer.googleapis.com/".to_string(),
151 _root_url: "https://bigquerydatatransfer.googleapis.com/".to_string(),
152 }
153 }
154
155 pub fn projects(&'a self) -> ProjectMethods<'a, C> {
156 ProjectMethods { hub: self }
157 }
158
159 /// Set the user-agent header field to use in all requests to the server.
160 /// It defaults to `google-api-rust-client/7.0.0`.
161 ///
162 /// Returns the previously set user-agent.
163 pub fn user_agent(&mut self, agent_name: String) -> String {
164 std::mem::replace(&mut self._user_agent, agent_name)
165 }
166
167 /// Set the base url to use in all requests to the server.
168 /// It defaults to `https://bigquerydatatransfer.googleapis.com/`.
169 ///
170 /// Returns the previously set base url.
171 pub fn base_url(&mut self, new_base_url: String) -> String {
172 std::mem::replace(&mut self._base_url, new_base_url)
173 }
174
175 /// Set the root url to use in all requests to the server.
176 /// It defaults to `https://bigquerydatatransfer.googleapis.com/`.
177 ///
178 /// Returns the previously set root url.
179 pub fn root_url(&mut self, new_root_url: String) -> String {
180 std::mem::replace(&mut self._root_url, new_root_url)
181 }
182}
183
184// ############
185// SCHEMAS ###
186// ##########
187/// A request to determine whether the user has valid credentials. This method is used to limit the number of OAuth popups in the user interface. The user id is inferred from the API call context. If the data source has the Google+ authorization type, this method returns false, as it cannot be determined whether the credentials are already valid merely based on the user id.
188///
189/// # Activities
190///
191/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
192/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
193///
194/// * [data sources check valid creds projects](ProjectDataSourceCheckValidCredCall) (request)
195/// * [locations data sources check valid creds projects](ProjectLocationDataSourceCheckValidCredCall) (request)
196#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
197#[serde_with::serde_as]
198#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
199pub struct CheckValidCredsRequest {
200 _never_set: Option<bool>,
201}
202
203impl common::RequestValue for CheckValidCredsRequest {}
204
205/// A response indicating whether the credentials exist and are valid.
206///
207/// # Activities
208///
209/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
210/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
211///
212/// * [data sources check valid creds projects](ProjectDataSourceCheckValidCredCall) (response)
213/// * [locations data sources check valid creds projects](ProjectLocationDataSourceCheckValidCredCall) (response)
214#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
215#[serde_with::serde_as]
216#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
217pub struct CheckValidCredsResponse {
218 /// If set to `true`, the credentials exist and are valid.
219 #[serde(rename = "hasValidCreds")]
220 pub has_valid_creds: Option<bool>,
221}
222
223impl common::ResponseResult for CheckValidCredsResponse {}
224
225/// Defines the properties and custom parameters for a data source.
226///
227/// # Activities
228///
229/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
230/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
231///
232/// * [data sources get projects](ProjectDataSourceGetCall) (response)
233/// * [locations data sources get projects](ProjectLocationDataSourceGetCall) (response)
234#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
235#[serde_with::serde_as]
236#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
237pub struct DataSource {
238 /// Indicates the type of authorization.
239 #[serde(rename = "authorizationType")]
240 pub authorization_type: Option<String>,
241 /// Data source client id which should be used to receive refresh token.
242 #[serde(rename = "clientId")]
243 pub client_id: Option<String>,
244 /// Specifies whether the data source supports automatic data refresh for the past few days, and how it's supported. For some data sources, data might not be complete until a few days later, so it's useful to refresh data automatically.
245 #[serde(rename = "dataRefreshType")]
246 pub data_refresh_type: Option<String>,
247 /// Data source id.
248 #[serde(rename = "dataSourceId")]
249 pub data_source_id: Option<String>,
250 /// Default data refresh window on days. Only meaningful when `data_refresh_type` = `SLIDING_WINDOW`.
251 #[serde(rename = "defaultDataRefreshWindowDays")]
252 pub default_data_refresh_window_days: Option<i32>,
253 /// Default data transfer schedule. Examples of valid schedules include: `1st,3rd monday of month 15:30`, `every wed,fri of jan,jun 13:15`, and `first sunday of quarter 00:00`.
254 #[serde(rename = "defaultSchedule")]
255 pub default_schedule: Option<String>,
256 /// User friendly data source description string.
257 pub description: Option<String>,
258 /// User friendly data source name.
259 #[serde(rename = "displayName")]
260 pub display_name: Option<String>,
261 /// Url for the help document for this data source.
262 #[serde(rename = "helpUrl")]
263 pub help_url: Option<String>,
264 /// Disables backfilling and manual run scheduling for the data source.
265 #[serde(rename = "manualRunsDisabled")]
266 pub manual_runs_disabled: Option<bool>,
267 /// The minimum interval for scheduler to schedule runs.
268 #[serde(rename = "minimumScheduleInterval")]
269 #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
270 pub minimum_schedule_interval: Option<chrono::Duration>,
271 /// Output only. Data source resource name.
272 pub name: Option<String>,
273 /// Data source parameters.
274 pub parameters: Option<Vec<DataSourceParameter>>,
275 /// Api auth scopes for which refresh token needs to be obtained. These are scopes needed by a data source to prepare data and ingest them into BigQuery, e.g., https://www.googleapis.com/auth/bigquery
276 pub scopes: Option<Vec<String>>,
277 /// Specifies whether the data source supports a user defined schedule, or operates on the default schedule. When set to `true`, user can override default schedule.
278 #[serde(rename = "supportsCustomSchedule")]
279 pub supports_custom_schedule: Option<bool>,
280 /// Deprecated. This field has no effect.
281 #[serde(rename = "supportsMultipleTransfers")]
282 pub supports_multiple_transfers: Option<bool>,
283 /// Deprecated. This field has no effect.
284 #[serde(rename = "transferType")]
285 pub transfer_type: Option<String>,
286 /// The number of seconds to wait for an update from the data source before the Data Transfer Service marks the transfer as FAILED.
287 #[serde(rename = "updateDeadlineSeconds")]
288 pub update_deadline_seconds: Option<i32>,
289}
290
291impl common::ResponseResult for DataSource {}
292
293/// A parameter used to define custom fields in a data source definition.
294///
295/// This type is not used in any activity, and only used as *part* of another schema.
296///
297#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
298#[serde_with::serde_as]
299#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
300pub struct DataSourceParameter {
301 /// All possible values for the parameter.
302 #[serde(rename = "allowedValues")]
303 pub allowed_values: Option<Vec<String>>,
304 /// If true, it should not be used in new transfers, and it should not be visible to users.
305 pub deprecated: Option<bool>,
306 /// Parameter description.
307 pub description: Option<String>,
308 /// Parameter display name in the user interface.
309 #[serde(rename = "displayName")]
310 pub display_name: Option<String>,
311 /// Deprecated. This field has no effect.
312 pub fields: Option<Vec<DataSourceParameter>>,
313 /// Cannot be changed after initial creation.
314 pub immutable: Option<bool>,
315 /// For list parameters, the max size of the list.
316 #[serde(rename = "maxListSize")]
317 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
318 pub max_list_size: Option<i64>,
319 /// For integer and double values specifies maximum allowed value.
320 #[serde(rename = "maxValue")]
321 pub max_value: Option<f64>,
322 /// For integer and double values specifies minimum allowed value.
323 #[serde(rename = "minValue")]
324 pub min_value: Option<f64>,
325 /// Parameter identifier.
326 #[serde(rename = "paramId")]
327 pub param_id: Option<String>,
328 /// Deprecated. This field has no effect.
329 pub recurse: Option<bool>,
330 /// Deprecated. This field has no effect.
331 pub repeated: Option<bool>,
332 /// Is parameter required.
333 pub required: Option<bool>,
334 /// Parameter type.
335 #[serde(rename = "type")]
336 pub type_: Option<String>,
337 /// Description of the requirements for this field, in case the user input does not fulfill the regex pattern or min/max values.
338 #[serde(rename = "validationDescription")]
339 pub validation_description: Option<String>,
340 /// URL to a help document to further explain the naming requirements.
341 #[serde(rename = "validationHelpUrl")]
342 pub validation_help_url: Option<String>,
343 /// Regular expression which can be used for parameter validation.
344 #[serde(rename = "validationRegex")]
345 pub validation_regex: Option<String>,
346}
347
348impl common::Part for DataSourceParameter {}
349
350/// Represents preferences for sending email notifications for transfer run events.
351///
352/// This type is not used in any activity, and only used as *part* of another schema.
353///
354#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
355#[serde_with::serde_as]
356#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
357pub struct EmailPreferences {
358 /// If true, email notifications will be sent on transfer run failures.
359 #[serde(rename = "enableFailureEmail")]
360 pub enable_failure_email: Option<bool>,
361}
362
363impl common::Part for EmailPreferences {}
364
365/// A generic empty message that you can re-use to avoid defining duplicated empty messages in your APIs. A typical example is to use it as the request or the response type of an API method. For instance: service Foo { rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); }
366///
367/// # Activities
368///
369/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
370/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
371///
372/// * [locations transfer configs runs delete projects](ProjectLocationTransferConfigRunDeleteCall) (response)
373/// * [locations transfer configs delete projects](ProjectLocationTransferConfigDeleteCall) (response)
374/// * [locations enroll data sources projects](ProjectLocationEnrollDataSourceCall) (response)
375/// * [locations unenroll data sources projects](ProjectLocationUnenrollDataSourceCall) (response)
376/// * [transfer configs runs delete projects](ProjectTransferConfigRunDeleteCall) (response)
377/// * [transfer configs delete projects](ProjectTransferConfigDeleteCall) (response)
378/// * [enroll data sources projects](ProjectEnrollDataSourceCall) (response)
379#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
380#[serde_with::serde_as]
381#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
382pub struct Empty {
383 _never_set: Option<bool>,
384}
385
386impl common::ResponseResult for Empty {}
387
388/// Represents the encryption configuration for a transfer.
389///
390/// This type is not used in any activity, and only used as *part* of another schema.
391///
392#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
393#[serde_with::serde_as]
394#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
395pub struct EncryptionConfiguration {
396 /// The name of the KMS key used for encrypting BigQuery data.
397 #[serde(rename = "kmsKeyName")]
398 pub kms_key_name: Option<String>,
399}
400
401impl common::Part for EncryptionConfiguration {}
402
403/// A request to enroll a set of data sources so they are visible in the BigQuery UI’s `Transfer` tab.
404///
405/// # Activities
406///
407/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
408/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
409///
410/// * [locations enroll data sources projects](ProjectLocationEnrollDataSourceCall) (request)
411/// * [enroll data sources projects](ProjectEnrollDataSourceCall) (request)
412#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
413#[serde_with::serde_as]
414#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
415pub struct EnrollDataSourcesRequest {
416 /// Data sources that are enrolled. It is required to provide at least one data source id.
417 #[serde(rename = "dataSourceIds")]
418 pub data_source_ids: Option<Vec<String>>,
419}
420
421impl common::RequestValue for EnrollDataSourcesRequest {}
422
423/// Options customizing EventDriven transfers schedule.
424///
425/// This type is not used in any activity, and only used as *part* of another schema.
426///
427#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
428#[serde_with::serde_as]
429#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
430pub struct EventDrivenSchedule {
431 /// Pub/Sub subscription name used to receive events. Only Google Cloud Storage data source support this option. Format: projects/{project}/subscriptions/{subscription}
432 #[serde(rename = "pubsubSubscription")]
433 pub pubsub_subscription: Option<String>,
434}
435
436impl common::Part for EventDrivenSchedule {}
437
438/// Returns list of supported data sources and their metadata.
439///
440/// # Activities
441///
442/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
443/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
444///
445/// * [data sources list projects](ProjectDataSourceListCall) (response)
446/// * [locations data sources list projects](ProjectLocationDataSourceListCall) (response)
447#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
448#[serde_with::serde_as]
449#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
450pub struct ListDataSourcesResponse {
451 /// List of supported data sources and their transfer settings.
452 #[serde(rename = "dataSources")]
453 pub data_sources: Option<Vec<DataSource>>,
454 /// Output only. The next-pagination token. For multiple-page list results, this token can be used as the `ListDataSourcesRequest.page_token` to request the next page of list results.
455 #[serde(rename = "nextPageToken")]
456 pub next_page_token: Option<String>,
457}
458
459impl common::ResponseResult for ListDataSourcesResponse {}
460
461/// The response message for Locations.ListLocations.
462///
463/// # Activities
464///
465/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
466/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
467///
468/// * [locations list projects](ProjectLocationListCall) (response)
469#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
470#[serde_with::serde_as]
471#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
472pub struct ListLocationsResponse {
473 /// A list of locations that matches the specified filter in the request.
474 pub locations: Option<Vec<Location>>,
475 /// The standard List next-page token.
476 #[serde(rename = "nextPageToken")]
477 pub next_page_token: Option<String>,
478}
479
480impl common::ResponseResult for ListLocationsResponse {}
481
482/// The returned list of pipelines in the project.
483///
484/// # Activities
485///
486/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
487/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
488///
489/// * [locations transfer configs list projects](ProjectLocationTransferConfigListCall) (response)
490/// * [transfer configs list projects](ProjectTransferConfigListCall) (response)
491#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
492#[serde_with::serde_as]
493#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
494pub struct ListTransferConfigsResponse {
495 /// Output only. The next-pagination token. For multiple-page list results, this token can be used as the `ListTransferConfigsRequest.page_token` to request the next page of list results.
496 #[serde(rename = "nextPageToken")]
497 pub next_page_token: Option<String>,
498 /// Output only. The stored pipeline transfer configurations.
499 #[serde(rename = "transferConfigs")]
500 pub transfer_configs: Option<Vec<TransferConfig>>,
501}
502
503impl common::ResponseResult for ListTransferConfigsResponse {}
504
505/// The returned list transfer run messages.
506///
507/// # Activities
508///
509/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
510/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
511///
512/// * [locations transfer configs runs transfer logs list projects](ProjectLocationTransferConfigRunTransferLogListCall) (response)
513/// * [transfer configs runs transfer logs list projects](ProjectTransferConfigRunTransferLogListCall) (response)
514#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
515#[serde_with::serde_as]
516#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
517pub struct ListTransferLogsResponse {
518 /// Output only. The next-pagination token. For multiple-page list results, this token can be used as the `GetTransferRunLogRequest.page_token` to request the next page of list results.
519 #[serde(rename = "nextPageToken")]
520 pub next_page_token: Option<String>,
521 /// Output only. The stored pipeline transfer messages.
522 #[serde(rename = "transferMessages")]
523 pub transfer_messages: Option<Vec<TransferMessage>>,
524}
525
526impl common::ResponseResult for ListTransferLogsResponse {}
527
528/// The returned list of pipelines in the project.
529///
530/// # Activities
531///
532/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
533/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
534///
535/// * [locations transfer configs runs list projects](ProjectLocationTransferConfigRunListCall) (response)
536/// * [transfer configs runs list projects](ProjectTransferConfigRunListCall) (response)
537#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
538#[serde_with::serde_as]
539#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
540pub struct ListTransferRunsResponse {
541 /// Output only. The next-pagination token. For multiple-page list results, this token can be used as the `ListTransferRunsRequest.page_token` to request the next page of list results.
542 #[serde(rename = "nextPageToken")]
543 pub next_page_token: Option<String>,
544 /// Output only. The stored pipeline transfer runs.
545 #[serde(rename = "transferRuns")]
546 pub transfer_runs: Option<Vec<TransferRun>>,
547}
548
549impl common::ResponseResult for ListTransferRunsResponse {}
550
551/// A resource that represents a Google Cloud location.
552///
553/// # Activities
554///
555/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
556/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
557///
558/// * [locations get projects](ProjectLocationGetCall) (response)
559#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
560#[serde_with::serde_as]
561#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
562pub struct Location {
563 /// The friendly name for this location, typically a nearby city name. For example, "Tokyo".
564 #[serde(rename = "displayName")]
565 pub display_name: Option<String>,
566 /// Cross-service attributes for the location. For example {"cloud.googleapis.com/region": "us-east1"}
567 pub labels: Option<HashMap<String, String>>,
568 /// The canonical id for this location. For example: `"us-east1"`.
569 #[serde(rename = "locationId")]
570 pub location_id: Option<String>,
571 /// Service-specific metadata. For example the available capacity at the given location.
572 pub metadata: Option<HashMap<String, serde_json::Value>>,
573 /// Resource name for the location, which may vary between implementations. For example: `"projects/example-project/locations/us-east1"`
574 pub name: Option<String>,
575}
576
577impl common::ResponseResult for Location {}
578
579/// Options customizing manual transfers schedule.
580///
581/// This type is not used in any activity, and only used as *part* of another schema.
582///
583#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
584#[serde_with::serde_as]
585#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
586pub struct ManualSchedule {
587 _never_set: Option<bool>,
588}
589
590impl common::Part for ManualSchedule {}
591
592/// Options customizing the data transfer schedule.
593///
594/// This type is not used in any activity, and only used as *part* of another schema.
595///
596#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
597#[serde_with::serde_as]
598#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
599pub struct ScheduleOptions {
600 /// If true, automatic scheduling of data transfer runs for this configuration will be disabled. The runs can be started on ad-hoc basis using StartManualTransferRuns API. When automatic scheduling is disabled, the TransferConfig.schedule field will be ignored.
601 #[serde(rename = "disableAutoScheduling")]
602 pub disable_auto_scheduling: Option<bool>,
603 /// Defines time to stop scheduling transfer runs. A transfer run cannot be scheduled at or after the end time. The end time can be changed at any moment. The time when a data transfer can be triggered manually is not limited by this option.
604 #[serde(rename = "endTime")]
605 pub end_time: Option<chrono::DateTime<chrono::offset::Utc>>,
606 /// Specifies time to start scheduling transfer runs. The first run will be scheduled at or after the start time according to a recurrence pattern defined in the schedule string. The start time can be changed at any moment. The time when a data transfer can be triggered manually is not limited by this option.
607 #[serde(rename = "startTime")]
608 pub start_time: Option<chrono::DateTime<chrono::offset::Utc>>,
609}
610
611impl common::Part for ScheduleOptions {}
612
613/// V2 options customizing different types of data transfer schedule. This field supports existing time-based and manual transfer schedule. Also supports Event-Driven transfer schedule. ScheduleOptionsV2 cannot be used together with ScheduleOptions/Schedule.
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 ScheduleOptionsV2 {
621 /// Event driven transfer schedule options. If set, the transfer will be scheduled upon events arrial.
622 #[serde(rename = "eventDrivenSchedule")]
623 pub event_driven_schedule: Option<EventDrivenSchedule>,
624 /// Manual transfer schedule. If set, the transfer run will not be auto-scheduled by the system, unless the client invokes StartManualTransferRuns. This is equivalent to disable_auto_scheduling = true.
625 #[serde(rename = "manualSchedule")]
626 pub manual_schedule: Option<ManualSchedule>,
627 /// Time based transfer schedule options. This is the default schedule option.
628 #[serde(rename = "timeBasedSchedule")]
629 pub time_based_schedule: Option<TimeBasedSchedule>,
630}
631
632impl common::Part for ScheduleOptionsV2 {}
633
634/// A request to schedule transfer runs for a time range.
635///
636/// # Activities
637///
638/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
639/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
640///
641/// * [locations transfer configs schedule runs projects](ProjectLocationTransferConfigScheduleRunCall) (request)
642/// * [transfer configs schedule runs projects](ProjectTransferConfigScheduleRunCall) (request)
643#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
644#[serde_with::serde_as]
645#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
646pub struct ScheduleTransferRunsRequest {
647 /// Required. End time of the range of transfer runs. For example, `"2017-05-30T00:00:00+00:00"`.
648 #[serde(rename = "endTime")]
649 pub end_time: Option<chrono::DateTime<chrono::offset::Utc>>,
650 /// Required. Start time of the range of transfer runs. For example, `"2017-05-25T00:00:00+00:00"`.
651 #[serde(rename = "startTime")]
652 pub start_time: Option<chrono::DateTime<chrono::offset::Utc>>,
653}
654
655impl common::RequestValue for ScheduleTransferRunsRequest {}
656
657/// A response to schedule transfer runs for a time range.
658///
659/// # Activities
660///
661/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
662/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
663///
664/// * [locations transfer configs schedule runs projects](ProjectLocationTransferConfigScheduleRunCall) (response)
665/// * [transfer configs schedule runs projects](ProjectTransferConfigScheduleRunCall) (response)
666#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
667#[serde_with::serde_as]
668#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
669pub struct ScheduleTransferRunsResponse {
670 /// The transfer runs that were scheduled.
671 pub runs: Option<Vec<TransferRun>>,
672}
673
674impl common::ResponseResult for ScheduleTransferRunsResponse {}
675
676/// A request to start manual transfer runs.
677///
678/// # Activities
679///
680/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
681/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
682///
683/// * [locations transfer configs start manual runs projects](ProjectLocationTransferConfigStartManualRunCall) (request)
684/// * [transfer configs start manual runs projects](ProjectTransferConfigStartManualRunCall) (request)
685#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
686#[serde_with::serde_as]
687#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
688pub struct StartManualTransferRunsRequest {
689 /// A run_time timestamp for historical data files or reports that are scheduled to be transferred by the scheduled transfer run. requested_run_time must be a past time and cannot include future time values.
690 #[serde(rename = "requestedRunTime")]
691 pub requested_run_time: Option<chrono::DateTime<chrono::offset::Utc>>,
692 /// A time_range start and end timestamp for historical data files or reports that are scheduled to be transferred by the scheduled transfer run. requested_time_range must be a past time and cannot include future time values.
693 #[serde(rename = "requestedTimeRange")]
694 pub requested_time_range: Option<TimeRange>,
695}
696
697impl common::RequestValue for StartManualTransferRunsRequest {}
698
699/// A response to start manual transfer runs.
700///
701/// # Activities
702///
703/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
704/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
705///
706/// * [locations transfer configs start manual runs projects](ProjectLocationTransferConfigStartManualRunCall) (response)
707/// * [transfer configs start manual runs projects](ProjectTransferConfigStartManualRunCall) (response)
708#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
709#[serde_with::serde_as]
710#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
711pub struct StartManualTransferRunsResponse {
712 /// The transfer runs that were created.
713 pub runs: Option<Vec<TransferRun>>,
714}
715
716impl common::ResponseResult for StartManualTransferRunsResponse {}
717
718/// The `Status` type defines a logical error model that is suitable for different programming environments, including REST APIs and RPC APIs. It is used by [gRPC](https://github.com/grpc). Each `Status` message contains three pieces of data: error code, error message, and error details. You can find out more about this error model and how to work with it in the [API Design Guide](https://cloud.google.com/apis/design/errors).
719///
720/// This type is not used in any activity, and only used as *part* of another schema.
721///
722#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
723#[serde_with::serde_as]
724#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
725pub struct Status {
726 /// The status code, which should be an enum value of google.rpc.Code.
727 pub code: Option<i32>,
728 /// A list of messages that carry the error details. There is a common set of message types for APIs to use.
729 pub details: Option<Vec<HashMap<String, serde_json::Value>>>,
730 /// A developer-facing error message, which should be in English. Any user-facing error message should be localized and sent in the google.rpc.Status.details field, or localized by the client.
731 pub message: Option<String>,
732}
733
734impl common::Part for Status {}
735
736/// Options customizing the time based transfer schedule. Options are migrated from the original ScheduleOptions message.
737///
738/// This type is not used in any activity, and only used as *part* of another schema.
739///
740#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
741#[serde_with::serde_as]
742#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
743pub struct TimeBasedSchedule {
744 /// Defines time to stop scheduling transfer runs. A transfer run cannot be scheduled at or after the end time. The end time can be changed at any moment.
745 #[serde(rename = "endTime")]
746 pub end_time: Option<chrono::DateTime<chrono::offset::Utc>>,
747 /// Data transfer schedule. If the data source does not support a custom schedule, this should be empty. If it is empty, the default value for the data source will be used. The specified times are in UTC. Examples of valid format: `1st,3rd monday of month 15:30`, `every wed,fri of jan,jun 13:15`, and `first sunday of quarter 00:00`. See more explanation about the format here: https://cloud.google.com/appengine/docs/flexible/python/scheduling-jobs-with-cron-yaml#the_schedule_format NOTE: The minimum interval time between recurring transfers depends on the data source; refer to the documentation for your data source.
748 pub schedule: Option<String>,
749 /// Specifies time to start scheduling transfer runs. The first run will be scheduled at or after the start time according to a recurrence pattern defined in the schedule string. The start time can be changed at any moment.
750 #[serde(rename = "startTime")]
751 pub start_time: Option<chrono::DateTime<chrono::offset::Utc>>,
752}
753
754impl common::Part for TimeBasedSchedule {}
755
756/// A specification for a time range, this will request transfer runs with run_time between start_time (inclusive) and end_time (exclusive).
757///
758/// This type is not used in any activity, and only used as *part* of another schema.
759///
760#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
761#[serde_with::serde_as]
762#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
763pub struct TimeRange {
764 /// End time of the range of transfer runs. For example, `"2017-05-30T00:00:00+00:00"`. The end_time must not be in the future. Creates transfer runs where run_time is in the range between start_time (inclusive) and end_time (exclusive).
765 #[serde(rename = "endTime")]
766 pub end_time: Option<chrono::DateTime<chrono::offset::Utc>>,
767 /// Start time of the range of transfer runs. For example, `"2017-05-25T00:00:00+00:00"`. The start_time must be strictly less than the end_time. Creates transfer runs where run_time is in the range between start_time (inclusive) and end_time (exclusive).
768 #[serde(rename = "startTime")]
769 pub start_time: Option<chrono::DateTime<chrono::offset::Utc>>,
770}
771
772impl common::Part for TimeRange {}
773
774/// Represents a data transfer configuration. A transfer configuration contains all metadata needed to perform a data transfer. For example, `destination_dataset_id` specifies where data should be stored. When a new transfer configuration is created, the specified `destination_dataset_id` is created when needed and shared with the appropriate data source service account.
775///
776/// # Activities
777///
778/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
779/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
780///
781/// * [locations transfer configs create projects](ProjectLocationTransferConfigCreateCall) (request|response)
782/// * [locations transfer configs get projects](ProjectLocationTransferConfigGetCall) (response)
783/// * [locations transfer configs patch projects](ProjectLocationTransferConfigPatchCall) (request|response)
784/// * [transfer configs create projects](ProjectTransferConfigCreateCall) (request|response)
785/// * [transfer configs get projects](ProjectTransferConfigGetCall) (response)
786/// * [transfer configs patch projects](ProjectTransferConfigPatchCall) (request|response)
787#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
788#[serde_with::serde_as]
789#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
790pub struct TransferConfig {
791 /// The number of days to look back to automatically refresh the data. For example, if `data_refresh_window_days = 10`, then every day BigQuery reingests data for [today-10, today-1], rather than ingesting data for just [today-1]. Only valid if the data source supports the feature. Set the value to 0 to use the default value.
792 #[serde(rename = "dataRefreshWindowDays")]
793 pub data_refresh_window_days: Option<i32>,
794 /// Data source ID. This cannot be changed once data transfer is created. The full list of available data source IDs can be returned through an API call: https://cloud.google.com/bigquery-transfer/docs/reference/datatransfer/rest/v1/projects.locations.dataSources/list
795 #[serde(rename = "dataSourceId")]
796 pub data_source_id: Option<String>,
797 /// Output only. Region in which BigQuery dataset is located.
798 #[serde(rename = "datasetRegion")]
799 pub dataset_region: Option<String>,
800 /// The BigQuery target dataset id.
801 #[serde(rename = "destinationDatasetId")]
802 pub destination_dataset_id: Option<String>,
803 /// Is this config disabled. When set to true, no runs will be scheduled for this transfer config.
804 pub disabled: Option<bool>,
805 /// User specified display name for the data transfer.
806 #[serde(rename = "displayName")]
807 pub display_name: Option<String>,
808 /// Email notifications will be sent according to these preferences to the email address of the user who owns this transfer config.
809 #[serde(rename = "emailPreferences")]
810 pub email_preferences: Option<EmailPreferences>,
811 /// The encryption configuration part. Currently, it is only used for the optional KMS key name. The BigQuery service account of your project must be granted permissions to use the key. Read methods will return the key name applied in effect. Write methods will apply the key if it is present, or otherwise try to apply project default keys if it is absent.
812 #[serde(rename = "encryptionConfiguration")]
813 pub encryption_configuration: Option<EncryptionConfiguration>,
814 /// Output only. Error code with detailed information about reason of the latest config failure.
815 pub error: Option<Status>,
816 /// The classification of the destination table.
817 #[serde(rename = "managedTableType")]
818 pub managed_table_type: Option<String>,
819 /// Identifier. The resource name of the transfer config. Transfer config names have the form either `projects/{project_id}/locations/{region}/transferConfigs/{config_id}` or `projects/{project_id}/transferConfigs/{config_id}`, where `config_id` is usually a UUID, even though it is not guaranteed or required. The name is ignored when creating a transfer config.
820 pub name: Option<String>,
821 /// Output only. Next time when data transfer will run.
822 #[serde(rename = "nextRunTime")]
823 pub next_run_time: Option<chrono::DateTime<chrono::offset::Utc>>,
824 /// Pub/Sub topic where notifications will be sent after transfer runs associated with this transfer config finish. The format for specifying a pubsub topic is: `projects/{project_id}/topics/{topic_id}`
825 #[serde(rename = "notificationPubsubTopic")]
826 pub notification_pubsub_topic: Option<String>,
827 /// Output only. Information about the user whose credentials are used to transfer data. Populated only for `transferConfigs.get` requests. In case the user information is not available, this field will not be populated.
828 #[serde(rename = "ownerInfo")]
829 pub owner_info: Option<UserInfo>,
830 /// Parameters specific to each data source. For more information see the bq tab in the 'Setting up a data transfer' section for each data source. For example the parameters for Cloud Storage transfers are listed here: https://cloud.google.com/bigquery-transfer/docs/cloud-storage-transfer#bq
831 pub params: Option<HashMap<String, serde_json::Value>>,
832 /// Data transfer schedule. If the data source does not support a custom schedule, this should be empty. If it is empty, the default value for the data source will be used. The specified times are in UTC. Examples of valid format: `1st,3rd monday of month 15:30`, `every wed,fri of jan,jun 13:15`, and `first sunday of quarter 00:00`. See more explanation about the format here: https://cloud.google.com/appengine/docs/flexible/python/scheduling-jobs-with-cron-yaml#the_schedule_format NOTE: The minimum interval time between recurring transfers depends on the data source; refer to the documentation for your data source.
833 pub schedule: Option<String>,
834 /// Options customizing the data transfer schedule.
835 #[serde(rename = "scheduleOptions")]
836 pub schedule_options: Option<ScheduleOptions>,
837 /// Options customizing different types of data transfer schedule. This field replaces "schedule" and "schedule_options" fields. ScheduleOptionsV2 cannot be used together with ScheduleOptions/Schedule.
838 #[serde(rename = "scheduleOptionsV2")]
839 pub schedule_options_v2: Option<ScheduleOptionsV2>,
840 /// Output only. State of the most recently updated transfer run.
841 pub state: Option<String>,
842 /// Output only. Data transfer modification time. Ignored by server on input.
843 #[serde(rename = "updateTime")]
844 pub update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
845 /// Deprecated. Unique ID of the user on whose behalf transfer is done.
846 #[serde(rename = "userId")]
847 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
848 pub user_id: Option<i64>,
849}
850
851impl common::RequestValue for TransferConfig {}
852impl common::ResponseResult for TransferConfig {}
853
854/// Represents a user facing message for a particular data transfer run.
855///
856/// This type is not used in any activity, and only used as *part* of another schema.
857///
858#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
859#[serde_with::serde_as]
860#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
861pub struct TransferMessage {
862 /// Message text.
863 #[serde(rename = "messageText")]
864 pub message_text: Option<String>,
865 /// Time when message was logged.
866 #[serde(rename = "messageTime")]
867 pub message_time: Option<chrono::DateTime<chrono::offset::Utc>>,
868 /// Message severity.
869 pub severity: Option<String>,
870}
871
872impl common::Part for TransferMessage {}
873
874/// Represents a data transfer run.
875///
876/// # Activities
877///
878/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
879/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
880///
881/// * [locations transfer configs runs get projects](ProjectLocationTransferConfigRunGetCall) (response)
882/// * [transfer configs runs get projects](ProjectTransferConfigRunGetCall) (response)
883#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
884#[serde_with::serde_as]
885#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
886pub struct TransferRun {
887 /// Output only. Data source id.
888 #[serde(rename = "dataSourceId")]
889 pub data_source_id: Option<String>,
890 /// Output only. The BigQuery target dataset id.
891 #[serde(rename = "destinationDatasetId")]
892 pub destination_dataset_id: Option<String>,
893 /// Output only. Email notifications will be sent according to these preferences to the email address of the user who owns the transfer config this run was derived from.
894 #[serde(rename = "emailPreferences")]
895 pub email_preferences: Option<EmailPreferences>,
896 /// Output only. Time when transfer run ended. Parameter ignored by server for input requests.
897 #[serde(rename = "endTime")]
898 pub end_time: Option<chrono::DateTime<chrono::offset::Utc>>,
899 /// Status of the transfer run.
900 #[serde(rename = "errorStatus")]
901 pub error_status: Option<Status>,
902 /// Identifier. The resource name of the transfer run. Transfer run names have the form `projects/{project_id}/locations/{location}/transferConfigs/{config_id}/runs/{run_id}`. The name is ignored when creating a transfer run.
903 pub name: Option<String>,
904 /// Output only. Pub/Sub topic where a notification will be sent after this transfer run finishes. The format for specifying a pubsub topic is: `projects/{project_id}/topics/{topic_id}`
905 #[serde(rename = "notificationPubsubTopic")]
906 pub notification_pubsub_topic: Option<String>,
907 /// Output only. Parameters specific to each data source. For more information see the bq tab in the 'Setting up a data transfer' section for each data source. For example the parameters for Cloud Storage transfers are listed here: https://cloud.google.com/bigquery-transfer/docs/cloud-storage-transfer#bq
908 pub params: Option<HashMap<String, serde_json::Value>>,
909 /// For batch transfer runs, specifies the date and time of the data should be ingested.
910 #[serde(rename = "runTime")]
911 pub run_time: Option<chrono::DateTime<chrono::offset::Utc>>,
912 /// Output only. Describes the schedule of this transfer run if it was created as part of a regular schedule. For batch transfer runs that are scheduled manually, this is empty. NOTE: the system might choose to delay the schedule depending on the current load, so `schedule_time` doesn't always match this.
913 pub schedule: Option<String>,
914 /// Minimum time after which a transfer run can be started.
915 #[serde(rename = "scheduleTime")]
916 pub schedule_time: Option<chrono::DateTime<chrono::offset::Utc>>,
917 /// Output only. Time when transfer run was started. Parameter ignored by server for input requests.
918 #[serde(rename = "startTime")]
919 pub start_time: Option<chrono::DateTime<chrono::offset::Utc>>,
920 /// Data transfer run state. Ignored for input requests.
921 pub state: Option<String>,
922 /// Output only. Last time the data transfer run state was updated.
923 #[serde(rename = "updateTime")]
924 pub update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
925 /// Deprecated. Unique ID of the user on whose behalf transfer is done.
926 #[serde(rename = "userId")]
927 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
928 pub user_id: Option<i64>,
929}
930
931impl common::ResponseResult for TransferRun {}
932
933/// A request to unenroll a set of data sources so they are no longer visible in the BigQuery UI’s `Transfer` tab.
934///
935/// # Activities
936///
937/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
938/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
939///
940/// * [locations unenroll data sources projects](ProjectLocationUnenrollDataSourceCall) (request)
941#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
942#[serde_with::serde_as]
943#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
944pub struct UnenrollDataSourcesRequest {
945 /// Data sources that are unenrolled. It is required to provide at least one data source id.
946 #[serde(rename = "dataSourceIds")]
947 pub data_source_ids: Option<Vec<String>>,
948}
949
950impl common::RequestValue for UnenrollDataSourcesRequest {}
951
952/// Information about a user.
953///
954/// This type is not used in any activity, and only used as *part* of another schema.
955///
956#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
957#[serde_with::serde_as]
958#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
959pub struct UserInfo {
960 /// E-mail address of the user.
961 pub email: Option<String>,
962}
963
964impl common::Part for UserInfo {}
965
966// ###################
967// MethodBuilders ###
968// #################
969
970/// A builder providing access to all methods supported on *project* resources.
971/// It is not used directly, but through the [`BigQueryDataTransfer`] hub.
972///
973/// # Example
974///
975/// Instantiate a resource builder
976///
977/// ```test_harness,no_run
978/// extern crate hyper;
979/// extern crate hyper_rustls;
980/// extern crate google_bigquerydatatransfer1 as bigquerydatatransfer1;
981///
982/// # async fn dox() {
983/// use bigquerydatatransfer1::{BigQueryDataTransfer, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
984///
985/// let secret: yup_oauth2::ApplicationSecret = Default::default();
986/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
987/// .with_native_roots()
988/// .unwrap()
989/// .https_only()
990/// .enable_http2()
991/// .build();
992///
993/// let executor = hyper_util::rt::TokioExecutor::new();
994/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
995/// secret,
996/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
997/// yup_oauth2::client::CustomHyperClientBuilder::from(
998/// hyper_util::client::legacy::Client::builder(executor).build(connector),
999/// ),
1000/// ).build().await.unwrap();
1001///
1002/// let client = hyper_util::client::legacy::Client::builder(
1003/// hyper_util::rt::TokioExecutor::new()
1004/// )
1005/// .build(
1006/// hyper_rustls::HttpsConnectorBuilder::new()
1007/// .with_native_roots()
1008/// .unwrap()
1009/// .https_or_http()
1010/// .enable_http2()
1011/// .build()
1012/// );
1013/// let mut hub = BigQueryDataTransfer::new(client, auth);
1014/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
1015/// // like `data_sources_check_valid_creds(...)`, `data_sources_get(...)`, `data_sources_list(...)`, `enroll_data_sources(...)`, `locations_data_sources_check_valid_creds(...)`, `locations_data_sources_get(...)`, `locations_data_sources_list(...)`, `locations_enroll_data_sources(...)`, `locations_get(...)`, `locations_list(...)`, `locations_transfer_configs_create(...)`, `locations_transfer_configs_delete(...)`, `locations_transfer_configs_get(...)`, `locations_transfer_configs_list(...)`, `locations_transfer_configs_patch(...)`, `locations_transfer_configs_runs_delete(...)`, `locations_transfer_configs_runs_get(...)`, `locations_transfer_configs_runs_list(...)`, `locations_transfer_configs_runs_transfer_logs_list(...)`, `locations_transfer_configs_schedule_runs(...)`, `locations_transfer_configs_start_manual_runs(...)`, `locations_unenroll_data_sources(...)`, `transfer_configs_create(...)`, `transfer_configs_delete(...)`, `transfer_configs_get(...)`, `transfer_configs_list(...)`, `transfer_configs_patch(...)`, `transfer_configs_runs_delete(...)`, `transfer_configs_runs_get(...)`, `transfer_configs_runs_list(...)`, `transfer_configs_runs_transfer_logs_list(...)`, `transfer_configs_schedule_runs(...)` and `transfer_configs_start_manual_runs(...)`
1016/// // to build up your call.
1017/// let rb = hub.projects();
1018/// # }
1019/// ```
1020pub struct ProjectMethods<'a, C>
1021where
1022 C: 'a,
1023{
1024 hub: &'a BigQueryDataTransfer<C>,
1025}
1026
1027impl<'a, C> common::MethodsBuilder for ProjectMethods<'a, C> {}
1028
1029impl<'a, C> ProjectMethods<'a, C> {
1030 /// Create a builder to help you perform the following task:
1031 ///
1032 /// Returns true if valid credentials exist for the given data source and requesting user.
1033 ///
1034 /// # Arguments
1035 ///
1036 /// * `request` - No description provided.
1037 /// * `name` - Required. The name of the data source. If you are using the regionless method, the location must be `US` and the name should be in the following form: * `projects/{project_id}/dataSources/{data_source_id}` If you are using the regionalized method, the name should be in the following form: * `projects/{project_id}/locations/{location_id}/dataSources/{data_source_id}`
1038 pub fn data_sources_check_valid_creds(
1039 &self,
1040 request: CheckValidCredsRequest,
1041 name: &str,
1042 ) -> ProjectDataSourceCheckValidCredCall<'a, C> {
1043 ProjectDataSourceCheckValidCredCall {
1044 hub: self.hub,
1045 _request: request,
1046 _name: name.to_string(),
1047 _delegate: Default::default(),
1048 _additional_params: Default::default(),
1049 _scopes: Default::default(),
1050 }
1051 }
1052
1053 /// Create a builder to help you perform the following task:
1054 ///
1055 /// Retrieves a supported data source and returns its settings.
1056 ///
1057 /// # Arguments
1058 ///
1059 /// * `name` - Required. The name of the resource requested. If you are using the regionless method, the location must be `US` and the name should be in the following form: * `projects/{project_id}/dataSources/{data_source_id}` If you are using the regionalized method, the name should be in the following form: * `projects/{project_id}/locations/{location_id}/dataSources/{data_source_id}`
1060 pub fn data_sources_get(&self, name: &str) -> ProjectDataSourceGetCall<'a, C> {
1061 ProjectDataSourceGetCall {
1062 hub: self.hub,
1063 _name: name.to_string(),
1064 _delegate: Default::default(),
1065 _additional_params: Default::default(),
1066 _scopes: Default::default(),
1067 }
1068 }
1069
1070 /// Create a builder to help you perform the following task:
1071 ///
1072 /// Lists supported data sources and returns their settings.
1073 ///
1074 /// # Arguments
1075 ///
1076 /// * `parent` - Required. The BigQuery project id for which data sources should be returned. Must be in the form: `projects/{project_id}` or `projects/{project_id}/locations/{location_id}`
1077 pub fn data_sources_list(&self, parent: &str) -> ProjectDataSourceListCall<'a, C> {
1078 ProjectDataSourceListCall {
1079 hub: self.hub,
1080 _parent: parent.to_string(),
1081 _page_token: Default::default(),
1082 _page_size: Default::default(),
1083 _delegate: Default::default(),
1084 _additional_params: Default::default(),
1085 _scopes: Default::default(),
1086 }
1087 }
1088
1089 /// Create a builder to help you perform the following task:
1090 ///
1091 /// Returns true if valid credentials exist for the given data source and requesting user.
1092 ///
1093 /// # Arguments
1094 ///
1095 /// * `request` - No description provided.
1096 /// * `name` - Required. The name of the data source. If you are using the regionless method, the location must be `US` and the name should be in the following form: * `projects/{project_id}/dataSources/{data_source_id}` If you are using the regionalized method, the name should be in the following form: * `projects/{project_id}/locations/{location_id}/dataSources/{data_source_id}`
1097 pub fn locations_data_sources_check_valid_creds(
1098 &self,
1099 request: CheckValidCredsRequest,
1100 name: &str,
1101 ) -> ProjectLocationDataSourceCheckValidCredCall<'a, C> {
1102 ProjectLocationDataSourceCheckValidCredCall {
1103 hub: self.hub,
1104 _request: request,
1105 _name: name.to_string(),
1106 _delegate: Default::default(),
1107 _additional_params: Default::default(),
1108 _scopes: Default::default(),
1109 }
1110 }
1111
1112 /// Create a builder to help you perform the following task:
1113 ///
1114 /// Retrieves a supported data source and returns its settings.
1115 ///
1116 /// # Arguments
1117 ///
1118 /// * `name` - Required. The name of the resource requested. If you are using the regionless method, the location must be `US` and the name should be in the following form: * `projects/{project_id}/dataSources/{data_source_id}` If you are using the regionalized method, the name should be in the following form: * `projects/{project_id}/locations/{location_id}/dataSources/{data_source_id}`
1119 pub fn locations_data_sources_get(
1120 &self,
1121 name: &str,
1122 ) -> ProjectLocationDataSourceGetCall<'a, C> {
1123 ProjectLocationDataSourceGetCall {
1124 hub: self.hub,
1125 _name: name.to_string(),
1126 _delegate: Default::default(),
1127 _additional_params: Default::default(),
1128 _scopes: Default::default(),
1129 }
1130 }
1131
1132 /// Create a builder to help you perform the following task:
1133 ///
1134 /// Lists supported data sources and returns their settings.
1135 ///
1136 /// # Arguments
1137 ///
1138 /// * `parent` - Required. The BigQuery project id for which data sources should be returned. Must be in the form: `projects/{project_id}` or `projects/{project_id}/locations/{location_id}`
1139 pub fn locations_data_sources_list(
1140 &self,
1141 parent: &str,
1142 ) -> ProjectLocationDataSourceListCall<'a, C> {
1143 ProjectLocationDataSourceListCall {
1144 hub: self.hub,
1145 _parent: parent.to_string(),
1146 _page_token: Default::default(),
1147 _page_size: Default::default(),
1148 _delegate: Default::default(),
1149 _additional_params: Default::default(),
1150 _scopes: Default::default(),
1151 }
1152 }
1153
1154 /// Create a builder to help you perform the following task:
1155 ///
1156 /// Returns log messages for the transfer run.
1157 ///
1158 /// # Arguments
1159 ///
1160 /// * `parent` - Required. Transfer run name. If you are using the regionless method, the location must be `US` and the name should be in the following form: * `projects/{project_id}/transferConfigs/{config_id}/runs/{run_id}` If you are using the regionalized method, the name should be in the following form: * `projects/{project_id}/locations/{location_id}/transferConfigs/{config_id}/runs/{run_id}`
1161 pub fn locations_transfer_configs_runs_transfer_logs_list(
1162 &self,
1163 parent: &str,
1164 ) -> ProjectLocationTransferConfigRunTransferLogListCall<'a, C> {
1165 ProjectLocationTransferConfigRunTransferLogListCall {
1166 hub: self.hub,
1167 _parent: parent.to_string(),
1168 _page_token: Default::default(),
1169 _page_size: Default::default(),
1170 _message_types: Default::default(),
1171 _delegate: Default::default(),
1172 _additional_params: Default::default(),
1173 _scopes: Default::default(),
1174 }
1175 }
1176
1177 /// Create a builder to help you perform the following task:
1178 ///
1179 /// Deletes the specified transfer run.
1180 ///
1181 /// # Arguments
1182 ///
1183 /// * `name` - Required. The name of the resource requested. If you are using the regionless method, the location must be `US` and the name should be in the following form: * `projects/{project_id}/transferConfigs/{config_id}/runs/{run_id}` If you are using the regionalized method, the name should be in the following form: * `projects/{project_id}/locations/{location_id}/transferConfigs/{config_id}/runs/{run_id}`
1184 pub fn locations_transfer_configs_runs_delete(
1185 &self,
1186 name: &str,
1187 ) -> ProjectLocationTransferConfigRunDeleteCall<'a, C> {
1188 ProjectLocationTransferConfigRunDeleteCall {
1189 hub: self.hub,
1190 _name: name.to_string(),
1191 _delegate: Default::default(),
1192 _additional_params: Default::default(),
1193 _scopes: Default::default(),
1194 }
1195 }
1196
1197 /// Create a builder to help you perform the following task:
1198 ///
1199 /// Returns information about the particular transfer run.
1200 ///
1201 /// # Arguments
1202 ///
1203 /// * `name` - Required. The name of the resource requested. If you are using the regionless method, the location must be `US` and the name should be in the following form: * `projects/{project_id}/transferConfigs/{config_id}/runs/{run_id}` If you are using the regionalized method, the name should be in the following form: * `projects/{project_id}/locations/{location_id}/transferConfigs/{config_id}/runs/{run_id}`
1204 pub fn locations_transfer_configs_runs_get(
1205 &self,
1206 name: &str,
1207 ) -> ProjectLocationTransferConfigRunGetCall<'a, C> {
1208 ProjectLocationTransferConfigRunGetCall {
1209 hub: self.hub,
1210 _name: name.to_string(),
1211 _delegate: Default::default(),
1212 _additional_params: Default::default(),
1213 _scopes: Default::default(),
1214 }
1215 }
1216
1217 /// Create a builder to help you perform the following task:
1218 ///
1219 /// Returns information about running and completed transfer runs.
1220 ///
1221 /// # Arguments
1222 ///
1223 /// * `parent` - Required. Name of transfer configuration for which transfer runs should be retrieved. If you are using the regionless method, the location must be `US` and the name should be in the following form: * `projects/{project_id}/transferConfigs/{config_id}` If you are using the regionalized method, the name should be in the following form: * `projects/{project_id}/locations/{location_id}/transferConfigs/{config_id}`
1224 pub fn locations_transfer_configs_runs_list(
1225 &self,
1226 parent: &str,
1227 ) -> ProjectLocationTransferConfigRunListCall<'a, C> {
1228 ProjectLocationTransferConfigRunListCall {
1229 hub: self.hub,
1230 _parent: parent.to_string(),
1231 _states: Default::default(),
1232 _run_attempt: Default::default(),
1233 _page_token: Default::default(),
1234 _page_size: Default::default(),
1235 _delegate: Default::default(),
1236 _additional_params: Default::default(),
1237 _scopes: Default::default(),
1238 }
1239 }
1240
1241 /// Create a builder to help you perform the following task:
1242 ///
1243 /// Creates a new data transfer configuration.
1244 ///
1245 /// # Arguments
1246 ///
1247 /// * `request` - No description provided.
1248 /// * `parent` - Required. The BigQuery project id where the transfer configuration should be created. Must be in the format projects/{project_id}/locations/{location_id} or projects/{project_id}. If specified location and location of the destination bigquery dataset do not match - the request will fail.
1249 pub fn locations_transfer_configs_create(
1250 &self,
1251 request: TransferConfig,
1252 parent: &str,
1253 ) -> ProjectLocationTransferConfigCreateCall<'a, C> {
1254 ProjectLocationTransferConfigCreateCall {
1255 hub: self.hub,
1256 _request: request,
1257 _parent: parent.to_string(),
1258 _version_info: Default::default(),
1259 _service_account_name: Default::default(),
1260 _authorization_code: Default::default(),
1261 _delegate: Default::default(),
1262 _additional_params: Default::default(),
1263 _scopes: Default::default(),
1264 }
1265 }
1266
1267 /// Create a builder to help you perform the following task:
1268 ///
1269 /// Deletes a data transfer configuration, including any associated transfer runs and logs.
1270 ///
1271 /// # Arguments
1272 ///
1273 /// * `name` - Required. The name of the resource to delete. If you are using the regionless method, the location must be `US` and the name should be in the following form: * `projects/{project_id}/transferConfigs/{config_id}` If you are using the regionalized method, the name should be in the following form: * `projects/{project_id}/locations/{location_id}/transferConfigs/{config_id}`
1274 pub fn locations_transfer_configs_delete(
1275 &self,
1276 name: &str,
1277 ) -> ProjectLocationTransferConfigDeleteCall<'a, C> {
1278 ProjectLocationTransferConfigDeleteCall {
1279 hub: self.hub,
1280 _name: name.to_string(),
1281 _delegate: Default::default(),
1282 _additional_params: Default::default(),
1283 _scopes: Default::default(),
1284 }
1285 }
1286
1287 /// Create a builder to help you perform the following task:
1288 ///
1289 /// Returns information about a data transfer config.
1290 ///
1291 /// # Arguments
1292 ///
1293 /// * `name` - Required. The name of the resource requested. If you are using the regionless method, the location must be `US` and the name should be in the following form: * `projects/{project_id}/transferConfigs/{config_id}` If you are using the regionalized method, the name should be in the following form: * `projects/{project_id}/locations/{location_id}/transferConfigs/{config_id}`
1294 pub fn locations_transfer_configs_get(
1295 &self,
1296 name: &str,
1297 ) -> ProjectLocationTransferConfigGetCall<'a, C> {
1298 ProjectLocationTransferConfigGetCall {
1299 hub: self.hub,
1300 _name: name.to_string(),
1301 _delegate: Default::default(),
1302 _additional_params: Default::default(),
1303 _scopes: Default::default(),
1304 }
1305 }
1306
1307 /// Create a builder to help you perform the following task:
1308 ///
1309 /// Returns information about all transfer configs owned by a project in the specified location.
1310 ///
1311 /// # Arguments
1312 ///
1313 /// * `parent` - Required. The BigQuery project id for which transfer configs should be returned. If you are using the regionless method, the location must be `US` and `parent` should be in the following form: * `projects/{project_id} If you are using the regionalized method, `parent` should be in the following form: * `projects/{project_id}/locations/{location_id}`
1314 pub fn locations_transfer_configs_list(
1315 &self,
1316 parent: &str,
1317 ) -> ProjectLocationTransferConfigListCall<'a, C> {
1318 ProjectLocationTransferConfigListCall {
1319 hub: self.hub,
1320 _parent: parent.to_string(),
1321 _page_token: Default::default(),
1322 _page_size: Default::default(),
1323 _data_source_ids: Default::default(),
1324 _delegate: Default::default(),
1325 _additional_params: Default::default(),
1326 _scopes: Default::default(),
1327 }
1328 }
1329
1330 /// Create a builder to help you perform the following task:
1331 ///
1332 /// Updates a data transfer configuration. All fields must be set, even if they are not updated.
1333 ///
1334 /// # Arguments
1335 ///
1336 /// * `request` - No description provided.
1337 /// * `name` - Identifier. The resource name of the transfer config. Transfer config names have the form either `projects/{project_id}/locations/{region}/transferConfigs/{config_id}` or `projects/{project_id}/transferConfigs/{config_id}`, where `config_id` is usually a UUID, even though it is not guaranteed or required. The name is ignored when creating a transfer config.
1338 pub fn locations_transfer_configs_patch(
1339 &self,
1340 request: TransferConfig,
1341 name: &str,
1342 ) -> ProjectLocationTransferConfigPatchCall<'a, C> {
1343 ProjectLocationTransferConfigPatchCall {
1344 hub: self.hub,
1345 _request: request,
1346 _name: name.to_string(),
1347 _version_info: Default::default(),
1348 _update_mask: Default::default(),
1349 _service_account_name: Default::default(),
1350 _authorization_code: Default::default(),
1351 _delegate: Default::default(),
1352 _additional_params: Default::default(),
1353 _scopes: Default::default(),
1354 }
1355 }
1356
1357 /// Create a builder to help you perform the following task:
1358 ///
1359 /// Creates transfer runs for a time range [start_time, end_time]. For each date - or whatever granularity the data source supports - in the range, one transfer run is created. Note that runs are created per UTC time in the time range. DEPRECATED: use StartManualTransferRuns instead.
1360 ///
1361 /// # Arguments
1362 ///
1363 /// * `request` - No description provided.
1364 /// * `parent` - Required. Transfer configuration name. If you are using the regionless method, the location must be `US` and the name should be in the following form: * `projects/{project_id}/transferConfigs/{config_id}` If you are using the regionalized method, the name should be in the following form: * `projects/{project_id}/locations/{location_id}/transferConfigs/{config_id}`
1365 pub fn locations_transfer_configs_schedule_runs(
1366 &self,
1367 request: ScheduleTransferRunsRequest,
1368 parent: &str,
1369 ) -> ProjectLocationTransferConfigScheduleRunCall<'a, C> {
1370 ProjectLocationTransferConfigScheduleRunCall {
1371 hub: self.hub,
1372 _request: request,
1373 _parent: parent.to_string(),
1374 _delegate: Default::default(),
1375 _additional_params: Default::default(),
1376 _scopes: Default::default(),
1377 }
1378 }
1379
1380 /// Create a builder to help you perform the following task:
1381 ///
1382 /// Manually initiates transfer runs. You can schedule these runs in two ways: 1. For a specific point in time using the 'requested_run_time' parameter. 2. For a period between 'start_time' (inclusive) and 'end_time' (exclusive). If scheduling a single run, it is set to execute immediately (schedule_time equals the current time). When scheduling multiple runs within a time range, the first run starts now, and subsequent runs are delayed by 15 seconds each.
1383 ///
1384 /// # Arguments
1385 ///
1386 /// * `request` - No description provided.
1387 /// * `parent` - Required. Transfer configuration name. If you are using the regionless method, the location must be `US` and the name should be in the following form: * `projects/{project_id}/transferConfigs/{config_id}` If you are using the regionalized method, the name should be in the following form: * `projects/{project_id}/locations/{location_id}/transferConfigs/{config_id}`
1388 pub fn locations_transfer_configs_start_manual_runs(
1389 &self,
1390 request: StartManualTransferRunsRequest,
1391 parent: &str,
1392 ) -> ProjectLocationTransferConfigStartManualRunCall<'a, C> {
1393 ProjectLocationTransferConfigStartManualRunCall {
1394 hub: self.hub,
1395 _request: request,
1396 _parent: parent.to_string(),
1397 _delegate: Default::default(),
1398 _additional_params: Default::default(),
1399 _scopes: Default::default(),
1400 }
1401 }
1402
1403 /// Create a builder to help you perform the following task:
1404 ///
1405 /// Enroll data sources in a user project. This allows users to create transfer configurations for these data sources. They will also appear in the ListDataSources RPC and as such, will appear in the [BigQuery UI](https://console.cloud.google.com/bigquery), and the documents can be found in the public guide for [BigQuery Web UI](https://cloud.google.com/bigquery/bigquery-web-ui) and [Data Transfer Service](https://cloud.google.com/bigquery/docs/working-with-transfers).
1406 ///
1407 /// # Arguments
1408 ///
1409 /// * `request` - No description provided.
1410 /// * `name` - Required. The name of the project resource in the form: `projects/{project_id}`
1411 pub fn locations_enroll_data_sources(
1412 &self,
1413 request: EnrollDataSourcesRequest,
1414 name: &str,
1415 ) -> ProjectLocationEnrollDataSourceCall<'a, C> {
1416 ProjectLocationEnrollDataSourceCall {
1417 hub: self.hub,
1418 _request: request,
1419 _name: name.to_string(),
1420 _delegate: Default::default(),
1421 _additional_params: Default::default(),
1422 _scopes: Default::default(),
1423 }
1424 }
1425
1426 /// Create a builder to help you perform the following task:
1427 ///
1428 /// Gets information about a location.
1429 ///
1430 /// # Arguments
1431 ///
1432 /// * `name` - Resource name for the location.
1433 pub fn locations_get(&self, name: &str) -> ProjectLocationGetCall<'a, C> {
1434 ProjectLocationGetCall {
1435 hub: self.hub,
1436 _name: name.to_string(),
1437 _delegate: Default::default(),
1438 _additional_params: Default::default(),
1439 _scopes: Default::default(),
1440 }
1441 }
1442
1443 /// Create a builder to help you perform the following task:
1444 ///
1445 /// Lists information about the supported locations for this service.
1446 ///
1447 /// # Arguments
1448 ///
1449 /// * `name` - The resource that owns the locations collection, if applicable.
1450 pub fn locations_list(&self, name: &str) -> ProjectLocationListCall<'a, C> {
1451 ProjectLocationListCall {
1452 hub: self.hub,
1453 _name: name.to_string(),
1454 _page_token: Default::default(),
1455 _page_size: Default::default(),
1456 _filter: Default::default(),
1457 _extra_location_types: Default::default(),
1458 _delegate: Default::default(),
1459 _additional_params: Default::default(),
1460 _scopes: Default::default(),
1461 }
1462 }
1463
1464 /// Create a builder to help you perform the following task:
1465 ///
1466 /// Unenroll data sources in a user project. This allows users to remove transfer configurations for these data sources. They will no longer appear in the ListDataSources RPC and will also no longer appear in the [BigQuery UI](https://console.cloud.google.com/bigquery). Data transfers configurations of unenrolled data sources will not be scheduled.
1467 ///
1468 /// # Arguments
1469 ///
1470 /// * `request` - No description provided.
1471 /// * `name` - Required. The name of the project resource in the form: `projects/{project_id}`
1472 pub fn locations_unenroll_data_sources(
1473 &self,
1474 request: UnenrollDataSourcesRequest,
1475 name: &str,
1476 ) -> ProjectLocationUnenrollDataSourceCall<'a, C> {
1477 ProjectLocationUnenrollDataSourceCall {
1478 hub: self.hub,
1479 _request: request,
1480 _name: name.to_string(),
1481 _delegate: Default::default(),
1482 _additional_params: Default::default(),
1483 _scopes: Default::default(),
1484 }
1485 }
1486
1487 /// Create a builder to help you perform the following task:
1488 ///
1489 /// Returns log messages for the transfer run.
1490 ///
1491 /// # Arguments
1492 ///
1493 /// * `parent` - Required. Transfer run name. If you are using the regionless method, the location must be `US` and the name should be in the following form: * `projects/{project_id}/transferConfigs/{config_id}/runs/{run_id}` If you are using the regionalized method, the name should be in the following form: * `projects/{project_id}/locations/{location_id}/transferConfigs/{config_id}/runs/{run_id}`
1494 pub fn transfer_configs_runs_transfer_logs_list(
1495 &self,
1496 parent: &str,
1497 ) -> ProjectTransferConfigRunTransferLogListCall<'a, C> {
1498 ProjectTransferConfigRunTransferLogListCall {
1499 hub: self.hub,
1500 _parent: parent.to_string(),
1501 _page_token: Default::default(),
1502 _page_size: Default::default(),
1503 _message_types: Default::default(),
1504 _delegate: Default::default(),
1505 _additional_params: Default::default(),
1506 _scopes: Default::default(),
1507 }
1508 }
1509
1510 /// Create a builder to help you perform the following task:
1511 ///
1512 /// Deletes the specified transfer run.
1513 ///
1514 /// # Arguments
1515 ///
1516 /// * `name` - Required. The name of the resource requested. If you are using the regionless method, the location must be `US` and the name should be in the following form: * `projects/{project_id}/transferConfigs/{config_id}/runs/{run_id}` If you are using the regionalized method, the name should be in the following form: * `projects/{project_id}/locations/{location_id}/transferConfigs/{config_id}/runs/{run_id}`
1517 pub fn transfer_configs_runs_delete(
1518 &self,
1519 name: &str,
1520 ) -> ProjectTransferConfigRunDeleteCall<'a, C> {
1521 ProjectTransferConfigRunDeleteCall {
1522 hub: self.hub,
1523 _name: name.to_string(),
1524 _delegate: Default::default(),
1525 _additional_params: Default::default(),
1526 _scopes: Default::default(),
1527 }
1528 }
1529
1530 /// Create a builder to help you perform the following task:
1531 ///
1532 /// Returns information about the particular transfer run.
1533 ///
1534 /// # Arguments
1535 ///
1536 /// * `name` - Required. The name of the resource requested. If you are using the regionless method, the location must be `US` and the name should be in the following form: * `projects/{project_id}/transferConfigs/{config_id}/runs/{run_id}` If you are using the regionalized method, the name should be in the following form: * `projects/{project_id}/locations/{location_id}/transferConfigs/{config_id}/runs/{run_id}`
1537 pub fn transfer_configs_runs_get(&self, name: &str) -> ProjectTransferConfigRunGetCall<'a, C> {
1538 ProjectTransferConfigRunGetCall {
1539 hub: self.hub,
1540 _name: name.to_string(),
1541 _delegate: Default::default(),
1542 _additional_params: Default::default(),
1543 _scopes: Default::default(),
1544 }
1545 }
1546
1547 /// Create a builder to help you perform the following task:
1548 ///
1549 /// Returns information about running and completed transfer runs.
1550 ///
1551 /// # Arguments
1552 ///
1553 /// * `parent` - Required. Name of transfer configuration for which transfer runs should be retrieved. If you are using the regionless method, the location must be `US` and the name should be in the following form: * `projects/{project_id}/transferConfigs/{config_id}` If you are using the regionalized method, the name should be in the following form: * `projects/{project_id}/locations/{location_id}/transferConfigs/{config_id}`
1554 pub fn transfer_configs_runs_list(
1555 &self,
1556 parent: &str,
1557 ) -> ProjectTransferConfigRunListCall<'a, C> {
1558 ProjectTransferConfigRunListCall {
1559 hub: self.hub,
1560 _parent: parent.to_string(),
1561 _states: Default::default(),
1562 _run_attempt: Default::default(),
1563 _page_token: Default::default(),
1564 _page_size: Default::default(),
1565 _delegate: Default::default(),
1566 _additional_params: Default::default(),
1567 _scopes: Default::default(),
1568 }
1569 }
1570
1571 /// Create a builder to help you perform the following task:
1572 ///
1573 /// Creates a new data transfer configuration.
1574 ///
1575 /// # Arguments
1576 ///
1577 /// * `request` - No description provided.
1578 /// * `parent` - Required. The BigQuery project id where the transfer configuration should be created. Must be in the format projects/{project_id}/locations/{location_id} or projects/{project_id}. If specified location and location of the destination bigquery dataset do not match - the request will fail.
1579 pub fn transfer_configs_create(
1580 &self,
1581 request: TransferConfig,
1582 parent: &str,
1583 ) -> ProjectTransferConfigCreateCall<'a, C> {
1584 ProjectTransferConfigCreateCall {
1585 hub: self.hub,
1586 _request: request,
1587 _parent: parent.to_string(),
1588 _version_info: Default::default(),
1589 _service_account_name: Default::default(),
1590 _authorization_code: Default::default(),
1591 _delegate: Default::default(),
1592 _additional_params: Default::default(),
1593 _scopes: Default::default(),
1594 }
1595 }
1596
1597 /// Create a builder to help you perform the following task:
1598 ///
1599 /// Deletes a data transfer configuration, including any associated transfer runs and logs.
1600 ///
1601 /// # Arguments
1602 ///
1603 /// * `name` - Required. The name of the resource to delete. If you are using the regionless method, the location must be `US` and the name should be in the following form: * `projects/{project_id}/transferConfigs/{config_id}` If you are using the regionalized method, the name should be in the following form: * `projects/{project_id}/locations/{location_id}/transferConfigs/{config_id}`
1604 pub fn transfer_configs_delete(&self, name: &str) -> ProjectTransferConfigDeleteCall<'a, C> {
1605 ProjectTransferConfigDeleteCall {
1606 hub: self.hub,
1607 _name: name.to_string(),
1608 _delegate: Default::default(),
1609 _additional_params: Default::default(),
1610 _scopes: Default::default(),
1611 }
1612 }
1613
1614 /// Create a builder to help you perform the following task:
1615 ///
1616 /// Returns information about a data transfer config.
1617 ///
1618 /// # Arguments
1619 ///
1620 /// * `name` - Required. The name of the resource requested. If you are using the regionless method, the location must be `US` and the name should be in the following form: * `projects/{project_id}/transferConfigs/{config_id}` If you are using the regionalized method, the name should be in the following form: * `projects/{project_id}/locations/{location_id}/transferConfigs/{config_id}`
1621 pub fn transfer_configs_get(&self, name: &str) -> ProjectTransferConfigGetCall<'a, C> {
1622 ProjectTransferConfigGetCall {
1623 hub: self.hub,
1624 _name: name.to_string(),
1625 _delegate: Default::default(),
1626 _additional_params: Default::default(),
1627 _scopes: Default::default(),
1628 }
1629 }
1630
1631 /// Create a builder to help you perform the following task:
1632 ///
1633 /// Returns information about all transfer configs owned by a project in the specified location.
1634 ///
1635 /// # Arguments
1636 ///
1637 /// * `parent` - Required. The BigQuery project id for which transfer configs should be returned. If you are using the regionless method, the location must be `US` and `parent` should be in the following form: * `projects/{project_id} If you are using the regionalized method, `parent` should be in the following form: * `projects/{project_id}/locations/{location_id}`
1638 pub fn transfer_configs_list(&self, parent: &str) -> ProjectTransferConfigListCall<'a, C> {
1639 ProjectTransferConfigListCall {
1640 hub: self.hub,
1641 _parent: parent.to_string(),
1642 _page_token: Default::default(),
1643 _page_size: Default::default(),
1644 _data_source_ids: Default::default(),
1645 _delegate: Default::default(),
1646 _additional_params: Default::default(),
1647 _scopes: Default::default(),
1648 }
1649 }
1650
1651 /// Create a builder to help you perform the following task:
1652 ///
1653 /// Updates a data transfer configuration. All fields must be set, even if they are not updated.
1654 ///
1655 /// # Arguments
1656 ///
1657 /// * `request` - No description provided.
1658 /// * `name` - Identifier. The resource name of the transfer config. Transfer config names have the form either `projects/{project_id}/locations/{region}/transferConfigs/{config_id}` or `projects/{project_id}/transferConfigs/{config_id}`, where `config_id` is usually a UUID, even though it is not guaranteed or required. The name is ignored when creating a transfer config.
1659 pub fn transfer_configs_patch(
1660 &self,
1661 request: TransferConfig,
1662 name: &str,
1663 ) -> ProjectTransferConfigPatchCall<'a, C> {
1664 ProjectTransferConfigPatchCall {
1665 hub: self.hub,
1666 _request: request,
1667 _name: name.to_string(),
1668 _version_info: Default::default(),
1669 _update_mask: Default::default(),
1670 _service_account_name: Default::default(),
1671 _authorization_code: Default::default(),
1672 _delegate: Default::default(),
1673 _additional_params: Default::default(),
1674 _scopes: Default::default(),
1675 }
1676 }
1677
1678 /// Create a builder to help you perform the following task:
1679 ///
1680 /// Creates transfer runs for a time range [start_time, end_time]. For each date - or whatever granularity the data source supports - in the range, one transfer run is created. Note that runs are created per UTC time in the time range. DEPRECATED: use StartManualTransferRuns instead.
1681 ///
1682 /// # Arguments
1683 ///
1684 /// * `request` - No description provided.
1685 /// * `parent` - Required. Transfer configuration name. If you are using the regionless method, the location must be `US` and the name should be in the following form: * `projects/{project_id}/transferConfigs/{config_id}` If you are using the regionalized method, the name should be in the following form: * `projects/{project_id}/locations/{location_id}/transferConfigs/{config_id}`
1686 pub fn transfer_configs_schedule_runs(
1687 &self,
1688 request: ScheduleTransferRunsRequest,
1689 parent: &str,
1690 ) -> ProjectTransferConfigScheduleRunCall<'a, C> {
1691 ProjectTransferConfigScheduleRunCall {
1692 hub: self.hub,
1693 _request: request,
1694 _parent: parent.to_string(),
1695 _delegate: Default::default(),
1696 _additional_params: Default::default(),
1697 _scopes: Default::default(),
1698 }
1699 }
1700
1701 /// Create a builder to help you perform the following task:
1702 ///
1703 /// Manually initiates transfer runs. You can schedule these runs in two ways: 1. For a specific point in time using the 'requested_run_time' parameter. 2. For a period between 'start_time' (inclusive) and 'end_time' (exclusive). If scheduling a single run, it is set to execute immediately (schedule_time equals the current time). When scheduling multiple runs within a time range, the first run starts now, and subsequent runs are delayed by 15 seconds each.
1704 ///
1705 /// # Arguments
1706 ///
1707 /// * `request` - No description provided.
1708 /// * `parent` - Required. Transfer configuration name. If you are using the regionless method, the location must be `US` and the name should be in the following form: * `projects/{project_id}/transferConfigs/{config_id}` If you are using the regionalized method, the name should be in the following form: * `projects/{project_id}/locations/{location_id}/transferConfigs/{config_id}`
1709 pub fn transfer_configs_start_manual_runs(
1710 &self,
1711 request: StartManualTransferRunsRequest,
1712 parent: &str,
1713 ) -> ProjectTransferConfigStartManualRunCall<'a, C> {
1714 ProjectTransferConfigStartManualRunCall {
1715 hub: self.hub,
1716 _request: request,
1717 _parent: parent.to_string(),
1718 _delegate: Default::default(),
1719 _additional_params: Default::default(),
1720 _scopes: Default::default(),
1721 }
1722 }
1723
1724 /// Create a builder to help you perform the following task:
1725 ///
1726 /// Enroll data sources in a user project. This allows users to create transfer configurations for these data sources. They will also appear in the ListDataSources RPC and as such, will appear in the [BigQuery UI](https://console.cloud.google.com/bigquery), and the documents can be found in the public guide for [BigQuery Web UI](https://cloud.google.com/bigquery/bigquery-web-ui) and [Data Transfer Service](https://cloud.google.com/bigquery/docs/working-with-transfers).
1727 ///
1728 /// # Arguments
1729 ///
1730 /// * `request` - No description provided.
1731 /// * `name` - Required. The name of the project resource in the form: `projects/{project_id}`
1732 pub fn enroll_data_sources(
1733 &self,
1734 request: EnrollDataSourcesRequest,
1735 name: &str,
1736 ) -> ProjectEnrollDataSourceCall<'a, C> {
1737 ProjectEnrollDataSourceCall {
1738 hub: self.hub,
1739 _request: request,
1740 _name: name.to_string(),
1741 _delegate: Default::default(),
1742 _additional_params: Default::default(),
1743 _scopes: Default::default(),
1744 }
1745 }
1746}
1747
1748// ###################
1749// CallBuilders ###
1750// #################
1751
1752/// Returns true if valid credentials exist for the given data source and requesting user.
1753///
1754/// A builder for the *dataSources.checkValidCreds* method supported by a *project* resource.
1755/// It is not used directly, but through a [`ProjectMethods`] instance.
1756///
1757/// # Example
1758///
1759/// Instantiate a resource method builder
1760///
1761/// ```test_harness,no_run
1762/// # extern crate hyper;
1763/// # extern crate hyper_rustls;
1764/// # extern crate google_bigquerydatatransfer1 as bigquerydatatransfer1;
1765/// use bigquerydatatransfer1::api::CheckValidCredsRequest;
1766/// # async fn dox() {
1767/// # use bigquerydatatransfer1::{BigQueryDataTransfer, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
1768///
1769/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
1770/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
1771/// # .with_native_roots()
1772/// # .unwrap()
1773/// # .https_only()
1774/// # .enable_http2()
1775/// # .build();
1776///
1777/// # let executor = hyper_util::rt::TokioExecutor::new();
1778/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
1779/// # secret,
1780/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
1781/// # yup_oauth2::client::CustomHyperClientBuilder::from(
1782/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
1783/// # ),
1784/// # ).build().await.unwrap();
1785///
1786/// # let client = hyper_util::client::legacy::Client::builder(
1787/// # hyper_util::rt::TokioExecutor::new()
1788/// # )
1789/// # .build(
1790/// # hyper_rustls::HttpsConnectorBuilder::new()
1791/// # .with_native_roots()
1792/// # .unwrap()
1793/// # .https_or_http()
1794/// # .enable_http2()
1795/// # .build()
1796/// # );
1797/// # let mut hub = BigQueryDataTransfer::new(client, auth);
1798/// // As the method needs a request, you would usually fill it with the desired information
1799/// // into the respective structure. Some of the parts shown here might not be applicable !
1800/// // Values shown here are possibly random and not representative !
1801/// let mut req = CheckValidCredsRequest::default();
1802///
1803/// // You can configure optional parameters by calling the respective setters at will, and
1804/// // execute the final call using `doit()`.
1805/// // Values shown here are possibly random and not representative !
1806/// let result = hub.projects().data_sources_check_valid_creds(req, "name")
1807/// .doit().await;
1808/// # }
1809/// ```
1810pub struct ProjectDataSourceCheckValidCredCall<'a, C>
1811where
1812 C: 'a,
1813{
1814 hub: &'a BigQueryDataTransfer<C>,
1815 _request: CheckValidCredsRequest,
1816 _name: String,
1817 _delegate: Option<&'a mut dyn common::Delegate>,
1818 _additional_params: HashMap<String, String>,
1819 _scopes: BTreeSet<String>,
1820}
1821
1822impl<'a, C> common::CallBuilder for ProjectDataSourceCheckValidCredCall<'a, C> {}
1823
1824impl<'a, C> ProjectDataSourceCheckValidCredCall<'a, C>
1825where
1826 C: common::Connector,
1827{
1828 /// Perform the operation you have build so far.
1829 pub async fn doit(mut self) -> common::Result<(common::Response, CheckValidCredsResponse)> {
1830 use std::borrow::Cow;
1831 use std::io::{Read, Seek};
1832
1833 use common::{url::Params, ToParts};
1834 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
1835
1836 let mut dd = common::DefaultDelegate;
1837 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
1838 dlg.begin(common::MethodInfo {
1839 id: "bigquerydatatransfer.projects.dataSources.checkValidCreds",
1840 http_method: hyper::Method::POST,
1841 });
1842
1843 for &field in ["alt", "name"].iter() {
1844 if self._additional_params.contains_key(field) {
1845 dlg.finished(false);
1846 return Err(common::Error::FieldClash(field));
1847 }
1848 }
1849
1850 let mut params = Params::with_capacity(4 + self._additional_params.len());
1851 params.push("name", self._name);
1852
1853 params.extend(self._additional_params.iter());
1854
1855 params.push("alt", "json");
1856 let mut url = self.hub._base_url.clone() + "v1/{+name}:checkValidCreds";
1857 if self._scopes.is_empty() {
1858 self._scopes
1859 .insert(Scope::CloudPlatformReadOnly.as_ref().to_string());
1860 }
1861
1862 #[allow(clippy::single_element_loop)]
1863 for &(find_this, param_name) in [("{+name}", "name")].iter() {
1864 url = params.uri_replacement(url, param_name, find_this, true);
1865 }
1866 {
1867 let to_remove = ["name"];
1868 params.remove_params(&to_remove);
1869 }
1870
1871 let url = params.parse_with_url(&url);
1872
1873 let mut json_mime_type = mime::APPLICATION_JSON;
1874 let mut request_value_reader = {
1875 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
1876 common::remove_json_null_values(&mut value);
1877 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
1878 serde_json::to_writer(&mut dst, &value).unwrap();
1879 dst
1880 };
1881 let request_size = request_value_reader
1882 .seek(std::io::SeekFrom::End(0))
1883 .unwrap();
1884 request_value_reader
1885 .seek(std::io::SeekFrom::Start(0))
1886 .unwrap();
1887
1888 loop {
1889 let token = match self
1890 .hub
1891 .auth
1892 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
1893 .await
1894 {
1895 Ok(token) => token,
1896 Err(e) => match dlg.token(e) {
1897 Ok(token) => token,
1898 Err(e) => {
1899 dlg.finished(false);
1900 return Err(common::Error::MissingToken(e));
1901 }
1902 },
1903 };
1904 request_value_reader
1905 .seek(std::io::SeekFrom::Start(0))
1906 .unwrap();
1907 let mut req_result = {
1908 let client = &self.hub.client;
1909 dlg.pre_request();
1910 let mut req_builder = hyper::Request::builder()
1911 .method(hyper::Method::POST)
1912 .uri(url.as_str())
1913 .header(USER_AGENT, self.hub._user_agent.clone());
1914
1915 if let Some(token) = token.as_ref() {
1916 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
1917 }
1918
1919 let request = req_builder
1920 .header(CONTENT_TYPE, json_mime_type.to_string())
1921 .header(CONTENT_LENGTH, request_size as u64)
1922 .body(common::to_body(
1923 request_value_reader.get_ref().clone().into(),
1924 ));
1925
1926 client.request(request.unwrap()).await
1927 };
1928
1929 match req_result {
1930 Err(err) => {
1931 if let common::Retry::After(d) = dlg.http_error(&err) {
1932 sleep(d).await;
1933 continue;
1934 }
1935 dlg.finished(false);
1936 return Err(common::Error::HttpError(err));
1937 }
1938 Ok(res) => {
1939 let (mut parts, body) = res.into_parts();
1940 let mut body = common::Body::new(body);
1941 if !parts.status.is_success() {
1942 let bytes = common::to_bytes(body).await.unwrap_or_default();
1943 let error = serde_json::from_str(&common::to_string(&bytes));
1944 let response = common::to_response(parts, bytes.into());
1945
1946 if let common::Retry::After(d) =
1947 dlg.http_failure(&response, error.as_ref().ok())
1948 {
1949 sleep(d).await;
1950 continue;
1951 }
1952
1953 dlg.finished(false);
1954
1955 return Err(match error {
1956 Ok(value) => common::Error::BadRequest(value),
1957 _ => common::Error::Failure(response),
1958 });
1959 }
1960 let response = {
1961 let bytes = common::to_bytes(body).await.unwrap_or_default();
1962 let encoded = common::to_string(&bytes);
1963 match serde_json::from_str(&encoded) {
1964 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
1965 Err(error) => {
1966 dlg.response_json_decode_error(&encoded, &error);
1967 return Err(common::Error::JsonDecodeError(
1968 encoded.to_string(),
1969 error,
1970 ));
1971 }
1972 }
1973 };
1974
1975 dlg.finished(true);
1976 return Ok(response);
1977 }
1978 }
1979 }
1980 }
1981
1982 ///
1983 /// Sets the *request* property to the given value.
1984 ///
1985 /// Even though the property as already been set when instantiating this call,
1986 /// we provide this method for API completeness.
1987 pub fn request(
1988 mut self,
1989 new_value: CheckValidCredsRequest,
1990 ) -> ProjectDataSourceCheckValidCredCall<'a, C> {
1991 self._request = new_value;
1992 self
1993 }
1994 /// Required. The name of the data source. If you are using the regionless method, the location must be `US` and the name should be in the following form: * `projects/{project_id}/dataSources/{data_source_id}` If you are using the regionalized method, the name should be in the following form: * `projects/{project_id}/locations/{location_id}/dataSources/{data_source_id}`
1995 ///
1996 /// Sets the *name* path property to the given value.
1997 ///
1998 /// Even though the property as already been set when instantiating this call,
1999 /// we provide this method for API completeness.
2000 pub fn name(mut self, new_value: &str) -> ProjectDataSourceCheckValidCredCall<'a, C> {
2001 self._name = new_value.to_string();
2002 self
2003 }
2004 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
2005 /// while executing the actual API request.
2006 ///
2007 /// ````text
2008 /// It should be used to handle progress information, and to implement a certain level of resilience.
2009 /// ````
2010 ///
2011 /// Sets the *delegate* property to the given value.
2012 pub fn delegate(
2013 mut self,
2014 new_value: &'a mut dyn common::Delegate,
2015 ) -> ProjectDataSourceCheckValidCredCall<'a, C> {
2016 self._delegate = Some(new_value);
2017 self
2018 }
2019
2020 /// Set any additional parameter of the query string used in the request.
2021 /// It should be used to set parameters which are not yet available through their own
2022 /// setters.
2023 ///
2024 /// Please note that this method must not be used to set any of the known parameters
2025 /// which have their own setter method. If done anyway, the request will fail.
2026 ///
2027 /// # Additional Parameters
2028 ///
2029 /// * *$.xgafv* (query-string) - V1 error format.
2030 /// * *access_token* (query-string) - OAuth access token.
2031 /// * *alt* (query-string) - Data format for response.
2032 /// * *callback* (query-string) - JSONP
2033 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
2034 /// * *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.
2035 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
2036 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
2037 /// * *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.
2038 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
2039 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
2040 pub fn param<T>(mut self, name: T, value: T) -> ProjectDataSourceCheckValidCredCall<'a, C>
2041 where
2042 T: AsRef<str>,
2043 {
2044 self._additional_params
2045 .insert(name.as_ref().to_string(), value.as_ref().to_string());
2046 self
2047 }
2048
2049 /// Identifies the authorization scope for the method you are building.
2050 ///
2051 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
2052 /// [`Scope::CloudPlatformReadOnly`].
2053 ///
2054 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
2055 /// tokens for more than one scope.
2056 ///
2057 /// Usually there is more than one suitable scope to authorize an operation, some of which may
2058 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
2059 /// sufficient, a read-write scope will do as well.
2060 pub fn add_scope<St>(mut self, scope: St) -> ProjectDataSourceCheckValidCredCall<'a, C>
2061 where
2062 St: AsRef<str>,
2063 {
2064 self._scopes.insert(String::from(scope.as_ref()));
2065 self
2066 }
2067 /// Identifies the authorization scope(s) for the method you are building.
2068 ///
2069 /// See [`Self::add_scope()`] for details.
2070 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectDataSourceCheckValidCredCall<'a, C>
2071 where
2072 I: IntoIterator<Item = St>,
2073 St: AsRef<str>,
2074 {
2075 self._scopes
2076 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
2077 self
2078 }
2079
2080 /// Removes all scopes, and no default scope will be used either.
2081 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
2082 /// for details).
2083 pub fn clear_scopes(mut self) -> ProjectDataSourceCheckValidCredCall<'a, C> {
2084 self._scopes.clear();
2085 self
2086 }
2087}
2088
2089/// Retrieves a supported data source and returns its settings.
2090///
2091/// A builder for the *dataSources.get* method supported by a *project* resource.
2092/// It is not used directly, but through a [`ProjectMethods`] instance.
2093///
2094/// # Example
2095///
2096/// Instantiate a resource method builder
2097///
2098/// ```test_harness,no_run
2099/// # extern crate hyper;
2100/// # extern crate hyper_rustls;
2101/// # extern crate google_bigquerydatatransfer1 as bigquerydatatransfer1;
2102/// # async fn dox() {
2103/// # use bigquerydatatransfer1::{BigQueryDataTransfer, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2104///
2105/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
2106/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
2107/// # .with_native_roots()
2108/// # .unwrap()
2109/// # .https_only()
2110/// # .enable_http2()
2111/// # .build();
2112///
2113/// # let executor = hyper_util::rt::TokioExecutor::new();
2114/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
2115/// # secret,
2116/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2117/// # yup_oauth2::client::CustomHyperClientBuilder::from(
2118/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
2119/// # ),
2120/// # ).build().await.unwrap();
2121///
2122/// # let client = hyper_util::client::legacy::Client::builder(
2123/// # hyper_util::rt::TokioExecutor::new()
2124/// # )
2125/// # .build(
2126/// # hyper_rustls::HttpsConnectorBuilder::new()
2127/// # .with_native_roots()
2128/// # .unwrap()
2129/// # .https_or_http()
2130/// # .enable_http2()
2131/// # .build()
2132/// # );
2133/// # let mut hub = BigQueryDataTransfer::new(client, auth);
2134/// // You can configure optional parameters by calling the respective setters at will, and
2135/// // execute the final call using `doit()`.
2136/// // Values shown here are possibly random and not representative !
2137/// let result = hub.projects().data_sources_get("name")
2138/// .doit().await;
2139/// # }
2140/// ```
2141pub struct ProjectDataSourceGetCall<'a, C>
2142where
2143 C: 'a,
2144{
2145 hub: &'a BigQueryDataTransfer<C>,
2146 _name: String,
2147 _delegate: Option<&'a mut dyn common::Delegate>,
2148 _additional_params: HashMap<String, String>,
2149 _scopes: BTreeSet<String>,
2150}
2151
2152impl<'a, C> common::CallBuilder for ProjectDataSourceGetCall<'a, C> {}
2153
2154impl<'a, C> ProjectDataSourceGetCall<'a, C>
2155where
2156 C: common::Connector,
2157{
2158 /// Perform the operation you have build so far.
2159 pub async fn doit(mut self) -> common::Result<(common::Response, DataSource)> {
2160 use std::borrow::Cow;
2161 use std::io::{Read, Seek};
2162
2163 use common::{url::Params, ToParts};
2164 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
2165
2166 let mut dd = common::DefaultDelegate;
2167 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
2168 dlg.begin(common::MethodInfo {
2169 id: "bigquerydatatransfer.projects.dataSources.get",
2170 http_method: hyper::Method::GET,
2171 });
2172
2173 for &field in ["alt", "name"].iter() {
2174 if self._additional_params.contains_key(field) {
2175 dlg.finished(false);
2176 return Err(common::Error::FieldClash(field));
2177 }
2178 }
2179
2180 let mut params = Params::with_capacity(3 + self._additional_params.len());
2181 params.push("name", self._name);
2182
2183 params.extend(self._additional_params.iter());
2184
2185 params.push("alt", "json");
2186 let mut url = self.hub._base_url.clone() + "v1/{+name}";
2187 if self._scopes.is_empty() {
2188 self._scopes
2189 .insert(Scope::CloudPlatformReadOnly.as_ref().to_string());
2190 }
2191
2192 #[allow(clippy::single_element_loop)]
2193 for &(find_this, param_name) in [("{+name}", "name")].iter() {
2194 url = params.uri_replacement(url, param_name, find_this, true);
2195 }
2196 {
2197 let to_remove = ["name"];
2198 params.remove_params(&to_remove);
2199 }
2200
2201 let url = params.parse_with_url(&url);
2202
2203 loop {
2204 let token = match self
2205 .hub
2206 .auth
2207 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
2208 .await
2209 {
2210 Ok(token) => token,
2211 Err(e) => match dlg.token(e) {
2212 Ok(token) => token,
2213 Err(e) => {
2214 dlg.finished(false);
2215 return Err(common::Error::MissingToken(e));
2216 }
2217 },
2218 };
2219 let mut req_result = {
2220 let client = &self.hub.client;
2221 dlg.pre_request();
2222 let mut req_builder = hyper::Request::builder()
2223 .method(hyper::Method::GET)
2224 .uri(url.as_str())
2225 .header(USER_AGENT, self.hub._user_agent.clone());
2226
2227 if let Some(token) = token.as_ref() {
2228 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
2229 }
2230
2231 let request = req_builder
2232 .header(CONTENT_LENGTH, 0_u64)
2233 .body(common::to_body::<String>(None));
2234
2235 client.request(request.unwrap()).await
2236 };
2237
2238 match req_result {
2239 Err(err) => {
2240 if let common::Retry::After(d) = dlg.http_error(&err) {
2241 sleep(d).await;
2242 continue;
2243 }
2244 dlg.finished(false);
2245 return Err(common::Error::HttpError(err));
2246 }
2247 Ok(res) => {
2248 let (mut parts, body) = res.into_parts();
2249 let mut body = common::Body::new(body);
2250 if !parts.status.is_success() {
2251 let bytes = common::to_bytes(body).await.unwrap_or_default();
2252 let error = serde_json::from_str(&common::to_string(&bytes));
2253 let response = common::to_response(parts, bytes.into());
2254
2255 if let common::Retry::After(d) =
2256 dlg.http_failure(&response, error.as_ref().ok())
2257 {
2258 sleep(d).await;
2259 continue;
2260 }
2261
2262 dlg.finished(false);
2263
2264 return Err(match error {
2265 Ok(value) => common::Error::BadRequest(value),
2266 _ => common::Error::Failure(response),
2267 });
2268 }
2269 let response = {
2270 let bytes = common::to_bytes(body).await.unwrap_or_default();
2271 let encoded = common::to_string(&bytes);
2272 match serde_json::from_str(&encoded) {
2273 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
2274 Err(error) => {
2275 dlg.response_json_decode_error(&encoded, &error);
2276 return Err(common::Error::JsonDecodeError(
2277 encoded.to_string(),
2278 error,
2279 ));
2280 }
2281 }
2282 };
2283
2284 dlg.finished(true);
2285 return Ok(response);
2286 }
2287 }
2288 }
2289 }
2290
2291 /// Required. The name of the resource requested. If you are using the regionless method, the location must be `US` and the name should be in the following form: * `projects/{project_id}/dataSources/{data_source_id}` If you are using the regionalized method, the name should be in the following form: * `projects/{project_id}/locations/{location_id}/dataSources/{data_source_id}`
2292 ///
2293 /// Sets the *name* path property to the given value.
2294 ///
2295 /// Even though the property as already been set when instantiating this call,
2296 /// we provide this method for API completeness.
2297 pub fn name(mut self, new_value: &str) -> ProjectDataSourceGetCall<'a, C> {
2298 self._name = new_value.to_string();
2299 self
2300 }
2301 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
2302 /// while executing the actual API request.
2303 ///
2304 /// ````text
2305 /// It should be used to handle progress information, and to implement a certain level of resilience.
2306 /// ````
2307 ///
2308 /// Sets the *delegate* property to the given value.
2309 pub fn delegate(
2310 mut self,
2311 new_value: &'a mut dyn common::Delegate,
2312 ) -> ProjectDataSourceGetCall<'a, C> {
2313 self._delegate = Some(new_value);
2314 self
2315 }
2316
2317 /// Set any additional parameter of the query string used in the request.
2318 /// It should be used to set parameters which are not yet available through their own
2319 /// setters.
2320 ///
2321 /// Please note that this method must not be used to set any of the known parameters
2322 /// which have their own setter method. If done anyway, the request will fail.
2323 ///
2324 /// # Additional Parameters
2325 ///
2326 /// * *$.xgafv* (query-string) - V1 error format.
2327 /// * *access_token* (query-string) - OAuth access token.
2328 /// * *alt* (query-string) - Data format for response.
2329 /// * *callback* (query-string) - JSONP
2330 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
2331 /// * *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.
2332 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
2333 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
2334 /// * *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.
2335 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
2336 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
2337 pub fn param<T>(mut self, name: T, value: T) -> ProjectDataSourceGetCall<'a, C>
2338 where
2339 T: AsRef<str>,
2340 {
2341 self._additional_params
2342 .insert(name.as_ref().to_string(), value.as_ref().to_string());
2343 self
2344 }
2345
2346 /// Identifies the authorization scope for the method you are building.
2347 ///
2348 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
2349 /// [`Scope::CloudPlatformReadOnly`].
2350 ///
2351 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
2352 /// tokens for more than one scope.
2353 ///
2354 /// Usually there is more than one suitable scope to authorize an operation, some of which may
2355 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
2356 /// sufficient, a read-write scope will do as well.
2357 pub fn add_scope<St>(mut self, scope: St) -> ProjectDataSourceGetCall<'a, C>
2358 where
2359 St: AsRef<str>,
2360 {
2361 self._scopes.insert(String::from(scope.as_ref()));
2362 self
2363 }
2364 /// Identifies the authorization scope(s) for the method you are building.
2365 ///
2366 /// See [`Self::add_scope()`] for details.
2367 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectDataSourceGetCall<'a, C>
2368 where
2369 I: IntoIterator<Item = St>,
2370 St: AsRef<str>,
2371 {
2372 self._scopes
2373 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
2374 self
2375 }
2376
2377 /// Removes all scopes, and no default scope will be used either.
2378 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
2379 /// for details).
2380 pub fn clear_scopes(mut self) -> ProjectDataSourceGetCall<'a, C> {
2381 self._scopes.clear();
2382 self
2383 }
2384}
2385
2386/// Lists supported data sources and returns their settings.
2387///
2388/// A builder for the *dataSources.list* method supported by a *project* resource.
2389/// It is not used directly, but through a [`ProjectMethods`] instance.
2390///
2391/// # Example
2392///
2393/// Instantiate a resource method builder
2394///
2395/// ```test_harness,no_run
2396/// # extern crate hyper;
2397/// # extern crate hyper_rustls;
2398/// # extern crate google_bigquerydatatransfer1 as bigquerydatatransfer1;
2399/// # async fn dox() {
2400/// # use bigquerydatatransfer1::{BigQueryDataTransfer, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2401///
2402/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
2403/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
2404/// # .with_native_roots()
2405/// # .unwrap()
2406/// # .https_only()
2407/// # .enable_http2()
2408/// # .build();
2409///
2410/// # let executor = hyper_util::rt::TokioExecutor::new();
2411/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
2412/// # secret,
2413/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2414/// # yup_oauth2::client::CustomHyperClientBuilder::from(
2415/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
2416/// # ),
2417/// # ).build().await.unwrap();
2418///
2419/// # let client = hyper_util::client::legacy::Client::builder(
2420/// # hyper_util::rt::TokioExecutor::new()
2421/// # )
2422/// # .build(
2423/// # hyper_rustls::HttpsConnectorBuilder::new()
2424/// # .with_native_roots()
2425/// # .unwrap()
2426/// # .https_or_http()
2427/// # .enable_http2()
2428/// # .build()
2429/// # );
2430/// # let mut hub = BigQueryDataTransfer::new(client, auth);
2431/// // You can configure optional parameters by calling the respective setters at will, and
2432/// // execute the final call using `doit()`.
2433/// // Values shown here are possibly random and not representative !
2434/// let result = hub.projects().data_sources_list("parent")
2435/// .page_token("sanctus")
2436/// .page_size(-80)
2437/// .doit().await;
2438/// # }
2439/// ```
2440pub struct ProjectDataSourceListCall<'a, C>
2441where
2442 C: 'a,
2443{
2444 hub: &'a BigQueryDataTransfer<C>,
2445 _parent: String,
2446 _page_token: Option<String>,
2447 _page_size: Option<i32>,
2448 _delegate: Option<&'a mut dyn common::Delegate>,
2449 _additional_params: HashMap<String, String>,
2450 _scopes: BTreeSet<String>,
2451}
2452
2453impl<'a, C> common::CallBuilder for ProjectDataSourceListCall<'a, C> {}
2454
2455impl<'a, C> ProjectDataSourceListCall<'a, C>
2456where
2457 C: common::Connector,
2458{
2459 /// Perform the operation you have build so far.
2460 pub async fn doit(mut self) -> common::Result<(common::Response, ListDataSourcesResponse)> {
2461 use std::borrow::Cow;
2462 use std::io::{Read, Seek};
2463
2464 use common::{url::Params, ToParts};
2465 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
2466
2467 let mut dd = common::DefaultDelegate;
2468 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
2469 dlg.begin(common::MethodInfo {
2470 id: "bigquerydatatransfer.projects.dataSources.list",
2471 http_method: hyper::Method::GET,
2472 });
2473
2474 for &field in ["alt", "parent", "pageToken", "pageSize"].iter() {
2475 if self._additional_params.contains_key(field) {
2476 dlg.finished(false);
2477 return Err(common::Error::FieldClash(field));
2478 }
2479 }
2480
2481 let mut params = Params::with_capacity(5 + self._additional_params.len());
2482 params.push("parent", self._parent);
2483 if let Some(value) = self._page_token.as_ref() {
2484 params.push("pageToken", value);
2485 }
2486 if let Some(value) = self._page_size.as_ref() {
2487 params.push("pageSize", value.to_string());
2488 }
2489
2490 params.extend(self._additional_params.iter());
2491
2492 params.push("alt", "json");
2493 let mut url = self.hub._base_url.clone() + "v1/{+parent}/dataSources";
2494 if self._scopes.is_empty() {
2495 self._scopes
2496 .insert(Scope::CloudPlatformReadOnly.as_ref().to_string());
2497 }
2498
2499 #[allow(clippy::single_element_loop)]
2500 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
2501 url = params.uri_replacement(url, param_name, find_this, true);
2502 }
2503 {
2504 let to_remove = ["parent"];
2505 params.remove_params(&to_remove);
2506 }
2507
2508 let url = params.parse_with_url(&url);
2509
2510 loop {
2511 let token = match self
2512 .hub
2513 .auth
2514 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
2515 .await
2516 {
2517 Ok(token) => token,
2518 Err(e) => match dlg.token(e) {
2519 Ok(token) => token,
2520 Err(e) => {
2521 dlg.finished(false);
2522 return Err(common::Error::MissingToken(e));
2523 }
2524 },
2525 };
2526 let mut req_result = {
2527 let client = &self.hub.client;
2528 dlg.pre_request();
2529 let mut req_builder = hyper::Request::builder()
2530 .method(hyper::Method::GET)
2531 .uri(url.as_str())
2532 .header(USER_AGENT, self.hub._user_agent.clone());
2533
2534 if let Some(token) = token.as_ref() {
2535 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
2536 }
2537
2538 let request = req_builder
2539 .header(CONTENT_LENGTH, 0_u64)
2540 .body(common::to_body::<String>(None));
2541
2542 client.request(request.unwrap()).await
2543 };
2544
2545 match req_result {
2546 Err(err) => {
2547 if let common::Retry::After(d) = dlg.http_error(&err) {
2548 sleep(d).await;
2549 continue;
2550 }
2551 dlg.finished(false);
2552 return Err(common::Error::HttpError(err));
2553 }
2554 Ok(res) => {
2555 let (mut parts, body) = res.into_parts();
2556 let mut body = common::Body::new(body);
2557 if !parts.status.is_success() {
2558 let bytes = common::to_bytes(body).await.unwrap_or_default();
2559 let error = serde_json::from_str(&common::to_string(&bytes));
2560 let response = common::to_response(parts, bytes.into());
2561
2562 if let common::Retry::After(d) =
2563 dlg.http_failure(&response, error.as_ref().ok())
2564 {
2565 sleep(d).await;
2566 continue;
2567 }
2568
2569 dlg.finished(false);
2570
2571 return Err(match error {
2572 Ok(value) => common::Error::BadRequest(value),
2573 _ => common::Error::Failure(response),
2574 });
2575 }
2576 let response = {
2577 let bytes = common::to_bytes(body).await.unwrap_or_default();
2578 let encoded = common::to_string(&bytes);
2579 match serde_json::from_str(&encoded) {
2580 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
2581 Err(error) => {
2582 dlg.response_json_decode_error(&encoded, &error);
2583 return Err(common::Error::JsonDecodeError(
2584 encoded.to_string(),
2585 error,
2586 ));
2587 }
2588 }
2589 };
2590
2591 dlg.finished(true);
2592 return Ok(response);
2593 }
2594 }
2595 }
2596 }
2597
2598 /// Required. The BigQuery project id for which data sources should be returned. Must be in the form: `projects/{project_id}` or `projects/{project_id}/locations/{location_id}`
2599 ///
2600 /// Sets the *parent* path property to the given value.
2601 ///
2602 /// Even though the property as already been set when instantiating this call,
2603 /// we provide this method for API completeness.
2604 pub fn parent(mut self, new_value: &str) -> ProjectDataSourceListCall<'a, C> {
2605 self._parent = new_value.to_string();
2606 self
2607 }
2608 /// Pagination token, which can be used to request a specific page of `ListDataSourcesRequest` list results. For multiple-page results, `ListDataSourcesResponse` outputs a `next_page` token, which can be used as the `page_token` value to request the next page of list results.
2609 ///
2610 /// Sets the *page token* query property to the given value.
2611 pub fn page_token(mut self, new_value: &str) -> ProjectDataSourceListCall<'a, C> {
2612 self._page_token = Some(new_value.to_string());
2613 self
2614 }
2615 /// Page size. The default page size is the maximum value of 1000 results.
2616 ///
2617 /// Sets the *page size* query property to the given value.
2618 pub fn page_size(mut self, new_value: i32) -> ProjectDataSourceListCall<'a, C> {
2619 self._page_size = Some(new_value);
2620 self
2621 }
2622 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
2623 /// while executing the actual API request.
2624 ///
2625 /// ````text
2626 /// It should be used to handle progress information, and to implement a certain level of resilience.
2627 /// ````
2628 ///
2629 /// Sets the *delegate* property to the given value.
2630 pub fn delegate(
2631 mut self,
2632 new_value: &'a mut dyn common::Delegate,
2633 ) -> ProjectDataSourceListCall<'a, C> {
2634 self._delegate = Some(new_value);
2635 self
2636 }
2637
2638 /// Set any additional parameter of the query string used in the request.
2639 /// It should be used to set parameters which are not yet available through their own
2640 /// setters.
2641 ///
2642 /// Please note that this method must not be used to set any of the known parameters
2643 /// which have their own setter method. If done anyway, the request will fail.
2644 ///
2645 /// # Additional Parameters
2646 ///
2647 /// * *$.xgafv* (query-string) - V1 error format.
2648 /// * *access_token* (query-string) - OAuth access token.
2649 /// * *alt* (query-string) - Data format for response.
2650 /// * *callback* (query-string) - JSONP
2651 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
2652 /// * *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.
2653 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
2654 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
2655 /// * *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.
2656 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
2657 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
2658 pub fn param<T>(mut self, name: T, value: T) -> ProjectDataSourceListCall<'a, C>
2659 where
2660 T: AsRef<str>,
2661 {
2662 self._additional_params
2663 .insert(name.as_ref().to_string(), value.as_ref().to_string());
2664 self
2665 }
2666
2667 /// Identifies the authorization scope for the method you are building.
2668 ///
2669 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
2670 /// [`Scope::CloudPlatformReadOnly`].
2671 ///
2672 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
2673 /// tokens for more than one scope.
2674 ///
2675 /// Usually there is more than one suitable scope to authorize an operation, some of which may
2676 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
2677 /// sufficient, a read-write scope will do as well.
2678 pub fn add_scope<St>(mut self, scope: St) -> ProjectDataSourceListCall<'a, C>
2679 where
2680 St: AsRef<str>,
2681 {
2682 self._scopes.insert(String::from(scope.as_ref()));
2683 self
2684 }
2685 /// Identifies the authorization scope(s) for the method you are building.
2686 ///
2687 /// See [`Self::add_scope()`] for details.
2688 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectDataSourceListCall<'a, C>
2689 where
2690 I: IntoIterator<Item = St>,
2691 St: AsRef<str>,
2692 {
2693 self._scopes
2694 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
2695 self
2696 }
2697
2698 /// Removes all scopes, and no default scope will be used either.
2699 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
2700 /// for details).
2701 pub fn clear_scopes(mut self) -> ProjectDataSourceListCall<'a, C> {
2702 self._scopes.clear();
2703 self
2704 }
2705}
2706
2707/// Returns true if valid credentials exist for the given data source and requesting user.
2708///
2709/// A builder for the *locations.dataSources.checkValidCreds* method supported by a *project* resource.
2710/// It is not used directly, but through a [`ProjectMethods`] instance.
2711///
2712/// # Example
2713///
2714/// Instantiate a resource method builder
2715///
2716/// ```test_harness,no_run
2717/// # extern crate hyper;
2718/// # extern crate hyper_rustls;
2719/// # extern crate google_bigquerydatatransfer1 as bigquerydatatransfer1;
2720/// use bigquerydatatransfer1::api::CheckValidCredsRequest;
2721/// # async fn dox() {
2722/// # use bigquerydatatransfer1::{BigQueryDataTransfer, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2723///
2724/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
2725/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
2726/// # .with_native_roots()
2727/// # .unwrap()
2728/// # .https_only()
2729/// # .enable_http2()
2730/// # .build();
2731///
2732/// # let executor = hyper_util::rt::TokioExecutor::new();
2733/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
2734/// # secret,
2735/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2736/// # yup_oauth2::client::CustomHyperClientBuilder::from(
2737/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
2738/// # ),
2739/// # ).build().await.unwrap();
2740///
2741/// # let client = hyper_util::client::legacy::Client::builder(
2742/// # hyper_util::rt::TokioExecutor::new()
2743/// # )
2744/// # .build(
2745/// # hyper_rustls::HttpsConnectorBuilder::new()
2746/// # .with_native_roots()
2747/// # .unwrap()
2748/// # .https_or_http()
2749/// # .enable_http2()
2750/// # .build()
2751/// # );
2752/// # let mut hub = BigQueryDataTransfer::new(client, auth);
2753/// // As the method needs a request, you would usually fill it with the desired information
2754/// // into the respective structure. Some of the parts shown here might not be applicable !
2755/// // Values shown here are possibly random and not representative !
2756/// let mut req = CheckValidCredsRequest::default();
2757///
2758/// // You can configure optional parameters by calling the respective setters at will, and
2759/// // execute the final call using `doit()`.
2760/// // Values shown here are possibly random and not representative !
2761/// let result = hub.projects().locations_data_sources_check_valid_creds(req, "name")
2762/// .doit().await;
2763/// # }
2764/// ```
2765pub struct ProjectLocationDataSourceCheckValidCredCall<'a, C>
2766where
2767 C: 'a,
2768{
2769 hub: &'a BigQueryDataTransfer<C>,
2770 _request: CheckValidCredsRequest,
2771 _name: String,
2772 _delegate: Option<&'a mut dyn common::Delegate>,
2773 _additional_params: HashMap<String, String>,
2774 _scopes: BTreeSet<String>,
2775}
2776
2777impl<'a, C> common::CallBuilder for ProjectLocationDataSourceCheckValidCredCall<'a, C> {}
2778
2779impl<'a, C> ProjectLocationDataSourceCheckValidCredCall<'a, C>
2780where
2781 C: common::Connector,
2782{
2783 /// Perform the operation you have build so far.
2784 pub async fn doit(mut self) -> common::Result<(common::Response, CheckValidCredsResponse)> {
2785 use std::borrow::Cow;
2786 use std::io::{Read, Seek};
2787
2788 use common::{url::Params, ToParts};
2789 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
2790
2791 let mut dd = common::DefaultDelegate;
2792 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
2793 dlg.begin(common::MethodInfo {
2794 id: "bigquerydatatransfer.projects.locations.dataSources.checkValidCreds",
2795 http_method: hyper::Method::POST,
2796 });
2797
2798 for &field in ["alt", "name"].iter() {
2799 if self._additional_params.contains_key(field) {
2800 dlg.finished(false);
2801 return Err(common::Error::FieldClash(field));
2802 }
2803 }
2804
2805 let mut params = Params::with_capacity(4 + self._additional_params.len());
2806 params.push("name", self._name);
2807
2808 params.extend(self._additional_params.iter());
2809
2810 params.push("alt", "json");
2811 let mut url = self.hub._base_url.clone() + "v1/{+name}:checkValidCreds";
2812 if self._scopes.is_empty() {
2813 self._scopes
2814 .insert(Scope::CloudPlatformReadOnly.as_ref().to_string());
2815 }
2816
2817 #[allow(clippy::single_element_loop)]
2818 for &(find_this, param_name) in [("{+name}", "name")].iter() {
2819 url = params.uri_replacement(url, param_name, find_this, true);
2820 }
2821 {
2822 let to_remove = ["name"];
2823 params.remove_params(&to_remove);
2824 }
2825
2826 let url = params.parse_with_url(&url);
2827
2828 let mut json_mime_type = mime::APPLICATION_JSON;
2829 let mut request_value_reader = {
2830 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
2831 common::remove_json_null_values(&mut value);
2832 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
2833 serde_json::to_writer(&mut dst, &value).unwrap();
2834 dst
2835 };
2836 let request_size = request_value_reader
2837 .seek(std::io::SeekFrom::End(0))
2838 .unwrap();
2839 request_value_reader
2840 .seek(std::io::SeekFrom::Start(0))
2841 .unwrap();
2842
2843 loop {
2844 let token = match self
2845 .hub
2846 .auth
2847 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
2848 .await
2849 {
2850 Ok(token) => token,
2851 Err(e) => match dlg.token(e) {
2852 Ok(token) => token,
2853 Err(e) => {
2854 dlg.finished(false);
2855 return Err(common::Error::MissingToken(e));
2856 }
2857 },
2858 };
2859 request_value_reader
2860 .seek(std::io::SeekFrom::Start(0))
2861 .unwrap();
2862 let mut req_result = {
2863 let client = &self.hub.client;
2864 dlg.pre_request();
2865 let mut req_builder = hyper::Request::builder()
2866 .method(hyper::Method::POST)
2867 .uri(url.as_str())
2868 .header(USER_AGENT, self.hub._user_agent.clone());
2869
2870 if let Some(token) = token.as_ref() {
2871 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
2872 }
2873
2874 let request = req_builder
2875 .header(CONTENT_TYPE, json_mime_type.to_string())
2876 .header(CONTENT_LENGTH, request_size as u64)
2877 .body(common::to_body(
2878 request_value_reader.get_ref().clone().into(),
2879 ));
2880
2881 client.request(request.unwrap()).await
2882 };
2883
2884 match req_result {
2885 Err(err) => {
2886 if let common::Retry::After(d) = dlg.http_error(&err) {
2887 sleep(d).await;
2888 continue;
2889 }
2890 dlg.finished(false);
2891 return Err(common::Error::HttpError(err));
2892 }
2893 Ok(res) => {
2894 let (mut parts, body) = res.into_parts();
2895 let mut body = common::Body::new(body);
2896 if !parts.status.is_success() {
2897 let bytes = common::to_bytes(body).await.unwrap_or_default();
2898 let error = serde_json::from_str(&common::to_string(&bytes));
2899 let response = common::to_response(parts, bytes.into());
2900
2901 if let common::Retry::After(d) =
2902 dlg.http_failure(&response, error.as_ref().ok())
2903 {
2904 sleep(d).await;
2905 continue;
2906 }
2907
2908 dlg.finished(false);
2909
2910 return Err(match error {
2911 Ok(value) => common::Error::BadRequest(value),
2912 _ => common::Error::Failure(response),
2913 });
2914 }
2915 let response = {
2916 let bytes = common::to_bytes(body).await.unwrap_or_default();
2917 let encoded = common::to_string(&bytes);
2918 match serde_json::from_str(&encoded) {
2919 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
2920 Err(error) => {
2921 dlg.response_json_decode_error(&encoded, &error);
2922 return Err(common::Error::JsonDecodeError(
2923 encoded.to_string(),
2924 error,
2925 ));
2926 }
2927 }
2928 };
2929
2930 dlg.finished(true);
2931 return Ok(response);
2932 }
2933 }
2934 }
2935 }
2936
2937 ///
2938 /// Sets the *request* property to the given value.
2939 ///
2940 /// Even though the property as already been set when instantiating this call,
2941 /// we provide this method for API completeness.
2942 pub fn request(
2943 mut self,
2944 new_value: CheckValidCredsRequest,
2945 ) -> ProjectLocationDataSourceCheckValidCredCall<'a, C> {
2946 self._request = new_value;
2947 self
2948 }
2949 /// Required. The name of the data source. If you are using the regionless method, the location must be `US` and the name should be in the following form: * `projects/{project_id}/dataSources/{data_source_id}` If you are using the regionalized method, the name should be in the following form: * `projects/{project_id}/locations/{location_id}/dataSources/{data_source_id}`
2950 ///
2951 /// Sets the *name* path property to the given value.
2952 ///
2953 /// Even though the property as already been set when instantiating this call,
2954 /// we provide this method for API completeness.
2955 pub fn name(mut self, new_value: &str) -> ProjectLocationDataSourceCheckValidCredCall<'a, C> {
2956 self._name = new_value.to_string();
2957 self
2958 }
2959 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
2960 /// while executing the actual API request.
2961 ///
2962 /// ````text
2963 /// It should be used to handle progress information, and to implement a certain level of resilience.
2964 /// ````
2965 ///
2966 /// Sets the *delegate* property to the given value.
2967 pub fn delegate(
2968 mut self,
2969 new_value: &'a mut dyn common::Delegate,
2970 ) -> ProjectLocationDataSourceCheckValidCredCall<'a, C> {
2971 self._delegate = Some(new_value);
2972 self
2973 }
2974
2975 /// Set any additional parameter of the query string used in the request.
2976 /// It should be used to set parameters which are not yet available through their own
2977 /// setters.
2978 ///
2979 /// Please note that this method must not be used to set any of the known parameters
2980 /// which have their own setter method. If done anyway, the request will fail.
2981 ///
2982 /// # Additional Parameters
2983 ///
2984 /// * *$.xgafv* (query-string) - V1 error format.
2985 /// * *access_token* (query-string) - OAuth access token.
2986 /// * *alt* (query-string) - Data format for response.
2987 /// * *callback* (query-string) - JSONP
2988 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
2989 /// * *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.
2990 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
2991 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
2992 /// * *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.
2993 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
2994 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
2995 pub fn param<T>(
2996 mut self,
2997 name: T,
2998 value: T,
2999 ) -> ProjectLocationDataSourceCheckValidCredCall<'a, C>
3000 where
3001 T: AsRef<str>,
3002 {
3003 self._additional_params
3004 .insert(name.as_ref().to_string(), value.as_ref().to_string());
3005 self
3006 }
3007
3008 /// Identifies the authorization scope for the method you are building.
3009 ///
3010 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
3011 /// [`Scope::CloudPlatformReadOnly`].
3012 ///
3013 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
3014 /// tokens for more than one scope.
3015 ///
3016 /// Usually there is more than one suitable scope to authorize an operation, some of which may
3017 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
3018 /// sufficient, a read-write scope will do as well.
3019 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationDataSourceCheckValidCredCall<'a, C>
3020 where
3021 St: AsRef<str>,
3022 {
3023 self._scopes.insert(String::from(scope.as_ref()));
3024 self
3025 }
3026 /// Identifies the authorization scope(s) for the method you are building.
3027 ///
3028 /// See [`Self::add_scope()`] for details.
3029 pub fn add_scopes<I, St>(
3030 mut self,
3031 scopes: I,
3032 ) -> ProjectLocationDataSourceCheckValidCredCall<'a, C>
3033 where
3034 I: IntoIterator<Item = St>,
3035 St: AsRef<str>,
3036 {
3037 self._scopes
3038 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
3039 self
3040 }
3041
3042 /// Removes all scopes, and no default scope will be used either.
3043 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
3044 /// for details).
3045 pub fn clear_scopes(mut self) -> ProjectLocationDataSourceCheckValidCredCall<'a, C> {
3046 self._scopes.clear();
3047 self
3048 }
3049}
3050
3051/// Retrieves a supported data source and returns its settings.
3052///
3053/// A builder for the *locations.dataSources.get* method supported by a *project* resource.
3054/// It is not used directly, but through a [`ProjectMethods`] instance.
3055///
3056/// # Example
3057///
3058/// Instantiate a resource method builder
3059///
3060/// ```test_harness,no_run
3061/// # extern crate hyper;
3062/// # extern crate hyper_rustls;
3063/// # extern crate google_bigquerydatatransfer1 as bigquerydatatransfer1;
3064/// # async fn dox() {
3065/// # use bigquerydatatransfer1::{BigQueryDataTransfer, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3066///
3067/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
3068/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
3069/// # .with_native_roots()
3070/// # .unwrap()
3071/// # .https_only()
3072/// # .enable_http2()
3073/// # .build();
3074///
3075/// # let executor = hyper_util::rt::TokioExecutor::new();
3076/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
3077/// # secret,
3078/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3079/// # yup_oauth2::client::CustomHyperClientBuilder::from(
3080/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
3081/// # ),
3082/// # ).build().await.unwrap();
3083///
3084/// # let client = hyper_util::client::legacy::Client::builder(
3085/// # hyper_util::rt::TokioExecutor::new()
3086/// # )
3087/// # .build(
3088/// # hyper_rustls::HttpsConnectorBuilder::new()
3089/// # .with_native_roots()
3090/// # .unwrap()
3091/// # .https_or_http()
3092/// # .enable_http2()
3093/// # .build()
3094/// # );
3095/// # let mut hub = BigQueryDataTransfer::new(client, auth);
3096/// // You can configure optional parameters by calling the respective setters at will, and
3097/// // execute the final call using `doit()`.
3098/// // Values shown here are possibly random and not representative !
3099/// let result = hub.projects().locations_data_sources_get("name")
3100/// .doit().await;
3101/// # }
3102/// ```
3103pub struct ProjectLocationDataSourceGetCall<'a, C>
3104where
3105 C: 'a,
3106{
3107 hub: &'a BigQueryDataTransfer<C>,
3108 _name: String,
3109 _delegate: Option<&'a mut dyn common::Delegate>,
3110 _additional_params: HashMap<String, String>,
3111 _scopes: BTreeSet<String>,
3112}
3113
3114impl<'a, C> common::CallBuilder for ProjectLocationDataSourceGetCall<'a, C> {}
3115
3116impl<'a, C> ProjectLocationDataSourceGetCall<'a, C>
3117where
3118 C: common::Connector,
3119{
3120 /// Perform the operation you have build so far.
3121 pub async fn doit(mut self) -> common::Result<(common::Response, DataSource)> {
3122 use std::borrow::Cow;
3123 use std::io::{Read, Seek};
3124
3125 use common::{url::Params, ToParts};
3126 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
3127
3128 let mut dd = common::DefaultDelegate;
3129 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
3130 dlg.begin(common::MethodInfo {
3131 id: "bigquerydatatransfer.projects.locations.dataSources.get",
3132 http_method: hyper::Method::GET,
3133 });
3134
3135 for &field in ["alt", "name"].iter() {
3136 if self._additional_params.contains_key(field) {
3137 dlg.finished(false);
3138 return Err(common::Error::FieldClash(field));
3139 }
3140 }
3141
3142 let mut params = Params::with_capacity(3 + self._additional_params.len());
3143 params.push("name", self._name);
3144
3145 params.extend(self._additional_params.iter());
3146
3147 params.push("alt", "json");
3148 let mut url = self.hub._base_url.clone() + "v1/{+name}";
3149 if self._scopes.is_empty() {
3150 self._scopes
3151 .insert(Scope::CloudPlatformReadOnly.as_ref().to_string());
3152 }
3153
3154 #[allow(clippy::single_element_loop)]
3155 for &(find_this, param_name) in [("{+name}", "name")].iter() {
3156 url = params.uri_replacement(url, param_name, find_this, true);
3157 }
3158 {
3159 let to_remove = ["name"];
3160 params.remove_params(&to_remove);
3161 }
3162
3163 let url = params.parse_with_url(&url);
3164
3165 loop {
3166 let token = match self
3167 .hub
3168 .auth
3169 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
3170 .await
3171 {
3172 Ok(token) => token,
3173 Err(e) => match dlg.token(e) {
3174 Ok(token) => token,
3175 Err(e) => {
3176 dlg.finished(false);
3177 return Err(common::Error::MissingToken(e));
3178 }
3179 },
3180 };
3181 let mut req_result = {
3182 let client = &self.hub.client;
3183 dlg.pre_request();
3184 let mut req_builder = hyper::Request::builder()
3185 .method(hyper::Method::GET)
3186 .uri(url.as_str())
3187 .header(USER_AGENT, self.hub._user_agent.clone());
3188
3189 if let Some(token) = token.as_ref() {
3190 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
3191 }
3192
3193 let request = req_builder
3194 .header(CONTENT_LENGTH, 0_u64)
3195 .body(common::to_body::<String>(None));
3196
3197 client.request(request.unwrap()).await
3198 };
3199
3200 match req_result {
3201 Err(err) => {
3202 if let common::Retry::After(d) = dlg.http_error(&err) {
3203 sleep(d).await;
3204 continue;
3205 }
3206 dlg.finished(false);
3207 return Err(common::Error::HttpError(err));
3208 }
3209 Ok(res) => {
3210 let (mut parts, body) = res.into_parts();
3211 let mut body = common::Body::new(body);
3212 if !parts.status.is_success() {
3213 let bytes = common::to_bytes(body).await.unwrap_or_default();
3214 let error = serde_json::from_str(&common::to_string(&bytes));
3215 let response = common::to_response(parts, bytes.into());
3216
3217 if let common::Retry::After(d) =
3218 dlg.http_failure(&response, error.as_ref().ok())
3219 {
3220 sleep(d).await;
3221 continue;
3222 }
3223
3224 dlg.finished(false);
3225
3226 return Err(match error {
3227 Ok(value) => common::Error::BadRequest(value),
3228 _ => common::Error::Failure(response),
3229 });
3230 }
3231 let response = {
3232 let bytes = common::to_bytes(body).await.unwrap_or_default();
3233 let encoded = common::to_string(&bytes);
3234 match serde_json::from_str(&encoded) {
3235 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
3236 Err(error) => {
3237 dlg.response_json_decode_error(&encoded, &error);
3238 return Err(common::Error::JsonDecodeError(
3239 encoded.to_string(),
3240 error,
3241 ));
3242 }
3243 }
3244 };
3245
3246 dlg.finished(true);
3247 return Ok(response);
3248 }
3249 }
3250 }
3251 }
3252
3253 /// Required. The name of the resource requested. If you are using the regionless method, the location must be `US` and the name should be in the following form: * `projects/{project_id}/dataSources/{data_source_id}` If you are using the regionalized method, the name should be in the following form: * `projects/{project_id}/locations/{location_id}/dataSources/{data_source_id}`
3254 ///
3255 /// Sets the *name* path property to the given value.
3256 ///
3257 /// Even though the property as already been set when instantiating this call,
3258 /// we provide this method for API completeness.
3259 pub fn name(mut self, new_value: &str) -> ProjectLocationDataSourceGetCall<'a, C> {
3260 self._name = new_value.to_string();
3261 self
3262 }
3263 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3264 /// while executing the actual API request.
3265 ///
3266 /// ````text
3267 /// It should be used to handle progress information, and to implement a certain level of resilience.
3268 /// ````
3269 ///
3270 /// Sets the *delegate* property to the given value.
3271 pub fn delegate(
3272 mut self,
3273 new_value: &'a mut dyn common::Delegate,
3274 ) -> ProjectLocationDataSourceGetCall<'a, C> {
3275 self._delegate = Some(new_value);
3276 self
3277 }
3278
3279 /// Set any additional parameter of the query string used in the request.
3280 /// It should be used to set parameters which are not yet available through their own
3281 /// setters.
3282 ///
3283 /// Please note that this method must not be used to set any of the known parameters
3284 /// which have their own setter method. If done anyway, the request will fail.
3285 ///
3286 /// # Additional Parameters
3287 ///
3288 /// * *$.xgafv* (query-string) - V1 error format.
3289 /// * *access_token* (query-string) - OAuth access token.
3290 /// * *alt* (query-string) - Data format for response.
3291 /// * *callback* (query-string) - JSONP
3292 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
3293 /// * *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.
3294 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3295 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
3296 /// * *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.
3297 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
3298 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
3299 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationDataSourceGetCall<'a, C>
3300 where
3301 T: AsRef<str>,
3302 {
3303 self._additional_params
3304 .insert(name.as_ref().to_string(), value.as_ref().to_string());
3305 self
3306 }
3307
3308 /// Identifies the authorization scope for the method you are building.
3309 ///
3310 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
3311 /// [`Scope::CloudPlatformReadOnly`].
3312 ///
3313 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
3314 /// tokens for more than one scope.
3315 ///
3316 /// Usually there is more than one suitable scope to authorize an operation, some of which may
3317 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
3318 /// sufficient, a read-write scope will do as well.
3319 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationDataSourceGetCall<'a, C>
3320 where
3321 St: AsRef<str>,
3322 {
3323 self._scopes.insert(String::from(scope.as_ref()));
3324 self
3325 }
3326 /// Identifies the authorization scope(s) for the method you are building.
3327 ///
3328 /// See [`Self::add_scope()`] for details.
3329 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationDataSourceGetCall<'a, C>
3330 where
3331 I: IntoIterator<Item = St>,
3332 St: AsRef<str>,
3333 {
3334 self._scopes
3335 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
3336 self
3337 }
3338
3339 /// Removes all scopes, and no default scope will be used either.
3340 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
3341 /// for details).
3342 pub fn clear_scopes(mut self) -> ProjectLocationDataSourceGetCall<'a, C> {
3343 self._scopes.clear();
3344 self
3345 }
3346}
3347
3348/// Lists supported data sources and returns their settings.
3349///
3350/// A builder for the *locations.dataSources.list* method supported by a *project* resource.
3351/// It is not used directly, but through a [`ProjectMethods`] instance.
3352///
3353/// # Example
3354///
3355/// Instantiate a resource method builder
3356///
3357/// ```test_harness,no_run
3358/// # extern crate hyper;
3359/// # extern crate hyper_rustls;
3360/// # extern crate google_bigquerydatatransfer1 as bigquerydatatransfer1;
3361/// # async fn dox() {
3362/// # use bigquerydatatransfer1::{BigQueryDataTransfer, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3363///
3364/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
3365/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
3366/// # .with_native_roots()
3367/// # .unwrap()
3368/// # .https_only()
3369/// # .enable_http2()
3370/// # .build();
3371///
3372/// # let executor = hyper_util::rt::TokioExecutor::new();
3373/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
3374/// # secret,
3375/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3376/// # yup_oauth2::client::CustomHyperClientBuilder::from(
3377/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
3378/// # ),
3379/// # ).build().await.unwrap();
3380///
3381/// # let client = hyper_util::client::legacy::Client::builder(
3382/// # hyper_util::rt::TokioExecutor::new()
3383/// # )
3384/// # .build(
3385/// # hyper_rustls::HttpsConnectorBuilder::new()
3386/// # .with_native_roots()
3387/// # .unwrap()
3388/// # .https_or_http()
3389/// # .enable_http2()
3390/// # .build()
3391/// # );
3392/// # let mut hub = BigQueryDataTransfer::new(client, auth);
3393/// // You can configure optional parameters by calling the respective setters at will, and
3394/// // execute the final call using `doit()`.
3395/// // Values shown here are possibly random and not representative !
3396/// let result = hub.projects().locations_data_sources_list("parent")
3397/// .page_token("duo")
3398/// .page_size(-55)
3399/// .doit().await;
3400/// # }
3401/// ```
3402pub struct ProjectLocationDataSourceListCall<'a, C>
3403where
3404 C: 'a,
3405{
3406 hub: &'a BigQueryDataTransfer<C>,
3407 _parent: String,
3408 _page_token: Option<String>,
3409 _page_size: Option<i32>,
3410 _delegate: Option<&'a mut dyn common::Delegate>,
3411 _additional_params: HashMap<String, String>,
3412 _scopes: BTreeSet<String>,
3413}
3414
3415impl<'a, C> common::CallBuilder for ProjectLocationDataSourceListCall<'a, C> {}
3416
3417impl<'a, C> ProjectLocationDataSourceListCall<'a, C>
3418where
3419 C: common::Connector,
3420{
3421 /// Perform the operation you have build so far.
3422 pub async fn doit(mut self) -> common::Result<(common::Response, ListDataSourcesResponse)> {
3423 use std::borrow::Cow;
3424 use std::io::{Read, Seek};
3425
3426 use common::{url::Params, ToParts};
3427 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
3428
3429 let mut dd = common::DefaultDelegate;
3430 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
3431 dlg.begin(common::MethodInfo {
3432 id: "bigquerydatatransfer.projects.locations.dataSources.list",
3433 http_method: hyper::Method::GET,
3434 });
3435
3436 for &field in ["alt", "parent", "pageToken", "pageSize"].iter() {
3437 if self._additional_params.contains_key(field) {
3438 dlg.finished(false);
3439 return Err(common::Error::FieldClash(field));
3440 }
3441 }
3442
3443 let mut params = Params::with_capacity(5 + self._additional_params.len());
3444 params.push("parent", self._parent);
3445 if let Some(value) = self._page_token.as_ref() {
3446 params.push("pageToken", value);
3447 }
3448 if let Some(value) = self._page_size.as_ref() {
3449 params.push("pageSize", value.to_string());
3450 }
3451
3452 params.extend(self._additional_params.iter());
3453
3454 params.push("alt", "json");
3455 let mut url = self.hub._base_url.clone() + "v1/{+parent}/dataSources";
3456 if self._scopes.is_empty() {
3457 self._scopes
3458 .insert(Scope::CloudPlatformReadOnly.as_ref().to_string());
3459 }
3460
3461 #[allow(clippy::single_element_loop)]
3462 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
3463 url = params.uri_replacement(url, param_name, find_this, true);
3464 }
3465 {
3466 let to_remove = ["parent"];
3467 params.remove_params(&to_remove);
3468 }
3469
3470 let url = params.parse_with_url(&url);
3471
3472 loop {
3473 let token = match self
3474 .hub
3475 .auth
3476 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
3477 .await
3478 {
3479 Ok(token) => token,
3480 Err(e) => match dlg.token(e) {
3481 Ok(token) => token,
3482 Err(e) => {
3483 dlg.finished(false);
3484 return Err(common::Error::MissingToken(e));
3485 }
3486 },
3487 };
3488 let mut req_result = {
3489 let client = &self.hub.client;
3490 dlg.pre_request();
3491 let mut req_builder = hyper::Request::builder()
3492 .method(hyper::Method::GET)
3493 .uri(url.as_str())
3494 .header(USER_AGENT, self.hub._user_agent.clone());
3495
3496 if let Some(token) = token.as_ref() {
3497 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
3498 }
3499
3500 let request = req_builder
3501 .header(CONTENT_LENGTH, 0_u64)
3502 .body(common::to_body::<String>(None));
3503
3504 client.request(request.unwrap()).await
3505 };
3506
3507 match req_result {
3508 Err(err) => {
3509 if let common::Retry::After(d) = dlg.http_error(&err) {
3510 sleep(d).await;
3511 continue;
3512 }
3513 dlg.finished(false);
3514 return Err(common::Error::HttpError(err));
3515 }
3516 Ok(res) => {
3517 let (mut parts, body) = res.into_parts();
3518 let mut body = common::Body::new(body);
3519 if !parts.status.is_success() {
3520 let bytes = common::to_bytes(body).await.unwrap_or_default();
3521 let error = serde_json::from_str(&common::to_string(&bytes));
3522 let response = common::to_response(parts, bytes.into());
3523
3524 if let common::Retry::After(d) =
3525 dlg.http_failure(&response, error.as_ref().ok())
3526 {
3527 sleep(d).await;
3528 continue;
3529 }
3530
3531 dlg.finished(false);
3532
3533 return Err(match error {
3534 Ok(value) => common::Error::BadRequest(value),
3535 _ => common::Error::Failure(response),
3536 });
3537 }
3538 let response = {
3539 let bytes = common::to_bytes(body).await.unwrap_or_default();
3540 let encoded = common::to_string(&bytes);
3541 match serde_json::from_str(&encoded) {
3542 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
3543 Err(error) => {
3544 dlg.response_json_decode_error(&encoded, &error);
3545 return Err(common::Error::JsonDecodeError(
3546 encoded.to_string(),
3547 error,
3548 ));
3549 }
3550 }
3551 };
3552
3553 dlg.finished(true);
3554 return Ok(response);
3555 }
3556 }
3557 }
3558 }
3559
3560 /// Required. The BigQuery project id for which data sources should be returned. Must be in the form: `projects/{project_id}` or `projects/{project_id}/locations/{location_id}`
3561 ///
3562 /// Sets the *parent* path property to the given value.
3563 ///
3564 /// Even though the property as already been set when instantiating this call,
3565 /// we provide this method for API completeness.
3566 pub fn parent(mut self, new_value: &str) -> ProjectLocationDataSourceListCall<'a, C> {
3567 self._parent = new_value.to_string();
3568 self
3569 }
3570 /// Pagination token, which can be used to request a specific page of `ListDataSourcesRequest` list results. For multiple-page results, `ListDataSourcesResponse` outputs a `next_page` token, which can be used as the `page_token` value to request the next page of list results.
3571 ///
3572 /// Sets the *page token* query property to the given value.
3573 pub fn page_token(mut self, new_value: &str) -> ProjectLocationDataSourceListCall<'a, C> {
3574 self._page_token = Some(new_value.to_string());
3575 self
3576 }
3577 /// Page size. The default page size is the maximum value of 1000 results.
3578 ///
3579 /// Sets the *page size* query property to the given value.
3580 pub fn page_size(mut self, new_value: i32) -> ProjectLocationDataSourceListCall<'a, C> {
3581 self._page_size = Some(new_value);
3582 self
3583 }
3584 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3585 /// while executing the actual API request.
3586 ///
3587 /// ````text
3588 /// It should be used to handle progress information, and to implement a certain level of resilience.
3589 /// ````
3590 ///
3591 /// Sets the *delegate* property to the given value.
3592 pub fn delegate(
3593 mut self,
3594 new_value: &'a mut dyn common::Delegate,
3595 ) -> ProjectLocationDataSourceListCall<'a, C> {
3596 self._delegate = Some(new_value);
3597 self
3598 }
3599
3600 /// Set any additional parameter of the query string used in the request.
3601 /// It should be used to set parameters which are not yet available through their own
3602 /// setters.
3603 ///
3604 /// Please note that this method must not be used to set any of the known parameters
3605 /// which have their own setter method. If done anyway, the request will fail.
3606 ///
3607 /// # Additional Parameters
3608 ///
3609 /// * *$.xgafv* (query-string) - V1 error format.
3610 /// * *access_token* (query-string) - OAuth access token.
3611 /// * *alt* (query-string) - Data format for response.
3612 /// * *callback* (query-string) - JSONP
3613 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
3614 /// * *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.
3615 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3616 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
3617 /// * *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.
3618 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
3619 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
3620 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationDataSourceListCall<'a, C>
3621 where
3622 T: AsRef<str>,
3623 {
3624 self._additional_params
3625 .insert(name.as_ref().to_string(), value.as_ref().to_string());
3626 self
3627 }
3628
3629 /// Identifies the authorization scope for the method you are building.
3630 ///
3631 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
3632 /// [`Scope::CloudPlatformReadOnly`].
3633 ///
3634 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
3635 /// tokens for more than one scope.
3636 ///
3637 /// Usually there is more than one suitable scope to authorize an operation, some of which may
3638 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
3639 /// sufficient, a read-write scope will do as well.
3640 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationDataSourceListCall<'a, C>
3641 where
3642 St: AsRef<str>,
3643 {
3644 self._scopes.insert(String::from(scope.as_ref()));
3645 self
3646 }
3647 /// Identifies the authorization scope(s) for the method you are building.
3648 ///
3649 /// See [`Self::add_scope()`] for details.
3650 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationDataSourceListCall<'a, C>
3651 where
3652 I: IntoIterator<Item = St>,
3653 St: AsRef<str>,
3654 {
3655 self._scopes
3656 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
3657 self
3658 }
3659
3660 /// Removes all scopes, and no default scope will be used either.
3661 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
3662 /// for details).
3663 pub fn clear_scopes(mut self) -> ProjectLocationDataSourceListCall<'a, C> {
3664 self._scopes.clear();
3665 self
3666 }
3667}
3668
3669/// Returns log messages for the transfer run.
3670///
3671/// A builder for the *locations.transferConfigs.runs.transferLogs.list* method supported by a *project* resource.
3672/// It is not used directly, but through a [`ProjectMethods`] instance.
3673///
3674/// # Example
3675///
3676/// Instantiate a resource method builder
3677///
3678/// ```test_harness,no_run
3679/// # extern crate hyper;
3680/// # extern crate hyper_rustls;
3681/// # extern crate google_bigquerydatatransfer1 as bigquerydatatransfer1;
3682/// # async fn dox() {
3683/// # use bigquerydatatransfer1::{BigQueryDataTransfer, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3684///
3685/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
3686/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
3687/// # .with_native_roots()
3688/// # .unwrap()
3689/// # .https_only()
3690/// # .enable_http2()
3691/// # .build();
3692///
3693/// # let executor = hyper_util::rt::TokioExecutor::new();
3694/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
3695/// # secret,
3696/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3697/// # yup_oauth2::client::CustomHyperClientBuilder::from(
3698/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
3699/// # ),
3700/// # ).build().await.unwrap();
3701///
3702/// # let client = hyper_util::client::legacy::Client::builder(
3703/// # hyper_util::rt::TokioExecutor::new()
3704/// # )
3705/// # .build(
3706/// # hyper_rustls::HttpsConnectorBuilder::new()
3707/// # .with_native_roots()
3708/// # .unwrap()
3709/// # .https_or_http()
3710/// # .enable_http2()
3711/// # .build()
3712/// # );
3713/// # let mut hub = BigQueryDataTransfer::new(client, auth);
3714/// // You can configure optional parameters by calling the respective setters at will, and
3715/// // execute the final call using `doit()`.
3716/// // Values shown here are possibly random and not representative !
3717/// let result = hub.projects().locations_transfer_configs_runs_transfer_logs_list("parent")
3718/// .page_token("Lorem")
3719/// .page_size(-12)
3720/// .add_message_types("eos")
3721/// .doit().await;
3722/// # }
3723/// ```
3724pub struct ProjectLocationTransferConfigRunTransferLogListCall<'a, C>
3725where
3726 C: 'a,
3727{
3728 hub: &'a BigQueryDataTransfer<C>,
3729 _parent: String,
3730 _page_token: Option<String>,
3731 _page_size: Option<i32>,
3732 _message_types: Vec<String>,
3733 _delegate: Option<&'a mut dyn common::Delegate>,
3734 _additional_params: HashMap<String, String>,
3735 _scopes: BTreeSet<String>,
3736}
3737
3738impl<'a, C> common::CallBuilder for ProjectLocationTransferConfigRunTransferLogListCall<'a, C> {}
3739
3740impl<'a, C> ProjectLocationTransferConfigRunTransferLogListCall<'a, C>
3741where
3742 C: common::Connector,
3743{
3744 /// Perform the operation you have build so far.
3745 pub async fn doit(mut self) -> common::Result<(common::Response, ListTransferLogsResponse)> {
3746 use std::borrow::Cow;
3747 use std::io::{Read, Seek};
3748
3749 use common::{url::Params, ToParts};
3750 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
3751
3752 let mut dd = common::DefaultDelegate;
3753 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
3754 dlg.begin(common::MethodInfo {
3755 id: "bigquerydatatransfer.projects.locations.transferConfigs.runs.transferLogs.list",
3756 http_method: hyper::Method::GET,
3757 });
3758
3759 for &field in ["alt", "parent", "pageToken", "pageSize", "messageTypes"].iter() {
3760 if self._additional_params.contains_key(field) {
3761 dlg.finished(false);
3762 return Err(common::Error::FieldClash(field));
3763 }
3764 }
3765
3766 let mut params = Params::with_capacity(6 + self._additional_params.len());
3767 params.push("parent", self._parent);
3768 if let Some(value) = self._page_token.as_ref() {
3769 params.push("pageToken", value);
3770 }
3771 if let Some(value) = self._page_size.as_ref() {
3772 params.push("pageSize", value.to_string());
3773 }
3774 if !self._message_types.is_empty() {
3775 for f in self._message_types.iter() {
3776 params.push("messageTypes", f);
3777 }
3778 }
3779
3780 params.extend(self._additional_params.iter());
3781
3782 params.push("alt", "json");
3783 let mut url = self.hub._base_url.clone() + "v1/{+parent}/transferLogs";
3784 if self._scopes.is_empty() {
3785 self._scopes
3786 .insert(Scope::CloudPlatformReadOnly.as_ref().to_string());
3787 }
3788
3789 #[allow(clippy::single_element_loop)]
3790 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
3791 url = params.uri_replacement(url, param_name, find_this, true);
3792 }
3793 {
3794 let to_remove = ["parent"];
3795 params.remove_params(&to_remove);
3796 }
3797
3798 let url = params.parse_with_url(&url);
3799
3800 loop {
3801 let token = match self
3802 .hub
3803 .auth
3804 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
3805 .await
3806 {
3807 Ok(token) => token,
3808 Err(e) => match dlg.token(e) {
3809 Ok(token) => token,
3810 Err(e) => {
3811 dlg.finished(false);
3812 return Err(common::Error::MissingToken(e));
3813 }
3814 },
3815 };
3816 let mut req_result = {
3817 let client = &self.hub.client;
3818 dlg.pre_request();
3819 let mut req_builder = hyper::Request::builder()
3820 .method(hyper::Method::GET)
3821 .uri(url.as_str())
3822 .header(USER_AGENT, self.hub._user_agent.clone());
3823
3824 if let Some(token) = token.as_ref() {
3825 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
3826 }
3827
3828 let request = req_builder
3829 .header(CONTENT_LENGTH, 0_u64)
3830 .body(common::to_body::<String>(None));
3831
3832 client.request(request.unwrap()).await
3833 };
3834
3835 match req_result {
3836 Err(err) => {
3837 if let common::Retry::After(d) = dlg.http_error(&err) {
3838 sleep(d).await;
3839 continue;
3840 }
3841 dlg.finished(false);
3842 return Err(common::Error::HttpError(err));
3843 }
3844 Ok(res) => {
3845 let (mut parts, body) = res.into_parts();
3846 let mut body = common::Body::new(body);
3847 if !parts.status.is_success() {
3848 let bytes = common::to_bytes(body).await.unwrap_or_default();
3849 let error = serde_json::from_str(&common::to_string(&bytes));
3850 let response = common::to_response(parts, bytes.into());
3851
3852 if let common::Retry::After(d) =
3853 dlg.http_failure(&response, error.as_ref().ok())
3854 {
3855 sleep(d).await;
3856 continue;
3857 }
3858
3859 dlg.finished(false);
3860
3861 return Err(match error {
3862 Ok(value) => common::Error::BadRequest(value),
3863 _ => common::Error::Failure(response),
3864 });
3865 }
3866 let response = {
3867 let bytes = common::to_bytes(body).await.unwrap_or_default();
3868 let encoded = common::to_string(&bytes);
3869 match serde_json::from_str(&encoded) {
3870 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
3871 Err(error) => {
3872 dlg.response_json_decode_error(&encoded, &error);
3873 return Err(common::Error::JsonDecodeError(
3874 encoded.to_string(),
3875 error,
3876 ));
3877 }
3878 }
3879 };
3880
3881 dlg.finished(true);
3882 return Ok(response);
3883 }
3884 }
3885 }
3886 }
3887
3888 /// Required. Transfer run name. If you are using the regionless method, the location must be `US` and the name should be in the following form: * `projects/{project_id}/transferConfigs/{config_id}/runs/{run_id}` If you are using the regionalized method, the name should be in the following form: * `projects/{project_id}/locations/{location_id}/transferConfigs/{config_id}/runs/{run_id}`
3889 ///
3890 /// Sets the *parent* path property to the given value.
3891 ///
3892 /// Even though the property as already been set when instantiating this call,
3893 /// we provide this method for API completeness.
3894 pub fn parent(
3895 mut self,
3896 new_value: &str,
3897 ) -> ProjectLocationTransferConfigRunTransferLogListCall<'a, C> {
3898 self._parent = new_value.to_string();
3899 self
3900 }
3901 /// Pagination token, which can be used to request a specific page of `ListTransferLogsRequest` list results. For multiple-page results, `ListTransferLogsResponse` outputs a `next_page` token, which can be used as the `page_token` value to request the next page of list results.
3902 ///
3903 /// Sets the *page token* query property to the given value.
3904 pub fn page_token(
3905 mut self,
3906 new_value: &str,
3907 ) -> ProjectLocationTransferConfigRunTransferLogListCall<'a, C> {
3908 self._page_token = Some(new_value.to_string());
3909 self
3910 }
3911 /// Page size. The default page size is the maximum value of 1000 results.
3912 ///
3913 /// Sets the *page size* query property to the given value.
3914 pub fn page_size(
3915 mut self,
3916 new_value: i32,
3917 ) -> ProjectLocationTransferConfigRunTransferLogListCall<'a, C> {
3918 self._page_size = Some(new_value);
3919 self
3920 }
3921 /// Message types to return. If not populated - INFO, WARNING and ERROR messages are returned.
3922 ///
3923 /// Append the given value to the *message types* query property.
3924 /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
3925 pub fn add_message_types(
3926 mut self,
3927 new_value: &str,
3928 ) -> ProjectLocationTransferConfigRunTransferLogListCall<'a, C> {
3929 self._message_types.push(new_value.to_string());
3930 self
3931 }
3932 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3933 /// while executing the actual API request.
3934 ///
3935 /// ````text
3936 /// It should be used to handle progress information, and to implement a certain level of resilience.
3937 /// ````
3938 ///
3939 /// Sets the *delegate* property to the given value.
3940 pub fn delegate(
3941 mut self,
3942 new_value: &'a mut dyn common::Delegate,
3943 ) -> ProjectLocationTransferConfigRunTransferLogListCall<'a, C> {
3944 self._delegate = Some(new_value);
3945 self
3946 }
3947
3948 /// Set any additional parameter of the query string used in the request.
3949 /// It should be used to set parameters which are not yet available through their own
3950 /// setters.
3951 ///
3952 /// Please note that this method must not be used to set any of the known parameters
3953 /// which have their own setter method. If done anyway, the request will fail.
3954 ///
3955 /// # Additional Parameters
3956 ///
3957 /// * *$.xgafv* (query-string) - V1 error format.
3958 /// * *access_token* (query-string) - OAuth access token.
3959 /// * *alt* (query-string) - Data format for response.
3960 /// * *callback* (query-string) - JSONP
3961 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
3962 /// * *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.
3963 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3964 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
3965 /// * *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.
3966 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
3967 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
3968 pub fn param<T>(
3969 mut self,
3970 name: T,
3971 value: T,
3972 ) -> ProjectLocationTransferConfigRunTransferLogListCall<'a, C>
3973 where
3974 T: AsRef<str>,
3975 {
3976 self._additional_params
3977 .insert(name.as_ref().to_string(), value.as_ref().to_string());
3978 self
3979 }
3980
3981 /// Identifies the authorization scope for the method you are building.
3982 ///
3983 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
3984 /// [`Scope::CloudPlatformReadOnly`].
3985 ///
3986 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
3987 /// tokens for more than one scope.
3988 ///
3989 /// Usually there is more than one suitable scope to authorize an operation, some of which may
3990 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
3991 /// sufficient, a read-write scope will do as well.
3992 pub fn add_scope<St>(
3993 mut self,
3994 scope: St,
3995 ) -> ProjectLocationTransferConfigRunTransferLogListCall<'a, C>
3996 where
3997 St: AsRef<str>,
3998 {
3999 self._scopes.insert(String::from(scope.as_ref()));
4000 self
4001 }
4002 /// Identifies the authorization scope(s) for the method you are building.
4003 ///
4004 /// See [`Self::add_scope()`] for details.
4005 pub fn add_scopes<I, St>(
4006 mut self,
4007 scopes: I,
4008 ) -> ProjectLocationTransferConfigRunTransferLogListCall<'a, C>
4009 where
4010 I: IntoIterator<Item = St>,
4011 St: AsRef<str>,
4012 {
4013 self._scopes
4014 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
4015 self
4016 }
4017
4018 /// Removes all scopes, and no default scope will be used either.
4019 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
4020 /// for details).
4021 pub fn clear_scopes(mut self) -> ProjectLocationTransferConfigRunTransferLogListCall<'a, C> {
4022 self._scopes.clear();
4023 self
4024 }
4025}
4026
4027/// Deletes the specified transfer run.
4028///
4029/// A builder for the *locations.transferConfigs.runs.delete* method supported by a *project* resource.
4030/// It is not used directly, but through a [`ProjectMethods`] instance.
4031///
4032/// # Example
4033///
4034/// Instantiate a resource method builder
4035///
4036/// ```test_harness,no_run
4037/// # extern crate hyper;
4038/// # extern crate hyper_rustls;
4039/// # extern crate google_bigquerydatatransfer1 as bigquerydatatransfer1;
4040/// # async fn dox() {
4041/// # use bigquerydatatransfer1::{BigQueryDataTransfer, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4042///
4043/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4044/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
4045/// # .with_native_roots()
4046/// # .unwrap()
4047/// # .https_only()
4048/// # .enable_http2()
4049/// # .build();
4050///
4051/// # let executor = hyper_util::rt::TokioExecutor::new();
4052/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
4053/// # secret,
4054/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4055/// # yup_oauth2::client::CustomHyperClientBuilder::from(
4056/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
4057/// # ),
4058/// # ).build().await.unwrap();
4059///
4060/// # let client = hyper_util::client::legacy::Client::builder(
4061/// # hyper_util::rt::TokioExecutor::new()
4062/// # )
4063/// # .build(
4064/// # hyper_rustls::HttpsConnectorBuilder::new()
4065/// # .with_native_roots()
4066/// # .unwrap()
4067/// # .https_or_http()
4068/// # .enable_http2()
4069/// # .build()
4070/// # );
4071/// # let mut hub = BigQueryDataTransfer::new(client, auth);
4072/// // You can configure optional parameters by calling the respective setters at will, and
4073/// // execute the final call using `doit()`.
4074/// // Values shown here are possibly random and not representative !
4075/// let result = hub.projects().locations_transfer_configs_runs_delete("name")
4076/// .doit().await;
4077/// # }
4078/// ```
4079pub struct ProjectLocationTransferConfigRunDeleteCall<'a, C>
4080where
4081 C: 'a,
4082{
4083 hub: &'a BigQueryDataTransfer<C>,
4084 _name: String,
4085 _delegate: Option<&'a mut dyn common::Delegate>,
4086 _additional_params: HashMap<String, String>,
4087 _scopes: BTreeSet<String>,
4088}
4089
4090impl<'a, C> common::CallBuilder for ProjectLocationTransferConfigRunDeleteCall<'a, C> {}
4091
4092impl<'a, C> ProjectLocationTransferConfigRunDeleteCall<'a, C>
4093where
4094 C: common::Connector,
4095{
4096 /// Perform the operation you have build so far.
4097 pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
4098 use std::borrow::Cow;
4099 use std::io::{Read, Seek};
4100
4101 use common::{url::Params, ToParts};
4102 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
4103
4104 let mut dd = common::DefaultDelegate;
4105 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
4106 dlg.begin(common::MethodInfo {
4107 id: "bigquerydatatransfer.projects.locations.transferConfigs.runs.delete",
4108 http_method: hyper::Method::DELETE,
4109 });
4110
4111 for &field in ["alt", "name"].iter() {
4112 if self._additional_params.contains_key(field) {
4113 dlg.finished(false);
4114 return Err(common::Error::FieldClash(field));
4115 }
4116 }
4117
4118 let mut params = Params::with_capacity(3 + self._additional_params.len());
4119 params.push("name", self._name);
4120
4121 params.extend(self._additional_params.iter());
4122
4123 params.push("alt", "json");
4124 let mut url = self.hub._base_url.clone() + "v1/{+name}";
4125 if self._scopes.is_empty() {
4126 self._scopes
4127 .insert(Scope::CloudPlatform.as_ref().to_string());
4128 }
4129
4130 #[allow(clippy::single_element_loop)]
4131 for &(find_this, param_name) in [("{+name}", "name")].iter() {
4132 url = params.uri_replacement(url, param_name, find_this, true);
4133 }
4134 {
4135 let to_remove = ["name"];
4136 params.remove_params(&to_remove);
4137 }
4138
4139 let url = params.parse_with_url(&url);
4140
4141 loop {
4142 let token = match self
4143 .hub
4144 .auth
4145 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
4146 .await
4147 {
4148 Ok(token) => token,
4149 Err(e) => match dlg.token(e) {
4150 Ok(token) => token,
4151 Err(e) => {
4152 dlg.finished(false);
4153 return Err(common::Error::MissingToken(e));
4154 }
4155 },
4156 };
4157 let mut req_result = {
4158 let client = &self.hub.client;
4159 dlg.pre_request();
4160 let mut req_builder = hyper::Request::builder()
4161 .method(hyper::Method::DELETE)
4162 .uri(url.as_str())
4163 .header(USER_AGENT, self.hub._user_agent.clone());
4164
4165 if let Some(token) = token.as_ref() {
4166 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
4167 }
4168
4169 let request = req_builder
4170 .header(CONTENT_LENGTH, 0_u64)
4171 .body(common::to_body::<String>(None));
4172
4173 client.request(request.unwrap()).await
4174 };
4175
4176 match req_result {
4177 Err(err) => {
4178 if let common::Retry::After(d) = dlg.http_error(&err) {
4179 sleep(d).await;
4180 continue;
4181 }
4182 dlg.finished(false);
4183 return Err(common::Error::HttpError(err));
4184 }
4185 Ok(res) => {
4186 let (mut parts, body) = res.into_parts();
4187 let mut body = common::Body::new(body);
4188 if !parts.status.is_success() {
4189 let bytes = common::to_bytes(body).await.unwrap_or_default();
4190 let error = serde_json::from_str(&common::to_string(&bytes));
4191 let response = common::to_response(parts, bytes.into());
4192
4193 if let common::Retry::After(d) =
4194 dlg.http_failure(&response, error.as_ref().ok())
4195 {
4196 sleep(d).await;
4197 continue;
4198 }
4199
4200 dlg.finished(false);
4201
4202 return Err(match error {
4203 Ok(value) => common::Error::BadRequest(value),
4204 _ => common::Error::Failure(response),
4205 });
4206 }
4207 let response = {
4208 let bytes = common::to_bytes(body).await.unwrap_or_default();
4209 let encoded = common::to_string(&bytes);
4210 match serde_json::from_str(&encoded) {
4211 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4212 Err(error) => {
4213 dlg.response_json_decode_error(&encoded, &error);
4214 return Err(common::Error::JsonDecodeError(
4215 encoded.to_string(),
4216 error,
4217 ));
4218 }
4219 }
4220 };
4221
4222 dlg.finished(true);
4223 return Ok(response);
4224 }
4225 }
4226 }
4227 }
4228
4229 /// Required. The name of the resource requested. If you are using the regionless method, the location must be `US` and the name should be in the following form: * `projects/{project_id}/transferConfigs/{config_id}/runs/{run_id}` If you are using the regionalized method, the name should be in the following form: * `projects/{project_id}/locations/{location_id}/transferConfigs/{config_id}/runs/{run_id}`
4230 ///
4231 /// Sets the *name* path property to the given value.
4232 ///
4233 /// Even though the property as already been set when instantiating this call,
4234 /// we provide this method for API completeness.
4235 pub fn name(mut self, new_value: &str) -> ProjectLocationTransferConfigRunDeleteCall<'a, C> {
4236 self._name = new_value.to_string();
4237 self
4238 }
4239 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4240 /// while executing the actual API request.
4241 ///
4242 /// ````text
4243 /// It should be used to handle progress information, and to implement a certain level of resilience.
4244 /// ````
4245 ///
4246 /// Sets the *delegate* property to the given value.
4247 pub fn delegate(
4248 mut self,
4249 new_value: &'a mut dyn common::Delegate,
4250 ) -> ProjectLocationTransferConfigRunDeleteCall<'a, C> {
4251 self._delegate = Some(new_value);
4252 self
4253 }
4254
4255 /// Set any additional parameter of the query string used in the request.
4256 /// It should be used to set parameters which are not yet available through their own
4257 /// setters.
4258 ///
4259 /// Please note that this method must not be used to set any of the known parameters
4260 /// which have their own setter method. If done anyway, the request will fail.
4261 ///
4262 /// # Additional Parameters
4263 ///
4264 /// * *$.xgafv* (query-string) - V1 error format.
4265 /// * *access_token* (query-string) - OAuth access token.
4266 /// * *alt* (query-string) - Data format for response.
4267 /// * *callback* (query-string) - JSONP
4268 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4269 /// * *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.
4270 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4271 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4272 /// * *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.
4273 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4274 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4275 pub fn param<T>(
4276 mut self,
4277 name: T,
4278 value: T,
4279 ) -> ProjectLocationTransferConfigRunDeleteCall<'a, C>
4280 where
4281 T: AsRef<str>,
4282 {
4283 self._additional_params
4284 .insert(name.as_ref().to_string(), value.as_ref().to_string());
4285 self
4286 }
4287
4288 /// Identifies the authorization scope for the method you are building.
4289 ///
4290 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
4291 /// [`Scope::CloudPlatform`].
4292 ///
4293 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4294 /// tokens for more than one scope.
4295 ///
4296 /// Usually there is more than one suitable scope to authorize an operation, some of which may
4297 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
4298 /// sufficient, a read-write scope will do as well.
4299 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationTransferConfigRunDeleteCall<'a, C>
4300 where
4301 St: AsRef<str>,
4302 {
4303 self._scopes.insert(String::from(scope.as_ref()));
4304 self
4305 }
4306 /// Identifies the authorization scope(s) for the method you are building.
4307 ///
4308 /// See [`Self::add_scope()`] for details.
4309 pub fn add_scopes<I, St>(
4310 mut self,
4311 scopes: I,
4312 ) -> ProjectLocationTransferConfigRunDeleteCall<'a, C>
4313 where
4314 I: IntoIterator<Item = St>,
4315 St: AsRef<str>,
4316 {
4317 self._scopes
4318 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
4319 self
4320 }
4321
4322 /// Removes all scopes, and no default scope will be used either.
4323 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
4324 /// for details).
4325 pub fn clear_scopes(mut self) -> ProjectLocationTransferConfigRunDeleteCall<'a, C> {
4326 self._scopes.clear();
4327 self
4328 }
4329}
4330
4331/// Returns information about the particular transfer run.
4332///
4333/// A builder for the *locations.transferConfigs.runs.get* method supported by a *project* resource.
4334/// It is not used directly, but through a [`ProjectMethods`] instance.
4335///
4336/// # Example
4337///
4338/// Instantiate a resource method builder
4339///
4340/// ```test_harness,no_run
4341/// # extern crate hyper;
4342/// # extern crate hyper_rustls;
4343/// # extern crate google_bigquerydatatransfer1 as bigquerydatatransfer1;
4344/// # async fn dox() {
4345/// # use bigquerydatatransfer1::{BigQueryDataTransfer, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4346///
4347/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4348/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
4349/// # .with_native_roots()
4350/// # .unwrap()
4351/// # .https_only()
4352/// # .enable_http2()
4353/// # .build();
4354///
4355/// # let executor = hyper_util::rt::TokioExecutor::new();
4356/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
4357/// # secret,
4358/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4359/// # yup_oauth2::client::CustomHyperClientBuilder::from(
4360/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
4361/// # ),
4362/// # ).build().await.unwrap();
4363///
4364/// # let client = hyper_util::client::legacy::Client::builder(
4365/// # hyper_util::rt::TokioExecutor::new()
4366/// # )
4367/// # .build(
4368/// # hyper_rustls::HttpsConnectorBuilder::new()
4369/// # .with_native_roots()
4370/// # .unwrap()
4371/// # .https_or_http()
4372/// # .enable_http2()
4373/// # .build()
4374/// # );
4375/// # let mut hub = BigQueryDataTransfer::new(client, auth);
4376/// // You can configure optional parameters by calling the respective setters at will, and
4377/// // execute the final call using `doit()`.
4378/// // Values shown here are possibly random and not representative !
4379/// let result = hub.projects().locations_transfer_configs_runs_get("name")
4380/// .doit().await;
4381/// # }
4382/// ```
4383pub struct ProjectLocationTransferConfigRunGetCall<'a, C>
4384where
4385 C: 'a,
4386{
4387 hub: &'a BigQueryDataTransfer<C>,
4388 _name: String,
4389 _delegate: Option<&'a mut dyn common::Delegate>,
4390 _additional_params: HashMap<String, String>,
4391 _scopes: BTreeSet<String>,
4392}
4393
4394impl<'a, C> common::CallBuilder for ProjectLocationTransferConfigRunGetCall<'a, C> {}
4395
4396impl<'a, C> ProjectLocationTransferConfigRunGetCall<'a, C>
4397where
4398 C: common::Connector,
4399{
4400 /// Perform the operation you have build so far.
4401 pub async fn doit(mut self) -> common::Result<(common::Response, TransferRun)> {
4402 use std::borrow::Cow;
4403 use std::io::{Read, Seek};
4404
4405 use common::{url::Params, ToParts};
4406 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
4407
4408 let mut dd = common::DefaultDelegate;
4409 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
4410 dlg.begin(common::MethodInfo {
4411 id: "bigquerydatatransfer.projects.locations.transferConfigs.runs.get",
4412 http_method: hyper::Method::GET,
4413 });
4414
4415 for &field in ["alt", "name"].iter() {
4416 if self._additional_params.contains_key(field) {
4417 dlg.finished(false);
4418 return Err(common::Error::FieldClash(field));
4419 }
4420 }
4421
4422 let mut params = Params::with_capacity(3 + self._additional_params.len());
4423 params.push("name", self._name);
4424
4425 params.extend(self._additional_params.iter());
4426
4427 params.push("alt", "json");
4428 let mut url = self.hub._base_url.clone() + "v1/{+name}";
4429 if self._scopes.is_empty() {
4430 self._scopes
4431 .insert(Scope::CloudPlatformReadOnly.as_ref().to_string());
4432 }
4433
4434 #[allow(clippy::single_element_loop)]
4435 for &(find_this, param_name) in [("{+name}", "name")].iter() {
4436 url = params.uri_replacement(url, param_name, find_this, true);
4437 }
4438 {
4439 let to_remove = ["name"];
4440 params.remove_params(&to_remove);
4441 }
4442
4443 let url = params.parse_with_url(&url);
4444
4445 loop {
4446 let token = match self
4447 .hub
4448 .auth
4449 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
4450 .await
4451 {
4452 Ok(token) => token,
4453 Err(e) => match dlg.token(e) {
4454 Ok(token) => token,
4455 Err(e) => {
4456 dlg.finished(false);
4457 return Err(common::Error::MissingToken(e));
4458 }
4459 },
4460 };
4461 let mut req_result = {
4462 let client = &self.hub.client;
4463 dlg.pre_request();
4464 let mut req_builder = hyper::Request::builder()
4465 .method(hyper::Method::GET)
4466 .uri(url.as_str())
4467 .header(USER_AGENT, self.hub._user_agent.clone());
4468
4469 if let Some(token) = token.as_ref() {
4470 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
4471 }
4472
4473 let request = req_builder
4474 .header(CONTENT_LENGTH, 0_u64)
4475 .body(common::to_body::<String>(None));
4476
4477 client.request(request.unwrap()).await
4478 };
4479
4480 match req_result {
4481 Err(err) => {
4482 if let common::Retry::After(d) = dlg.http_error(&err) {
4483 sleep(d).await;
4484 continue;
4485 }
4486 dlg.finished(false);
4487 return Err(common::Error::HttpError(err));
4488 }
4489 Ok(res) => {
4490 let (mut parts, body) = res.into_parts();
4491 let mut body = common::Body::new(body);
4492 if !parts.status.is_success() {
4493 let bytes = common::to_bytes(body).await.unwrap_or_default();
4494 let error = serde_json::from_str(&common::to_string(&bytes));
4495 let response = common::to_response(parts, bytes.into());
4496
4497 if let common::Retry::After(d) =
4498 dlg.http_failure(&response, error.as_ref().ok())
4499 {
4500 sleep(d).await;
4501 continue;
4502 }
4503
4504 dlg.finished(false);
4505
4506 return Err(match error {
4507 Ok(value) => common::Error::BadRequest(value),
4508 _ => common::Error::Failure(response),
4509 });
4510 }
4511 let response = {
4512 let bytes = common::to_bytes(body).await.unwrap_or_default();
4513 let encoded = common::to_string(&bytes);
4514 match serde_json::from_str(&encoded) {
4515 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4516 Err(error) => {
4517 dlg.response_json_decode_error(&encoded, &error);
4518 return Err(common::Error::JsonDecodeError(
4519 encoded.to_string(),
4520 error,
4521 ));
4522 }
4523 }
4524 };
4525
4526 dlg.finished(true);
4527 return Ok(response);
4528 }
4529 }
4530 }
4531 }
4532
4533 /// Required. The name of the resource requested. If you are using the regionless method, the location must be `US` and the name should be in the following form: * `projects/{project_id}/transferConfigs/{config_id}/runs/{run_id}` If you are using the regionalized method, the name should be in the following form: * `projects/{project_id}/locations/{location_id}/transferConfigs/{config_id}/runs/{run_id}`
4534 ///
4535 /// Sets the *name* path property to the given value.
4536 ///
4537 /// Even though the property as already been set when instantiating this call,
4538 /// we provide this method for API completeness.
4539 pub fn name(mut self, new_value: &str) -> ProjectLocationTransferConfigRunGetCall<'a, C> {
4540 self._name = new_value.to_string();
4541 self
4542 }
4543 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4544 /// while executing the actual API request.
4545 ///
4546 /// ````text
4547 /// It should be used to handle progress information, and to implement a certain level of resilience.
4548 /// ````
4549 ///
4550 /// Sets the *delegate* property to the given value.
4551 pub fn delegate(
4552 mut self,
4553 new_value: &'a mut dyn common::Delegate,
4554 ) -> ProjectLocationTransferConfigRunGetCall<'a, C> {
4555 self._delegate = Some(new_value);
4556 self
4557 }
4558
4559 /// Set any additional parameter of the query string used in the request.
4560 /// It should be used to set parameters which are not yet available through their own
4561 /// setters.
4562 ///
4563 /// Please note that this method must not be used to set any of the known parameters
4564 /// which have their own setter method. If done anyway, the request will fail.
4565 ///
4566 /// # Additional Parameters
4567 ///
4568 /// * *$.xgafv* (query-string) - V1 error format.
4569 /// * *access_token* (query-string) - OAuth access token.
4570 /// * *alt* (query-string) - Data format for response.
4571 /// * *callback* (query-string) - JSONP
4572 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4573 /// * *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.
4574 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4575 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4576 /// * *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.
4577 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4578 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4579 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationTransferConfigRunGetCall<'a, C>
4580 where
4581 T: AsRef<str>,
4582 {
4583 self._additional_params
4584 .insert(name.as_ref().to_string(), value.as_ref().to_string());
4585 self
4586 }
4587
4588 /// Identifies the authorization scope for the method you are building.
4589 ///
4590 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
4591 /// [`Scope::CloudPlatformReadOnly`].
4592 ///
4593 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4594 /// tokens for more than one scope.
4595 ///
4596 /// Usually there is more than one suitable scope to authorize an operation, some of which may
4597 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
4598 /// sufficient, a read-write scope will do as well.
4599 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationTransferConfigRunGetCall<'a, C>
4600 where
4601 St: AsRef<str>,
4602 {
4603 self._scopes.insert(String::from(scope.as_ref()));
4604 self
4605 }
4606 /// Identifies the authorization scope(s) for the method you are building.
4607 ///
4608 /// See [`Self::add_scope()`] for details.
4609 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationTransferConfigRunGetCall<'a, C>
4610 where
4611 I: IntoIterator<Item = St>,
4612 St: AsRef<str>,
4613 {
4614 self._scopes
4615 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
4616 self
4617 }
4618
4619 /// Removes all scopes, and no default scope will be used either.
4620 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
4621 /// for details).
4622 pub fn clear_scopes(mut self) -> ProjectLocationTransferConfigRunGetCall<'a, C> {
4623 self._scopes.clear();
4624 self
4625 }
4626}
4627
4628/// Returns information about running and completed transfer runs.
4629///
4630/// A builder for the *locations.transferConfigs.runs.list* method supported by a *project* resource.
4631/// It is not used directly, but through a [`ProjectMethods`] instance.
4632///
4633/// # Example
4634///
4635/// Instantiate a resource method builder
4636///
4637/// ```test_harness,no_run
4638/// # extern crate hyper;
4639/// # extern crate hyper_rustls;
4640/// # extern crate google_bigquerydatatransfer1 as bigquerydatatransfer1;
4641/// # async fn dox() {
4642/// # use bigquerydatatransfer1::{BigQueryDataTransfer, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4643///
4644/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4645/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
4646/// # .with_native_roots()
4647/// # .unwrap()
4648/// # .https_only()
4649/// # .enable_http2()
4650/// # .build();
4651///
4652/// # let executor = hyper_util::rt::TokioExecutor::new();
4653/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
4654/// # secret,
4655/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4656/// # yup_oauth2::client::CustomHyperClientBuilder::from(
4657/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
4658/// # ),
4659/// # ).build().await.unwrap();
4660///
4661/// # let client = hyper_util::client::legacy::Client::builder(
4662/// # hyper_util::rt::TokioExecutor::new()
4663/// # )
4664/// # .build(
4665/// # hyper_rustls::HttpsConnectorBuilder::new()
4666/// # .with_native_roots()
4667/// # .unwrap()
4668/// # .https_or_http()
4669/// # .enable_http2()
4670/// # .build()
4671/// # );
4672/// # let mut hub = BigQueryDataTransfer::new(client, auth);
4673/// // You can configure optional parameters by calling the respective setters at will, and
4674/// // execute the final call using `doit()`.
4675/// // Values shown here are possibly random and not representative !
4676/// let result = hub.projects().locations_transfer_configs_runs_list("parent")
4677/// .add_states("invidunt")
4678/// .run_attempt("amet")
4679/// .page_token("duo")
4680/// .page_size(-50)
4681/// .doit().await;
4682/// # }
4683/// ```
4684pub struct ProjectLocationTransferConfigRunListCall<'a, C>
4685where
4686 C: 'a,
4687{
4688 hub: &'a BigQueryDataTransfer<C>,
4689 _parent: String,
4690 _states: Vec<String>,
4691 _run_attempt: Option<String>,
4692 _page_token: Option<String>,
4693 _page_size: Option<i32>,
4694 _delegate: Option<&'a mut dyn common::Delegate>,
4695 _additional_params: HashMap<String, String>,
4696 _scopes: BTreeSet<String>,
4697}
4698
4699impl<'a, C> common::CallBuilder for ProjectLocationTransferConfigRunListCall<'a, C> {}
4700
4701impl<'a, C> ProjectLocationTransferConfigRunListCall<'a, C>
4702where
4703 C: common::Connector,
4704{
4705 /// Perform the operation you have build so far.
4706 pub async fn doit(mut self) -> common::Result<(common::Response, ListTransferRunsResponse)> {
4707 use std::borrow::Cow;
4708 use std::io::{Read, Seek};
4709
4710 use common::{url::Params, ToParts};
4711 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
4712
4713 let mut dd = common::DefaultDelegate;
4714 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
4715 dlg.begin(common::MethodInfo {
4716 id: "bigquerydatatransfer.projects.locations.transferConfigs.runs.list",
4717 http_method: hyper::Method::GET,
4718 });
4719
4720 for &field in [
4721 "alt",
4722 "parent",
4723 "states",
4724 "runAttempt",
4725 "pageToken",
4726 "pageSize",
4727 ]
4728 .iter()
4729 {
4730 if self._additional_params.contains_key(field) {
4731 dlg.finished(false);
4732 return Err(common::Error::FieldClash(field));
4733 }
4734 }
4735
4736 let mut params = Params::with_capacity(7 + self._additional_params.len());
4737 params.push("parent", self._parent);
4738 if !self._states.is_empty() {
4739 for f in self._states.iter() {
4740 params.push("states", f);
4741 }
4742 }
4743 if let Some(value) = self._run_attempt.as_ref() {
4744 params.push("runAttempt", value);
4745 }
4746 if let Some(value) = self._page_token.as_ref() {
4747 params.push("pageToken", value);
4748 }
4749 if let Some(value) = self._page_size.as_ref() {
4750 params.push("pageSize", value.to_string());
4751 }
4752
4753 params.extend(self._additional_params.iter());
4754
4755 params.push("alt", "json");
4756 let mut url = self.hub._base_url.clone() + "v1/{+parent}/runs";
4757 if self._scopes.is_empty() {
4758 self._scopes
4759 .insert(Scope::CloudPlatformReadOnly.as_ref().to_string());
4760 }
4761
4762 #[allow(clippy::single_element_loop)]
4763 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
4764 url = params.uri_replacement(url, param_name, find_this, true);
4765 }
4766 {
4767 let to_remove = ["parent"];
4768 params.remove_params(&to_remove);
4769 }
4770
4771 let url = params.parse_with_url(&url);
4772
4773 loop {
4774 let token = match self
4775 .hub
4776 .auth
4777 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
4778 .await
4779 {
4780 Ok(token) => token,
4781 Err(e) => match dlg.token(e) {
4782 Ok(token) => token,
4783 Err(e) => {
4784 dlg.finished(false);
4785 return Err(common::Error::MissingToken(e));
4786 }
4787 },
4788 };
4789 let mut req_result = {
4790 let client = &self.hub.client;
4791 dlg.pre_request();
4792 let mut req_builder = hyper::Request::builder()
4793 .method(hyper::Method::GET)
4794 .uri(url.as_str())
4795 .header(USER_AGENT, self.hub._user_agent.clone());
4796
4797 if let Some(token) = token.as_ref() {
4798 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
4799 }
4800
4801 let request = req_builder
4802 .header(CONTENT_LENGTH, 0_u64)
4803 .body(common::to_body::<String>(None));
4804
4805 client.request(request.unwrap()).await
4806 };
4807
4808 match req_result {
4809 Err(err) => {
4810 if let common::Retry::After(d) = dlg.http_error(&err) {
4811 sleep(d).await;
4812 continue;
4813 }
4814 dlg.finished(false);
4815 return Err(common::Error::HttpError(err));
4816 }
4817 Ok(res) => {
4818 let (mut parts, body) = res.into_parts();
4819 let mut body = common::Body::new(body);
4820 if !parts.status.is_success() {
4821 let bytes = common::to_bytes(body).await.unwrap_or_default();
4822 let error = serde_json::from_str(&common::to_string(&bytes));
4823 let response = common::to_response(parts, bytes.into());
4824
4825 if let common::Retry::After(d) =
4826 dlg.http_failure(&response, error.as_ref().ok())
4827 {
4828 sleep(d).await;
4829 continue;
4830 }
4831
4832 dlg.finished(false);
4833
4834 return Err(match error {
4835 Ok(value) => common::Error::BadRequest(value),
4836 _ => common::Error::Failure(response),
4837 });
4838 }
4839 let response = {
4840 let bytes = common::to_bytes(body).await.unwrap_or_default();
4841 let encoded = common::to_string(&bytes);
4842 match serde_json::from_str(&encoded) {
4843 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4844 Err(error) => {
4845 dlg.response_json_decode_error(&encoded, &error);
4846 return Err(common::Error::JsonDecodeError(
4847 encoded.to_string(),
4848 error,
4849 ));
4850 }
4851 }
4852 };
4853
4854 dlg.finished(true);
4855 return Ok(response);
4856 }
4857 }
4858 }
4859 }
4860
4861 /// Required. Name of transfer configuration for which transfer runs should be retrieved. If you are using the regionless method, the location must be `US` and the name should be in the following form: * `projects/{project_id}/transferConfigs/{config_id}` If you are using the regionalized method, the name should be in the following form: * `projects/{project_id}/locations/{location_id}/transferConfigs/{config_id}`
4862 ///
4863 /// Sets the *parent* path property to the given value.
4864 ///
4865 /// Even though the property as already been set when instantiating this call,
4866 /// we provide this method for API completeness.
4867 pub fn parent(mut self, new_value: &str) -> ProjectLocationTransferConfigRunListCall<'a, C> {
4868 self._parent = new_value.to_string();
4869 self
4870 }
4871 /// When specified, only transfer runs with requested states are returned.
4872 ///
4873 /// Append the given value to the *states* query property.
4874 /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
4875 pub fn add_states(
4876 mut self,
4877 new_value: &str,
4878 ) -> ProjectLocationTransferConfigRunListCall<'a, C> {
4879 self._states.push(new_value.to_string());
4880 self
4881 }
4882 /// Indicates how run attempts are to be pulled.
4883 ///
4884 /// Sets the *run attempt* query property to the given value.
4885 pub fn run_attempt(
4886 mut self,
4887 new_value: &str,
4888 ) -> ProjectLocationTransferConfigRunListCall<'a, C> {
4889 self._run_attempt = Some(new_value.to_string());
4890 self
4891 }
4892 /// Pagination token, which can be used to request a specific page of `ListTransferRunsRequest` list results. For multiple-page results, `ListTransferRunsResponse` outputs a `next_page` token, which can be used as the `page_token` value to request the next page of list results.
4893 ///
4894 /// Sets the *page token* query property to the given value.
4895 pub fn page_token(
4896 mut self,
4897 new_value: &str,
4898 ) -> ProjectLocationTransferConfigRunListCall<'a, C> {
4899 self._page_token = Some(new_value.to_string());
4900 self
4901 }
4902 /// Page size. The default page size is the maximum value of 1000 results.
4903 ///
4904 /// Sets the *page size* query property to the given value.
4905 pub fn page_size(mut self, new_value: i32) -> ProjectLocationTransferConfigRunListCall<'a, C> {
4906 self._page_size = Some(new_value);
4907 self
4908 }
4909 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4910 /// while executing the actual API request.
4911 ///
4912 /// ````text
4913 /// It should be used to handle progress information, and to implement a certain level of resilience.
4914 /// ````
4915 ///
4916 /// Sets the *delegate* property to the given value.
4917 pub fn delegate(
4918 mut self,
4919 new_value: &'a mut dyn common::Delegate,
4920 ) -> ProjectLocationTransferConfigRunListCall<'a, C> {
4921 self._delegate = Some(new_value);
4922 self
4923 }
4924
4925 /// Set any additional parameter of the query string used in the request.
4926 /// It should be used to set parameters which are not yet available through their own
4927 /// setters.
4928 ///
4929 /// Please note that this method must not be used to set any of the known parameters
4930 /// which have their own setter method. If done anyway, the request will fail.
4931 ///
4932 /// # Additional Parameters
4933 ///
4934 /// * *$.xgafv* (query-string) - V1 error format.
4935 /// * *access_token* (query-string) - OAuth access token.
4936 /// * *alt* (query-string) - Data format for response.
4937 /// * *callback* (query-string) - JSONP
4938 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4939 /// * *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.
4940 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4941 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4942 /// * *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.
4943 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4944 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4945 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationTransferConfigRunListCall<'a, C>
4946 where
4947 T: AsRef<str>,
4948 {
4949 self._additional_params
4950 .insert(name.as_ref().to_string(), value.as_ref().to_string());
4951 self
4952 }
4953
4954 /// Identifies the authorization scope for the method you are building.
4955 ///
4956 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
4957 /// [`Scope::CloudPlatformReadOnly`].
4958 ///
4959 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4960 /// tokens for more than one scope.
4961 ///
4962 /// Usually there is more than one suitable scope to authorize an operation, some of which may
4963 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
4964 /// sufficient, a read-write scope will do as well.
4965 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationTransferConfigRunListCall<'a, C>
4966 where
4967 St: AsRef<str>,
4968 {
4969 self._scopes.insert(String::from(scope.as_ref()));
4970 self
4971 }
4972 /// Identifies the authorization scope(s) for the method you are building.
4973 ///
4974 /// See [`Self::add_scope()`] for details.
4975 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationTransferConfigRunListCall<'a, C>
4976 where
4977 I: IntoIterator<Item = St>,
4978 St: AsRef<str>,
4979 {
4980 self._scopes
4981 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
4982 self
4983 }
4984
4985 /// Removes all scopes, and no default scope will be used either.
4986 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
4987 /// for details).
4988 pub fn clear_scopes(mut self) -> ProjectLocationTransferConfigRunListCall<'a, C> {
4989 self._scopes.clear();
4990 self
4991 }
4992}
4993
4994/// Creates a new data transfer configuration.
4995///
4996/// A builder for the *locations.transferConfigs.create* method supported by a *project* resource.
4997/// It is not used directly, but through a [`ProjectMethods`] instance.
4998///
4999/// # Example
5000///
5001/// Instantiate a resource method builder
5002///
5003/// ```test_harness,no_run
5004/// # extern crate hyper;
5005/// # extern crate hyper_rustls;
5006/// # extern crate google_bigquerydatatransfer1 as bigquerydatatransfer1;
5007/// use bigquerydatatransfer1::api::TransferConfig;
5008/// # async fn dox() {
5009/// # use bigquerydatatransfer1::{BigQueryDataTransfer, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5010///
5011/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5012/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
5013/// # .with_native_roots()
5014/// # .unwrap()
5015/// # .https_only()
5016/// # .enable_http2()
5017/// # .build();
5018///
5019/// # let executor = hyper_util::rt::TokioExecutor::new();
5020/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
5021/// # secret,
5022/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5023/// # yup_oauth2::client::CustomHyperClientBuilder::from(
5024/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
5025/// # ),
5026/// # ).build().await.unwrap();
5027///
5028/// # let client = hyper_util::client::legacy::Client::builder(
5029/// # hyper_util::rt::TokioExecutor::new()
5030/// # )
5031/// # .build(
5032/// # hyper_rustls::HttpsConnectorBuilder::new()
5033/// # .with_native_roots()
5034/// # .unwrap()
5035/// # .https_or_http()
5036/// # .enable_http2()
5037/// # .build()
5038/// # );
5039/// # let mut hub = BigQueryDataTransfer::new(client, auth);
5040/// // As the method needs a request, you would usually fill it with the desired information
5041/// // into the respective structure. Some of the parts shown here might not be applicable !
5042/// // Values shown here are possibly random and not representative !
5043/// let mut req = TransferConfig::default();
5044///
5045/// // You can configure optional parameters by calling the respective setters at will, and
5046/// // execute the final call using `doit()`.
5047/// // Values shown here are possibly random and not representative !
5048/// let result = hub.projects().locations_transfer_configs_create(req, "parent")
5049/// .version_info("ut")
5050/// .service_account_name("gubergren")
5051/// .authorization_code("rebum.")
5052/// .doit().await;
5053/// # }
5054/// ```
5055pub struct ProjectLocationTransferConfigCreateCall<'a, C>
5056where
5057 C: 'a,
5058{
5059 hub: &'a BigQueryDataTransfer<C>,
5060 _request: TransferConfig,
5061 _parent: String,
5062 _version_info: Option<String>,
5063 _service_account_name: Option<String>,
5064 _authorization_code: Option<String>,
5065 _delegate: Option<&'a mut dyn common::Delegate>,
5066 _additional_params: HashMap<String, String>,
5067 _scopes: BTreeSet<String>,
5068}
5069
5070impl<'a, C> common::CallBuilder for ProjectLocationTransferConfigCreateCall<'a, C> {}
5071
5072impl<'a, C> ProjectLocationTransferConfigCreateCall<'a, C>
5073where
5074 C: common::Connector,
5075{
5076 /// Perform the operation you have build so far.
5077 pub async fn doit(mut self) -> common::Result<(common::Response, TransferConfig)> {
5078 use std::borrow::Cow;
5079 use std::io::{Read, Seek};
5080
5081 use common::{url::Params, ToParts};
5082 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5083
5084 let mut dd = common::DefaultDelegate;
5085 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5086 dlg.begin(common::MethodInfo {
5087 id: "bigquerydatatransfer.projects.locations.transferConfigs.create",
5088 http_method: hyper::Method::POST,
5089 });
5090
5091 for &field in [
5092 "alt",
5093 "parent",
5094 "versionInfo",
5095 "serviceAccountName",
5096 "authorizationCode",
5097 ]
5098 .iter()
5099 {
5100 if self._additional_params.contains_key(field) {
5101 dlg.finished(false);
5102 return Err(common::Error::FieldClash(field));
5103 }
5104 }
5105
5106 let mut params = Params::with_capacity(7 + self._additional_params.len());
5107 params.push("parent", self._parent);
5108 if let Some(value) = self._version_info.as_ref() {
5109 params.push("versionInfo", value);
5110 }
5111 if let Some(value) = self._service_account_name.as_ref() {
5112 params.push("serviceAccountName", value);
5113 }
5114 if let Some(value) = self._authorization_code.as_ref() {
5115 params.push("authorizationCode", value);
5116 }
5117
5118 params.extend(self._additional_params.iter());
5119
5120 params.push("alt", "json");
5121 let mut url = self.hub._base_url.clone() + "v1/{+parent}/transferConfigs";
5122 if self._scopes.is_empty() {
5123 self._scopes
5124 .insert(Scope::CloudPlatform.as_ref().to_string());
5125 }
5126
5127 #[allow(clippy::single_element_loop)]
5128 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
5129 url = params.uri_replacement(url, param_name, find_this, true);
5130 }
5131 {
5132 let to_remove = ["parent"];
5133 params.remove_params(&to_remove);
5134 }
5135
5136 let url = params.parse_with_url(&url);
5137
5138 let mut json_mime_type = mime::APPLICATION_JSON;
5139 let mut request_value_reader = {
5140 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
5141 common::remove_json_null_values(&mut value);
5142 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
5143 serde_json::to_writer(&mut dst, &value).unwrap();
5144 dst
5145 };
5146 let request_size = request_value_reader
5147 .seek(std::io::SeekFrom::End(0))
5148 .unwrap();
5149 request_value_reader
5150 .seek(std::io::SeekFrom::Start(0))
5151 .unwrap();
5152
5153 loop {
5154 let token = match self
5155 .hub
5156 .auth
5157 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5158 .await
5159 {
5160 Ok(token) => token,
5161 Err(e) => match dlg.token(e) {
5162 Ok(token) => token,
5163 Err(e) => {
5164 dlg.finished(false);
5165 return Err(common::Error::MissingToken(e));
5166 }
5167 },
5168 };
5169 request_value_reader
5170 .seek(std::io::SeekFrom::Start(0))
5171 .unwrap();
5172 let mut req_result = {
5173 let client = &self.hub.client;
5174 dlg.pre_request();
5175 let mut req_builder = hyper::Request::builder()
5176 .method(hyper::Method::POST)
5177 .uri(url.as_str())
5178 .header(USER_AGENT, self.hub._user_agent.clone());
5179
5180 if let Some(token) = token.as_ref() {
5181 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5182 }
5183
5184 let request = req_builder
5185 .header(CONTENT_TYPE, json_mime_type.to_string())
5186 .header(CONTENT_LENGTH, request_size as u64)
5187 .body(common::to_body(
5188 request_value_reader.get_ref().clone().into(),
5189 ));
5190
5191 client.request(request.unwrap()).await
5192 };
5193
5194 match req_result {
5195 Err(err) => {
5196 if let common::Retry::After(d) = dlg.http_error(&err) {
5197 sleep(d).await;
5198 continue;
5199 }
5200 dlg.finished(false);
5201 return Err(common::Error::HttpError(err));
5202 }
5203 Ok(res) => {
5204 let (mut parts, body) = res.into_parts();
5205 let mut body = common::Body::new(body);
5206 if !parts.status.is_success() {
5207 let bytes = common::to_bytes(body).await.unwrap_or_default();
5208 let error = serde_json::from_str(&common::to_string(&bytes));
5209 let response = common::to_response(parts, bytes.into());
5210
5211 if let common::Retry::After(d) =
5212 dlg.http_failure(&response, error.as_ref().ok())
5213 {
5214 sleep(d).await;
5215 continue;
5216 }
5217
5218 dlg.finished(false);
5219
5220 return Err(match error {
5221 Ok(value) => common::Error::BadRequest(value),
5222 _ => common::Error::Failure(response),
5223 });
5224 }
5225 let response = {
5226 let bytes = common::to_bytes(body).await.unwrap_or_default();
5227 let encoded = common::to_string(&bytes);
5228 match serde_json::from_str(&encoded) {
5229 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5230 Err(error) => {
5231 dlg.response_json_decode_error(&encoded, &error);
5232 return Err(common::Error::JsonDecodeError(
5233 encoded.to_string(),
5234 error,
5235 ));
5236 }
5237 }
5238 };
5239
5240 dlg.finished(true);
5241 return Ok(response);
5242 }
5243 }
5244 }
5245 }
5246
5247 ///
5248 /// Sets the *request* property to the given value.
5249 ///
5250 /// Even though the property as already been set when instantiating this call,
5251 /// we provide this method for API completeness.
5252 pub fn request(
5253 mut self,
5254 new_value: TransferConfig,
5255 ) -> ProjectLocationTransferConfigCreateCall<'a, C> {
5256 self._request = new_value;
5257 self
5258 }
5259 /// Required. The BigQuery project id where the transfer configuration should be created. Must be in the format projects/{project_id}/locations/{location_id} or projects/{project_id}. If specified location and location of the destination bigquery dataset do not match - the request will fail.
5260 ///
5261 /// Sets the *parent* path property to the given value.
5262 ///
5263 /// Even though the property as already been set when instantiating this call,
5264 /// we provide this method for API completeness.
5265 pub fn parent(mut self, new_value: &str) -> ProjectLocationTransferConfigCreateCall<'a, C> {
5266 self._parent = new_value.to_string();
5267 self
5268 }
5269 /// Optional version info. This parameter replaces `authorization_code` which is no longer used in any data sources. This is required only if `transferConfig.dataSourceId` is 'youtube_channel' *or* new credentials are needed, as indicated by `CheckValidCreds`. In order to obtain version info, make a request to the following URL: https://bigquery.cloud.google.com/datatransfer/oauthz/auth?redirect_uri=urn:ietf:wg:oauth:2.0:oob&response_type=version_info&client_id=client_id&scope=data_source_scopes * The client_id is the OAuth client_id of the data source as returned by ListDataSources method. * data_source_scopes are the scopes returned by ListDataSources method. Note that this should not be set when `service_account_name` is used to create the transfer config.
5270 ///
5271 /// Sets the *version info* query property to the given value.
5272 pub fn version_info(
5273 mut self,
5274 new_value: &str,
5275 ) -> ProjectLocationTransferConfigCreateCall<'a, C> {
5276 self._version_info = Some(new_value.to_string());
5277 self
5278 }
5279 /// Optional service account email. If this field is set, the transfer config will be created with this service account's credentials. It requires that the requesting user calling this API has permissions to act as this service account. Note that not all data sources support service account credentials when creating a transfer config. For the latest list of data sources, read about [using service accounts](https://cloud.google.com/bigquery-transfer/docs/use-service-accounts).
5280 ///
5281 /// Sets the *service account name* query property to the given value.
5282 pub fn service_account_name(
5283 mut self,
5284 new_value: &str,
5285 ) -> ProjectLocationTransferConfigCreateCall<'a, C> {
5286 self._service_account_name = Some(new_value.to_string());
5287 self
5288 }
5289 /// Deprecated: Authorization code was required when `transferConfig.dataSourceId` is 'youtube_channel' but it is no longer used in any data sources. Use `version_info` instead. Optional OAuth2 authorization code to use with this transfer configuration. This is required only if `transferConfig.dataSourceId` is 'youtube_channel' and new credentials are needed, as indicated by `CheckValidCreds`. In order to obtain authorization_code, make a request to the following URL: https://bigquery.cloud.google.com/datatransfer/oauthz/auth?redirect_uri=urn:ietf:wg:oauth:2.0:oob&response_type=authorization_code&client_id=client_id&scope=data_source_scopes * The client_id is the OAuth client_id of the data source as returned by ListDataSources method. * data_source_scopes are the scopes returned by ListDataSources method. Note that this should not be set when `service_account_name` is used to create the transfer config.
5290 ///
5291 /// Sets the *authorization code* query property to the given value.
5292 pub fn authorization_code(
5293 mut self,
5294 new_value: &str,
5295 ) -> ProjectLocationTransferConfigCreateCall<'a, C> {
5296 self._authorization_code = Some(new_value.to_string());
5297 self
5298 }
5299 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5300 /// while executing the actual API request.
5301 ///
5302 /// ````text
5303 /// It should be used to handle progress information, and to implement a certain level of resilience.
5304 /// ````
5305 ///
5306 /// Sets the *delegate* property to the given value.
5307 pub fn delegate(
5308 mut self,
5309 new_value: &'a mut dyn common::Delegate,
5310 ) -> ProjectLocationTransferConfigCreateCall<'a, C> {
5311 self._delegate = Some(new_value);
5312 self
5313 }
5314
5315 /// Set any additional parameter of the query string used in the request.
5316 /// It should be used to set parameters which are not yet available through their own
5317 /// setters.
5318 ///
5319 /// Please note that this method must not be used to set any of the known parameters
5320 /// which have their own setter method. If done anyway, the request will fail.
5321 ///
5322 /// # Additional Parameters
5323 ///
5324 /// * *$.xgafv* (query-string) - V1 error format.
5325 /// * *access_token* (query-string) - OAuth access token.
5326 /// * *alt* (query-string) - Data format for response.
5327 /// * *callback* (query-string) - JSONP
5328 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5329 /// * *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.
5330 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5331 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5332 /// * *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.
5333 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5334 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5335 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationTransferConfigCreateCall<'a, C>
5336 where
5337 T: AsRef<str>,
5338 {
5339 self._additional_params
5340 .insert(name.as_ref().to_string(), value.as_ref().to_string());
5341 self
5342 }
5343
5344 /// Identifies the authorization scope for the method you are building.
5345 ///
5346 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5347 /// [`Scope::CloudPlatform`].
5348 ///
5349 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5350 /// tokens for more than one scope.
5351 ///
5352 /// Usually there is more than one suitable scope to authorize an operation, some of which may
5353 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5354 /// sufficient, a read-write scope will do as well.
5355 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationTransferConfigCreateCall<'a, C>
5356 where
5357 St: AsRef<str>,
5358 {
5359 self._scopes.insert(String::from(scope.as_ref()));
5360 self
5361 }
5362 /// Identifies the authorization scope(s) for the method you are building.
5363 ///
5364 /// See [`Self::add_scope()`] for details.
5365 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationTransferConfigCreateCall<'a, C>
5366 where
5367 I: IntoIterator<Item = St>,
5368 St: AsRef<str>,
5369 {
5370 self._scopes
5371 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5372 self
5373 }
5374
5375 /// Removes all scopes, and no default scope will be used either.
5376 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5377 /// for details).
5378 pub fn clear_scopes(mut self) -> ProjectLocationTransferConfigCreateCall<'a, C> {
5379 self._scopes.clear();
5380 self
5381 }
5382}
5383
5384/// Deletes a data transfer configuration, including any associated transfer runs and logs.
5385///
5386/// A builder for the *locations.transferConfigs.delete* method supported by a *project* resource.
5387/// It is not used directly, but through a [`ProjectMethods`] instance.
5388///
5389/// # Example
5390///
5391/// Instantiate a resource method builder
5392///
5393/// ```test_harness,no_run
5394/// # extern crate hyper;
5395/// # extern crate hyper_rustls;
5396/// # extern crate google_bigquerydatatransfer1 as bigquerydatatransfer1;
5397/// # async fn dox() {
5398/// # use bigquerydatatransfer1::{BigQueryDataTransfer, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5399///
5400/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5401/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
5402/// # .with_native_roots()
5403/// # .unwrap()
5404/// # .https_only()
5405/// # .enable_http2()
5406/// # .build();
5407///
5408/// # let executor = hyper_util::rt::TokioExecutor::new();
5409/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
5410/// # secret,
5411/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5412/// # yup_oauth2::client::CustomHyperClientBuilder::from(
5413/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
5414/// # ),
5415/// # ).build().await.unwrap();
5416///
5417/// # let client = hyper_util::client::legacy::Client::builder(
5418/// # hyper_util::rt::TokioExecutor::new()
5419/// # )
5420/// # .build(
5421/// # hyper_rustls::HttpsConnectorBuilder::new()
5422/// # .with_native_roots()
5423/// # .unwrap()
5424/// # .https_or_http()
5425/// # .enable_http2()
5426/// # .build()
5427/// # );
5428/// # let mut hub = BigQueryDataTransfer::new(client, auth);
5429/// // You can configure optional parameters by calling the respective setters at will, and
5430/// // execute the final call using `doit()`.
5431/// // Values shown here are possibly random and not representative !
5432/// let result = hub.projects().locations_transfer_configs_delete("name")
5433/// .doit().await;
5434/// # }
5435/// ```
5436pub struct ProjectLocationTransferConfigDeleteCall<'a, C>
5437where
5438 C: 'a,
5439{
5440 hub: &'a BigQueryDataTransfer<C>,
5441 _name: String,
5442 _delegate: Option<&'a mut dyn common::Delegate>,
5443 _additional_params: HashMap<String, String>,
5444 _scopes: BTreeSet<String>,
5445}
5446
5447impl<'a, C> common::CallBuilder for ProjectLocationTransferConfigDeleteCall<'a, C> {}
5448
5449impl<'a, C> ProjectLocationTransferConfigDeleteCall<'a, C>
5450where
5451 C: common::Connector,
5452{
5453 /// Perform the operation you have build so far.
5454 pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
5455 use std::borrow::Cow;
5456 use std::io::{Read, Seek};
5457
5458 use common::{url::Params, ToParts};
5459 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5460
5461 let mut dd = common::DefaultDelegate;
5462 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5463 dlg.begin(common::MethodInfo {
5464 id: "bigquerydatatransfer.projects.locations.transferConfigs.delete",
5465 http_method: hyper::Method::DELETE,
5466 });
5467
5468 for &field in ["alt", "name"].iter() {
5469 if self._additional_params.contains_key(field) {
5470 dlg.finished(false);
5471 return Err(common::Error::FieldClash(field));
5472 }
5473 }
5474
5475 let mut params = Params::with_capacity(3 + self._additional_params.len());
5476 params.push("name", self._name);
5477
5478 params.extend(self._additional_params.iter());
5479
5480 params.push("alt", "json");
5481 let mut url = self.hub._base_url.clone() + "v1/{+name}";
5482 if self._scopes.is_empty() {
5483 self._scopes
5484 .insert(Scope::CloudPlatform.as_ref().to_string());
5485 }
5486
5487 #[allow(clippy::single_element_loop)]
5488 for &(find_this, param_name) in [("{+name}", "name")].iter() {
5489 url = params.uri_replacement(url, param_name, find_this, true);
5490 }
5491 {
5492 let to_remove = ["name"];
5493 params.remove_params(&to_remove);
5494 }
5495
5496 let url = params.parse_with_url(&url);
5497
5498 loop {
5499 let token = match self
5500 .hub
5501 .auth
5502 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5503 .await
5504 {
5505 Ok(token) => token,
5506 Err(e) => match dlg.token(e) {
5507 Ok(token) => token,
5508 Err(e) => {
5509 dlg.finished(false);
5510 return Err(common::Error::MissingToken(e));
5511 }
5512 },
5513 };
5514 let mut req_result = {
5515 let client = &self.hub.client;
5516 dlg.pre_request();
5517 let mut req_builder = hyper::Request::builder()
5518 .method(hyper::Method::DELETE)
5519 .uri(url.as_str())
5520 .header(USER_AGENT, self.hub._user_agent.clone());
5521
5522 if let Some(token) = token.as_ref() {
5523 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5524 }
5525
5526 let request = req_builder
5527 .header(CONTENT_LENGTH, 0_u64)
5528 .body(common::to_body::<String>(None));
5529
5530 client.request(request.unwrap()).await
5531 };
5532
5533 match req_result {
5534 Err(err) => {
5535 if let common::Retry::After(d) = dlg.http_error(&err) {
5536 sleep(d).await;
5537 continue;
5538 }
5539 dlg.finished(false);
5540 return Err(common::Error::HttpError(err));
5541 }
5542 Ok(res) => {
5543 let (mut parts, body) = res.into_parts();
5544 let mut body = common::Body::new(body);
5545 if !parts.status.is_success() {
5546 let bytes = common::to_bytes(body).await.unwrap_or_default();
5547 let error = serde_json::from_str(&common::to_string(&bytes));
5548 let response = common::to_response(parts, bytes.into());
5549
5550 if let common::Retry::After(d) =
5551 dlg.http_failure(&response, error.as_ref().ok())
5552 {
5553 sleep(d).await;
5554 continue;
5555 }
5556
5557 dlg.finished(false);
5558
5559 return Err(match error {
5560 Ok(value) => common::Error::BadRequest(value),
5561 _ => common::Error::Failure(response),
5562 });
5563 }
5564 let response = {
5565 let bytes = common::to_bytes(body).await.unwrap_or_default();
5566 let encoded = common::to_string(&bytes);
5567 match serde_json::from_str(&encoded) {
5568 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5569 Err(error) => {
5570 dlg.response_json_decode_error(&encoded, &error);
5571 return Err(common::Error::JsonDecodeError(
5572 encoded.to_string(),
5573 error,
5574 ));
5575 }
5576 }
5577 };
5578
5579 dlg.finished(true);
5580 return Ok(response);
5581 }
5582 }
5583 }
5584 }
5585
5586 /// Required. The name of the resource to delete. If you are using the regionless method, the location must be `US` and the name should be in the following form: * `projects/{project_id}/transferConfigs/{config_id}` If you are using the regionalized method, the name should be in the following form: * `projects/{project_id}/locations/{location_id}/transferConfigs/{config_id}`
5587 ///
5588 /// Sets the *name* path property to the given value.
5589 ///
5590 /// Even though the property as already been set when instantiating this call,
5591 /// we provide this method for API completeness.
5592 pub fn name(mut self, new_value: &str) -> ProjectLocationTransferConfigDeleteCall<'a, C> {
5593 self._name = new_value.to_string();
5594 self
5595 }
5596 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5597 /// while executing the actual API request.
5598 ///
5599 /// ````text
5600 /// It should be used to handle progress information, and to implement a certain level of resilience.
5601 /// ````
5602 ///
5603 /// Sets the *delegate* property to the given value.
5604 pub fn delegate(
5605 mut self,
5606 new_value: &'a mut dyn common::Delegate,
5607 ) -> ProjectLocationTransferConfigDeleteCall<'a, C> {
5608 self._delegate = Some(new_value);
5609 self
5610 }
5611
5612 /// Set any additional parameter of the query string used in the request.
5613 /// It should be used to set parameters which are not yet available through their own
5614 /// setters.
5615 ///
5616 /// Please note that this method must not be used to set any of the known parameters
5617 /// which have their own setter method. If done anyway, the request will fail.
5618 ///
5619 /// # Additional Parameters
5620 ///
5621 /// * *$.xgafv* (query-string) - V1 error format.
5622 /// * *access_token* (query-string) - OAuth access token.
5623 /// * *alt* (query-string) - Data format for response.
5624 /// * *callback* (query-string) - JSONP
5625 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5626 /// * *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.
5627 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5628 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5629 /// * *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.
5630 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5631 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5632 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationTransferConfigDeleteCall<'a, C>
5633 where
5634 T: AsRef<str>,
5635 {
5636 self._additional_params
5637 .insert(name.as_ref().to_string(), value.as_ref().to_string());
5638 self
5639 }
5640
5641 /// Identifies the authorization scope for the method you are building.
5642 ///
5643 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5644 /// [`Scope::CloudPlatform`].
5645 ///
5646 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5647 /// tokens for more than one scope.
5648 ///
5649 /// Usually there is more than one suitable scope to authorize an operation, some of which may
5650 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5651 /// sufficient, a read-write scope will do as well.
5652 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationTransferConfigDeleteCall<'a, C>
5653 where
5654 St: AsRef<str>,
5655 {
5656 self._scopes.insert(String::from(scope.as_ref()));
5657 self
5658 }
5659 /// Identifies the authorization scope(s) for the method you are building.
5660 ///
5661 /// See [`Self::add_scope()`] for details.
5662 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationTransferConfigDeleteCall<'a, C>
5663 where
5664 I: IntoIterator<Item = St>,
5665 St: AsRef<str>,
5666 {
5667 self._scopes
5668 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5669 self
5670 }
5671
5672 /// Removes all scopes, and no default scope will be used either.
5673 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5674 /// for details).
5675 pub fn clear_scopes(mut self) -> ProjectLocationTransferConfigDeleteCall<'a, C> {
5676 self._scopes.clear();
5677 self
5678 }
5679}
5680
5681/// Returns information about a data transfer config.
5682///
5683/// A builder for the *locations.transferConfigs.get* method supported by a *project* resource.
5684/// It is not used directly, but through a [`ProjectMethods`] instance.
5685///
5686/// # Example
5687///
5688/// Instantiate a resource method builder
5689///
5690/// ```test_harness,no_run
5691/// # extern crate hyper;
5692/// # extern crate hyper_rustls;
5693/// # extern crate google_bigquerydatatransfer1 as bigquerydatatransfer1;
5694/// # async fn dox() {
5695/// # use bigquerydatatransfer1::{BigQueryDataTransfer, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5696///
5697/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5698/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
5699/// # .with_native_roots()
5700/// # .unwrap()
5701/// # .https_only()
5702/// # .enable_http2()
5703/// # .build();
5704///
5705/// # let executor = hyper_util::rt::TokioExecutor::new();
5706/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
5707/// # secret,
5708/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5709/// # yup_oauth2::client::CustomHyperClientBuilder::from(
5710/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
5711/// # ),
5712/// # ).build().await.unwrap();
5713///
5714/// # let client = hyper_util::client::legacy::Client::builder(
5715/// # hyper_util::rt::TokioExecutor::new()
5716/// # )
5717/// # .build(
5718/// # hyper_rustls::HttpsConnectorBuilder::new()
5719/// # .with_native_roots()
5720/// # .unwrap()
5721/// # .https_or_http()
5722/// # .enable_http2()
5723/// # .build()
5724/// # );
5725/// # let mut hub = BigQueryDataTransfer::new(client, auth);
5726/// // You can configure optional parameters by calling the respective setters at will, and
5727/// // execute the final call using `doit()`.
5728/// // Values shown here are possibly random and not representative !
5729/// let result = hub.projects().locations_transfer_configs_get("name")
5730/// .doit().await;
5731/// # }
5732/// ```
5733pub struct ProjectLocationTransferConfigGetCall<'a, C>
5734where
5735 C: 'a,
5736{
5737 hub: &'a BigQueryDataTransfer<C>,
5738 _name: String,
5739 _delegate: Option<&'a mut dyn common::Delegate>,
5740 _additional_params: HashMap<String, String>,
5741 _scopes: BTreeSet<String>,
5742}
5743
5744impl<'a, C> common::CallBuilder for ProjectLocationTransferConfigGetCall<'a, C> {}
5745
5746impl<'a, C> ProjectLocationTransferConfigGetCall<'a, C>
5747where
5748 C: common::Connector,
5749{
5750 /// Perform the operation you have build so far.
5751 pub async fn doit(mut self) -> common::Result<(common::Response, TransferConfig)> {
5752 use std::borrow::Cow;
5753 use std::io::{Read, Seek};
5754
5755 use common::{url::Params, ToParts};
5756 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5757
5758 let mut dd = common::DefaultDelegate;
5759 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5760 dlg.begin(common::MethodInfo {
5761 id: "bigquerydatatransfer.projects.locations.transferConfigs.get",
5762 http_method: hyper::Method::GET,
5763 });
5764
5765 for &field in ["alt", "name"].iter() {
5766 if self._additional_params.contains_key(field) {
5767 dlg.finished(false);
5768 return Err(common::Error::FieldClash(field));
5769 }
5770 }
5771
5772 let mut params = Params::with_capacity(3 + self._additional_params.len());
5773 params.push("name", self._name);
5774
5775 params.extend(self._additional_params.iter());
5776
5777 params.push("alt", "json");
5778 let mut url = self.hub._base_url.clone() + "v1/{+name}";
5779 if self._scopes.is_empty() {
5780 self._scopes
5781 .insert(Scope::CloudPlatformReadOnly.as_ref().to_string());
5782 }
5783
5784 #[allow(clippy::single_element_loop)]
5785 for &(find_this, param_name) in [("{+name}", "name")].iter() {
5786 url = params.uri_replacement(url, param_name, find_this, true);
5787 }
5788 {
5789 let to_remove = ["name"];
5790 params.remove_params(&to_remove);
5791 }
5792
5793 let url = params.parse_with_url(&url);
5794
5795 loop {
5796 let token = match self
5797 .hub
5798 .auth
5799 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5800 .await
5801 {
5802 Ok(token) => token,
5803 Err(e) => match dlg.token(e) {
5804 Ok(token) => token,
5805 Err(e) => {
5806 dlg.finished(false);
5807 return Err(common::Error::MissingToken(e));
5808 }
5809 },
5810 };
5811 let mut req_result = {
5812 let client = &self.hub.client;
5813 dlg.pre_request();
5814 let mut req_builder = hyper::Request::builder()
5815 .method(hyper::Method::GET)
5816 .uri(url.as_str())
5817 .header(USER_AGENT, self.hub._user_agent.clone());
5818
5819 if let Some(token) = token.as_ref() {
5820 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5821 }
5822
5823 let request = req_builder
5824 .header(CONTENT_LENGTH, 0_u64)
5825 .body(common::to_body::<String>(None));
5826
5827 client.request(request.unwrap()).await
5828 };
5829
5830 match req_result {
5831 Err(err) => {
5832 if let common::Retry::After(d) = dlg.http_error(&err) {
5833 sleep(d).await;
5834 continue;
5835 }
5836 dlg.finished(false);
5837 return Err(common::Error::HttpError(err));
5838 }
5839 Ok(res) => {
5840 let (mut parts, body) = res.into_parts();
5841 let mut body = common::Body::new(body);
5842 if !parts.status.is_success() {
5843 let bytes = common::to_bytes(body).await.unwrap_or_default();
5844 let error = serde_json::from_str(&common::to_string(&bytes));
5845 let response = common::to_response(parts, bytes.into());
5846
5847 if let common::Retry::After(d) =
5848 dlg.http_failure(&response, error.as_ref().ok())
5849 {
5850 sleep(d).await;
5851 continue;
5852 }
5853
5854 dlg.finished(false);
5855
5856 return Err(match error {
5857 Ok(value) => common::Error::BadRequest(value),
5858 _ => common::Error::Failure(response),
5859 });
5860 }
5861 let response = {
5862 let bytes = common::to_bytes(body).await.unwrap_or_default();
5863 let encoded = common::to_string(&bytes);
5864 match serde_json::from_str(&encoded) {
5865 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5866 Err(error) => {
5867 dlg.response_json_decode_error(&encoded, &error);
5868 return Err(common::Error::JsonDecodeError(
5869 encoded.to_string(),
5870 error,
5871 ));
5872 }
5873 }
5874 };
5875
5876 dlg.finished(true);
5877 return Ok(response);
5878 }
5879 }
5880 }
5881 }
5882
5883 /// Required. The name of the resource requested. If you are using the regionless method, the location must be `US` and the name should be in the following form: * `projects/{project_id}/transferConfigs/{config_id}` If you are using the regionalized method, the name should be in the following form: * `projects/{project_id}/locations/{location_id}/transferConfigs/{config_id}`
5884 ///
5885 /// Sets the *name* path property to the given value.
5886 ///
5887 /// Even though the property as already been set when instantiating this call,
5888 /// we provide this method for API completeness.
5889 pub fn name(mut self, new_value: &str) -> ProjectLocationTransferConfigGetCall<'a, C> {
5890 self._name = new_value.to_string();
5891 self
5892 }
5893 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5894 /// while executing the actual API request.
5895 ///
5896 /// ````text
5897 /// It should be used to handle progress information, and to implement a certain level of resilience.
5898 /// ````
5899 ///
5900 /// Sets the *delegate* property to the given value.
5901 pub fn delegate(
5902 mut self,
5903 new_value: &'a mut dyn common::Delegate,
5904 ) -> ProjectLocationTransferConfigGetCall<'a, C> {
5905 self._delegate = Some(new_value);
5906 self
5907 }
5908
5909 /// Set any additional parameter of the query string used in the request.
5910 /// It should be used to set parameters which are not yet available through their own
5911 /// setters.
5912 ///
5913 /// Please note that this method must not be used to set any of the known parameters
5914 /// which have their own setter method. If done anyway, the request will fail.
5915 ///
5916 /// # Additional Parameters
5917 ///
5918 /// * *$.xgafv* (query-string) - V1 error format.
5919 /// * *access_token* (query-string) - OAuth access token.
5920 /// * *alt* (query-string) - Data format for response.
5921 /// * *callback* (query-string) - JSONP
5922 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5923 /// * *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.
5924 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5925 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5926 /// * *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.
5927 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5928 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5929 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationTransferConfigGetCall<'a, C>
5930 where
5931 T: AsRef<str>,
5932 {
5933 self._additional_params
5934 .insert(name.as_ref().to_string(), value.as_ref().to_string());
5935 self
5936 }
5937
5938 /// Identifies the authorization scope for the method you are building.
5939 ///
5940 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5941 /// [`Scope::CloudPlatformReadOnly`].
5942 ///
5943 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5944 /// tokens for more than one scope.
5945 ///
5946 /// Usually there is more than one suitable scope to authorize an operation, some of which may
5947 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5948 /// sufficient, a read-write scope will do as well.
5949 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationTransferConfigGetCall<'a, C>
5950 where
5951 St: AsRef<str>,
5952 {
5953 self._scopes.insert(String::from(scope.as_ref()));
5954 self
5955 }
5956 /// Identifies the authorization scope(s) for the method you are building.
5957 ///
5958 /// See [`Self::add_scope()`] for details.
5959 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationTransferConfigGetCall<'a, C>
5960 where
5961 I: IntoIterator<Item = St>,
5962 St: AsRef<str>,
5963 {
5964 self._scopes
5965 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5966 self
5967 }
5968
5969 /// Removes all scopes, and no default scope will be used either.
5970 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5971 /// for details).
5972 pub fn clear_scopes(mut self) -> ProjectLocationTransferConfigGetCall<'a, C> {
5973 self._scopes.clear();
5974 self
5975 }
5976}
5977
5978/// Returns information about all transfer configs owned by a project in the specified location.
5979///
5980/// A builder for the *locations.transferConfigs.list* method supported by a *project* resource.
5981/// It is not used directly, but through a [`ProjectMethods`] instance.
5982///
5983/// # Example
5984///
5985/// Instantiate a resource method builder
5986///
5987/// ```test_harness,no_run
5988/// # extern crate hyper;
5989/// # extern crate hyper_rustls;
5990/// # extern crate google_bigquerydatatransfer1 as bigquerydatatransfer1;
5991/// # async fn dox() {
5992/// # use bigquerydatatransfer1::{BigQueryDataTransfer, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5993///
5994/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5995/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
5996/// # .with_native_roots()
5997/// # .unwrap()
5998/// # .https_only()
5999/// # .enable_http2()
6000/// # .build();
6001///
6002/// # let executor = hyper_util::rt::TokioExecutor::new();
6003/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
6004/// # secret,
6005/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6006/// # yup_oauth2::client::CustomHyperClientBuilder::from(
6007/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
6008/// # ),
6009/// # ).build().await.unwrap();
6010///
6011/// # let client = hyper_util::client::legacy::Client::builder(
6012/// # hyper_util::rt::TokioExecutor::new()
6013/// # )
6014/// # .build(
6015/// # hyper_rustls::HttpsConnectorBuilder::new()
6016/// # .with_native_roots()
6017/// # .unwrap()
6018/// # .https_or_http()
6019/// # .enable_http2()
6020/// # .build()
6021/// # );
6022/// # let mut hub = BigQueryDataTransfer::new(client, auth);
6023/// // You can configure optional parameters by calling the respective setters at will, and
6024/// // execute the final call using `doit()`.
6025/// // Values shown here are possibly random and not representative !
6026/// let result = hub.projects().locations_transfer_configs_list("parent")
6027/// .page_token("est")
6028/// .page_size(-62)
6029/// .add_data_source_ids("ea")
6030/// .doit().await;
6031/// # }
6032/// ```
6033pub struct ProjectLocationTransferConfigListCall<'a, C>
6034where
6035 C: 'a,
6036{
6037 hub: &'a BigQueryDataTransfer<C>,
6038 _parent: String,
6039 _page_token: Option<String>,
6040 _page_size: Option<i32>,
6041 _data_source_ids: Vec<String>,
6042 _delegate: Option<&'a mut dyn common::Delegate>,
6043 _additional_params: HashMap<String, String>,
6044 _scopes: BTreeSet<String>,
6045}
6046
6047impl<'a, C> common::CallBuilder for ProjectLocationTransferConfigListCall<'a, C> {}
6048
6049impl<'a, C> ProjectLocationTransferConfigListCall<'a, C>
6050where
6051 C: common::Connector,
6052{
6053 /// Perform the operation you have build so far.
6054 pub async fn doit(mut self) -> common::Result<(common::Response, ListTransferConfigsResponse)> {
6055 use std::borrow::Cow;
6056 use std::io::{Read, Seek};
6057
6058 use common::{url::Params, ToParts};
6059 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6060
6061 let mut dd = common::DefaultDelegate;
6062 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6063 dlg.begin(common::MethodInfo {
6064 id: "bigquerydatatransfer.projects.locations.transferConfigs.list",
6065 http_method: hyper::Method::GET,
6066 });
6067
6068 for &field in ["alt", "parent", "pageToken", "pageSize", "dataSourceIds"].iter() {
6069 if self._additional_params.contains_key(field) {
6070 dlg.finished(false);
6071 return Err(common::Error::FieldClash(field));
6072 }
6073 }
6074
6075 let mut params = Params::with_capacity(6 + self._additional_params.len());
6076 params.push("parent", self._parent);
6077 if let Some(value) = self._page_token.as_ref() {
6078 params.push("pageToken", value);
6079 }
6080 if let Some(value) = self._page_size.as_ref() {
6081 params.push("pageSize", value.to_string());
6082 }
6083 if !self._data_source_ids.is_empty() {
6084 for f in self._data_source_ids.iter() {
6085 params.push("dataSourceIds", f);
6086 }
6087 }
6088
6089 params.extend(self._additional_params.iter());
6090
6091 params.push("alt", "json");
6092 let mut url = self.hub._base_url.clone() + "v1/{+parent}/transferConfigs";
6093 if self._scopes.is_empty() {
6094 self._scopes
6095 .insert(Scope::CloudPlatformReadOnly.as_ref().to_string());
6096 }
6097
6098 #[allow(clippy::single_element_loop)]
6099 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
6100 url = params.uri_replacement(url, param_name, find_this, true);
6101 }
6102 {
6103 let to_remove = ["parent"];
6104 params.remove_params(&to_remove);
6105 }
6106
6107 let url = params.parse_with_url(&url);
6108
6109 loop {
6110 let token = match self
6111 .hub
6112 .auth
6113 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6114 .await
6115 {
6116 Ok(token) => token,
6117 Err(e) => match dlg.token(e) {
6118 Ok(token) => token,
6119 Err(e) => {
6120 dlg.finished(false);
6121 return Err(common::Error::MissingToken(e));
6122 }
6123 },
6124 };
6125 let mut req_result = {
6126 let client = &self.hub.client;
6127 dlg.pre_request();
6128 let mut req_builder = hyper::Request::builder()
6129 .method(hyper::Method::GET)
6130 .uri(url.as_str())
6131 .header(USER_AGENT, self.hub._user_agent.clone());
6132
6133 if let Some(token) = token.as_ref() {
6134 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6135 }
6136
6137 let request = req_builder
6138 .header(CONTENT_LENGTH, 0_u64)
6139 .body(common::to_body::<String>(None));
6140
6141 client.request(request.unwrap()).await
6142 };
6143
6144 match req_result {
6145 Err(err) => {
6146 if let common::Retry::After(d) = dlg.http_error(&err) {
6147 sleep(d).await;
6148 continue;
6149 }
6150 dlg.finished(false);
6151 return Err(common::Error::HttpError(err));
6152 }
6153 Ok(res) => {
6154 let (mut parts, body) = res.into_parts();
6155 let mut body = common::Body::new(body);
6156 if !parts.status.is_success() {
6157 let bytes = common::to_bytes(body).await.unwrap_or_default();
6158 let error = serde_json::from_str(&common::to_string(&bytes));
6159 let response = common::to_response(parts, bytes.into());
6160
6161 if let common::Retry::After(d) =
6162 dlg.http_failure(&response, error.as_ref().ok())
6163 {
6164 sleep(d).await;
6165 continue;
6166 }
6167
6168 dlg.finished(false);
6169
6170 return Err(match error {
6171 Ok(value) => common::Error::BadRequest(value),
6172 _ => common::Error::Failure(response),
6173 });
6174 }
6175 let response = {
6176 let bytes = common::to_bytes(body).await.unwrap_or_default();
6177 let encoded = common::to_string(&bytes);
6178 match serde_json::from_str(&encoded) {
6179 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6180 Err(error) => {
6181 dlg.response_json_decode_error(&encoded, &error);
6182 return Err(common::Error::JsonDecodeError(
6183 encoded.to_string(),
6184 error,
6185 ));
6186 }
6187 }
6188 };
6189
6190 dlg.finished(true);
6191 return Ok(response);
6192 }
6193 }
6194 }
6195 }
6196
6197 /// Required. The BigQuery project id for which transfer configs should be returned. If you are using the regionless method, the location must be `US` and `parent` should be in the following form: * `projects/{project_id} If you are using the regionalized method, `parent` should be in the following form: * `projects/{project_id}/locations/{location_id}`
6198 ///
6199 /// Sets the *parent* path property to the given value.
6200 ///
6201 /// Even though the property as already been set when instantiating this call,
6202 /// we provide this method for API completeness.
6203 pub fn parent(mut self, new_value: &str) -> ProjectLocationTransferConfigListCall<'a, C> {
6204 self._parent = new_value.to_string();
6205 self
6206 }
6207 /// Pagination token, which can be used to request a specific page of `ListTransfersRequest` list results. For multiple-page results, `ListTransfersResponse` outputs a `next_page` token, which can be used as the `page_token` value to request the next page of list results.
6208 ///
6209 /// Sets the *page token* query property to the given value.
6210 pub fn page_token(mut self, new_value: &str) -> ProjectLocationTransferConfigListCall<'a, C> {
6211 self._page_token = Some(new_value.to_string());
6212 self
6213 }
6214 /// Page size. The default page size is the maximum value of 1000 results.
6215 ///
6216 /// Sets the *page size* query property to the given value.
6217 pub fn page_size(mut self, new_value: i32) -> ProjectLocationTransferConfigListCall<'a, C> {
6218 self._page_size = Some(new_value);
6219 self
6220 }
6221 /// When specified, only configurations of requested data sources are returned.
6222 ///
6223 /// Append the given value to the *data source ids* query property.
6224 /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
6225 pub fn add_data_source_ids(
6226 mut self,
6227 new_value: &str,
6228 ) -> ProjectLocationTransferConfigListCall<'a, C> {
6229 self._data_source_ids.push(new_value.to_string());
6230 self
6231 }
6232 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6233 /// while executing the actual API request.
6234 ///
6235 /// ````text
6236 /// It should be used to handle progress information, and to implement a certain level of resilience.
6237 /// ````
6238 ///
6239 /// Sets the *delegate* property to the given value.
6240 pub fn delegate(
6241 mut self,
6242 new_value: &'a mut dyn common::Delegate,
6243 ) -> ProjectLocationTransferConfigListCall<'a, C> {
6244 self._delegate = Some(new_value);
6245 self
6246 }
6247
6248 /// Set any additional parameter of the query string used in the request.
6249 /// It should be used to set parameters which are not yet available through their own
6250 /// setters.
6251 ///
6252 /// Please note that this method must not be used to set any of the known parameters
6253 /// which have their own setter method. If done anyway, the request will fail.
6254 ///
6255 /// # Additional Parameters
6256 ///
6257 /// * *$.xgafv* (query-string) - V1 error format.
6258 /// * *access_token* (query-string) - OAuth access token.
6259 /// * *alt* (query-string) - Data format for response.
6260 /// * *callback* (query-string) - JSONP
6261 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6262 /// * *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.
6263 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6264 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6265 /// * *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.
6266 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6267 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6268 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationTransferConfigListCall<'a, C>
6269 where
6270 T: AsRef<str>,
6271 {
6272 self._additional_params
6273 .insert(name.as_ref().to_string(), value.as_ref().to_string());
6274 self
6275 }
6276
6277 /// Identifies the authorization scope for the method you are building.
6278 ///
6279 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6280 /// [`Scope::CloudPlatformReadOnly`].
6281 ///
6282 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6283 /// tokens for more than one scope.
6284 ///
6285 /// Usually there is more than one suitable scope to authorize an operation, some of which may
6286 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6287 /// sufficient, a read-write scope will do as well.
6288 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationTransferConfigListCall<'a, C>
6289 where
6290 St: AsRef<str>,
6291 {
6292 self._scopes.insert(String::from(scope.as_ref()));
6293 self
6294 }
6295 /// Identifies the authorization scope(s) for the method you are building.
6296 ///
6297 /// See [`Self::add_scope()`] for details.
6298 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationTransferConfigListCall<'a, C>
6299 where
6300 I: IntoIterator<Item = St>,
6301 St: AsRef<str>,
6302 {
6303 self._scopes
6304 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6305 self
6306 }
6307
6308 /// Removes all scopes, and no default scope will be used either.
6309 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6310 /// for details).
6311 pub fn clear_scopes(mut self) -> ProjectLocationTransferConfigListCall<'a, C> {
6312 self._scopes.clear();
6313 self
6314 }
6315}
6316
6317/// Updates a data transfer configuration. All fields must be set, even if they are not updated.
6318///
6319/// A builder for the *locations.transferConfigs.patch* method supported by a *project* resource.
6320/// It is not used directly, but through a [`ProjectMethods`] instance.
6321///
6322/// # Example
6323///
6324/// Instantiate a resource method builder
6325///
6326/// ```test_harness,no_run
6327/// # extern crate hyper;
6328/// # extern crate hyper_rustls;
6329/// # extern crate google_bigquerydatatransfer1 as bigquerydatatransfer1;
6330/// use bigquerydatatransfer1::api::TransferConfig;
6331/// # async fn dox() {
6332/// # use bigquerydatatransfer1::{BigQueryDataTransfer, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6333///
6334/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6335/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
6336/// # .with_native_roots()
6337/// # .unwrap()
6338/// # .https_only()
6339/// # .enable_http2()
6340/// # .build();
6341///
6342/// # let executor = hyper_util::rt::TokioExecutor::new();
6343/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
6344/// # secret,
6345/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6346/// # yup_oauth2::client::CustomHyperClientBuilder::from(
6347/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
6348/// # ),
6349/// # ).build().await.unwrap();
6350///
6351/// # let client = hyper_util::client::legacy::Client::builder(
6352/// # hyper_util::rt::TokioExecutor::new()
6353/// # )
6354/// # .build(
6355/// # hyper_rustls::HttpsConnectorBuilder::new()
6356/// # .with_native_roots()
6357/// # .unwrap()
6358/// # .https_or_http()
6359/// # .enable_http2()
6360/// # .build()
6361/// # );
6362/// # let mut hub = BigQueryDataTransfer::new(client, auth);
6363/// // As the method needs a request, you would usually fill it with the desired information
6364/// // into the respective structure. Some of the parts shown here might not be applicable !
6365/// // Values shown here are possibly random and not representative !
6366/// let mut req = TransferConfig::default();
6367///
6368/// // You can configure optional parameters by calling the respective setters at will, and
6369/// // execute the final call using `doit()`.
6370/// // Values shown here are possibly random and not representative !
6371/// let result = hub.projects().locations_transfer_configs_patch(req, "name")
6372/// .version_info("Lorem")
6373/// .update_mask(FieldMask::new::<&str>(&[]))
6374/// .service_account_name("eos")
6375/// .authorization_code("labore")
6376/// .doit().await;
6377/// # }
6378/// ```
6379pub struct ProjectLocationTransferConfigPatchCall<'a, C>
6380where
6381 C: 'a,
6382{
6383 hub: &'a BigQueryDataTransfer<C>,
6384 _request: TransferConfig,
6385 _name: String,
6386 _version_info: Option<String>,
6387 _update_mask: Option<common::FieldMask>,
6388 _service_account_name: Option<String>,
6389 _authorization_code: Option<String>,
6390 _delegate: Option<&'a mut dyn common::Delegate>,
6391 _additional_params: HashMap<String, String>,
6392 _scopes: BTreeSet<String>,
6393}
6394
6395impl<'a, C> common::CallBuilder for ProjectLocationTransferConfigPatchCall<'a, C> {}
6396
6397impl<'a, C> ProjectLocationTransferConfigPatchCall<'a, C>
6398where
6399 C: common::Connector,
6400{
6401 /// Perform the operation you have build so far.
6402 pub async fn doit(mut self) -> common::Result<(common::Response, TransferConfig)> {
6403 use std::borrow::Cow;
6404 use std::io::{Read, Seek};
6405
6406 use common::{url::Params, ToParts};
6407 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6408
6409 let mut dd = common::DefaultDelegate;
6410 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6411 dlg.begin(common::MethodInfo {
6412 id: "bigquerydatatransfer.projects.locations.transferConfigs.patch",
6413 http_method: hyper::Method::PATCH,
6414 });
6415
6416 for &field in [
6417 "alt",
6418 "name",
6419 "versionInfo",
6420 "updateMask",
6421 "serviceAccountName",
6422 "authorizationCode",
6423 ]
6424 .iter()
6425 {
6426 if self._additional_params.contains_key(field) {
6427 dlg.finished(false);
6428 return Err(common::Error::FieldClash(field));
6429 }
6430 }
6431
6432 let mut params = Params::with_capacity(8 + self._additional_params.len());
6433 params.push("name", self._name);
6434 if let Some(value) = self._version_info.as_ref() {
6435 params.push("versionInfo", value);
6436 }
6437 if let Some(value) = self._update_mask.as_ref() {
6438 params.push("updateMask", value.to_string());
6439 }
6440 if let Some(value) = self._service_account_name.as_ref() {
6441 params.push("serviceAccountName", value);
6442 }
6443 if let Some(value) = self._authorization_code.as_ref() {
6444 params.push("authorizationCode", value);
6445 }
6446
6447 params.extend(self._additional_params.iter());
6448
6449 params.push("alt", "json");
6450 let mut url = self.hub._base_url.clone() + "v1/{+name}";
6451 if self._scopes.is_empty() {
6452 self._scopes
6453 .insert(Scope::CloudPlatform.as_ref().to_string());
6454 }
6455
6456 #[allow(clippy::single_element_loop)]
6457 for &(find_this, param_name) in [("{+name}", "name")].iter() {
6458 url = params.uri_replacement(url, param_name, find_this, true);
6459 }
6460 {
6461 let to_remove = ["name"];
6462 params.remove_params(&to_remove);
6463 }
6464
6465 let url = params.parse_with_url(&url);
6466
6467 let mut json_mime_type = mime::APPLICATION_JSON;
6468 let mut request_value_reader = {
6469 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
6470 common::remove_json_null_values(&mut value);
6471 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
6472 serde_json::to_writer(&mut dst, &value).unwrap();
6473 dst
6474 };
6475 let request_size = request_value_reader
6476 .seek(std::io::SeekFrom::End(0))
6477 .unwrap();
6478 request_value_reader
6479 .seek(std::io::SeekFrom::Start(0))
6480 .unwrap();
6481
6482 loop {
6483 let token = match self
6484 .hub
6485 .auth
6486 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6487 .await
6488 {
6489 Ok(token) => token,
6490 Err(e) => match dlg.token(e) {
6491 Ok(token) => token,
6492 Err(e) => {
6493 dlg.finished(false);
6494 return Err(common::Error::MissingToken(e));
6495 }
6496 },
6497 };
6498 request_value_reader
6499 .seek(std::io::SeekFrom::Start(0))
6500 .unwrap();
6501 let mut req_result = {
6502 let client = &self.hub.client;
6503 dlg.pre_request();
6504 let mut req_builder = hyper::Request::builder()
6505 .method(hyper::Method::PATCH)
6506 .uri(url.as_str())
6507 .header(USER_AGENT, self.hub._user_agent.clone());
6508
6509 if let Some(token) = token.as_ref() {
6510 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6511 }
6512
6513 let request = req_builder
6514 .header(CONTENT_TYPE, json_mime_type.to_string())
6515 .header(CONTENT_LENGTH, request_size as u64)
6516 .body(common::to_body(
6517 request_value_reader.get_ref().clone().into(),
6518 ));
6519
6520 client.request(request.unwrap()).await
6521 };
6522
6523 match req_result {
6524 Err(err) => {
6525 if let common::Retry::After(d) = dlg.http_error(&err) {
6526 sleep(d).await;
6527 continue;
6528 }
6529 dlg.finished(false);
6530 return Err(common::Error::HttpError(err));
6531 }
6532 Ok(res) => {
6533 let (mut parts, body) = res.into_parts();
6534 let mut body = common::Body::new(body);
6535 if !parts.status.is_success() {
6536 let bytes = common::to_bytes(body).await.unwrap_or_default();
6537 let error = serde_json::from_str(&common::to_string(&bytes));
6538 let response = common::to_response(parts, bytes.into());
6539
6540 if let common::Retry::After(d) =
6541 dlg.http_failure(&response, error.as_ref().ok())
6542 {
6543 sleep(d).await;
6544 continue;
6545 }
6546
6547 dlg.finished(false);
6548
6549 return Err(match error {
6550 Ok(value) => common::Error::BadRequest(value),
6551 _ => common::Error::Failure(response),
6552 });
6553 }
6554 let response = {
6555 let bytes = common::to_bytes(body).await.unwrap_or_default();
6556 let encoded = common::to_string(&bytes);
6557 match serde_json::from_str(&encoded) {
6558 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6559 Err(error) => {
6560 dlg.response_json_decode_error(&encoded, &error);
6561 return Err(common::Error::JsonDecodeError(
6562 encoded.to_string(),
6563 error,
6564 ));
6565 }
6566 }
6567 };
6568
6569 dlg.finished(true);
6570 return Ok(response);
6571 }
6572 }
6573 }
6574 }
6575
6576 ///
6577 /// Sets the *request* property to the given value.
6578 ///
6579 /// Even though the property as already been set when instantiating this call,
6580 /// we provide this method for API completeness.
6581 pub fn request(
6582 mut self,
6583 new_value: TransferConfig,
6584 ) -> ProjectLocationTransferConfigPatchCall<'a, C> {
6585 self._request = new_value;
6586 self
6587 }
6588 /// Identifier. The resource name of the transfer config. Transfer config names have the form either `projects/{project_id}/locations/{region}/transferConfigs/{config_id}` or `projects/{project_id}/transferConfigs/{config_id}`, where `config_id` is usually a UUID, even though it is not guaranteed or required. The name is ignored when creating a transfer config.
6589 ///
6590 /// Sets the *name* path property to the given value.
6591 ///
6592 /// Even though the property as already been set when instantiating this call,
6593 /// we provide this method for API completeness.
6594 pub fn name(mut self, new_value: &str) -> ProjectLocationTransferConfigPatchCall<'a, C> {
6595 self._name = new_value.to_string();
6596 self
6597 }
6598 /// Optional version info. This parameter replaces `authorization_code` which is no longer used in any data sources. This is required only if `transferConfig.dataSourceId` is 'youtube_channel' *or* new credentials are needed, as indicated by `CheckValidCreds`. In order to obtain version info, make a request to the following URL: https://bigquery.cloud.google.com/datatransfer/oauthz/auth?redirect_uri=urn:ietf:wg:oauth:2.0:oob&response_type=version_info&client_id=client_id&scope=data_source_scopes * The client_id is the OAuth client_id of the data source as returned by ListDataSources method. * data_source_scopes are the scopes returned by ListDataSources method. Note that this should not be set when `service_account_name` is used to update the transfer config.
6599 ///
6600 /// Sets the *version info* query property to the given value.
6601 pub fn version_info(
6602 mut self,
6603 new_value: &str,
6604 ) -> ProjectLocationTransferConfigPatchCall<'a, C> {
6605 self._version_info = Some(new_value.to_string());
6606 self
6607 }
6608 /// Required. Required list of fields to be updated in this request.
6609 ///
6610 /// Sets the *update mask* query property to the given value.
6611 pub fn update_mask(
6612 mut self,
6613 new_value: common::FieldMask,
6614 ) -> ProjectLocationTransferConfigPatchCall<'a, C> {
6615 self._update_mask = Some(new_value);
6616 self
6617 }
6618 /// Optional service account email. If this field is set, the transfer config will be created with this service account's credentials. It requires that the requesting user calling this API has permissions to act as this service account. Note that not all data sources support service account credentials when creating a transfer config. For the latest list of data sources, read about [using service accounts](https://cloud.google.com/bigquery-transfer/docs/use-service-accounts).
6619 ///
6620 /// Sets the *service account name* query property to the given value.
6621 pub fn service_account_name(
6622 mut self,
6623 new_value: &str,
6624 ) -> ProjectLocationTransferConfigPatchCall<'a, C> {
6625 self._service_account_name = Some(new_value.to_string());
6626 self
6627 }
6628 /// Deprecated: Authorization code was required when `transferConfig.dataSourceId` is 'youtube_channel' but it is no longer used in any data sources. Use `version_info` instead. Optional OAuth2 authorization code to use with this transfer configuration. This is required only if `transferConfig.dataSourceId` is 'youtube_channel' and new credentials are needed, as indicated by `CheckValidCreds`. In order to obtain authorization_code, make a request to the following URL: https://bigquery.cloud.google.com/datatransfer/oauthz/auth?redirect_uri=urn:ietf:wg:oauth:2.0:oob&response_type=authorization_code&client_id=client_id&scope=data_source_scopes * The client_id is the OAuth client_id of the data source as returned by ListDataSources method. * data_source_scopes are the scopes returned by ListDataSources method. Note that this should not be set when `service_account_name` is used to update the transfer config.
6629 ///
6630 /// Sets the *authorization code* query property to the given value.
6631 pub fn authorization_code(
6632 mut self,
6633 new_value: &str,
6634 ) -> ProjectLocationTransferConfigPatchCall<'a, C> {
6635 self._authorization_code = Some(new_value.to_string());
6636 self
6637 }
6638 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6639 /// while executing the actual API request.
6640 ///
6641 /// ````text
6642 /// It should be used to handle progress information, and to implement a certain level of resilience.
6643 /// ````
6644 ///
6645 /// Sets the *delegate* property to the given value.
6646 pub fn delegate(
6647 mut self,
6648 new_value: &'a mut dyn common::Delegate,
6649 ) -> ProjectLocationTransferConfigPatchCall<'a, C> {
6650 self._delegate = Some(new_value);
6651 self
6652 }
6653
6654 /// Set any additional parameter of the query string used in the request.
6655 /// It should be used to set parameters which are not yet available through their own
6656 /// setters.
6657 ///
6658 /// Please note that this method must not be used to set any of the known parameters
6659 /// which have their own setter method. If done anyway, the request will fail.
6660 ///
6661 /// # Additional Parameters
6662 ///
6663 /// * *$.xgafv* (query-string) - V1 error format.
6664 /// * *access_token* (query-string) - OAuth access token.
6665 /// * *alt* (query-string) - Data format for response.
6666 /// * *callback* (query-string) - JSONP
6667 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6668 /// * *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.
6669 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6670 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6671 /// * *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.
6672 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6673 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6674 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationTransferConfigPatchCall<'a, C>
6675 where
6676 T: AsRef<str>,
6677 {
6678 self._additional_params
6679 .insert(name.as_ref().to_string(), value.as_ref().to_string());
6680 self
6681 }
6682
6683 /// Identifies the authorization scope for the method you are building.
6684 ///
6685 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6686 /// [`Scope::CloudPlatform`].
6687 ///
6688 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6689 /// tokens for more than one scope.
6690 ///
6691 /// Usually there is more than one suitable scope to authorize an operation, some of which may
6692 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6693 /// sufficient, a read-write scope will do as well.
6694 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationTransferConfigPatchCall<'a, C>
6695 where
6696 St: AsRef<str>,
6697 {
6698 self._scopes.insert(String::from(scope.as_ref()));
6699 self
6700 }
6701 /// Identifies the authorization scope(s) for the method you are building.
6702 ///
6703 /// See [`Self::add_scope()`] for details.
6704 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationTransferConfigPatchCall<'a, C>
6705 where
6706 I: IntoIterator<Item = St>,
6707 St: AsRef<str>,
6708 {
6709 self._scopes
6710 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6711 self
6712 }
6713
6714 /// Removes all scopes, and no default scope will be used either.
6715 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6716 /// for details).
6717 pub fn clear_scopes(mut self) -> ProjectLocationTransferConfigPatchCall<'a, C> {
6718 self._scopes.clear();
6719 self
6720 }
6721}
6722
6723/// Creates transfer runs for a time range [start_time, end_time]. For each date - or whatever granularity the data source supports - in the range, one transfer run is created. Note that runs are created per UTC time in the time range. DEPRECATED: use StartManualTransferRuns instead.
6724///
6725/// A builder for the *locations.transferConfigs.scheduleRuns* method supported by a *project* resource.
6726/// It is not used directly, but through a [`ProjectMethods`] instance.
6727///
6728/// # Example
6729///
6730/// Instantiate a resource method builder
6731///
6732/// ```test_harness,no_run
6733/// # extern crate hyper;
6734/// # extern crate hyper_rustls;
6735/// # extern crate google_bigquerydatatransfer1 as bigquerydatatransfer1;
6736/// use bigquerydatatransfer1::api::ScheduleTransferRunsRequest;
6737/// # async fn dox() {
6738/// # use bigquerydatatransfer1::{BigQueryDataTransfer, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6739///
6740/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6741/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
6742/// # .with_native_roots()
6743/// # .unwrap()
6744/// # .https_only()
6745/// # .enable_http2()
6746/// # .build();
6747///
6748/// # let executor = hyper_util::rt::TokioExecutor::new();
6749/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
6750/// # secret,
6751/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6752/// # yup_oauth2::client::CustomHyperClientBuilder::from(
6753/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
6754/// # ),
6755/// # ).build().await.unwrap();
6756///
6757/// # let client = hyper_util::client::legacy::Client::builder(
6758/// # hyper_util::rt::TokioExecutor::new()
6759/// # )
6760/// # .build(
6761/// # hyper_rustls::HttpsConnectorBuilder::new()
6762/// # .with_native_roots()
6763/// # .unwrap()
6764/// # .https_or_http()
6765/// # .enable_http2()
6766/// # .build()
6767/// # );
6768/// # let mut hub = BigQueryDataTransfer::new(client, auth);
6769/// // As the method needs a request, you would usually fill it with the desired information
6770/// // into the respective structure. Some of the parts shown here might not be applicable !
6771/// // Values shown here are possibly random and not representative !
6772/// let mut req = ScheduleTransferRunsRequest::default();
6773///
6774/// // You can configure optional parameters by calling the respective setters at will, and
6775/// // execute the final call using `doit()`.
6776/// // Values shown here are possibly random and not representative !
6777/// let result = hub.projects().locations_transfer_configs_schedule_runs(req, "parent")
6778/// .doit().await;
6779/// # }
6780/// ```
6781pub struct ProjectLocationTransferConfigScheduleRunCall<'a, C>
6782where
6783 C: 'a,
6784{
6785 hub: &'a BigQueryDataTransfer<C>,
6786 _request: ScheduleTransferRunsRequest,
6787 _parent: String,
6788 _delegate: Option<&'a mut dyn common::Delegate>,
6789 _additional_params: HashMap<String, String>,
6790 _scopes: BTreeSet<String>,
6791}
6792
6793impl<'a, C> common::CallBuilder for ProjectLocationTransferConfigScheduleRunCall<'a, C> {}
6794
6795impl<'a, C> ProjectLocationTransferConfigScheduleRunCall<'a, C>
6796where
6797 C: common::Connector,
6798{
6799 /// Perform the operation you have build so far.
6800 pub async fn doit(
6801 mut self,
6802 ) -> common::Result<(common::Response, ScheduleTransferRunsResponse)> {
6803 use std::borrow::Cow;
6804 use std::io::{Read, Seek};
6805
6806 use common::{url::Params, ToParts};
6807 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6808
6809 let mut dd = common::DefaultDelegate;
6810 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6811 dlg.begin(common::MethodInfo {
6812 id: "bigquerydatatransfer.projects.locations.transferConfigs.scheduleRuns",
6813 http_method: hyper::Method::POST,
6814 });
6815
6816 for &field in ["alt", "parent"].iter() {
6817 if self._additional_params.contains_key(field) {
6818 dlg.finished(false);
6819 return Err(common::Error::FieldClash(field));
6820 }
6821 }
6822
6823 let mut params = Params::with_capacity(4 + self._additional_params.len());
6824 params.push("parent", self._parent);
6825
6826 params.extend(self._additional_params.iter());
6827
6828 params.push("alt", "json");
6829 let mut url = self.hub._base_url.clone() + "v1/{+parent}:scheduleRuns";
6830 if self._scopes.is_empty() {
6831 self._scopes
6832 .insert(Scope::CloudPlatform.as_ref().to_string());
6833 }
6834
6835 #[allow(clippy::single_element_loop)]
6836 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
6837 url = params.uri_replacement(url, param_name, find_this, true);
6838 }
6839 {
6840 let to_remove = ["parent"];
6841 params.remove_params(&to_remove);
6842 }
6843
6844 let url = params.parse_with_url(&url);
6845
6846 let mut json_mime_type = mime::APPLICATION_JSON;
6847 let mut request_value_reader = {
6848 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
6849 common::remove_json_null_values(&mut value);
6850 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
6851 serde_json::to_writer(&mut dst, &value).unwrap();
6852 dst
6853 };
6854 let request_size = request_value_reader
6855 .seek(std::io::SeekFrom::End(0))
6856 .unwrap();
6857 request_value_reader
6858 .seek(std::io::SeekFrom::Start(0))
6859 .unwrap();
6860
6861 loop {
6862 let token = match self
6863 .hub
6864 .auth
6865 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6866 .await
6867 {
6868 Ok(token) => token,
6869 Err(e) => match dlg.token(e) {
6870 Ok(token) => token,
6871 Err(e) => {
6872 dlg.finished(false);
6873 return Err(common::Error::MissingToken(e));
6874 }
6875 },
6876 };
6877 request_value_reader
6878 .seek(std::io::SeekFrom::Start(0))
6879 .unwrap();
6880 let mut req_result = {
6881 let client = &self.hub.client;
6882 dlg.pre_request();
6883 let mut req_builder = hyper::Request::builder()
6884 .method(hyper::Method::POST)
6885 .uri(url.as_str())
6886 .header(USER_AGENT, self.hub._user_agent.clone());
6887
6888 if let Some(token) = token.as_ref() {
6889 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6890 }
6891
6892 let request = req_builder
6893 .header(CONTENT_TYPE, json_mime_type.to_string())
6894 .header(CONTENT_LENGTH, request_size as u64)
6895 .body(common::to_body(
6896 request_value_reader.get_ref().clone().into(),
6897 ));
6898
6899 client.request(request.unwrap()).await
6900 };
6901
6902 match req_result {
6903 Err(err) => {
6904 if let common::Retry::After(d) = dlg.http_error(&err) {
6905 sleep(d).await;
6906 continue;
6907 }
6908 dlg.finished(false);
6909 return Err(common::Error::HttpError(err));
6910 }
6911 Ok(res) => {
6912 let (mut parts, body) = res.into_parts();
6913 let mut body = common::Body::new(body);
6914 if !parts.status.is_success() {
6915 let bytes = common::to_bytes(body).await.unwrap_or_default();
6916 let error = serde_json::from_str(&common::to_string(&bytes));
6917 let response = common::to_response(parts, bytes.into());
6918
6919 if let common::Retry::After(d) =
6920 dlg.http_failure(&response, error.as_ref().ok())
6921 {
6922 sleep(d).await;
6923 continue;
6924 }
6925
6926 dlg.finished(false);
6927
6928 return Err(match error {
6929 Ok(value) => common::Error::BadRequest(value),
6930 _ => common::Error::Failure(response),
6931 });
6932 }
6933 let response = {
6934 let bytes = common::to_bytes(body).await.unwrap_or_default();
6935 let encoded = common::to_string(&bytes);
6936 match serde_json::from_str(&encoded) {
6937 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6938 Err(error) => {
6939 dlg.response_json_decode_error(&encoded, &error);
6940 return Err(common::Error::JsonDecodeError(
6941 encoded.to_string(),
6942 error,
6943 ));
6944 }
6945 }
6946 };
6947
6948 dlg.finished(true);
6949 return Ok(response);
6950 }
6951 }
6952 }
6953 }
6954
6955 ///
6956 /// Sets the *request* property to the given value.
6957 ///
6958 /// Even though the property as already been set when instantiating this call,
6959 /// we provide this method for API completeness.
6960 pub fn request(
6961 mut self,
6962 new_value: ScheduleTransferRunsRequest,
6963 ) -> ProjectLocationTransferConfigScheduleRunCall<'a, C> {
6964 self._request = new_value;
6965 self
6966 }
6967 /// Required. Transfer configuration name. If you are using the regionless method, the location must be `US` and the name should be in the following form: * `projects/{project_id}/transferConfigs/{config_id}` If you are using the regionalized method, the name should be in the following form: * `projects/{project_id}/locations/{location_id}/transferConfigs/{config_id}`
6968 ///
6969 /// Sets the *parent* path property to the given value.
6970 ///
6971 /// Even though the property as already been set when instantiating this call,
6972 /// we provide this method for API completeness.
6973 pub fn parent(
6974 mut self,
6975 new_value: &str,
6976 ) -> ProjectLocationTransferConfigScheduleRunCall<'a, C> {
6977 self._parent = new_value.to_string();
6978 self
6979 }
6980 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6981 /// while executing the actual API request.
6982 ///
6983 /// ````text
6984 /// It should be used to handle progress information, and to implement a certain level of resilience.
6985 /// ````
6986 ///
6987 /// Sets the *delegate* property to the given value.
6988 pub fn delegate(
6989 mut self,
6990 new_value: &'a mut dyn common::Delegate,
6991 ) -> ProjectLocationTransferConfigScheduleRunCall<'a, C> {
6992 self._delegate = Some(new_value);
6993 self
6994 }
6995
6996 /// Set any additional parameter of the query string used in the request.
6997 /// It should be used to set parameters which are not yet available through their own
6998 /// setters.
6999 ///
7000 /// Please note that this method must not be used to set any of the known parameters
7001 /// which have their own setter method. If done anyway, the request will fail.
7002 ///
7003 /// # Additional Parameters
7004 ///
7005 /// * *$.xgafv* (query-string) - V1 error format.
7006 /// * *access_token* (query-string) - OAuth access token.
7007 /// * *alt* (query-string) - Data format for response.
7008 /// * *callback* (query-string) - JSONP
7009 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7010 /// * *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.
7011 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7012 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7013 /// * *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.
7014 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7015 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7016 pub fn param<T>(
7017 mut self,
7018 name: T,
7019 value: T,
7020 ) -> ProjectLocationTransferConfigScheduleRunCall<'a, C>
7021 where
7022 T: AsRef<str>,
7023 {
7024 self._additional_params
7025 .insert(name.as_ref().to_string(), value.as_ref().to_string());
7026 self
7027 }
7028
7029 /// Identifies the authorization scope for the method you are building.
7030 ///
7031 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7032 /// [`Scope::CloudPlatform`].
7033 ///
7034 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7035 /// tokens for more than one scope.
7036 ///
7037 /// Usually there is more than one suitable scope to authorize an operation, some of which may
7038 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7039 /// sufficient, a read-write scope will do as well.
7040 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationTransferConfigScheduleRunCall<'a, C>
7041 where
7042 St: AsRef<str>,
7043 {
7044 self._scopes.insert(String::from(scope.as_ref()));
7045 self
7046 }
7047 /// Identifies the authorization scope(s) for the method you are building.
7048 ///
7049 /// See [`Self::add_scope()`] for details.
7050 pub fn add_scopes<I, St>(
7051 mut self,
7052 scopes: I,
7053 ) -> ProjectLocationTransferConfigScheduleRunCall<'a, C>
7054 where
7055 I: IntoIterator<Item = St>,
7056 St: AsRef<str>,
7057 {
7058 self._scopes
7059 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7060 self
7061 }
7062
7063 /// Removes all scopes, and no default scope will be used either.
7064 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7065 /// for details).
7066 pub fn clear_scopes(mut self) -> ProjectLocationTransferConfigScheduleRunCall<'a, C> {
7067 self._scopes.clear();
7068 self
7069 }
7070}
7071
7072/// Manually initiates transfer runs. You can schedule these runs in two ways: 1. For a specific point in time using the 'requested_run_time' parameter. 2. For a period between 'start_time' (inclusive) and 'end_time' (exclusive). If scheduling a single run, it is set to execute immediately (schedule_time equals the current time). When scheduling multiple runs within a time range, the first run starts now, and subsequent runs are delayed by 15 seconds each.
7073///
7074/// A builder for the *locations.transferConfigs.startManualRuns* method supported by a *project* resource.
7075/// It is not used directly, but through a [`ProjectMethods`] instance.
7076///
7077/// # Example
7078///
7079/// Instantiate a resource method builder
7080///
7081/// ```test_harness,no_run
7082/// # extern crate hyper;
7083/// # extern crate hyper_rustls;
7084/// # extern crate google_bigquerydatatransfer1 as bigquerydatatransfer1;
7085/// use bigquerydatatransfer1::api::StartManualTransferRunsRequest;
7086/// # async fn dox() {
7087/// # use bigquerydatatransfer1::{BigQueryDataTransfer, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7088///
7089/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7090/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
7091/// # .with_native_roots()
7092/// # .unwrap()
7093/// # .https_only()
7094/// # .enable_http2()
7095/// # .build();
7096///
7097/// # let executor = hyper_util::rt::TokioExecutor::new();
7098/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
7099/// # secret,
7100/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7101/// # yup_oauth2::client::CustomHyperClientBuilder::from(
7102/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
7103/// # ),
7104/// # ).build().await.unwrap();
7105///
7106/// # let client = hyper_util::client::legacy::Client::builder(
7107/// # hyper_util::rt::TokioExecutor::new()
7108/// # )
7109/// # .build(
7110/// # hyper_rustls::HttpsConnectorBuilder::new()
7111/// # .with_native_roots()
7112/// # .unwrap()
7113/// # .https_or_http()
7114/// # .enable_http2()
7115/// # .build()
7116/// # );
7117/// # let mut hub = BigQueryDataTransfer::new(client, auth);
7118/// // As the method needs a request, you would usually fill it with the desired information
7119/// // into the respective structure. Some of the parts shown here might not be applicable !
7120/// // Values shown here are possibly random and not representative !
7121/// let mut req = StartManualTransferRunsRequest::default();
7122///
7123/// // You can configure optional parameters by calling the respective setters at will, and
7124/// // execute the final call using `doit()`.
7125/// // Values shown here are possibly random and not representative !
7126/// let result = hub.projects().locations_transfer_configs_start_manual_runs(req, "parent")
7127/// .doit().await;
7128/// # }
7129/// ```
7130pub struct ProjectLocationTransferConfigStartManualRunCall<'a, C>
7131where
7132 C: 'a,
7133{
7134 hub: &'a BigQueryDataTransfer<C>,
7135 _request: StartManualTransferRunsRequest,
7136 _parent: String,
7137 _delegate: Option<&'a mut dyn common::Delegate>,
7138 _additional_params: HashMap<String, String>,
7139 _scopes: BTreeSet<String>,
7140}
7141
7142impl<'a, C> common::CallBuilder for ProjectLocationTransferConfigStartManualRunCall<'a, C> {}
7143
7144impl<'a, C> ProjectLocationTransferConfigStartManualRunCall<'a, C>
7145where
7146 C: common::Connector,
7147{
7148 /// Perform the operation you have build so far.
7149 pub async fn doit(
7150 mut self,
7151 ) -> common::Result<(common::Response, StartManualTransferRunsResponse)> {
7152 use std::borrow::Cow;
7153 use std::io::{Read, Seek};
7154
7155 use common::{url::Params, ToParts};
7156 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7157
7158 let mut dd = common::DefaultDelegate;
7159 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7160 dlg.begin(common::MethodInfo {
7161 id: "bigquerydatatransfer.projects.locations.transferConfigs.startManualRuns",
7162 http_method: hyper::Method::POST,
7163 });
7164
7165 for &field in ["alt", "parent"].iter() {
7166 if self._additional_params.contains_key(field) {
7167 dlg.finished(false);
7168 return Err(common::Error::FieldClash(field));
7169 }
7170 }
7171
7172 let mut params = Params::with_capacity(4 + self._additional_params.len());
7173 params.push("parent", self._parent);
7174
7175 params.extend(self._additional_params.iter());
7176
7177 params.push("alt", "json");
7178 let mut url = self.hub._base_url.clone() + "v1/{+parent}:startManualRuns";
7179 if self._scopes.is_empty() {
7180 self._scopes
7181 .insert(Scope::CloudPlatform.as_ref().to_string());
7182 }
7183
7184 #[allow(clippy::single_element_loop)]
7185 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
7186 url = params.uri_replacement(url, param_name, find_this, true);
7187 }
7188 {
7189 let to_remove = ["parent"];
7190 params.remove_params(&to_remove);
7191 }
7192
7193 let url = params.parse_with_url(&url);
7194
7195 let mut json_mime_type = mime::APPLICATION_JSON;
7196 let mut request_value_reader = {
7197 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
7198 common::remove_json_null_values(&mut value);
7199 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
7200 serde_json::to_writer(&mut dst, &value).unwrap();
7201 dst
7202 };
7203 let request_size = request_value_reader
7204 .seek(std::io::SeekFrom::End(0))
7205 .unwrap();
7206 request_value_reader
7207 .seek(std::io::SeekFrom::Start(0))
7208 .unwrap();
7209
7210 loop {
7211 let token = match self
7212 .hub
7213 .auth
7214 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
7215 .await
7216 {
7217 Ok(token) => token,
7218 Err(e) => match dlg.token(e) {
7219 Ok(token) => token,
7220 Err(e) => {
7221 dlg.finished(false);
7222 return Err(common::Error::MissingToken(e));
7223 }
7224 },
7225 };
7226 request_value_reader
7227 .seek(std::io::SeekFrom::Start(0))
7228 .unwrap();
7229 let mut req_result = {
7230 let client = &self.hub.client;
7231 dlg.pre_request();
7232 let mut req_builder = hyper::Request::builder()
7233 .method(hyper::Method::POST)
7234 .uri(url.as_str())
7235 .header(USER_AGENT, self.hub._user_agent.clone());
7236
7237 if let Some(token) = token.as_ref() {
7238 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7239 }
7240
7241 let request = req_builder
7242 .header(CONTENT_TYPE, json_mime_type.to_string())
7243 .header(CONTENT_LENGTH, request_size as u64)
7244 .body(common::to_body(
7245 request_value_reader.get_ref().clone().into(),
7246 ));
7247
7248 client.request(request.unwrap()).await
7249 };
7250
7251 match req_result {
7252 Err(err) => {
7253 if let common::Retry::After(d) = dlg.http_error(&err) {
7254 sleep(d).await;
7255 continue;
7256 }
7257 dlg.finished(false);
7258 return Err(common::Error::HttpError(err));
7259 }
7260 Ok(res) => {
7261 let (mut parts, body) = res.into_parts();
7262 let mut body = common::Body::new(body);
7263 if !parts.status.is_success() {
7264 let bytes = common::to_bytes(body).await.unwrap_or_default();
7265 let error = serde_json::from_str(&common::to_string(&bytes));
7266 let response = common::to_response(parts, bytes.into());
7267
7268 if let common::Retry::After(d) =
7269 dlg.http_failure(&response, error.as_ref().ok())
7270 {
7271 sleep(d).await;
7272 continue;
7273 }
7274
7275 dlg.finished(false);
7276
7277 return Err(match error {
7278 Ok(value) => common::Error::BadRequest(value),
7279 _ => common::Error::Failure(response),
7280 });
7281 }
7282 let response = {
7283 let bytes = common::to_bytes(body).await.unwrap_or_default();
7284 let encoded = common::to_string(&bytes);
7285 match serde_json::from_str(&encoded) {
7286 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
7287 Err(error) => {
7288 dlg.response_json_decode_error(&encoded, &error);
7289 return Err(common::Error::JsonDecodeError(
7290 encoded.to_string(),
7291 error,
7292 ));
7293 }
7294 }
7295 };
7296
7297 dlg.finished(true);
7298 return Ok(response);
7299 }
7300 }
7301 }
7302 }
7303
7304 ///
7305 /// Sets the *request* property to the given value.
7306 ///
7307 /// Even though the property as already been set when instantiating this call,
7308 /// we provide this method for API completeness.
7309 pub fn request(
7310 mut self,
7311 new_value: StartManualTransferRunsRequest,
7312 ) -> ProjectLocationTransferConfigStartManualRunCall<'a, C> {
7313 self._request = new_value;
7314 self
7315 }
7316 /// Required. Transfer configuration name. If you are using the regionless method, the location must be `US` and the name should be in the following form: * `projects/{project_id}/transferConfigs/{config_id}` If you are using the regionalized method, the name should be in the following form: * `projects/{project_id}/locations/{location_id}/transferConfigs/{config_id}`
7317 ///
7318 /// Sets the *parent* path property to the given value.
7319 ///
7320 /// Even though the property as already been set when instantiating this call,
7321 /// we provide this method for API completeness.
7322 pub fn parent(
7323 mut self,
7324 new_value: &str,
7325 ) -> ProjectLocationTransferConfigStartManualRunCall<'a, C> {
7326 self._parent = new_value.to_string();
7327 self
7328 }
7329 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7330 /// while executing the actual API request.
7331 ///
7332 /// ````text
7333 /// It should be used to handle progress information, and to implement a certain level of resilience.
7334 /// ````
7335 ///
7336 /// Sets the *delegate* property to the given value.
7337 pub fn delegate(
7338 mut self,
7339 new_value: &'a mut dyn common::Delegate,
7340 ) -> ProjectLocationTransferConfigStartManualRunCall<'a, C> {
7341 self._delegate = Some(new_value);
7342 self
7343 }
7344
7345 /// Set any additional parameter of the query string used in the request.
7346 /// It should be used to set parameters which are not yet available through their own
7347 /// setters.
7348 ///
7349 /// Please note that this method must not be used to set any of the known parameters
7350 /// which have their own setter method. If done anyway, the request will fail.
7351 ///
7352 /// # Additional Parameters
7353 ///
7354 /// * *$.xgafv* (query-string) - V1 error format.
7355 /// * *access_token* (query-string) - OAuth access token.
7356 /// * *alt* (query-string) - Data format for response.
7357 /// * *callback* (query-string) - JSONP
7358 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7359 /// * *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.
7360 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7361 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7362 /// * *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.
7363 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7364 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7365 pub fn param<T>(
7366 mut self,
7367 name: T,
7368 value: T,
7369 ) -> ProjectLocationTransferConfigStartManualRunCall<'a, C>
7370 where
7371 T: AsRef<str>,
7372 {
7373 self._additional_params
7374 .insert(name.as_ref().to_string(), value.as_ref().to_string());
7375 self
7376 }
7377
7378 /// Identifies the authorization scope for the method you are building.
7379 ///
7380 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7381 /// [`Scope::CloudPlatform`].
7382 ///
7383 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7384 /// tokens for more than one scope.
7385 ///
7386 /// Usually there is more than one suitable scope to authorize an operation, some of which may
7387 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7388 /// sufficient, a read-write scope will do as well.
7389 pub fn add_scope<St>(
7390 mut self,
7391 scope: St,
7392 ) -> ProjectLocationTransferConfigStartManualRunCall<'a, C>
7393 where
7394 St: AsRef<str>,
7395 {
7396 self._scopes.insert(String::from(scope.as_ref()));
7397 self
7398 }
7399 /// Identifies the authorization scope(s) for the method you are building.
7400 ///
7401 /// See [`Self::add_scope()`] for details.
7402 pub fn add_scopes<I, St>(
7403 mut self,
7404 scopes: I,
7405 ) -> ProjectLocationTransferConfigStartManualRunCall<'a, C>
7406 where
7407 I: IntoIterator<Item = St>,
7408 St: AsRef<str>,
7409 {
7410 self._scopes
7411 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7412 self
7413 }
7414
7415 /// Removes all scopes, and no default scope will be used either.
7416 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7417 /// for details).
7418 pub fn clear_scopes(mut self) -> ProjectLocationTransferConfigStartManualRunCall<'a, C> {
7419 self._scopes.clear();
7420 self
7421 }
7422}
7423
7424/// Enroll data sources in a user project. This allows users to create transfer configurations for these data sources. They will also appear in the ListDataSources RPC and as such, will appear in the [BigQuery UI](https://console.cloud.google.com/bigquery), and the documents can be found in the public guide for [BigQuery Web UI](https://cloud.google.com/bigquery/bigquery-web-ui) and [Data Transfer Service](https://cloud.google.com/bigquery/docs/working-with-transfers).
7425///
7426/// A builder for the *locations.enrollDataSources* method supported by a *project* resource.
7427/// It is not used directly, but through a [`ProjectMethods`] instance.
7428///
7429/// # Example
7430///
7431/// Instantiate a resource method builder
7432///
7433/// ```test_harness,no_run
7434/// # extern crate hyper;
7435/// # extern crate hyper_rustls;
7436/// # extern crate google_bigquerydatatransfer1 as bigquerydatatransfer1;
7437/// use bigquerydatatransfer1::api::EnrollDataSourcesRequest;
7438/// # async fn dox() {
7439/// # use bigquerydatatransfer1::{BigQueryDataTransfer, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7440///
7441/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7442/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
7443/// # .with_native_roots()
7444/// # .unwrap()
7445/// # .https_only()
7446/// # .enable_http2()
7447/// # .build();
7448///
7449/// # let executor = hyper_util::rt::TokioExecutor::new();
7450/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
7451/// # secret,
7452/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7453/// # yup_oauth2::client::CustomHyperClientBuilder::from(
7454/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
7455/// # ),
7456/// # ).build().await.unwrap();
7457///
7458/// # let client = hyper_util::client::legacy::Client::builder(
7459/// # hyper_util::rt::TokioExecutor::new()
7460/// # )
7461/// # .build(
7462/// # hyper_rustls::HttpsConnectorBuilder::new()
7463/// # .with_native_roots()
7464/// # .unwrap()
7465/// # .https_or_http()
7466/// # .enable_http2()
7467/// # .build()
7468/// # );
7469/// # let mut hub = BigQueryDataTransfer::new(client, auth);
7470/// // As the method needs a request, you would usually fill it with the desired information
7471/// // into the respective structure. Some of the parts shown here might not be applicable !
7472/// // Values shown here are possibly random and not representative !
7473/// let mut req = EnrollDataSourcesRequest::default();
7474///
7475/// // You can configure optional parameters by calling the respective setters at will, and
7476/// // execute the final call using `doit()`.
7477/// // Values shown here are possibly random and not representative !
7478/// let result = hub.projects().locations_enroll_data_sources(req, "name")
7479/// .doit().await;
7480/// # }
7481/// ```
7482pub struct ProjectLocationEnrollDataSourceCall<'a, C>
7483where
7484 C: 'a,
7485{
7486 hub: &'a BigQueryDataTransfer<C>,
7487 _request: EnrollDataSourcesRequest,
7488 _name: String,
7489 _delegate: Option<&'a mut dyn common::Delegate>,
7490 _additional_params: HashMap<String, String>,
7491 _scopes: BTreeSet<String>,
7492}
7493
7494impl<'a, C> common::CallBuilder for ProjectLocationEnrollDataSourceCall<'a, C> {}
7495
7496impl<'a, C> ProjectLocationEnrollDataSourceCall<'a, C>
7497where
7498 C: common::Connector,
7499{
7500 /// Perform the operation you have build so far.
7501 pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
7502 use std::borrow::Cow;
7503 use std::io::{Read, Seek};
7504
7505 use common::{url::Params, ToParts};
7506 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7507
7508 let mut dd = common::DefaultDelegate;
7509 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7510 dlg.begin(common::MethodInfo {
7511 id: "bigquerydatatransfer.projects.locations.enrollDataSources",
7512 http_method: hyper::Method::POST,
7513 });
7514
7515 for &field in ["alt", "name"].iter() {
7516 if self._additional_params.contains_key(field) {
7517 dlg.finished(false);
7518 return Err(common::Error::FieldClash(field));
7519 }
7520 }
7521
7522 let mut params = Params::with_capacity(4 + self._additional_params.len());
7523 params.push("name", self._name);
7524
7525 params.extend(self._additional_params.iter());
7526
7527 params.push("alt", "json");
7528 let mut url = self.hub._base_url.clone() + "v1/{+name}:enrollDataSources";
7529 if self._scopes.is_empty() {
7530 self._scopes
7531 .insert(Scope::CloudPlatform.as_ref().to_string());
7532 }
7533
7534 #[allow(clippy::single_element_loop)]
7535 for &(find_this, param_name) in [("{+name}", "name")].iter() {
7536 url = params.uri_replacement(url, param_name, find_this, true);
7537 }
7538 {
7539 let to_remove = ["name"];
7540 params.remove_params(&to_remove);
7541 }
7542
7543 let url = params.parse_with_url(&url);
7544
7545 let mut json_mime_type = mime::APPLICATION_JSON;
7546 let mut request_value_reader = {
7547 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
7548 common::remove_json_null_values(&mut value);
7549 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
7550 serde_json::to_writer(&mut dst, &value).unwrap();
7551 dst
7552 };
7553 let request_size = request_value_reader
7554 .seek(std::io::SeekFrom::End(0))
7555 .unwrap();
7556 request_value_reader
7557 .seek(std::io::SeekFrom::Start(0))
7558 .unwrap();
7559
7560 loop {
7561 let token = match self
7562 .hub
7563 .auth
7564 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
7565 .await
7566 {
7567 Ok(token) => token,
7568 Err(e) => match dlg.token(e) {
7569 Ok(token) => token,
7570 Err(e) => {
7571 dlg.finished(false);
7572 return Err(common::Error::MissingToken(e));
7573 }
7574 },
7575 };
7576 request_value_reader
7577 .seek(std::io::SeekFrom::Start(0))
7578 .unwrap();
7579 let mut req_result = {
7580 let client = &self.hub.client;
7581 dlg.pre_request();
7582 let mut req_builder = hyper::Request::builder()
7583 .method(hyper::Method::POST)
7584 .uri(url.as_str())
7585 .header(USER_AGENT, self.hub._user_agent.clone());
7586
7587 if let Some(token) = token.as_ref() {
7588 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7589 }
7590
7591 let request = req_builder
7592 .header(CONTENT_TYPE, json_mime_type.to_string())
7593 .header(CONTENT_LENGTH, request_size as u64)
7594 .body(common::to_body(
7595 request_value_reader.get_ref().clone().into(),
7596 ));
7597
7598 client.request(request.unwrap()).await
7599 };
7600
7601 match req_result {
7602 Err(err) => {
7603 if let common::Retry::After(d) = dlg.http_error(&err) {
7604 sleep(d).await;
7605 continue;
7606 }
7607 dlg.finished(false);
7608 return Err(common::Error::HttpError(err));
7609 }
7610 Ok(res) => {
7611 let (mut parts, body) = res.into_parts();
7612 let mut body = common::Body::new(body);
7613 if !parts.status.is_success() {
7614 let bytes = common::to_bytes(body).await.unwrap_or_default();
7615 let error = serde_json::from_str(&common::to_string(&bytes));
7616 let response = common::to_response(parts, bytes.into());
7617
7618 if let common::Retry::After(d) =
7619 dlg.http_failure(&response, error.as_ref().ok())
7620 {
7621 sleep(d).await;
7622 continue;
7623 }
7624
7625 dlg.finished(false);
7626
7627 return Err(match error {
7628 Ok(value) => common::Error::BadRequest(value),
7629 _ => common::Error::Failure(response),
7630 });
7631 }
7632 let response = {
7633 let bytes = common::to_bytes(body).await.unwrap_or_default();
7634 let encoded = common::to_string(&bytes);
7635 match serde_json::from_str(&encoded) {
7636 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
7637 Err(error) => {
7638 dlg.response_json_decode_error(&encoded, &error);
7639 return Err(common::Error::JsonDecodeError(
7640 encoded.to_string(),
7641 error,
7642 ));
7643 }
7644 }
7645 };
7646
7647 dlg.finished(true);
7648 return Ok(response);
7649 }
7650 }
7651 }
7652 }
7653
7654 ///
7655 /// Sets the *request* property to the given value.
7656 ///
7657 /// Even though the property as already been set when instantiating this call,
7658 /// we provide this method for API completeness.
7659 pub fn request(
7660 mut self,
7661 new_value: EnrollDataSourcesRequest,
7662 ) -> ProjectLocationEnrollDataSourceCall<'a, C> {
7663 self._request = new_value;
7664 self
7665 }
7666 /// Required. The name of the project resource in the form: `projects/{project_id}`
7667 ///
7668 /// Sets the *name* path property to the given value.
7669 ///
7670 /// Even though the property as already been set when instantiating this call,
7671 /// we provide this method for API completeness.
7672 pub fn name(mut self, new_value: &str) -> ProjectLocationEnrollDataSourceCall<'a, C> {
7673 self._name = new_value.to_string();
7674 self
7675 }
7676 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7677 /// while executing the actual API request.
7678 ///
7679 /// ````text
7680 /// It should be used to handle progress information, and to implement a certain level of resilience.
7681 /// ````
7682 ///
7683 /// Sets the *delegate* property to the given value.
7684 pub fn delegate(
7685 mut self,
7686 new_value: &'a mut dyn common::Delegate,
7687 ) -> ProjectLocationEnrollDataSourceCall<'a, C> {
7688 self._delegate = Some(new_value);
7689 self
7690 }
7691
7692 /// Set any additional parameter of the query string used in the request.
7693 /// It should be used to set parameters which are not yet available through their own
7694 /// setters.
7695 ///
7696 /// Please note that this method must not be used to set any of the known parameters
7697 /// which have their own setter method. If done anyway, the request will fail.
7698 ///
7699 /// # Additional Parameters
7700 ///
7701 /// * *$.xgafv* (query-string) - V1 error format.
7702 /// * *access_token* (query-string) - OAuth access token.
7703 /// * *alt* (query-string) - Data format for response.
7704 /// * *callback* (query-string) - JSONP
7705 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7706 /// * *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.
7707 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7708 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7709 /// * *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.
7710 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7711 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7712 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationEnrollDataSourceCall<'a, C>
7713 where
7714 T: AsRef<str>,
7715 {
7716 self._additional_params
7717 .insert(name.as_ref().to_string(), value.as_ref().to_string());
7718 self
7719 }
7720
7721 /// Identifies the authorization scope for the method you are building.
7722 ///
7723 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7724 /// [`Scope::CloudPlatform`].
7725 ///
7726 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7727 /// tokens for more than one scope.
7728 ///
7729 /// Usually there is more than one suitable scope to authorize an operation, some of which may
7730 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7731 /// sufficient, a read-write scope will do as well.
7732 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationEnrollDataSourceCall<'a, C>
7733 where
7734 St: AsRef<str>,
7735 {
7736 self._scopes.insert(String::from(scope.as_ref()));
7737 self
7738 }
7739 /// Identifies the authorization scope(s) for the method you are building.
7740 ///
7741 /// See [`Self::add_scope()`] for details.
7742 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationEnrollDataSourceCall<'a, C>
7743 where
7744 I: IntoIterator<Item = St>,
7745 St: AsRef<str>,
7746 {
7747 self._scopes
7748 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7749 self
7750 }
7751
7752 /// Removes all scopes, and no default scope will be used either.
7753 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7754 /// for details).
7755 pub fn clear_scopes(mut self) -> ProjectLocationEnrollDataSourceCall<'a, C> {
7756 self._scopes.clear();
7757 self
7758 }
7759}
7760
7761/// Gets information about a location.
7762///
7763/// A builder for the *locations.get* method supported by a *project* resource.
7764/// It is not used directly, but through a [`ProjectMethods`] instance.
7765///
7766/// # Example
7767///
7768/// Instantiate a resource method builder
7769///
7770/// ```test_harness,no_run
7771/// # extern crate hyper;
7772/// # extern crate hyper_rustls;
7773/// # extern crate google_bigquerydatatransfer1 as bigquerydatatransfer1;
7774/// # async fn dox() {
7775/// # use bigquerydatatransfer1::{BigQueryDataTransfer, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7776///
7777/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7778/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
7779/// # .with_native_roots()
7780/// # .unwrap()
7781/// # .https_only()
7782/// # .enable_http2()
7783/// # .build();
7784///
7785/// # let executor = hyper_util::rt::TokioExecutor::new();
7786/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
7787/// # secret,
7788/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7789/// # yup_oauth2::client::CustomHyperClientBuilder::from(
7790/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
7791/// # ),
7792/// # ).build().await.unwrap();
7793///
7794/// # let client = hyper_util::client::legacy::Client::builder(
7795/// # hyper_util::rt::TokioExecutor::new()
7796/// # )
7797/// # .build(
7798/// # hyper_rustls::HttpsConnectorBuilder::new()
7799/// # .with_native_roots()
7800/// # .unwrap()
7801/// # .https_or_http()
7802/// # .enable_http2()
7803/// # .build()
7804/// # );
7805/// # let mut hub = BigQueryDataTransfer::new(client, auth);
7806/// // You can configure optional parameters by calling the respective setters at will, and
7807/// // execute the final call using `doit()`.
7808/// // Values shown here are possibly random and not representative !
7809/// let result = hub.projects().locations_get("name")
7810/// .doit().await;
7811/// # }
7812/// ```
7813pub struct ProjectLocationGetCall<'a, C>
7814where
7815 C: 'a,
7816{
7817 hub: &'a BigQueryDataTransfer<C>,
7818 _name: String,
7819 _delegate: Option<&'a mut dyn common::Delegate>,
7820 _additional_params: HashMap<String, String>,
7821 _scopes: BTreeSet<String>,
7822}
7823
7824impl<'a, C> common::CallBuilder for ProjectLocationGetCall<'a, C> {}
7825
7826impl<'a, C> ProjectLocationGetCall<'a, C>
7827where
7828 C: common::Connector,
7829{
7830 /// Perform the operation you have build so far.
7831 pub async fn doit(mut self) -> common::Result<(common::Response, Location)> {
7832 use std::borrow::Cow;
7833 use std::io::{Read, Seek};
7834
7835 use common::{url::Params, ToParts};
7836 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7837
7838 let mut dd = common::DefaultDelegate;
7839 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7840 dlg.begin(common::MethodInfo {
7841 id: "bigquerydatatransfer.projects.locations.get",
7842 http_method: hyper::Method::GET,
7843 });
7844
7845 for &field in ["alt", "name"].iter() {
7846 if self._additional_params.contains_key(field) {
7847 dlg.finished(false);
7848 return Err(common::Error::FieldClash(field));
7849 }
7850 }
7851
7852 let mut params = Params::with_capacity(3 + self._additional_params.len());
7853 params.push("name", self._name);
7854
7855 params.extend(self._additional_params.iter());
7856
7857 params.push("alt", "json");
7858 let mut url = self.hub._base_url.clone() + "v1/{+name}";
7859 if self._scopes.is_empty() {
7860 self._scopes
7861 .insert(Scope::CloudPlatformReadOnly.as_ref().to_string());
7862 }
7863
7864 #[allow(clippy::single_element_loop)]
7865 for &(find_this, param_name) in [("{+name}", "name")].iter() {
7866 url = params.uri_replacement(url, param_name, find_this, true);
7867 }
7868 {
7869 let to_remove = ["name"];
7870 params.remove_params(&to_remove);
7871 }
7872
7873 let url = params.parse_with_url(&url);
7874
7875 loop {
7876 let token = match self
7877 .hub
7878 .auth
7879 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
7880 .await
7881 {
7882 Ok(token) => token,
7883 Err(e) => match dlg.token(e) {
7884 Ok(token) => token,
7885 Err(e) => {
7886 dlg.finished(false);
7887 return Err(common::Error::MissingToken(e));
7888 }
7889 },
7890 };
7891 let mut req_result = {
7892 let client = &self.hub.client;
7893 dlg.pre_request();
7894 let mut req_builder = hyper::Request::builder()
7895 .method(hyper::Method::GET)
7896 .uri(url.as_str())
7897 .header(USER_AGENT, self.hub._user_agent.clone());
7898
7899 if let Some(token) = token.as_ref() {
7900 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7901 }
7902
7903 let request = req_builder
7904 .header(CONTENT_LENGTH, 0_u64)
7905 .body(common::to_body::<String>(None));
7906
7907 client.request(request.unwrap()).await
7908 };
7909
7910 match req_result {
7911 Err(err) => {
7912 if let common::Retry::After(d) = dlg.http_error(&err) {
7913 sleep(d).await;
7914 continue;
7915 }
7916 dlg.finished(false);
7917 return Err(common::Error::HttpError(err));
7918 }
7919 Ok(res) => {
7920 let (mut parts, body) = res.into_parts();
7921 let mut body = common::Body::new(body);
7922 if !parts.status.is_success() {
7923 let bytes = common::to_bytes(body).await.unwrap_or_default();
7924 let error = serde_json::from_str(&common::to_string(&bytes));
7925 let response = common::to_response(parts, bytes.into());
7926
7927 if let common::Retry::After(d) =
7928 dlg.http_failure(&response, error.as_ref().ok())
7929 {
7930 sleep(d).await;
7931 continue;
7932 }
7933
7934 dlg.finished(false);
7935
7936 return Err(match error {
7937 Ok(value) => common::Error::BadRequest(value),
7938 _ => common::Error::Failure(response),
7939 });
7940 }
7941 let response = {
7942 let bytes = common::to_bytes(body).await.unwrap_or_default();
7943 let encoded = common::to_string(&bytes);
7944 match serde_json::from_str(&encoded) {
7945 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
7946 Err(error) => {
7947 dlg.response_json_decode_error(&encoded, &error);
7948 return Err(common::Error::JsonDecodeError(
7949 encoded.to_string(),
7950 error,
7951 ));
7952 }
7953 }
7954 };
7955
7956 dlg.finished(true);
7957 return Ok(response);
7958 }
7959 }
7960 }
7961 }
7962
7963 /// Resource name for the location.
7964 ///
7965 /// Sets the *name* path property to the given value.
7966 ///
7967 /// Even though the property as already been set when instantiating this call,
7968 /// we provide this method for API completeness.
7969 pub fn name(mut self, new_value: &str) -> ProjectLocationGetCall<'a, C> {
7970 self._name = new_value.to_string();
7971 self
7972 }
7973 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7974 /// while executing the actual API request.
7975 ///
7976 /// ````text
7977 /// It should be used to handle progress information, and to implement a certain level of resilience.
7978 /// ````
7979 ///
7980 /// Sets the *delegate* property to the given value.
7981 pub fn delegate(
7982 mut self,
7983 new_value: &'a mut dyn common::Delegate,
7984 ) -> ProjectLocationGetCall<'a, C> {
7985 self._delegate = Some(new_value);
7986 self
7987 }
7988
7989 /// Set any additional parameter of the query string used in the request.
7990 /// It should be used to set parameters which are not yet available through their own
7991 /// setters.
7992 ///
7993 /// Please note that this method must not be used to set any of the known parameters
7994 /// which have their own setter method. If done anyway, the request will fail.
7995 ///
7996 /// # Additional Parameters
7997 ///
7998 /// * *$.xgafv* (query-string) - V1 error format.
7999 /// * *access_token* (query-string) - OAuth access token.
8000 /// * *alt* (query-string) - Data format for response.
8001 /// * *callback* (query-string) - JSONP
8002 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8003 /// * *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.
8004 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8005 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8006 /// * *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.
8007 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8008 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8009 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationGetCall<'a, C>
8010 where
8011 T: AsRef<str>,
8012 {
8013 self._additional_params
8014 .insert(name.as_ref().to_string(), value.as_ref().to_string());
8015 self
8016 }
8017
8018 /// Identifies the authorization scope for the method you are building.
8019 ///
8020 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
8021 /// [`Scope::CloudPlatformReadOnly`].
8022 ///
8023 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
8024 /// tokens for more than one scope.
8025 ///
8026 /// Usually there is more than one suitable scope to authorize an operation, some of which may
8027 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
8028 /// sufficient, a read-write scope will do as well.
8029 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationGetCall<'a, C>
8030 where
8031 St: AsRef<str>,
8032 {
8033 self._scopes.insert(String::from(scope.as_ref()));
8034 self
8035 }
8036 /// Identifies the authorization scope(s) for the method you are building.
8037 ///
8038 /// See [`Self::add_scope()`] for details.
8039 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationGetCall<'a, C>
8040 where
8041 I: IntoIterator<Item = St>,
8042 St: AsRef<str>,
8043 {
8044 self._scopes
8045 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
8046 self
8047 }
8048
8049 /// Removes all scopes, and no default scope will be used either.
8050 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
8051 /// for details).
8052 pub fn clear_scopes(mut self) -> ProjectLocationGetCall<'a, C> {
8053 self._scopes.clear();
8054 self
8055 }
8056}
8057
8058/// Lists information about the supported locations for this service.
8059///
8060/// A builder for the *locations.list* method supported by a *project* resource.
8061/// It is not used directly, but through a [`ProjectMethods`] instance.
8062///
8063/// # Example
8064///
8065/// Instantiate a resource method builder
8066///
8067/// ```test_harness,no_run
8068/// # extern crate hyper;
8069/// # extern crate hyper_rustls;
8070/// # extern crate google_bigquerydatatransfer1 as bigquerydatatransfer1;
8071/// # async fn dox() {
8072/// # use bigquerydatatransfer1::{BigQueryDataTransfer, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8073///
8074/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
8075/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
8076/// # .with_native_roots()
8077/// # .unwrap()
8078/// # .https_only()
8079/// # .enable_http2()
8080/// # .build();
8081///
8082/// # let executor = hyper_util::rt::TokioExecutor::new();
8083/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
8084/// # secret,
8085/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8086/// # yup_oauth2::client::CustomHyperClientBuilder::from(
8087/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
8088/// # ),
8089/// # ).build().await.unwrap();
8090///
8091/// # let client = hyper_util::client::legacy::Client::builder(
8092/// # hyper_util::rt::TokioExecutor::new()
8093/// # )
8094/// # .build(
8095/// # hyper_rustls::HttpsConnectorBuilder::new()
8096/// # .with_native_roots()
8097/// # .unwrap()
8098/// # .https_or_http()
8099/// # .enable_http2()
8100/// # .build()
8101/// # );
8102/// # let mut hub = BigQueryDataTransfer::new(client, auth);
8103/// // You can configure optional parameters by calling the respective setters at will, and
8104/// // execute the final call using `doit()`.
8105/// // Values shown here are possibly random and not representative !
8106/// let result = hub.projects().locations_list("name")
8107/// .page_token("kasd")
8108/// .page_size(-24)
8109/// .filter("sed")
8110/// .add_extra_location_types("et")
8111/// .doit().await;
8112/// # }
8113/// ```
8114pub struct ProjectLocationListCall<'a, C>
8115where
8116 C: 'a,
8117{
8118 hub: &'a BigQueryDataTransfer<C>,
8119 _name: String,
8120 _page_token: Option<String>,
8121 _page_size: Option<i32>,
8122 _filter: Option<String>,
8123 _extra_location_types: Vec<String>,
8124 _delegate: Option<&'a mut dyn common::Delegate>,
8125 _additional_params: HashMap<String, String>,
8126 _scopes: BTreeSet<String>,
8127}
8128
8129impl<'a, C> common::CallBuilder for ProjectLocationListCall<'a, C> {}
8130
8131impl<'a, C> ProjectLocationListCall<'a, C>
8132where
8133 C: common::Connector,
8134{
8135 /// Perform the operation you have build so far.
8136 pub async fn doit(mut self) -> common::Result<(common::Response, ListLocationsResponse)> {
8137 use std::borrow::Cow;
8138 use std::io::{Read, Seek};
8139
8140 use common::{url::Params, ToParts};
8141 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
8142
8143 let mut dd = common::DefaultDelegate;
8144 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
8145 dlg.begin(common::MethodInfo {
8146 id: "bigquerydatatransfer.projects.locations.list",
8147 http_method: hyper::Method::GET,
8148 });
8149
8150 for &field in [
8151 "alt",
8152 "name",
8153 "pageToken",
8154 "pageSize",
8155 "filter",
8156 "extraLocationTypes",
8157 ]
8158 .iter()
8159 {
8160 if self._additional_params.contains_key(field) {
8161 dlg.finished(false);
8162 return Err(common::Error::FieldClash(field));
8163 }
8164 }
8165
8166 let mut params = Params::with_capacity(7 + self._additional_params.len());
8167 params.push("name", self._name);
8168 if let Some(value) = self._page_token.as_ref() {
8169 params.push("pageToken", value);
8170 }
8171 if let Some(value) = self._page_size.as_ref() {
8172 params.push("pageSize", value.to_string());
8173 }
8174 if let Some(value) = self._filter.as_ref() {
8175 params.push("filter", value);
8176 }
8177 if !self._extra_location_types.is_empty() {
8178 for f in self._extra_location_types.iter() {
8179 params.push("extraLocationTypes", f);
8180 }
8181 }
8182
8183 params.extend(self._additional_params.iter());
8184
8185 params.push("alt", "json");
8186 let mut url = self.hub._base_url.clone() + "v1/{+name}/locations";
8187 if self._scopes.is_empty() {
8188 self._scopes
8189 .insert(Scope::CloudPlatformReadOnly.as_ref().to_string());
8190 }
8191
8192 #[allow(clippy::single_element_loop)]
8193 for &(find_this, param_name) in [("{+name}", "name")].iter() {
8194 url = params.uri_replacement(url, param_name, find_this, true);
8195 }
8196 {
8197 let to_remove = ["name"];
8198 params.remove_params(&to_remove);
8199 }
8200
8201 let url = params.parse_with_url(&url);
8202
8203 loop {
8204 let token = match self
8205 .hub
8206 .auth
8207 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
8208 .await
8209 {
8210 Ok(token) => token,
8211 Err(e) => match dlg.token(e) {
8212 Ok(token) => token,
8213 Err(e) => {
8214 dlg.finished(false);
8215 return Err(common::Error::MissingToken(e));
8216 }
8217 },
8218 };
8219 let mut req_result = {
8220 let client = &self.hub.client;
8221 dlg.pre_request();
8222 let mut req_builder = hyper::Request::builder()
8223 .method(hyper::Method::GET)
8224 .uri(url.as_str())
8225 .header(USER_AGENT, self.hub._user_agent.clone());
8226
8227 if let Some(token) = token.as_ref() {
8228 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8229 }
8230
8231 let request = req_builder
8232 .header(CONTENT_LENGTH, 0_u64)
8233 .body(common::to_body::<String>(None));
8234
8235 client.request(request.unwrap()).await
8236 };
8237
8238 match req_result {
8239 Err(err) => {
8240 if let common::Retry::After(d) = dlg.http_error(&err) {
8241 sleep(d).await;
8242 continue;
8243 }
8244 dlg.finished(false);
8245 return Err(common::Error::HttpError(err));
8246 }
8247 Ok(res) => {
8248 let (mut parts, body) = res.into_parts();
8249 let mut body = common::Body::new(body);
8250 if !parts.status.is_success() {
8251 let bytes = common::to_bytes(body).await.unwrap_or_default();
8252 let error = serde_json::from_str(&common::to_string(&bytes));
8253 let response = common::to_response(parts, bytes.into());
8254
8255 if let common::Retry::After(d) =
8256 dlg.http_failure(&response, error.as_ref().ok())
8257 {
8258 sleep(d).await;
8259 continue;
8260 }
8261
8262 dlg.finished(false);
8263
8264 return Err(match error {
8265 Ok(value) => common::Error::BadRequest(value),
8266 _ => common::Error::Failure(response),
8267 });
8268 }
8269 let response = {
8270 let bytes = common::to_bytes(body).await.unwrap_or_default();
8271 let encoded = common::to_string(&bytes);
8272 match serde_json::from_str(&encoded) {
8273 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8274 Err(error) => {
8275 dlg.response_json_decode_error(&encoded, &error);
8276 return Err(common::Error::JsonDecodeError(
8277 encoded.to_string(),
8278 error,
8279 ));
8280 }
8281 }
8282 };
8283
8284 dlg.finished(true);
8285 return Ok(response);
8286 }
8287 }
8288 }
8289 }
8290
8291 /// The resource that owns the locations collection, if applicable.
8292 ///
8293 /// Sets the *name* path property to the given value.
8294 ///
8295 /// Even though the property as already been set when instantiating this call,
8296 /// we provide this method for API completeness.
8297 pub fn name(mut self, new_value: &str) -> ProjectLocationListCall<'a, C> {
8298 self._name = new_value.to_string();
8299 self
8300 }
8301 /// A page token received from the `next_page_token` field in the response. Send that page token to receive the subsequent page.
8302 ///
8303 /// Sets the *page token* query property to the given value.
8304 pub fn page_token(mut self, new_value: &str) -> ProjectLocationListCall<'a, C> {
8305 self._page_token = Some(new_value.to_string());
8306 self
8307 }
8308 /// The maximum number of results to return. If not set, the service selects a default.
8309 ///
8310 /// Sets the *page size* query property to the given value.
8311 pub fn page_size(mut self, new_value: i32) -> ProjectLocationListCall<'a, C> {
8312 self._page_size = Some(new_value);
8313 self
8314 }
8315 /// A filter to narrow down results to a preferred subset. The filtering language accepts strings like `"displayName=tokyo"`, and is documented in more detail in [AIP-160](https://google.aip.dev/160).
8316 ///
8317 /// Sets the *filter* query property to the given value.
8318 pub fn filter(mut self, new_value: &str) -> ProjectLocationListCall<'a, C> {
8319 self._filter = Some(new_value.to_string());
8320 self
8321 }
8322 /// Optional. Do not use this field. It is unsupported and is ignored unless explicitly documented otherwise. This is primarily for internal usage.
8323 ///
8324 /// Append the given value to the *extra location types* query property.
8325 /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
8326 pub fn add_extra_location_types(mut self, new_value: &str) -> ProjectLocationListCall<'a, C> {
8327 self._extra_location_types.push(new_value.to_string());
8328 self
8329 }
8330 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8331 /// while executing the actual API request.
8332 ///
8333 /// ````text
8334 /// It should be used to handle progress information, and to implement a certain level of resilience.
8335 /// ````
8336 ///
8337 /// Sets the *delegate* property to the given value.
8338 pub fn delegate(
8339 mut self,
8340 new_value: &'a mut dyn common::Delegate,
8341 ) -> ProjectLocationListCall<'a, C> {
8342 self._delegate = Some(new_value);
8343 self
8344 }
8345
8346 /// Set any additional parameter of the query string used in the request.
8347 /// It should be used to set parameters which are not yet available through their own
8348 /// setters.
8349 ///
8350 /// Please note that this method must not be used to set any of the known parameters
8351 /// which have their own setter method. If done anyway, the request will fail.
8352 ///
8353 /// # Additional Parameters
8354 ///
8355 /// * *$.xgafv* (query-string) - V1 error format.
8356 /// * *access_token* (query-string) - OAuth access token.
8357 /// * *alt* (query-string) - Data format for response.
8358 /// * *callback* (query-string) - JSONP
8359 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8360 /// * *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.
8361 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8362 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8363 /// * *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.
8364 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8365 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8366 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationListCall<'a, C>
8367 where
8368 T: AsRef<str>,
8369 {
8370 self._additional_params
8371 .insert(name.as_ref().to_string(), value.as_ref().to_string());
8372 self
8373 }
8374
8375 /// Identifies the authorization scope for the method you are building.
8376 ///
8377 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
8378 /// [`Scope::CloudPlatformReadOnly`].
8379 ///
8380 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
8381 /// tokens for more than one scope.
8382 ///
8383 /// Usually there is more than one suitable scope to authorize an operation, some of which may
8384 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
8385 /// sufficient, a read-write scope will do as well.
8386 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationListCall<'a, C>
8387 where
8388 St: AsRef<str>,
8389 {
8390 self._scopes.insert(String::from(scope.as_ref()));
8391 self
8392 }
8393 /// Identifies the authorization scope(s) for the method you are building.
8394 ///
8395 /// See [`Self::add_scope()`] for details.
8396 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationListCall<'a, C>
8397 where
8398 I: IntoIterator<Item = St>,
8399 St: AsRef<str>,
8400 {
8401 self._scopes
8402 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
8403 self
8404 }
8405
8406 /// Removes all scopes, and no default scope will be used either.
8407 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
8408 /// for details).
8409 pub fn clear_scopes(mut self) -> ProjectLocationListCall<'a, C> {
8410 self._scopes.clear();
8411 self
8412 }
8413}
8414
8415/// Unenroll data sources in a user project. This allows users to remove transfer configurations for these data sources. They will no longer appear in the ListDataSources RPC and will also no longer appear in the [BigQuery UI](https://console.cloud.google.com/bigquery). Data transfers configurations of unenrolled data sources will not be scheduled.
8416///
8417/// A builder for the *locations.unenrollDataSources* method supported by a *project* resource.
8418/// It is not used directly, but through a [`ProjectMethods`] instance.
8419///
8420/// # Example
8421///
8422/// Instantiate a resource method builder
8423///
8424/// ```test_harness,no_run
8425/// # extern crate hyper;
8426/// # extern crate hyper_rustls;
8427/// # extern crate google_bigquerydatatransfer1 as bigquerydatatransfer1;
8428/// use bigquerydatatransfer1::api::UnenrollDataSourcesRequest;
8429/// # async fn dox() {
8430/// # use bigquerydatatransfer1::{BigQueryDataTransfer, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8431///
8432/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
8433/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
8434/// # .with_native_roots()
8435/// # .unwrap()
8436/// # .https_only()
8437/// # .enable_http2()
8438/// # .build();
8439///
8440/// # let executor = hyper_util::rt::TokioExecutor::new();
8441/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
8442/// # secret,
8443/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8444/// # yup_oauth2::client::CustomHyperClientBuilder::from(
8445/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
8446/// # ),
8447/// # ).build().await.unwrap();
8448///
8449/// # let client = hyper_util::client::legacy::Client::builder(
8450/// # hyper_util::rt::TokioExecutor::new()
8451/// # )
8452/// # .build(
8453/// # hyper_rustls::HttpsConnectorBuilder::new()
8454/// # .with_native_roots()
8455/// # .unwrap()
8456/// # .https_or_http()
8457/// # .enable_http2()
8458/// # .build()
8459/// # );
8460/// # let mut hub = BigQueryDataTransfer::new(client, auth);
8461/// // As the method needs a request, you would usually fill it with the desired information
8462/// // into the respective structure. Some of the parts shown here might not be applicable !
8463/// // Values shown here are possibly random and not representative !
8464/// let mut req = UnenrollDataSourcesRequest::default();
8465///
8466/// // You can configure optional parameters by calling the respective setters at will, and
8467/// // execute the final call using `doit()`.
8468/// // Values shown here are possibly random and not representative !
8469/// let result = hub.projects().locations_unenroll_data_sources(req, "name")
8470/// .doit().await;
8471/// # }
8472/// ```
8473pub struct ProjectLocationUnenrollDataSourceCall<'a, C>
8474where
8475 C: 'a,
8476{
8477 hub: &'a BigQueryDataTransfer<C>,
8478 _request: UnenrollDataSourcesRequest,
8479 _name: String,
8480 _delegate: Option<&'a mut dyn common::Delegate>,
8481 _additional_params: HashMap<String, String>,
8482 _scopes: BTreeSet<String>,
8483}
8484
8485impl<'a, C> common::CallBuilder for ProjectLocationUnenrollDataSourceCall<'a, C> {}
8486
8487impl<'a, C> ProjectLocationUnenrollDataSourceCall<'a, C>
8488where
8489 C: common::Connector,
8490{
8491 /// Perform the operation you have build so far.
8492 pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
8493 use std::borrow::Cow;
8494 use std::io::{Read, Seek};
8495
8496 use common::{url::Params, ToParts};
8497 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
8498
8499 let mut dd = common::DefaultDelegate;
8500 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
8501 dlg.begin(common::MethodInfo {
8502 id: "bigquerydatatransfer.projects.locations.unenrollDataSources",
8503 http_method: hyper::Method::POST,
8504 });
8505
8506 for &field in ["alt", "name"].iter() {
8507 if self._additional_params.contains_key(field) {
8508 dlg.finished(false);
8509 return Err(common::Error::FieldClash(field));
8510 }
8511 }
8512
8513 let mut params = Params::with_capacity(4 + self._additional_params.len());
8514 params.push("name", self._name);
8515
8516 params.extend(self._additional_params.iter());
8517
8518 params.push("alt", "json");
8519 let mut url = self.hub._base_url.clone() + "v1/{+name}:unenrollDataSources";
8520 if self._scopes.is_empty() {
8521 self._scopes
8522 .insert(Scope::CloudPlatform.as_ref().to_string());
8523 }
8524
8525 #[allow(clippy::single_element_loop)]
8526 for &(find_this, param_name) in [("{+name}", "name")].iter() {
8527 url = params.uri_replacement(url, param_name, find_this, true);
8528 }
8529 {
8530 let to_remove = ["name"];
8531 params.remove_params(&to_remove);
8532 }
8533
8534 let url = params.parse_with_url(&url);
8535
8536 let mut json_mime_type = mime::APPLICATION_JSON;
8537 let mut request_value_reader = {
8538 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
8539 common::remove_json_null_values(&mut value);
8540 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
8541 serde_json::to_writer(&mut dst, &value).unwrap();
8542 dst
8543 };
8544 let request_size = request_value_reader
8545 .seek(std::io::SeekFrom::End(0))
8546 .unwrap();
8547 request_value_reader
8548 .seek(std::io::SeekFrom::Start(0))
8549 .unwrap();
8550
8551 loop {
8552 let token = match self
8553 .hub
8554 .auth
8555 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
8556 .await
8557 {
8558 Ok(token) => token,
8559 Err(e) => match dlg.token(e) {
8560 Ok(token) => token,
8561 Err(e) => {
8562 dlg.finished(false);
8563 return Err(common::Error::MissingToken(e));
8564 }
8565 },
8566 };
8567 request_value_reader
8568 .seek(std::io::SeekFrom::Start(0))
8569 .unwrap();
8570 let mut req_result = {
8571 let client = &self.hub.client;
8572 dlg.pre_request();
8573 let mut req_builder = hyper::Request::builder()
8574 .method(hyper::Method::POST)
8575 .uri(url.as_str())
8576 .header(USER_AGENT, self.hub._user_agent.clone());
8577
8578 if let Some(token) = token.as_ref() {
8579 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8580 }
8581
8582 let request = req_builder
8583 .header(CONTENT_TYPE, json_mime_type.to_string())
8584 .header(CONTENT_LENGTH, request_size as u64)
8585 .body(common::to_body(
8586 request_value_reader.get_ref().clone().into(),
8587 ));
8588
8589 client.request(request.unwrap()).await
8590 };
8591
8592 match req_result {
8593 Err(err) => {
8594 if let common::Retry::After(d) = dlg.http_error(&err) {
8595 sleep(d).await;
8596 continue;
8597 }
8598 dlg.finished(false);
8599 return Err(common::Error::HttpError(err));
8600 }
8601 Ok(res) => {
8602 let (mut parts, body) = res.into_parts();
8603 let mut body = common::Body::new(body);
8604 if !parts.status.is_success() {
8605 let bytes = common::to_bytes(body).await.unwrap_or_default();
8606 let error = serde_json::from_str(&common::to_string(&bytes));
8607 let response = common::to_response(parts, bytes.into());
8608
8609 if let common::Retry::After(d) =
8610 dlg.http_failure(&response, error.as_ref().ok())
8611 {
8612 sleep(d).await;
8613 continue;
8614 }
8615
8616 dlg.finished(false);
8617
8618 return Err(match error {
8619 Ok(value) => common::Error::BadRequest(value),
8620 _ => common::Error::Failure(response),
8621 });
8622 }
8623 let response = {
8624 let bytes = common::to_bytes(body).await.unwrap_or_default();
8625 let encoded = common::to_string(&bytes);
8626 match serde_json::from_str(&encoded) {
8627 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8628 Err(error) => {
8629 dlg.response_json_decode_error(&encoded, &error);
8630 return Err(common::Error::JsonDecodeError(
8631 encoded.to_string(),
8632 error,
8633 ));
8634 }
8635 }
8636 };
8637
8638 dlg.finished(true);
8639 return Ok(response);
8640 }
8641 }
8642 }
8643 }
8644
8645 ///
8646 /// Sets the *request* property to the given value.
8647 ///
8648 /// Even though the property as already been set when instantiating this call,
8649 /// we provide this method for API completeness.
8650 pub fn request(
8651 mut self,
8652 new_value: UnenrollDataSourcesRequest,
8653 ) -> ProjectLocationUnenrollDataSourceCall<'a, C> {
8654 self._request = new_value;
8655 self
8656 }
8657 /// Required. The name of the project resource in the form: `projects/{project_id}`
8658 ///
8659 /// Sets the *name* path property to the given value.
8660 ///
8661 /// Even though the property as already been set when instantiating this call,
8662 /// we provide this method for API completeness.
8663 pub fn name(mut self, new_value: &str) -> ProjectLocationUnenrollDataSourceCall<'a, C> {
8664 self._name = new_value.to_string();
8665 self
8666 }
8667 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8668 /// while executing the actual API request.
8669 ///
8670 /// ````text
8671 /// It should be used to handle progress information, and to implement a certain level of resilience.
8672 /// ````
8673 ///
8674 /// Sets the *delegate* property to the given value.
8675 pub fn delegate(
8676 mut self,
8677 new_value: &'a mut dyn common::Delegate,
8678 ) -> ProjectLocationUnenrollDataSourceCall<'a, C> {
8679 self._delegate = Some(new_value);
8680 self
8681 }
8682
8683 /// Set any additional parameter of the query string used in the request.
8684 /// It should be used to set parameters which are not yet available through their own
8685 /// setters.
8686 ///
8687 /// Please note that this method must not be used to set any of the known parameters
8688 /// which have their own setter method. If done anyway, the request will fail.
8689 ///
8690 /// # Additional Parameters
8691 ///
8692 /// * *$.xgafv* (query-string) - V1 error format.
8693 /// * *access_token* (query-string) - OAuth access token.
8694 /// * *alt* (query-string) - Data format for response.
8695 /// * *callback* (query-string) - JSONP
8696 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8697 /// * *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.
8698 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8699 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8700 /// * *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.
8701 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8702 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8703 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationUnenrollDataSourceCall<'a, C>
8704 where
8705 T: AsRef<str>,
8706 {
8707 self._additional_params
8708 .insert(name.as_ref().to_string(), value.as_ref().to_string());
8709 self
8710 }
8711
8712 /// Identifies the authorization scope for the method you are building.
8713 ///
8714 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
8715 /// [`Scope::CloudPlatform`].
8716 ///
8717 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
8718 /// tokens for more than one scope.
8719 ///
8720 /// Usually there is more than one suitable scope to authorize an operation, some of which may
8721 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
8722 /// sufficient, a read-write scope will do as well.
8723 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationUnenrollDataSourceCall<'a, C>
8724 where
8725 St: AsRef<str>,
8726 {
8727 self._scopes.insert(String::from(scope.as_ref()));
8728 self
8729 }
8730 /// Identifies the authorization scope(s) for the method you are building.
8731 ///
8732 /// See [`Self::add_scope()`] for details.
8733 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationUnenrollDataSourceCall<'a, C>
8734 where
8735 I: IntoIterator<Item = St>,
8736 St: AsRef<str>,
8737 {
8738 self._scopes
8739 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
8740 self
8741 }
8742
8743 /// Removes all scopes, and no default scope will be used either.
8744 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
8745 /// for details).
8746 pub fn clear_scopes(mut self) -> ProjectLocationUnenrollDataSourceCall<'a, C> {
8747 self._scopes.clear();
8748 self
8749 }
8750}
8751
8752/// Returns log messages for the transfer run.
8753///
8754/// A builder for the *transferConfigs.runs.transferLogs.list* method supported by a *project* resource.
8755/// It is not used directly, but through a [`ProjectMethods`] instance.
8756///
8757/// # Example
8758///
8759/// Instantiate a resource method builder
8760///
8761/// ```test_harness,no_run
8762/// # extern crate hyper;
8763/// # extern crate hyper_rustls;
8764/// # extern crate google_bigquerydatatransfer1 as bigquerydatatransfer1;
8765/// # async fn dox() {
8766/// # use bigquerydatatransfer1::{BigQueryDataTransfer, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8767///
8768/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
8769/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
8770/// # .with_native_roots()
8771/// # .unwrap()
8772/// # .https_only()
8773/// # .enable_http2()
8774/// # .build();
8775///
8776/// # let executor = hyper_util::rt::TokioExecutor::new();
8777/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
8778/// # secret,
8779/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8780/// # yup_oauth2::client::CustomHyperClientBuilder::from(
8781/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
8782/// # ),
8783/// # ).build().await.unwrap();
8784///
8785/// # let client = hyper_util::client::legacy::Client::builder(
8786/// # hyper_util::rt::TokioExecutor::new()
8787/// # )
8788/// # .build(
8789/// # hyper_rustls::HttpsConnectorBuilder::new()
8790/// # .with_native_roots()
8791/// # .unwrap()
8792/// # .https_or_http()
8793/// # .enable_http2()
8794/// # .build()
8795/// # );
8796/// # let mut hub = BigQueryDataTransfer::new(client, auth);
8797/// // You can configure optional parameters by calling the respective setters at will, and
8798/// // execute the final call using `doit()`.
8799/// // Values shown here are possibly random and not representative !
8800/// let result = hub.projects().transfer_configs_runs_transfer_logs_list("parent")
8801/// .page_token("erat")
8802/// .page_size(-93)
8803/// .add_message_types("duo")
8804/// .doit().await;
8805/// # }
8806/// ```
8807pub struct ProjectTransferConfigRunTransferLogListCall<'a, C>
8808where
8809 C: 'a,
8810{
8811 hub: &'a BigQueryDataTransfer<C>,
8812 _parent: String,
8813 _page_token: Option<String>,
8814 _page_size: Option<i32>,
8815 _message_types: Vec<String>,
8816 _delegate: Option<&'a mut dyn common::Delegate>,
8817 _additional_params: HashMap<String, String>,
8818 _scopes: BTreeSet<String>,
8819}
8820
8821impl<'a, C> common::CallBuilder for ProjectTransferConfigRunTransferLogListCall<'a, C> {}
8822
8823impl<'a, C> ProjectTransferConfigRunTransferLogListCall<'a, C>
8824where
8825 C: common::Connector,
8826{
8827 /// Perform the operation you have build so far.
8828 pub async fn doit(mut self) -> common::Result<(common::Response, ListTransferLogsResponse)> {
8829 use std::borrow::Cow;
8830 use std::io::{Read, Seek};
8831
8832 use common::{url::Params, ToParts};
8833 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
8834
8835 let mut dd = common::DefaultDelegate;
8836 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
8837 dlg.begin(common::MethodInfo {
8838 id: "bigquerydatatransfer.projects.transferConfigs.runs.transferLogs.list",
8839 http_method: hyper::Method::GET,
8840 });
8841
8842 for &field in ["alt", "parent", "pageToken", "pageSize", "messageTypes"].iter() {
8843 if self._additional_params.contains_key(field) {
8844 dlg.finished(false);
8845 return Err(common::Error::FieldClash(field));
8846 }
8847 }
8848
8849 let mut params = Params::with_capacity(6 + self._additional_params.len());
8850 params.push("parent", self._parent);
8851 if let Some(value) = self._page_token.as_ref() {
8852 params.push("pageToken", value);
8853 }
8854 if let Some(value) = self._page_size.as_ref() {
8855 params.push("pageSize", value.to_string());
8856 }
8857 if !self._message_types.is_empty() {
8858 for f in self._message_types.iter() {
8859 params.push("messageTypes", f);
8860 }
8861 }
8862
8863 params.extend(self._additional_params.iter());
8864
8865 params.push("alt", "json");
8866 let mut url = self.hub._base_url.clone() + "v1/{+parent}/transferLogs";
8867 if self._scopes.is_empty() {
8868 self._scopes
8869 .insert(Scope::CloudPlatformReadOnly.as_ref().to_string());
8870 }
8871
8872 #[allow(clippy::single_element_loop)]
8873 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
8874 url = params.uri_replacement(url, param_name, find_this, true);
8875 }
8876 {
8877 let to_remove = ["parent"];
8878 params.remove_params(&to_remove);
8879 }
8880
8881 let url = params.parse_with_url(&url);
8882
8883 loop {
8884 let token = match self
8885 .hub
8886 .auth
8887 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
8888 .await
8889 {
8890 Ok(token) => token,
8891 Err(e) => match dlg.token(e) {
8892 Ok(token) => token,
8893 Err(e) => {
8894 dlg.finished(false);
8895 return Err(common::Error::MissingToken(e));
8896 }
8897 },
8898 };
8899 let mut req_result = {
8900 let client = &self.hub.client;
8901 dlg.pre_request();
8902 let mut req_builder = hyper::Request::builder()
8903 .method(hyper::Method::GET)
8904 .uri(url.as_str())
8905 .header(USER_AGENT, self.hub._user_agent.clone());
8906
8907 if let Some(token) = token.as_ref() {
8908 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8909 }
8910
8911 let request = req_builder
8912 .header(CONTENT_LENGTH, 0_u64)
8913 .body(common::to_body::<String>(None));
8914
8915 client.request(request.unwrap()).await
8916 };
8917
8918 match req_result {
8919 Err(err) => {
8920 if let common::Retry::After(d) = dlg.http_error(&err) {
8921 sleep(d).await;
8922 continue;
8923 }
8924 dlg.finished(false);
8925 return Err(common::Error::HttpError(err));
8926 }
8927 Ok(res) => {
8928 let (mut parts, body) = res.into_parts();
8929 let mut body = common::Body::new(body);
8930 if !parts.status.is_success() {
8931 let bytes = common::to_bytes(body).await.unwrap_or_default();
8932 let error = serde_json::from_str(&common::to_string(&bytes));
8933 let response = common::to_response(parts, bytes.into());
8934
8935 if let common::Retry::After(d) =
8936 dlg.http_failure(&response, error.as_ref().ok())
8937 {
8938 sleep(d).await;
8939 continue;
8940 }
8941
8942 dlg.finished(false);
8943
8944 return Err(match error {
8945 Ok(value) => common::Error::BadRequest(value),
8946 _ => common::Error::Failure(response),
8947 });
8948 }
8949 let response = {
8950 let bytes = common::to_bytes(body).await.unwrap_or_default();
8951 let encoded = common::to_string(&bytes);
8952 match serde_json::from_str(&encoded) {
8953 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8954 Err(error) => {
8955 dlg.response_json_decode_error(&encoded, &error);
8956 return Err(common::Error::JsonDecodeError(
8957 encoded.to_string(),
8958 error,
8959 ));
8960 }
8961 }
8962 };
8963
8964 dlg.finished(true);
8965 return Ok(response);
8966 }
8967 }
8968 }
8969 }
8970
8971 /// Required. Transfer run name. If you are using the regionless method, the location must be `US` and the name should be in the following form: * `projects/{project_id}/transferConfigs/{config_id}/runs/{run_id}` If you are using the regionalized method, the name should be in the following form: * `projects/{project_id}/locations/{location_id}/transferConfigs/{config_id}/runs/{run_id}`
8972 ///
8973 /// Sets the *parent* path property to the given value.
8974 ///
8975 /// Even though the property as already been set when instantiating this call,
8976 /// we provide this method for API completeness.
8977 pub fn parent(mut self, new_value: &str) -> ProjectTransferConfigRunTransferLogListCall<'a, C> {
8978 self._parent = new_value.to_string();
8979 self
8980 }
8981 /// Pagination token, which can be used to request a specific page of `ListTransferLogsRequest` list results. For multiple-page results, `ListTransferLogsResponse` outputs a `next_page` token, which can be used as the `page_token` value to request the next page of list results.
8982 ///
8983 /// Sets the *page token* query property to the given value.
8984 pub fn page_token(
8985 mut self,
8986 new_value: &str,
8987 ) -> ProjectTransferConfigRunTransferLogListCall<'a, C> {
8988 self._page_token = Some(new_value.to_string());
8989 self
8990 }
8991 /// Page size. The default page size is the maximum value of 1000 results.
8992 ///
8993 /// Sets the *page size* query property to the given value.
8994 pub fn page_size(
8995 mut self,
8996 new_value: i32,
8997 ) -> ProjectTransferConfigRunTransferLogListCall<'a, C> {
8998 self._page_size = Some(new_value);
8999 self
9000 }
9001 /// Message types to return. If not populated - INFO, WARNING and ERROR messages are returned.
9002 ///
9003 /// Append the given value to the *message types* query property.
9004 /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
9005 pub fn add_message_types(
9006 mut self,
9007 new_value: &str,
9008 ) -> ProjectTransferConfigRunTransferLogListCall<'a, C> {
9009 self._message_types.push(new_value.to_string());
9010 self
9011 }
9012 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
9013 /// while executing the actual API request.
9014 ///
9015 /// ````text
9016 /// It should be used to handle progress information, and to implement a certain level of resilience.
9017 /// ````
9018 ///
9019 /// Sets the *delegate* property to the given value.
9020 pub fn delegate(
9021 mut self,
9022 new_value: &'a mut dyn common::Delegate,
9023 ) -> ProjectTransferConfigRunTransferLogListCall<'a, C> {
9024 self._delegate = Some(new_value);
9025 self
9026 }
9027
9028 /// Set any additional parameter of the query string used in the request.
9029 /// It should be used to set parameters which are not yet available through their own
9030 /// setters.
9031 ///
9032 /// Please note that this method must not be used to set any of the known parameters
9033 /// which have their own setter method. If done anyway, the request will fail.
9034 ///
9035 /// # Additional Parameters
9036 ///
9037 /// * *$.xgafv* (query-string) - V1 error format.
9038 /// * *access_token* (query-string) - OAuth access token.
9039 /// * *alt* (query-string) - Data format for response.
9040 /// * *callback* (query-string) - JSONP
9041 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
9042 /// * *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.
9043 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
9044 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
9045 /// * *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.
9046 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
9047 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
9048 pub fn param<T>(
9049 mut self,
9050 name: T,
9051 value: T,
9052 ) -> ProjectTransferConfigRunTransferLogListCall<'a, C>
9053 where
9054 T: AsRef<str>,
9055 {
9056 self._additional_params
9057 .insert(name.as_ref().to_string(), value.as_ref().to_string());
9058 self
9059 }
9060
9061 /// Identifies the authorization scope for the method you are building.
9062 ///
9063 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
9064 /// [`Scope::CloudPlatformReadOnly`].
9065 ///
9066 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
9067 /// tokens for more than one scope.
9068 ///
9069 /// Usually there is more than one suitable scope to authorize an operation, some of which may
9070 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
9071 /// sufficient, a read-write scope will do as well.
9072 pub fn add_scope<St>(mut self, scope: St) -> ProjectTransferConfigRunTransferLogListCall<'a, C>
9073 where
9074 St: AsRef<str>,
9075 {
9076 self._scopes.insert(String::from(scope.as_ref()));
9077 self
9078 }
9079 /// Identifies the authorization scope(s) for the method you are building.
9080 ///
9081 /// See [`Self::add_scope()`] for details.
9082 pub fn add_scopes<I, St>(
9083 mut self,
9084 scopes: I,
9085 ) -> ProjectTransferConfigRunTransferLogListCall<'a, C>
9086 where
9087 I: IntoIterator<Item = St>,
9088 St: AsRef<str>,
9089 {
9090 self._scopes
9091 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
9092 self
9093 }
9094
9095 /// Removes all scopes, and no default scope will be used either.
9096 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
9097 /// for details).
9098 pub fn clear_scopes(mut self) -> ProjectTransferConfigRunTransferLogListCall<'a, C> {
9099 self._scopes.clear();
9100 self
9101 }
9102}
9103
9104/// Deletes the specified transfer run.
9105///
9106/// A builder for the *transferConfigs.runs.delete* method supported by a *project* resource.
9107/// It is not used directly, but through a [`ProjectMethods`] instance.
9108///
9109/// # Example
9110///
9111/// Instantiate a resource method builder
9112///
9113/// ```test_harness,no_run
9114/// # extern crate hyper;
9115/// # extern crate hyper_rustls;
9116/// # extern crate google_bigquerydatatransfer1 as bigquerydatatransfer1;
9117/// # async fn dox() {
9118/// # use bigquerydatatransfer1::{BigQueryDataTransfer, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9119///
9120/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
9121/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
9122/// # .with_native_roots()
9123/// # .unwrap()
9124/// # .https_only()
9125/// # .enable_http2()
9126/// # .build();
9127///
9128/// # let executor = hyper_util::rt::TokioExecutor::new();
9129/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
9130/// # secret,
9131/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9132/// # yup_oauth2::client::CustomHyperClientBuilder::from(
9133/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
9134/// # ),
9135/// # ).build().await.unwrap();
9136///
9137/// # let client = hyper_util::client::legacy::Client::builder(
9138/// # hyper_util::rt::TokioExecutor::new()
9139/// # )
9140/// # .build(
9141/// # hyper_rustls::HttpsConnectorBuilder::new()
9142/// # .with_native_roots()
9143/// # .unwrap()
9144/// # .https_or_http()
9145/// # .enable_http2()
9146/// # .build()
9147/// # );
9148/// # let mut hub = BigQueryDataTransfer::new(client, auth);
9149/// // You can configure optional parameters by calling the respective setters at will, and
9150/// // execute the final call using `doit()`.
9151/// // Values shown here are possibly random and not representative !
9152/// let result = hub.projects().transfer_configs_runs_delete("name")
9153/// .doit().await;
9154/// # }
9155/// ```
9156pub struct ProjectTransferConfigRunDeleteCall<'a, C>
9157where
9158 C: 'a,
9159{
9160 hub: &'a BigQueryDataTransfer<C>,
9161 _name: String,
9162 _delegate: Option<&'a mut dyn common::Delegate>,
9163 _additional_params: HashMap<String, String>,
9164 _scopes: BTreeSet<String>,
9165}
9166
9167impl<'a, C> common::CallBuilder for ProjectTransferConfigRunDeleteCall<'a, C> {}
9168
9169impl<'a, C> ProjectTransferConfigRunDeleteCall<'a, C>
9170where
9171 C: common::Connector,
9172{
9173 /// Perform the operation you have build so far.
9174 pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
9175 use std::borrow::Cow;
9176 use std::io::{Read, Seek};
9177
9178 use common::{url::Params, ToParts};
9179 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
9180
9181 let mut dd = common::DefaultDelegate;
9182 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
9183 dlg.begin(common::MethodInfo {
9184 id: "bigquerydatatransfer.projects.transferConfigs.runs.delete",
9185 http_method: hyper::Method::DELETE,
9186 });
9187
9188 for &field in ["alt", "name"].iter() {
9189 if self._additional_params.contains_key(field) {
9190 dlg.finished(false);
9191 return Err(common::Error::FieldClash(field));
9192 }
9193 }
9194
9195 let mut params = Params::with_capacity(3 + self._additional_params.len());
9196 params.push("name", self._name);
9197
9198 params.extend(self._additional_params.iter());
9199
9200 params.push("alt", "json");
9201 let mut url = self.hub._base_url.clone() + "v1/{+name}";
9202 if self._scopes.is_empty() {
9203 self._scopes
9204 .insert(Scope::CloudPlatform.as_ref().to_string());
9205 }
9206
9207 #[allow(clippy::single_element_loop)]
9208 for &(find_this, param_name) in [("{+name}", "name")].iter() {
9209 url = params.uri_replacement(url, param_name, find_this, true);
9210 }
9211 {
9212 let to_remove = ["name"];
9213 params.remove_params(&to_remove);
9214 }
9215
9216 let url = params.parse_with_url(&url);
9217
9218 loop {
9219 let token = match self
9220 .hub
9221 .auth
9222 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
9223 .await
9224 {
9225 Ok(token) => token,
9226 Err(e) => match dlg.token(e) {
9227 Ok(token) => token,
9228 Err(e) => {
9229 dlg.finished(false);
9230 return Err(common::Error::MissingToken(e));
9231 }
9232 },
9233 };
9234 let mut req_result = {
9235 let client = &self.hub.client;
9236 dlg.pre_request();
9237 let mut req_builder = hyper::Request::builder()
9238 .method(hyper::Method::DELETE)
9239 .uri(url.as_str())
9240 .header(USER_AGENT, self.hub._user_agent.clone());
9241
9242 if let Some(token) = token.as_ref() {
9243 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
9244 }
9245
9246 let request = req_builder
9247 .header(CONTENT_LENGTH, 0_u64)
9248 .body(common::to_body::<String>(None));
9249
9250 client.request(request.unwrap()).await
9251 };
9252
9253 match req_result {
9254 Err(err) => {
9255 if let common::Retry::After(d) = dlg.http_error(&err) {
9256 sleep(d).await;
9257 continue;
9258 }
9259 dlg.finished(false);
9260 return Err(common::Error::HttpError(err));
9261 }
9262 Ok(res) => {
9263 let (mut parts, body) = res.into_parts();
9264 let mut body = common::Body::new(body);
9265 if !parts.status.is_success() {
9266 let bytes = common::to_bytes(body).await.unwrap_or_default();
9267 let error = serde_json::from_str(&common::to_string(&bytes));
9268 let response = common::to_response(parts, bytes.into());
9269
9270 if let common::Retry::After(d) =
9271 dlg.http_failure(&response, error.as_ref().ok())
9272 {
9273 sleep(d).await;
9274 continue;
9275 }
9276
9277 dlg.finished(false);
9278
9279 return Err(match error {
9280 Ok(value) => common::Error::BadRequest(value),
9281 _ => common::Error::Failure(response),
9282 });
9283 }
9284 let response = {
9285 let bytes = common::to_bytes(body).await.unwrap_or_default();
9286 let encoded = common::to_string(&bytes);
9287 match serde_json::from_str(&encoded) {
9288 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
9289 Err(error) => {
9290 dlg.response_json_decode_error(&encoded, &error);
9291 return Err(common::Error::JsonDecodeError(
9292 encoded.to_string(),
9293 error,
9294 ));
9295 }
9296 }
9297 };
9298
9299 dlg.finished(true);
9300 return Ok(response);
9301 }
9302 }
9303 }
9304 }
9305
9306 /// Required. The name of the resource requested. If you are using the regionless method, the location must be `US` and the name should be in the following form: * `projects/{project_id}/transferConfigs/{config_id}/runs/{run_id}` If you are using the regionalized method, the name should be in the following form: * `projects/{project_id}/locations/{location_id}/transferConfigs/{config_id}/runs/{run_id}`
9307 ///
9308 /// Sets the *name* path property to the given value.
9309 ///
9310 /// Even though the property as already been set when instantiating this call,
9311 /// we provide this method for API completeness.
9312 pub fn name(mut self, new_value: &str) -> ProjectTransferConfigRunDeleteCall<'a, C> {
9313 self._name = new_value.to_string();
9314 self
9315 }
9316 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
9317 /// while executing the actual API request.
9318 ///
9319 /// ````text
9320 /// It should be used to handle progress information, and to implement a certain level of resilience.
9321 /// ````
9322 ///
9323 /// Sets the *delegate* property to the given value.
9324 pub fn delegate(
9325 mut self,
9326 new_value: &'a mut dyn common::Delegate,
9327 ) -> ProjectTransferConfigRunDeleteCall<'a, C> {
9328 self._delegate = Some(new_value);
9329 self
9330 }
9331
9332 /// Set any additional parameter of the query string used in the request.
9333 /// It should be used to set parameters which are not yet available through their own
9334 /// setters.
9335 ///
9336 /// Please note that this method must not be used to set any of the known parameters
9337 /// which have their own setter method. If done anyway, the request will fail.
9338 ///
9339 /// # Additional Parameters
9340 ///
9341 /// * *$.xgafv* (query-string) - V1 error format.
9342 /// * *access_token* (query-string) - OAuth access token.
9343 /// * *alt* (query-string) - Data format for response.
9344 /// * *callback* (query-string) - JSONP
9345 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
9346 /// * *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.
9347 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
9348 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
9349 /// * *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.
9350 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
9351 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
9352 pub fn param<T>(mut self, name: T, value: T) -> ProjectTransferConfigRunDeleteCall<'a, C>
9353 where
9354 T: AsRef<str>,
9355 {
9356 self._additional_params
9357 .insert(name.as_ref().to_string(), value.as_ref().to_string());
9358 self
9359 }
9360
9361 /// Identifies the authorization scope for the method you are building.
9362 ///
9363 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
9364 /// [`Scope::CloudPlatform`].
9365 ///
9366 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
9367 /// tokens for more than one scope.
9368 ///
9369 /// Usually there is more than one suitable scope to authorize an operation, some of which may
9370 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
9371 /// sufficient, a read-write scope will do as well.
9372 pub fn add_scope<St>(mut self, scope: St) -> ProjectTransferConfigRunDeleteCall<'a, C>
9373 where
9374 St: AsRef<str>,
9375 {
9376 self._scopes.insert(String::from(scope.as_ref()));
9377 self
9378 }
9379 /// Identifies the authorization scope(s) for the method you are building.
9380 ///
9381 /// See [`Self::add_scope()`] for details.
9382 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectTransferConfigRunDeleteCall<'a, C>
9383 where
9384 I: IntoIterator<Item = St>,
9385 St: AsRef<str>,
9386 {
9387 self._scopes
9388 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
9389 self
9390 }
9391
9392 /// Removes all scopes, and no default scope will be used either.
9393 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
9394 /// for details).
9395 pub fn clear_scopes(mut self) -> ProjectTransferConfigRunDeleteCall<'a, C> {
9396 self._scopes.clear();
9397 self
9398 }
9399}
9400
9401/// Returns information about the particular transfer run.
9402///
9403/// A builder for the *transferConfigs.runs.get* method supported by a *project* resource.
9404/// It is not used directly, but through a [`ProjectMethods`] instance.
9405///
9406/// # Example
9407///
9408/// Instantiate a resource method builder
9409///
9410/// ```test_harness,no_run
9411/// # extern crate hyper;
9412/// # extern crate hyper_rustls;
9413/// # extern crate google_bigquerydatatransfer1 as bigquerydatatransfer1;
9414/// # async fn dox() {
9415/// # use bigquerydatatransfer1::{BigQueryDataTransfer, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9416///
9417/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
9418/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
9419/// # .with_native_roots()
9420/// # .unwrap()
9421/// # .https_only()
9422/// # .enable_http2()
9423/// # .build();
9424///
9425/// # let executor = hyper_util::rt::TokioExecutor::new();
9426/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
9427/// # secret,
9428/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9429/// # yup_oauth2::client::CustomHyperClientBuilder::from(
9430/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
9431/// # ),
9432/// # ).build().await.unwrap();
9433///
9434/// # let client = hyper_util::client::legacy::Client::builder(
9435/// # hyper_util::rt::TokioExecutor::new()
9436/// # )
9437/// # .build(
9438/// # hyper_rustls::HttpsConnectorBuilder::new()
9439/// # .with_native_roots()
9440/// # .unwrap()
9441/// # .https_or_http()
9442/// # .enable_http2()
9443/// # .build()
9444/// # );
9445/// # let mut hub = BigQueryDataTransfer::new(client, auth);
9446/// // You can configure optional parameters by calling the respective setters at will, and
9447/// // execute the final call using `doit()`.
9448/// // Values shown here are possibly random and not representative !
9449/// let result = hub.projects().transfer_configs_runs_get("name")
9450/// .doit().await;
9451/// # }
9452/// ```
9453pub struct ProjectTransferConfigRunGetCall<'a, C>
9454where
9455 C: 'a,
9456{
9457 hub: &'a BigQueryDataTransfer<C>,
9458 _name: String,
9459 _delegate: Option<&'a mut dyn common::Delegate>,
9460 _additional_params: HashMap<String, String>,
9461 _scopes: BTreeSet<String>,
9462}
9463
9464impl<'a, C> common::CallBuilder for ProjectTransferConfigRunGetCall<'a, C> {}
9465
9466impl<'a, C> ProjectTransferConfigRunGetCall<'a, C>
9467where
9468 C: common::Connector,
9469{
9470 /// Perform the operation you have build so far.
9471 pub async fn doit(mut self) -> common::Result<(common::Response, TransferRun)> {
9472 use std::borrow::Cow;
9473 use std::io::{Read, Seek};
9474
9475 use common::{url::Params, ToParts};
9476 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
9477
9478 let mut dd = common::DefaultDelegate;
9479 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
9480 dlg.begin(common::MethodInfo {
9481 id: "bigquerydatatransfer.projects.transferConfigs.runs.get",
9482 http_method: hyper::Method::GET,
9483 });
9484
9485 for &field in ["alt", "name"].iter() {
9486 if self._additional_params.contains_key(field) {
9487 dlg.finished(false);
9488 return Err(common::Error::FieldClash(field));
9489 }
9490 }
9491
9492 let mut params = Params::with_capacity(3 + self._additional_params.len());
9493 params.push("name", self._name);
9494
9495 params.extend(self._additional_params.iter());
9496
9497 params.push("alt", "json");
9498 let mut url = self.hub._base_url.clone() + "v1/{+name}";
9499 if self._scopes.is_empty() {
9500 self._scopes
9501 .insert(Scope::CloudPlatformReadOnly.as_ref().to_string());
9502 }
9503
9504 #[allow(clippy::single_element_loop)]
9505 for &(find_this, param_name) in [("{+name}", "name")].iter() {
9506 url = params.uri_replacement(url, param_name, find_this, true);
9507 }
9508 {
9509 let to_remove = ["name"];
9510 params.remove_params(&to_remove);
9511 }
9512
9513 let url = params.parse_with_url(&url);
9514
9515 loop {
9516 let token = match self
9517 .hub
9518 .auth
9519 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
9520 .await
9521 {
9522 Ok(token) => token,
9523 Err(e) => match dlg.token(e) {
9524 Ok(token) => token,
9525 Err(e) => {
9526 dlg.finished(false);
9527 return Err(common::Error::MissingToken(e));
9528 }
9529 },
9530 };
9531 let mut req_result = {
9532 let client = &self.hub.client;
9533 dlg.pre_request();
9534 let mut req_builder = hyper::Request::builder()
9535 .method(hyper::Method::GET)
9536 .uri(url.as_str())
9537 .header(USER_AGENT, self.hub._user_agent.clone());
9538
9539 if let Some(token) = token.as_ref() {
9540 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
9541 }
9542
9543 let request = req_builder
9544 .header(CONTENT_LENGTH, 0_u64)
9545 .body(common::to_body::<String>(None));
9546
9547 client.request(request.unwrap()).await
9548 };
9549
9550 match req_result {
9551 Err(err) => {
9552 if let common::Retry::After(d) = dlg.http_error(&err) {
9553 sleep(d).await;
9554 continue;
9555 }
9556 dlg.finished(false);
9557 return Err(common::Error::HttpError(err));
9558 }
9559 Ok(res) => {
9560 let (mut parts, body) = res.into_parts();
9561 let mut body = common::Body::new(body);
9562 if !parts.status.is_success() {
9563 let bytes = common::to_bytes(body).await.unwrap_or_default();
9564 let error = serde_json::from_str(&common::to_string(&bytes));
9565 let response = common::to_response(parts, bytes.into());
9566
9567 if let common::Retry::After(d) =
9568 dlg.http_failure(&response, error.as_ref().ok())
9569 {
9570 sleep(d).await;
9571 continue;
9572 }
9573
9574 dlg.finished(false);
9575
9576 return Err(match error {
9577 Ok(value) => common::Error::BadRequest(value),
9578 _ => common::Error::Failure(response),
9579 });
9580 }
9581 let response = {
9582 let bytes = common::to_bytes(body).await.unwrap_or_default();
9583 let encoded = common::to_string(&bytes);
9584 match serde_json::from_str(&encoded) {
9585 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
9586 Err(error) => {
9587 dlg.response_json_decode_error(&encoded, &error);
9588 return Err(common::Error::JsonDecodeError(
9589 encoded.to_string(),
9590 error,
9591 ));
9592 }
9593 }
9594 };
9595
9596 dlg.finished(true);
9597 return Ok(response);
9598 }
9599 }
9600 }
9601 }
9602
9603 /// Required. The name of the resource requested. If you are using the regionless method, the location must be `US` and the name should be in the following form: * `projects/{project_id}/transferConfigs/{config_id}/runs/{run_id}` If you are using the regionalized method, the name should be in the following form: * `projects/{project_id}/locations/{location_id}/transferConfigs/{config_id}/runs/{run_id}`
9604 ///
9605 /// Sets the *name* path property to the given value.
9606 ///
9607 /// Even though the property as already been set when instantiating this call,
9608 /// we provide this method for API completeness.
9609 pub fn name(mut self, new_value: &str) -> ProjectTransferConfigRunGetCall<'a, C> {
9610 self._name = new_value.to_string();
9611 self
9612 }
9613 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
9614 /// while executing the actual API request.
9615 ///
9616 /// ````text
9617 /// It should be used to handle progress information, and to implement a certain level of resilience.
9618 /// ````
9619 ///
9620 /// Sets the *delegate* property to the given value.
9621 pub fn delegate(
9622 mut self,
9623 new_value: &'a mut dyn common::Delegate,
9624 ) -> ProjectTransferConfigRunGetCall<'a, C> {
9625 self._delegate = Some(new_value);
9626 self
9627 }
9628
9629 /// Set any additional parameter of the query string used in the request.
9630 /// It should be used to set parameters which are not yet available through their own
9631 /// setters.
9632 ///
9633 /// Please note that this method must not be used to set any of the known parameters
9634 /// which have their own setter method. If done anyway, the request will fail.
9635 ///
9636 /// # Additional Parameters
9637 ///
9638 /// * *$.xgafv* (query-string) - V1 error format.
9639 /// * *access_token* (query-string) - OAuth access token.
9640 /// * *alt* (query-string) - Data format for response.
9641 /// * *callback* (query-string) - JSONP
9642 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
9643 /// * *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.
9644 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
9645 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
9646 /// * *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.
9647 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
9648 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
9649 pub fn param<T>(mut self, name: T, value: T) -> ProjectTransferConfigRunGetCall<'a, C>
9650 where
9651 T: AsRef<str>,
9652 {
9653 self._additional_params
9654 .insert(name.as_ref().to_string(), value.as_ref().to_string());
9655 self
9656 }
9657
9658 /// Identifies the authorization scope for the method you are building.
9659 ///
9660 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
9661 /// [`Scope::CloudPlatformReadOnly`].
9662 ///
9663 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
9664 /// tokens for more than one scope.
9665 ///
9666 /// Usually there is more than one suitable scope to authorize an operation, some of which may
9667 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
9668 /// sufficient, a read-write scope will do as well.
9669 pub fn add_scope<St>(mut self, scope: St) -> ProjectTransferConfigRunGetCall<'a, C>
9670 where
9671 St: AsRef<str>,
9672 {
9673 self._scopes.insert(String::from(scope.as_ref()));
9674 self
9675 }
9676 /// Identifies the authorization scope(s) for the method you are building.
9677 ///
9678 /// See [`Self::add_scope()`] for details.
9679 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectTransferConfigRunGetCall<'a, C>
9680 where
9681 I: IntoIterator<Item = St>,
9682 St: AsRef<str>,
9683 {
9684 self._scopes
9685 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
9686 self
9687 }
9688
9689 /// Removes all scopes, and no default scope will be used either.
9690 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
9691 /// for details).
9692 pub fn clear_scopes(mut self) -> ProjectTransferConfigRunGetCall<'a, C> {
9693 self._scopes.clear();
9694 self
9695 }
9696}
9697
9698/// Returns information about running and completed transfer runs.
9699///
9700/// A builder for the *transferConfigs.runs.list* method supported by a *project* resource.
9701/// It is not used directly, but through a [`ProjectMethods`] instance.
9702///
9703/// # Example
9704///
9705/// Instantiate a resource method builder
9706///
9707/// ```test_harness,no_run
9708/// # extern crate hyper;
9709/// # extern crate hyper_rustls;
9710/// # extern crate google_bigquerydatatransfer1 as bigquerydatatransfer1;
9711/// # async fn dox() {
9712/// # use bigquerydatatransfer1::{BigQueryDataTransfer, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9713///
9714/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
9715/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
9716/// # .with_native_roots()
9717/// # .unwrap()
9718/// # .https_only()
9719/// # .enable_http2()
9720/// # .build();
9721///
9722/// # let executor = hyper_util::rt::TokioExecutor::new();
9723/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
9724/// # secret,
9725/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9726/// # yup_oauth2::client::CustomHyperClientBuilder::from(
9727/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
9728/// # ),
9729/// # ).build().await.unwrap();
9730///
9731/// # let client = hyper_util::client::legacy::Client::builder(
9732/// # hyper_util::rt::TokioExecutor::new()
9733/// # )
9734/// # .build(
9735/// # hyper_rustls::HttpsConnectorBuilder::new()
9736/// # .with_native_roots()
9737/// # .unwrap()
9738/// # .https_or_http()
9739/// # .enable_http2()
9740/// # .build()
9741/// # );
9742/// # let mut hub = BigQueryDataTransfer::new(client, auth);
9743/// // You can configure optional parameters by calling the respective setters at will, and
9744/// // execute the final call using `doit()`.
9745/// // Values shown here are possibly random and not representative !
9746/// let result = hub.projects().transfer_configs_runs_list("parent")
9747/// .add_states("amet.")
9748/// .run_attempt("consetetur")
9749/// .page_token("diam")
9750/// .page_size(-49)
9751/// .doit().await;
9752/// # }
9753/// ```
9754pub struct ProjectTransferConfigRunListCall<'a, C>
9755where
9756 C: 'a,
9757{
9758 hub: &'a BigQueryDataTransfer<C>,
9759 _parent: String,
9760 _states: Vec<String>,
9761 _run_attempt: Option<String>,
9762 _page_token: Option<String>,
9763 _page_size: Option<i32>,
9764 _delegate: Option<&'a mut dyn common::Delegate>,
9765 _additional_params: HashMap<String, String>,
9766 _scopes: BTreeSet<String>,
9767}
9768
9769impl<'a, C> common::CallBuilder for ProjectTransferConfigRunListCall<'a, C> {}
9770
9771impl<'a, C> ProjectTransferConfigRunListCall<'a, C>
9772where
9773 C: common::Connector,
9774{
9775 /// Perform the operation you have build so far.
9776 pub async fn doit(mut self) -> common::Result<(common::Response, ListTransferRunsResponse)> {
9777 use std::borrow::Cow;
9778 use std::io::{Read, Seek};
9779
9780 use common::{url::Params, ToParts};
9781 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
9782
9783 let mut dd = common::DefaultDelegate;
9784 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
9785 dlg.begin(common::MethodInfo {
9786 id: "bigquerydatatransfer.projects.transferConfigs.runs.list",
9787 http_method: hyper::Method::GET,
9788 });
9789
9790 for &field in [
9791 "alt",
9792 "parent",
9793 "states",
9794 "runAttempt",
9795 "pageToken",
9796 "pageSize",
9797 ]
9798 .iter()
9799 {
9800 if self._additional_params.contains_key(field) {
9801 dlg.finished(false);
9802 return Err(common::Error::FieldClash(field));
9803 }
9804 }
9805
9806 let mut params = Params::with_capacity(7 + self._additional_params.len());
9807 params.push("parent", self._parent);
9808 if !self._states.is_empty() {
9809 for f in self._states.iter() {
9810 params.push("states", f);
9811 }
9812 }
9813 if let Some(value) = self._run_attempt.as_ref() {
9814 params.push("runAttempt", value);
9815 }
9816 if let Some(value) = self._page_token.as_ref() {
9817 params.push("pageToken", value);
9818 }
9819 if let Some(value) = self._page_size.as_ref() {
9820 params.push("pageSize", value.to_string());
9821 }
9822
9823 params.extend(self._additional_params.iter());
9824
9825 params.push("alt", "json");
9826 let mut url = self.hub._base_url.clone() + "v1/{+parent}/runs";
9827 if self._scopes.is_empty() {
9828 self._scopes
9829 .insert(Scope::CloudPlatformReadOnly.as_ref().to_string());
9830 }
9831
9832 #[allow(clippy::single_element_loop)]
9833 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
9834 url = params.uri_replacement(url, param_name, find_this, true);
9835 }
9836 {
9837 let to_remove = ["parent"];
9838 params.remove_params(&to_remove);
9839 }
9840
9841 let url = params.parse_with_url(&url);
9842
9843 loop {
9844 let token = match self
9845 .hub
9846 .auth
9847 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
9848 .await
9849 {
9850 Ok(token) => token,
9851 Err(e) => match dlg.token(e) {
9852 Ok(token) => token,
9853 Err(e) => {
9854 dlg.finished(false);
9855 return Err(common::Error::MissingToken(e));
9856 }
9857 },
9858 };
9859 let mut req_result = {
9860 let client = &self.hub.client;
9861 dlg.pre_request();
9862 let mut req_builder = hyper::Request::builder()
9863 .method(hyper::Method::GET)
9864 .uri(url.as_str())
9865 .header(USER_AGENT, self.hub._user_agent.clone());
9866
9867 if let Some(token) = token.as_ref() {
9868 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
9869 }
9870
9871 let request = req_builder
9872 .header(CONTENT_LENGTH, 0_u64)
9873 .body(common::to_body::<String>(None));
9874
9875 client.request(request.unwrap()).await
9876 };
9877
9878 match req_result {
9879 Err(err) => {
9880 if let common::Retry::After(d) = dlg.http_error(&err) {
9881 sleep(d).await;
9882 continue;
9883 }
9884 dlg.finished(false);
9885 return Err(common::Error::HttpError(err));
9886 }
9887 Ok(res) => {
9888 let (mut parts, body) = res.into_parts();
9889 let mut body = common::Body::new(body);
9890 if !parts.status.is_success() {
9891 let bytes = common::to_bytes(body).await.unwrap_or_default();
9892 let error = serde_json::from_str(&common::to_string(&bytes));
9893 let response = common::to_response(parts, bytes.into());
9894
9895 if let common::Retry::After(d) =
9896 dlg.http_failure(&response, error.as_ref().ok())
9897 {
9898 sleep(d).await;
9899 continue;
9900 }
9901
9902 dlg.finished(false);
9903
9904 return Err(match error {
9905 Ok(value) => common::Error::BadRequest(value),
9906 _ => common::Error::Failure(response),
9907 });
9908 }
9909 let response = {
9910 let bytes = common::to_bytes(body).await.unwrap_or_default();
9911 let encoded = common::to_string(&bytes);
9912 match serde_json::from_str(&encoded) {
9913 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
9914 Err(error) => {
9915 dlg.response_json_decode_error(&encoded, &error);
9916 return Err(common::Error::JsonDecodeError(
9917 encoded.to_string(),
9918 error,
9919 ));
9920 }
9921 }
9922 };
9923
9924 dlg.finished(true);
9925 return Ok(response);
9926 }
9927 }
9928 }
9929 }
9930
9931 /// Required. Name of transfer configuration for which transfer runs should be retrieved. If you are using the regionless method, the location must be `US` and the name should be in the following form: * `projects/{project_id}/transferConfigs/{config_id}` If you are using the regionalized method, the name should be in the following form: * `projects/{project_id}/locations/{location_id}/transferConfigs/{config_id}`
9932 ///
9933 /// Sets the *parent* path property to the given value.
9934 ///
9935 /// Even though the property as already been set when instantiating this call,
9936 /// we provide this method for API completeness.
9937 pub fn parent(mut self, new_value: &str) -> ProjectTransferConfigRunListCall<'a, C> {
9938 self._parent = new_value.to_string();
9939 self
9940 }
9941 /// When specified, only transfer runs with requested states are returned.
9942 ///
9943 /// Append the given value to the *states* query property.
9944 /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
9945 pub fn add_states(mut self, new_value: &str) -> ProjectTransferConfigRunListCall<'a, C> {
9946 self._states.push(new_value.to_string());
9947 self
9948 }
9949 /// Indicates how run attempts are to be pulled.
9950 ///
9951 /// Sets the *run attempt* query property to the given value.
9952 pub fn run_attempt(mut self, new_value: &str) -> ProjectTransferConfigRunListCall<'a, C> {
9953 self._run_attempt = Some(new_value.to_string());
9954 self
9955 }
9956 /// Pagination token, which can be used to request a specific page of `ListTransferRunsRequest` list results. For multiple-page results, `ListTransferRunsResponse` outputs a `next_page` token, which can be used as the `page_token` value to request the next page of list results.
9957 ///
9958 /// Sets the *page token* query property to the given value.
9959 pub fn page_token(mut self, new_value: &str) -> ProjectTransferConfigRunListCall<'a, C> {
9960 self._page_token = Some(new_value.to_string());
9961 self
9962 }
9963 /// Page size. The default page size is the maximum value of 1000 results.
9964 ///
9965 /// Sets the *page size* query property to the given value.
9966 pub fn page_size(mut self, new_value: i32) -> ProjectTransferConfigRunListCall<'a, C> {
9967 self._page_size = Some(new_value);
9968 self
9969 }
9970 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
9971 /// while executing the actual API request.
9972 ///
9973 /// ````text
9974 /// It should be used to handle progress information, and to implement a certain level of resilience.
9975 /// ````
9976 ///
9977 /// Sets the *delegate* property to the given value.
9978 pub fn delegate(
9979 mut self,
9980 new_value: &'a mut dyn common::Delegate,
9981 ) -> ProjectTransferConfigRunListCall<'a, C> {
9982 self._delegate = Some(new_value);
9983 self
9984 }
9985
9986 /// Set any additional parameter of the query string used in the request.
9987 /// It should be used to set parameters which are not yet available through their own
9988 /// setters.
9989 ///
9990 /// Please note that this method must not be used to set any of the known parameters
9991 /// which have their own setter method. If done anyway, the request will fail.
9992 ///
9993 /// # Additional Parameters
9994 ///
9995 /// * *$.xgafv* (query-string) - V1 error format.
9996 /// * *access_token* (query-string) - OAuth access token.
9997 /// * *alt* (query-string) - Data format for response.
9998 /// * *callback* (query-string) - JSONP
9999 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
10000 /// * *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.
10001 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
10002 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
10003 /// * *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.
10004 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
10005 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
10006 pub fn param<T>(mut self, name: T, value: T) -> ProjectTransferConfigRunListCall<'a, C>
10007 where
10008 T: AsRef<str>,
10009 {
10010 self._additional_params
10011 .insert(name.as_ref().to_string(), value.as_ref().to_string());
10012 self
10013 }
10014
10015 /// Identifies the authorization scope for the method you are building.
10016 ///
10017 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
10018 /// [`Scope::CloudPlatformReadOnly`].
10019 ///
10020 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
10021 /// tokens for more than one scope.
10022 ///
10023 /// Usually there is more than one suitable scope to authorize an operation, some of which may
10024 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
10025 /// sufficient, a read-write scope will do as well.
10026 pub fn add_scope<St>(mut self, scope: St) -> ProjectTransferConfigRunListCall<'a, C>
10027 where
10028 St: AsRef<str>,
10029 {
10030 self._scopes.insert(String::from(scope.as_ref()));
10031 self
10032 }
10033 /// Identifies the authorization scope(s) for the method you are building.
10034 ///
10035 /// See [`Self::add_scope()`] for details.
10036 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectTransferConfigRunListCall<'a, C>
10037 where
10038 I: IntoIterator<Item = St>,
10039 St: AsRef<str>,
10040 {
10041 self._scopes
10042 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
10043 self
10044 }
10045
10046 /// Removes all scopes, and no default scope will be used either.
10047 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
10048 /// for details).
10049 pub fn clear_scopes(mut self) -> ProjectTransferConfigRunListCall<'a, C> {
10050 self._scopes.clear();
10051 self
10052 }
10053}
10054
10055/// Creates a new data transfer configuration.
10056///
10057/// A builder for the *transferConfigs.create* method supported by a *project* resource.
10058/// It is not used directly, but through a [`ProjectMethods`] instance.
10059///
10060/// # Example
10061///
10062/// Instantiate a resource method builder
10063///
10064/// ```test_harness,no_run
10065/// # extern crate hyper;
10066/// # extern crate hyper_rustls;
10067/// # extern crate google_bigquerydatatransfer1 as bigquerydatatransfer1;
10068/// use bigquerydatatransfer1::api::TransferConfig;
10069/// # async fn dox() {
10070/// # use bigquerydatatransfer1::{BigQueryDataTransfer, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
10071///
10072/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
10073/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
10074/// # .with_native_roots()
10075/// # .unwrap()
10076/// # .https_only()
10077/// # .enable_http2()
10078/// # .build();
10079///
10080/// # let executor = hyper_util::rt::TokioExecutor::new();
10081/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
10082/// # secret,
10083/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
10084/// # yup_oauth2::client::CustomHyperClientBuilder::from(
10085/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
10086/// # ),
10087/// # ).build().await.unwrap();
10088///
10089/// # let client = hyper_util::client::legacy::Client::builder(
10090/// # hyper_util::rt::TokioExecutor::new()
10091/// # )
10092/// # .build(
10093/// # hyper_rustls::HttpsConnectorBuilder::new()
10094/// # .with_native_roots()
10095/// # .unwrap()
10096/// # .https_or_http()
10097/// # .enable_http2()
10098/// # .build()
10099/// # );
10100/// # let mut hub = BigQueryDataTransfer::new(client, auth);
10101/// // As the method needs a request, you would usually fill it with the desired information
10102/// // into the respective structure. Some of the parts shown here might not be applicable !
10103/// // Values shown here are possibly random and not representative !
10104/// let mut req = TransferConfig::default();
10105///
10106/// // You can configure optional parameters by calling the respective setters at will, and
10107/// // execute the final call using `doit()`.
10108/// // Values shown here are possibly random and not representative !
10109/// let result = hub.projects().transfer_configs_create(req, "parent")
10110/// .version_info("et")
10111/// .service_account_name("sadipscing")
10112/// .authorization_code("Stet")
10113/// .doit().await;
10114/// # }
10115/// ```
10116pub struct ProjectTransferConfigCreateCall<'a, C>
10117where
10118 C: 'a,
10119{
10120 hub: &'a BigQueryDataTransfer<C>,
10121 _request: TransferConfig,
10122 _parent: String,
10123 _version_info: Option<String>,
10124 _service_account_name: Option<String>,
10125 _authorization_code: Option<String>,
10126 _delegate: Option<&'a mut dyn common::Delegate>,
10127 _additional_params: HashMap<String, String>,
10128 _scopes: BTreeSet<String>,
10129}
10130
10131impl<'a, C> common::CallBuilder for ProjectTransferConfigCreateCall<'a, C> {}
10132
10133impl<'a, C> ProjectTransferConfigCreateCall<'a, C>
10134where
10135 C: common::Connector,
10136{
10137 /// Perform the operation you have build so far.
10138 pub async fn doit(mut self) -> common::Result<(common::Response, TransferConfig)> {
10139 use std::borrow::Cow;
10140 use std::io::{Read, Seek};
10141
10142 use common::{url::Params, ToParts};
10143 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
10144
10145 let mut dd = common::DefaultDelegate;
10146 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
10147 dlg.begin(common::MethodInfo {
10148 id: "bigquerydatatransfer.projects.transferConfigs.create",
10149 http_method: hyper::Method::POST,
10150 });
10151
10152 for &field in [
10153 "alt",
10154 "parent",
10155 "versionInfo",
10156 "serviceAccountName",
10157 "authorizationCode",
10158 ]
10159 .iter()
10160 {
10161 if self._additional_params.contains_key(field) {
10162 dlg.finished(false);
10163 return Err(common::Error::FieldClash(field));
10164 }
10165 }
10166
10167 let mut params = Params::with_capacity(7 + self._additional_params.len());
10168 params.push("parent", self._parent);
10169 if let Some(value) = self._version_info.as_ref() {
10170 params.push("versionInfo", value);
10171 }
10172 if let Some(value) = self._service_account_name.as_ref() {
10173 params.push("serviceAccountName", value);
10174 }
10175 if let Some(value) = self._authorization_code.as_ref() {
10176 params.push("authorizationCode", value);
10177 }
10178
10179 params.extend(self._additional_params.iter());
10180
10181 params.push("alt", "json");
10182 let mut url = self.hub._base_url.clone() + "v1/{+parent}/transferConfigs";
10183 if self._scopes.is_empty() {
10184 self._scopes
10185 .insert(Scope::CloudPlatform.as_ref().to_string());
10186 }
10187
10188 #[allow(clippy::single_element_loop)]
10189 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
10190 url = params.uri_replacement(url, param_name, find_this, true);
10191 }
10192 {
10193 let to_remove = ["parent"];
10194 params.remove_params(&to_remove);
10195 }
10196
10197 let url = params.parse_with_url(&url);
10198
10199 let mut json_mime_type = mime::APPLICATION_JSON;
10200 let mut request_value_reader = {
10201 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
10202 common::remove_json_null_values(&mut value);
10203 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
10204 serde_json::to_writer(&mut dst, &value).unwrap();
10205 dst
10206 };
10207 let request_size = request_value_reader
10208 .seek(std::io::SeekFrom::End(0))
10209 .unwrap();
10210 request_value_reader
10211 .seek(std::io::SeekFrom::Start(0))
10212 .unwrap();
10213
10214 loop {
10215 let token = match self
10216 .hub
10217 .auth
10218 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
10219 .await
10220 {
10221 Ok(token) => token,
10222 Err(e) => match dlg.token(e) {
10223 Ok(token) => token,
10224 Err(e) => {
10225 dlg.finished(false);
10226 return Err(common::Error::MissingToken(e));
10227 }
10228 },
10229 };
10230 request_value_reader
10231 .seek(std::io::SeekFrom::Start(0))
10232 .unwrap();
10233 let mut req_result = {
10234 let client = &self.hub.client;
10235 dlg.pre_request();
10236 let mut req_builder = hyper::Request::builder()
10237 .method(hyper::Method::POST)
10238 .uri(url.as_str())
10239 .header(USER_AGENT, self.hub._user_agent.clone());
10240
10241 if let Some(token) = token.as_ref() {
10242 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
10243 }
10244
10245 let request = req_builder
10246 .header(CONTENT_TYPE, json_mime_type.to_string())
10247 .header(CONTENT_LENGTH, request_size as u64)
10248 .body(common::to_body(
10249 request_value_reader.get_ref().clone().into(),
10250 ));
10251
10252 client.request(request.unwrap()).await
10253 };
10254
10255 match req_result {
10256 Err(err) => {
10257 if let common::Retry::After(d) = dlg.http_error(&err) {
10258 sleep(d).await;
10259 continue;
10260 }
10261 dlg.finished(false);
10262 return Err(common::Error::HttpError(err));
10263 }
10264 Ok(res) => {
10265 let (mut parts, body) = res.into_parts();
10266 let mut body = common::Body::new(body);
10267 if !parts.status.is_success() {
10268 let bytes = common::to_bytes(body).await.unwrap_or_default();
10269 let error = serde_json::from_str(&common::to_string(&bytes));
10270 let response = common::to_response(parts, bytes.into());
10271
10272 if let common::Retry::After(d) =
10273 dlg.http_failure(&response, error.as_ref().ok())
10274 {
10275 sleep(d).await;
10276 continue;
10277 }
10278
10279 dlg.finished(false);
10280
10281 return Err(match error {
10282 Ok(value) => common::Error::BadRequest(value),
10283 _ => common::Error::Failure(response),
10284 });
10285 }
10286 let response = {
10287 let bytes = common::to_bytes(body).await.unwrap_or_default();
10288 let encoded = common::to_string(&bytes);
10289 match serde_json::from_str(&encoded) {
10290 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
10291 Err(error) => {
10292 dlg.response_json_decode_error(&encoded, &error);
10293 return Err(common::Error::JsonDecodeError(
10294 encoded.to_string(),
10295 error,
10296 ));
10297 }
10298 }
10299 };
10300
10301 dlg.finished(true);
10302 return Ok(response);
10303 }
10304 }
10305 }
10306 }
10307
10308 ///
10309 /// Sets the *request* property to the given value.
10310 ///
10311 /// Even though the property as already been set when instantiating this call,
10312 /// we provide this method for API completeness.
10313 pub fn request(mut self, new_value: TransferConfig) -> ProjectTransferConfigCreateCall<'a, C> {
10314 self._request = new_value;
10315 self
10316 }
10317 /// Required. The BigQuery project id where the transfer configuration should be created. Must be in the format projects/{project_id}/locations/{location_id} or projects/{project_id}. If specified location and location of the destination bigquery dataset do not match - the request will fail.
10318 ///
10319 /// Sets the *parent* path property to the given value.
10320 ///
10321 /// Even though the property as already been set when instantiating this call,
10322 /// we provide this method for API completeness.
10323 pub fn parent(mut self, new_value: &str) -> ProjectTransferConfigCreateCall<'a, C> {
10324 self._parent = new_value.to_string();
10325 self
10326 }
10327 /// Optional version info. This parameter replaces `authorization_code` which is no longer used in any data sources. This is required only if `transferConfig.dataSourceId` is 'youtube_channel' *or* new credentials are needed, as indicated by `CheckValidCreds`. In order to obtain version info, make a request to the following URL: https://bigquery.cloud.google.com/datatransfer/oauthz/auth?redirect_uri=urn:ietf:wg:oauth:2.0:oob&response_type=version_info&client_id=client_id&scope=data_source_scopes * The client_id is the OAuth client_id of the data source as returned by ListDataSources method. * data_source_scopes are the scopes returned by ListDataSources method. Note that this should not be set when `service_account_name` is used to create the transfer config.
10328 ///
10329 /// Sets the *version info* query property to the given value.
10330 pub fn version_info(mut self, new_value: &str) -> ProjectTransferConfigCreateCall<'a, C> {
10331 self._version_info = Some(new_value.to_string());
10332 self
10333 }
10334 /// Optional service account email. If this field is set, the transfer config will be created with this service account's credentials. It requires that the requesting user calling this API has permissions to act as this service account. Note that not all data sources support service account credentials when creating a transfer config. For the latest list of data sources, read about [using service accounts](https://cloud.google.com/bigquery-transfer/docs/use-service-accounts).
10335 ///
10336 /// Sets the *service account name* query property to the given value.
10337 pub fn service_account_name(
10338 mut self,
10339 new_value: &str,
10340 ) -> ProjectTransferConfigCreateCall<'a, C> {
10341 self._service_account_name = Some(new_value.to_string());
10342 self
10343 }
10344 /// Deprecated: Authorization code was required when `transferConfig.dataSourceId` is 'youtube_channel' but it is no longer used in any data sources. Use `version_info` instead. Optional OAuth2 authorization code to use with this transfer configuration. This is required only if `transferConfig.dataSourceId` is 'youtube_channel' and new credentials are needed, as indicated by `CheckValidCreds`. In order to obtain authorization_code, make a request to the following URL: https://bigquery.cloud.google.com/datatransfer/oauthz/auth?redirect_uri=urn:ietf:wg:oauth:2.0:oob&response_type=authorization_code&client_id=client_id&scope=data_source_scopes * The client_id is the OAuth client_id of the data source as returned by ListDataSources method. * data_source_scopes are the scopes returned by ListDataSources method. Note that this should not be set when `service_account_name` is used to create the transfer config.
10345 ///
10346 /// Sets the *authorization code* query property to the given value.
10347 pub fn authorization_code(mut self, new_value: &str) -> ProjectTransferConfigCreateCall<'a, C> {
10348 self._authorization_code = Some(new_value.to_string());
10349 self
10350 }
10351 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
10352 /// while executing the actual API request.
10353 ///
10354 /// ````text
10355 /// It should be used to handle progress information, and to implement a certain level of resilience.
10356 /// ````
10357 ///
10358 /// Sets the *delegate* property to the given value.
10359 pub fn delegate(
10360 mut self,
10361 new_value: &'a mut dyn common::Delegate,
10362 ) -> ProjectTransferConfigCreateCall<'a, C> {
10363 self._delegate = Some(new_value);
10364 self
10365 }
10366
10367 /// Set any additional parameter of the query string used in the request.
10368 /// It should be used to set parameters which are not yet available through their own
10369 /// setters.
10370 ///
10371 /// Please note that this method must not be used to set any of the known parameters
10372 /// which have their own setter method. If done anyway, the request will fail.
10373 ///
10374 /// # Additional Parameters
10375 ///
10376 /// * *$.xgafv* (query-string) - V1 error format.
10377 /// * *access_token* (query-string) - OAuth access token.
10378 /// * *alt* (query-string) - Data format for response.
10379 /// * *callback* (query-string) - JSONP
10380 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
10381 /// * *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.
10382 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
10383 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
10384 /// * *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.
10385 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
10386 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
10387 pub fn param<T>(mut self, name: T, value: T) -> ProjectTransferConfigCreateCall<'a, C>
10388 where
10389 T: AsRef<str>,
10390 {
10391 self._additional_params
10392 .insert(name.as_ref().to_string(), value.as_ref().to_string());
10393 self
10394 }
10395
10396 /// Identifies the authorization scope for the method you are building.
10397 ///
10398 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
10399 /// [`Scope::CloudPlatform`].
10400 ///
10401 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
10402 /// tokens for more than one scope.
10403 ///
10404 /// Usually there is more than one suitable scope to authorize an operation, some of which may
10405 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
10406 /// sufficient, a read-write scope will do as well.
10407 pub fn add_scope<St>(mut self, scope: St) -> ProjectTransferConfigCreateCall<'a, C>
10408 where
10409 St: AsRef<str>,
10410 {
10411 self._scopes.insert(String::from(scope.as_ref()));
10412 self
10413 }
10414 /// Identifies the authorization scope(s) for the method you are building.
10415 ///
10416 /// See [`Self::add_scope()`] for details.
10417 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectTransferConfigCreateCall<'a, C>
10418 where
10419 I: IntoIterator<Item = St>,
10420 St: AsRef<str>,
10421 {
10422 self._scopes
10423 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
10424 self
10425 }
10426
10427 /// Removes all scopes, and no default scope will be used either.
10428 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
10429 /// for details).
10430 pub fn clear_scopes(mut self) -> ProjectTransferConfigCreateCall<'a, C> {
10431 self._scopes.clear();
10432 self
10433 }
10434}
10435
10436/// Deletes a data transfer configuration, including any associated transfer runs and logs.
10437///
10438/// A builder for the *transferConfigs.delete* method supported by a *project* resource.
10439/// It is not used directly, but through a [`ProjectMethods`] instance.
10440///
10441/// # Example
10442///
10443/// Instantiate a resource method builder
10444///
10445/// ```test_harness,no_run
10446/// # extern crate hyper;
10447/// # extern crate hyper_rustls;
10448/// # extern crate google_bigquerydatatransfer1 as bigquerydatatransfer1;
10449/// # async fn dox() {
10450/// # use bigquerydatatransfer1::{BigQueryDataTransfer, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
10451///
10452/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
10453/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
10454/// # .with_native_roots()
10455/// # .unwrap()
10456/// # .https_only()
10457/// # .enable_http2()
10458/// # .build();
10459///
10460/// # let executor = hyper_util::rt::TokioExecutor::new();
10461/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
10462/// # secret,
10463/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
10464/// # yup_oauth2::client::CustomHyperClientBuilder::from(
10465/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
10466/// # ),
10467/// # ).build().await.unwrap();
10468///
10469/// # let client = hyper_util::client::legacy::Client::builder(
10470/// # hyper_util::rt::TokioExecutor::new()
10471/// # )
10472/// # .build(
10473/// # hyper_rustls::HttpsConnectorBuilder::new()
10474/// # .with_native_roots()
10475/// # .unwrap()
10476/// # .https_or_http()
10477/// # .enable_http2()
10478/// # .build()
10479/// # );
10480/// # let mut hub = BigQueryDataTransfer::new(client, auth);
10481/// // You can configure optional parameters by calling the respective setters at will, and
10482/// // execute the final call using `doit()`.
10483/// // Values shown here are possibly random and not representative !
10484/// let result = hub.projects().transfer_configs_delete("name")
10485/// .doit().await;
10486/// # }
10487/// ```
10488pub struct ProjectTransferConfigDeleteCall<'a, C>
10489where
10490 C: 'a,
10491{
10492 hub: &'a BigQueryDataTransfer<C>,
10493 _name: String,
10494 _delegate: Option<&'a mut dyn common::Delegate>,
10495 _additional_params: HashMap<String, String>,
10496 _scopes: BTreeSet<String>,
10497}
10498
10499impl<'a, C> common::CallBuilder for ProjectTransferConfigDeleteCall<'a, C> {}
10500
10501impl<'a, C> ProjectTransferConfigDeleteCall<'a, C>
10502where
10503 C: common::Connector,
10504{
10505 /// Perform the operation you have build so far.
10506 pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
10507 use std::borrow::Cow;
10508 use std::io::{Read, Seek};
10509
10510 use common::{url::Params, ToParts};
10511 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
10512
10513 let mut dd = common::DefaultDelegate;
10514 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
10515 dlg.begin(common::MethodInfo {
10516 id: "bigquerydatatransfer.projects.transferConfigs.delete",
10517 http_method: hyper::Method::DELETE,
10518 });
10519
10520 for &field in ["alt", "name"].iter() {
10521 if self._additional_params.contains_key(field) {
10522 dlg.finished(false);
10523 return Err(common::Error::FieldClash(field));
10524 }
10525 }
10526
10527 let mut params = Params::with_capacity(3 + self._additional_params.len());
10528 params.push("name", self._name);
10529
10530 params.extend(self._additional_params.iter());
10531
10532 params.push("alt", "json");
10533 let mut url = self.hub._base_url.clone() + "v1/{+name}";
10534 if self._scopes.is_empty() {
10535 self._scopes
10536 .insert(Scope::CloudPlatform.as_ref().to_string());
10537 }
10538
10539 #[allow(clippy::single_element_loop)]
10540 for &(find_this, param_name) in [("{+name}", "name")].iter() {
10541 url = params.uri_replacement(url, param_name, find_this, true);
10542 }
10543 {
10544 let to_remove = ["name"];
10545 params.remove_params(&to_remove);
10546 }
10547
10548 let url = params.parse_with_url(&url);
10549
10550 loop {
10551 let token = match self
10552 .hub
10553 .auth
10554 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
10555 .await
10556 {
10557 Ok(token) => token,
10558 Err(e) => match dlg.token(e) {
10559 Ok(token) => token,
10560 Err(e) => {
10561 dlg.finished(false);
10562 return Err(common::Error::MissingToken(e));
10563 }
10564 },
10565 };
10566 let mut req_result = {
10567 let client = &self.hub.client;
10568 dlg.pre_request();
10569 let mut req_builder = hyper::Request::builder()
10570 .method(hyper::Method::DELETE)
10571 .uri(url.as_str())
10572 .header(USER_AGENT, self.hub._user_agent.clone());
10573
10574 if let Some(token) = token.as_ref() {
10575 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
10576 }
10577
10578 let request = req_builder
10579 .header(CONTENT_LENGTH, 0_u64)
10580 .body(common::to_body::<String>(None));
10581
10582 client.request(request.unwrap()).await
10583 };
10584
10585 match req_result {
10586 Err(err) => {
10587 if let common::Retry::After(d) = dlg.http_error(&err) {
10588 sleep(d).await;
10589 continue;
10590 }
10591 dlg.finished(false);
10592 return Err(common::Error::HttpError(err));
10593 }
10594 Ok(res) => {
10595 let (mut parts, body) = res.into_parts();
10596 let mut body = common::Body::new(body);
10597 if !parts.status.is_success() {
10598 let bytes = common::to_bytes(body).await.unwrap_or_default();
10599 let error = serde_json::from_str(&common::to_string(&bytes));
10600 let response = common::to_response(parts, bytes.into());
10601
10602 if let common::Retry::After(d) =
10603 dlg.http_failure(&response, error.as_ref().ok())
10604 {
10605 sleep(d).await;
10606 continue;
10607 }
10608
10609 dlg.finished(false);
10610
10611 return Err(match error {
10612 Ok(value) => common::Error::BadRequest(value),
10613 _ => common::Error::Failure(response),
10614 });
10615 }
10616 let response = {
10617 let bytes = common::to_bytes(body).await.unwrap_or_default();
10618 let encoded = common::to_string(&bytes);
10619 match serde_json::from_str(&encoded) {
10620 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
10621 Err(error) => {
10622 dlg.response_json_decode_error(&encoded, &error);
10623 return Err(common::Error::JsonDecodeError(
10624 encoded.to_string(),
10625 error,
10626 ));
10627 }
10628 }
10629 };
10630
10631 dlg.finished(true);
10632 return Ok(response);
10633 }
10634 }
10635 }
10636 }
10637
10638 /// Required. The name of the resource to delete. If you are using the regionless method, the location must be `US` and the name should be in the following form: * `projects/{project_id}/transferConfigs/{config_id}` If you are using the regionalized method, the name should be in the following form: * `projects/{project_id}/locations/{location_id}/transferConfigs/{config_id}`
10639 ///
10640 /// Sets the *name* path property to the given value.
10641 ///
10642 /// Even though the property as already been set when instantiating this call,
10643 /// we provide this method for API completeness.
10644 pub fn name(mut self, new_value: &str) -> ProjectTransferConfigDeleteCall<'a, C> {
10645 self._name = new_value.to_string();
10646 self
10647 }
10648 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
10649 /// while executing the actual API request.
10650 ///
10651 /// ````text
10652 /// It should be used to handle progress information, and to implement a certain level of resilience.
10653 /// ````
10654 ///
10655 /// Sets the *delegate* property to the given value.
10656 pub fn delegate(
10657 mut self,
10658 new_value: &'a mut dyn common::Delegate,
10659 ) -> ProjectTransferConfigDeleteCall<'a, C> {
10660 self._delegate = Some(new_value);
10661 self
10662 }
10663
10664 /// Set any additional parameter of the query string used in the request.
10665 /// It should be used to set parameters which are not yet available through their own
10666 /// setters.
10667 ///
10668 /// Please note that this method must not be used to set any of the known parameters
10669 /// which have their own setter method. If done anyway, the request will fail.
10670 ///
10671 /// # Additional Parameters
10672 ///
10673 /// * *$.xgafv* (query-string) - V1 error format.
10674 /// * *access_token* (query-string) - OAuth access token.
10675 /// * *alt* (query-string) - Data format for response.
10676 /// * *callback* (query-string) - JSONP
10677 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
10678 /// * *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.
10679 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
10680 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
10681 /// * *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.
10682 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
10683 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
10684 pub fn param<T>(mut self, name: T, value: T) -> ProjectTransferConfigDeleteCall<'a, C>
10685 where
10686 T: AsRef<str>,
10687 {
10688 self._additional_params
10689 .insert(name.as_ref().to_string(), value.as_ref().to_string());
10690 self
10691 }
10692
10693 /// Identifies the authorization scope for the method you are building.
10694 ///
10695 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
10696 /// [`Scope::CloudPlatform`].
10697 ///
10698 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
10699 /// tokens for more than one scope.
10700 ///
10701 /// Usually there is more than one suitable scope to authorize an operation, some of which may
10702 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
10703 /// sufficient, a read-write scope will do as well.
10704 pub fn add_scope<St>(mut self, scope: St) -> ProjectTransferConfigDeleteCall<'a, C>
10705 where
10706 St: AsRef<str>,
10707 {
10708 self._scopes.insert(String::from(scope.as_ref()));
10709 self
10710 }
10711 /// Identifies the authorization scope(s) for the method you are building.
10712 ///
10713 /// See [`Self::add_scope()`] for details.
10714 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectTransferConfigDeleteCall<'a, C>
10715 where
10716 I: IntoIterator<Item = St>,
10717 St: AsRef<str>,
10718 {
10719 self._scopes
10720 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
10721 self
10722 }
10723
10724 /// Removes all scopes, and no default scope will be used either.
10725 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
10726 /// for details).
10727 pub fn clear_scopes(mut self) -> ProjectTransferConfigDeleteCall<'a, C> {
10728 self._scopes.clear();
10729 self
10730 }
10731}
10732
10733/// Returns information about a data transfer config.
10734///
10735/// A builder for the *transferConfigs.get* method supported by a *project* resource.
10736/// It is not used directly, but through a [`ProjectMethods`] instance.
10737///
10738/// # Example
10739///
10740/// Instantiate a resource method builder
10741///
10742/// ```test_harness,no_run
10743/// # extern crate hyper;
10744/// # extern crate hyper_rustls;
10745/// # extern crate google_bigquerydatatransfer1 as bigquerydatatransfer1;
10746/// # async fn dox() {
10747/// # use bigquerydatatransfer1::{BigQueryDataTransfer, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
10748///
10749/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
10750/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
10751/// # .with_native_roots()
10752/// # .unwrap()
10753/// # .https_only()
10754/// # .enable_http2()
10755/// # .build();
10756///
10757/// # let executor = hyper_util::rt::TokioExecutor::new();
10758/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
10759/// # secret,
10760/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
10761/// # yup_oauth2::client::CustomHyperClientBuilder::from(
10762/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
10763/// # ),
10764/// # ).build().await.unwrap();
10765///
10766/// # let client = hyper_util::client::legacy::Client::builder(
10767/// # hyper_util::rt::TokioExecutor::new()
10768/// # )
10769/// # .build(
10770/// # hyper_rustls::HttpsConnectorBuilder::new()
10771/// # .with_native_roots()
10772/// # .unwrap()
10773/// # .https_or_http()
10774/// # .enable_http2()
10775/// # .build()
10776/// # );
10777/// # let mut hub = BigQueryDataTransfer::new(client, auth);
10778/// // You can configure optional parameters by calling the respective setters at will, and
10779/// // execute the final call using `doit()`.
10780/// // Values shown here are possibly random and not representative !
10781/// let result = hub.projects().transfer_configs_get("name")
10782/// .doit().await;
10783/// # }
10784/// ```
10785pub struct ProjectTransferConfigGetCall<'a, C>
10786where
10787 C: 'a,
10788{
10789 hub: &'a BigQueryDataTransfer<C>,
10790 _name: String,
10791 _delegate: Option<&'a mut dyn common::Delegate>,
10792 _additional_params: HashMap<String, String>,
10793 _scopes: BTreeSet<String>,
10794}
10795
10796impl<'a, C> common::CallBuilder for ProjectTransferConfigGetCall<'a, C> {}
10797
10798impl<'a, C> ProjectTransferConfigGetCall<'a, C>
10799where
10800 C: common::Connector,
10801{
10802 /// Perform the operation you have build so far.
10803 pub async fn doit(mut self) -> common::Result<(common::Response, TransferConfig)> {
10804 use std::borrow::Cow;
10805 use std::io::{Read, Seek};
10806
10807 use common::{url::Params, ToParts};
10808 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
10809
10810 let mut dd = common::DefaultDelegate;
10811 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
10812 dlg.begin(common::MethodInfo {
10813 id: "bigquerydatatransfer.projects.transferConfigs.get",
10814 http_method: hyper::Method::GET,
10815 });
10816
10817 for &field in ["alt", "name"].iter() {
10818 if self._additional_params.contains_key(field) {
10819 dlg.finished(false);
10820 return Err(common::Error::FieldClash(field));
10821 }
10822 }
10823
10824 let mut params = Params::with_capacity(3 + self._additional_params.len());
10825 params.push("name", self._name);
10826
10827 params.extend(self._additional_params.iter());
10828
10829 params.push("alt", "json");
10830 let mut url = self.hub._base_url.clone() + "v1/{+name}";
10831 if self._scopes.is_empty() {
10832 self._scopes
10833 .insert(Scope::CloudPlatformReadOnly.as_ref().to_string());
10834 }
10835
10836 #[allow(clippy::single_element_loop)]
10837 for &(find_this, param_name) in [("{+name}", "name")].iter() {
10838 url = params.uri_replacement(url, param_name, find_this, true);
10839 }
10840 {
10841 let to_remove = ["name"];
10842 params.remove_params(&to_remove);
10843 }
10844
10845 let url = params.parse_with_url(&url);
10846
10847 loop {
10848 let token = match self
10849 .hub
10850 .auth
10851 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
10852 .await
10853 {
10854 Ok(token) => token,
10855 Err(e) => match dlg.token(e) {
10856 Ok(token) => token,
10857 Err(e) => {
10858 dlg.finished(false);
10859 return Err(common::Error::MissingToken(e));
10860 }
10861 },
10862 };
10863 let mut req_result = {
10864 let client = &self.hub.client;
10865 dlg.pre_request();
10866 let mut req_builder = hyper::Request::builder()
10867 .method(hyper::Method::GET)
10868 .uri(url.as_str())
10869 .header(USER_AGENT, self.hub._user_agent.clone());
10870
10871 if let Some(token) = token.as_ref() {
10872 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
10873 }
10874
10875 let request = req_builder
10876 .header(CONTENT_LENGTH, 0_u64)
10877 .body(common::to_body::<String>(None));
10878
10879 client.request(request.unwrap()).await
10880 };
10881
10882 match req_result {
10883 Err(err) => {
10884 if let common::Retry::After(d) = dlg.http_error(&err) {
10885 sleep(d).await;
10886 continue;
10887 }
10888 dlg.finished(false);
10889 return Err(common::Error::HttpError(err));
10890 }
10891 Ok(res) => {
10892 let (mut parts, body) = res.into_parts();
10893 let mut body = common::Body::new(body);
10894 if !parts.status.is_success() {
10895 let bytes = common::to_bytes(body).await.unwrap_or_default();
10896 let error = serde_json::from_str(&common::to_string(&bytes));
10897 let response = common::to_response(parts, bytes.into());
10898
10899 if let common::Retry::After(d) =
10900 dlg.http_failure(&response, error.as_ref().ok())
10901 {
10902 sleep(d).await;
10903 continue;
10904 }
10905
10906 dlg.finished(false);
10907
10908 return Err(match error {
10909 Ok(value) => common::Error::BadRequest(value),
10910 _ => common::Error::Failure(response),
10911 });
10912 }
10913 let response = {
10914 let bytes = common::to_bytes(body).await.unwrap_or_default();
10915 let encoded = common::to_string(&bytes);
10916 match serde_json::from_str(&encoded) {
10917 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
10918 Err(error) => {
10919 dlg.response_json_decode_error(&encoded, &error);
10920 return Err(common::Error::JsonDecodeError(
10921 encoded.to_string(),
10922 error,
10923 ));
10924 }
10925 }
10926 };
10927
10928 dlg.finished(true);
10929 return Ok(response);
10930 }
10931 }
10932 }
10933 }
10934
10935 /// Required. The name of the resource requested. If you are using the regionless method, the location must be `US` and the name should be in the following form: * `projects/{project_id}/transferConfigs/{config_id}` If you are using the regionalized method, the name should be in the following form: * `projects/{project_id}/locations/{location_id}/transferConfigs/{config_id}`
10936 ///
10937 /// Sets the *name* path property to the given value.
10938 ///
10939 /// Even though the property as already been set when instantiating this call,
10940 /// we provide this method for API completeness.
10941 pub fn name(mut self, new_value: &str) -> ProjectTransferConfigGetCall<'a, C> {
10942 self._name = new_value.to_string();
10943 self
10944 }
10945 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
10946 /// while executing the actual API request.
10947 ///
10948 /// ````text
10949 /// It should be used to handle progress information, and to implement a certain level of resilience.
10950 /// ````
10951 ///
10952 /// Sets the *delegate* property to the given value.
10953 pub fn delegate(
10954 mut self,
10955 new_value: &'a mut dyn common::Delegate,
10956 ) -> ProjectTransferConfigGetCall<'a, C> {
10957 self._delegate = Some(new_value);
10958 self
10959 }
10960
10961 /// Set any additional parameter of the query string used in the request.
10962 /// It should be used to set parameters which are not yet available through their own
10963 /// setters.
10964 ///
10965 /// Please note that this method must not be used to set any of the known parameters
10966 /// which have their own setter method. If done anyway, the request will fail.
10967 ///
10968 /// # Additional Parameters
10969 ///
10970 /// * *$.xgafv* (query-string) - V1 error format.
10971 /// * *access_token* (query-string) - OAuth access token.
10972 /// * *alt* (query-string) - Data format for response.
10973 /// * *callback* (query-string) - JSONP
10974 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
10975 /// * *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.
10976 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
10977 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
10978 /// * *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.
10979 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
10980 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
10981 pub fn param<T>(mut self, name: T, value: T) -> ProjectTransferConfigGetCall<'a, C>
10982 where
10983 T: AsRef<str>,
10984 {
10985 self._additional_params
10986 .insert(name.as_ref().to_string(), value.as_ref().to_string());
10987 self
10988 }
10989
10990 /// Identifies the authorization scope for the method you are building.
10991 ///
10992 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
10993 /// [`Scope::CloudPlatformReadOnly`].
10994 ///
10995 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
10996 /// tokens for more than one scope.
10997 ///
10998 /// Usually there is more than one suitable scope to authorize an operation, some of which may
10999 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
11000 /// sufficient, a read-write scope will do as well.
11001 pub fn add_scope<St>(mut self, scope: St) -> ProjectTransferConfigGetCall<'a, C>
11002 where
11003 St: AsRef<str>,
11004 {
11005 self._scopes.insert(String::from(scope.as_ref()));
11006 self
11007 }
11008 /// Identifies the authorization scope(s) for the method you are building.
11009 ///
11010 /// See [`Self::add_scope()`] for details.
11011 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectTransferConfigGetCall<'a, C>
11012 where
11013 I: IntoIterator<Item = St>,
11014 St: AsRef<str>,
11015 {
11016 self._scopes
11017 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
11018 self
11019 }
11020
11021 /// Removes all scopes, and no default scope will be used either.
11022 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
11023 /// for details).
11024 pub fn clear_scopes(mut self) -> ProjectTransferConfigGetCall<'a, C> {
11025 self._scopes.clear();
11026 self
11027 }
11028}
11029
11030/// Returns information about all transfer configs owned by a project in the specified location.
11031///
11032/// A builder for the *transferConfigs.list* method supported by a *project* resource.
11033/// It is not used directly, but through a [`ProjectMethods`] instance.
11034///
11035/// # Example
11036///
11037/// Instantiate a resource method builder
11038///
11039/// ```test_harness,no_run
11040/// # extern crate hyper;
11041/// # extern crate hyper_rustls;
11042/// # extern crate google_bigquerydatatransfer1 as bigquerydatatransfer1;
11043/// # async fn dox() {
11044/// # use bigquerydatatransfer1::{BigQueryDataTransfer, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
11045///
11046/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
11047/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
11048/// # .with_native_roots()
11049/// # .unwrap()
11050/// # .https_only()
11051/// # .enable_http2()
11052/// # .build();
11053///
11054/// # let executor = hyper_util::rt::TokioExecutor::new();
11055/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
11056/// # secret,
11057/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
11058/// # yup_oauth2::client::CustomHyperClientBuilder::from(
11059/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
11060/// # ),
11061/// # ).build().await.unwrap();
11062///
11063/// # let client = hyper_util::client::legacy::Client::builder(
11064/// # hyper_util::rt::TokioExecutor::new()
11065/// # )
11066/// # .build(
11067/// # hyper_rustls::HttpsConnectorBuilder::new()
11068/// # .with_native_roots()
11069/// # .unwrap()
11070/// # .https_or_http()
11071/// # .enable_http2()
11072/// # .build()
11073/// # );
11074/// # let mut hub = BigQueryDataTransfer::new(client, auth);
11075/// // You can configure optional parameters by calling the respective setters at will, and
11076/// // execute the final call using `doit()`.
11077/// // Values shown here are possibly random and not representative !
11078/// let result = hub.projects().transfer_configs_list("parent")
11079/// .page_token("vero")
11080/// .page_size(-88)
11081/// .add_data_source_ids("Stet")
11082/// .doit().await;
11083/// # }
11084/// ```
11085pub struct ProjectTransferConfigListCall<'a, C>
11086where
11087 C: 'a,
11088{
11089 hub: &'a BigQueryDataTransfer<C>,
11090 _parent: String,
11091 _page_token: Option<String>,
11092 _page_size: Option<i32>,
11093 _data_source_ids: Vec<String>,
11094 _delegate: Option<&'a mut dyn common::Delegate>,
11095 _additional_params: HashMap<String, String>,
11096 _scopes: BTreeSet<String>,
11097}
11098
11099impl<'a, C> common::CallBuilder for ProjectTransferConfigListCall<'a, C> {}
11100
11101impl<'a, C> ProjectTransferConfigListCall<'a, C>
11102where
11103 C: common::Connector,
11104{
11105 /// Perform the operation you have build so far.
11106 pub async fn doit(mut self) -> common::Result<(common::Response, ListTransferConfigsResponse)> {
11107 use std::borrow::Cow;
11108 use std::io::{Read, Seek};
11109
11110 use common::{url::Params, ToParts};
11111 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
11112
11113 let mut dd = common::DefaultDelegate;
11114 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
11115 dlg.begin(common::MethodInfo {
11116 id: "bigquerydatatransfer.projects.transferConfigs.list",
11117 http_method: hyper::Method::GET,
11118 });
11119
11120 for &field in ["alt", "parent", "pageToken", "pageSize", "dataSourceIds"].iter() {
11121 if self._additional_params.contains_key(field) {
11122 dlg.finished(false);
11123 return Err(common::Error::FieldClash(field));
11124 }
11125 }
11126
11127 let mut params = Params::with_capacity(6 + self._additional_params.len());
11128 params.push("parent", self._parent);
11129 if let Some(value) = self._page_token.as_ref() {
11130 params.push("pageToken", value);
11131 }
11132 if let Some(value) = self._page_size.as_ref() {
11133 params.push("pageSize", value.to_string());
11134 }
11135 if !self._data_source_ids.is_empty() {
11136 for f in self._data_source_ids.iter() {
11137 params.push("dataSourceIds", f);
11138 }
11139 }
11140
11141 params.extend(self._additional_params.iter());
11142
11143 params.push("alt", "json");
11144 let mut url = self.hub._base_url.clone() + "v1/{+parent}/transferConfigs";
11145 if self._scopes.is_empty() {
11146 self._scopes
11147 .insert(Scope::CloudPlatformReadOnly.as_ref().to_string());
11148 }
11149
11150 #[allow(clippy::single_element_loop)]
11151 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
11152 url = params.uri_replacement(url, param_name, find_this, true);
11153 }
11154 {
11155 let to_remove = ["parent"];
11156 params.remove_params(&to_remove);
11157 }
11158
11159 let url = params.parse_with_url(&url);
11160
11161 loop {
11162 let token = match self
11163 .hub
11164 .auth
11165 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
11166 .await
11167 {
11168 Ok(token) => token,
11169 Err(e) => match dlg.token(e) {
11170 Ok(token) => token,
11171 Err(e) => {
11172 dlg.finished(false);
11173 return Err(common::Error::MissingToken(e));
11174 }
11175 },
11176 };
11177 let mut req_result = {
11178 let client = &self.hub.client;
11179 dlg.pre_request();
11180 let mut req_builder = hyper::Request::builder()
11181 .method(hyper::Method::GET)
11182 .uri(url.as_str())
11183 .header(USER_AGENT, self.hub._user_agent.clone());
11184
11185 if let Some(token) = token.as_ref() {
11186 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
11187 }
11188
11189 let request = req_builder
11190 .header(CONTENT_LENGTH, 0_u64)
11191 .body(common::to_body::<String>(None));
11192
11193 client.request(request.unwrap()).await
11194 };
11195
11196 match req_result {
11197 Err(err) => {
11198 if let common::Retry::After(d) = dlg.http_error(&err) {
11199 sleep(d).await;
11200 continue;
11201 }
11202 dlg.finished(false);
11203 return Err(common::Error::HttpError(err));
11204 }
11205 Ok(res) => {
11206 let (mut parts, body) = res.into_parts();
11207 let mut body = common::Body::new(body);
11208 if !parts.status.is_success() {
11209 let bytes = common::to_bytes(body).await.unwrap_or_default();
11210 let error = serde_json::from_str(&common::to_string(&bytes));
11211 let response = common::to_response(parts, bytes.into());
11212
11213 if let common::Retry::After(d) =
11214 dlg.http_failure(&response, error.as_ref().ok())
11215 {
11216 sleep(d).await;
11217 continue;
11218 }
11219
11220 dlg.finished(false);
11221
11222 return Err(match error {
11223 Ok(value) => common::Error::BadRequest(value),
11224 _ => common::Error::Failure(response),
11225 });
11226 }
11227 let response = {
11228 let bytes = common::to_bytes(body).await.unwrap_or_default();
11229 let encoded = common::to_string(&bytes);
11230 match serde_json::from_str(&encoded) {
11231 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
11232 Err(error) => {
11233 dlg.response_json_decode_error(&encoded, &error);
11234 return Err(common::Error::JsonDecodeError(
11235 encoded.to_string(),
11236 error,
11237 ));
11238 }
11239 }
11240 };
11241
11242 dlg.finished(true);
11243 return Ok(response);
11244 }
11245 }
11246 }
11247 }
11248
11249 /// Required. The BigQuery project id for which transfer configs should be returned. If you are using the regionless method, the location must be `US` and `parent` should be in the following form: * `projects/{project_id} If you are using the regionalized method, `parent` should be in the following form: * `projects/{project_id}/locations/{location_id}`
11250 ///
11251 /// Sets the *parent* path property to the given value.
11252 ///
11253 /// Even though the property as already been set when instantiating this call,
11254 /// we provide this method for API completeness.
11255 pub fn parent(mut self, new_value: &str) -> ProjectTransferConfigListCall<'a, C> {
11256 self._parent = new_value.to_string();
11257 self
11258 }
11259 /// Pagination token, which can be used to request a specific page of `ListTransfersRequest` list results. For multiple-page results, `ListTransfersResponse` outputs a `next_page` token, which can be used as the `page_token` value to request the next page of list results.
11260 ///
11261 /// Sets the *page token* query property to the given value.
11262 pub fn page_token(mut self, new_value: &str) -> ProjectTransferConfigListCall<'a, C> {
11263 self._page_token = Some(new_value.to_string());
11264 self
11265 }
11266 /// Page size. The default page size is the maximum value of 1000 results.
11267 ///
11268 /// Sets the *page size* query property to the given value.
11269 pub fn page_size(mut self, new_value: i32) -> ProjectTransferConfigListCall<'a, C> {
11270 self._page_size = Some(new_value);
11271 self
11272 }
11273 /// When specified, only configurations of requested data sources are returned.
11274 ///
11275 /// Append the given value to the *data source ids* query property.
11276 /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
11277 pub fn add_data_source_ids(mut self, new_value: &str) -> ProjectTransferConfigListCall<'a, C> {
11278 self._data_source_ids.push(new_value.to_string());
11279 self
11280 }
11281 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
11282 /// while executing the actual API request.
11283 ///
11284 /// ````text
11285 /// It should be used to handle progress information, and to implement a certain level of resilience.
11286 /// ````
11287 ///
11288 /// Sets the *delegate* property to the given value.
11289 pub fn delegate(
11290 mut self,
11291 new_value: &'a mut dyn common::Delegate,
11292 ) -> ProjectTransferConfigListCall<'a, C> {
11293 self._delegate = Some(new_value);
11294 self
11295 }
11296
11297 /// Set any additional parameter of the query string used in the request.
11298 /// It should be used to set parameters which are not yet available through their own
11299 /// setters.
11300 ///
11301 /// Please note that this method must not be used to set any of the known parameters
11302 /// which have their own setter method. If done anyway, the request will fail.
11303 ///
11304 /// # Additional Parameters
11305 ///
11306 /// * *$.xgafv* (query-string) - V1 error format.
11307 /// * *access_token* (query-string) - OAuth access token.
11308 /// * *alt* (query-string) - Data format for response.
11309 /// * *callback* (query-string) - JSONP
11310 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
11311 /// * *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.
11312 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
11313 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
11314 /// * *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.
11315 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
11316 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
11317 pub fn param<T>(mut self, name: T, value: T) -> ProjectTransferConfigListCall<'a, C>
11318 where
11319 T: AsRef<str>,
11320 {
11321 self._additional_params
11322 .insert(name.as_ref().to_string(), value.as_ref().to_string());
11323 self
11324 }
11325
11326 /// Identifies the authorization scope for the method you are building.
11327 ///
11328 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
11329 /// [`Scope::CloudPlatformReadOnly`].
11330 ///
11331 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
11332 /// tokens for more than one scope.
11333 ///
11334 /// Usually there is more than one suitable scope to authorize an operation, some of which may
11335 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
11336 /// sufficient, a read-write scope will do as well.
11337 pub fn add_scope<St>(mut self, scope: St) -> ProjectTransferConfigListCall<'a, C>
11338 where
11339 St: AsRef<str>,
11340 {
11341 self._scopes.insert(String::from(scope.as_ref()));
11342 self
11343 }
11344 /// Identifies the authorization scope(s) for the method you are building.
11345 ///
11346 /// See [`Self::add_scope()`] for details.
11347 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectTransferConfigListCall<'a, C>
11348 where
11349 I: IntoIterator<Item = St>,
11350 St: AsRef<str>,
11351 {
11352 self._scopes
11353 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
11354 self
11355 }
11356
11357 /// Removes all scopes, and no default scope will be used either.
11358 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
11359 /// for details).
11360 pub fn clear_scopes(mut self) -> ProjectTransferConfigListCall<'a, C> {
11361 self._scopes.clear();
11362 self
11363 }
11364}
11365
11366/// Updates a data transfer configuration. All fields must be set, even if they are not updated.
11367///
11368/// A builder for the *transferConfigs.patch* method supported by a *project* resource.
11369/// It is not used directly, but through a [`ProjectMethods`] instance.
11370///
11371/// # Example
11372///
11373/// Instantiate a resource method builder
11374///
11375/// ```test_harness,no_run
11376/// # extern crate hyper;
11377/// # extern crate hyper_rustls;
11378/// # extern crate google_bigquerydatatransfer1 as bigquerydatatransfer1;
11379/// use bigquerydatatransfer1::api::TransferConfig;
11380/// # async fn dox() {
11381/// # use bigquerydatatransfer1::{BigQueryDataTransfer, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
11382///
11383/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
11384/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
11385/// # .with_native_roots()
11386/// # .unwrap()
11387/// # .https_only()
11388/// # .enable_http2()
11389/// # .build();
11390///
11391/// # let executor = hyper_util::rt::TokioExecutor::new();
11392/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
11393/// # secret,
11394/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
11395/// # yup_oauth2::client::CustomHyperClientBuilder::from(
11396/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
11397/// # ),
11398/// # ).build().await.unwrap();
11399///
11400/// # let client = hyper_util::client::legacy::Client::builder(
11401/// # hyper_util::rt::TokioExecutor::new()
11402/// # )
11403/// # .build(
11404/// # hyper_rustls::HttpsConnectorBuilder::new()
11405/// # .with_native_roots()
11406/// # .unwrap()
11407/// # .https_or_http()
11408/// # .enable_http2()
11409/// # .build()
11410/// # );
11411/// # let mut hub = BigQueryDataTransfer::new(client, auth);
11412/// // As the method needs a request, you would usually fill it with the desired information
11413/// // into the respective structure. Some of the parts shown here might not be applicable !
11414/// // Values shown here are possibly random and not representative !
11415/// let mut req = TransferConfig::default();
11416///
11417/// // You can configure optional parameters by calling the respective setters at will, and
11418/// // execute the final call using `doit()`.
11419/// // Values shown here are possibly random and not representative !
11420/// let result = hub.projects().transfer_configs_patch(req, "name")
11421/// .version_info("elitr")
11422/// .update_mask(FieldMask::new::<&str>(&[]))
11423/// .service_account_name("Lorem")
11424/// .authorization_code("diam")
11425/// .doit().await;
11426/// # }
11427/// ```
11428pub struct ProjectTransferConfigPatchCall<'a, C>
11429where
11430 C: 'a,
11431{
11432 hub: &'a BigQueryDataTransfer<C>,
11433 _request: TransferConfig,
11434 _name: String,
11435 _version_info: Option<String>,
11436 _update_mask: Option<common::FieldMask>,
11437 _service_account_name: Option<String>,
11438 _authorization_code: Option<String>,
11439 _delegate: Option<&'a mut dyn common::Delegate>,
11440 _additional_params: HashMap<String, String>,
11441 _scopes: BTreeSet<String>,
11442}
11443
11444impl<'a, C> common::CallBuilder for ProjectTransferConfigPatchCall<'a, C> {}
11445
11446impl<'a, C> ProjectTransferConfigPatchCall<'a, C>
11447where
11448 C: common::Connector,
11449{
11450 /// Perform the operation you have build so far.
11451 pub async fn doit(mut self) -> common::Result<(common::Response, TransferConfig)> {
11452 use std::borrow::Cow;
11453 use std::io::{Read, Seek};
11454
11455 use common::{url::Params, ToParts};
11456 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
11457
11458 let mut dd = common::DefaultDelegate;
11459 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
11460 dlg.begin(common::MethodInfo {
11461 id: "bigquerydatatransfer.projects.transferConfigs.patch",
11462 http_method: hyper::Method::PATCH,
11463 });
11464
11465 for &field in [
11466 "alt",
11467 "name",
11468 "versionInfo",
11469 "updateMask",
11470 "serviceAccountName",
11471 "authorizationCode",
11472 ]
11473 .iter()
11474 {
11475 if self._additional_params.contains_key(field) {
11476 dlg.finished(false);
11477 return Err(common::Error::FieldClash(field));
11478 }
11479 }
11480
11481 let mut params = Params::with_capacity(8 + self._additional_params.len());
11482 params.push("name", self._name);
11483 if let Some(value) = self._version_info.as_ref() {
11484 params.push("versionInfo", value);
11485 }
11486 if let Some(value) = self._update_mask.as_ref() {
11487 params.push("updateMask", value.to_string());
11488 }
11489 if let Some(value) = self._service_account_name.as_ref() {
11490 params.push("serviceAccountName", value);
11491 }
11492 if let Some(value) = self._authorization_code.as_ref() {
11493 params.push("authorizationCode", value);
11494 }
11495
11496 params.extend(self._additional_params.iter());
11497
11498 params.push("alt", "json");
11499 let mut url = self.hub._base_url.clone() + "v1/{+name}";
11500 if self._scopes.is_empty() {
11501 self._scopes
11502 .insert(Scope::CloudPlatform.as_ref().to_string());
11503 }
11504
11505 #[allow(clippy::single_element_loop)]
11506 for &(find_this, param_name) in [("{+name}", "name")].iter() {
11507 url = params.uri_replacement(url, param_name, find_this, true);
11508 }
11509 {
11510 let to_remove = ["name"];
11511 params.remove_params(&to_remove);
11512 }
11513
11514 let url = params.parse_with_url(&url);
11515
11516 let mut json_mime_type = mime::APPLICATION_JSON;
11517 let mut request_value_reader = {
11518 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
11519 common::remove_json_null_values(&mut value);
11520 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
11521 serde_json::to_writer(&mut dst, &value).unwrap();
11522 dst
11523 };
11524 let request_size = request_value_reader
11525 .seek(std::io::SeekFrom::End(0))
11526 .unwrap();
11527 request_value_reader
11528 .seek(std::io::SeekFrom::Start(0))
11529 .unwrap();
11530
11531 loop {
11532 let token = match self
11533 .hub
11534 .auth
11535 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
11536 .await
11537 {
11538 Ok(token) => token,
11539 Err(e) => match dlg.token(e) {
11540 Ok(token) => token,
11541 Err(e) => {
11542 dlg.finished(false);
11543 return Err(common::Error::MissingToken(e));
11544 }
11545 },
11546 };
11547 request_value_reader
11548 .seek(std::io::SeekFrom::Start(0))
11549 .unwrap();
11550 let mut req_result = {
11551 let client = &self.hub.client;
11552 dlg.pre_request();
11553 let mut req_builder = hyper::Request::builder()
11554 .method(hyper::Method::PATCH)
11555 .uri(url.as_str())
11556 .header(USER_AGENT, self.hub._user_agent.clone());
11557
11558 if let Some(token) = token.as_ref() {
11559 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
11560 }
11561
11562 let request = req_builder
11563 .header(CONTENT_TYPE, json_mime_type.to_string())
11564 .header(CONTENT_LENGTH, request_size as u64)
11565 .body(common::to_body(
11566 request_value_reader.get_ref().clone().into(),
11567 ));
11568
11569 client.request(request.unwrap()).await
11570 };
11571
11572 match req_result {
11573 Err(err) => {
11574 if let common::Retry::After(d) = dlg.http_error(&err) {
11575 sleep(d).await;
11576 continue;
11577 }
11578 dlg.finished(false);
11579 return Err(common::Error::HttpError(err));
11580 }
11581 Ok(res) => {
11582 let (mut parts, body) = res.into_parts();
11583 let mut body = common::Body::new(body);
11584 if !parts.status.is_success() {
11585 let bytes = common::to_bytes(body).await.unwrap_or_default();
11586 let error = serde_json::from_str(&common::to_string(&bytes));
11587 let response = common::to_response(parts, bytes.into());
11588
11589 if let common::Retry::After(d) =
11590 dlg.http_failure(&response, error.as_ref().ok())
11591 {
11592 sleep(d).await;
11593 continue;
11594 }
11595
11596 dlg.finished(false);
11597
11598 return Err(match error {
11599 Ok(value) => common::Error::BadRequest(value),
11600 _ => common::Error::Failure(response),
11601 });
11602 }
11603 let response = {
11604 let bytes = common::to_bytes(body).await.unwrap_or_default();
11605 let encoded = common::to_string(&bytes);
11606 match serde_json::from_str(&encoded) {
11607 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
11608 Err(error) => {
11609 dlg.response_json_decode_error(&encoded, &error);
11610 return Err(common::Error::JsonDecodeError(
11611 encoded.to_string(),
11612 error,
11613 ));
11614 }
11615 }
11616 };
11617
11618 dlg.finished(true);
11619 return Ok(response);
11620 }
11621 }
11622 }
11623 }
11624
11625 ///
11626 /// Sets the *request* property to the given value.
11627 ///
11628 /// Even though the property as already been set when instantiating this call,
11629 /// we provide this method for API completeness.
11630 pub fn request(mut self, new_value: TransferConfig) -> ProjectTransferConfigPatchCall<'a, C> {
11631 self._request = new_value;
11632 self
11633 }
11634 /// Identifier. The resource name of the transfer config. Transfer config names have the form either `projects/{project_id}/locations/{region}/transferConfigs/{config_id}` or `projects/{project_id}/transferConfigs/{config_id}`, where `config_id` is usually a UUID, even though it is not guaranteed or required. The name is ignored when creating a transfer config.
11635 ///
11636 /// Sets the *name* path property to the given value.
11637 ///
11638 /// Even though the property as already been set when instantiating this call,
11639 /// we provide this method for API completeness.
11640 pub fn name(mut self, new_value: &str) -> ProjectTransferConfigPatchCall<'a, C> {
11641 self._name = new_value.to_string();
11642 self
11643 }
11644 /// Optional version info. This parameter replaces `authorization_code` which is no longer used in any data sources. This is required only if `transferConfig.dataSourceId` is 'youtube_channel' *or* new credentials are needed, as indicated by `CheckValidCreds`. In order to obtain version info, make a request to the following URL: https://bigquery.cloud.google.com/datatransfer/oauthz/auth?redirect_uri=urn:ietf:wg:oauth:2.0:oob&response_type=version_info&client_id=client_id&scope=data_source_scopes * The client_id is the OAuth client_id of the data source as returned by ListDataSources method. * data_source_scopes are the scopes returned by ListDataSources method. Note that this should not be set when `service_account_name` is used to update the transfer config.
11645 ///
11646 /// Sets the *version info* query property to the given value.
11647 pub fn version_info(mut self, new_value: &str) -> ProjectTransferConfigPatchCall<'a, C> {
11648 self._version_info = Some(new_value.to_string());
11649 self
11650 }
11651 /// Required. Required list of fields to be updated in this request.
11652 ///
11653 /// Sets the *update mask* query property to the given value.
11654 pub fn update_mask(
11655 mut self,
11656 new_value: common::FieldMask,
11657 ) -> ProjectTransferConfigPatchCall<'a, C> {
11658 self._update_mask = Some(new_value);
11659 self
11660 }
11661 /// Optional service account email. If this field is set, the transfer config will be created with this service account's credentials. It requires that the requesting user calling this API has permissions to act as this service account. Note that not all data sources support service account credentials when creating a transfer config. For the latest list of data sources, read about [using service accounts](https://cloud.google.com/bigquery-transfer/docs/use-service-accounts).
11662 ///
11663 /// Sets the *service account name* query property to the given value.
11664 pub fn service_account_name(
11665 mut self,
11666 new_value: &str,
11667 ) -> ProjectTransferConfigPatchCall<'a, C> {
11668 self._service_account_name = Some(new_value.to_string());
11669 self
11670 }
11671 /// Deprecated: Authorization code was required when `transferConfig.dataSourceId` is 'youtube_channel' but it is no longer used in any data sources. Use `version_info` instead. Optional OAuth2 authorization code to use with this transfer configuration. This is required only if `transferConfig.dataSourceId` is 'youtube_channel' and new credentials are needed, as indicated by `CheckValidCreds`. In order to obtain authorization_code, make a request to the following URL: https://bigquery.cloud.google.com/datatransfer/oauthz/auth?redirect_uri=urn:ietf:wg:oauth:2.0:oob&response_type=authorization_code&client_id=client_id&scope=data_source_scopes * The client_id is the OAuth client_id of the data source as returned by ListDataSources method. * data_source_scopes are the scopes returned by ListDataSources method. Note that this should not be set when `service_account_name` is used to update the transfer config.
11672 ///
11673 /// Sets the *authorization code* query property to the given value.
11674 pub fn authorization_code(mut self, new_value: &str) -> ProjectTransferConfigPatchCall<'a, C> {
11675 self._authorization_code = Some(new_value.to_string());
11676 self
11677 }
11678 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
11679 /// while executing the actual API request.
11680 ///
11681 /// ````text
11682 /// It should be used to handle progress information, and to implement a certain level of resilience.
11683 /// ````
11684 ///
11685 /// Sets the *delegate* property to the given value.
11686 pub fn delegate(
11687 mut self,
11688 new_value: &'a mut dyn common::Delegate,
11689 ) -> ProjectTransferConfigPatchCall<'a, C> {
11690 self._delegate = Some(new_value);
11691 self
11692 }
11693
11694 /// Set any additional parameter of the query string used in the request.
11695 /// It should be used to set parameters which are not yet available through their own
11696 /// setters.
11697 ///
11698 /// Please note that this method must not be used to set any of the known parameters
11699 /// which have their own setter method. If done anyway, the request will fail.
11700 ///
11701 /// # Additional Parameters
11702 ///
11703 /// * *$.xgafv* (query-string) - V1 error format.
11704 /// * *access_token* (query-string) - OAuth access token.
11705 /// * *alt* (query-string) - Data format for response.
11706 /// * *callback* (query-string) - JSONP
11707 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
11708 /// * *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.
11709 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
11710 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
11711 /// * *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.
11712 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
11713 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
11714 pub fn param<T>(mut self, name: T, value: T) -> ProjectTransferConfigPatchCall<'a, C>
11715 where
11716 T: AsRef<str>,
11717 {
11718 self._additional_params
11719 .insert(name.as_ref().to_string(), value.as_ref().to_string());
11720 self
11721 }
11722
11723 /// Identifies the authorization scope for the method you are building.
11724 ///
11725 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
11726 /// [`Scope::CloudPlatform`].
11727 ///
11728 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
11729 /// tokens for more than one scope.
11730 ///
11731 /// Usually there is more than one suitable scope to authorize an operation, some of which may
11732 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
11733 /// sufficient, a read-write scope will do as well.
11734 pub fn add_scope<St>(mut self, scope: St) -> ProjectTransferConfigPatchCall<'a, C>
11735 where
11736 St: AsRef<str>,
11737 {
11738 self._scopes.insert(String::from(scope.as_ref()));
11739 self
11740 }
11741 /// Identifies the authorization scope(s) for the method you are building.
11742 ///
11743 /// See [`Self::add_scope()`] for details.
11744 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectTransferConfigPatchCall<'a, C>
11745 where
11746 I: IntoIterator<Item = St>,
11747 St: AsRef<str>,
11748 {
11749 self._scopes
11750 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
11751 self
11752 }
11753
11754 /// Removes all scopes, and no default scope will be used either.
11755 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
11756 /// for details).
11757 pub fn clear_scopes(mut self) -> ProjectTransferConfigPatchCall<'a, C> {
11758 self._scopes.clear();
11759 self
11760 }
11761}
11762
11763/// Creates transfer runs for a time range [start_time, end_time]. For each date - or whatever granularity the data source supports - in the range, one transfer run is created. Note that runs are created per UTC time in the time range. DEPRECATED: use StartManualTransferRuns instead.
11764///
11765/// A builder for the *transferConfigs.scheduleRuns* method supported by a *project* resource.
11766/// It is not used directly, but through a [`ProjectMethods`] instance.
11767///
11768/// # Example
11769///
11770/// Instantiate a resource method builder
11771///
11772/// ```test_harness,no_run
11773/// # extern crate hyper;
11774/// # extern crate hyper_rustls;
11775/// # extern crate google_bigquerydatatransfer1 as bigquerydatatransfer1;
11776/// use bigquerydatatransfer1::api::ScheduleTransferRunsRequest;
11777/// # async fn dox() {
11778/// # use bigquerydatatransfer1::{BigQueryDataTransfer, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
11779///
11780/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
11781/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
11782/// # .with_native_roots()
11783/// # .unwrap()
11784/// # .https_only()
11785/// # .enable_http2()
11786/// # .build();
11787///
11788/// # let executor = hyper_util::rt::TokioExecutor::new();
11789/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
11790/// # secret,
11791/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
11792/// # yup_oauth2::client::CustomHyperClientBuilder::from(
11793/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
11794/// # ),
11795/// # ).build().await.unwrap();
11796///
11797/// # let client = hyper_util::client::legacy::Client::builder(
11798/// # hyper_util::rt::TokioExecutor::new()
11799/// # )
11800/// # .build(
11801/// # hyper_rustls::HttpsConnectorBuilder::new()
11802/// # .with_native_roots()
11803/// # .unwrap()
11804/// # .https_or_http()
11805/// # .enable_http2()
11806/// # .build()
11807/// # );
11808/// # let mut hub = BigQueryDataTransfer::new(client, auth);
11809/// // As the method needs a request, you would usually fill it with the desired information
11810/// // into the respective structure. Some of the parts shown here might not be applicable !
11811/// // Values shown here are possibly random and not representative !
11812/// let mut req = ScheduleTransferRunsRequest::default();
11813///
11814/// // You can configure optional parameters by calling the respective setters at will, and
11815/// // execute the final call using `doit()`.
11816/// // Values shown here are possibly random and not representative !
11817/// let result = hub.projects().transfer_configs_schedule_runs(req, "parent")
11818/// .doit().await;
11819/// # }
11820/// ```
11821pub struct ProjectTransferConfigScheduleRunCall<'a, C>
11822where
11823 C: 'a,
11824{
11825 hub: &'a BigQueryDataTransfer<C>,
11826 _request: ScheduleTransferRunsRequest,
11827 _parent: String,
11828 _delegate: Option<&'a mut dyn common::Delegate>,
11829 _additional_params: HashMap<String, String>,
11830 _scopes: BTreeSet<String>,
11831}
11832
11833impl<'a, C> common::CallBuilder for ProjectTransferConfigScheduleRunCall<'a, C> {}
11834
11835impl<'a, C> ProjectTransferConfigScheduleRunCall<'a, C>
11836where
11837 C: common::Connector,
11838{
11839 /// Perform the operation you have build so far.
11840 pub async fn doit(
11841 mut self,
11842 ) -> common::Result<(common::Response, ScheduleTransferRunsResponse)> {
11843 use std::borrow::Cow;
11844 use std::io::{Read, Seek};
11845
11846 use common::{url::Params, ToParts};
11847 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
11848
11849 let mut dd = common::DefaultDelegate;
11850 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
11851 dlg.begin(common::MethodInfo {
11852 id: "bigquerydatatransfer.projects.transferConfigs.scheduleRuns",
11853 http_method: hyper::Method::POST,
11854 });
11855
11856 for &field in ["alt", "parent"].iter() {
11857 if self._additional_params.contains_key(field) {
11858 dlg.finished(false);
11859 return Err(common::Error::FieldClash(field));
11860 }
11861 }
11862
11863 let mut params = Params::with_capacity(4 + self._additional_params.len());
11864 params.push("parent", self._parent);
11865
11866 params.extend(self._additional_params.iter());
11867
11868 params.push("alt", "json");
11869 let mut url = self.hub._base_url.clone() + "v1/{+parent}:scheduleRuns";
11870 if self._scopes.is_empty() {
11871 self._scopes
11872 .insert(Scope::CloudPlatform.as_ref().to_string());
11873 }
11874
11875 #[allow(clippy::single_element_loop)]
11876 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
11877 url = params.uri_replacement(url, param_name, find_this, true);
11878 }
11879 {
11880 let to_remove = ["parent"];
11881 params.remove_params(&to_remove);
11882 }
11883
11884 let url = params.parse_with_url(&url);
11885
11886 let mut json_mime_type = mime::APPLICATION_JSON;
11887 let mut request_value_reader = {
11888 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
11889 common::remove_json_null_values(&mut value);
11890 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
11891 serde_json::to_writer(&mut dst, &value).unwrap();
11892 dst
11893 };
11894 let request_size = request_value_reader
11895 .seek(std::io::SeekFrom::End(0))
11896 .unwrap();
11897 request_value_reader
11898 .seek(std::io::SeekFrom::Start(0))
11899 .unwrap();
11900
11901 loop {
11902 let token = match self
11903 .hub
11904 .auth
11905 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
11906 .await
11907 {
11908 Ok(token) => token,
11909 Err(e) => match dlg.token(e) {
11910 Ok(token) => token,
11911 Err(e) => {
11912 dlg.finished(false);
11913 return Err(common::Error::MissingToken(e));
11914 }
11915 },
11916 };
11917 request_value_reader
11918 .seek(std::io::SeekFrom::Start(0))
11919 .unwrap();
11920 let mut req_result = {
11921 let client = &self.hub.client;
11922 dlg.pre_request();
11923 let mut req_builder = hyper::Request::builder()
11924 .method(hyper::Method::POST)
11925 .uri(url.as_str())
11926 .header(USER_AGENT, self.hub._user_agent.clone());
11927
11928 if let Some(token) = token.as_ref() {
11929 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
11930 }
11931
11932 let request = req_builder
11933 .header(CONTENT_TYPE, json_mime_type.to_string())
11934 .header(CONTENT_LENGTH, request_size as u64)
11935 .body(common::to_body(
11936 request_value_reader.get_ref().clone().into(),
11937 ));
11938
11939 client.request(request.unwrap()).await
11940 };
11941
11942 match req_result {
11943 Err(err) => {
11944 if let common::Retry::After(d) = dlg.http_error(&err) {
11945 sleep(d).await;
11946 continue;
11947 }
11948 dlg.finished(false);
11949 return Err(common::Error::HttpError(err));
11950 }
11951 Ok(res) => {
11952 let (mut parts, body) = res.into_parts();
11953 let mut body = common::Body::new(body);
11954 if !parts.status.is_success() {
11955 let bytes = common::to_bytes(body).await.unwrap_or_default();
11956 let error = serde_json::from_str(&common::to_string(&bytes));
11957 let response = common::to_response(parts, bytes.into());
11958
11959 if let common::Retry::After(d) =
11960 dlg.http_failure(&response, error.as_ref().ok())
11961 {
11962 sleep(d).await;
11963 continue;
11964 }
11965
11966 dlg.finished(false);
11967
11968 return Err(match error {
11969 Ok(value) => common::Error::BadRequest(value),
11970 _ => common::Error::Failure(response),
11971 });
11972 }
11973 let response = {
11974 let bytes = common::to_bytes(body).await.unwrap_or_default();
11975 let encoded = common::to_string(&bytes);
11976 match serde_json::from_str(&encoded) {
11977 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
11978 Err(error) => {
11979 dlg.response_json_decode_error(&encoded, &error);
11980 return Err(common::Error::JsonDecodeError(
11981 encoded.to_string(),
11982 error,
11983 ));
11984 }
11985 }
11986 };
11987
11988 dlg.finished(true);
11989 return Ok(response);
11990 }
11991 }
11992 }
11993 }
11994
11995 ///
11996 /// Sets the *request* property to the given value.
11997 ///
11998 /// Even though the property as already been set when instantiating this call,
11999 /// we provide this method for API completeness.
12000 pub fn request(
12001 mut self,
12002 new_value: ScheduleTransferRunsRequest,
12003 ) -> ProjectTransferConfigScheduleRunCall<'a, C> {
12004 self._request = new_value;
12005 self
12006 }
12007 /// Required. Transfer configuration name. If you are using the regionless method, the location must be `US` and the name should be in the following form: * `projects/{project_id}/transferConfigs/{config_id}` If you are using the regionalized method, the name should be in the following form: * `projects/{project_id}/locations/{location_id}/transferConfigs/{config_id}`
12008 ///
12009 /// Sets the *parent* path property to the given value.
12010 ///
12011 /// Even though the property as already been set when instantiating this call,
12012 /// we provide this method for API completeness.
12013 pub fn parent(mut self, new_value: &str) -> ProjectTransferConfigScheduleRunCall<'a, C> {
12014 self._parent = new_value.to_string();
12015 self
12016 }
12017 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
12018 /// while executing the actual API request.
12019 ///
12020 /// ````text
12021 /// It should be used to handle progress information, and to implement a certain level of resilience.
12022 /// ````
12023 ///
12024 /// Sets the *delegate* property to the given value.
12025 pub fn delegate(
12026 mut self,
12027 new_value: &'a mut dyn common::Delegate,
12028 ) -> ProjectTransferConfigScheduleRunCall<'a, C> {
12029 self._delegate = Some(new_value);
12030 self
12031 }
12032
12033 /// Set any additional parameter of the query string used in the request.
12034 /// It should be used to set parameters which are not yet available through their own
12035 /// setters.
12036 ///
12037 /// Please note that this method must not be used to set any of the known parameters
12038 /// which have their own setter method. If done anyway, the request will fail.
12039 ///
12040 /// # Additional Parameters
12041 ///
12042 /// * *$.xgafv* (query-string) - V1 error format.
12043 /// * *access_token* (query-string) - OAuth access token.
12044 /// * *alt* (query-string) - Data format for response.
12045 /// * *callback* (query-string) - JSONP
12046 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
12047 /// * *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.
12048 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
12049 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
12050 /// * *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.
12051 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
12052 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
12053 pub fn param<T>(mut self, name: T, value: T) -> ProjectTransferConfigScheduleRunCall<'a, C>
12054 where
12055 T: AsRef<str>,
12056 {
12057 self._additional_params
12058 .insert(name.as_ref().to_string(), value.as_ref().to_string());
12059 self
12060 }
12061
12062 /// Identifies the authorization scope for the method you are building.
12063 ///
12064 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
12065 /// [`Scope::CloudPlatform`].
12066 ///
12067 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
12068 /// tokens for more than one scope.
12069 ///
12070 /// Usually there is more than one suitable scope to authorize an operation, some of which may
12071 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
12072 /// sufficient, a read-write scope will do as well.
12073 pub fn add_scope<St>(mut self, scope: St) -> ProjectTransferConfigScheduleRunCall<'a, C>
12074 where
12075 St: AsRef<str>,
12076 {
12077 self._scopes.insert(String::from(scope.as_ref()));
12078 self
12079 }
12080 /// Identifies the authorization scope(s) for the method you are building.
12081 ///
12082 /// See [`Self::add_scope()`] for details.
12083 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectTransferConfigScheduleRunCall<'a, C>
12084 where
12085 I: IntoIterator<Item = St>,
12086 St: AsRef<str>,
12087 {
12088 self._scopes
12089 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
12090 self
12091 }
12092
12093 /// Removes all scopes, and no default scope will be used either.
12094 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
12095 /// for details).
12096 pub fn clear_scopes(mut self) -> ProjectTransferConfigScheduleRunCall<'a, C> {
12097 self._scopes.clear();
12098 self
12099 }
12100}
12101
12102/// Manually initiates transfer runs. You can schedule these runs in two ways: 1. For a specific point in time using the 'requested_run_time' parameter. 2. For a period between 'start_time' (inclusive) and 'end_time' (exclusive). If scheduling a single run, it is set to execute immediately (schedule_time equals the current time). When scheduling multiple runs within a time range, the first run starts now, and subsequent runs are delayed by 15 seconds each.
12103///
12104/// A builder for the *transferConfigs.startManualRuns* method supported by a *project* resource.
12105/// It is not used directly, but through a [`ProjectMethods`] instance.
12106///
12107/// # Example
12108///
12109/// Instantiate a resource method builder
12110///
12111/// ```test_harness,no_run
12112/// # extern crate hyper;
12113/// # extern crate hyper_rustls;
12114/// # extern crate google_bigquerydatatransfer1 as bigquerydatatransfer1;
12115/// use bigquerydatatransfer1::api::StartManualTransferRunsRequest;
12116/// # async fn dox() {
12117/// # use bigquerydatatransfer1::{BigQueryDataTransfer, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
12118///
12119/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
12120/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
12121/// # .with_native_roots()
12122/// # .unwrap()
12123/// # .https_only()
12124/// # .enable_http2()
12125/// # .build();
12126///
12127/// # let executor = hyper_util::rt::TokioExecutor::new();
12128/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
12129/// # secret,
12130/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
12131/// # yup_oauth2::client::CustomHyperClientBuilder::from(
12132/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
12133/// # ),
12134/// # ).build().await.unwrap();
12135///
12136/// # let client = hyper_util::client::legacy::Client::builder(
12137/// # hyper_util::rt::TokioExecutor::new()
12138/// # )
12139/// # .build(
12140/// # hyper_rustls::HttpsConnectorBuilder::new()
12141/// # .with_native_roots()
12142/// # .unwrap()
12143/// # .https_or_http()
12144/// # .enable_http2()
12145/// # .build()
12146/// # );
12147/// # let mut hub = BigQueryDataTransfer::new(client, auth);
12148/// // As the method needs a request, you would usually fill it with the desired information
12149/// // into the respective structure. Some of the parts shown here might not be applicable !
12150/// // Values shown here are possibly random and not representative !
12151/// let mut req = StartManualTransferRunsRequest::default();
12152///
12153/// // You can configure optional parameters by calling the respective setters at will, and
12154/// // execute the final call using `doit()`.
12155/// // Values shown here are possibly random and not representative !
12156/// let result = hub.projects().transfer_configs_start_manual_runs(req, "parent")
12157/// .doit().await;
12158/// # }
12159/// ```
12160pub struct ProjectTransferConfigStartManualRunCall<'a, C>
12161where
12162 C: 'a,
12163{
12164 hub: &'a BigQueryDataTransfer<C>,
12165 _request: StartManualTransferRunsRequest,
12166 _parent: String,
12167 _delegate: Option<&'a mut dyn common::Delegate>,
12168 _additional_params: HashMap<String, String>,
12169 _scopes: BTreeSet<String>,
12170}
12171
12172impl<'a, C> common::CallBuilder for ProjectTransferConfigStartManualRunCall<'a, C> {}
12173
12174impl<'a, C> ProjectTransferConfigStartManualRunCall<'a, C>
12175where
12176 C: common::Connector,
12177{
12178 /// Perform the operation you have build so far.
12179 pub async fn doit(
12180 mut self,
12181 ) -> common::Result<(common::Response, StartManualTransferRunsResponse)> {
12182 use std::borrow::Cow;
12183 use std::io::{Read, Seek};
12184
12185 use common::{url::Params, ToParts};
12186 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
12187
12188 let mut dd = common::DefaultDelegate;
12189 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
12190 dlg.begin(common::MethodInfo {
12191 id: "bigquerydatatransfer.projects.transferConfigs.startManualRuns",
12192 http_method: hyper::Method::POST,
12193 });
12194
12195 for &field in ["alt", "parent"].iter() {
12196 if self._additional_params.contains_key(field) {
12197 dlg.finished(false);
12198 return Err(common::Error::FieldClash(field));
12199 }
12200 }
12201
12202 let mut params = Params::with_capacity(4 + self._additional_params.len());
12203 params.push("parent", self._parent);
12204
12205 params.extend(self._additional_params.iter());
12206
12207 params.push("alt", "json");
12208 let mut url = self.hub._base_url.clone() + "v1/{+parent}:startManualRuns";
12209 if self._scopes.is_empty() {
12210 self._scopes
12211 .insert(Scope::CloudPlatform.as_ref().to_string());
12212 }
12213
12214 #[allow(clippy::single_element_loop)]
12215 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
12216 url = params.uri_replacement(url, param_name, find_this, true);
12217 }
12218 {
12219 let to_remove = ["parent"];
12220 params.remove_params(&to_remove);
12221 }
12222
12223 let url = params.parse_with_url(&url);
12224
12225 let mut json_mime_type = mime::APPLICATION_JSON;
12226 let mut request_value_reader = {
12227 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
12228 common::remove_json_null_values(&mut value);
12229 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
12230 serde_json::to_writer(&mut dst, &value).unwrap();
12231 dst
12232 };
12233 let request_size = request_value_reader
12234 .seek(std::io::SeekFrom::End(0))
12235 .unwrap();
12236 request_value_reader
12237 .seek(std::io::SeekFrom::Start(0))
12238 .unwrap();
12239
12240 loop {
12241 let token = match self
12242 .hub
12243 .auth
12244 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
12245 .await
12246 {
12247 Ok(token) => token,
12248 Err(e) => match dlg.token(e) {
12249 Ok(token) => token,
12250 Err(e) => {
12251 dlg.finished(false);
12252 return Err(common::Error::MissingToken(e));
12253 }
12254 },
12255 };
12256 request_value_reader
12257 .seek(std::io::SeekFrom::Start(0))
12258 .unwrap();
12259 let mut req_result = {
12260 let client = &self.hub.client;
12261 dlg.pre_request();
12262 let mut req_builder = hyper::Request::builder()
12263 .method(hyper::Method::POST)
12264 .uri(url.as_str())
12265 .header(USER_AGENT, self.hub._user_agent.clone());
12266
12267 if let Some(token) = token.as_ref() {
12268 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
12269 }
12270
12271 let request = req_builder
12272 .header(CONTENT_TYPE, json_mime_type.to_string())
12273 .header(CONTENT_LENGTH, request_size as u64)
12274 .body(common::to_body(
12275 request_value_reader.get_ref().clone().into(),
12276 ));
12277
12278 client.request(request.unwrap()).await
12279 };
12280
12281 match req_result {
12282 Err(err) => {
12283 if let common::Retry::After(d) = dlg.http_error(&err) {
12284 sleep(d).await;
12285 continue;
12286 }
12287 dlg.finished(false);
12288 return Err(common::Error::HttpError(err));
12289 }
12290 Ok(res) => {
12291 let (mut parts, body) = res.into_parts();
12292 let mut body = common::Body::new(body);
12293 if !parts.status.is_success() {
12294 let bytes = common::to_bytes(body).await.unwrap_or_default();
12295 let error = serde_json::from_str(&common::to_string(&bytes));
12296 let response = common::to_response(parts, bytes.into());
12297
12298 if let common::Retry::After(d) =
12299 dlg.http_failure(&response, error.as_ref().ok())
12300 {
12301 sleep(d).await;
12302 continue;
12303 }
12304
12305 dlg.finished(false);
12306
12307 return Err(match error {
12308 Ok(value) => common::Error::BadRequest(value),
12309 _ => common::Error::Failure(response),
12310 });
12311 }
12312 let response = {
12313 let bytes = common::to_bytes(body).await.unwrap_or_default();
12314 let encoded = common::to_string(&bytes);
12315 match serde_json::from_str(&encoded) {
12316 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
12317 Err(error) => {
12318 dlg.response_json_decode_error(&encoded, &error);
12319 return Err(common::Error::JsonDecodeError(
12320 encoded.to_string(),
12321 error,
12322 ));
12323 }
12324 }
12325 };
12326
12327 dlg.finished(true);
12328 return Ok(response);
12329 }
12330 }
12331 }
12332 }
12333
12334 ///
12335 /// Sets the *request* property to the given value.
12336 ///
12337 /// Even though the property as already been set when instantiating this call,
12338 /// we provide this method for API completeness.
12339 pub fn request(
12340 mut self,
12341 new_value: StartManualTransferRunsRequest,
12342 ) -> ProjectTransferConfigStartManualRunCall<'a, C> {
12343 self._request = new_value;
12344 self
12345 }
12346 /// Required. Transfer configuration name. If you are using the regionless method, the location must be `US` and the name should be in the following form: * `projects/{project_id}/transferConfigs/{config_id}` If you are using the regionalized method, the name should be in the following form: * `projects/{project_id}/locations/{location_id}/transferConfigs/{config_id}`
12347 ///
12348 /// Sets the *parent* path property to the given value.
12349 ///
12350 /// Even though the property as already been set when instantiating this call,
12351 /// we provide this method for API completeness.
12352 pub fn parent(mut self, new_value: &str) -> ProjectTransferConfigStartManualRunCall<'a, C> {
12353 self._parent = new_value.to_string();
12354 self
12355 }
12356 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
12357 /// while executing the actual API request.
12358 ///
12359 /// ````text
12360 /// It should be used to handle progress information, and to implement a certain level of resilience.
12361 /// ````
12362 ///
12363 /// Sets the *delegate* property to the given value.
12364 pub fn delegate(
12365 mut self,
12366 new_value: &'a mut dyn common::Delegate,
12367 ) -> ProjectTransferConfigStartManualRunCall<'a, C> {
12368 self._delegate = Some(new_value);
12369 self
12370 }
12371
12372 /// Set any additional parameter of the query string used in the request.
12373 /// It should be used to set parameters which are not yet available through their own
12374 /// setters.
12375 ///
12376 /// Please note that this method must not be used to set any of the known parameters
12377 /// which have their own setter method. If done anyway, the request will fail.
12378 ///
12379 /// # Additional Parameters
12380 ///
12381 /// * *$.xgafv* (query-string) - V1 error format.
12382 /// * *access_token* (query-string) - OAuth access token.
12383 /// * *alt* (query-string) - Data format for response.
12384 /// * *callback* (query-string) - JSONP
12385 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
12386 /// * *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.
12387 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
12388 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
12389 /// * *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.
12390 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
12391 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
12392 pub fn param<T>(mut self, name: T, value: T) -> ProjectTransferConfigStartManualRunCall<'a, C>
12393 where
12394 T: AsRef<str>,
12395 {
12396 self._additional_params
12397 .insert(name.as_ref().to_string(), value.as_ref().to_string());
12398 self
12399 }
12400
12401 /// Identifies the authorization scope for the method you are building.
12402 ///
12403 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
12404 /// [`Scope::CloudPlatform`].
12405 ///
12406 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
12407 /// tokens for more than one scope.
12408 ///
12409 /// Usually there is more than one suitable scope to authorize an operation, some of which may
12410 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
12411 /// sufficient, a read-write scope will do as well.
12412 pub fn add_scope<St>(mut self, scope: St) -> ProjectTransferConfigStartManualRunCall<'a, C>
12413 where
12414 St: AsRef<str>,
12415 {
12416 self._scopes.insert(String::from(scope.as_ref()));
12417 self
12418 }
12419 /// Identifies the authorization scope(s) for the method you are building.
12420 ///
12421 /// See [`Self::add_scope()`] for details.
12422 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectTransferConfigStartManualRunCall<'a, C>
12423 where
12424 I: IntoIterator<Item = St>,
12425 St: AsRef<str>,
12426 {
12427 self._scopes
12428 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
12429 self
12430 }
12431
12432 /// Removes all scopes, and no default scope will be used either.
12433 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
12434 /// for details).
12435 pub fn clear_scopes(mut self) -> ProjectTransferConfigStartManualRunCall<'a, C> {
12436 self._scopes.clear();
12437 self
12438 }
12439}
12440
12441/// Enroll data sources in a user project. This allows users to create transfer configurations for these data sources. They will also appear in the ListDataSources RPC and as such, will appear in the [BigQuery UI](https://console.cloud.google.com/bigquery), and the documents can be found in the public guide for [BigQuery Web UI](https://cloud.google.com/bigquery/bigquery-web-ui) and [Data Transfer Service](https://cloud.google.com/bigquery/docs/working-with-transfers).
12442///
12443/// A builder for the *enrollDataSources* method supported by a *project* resource.
12444/// It is not used directly, but through a [`ProjectMethods`] instance.
12445///
12446/// # Example
12447///
12448/// Instantiate a resource method builder
12449///
12450/// ```test_harness,no_run
12451/// # extern crate hyper;
12452/// # extern crate hyper_rustls;
12453/// # extern crate google_bigquerydatatransfer1 as bigquerydatatransfer1;
12454/// use bigquerydatatransfer1::api::EnrollDataSourcesRequest;
12455/// # async fn dox() {
12456/// # use bigquerydatatransfer1::{BigQueryDataTransfer, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
12457///
12458/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
12459/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
12460/// # .with_native_roots()
12461/// # .unwrap()
12462/// # .https_only()
12463/// # .enable_http2()
12464/// # .build();
12465///
12466/// # let executor = hyper_util::rt::TokioExecutor::new();
12467/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
12468/// # secret,
12469/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
12470/// # yup_oauth2::client::CustomHyperClientBuilder::from(
12471/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
12472/// # ),
12473/// # ).build().await.unwrap();
12474///
12475/// # let client = hyper_util::client::legacy::Client::builder(
12476/// # hyper_util::rt::TokioExecutor::new()
12477/// # )
12478/// # .build(
12479/// # hyper_rustls::HttpsConnectorBuilder::new()
12480/// # .with_native_roots()
12481/// # .unwrap()
12482/// # .https_or_http()
12483/// # .enable_http2()
12484/// # .build()
12485/// # );
12486/// # let mut hub = BigQueryDataTransfer::new(client, auth);
12487/// // As the method needs a request, you would usually fill it with the desired information
12488/// // into the respective structure. Some of the parts shown here might not be applicable !
12489/// // Values shown here are possibly random and not representative !
12490/// let mut req = EnrollDataSourcesRequest::default();
12491///
12492/// // You can configure optional parameters by calling the respective setters at will, and
12493/// // execute the final call using `doit()`.
12494/// // Values shown here are possibly random and not representative !
12495/// let result = hub.projects().enroll_data_sources(req, "name")
12496/// .doit().await;
12497/// # }
12498/// ```
12499pub struct ProjectEnrollDataSourceCall<'a, C>
12500where
12501 C: 'a,
12502{
12503 hub: &'a BigQueryDataTransfer<C>,
12504 _request: EnrollDataSourcesRequest,
12505 _name: String,
12506 _delegate: Option<&'a mut dyn common::Delegate>,
12507 _additional_params: HashMap<String, String>,
12508 _scopes: BTreeSet<String>,
12509}
12510
12511impl<'a, C> common::CallBuilder for ProjectEnrollDataSourceCall<'a, C> {}
12512
12513impl<'a, C> ProjectEnrollDataSourceCall<'a, C>
12514where
12515 C: common::Connector,
12516{
12517 /// Perform the operation you have build so far.
12518 pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
12519 use std::borrow::Cow;
12520 use std::io::{Read, Seek};
12521
12522 use common::{url::Params, ToParts};
12523 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
12524
12525 let mut dd = common::DefaultDelegate;
12526 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
12527 dlg.begin(common::MethodInfo {
12528 id: "bigquerydatatransfer.projects.enrollDataSources",
12529 http_method: hyper::Method::POST,
12530 });
12531
12532 for &field in ["alt", "name"].iter() {
12533 if self._additional_params.contains_key(field) {
12534 dlg.finished(false);
12535 return Err(common::Error::FieldClash(field));
12536 }
12537 }
12538
12539 let mut params = Params::with_capacity(4 + self._additional_params.len());
12540 params.push("name", self._name);
12541
12542 params.extend(self._additional_params.iter());
12543
12544 params.push("alt", "json");
12545 let mut url = self.hub._base_url.clone() + "v1/{+name}:enrollDataSources";
12546 if self._scopes.is_empty() {
12547 self._scopes
12548 .insert(Scope::CloudPlatform.as_ref().to_string());
12549 }
12550
12551 #[allow(clippy::single_element_loop)]
12552 for &(find_this, param_name) in [("{+name}", "name")].iter() {
12553 url = params.uri_replacement(url, param_name, find_this, true);
12554 }
12555 {
12556 let to_remove = ["name"];
12557 params.remove_params(&to_remove);
12558 }
12559
12560 let url = params.parse_with_url(&url);
12561
12562 let mut json_mime_type = mime::APPLICATION_JSON;
12563 let mut request_value_reader = {
12564 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
12565 common::remove_json_null_values(&mut value);
12566 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
12567 serde_json::to_writer(&mut dst, &value).unwrap();
12568 dst
12569 };
12570 let request_size = request_value_reader
12571 .seek(std::io::SeekFrom::End(0))
12572 .unwrap();
12573 request_value_reader
12574 .seek(std::io::SeekFrom::Start(0))
12575 .unwrap();
12576
12577 loop {
12578 let token = match self
12579 .hub
12580 .auth
12581 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
12582 .await
12583 {
12584 Ok(token) => token,
12585 Err(e) => match dlg.token(e) {
12586 Ok(token) => token,
12587 Err(e) => {
12588 dlg.finished(false);
12589 return Err(common::Error::MissingToken(e));
12590 }
12591 },
12592 };
12593 request_value_reader
12594 .seek(std::io::SeekFrom::Start(0))
12595 .unwrap();
12596 let mut req_result = {
12597 let client = &self.hub.client;
12598 dlg.pre_request();
12599 let mut req_builder = hyper::Request::builder()
12600 .method(hyper::Method::POST)
12601 .uri(url.as_str())
12602 .header(USER_AGENT, self.hub._user_agent.clone());
12603
12604 if let Some(token) = token.as_ref() {
12605 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
12606 }
12607
12608 let request = req_builder
12609 .header(CONTENT_TYPE, json_mime_type.to_string())
12610 .header(CONTENT_LENGTH, request_size as u64)
12611 .body(common::to_body(
12612 request_value_reader.get_ref().clone().into(),
12613 ));
12614
12615 client.request(request.unwrap()).await
12616 };
12617
12618 match req_result {
12619 Err(err) => {
12620 if let common::Retry::After(d) = dlg.http_error(&err) {
12621 sleep(d).await;
12622 continue;
12623 }
12624 dlg.finished(false);
12625 return Err(common::Error::HttpError(err));
12626 }
12627 Ok(res) => {
12628 let (mut parts, body) = res.into_parts();
12629 let mut body = common::Body::new(body);
12630 if !parts.status.is_success() {
12631 let bytes = common::to_bytes(body).await.unwrap_or_default();
12632 let error = serde_json::from_str(&common::to_string(&bytes));
12633 let response = common::to_response(parts, bytes.into());
12634
12635 if let common::Retry::After(d) =
12636 dlg.http_failure(&response, error.as_ref().ok())
12637 {
12638 sleep(d).await;
12639 continue;
12640 }
12641
12642 dlg.finished(false);
12643
12644 return Err(match error {
12645 Ok(value) => common::Error::BadRequest(value),
12646 _ => common::Error::Failure(response),
12647 });
12648 }
12649 let response = {
12650 let bytes = common::to_bytes(body).await.unwrap_or_default();
12651 let encoded = common::to_string(&bytes);
12652 match serde_json::from_str(&encoded) {
12653 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
12654 Err(error) => {
12655 dlg.response_json_decode_error(&encoded, &error);
12656 return Err(common::Error::JsonDecodeError(
12657 encoded.to_string(),
12658 error,
12659 ));
12660 }
12661 }
12662 };
12663
12664 dlg.finished(true);
12665 return Ok(response);
12666 }
12667 }
12668 }
12669 }
12670
12671 ///
12672 /// Sets the *request* property to the given value.
12673 ///
12674 /// Even though the property as already been set when instantiating this call,
12675 /// we provide this method for API completeness.
12676 pub fn request(
12677 mut self,
12678 new_value: EnrollDataSourcesRequest,
12679 ) -> ProjectEnrollDataSourceCall<'a, C> {
12680 self._request = new_value;
12681 self
12682 }
12683 /// Required. The name of the project resource in the form: `projects/{project_id}`
12684 ///
12685 /// Sets the *name* path property to the given value.
12686 ///
12687 /// Even though the property as already been set when instantiating this call,
12688 /// we provide this method for API completeness.
12689 pub fn name(mut self, new_value: &str) -> ProjectEnrollDataSourceCall<'a, C> {
12690 self._name = new_value.to_string();
12691 self
12692 }
12693 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
12694 /// while executing the actual API request.
12695 ///
12696 /// ````text
12697 /// It should be used to handle progress information, and to implement a certain level of resilience.
12698 /// ````
12699 ///
12700 /// Sets the *delegate* property to the given value.
12701 pub fn delegate(
12702 mut self,
12703 new_value: &'a mut dyn common::Delegate,
12704 ) -> ProjectEnrollDataSourceCall<'a, C> {
12705 self._delegate = Some(new_value);
12706 self
12707 }
12708
12709 /// Set any additional parameter of the query string used in the request.
12710 /// It should be used to set parameters which are not yet available through their own
12711 /// setters.
12712 ///
12713 /// Please note that this method must not be used to set any of the known parameters
12714 /// which have their own setter method. If done anyway, the request will fail.
12715 ///
12716 /// # Additional Parameters
12717 ///
12718 /// * *$.xgafv* (query-string) - V1 error format.
12719 /// * *access_token* (query-string) - OAuth access token.
12720 /// * *alt* (query-string) - Data format for response.
12721 /// * *callback* (query-string) - JSONP
12722 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
12723 /// * *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.
12724 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
12725 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
12726 /// * *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.
12727 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
12728 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
12729 pub fn param<T>(mut self, name: T, value: T) -> ProjectEnrollDataSourceCall<'a, C>
12730 where
12731 T: AsRef<str>,
12732 {
12733 self._additional_params
12734 .insert(name.as_ref().to_string(), value.as_ref().to_string());
12735 self
12736 }
12737
12738 /// Identifies the authorization scope for the method you are building.
12739 ///
12740 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
12741 /// [`Scope::CloudPlatform`].
12742 ///
12743 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
12744 /// tokens for more than one scope.
12745 ///
12746 /// Usually there is more than one suitable scope to authorize an operation, some of which may
12747 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
12748 /// sufficient, a read-write scope will do as well.
12749 pub fn add_scope<St>(mut self, scope: St) -> ProjectEnrollDataSourceCall<'a, C>
12750 where
12751 St: AsRef<str>,
12752 {
12753 self._scopes.insert(String::from(scope.as_ref()));
12754 self
12755 }
12756 /// Identifies the authorization scope(s) for the method you are building.
12757 ///
12758 /// See [`Self::add_scope()`] for details.
12759 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectEnrollDataSourceCall<'a, C>
12760 where
12761 I: IntoIterator<Item = St>,
12762 St: AsRef<str>,
12763 {
12764 self._scopes
12765 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
12766 self
12767 }
12768
12769 /// Removes all scopes, and no default scope will be used either.
12770 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
12771 /// for details).
12772 pub fn clear_scopes(mut self) -> ProjectEnrollDataSourceCall<'a, C> {
12773 self._scopes.clear();
12774 self
12775 }
12776}