google_file1_beta1/
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    /// See, edit, configure, and delete your Google Cloud data and see the email address for your Google Account.
17    CloudPlatform,
18}
19
20impl AsRef<str> for Scope {
21    fn as_ref(&self) -> &str {
22        match *self {
23            Scope::CloudPlatform => "https://www.googleapis.com/auth/cloud-platform",
24        }
25    }
26}
27
28#[allow(clippy::derivable_impls)]
29impl Default for Scope {
30    fn default() -> Scope {
31        Scope::CloudPlatform
32    }
33}
34
35// ########
36// HUB ###
37// ######
38
39/// Central instance to access all CloudFilestore related resource activities
40///
41/// # Examples
42///
43/// Instantiate a new hub
44///
45/// ```test_harness,no_run
46/// extern crate hyper;
47/// extern crate hyper_rustls;
48/// extern crate google_file1_beta1 as file1_beta1;
49/// use file1_beta1::api::Backup;
50/// use file1_beta1::{Result, Error};
51/// # async fn dox() {
52/// use file1_beta1::{CloudFilestore, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
53///
54/// // Get an ApplicationSecret instance by some means. It contains the `client_id` and
55/// // `client_secret`, among other things.
56/// let secret: yup_oauth2::ApplicationSecret = Default::default();
57/// // Instantiate the authenticator. It will choose a suitable authentication flow for you,
58/// // unless you replace  `None` with the desired Flow.
59/// // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about
60/// // what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and
61/// // retrieve them from storage.
62/// let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
63///     secret,
64///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
65/// ).build().await.unwrap();
66///
67/// let client = hyper_util::client::legacy::Client::builder(
68///     hyper_util::rt::TokioExecutor::new()
69/// )
70/// .build(
71///     hyper_rustls::HttpsConnectorBuilder::new()
72///         .with_native_roots()
73///         .unwrap()
74///         .https_or_http()
75///         .enable_http1()
76///         .build()
77/// );
78/// let mut hub = CloudFilestore::new(client, auth);
79/// // As the method needs a request, you would usually fill it with the desired information
80/// // into the respective structure. Some of the parts shown here might not be applicable !
81/// // Values shown here are possibly random and not representative !
82/// let mut req = Backup::default();
83///
84/// // You can configure optional parameters by calling the respective setters at will, and
85/// // execute the final call using `doit()`.
86/// // Values shown here are possibly random and not representative !
87/// let result = hub.projects().locations_backups_create(req, "parent")
88///              .backup_id("At")
89///              .doit().await;
90///
91/// match result {
92///     Err(e) => match e {
93///         // The Error enum provides details about what exactly happened.
94///         // You can also just use its `Debug`, `Display` or `Error` traits
95///          Error::HttpError(_)
96///         |Error::Io(_)
97///         |Error::MissingAPIKey
98///         |Error::MissingToken(_)
99///         |Error::Cancelled
100///         |Error::UploadSizeLimitExceeded(_, _)
101///         |Error::Failure(_)
102///         |Error::BadRequest(_)
103///         |Error::FieldClash(_)
104///         |Error::JsonDecodeError(_, _) => println!("{}", e),
105///     },
106///     Ok(res) => println!("Success: {:?}", res),
107/// }
108/// # }
109/// ```
110#[derive(Clone)]
111pub struct CloudFilestore<C> {
112    pub client: common::Client<C>,
113    pub auth: Box<dyn common::GetToken>,
114    _user_agent: String,
115    _base_url: String,
116    _root_url: String,
117}
118
119impl<C> common::Hub for CloudFilestore<C> {}
120
121impl<'a, C> CloudFilestore<C> {
122    pub fn new<A: 'static + common::GetToken>(
123        client: common::Client<C>,
124        auth: A,
125    ) -> CloudFilestore<C> {
126        CloudFilestore {
127            client,
128            auth: Box::new(auth),
129            _user_agent: "google-api-rust-client/6.0.0".to_string(),
130            _base_url: "https://file.googleapis.com/".to_string(),
131            _root_url: "https://file.googleapis.com/".to_string(),
132        }
133    }
134
135    pub fn projects(&'a self) -> ProjectMethods<'a, C> {
136        ProjectMethods { hub: self }
137    }
138
139    /// Set the user-agent header field to use in all requests to the server.
140    /// It defaults to `google-api-rust-client/6.0.0`.
141    ///
142    /// Returns the previously set user-agent.
143    pub fn user_agent(&mut self, agent_name: String) -> String {
144        std::mem::replace(&mut self._user_agent, agent_name)
145    }
146
147    /// Set the base url to use in all requests to the server.
148    /// It defaults to `https://file.googleapis.com/`.
149    ///
150    /// Returns the previously set base url.
151    pub fn base_url(&mut self, new_base_url: String) -> String {
152        std::mem::replace(&mut self._base_url, new_base_url)
153    }
154
155    /// Set the root url to use in all requests to the server.
156    /// It defaults to `https://file.googleapis.com/`.
157    ///
158    /// Returns the previously set root url.
159    pub fn root_url(&mut self, new_root_url: String) -> String {
160        std::mem::replace(&mut self._root_url, new_root_url)
161    }
162}
163
164// ############
165// SCHEMAS ###
166// ##########
167/// A Filestore backup.
168///
169/// # Activities
170///
171/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
172/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
173///
174/// * [locations backups create projects](ProjectLocationBackupCreateCall) (request)
175/// * [locations backups get projects](ProjectLocationBackupGetCall) (response)
176/// * [locations backups patch projects](ProjectLocationBackupPatchCall) (request)
177#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
178#[serde_with::serde_as]
179#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
180pub struct Backup {
181    /// Output only. Capacity of the source file share when the backup was created.
182    #[serde(rename = "capacityGb")]
183    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
184    pub capacity_gb: Option<i64>,
185    /// Output only. The time when the backup was created.
186    #[serde(rename = "createTime")]
187    pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
188    /// A description of the backup with 2048 characters or less. Requests with longer descriptions will be rejected.
189    pub description: Option<String>,
190    /// Output only. Amount of bytes that will be downloaded if the backup is restored
191    #[serde(rename = "downloadBytes")]
192    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
193    pub download_bytes: Option<i64>,
194    /// Immutable. KMS key name used for data encryption.
195    #[serde(rename = "kmsKeyName")]
196    pub kms_key_name: Option<String>,
197    /// Resource labels to represent user provided metadata.
198    pub labels: Option<HashMap<String, String>>,
199    /// Output only. The resource name of the backup, in the format `projects/{project_id}/locations/{location_id}/backups/{backup_id}`.
200    pub name: Option<String>,
201    /// Output only. Reserved for future use.
202    #[serde(rename = "satisfiesPzi")]
203    pub satisfies_pzi: Option<bool>,
204    /// Output only. Reserved for future use.
205    #[serde(rename = "satisfiesPzs")]
206    pub satisfies_pzs: Option<bool>,
207    /// Name of the file share in the source Filestore instance that the backup is created from.
208    #[serde(rename = "sourceFileShare")]
209    pub source_file_share: Option<String>,
210    /// The resource name of the source Filestore instance, in the format `projects/{project_id}/locations/{location_id}/instances/{instance_id}`, used to create this backup.
211    #[serde(rename = "sourceInstance")]
212    pub source_instance: Option<String>,
213    /// Output only. The service tier of the source Filestore instance that this backup is created from.
214    #[serde(rename = "sourceInstanceTier")]
215    pub source_instance_tier: Option<String>,
216    /// Output only. The backup state.
217    pub state: Option<String>,
218    /// Output only. The size of the storage used by the backup. As backups share storage, this number is expected to change with backup creation/deletion.
219    #[serde(rename = "storageBytes")]
220    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
221    pub storage_bytes: Option<i64>,
222    /// Optional. Input only. Immutable. Tag keys/values directly bound to this resource. For example: "123/environment": "production", "123/costCenter": "marketing"
223    pub tags: Option<HashMap<String, String>>,
224}
225
226impl common::RequestValue for Backup {}
227impl common::ResponseResult for Backup {}
228
229/// The request message for Operations.CancelOperation.
230///
231/// # Activities
232///
233/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
234/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
235///
236/// * [locations operations cancel projects](ProjectLocationOperationCancelCall) (request)
237#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
238#[serde_with::serde_as]
239#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
240pub struct CancelOperationRequest {
241    _never_set: Option<bool>,
242}
243
244impl common::RequestValue for CancelOperationRequest {}
245
246/// Directory Services configuration for Kerberos-based authentication.
247///
248/// This type is not used in any activity, and only used as *part* of another schema.
249///
250#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
251#[serde_with::serde_as]
252#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
253pub struct DirectoryServicesConfig {
254    /// Configuration for Managed Service for Microsoft Active Directory.
255    #[serde(rename = "managedActiveDirectory")]
256    pub managed_active_directory: Option<ManagedActiveDirectoryConfig>,
257}
258
259impl common::Part for DirectoryServicesConfig {}
260
261/// 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); }
262///
263/// # Activities
264///
265/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
266/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
267///
268/// * [locations operations cancel projects](ProjectLocationOperationCancelCall) (response)
269/// * [locations operations delete projects](ProjectLocationOperationDeleteCall) (response)
270#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
271#[serde_with::serde_as]
272#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
273pub struct Empty {
274    _never_set: Option<bool>,
275}
276
277impl common::ResponseResult for Empty {}
278
279/// File share configuration for the instance.
280///
281/// This type is not used in any activity, and only used as *part* of another schema.
282///
283#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
284#[serde_with::serde_as]
285#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
286pub struct FileShareConfig {
287    /// File share capacity in gigabytes (GB). Filestore defines 1 GB as 1024^3 bytes.
288    #[serde(rename = "capacityGb")]
289    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
290    pub capacity_gb: Option<i64>,
291    /// Required. The name of the file share. Must use 1-16 characters for the basic service tier and 1-63 characters for all other service tiers. Must use lowercase letters, numbers, or underscores `[a-z0-9_]`. Must start with a letter. Immutable.
292    pub name: Option<String>,
293    /// Nfs Export Options. There is a limit of 10 export options per file share.
294    #[serde(rename = "nfsExportOptions")]
295    pub nfs_export_options: Option<Vec<NfsExportOptions>>,
296    /// Optional. Used to configure performance.
297    #[serde(rename = "performanceConfig")]
298    pub performance_config: Option<PerformanceConfig>,
299    /// Output only. Used for getting performance limits.
300    #[serde(rename = "performanceLimits")]
301    pub performance_limits: Option<PerformanceLimits>,
302    /// The resource name of the backup, in the format `projects/{project_id}/locations/{location_id}/backups/{backup_id}`, that this file share has been restored from.
303    #[serde(rename = "sourceBackup")]
304    pub source_backup: Option<String>,
305}
306
307impl common::Part for FileShareConfig {}
308
309/// Fixed IOPS parameters.
310///
311/// This type is not used in any activity, and only used as *part* of another schema.
312///
313#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
314#[serde_with::serde_as]
315#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
316pub struct FixedIOPS {
317    /// Required. Maximum raw read IOPS.
318    #[serde(rename = "maxReadIops")]
319    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
320    pub max_read_iops: Option<i64>,
321}
322
323impl common::Part for FixedIOPS {}
324
325/// IOPS per capacity parameters.
326///
327/// This type is not used in any activity, and only used as *part* of another schema.
328///
329#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
330#[serde_with::serde_as]
331#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
332pub struct IOPSPerGB {
333    /// Required. Maximum read IOPS per GB.
334    #[serde(rename = "maxReadIopsPerGb")]
335    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
336    pub max_read_iops_per_gb: Option<i64>,
337}
338
339impl common::Part for IOPSPerGB {}
340
341/// A Filestore instance.
342///
343/// # Activities
344///
345/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
346/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
347///
348/// * [locations instances create projects](ProjectLocationInstanceCreateCall) (request)
349/// * [locations instances get projects](ProjectLocationInstanceGetCall) (response)
350/// * [locations instances patch projects](ProjectLocationInstancePatchCall) (request)
351#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
352#[serde_with::serde_as]
353#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
354pub struct Instance {
355    /// The storage capacity of the instance in gigabytes (GB = 1024^3 bytes). This capacity can be increased up to `max_capacity_gb` GB in multipliers of `capacity_step_size_gb` GB.
356    #[serde(rename = "capacityGb")]
357    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
358    pub capacity_gb: Option<i64>,
359    /// Output only. The increase/decrease capacity step size.
360    #[serde(rename = "capacityStepSizeGb")]
361    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
362    pub capacity_step_size_gb: Option<i64>,
363    /// Output only. The time when the instance was created.
364    #[serde(rename = "createTime")]
365    pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
366    /// The description of the instance (2048 characters or less).
367    pub description: Option<String>,
368    /// Optional. Directory Services configuration for Kerberos-based authentication. Should only be set if protocol is "NFS_V4_1".
369    #[serde(rename = "directoryServices")]
370    pub directory_services: Option<DirectoryServicesConfig>,
371    /// Server-specified ETag for the instance resource to prevent simultaneous updates from overwriting each other.
372    pub etag: Option<String>,
373    /// File system shares on the instance. For this version, only a single file share is supported.
374    #[serde(rename = "fileShares")]
375    pub file_shares: Option<Vec<FileShareConfig>>,
376    /// KMS key name used for data encryption.
377    #[serde(rename = "kmsKeyName")]
378    pub kms_key_name: Option<String>,
379    /// Resource labels to represent user provided metadata.
380    pub labels: Option<HashMap<String, String>>,
381    /// Output only. The max capacity of the instance.
382    #[serde(rename = "maxCapacityGb")]
383    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
384    pub max_capacity_gb: Option<i64>,
385    /// The max number of shares allowed.
386    #[serde(rename = "maxShareCount")]
387    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
388    pub max_share_count: Option<i64>,
389    /// Indicates whether this instance uses a multi-share configuration with which it can have more than one file-share or none at all. File-shares are added, updated and removed through the separate file-share APIs.
390    #[serde(rename = "multiShareEnabled")]
391    pub multi_share_enabled: Option<bool>,
392    /// Output only. The resource name of the instance, in the format `projects/{project_id}/locations/{location_id}/instances/{instance_id}`.
393    pub name: Option<String>,
394    /// VPC networks to which the instance is connected. For this version, only a single network is supported.
395    pub networks: Option<Vec<NetworkConfig>>,
396    /// Immutable. The protocol indicates the access protocol for all shares in the instance. This field is immutable and it cannot be changed after the instance has been created. Default value: `NFS_V3`.
397    pub protocol: Option<String>,
398    /// Optional. Replicaition configuration.
399    pub replication: Option<Replication>,
400    /// Output only. Reserved for future use.
401    #[serde(rename = "satisfiesPzi")]
402    pub satisfies_pzi: Option<bool>,
403    /// Output only. Reserved for future use.
404    #[serde(rename = "satisfiesPzs")]
405    pub satisfies_pzs: Option<bool>,
406    /// Output only. The instance state.
407    pub state: Option<String>,
408    /// Output only. Additional information about the instance state, if available.
409    #[serde(rename = "statusMessage")]
410    pub status_message: Option<String>,
411    /// Output only. Field indicates all the reasons the instance is in "SUSPENDED" state.
412    #[serde(rename = "suspensionReasons")]
413    pub suspension_reasons: Option<Vec<String>>,
414    /// Optional. Input only. Immutable. Tag keys/values directly bound to this resource. For example: "123/environment": "production", "123/costCenter": "marketing"
415    pub tags: Option<HashMap<String, String>>,
416    /// The service tier of the instance.
417    pub tier: Option<String>,
418}
419
420impl common::RequestValue for Instance {}
421impl common::ResponseResult for Instance {}
422
423/// ListBackupsResponse is the result of ListBackupsRequest.
424///
425/// # Activities
426///
427/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
428/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
429///
430/// * [locations backups list projects](ProjectLocationBackupListCall) (response)
431#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
432#[serde_with::serde_as]
433#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
434pub struct ListBackupsResponse {
435    /// A list of backups in the project for the specified location. If the `{location}` value in the request is "-", the response contains a list of backups from all locations. If any location is unreachable, the response will only return backups in reachable locations and the "unreachable" field will be populated with a list of unreachable locations.
436    pub backups: Option<Vec<Backup>>,
437    /// The token you can use to retrieve the next page of results. Not returned if there are no more results in the list.
438    #[serde(rename = "nextPageToken")]
439    pub next_page_token: Option<String>,
440    /// Locations that could not be reached.
441    pub unreachable: Option<Vec<String>>,
442}
443
444impl common::ResponseResult for ListBackupsResponse {}
445
446/// ListInstancesResponse is the result of ListInstancesRequest.
447///
448/// # Activities
449///
450/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
451/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
452///
453/// * [locations instances list projects](ProjectLocationInstanceListCall) (response)
454#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
455#[serde_with::serde_as]
456#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
457pub struct ListInstancesResponse {
458    /// A list of instances in the project for the specified location. If the `{location}` value in the request is "-", the response contains a list of instances from all locations. If any location is unreachable, the response will only return instances in reachable locations and the "unreachable" field will be populated with a list of unreachable locations.
459    pub instances: Option<Vec<Instance>>,
460    /// The token you can use to retrieve the next page of results. Not returned if there are no more results in the list.
461    #[serde(rename = "nextPageToken")]
462    pub next_page_token: Option<String>,
463    /// Locations that could not be reached.
464    pub unreachable: Option<Vec<String>>,
465}
466
467impl common::ResponseResult for ListInstancesResponse {}
468
469/// The response message for Locations.ListLocations.
470///
471/// # Activities
472///
473/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
474/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
475///
476/// * [locations list projects](ProjectLocationListCall) (response)
477#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
478#[serde_with::serde_as]
479#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
480pub struct ListLocationsResponse {
481    /// A list of locations that matches the specified filter in the request.
482    pub locations: Option<Vec<Location>>,
483    /// The standard List next-page token.
484    #[serde(rename = "nextPageToken")]
485    pub next_page_token: Option<String>,
486}
487
488impl common::ResponseResult for ListLocationsResponse {}
489
490/// The response message for Operations.ListOperations.
491///
492/// # Activities
493///
494/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
495/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
496///
497/// * [locations operations list projects](ProjectLocationOperationListCall) (response)
498#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
499#[serde_with::serde_as]
500#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
501pub struct ListOperationsResponse {
502    /// The standard List next-page token.
503    #[serde(rename = "nextPageToken")]
504    pub next_page_token: Option<String>,
505    /// A list of operations that matches the specified filter in the request.
506    pub operations: Option<Vec<Operation>>,
507}
508
509impl common::ResponseResult for ListOperationsResponse {}
510
511/// ListSharesResponse is the result of ListSharesRequest.
512///
513/// # Activities
514///
515/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
516/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
517///
518/// * [locations instances shares list projects](ProjectLocationInstanceShareListCall) (response)
519#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
520#[serde_with::serde_as]
521#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
522pub struct ListSharesResponse {
523    /// The token you can use to retrieve the next page of results. Not returned if there are no more results in the list.
524    #[serde(rename = "nextPageToken")]
525    pub next_page_token: Option<String>,
526    /// A list of shares in the project for the specified instance.
527    pub shares: Option<Vec<Share>>,
528    /// Locations that could not be reached.
529    pub unreachable: Option<Vec<String>>,
530}
531
532impl common::ResponseResult for ListSharesResponse {}
533
534/// ListSnapshotsResponse is the result of ListSnapshotsRequest.
535///
536/// # Activities
537///
538/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
539/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
540///
541/// * [locations instances snapshots list projects](ProjectLocationInstanceSnapshotListCall) (response)
542#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
543#[serde_with::serde_as]
544#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
545pub struct ListSnapshotsResponse {
546    /// The token you can use to retrieve the next page of results. Not returned if there are no more results in the list.
547    #[serde(rename = "nextPageToken")]
548    pub next_page_token: Option<String>,
549    /// A list of snapshots in the project for the specified instance.
550    pub snapshots: Option<Vec<Snapshot>>,
551}
552
553impl common::ResponseResult for ListSnapshotsResponse {}
554
555/// A resource that represents a Google Cloud location.
556///
557/// # Activities
558///
559/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
560/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
561///
562/// * [locations get projects](ProjectLocationGetCall) (response)
563#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
564#[serde_with::serde_as]
565#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
566pub struct Location {
567    /// The friendly name for this location, typically a nearby city name. For example, "Tokyo".
568    #[serde(rename = "displayName")]
569    pub display_name: Option<String>,
570    /// Cross-service attributes for the location. For example {"cloud.googleapis.com/region": "us-east1"}
571    pub labels: Option<HashMap<String, String>>,
572    /// The canonical id for this location. For example: `"us-east1"`.
573    #[serde(rename = "locationId")]
574    pub location_id: Option<String>,
575    /// Service-specific metadata. For example the available capacity at the given location.
576    pub metadata: Option<HashMap<String, serde_json::Value>>,
577    /// Resource name for the location, which may vary between implementations. For example: `"projects/example-project/locations/us-east1"`
578    pub name: Option<String>,
579}
580
581impl common::ResponseResult for Location {}
582
583/// ManagedActiveDirectoryConfig contains all the parameters for connecting to Managed Active Directory.
584///
585/// This type is not used in any activity, and only used as *part* of another schema.
586///
587#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
588#[serde_with::serde_as]
589#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
590pub struct ManagedActiveDirectoryConfig {
591    /// Required. The computer name is used as a prefix to the mount remote target. Example: if the computer is `my-computer`, the mount command will look like: `$mount -o vers=4.1,sec=krb5 my-computer.filestore.: `.
592    pub computer: Option<String>,
593    /// Required. The domain resource name, in the format `projects/{project_id}/locations/global/domains/{domain}`.
594    pub domain: Option<String>,
595}
596
597impl common::Part for ManagedActiveDirectoryConfig {}
598
599/// Network configuration for the instance.
600///
601/// This type is not used in any activity, and only used as *part* of another schema.
602///
603#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
604#[serde_with::serde_as]
605#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
606pub struct NetworkConfig {
607    /// The network connect mode of the Filestore instance. If not provided, the connect mode defaults to DIRECT_PEERING.
608    #[serde(rename = "connectMode")]
609    pub connect_mode: Option<String>,
610    /// Output only. IPv4 addresses in the format `{octet1}.{octet2}.{octet3}.{octet4}` or IPv6 addresses in the format `{block1}:{block2}:{block3}:{block4}:{block5}:{block6}:{block7}:{block8}`.
611    #[serde(rename = "ipAddresses")]
612    pub ip_addresses: Option<Vec<String>>,
613    /// Internet protocol versions for which the instance has IP addresses assigned. For this version, only MODE_IPV4 is supported.
614    pub modes: Option<Vec<String>>,
615    /// The name of the Google Compute Engine [VPC network](https://cloud.google.com/vpc/docs/vpc) to which the instance is connected.
616    pub network: Option<String>,
617    /// Optional, reserved_ip_range can have one of the following two types of values. * CIDR range value when using DIRECT_PEERING connect mode. * [Allocated IP address range](https://cloud.google.com/compute/docs/ip-addresses/reserve-static-internal-ip-address) when using PRIVATE_SERVICE_ACCESS connect mode. When the name of an allocated IP address range is specified, it must be one of the ranges associated with the private service access connection. When specified as a direct CIDR value, it must be a /29 CIDR block for Basic tier, a /24 CIDR block for High Scale tier, or a /26 CIDR block for Enterprise tier in one of the [internal IP address ranges](https://www.arin.net/reference/research/statistics/address_filters/) that identifies the range of IP addresses reserved for this instance. For example, 10.0.0.0/29, 192.168.0.0/24, or 192.168.0.0/26, respectively. The range you specify can't overlap with either existing subnets or assigned IP address ranges for other Filestore instances in the selected VPC network.
618    #[serde(rename = "reservedIpRange")]
619    pub reserved_ip_range: Option<String>,
620}
621
622impl common::Part for NetworkConfig {}
623
624/// NFS export options specifications.
625///
626/// This type is not used in any activity, and only used as *part* of another schema.
627///
628#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
629#[serde_with::serde_as]
630#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
631pub struct NfsExportOptions {
632    /// Either READ_ONLY, for allowing only read requests on the exported directory, or READ_WRITE, for allowing both read and write requests. The default is READ_WRITE.
633    #[serde(rename = "accessMode")]
634    pub access_mode: Option<String>,
635    /// An integer representing the anonymous group id with a default value of 65534. Anon_gid may only be set with squash_mode of ROOT_SQUASH. An error will be returned if this field is specified for other squash_mode settings.
636    #[serde(rename = "anonGid")]
637    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
638    pub anon_gid: Option<i64>,
639    /// An integer representing the anonymous user id with a default value of 65534. Anon_uid may only be set with squash_mode of ROOT_SQUASH. An error will be returned if this field is specified for other squash_mode settings.
640    #[serde(rename = "anonUid")]
641    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
642    pub anon_uid: Option<i64>,
643    /// List of either an IPv4 addresses in the format `{octet1}.{octet2}.{octet3}.{octet4}` or CIDR ranges in the format `{octet1}.{octet2}.{octet3}.{octet4}/{mask size}` which may mount the file share. Overlapping IP ranges are not allowed, both within and across NfsExportOptions. An error will be returned. The limit is 64 IP ranges/addresses for each FileShareConfig among all NfsExportOptions.
644    #[serde(rename = "ipRanges")]
645    pub ip_ranges: Option<Vec<String>>,
646    /// The security flavors allowed for mount operations. The default is AUTH_SYS.
647    #[serde(rename = "securityFlavors")]
648    pub security_flavors: Option<Vec<String>>,
649    /// Either NO_ROOT_SQUASH, for allowing root access on the exported directory, or ROOT_SQUASH, for not allowing root access. The default is NO_ROOT_SQUASH.
650    #[serde(rename = "squashMode")]
651    pub squash_mode: Option<String>,
652}
653
654impl common::Part for NfsExportOptions {}
655
656/// This resource represents a long-running operation that is the result of a network API call.
657///
658/// # Activities
659///
660/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
661/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
662///
663/// * [locations backups create projects](ProjectLocationBackupCreateCall) (response)
664/// * [locations backups delete projects](ProjectLocationBackupDeleteCall) (response)
665/// * [locations backups patch projects](ProjectLocationBackupPatchCall) (response)
666/// * [locations instances shares create projects](ProjectLocationInstanceShareCreateCall) (response)
667/// * [locations instances shares delete projects](ProjectLocationInstanceShareDeleteCall) (response)
668/// * [locations instances shares patch projects](ProjectLocationInstanceSharePatchCall) (response)
669/// * [locations instances snapshots create projects](ProjectLocationInstanceSnapshotCreateCall) (response)
670/// * [locations instances snapshots delete projects](ProjectLocationInstanceSnapshotDeleteCall) (response)
671/// * [locations instances snapshots patch projects](ProjectLocationInstanceSnapshotPatchCall) (response)
672/// * [locations instances create projects](ProjectLocationInstanceCreateCall) (response)
673/// * [locations instances delete projects](ProjectLocationInstanceDeleteCall) (response)
674/// * [locations instances patch projects](ProjectLocationInstancePatchCall) (response)
675/// * [locations instances promote replica projects](ProjectLocationInstancePromoteReplicaCall) (response)
676/// * [locations instances restore projects](ProjectLocationInstanceRestoreCall) (response)
677/// * [locations instances revert projects](ProjectLocationInstanceRevertCall) (response)
678/// * [locations operations get projects](ProjectLocationOperationGetCall) (response)
679#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
680#[serde_with::serde_as]
681#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
682pub struct Operation {
683    /// If the value is `false`, it means the operation is still in progress. If `true`, the operation is completed, and either `error` or `response` is available.
684    pub done: Option<bool>,
685    /// The error result of the operation in case of failure or cancellation.
686    pub error: Option<Status>,
687    /// Service-specific metadata associated with the operation. It typically contains progress information and common metadata such as create time. Some services might not provide such metadata. Any method that returns a long-running operation should document the metadata type, if any.
688    pub metadata: Option<HashMap<String, serde_json::Value>>,
689    /// The server-assigned name, which is only unique within the same service that originally returns it. If you use the default HTTP mapping, the `name` should be a resource name ending with `operations/{unique_id}`.
690    pub name: Option<String>,
691    /// The normal, successful response of the operation. If the original method returns no data on success, such as `Delete`, the response is `google.protobuf.Empty`. If the original method is standard `Get`/`Create`/`Update`, the response should be the resource. For other methods, the response should have the type `XxxResponse`, where `Xxx` is the original method name. For example, if the original method name is `TakeSnapshot()`, the inferred response type is `TakeSnapshotResponse`.
692    pub response: Option<HashMap<String, serde_json::Value>>,
693}
694
695impl common::ResponseResult for Operation {}
696
697/// Performance configuration. Used for setting the performance configuration. Defaults to `iops_by_capacity` if unset in instance creation.
698///
699/// This type is not used in any activity, and only used as *part* of another schema.
700///
701#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
702#[serde_with::serde_as]
703#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
704pub struct PerformanceConfig {
705    /// Choose a fixed provisioned IOPS value for the instance, which will remain constant regardless of instance capacity. Value must be a multiple of 1000. If the chosen value is outside the supported range for the instance's capacity during instance creation, instance creation will fail with an `InvalidArgument` error. Similarly, if an instance capacity update would result in a value outside the supported range, the update will fail with an `InvalidArgument` error.
706    #[serde(rename = "fixedIops")]
707    pub fixed_iops: Option<FixedIOPS>,
708    /// Automatically provision maximum available IOPS based on the capacity of the instance. Larger instances will be granted more IOPS. If instance capacity is increased or decreased, IOPS will be automatically adjusted upwards or downwards accordingly. The maximum available IOPS for a given capacity is defined in Filestore documentation.
709    #[serde(rename = "iopsByCapacity")]
710    pub iops_by_capacity: Option<bool>,
711    /// Provision IOPS dynamically based on the capacity of the instance. Provisioned read IOPS will be calculated by by multiplying the capacity of the instance in GiB by the `iops_per_gb` value, and rounding to the nearest 1000. For example, for a 1 TiB instance with an `iops_per_gb` value of 15, the provisioned read IOPS would be `1024 * 15 = 15,360`, rounded to `15,000`. If the calculated value is outside the supported range for the instance's capacity during instance creation, instance creation will fail with an `InvalidArgument` error. Similarly, if an instance capacity update would result in a value outside the supported range, the update will fail with an `InvalidArgument` error.
712    #[serde(rename = "iopsPerGb")]
713    pub iops_per_gb: Option<IOPSPerGB>,
714}
715
716impl common::Part for PerformanceConfig {}
717
718/// The enforced performance limits, calculated from the instance's performance configuration.
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 PerformanceLimits {
726    /// Output only. The max read IOPS.
727    #[serde(rename = "maxReadIops")]
728    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
729    pub max_read_iops: Option<i64>,
730    /// Output only. The max read throughput.
731    #[serde(rename = "maxReadThroughput")]
732    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
733    pub max_read_throughput: Option<i64>,
734    /// Output only. The max write IOPS.
735    #[serde(rename = "maxWriteIops")]
736    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
737    pub max_write_iops: Option<i64>,
738    /// Output only. The max write throughput.
739    #[serde(rename = "maxWriteThroughput")]
740    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
741    pub max_write_throughput: Option<i64>,
742}
743
744impl common::Part for PerformanceLimits {}
745
746/// PromoteReplicaRequest promotes a Filestore standby instance (replica).
747///
748/// # Activities
749///
750/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
751/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
752///
753/// * [locations instances promote replica projects](ProjectLocationInstancePromoteReplicaCall) (request)
754#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
755#[serde_with::serde_as]
756#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
757pub struct PromoteReplicaRequest {
758    _never_set: Option<bool>,
759}
760
761impl common::RequestValue for PromoteReplicaRequest {}
762
763/// Replica configuration for the instance.
764///
765/// This type is not used in any activity, and only used as *part* of another schema.
766///
767#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
768#[serde_with::serde_as]
769#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
770pub struct ReplicaConfig {
771    /// Output only. The timestamp of the latest replication snapshot taken on the active instance and is already replicated safely.
772    #[serde(rename = "lastActiveSyncTime")]
773    pub last_active_sync_time: Option<chrono::DateTime<chrono::offset::Utc>>,
774    /// The peer instance.
775    #[serde(rename = "peerInstance")]
776    pub peer_instance: Option<String>,
777    /// Output only. The replica state.
778    pub state: Option<String>,
779    /// Output only. Additional information about the replication state, if available.
780    #[serde(rename = "stateReasons")]
781    pub state_reasons: Option<Vec<String>>,
782}
783
784impl common::Part for ReplicaConfig {}
785
786/// Replication specifications.
787///
788/// This type is not used in any activity, and only used as *part* of another schema.
789///
790#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
791#[serde_with::serde_as]
792#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
793pub struct Replication {
794    /// Replicas configuration on the instance. For now, only a single replica config is supported.
795    pub replicas: Option<Vec<ReplicaConfig>>,
796    /// Output only. The replication role.
797    pub role: Option<String>,
798}
799
800impl common::Part for Replication {}
801
802/// RestoreInstanceRequest restores an existing instance’s file share from a backup.
803///
804/// # Activities
805///
806/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
807/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
808///
809/// * [locations instances restore projects](ProjectLocationInstanceRestoreCall) (request)
810#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
811#[serde_with::serde_as]
812#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
813pub struct RestoreInstanceRequest {
814    /// Required. Name of the file share in the Filestore instance that the backup is being restored to.
815    #[serde(rename = "fileShare")]
816    pub file_share: Option<String>,
817    /// The resource name of the backup, in the format `projects/{project_id}/locations/{location_id}/backups/{backup_id}`.
818    #[serde(rename = "sourceBackup")]
819    pub source_backup: Option<String>,
820    /// The resource name of the snapshot, in the format `projects/{project_id}/locations/{location_id}/snapshots/{snapshot_id}`.
821    #[serde(rename = "sourceSnapshot")]
822    pub source_snapshot: Option<String>,
823}
824
825impl common::RequestValue for RestoreInstanceRequest {}
826
827/// RevertInstanceRequest reverts the given instance’s file share to the specified snapshot.
828///
829/// # Activities
830///
831/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
832/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
833///
834/// * [locations instances revert projects](ProjectLocationInstanceRevertCall) (request)
835#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
836#[serde_with::serde_as]
837#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
838pub struct RevertInstanceRequest {
839    /// Required. The snapshot resource ID, in the format 'my-snapshot', where the specified ID is the {snapshot_id} of the fully qualified name like `projects/{project_id}/locations/{location_id}/instances/{instance_id}/snapshots/{snapshot_id}`
840    #[serde(rename = "targetSnapshotId")]
841    pub target_snapshot_id: Option<String>,
842}
843
844impl common::RequestValue for RevertInstanceRequest {}
845
846/// A Filestore share.
847///
848/// # Activities
849///
850/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
851/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
852///
853/// * [locations instances shares create projects](ProjectLocationInstanceShareCreateCall) (request)
854/// * [locations instances shares get projects](ProjectLocationInstanceShareGetCall) (response)
855/// * [locations instances shares patch projects](ProjectLocationInstanceSharePatchCall) (request)
856#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
857#[serde_with::serde_as]
858#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
859pub struct Share {
860    /// Immutable. Full name of the Cloud Filestore Backup resource that this Share is restored from, in the format of projects/{project_id}/locations/{location_id}/backups/{backup_id}. Empty, if the Share is created from scratch and not restored from a backup.
861    pub backup: Option<String>,
862    /// File share capacity in gigabytes (GB). Filestore defines 1 GB as 1024^3 bytes. Must be greater than 0.
863    #[serde(rename = "capacityGb")]
864    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
865    pub capacity_gb: Option<i64>,
866    /// Output only. The time when the share was created.
867    #[serde(rename = "createTime")]
868    pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
869    /// A description of the share with 2048 characters or less. Requests with longer descriptions will be rejected.
870    pub description: Option<String>,
871    /// Resource labels to represent user provided metadata.
872    pub labels: Option<HashMap<String, String>>,
873    /// The mount name of the share. Must be 63 characters or less and consist of uppercase or lowercase letters, numbers, and underscores.
874    #[serde(rename = "mountName")]
875    pub mount_name: Option<String>,
876    /// Output only. The resource name of the share, in the format `projects/{project_id}/locations/{location_id}/instances/{instance_id}/shares/{share_id}`.
877    pub name: Option<String>,
878    /// Nfs Export Options. There is a limit of 10 export options per file share.
879    #[serde(rename = "nfsExportOptions")]
880    pub nfs_export_options: Option<Vec<NfsExportOptions>>,
881    /// Output only. The share state.
882    pub state: Option<String>,
883}
884
885impl common::RequestValue for Share {}
886impl common::ResponseResult for Share {}
887
888/// A Filestore snapshot.
889///
890/// # Activities
891///
892/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
893/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
894///
895/// * [locations instances snapshots create projects](ProjectLocationInstanceSnapshotCreateCall) (request)
896/// * [locations instances snapshots get projects](ProjectLocationInstanceSnapshotGetCall) (response)
897/// * [locations instances snapshots patch projects](ProjectLocationInstanceSnapshotPatchCall) (request)
898#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
899#[serde_with::serde_as]
900#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
901pub struct Snapshot {
902    /// Output only. The time when the snapshot was created.
903    #[serde(rename = "createTime")]
904    pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
905    /// A description of the snapshot with 2048 characters or less. Requests with longer descriptions will be rejected.
906    pub description: Option<String>,
907    /// Output only. The amount of bytes needed to allocate a full copy of the snapshot content
908    #[serde(rename = "filesystemUsedBytes")]
909    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
910    pub filesystem_used_bytes: Option<i64>,
911    /// Resource labels to represent user provided metadata.
912    pub labels: Option<HashMap<String, String>>,
913    /// Output only. The resource name of the snapshot, in the format `projects/{project_id}/locations/{location_id}/instances/{instance_id}/snapshots/{snapshot_id}`.
914    pub name: Option<String>,
915    /// Output only. The snapshot state.
916    pub state: Option<String>,
917    /// Optional. Input only. Immutable. Tag keys/values directly bound to this resource. For example: "123/environment": "production", "123/costCenter": "marketing"
918    pub tags: Option<HashMap<String, String>>,
919}
920
921impl common::RequestValue for Snapshot {}
922impl common::ResponseResult for Snapshot {}
923
924/// 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).
925///
926/// This type is not used in any activity, and only used as *part* of another schema.
927///
928#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
929#[serde_with::serde_as]
930#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
931pub struct Status {
932    /// The status code, which should be an enum value of google.rpc.Code.
933    pub code: Option<i32>,
934    /// A list of messages that carry the error details. There is a common set of message types for APIs to use.
935    pub details: Option<Vec<HashMap<String, serde_json::Value>>>,
936    /// 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.
937    pub message: Option<String>,
938}
939
940impl common::Part for Status {}
941
942// ###################
943// MethodBuilders ###
944// #################
945
946/// A builder providing access to all methods supported on *project* resources.
947/// It is not used directly, but through the [`CloudFilestore`] hub.
948///
949/// # Example
950///
951/// Instantiate a resource builder
952///
953/// ```test_harness,no_run
954/// extern crate hyper;
955/// extern crate hyper_rustls;
956/// extern crate google_file1_beta1 as file1_beta1;
957///
958/// # async fn dox() {
959/// use file1_beta1::{CloudFilestore, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
960///
961/// let secret: yup_oauth2::ApplicationSecret = Default::default();
962/// let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
963///     secret,
964///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
965/// ).build().await.unwrap();
966///
967/// let client = hyper_util::client::legacy::Client::builder(
968///     hyper_util::rt::TokioExecutor::new()
969/// )
970/// .build(
971///     hyper_rustls::HttpsConnectorBuilder::new()
972///         .with_native_roots()
973///         .unwrap()
974///         .https_or_http()
975///         .enable_http1()
976///         .build()
977/// );
978/// let mut hub = CloudFilestore::new(client, auth);
979/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
980/// // like `locations_backups_create(...)`, `locations_backups_delete(...)`, `locations_backups_get(...)`, `locations_backups_list(...)`, `locations_backups_patch(...)`, `locations_get(...)`, `locations_instances_create(...)`, `locations_instances_delete(...)`, `locations_instances_get(...)`, `locations_instances_list(...)`, `locations_instances_patch(...)`, `locations_instances_promote_replica(...)`, `locations_instances_restore(...)`, `locations_instances_revert(...)`, `locations_instances_shares_create(...)`, `locations_instances_shares_delete(...)`, `locations_instances_shares_get(...)`, `locations_instances_shares_list(...)`, `locations_instances_shares_patch(...)`, `locations_instances_snapshots_create(...)`, `locations_instances_snapshots_delete(...)`, `locations_instances_snapshots_get(...)`, `locations_instances_snapshots_list(...)`, `locations_instances_snapshots_patch(...)`, `locations_list(...)`, `locations_operations_cancel(...)`, `locations_operations_delete(...)`, `locations_operations_get(...)` and `locations_operations_list(...)`
981/// // to build up your call.
982/// let rb = hub.projects();
983/// # }
984/// ```
985pub struct ProjectMethods<'a, C>
986where
987    C: 'a,
988{
989    hub: &'a CloudFilestore<C>,
990}
991
992impl<'a, C> common::MethodsBuilder for ProjectMethods<'a, C> {}
993
994impl<'a, C> ProjectMethods<'a, C> {
995    /// Create a builder to help you perform the following task:
996    ///
997    /// Creates a backup.
998    ///
999    /// # Arguments
1000    ///
1001    /// * `request` - No description provided.
1002    /// * `parent` - Required. The backup's project and location, in the format `projects/{project_id}/locations/{location}`. In Filestore, backup locations map to Google Cloud regions, for example **us-west1**.
1003    pub fn locations_backups_create(
1004        &self,
1005        request: Backup,
1006        parent: &str,
1007    ) -> ProjectLocationBackupCreateCall<'a, C> {
1008        ProjectLocationBackupCreateCall {
1009            hub: self.hub,
1010            _request: request,
1011            _parent: parent.to_string(),
1012            _backup_id: Default::default(),
1013            _delegate: Default::default(),
1014            _additional_params: Default::default(),
1015            _scopes: Default::default(),
1016        }
1017    }
1018
1019    /// Create a builder to help you perform the following task:
1020    ///
1021    /// Deletes a backup.
1022    ///
1023    /// # Arguments
1024    ///
1025    /// * `name` - Required. The backup resource name, in the format `projects/{project_id}/locations/{location}/backups/{backup_id}`
1026    pub fn locations_backups_delete(&self, name: &str) -> ProjectLocationBackupDeleteCall<'a, C> {
1027        ProjectLocationBackupDeleteCall {
1028            hub: self.hub,
1029            _name: name.to_string(),
1030            _delegate: Default::default(),
1031            _additional_params: Default::default(),
1032            _scopes: Default::default(),
1033        }
1034    }
1035
1036    /// Create a builder to help you perform the following task:
1037    ///
1038    /// Gets the details of a specific backup.
1039    ///
1040    /// # Arguments
1041    ///
1042    /// * `name` - Required. The backup resource name, in the format `projects/{project_id}/locations/{location}/backups/{backup_id}`.
1043    pub fn locations_backups_get(&self, name: &str) -> ProjectLocationBackupGetCall<'a, C> {
1044        ProjectLocationBackupGetCall {
1045            hub: self.hub,
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    /// Lists all backups in a project for either a specified location or for all locations.
1056    ///
1057    /// # Arguments
1058    ///
1059    /// * `parent` - Required. The project and location for which to retrieve backup information, in the format `projects/{project_id}/locations/{location}`. In Filestore, backup locations map to Google Cloud regions, for example **us-west1**. To retrieve backup information for all locations, use "-" for the `{location}` value.
1060    pub fn locations_backups_list(&self, parent: &str) -> ProjectLocationBackupListCall<'a, C> {
1061        ProjectLocationBackupListCall {
1062            hub: self.hub,
1063            _parent: parent.to_string(),
1064            _page_token: Default::default(),
1065            _page_size: Default::default(),
1066            _order_by: Default::default(),
1067            _filter: Default::default(),
1068            _delegate: Default::default(),
1069            _additional_params: Default::default(),
1070            _scopes: Default::default(),
1071        }
1072    }
1073
1074    /// Create a builder to help you perform the following task:
1075    ///
1076    /// Updates the settings of a specific backup.
1077    ///
1078    /// # Arguments
1079    ///
1080    /// * `request` - No description provided.
1081    /// * `name` - Output only. The resource name of the backup, in the format `projects/{project_id}/locations/{location_id}/backups/{backup_id}`.
1082    pub fn locations_backups_patch(
1083        &self,
1084        request: Backup,
1085        name: &str,
1086    ) -> ProjectLocationBackupPatchCall<'a, C> {
1087        ProjectLocationBackupPatchCall {
1088            hub: self.hub,
1089            _request: request,
1090            _name: name.to_string(),
1091            _update_mask: Default::default(),
1092            _delegate: Default::default(),
1093            _additional_params: Default::default(),
1094            _scopes: Default::default(),
1095        }
1096    }
1097
1098    /// Create a builder to help you perform the following task:
1099    ///
1100    /// Creates a share.
1101    ///
1102    /// # Arguments
1103    ///
1104    /// * `request` - No description provided.
1105    /// * `parent` - Required. The Filestore Instance to create the share for, in the format `projects/{project_id}/locations/{location}/instances/{instance_id}`
1106    pub fn locations_instances_shares_create(
1107        &self,
1108        request: Share,
1109        parent: &str,
1110    ) -> ProjectLocationInstanceShareCreateCall<'a, C> {
1111        ProjectLocationInstanceShareCreateCall {
1112            hub: self.hub,
1113            _request: request,
1114            _parent: parent.to_string(),
1115            _share_id: Default::default(),
1116            _delegate: Default::default(),
1117            _additional_params: Default::default(),
1118            _scopes: Default::default(),
1119        }
1120    }
1121
1122    /// Create a builder to help you perform the following task:
1123    ///
1124    /// Deletes a share.
1125    ///
1126    /// # Arguments
1127    ///
1128    /// * `name` - Required. The share resource name, in the format `projects/{project_id}/locations/{location}/instances/{instance_id}/share/{share_id}`
1129    pub fn locations_instances_shares_delete(
1130        &self,
1131        name: &str,
1132    ) -> ProjectLocationInstanceShareDeleteCall<'a, C> {
1133        ProjectLocationInstanceShareDeleteCall {
1134            hub: self.hub,
1135            _name: name.to_string(),
1136            _delegate: Default::default(),
1137            _additional_params: Default::default(),
1138            _scopes: Default::default(),
1139        }
1140    }
1141
1142    /// Create a builder to help you perform the following task:
1143    ///
1144    /// Gets the details of a specific share.
1145    ///
1146    /// # Arguments
1147    ///
1148    /// * `name` - Required. The share resource name, in the format `projects/{project_id}/locations/{location}/instances/{instance_id}/shares/{share_id}`
1149    pub fn locations_instances_shares_get(
1150        &self,
1151        name: &str,
1152    ) -> ProjectLocationInstanceShareGetCall<'a, C> {
1153        ProjectLocationInstanceShareGetCall {
1154            hub: self.hub,
1155            _name: name.to_string(),
1156            _delegate: Default::default(),
1157            _additional_params: Default::default(),
1158            _scopes: Default::default(),
1159        }
1160    }
1161
1162    /// Create a builder to help you perform the following task:
1163    ///
1164    /// Lists all shares for a specified instance.
1165    ///
1166    /// # Arguments
1167    ///
1168    /// * `parent` - Required. The instance for which to retrieve share information, in the format `projects/{project_id}/locations/{location}/instances/{instance_id}`.
1169    pub fn locations_instances_shares_list(
1170        &self,
1171        parent: &str,
1172    ) -> ProjectLocationInstanceShareListCall<'a, C> {
1173        ProjectLocationInstanceShareListCall {
1174            hub: self.hub,
1175            _parent: parent.to_string(),
1176            _page_token: Default::default(),
1177            _page_size: Default::default(),
1178            _order_by: Default::default(),
1179            _filter: Default::default(),
1180            _delegate: Default::default(),
1181            _additional_params: Default::default(),
1182            _scopes: Default::default(),
1183        }
1184    }
1185
1186    /// Create a builder to help you perform the following task:
1187    ///
1188    /// Updates the settings of a specific share.
1189    ///
1190    /// # Arguments
1191    ///
1192    /// * `request` - No description provided.
1193    /// * `name` - Output only. The resource name of the share, in the format `projects/{project_id}/locations/{location_id}/instances/{instance_id}/shares/{share_id}`.
1194    pub fn locations_instances_shares_patch(
1195        &self,
1196        request: Share,
1197        name: &str,
1198    ) -> ProjectLocationInstanceSharePatchCall<'a, C> {
1199        ProjectLocationInstanceSharePatchCall {
1200            hub: self.hub,
1201            _request: request,
1202            _name: name.to_string(),
1203            _update_mask: Default::default(),
1204            _delegate: Default::default(),
1205            _additional_params: Default::default(),
1206            _scopes: Default::default(),
1207        }
1208    }
1209
1210    /// Create a builder to help you perform the following task:
1211    ///
1212    /// Creates a snapshot.
1213    ///
1214    /// # Arguments
1215    ///
1216    /// * `request` - No description provided.
1217    /// * `parent` - Required. The Filestore Instance to create the snapshots of, in the format `projects/{project_id}/locations/{location}/instances/{instance_id}`
1218    pub fn locations_instances_snapshots_create(
1219        &self,
1220        request: Snapshot,
1221        parent: &str,
1222    ) -> ProjectLocationInstanceSnapshotCreateCall<'a, C> {
1223        ProjectLocationInstanceSnapshotCreateCall {
1224            hub: self.hub,
1225            _request: request,
1226            _parent: parent.to_string(),
1227            _snapshot_id: Default::default(),
1228            _delegate: Default::default(),
1229            _additional_params: Default::default(),
1230            _scopes: Default::default(),
1231        }
1232    }
1233
1234    /// Create a builder to help you perform the following task:
1235    ///
1236    /// Deletes a snapshot.
1237    ///
1238    /// # Arguments
1239    ///
1240    /// * `name` - Required. The snapshot resource name, in the format `projects/{project_id}/locations/{location}/instances/{instance_id}/snapshots/{snapshot_id}`
1241    pub fn locations_instances_snapshots_delete(
1242        &self,
1243        name: &str,
1244    ) -> ProjectLocationInstanceSnapshotDeleteCall<'a, C> {
1245        ProjectLocationInstanceSnapshotDeleteCall {
1246            hub: self.hub,
1247            _name: name.to_string(),
1248            _delegate: Default::default(),
1249            _additional_params: Default::default(),
1250            _scopes: Default::default(),
1251        }
1252    }
1253
1254    /// Create a builder to help you perform the following task:
1255    ///
1256    /// Gets the details of a specific snapshot.
1257    ///
1258    /// # Arguments
1259    ///
1260    /// * `name` - Required. The snapshot resource name, in the format `projects/{project_id}/locations/{location}/instances/{instance_id}/snapshots/{snapshot_id}`
1261    pub fn locations_instances_snapshots_get(
1262        &self,
1263        name: &str,
1264    ) -> ProjectLocationInstanceSnapshotGetCall<'a, C> {
1265        ProjectLocationInstanceSnapshotGetCall {
1266            hub: self.hub,
1267            _name: name.to_string(),
1268            _delegate: Default::default(),
1269            _additional_params: Default::default(),
1270            _scopes: Default::default(),
1271        }
1272    }
1273
1274    /// Create a builder to help you perform the following task:
1275    ///
1276    /// Lists all snapshots in a project for either a specified location or for all locations.
1277    ///
1278    /// # Arguments
1279    ///
1280    /// * `parent` - Required. The instance for which to retrieve snapshot information, in the format `projects/{project_id}/locations/{location}/instances/{instance_id}`.
1281    pub fn locations_instances_snapshots_list(
1282        &self,
1283        parent: &str,
1284    ) -> ProjectLocationInstanceSnapshotListCall<'a, C> {
1285        ProjectLocationInstanceSnapshotListCall {
1286            hub: self.hub,
1287            _parent: parent.to_string(),
1288            _page_token: Default::default(),
1289            _page_size: Default::default(),
1290            _order_by: Default::default(),
1291            _filter: Default::default(),
1292            _delegate: Default::default(),
1293            _additional_params: Default::default(),
1294            _scopes: Default::default(),
1295        }
1296    }
1297
1298    /// Create a builder to help you perform the following task:
1299    ///
1300    /// Updates the settings of a specific snapshot.
1301    ///
1302    /// # Arguments
1303    ///
1304    /// * `request` - No description provided.
1305    /// * `name` - Output only. The resource name of the snapshot, in the format `projects/{project_id}/locations/{location_id}/instances/{instance_id}/snapshots/{snapshot_id}`.
1306    pub fn locations_instances_snapshots_patch(
1307        &self,
1308        request: Snapshot,
1309        name: &str,
1310    ) -> ProjectLocationInstanceSnapshotPatchCall<'a, C> {
1311        ProjectLocationInstanceSnapshotPatchCall {
1312            hub: self.hub,
1313            _request: request,
1314            _name: name.to_string(),
1315            _update_mask: Default::default(),
1316            _delegate: Default::default(),
1317            _additional_params: Default::default(),
1318            _scopes: Default::default(),
1319        }
1320    }
1321
1322    /// Create a builder to help you perform the following task:
1323    ///
1324    /// Creates an instance. When creating from a backup, the capacity of the new instance needs to be equal to or larger than the capacity of the backup (and also equal to or larger than the minimum capacity of the tier).
1325    ///
1326    /// # Arguments
1327    ///
1328    /// * `request` - No description provided.
1329    /// * `parent` - Required. The instance's project and location, in the format `projects/{project_id}/locations/{location}`. In Filestore, locations map to Google Cloud zones, for example **us-west1-b**.
1330    pub fn locations_instances_create(
1331        &self,
1332        request: Instance,
1333        parent: &str,
1334    ) -> ProjectLocationInstanceCreateCall<'a, C> {
1335        ProjectLocationInstanceCreateCall {
1336            hub: self.hub,
1337            _request: request,
1338            _parent: parent.to_string(),
1339            _instance_id: Default::default(),
1340            _delegate: Default::default(),
1341            _additional_params: Default::default(),
1342            _scopes: Default::default(),
1343        }
1344    }
1345
1346    /// Create a builder to help you perform the following task:
1347    ///
1348    /// Deletes an instance.
1349    ///
1350    /// # Arguments
1351    ///
1352    /// * `name` - Required. The instance resource name, in the format `projects/{project_id}/locations/{location}/instances/{instance_id}`
1353    pub fn locations_instances_delete(
1354        &self,
1355        name: &str,
1356    ) -> ProjectLocationInstanceDeleteCall<'a, C> {
1357        ProjectLocationInstanceDeleteCall {
1358            hub: self.hub,
1359            _name: name.to_string(),
1360            _force: Default::default(),
1361            _delegate: Default::default(),
1362            _additional_params: Default::default(),
1363            _scopes: Default::default(),
1364        }
1365    }
1366
1367    /// Create a builder to help you perform the following task:
1368    ///
1369    /// Gets the details of a specific instance.
1370    ///
1371    /// # Arguments
1372    ///
1373    /// * `name` - Required. The instance resource name, in the format `projects/{project_id}/locations/{location}/instances/{instance_id}`.
1374    pub fn locations_instances_get(&self, name: &str) -> ProjectLocationInstanceGetCall<'a, C> {
1375        ProjectLocationInstanceGetCall {
1376            hub: self.hub,
1377            _name: name.to_string(),
1378            _delegate: Default::default(),
1379            _additional_params: Default::default(),
1380            _scopes: Default::default(),
1381        }
1382    }
1383
1384    /// Create a builder to help you perform the following task:
1385    ///
1386    /// Lists all instances in a project for either a specified location or for all locations.
1387    ///
1388    /// # Arguments
1389    ///
1390    /// * `parent` - Required. The project and location for which to retrieve instance information, in the format `projects/{project_id}/locations/{location}`. In Cloud Filestore, locations map to Google Cloud zones, for example **us-west1-b**. To retrieve instance information for all locations, use "-" for the `{location}` value.
1391    pub fn locations_instances_list(&self, parent: &str) -> ProjectLocationInstanceListCall<'a, C> {
1392        ProjectLocationInstanceListCall {
1393            hub: self.hub,
1394            _parent: parent.to_string(),
1395            _page_token: Default::default(),
1396            _page_size: Default::default(),
1397            _order_by: Default::default(),
1398            _filter: Default::default(),
1399            _delegate: Default::default(),
1400            _additional_params: Default::default(),
1401            _scopes: Default::default(),
1402        }
1403    }
1404
1405    /// Create a builder to help you perform the following task:
1406    ///
1407    /// Updates the settings of a specific instance.
1408    ///
1409    /// # Arguments
1410    ///
1411    /// * `request` - No description provided.
1412    /// * `name` - Output only. The resource name of the instance, in the format `projects/{project_id}/locations/{location_id}/instances/{instance_id}`.
1413    pub fn locations_instances_patch(
1414        &self,
1415        request: Instance,
1416        name: &str,
1417    ) -> ProjectLocationInstancePatchCall<'a, C> {
1418        ProjectLocationInstancePatchCall {
1419            hub: self.hub,
1420            _request: request,
1421            _name: name.to_string(),
1422            _update_mask: Default::default(),
1423            _delegate: Default::default(),
1424            _additional_params: Default::default(),
1425            _scopes: Default::default(),
1426        }
1427    }
1428
1429    /// Create a builder to help you perform the following task:
1430    ///
1431    /// Promote an standby instance (replica).
1432    ///
1433    /// # Arguments
1434    ///
1435    /// * `request` - No description provided.
1436    /// * `name` - Required. The resource name of the instance, in the format `projects/{project_id}/locations/{location_id}/instances/{instance_id}`.
1437    pub fn locations_instances_promote_replica(
1438        &self,
1439        request: PromoteReplicaRequest,
1440        name: &str,
1441    ) -> ProjectLocationInstancePromoteReplicaCall<'a, C> {
1442        ProjectLocationInstancePromoteReplicaCall {
1443            hub: self.hub,
1444            _request: request,
1445            _name: name.to_string(),
1446            _delegate: Default::default(),
1447            _additional_params: Default::default(),
1448            _scopes: Default::default(),
1449        }
1450    }
1451
1452    /// Create a builder to help you perform the following task:
1453    ///
1454    /// Restores an existing instance's file share from a backup. The capacity of the instance needs to be equal to or larger than the capacity of the backup (and also equal to or larger than the minimum capacity of the tier).
1455    ///
1456    /// # Arguments
1457    ///
1458    /// * `request` - No description provided.
1459    /// * `name` - Required. The resource name of the instance, in the format `projects/{project_id}/locations/{location_id}/instances/{instance_id}`.
1460    pub fn locations_instances_restore(
1461        &self,
1462        request: RestoreInstanceRequest,
1463        name: &str,
1464    ) -> ProjectLocationInstanceRestoreCall<'a, C> {
1465        ProjectLocationInstanceRestoreCall {
1466            hub: self.hub,
1467            _request: request,
1468            _name: name.to_string(),
1469            _delegate: Default::default(),
1470            _additional_params: Default::default(),
1471            _scopes: Default::default(),
1472        }
1473    }
1474
1475    /// Create a builder to help you perform the following task:
1476    ///
1477    /// Revert an existing instance's file system to a specified snapshot.
1478    ///
1479    /// # Arguments
1480    ///
1481    /// * `request` - No description provided.
1482    /// * `name` - Required. The resource name of the instance, in the format `projects/{project_id}/locations/{location_id}/instances/{instance_id}`.
1483    pub fn locations_instances_revert(
1484        &self,
1485        request: RevertInstanceRequest,
1486        name: &str,
1487    ) -> ProjectLocationInstanceRevertCall<'a, C> {
1488        ProjectLocationInstanceRevertCall {
1489            hub: self.hub,
1490            _request: request,
1491            _name: name.to_string(),
1492            _delegate: Default::default(),
1493            _additional_params: Default::default(),
1494            _scopes: Default::default(),
1495        }
1496    }
1497
1498    /// Create a builder to help you perform the following task:
1499    ///
1500    /// Starts asynchronous cancellation on a long-running operation. The server makes a best effort to cancel the operation, but success is not guaranteed. If the server doesn't support this method, it returns `google.rpc.Code.UNIMPLEMENTED`. Clients can use Operations.GetOperation or other methods to check whether the cancellation succeeded or whether the operation completed despite cancellation. On successful cancellation, the operation is not deleted; instead, it becomes an operation with an Operation.error value with a google.rpc.Status.code of 1, corresponding to `Code.CANCELLED`.
1501    ///
1502    /// # Arguments
1503    ///
1504    /// * `request` - No description provided.
1505    /// * `name` - The name of the operation resource to be cancelled.
1506    pub fn locations_operations_cancel(
1507        &self,
1508        request: CancelOperationRequest,
1509        name: &str,
1510    ) -> ProjectLocationOperationCancelCall<'a, C> {
1511        ProjectLocationOperationCancelCall {
1512            hub: self.hub,
1513            _request: request,
1514            _name: name.to_string(),
1515            _delegate: Default::default(),
1516            _additional_params: Default::default(),
1517            _scopes: Default::default(),
1518        }
1519    }
1520
1521    /// Create a builder to help you perform the following task:
1522    ///
1523    /// Deletes a long-running operation. This method indicates that the client is no longer interested in the operation result. It does not cancel the operation. If the server doesn't support this method, it returns `google.rpc.Code.UNIMPLEMENTED`.
1524    ///
1525    /// # Arguments
1526    ///
1527    /// * `name` - The name of the operation resource to be deleted.
1528    pub fn locations_operations_delete(
1529        &self,
1530        name: &str,
1531    ) -> ProjectLocationOperationDeleteCall<'a, C> {
1532        ProjectLocationOperationDeleteCall {
1533            hub: self.hub,
1534            _name: name.to_string(),
1535            _delegate: Default::default(),
1536            _additional_params: Default::default(),
1537            _scopes: Default::default(),
1538        }
1539    }
1540
1541    /// Create a builder to help you perform the following task:
1542    ///
1543    /// Gets the latest state of a long-running operation. Clients can use this method to poll the operation result at intervals as recommended by the API service.
1544    ///
1545    /// # Arguments
1546    ///
1547    /// * `name` - The name of the operation resource.
1548    pub fn locations_operations_get(&self, name: &str) -> ProjectLocationOperationGetCall<'a, C> {
1549        ProjectLocationOperationGetCall {
1550            hub: self.hub,
1551            _name: name.to_string(),
1552            _delegate: Default::default(),
1553            _additional_params: Default::default(),
1554            _scopes: Default::default(),
1555        }
1556    }
1557
1558    /// Create a builder to help you perform the following task:
1559    ///
1560    /// Lists operations that match the specified filter in the request. If the server doesn't support this method, it returns `UNIMPLEMENTED`.
1561    ///
1562    /// # Arguments
1563    ///
1564    /// * `name` - The name of the operation's parent resource.
1565    pub fn locations_operations_list(&self, name: &str) -> ProjectLocationOperationListCall<'a, C> {
1566        ProjectLocationOperationListCall {
1567            hub: self.hub,
1568            _name: name.to_string(),
1569            _page_token: Default::default(),
1570            _page_size: Default::default(),
1571            _filter: Default::default(),
1572            _delegate: Default::default(),
1573            _additional_params: Default::default(),
1574            _scopes: Default::default(),
1575        }
1576    }
1577
1578    /// Create a builder to help you perform the following task:
1579    ///
1580    /// Gets information about a location.
1581    ///
1582    /// # Arguments
1583    ///
1584    /// * `name` - Resource name for the location.
1585    pub fn locations_get(&self, name: &str) -> ProjectLocationGetCall<'a, C> {
1586        ProjectLocationGetCall {
1587            hub: self.hub,
1588            _name: name.to_string(),
1589            _delegate: Default::default(),
1590            _additional_params: Default::default(),
1591            _scopes: Default::default(),
1592        }
1593    }
1594
1595    /// Create a builder to help you perform the following task:
1596    ///
1597    /// Lists information about the supported locations for this service.
1598    ///
1599    /// # Arguments
1600    ///
1601    /// * `name` - The resource that owns the locations collection, if applicable.
1602    pub fn locations_list(&self, name: &str) -> ProjectLocationListCall<'a, C> {
1603        ProjectLocationListCall {
1604            hub: self.hub,
1605            _name: name.to_string(),
1606            _page_token: Default::default(),
1607            _page_size: Default::default(),
1608            _include_unrevealed_locations: Default::default(),
1609            _filter: Default::default(),
1610            _delegate: Default::default(),
1611            _additional_params: Default::default(),
1612            _scopes: Default::default(),
1613        }
1614    }
1615}
1616
1617// ###################
1618// CallBuilders   ###
1619// #################
1620
1621/// Creates a backup.
1622///
1623/// A builder for the *locations.backups.create* method supported by a *project* resource.
1624/// It is not used directly, but through a [`ProjectMethods`] instance.
1625///
1626/// # Example
1627///
1628/// Instantiate a resource method builder
1629///
1630/// ```test_harness,no_run
1631/// # extern crate hyper;
1632/// # extern crate hyper_rustls;
1633/// # extern crate google_file1_beta1 as file1_beta1;
1634/// use file1_beta1::api::Backup;
1635/// # async fn dox() {
1636/// # use file1_beta1::{CloudFilestore, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
1637///
1638/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
1639/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
1640/// #     secret,
1641/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
1642/// # ).build().await.unwrap();
1643///
1644/// # let client = hyper_util::client::legacy::Client::builder(
1645/// #     hyper_util::rt::TokioExecutor::new()
1646/// # )
1647/// # .build(
1648/// #     hyper_rustls::HttpsConnectorBuilder::new()
1649/// #         .with_native_roots()
1650/// #         .unwrap()
1651/// #         .https_or_http()
1652/// #         .enable_http1()
1653/// #         .build()
1654/// # );
1655/// # let mut hub = CloudFilestore::new(client, auth);
1656/// // As the method needs a request, you would usually fill it with the desired information
1657/// // into the respective structure. Some of the parts shown here might not be applicable !
1658/// // Values shown here are possibly random and not representative !
1659/// let mut req = Backup::default();
1660///
1661/// // You can configure optional parameters by calling the respective setters at will, and
1662/// // execute the final call using `doit()`.
1663/// // Values shown here are possibly random and not representative !
1664/// let result = hub.projects().locations_backups_create(req, "parent")
1665///              .backup_id("sed")
1666///              .doit().await;
1667/// # }
1668/// ```
1669pub struct ProjectLocationBackupCreateCall<'a, C>
1670where
1671    C: 'a,
1672{
1673    hub: &'a CloudFilestore<C>,
1674    _request: Backup,
1675    _parent: String,
1676    _backup_id: Option<String>,
1677    _delegate: Option<&'a mut dyn common::Delegate>,
1678    _additional_params: HashMap<String, String>,
1679    _scopes: BTreeSet<String>,
1680}
1681
1682impl<'a, C> common::CallBuilder for ProjectLocationBackupCreateCall<'a, C> {}
1683
1684impl<'a, C> ProjectLocationBackupCreateCall<'a, C>
1685where
1686    C: common::Connector,
1687{
1688    /// Perform the operation you have build so far.
1689    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
1690        use std::borrow::Cow;
1691        use std::io::{Read, Seek};
1692
1693        use common::{url::Params, ToParts};
1694        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
1695
1696        let mut dd = common::DefaultDelegate;
1697        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
1698        dlg.begin(common::MethodInfo {
1699            id: "file.projects.locations.backups.create",
1700            http_method: hyper::Method::POST,
1701        });
1702
1703        for &field in ["alt", "parent", "backupId"].iter() {
1704            if self._additional_params.contains_key(field) {
1705                dlg.finished(false);
1706                return Err(common::Error::FieldClash(field));
1707            }
1708        }
1709
1710        let mut params = Params::with_capacity(5 + self._additional_params.len());
1711        params.push("parent", self._parent);
1712        if let Some(value) = self._backup_id.as_ref() {
1713            params.push("backupId", value);
1714        }
1715
1716        params.extend(self._additional_params.iter());
1717
1718        params.push("alt", "json");
1719        let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/backups";
1720        if self._scopes.is_empty() {
1721            self._scopes
1722                .insert(Scope::CloudPlatform.as_ref().to_string());
1723        }
1724
1725        #[allow(clippy::single_element_loop)]
1726        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
1727            url = params.uri_replacement(url, param_name, find_this, true);
1728        }
1729        {
1730            let to_remove = ["parent"];
1731            params.remove_params(&to_remove);
1732        }
1733
1734        let url = params.parse_with_url(&url);
1735
1736        let mut json_mime_type = mime::APPLICATION_JSON;
1737        let mut request_value_reader = {
1738            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
1739            common::remove_json_null_values(&mut value);
1740            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
1741            serde_json::to_writer(&mut dst, &value).unwrap();
1742            dst
1743        };
1744        let request_size = request_value_reader
1745            .seek(std::io::SeekFrom::End(0))
1746            .unwrap();
1747        request_value_reader
1748            .seek(std::io::SeekFrom::Start(0))
1749            .unwrap();
1750
1751        loop {
1752            let token = match self
1753                .hub
1754                .auth
1755                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
1756                .await
1757            {
1758                Ok(token) => token,
1759                Err(e) => match dlg.token(e) {
1760                    Ok(token) => token,
1761                    Err(e) => {
1762                        dlg.finished(false);
1763                        return Err(common::Error::MissingToken(e));
1764                    }
1765                },
1766            };
1767            request_value_reader
1768                .seek(std::io::SeekFrom::Start(0))
1769                .unwrap();
1770            let mut req_result = {
1771                let client = &self.hub.client;
1772                dlg.pre_request();
1773                let mut req_builder = hyper::Request::builder()
1774                    .method(hyper::Method::POST)
1775                    .uri(url.as_str())
1776                    .header(USER_AGENT, self.hub._user_agent.clone());
1777
1778                if let Some(token) = token.as_ref() {
1779                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
1780                }
1781
1782                let request = req_builder
1783                    .header(CONTENT_TYPE, json_mime_type.to_string())
1784                    .header(CONTENT_LENGTH, request_size as u64)
1785                    .body(common::to_body(
1786                        request_value_reader.get_ref().clone().into(),
1787                    ));
1788
1789                client.request(request.unwrap()).await
1790            };
1791
1792            match req_result {
1793                Err(err) => {
1794                    if let common::Retry::After(d) = dlg.http_error(&err) {
1795                        sleep(d).await;
1796                        continue;
1797                    }
1798                    dlg.finished(false);
1799                    return Err(common::Error::HttpError(err));
1800                }
1801                Ok(res) => {
1802                    let (mut parts, body) = res.into_parts();
1803                    let mut body = common::Body::new(body);
1804                    if !parts.status.is_success() {
1805                        let bytes = common::to_bytes(body).await.unwrap_or_default();
1806                        let error = serde_json::from_str(&common::to_string(&bytes));
1807                        let response = common::to_response(parts, bytes.into());
1808
1809                        if let common::Retry::After(d) =
1810                            dlg.http_failure(&response, error.as_ref().ok())
1811                        {
1812                            sleep(d).await;
1813                            continue;
1814                        }
1815
1816                        dlg.finished(false);
1817
1818                        return Err(match error {
1819                            Ok(value) => common::Error::BadRequest(value),
1820                            _ => common::Error::Failure(response),
1821                        });
1822                    }
1823                    let response = {
1824                        let bytes = common::to_bytes(body).await.unwrap_or_default();
1825                        let encoded = common::to_string(&bytes);
1826                        match serde_json::from_str(&encoded) {
1827                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
1828                            Err(error) => {
1829                                dlg.response_json_decode_error(&encoded, &error);
1830                                return Err(common::Error::JsonDecodeError(
1831                                    encoded.to_string(),
1832                                    error,
1833                                ));
1834                            }
1835                        }
1836                    };
1837
1838                    dlg.finished(true);
1839                    return Ok(response);
1840                }
1841            }
1842        }
1843    }
1844
1845    ///
1846    /// Sets the *request* property to the given value.
1847    ///
1848    /// Even though the property as already been set when instantiating this call,
1849    /// we provide this method for API completeness.
1850    pub fn request(mut self, new_value: Backup) -> ProjectLocationBackupCreateCall<'a, C> {
1851        self._request = new_value;
1852        self
1853    }
1854    /// Required. The backup's project and location, in the format `projects/{project_id}/locations/{location}`. In Filestore, backup locations map to Google Cloud regions, for example **us-west1**.
1855    ///
1856    /// Sets the *parent* path property to the given value.
1857    ///
1858    /// Even though the property as already been set when instantiating this call,
1859    /// we provide this method for API completeness.
1860    pub fn parent(mut self, new_value: &str) -> ProjectLocationBackupCreateCall<'a, C> {
1861        self._parent = new_value.to_string();
1862        self
1863    }
1864    /// Required. The ID to use for the backup. The ID must be unique within the specified project and location. This value must start with a lowercase letter followed by up to 62 lowercase letters, numbers, or hyphens, and cannot end with a hyphen.
1865    ///
1866    /// Sets the *backup id* query property to the given value.
1867    pub fn backup_id(mut self, new_value: &str) -> ProjectLocationBackupCreateCall<'a, C> {
1868        self._backup_id = Some(new_value.to_string());
1869        self
1870    }
1871    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
1872    /// while executing the actual API request.
1873    ///
1874    /// ````text
1875    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
1876    /// ````
1877    ///
1878    /// Sets the *delegate* property to the given value.
1879    pub fn delegate(
1880        mut self,
1881        new_value: &'a mut dyn common::Delegate,
1882    ) -> ProjectLocationBackupCreateCall<'a, C> {
1883        self._delegate = Some(new_value);
1884        self
1885    }
1886
1887    /// Set any additional parameter of the query string used in the request.
1888    /// It should be used to set parameters which are not yet available through their own
1889    /// setters.
1890    ///
1891    /// Please note that this method must not be used to set any of the known parameters
1892    /// which have their own setter method. If done anyway, the request will fail.
1893    ///
1894    /// # Additional Parameters
1895    ///
1896    /// * *$.xgafv* (query-string) - V1 error format.
1897    /// * *access_token* (query-string) - OAuth access token.
1898    /// * *alt* (query-string) - Data format for response.
1899    /// * *callback* (query-string) - JSONP
1900    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
1901    /// * *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.
1902    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
1903    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
1904    /// * *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.
1905    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
1906    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
1907    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationBackupCreateCall<'a, C>
1908    where
1909        T: AsRef<str>,
1910    {
1911        self._additional_params
1912            .insert(name.as_ref().to_string(), value.as_ref().to_string());
1913        self
1914    }
1915
1916    /// Identifies the authorization scope for the method you are building.
1917    ///
1918    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
1919    /// [`Scope::CloudPlatform`].
1920    ///
1921    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
1922    /// tokens for more than one scope.
1923    ///
1924    /// Usually there is more than one suitable scope to authorize an operation, some of which may
1925    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
1926    /// sufficient, a read-write scope will do as well.
1927    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationBackupCreateCall<'a, C>
1928    where
1929        St: AsRef<str>,
1930    {
1931        self._scopes.insert(String::from(scope.as_ref()));
1932        self
1933    }
1934    /// Identifies the authorization scope(s) for the method you are building.
1935    ///
1936    /// See [`Self::add_scope()`] for details.
1937    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationBackupCreateCall<'a, C>
1938    where
1939        I: IntoIterator<Item = St>,
1940        St: AsRef<str>,
1941    {
1942        self._scopes
1943            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
1944        self
1945    }
1946
1947    /// Removes all scopes, and no default scope will be used either.
1948    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
1949    /// for details).
1950    pub fn clear_scopes(mut self) -> ProjectLocationBackupCreateCall<'a, C> {
1951        self._scopes.clear();
1952        self
1953    }
1954}
1955
1956/// Deletes a backup.
1957///
1958/// A builder for the *locations.backups.delete* method supported by a *project* resource.
1959/// It is not used directly, but through a [`ProjectMethods`] instance.
1960///
1961/// # Example
1962///
1963/// Instantiate a resource method builder
1964///
1965/// ```test_harness,no_run
1966/// # extern crate hyper;
1967/// # extern crate hyper_rustls;
1968/// # extern crate google_file1_beta1 as file1_beta1;
1969/// # async fn dox() {
1970/// # use file1_beta1::{CloudFilestore, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
1971///
1972/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
1973/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
1974/// #     secret,
1975/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
1976/// # ).build().await.unwrap();
1977///
1978/// # let client = hyper_util::client::legacy::Client::builder(
1979/// #     hyper_util::rt::TokioExecutor::new()
1980/// # )
1981/// # .build(
1982/// #     hyper_rustls::HttpsConnectorBuilder::new()
1983/// #         .with_native_roots()
1984/// #         .unwrap()
1985/// #         .https_or_http()
1986/// #         .enable_http1()
1987/// #         .build()
1988/// # );
1989/// # let mut hub = CloudFilestore::new(client, auth);
1990/// // You can configure optional parameters by calling the respective setters at will, and
1991/// // execute the final call using `doit()`.
1992/// // Values shown here are possibly random and not representative !
1993/// let result = hub.projects().locations_backups_delete("name")
1994///              .doit().await;
1995/// # }
1996/// ```
1997pub struct ProjectLocationBackupDeleteCall<'a, C>
1998where
1999    C: 'a,
2000{
2001    hub: &'a CloudFilestore<C>,
2002    _name: String,
2003    _delegate: Option<&'a mut dyn common::Delegate>,
2004    _additional_params: HashMap<String, String>,
2005    _scopes: BTreeSet<String>,
2006}
2007
2008impl<'a, C> common::CallBuilder for ProjectLocationBackupDeleteCall<'a, C> {}
2009
2010impl<'a, C> ProjectLocationBackupDeleteCall<'a, C>
2011where
2012    C: common::Connector,
2013{
2014    /// Perform the operation you have build so far.
2015    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
2016        use std::borrow::Cow;
2017        use std::io::{Read, Seek};
2018
2019        use common::{url::Params, ToParts};
2020        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
2021
2022        let mut dd = common::DefaultDelegate;
2023        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
2024        dlg.begin(common::MethodInfo {
2025            id: "file.projects.locations.backups.delete",
2026            http_method: hyper::Method::DELETE,
2027        });
2028
2029        for &field in ["alt", "name"].iter() {
2030            if self._additional_params.contains_key(field) {
2031                dlg.finished(false);
2032                return Err(common::Error::FieldClash(field));
2033            }
2034        }
2035
2036        let mut params = Params::with_capacity(3 + self._additional_params.len());
2037        params.push("name", self._name);
2038
2039        params.extend(self._additional_params.iter());
2040
2041        params.push("alt", "json");
2042        let mut url = self.hub._base_url.clone() + "v1beta1/{+name}";
2043        if self._scopes.is_empty() {
2044            self._scopes
2045                .insert(Scope::CloudPlatform.as_ref().to_string());
2046        }
2047
2048        #[allow(clippy::single_element_loop)]
2049        for &(find_this, param_name) in [("{+name}", "name")].iter() {
2050            url = params.uri_replacement(url, param_name, find_this, true);
2051        }
2052        {
2053            let to_remove = ["name"];
2054            params.remove_params(&to_remove);
2055        }
2056
2057        let url = params.parse_with_url(&url);
2058
2059        loop {
2060            let token = match self
2061                .hub
2062                .auth
2063                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
2064                .await
2065            {
2066                Ok(token) => token,
2067                Err(e) => match dlg.token(e) {
2068                    Ok(token) => token,
2069                    Err(e) => {
2070                        dlg.finished(false);
2071                        return Err(common::Error::MissingToken(e));
2072                    }
2073                },
2074            };
2075            let mut req_result = {
2076                let client = &self.hub.client;
2077                dlg.pre_request();
2078                let mut req_builder = hyper::Request::builder()
2079                    .method(hyper::Method::DELETE)
2080                    .uri(url.as_str())
2081                    .header(USER_AGENT, self.hub._user_agent.clone());
2082
2083                if let Some(token) = token.as_ref() {
2084                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
2085                }
2086
2087                let request = req_builder
2088                    .header(CONTENT_LENGTH, 0_u64)
2089                    .body(common::to_body::<String>(None));
2090
2091                client.request(request.unwrap()).await
2092            };
2093
2094            match req_result {
2095                Err(err) => {
2096                    if let common::Retry::After(d) = dlg.http_error(&err) {
2097                        sleep(d).await;
2098                        continue;
2099                    }
2100                    dlg.finished(false);
2101                    return Err(common::Error::HttpError(err));
2102                }
2103                Ok(res) => {
2104                    let (mut parts, body) = res.into_parts();
2105                    let mut body = common::Body::new(body);
2106                    if !parts.status.is_success() {
2107                        let bytes = common::to_bytes(body).await.unwrap_or_default();
2108                        let error = serde_json::from_str(&common::to_string(&bytes));
2109                        let response = common::to_response(parts, bytes.into());
2110
2111                        if let common::Retry::After(d) =
2112                            dlg.http_failure(&response, error.as_ref().ok())
2113                        {
2114                            sleep(d).await;
2115                            continue;
2116                        }
2117
2118                        dlg.finished(false);
2119
2120                        return Err(match error {
2121                            Ok(value) => common::Error::BadRequest(value),
2122                            _ => common::Error::Failure(response),
2123                        });
2124                    }
2125                    let response = {
2126                        let bytes = common::to_bytes(body).await.unwrap_or_default();
2127                        let encoded = common::to_string(&bytes);
2128                        match serde_json::from_str(&encoded) {
2129                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
2130                            Err(error) => {
2131                                dlg.response_json_decode_error(&encoded, &error);
2132                                return Err(common::Error::JsonDecodeError(
2133                                    encoded.to_string(),
2134                                    error,
2135                                ));
2136                            }
2137                        }
2138                    };
2139
2140                    dlg.finished(true);
2141                    return Ok(response);
2142                }
2143            }
2144        }
2145    }
2146
2147    /// Required. The backup resource name, in the format `projects/{project_id}/locations/{location}/backups/{backup_id}`
2148    ///
2149    /// Sets the *name* path property to the given value.
2150    ///
2151    /// Even though the property as already been set when instantiating this call,
2152    /// we provide this method for API completeness.
2153    pub fn name(mut self, new_value: &str) -> ProjectLocationBackupDeleteCall<'a, C> {
2154        self._name = new_value.to_string();
2155        self
2156    }
2157    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
2158    /// while executing the actual API request.
2159    ///
2160    /// ````text
2161    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
2162    /// ````
2163    ///
2164    /// Sets the *delegate* property to the given value.
2165    pub fn delegate(
2166        mut self,
2167        new_value: &'a mut dyn common::Delegate,
2168    ) -> ProjectLocationBackupDeleteCall<'a, C> {
2169        self._delegate = Some(new_value);
2170        self
2171    }
2172
2173    /// Set any additional parameter of the query string used in the request.
2174    /// It should be used to set parameters which are not yet available through their own
2175    /// setters.
2176    ///
2177    /// Please note that this method must not be used to set any of the known parameters
2178    /// which have their own setter method. If done anyway, the request will fail.
2179    ///
2180    /// # Additional Parameters
2181    ///
2182    /// * *$.xgafv* (query-string) - V1 error format.
2183    /// * *access_token* (query-string) - OAuth access token.
2184    /// * *alt* (query-string) - Data format for response.
2185    /// * *callback* (query-string) - JSONP
2186    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
2187    /// * *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.
2188    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
2189    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
2190    /// * *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.
2191    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
2192    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
2193    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationBackupDeleteCall<'a, C>
2194    where
2195        T: AsRef<str>,
2196    {
2197        self._additional_params
2198            .insert(name.as_ref().to_string(), value.as_ref().to_string());
2199        self
2200    }
2201
2202    /// Identifies the authorization scope for the method you are building.
2203    ///
2204    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
2205    /// [`Scope::CloudPlatform`].
2206    ///
2207    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
2208    /// tokens for more than one scope.
2209    ///
2210    /// Usually there is more than one suitable scope to authorize an operation, some of which may
2211    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
2212    /// sufficient, a read-write scope will do as well.
2213    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationBackupDeleteCall<'a, C>
2214    where
2215        St: AsRef<str>,
2216    {
2217        self._scopes.insert(String::from(scope.as_ref()));
2218        self
2219    }
2220    /// Identifies the authorization scope(s) for the method you are building.
2221    ///
2222    /// See [`Self::add_scope()`] for details.
2223    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationBackupDeleteCall<'a, C>
2224    where
2225        I: IntoIterator<Item = St>,
2226        St: AsRef<str>,
2227    {
2228        self._scopes
2229            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
2230        self
2231    }
2232
2233    /// Removes all scopes, and no default scope will be used either.
2234    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
2235    /// for details).
2236    pub fn clear_scopes(mut self) -> ProjectLocationBackupDeleteCall<'a, C> {
2237        self._scopes.clear();
2238        self
2239    }
2240}
2241
2242/// Gets the details of a specific backup.
2243///
2244/// A builder for the *locations.backups.get* method supported by a *project* resource.
2245/// It is not used directly, but through a [`ProjectMethods`] instance.
2246///
2247/// # Example
2248///
2249/// Instantiate a resource method builder
2250///
2251/// ```test_harness,no_run
2252/// # extern crate hyper;
2253/// # extern crate hyper_rustls;
2254/// # extern crate google_file1_beta1 as file1_beta1;
2255/// # async fn dox() {
2256/// # use file1_beta1::{CloudFilestore, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2257///
2258/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
2259/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
2260/// #     secret,
2261/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2262/// # ).build().await.unwrap();
2263///
2264/// # let client = hyper_util::client::legacy::Client::builder(
2265/// #     hyper_util::rt::TokioExecutor::new()
2266/// # )
2267/// # .build(
2268/// #     hyper_rustls::HttpsConnectorBuilder::new()
2269/// #         .with_native_roots()
2270/// #         .unwrap()
2271/// #         .https_or_http()
2272/// #         .enable_http1()
2273/// #         .build()
2274/// # );
2275/// # let mut hub = CloudFilestore::new(client, auth);
2276/// // You can configure optional parameters by calling the respective setters at will, and
2277/// // execute the final call using `doit()`.
2278/// // Values shown here are possibly random and not representative !
2279/// let result = hub.projects().locations_backups_get("name")
2280///              .doit().await;
2281/// # }
2282/// ```
2283pub struct ProjectLocationBackupGetCall<'a, C>
2284where
2285    C: 'a,
2286{
2287    hub: &'a CloudFilestore<C>,
2288    _name: String,
2289    _delegate: Option<&'a mut dyn common::Delegate>,
2290    _additional_params: HashMap<String, String>,
2291    _scopes: BTreeSet<String>,
2292}
2293
2294impl<'a, C> common::CallBuilder for ProjectLocationBackupGetCall<'a, C> {}
2295
2296impl<'a, C> ProjectLocationBackupGetCall<'a, C>
2297where
2298    C: common::Connector,
2299{
2300    /// Perform the operation you have build so far.
2301    pub async fn doit(mut self) -> common::Result<(common::Response, Backup)> {
2302        use std::borrow::Cow;
2303        use std::io::{Read, Seek};
2304
2305        use common::{url::Params, ToParts};
2306        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
2307
2308        let mut dd = common::DefaultDelegate;
2309        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
2310        dlg.begin(common::MethodInfo {
2311            id: "file.projects.locations.backups.get",
2312            http_method: hyper::Method::GET,
2313        });
2314
2315        for &field in ["alt", "name"].iter() {
2316            if self._additional_params.contains_key(field) {
2317                dlg.finished(false);
2318                return Err(common::Error::FieldClash(field));
2319            }
2320        }
2321
2322        let mut params = Params::with_capacity(3 + self._additional_params.len());
2323        params.push("name", self._name);
2324
2325        params.extend(self._additional_params.iter());
2326
2327        params.push("alt", "json");
2328        let mut url = self.hub._base_url.clone() + "v1beta1/{+name}";
2329        if self._scopes.is_empty() {
2330            self._scopes
2331                .insert(Scope::CloudPlatform.as_ref().to_string());
2332        }
2333
2334        #[allow(clippy::single_element_loop)]
2335        for &(find_this, param_name) in [("{+name}", "name")].iter() {
2336            url = params.uri_replacement(url, param_name, find_this, true);
2337        }
2338        {
2339            let to_remove = ["name"];
2340            params.remove_params(&to_remove);
2341        }
2342
2343        let url = params.parse_with_url(&url);
2344
2345        loop {
2346            let token = match self
2347                .hub
2348                .auth
2349                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
2350                .await
2351            {
2352                Ok(token) => token,
2353                Err(e) => match dlg.token(e) {
2354                    Ok(token) => token,
2355                    Err(e) => {
2356                        dlg.finished(false);
2357                        return Err(common::Error::MissingToken(e));
2358                    }
2359                },
2360            };
2361            let mut req_result = {
2362                let client = &self.hub.client;
2363                dlg.pre_request();
2364                let mut req_builder = hyper::Request::builder()
2365                    .method(hyper::Method::GET)
2366                    .uri(url.as_str())
2367                    .header(USER_AGENT, self.hub._user_agent.clone());
2368
2369                if let Some(token) = token.as_ref() {
2370                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
2371                }
2372
2373                let request = req_builder
2374                    .header(CONTENT_LENGTH, 0_u64)
2375                    .body(common::to_body::<String>(None));
2376
2377                client.request(request.unwrap()).await
2378            };
2379
2380            match req_result {
2381                Err(err) => {
2382                    if let common::Retry::After(d) = dlg.http_error(&err) {
2383                        sleep(d).await;
2384                        continue;
2385                    }
2386                    dlg.finished(false);
2387                    return Err(common::Error::HttpError(err));
2388                }
2389                Ok(res) => {
2390                    let (mut parts, body) = res.into_parts();
2391                    let mut body = common::Body::new(body);
2392                    if !parts.status.is_success() {
2393                        let bytes = common::to_bytes(body).await.unwrap_or_default();
2394                        let error = serde_json::from_str(&common::to_string(&bytes));
2395                        let response = common::to_response(parts, bytes.into());
2396
2397                        if let common::Retry::After(d) =
2398                            dlg.http_failure(&response, error.as_ref().ok())
2399                        {
2400                            sleep(d).await;
2401                            continue;
2402                        }
2403
2404                        dlg.finished(false);
2405
2406                        return Err(match error {
2407                            Ok(value) => common::Error::BadRequest(value),
2408                            _ => common::Error::Failure(response),
2409                        });
2410                    }
2411                    let response = {
2412                        let bytes = common::to_bytes(body).await.unwrap_or_default();
2413                        let encoded = common::to_string(&bytes);
2414                        match serde_json::from_str(&encoded) {
2415                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
2416                            Err(error) => {
2417                                dlg.response_json_decode_error(&encoded, &error);
2418                                return Err(common::Error::JsonDecodeError(
2419                                    encoded.to_string(),
2420                                    error,
2421                                ));
2422                            }
2423                        }
2424                    };
2425
2426                    dlg.finished(true);
2427                    return Ok(response);
2428                }
2429            }
2430        }
2431    }
2432
2433    /// Required. The backup resource name, in the format `projects/{project_id}/locations/{location}/backups/{backup_id}`.
2434    ///
2435    /// Sets the *name* path property to the given value.
2436    ///
2437    /// Even though the property as already been set when instantiating this call,
2438    /// we provide this method for API completeness.
2439    pub fn name(mut self, new_value: &str) -> ProjectLocationBackupGetCall<'a, C> {
2440        self._name = new_value.to_string();
2441        self
2442    }
2443    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
2444    /// while executing the actual API request.
2445    ///
2446    /// ````text
2447    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
2448    /// ````
2449    ///
2450    /// Sets the *delegate* property to the given value.
2451    pub fn delegate(
2452        mut self,
2453        new_value: &'a mut dyn common::Delegate,
2454    ) -> ProjectLocationBackupGetCall<'a, C> {
2455        self._delegate = Some(new_value);
2456        self
2457    }
2458
2459    /// Set any additional parameter of the query string used in the request.
2460    /// It should be used to set parameters which are not yet available through their own
2461    /// setters.
2462    ///
2463    /// Please note that this method must not be used to set any of the known parameters
2464    /// which have their own setter method. If done anyway, the request will fail.
2465    ///
2466    /// # Additional Parameters
2467    ///
2468    /// * *$.xgafv* (query-string) - V1 error format.
2469    /// * *access_token* (query-string) - OAuth access token.
2470    /// * *alt* (query-string) - Data format for response.
2471    /// * *callback* (query-string) - JSONP
2472    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
2473    /// * *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.
2474    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
2475    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
2476    /// * *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.
2477    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
2478    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
2479    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationBackupGetCall<'a, C>
2480    where
2481        T: AsRef<str>,
2482    {
2483        self._additional_params
2484            .insert(name.as_ref().to_string(), value.as_ref().to_string());
2485        self
2486    }
2487
2488    /// Identifies the authorization scope for the method you are building.
2489    ///
2490    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
2491    /// [`Scope::CloudPlatform`].
2492    ///
2493    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
2494    /// tokens for more than one scope.
2495    ///
2496    /// Usually there is more than one suitable scope to authorize an operation, some of which may
2497    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
2498    /// sufficient, a read-write scope will do as well.
2499    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationBackupGetCall<'a, C>
2500    where
2501        St: AsRef<str>,
2502    {
2503        self._scopes.insert(String::from(scope.as_ref()));
2504        self
2505    }
2506    /// Identifies the authorization scope(s) for the method you are building.
2507    ///
2508    /// See [`Self::add_scope()`] for details.
2509    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationBackupGetCall<'a, C>
2510    where
2511        I: IntoIterator<Item = St>,
2512        St: AsRef<str>,
2513    {
2514        self._scopes
2515            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
2516        self
2517    }
2518
2519    /// Removes all scopes, and no default scope will be used either.
2520    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
2521    /// for details).
2522    pub fn clear_scopes(mut self) -> ProjectLocationBackupGetCall<'a, C> {
2523        self._scopes.clear();
2524        self
2525    }
2526}
2527
2528/// Lists all backups in a project for either a specified location or for all locations.
2529///
2530/// A builder for the *locations.backups.list* method supported by a *project* resource.
2531/// It is not used directly, but through a [`ProjectMethods`] instance.
2532///
2533/// # Example
2534///
2535/// Instantiate a resource method builder
2536///
2537/// ```test_harness,no_run
2538/// # extern crate hyper;
2539/// # extern crate hyper_rustls;
2540/// # extern crate google_file1_beta1 as file1_beta1;
2541/// # async fn dox() {
2542/// # use file1_beta1::{CloudFilestore, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2543///
2544/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
2545/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
2546/// #     secret,
2547/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2548/// # ).build().await.unwrap();
2549///
2550/// # let client = hyper_util::client::legacy::Client::builder(
2551/// #     hyper_util::rt::TokioExecutor::new()
2552/// # )
2553/// # .build(
2554/// #     hyper_rustls::HttpsConnectorBuilder::new()
2555/// #         .with_native_roots()
2556/// #         .unwrap()
2557/// #         .https_or_http()
2558/// #         .enable_http1()
2559/// #         .build()
2560/// # );
2561/// # let mut hub = CloudFilestore::new(client, auth);
2562/// // You can configure optional parameters by calling the respective setters at will, and
2563/// // execute the final call using `doit()`.
2564/// // Values shown here are possibly random and not representative !
2565/// let result = hub.projects().locations_backups_list("parent")
2566///              .page_token("duo")
2567///              .page_size(-55)
2568///              .order_by("gubergren")
2569///              .filter("Lorem")
2570///              .doit().await;
2571/// # }
2572/// ```
2573pub struct ProjectLocationBackupListCall<'a, C>
2574where
2575    C: 'a,
2576{
2577    hub: &'a CloudFilestore<C>,
2578    _parent: String,
2579    _page_token: Option<String>,
2580    _page_size: Option<i32>,
2581    _order_by: Option<String>,
2582    _filter: Option<String>,
2583    _delegate: Option<&'a mut dyn common::Delegate>,
2584    _additional_params: HashMap<String, String>,
2585    _scopes: BTreeSet<String>,
2586}
2587
2588impl<'a, C> common::CallBuilder for ProjectLocationBackupListCall<'a, C> {}
2589
2590impl<'a, C> ProjectLocationBackupListCall<'a, C>
2591where
2592    C: common::Connector,
2593{
2594    /// Perform the operation you have build so far.
2595    pub async fn doit(mut self) -> common::Result<(common::Response, ListBackupsResponse)> {
2596        use std::borrow::Cow;
2597        use std::io::{Read, Seek};
2598
2599        use common::{url::Params, ToParts};
2600        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
2601
2602        let mut dd = common::DefaultDelegate;
2603        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
2604        dlg.begin(common::MethodInfo {
2605            id: "file.projects.locations.backups.list",
2606            http_method: hyper::Method::GET,
2607        });
2608
2609        for &field in [
2610            "alt",
2611            "parent",
2612            "pageToken",
2613            "pageSize",
2614            "orderBy",
2615            "filter",
2616        ]
2617        .iter()
2618        {
2619            if self._additional_params.contains_key(field) {
2620                dlg.finished(false);
2621                return Err(common::Error::FieldClash(field));
2622            }
2623        }
2624
2625        let mut params = Params::with_capacity(7 + self._additional_params.len());
2626        params.push("parent", self._parent);
2627        if let Some(value) = self._page_token.as_ref() {
2628            params.push("pageToken", value);
2629        }
2630        if let Some(value) = self._page_size.as_ref() {
2631            params.push("pageSize", value.to_string());
2632        }
2633        if let Some(value) = self._order_by.as_ref() {
2634            params.push("orderBy", value);
2635        }
2636        if let Some(value) = self._filter.as_ref() {
2637            params.push("filter", value);
2638        }
2639
2640        params.extend(self._additional_params.iter());
2641
2642        params.push("alt", "json");
2643        let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/backups";
2644        if self._scopes.is_empty() {
2645            self._scopes
2646                .insert(Scope::CloudPlatform.as_ref().to_string());
2647        }
2648
2649        #[allow(clippy::single_element_loop)]
2650        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
2651            url = params.uri_replacement(url, param_name, find_this, true);
2652        }
2653        {
2654            let to_remove = ["parent"];
2655            params.remove_params(&to_remove);
2656        }
2657
2658        let url = params.parse_with_url(&url);
2659
2660        loop {
2661            let token = match self
2662                .hub
2663                .auth
2664                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
2665                .await
2666            {
2667                Ok(token) => token,
2668                Err(e) => match dlg.token(e) {
2669                    Ok(token) => token,
2670                    Err(e) => {
2671                        dlg.finished(false);
2672                        return Err(common::Error::MissingToken(e));
2673                    }
2674                },
2675            };
2676            let mut req_result = {
2677                let client = &self.hub.client;
2678                dlg.pre_request();
2679                let mut req_builder = hyper::Request::builder()
2680                    .method(hyper::Method::GET)
2681                    .uri(url.as_str())
2682                    .header(USER_AGENT, self.hub._user_agent.clone());
2683
2684                if let Some(token) = token.as_ref() {
2685                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
2686                }
2687
2688                let request = req_builder
2689                    .header(CONTENT_LENGTH, 0_u64)
2690                    .body(common::to_body::<String>(None));
2691
2692                client.request(request.unwrap()).await
2693            };
2694
2695            match req_result {
2696                Err(err) => {
2697                    if let common::Retry::After(d) = dlg.http_error(&err) {
2698                        sleep(d).await;
2699                        continue;
2700                    }
2701                    dlg.finished(false);
2702                    return Err(common::Error::HttpError(err));
2703                }
2704                Ok(res) => {
2705                    let (mut parts, body) = res.into_parts();
2706                    let mut body = common::Body::new(body);
2707                    if !parts.status.is_success() {
2708                        let bytes = common::to_bytes(body).await.unwrap_or_default();
2709                        let error = serde_json::from_str(&common::to_string(&bytes));
2710                        let response = common::to_response(parts, bytes.into());
2711
2712                        if let common::Retry::After(d) =
2713                            dlg.http_failure(&response, error.as_ref().ok())
2714                        {
2715                            sleep(d).await;
2716                            continue;
2717                        }
2718
2719                        dlg.finished(false);
2720
2721                        return Err(match error {
2722                            Ok(value) => common::Error::BadRequest(value),
2723                            _ => common::Error::Failure(response),
2724                        });
2725                    }
2726                    let response = {
2727                        let bytes = common::to_bytes(body).await.unwrap_or_default();
2728                        let encoded = common::to_string(&bytes);
2729                        match serde_json::from_str(&encoded) {
2730                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
2731                            Err(error) => {
2732                                dlg.response_json_decode_error(&encoded, &error);
2733                                return Err(common::Error::JsonDecodeError(
2734                                    encoded.to_string(),
2735                                    error,
2736                                ));
2737                            }
2738                        }
2739                    };
2740
2741                    dlg.finished(true);
2742                    return Ok(response);
2743                }
2744            }
2745        }
2746    }
2747
2748    /// Required. The project and location for which to retrieve backup information, in the format `projects/{project_id}/locations/{location}`. In Filestore, backup locations map to Google Cloud regions, for example **us-west1**. To retrieve backup information for all locations, use "-" for the `{location}` value.
2749    ///
2750    /// Sets the *parent* path property to the given value.
2751    ///
2752    /// Even though the property as already been set when instantiating this call,
2753    /// we provide this method for API completeness.
2754    pub fn parent(mut self, new_value: &str) -> ProjectLocationBackupListCall<'a, C> {
2755        self._parent = new_value.to_string();
2756        self
2757    }
2758    /// The next_page_token value to use if there are additional results to retrieve for this list request.
2759    ///
2760    /// Sets the *page token* query property to the given value.
2761    pub fn page_token(mut self, new_value: &str) -> ProjectLocationBackupListCall<'a, C> {
2762        self._page_token = Some(new_value.to_string());
2763        self
2764    }
2765    /// The maximum number of items to return.
2766    ///
2767    /// Sets the *page size* query property to the given value.
2768    pub fn page_size(mut self, new_value: i32) -> ProjectLocationBackupListCall<'a, C> {
2769        self._page_size = Some(new_value);
2770        self
2771    }
2772    /// Sort results. Supported values are "name", "name desc" or "" (unsorted).
2773    ///
2774    /// Sets the *order by* query property to the given value.
2775    pub fn order_by(mut self, new_value: &str) -> ProjectLocationBackupListCall<'a, C> {
2776        self._order_by = Some(new_value.to_string());
2777        self
2778    }
2779    /// List filter.
2780    ///
2781    /// Sets the *filter* query property to the given value.
2782    pub fn filter(mut self, new_value: &str) -> ProjectLocationBackupListCall<'a, C> {
2783        self._filter = Some(new_value.to_string());
2784        self
2785    }
2786    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
2787    /// while executing the actual API request.
2788    ///
2789    /// ````text
2790    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
2791    /// ````
2792    ///
2793    /// Sets the *delegate* property to the given value.
2794    pub fn delegate(
2795        mut self,
2796        new_value: &'a mut dyn common::Delegate,
2797    ) -> ProjectLocationBackupListCall<'a, C> {
2798        self._delegate = Some(new_value);
2799        self
2800    }
2801
2802    /// Set any additional parameter of the query string used in the request.
2803    /// It should be used to set parameters which are not yet available through their own
2804    /// setters.
2805    ///
2806    /// Please note that this method must not be used to set any of the known parameters
2807    /// which have their own setter method. If done anyway, the request will fail.
2808    ///
2809    /// # Additional Parameters
2810    ///
2811    /// * *$.xgafv* (query-string) - V1 error format.
2812    /// * *access_token* (query-string) - OAuth access token.
2813    /// * *alt* (query-string) - Data format for response.
2814    /// * *callback* (query-string) - JSONP
2815    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
2816    /// * *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.
2817    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
2818    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
2819    /// * *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.
2820    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
2821    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
2822    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationBackupListCall<'a, C>
2823    where
2824        T: AsRef<str>,
2825    {
2826        self._additional_params
2827            .insert(name.as_ref().to_string(), value.as_ref().to_string());
2828        self
2829    }
2830
2831    /// Identifies the authorization scope for the method you are building.
2832    ///
2833    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
2834    /// [`Scope::CloudPlatform`].
2835    ///
2836    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
2837    /// tokens for more than one scope.
2838    ///
2839    /// Usually there is more than one suitable scope to authorize an operation, some of which may
2840    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
2841    /// sufficient, a read-write scope will do as well.
2842    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationBackupListCall<'a, C>
2843    where
2844        St: AsRef<str>,
2845    {
2846        self._scopes.insert(String::from(scope.as_ref()));
2847        self
2848    }
2849    /// Identifies the authorization scope(s) for the method you are building.
2850    ///
2851    /// See [`Self::add_scope()`] for details.
2852    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationBackupListCall<'a, C>
2853    where
2854        I: IntoIterator<Item = St>,
2855        St: AsRef<str>,
2856    {
2857        self._scopes
2858            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
2859        self
2860    }
2861
2862    /// Removes all scopes, and no default scope will be used either.
2863    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
2864    /// for details).
2865    pub fn clear_scopes(mut self) -> ProjectLocationBackupListCall<'a, C> {
2866        self._scopes.clear();
2867        self
2868    }
2869}
2870
2871/// Updates the settings of a specific backup.
2872///
2873/// A builder for the *locations.backups.patch* method supported by a *project* resource.
2874/// It is not used directly, but through a [`ProjectMethods`] instance.
2875///
2876/// # Example
2877///
2878/// Instantiate a resource method builder
2879///
2880/// ```test_harness,no_run
2881/// # extern crate hyper;
2882/// # extern crate hyper_rustls;
2883/// # extern crate google_file1_beta1 as file1_beta1;
2884/// use file1_beta1::api::Backup;
2885/// # async fn dox() {
2886/// # use file1_beta1::{CloudFilestore, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2887///
2888/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
2889/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
2890/// #     secret,
2891/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2892/// # ).build().await.unwrap();
2893///
2894/// # let client = hyper_util::client::legacy::Client::builder(
2895/// #     hyper_util::rt::TokioExecutor::new()
2896/// # )
2897/// # .build(
2898/// #     hyper_rustls::HttpsConnectorBuilder::new()
2899/// #         .with_native_roots()
2900/// #         .unwrap()
2901/// #         .https_or_http()
2902/// #         .enable_http1()
2903/// #         .build()
2904/// # );
2905/// # let mut hub = CloudFilestore::new(client, auth);
2906/// // As the method needs a request, you would usually fill it with the desired information
2907/// // into the respective structure. Some of the parts shown here might not be applicable !
2908/// // Values shown here are possibly random and not representative !
2909/// let mut req = Backup::default();
2910///
2911/// // You can configure optional parameters by calling the respective setters at will, and
2912/// // execute the final call using `doit()`.
2913/// // Values shown here are possibly random and not representative !
2914/// let result = hub.projects().locations_backups_patch(req, "name")
2915///              .update_mask(FieldMask::new::<&str>(&[]))
2916///              .doit().await;
2917/// # }
2918/// ```
2919pub struct ProjectLocationBackupPatchCall<'a, C>
2920where
2921    C: 'a,
2922{
2923    hub: &'a CloudFilestore<C>,
2924    _request: Backup,
2925    _name: String,
2926    _update_mask: Option<common::FieldMask>,
2927    _delegate: Option<&'a mut dyn common::Delegate>,
2928    _additional_params: HashMap<String, String>,
2929    _scopes: BTreeSet<String>,
2930}
2931
2932impl<'a, C> common::CallBuilder for ProjectLocationBackupPatchCall<'a, C> {}
2933
2934impl<'a, C> ProjectLocationBackupPatchCall<'a, C>
2935where
2936    C: common::Connector,
2937{
2938    /// Perform the operation you have build so far.
2939    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
2940        use std::borrow::Cow;
2941        use std::io::{Read, Seek};
2942
2943        use common::{url::Params, ToParts};
2944        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
2945
2946        let mut dd = common::DefaultDelegate;
2947        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
2948        dlg.begin(common::MethodInfo {
2949            id: "file.projects.locations.backups.patch",
2950            http_method: hyper::Method::PATCH,
2951        });
2952
2953        for &field in ["alt", "name", "updateMask"].iter() {
2954            if self._additional_params.contains_key(field) {
2955                dlg.finished(false);
2956                return Err(common::Error::FieldClash(field));
2957            }
2958        }
2959
2960        let mut params = Params::with_capacity(5 + self._additional_params.len());
2961        params.push("name", self._name);
2962        if let Some(value) = self._update_mask.as_ref() {
2963            params.push("updateMask", value.to_string());
2964        }
2965
2966        params.extend(self._additional_params.iter());
2967
2968        params.push("alt", "json");
2969        let mut url = self.hub._base_url.clone() + "v1beta1/{+name}";
2970        if self._scopes.is_empty() {
2971            self._scopes
2972                .insert(Scope::CloudPlatform.as_ref().to_string());
2973        }
2974
2975        #[allow(clippy::single_element_loop)]
2976        for &(find_this, param_name) in [("{+name}", "name")].iter() {
2977            url = params.uri_replacement(url, param_name, find_this, true);
2978        }
2979        {
2980            let to_remove = ["name"];
2981            params.remove_params(&to_remove);
2982        }
2983
2984        let url = params.parse_with_url(&url);
2985
2986        let mut json_mime_type = mime::APPLICATION_JSON;
2987        let mut request_value_reader = {
2988            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
2989            common::remove_json_null_values(&mut value);
2990            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
2991            serde_json::to_writer(&mut dst, &value).unwrap();
2992            dst
2993        };
2994        let request_size = request_value_reader
2995            .seek(std::io::SeekFrom::End(0))
2996            .unwrap();
2997        request_value_reader
2998            .seek(std::io::SeekFrom::Start(0))
2999            .unwrap();
3000
3001        loop {
3002            let token = match self
3003                .hub
3004                .auth
3005                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
3006                .await
3007            {
3008                Ok(token) => token,
3009                Err(e) => match dlg.token(e) {
3010                    Ok(token) => token,
3011                    Err(e) => {
3012                        dlg.finished(false);
3013                        return Err(common::Error::MissingToken(e));
3014                    }
3015                },
3016            };
3017            request_value_reader
3018                .seek(std::io::SeekFrom::Start(0))
3019                .unwrap();
3020            let mut req_result = {
3021                let client = &self.hub.client;
3022                dlg.pre_request();
3023                let mut req_builder = hyper::Request::builder()
3024                    .method(hyper::Method::PATCH)
3025                    .uri(url.as_str())
3026                    .header(USER_AGENT, self.hub._user_agent.clone());
3027
3028                if let Some(token) = token.as_ref() {
3029                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
3030                }
3031
3032                let request = req_builder
3033                    .header(CONTENT_TYPE, json_mime_type.to_string())
3034                    .header(CONTENT_LENGTH, request_size as u64)
3035                    .body(common::to_body(
3036                        request_value_reader.get_ref().clone().into(),
3037                    ));
3038
3039                client.request(request.unwrap()).await
3040            };
3041
3042            match req_result {
3043                Err(err) => {
3044                    if let common::Retry::After(d) = dlg.http_error(&err) {
3045                        sleep(d).await;
3046                        continue;
3047                    }
3048                    dlg.finished(false);
3049                    return Err(common::Error::HttpError(err));
3050                }
3051                Ok(res) => {
3052                    let (mut parts, body) = res.into_parts();
3053                    let mut body = common::Body::new(body);
3054                    if !parts.status.is_success() {
3055                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3056                        let error = serde_json::from_str(&common::to_string(&bytes));
3057                        let response = common::to_response(parts, bytes.into());
3058
3059                        if let common::Retry::After(d) =
3060                            dlg.http_failure(&response, error.as_ref().ok())
3061                        {
3062                            sleep(d).await;
3063                            continue;
3064                        }
3065
3066                        dlg.finished(false);
3067
3068                        return Err(match error {
3069                            Ok(value) => common::Error::BadRequest(value),
3070                            _ => common::Error::Failure(response),
3071                        });
3072                    }
3073                    let response = {
3074                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3075                        let encoded = common::to_string(&bytes);
3076                        match serde_json::from_str(&encoded) {
3077                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
3078                            Err(error) => {
3079                                dlg.response_json_decode_error(&encoded, &error);
3080                                return Err(common::Error::JsonDecodeError(
3081                                    encoded.to_string(),
3082                                    error,
3083                                ));
3084                            }
3085                        }
3086                    };
3087
3088                    dlg.finished(true);
3089                    return Ok(response);
3090                }
3091            }
3092        }
3093    }
3094
3095    ///
3096    /// Sets the *request* property to the given value.
3097    ///
3098    /// Even though the property as already been set when instantiating this call,
3099    /// we provide this method for API completeness.
3100    pub fn request(mut self, new_value: Backup) -> ProjectLocationBackupPatchCall<'a, C> {
3101        self._request = new_value;
3102        self
3103    }
3104    /// Output only. The resource name of the backup, in the format `projects/{project_id}/locations/{location_id}/backups/{backup_id}`.
3105    ///
3106    /// Sets the *name* path property to the given value.
3107    ///
3108    /// Even though the property as already been set when instantiating this call,
3109    /// we provide this method for API completeness.
3110    pub fn name(mut self, new_value: &str) -> ProjectLocationBackupPatchCall<'a, C> {
3111        self._name = new_value.to_string();
3112        self
3113    }
3114    /// Required. Mask of fields to update. At least one path must be supplied in this field.
3115    ///
3116    /// Sets the *update mask* query property to the given value.
3117    pub fn update_mask(
3118        mut self,
3119        new_value: common::FieldMask,
3120    ) -> ProjectLocationBackupPatchCall<'a, C> {
3121        self._update_mask = Some(new_value);
3122        self
3123    }
3124    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3125    /// while executing the actual API request.
3126    ///
3127    /// ````text
3128    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
3129    /// ````
3130    ///
3131    /// Sets the *delegate* property to the given value.
3132    pub fn delegate(
3133        mut self,
3134        new_value: &'a mut dyn common::Delegate,
3135    ) -> ProjectLocationBackupPatchCall<'a, C> {
3136        self._delegate = Some(new_value);
3137        self
3138    }
3139
3140    /// Set any additional parameter of the query string used in the request.
3141    /// It should be used to set parameters which are not yet available through their own
3142    /// setters.
3143    ///
3144    /// Please note that this method must not be used to set any of the known parameters
3145    /// which have their own setter method. If done anyway, the request will fail.
3146    ///
3147    /// # Additional Parameters
3148    ///
3149    /// * *$.xgafv* (query-string) - V1 error format.
3150    /// * *access_token* (query-string) - OAuth access token.
3151    /// * *alt* (query-string) - Data format for response.
3152    /// * *callback* (query-string) - JSONP
3153    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
3154    /// * *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.
3155    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3156    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
3157    /// * *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.
3158    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
3159    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
3160    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationBackupPatchCall<'a, C>
3161    where
3162        T: AsRef<str>,
3163    {
3164        self._additional_params
3165            .insert(name.as_ref().to_string(), value.as_ref().to_string());
3166        self
3167    }
3168
3169    /// Identifies the authorization scope for the method you are building.
3170    ///
3171    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
3172    /// [`Scope::CloudPlatform`].
3173    ///
3174    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
3175    /// tokens for more than one scope.
3176    ///
3177    /// Usually there is more than one suitable scope to authorize an operation, some of which may
3178    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
3179    /// sufficient, a read-write scope will do as well.
3180    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationBackupPatchCall<'a, C>
3181    where
3182        St: AsRef<str>,
3183    {
3184        self._scopes.insert(String::from(scope.as_ref()));
3185        self
3186    }
3187    /// Identifies the authorization scope(s) for the method you are building.
3188    ///
3189    /// See [`Self::add_scope()`] for details.
3190    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationBackupPatchCall<'a, C>
3191    where
3192        I: IntoIterator<Item = St>,
3193        St: AsRef<str>,
3194    {
3195        self._scopes
3196            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
3197        self
3198    }
3199
3200    /// Removes all scopes, and no default scope will be used either.
3201    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
3202    /// for details).
3203    pub fn clear_scopes(mut self) -> ProjectLocationBackupPatchCall<'a, C> {
3204        self._scopes.clear();
3205        self
3206    }
3207}
3208
3209/// Creates a share.
3210///
3211/// A builder for the *locations.instances.shares.create* method supported by a *project* resource.
3212/// It is not used directly, but through a [`ProjectMethods`] instance.
3213///
3214/// # Example
3215///
3216/// Instantiate a resource method builder
3217///
3218/// ```test_harness,no_run
3219/// # extern crate hyper;
3220/// # extern crate hyper_rustls;
3221/// # extern crate google_file1_beta1 as file1_beta1;
3222/// use file1_beta1::api::Share;
3223/// # async fn dox() {
3224/// # use file1_beta1::{CloudFilestore, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3225///
3226/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
3227/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
3228/// #     secret,
3229/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3230/// # ).build().await.unwrap();
3231///
3232/// # let client = hyper_util::client::legacy::Client::builder(
3233/// #     hyper_util::rt::TokioExecutor::new()
3234/// # )
3235/// # .build(
3236/// #     hyper_rustls::HttpsConnectorBuilder::new()
3237/// #         .with_native_roots()
3238/// #         .unwrap()
3239/// #         .https_or_http()
3240/// #         .enable_http1()
3241/// #         .build()
3242/// # );
3243/// # let mut hub = CloudFilestore::new(client, auth);
3244/// // As the method needs a request, you would usually fill it with the desired information
3245/// // into the respective structure. Some of the parts shown here might not be applicable !
3246/// // Values shown here are possibly random and not representative !
3247/// let mut req = Share::default();
3248///
3249/// // You can configure optional parameters by calling the respective setters at will, and
3250/// // execute the final call using `doit()`.
3251/// // Values shown here are possibly random and not representative !
3252/// let result = hub.projects().locations_instances_shares_create(req, "parent")
3253///              .share_id("dolor")
3254///              .doit().await;
3255/// # }
3256/// ```
3257pub struct ProjectLocationInstanceShareCreateCall<'a, C>
3258where
3259    C: 'a,
3260{
3261    hub: &'a CloudFilestore<C>,
3262    _request: Share,
3263    _parent: String,
3264    _share_id: Option<String>,
3265    _delegate: Option<&'a mut dyn common::Delegate>,
3266    _additional_params: HashMap<String, String>,
3267    _scopes: BTreeSet<String>,
3268}
3269
3270impl<'a, C> common::CallBuilder for ProjectLocationInstanceShareCreateCall<'a, C> {}
3271
3272impl<'a, C> ProjectLocationInstanceShareCreateCall<'a, C>
3273where
3274    C: common::Connector,
3275{
3276    /// Perform the operation you have build so far.
3277    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
3278        use std::borrow::Cow;
3279        use std::io::{Read, Seek};
3280
3281        use common::{url::Params, ToParts};
3282        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
3283
3284        let mut dd = common::DefaultDelegate;
3285        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
3286        dlg.begin(common::MethodInfo {
3287            id: "file.projects.locations.instances.shares.create",
3288            http_method: hyper::Method::POST,
3289        });
3290
3291        for &field in ["alt", "parent", "shareId"].iter() {
3292            if self._additional_params.contains_key(field) {
3293                dlg.finished(false);
3294                return Err(common::Error::FieldClash(field));
3295            }
3296        }
3297
3298        let mut params = Params::with_capacity(5 + self._additional_params.len());
3299        params.push("parent", self._parent);
3300        if let Some(value) = self._share_id.as_ref() {
3301            params.push("shareId", value);
3302        }
3303
3304        params.extend(self._additional_params.iter());
3305
3306        params.push("alt", "json");
3307        let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/shares";
3308        if self._scopes.is_empty() {
3309            self._scopes
3310                .insert(Scope::CloudPlatform.as_ref().to_string());
3311        }
3312
3313        #[allow(clippy::single_element_loop)]
3314        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
3315            url = params.uri_replacement(url, param_name, find_this, true);
3316        }
3317        {
3318            let to_remove = ["parent"];
3319            params.remove_params(&to_remove);
3320        }
3321
3322        let url = params.parse_with_url(&url);
3323
3324        let mut json_mime_type = mime::APPLICATION_JSON;
3325        let mut request_value_reader = {
3326            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
3327            common::remove_json_null_values(&mut value);
3328            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
3329            serde_json::to_writer(&mut dst, &value).unwrap();
3330            dst
3331        };
3332        let request_size = request_value_reader
3333            .seek(std::io::SeekFrom::End(0))
3334            .unwrap();
3335        request_value_reader
3336            .seek(std::io::SeekFrom::Start(0))
3337            .unwrap();
3338
3339        loop {
3340            let token = match self
3341                .hub
3342                .auth
3343                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
3344                .await
3345            {
3346                Ok(token) => token,
3347                Err(e) => match dlg.token(e) {
3348                    Ok(token) => token,
3349                    Err(e) => {
3350                        dlg.finished(false);
3351                        return Err(common::Error::MissingToken(e));
3352                    }
3353                },
3354            };
3355            request_value_reader
3356                .seek(std::io::SeekFrom::Start(0))
3357                .unwrap();
3358            let mut req_result = {
3359                let client = &self.hub.client;
3360                dlg.pre_request();
3361                let mut req_builder = hyper::Request::builder()
3362                    .method(hyper::Method::POST)
3363                    .uri(url.as_str())
3364                    .header(USER_AGENT, self.hub._user_agent.clone());
3365
3366                if let Some(token) = token.as_ref() {
3367                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
3368                }
3369
3370                let request = req_builder
3371                    .header(CONTENT_TYPE, json_mime_type.to_string())
3372                    .header(CONTENT_LENGTH, request_size as u64)
3373                    .body(common::to_body(
3374                        request_value_reader.get_ref().clone().into(),
3375                    ));
3376
3377                client.request(request.unwrap()).await
3378            };
3379
3380            match req_result {
3381                Err(err) => {
3382                    if let common::Retry::After(d) = dlg.http_error(&err) {
3383                        sleep(d).await;
3384                        continue;
3385                    }
3386                    dlg.finished(false);
3387                    return Err(common::Error::HttpError(err));
3388                }
3389                Ok(res) => {
3390                    let (mut parts, body) = res.into_parts();
3391                    let mut body = common::Body::new(body);
3392                    if !parts.status.is_success() {
3393                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3394                        let error = serde_json::from_str(&common::to_string(&bytes));
3395                        let response = common::to_response(parts, bytes.into());
3396
3397                        if let common::Retry::After(d) =
3398                            dlg.http_failure(&response, error.as_ref().ok())
3399                        {
3400                            sleep(d).await;
3401                            continue;
3402                        }
3403
3404                        dlg.finished(false);
3405
3406                        return Err(match error {
3407                            Ok(value) => common::Error::BadRequest(value),
3408                            _ => common::Error::Failure(response),
3409                        });
3410                    }
3411                    let response = {
3412                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3413                        let encoded = common::to_string(&bytes);
3414                        match serde_json::from_str(&encoded) {
3415                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
3416                            Err(error) => {
3417                                dlg.response_json_decode_error(&encoded, &error);
3418                                return Err(common::Error::JsonDecodeError(
3419                                    encoded.to_string(),
3420                                    error,
3421                                ));
3422                            }
3423                        }
3424                    };
3425
3426                    dlg.finished(true);
3427                    return Ok(response);
3428                }
3429            }
3430        }
3431    }
3432
3433    ///
3434    /// Sets the *request* property to the given value.
3435    ///
3436    /// Even though the property as already been set when instantiating this call,
3437    /// we provide this method for API completeness.
3438    pub fn request(mut self, new_value: Share) -> ProjectLocationInstanceShareCreateCall<'a, C> {
3439        self._request = new_value;
3440        self
3441    }
3442    /// Required. The Filestore Instance to create the share for, in the format `projects/{project_id}/locations/{location}/instances/{instance_id}`
3443    ///
3444    /// Sets the *parent* path property to the given value.
3445    ///
3446    /// Even though the property as already been set when instantiating this call,
3447    /// we provide this method for API completeness.
3448    pub fn parent(mut self, new_value: &str) -> ProjectLocationInstanceShareCreateCall<'a, C> {
3449        self._parent = new_value.to_string();
3450        self
3451    }
3452    /// Required. The ID to use for the share. The ID must be unique within the specified instance. This value must start with a lowercase letter followed by up to 62 lowercase letters, numbers, or hyphens, and cannot end with a hyphen.
3453    ///
3454    /// Sets the *share id* query property to the given value.
3455    pub fn share_id(mut self, new_value: &str) -> ProjectLocationInstanceShareCreateCall<'a, C> {
3456        self._share_id = Some(new_value.to_string());
3457        self
3458    }
3459    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3460    /// while executing the actual API request.
3461    ///
3462    /// ````text
3463    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
3464    /// ````
3465    ///
3466    /// Sets the *delegate* property to the given value.
3467    pub fn delegate(
3468        mut self,
3469        new_value: &'a mut dyn common::Delegate,
3470    ) -> ProjectLocationInstanceShareCreateCall<'a, C> {
3471        self._delegate = Some(new_value);
3472        self
3473    }
3474
3475    /// Set any additional parameter of the query string used in the request.
3476    /// It should be used to set parameters which are not yet available through their own
3477    /// setters.
3478    ///
3479    /// Please note that this method must not be used to set any of the known parameters
3480    /// which have their own setter method. If done anyway, the request will fail.
3481    ///
3482    /// # Additional Parameters
3483    ///
3484    /// * *$.xgafv* (query-string) - V1 error format.
3485    /// * *access_token* (query-string) - OAuth access token.
3486    /// * *alt* (query-string) - Data format for response.
3487    /// * *callback* (query-string) - JSONP
3488    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
3489    /// * *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.
3490    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3491    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
3492    /// * *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.
3493    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
3494    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
3495    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationInstanceShareCreateCall<'a, C>
3496    where
3497        T: AsRef<str>,
3498    {
3499        self._additional_params
3500            .insert(name.as_ref().to_string(), value.as_ref().to_string());
3501        self
3502    }
3503
3504    /// Identifies the authorization scope for the method you are building.
3505    ///
3506    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
3507    /// [`Scope::CloudPlatform`].
3508    ///
3509    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
3510    /// tokens for more than one scope.
3511    ///
3512    /// Usually there is more than one suitable scope to authorize an operation, some of which may
3513    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
3514    /// sufficient, a read-write scope will do as well.
3515    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationInstanceShareCreateCall<'a, C>
3516    where
3517        St: AsRef<str>,
3518    {
3519        self._scopes.insert(String::from(scope.as_ref()));
3520        self
3521    }
3522    /// Identifies the authorization scope(s) for the method you are building.
3523    ///
3524    /// See [`Self::add_scope()`] for details.
3525    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationInstanceShareCreateCall<'a, C>
3526    where
3527        I: IntoIterator<Item = St>,
3528        St: AsRef<str>,
3529    {
3530        self._scopes
3531            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
3532        self
3533    }
3534
3535    /// Removes all scopes, and no default scope will be used either.
3536    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
3537    /// for details).
3538    pub fn clear_scopes(mut self) -> ProjectLocationInstanceShareCreateCall<'a, C> {
3539        self._scopes.clear();
3540        self
3541    }
3542}
3543
3544/// Deletes a share.
3545///
3546/// A builder for the *locations.instances.shares.delete* method supported by a *project* resource.
3547/// It is not used directly, but through a [`ProjectMethods`] instance.
3548///
3549/// # Example
3550///
3551/// Instantiate a resource method builder
3552///
3553/// ```test_harness,no_run
3554/// # extern crate hyper;
3555/// # extern crate hyper_rustls;
3556/// # extern crate google_file1_beta1 as file1_beta1;
3557/// # async fn dox() {
3558/// # use file1_beta1::{CloudFilestore, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3559///
3560/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
3561/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
3562/// #     secret,
3563/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3564/// # ).build().await.unwrap();
3565///
3566/// # let client = hyper_util::client::legacy::Client::builder(
3567/// #     hyper_util::rt::TokioExecutor::new()
3568/// # )
3569/// # .build(
3570/// #     hyper_rustls::HttpsConnectorBuilder::new()
3571/// #         .with_native_roots()
3572/// #         .unwrap()
3573/// #         .https_or_http()
3574/// #         .enable_http1()
3575/// #         .build()
3576/// # );
3577/// # let mut hub = CloudFilestore::new(client, auth);
3578/// // You can configure optional parameters by calling the respective setters at will, and
3579/// // execute the final call using `doit()`.
3580/// // Values shown here are possibly random and not representative !
3581/// let result = hub.projects().locations_instances_shares_delete("name")
3582///              .doit().await;
3583/// # }
3584/// ```
3585pub struct ProjectLocationInstanceShareDeleteCall<'a, C>
3586where
3587    C: 'a,
3588{
3589    hub: &'a CloudFilestore<C>,
3590    _name: String,
3591    _delegate: Option<&'a mut dyn common::Delegate>,
3592    _additional_params: HashMap<String, String>,
3593    _scopes: BTreeSet<String>,
3594}
3595
3596impl<'a, C> common::CallBuilder for ProjectLocationInstanceShareDeleteCall<'a, C> {}
3597
3598impl<'a, C> ProjectLocationInstanceShareDeleteCall<'a, C>
3599where
3600    C: common::Connector,
3601{
3602    /// Perform the operation you have build so far.
3603    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
3604        use std::borrow::Cow;
3605        use std::io::{Read, Seek};
3606
3607        use common::{url::Params, ToParts};
3608        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
3609
3610        let mut dd = common::DefaultDelegate;
3611        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
3612        dlg.begin(common::MethodInfo {
3613            id: "file.projects.locations.instances.shares.delete",
3614            http_method: hyper::Method::DELETE,
3615        });
3616
3617        for &field in ["alt", "name"].iter() {
3618            if self._additional_params.contains_key(field) {
3619                dlg.finished(false);
3620                return Err(common::Error::FieldClash(field));
3621            }
3622        }
3623
3624        let mut params = Params::with_capacity(3 + self._additional_params.len());
3625        params.push("name", self._name);
3626
3627        params.extend(self._additional_params.iter());
3628
3629        params.push("alt", "json");
3630        let mut url = self.hub._base_url.clone() + "v1beta1/{+name}";
3631        if self._scopes.is_empty() {
3632            self._scopes
3633                .insert(Scope::CloudPlatform.as_ref().to_string());
3634        }
3635
3636        #[allow(clippy::single_element_loop)]
3637        for &(find_this, param_name) in [("{+name}", "name")].iter() {
3638            url = params.uri_replacement(url, param_name, find_this, true);
3639        }
3640        {
3641            let to_remove = ["name"];
3642            params.remove_params(&to_remove);
3643        }
3644
3645        let url = params.parse_with_url(&url);
3646
3647        loop {
3648            let token = match self
3649                .hub
3650                .auth
3651                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
3652                .await
3653            {
3654                Ok(token) => token,
3655                Err(e) => match dlg.token(e) {
3656                    Ok(token) => token,
3657                    Err(e) => {
3658                        dlg.finished(false);
3659                        return Err(common::Error::MissingToken(e));
3660                    }
3661                },
3662            };
3663            let mut req_result = {
3664                let client = &self.hub.client;
3665                dlg.pre_request();
3666                let mut req_builder = hyper::Request::builder()
3667                    .method(hyper::Method::DELETE)
3668                    .uri(url.as_str())
3669                    .header(USER_AGENT, self.hub._user_agent.clone());
3670
3671                if let Some(token) = token.as_ref() {
3672                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
3673                }
3674
3675                let request = req_builder
3676                    .header(CONTENT_LENGTH, 0_u64)
3677                    .body(common::to_body::<String>(None));
3678
3679                client.request(request.unwrap()).await
3680            };
3681
3682            match req_result {
3683                Err(err) => {
3684                    if let common::Retry::After(d) = dlg.http_error(&err) {
3685                        sleep(d).await;
3686                        continue;
3687                    }
3688                    dlg.finished(false);
3689                    return Err(common::Error::HttpError(err));
3690                }
3691                Ok(res) => {
3692                    let (mut parts, body) = res.into_parts();
3693                    let mut body = common::Body::new(body);
3694                    if !parts.status.is_success() {
3695                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3696                        let error = serde_json::from_str(&common::to_string(&bytes));
3697                        let response = common::to_response(parts, bytes.into());
3698
3699                        if let common::Retry::After(d) =
3700                            dlg.http_failure(&response, error.as_ref().ok())
3701                        {
3702                            sleep(d).await;
3703                            continue;
3704                        }
3705
3706                        dlg.finished(false);
3707
3708                        return Err(match error {
3709                            Ok(value) => common::Error::BadRequest(value),
3710                            _ => common::Error::Failure(response),
3711                        });
3712                    }
3713                    let response = {
3714                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3715                        let encoded = common::to_string(&bytes);
3716                        match serde_json::from_str(&encoded) {
3717                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
3718                            Err(error) => {
3719                                dlg.response_json_decode_error(&encoded, &error);
3720                                return Err(common::Error::JsonDecodeError(
3721                                    encoded.to_string(),
3722                                    error,
3723                                ));
3724                            }
3725                        }
3726                    };
3727
3728                    dlg.finished(true);
3729                    return Ok(response);
3730                }
3731            }
3732        }
3733    }
3734
3735    /// Required. The share resource name, in the format `projects/{project_id}/locations/{location}/instances/{instance_id}/share/{share_id}`
3736    ///
3737    /// Sets the *name* path property to the given value.
3738    ///
3739    /// Even though the property as already been set when instantiating this call,
3740    /// we provide this method for API completeness.
3741    pub fn name(mut self, new_value: &str) -> ProjectLocationInstanceShareDeleteCall<'a, C> {
3742        self._name = new_value.to_string();
3743        self
3744    }
3745    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3746    /// while executing the actual API request.
3747    ///
3748    /// ````text
3749    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
3750    /// ````
3751    ///
3752    /// Sets the *delegate* property to the given value.
3753    pub fn delegate(
3754        mut self,
3755        new_value: &'a mut dyn common::Delegate,
3756    ) -> ProjectLocationInstanceShareDeleteCall<'a, C> {
3757        self._delegate = Some(new_value);
3758        self
3759    }
3760
3761    /// Set any additional parameter of the query string used in the request.
3762    /// It should be used to set parameters which are not yet available through their own
3763    /// setters.
3764    ///
3765    /// Please note that this method must not be used to set any of the known parameters
3766    /// which have their own setter method. If done anyway, the request will fail.
3767    ///
3768    /// # Additional Parameters
3769    ///
3770    /// * *$.xgafv* (query-string) - V1 error format.
3771    /// * *access_token* (query-string) - OAuth access token.
3772    /// * *alt* (query-string) - Data format for response.
3773    /// * *callback* (query-string) - JSONP
3774    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
3775    /// * *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.
3776    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3777    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
3778    /// * *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.
3779    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
3780    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
3781    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationInstanceShareDeleteCall<'a, C>
3782    where
3783        T: AsRef<str>,
3784    {
3785        self._additional_params
3786            .insert(name.as_ref().to_string(), value.as_ref().to_string());
3787        self
3788    }
3789
3790    /// Identifies the authorization scope for the method you are building.
3791    ///
3792    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
3793    /// [`Scope::CloudPlatform`].
3794    ///
3795    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
3796    /// tokens for more than one scope.
3797    ///
3798    /// Usually there is more than one suitable scope to authorize an operation, some of which may
3799    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
3800    /// sufficient, a read-write scope will do as well.
3801    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationInstanceShareDeleteCall<'a, C>
3802    where
3803        St: AsRef<str>,
3804    {
3805        self._scopes.insert(String::from(scope.as_ref()));
3806        self
3807    }
3808    /// Identifies the authorization scope(s) for the method you are building.
3809    ///
3810    /// See [`Self::add_scope()`] for details.
3811    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationInstanceShareDeleteCall<'a, C>
3812    where
3813        I: IntoIterator<Item = St>,
3814        St: AsRef<str>,
3815    {
3816        self._scopes
3817            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
3818        self
3819    }
3820
3821    /// Removes all scopes, and no default scope will be used either.
3822    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
3823    /// for details).
3824    pub fn clear_scopes(mut self) -> ProjectLocationInstanceShareDeleteCall<'a, C> {
3825        self._scopes.clear();
3826        self
3827    }
3828}
3829
3830/// Gets the details of a specific share.
3831///
3832/// A builder for the *locations.instances.shares.get* method supported by a *project* resource.
3833/// It is not used directly, but through a [`ProjectMethods`] instance.
3834///
3835/// # Example
3836///
3837/// Instantiate a resource method builder
3838///
3839/// ```test_harness,no_run
3840/// # extern crate hyper;
3841/// # extern crate hyper_rustls;
3842/// # extern crate google_file1_beta1 as file1_beta1;
3843/// # async fn dox() {
3844/// # use file1_beta1::{CloudFilestore, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3845///
3846/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
3847/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
3848/// #     secret,
3849/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3850/// # ).build().await.unwrap();
3851///
3852/// # let client = hyper_util::client::legacy::Client::builder(
3853/// #     hyper_util::rt::TokioExecutor::new()
3854/// # )
3855/// # .build(
3856/// #     hyper_rustls::HttpsConnectorBuilder::new()
3857/// #         .with_native_roots()
3858/// #         .unwrap()
3859/// #         .https_or_http()
3860/// #         .enable_http1()
3861/// #         .build()
3862/// # );
3863/// # let mut hub = CloudFilestore::new(client, auth);
3864/// // You can configure optional parameters by calling the respective setters at will, and
3865/// // execute the final call using `doit()`.
3866/// // Values shown here are possibly random and not representative !
3867/// let result = hub.projects().locations_instances_shares_get("name")
3868///              .doit().await;
3869/// # }
3870/// ```
3871pub struct ProjectLocationInstanceShareGetCall<'a, C>
3872where
3873    C: 'a,
3874{
3875    hub: &'a CloudFilestore<C>,
3876    _name: String,
3877    _delegate: Option<&'a mut dyn common::Delegate>,
3878    _additional_params: HashMap<String, String>,
3879    _scopes: BTreeSet<String>,
3880}
3881
3882impl<'a, C> common::CallBuilder for ProjectLocationInstanceShareGetCall<'a, C> {}
3883
3884impl<'a, C> ProjectLocationInstanceShareGetCall<'a, C>
3885where
3886    C: common::Connector,
3887{
3888    /// Perform the operation you have build so far.
3889    pub async fn doit(mut self) -> common::Result<(common::Response, Share)> {
3890        use std::borrow::Cow;
3891        use std::io::{Read, Seek};
3892
3893        use common::{url::Params, ToParts};
3894        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
3895
3896        let mut dd = common::DefaultDelegate;
3897        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
3898        dlg.begin(common::MethodInfo {
3899            id: "file.projects.locations.instances.shares.get",
3900            http_method: hyper::Method::GET,
3901        });
3902
3903        for &field in ["alt", "name"].iter() {
3904            if self._additional_params.contains_key(field) {
3905                dlg.finished(false);
3906                return Err(common::Error::FieldClash(field));
3907            }
3908        }
3909
3910        let mut params = Params::with_capacity(3 + self._additional_params.len());
3911        params.push("name", self._name);
3912
3913        params.extend(self._additional_params.iter());
3914
3915        params.push("alt", "json");
3916        let mut url = self.hub._base_url.clone() + "v1beta1/{+name}";
3917        if self._scopes.is_empty() {
3918            self._scopes
3919                .insert(Scope::CloudPlatform.as_ref().to_string());
3920        }
3921
3922        #[allow(clippy::single_element_loop)]
3923        for &(find_this, param_name) in [("{+name}", "name")].iter() {
3924            url = params.uri_replacement(url, param_name, find_this, true);
3925        }
3926        {
3927            let to_remove = ["name"];
3928            params.remove_params(&to_remove);
3929        }
3930
3931        let url = params.parse_with_url(&url);
3932
3933        loop {
3934            let token = match self
3935                .hub
3936                .auth
3937                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
3938                .await
3939            {
3940                Ok(token) => token,
3941                Err(e) => match dlg.token(e) {
3942                    Ok(token) => token,
3943                    Err(e) => {
3944                        dlg.finished(false);
3945                        return Err(common::Error::MissingToken(e));
3946                    }
3947                },
3948            };
3949            let mut req_result = {
3950                let client = &self.hub.client;
3951                dlg.pre_request();
3952                let mut req_builder = hyper::Request::builder()
3953                    .method(hyper::Method::GET)
3954                    .uri(url.as_str())
3955                    .header(USER_AGENT, self.hub._user_agent.clone());
3956
3957                if let Some(token) = token.as_ref() {
3958                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
3959                }
3960
3961                let request = req_builder
3962                    .header(CONTENT_LENGTH, 0_u64)
3963                    .body(common::to_body::<String>(None));
3964
3965                client.request(request.unwrap()).await
3966            };
3967
3968            match req_result {
3969                Err(err) => {
3970                    if let common::Retry::After(d) = dlg.http_error(&err) {
3971                        sleep(d).await;
3972                        continue;
3973                    }
3974                    dlg.finished(false);
3975                    return Err(common::Error::HttpError(err));
3976                }
3977                Ok(res) => {
3978                    let (mut parts, body) = res.into_parts();
3979                    let mut body = common::Body::new(body);
3980                    if !parts.status.is_success() {
3981                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3982                        let error = serde_json::from_str(&common::to_string(&bytes));
3983                        let response = common::to_response(parts, bytes.into());
3984
3985                        if let common::Retry::After(d) =
3986                            dlg.http_failure(&response, error.as_ref().ok())
3987                        {
3988                            sleep(d).await;
3989                            continue;
3990                        }
3991
3992                        dlg.finished(false);
3993
3994                        return Err(match error {
3995                            Ok(value) => common::Error::BadRequest(value),
3996                            _ => common::Error::Failure(response),
3997                        });
3998                    }
3999                    let response = {
4000                        let bytes = common::to_bytes(body).await.unwrap_or_default();
4001                        let encoded = common::to_string(&bytes);
4002                        match serde_json::from_str(&encoded) {
4003                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4004                            Err(error) => {
4005                                dlg.response_json_decode_error(&encoded, &error);
4006                                return Err(common::Error::JsonDecodeError(
4007                                    encoded.to_string(),
4008                                    error,
4009                                ));
4010                            }
4011                        }
4012                    };
4013
4014                    dlg.finished(true);
4015                    return Ok(response);
4016                }
4017            }
4018        }
4019    }
4020
4021    /// Required. The share resource name, in the format `projects/{project_id}/locations/{location}/instances/{instance_id}/shares/{share_id}`
4022    ///
4023    /// Sets the *name* path property to the given value.
4024    ///
4025    /// Even though the property as already been set when instantiating this call,
4026    /// we provide this method for API completeness.
4027    pub fn name(mut self, new_value: &str) -> ProjectLocationInstanceShareGetCall<'a, C> {
4028        self._name = new_value.to_string();
4029        self
4030    }
4031    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4032    /// while executing the actual API request.
4033    ///
4034    /// ````text
4035    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
4036    /// ````
4037    ///
4038    /// Sets the *delegate* property to the given value.
4039    pub fn delegate(
4040        mut self,
4041        new_value: &'a mut dyn common::Delegate,
4042    ) -> ProjectLocationInstanceShareGetCall<'a, C> {
4043        self._delegate = Some(new_value);
4044        self
4045    }
4046
4047    /// Set any additional parameter of the query string used in the request.
4048    /// It should be used to set parameters which are not yet available through their own
4049    /// setters.
4050    ///
4051    /// Please note that this method must not be used to set any of the known parameters
4052    /// which have their own setter method. If done anyway, the request will fail.
4053    ///
4054    /// # Additional Parameters
4055    ///
4056    /// * *$.xgafv* (query-string) - V1 error format.
4057    /// * *access_token* (query-string) - OAuth access token.
4058    /// * *alt* (query-string) - Data format for response.
4059    /// * *callback* (query-string) - JSONP
4060    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4061    /// * *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.
4062    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4063    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4064    /// * *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.
4065    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4066    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4067    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationInstanceShareGetCall<'a, C>
4068    where
4069        T: AsRef<str>,
4070    {
4071        self._additional_params
4072            .insert(name.as_ref().to_string(), value.as_ref().to_string());
4073        self
4074    }
4075
4076    /// Identifies the authorization scope for the method you are building.
4077    ///
4078    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
4079    /// [`Scope::CloudPlatform`].
4080    ///
4081    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4082    /// tokens for more than one scope.
4083    ///
4084    /// Usually there is more than one suitable scope to authorize an operation, some of which may
4085    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
4086    /// sufficient, a read-write scope will do as well.
4087    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationInstanceShareGetCall<'a, C>
4088    where
4089        St: AsRef<str>,
4090    {
4091        self._scopes.insert(String::from(scope.as_ref()));
4092        self
4093    }
4094    /// Identifies the authorization scope(s) for the method you are building.
4095    ///
4096    /// See [`Self::add_scope()`] for details.
4097    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationInstanceShareGetCall<'a, C>
4098    where
4099        I: IntoIterator<Item = St>,
4100        St: AsRef<str>,
4101    {
4102        self._scopes
4103            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
4104        self
4105    }
4106
4107    /// Removes all scopes, and no default scope will be used either.
4108    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
4109    /// for details).
4110    pub fn clear_scopes(mut self) -> ProjectLocationInstanceShareGetCall<'a, C> {
4111        self._scopes.clear();
4112        self
4113    }
4114}
4115
4116/// Lists all shares for a specified instance.
4117///
4118/// A builder for the *locations.instances.shares.list* method supported by a *project* resource.
4119/// It is not used directly, but through a [`ProjectMethods`] instance.
4120///
4121/// # Example
4122///
4123/// Instantiate a resource method builder
4124///
4125/// ```test_harness,no_run
4126/// # extern crate hyper;
4127/// # extern crate hyper_rustls;
4128/// # extern crate google_file1_beta1 as file1_beta1;
4129/// # async fn dox() {
4130/// # use file1_beta1::{CloudFilestore, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4131///
4132/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4133/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
4134/// #     secret,
4135/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4136/// # ).build().await.unwrap();
4137///
4138/// # let client = hyper_util::client::legacy::Client::builder(
4139/// #     hyper_util::rt::TokioExecutor::new()
4140/// # )
4141/// # .build(
4142/// #     hyper_rustls::HttpsConnectorBuilder::new()
4143/// #         .with_native_roots()
4144/// #         .unwrap()
4145/// #         .https_or_http()
4146/// #         .enable_http1()
4147/// #         .build()
4148/// # );
4149/// # let mut hub = CloudFilestore::new(client, auth);
4150/// // You can configure optional parameters by calling the respective setters at will, and
4151/// // execute the final call using `doit()`.
4152/// // Values shown here are possibly random and not representative !
4153/// let result = hub.projects().locations_instances_shares_list("parent")
4154///              .page_token("amet")
4155///              .page_size(-20)
4156///              .order_by("ipsum")
4157///              .filter("sed")
4158///              .doit().await;
4159/// # }
4160/// ```
4161pub struct ProjectLocationInstanceShareListCall<'a, C>
4162where
4163    C: 'a,
4164{
4165    hub: &'a CloudFilestore<C>,
4166    _parent: String,
4167    _page_token: Option<String>,
4168    _page_size: Option<i32>,
4169    _order_by: Option<String>,
4170    _filter: Option<String>,
4171    _delegate: Option<&'a mut dyn common::Delegate>,
4172    _additional_params: HashMap<String, String>,
4173    _scopes: BTreeSet<String>,
4174}
4175
4176impl<'a, C> common::CallBuilder for ProjectLocationInstanceShareListCall<'a, C> {}
4177
4178impl<'a, C> ProjectLocationInstanceShareListCall<'a, C>
4179where
4180    C: common::Connector,
4181{
4182    /// Perform the operation you have build so far.
4183    pub async fn doit(mut self) -> common::Result<(common::Response, ListSharesResponse)> {
4184        use std::borrow::Cow;
4185        use std::io::{Read, Seek};
4186
4187        use common::{url::Params, ToParts};
4188        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
4189
4190        let mut dd = common::DefaultDelegate;
4191        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
4192        dlg.begin(common::MethodInfo {
4193            id: "file.projects.locations.instances.shares.list",
4194            http_method: hyper::Method::GET,
4195        });
4196
4197        for &field in [
4198            "alt",
4199            "parent",
4200            "pageToken",
4201            "pageSize",
4202            "orderBy",
4203            "filter",
4204        ]
4205        .iter()
4206        {
4207            if self._additional_params.contains_key(field) {
4208                dlg.finished(false);
4209                return Err(common::Error::FieldClash(field));
4210            }
4211        }
4212
4213        let mut params = Params::with_capacity(7 + self._additional_params.len());
4214        params.push("parent", self._parent);
4215        if let Some(value) = self._page_token.as_ref() {
4216            params.push("pageToken", value);
4217        }
4218        if let Some(value) = self._page_size.as_ref() {
4219            params.push("pageSize", value.to_string());
4220        }
4221        if let Some(value) = self._order_by.as_ref() {
4222            params.push("orderBy", value);
4223        }
4224        if let Some(value) = self._filter.as_ref() {
4225            params.push("filter", value);
4226        }
4227
4228        params.extend(self._additional_params.iter());
4229
4230        params.push("alt", "json");
4231        let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/shares";
4232        if self._scopes.is_empty() {
4233            self._scopes
4234                .insert(Scope::CloudPlatform.as_ref().to_string());
4235        }
4236
4237        #[allow(clippy::single_element_loop)]
4238        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
4239            url = params.uri_replacement(url, param_name, find_this, true);
4240        }
4241        {
4242            let to_remove = ["parent"];
4243            params.remove_params(&to_remove);
4244        }
4245
4246        let url = params.parse_with_url(&url);
4247
4248        loop {
4249            let token = match self
4250                .hub
4251                .auth
4252                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
4253                .await
4254            {
4255                Ok(token) => token,
4256                Err(e) => match dlg.token(e) {
4257                    Ok(token) => token,
4258                    Err(e) => {
4259                        dlg.finished(false);
4260                        return Err(common::Error::MissingToken(e));
4261                    }
4262                },
4263            };
4264            let mut req_result = {
4265                let client = &self.hub.client;
4266                dlg.pre_request();
4267                let mut req_builder = hyper::Request::builder()
4268                    .method(hyper::Method::GET)
4269                    .uri(url.as_str())
4270                    .header(USER_AGENT, self.hub._user_agent.clone());
4271
4272                if let Some(token) = token.as_ref() {
4273                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
4274                }
4275
4276                let request = req_builder
4277                    .header(CONTENT_LENGTH, 0_u64)
4278                    .body(common::to_body::<String>(None));
4279
4280                client.request(request.unwrap()).await
4281            };
4282
4283            match req_result {
4284                Err(err) => {
4285                    if let common::Retry::After(d) = dlg.http_error(&err) {
4286                        sleep(d).await;
4287                        continue;
4288                    }
4289                    dlg.finished(false);
4290                    return Err(common::Error::HttpError(err));
4291                }
4292                Ok(res) => {
4293                    let (mut parts, body) = res.into_parts();
4294                    let mut body = common::Body::new(body);
4295                    if !parts.status.is_success() {
4296                        let bytes = common::to_bytes(body).await.unwrap_or_default();
4297                        let error = serde_json::from_str(&common::to_string(&bytes));
4298                        let response = common::to_response(parts, bytes.into());
4299
4300                        if let common::Retry::After(d) =
4301                            dlg.http_failure(&response, error.as_ref().ok())
4302                        {
4303                            sleep(d).await;
4304                            continue;
4305                        }
4306
4307                        dlg.finished(false);
4308
4309                        return Err(match error {
4310                            Ok(value) => common::Error::BadRequest(value),
4311                            _ => common::Error::Failure(response),
4312                        });
4313                    }
4314                    let response = {
4315                        let bytes = common::to_bytes(body).await.unwrap_or_default();
4316                        let encoded = common::to_string(&bytes);
4317                        match serde_json::from_str(&encoded) {
4318                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4319                            Err(error) => {
4320                                dlg.response_json_decode_error(&encoded, &error);
4321                                return Err(common::Error::JsonDecodeError(
4322                                    encoded.to_string(),
4323                                    error,
4324                                ));
4325                            }
4326                        }
4327                    };
4328
4329                    dlg.finished(true);
4330                    return Ok(response);
4331                }
4332            }
4333        }
4334    }
4335
4336    /// Required. The instance for which to retrieve share information, in the format `projects/{project_id}/locations/{location}/instances/{instance_id}`.
4337    ///
4338    /// Sets the *parent* path property to the given value.
4339    ///
4340    /// Even though the property as already been set when instantiating this call,
4341    /// we provide this method for API completeness.
4342    pub fn parent(mut self, new_value: &str) -> ProjectLocationInstanceShareListCall<'a, C> {
4343        self._parent = new_value.to_string();
4344        self
4345    }
4346    /// The next_page_token value to use if there are additional results to retrieve for this list request.
4347    ///
4348    /// Sets the *page token* query property to the given value.
4349    pub fn page_token(mut self, new_value: &str) -> ProjectLocationInstanceShareListCall<'a, C> {
4350        self._page_token = Some(new_value.to_string());
4351        self
4352    }
4353    /// The maximum number of items to return.
4354    ///
4355    /// Sets the *page size* query property to the given value.
4356    pub fn page_size(mut self, new_value: i32) -> ProjectLocationInstanceShareListCall<'a, C> {
4357        self._page_size = Some(new_value);
4358        self
4359    }
4360    /// Sort results. Supported values are "name", "name desc" or "" (unsorted).
4361    ///
4362    /// Sets the *order by* query property to the given value.
4363    pub fn order_by(mut self, new_value: &str) -> ProjectLocationInstanceShareListCall<'a, C> {
4364        self._order_by = Some(new_value.to_string());
4365        self
4366    }
4367    /// List filter.
4368    ///
4369    /// Sets the *filter* query property to the given value.
4370    pub fn filter(mut self, new_value: &str) -> ProjectLocationInstanceShareListCall<'a, C> {
4371        self._filter = Some(new_value.to_string());
4372        self
4373    }
4374    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4375    /// while executing the actual API request.
4376    ///
4377    /// ````text
4378    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
4379    /// ````
4380    ///
4381    /// Sets the *delegate* property to the given value.
4382    pub fn delegate(
4383        mut self,
4384        new_value: &'a mut dyn common::Delegate,
4385    ) -> ProjectLocationInstanceShareListCall<'a, C> {
4386        self._delegate = Some(new_value);
4387        self
4388    }
4389
4390    /// Set any additional parameter of the query string used in the request.
4391    /// It should be used to set parameters which are not yet available through their own
4392    /// setters.
4393    ///
4394    /// Please note that this method must not be used to set any of the known parameters
4395    /// which have their own setter method. If done anyway, the request will fail.
4396    ///
4397    /// # Additional Parameters
4398    ///
4399    /// * *$.xgafv* (query-string) - V1 error format.
4400    /// * *access_token* (query-string) - OAuth access token.
4401    /// * *alt* (query-string) - Data format for response.
4402    /// * *callback* (query-string) - JSONP
4403    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4404    /// * *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.
4405    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4406    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4407    /// * *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.
4408    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4409    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4410    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationInstanceShareListCall<'a, C>
4411    where
4412        T: AsRef<str>,
4413    {
4414        self._additional_params
4415            .insert(name.as_ref().to_string(), value.as_ref().to_string());
4416        self
4417    }
4418
4419    /// Identifies the authorization scope for the method you are building.
4420    ///
4421    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
4422    /// [`Scope::CloudPlatform`].
4423    ///
4424    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4425    /// tokens for more than one scope.
4426    ///
4427    /// Usually there is more than one suitable scope to authorize an operation, some of which may
4428    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
4429    /// sufficient, a read-write scope will do as well.
4430    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationInstanceShareListCall<'a, C>
4431    where
4432        St: AsRef<str>,
4433    {
4434        self._scopes.insert(String::from(scope.as_ref()));
4435        self
4436    }
4437    /// Identifies the authorization scope(s) for the method you are building.
4438    ///
4439    /// See [`Self::add_scope()`] for details.
4440    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationInstanceShareListCall<'a, C>
4441    where
4442        I: IntoIterator<Item = St>,
4443        St: AsRef<str>,
4444    {
4445        self._scopes
4446            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
4447        self
4448    }
4449
4450    /// Removes all scopes, and no default scope will be used either.
4451    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
4452    /// for details).
4453    pub fn clear_scopes(mut self) -> ProjectLocationInstanceShareListCall<'a, C> {
4454        self._scopes.clear();
4455        self
4456    }
4457}
4458
4459/// Updates the settings of a specific share.
4460///
4461/// A builder for the *locations.instances.shares.patch* method supported by a *project* resource.
4462/// It is not used directly, but through a [`ProjectMethods`] instance.
4463///
4464/// # Example
4465///
4466/// Instantiate a resource method builder
4467///
4468/// ```test_harness,no_run
4469/// # extern crate hyper;
4470/// # extern crate hyper_rustls;
4471/// # extern crate google_file1_beta1 as file1_beta1;
4472/// use file1_beta1::api::Share;
4473/// # async fn dox() {
4474/// # use file1_beta1::{CloudFilestore, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4475///
4476/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4477/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
4478/// #     secret,
4479/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4480/// # ).build().await.unwrap();
4481///
4482/// # let client = hyper_util::client::legacy::Client::builder(
4483/// #     hyper_util::rt::TokioExecutor::new()
4484/// # )
4485/// # .build(
4486/// #     hyper_rustls::HttpsConnectorBuilder::new()
4487/// #         .with_native_roots()
4488/// #         .unwrap()
4489/// #         .https_or_http()
4490/// #         .enable_http1()
4491/// #         .build()
4492/// # );
4493/// # let mut hub = CloudFilestore::new(client, auth);
4494/// // As the method needs a request, you would usually fill it with the desired information
4495/// // into the respective structure. Some of the parts shown here might not be applicable !
4496/// // Values shown here are possibly random and not representative !
4497/// let mut req = Share::default();
4498///
4499/// // You can configure optional parameters by calling the respective setters at will, and
4500/// // execute the final call using `doit()`.
4501/// // Values shown here are possibly random and not representative !
4502/// let result = hub.projects().locations_instances_shares_patch(req, "name")
4503///              .update_mask(FieldMask::new::<&str>(&[]))
4504///              .doit().await;
4505/// # }
4506/// ```
4507pub struct ProjectLocationInstanceSharePatchCall<'a, C>
4508where
4509    C: 'a,
4510{
4511    hub: &'a CloudFilestore<C>,
4512    _request: Share,
4513    _name: String,
4514    _update_mask: Option<common::FieldMask>,
4515    _delegate: Option<&'a mut dyn common::Delegate>,
4516    _additional_params: HashMap<String, String>,
4517    _scopes: BTreeSet<String>,
4518}
4519
4520impl<'a, C> common::CallBuilder for ProjectLocationInstanceSharePatchCall<'a, C> {}
4521
4522impl<'a, C> ProjectLocationInstanceSharePatchCall<'a, C>
4523where
4524    C: common::Connector,
4525{
4526    /// Perform the operation you have build so far.
4527    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
4528        use std::borrow::Cow;
4529        use std::io::{Read, Seek};
4530
4531        use common::{url::Params, ToParts};
4532        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
4533
4534        let mut dd = common::DefaultDelegate;
4535        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
4536        dlg.begin(common::MethodInfo {
4537            id: "file.projects.locations.instances.shares.patch",
4538            http_method: hyper::Method::PATCH,
4539        });
4540
4541        for &field in ["alt", "name", "updateMask"].iter() {
4542            if self._additional_params.contains_key(field) {
4543                dlg.finished(false);
4544                return Err(common::Error::FieldClash(field));
4545            }
4546        }
4547
4548        let mut params = Params::with_capacity(5 + self._additional_params.len());
4549        params.push("name", self._name);
4550        if let Some(value) = self._update_mask.as_ref() {
4551            params.push("updateMask", value.to_string());
4552        }
4553
4554        params.extend(self._additional_params.iter());
4555
4556        params.push("alt", "json");
4557        let mut url = self.hub._base_url.clone() + "v1beta1/{+name}";
4558        if self._scopes.is_empty() {
4559            self._scopes
4560                .insert(Scope::CloudPlatform.as_ref().to_string());
4561        }
4562
4563        #[allow(clippy::single_element_loop)]
4564        for &(find_this, param_name) in [("{+name}", "name")].iter() {
4565            url = params.uri_replacement(url, param_name, find_this, true);
4566        }
4567        {
4568            let to_remove = ["name"];
4569            params.remove_params(&to_remove);
4570        }
4571
4572        let url = params.parse_with_url(&url);
4573
4574        let mut json_mime_type = mime::APPLICATION_JSON;
4575        let mut request_value_reader = {
4576            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
4577            common::remove_json_null_values(&mut value);
4578            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
4579            serde_json::to_writer(&mut dst, &value).unwrap();
4580            dst
4581        };
4582        let request_size = request_value_reader
4583            .seek(std::io::SeekFrom::End(0))
4584            .unwrap();
4585        request_value_reader
4586            .seek(std::io::SeekFrom::Start(0))
4587            .unwrap();
4588
4589        loop {
4590            let token = match self
4591                .hub
4592                .auth
4593                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
4594                .await
4595            {
4596                Ok(token) => token,
4597                Err(e) => match dlg.token(e) {
4598                    Ok(token) => token,
4599                    Err(e) => {
4600                        dlg.finished(false);
4601                        return Err(common::Error::MissingToken(e));
4602                    }
4603                },
4604            };
4605            request_value_reader
4606                .seek(std::io::SeekFrom::Start(0))
4607                .unwrap();
4608            let mut req_result = {
4609                let client = &self.hub.client;
4610                dlg.pre_request();
4611                let mut req_builder = hyper::Request::builder()
4612                    .method(hyper::Method::PATCH)
4613                    .uri(url.as_str())
4614                    .header(USER_AGENT, self.hub._user_agent.clone());
4615
4616                if let Some(token) = token.as_ref() {
4617                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
4618                }
4619
4620                let request = req_builder
4621                    .header(CONTENT_TYPE, json_mime_type.to_string())
4622                    .header(CONTENT_LENGTH, request_size as u64)
4623                    .body(common::to_body(
4624                        request_value_reader.get_ref().clone().into(),
4625                    ));
4626
4627                client.request(request.unwrap()).await
4628            };
4629
4630            match req_result {
4631                Err(err) => {
4632                    if let common::Retry::After(d) = dlg.http_error(&err) {
4633                        sleep(d).await;
4634                        continue;
4635                    }
4636                    dlg.finished(false);
4637                    return Err(common::Error::HttpError(err));
4638                }
4639                Ok(res) => {
4640                    let (mut parts, body) = res.into_parts();
4641                    let mut body = common::Body::new(body);
4642                    if !parts.status.is_success() {
4643                        let bytes = common::to_bytes(body).await.unwrap_or_default();
4644                        let error = serde_json::from_str(&common::to_string(&bytes));
4645                        let response = common::to_response(parts, bytes.into());
4646
4647                        if let common::Retry::After(d) =
4648                            dlg.http_failure(&response, error.as_ref().ok())
4649                        {
4650                            sleep(d).await;
4651                            continue;
4652                        }
4653
4654                        dlg.finished(false);
4655
4656                        return Err(match error {
4657                            Ok(value) => common::Error::BadRequest(value),
4658                            _ => common::Error::Failure(response),
4659                        });
4660                    }
4661                    let response = {
4662                        let bytes = common::to_bytes(body).await.unwrap_or_default();
4663                        let encoded = common::to_string(&bytes);
4664                        match serde_json::from_str(&encoded) {
4665                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4666                            Err(error) => {
4667                                dlg.response_json_decode_error(&encoded, &error);
4668                                return Err(common::Error::JsonDecodeError(
4669                                    encoded.to_string(),
4670                                    error,
4671                                ));
4672                            }
4673                        }
4674                    };
4675
4676                    dlg.finished(true);
4677                    return Ok(response);
4678                }
4679            }
4680        }
4681    }
4682
4683    ///
4684    /// Sets the *request* property to the given value.
4685    ///
4686    /// Even though the property as already been set when instantiating this call,
4687    /// we provide this method for API completeness.
4688    pub fn request(mut self, new_value: Share) -> ProjectLocationInstanceSharePatchCall<'a, C> {
4689        self._request = new_value;
4690        self
4691    }
4692    /// Output only. The resource name of the share, in the format `projects/{project_id}/locations/{location_id}/instances/{instance_id}/shares/{share_id}`.
4693    ///
4694    /// Sets the *name* path property to the given value.
4695    ///
4696    /// Even though the property as already been set when instantiating this call,
4697    /// we provide this method for API completeness.
4698    pub fn name(mut self, new_value: &str) -> ProjectLocationInstanceSharePatchCall<'a, C> {
4699        self._name = new_value.to_string();
4700        self
4701    }
4702    /// Required. Mask of fields to update. At least one path must be supplied in this field. The elements of the repeated paths field may only include these fields: * "description" * "capacity_gb" * "labels" * "nfs_export_options"
4703    ///
4704    /// Sets the *update mask* query property to the given value.
4705    pub fn update_mask(
4706        mut self,
4707        new_value: common::FieldMask,
4708    ) -> ProjectLocationInstanceSharePatchCall<'a, C> {
4709        self._update_mask = Some(new_value);
4710        self
4711    }
4712    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4713    /// while executing the actual API request.
4714    ///
4715    /// ````text
4716    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
4717    /// ````
4718    ///
4719    /// Sets the *delegate* property to the given value.
4720    pub fn delegate(
4721        mut self,
4722        new_value: &'a mut dyn common::Delegate,
4723    ) -> ProjectLocationInstanceSharePatchCall<'a, C> {
4724        self._delegate = Some(new_value);
4725        self
4726    }
4727
4728    /// Set any additional parameter of the query string used in the request.
4729    /// It should be used to set parameters which are not yet available through their own
4730    /// setters.
4731    ///
4732    /// Please note that this method must not be used to set any of the known parameters
4733    /// which have their own setter method. If done anyway, the request will fail.
4734    ///
4735    /// # Additional Parameters
4736    ///
4737    /// * *$.xgafv* (query-string) - V1 error format.
4738    /// * *access_token* (query-string) - OAuth access token.
4739    /// * *alt* (query-string) - Data format for response.
4740    /// * *callback* (query-string) - JSONP
4741    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4742    /// * *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.
4743    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4744    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4745    /// * *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.
4746    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4747    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4748    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationInstanceSharePatchCall<'a, C>
4749    where
4750        T: AsRef<str>,
4751    {
4752        self._additional_params
4753            .insert(name.as_ref().to_string(), value.as_ref().to_string());
4754        self
4755    }
4756
4757    /// Identifies the authorization scope for the method you are building.
4758    ///
4759    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
4760    /// [`Scope::CloudPlatform`].
4761    ///
4762    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4763    /// tokens for more than one scope.
4764    ///
4765    /// Usually there is more than one suitable scope to authorize an operation, some of which may
4766    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
4767    /// sufficient, a read-write scope will do as well.
4768    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationInstanceSharePatchCall<'a, C>
4769    where
4770        St: AsRef<str>,
4771    {
4772        self._scopes.insert(String::from(scope.as_ref()));
4773        self
4774    }
4775    /// Identifies the authorization scope(s) for the method you are building.
4776    ///
4777    /// See [`Self::add_scope()`] for details.
4778    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationInstanceSharePatchCall<'a, C>
4779    where
4780        I: IntoIterator<Item = St>,
4781        St: AsRef<str>,
4782    {
4783        self._scopes
4784            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
4785        self
4786    }
4787
4788    /// Removes all scopes, and no default scope will be used either.
4789    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
4790    /// for details).
4791    pub fn clear_scopes(mut self) -> ProjectLocationInstanceSharePatchCall<'a, C> {
4792        self._scopes.clear();
4793        self
4794    }
4795}
4796
4797/// Creates a snapshot.
4798///
4799/// A builder for the *locations.instances.snapshots.create* method supported by a *project* resource.
4800/// It is not used directly, but through a [`ProjectMethods`] instance.
4801///
4802/// # Example
4803///
4804/// Instantiate a resource method builder
4805///
4806/// ```test_harness,no_run
4807/// # extern crate hyper;
4808/// # extern crate hyper_rustls;
4809/// # extern crate google_file1_beta1 as file1_beta1;
4810/// use file1_beta1::api::Snapshot;
4811/// # async fn dox() {
4812/// # use file1_beta1::{CloudFilestore, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4813///
4814/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4815/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
4816/// #     secret,
4817/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4818/// # ).build().await.unwrap();
4819///
4820/// # let client = hyper_util::client::legacy::Client::builder(
4821/// #     hyper_util::rt::TokioExecutor::new()
4822/// # )
4823/// # .build(
4824/// #     hyper_rustls::HttpsConnectorBuilder::new()
4825/// #         .with_native_roots()
4826/// #         .unwrap()
4827/// #         .https_or_http()
4828/// #         .enable_http1()
4829/// #         .build()
4830/// # );
4831/// # let mut hub = CloudFilestore::new(client, auth);
4832/// // As the method needs a request, you would usually fill it with the desired information
4833/// // into the respective structure. Some of the parts shown here might not be applicable !
4834/// // Values shown here are possibly random and not representative !
4835/// let mut req = Snapshot::default();
4836///
4837/// // You can configure optional parameters by calling the respective setters at will, and
4838/// // execute the final call using `doit()`.
4839/// // Values shown here are possibly random and not representative !
4840/// let result = hub.projects().locations_instances_snapshots_create(req, "parent")
4841///              .snapshot_id("rebum.")
4842///              .doit().await;
4843/// # }
4844/// ```
4845pub struct ProjectLocationInstanceSnapshotCreateCall<'a, C>
4846where
4847    C: 'a,
4848{
4849    hub: &'a CloudFilestore<C>,
4850    _request: Snapshot,
4851    _parent: String,
4852    _snapshot_id: Option<String>,
4853    _delegate: Option<&'a mut dyn common::Delegate>,
4854    _additional_params: HashMap<String, String>,
4855    _scopes: BTreeSet<String>,
4856}
4857
4858impl<'a, C> common::CallBuilder for ProjectLocationInstanceSnapshotCreateCall<'a, C> {}
4859
4860impl<'a, C> ProjectLocationInstanceSnapshotCreateCall<'a, C>
4861where
4862    C: common::Connector,
4863{
4864    /// Perform the operation you have build so far.
4865    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
4866        use std::borrow::Cow;
4867        use std::io::{Read, Seek};
4868
4869        use common::{url::Params, ToParts};
4870        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
4871
4872        let mut dd = common::DefaultDelegate;
4873        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
4874        dlg.begin(common::MethodInfo {
4875            id: "file.projects.locations.instances.snapshots.create",
4876            http_method: hyper::Method::POST,
4877        });
4878
4879        for &field in ["alt", "parent", "snapshotId"].iter() {
4880            if self._additional_params.contains_key(field) {
4881                dlg.finished(false);
4882                return Err(common::Error::FieldClash(field));
4883            }
4884        }
4885
4886        let mut params = Params::with_capacity(5 + self._additional_params.len());
4887        params.push("parent", self._parent);
4888        if let Some(value) = self._snapshot_id.as_ref() {
4889            params.push("snapshotId", value);
4890        }
4891
4892        params.extend(self._additional_params.iter());
4893
4894        params.push("alt", "json");
4895        let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/snapshots";
4896        if self._scopes.is_empty() {
4897            self._scopes
4898                .insert(Scope::CloudPlatform.as_ref().to_string());
4899        }
4900
4901        #[allow(clippy::single_element_loop)]
4902        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
4903            url = params.uri_replacement(url, param_name, find_this, true);
4904        }
4905        {
4906            let to_remove = ["parent"];
4907            params.remove_params(&to_remove);
4908        }
4909
4910        let url = params.parse_with_url(&url);
4911
4912        let mut json_mime_type = mime::APPLICATION_JSON;
4913        let mut request_value_reader = {
4914            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
4915            common::remove_json_null_values(&mut value);
4916            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
4917            serde_json::to_writer(&mut dst, &value).unwrap();
4918            dst
4919        };
4920        let request_size = request_value_reader
4921            .seek(std::io::SeekFrom::End(0))
4922            .unwrap();
4923        request_value_reader
4924            .seek(std::io::SeekFrom::Start(0))
4925            .unwrap();
4926
4927        loop {
4928            let token = match self
4929                .hub
4930                .auth
4931                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
4932                .await
4933            {
4934                Ok(token) => token,
4935                Err(e) => match dlg.token(e) {
4936                    Ok(token) => token,
4937                    Err(e) => {
4938                        dlg.finished(false);
4939                        return Err(common::Error::MissingToken(e));
4940                    }
4941                },
4942            };
4943            request_value_reader
4944                .seek(std::io::SeekFrom::Start(0))
4945                .unwrap();
4946            let mut req_result = {
4947                let client = &self.hub.client;
4948                dlg.pre_request();
4949                let mut req_builder = hyper::Request::builder()
4950                    .method(hyper::Method::POST)
4951                    .uri(url.as_str())
4952                    .header(USER_AGENT, self.hub._user_agent.clone());
4953
4954                if let Some(token) = token.as_ref() {
4955                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
4956                }
4957
4958                let request = req_builder
4959                    .header(CONTENT_TYPE, json_mime_type.to_string())
4960                    .header(CONTENT_LENGTH, request_size as u64)
4961                    .body(common::to_body(
4962                        request_value_reader.get_ref().clone().into(),
4963                    ));
4964
4965                client.request(request.unwrap()).await
4966            };
4967
4968            match req_result {
4969                Err(err) => {
4970                    if let common::Retry::After(d) = dlg.http_error(&err) {
4971                        sleep(d).await;
4972                        continue;
4973                    }
4974                    dlg.finished(false);
4975                    return Err(common::Error::HttpError(err));
4976                }
4977                Ok(res) => {
4978                    let (mut parts, body) = res.into_parts();
4979                    let mut body = common::Body::new(body);
4980                    if !parts.status.is_success() {
4981                        let bytes = common::to_bytes(body).await.unwrap_or_default();
4982                        let error = serde_json::from_str(&common::to_string(&bytes));
4983                        let response = common::to_response(parts, bytes.into());
4984
4985                        if let common::Retry::After(d) =
4986                            dlg.http_failure(&response, error.as_ref().ok())
4987                        {
4988                            sleep(d).await;
4989                            continue;
4990                        }
4991
4992                        dlg.finished(false);
4993
4994                        return Err(match error {
4995                            Ok(value) => common::Error::BadRequest(value),
4996                            _ => common::Error::Failure(response),
4997                        });
4998                    }
4999                    let response = {
5000                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5001                        let encoded = common::to_string(&bytes);
5002                        match serde_json::from_str(&encoded) {
5003                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5004                            Err(error) => {
5005                                dlg.response_json_decode_error(&encoded, &error);
5006                                return Err(common::Error::JsonDecodeError(
5007                                    encoded.to_string(),
5008                                    error,
5009                                ));
5010                            }
5011                        }
5012                    };
5013
5014                    dlg.finished(true);
5015                    return Ok(response);
5016                }
5017            }
5018        }
5019    }
5020
5021    ///
5022    /// Sets the *request* property to the given value.
5023    ///
5024    /// Even though the property as already been set when instantiating this call,
5025    /// we provide this method for API completeness.
5026    pub fn request(
5027        mut self,
5028        new_value: Snapshot,
5029    ) -> ProjectLocationInstanceSnapshotCreateCall<'a, C> {
5030        self._request = new_value;
5031        self
5032    }
5033    /// Required. The Filestore Instance to create the snapshots of, in the format `projects/{project_id}/locations/{location}/instances/{instance_id}`
5034    ///
5035    /// Sets the *parent* path property to the given value.
5036    ///
5037    /// Even though the property as already been set when instantiating this call,
5038    /// we provide this method for API completeness.
5039    pub fn parent(mut self, new_value: &str) -> ProjectLocationInstanceSnapshotCreateCall<'a, C> {
5040        self._parent = new_value.to_string();
5041        self
5042    }
5043    /// Required. The ID to use for the snapshot. The ID must be unique within the specified instance. This value must start with a lowercase letter followed by up to 62 lowercase letters, numbers, or hyphens, and cannot end with a hyphen.
5044    ///
5045    /// Sets the *snapshot id* query property to the given value.
5046    pub fn snapshot_id(
5047        mut self,
5048        new_value: &str,
5049    ) -> ProjectLocationInstanceSnapshotCreateCall<'a, C> {
5050        self._snapshot_id = Some(new_value.to_string());
5051        self
5052    }
5053    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5054    /// while executing the actual API request.
5055    ///
5056    /// ````text
5057    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
5058    /// ````
5059    ///
5060    /// Sets the *delegate* property to the given value.
5061    pub fn delegate(
5062        mut self,
5063        new_value: &'a mut dyn common::Delegate,
5064    ) -> ProjectLocationInstanceSnapshotCreateCall<'a, C> {
5065        self._delegate = Some(new_value);
5066        self
5067    }
5068
5069    /// Set any additional parameter of the query string used in the request.
5070    /// It should be used to set parameters which are not yet available through their own
5071    /// setters.
5072    ///
5073    /// Please note that this method must not be used to set any of the known parameters
5074    /// which have their own setter method. If done anyway, the request will fail.
5075    ///
5076    /// # Additional Parameters
5077    ///
5078    /// * *$.xgafv* (query-string) - V1 error format.
5079    /// * *access_token* (query-string) - OAuth access token.
5080    /// * *alt* (query-string) - Data format for response.
5081    /// * *callback* (query-string) - JSONP
5082    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5083    /// * *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.
5084    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5085    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5086    /// * *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.
5087    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5088    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5089    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationInstanceSnapshotCreateCall<'a, C>
5090    where
5091        T: AsRef<str>,
5092    {
5093        self._additional_params
5094            .insert(name.as_ref().to_string(), value.as_ref().to_string());
5095        self
5096    }
5097
5098    /// Identifies the authorization scope for the method you are building.
5099    ///
5100    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5101    /// [`Scope::CloudPlatform`].
5102    ///
5103    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5104    /// tokens for more than one scope.
5105    ///
5106    /// Usually there is more than one suitable scope to authorize an operation, some of which may
5107    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5108    /// sufficient, a read-write scope will do as well.
5109    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationInstanceSnapshotCreateCall<'a, C>
5110    where
5111        St: AsRef<str>,
5112    {
5113        self._scopes.insert(String::from(scope.as_ref()));
5114        self
5115    }
5116    /// Identifies the authorization scope(s) for the method you are building.
5117    ///
5118    /// See [`Self::add_scope()`] for details.
5119    pub fn add_scopes<I, St>(
5120        mut self,
5121        scopes: I,
5122    ) -> ProjectLocationInstanceSnapshotCreateCall<'a, C>
5123    where
5124        I: IntoIterator<Item = St>,
5125        St: AsRef<str>,
5126    {
5127        self._scopes
5128            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5129        self
5130    }
5131
5132    /// Removes all scopes, and no default scope will be used either.
5133    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5134    /// for details).
5135    pub fn clear_scopes(mut self) -> ProjectLocationInstanceSnapshotCreateCall<'a, C> {
5136        self._scopes.clear();
5137        self
5138    }
5139}
5140
5141/// Deletes a snapshot.
5142///
5143/// A builder for the *locations.instances.snapshots.delete* method supported by a *project* resource.
5144/// It is not used directly, but through a [`ProjectMethods`] instance.
5145///
5146/// # Example
5147///
5148/// Instantiate a resource method builder
5149///
5150/// ```test_harness,no_run
5151/// # extern crate hyper;
5152/// # extern crate hyper_rustls;
5153/// # extern crate google_file1_beta1 as file1_beta1;
5154/// # async fn dox() {
5155/// # use file1_beta1::{CloudFilestore, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5156///
5157/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5158/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
5159/// #     secret,
5160/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5161/// # ).build().await.unwrap();
5162///
5163/// # let client = hyper_util::client::legacy::Client::builder(
5164/// #     hyper_util::rt::TokioExecutor::new()
5165/// # )
5166/// # .build(
5167/// #     hyper_rustls::HttpsConnectorBuilder::new()
5168/// #         .with_native_roots()
5169/// #         .unwrap()
5170/// #         .https_or_http()
5171/// #         .enable_http1()
5172/// #         .build()
5173/// # );
5174/// # let mut hub = CloudFilestore::new(client, auth);
5175/// // You can configure optional parameters by calling the respective setters at will, and
5176/// // execute the final call using `doit()`.
5177/// // Values shown here are possibly random and not representative !
5178/// let result = hub.projects().locations_instances_snapshots_delete("name")
5179///              .doit().await;
5180/// # }
5181/// ```
5182pub struct ProjectLocationInstanceSnapshotDeleteCall<'a, C>
5183where
5184    C: 'a,
5185{
5186    hub: &'a CloudFilestore<C>,
5187    _name: String,
5188    _delegate: Option<&'a mut dyn common::Delegate>,
5189    _additional_params: HashMap<String, String>,
5190    _scopes: BTreeSet<String>,
5191}
5192
5193impl<'a, C> common::CallBuilder for ProjectLocationInstanceSnapshotDeleteCall<'a, C> {}
5194
5195impl<'a, C> ProjectLocationInstanceSnapshotDeleteCall<'a, C>
5196where
5197    C: common::Connector,
5198{
5199    /// Perform the operation you have build so far.
5200    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
5201        use std::borrow::Cow;
5202        use std::io::{Read, Seek};
5203
5204        use common::{url::Params, ToParts};
5205        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5206
5207        let mut dd = common::DefaultDelegate;
5208        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5209        dlg.begin(common::MethodInfo {
5210            id: "file.projects.locations.instances.snapshots.delete",
5211            http_method: hyper::Method::DELETE,
5212        });
5213
5214        for &field in ["alt", "name"].iter() {
5215            if self._additional_params.contains_key(field) {
5216                dlg.finished(false);
5217                return Err(common::Error::FieldClash(field));
5218            }
5219        }
5220
5221        let mut params = Params::with_capacity(3 + self._additional_params.len());
5222        params.push("name", self._name);
5223
5224        params.extend(self._additional_params.iter());
5225
5226        params.push("alt", "json");
5227        let mut url = self.hub._base_url.clone() + "v1beta1/{+name}";
5228        if self._scopes.is_empty() {
5229            self._scopes
5230                .insert(Scope::CloudPlatform.as_ref().to_string());
5231        }
5232
5233        #[allow(clippy::single_element_loop)]
5234        for &(find_this, param_name) in [("{+name}", "name")].iter() {
5235            url = params.uri_replacement(url, param_name, find_this, true);
5236        }
5237        {
5238            let to_remove = ["name"];
5239            params.remove_params(&to_remove);
5240        }
5241
5242        let url = params.parse_with_url(&url);
5243
5244        loop {
5245            let token = match self
5246                .hub
5247                .auth
5248                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5249                .await
5250            {
5251                Ok(token) => token,
5252                Err(e) => match dlg.token(e) {
5253                    Ok(token) => token,
5254                    Err(e) => {
5255                        dlg.finished(false);
5256                        return Err(common::Error::MissingToken(e));
5257                    }
5258                },
5259            };
5260            let mut req_result = {
5261                let client = &self.hub.client;
5262                dlg.pre_request();
5263                let mut req_builder = hyper::Request::builder()
5264                    .method(hyper::Method::DELETE)
5265                    .uri(url.as_str())
5266                    .header(USER_AGENT, self.hub._user_agent.clone());
5267
5268                if let Some(token) = token.as_ref() {
5269                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5270                }
5271
5272                let request = req_builder
5273                    .header(CONTENT_LENGTH, 0_u64)
5274                    .body(common::to_body::<String>(None));
5275
5276                client.request(request.unwrap()).await
5277            };
5278
5279            match req_result {
5280                Err(err) => {
5281                    if let common::Retry::After(d) = dlg.http_error(&err) {
5282                        sleep(d).await;
5283                        continue;
5284                    }
5285                    dlg.finished(false);
5286                    return Err(common::Error::HttpError(err));
5287                }
5288                Ok(res) => {
5289                    let (mut parts, body) = res.into_parts();
5290                    let mut body = common::Body::new(body);
5291                    if !parts.status.is_success() {
5292                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5293                        let error = serde_json::from_str(&common::to_string(&bytes));
5294                        let response = common::to_response(parts, bytes.into());
5295
5296                        if let common::Retry::After(d) =
5297                            dlg.http_failure(&response, error.as_ref().ok())
5298                        {
5299                            sleep(d).await;
5300                            continue;
5301                        }
5302
5303                        dlg.finished(false);
5304
5305                        return Err(match error {
5306                            Ok(value) => common::Error::BadRequest(value),
5307                            _ => common::Error::Failure(response),
5308                        });
5309                    }
5310                    let response = {
5311                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5312                        let encoded = common::to_string(&bytes);
5313                        match serde_json::from_str(&encoded) {
5314                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5315                            Err(error) => {
5316                                dlg.response_json_decode_error(&encoded, &error);
5317                                return Err(common::Error::JsonDecodeError(
5318                                    encoded.to_string(),
5319                                    error,
5320                                ));
5321                            }
5322                        }
5323                    };
5324
5325                    dlg.finished(true);
5326                    return Ok(response);
5327                }
5328            }
5329        }
5330    }
5331
5332    /// Required. The snapshot resource name, in the format `projects/{project_id}/locations/{location}/instances/{instance_id}/snapshots/{snapshot_id}`
5333    ///
5334    /// Sets the *name* path property to the given value.
5335    ///
5336    /// Even though the property as already been set when instantiating this call,
5337    /// we provide this method for API completeness.
5338    pub fn name(mut self, new_value: &str) -> ProjectLocationInstanceSnapshotDeleteCall<'a, C> {
5339        self._name = new_value.to_string();
5340        self
5341    }
5342    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5343    /// while executing the actual API request.
5344    ///
5345    /// ````text
5346    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
5347    /// ````
5348    ///
5349    /// Sets the *delegate* property to the given value.
5350    pub fn delegate(
5351        mut self,
5352        new_value: &'a mut dyn common::Delegate,
5353    ) -> ProjectLocationInstanceSnapshotDeleteCall<'a, C> {
5354        self._delegate = Some(new_value);
5355        self
5356    }
5357
5358    /// Set any additional parameter of the query string used in the request.
5359    /// It should be used to set parameters which are not yet available through their own
5360    /// setters.
5361    ///
5362    /// Please note that this method must not be used to set any of the known parameters
5363    /// which have their own setter method. If done anyway, the request will fail.
5364    ///
5365    /// # Additional Parameters
5366    ///
5367    /// * *$.xgafv* (query-string) - V1 error format.
5368    /// * *access_token* (query-string) - OAuth access token.
5369    /// * *alt* (query-string) - Data format for response.
5370    /// * *callback* (query-string) - JSONP
5371    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5372    /// * *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.
5373    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5374    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5375    /// * *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.
5376    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5377    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5378    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationInstanceSnapshotDeleteCall<'a, C>
5379    where
5380        T: AsRef<str>,
5381    {
5382        self._additional_params
5383            .insert(name.as_ref().to_string(), value.as_ref().to_string());
5384        self
5385    }
5386
5387    /// Identifies the authorization scope for the method you are building.
5388    ///
5389    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5390    /// [`Scope::CloudPlatform`].
5391    ///
5392    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5393    /// tokens for more than one scope.
5394    ///
5395    /// Usually there is more than one suitable scope to authorize an operation, some of which may
5396    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5397    /// sufficient, a read-write scope will do as well.
5398    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationInstanceSnapshotDeleteCall<'a, C>
5399    where
5400        St: AsRef<str>,
5401    {
5402        self._scopes.insert(String::from(scope.as_ref()));
5403        self
5404    }
5405    /// Identifies the authorization scope(s) for the method you are building.
5406    ///
5407    /// See [`Self::add_scope()`] for details.
5408    pub fn add_scopes<I, St>(
5409        mut self,
5410        scopes: I,
5411    ) -> ProjectLocationInstanceSnapshotDeleteCall<'a, C>
5412    where
5413        I: IntoIterator<Item = St>,
5414        St: AsRef<str>,
5415    {
5416        self._scopes
5417            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5418        self
5419    }
5420
5421    /// Removes all scopes, and no default scope will be used either.
5422    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5423    /// for details).
5424    pub fn clear_scopes(mut self) -> ProjectLocationInstanceSnapshotDeleteCall<'a, C> {
5425        self._scopes.clear();
5426        self
5427    }
5428}
5429
5430/// Gets the details of a specific snapshot.
5431///
5432/// A builder for the *locations.instances.snapshots.get* method supported by a *project* resource.
5433/// It is not used directly, but through a [`ProjectMethods`] instance.
5434///
5435/// # Example
5436///
5437/// Instantiate a resource method builder
5438///
5439/// ```test_harness,no_run
5440/// # extern crate hyper;
5441/// # extern crate hyper_rustls;
5442/// # extern crate google_file1_beta1 as file1_beta1;
5443/// # async fn dox() {
5444/// # use file1_beta1::{CloudFilestore, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5445///
5446/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5447/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
5448/// #     secret,
5449/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5450/// # ).build().await.unwrap();
5451///
5452/// # let client = hyper_util::client::legacy::Client::builder(
5453/// #     hyper_util::rt::TokioExecutor::new()
5454/// # )
5455/// # .build(
5456/// #     hyper_rustls::HttpsConnectorBuilder::new()
5457/// #         .with_native_roots()
5458/// #         .unwrap()
5459/// #         .https_or_http()
5460/// #         .enable_http1()
5461/// #         .build()
5462/// # );
5463/// # let mut hub = CloudFilestore::new(client, auth);
5464/// // You can configure optional parameters by calling the respective setters at will, and
5465/// // execute the final call using `doit()`.
5466/// // Values shown here are possibly random and not representative !
5467/// let result = hub.projects().locations_instances_snapshots_get("name")
5468///              .doit().await;
5469/// # }
5470/// ```
5471pub struct ProjectLocationInstanceSnapshotGetCall<'a, C>
5472where
5473    C: 'a,
5474{
5475    hub: &'a CloudFilestore<C>,
5476    _name: String,
5477    _delegate: Option<&'a mut dyn common::Delegate>,
5478    _additional_params: HashMap<String, String>,
5479    _scopes: BTreeSet<String>,
5480}
5481
5482impl<'a, C> common::CallBuilder for ProjectLocationInstanceSnapshotGetCall<'a, C> {}
5483
5484impl<'a, C> ProjectLocationInstanceSnapshotGetCall<'a, C>
5485where
5486    C: common::Connector,
5487{
5488    /// Perform the operation you have build so far.
5489    pub async fn doit(mut self) -> common::Result<(common::Response, Snapshot)> {
5490        use std::borrow::Cow;
5491        use std::io::{Read, Seek};
5492
5493        use common::{url::Params, ToParts};
5494        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5495
5496        let mut dd = common::DefaultDelegate;
5497        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5498        dlg.begin(common::MethodInfo {
5499            id: "file.projects.locations.instances.snapshots.get",
5500            http_method: hyper::Method::GET,
5501        });
5502
5503        for &field in ["alt", "name"].iter() {
5504            if self._additional_params.contains_key(field) {
5505                dlg.finished(false);
5506                return Err(common::Error::FieldClash(field));
5507            }
5508        }
5509
5510        let mut params = Params::with_capacity(3 + self._additional_params.len());
5511        params.push("name", self._name);
5512
5513        params.extend(self._additional_params.iter());
5514
5515        params.push("alt", "json");
5516        let mut url = self.hub._base_url.clone() + "v1beta1/{+name}";
5517        if self._scopes.is_empty() {
5518            self._scopes
5519                .insert(Scope::CloudPlatform.as_ref().to_string());
5520        }
5521
5522        #[allow(clippy::single_element_loop)]
5523        for &(find_this, param_name) in [("{+name}", "name")].iter() {
5524            url = params.uri_replacement(url, param_name, find_this, true);
5525        }
5526        {
5527            let to_remove = ["name"];
5528            params.remove_params(&to_remove);
5529        }
5530
5531        let url = params.parse_with_url(&url);
5532
5533        loop {
5534            let token = match self
5535                .hub
5536                .auth
5537                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5538                .await
5539            {
5540                Ok(token) => token,
5541                Err(e) => match dlg.token(e) {
5542                    Ok(token) => token,
5543                    Err(e) => {
5544                        dlg.finished(false);
5545                        return Err(common::Error::MissingToken(e));
5546                    }
5547                },
5548            };
5549            let mut req_result = {
5550                let client = &self.hub.client;
5551                dlg.pre_request();
5552                let mut req_builder = hyper::Request::builder()
5553                    .method(hyper::Method::GET)
5554                    .uri(url.as_str())
5555                    .header(USER_AGENT, self.hub._user_agent.clone());
5556
5557                if let Some(token) = token.as_ref() {
5558                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5559                }
5560
5561                let request = req_builder
5562                    .header(CONTENT_LENGTH, 0_u64)
5563                    .body(common::to_body::<String>(None));
5564
5565                client.request(request.unwrap()).await
5566            };
5567
5568            match req_result {
5569                Err(err) => {
5570                    if let common::Retry::After(d) = dlg.http_error(&err) {
5571                        sleep(d).await;
5572                        continue;
5573                    }
5574                    dlg.finished(false);
5575                    return Err(common::Error::HttpError(err));
5576                }
5577                Ok(res) => {
5578                    let (mut parts, body) = res.into_parts();
5579                    let mut body = common::Body::new(body);
5580                    if !parts.status.is_success() {
5581                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5582                        let error = serde_json::from_str(&common::to_string(&bytes));
5583                        let response = common::to_response(parts, bytes.into());
5584
5585                        if let common::Retry::After(d) =
5586                            dlg.http_failure(&response, error.as_ref().ok())
5587                        {
5588                            sleep(d).await;
5589                            continue;
5590                        }
5591
5592                        dlg.finished(false);
5593
5594                        return Err(match error {
5595                            Ok(value) => common::Error::BadRequest(value),
5596                            _ => common::Error::Failure(response),
5597                        });
5598                    }
5599                    let response = {
5600                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5601                        let encoded = common::to_string(&bytes);
5602                        match serde_json::from_str(&encoded) {
5603                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5604                            Err(error) => {
5605                                dlg.response_json_decode_error(&encoded, &error);
5606                                return Err(common::Error::JsonDecodeError(
5607                                    encoded.to_string(),
5608                                    error,
5609                                ));
5610                            }
5611                        }
5612                    };
5613
5614                    dlg.finished(true);
5615                    return Ok(response);
5616                }
5617            }
5618        }
5619    }
5620
5621    /// Required. The snapshot resource name, in the format `projects/{project_id}/locations/{location}/instances/{instance_id}/snapshots/{snapshot_id}`
5622    ///
5623    /// Sets the *name* path property to the given value.
5624    ///
5625    /// Even though the property as already been set when instantiating this call,
5626    /// we provide this method for API completeness.
5627    pub fn name(mut self, new_value: &str) -> ProjectLocationInstanceSnapshotGetCall<'a, C> {
5628        self._name = new_value.to_string();
5629        self
5630    }
5631    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5632    /// while executing the actual API request.
5633    ///
5634    /// ````text
5635    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
5636    /// ````
5637    ///
5638    /// Sets the *delegate* property to the given value.
5639    pub fn delegate(
5640        mut self,
5641        new_value: &'a mut dyn common::Delegate,
5642    ) -> ProjectLocationInstanceSnapshotGetCall<'a, C> {
5643        self._delegate = Some(new_value);
5644        self
5645    }
5646
5647    /// Set any additional parameter of the query string used in the request.
5648    /// It should be used to set parameters which are not yet available through their own
5649    /// setters.
5650    ///
5651    /// Please note that this method must not be used to set any of the known parameters
5652    /// which have their own setter method. If done anyway, the request will fail.
5653    ///
5654    /// # Additional Parameters
5655    ///
5656    /// * *$.xgafv* (query-string) - V1 error format.
5657    /// * *access_token* (query-string) - OAuth access token.
5658    /// * *alt* (query-string) - Data format for response.
5659    /// * *callback* (query-string) - JSONP
5660    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5661    /// * *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.
5662    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5663    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5664    /// * *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.
5665    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5666    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5667    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationInstanceSnapshotGetCall<'a, C>
5668    where
5669        T: AsRef<str>,
5670    {
5671        self._additional_params
5672            .insert(name.as_ref().to_string(), value.as_ref().to_string());
5673        self
5674    }
5675
5676    /// Identifies the authorization scope for the method you are building.
5677    ///
5678    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5679    /// [`Scope::CloudPlatform`].
5680    ///
5681    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5682    /// tokens for more than one scope.
5683    ///
5684    /// Usually there is more than one suitable scope to authorize an operation, some of which may
5685    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5686    /// sufficient, a read-write scope will do as well.
5687    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationInstanceSnapshotGetCall<'a, C>
5688    where
5689        St: AsRef<str>,
5690    {
5691        self._scopes.insert(String::from(scope.as_ref()));
5692        self
5693    }
5694    /// Identifies the authorization scope(s) for the method you are building.
5695    ///
5696    /// See [`Self::add_scope()`] for details.
5697    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationInstanceSnapshotGetCall<'a, C>
5698    where
5699        I: IntoIterator<Item = St>,
5700        St: AsRef<str>,
5701    {
5702        self._scopes
5703            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5704        self
5705    }
5706
5707    /// Removes all scopes, and no default scope will be used either.
5708    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5709    /// for details).
5710    pub fn clear_scopes(mut self) -> ProjectLocationInstanceSnapshotGetCall<'a, C> {
5711        self._scopes.clear();
5712        self
5713    }
5714}
5715
5716/// Lists all snapshots in a project for either a specified location or for all locations.
5717///
5718/// A builder for the *locations.instances.snapshots.list* method supported by a *project* resource.
5719/// It is not used directly, but through a [`ProjectMethods`] instance.
5720///
5721/// # Example
5722///
5723/// Instantiate a resource method builder
5724///
5725/// ```test_harness,no_run
5726/// # extern crate hyper;
5727/// # extern crate hyper_rustls;
5728/// # extern crate google_file1_beta1 as file1_beta1;
5729/// # async fn dox() {
5730/// # use file1_beta1::{CloudFilestore, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5731///
5732/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5733/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
5734/// #     secret,
5735/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5736/// # ).build().await.unwrap();
5737///
5738/// # let client = hyper_util::client::legacy::Client::builder(
5739/// #     hyper_util::rt::TokioExecutor::new()
5740/// # )
5741/// # .build(
5742/// #     hyper_rustls::HttpsConnectorBuilder::new()
5743/// #         .with_native_roots()
5744/// #         .unwrap()
5745/// #         .https_or_http()
5746/// #         .enable_http1()
5747/// #         .build()
5748/// # );
5749/// # let mut hub = CloudFilestore::new(client, auth);
5750/// // You can configure optional parameters by calling the respective setters at will, and
5751/// // execute the final call using `doit()`.
5752/// // Values shown here are possibly random and not representative !
5753/// let result = hub.projects().locations_instances_snapshots_list("parent")
5754///              .page_token("est")
5755///              .page_size(-62)
5756///              .order_by("ea")
5757///              .filter("dolor")
5758///              .doit().await;
5759/// # }
5760/// ```
5761pub struct ProjectLocationInstanceSnapshotListCall<'a, C>
5762where
5763    C: 'a,
5764{
5765    hub: &'a CloudFilestore<C>,
5766    _parent: String,
5767    _page_token: Option<String>,
5768    _page_size: Option<i32>,
5769    _order_by: Option<String>,
5770    _filter: Option<String>,
5771    _delegate: Option<&'a mut dyn common::Delegate>,
5772    _additional_params: HashMap<String, String>,
5773    _scopes: BTreeSet<String>,
5774}
5775
5776impl<'a, C> common::CallBuilder for ProjectLocationInstanceSnapshotListCall<'a, C> {}
5777
5778impl<'a, C> ProjectLocationInstanceSnapshotListCall<'a, C>
5779where
5780    C: common::Connector,
5781{
5782    /// Perform the operation you have build so far.
5783    pub async fn doit(mut self) -> common::Result<(common::Response, ListSnapshotsResponse)> {
5784        use std::borrow::Cow;
5785        use std::io::{Read, Seek};
5786
5787        use common::{url::Params, ToParts};
5788        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5789
5790        let mut dd = common::DefaultDelegate;
5791        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5792        dlg.begin(common::MethodInfo {
5793            id: "file.projects.locations.instances.snapshots.list",
5794            http_method: hyper::Method::GET,
5795        });
5796
5797        for &field in [
5798            "alt",
5799            "parent",
5800            "pageToken",
5801            "pageSize",
5802            "orderBy",
5803            "filter",
5804        ]
5805        .iter()
5806        {
5807            if self._additional_params.contains_key(field) {
5808                dlg.finished(false);
5809                return Err(common::Error::FieldClash(field));
5810            }
5811        }
5812
5813        let mut params = Params::with_capacity(7 + self._additional_params.len());
5814        params.push("parent", self._parent);
5815        if let Some(value) = self._page_token.as_ref() {
5816            params.push("pageToken", value);
5817        }
5818        if let Some(value) = self._page_size.as_ref() {
5819            params.push("pageSize", value.to_string());
5820        }
5821        if let Some(value) = self._order_by.as_ref() {
5822            params.push("orderBy", value);
5823        }
5824        if let Some(value) = self._filter.as_ref() {
5825            params.push("filter", value);
5826        }
5827
5828        params.extend(self._additional_params.iter());
5829
5830        params.push("alt", "json");
5831        let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/snapshots";
5832        if self._scopes.is_empty() {
5833            self._scopes
5834                .insert(Scope::CloudPlatform.as_ref().to_string());
5835        }
5836
5837        #[allow(clippy::single_element_loop)]
5838        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
5839            url = params.uri_replacement(url, param_name, find_this, true);
5840        }
5841        {
5842            let to_remove = ["parent"];
5843            params.remove_params(&to_remove);
5844        }
5845
5846        let url = params.parse_with_url(&url);
5847
5848        loop {
5849            let token = match self
5850                .hub
5851                .auth
5852                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5853                .await
5854            {
5855                Ok(token) => token,
5856                Err(e) => match dlg.token(e) {
5857                    Ok(token) => token,
5858                    Err(e) => {
5859                        dlg.finished(false);
5860                        return Err(common::Error::MissingToken(e));
5861                    }
5862                },
5863            };
5864            let mut req_result = {
5865                let client = &self.hub.client;
5866                dlg.pre_request();
5867                let mut req_builder = hyper::Request::builder()
5868                    .method(hyper::Method::GET)
5869                    .uri(url.as_str())
5870                    .header(USER_AGENT, self.hub._user_agent.clone());
5871
5872                if let Some(token) = token.as_ref() {
5873                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5874                }
5875
5876                let request = req_builder
5877                    .header(CONTENT_LENGTH, 0_u64)
5878                    .body(common::to_body::<String>(None));
5879
5880                client.request(request.unwrap()).await
5881            };
5882
5883            match req_result {
5884                Err(err) => {
5885                    if let common::Retry::After(d) = dlg.http_error(&err) {
5886                        sleep(d).await;
5887                        continue;
5888                    }
5889                    dlg.finished(false);
5890                    return Err(common::Error::HttpError(err));
5891                }
5892                Ok(res) => {
5893                    let (mut parts, body) = res.into_parts();
5894                    let mut body = common::Body::new(body);
5895                    if !parts.status.is_success() {
5896                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5897                        let error = serde_json::from_str(&common::to_string(&bytes));
5898                        let response = common::to_response(parts, bytes.into());
5899
5900                        if let common::Retry::After(d) =
5901                            dlg.http_failure(&response, error.as_ref().ok())
5902                        {
5903                            sleep(d).await;
5904                            continue;
5905                        }
5906
5907                        dlg.finished(false);
5908
5909                        return Err(match error {
5910                            Ok(value) => common::Error::BadRequest(value),
5911                            _ => common::Error::Failure(response),
5912                        });
5913                    }
5914                    let response = {
5915                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5916                        let encoded = common::to_string(&bytes);
5917                        match serde_json::from_str(&encoded) {
5918                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5919                            Err(error) => {
5920                                dlg.response_json_decode_error(&encoded, &error);
5921                                return Err(common::Error::JsonDecodeError(
5922                                    encoded.to_string(),
5923                                    error,
5924                                ));
5925                            }
5926                        }
5927                    };
5928
5929                    dlg.finished(true);
5930                    return Ok(response);
5931                }
5932            }
5933        }
5934    }
5935
5936    /// Required. The instance for which to retrieve snapshot information, in the format `projects/{project_id}/locations/{location}/instances/{instance_id}`.
5937    ///
5938    /// Sets the *parent* path property to the given value.
5939    ///
5940    /// Even though the property as already been set when instantiating this call,
5941    /// we provide this method for API completeness.
5942    pub fn parent(mut self, new_value: &str) -> ProjectLocationInstanceSnapshotListCall<'a, C> {
5943        self._parent = new_value.to_string();
5944        self
5945    }
5946    /// The next_page_token value to use if there are additional results to retrieve for this list request.
5947    ///
5948    /// Sets the *page token* query property to the given value.
5949    pub fn page_token(mut self, new_value: &str) -> ProjectLocationInstanceSnapshotListCall<'a, C> {
5950        self._page_token = Some(new_value.to_string());
5951        self
5952    }
5953    /// The maximum number of items to return.
5954    ///
5955    /// Sets the *page size* query property to the given value.
5956    pub fn page_size(mut self, new_value: i32) -> ProjectLocationInstanceSnapshotListCall<'a, C> {
5957        self._page_size = Some(new_value);
5958        self
5959    }
5960    /// Sort results. Supported values are "name", "name desc" or "" (unsorted).
5961    ///
5962    /// Sets the *order by* query property to the given value.
5963    pub fn order_by(mut self, new_value: &str) -> ProjectLocationInstanceSnapshotListCall<'a, C> {
5964        self._order_by = Some(new_value.to_string());
5965        self
5966    }
5967    /// List filter.
5968    ///
5969    /// Sets the *filter* query property to the given value.
5970    pub fn filter(mut self, new_value: &str) -> ProjectLocationInstanceSnapshotListCall<'a, C> {
5971        self._filter = Some(new_value.to_string());
5972        self
5973    }
5974    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5975    /// while executing the actual API request.
5976    ///
5977    /// ````text
5978    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
5979    /// ````
5980    ///
5981    /// Sets the *delegate* property to the given value.
5982    pub fn delegate(
5983        mut self,
5984        new_value: &'a mut dyn common::Delegate,
5985    ) -> ProjectLocationInstanceSnapshotListCall<'a, C> {
5986        self._delegate = Some(new_value);
5987        self
5988    }
5989
5990    /// Set any additional parameter of the query string used in the request.
5991    /// It should be used to set parameters which are not yet available through their own
5992    /// setters.
5993    ///
5994    /// Please note that this method must not be used to set any of the known parameters
5995    /// which have their own setter method. If done anyway, the request will fail.
5996    ///
5997    /// # Additional Parameters
5998    ///
5999    /// * *$.xgafv* (query-string) - V1 error format.
6000    /// * *access_token* (query-string) - OAuth access token.
6001    /// * *alt* (query-string) - Data format for response.
6002    /// * *callback* (query-string) - JSONP
6003    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6004    /// * *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.
6005    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6006    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6007    /// * *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.
6008    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6009    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6010    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationInstanceSnapshotListCall<'a, C>
6011    where
6012        T: AsRef<str>,
6013    {
6014        self._additional_params
6015            .insert(name.as_ref().to_string(), value.as_ref().to_string());
6016        self
6017    }
6018
6019    /// Identifies the authorization scope for the method you are building.
6020    ///
6021    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6022    /// [`Scope::CloudPlatform`].
6023    ///
6024    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6025    /// tokens for more than one scope.
6026    ///
6027    /// Usually there is more than one suitable scope to authorize an operation, some of which may
6028    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6029    /// sufficient, a read-write scope will do as well.
6030    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationInstanceSnapshotListCall<'a, C>
6031    where
6032        St: AsRef<str>,
6033    {
6034        self._scopes.insert(String::from(scope.as_ref()));
6035        self
6036    }
6037    /// Identifies the authorization scope(s) for the method you are building.
6038    ///
6039    /// See [`Self::add_scope()`] for details.
6040    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationInstanceSnapshotListCall<'a, C>
6041    where
6042        I: IntoIterator<Item = St>,
6043        St: AsRef<str>,
6044    {
6045        self._scopes
6046            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6047        self
6048    }
6049
6050    /// Removes all scopes, and no default scope will be used either.
6051    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6052    /// for details).
6053    pub fn clear_scopes(mut self) -> ProjectLocationInstanceSnapshotListCall<'a, C> {
6054        self._scopes.clear();
6055        self
6056    }
6057}
6058
6059/// Updates the settings of a specific snapshot.
6060///
6061/// A builder for the *locations.instances.snapshots.patch* method supported by a *project* resource.
6062/// It is not used directly, but through a [`ProjectMethods`] instance.
6063///
6064/// # Example
6065///
6066/// Instantiate a resource method builder
6067///
6068/// ```test_harness,no_run
6069/// # extern crate hyper;
6070/// # extern crate hyper_rustls;
6071/// # extern crate google_file1_beta1 as file1_beta1;
6072/// use file1_beta1::api::Snapshot;
6073/// # async fn dox() {
6074/// # use file1_beta1::{CloudFilestore, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6075///
6076/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6077/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
6078/// #     secret,
6079/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6080/// # ).build().await.unwrap();
6081///
6082/// # let client = hyper_util::client::legacy::Client::builder(
6083/// #     hyper_util::rt::TokioExecutor::new()
6084/// # )
6085/// # .build(
6086/// #     hyper_rustls::HttpsConnectorBuilder::new()
6087/// #         .with_native_roots()
6088/// #         .unwrap()
6089/// #         .https_or_http()
6090/// #         .enable_http1()
6091/// #         .build()
6092/// # );
6093/// # let mut hub = CloudFilestore::new(client, auth);
6094/// // As the method needs a request, you would usually fill it with the desired information
6095/// // into the respective structure. Some of the parts shown here might not be applicable !
6096/// // Values shown here are possibly random and not representative !
6097/// let mut req = Snapshot::default();
6098///
6099/// // You can configure optional parameters by calling the respective setters at will, and
6100/// // execute the final call using `doit()`.
6101/// // Values shown here are possibly random and not representative !
6102/// let result = hub.projects().locations_instances_snapshots_patch(req, "name")
6103///              .update_mask(FieldMask::new::<&str>(&[]))
6104///              .doit().await;
6105/// # }
6106/// ```
6107pub struct ProjectLocationInstanceSnapshotPatchCall<'a, C>
6108where
6109    C: 'a,
6110{
6111    hub: &'a CloudFilestore<C>,
6112    _request: Snapshot,
6113    _name: String,
6114    _update_mask: Option<common::FieldMask>,
6115    _delegate: Option<&'a mut dyn common::Delegate>,
6116    _additional_params: HashMap<String, String>,
6117    _scopes: BTreeSet<String>,
6118}
6119
6120impl<'a, C> common::CallBuilder for ProjectLocationInstanceSnapshotPatchCall<'a, C> {}
6121
6122impl<'a, C> ProjectLocationInstanceSnapshotPatchCall<'a, C>
6123where
6124    C: common::Connector,
6125{
6126    /// Perform the operation you have build so far.
6127    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
6128        use std::borrow::Cow;
6129        use std::io::{Read, Seek};
6130
6131        use common::{url::Params, ToParts};
6132        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6133
6134        let mut dd = common::DefaultDelegate;
6135        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6136        dlg.begin(common::MethodInfo {
6137            id: "file.projects.locations.instances.snapshots.patch",
6138            http_method: hyper::Method::PATCH,
6139        });
6140
6141        for &field in ["alt", "name", "updateMask"].iter() {
6142            if self._additional_params.contains_key(field) {
6143                dlg.finished(false);
6144                return Err(common::Error::FieldClash(field));
6145            }
6146        }
6147
6148        let mut params = Params::with_capacity(5 + self._additional_params.len());
6149        params.push("name", self._name);
6150        if let Some(value) = self._update_mask.as_ref() {
6151            params.push("updateMask", value.to_string());
6152        }
6153
6154        params.extend(self._additional_params.iter());
6155
6156        params.push("alt", "json");
6157        let mut url = self.hub._base_url.clone() + "v1beta1/{+name}";
6158        if self._scopes.is_empty() {
6159            self._scopes
6160                .insert(Scope::CloudPlatform.as_ref().to_string());
6161        }
6162
6163        #[allow(clippy::single_element_loop)]
6164        for &(find_this, param_name) in [("{+name}", "name")].iter() {
6165            url = params.uri_replacement(url, param_name, find_this, true);
6166        }
6167        {
6168            let to_remove = ["name"];
6169            params.remove_params(&to_remove);
6170        }
6171
6172        let url = params.parse_with_url(&url);
6173
6174        let mut json_mime_type = mime::APPLICATION_JSON;
6175        let mut request_value_reader = {
6176            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
6177            common::remove_json_null_values(&mut value);
6178            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
6179            serde_json::to_writer(&mut dst, &value).unwrap();
6180            dst
6181        };
6182        let request_size = request_value_reader
6183            .seek(std::io::SeekFrom::End(0))
6184            .unwrap();
6185        request_value_reader
6186            .seek(std::io::SeekFrom::Start(0))
6187            .unwrap();
6188
6189        loop {
6190            let token = match self
6191                .hub
6192                .auth
6193                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6194                .await
6195            {
6196                Ok(token) => token,
6197                Err(e) => match dlg.token(e) {
6198                    Ok(token) => token,
6199                    Err(e) => {
6200                        dlg.finished(false);
6201                        return Err(common::Error::MissingToken(e));
6202                    }
6203                },
6204            };
6205            request_value_reader
6206                .seek(std::io::SeekFrom::Start(0))
6207                .unwrap();
6208            let mut req_result = {
6209                let client = &self.hub.client;
6210                dlg.pre_request();
6211                let mut req_builder = hyper::Request::builder()
6212                    .method(hyper::Method::PATCH)
6213                    .uri(url.as_str())
6214                    .header(USER_AGENT, self.hub._user_agent.clone());
6215
6216                if let Some(token) = token.as_ref() {
6217                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6218                }
6219
6220                let request = req_builder
6221                    .header(CONTENT_TYPE, json_mime_type.to_string())
6222                    .header(CONTENT_LENGTH, request_size as u64)
6223                    .body(common::to_body(
6224                        request_value_reader.get_ref().clone().into(),
6225                    ));
6226
6227                client.request(request.unwrap()).await
6228            };
6229
6230            match req_result {
6231                Err(err) => {
6232                    if let common::Retry::After(d) = dlg.http_error(&err) {
6233                        sleep(d).await;
6234                        continue;
6235                    }
6236                    dlg.finished(false);
6237                    return Err(common::Error::HttpError(err));
6238                }
6239                Ok(res) => {
6240                    let (mut parts, body) = res.into_parts();
6241                    let mut body = common::Body::new(body);
6242                    if !parts.status.is_success() {
6243                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6244                        let error = serde_json::from_str(&common::to_string(&bytes));
6245                        let response = common::to_response(parts, bytes.into());
6246
6247                        if let common::Retry::After(d) =
6248                            dlg.http_failure(&response, error.as_ref().ok())
6249                        {
6250                            sleep(d).await;
6251                            continue;
6252                        }
6253
6254                        dlg.finished(false);
6255
6256                        return Err(match error {
6257                            Ok(value) => common::Error::BadRequest(value),
6258                            _ => common::Error::Failure(response),
6259                        });
6260                    }
6261                    let response = {
6262                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6263                        let encoded = common::to_string(&bytes);
6264                        match serde_json::from_str(&encoded) {
6265                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6266                            Err(error) => {
6267                                dlg.response_json_decode_error(&encoded, &error);
6268                                return Err(common::Error::JsonDecodeError(
6269                                    encoded.to_string(),
6270                                    error,
6271                                ));
6272                            }
6273                        }
6274                    };
6275
6276                    dlg.finished(true);
6277                    return Ok(response);
6278                }
6279            }
6280        }
6281    }
6282
6283    ///
6284    /// Sets the *request* property to the given value.
6285    ///
6286    /// Even though the property as already been set when instantiating this call,
6287    /// we provide this method for API completeness.
6288    pub fn request(
6289        mut self,
6290        new_value: Snapshot,
6291    ) -> ProjectLocationInstanceSnapshotPatchCall<'a, C> {
6292        self._request = new_value;
6293        self
6294    }
6295    /// Output only. The resource name of the snapshot, in the format `projects/{project_id}/locations/{location_id}/instances/{instance_id}/snapshots/{snapshot_id}`.
6296    ///
6297    /// Sets the *name* path property to the given value.
6298    ///
6299    /// Even though the property as already been set when instantiating this call,
6300    /// we provide this method for API completeness.
6301    pub fn name(mut self, new_value: &str) -> ProjectLocationInstanceSnapshotPatchCall<'a, C> {
6302        self._name = new_value.to_string();
6303        self
6304    }
6305    /// Required. Mask of fields to update. At least one path must be supplied in this field.
6306    ///
6307    /// Sets the *update mask* query property to the given value.
6308    pub fn update_mask(
6309        mut self,
6310        new_value: common::FieldMask,
6311    ) -> ProjectLocationInstanceSnapshotPatchCall<'a, C> {
6312        self._update_mask = Some(new_value);
6313        self
6314    }
6315    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6316    /// while executing the actual API request.
6317    ///
6318    /// ````text
6319    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
6320    /// ````
6321    ///
6322    /// Sets the *delegate* property to the given value.
6323    pub fn delegate(
6324        mut self,
6325        new_value: &'a mut dyn common::Delegate,
6326    ) -> ProjectLocationInstanceSnapshotPatchCall<'a, C> {
6327        self._delegate = Some(new_value);
6328        self
6329    }
6330
6331    /// Set any additional parameter of the query string used in the request.
6332    /// It should be used to set parameters which are not yet available through their own
6333    /// setters.
6334    ///
6335    /// Please note that this method must not be used to set any of the known parameters
6336    /// which have their own setter method. If done anyway, the request will fail.
6337    ///
6338    /// # Additional Parameters
6339    ///
6340    /// * *$.xgafv* (query-string) - V1 error format.
6341    /// * *access_token* (query-string) - OAuth access token.
6342    /// * *alt* (query-string) - Data format for response.
6343    /// * *callback* (query-string) - JSONP
6344    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6345    /// * *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.
6346    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6347    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6348    /// * *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.
6349    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6350    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6351    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationInstanceSnapshotPatchCall<'a, C>
6352    where
6353        T: AsRef<str>,
6354    {
6355        self._additional_params
6356            .insert(name.as_ref().to_string(), value.as_ref().to_string());
6357        self
6358    }
6359
6360    /// Identifies the authorization scope for the method you are building.
6361    ///
6362    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6363    /// [`Scope::CloudPlatform`].
6364    ///
6365    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6366    /// tokens for more than one scope.
6367    ///
6368    /// Usually there is more than one suitable scope to authorize an operation, some of which may
6369    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6370    /// sufficient, a read-write scope will do as well.
6371    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationInstanceSnapshotPatchCall<'a, C>
6372    where
6373        St: AsRef<str>,
6374    {
6375        self._scopes.insert(String::from(scope.as_ref()));
6376        self
6377    }
6378    /// Identifies the authorization scope(s) for the method you are building.
6379    ///
6380    /// See [`Self::add_scope()`] for details.
6381    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationInstanceSnapshotPatchCall<'a, C>
6382    where
6383        I: IntoIterator<Item = St>,
6384        St: AsRef<str>,
6385    {
6386        self._scopes
6387            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6388        self
6389    }
6390
6391    /// Removes all scopes, and no default scope will be used either.
6392    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6393    /// for details).
6394    pub fn clear_scopes(mut self) -> ProjectLocationInstanceSnapshotPatchCall<'a, C> {
6395        self._scopes.clear();
6396        self
6397    }
6398}
6399
6400/// Creates an instance. When creating from a backup, the capacity of the new instance needs to be equal to or larger than the capacity of the backup (and also equal to or larger than the minimum capacity of the tier).
6401///
6402/// A builder for the *locations.instances.create* method supported by a *project* resource.
6403/// It is not used directly, but through a [`ProjectMethods`] instance.
6404///
6405/// # Example
6406///
6407/// Instantiate a resource method builder
6408///
6409/// ```test_harness,no_run
6410/// # extern crate hyper;
6411/// # extern crate hyper_rustls;
6412/// # extern crate google_file1_beta1 as file1_beta1;
6413/// use file1_beta1::api::Instance;
6414/// # async fn dox() {
6415/// # use file1_beta1::{CloudFilestore, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6416///
6417/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6418/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
6419/// #     secret,
6420/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6421/// # ).build().await.unwrap();
6422///
6423/// # let client = hyper_util::client::legacy::Client::builder(
6424/// #     hyper_util::rt::TokioExecutor::new()
6425/// # )
6426/// # .build(
6427/// #     hyper_rustls::HttpsConnectorBuilder::new()
6428/// #         .with_native_roots()
6429/// #         .unwrap()
6430/// #         .https_or_http()
6431/// #         .enable_http1()
6432/// #         .build()
6433/// # );
6434/// # let mut hub = CloudFilestore::new(client, auth);
6435/// // As the method needs a request, you would usually fill it with the desired information
6436/// // into the respective structure. Some of the parts shown here might not be applicable !
6437/// // Values shown here are possibly random and not representative !
6438/// let mut req = Instance::default();
6439///
6440/// // You can configure optional parameters by calling the respective setters at will, and
6441/// // execute the final call using `doit()`.
6442/// // Values shown here are possibly random and not representative !
6443/// let result = hub.projects().locations_instances_create(req, "parent")
6444///              .instance_id("labore")
6445///              .doit().await;
6446/// # }
6447/// ```
6448pub struct ProjectLocationInstanceCreateCall<'a, C>
6449where
6450    C: 'a,
6451{
6452    hub: &'a CloudFilestore<C>,
6453    _request: Instance,
6454    _parent: String,
6455    _instance_id: Option<String>,
6456    _delegate: Option<&'a mut dyn common::Delegate>,
6457    _additional_params: HashMap<String, String>,
6458    _scopes: BTreeSet<String>,
6459}
6460
6461impl<'a, C> common::CallBuilder for ProjectLocationInstanceCreateCall<'a, C> {}
6462
6463impl<'a, C> ProjectLocationInstanceCreateCall<'a, C>
6464where
6465    C: common::Connector,
6466{
6467    /// Perform the operation you have build so far.
6468    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
6469        use std::borrow::Cow;
6470        use std::io::{Read, Seek};
6471
6472        use common::{url::Params, ToParts};
6473        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6474
6475        let mut dd = common::DefaultDelegate;
6476        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6477        dlg.begin(common::MethodInfo {
6478            id: "file.projects.locations.instances.create",
6479            http_method: hyper::Method::POST,
6480        });
6481
6482        for &field in ["alt", "parent", "instanceId"].iter() {
6483            if self._additional_params.contains_key(field) {
6484                dlg.finished(false);
6485                return Err(common::Error::FieldClash(field));
6486            }
6487        }
6488
6489        let mut params = Params::with_capacity(5 + self._additional_params.len());
6490        params.push("parent", self._parent);
6491        if let Some(value) = self._instance_id.as_ref() {
6492            params.push("instanceId", value);
6493        }
6494
6495        params.extend(self._additional_params.iter());
6496
6497        params.push("alt", "json");
6498        let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/instances";
6499        if self._scopes.is_empty() {
6500            self._scopes
6501                .insert(Scope::CloudPlatform.as_ref().to_string());
6502        }
6503
6504        #[allow(clippy::single_element_loop)]
6505        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
6506            url = params.uri_replacement(url, param_name, find_this, true);
6507        }
6508        {
6509            let to_remove = ["parent"];
6510            params.remove_params(&to_remove);
6511        }
6512
6513        let url = params.parse_with_url(&url);
6514
6515        let mut json_mime_type = mime::APPLICATION_JSON;
6516        let mut request_value_reader = {
6517            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
6518            common::remove_json_null_values(&mut value);
6519            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
6520            serde_json::to_writer(&mut dst, &value).unwrap();
6521            dst
6522        };
6523        let request_size = request_value_reader
6524            .seek(std::io::SeekFrom::End(0))
6525            .unwrap();
6526        request_value_reader
6527            .seek(std::io::SeekFrom::Start(0))
6528            .unwrap();
6529
6530        loop {
6531            let token = match self
6532                .hub
6533                .auth
6534                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6535                .await
6536            {
6537                Ok(token) => token,
6538                Err(e) => match dlg.token(e) {
6539                    Ok(token) => token,
6540                    Err(e) => {
6541                        dlg.finished(false);
6542                        return Err(common::Error::MissingToken(e));
6543                    }
6544                },
6545            };
6546            request_value_reader
6547                .seek(std::io::SeekFrom::Start(0))
6548                .unwrap();
6549            let mut req_result = {
6550                let client = &self.hub.client;
6551                dlg.pre_request();
6552                let mut req_builder = hyper::Request::builder()
6553                    .method(hyper::Method::POST)
6554                    .uri(url.as_str())
6555                    .header(USER_AGENT, self.hub._user_agent.clone());
6556
6557                if let Some(token) = token.as_ref() {
6558                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6559                }
6560
6561                let request = req_builder
6562                    .header(CONTENT_TYPE, json_mime_type.to_string())
6563                    .header(CONTENT_LENGTH, request_size as u64)
6564                    .body(common::to_body(
6565                        request_value_reader.get_ref().clone().into(),
6566                    ));
6567
6568                client.request(request.unwrap()).await
6569            };
6570
6571            match req_result {
6572                Err(err) => {
6573                    if let common::Retry::After(d) = dlg.http_error(&err) {
6574                        sleep(d).await;
6575                        continue;
6576                    }
6577                    dlg.finished(false);
6578                    return Err(common::Error::HttpError(err));
6579                }
6580                Ok(res) => {
6581                    let (mut parts, body) = res.into_parts();
6582                    let mut body = common::Body::new(body);
6583                    if !parts.status.is_success() {
6584                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6585                        let error = serde_json::from_str(&common::to_string(&bytes));
6586                        let response = common::to_response(parts, bytes.into());
6587
6588                        if let common::Retry::After(d) =
6589                            dlg.http_failure(&response, error.as_ref().ok())
6590                        {
6591                            sleep(d).await;
6592                            continue;
6593                        }
6594
6595                        dlg.finished(false);
6596
6597                        return Err(match error {
6598                            Ok(value) => common::Error::BadRequest(value),
6599                            _ => common::Error::Failure(response),
6600                        });
6601                    }
6602                    let response = {
6603                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6604                        let encoded = common::to_string(&bytes);
6605                        match serde_json::from_str(&encoded) {
6606                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6607                            Err(error) => {
6608                                dlg.response_json_decode_error(&encoded, &error);
6609                                return Err(common::Error::JsonDecodeError(
6610                                    encoded.to_string(),
6611                                    error,
6612                                ));
6613                            }
6614                        }
6615                    };
6616
6617                    dlg.finished(true);
6618                    return Ok(response);
6619                }
6620            }
6621        }
6622    }
6623
6624    ///
6625    /// Sets the *request* property to the given value.
6626    ///
6627    /// Even though the property as already been set when instantiating this call,
6628    /// we provide this method for API completeness.
6629    pub fn request(mut self, new_value: Instance) -> ProjectLocationInstanceCreateCall<'a, C> {
6630        self._request = new_value;
6631        self
6632    }
6633    /// Required. The instance's project and location, in the format `projects/{project_id}/locations/{location}`. In Filestore, locations map to Google Cloud zones, for example **us-west1-b**.
6634    ///
6635    /// Sets the *parent* path property to the given value.
6636    ///
6637    /// Even though the property as already been set when instantiating this call,
6638    /// we provide this method for API completeness.
6639    pub fn parent(mut self, new_value: &str) -> ProjectLocationInstanceCreateCall<'a, C> {
6640        self._parent = new_value.to_string();
6641        self
6642    }
6643    /// Required. The ID of the instance to create. The ID must be unique within the specified project and location. This value must start with a lowercase letter followed by up to 62 lowercase letters, numbers, or hyphens, and cannot end with a hyphen.
6644    ///
6645    /// Sets the *instance id* query property to the given value.
6646    pub fn instance_id(mut self, new_value: &str) -> ProjectLocationInstanceCreateCall<'a, C> {
6647        self._instance_id = Some(new_value.to_string());
6648        self
6649    }
6650    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6651    /// while executing the actual API request.
6652    ///
6653    /// ````text
6654    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
6655    /// ````
6656    ///
6657    /// Sets the *delegate* property to the given value.
6658    pub fn delegate(
6659        mut self,
6660        new_value: &'a mut dyn common::Delegate,
6661    ) -> ProjectLocationInstanceCreateCall<'a, C> {
6662        self._delegate = Some(new_value);
6663        self
6664    }
6665
6666    /// Set any additional parameter of the query string used in the request.
6667    /// It should be used to set parameters which are not yet available through their own
6668    /// setters.
6669    ///
6670    /// Please note that this method must not be used to set any of the known parameters
6671    /// which have their own setter method. If done anyway, the request will fail.
6672    ///
6673    /// # Additional Parameters
6674    ///
6675    /// * *$.xgafv* (query-string) - V1 error format.
6676    /// * *access_token* (query-string) - OAuth access token.
6677    /// * *alt* (query-string) - Data format for response.
6678    /// * *callback* (query-string) - JSONP
6679    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6680    /// * *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.
6681    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6682    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6683    /// * *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.
6684    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6685    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6686    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationInstanceCreateCall<'a, C>
6687    where
6688        T: AsRef<str>,
6689    {
6690        self._additional_params
6691            .insert(name.as_ref().to_string(), value.as_ref().to_string());
6692        self
6693    }
6694
6695    /// Identifies the authorization scope for the method you are building.
6696    ///
6697    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6698    /// [`Scope::CloudPlatform`].
6699    ///
6700    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6701    /// tokens for more than one scope.
6702    ///
6703    /// Usually there is more than one suitable scope to authorize an operation, some of which may
6704    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6705    /// sufficient, a read-write scope will do as well.
6706    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationInstanceCreateCall<'a, C>
6707    where
6708        St: AsRef<str>,
6709    {
6710        self._scopes.insert(String::from(scope.as_ref()));
6711        self
6712    }
6713    /// Identifies the authorization scope(s) for the method you are building.
6714    ///
6715    /// See [`Self::add_scope()`] for details.
6716    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationInstanceCreateCall<'a, C>
6717    where
6718        I: IntoIterator<Item = St>,
6719        St: AsRef<str>,
6720    {
6721        self._scopes
6722            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6723        self
6724    }
6725
6726    /// Removes all scopes, and no default scope will be used either.
6727    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6728    /// for details).
6729    pub fn clear_scopes(mut self) -> ProjectLocationInstanceCreateCall<'a, C> {
6730        self._scopes.clear();
6731        self
6732    }
6733}
6734
6735/// Deletes an instance.
6736///
6737/// A builder for the *locations.instances.delete* method supported by a *project* resource.
6738/// It is not used directly, but through a [`ProjectMethods`] instance.
6739///
6740/// # Example
6741///
6742/// Instantiate a resource method builder
6743///
6744/// ```test_harness,no_run
6745/// # extern crate hyper;
6746/// # extern crate hyper_rustls;
6747/// # extern crate google_file1_beta1 as file1_beta1;
6748/// # async fn dox() {
6749/// # use file1_beta1::{CloudFilestore, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6750///
6751/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6752/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
6753/// #     secret,
6754/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
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_http1()
6766/// #         .build()
6767/// # );
6768/// # let mut hub = CloudFilestore::new(client, auth);
6769/// // You can configure optional parameters by calling the respective setters at will, and
6770/// // execute the final call using `doit()`.
6771/// // Values shown here are possibly random and not representative !
6772/// let result = hub.projects().locations_instances_delete("name")
6773///              .force(false)
6774///              .doit().await;
6775/// # }
6776/// ```
6777pub struct ProjectLocationInstanceDeleteCall<'a, C>
6778where
6779    C: 'a,
6780{
6781    hub: &'a CloudFilestore<C>,
6782    _name: String,
6783    _force: Option<bool>,
6784    _delegate: Option<&'a mut dyn common::Delegate>,
6785    _additional_params: HashMap<String, String>,
6786    _scopes: BTreeSet<String>,
6787}
6788
6789impl<'a, C> common::CallBuilder for ProjectLocationInstanceDeleteCall<'a, C> {}
6790
6791impl<'a, C> ProjectLocationInstanceDeleteCall<'a, C>
6792where
6793    C: common::Connector,
6794{
6795    /// Perform the operation you have build so far.
6796    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
6797        use std::borrow::Cow;
6798        use std::io::{Read, Seek};
6799
6800        use common::{url::Params, ToParts};
6801        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6802
6803        let mut dd = common::DefaultDelegate;
6804        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6805        dlg.begin(common::MethodInfo {
6806            id: "file.projects.locations.instances.delete",
6807            http_method: hyper::Method::DELETE,
6808        });
6809
6810        for &field in ["alt", "name", "force"].iter() {
6811            if self._additional_params.contains_key(field) {
6812                dlg.finished(false);
6813                return Err(common::Error::FieldClash(field));
6814            }
6815        }
6816
6817        let mut params = Params::with_capacity(4 + self._additional_params.len());
6818        params.push("name", self._name);
6819        if let Some(value) = self._force.as_ref() {
6820            params.push("force", value.to_string());
6821        }
6822
6823        params.extend(self._additional_params.iter());
6824
6825        params.push("alt", "json");
6826        let mut url = self.hub._base_url.clone() + "v1beta1/{+name}";
6827        if self._scopes.is_empty() {
6828            self._scopes
6829                .insert(Scope::CloudPlatform.as_ref().to_string());
6830        }
6831
6832        #[allow(clippy::single_element_loop)]
6833        for &(find_this, param_name) in [("{+name}", "name")].iter() {
6834            url = params.uri_replacement(url, param_name, find_this, true);
6835        }
6836        {
6837            let to_remove = ["name"];
6838            params.remove_params(&to_remove);
6839        }
6840
6841        let url = params.parse_with_url(&url);
6842
6843        loop {
6844            let token = match self
6845                .hub
6846                .auth
6847                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6848                .await
6849            {
6850                Ok(token) => token,
6851                Err(e) => match dlg.token(e) {
6852                    Ok(token) => token,
6853                    Err(e) => {
6854                        dlg.finished(false);
6855                        return Err(common::Error::MissingToken(e));
6856                    }
6857                },
6858            };
6859            let mut req_result = {
6860                let client = &self.hub.client;
6861                dlg.pre_request();
6862                let mut req_builder = hyper::Request::builder()
6863                    .method(hyper::Method::DELETE)
6864                    .uri(url.as_str())
6865                    .header(USER_AGENT, self.hub._user_agent.clone());
6866
6867                if let Some(token) = token.as_ref() {
6868                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6869                }
6870
6871                let request = req_builder
6872                    .header(CONTENT_LENGTH, 0_u64)
6873                    .body(common::to_body::<String>(None));
6874
6875                client.request(request.unwrap()).await
6876            };
6877
6878            match req_result {
6879                Err(err) => {
6880                    if let common::Retry::After(d) = dlg.http_error(&err) {
6881                        sleep(d).await;
6882                        continue;
6883                    }
6884                    dlg.finished(false);
6885                    return Err(common::Error::HttpError(err));
6886                }
6887                Ok(res) => {
6888                    let (mut parts, body) = res.into_parts();
6889                    let mut body = common::Body::new(body);
6890                    if !parts.status.is_success() {
6891                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6892                        let error = serde_json::from_str(&common::to_string(&bytes));
6893                        let response = common::to_response(parts, bytes.into());
6894
6895                        if let common::Retry::After(d) =
6896                            dlg.http_failure(&response, error.as_ref().ok())
6897                        {
6898                            sleep(d).await;
6899                            continue;
6900                        }
6901
6902                        dlg.finished(false);
6903
6904                        return Err(match error {
6905                            Ok(value) => common::Error::BadRequest(value),
6906                            _ => common::Error::Failure(response),
6907                        });
6908                    }
6909                    let response = {
6910                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6911                        let encoded = common::to_string(&bytes);
6912                        match serde_json::from_str(&encoded) {
6913                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6914                            Err(error) => {
6915                                dlg.response_json_decode_error(&encoded, &error);
6916                                return Err(common::Error::JsonDecodeError(
6917                                    encoded.to_string(),
6918                                    error,
6919                                ));
6920                            }
6921                        }
6922                    };
6923
6924                    dlg.finished(true);
6925                    return Ok(response);
6926                }
6927            }
6928        }
6929    }
6930
6931    /// Required. The instance resource name, in the format `projects/{project_id}/locations/{location}/instances/{instance_id}`
6932    ///
6933    /// Sets the *name* path property to the given value.
6934    ///
6935    /// Even though the property as already been set when instantiating this call,
6936    /// we provide this method for API completeness.
6937    pub fn name(mut self, new_value: &str) -> ProjectLocationInstanceDeleteCall<'a, C> {
6938        self._name = new_value.to_string();
6939        self
6940    }
6941    /// If set to true, any snapshots of the instance will also be deleted. (Otherwise, the request will only work if the instance has no snapshots.)
6942    ///
6943    /// Sets the *force* query property to the given value.
6944    pub fn force(mut self, new_value: bool) -> ProjectLocationInstanceDeleteCall<'a, C> {
6945        self._force = Some(new_value);
6946        self
6947    }
6948    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6949    /// while executing the actual API request.
6950    ///
6951    /// ````text
6952    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
6953    /// ````
6954    ///
6955    /// Sets the *delegate* property to the given value.
6956    pub fn delegate(
6957        mut self,
6958        new_value: &'a mut dyn common::Delegate,
6959    ) -> ProjectLocationInstanceDeleteCall<'a, C> {
6960        self._delegate = Some(new_value);
6961        self
6962    }
6963
6964    /// Set any additional parameter of the query string used in the request.
6965    /// It should be used to set parameters which are not yet available through their own
6966    /// setters.
6967    ///
6968    /// Please note that this method must not be used to set any of the known parameters
6969    /// which have their own setter method. If done anyway, the request will fail.
6970    ///
6971    /// # Additional Parameters
6972    ///
6973    /// * *$.xgafv* (query-string) - V1 error format.
6974    /// * *access_token* (query-string) - OAuth access token.
6975    /// * *alt* (query-string) - Data format for response.
6976    /// * *callback* (query-string) - JSONP
6977    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6978    /// * *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.
6979    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6980    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6981    /// * *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.
6982    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6983    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6984    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationInstanceDeleteCall<'a, C>
6985    where
6986        T: AsRef<str>,
6987    {
6988        self._additional_params
6989            .insert(name.as_ref().to_string(), value.as_ref().to_string());
6990        self
6991    }
6992
6993    /// Identifies the authorization scope for the method you are building.
6994    ///
6995    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6996    /// [`Scope::CloudPlatform`].
6997    ///
6998    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6999    /// tokens for more than one scope.
7000    ///
7001    /// Usually there is more than one suitable scope to authorize an operation, some of which may
7002    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7003    /// sufficient, a read-write scope will do as well.
7004    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationInstanceDeleteCall<'a, C>
7005    where
7006        St: AsRef<str>,
7007    {
7008        self._scopes.insert(String::from(scope.as_ref()));
7009        self
7010    }
7011    /// Identifies the authorization scope(s) for the method you are building.
7012    ///
7013    /// See [`Self::add_scope()`] for details.
7014    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationInstanceDeleteCall<'a, C>
7015    where
7016        I: IntoIterator<Item = St>,
7017        St: AsRef<str>,
7018    {
7019        self._scopes
7020            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7021        self
7022    }
7023
7024    /// Removes all scopes, and no default scope will be used either.
7025    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7026    /// for details).
7027    pub fn clear_scopes(mut self) -> ProjectLocationInstanceDeleteCall<'a, C> {
7028        self._scopes.clear();
7029        self
7030    }
7031}
7032
7033/// Gets the details of a specific instance.
7034///
7035/// A builder for the *locations.instances.get* method supported by a *project* resource.
7036/// It is not used directly, but through a [`ProjectMethods`] instance.
7037///
7038/// # Example
7039///
7040/// Instantiate a resource method builder
7041///
7042/// ```test_harness,no_run
7043/// # extern crate hyper;
7044/// # extern crate hyper_rustls;
7045/// # extern crate google_file1_beta1 as file1_beta1;
7046/// # async fn dox() {
7047/// # use file1_beta1::{CloudFilestore, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7048///
7049/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7050/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
7051/// #     secret,
7052/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7053/// # ).build().await.unwrap();
7054///
7055/// # let client = hyper_util::client::legacy::Client::builder(
7056/// #     hyper_util::rt::TokioExecutor::new()
7057/// # )
7058/// # .build(
7059/// #     hyper_rustls::HttpsConnectorBuilder::new()
7060/// #         .with_native_roots()
7061/// #         .unwrap()
7062/// #         .https_or_http()
7063/// #         .enable_http1()
7064/// #         .build()
7065/// # );
7066/// # let mut hub = CloudFilestore::new(client, auth);
7067/// // You can configure optional parameters by calling the respective setters at will, and
7068/// // execute the final call using `doit()`.
7069/// // Values shown here are possibly random and not representative !
7070/// let result = hub.projects().locations_instances_get("name")
7071///              .doit().await;
7072/// # }
7073/// ```
7074pub struct ProjectLocationInstanceGetCall<'a, C>
7075where
7076    C: 'a,
7077{
7078    hub: &'a CloudFilestore<C>,
7079    _name: String,
7080    _delegate: Option<&'a mut dyn common::Delegate>,
7081    _additional_params: HashMap<String, String>,
7082    _scopes: BTreeSet<String>,
7083}
7084
7085impl<'a, C> common::CallBuilder for ProjectLocationInstanceGetCall<'a, C> {}
7086
7087impl<'a, C> ProjectLocationInstanceGetCall<'a, C>
7088where
7089    C: common::Connector,
7090{
7091    /// Perform the operation you have build so far.
7092    pub async fn doit(mut self) -> common::Result<(common::Response, Instance)> {
7093        use std::borrow::Cow;
7094        use std::io::{Read, Seek};
7095
7096        use common::{url::Params, ToParts};
7097        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7098
7099        let mut dd = common::DefaultDelegate;
7100        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7101        dlg.begin(common::MethodInfo {
7102            id: "file.projects.locations.instances.get",
7103            http_method: hyper::Method::GET,
7104        });
7105
7106        for &field in ["alt", "name"].iter() {
7107            if self._additional_params.contains_key(field) {
7108                dlg.finished(false);
7109                return Err(common::Error::FieldClash(field));
7110            }
7111        }
7112
7113        let mut params = Params::with_capacity(3 + self._additional_params.len());
7114        params.push("name", self._name);
7115
7116        params.extend(self._additional_params.iter());
7117
7118        params.push("alt", "json");
7119        let mut url = self.hub._base_url.clone() + "v1beta1/{+name}";
7120        if self._scopes.is_empty() {
7121            self._scopes
7122                .insert(Scope::CloudPlatform.as_ref().to_string());
7123        }
7124
7125        #[allow(clippy::single_element_loop)]
7126        for &(find_this, param_name) in [("{+name}", "name")].iter() {
7127            url = params.uri_replacement(url, param_name, find_this, true);
7128        }
7129        {
7130            let to_remove = ["name"];
7131            params.remove_params(&to_remove);
7132        }
7133
7134        let url = params.parse_with_url(&url);
7135
7136        loop {
7137            let token = match self
7138                .hub
7139                .auth
7140                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
7141                .await
7142            {
7143                Ok(token) => token,
7144                Err(e) => match dlg.token(e) {
7145                    Ok(token) => token,
7146                    Err(e) => {
7147                        dlg.finished(false);
7148                        return Err(common::Error::MissingToken(e));
7149                    }
7150                },
7151            };
7152            let mut req_result = {
7153                let client = &self.hub.client;
7154                dlg.pre_request();
7155                let mut req_builder = hyper::Request::builder()
7156                    .method(hyper::Method::GET)
7157                    .uri(url.as_str())
7158                    .header(USER_AGENT, self.hub._user_agent.clone());
7159
7160                if let Some(token) = token.as_ref() {
7161                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7162                }
7163
7164                let request = req_builder
7165                    .header(CONTENT_LENGTH, 0_u64)
7166                    .body(common::to_body::<String>(None));
7167
7168                client.request(request.unwrap()).await
7169            };
7170
7171            match req_result {
7172                Err(err) => {
7173                    if let common::Retry::After(d) = dlg.http_error(&err) {
7174                        sleep(d).await;
7175                        continue;
7176                    }
7177                    dlg.finished(false);
7178                    return Err(common::Error::HttpError(err));
7179                }
7180                Ok(res) => {
7181                    let (mut parts, body) = res.into_parts();
7182                    let mut body = common::Body::new(body);
7183                    if !parts.status.is_success() {
7184                        let bytes = common::to_bytes(body).await.unwrap_or_default();
7185                        let error = serde_json::from_str(&common::to_string(&bytes));
7186                        let response = common::to_response(parts, bytes.into());
7187
7188                        if let common::Retry::After(d) =
7189                            dlg.http_failure(&response, error.as_ref().ok())
7190                        {
7191                            sleep(d).await;
7192                            continue;
7193                        }
7194
7195                        dlg.finished(false);
7196
7197                        return Err(match error {
7198                            Ok(value) => common::Error::BadRequest(value),
7199                            _ => common::Error::Failure(response),
7200                        });
7201                    }
7202                    let response = {
7203                        let bytes = common::to_bytes(body).await.unwrap_or_default();
7204                        let encoded = common::to_string(&bytes);
7205                        match serde_json::from_str(&encoded) {
7206                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
7207                            Err(error) => {
7208                                dlg.response_json_decode_error(&encoded, &error);
7209                                return Err(common::Error::JsonDecodeError(
7210                                    encoded.to_string(),
7211                                    error,
7212                                ));
7213                            }
7214                        }
7215                    };
7216
7217                    dlg.finished(true);
7218                    return Ok(response);
7219                }
7220            }
7221        }
7222    }
7223
7224    /// Required. The instance resource name, in the format `projects/{project_id}/locations/{location}/instances/{instance_id}`.
7225    ///
7226    /// Sets the *name* path property to the given value.
7227    ///
7228    /// Even though the property as already been set when instantiating this call,
7229    /// we provide this method for API completeness.
7230    pub fn name(mut self, new_value: &str) -> ProjectLocationInstanceGetCall<'a, C> {
7231        self._name = new_value.to_string();
7232        self
7233    }
7234    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7235    /// while executing the actual API request.
7236    ///
7237    /// ````text
7238    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
7239    /// ````
7240    ///
7241    /// Sets the *delegate* property to the given value.
7242    pub fn delegate(
7243        mut self,
7244        new_value: &'a mut dyn common::Delegate,
7245    ) -> ProjectLocationInstanceGetCall<'a, C> {
7246        self._delegate = Some(new_value);
7247        self
7248    }
7249
7250    /// Set any additional parameter of the query string used in the request.
7251    /// It should be used to set parameters which are not yet available through their own
7252    /// setters.
7253    ///
7254    /// Please note that this method must not be used to set any of the known parameters
7255    /// which have their own setter method. If done anyway, the request will fail.
7256    ///
7257    /// # Additional Parameters
7258    ///
7259    /// * *$.xgafv* (query-string) - V1 error format.
7260    /// * *access_token* (query-string) - OAuth access token.
7261    /// * *alt* (query-string) - Data format for response.
7262    /// * *callback* (query-string) - JSONP
7263    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7264    /// * *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.
7265    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7266    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7267    /// * *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.
7268    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7269    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7270    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationInstanceGetCall<'a, C>
7271    where
7272        T: AsRef<str>,
7273    {
7274        self._additional_params
7275            .insert(name.as_ref().to_string(), value.as_ref().to_string());
7276        self
7277    }
7278
7279    /// Identifies the authorization scope for the method you are building.
7280    ///
7281    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7282    /// [`Scope::CloudPlatform`].
7283    ///
7284    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7285    /// tokens for more than one scope.
7286    ///
7287    /// Usually there is more than one suitable scope to authorize an operation, some of which may
7288    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7289    /// sufficient, a read-write scope will do as well.
7290    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationInstanceGetCall<'a, C>
7291    where
7292        St: AsRef<str>,
7293    {
7294        self._scopes.insert(String::from(scope.as_ref()));
7295        self
7296    }
7297    /// Identifies the authorization scope(s) for the method you are building.
7298    ///
7299    /// See [`Self::add_scope()`] for details.
7300    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationInstanceGetCall<'a, C>
7301    where
7302        I: IntoIterator<Item = St>,
7303        St: AsRef<str>,
7304    {
7305        self._scopes
7306            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7307        self
7308    }
7309
7310    /// Removes all scopes, and no default scope will be used either.
7311    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7312    /// for details).
7313    pub fn clear_scopes(mut self) -> ProjectLocationInstanceGetCall<'a, C> {
7314        self._scopes.clear();
7315        self
7316    }
7317}
7318
7319/// Lists all instances in a project for either a specified location or for all locations.
7320///
7321/// A builder for the *locations.instances.list* method supported by a *project* resource.
7322/// It is not used directly, but through a [`ProjectMethods`] instance.
7323///
7324/// # Example
7325///
7326/// Instantiate a resource method builder
7327///
7328/// ```test_harness,no_run
7329/// # extern crate hyper;
7330/// # extern crate hyper_rustls;
7331/// # extern crate google_file1_beta1 as file1_beta1;
7332/// # async fn dox() {
7333/// # use file1_beta1::{CloudFilestore, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7334///
7335/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7336/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
7337/// #     secret,
7338/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7339/// # ).build().await.unwrap();
7340///
7341/// # let client = hyper_util::client::legacy::Client::builder(
7342/// #     hyper_util::rt::TokioExecutor::new()
7343/// # )
7344/// # .build(
7345/// #     hyper_rustls::HttpsConnectorBuilder::new()
7346/// #         .with_native_roots()
7347/// #         .unwrap()
7348/// #         .https_or_http()
7349/// #         .enable_http1()
7350/// #         .build()
7351/// # );
7352/// # let mut hub = CloudFilestore::new(client, auth);
7353/// // You can configure optional parameters by calling the respective setters at will, and
7354/// // execute the final call using `doit()`.
7355/// // Values shown here are possibly random and not representative !
7356/// let result = hub.projects().locations_instances_list("parent")
7357///              .page_token("Stet")
7358///              .page_size(-13)
7359///              .order_by("et")
7360///              .filter("sed")
7361///              .doit().await;
7362/// # }
7363/// ```
7364pub struct ProjectLocationInstanceListCall<'a, C>
7365where
7366    C: 'a,
7367{
7368    hub: &'a CloudFilestore<C>,
7369    _parent: String,
7370    _page_token: Option<String>,
7371    _page_size: Option<i32>,
7372    _order_by: Option<String>,
7373    _filter: Option<String>,
7374    _delegate: Option<&'a mut dyn common::Delegate>,
7375    _additional_params: HashMap<String, String>,
7376    _scopes: BTreeSet<String>,
7377}
7378
7379impl<'a, C> common::CallBuilder for ProjectLocationInstanceListCall<'a, C> {}
7380
7381impl<'a, C> ProjectLocationInstanceListCall<'a, C>
7382where
7383    C: common::Connector,
7384{
7385    /// Perform the operation you have build so far.
7386    pub async fn doit(mut self) -> common::Result<(common::Response, ListInstancesResponse)> {
7387        use std::borrow::Cow;
7388        use std::io::{Read, Seek};
7389
7390        use common::{url::Params, ToParts};
7391        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7392
7393        let mut dd = common::DefaultDelegate;
7394        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7395        dlg.begin(common::MethodInfo {
7396            id: "file.projects.locations.instances.list",
7397            http_method: hyper::Method::GET,
7398        });
7399
7400        for &field in [
7401            "alt",
7402            "parent",
7403            "pageToken",
7404            "pageSize",
7405            "orderBy",
7406            "filter",
7407        ]
7408        .iter()
7409        {
7410            if self._additional_params.contains_key(field) {
7411                dlg.finished(false);
7412                return Err(common::Error::FieldClash(field));
7413            }
7414        }
7415
7416        let mut params = Params::with_capacity(7 + self._additional_params.len());
7417        params.push("parent", self._parent);
7418        if let Some(value) = self._page_token.as_ref() {
7419            params.push("pageToken", value);
7420        }
7421        if let Some(value) = self._page_size.as_ref() {
7422            params.push("pageSize", value.to_string());
7423        }
7424        if let Some(value) = self._order_by.as_ref() {
7425            params.push("orderBy", value);
7426        }
7427        if let Some(value) = self._filter.as_ref() {
7428            params.push("filter", value);
7429        }
7430
7431        params.extend(self._additional_params.iter());
7432
7433        params.push("alt", "json");
7434        let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/instances";
7435        if self._scopes.is_empty() {
7436            self._scopes
7437                .insert(Scope::CloudPlatform.as_ref().to_string());
7438        }
7439
7440        #[allow(clippy::single_element_loop)]
7441        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
7442            url = params.uri_replacement(url, param_name, find_this, true);
7443        }
7444        {
7445            let to_remove = ["parent"];
7446            params.remove_params(&to_remove);
7447        }
7448
7449        let url = params.parse_with_url(&url);
7450
7451        loop {
7452            let token = match self
7453                .hub
7454                .auth
7455                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
7456                .await
7457            {
7458                Ok(token) => token,
7459                Err(e) => match dlg.token(e) {
7460                    Ok(token) => token,
7461                    Err(e) => {
7462                        dlg.finished(false);
7463                        return Err(common::Error::MissingToken(e));
7464                    }
7465                },
7466            };
7467            let mut req_result = {
7468                let client = &self.hub.client;
7469                dlg.pre_request();
7470                let mut req_builder = hyper::Request::builder()
7471                    .method(hyper::Method::GET)
7472                    .uri(url.as_str())
7473                    .header(USER_AGENT, self.hub._user_agent.clone());
7474
7475                if let Some(token) = token.as_ref() {
7476                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7477                }
7478
7479                let request = req_builder
7480                    .header(CONTENT_LENGTH, 0_u64)
7481                    .body(common::to_body::<String>(None));
7482
7483                client.request(request.unwrap()).await
7484            };
7485
7486            match req_result {
7487                Err(err) => {
7488                    if let common::Retry::After(d) = dlg.http_error(&err) {
7489                        sleep(d).await;
7490                        continue;
7491                    }
7492                    dlg.finished(false);
7493                    return Err(common::Error::HttpError(err));
7494                }
7495                Ok(res) => {
7496                    let (mut parts, body) = res.into_parts();
7497                    let mut body = common::Body::new(body);
7498                    if !parts.status.is_success() {
7499                        let bytes = common::to_bytes(body).await.unwrap_or_default();
7500                        let error = serde_json::from_str(&common::to_string(&bytes));
7501                        let response = common::to_response(parts, bytes.into());
7502
7503                        if let common::Retry::After(d) =
7504                            dlg.http_failure(&response, error.as_ref().ok())
7505                        {
7506                            sleep(d).await;
7507                            continue;
7508                        }
7509
7510                        dlg.finished(false);
7511
7512                        return Err(match error {
7513                            Ok(value) => common::Error::BadRequest(value),
7514                            _ => common::Error::Failure(response),
7515                        });
7516                    }
7517                    let response = {
7518                        let bytes = common::to_bytes(body).await.unwrap_or_default();
7519                        let encoded = common::to_string(&bytes);
7520                        match serde_json::from_str(&encoded) {
7521                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
7522                            Err(error) => {
7523                                dlg.response_json_decode_error(&encoded, &error);
7524                                return Err(common::Error::JsonDecodeError(
7525                                    encoded.to_string(),
7526                                    error,
7527                                ));
7528                            }
7529                        }
7530                    };
7531
7532                    dlg.finished(true);
7533                    return Ok(response);
7534                }
7535            }
7536        }
7537    }
7538
7539    /// Required. The project and location for which to retrieve instance information, in the format `projects/{project_id}/locations/{location}`. In Cloud Filestore, locations map to Google Cloud zones, for example **us-west1-b**. To retrieve instance information for all locations, use "-" for the `{location}` value.
7540    ///
7541    /// Sets the *parent* path property to the given value.
7542    ///
7543    /// Even though the property as already been set when instantiating this call,
7544    /// we provide this method for API completeness.
7545    pub fn parent(mut self, new_value: &str) -> ProjectLocationInstanceListCall<'a, C> {
7546        self._parent = new_value.to_string();
7547        self
7548    }
7549    /// The next_page_token value to use if there are additional results to retrieve for this list request.
7550    ///
7551    /// Sets the *page token* query property to the given value.
7552    pub fn page_token(mut self, new_value: &str) -> ProjectLocationInstanceListCall<'a, C> {
7553        self._page_token = Some(new_value.to_string());
7554        self
7555    }
7556    /// The maximum number of items to return.
7557    ///
7558    /// Sets the *page size* query property to the given value.
7559    pub fn page_size(mut self, new_value: i32) -> ProjectLocationInstanceListCall<'a, C> {
7560        self._page_size = Some(new_value);
7561        self
7562    }
7563    /// Sort results. Supported values are "name", "name desc" or "" (unsorted).
7564    ///
7565    /// Sets the *order by* query property to the given value.
7566    pub fn order_by(mut self, new_value: &str) -> ProjectLocationInstanceListCall<'a, C> {
7567        self._order_by = Some(new_value.to_string());
7568        self
7569    }
7570    /// List filter.
7571    ///
7572    /// Sets the *filter* query property to the given value.
7573    pub fn filter(mut self, new_value: &str) -> ProjectLocationInstanceListCall<'a, C> {
7574        self._filter = Some(new_value.to_string());
7575        self
7576    }
7577    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7578    /// while executing the actual API request.
7579    ///
7580    /// ````text
7581    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
7582    /// ````
7583    ///
7584    /// Sets the *delegate* property to the given value.
7585    pub fn delegate(
7586        mut self,
7587        new_value: &'a mut dyn common::Delegate,
7588    ) -> ProjectLocationInstanceListCall<'a, C> {
7589        self._delegate = Some(new_value);
7590        self
7591    }
7592
7593    /// Set any additional parameter of the query string used in the request.
7594    /// It should be used to set parameters which are not yet available through their own
7595    /// setters.
7596    ///
7597    /// Please note that this method must not be used to set any of the known parameters
7598    /// which have their own setter method. If done anyway, the request will fail.
7599    ///
7600    /// # Additional Parameters
7601    ///
7602    /// * *$.xgafv* (query-string) - V1 error format.
7603    /// * *access_token* (query-string) - OAuth access token.
7604    /// * *alt* (query-string) - Data format for response.
7605    /// * *callback* (query-string) - JSONP
7606    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7607    /// * *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.
7608    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7609    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7610    /// * *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.
7611    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7612    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7613    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationInstanceListCall<'a, C>
7614    where
7615        T: AsRef<str>,
7616    {
7617        self._additional_params
7618            .insert(name.as_ref().to_string(), value.as_ref().to_string());
7619        self
7620    }
7621
7622    /// Identifies the authorization scope for the method you are building.
7623    ///
7624    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7625    /// [`Scope::CloudPlatform`].
7626    ///
7627    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7628    /// tokens for more than one scope.
7629    ///
7630    /// Usually there is more than one suitable scope to authorize an operation, some of which may
7631    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7632    /// sufficient, a read-write scope will do as well.
7633    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationInstanceListCall<'a, C>
7634    where
7635        St: AsRef<str>,
7636    {
7637        self._scopes.insert(String::from(scope.as_ref()));
7638        self
7639    }
7640    /// Identifies the authorization scope(s) for the method you are building.
7641    ///
7642    /// See [`Self::add_scope()`] for details.
7643    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationInstanceListCall<'a, C>
7644    where
7645        I: IntoIterator<Item = St>,
7646        St: AsRef<str>,
7647    {
7648        self._scopes
7649            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7650        self
7651    }
7652
7653    /// Removes all scopes, and no default scope will be used either.
7654    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7655    /// for details).
7656    pub fn clear_scopes(mut self) -> ProjectLocationInstanceListCall<'a, C> {
7657        self._scopes.clear();
7658        self
7659    }
7660}
7661
7662/// Updates the settings of a specific instance.
7663///
7664/// A builder for the *locations.instances.patch* method supported by a *project* resource.
7665/// It is not used directly, but through a [`ProjectMethods`] instance.
7666///
7667/// # Example
7668///
7669/// Instantiate a resource method builder
7670///
7671/// ```test_harness,no_run
7672/// # extern crate hyper;
7673/// # extern crate hyper_rustls;
7674/// # extern crate google_file1_beta1 as file1_beta1;
7675/// use file1_beta1::api::Instance;
7676/// # async fn dox() {
7677/// # use file1_beta1::{CloudFilestore, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7678///
7679/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7680/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
7681/// #     secret,
7682/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7683/// # ).build().await.unwrap();
7684///
7685/// # let client = hyper_util::client::legacy::Client::builder(
7686/// #     hyper_util::rt::TokioExecutor::new()
7687/// # )
7688/// # .build(
7689/// #     hyper_rustls::HttpsConnectorBuilder::new()
7690/// #         .with_native_roots()
7691/// #         .unwrap()
7692/// #         .https_or_http()
7693/// #         .enable_http1()
7694/// #         .build()
7695/// # );
7696/// # let mut hub = CloudFilestore::new(client, auth);
7697/// // As the method needs a request, you would usually fill it with the desired information
7698/// // into the respective structure. Some of the parts shown here might not be applicable !
7699/// // Values shown here are possibly random and not representative !
7700/// let mut req = Instance::default();
7701///
7702/// // You can configure optional parameters by calling the respective setters at will, and
7703/// // execute the final call using `doit()`.
7704/// // Values shown here are possibly random and not representative !
7705/// let result = hub.projects().locations_instances_patch(req, "name")
7706///              .update_mask(FieldMask::new::<&str>(&[]))
7707///              .doit().await;
7708/// # }
7709/// ```
7710pub struct ProjectLocationInstancePatchCall<'a, C>
7711where
7712    C: 'a,
7713{
7714    hub: &'a CloudFilestore<C>,
7715    _request: Instance,
7716    _name: String,
7717    _update_mask: Option<common::FieldMask>,
7718    _delegate: Option<&'a mut dyn common::Delegate>,
7719    _additional_params: HashMap<String, String>,
7720    _scopes: BTreeSet<String>,
7721}
7722
7723impl<'a, C> common::CallBuilder for ProjectLocationInstancePatchCall<'a, C> {}
7724
7725impl<'a, C> ProjectLocationInstancePatchCall<'a, C>
7726where
7727    C: common::Connector,
7728{
7729    /// Perform the operation you have build so far.
7730    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
7731        use std::borrow::Cow;
7732        use std::io::{Read, Seek};
7733
7734        use common::{url::Params, ToParts};
7735        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7736
7737        let mut dd = common::DefaultDelegate;
7738        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7739        dlg.begin(common::MethodInfo {
7740            id: "file.projects.locations.instances.patch",
7741            http_method: hyper::Method::PATCH,
7742        });
7743
7744        for &field in ["alt", "name", "updateMask"].iter() {
7745            if self._additional_params.contains_key(field) {
7746                dlg.finished(false);
7747                return Err(common::Error::FieldClash(field));
7748            }
7749        }
7750
7751        let mut params = Params::with_capacity(5 + self._additional_params.len());
7752        params.push("name", self._name);
7753        if let Some(value) = self._update_mask.as_ref() {
7754            params.push("updateMask", value.to_string());
7755        }
7756
7757        params.extend(self._additional_params.iter());
7758
7759        params.push("alt", "json");
7760        let mut url = self.hub._base_url.clone() + "v1beta1/{+name}";
7761        if self._scopes.is_empty() {
7762            self._scopes
7763                .insert(Scope::CloudPlatform.as_ref().to_string());
7764        }
7765
7766        #[allow(clippy::single_element_loop)]
7767        for &(find_this, param_name) in [("{+name}", "name")].iter() {
7768            url = params.uri_replacement(url, param_name, find_this, true);
7769        }
7770        {
7771            let to_remove = ["name"];
7772            params.remove_params(&to_remove);
7773        }
7774
7775        let url = params.parse_with_url(&url);
7776
7777        let mut json_mime_type = mime::APPLICATION_JSON;
7778        let mut request_value_reader = {
7779            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
7780            common::remove_json_null_values(&mut value);
7781            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
7782            serde_json::to_writer(&mut dst, &value).unwrap();
7783            dst
7784        };
7785        let request_size = request_value_reader
7786            .seek(std::io::SeekFrom::End(0))
7787            .unwrap();
7788        request_value_reader
7789            .seek(std::io::SeekFrom::Start(0))
7790            .unwrap();
7791
7792        loop {
7793            let token = match self
7794                .hub
7795                .auth
7796                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
7797                .await
7798            {
7799                Ok(token) => token,
7800                Err(e) => match dlg.token(e) {
7801                    Ok(token) => token,
7802                    Err(e) => {
7803                        dlg.finished(false);
7804                        return Err(common::Error::MissingToken(e));
7805                    }
7806                },
7807            };
7808            request_value_reader
7809                .seek(std::io::SeekFrom::Start(0))
7810                .unwrap();
7811            let mut req_result = {
7812                let client = &self.hub.client;
7813                dlg.pre_request();
7814                let mut req_builder = hyper::Request::builder()
7815                    .method(hyper::Method::PATCH)
7816                    .uri(url.as_str())
7817                    .header(USER_AGENT, self.hub._user_agent.clone());
7818
7819                if let Some(token) = token.as_ref() {
7820                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7821                }
7822
7823                let request = req_builder
7824                    .header(CONTENT_TYPE, json_mime_type.to_string())
7825                    .header(CONTENT_LENGTH, request_size as u64)
7826                    .body(common::to_body(
7827                        request_value_reader.get_ref().clone().into(),
7828                    ));
7829
7830                client.request(request.unwrap()).await
7831            };
7832
7833            match req_result {
7834                Err(err) => {
7835                    if let common::Retry::After(d) = dlg.http_error(&err) {
7836                        sleep(d).await;
7837                        continue;
7838                    }
7839                    dlg.finished(false);
7840                    return Err(common::Error::HttpError(err));
7841                }
7842                Ok(res) => {
7843                    let (mut parts, body) = res.into_parts();
7844                    let mut body = common::Body::new(body);
7845                    if !parts.status.is_success() {
7846                        let bytes = common::to_bytes(body).await.unwrap_or_default();
7847                        let error = serde_json::from_str(&common::to_string(&bytes));
7848                        let response = common::to_response(parts, bytes.into());
7849
7850                        if let common::Retry::After(d) =
7851                            dlg.http_failure(&response, error.as_ref().ok())
7852                        {
7853                            sleep(d).await;
7854                            continue;
7855                        }
7856
7857                        dlg.finished(false);
7858
7859                        return Err(match error {
7860                            Ok(value) => common::Error::BadRequest(value),
7861                            _ => common::Error::Failure(response),
7862                        });
7863                    }
7864                    let response = {
7865                        let bytes = common::to_bytes(body).await.unwrap_or_default();
7866                        let encoded = common::to_string(&bytes);
7867                        match serde_json::from_str(&encoded) {
7868                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
7869                            Err(error) => {
7870                                dlg.response_json_decode_error(&encoded, &error);
7871                                return Err(common::Error::JsonDecodeError(
7872                                    encoded.to_string(),
7873                                    error,
7874                                ));
7875                            }
7876                        }
7877                    };
7878
7879                    dlg.finished(true);
7880                    return Ok(response);
7881                }
7882            }
7883        }
7884    }
7885
7886    ///
7887    /// Sets the *request* property to the given value.
7888    ///
7889    /// Even though the property as already been set when instantiating this call,
7890    /// we provide this method for API completeness.
7891    pub fn request(mut self, new_value: Instance) -> ProjectLocationInstancePatchCall<'a, C> {
7892        self._request = new_value;
7893        self
7894    }
7895    /// Output only. The resource name of the instance, in the format `projects/{project_id}/locations/{location_id}/instances/{instance_id}`.
7896    ///
7897    /// Sets the *name* path property to the given value.
7898    ///
7899    /// Even though the property as already been set when instantiating this call,
7900    /// we provide this method for API completeness.
7901    pub fn name(mut self, new_value: &str) -> ProjectLocationInstancePatchCall<'a, C> {
7902        self._name = new_value.to_string();
7903        self
7904    }
7905    /// Required. Mask of fields to update. At least one path must be supplied in this field. The elements of the repeated paths field may only include these fields: * "description" * "directory_services" * "file_shares" * "labels"
7906    ///
7907    /// Sets the *update mask* query property to the given value.
7908    pub fn update_mask(
7909        mut self,
7910        new_value: common::FieldMask,
7911    ) -> ProjectLocationInstancePatchCall<'a, C> {
7912        self._update_mask = Some(new_value);
7913        self
7914    }
7915    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7916    /// while executing the actual API request.
7917    ///
7918    /// ````text
7919    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
7920    /// ````
7921    ///
7922    /// Sets the *delegate* property to the given value.
7923    pub fn delegate(
7924        mut self,
7925        new_value: &'a mut dyn common::Delegate,
7926    ) -> ProjectLocationInstancePatchCall<'a, C> {
7927        self._delegate = Some(new_value);
7928        self
7929    }
7930
7931    /// Set any additional parameter of the query string used in the request.
7932    /// It should be used to set parameters which are not yet available through their own
7933    /// setters.
7934    ///
7935    /// Please note that this method must not be used to set any of the known parameters
7936    /// which have their own setter method. If done anyway, the request will fail.
7937    ///
7938    /// # Additional Parameters
7939    ///
7940    /// * *$.xgafv* (query-string) - V1 error format.
7941    /// * *access_token* (query-string) - OAuth access token.
7942    /// * *alt* (query-string) - Data format for response.
7943    /// * *callback* (query-string) - JSONP
7944    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7945    /// * *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.
7946    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7947    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7948    /// * *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.
7949    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7950    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7951    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationInstancePatchCall<'a, C>
7952    where
7953        T: AsRef<str>,
7954    {
7955        self._additional_params
7956            .insert(name.as_ref().to_string(), value.as_ref().to_string());
7957        self
7958    }
7959
7960    /// Identifies the authorization scope for the method you are building.
7961    ///
7962    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7963    /// [`Scope::CloudPlatform`].
7964    ///
7965    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7966    /// tokens for more than one scope.
7967    ///
7968    /// Usually there is more than one suitable scope to authorize an operation, some of which may
7969    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7970    /// sufficient, a read-write scope will do as well.
7971    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationInstancePatchCall<'a, C>
7972    where
7973        St: AsRef<str>,
7974    {
7975        self._scopes.insert(String::from(scope.as_ref()));
7976        self
7977    }
7978    /// Identifies the authorization scope(s) for the method you are building.
7979    ///
7980    /// See [`Self::add_scope()`] for details.
7981    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationInstancePatchCall<'a, C>
7982    where
7983        I: IntoIterator<Item = St>,
7984        St: AsRef<str>,
7985    {
7986        self._scopes
7987            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7988        self
7989    }
7990
7991    /// Removes all scopes, and no default scope will be used either.
7992    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7993    /// for details).
7994    pub fn clear_scopes(mut self) -> ProjectLocationInstancePatchCall<'a, C> {
7995        self._scopes.clear();
7996        self
7997    }
7998}
7999
8000/// Promote an standby instance (replica).
8001///
8002/// A builder for the *locations.instances.promoteReplica* method supported by a *project* resource.
8003/// It is not used directly, but through a [`ProjectMethods`] instance.
8004///
8005/// # Example
8006///
8007/// Instantiate a resource method builder
8008///
8009/// ```test_harness,no_run
8010/// # extern crate hyper;
8011/// # extern crate hyper_rustls;
8012/// # extern crate google_file1_beta1 as file1_beta1;
8013/// use file1_beta1::api::PromoteReplicaRequest;
8014/// # async fn dox() {
8015/// # use file1_beta1::{CloudFilestore, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8016///
8017/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
8018/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
8019/// #     secret,
8020/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8021/// # ).build().await.unwrap();
8022///
8023/// # let client = hyper_util::client::legacy::Client::builder(
8024/// #     hyper_util::rt::TokioExecutor::new()
8025/// # )
8026/// # .build(
8027/// #     hyper_rustls::HttpsConnectorBuilder::new()
8028/// #         .with_native_roots()
8029/// #         .unwrap()
8030/// #         .https_or_http()
8031/// #         .enable_http1()
8032/// #         .build()
8033/// # );
8034/// # let mut hub = CloudFilestore::new(client, auth);
8035/// // As the method needs a request, you would usually fill it with the desired information
8036/// // into the respective structure. Some of the parts shown here might not be applicable !
8037/// // Values shown here are possibly random and not representative !
8038/// let mut req = PromoteReplicaRequest::default();
8039///
8040/// // You can configure optional parameters by calling the respective setters at will, and
8041/// // execute the final call using `doit()`.
8042/// // Values shown here are possibly random and not representative !
8043/// let result = hub.projects().locations_instances_promote_replica(req, "name")
8044///              .doit().await;
8045/// # }
8046/// ```
8047pub struct ProjectLocationInstancePromoteReplicaCall<'a, C>
8048where
8049    C: 'a,
8050{
8051    hub: &'a CloudFilestore<C>,
8052    _request: PromoteReplicaRequest,
8053    _name: String,
8054    _delegate: Option<&'a mut dyn common::Delegate>,
8055    _additional_params: HashMap<String, String>,
8056    _scopes: BTreeSet<String>,
8057}
8058
8059impl<'a, C> common::CallBuilder for ProjectLocationInstancePromoteReplicaCall<'a, C> {}
8060
8061impl<'a, C> ProjectLocationInstancePromoteReplicaCall<'a, C>
8062where
8063    C: common::Connector,
8064{
8065    /// Perform the operation you have build so far.
8066    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
8067        use std::borrow::Cow;
8068        use std::io::{Read, Seek};
8069
8070        use common::{url::Params, ToParts};
8071        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
8072
8073        let mut dd = common::DefaultDelegate;
8074        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
8075        dlg.begin(common::MethodInfo {
8076            id: "file.projects.locations.instances.promoteReplica",
8077            http_method: hyper::Method::POST,
8078        });
8079
8080        for &field in ["alt", "name"].iter() {
8081            if self._additional_params.contains_key(field) {
8082                dlg.finished(false);
8083                return Err(common::Error::FieldClash(field));
8084            }
8085        }
8086
8087        let mut params = Params::with_capacity(4 + self._additional_params.len());
8088        params.push("name", self._name);
8089
8090        params.extend(self._additional_params.iter());
8091
8092        params.push("alt", "json");
8093        let mut url = self.hub._base_url.clone() + "v1beta1/{+name}:promoteReplica";
8094        if self._scopes.is_empty() {
8095            self._scopes
8096                .insert(Scope::CloudPlatform.as_ref().to_string());
8097        }
8098
8099        #[allow(clippy::single_element_loop)]
8100        for &(find_this, param_name) in [("{+name}", "name")].iter() {
8101            url = params.uri_replacement(url, param_name, find_this, true);
8102        }
8103        {
8104            let to_remove = ["name"];
8105            params.remove_params(&to_remove);
8106        }
8107
8108        let url = params.parse_with_url(&url);
8109
8110        let mut json_mime_type = mime::APPLICATION_JSON;
8111        let mut request_value_reader = {
8112            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
8113            common::remove_json_null_values(&mut value);
8114            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
8115            serde_json::to_writer(&mut dst, &value).unwrap();
8116            dst
8117        };
8118        let request_size = request_value_reader
8119            .seek(std::io::SeekFrom::End(0))
8120            .unwrap();
8121        request_value_reader
8122            .seek(std::io::SeekFrom::Start(0))
8123            .unwrap();
8124
8125        loop {
8126            let token = match self
8127                .hub
8128                .auth
8129                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
8130                .await
8131            {
8132                Ok(token) => token,
8133                Err(e) => match dlg.token(e) {
8134                    Ok(token) => token,
8135                    Err(e) => {
8136                        dlg.finished(false);
8137                        return Err(common::Error::MissingToken(e));
8138                    }
8139                },
8140            };
8141            request_value_reader
8142                .seek(std::io::SeekFrom::Start(0))
8143                .unwrap();
8144            let mut req_result = {
8145                let client = &self.hub.client;
8146                dlg.pre_request();
8147                let mut req_builder = hyper::Request::builder()
8148                    .method(hyper::Method::POST)
8149                    .uri(url.as_str())
8150                    .header(USER_AGENT, self.hub._user_agent.clone());
8151
8152                if let Some(token) = token.as_ref() {
8153                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8154                }
8155
8156                let request = req_builder
8157                    .header(CONTENT_TYPE, json_mime_type.to_string())
8158                    .header(CONTENT_LENGTH, request_size as u64)
8159                    .body(common::to_body(
8160                        request_value_reader.get_ref().clone().into(),
8161                    ));
8162
8163                client.request(request.unwrap()).await
8164            };
8165
8166            match req_result {
8167                Err(err) => {
8168                    if let common::Retry::After(d) = dlg.http_error(&err) {
8169                        sleep(d).await;
8170                        continue;
8171                    }
8172                    dlg.finished(false);
8173                    return Err(common::Error::HttpError(err));
8174                }
8175                Ok(res) => {
8176                    let (mut parts, body) = res.into_parts();
8177                    let mut body = common::Body::new(body);
8178                    if !parts.status.is_success() {
8179                        let bytes = common::to_bytes(body).await.unwrap_or_default();
8180                        let error = serde_json::from_str(&common::to_string(&bytes));
8181                        let response = common::to_response(parts, bytes.into());
8182
8183                        if let common::Retry::After(d) =
8184                            dlg.http_failure(&response, error.as_ref().ok())
8185                        {
8186                            sleep(d).await;
8187                            continue;
8188                        }
8189
8190                        dlg.finished(false);
8191
8192                        return Err(match error {
8193                            Ok(value) => common::Error::BadRequest(value),
8194                            _ => common::Error::Failure(response),
8195                        });
8196                    }
8197                    let response = {
8198                        let bytes = common::to_bytes(body).await.unwrap_or_default();
8199                        let encoded = common::to_string(&bytes);
8200                        match serde_json::from_str(&encoded) {
8201                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8202                            Err(error) => {
8203                                dlg.response_json_decode_error(&encoded, &error);
8204                                return Err(common::Error::JsonDecodeError(
8205                                    encoded.to_string(),
8206                                    error,
8207                                ));
8208                            }
8209                        }
8210                    };
8211
8212                    dlg.finished(true);
8213                    return Ok(response);
8214                }
8215            }
8216        }
8217    }
8218
8219    ///
8220    /// Sets the *request* property to the given value.
8221    ///
8222    /// Even though the property as already been set when instantiating this call,
8223    /// we provide this method for API completeness.
8224    pub fn request(
8225        mut self,
8226        new_value: PromoteReplicaRequest,
8227    ) -> ProjectLocationInstancePromoteReplicaCall<'a, C> {
8228        self._request = new_value;
8229        self
8230    }
8231    /// Required. The resource name of the instance, in the format `projects/{project_id}/locations/{location_id}/instances/{instance_id}`.
8232    ///
8233    /// Sets the *name* path property to the given value.
8234    ///
8235    /// Even though the property as already been set when instantiating this call,
8236    /// we provide this method for API completeness.
8237    pub fn name(mut self, new_value: &str) -> ProjectLocationInstancePromoteReplicaCall<'a, C> {
8238        self._name = new_value.to_string();
8239        self
8240    }
8241    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8242    /// while executing the actual API request.
8243    ///
8244    /// ````text
8245    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
8246    /// ````
8247    ///
8248    /// Sets the *delegate* property to the given value.
8249    pub fn delegate(
8250        mut self,
8251        new_value: &'a mut dyn common::Delegate,
8252    ) -> ProjectLocationInstancePromoteReplicaCall<'a, C> {
8253        self._delegate = Some(new_value);
8254        self
8255    }
8256
8257    /// Set any additional parameter of the query string used in the request.
8258    /// It should be used to set parameters which are not yet available through their own
8259    /// setters.
8260    ///
8261    /// Please note that this method must not be used to set any of the known parameters
8262    /// which have their own setter method. If done anyway, the request will fail.
8263    ///
8264    /// # Additional Parameters
8265    ///
8266    /// * *$.xgafv* (query-string) - V1 error format.
8267    /// * *access_token* (query-string) - OAuth access token.
8268    /// * *alt* (query-string) - Data format for response.
8269    /// * *callback* (query-string) - JSONP
8270    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8271    /// * *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.
8272    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8273    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8274    /// * *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.
8275    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8276    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8277    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationInstancePromoteReplicaCall<'a, C>
8278    where
8279        T: AsRef<str>,
8280    {
8281        self._additional_params
8282            .insert(name.as_ref().to_string(), value.as_ref().to_string());
8283        self
8284    }
8285
8286    /// Identifies the authorization scope for the method you are building.
8287    ///
8288    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
8289    /// [`Scope::CloudPlatform`].
8290    ///
8291    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
8292    /// tokens for more than one scope.
8293    ///
8294    /// Usually there is more than one suitable scope to authorize an operation, some of which may
8295    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
8296    /// sufficient, a read-write scope will do as well.
8297    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationInstancePromoteReplicaCall<'a, C>
8298    where
8299        St: AsRef<str>,
8300    {
8301        self._scopes.insert(String::from(scope.as_ref()));
8302        self
8303    }
8304    /// Identifies the authorization scope(s) for the method you are building.
8305    ///
8306    /// See [`Self::add_scope()`] for details.
8307    pub fn add_scopes<I, St>(
8308        mut self,
8309        scopes: I,
8310    ) -> ProjectLocationInstancePromoteReplicaCall<'a, C>
8311    where
8312        I: IntoIterator<Item = St>,
8313        St: AsRef<str>,
8314    {
8315        self._scopes
8316            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
8317        self
8318    }
8319
8320    /// Removes all scopes, and no default scope will be used either.
8321    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
8322    /// for details).
8323    pub fn clear_scopes(mut self) -> ProjectLocationInstancePromoteReplicaCall<'a, C> {
8324        self._scopes.clear();
8325        self
8326    }
8327}
8328
8329/// Restores an existing instance's file share from a backup. The capacity of the instance needs to be equal to or larger than the capacity of the backup (and also equal to or larger than the minimum capacity of the tier).
8330///
8331/// A builder for the *locations.instances.restore* method supported by a *project* resource.
8332/// It is not used directly, but through a [`ProjectMethods`] instance.
8333///
8334/// # Example
8335///
8336/// Instantiate a resource method builder
8337///
8338/// ```test_harness,no_run
8339/// # extern crate hyper;
8340/// # extern crate hyper_rustls;
8341/// # extern crate google_file1_beta1 as file1_beta1;
8342/// use file1_beta1::api::RestoreInstanceRequest;
8343/// # async fn dox() {
8344/// # use file1_beta1::{CloudFilestore, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8345///
8346/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
8347/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
8348/// #     secret,
8349/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8350/// # ).build().await.unwrap();
8351///
8352/// # let client = hyper_util::client::legacy::Client::builder(
8353/// #     hyper_util::rt::TokioExecutor::new()
8354/// # )
8355/// # .build(
8356/// #     hyper_rustls::HttpsConnectorBuilder::new()
8357/// #         .with_native_roots()
8358/// #         .unwrap()
8359/// #         .https_or_http()
8360/// #         .enable_http1()
8361/// #         .build()
8362/// # );
8363/// # let mut hub = CloudFilestore::new(client, auth);
8364/// // As the method needs a request, you would usually fill it with the desired information
8365/// // into the respective structure. Some of the parts shown here might not be applicable !
8366/// // Values shown here are possibly random and not representative !
8367/// let mut req = RestoreInstanceRequest::default();
8368///
8369/// // You can configure optional parameters by calling the respective setters at will, and
8370/// // execute the final call using `doit()`.
8371/// // Values shown here are possibly random and not representative !
8372/// let result = hub.projects().locations_instances_restore(req, "name")
8373///              .doit().await;
8374/// # }
8375/// ```
8376pub struct ProjectLocationInstanceRestoreCall<'a, C>
8377where
8378    C: 'a,
8379{
8380    hub: &'a CloudFilestore<C>,
8381    _request: RestoreInstanceRequest,
8382    _name: String,
8383    _delegate: Option<&'a mut dyn common::Delegate>,
8384    _additional_params: HashMap<String, String>,
8385    _scopes: BTreeSet<String>,
8386}
8387
8388impl<'a, C> common::CallBuilder for ProjectLocationInstanceRestoreCall<'a, C> {}
8389
8390impl<'a, C> ProjectLocationInstanceRestoreCall<'a, C>
8391where
8392    C: common::Connector,
8393{
8394    /// Perform the operation you have build so far.
8395    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
8396        use std::borrow::Cow;
8397        use std::io::{Read, Seek};
8398
8399        use common::{url::Params, ToParts};
8400        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
8401
8402        let mut dd = common::DefaultDelegate;
8403        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
8404        dlg.begin(common::MethodInfo {
8405            id: "file.projects.locations.instances.restore",
8406            http_method: hyper::Method::POST,
8407        });
8408
8409        for &field in ["alt", "name"].iter() {
8410            if self._additional_params.contains_key(field) {
8411                dlg.finished(false);
8412                return Err(common::Error::FieldClash(field));
8413            }
8414        }
8415
8416        let mut params = Params::with_capacity(4 + self._additional_params.len());
8417        params.push("name", self._name);
8418
8419        params.extend(self._additional_params.iter());
8420
8421        params.push("alt", "json");
8422        let mut url = self.hub._base_url.clone() + "v1beta1/{+name}:restore";
8423        if self._scopes.is_empty() {
8424            self._scopes
8425                .insert(Scope::CloudPlatform.as_ref().to_string());
8426        }
8427
8428        #[allow(clippy::single_element_loop)]
8429        for &(find_this, param_name) in [("{+name}", "name")].iter() {
8430            url = params.uri_replacement(url, param_name, find_this, true);
8431        }
8432        {
8433            let to_remove = ["name"];
8434            params.remove_params(&to_remove);
8435        }
8436
8437        let url = params.parse_with_url(&url);
8438
8439        let mut json_mime_type = mime::APPLICATION_JSON;
8440        let mut request_value_reader = {
8441            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
8442            common::remove_json_null_values(&mut value);
8443            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
8444            serde_json::to_writer(&mut dst, &value).unwrap();
8445            dst
8446        };
8447        let request_size = request_value_reader
8448            .seek(std::io::SeekFrom::End(0))
8449            .unwrap();
8450        request_value_reader
8451            .seek(std::io::SeekFrom::Start(0))
8452            .unwrap();
8453
8454        loop {
8455            let token = match self
8456                .hub
8457                .auth
8458                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
8459                .await
8460            {
8461                Ok(token) => token,
8462                Err(e) => match dlg.token(e) {
8463                    Ok(token) => token,
8464                    Err(e) => {
8465                        dlg.finished(false);
8466                        return Err(common::Error::MissingToken(e));
8467                    }
8468                },
8469            };
8470            request_value_reader
8471                .seek(std::io::SeekFrom::Start(0))
8472                .unwrap();
8473            let mut req_result = {
8474                let client = &self.hub.client;
8475                dlg.pre_request();
8476                let mut req_builder = hyper::Request::builder()
8477                    .method(hyper::Method::POST)
8478                    .uri(url.as_str())
8479                    .header(USER_AGENT, self.hub._user_agent.clone());
8480
8481                if let Some(token) = token.as_ref() {
8482                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8483                }
8484
8485                let request = req_builder
8486                    .header(CONTENT_TYPE, json_mime_type.to_string())
8487                    .header(CONTENT_LENGTH, request_size as u64)
8488                    .body(common::to_body(
8489                        request_value_reader.get_ref().clone().into(),
8490                    ));
8491
8492                client.request(request.unwrap()).await
8493            };
8494
8495            match req_result {
8496                Err(err) => {
8497                    if let common::Retry::After(d) = dlg.http_error(&err) {
8498                        sleep(d).await;
8499                        continue;
8500                    }
8501                    dlg.finished(false);
8502                    return Err(common::Error::HttpError(err));
8503                }
8504                Ok(res) => {
8505                    let (mut parts, body) = res.into_parts();
8506                    let mut body = common::Body::new(body);
8507                    if !parts.status.is_success() {
8508                        let bytes = common::to_bytes(body).await.unwrap_or_default();
8509                        let error = serde_json::from_str(&common::to_string(&bytes));
8510                        let response = common::to_response(parts, bytes.into());
8511
8512                        if let common::Retry::After(d) =
8513                            dlg.http_failure(&response, error.as_ref().ok())
8514                        {
8515                            sleep(d).await;
8516                            continue;
8517                        }
8518
8519                        dlg.finished(false);
8520
8521                        return Err(match error {
8522                            Ok(value) => common::Error::BadRequest(value),
8523                            _ => common::Error::Failure(response),
8524                        });
8525                    }
8526                    let response = {
8527                        let bytes = common::to_bytes(body).await.unwrap_or_default();
8528                        let encoded = common::to_string(&bytes);
8529                        match serde_json::from_str(&encoded) {
8530                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8531                            Err(error) => {
8532                                dlg.response_json_decode_error(&encoded, &error);
8533                                return Err(common::Error::JsonDecodeError(
8534                                    encoded.to_string(),
8535                                    error,
8536                                ));
8537                            }
8538                        }
8539                    };
8540
8541                    dlg.finished(true);
8542                    return Ok(response);
8543                }
8544            }
8545        }
8546    }
8547
8548    ///
8549    /// Sets the *request* property to the given value.
8550    ///
8551    /// Even though the property as already been set when instantiating this call,
8552    /// we provide this method for API completeness.
8553    pub fn request(
8554        mut self,
8555        new_value: RestoreInstanceRequest,
8556    ) -> ProjectLocationInstanceRestoreCall<'a, C> {
8557        self._request = new_value;
8558        self
8559    }
8560    /// Required. The resource name of the instance, in the format `projects/{project_id}/locations/{location_id}/instances/{instance_id}`.
8561    ///
8562    /// Sets the *name* path property to the given value.
8563    ///
8564    /// Even though the property as already been set when instantiating this call,
8565    /// we provide this method for API completeness.
8566    pub fn name(mut self, new_value: &str) -> ProjectLocationInstanceRestoreCall<'a, C> {
8567        self._name = new_value.to_string();
8568        self
8569    }
8570    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8571    /// while executing the actual API request.
8572    ///
8573    /// ````text
8574    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
8575    /// ````
8576    ///
8577    /// Sets the *delegate* property to the given value.
8578    pub fn delegate(
8579        mut self,
8580        new_value: &'a mut dyn common::Delegate,
8581    ) -> ProjectLocationInstanceRestoreCall<'a, C> {
8582        self._delegate = Some(new_value);
8583        self
8584    }
8585
8586    /// Set any additional parameter of the query string used in the request.
8587    /// It should be used to set parameters which are not yet available through their own
8588    /// setters.
8589    ///
8590    /// Please note that this method must not be used to set any of the known parameters
8591    /// which have their own setter method. If done anyway, the request will fail.
8592    ///
8593    /// # Additional Parameters
8594    ///
8595    /// * *$.xgafv* (query-string) - V1 error format.
8596    /// * *access_token* (query-string) - OAuth access token.
8597    /// * *alt* (query-string) - Data format for response.
8598    /// * *callback* (query-string) - JSONP
8599    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8600    /// * *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.
8601    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8602    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8603    /// * *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.
8604    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8605    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8606    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationInstanceRestoreCall<'a, C>
8607    where
8608        T: AsRef<str>,
8609    {
8610        self._additional_params
8611            .insert(name.as_ref().to_string(), value.as_ref().to_string());
8612        self
8613    }
8614
8615    /// Identifies the authorization scope for the method you are building.
8616    ///
8617    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
8618    /// [`Scope::CloudPlatform`].
8619    ///
8620    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
8621    /// tokens for more than one scope.
8622    ///
8623    /// Usually there is more than one suitable scope to authorize an operation, some of which may
8624    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
8625    /// sufficient, a read-write scope will do as well.
8626    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationInstanceRestoreCall<'a, C>
8627    where
8628        St: AsRef<str>,
8629    {
8630        self._scopes.insert(String::from(scope.as_ref()));
8631        self
8632    }
8633    /// Identifies the authorization scope(s) for the method you are building.
8634    ///
8635    /// See [`Self::add_scope()`] for details.
8636    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationInstanceRestoreCall<'a, C>
8637    where
8638        I: IntoIterator<Item = St>,
8639        St: AsRef<str>,
8640    {
8641        self._scopes
8642            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
8643        self
8644    }
8645
8646    /// Removes all scopes, and no default scope will be used either.
8647    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
8648    /// for details).
8649    pub fn clear_scopes(mut self) -> ProjectLocationInstanceRestoreCall<'a, C> {
8650        self._scopes.clear();
8651        self
8652    }
8653}
8654
8655/// Revert an existing instance's file system to a specified snapshot.
8656///
8657/// A builder for the *locations.instances.revert* method supported by a *project* resource.
8658/// It is not used directly, but through a [`ProjectMethods`] instance.
8659///
8660/// # Example
8661///
8662/// Instantiate a resource method builder
8663///
8664/// ```test_harness,no_run
8665/// # extern crate hyper;
8666/// # extern crate hyper_rustls;
8667/// # extern crate google_file1_beta1 as file1_beta1;
8668/// use file1_beta1::api::RevertInstanceRequest;
8669/// # async fn dox() {
8670/// # use file1_beta1::{CloudFilestore, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8671///
8672/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
8673/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
8674/// #     secret,
8675/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8676/// # ).build().await.unwrap();
8677///
8678/// # let client = hyper_util::client::legacy::Client::builder(
8679/// #     hyper_util::rt::TokioExecutor::new()
8680/// # )
8681/// # .build(
8682/// #     hyper_rustls::HttpsConnectorBuilder::new()
8683/// #         .with_native_roots()
8684/// #         .unwrap()
8685/// #         .https_or_http()
8686/// #         .enable_http1()
8687/// #         .build()
8688/// # );
8689/// # let mut hub = CloudFilestore::new(client, auth);
8690/// // As the method needs a request, you would usually fill it with the desired information
8691/// // into the respective structure. Some of the parts shown here might not be applicable !
8692/// // Values shown here are possibly random and not representative !
8693/// let mut req = RevertInstanceRequest::default();
8694///
8695/// // You can configure optional parameters by calling the respective setters at will, and
8696/// // execute the final call using `doit()`.
8697/// // Values shown here are possibly random and not representative !
8698/// let result = hub.projects().locations_instances_revert(req, "name")
8699///              .doit().await;
8700/// # }
8701/// ```
8702pub struct ProjectLocationInstanceRevertCall<'a, C>
8703where
8704    C: 'a,
8705{
8706    hub: &'a CloudFilestore<C>,
8707    _request: RevertInstanceRequest,
8708    _name: String,
8709    _delegate: Option<&'a mut dyn common::Delegate>,
8710    _additional_params: HashMap<String, String>,
8711    _scopes: BTreeSet<String>,
8712}
8713
8714impl<'a, C> common::CallBuilder for ProjectLocationInstanceRevertCall<'a, C> {}
8715
8716impl<'a, C> ProjectLocationInstanceRevertCall<'a, C>
8717where
8718    C: common::Connector,
8719{
8720    /// Perform the operation you have build so far.
8721    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
8722        use std::borrow::Cow;
8723        use std::io::{Read, Seek};
8724
8725        use common::{url::Params, ToParts};
8726        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
8727
8728        let mut dd = common::DefaultDelegate;
8729        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
8730        dlg.begin(common::MethodInfo {
8731            id: "file.projects.locations.instances.revert",
8732            http_method: hyper::Method::POST,
8733        });
8734
8735        for &field in ["alt", "name"].iter() {
8736            if self._additional_params.contains_key(field) {
8737                dlg.finished(false);
8738                return Err(common::Error::FieldClash(field));
8739            }
8740        }
8741
8742        let mut params = Params::with_capacity(4 + self._additional_params.len());
8743        params.push("name", self._name);
8744
8745        params.extend(self._additional_params.iter());
8746
8747        params.push("alt", "json");
8748        let mut url = self.hub._base_url.clone() + "v1beta1/{+name}:revert";
8749        if self._scopes.is_empty() {
8750            self._scopes
8751                .insert(Scope::CloudPlatform.as_ref().to_string());
8752        }
8753
8754        #[allow(clippy::single_element_loop)]
8755        for &(find_this, param_name) in [("{+name}", "name")].iter() {
8756            url = params.uri_replacement(url, param_name, find_this, true);
8757        }
8758        {
8759            let to_remove = ["name"];
8760            params.remove_params(&to_remove);
8761        }
8762
8763        let url = params.parse_with_url(&url);
8764
8765        let mut json_mime_type = mime::APPLICATION_JSON;
8766        let mut request_value_reader = {
8767            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
8768            common::remove_json_null_values(&mut value);
8769            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
8770            serde_json::to_writer(&mut dst, &value).unwrap();
8771            dst
8772        };
8773        let request_size = request_value_reader
8774            .seek(std::io::SeekFrom::End(0))
8775            .unwrap();
8776        request_value_reader
8777            .seek(std::io::SeekFrom::Start(0))
8778            .unwrap();
8779
8780        loop {
8781            let token = match self
8782                .hub
8783                .auth
8784                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
8785                .await
8786            {
8787                Ok(token) => token,
8788                Err(e) => match dlg.token(e) {
8789                    Ok(token) => token,
8790                    Err(e) => {
8791                        dlg.finished(false);
8792                        return Err(common::Error::MissingToken(e));
8793                    }
8794                },
8795            };
8796            request_value_reader
8797                .seek(std::io::SeekFrom::Start(0))
8798                .unwrap();
8799            let mut req_result = {
8800                let client = &self.hub.client;
8801                dlg.pre_request();
8802                let mut req_builder = hyper::Request::builder()
8803                    .method(hyper::Method::POST)
8804                    .uri(url.as_str())
8805                    .header(USER_AGENT, self.hub._user_agent.clone());
8806
8807                if let Some(token) = token.as_ref() {
8808                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8809                }
8810
8811                let request = req_builder
8812                    .header(CONTENT_TYPE, json_mime_type.to_string())
8813                    .header(CONTENT_LENGTH, request_size as u64)
8814                    .body(common::to_body(
8815                        request_value_reader.get_ref().clone().into(),
8816                    ));
8817
8818                client.request(request.unwrap()).await
8819            };
8820
8821            match req_result {
8822                Err(err) => {
8823                    if let common::Retry::After(d) = dlg.http_error(&err) {
8824                        sleep(d).await;
8825                        continue;
8826                    }
8827                    dlg.finished(false);
8828                    return Err(common::Error::HttpError(err));
8829                }
8830                Ok(res) => {
8831                    let (mut parts, body) = res.into_parts();
8832                    let mut body = common::Body::new(body);
8833                    if !parts.status.is_success() {
8834                        let bytes = common::to_bytes(body).await.unwrap_or_default();
8835                        let error = serde_json::from_str(&common::to_string(&bytes));
8836                        let response = common::to_response(parts, bytes.into());
8837
8838                        if let common::Retry::After(d) =
8839                            dlg.http_failure(&response, error.as_ref().ok())
8840                        {
8841                            sleep(d).await;
8842                            continue;
8843                        }
8844
8845                        dlg.finished(false);
8846
8847                        return Err(match error {
8848                            Ok(value) => common::Error::BadRequest(value),
8849                            _ => common::Error::Failure(response),
8850                        });
8851                    }
8852                    let response = {
8853                        let bytes = common::to_bytes(body).await.unwrap_or_default();
8854                        let encoded = common::to_string(&bytes);
8855                        match serde_json::from_str(&encoded) {
8856                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8857                            Err(error) => {
8858                                dlg.response_json_decode_error(&encoded, &error);
8859                                return Err(common::Error::JsonDecodeError(
8860                                    encoded.to_string(),
8861                                    error,
8862                                ));
8863                            }
8864                        }
8865                    };
8866
8867                    dlg.finished(true);
8868                    return Ok(response);
8869                }
8870            }
8871        }
8872    }
8873
8874    ///
8875    /// Sets the *request* property to the given value.
8876    ///
8877    /// Even though the property as already been set when instantiating this call,
8878    /// we provide this method for API completeness.
8879    pub fn request(
8880        mut self,
8881        new_value: RevertInstanceRequest,
8882    ) -> ProjectLocationInstanceRevertCall<'a, C> {
8883        self._request = new_value;
8884        self
8885    }
8886    /// Required. The resource name of the instance, in the format `projects/{project_id}/locations/{location_id}/instances/{instance_id}`.
8887    ///
8888    /// Sets the *name* path property to the given value.
8889    ///
8890    /// Even though the property as already been set when instantiating this call,
8891    /// we provide this method for API completeness.
8892    pub fn name(mut self, new_value: &str) -> ProjectLocationInstanceRevertCall<'a, C> {
8893        self._name = new_value.to_string();
8894        self
8895    }
8896    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8897    /// while executing the actual API request.
8898    ///
8899    /// ````text
8900    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
8901    /// ````
8902    ///
8903    /// Sets the *delegate* property to the given value.
8904    pub fn delegate(
8905        mut self,
8906        new_value: &'a mut dyn common::Delegate,
8907    ) -> ProjectLocationInstanceRevertCall<'a, C> {
8908        self._delegate = Some(new_value);
8909        self
8910    }
8911
8912    /// Set any additional parameter of the query string used in the request.
8913    /// It should be used to set parameters which are not yet available through their own
8914    /// setters.
8915    ///
8916    /// Please note that this method must not be used to set any of the known parameters
8917    /// which have their own setter method. If done anyway, the request will fail.
8918    ///
8919    /// # Additional Parameters
8920    ///
8921    /// * *$.xgafv* (query-string) - V1 error format.
8922    /// * *access_token* (query-string) - OAuth access token.
8923    /// * *alt* (query-string) - Data format for response.
8924    /// * *callback* (query-string) - JSONP
8925    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8926    /// * *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.
8927    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8928    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8929    /// * *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.
8930    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8931    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8932    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationInstanceRevertCall<'a, C>
8933    where
8934        T: AsRef<str>,
8935    {
8936        self._additional_params
8937            .insert(name.as_ref().to_string(), value.as_ref().to_string());
8938        self
8939    }
8940
8941    /// Identifies the authorization scope for the method you are building.
8942    ///
8943    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
8944    /// [`Scope::CloudPlatform`].
8945    ///
8946    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
8947    /// tokens for more than one scope.
8948    ///
8949    /// Usually there is more than one suitable scope to authorize an operation, some of which may
8950    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
8951    /// sufficient, a read-write scope will do as well.
8952    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationInstanceRevertCall<'a, C>
8953    where
8954        St: AsRef<str>,
8955    {
8956        self._scopes.insert(String::from(scope.as_ref()));
8957        self
8958    }
8959    /// Identifies the authorization scope(s) for the method you are building.
8960    ///
8961    /// See [`Self::add_scope()`] for details.
8962    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationInstanceRevertCall<'a, C>
8963    where
8964        I: IntoIterator<Item = St>,
8965        St: AsRef<str>,
8966    {
8967        self._scopes
8968            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
8969        self
8970    }
8971
8972    /// Removes all scopes, and no default scope will be used either.
8973    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
8974    /// for details).
8975    pub fn clear_scopes(mut self) -> ProjectLocationInstanceRevertCall<'a, C> {
8976        self._scopes.clear();
8977        self
8978    }
8979}
8980
8981/// Starts asynchronous cancellation on a long-running operation. The server makes a best effort to cancel the operation, but success is not guaranteed. If the server doesn't support this method, it returns `google.rpc.Code.UNIMPLEMENTED`. Clients can use Operations.GetOperation or other methods to check whether the cancellation succeeded or whether the operation completed despite cancellation. On successful cancellation, the operation is not deleted; instead, it becomes an operation with an Operation.error value with a google.rpc.Status.code of 1, corresponding to `Code.CANCELLED`.
8982///
8983/// A builder for the *locations.operations.cancel* method supported by a *project* resource.
8984/// It is not used directly, but through a [`ProjectMethods`] instance.
8985///
8986/// # Example
8987///
8988/// Instantiate a resource method builder
8989///
8990/// ```test_harness,no_run
8991/// # extern crate hyper;
8992/// # extern crate hyper_rustls;
8993/// # extern crate google_file1_beta1 as file1_beta1;
8994/// use file1_beta1::api::CancelOperationRequest;
8995/// # async fn dox() {
8996/// # use file1_beta1::{CloudFilestore, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8997///
8998/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
8999/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
9000/// #     secret,
9001/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9002/// # ).build().await.unwrap();
9003///
9004/// # let client = hyper_util::client::legacy::Client::builder(
9005/// #     hyper_util::rt::TokioExecutor::new()
9006/// # )
9007/// # .build(
9008/// #     hyper_rustls::HttpsConnectorBuilder::new()
9009/// #         .with_native_roots()
9010/// #         .unwrap()
9011/// #         .https_or_http()
9012/// #         .enable_http1()
9013/// #         .build()
9014/// # );
9015/// # let mut hub = CloudFilestore::new(client, auth);
9016/// // As the method needs a request, you would usually fill it with the desired information
9017/// // into the respective structure. Some of the parts shown here might not be applicable !
9018/// // Values shown here are possibly random and not representative !
9019/// let mut req = CancelOperationRequest::default();
9020///
9021/// // You can configure optional parameters by calling the respective setters at will, and
9022/// // execute the final call using `doit()`.
9023/// // Values shown here are possibly random and not representative !
9024/// let result = hub.projects().locations_operations_cancel(req, "name")
9025///              .doit().await;
9026/// # }
9027/// ```
9028pub struct ProjectLocationOperationCancelCall<'a, C>
9029where
9030    C: 'a,
9031{
9032    hub: &'a CloudFilestore<C>,
9033    _request: CancelOperationRequest,
9034    _name: String,
9035    _delegate: Option<&'a mut dyn common::Delegate>,
9036    _additional_params: HashMap<String, String>,
9037    _scopes: BTreeSet<String>,
9038}
9039
9040impl<'a, C> common::CallBuilder for ProjectLocationOperationCancelCall<'a, C> {}
9041
9042impl<'a, C> ProjectLocationOperationCancelCall<'a, C>
9043where
9044    C: common::Connector,
9045{
9046    /// Perform the operation you have build so far.
9047    pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
9048        use std::borrow::Cow;
9049        use std::io::{Read, Seek};
9050
9051        use common::{url::Params, ToParts};
9052        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
9053
9054        let mut dd = common::DefaultDelegate;
9055        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
9056        dlg.begin(common::MethodInfo {
9057            id: "file.projects.locations.operations.cancel",
9058            http_method: hyper::Method::POST,
9059        });
9060
9061        for &field in ["alt", "name"].iter() {
9062            if self._additional_params.contains_key(field) {
9063                dlg.finished(false);
9064                return Err(common::Error::FieldClash(field));
9065            }
9066        }
9067
9068        let mut params = Params::with_capacity(4 + self._additional_params.len());
9069        params.push("name", self._name);
9070
9071        params.extend(self._additional_params.iter());
9072
9073        params.push("alt", "json");
9074        let mut url = self.hub._base_url.clone() + "v1beta1/{+name}:cancel";
9075        if self._scopes.is_empty() {
9076            self._scopes
9077                .insert(Scope::CloudPlatform.as_ref().to_string());
9078        }
9079
9080        #[allow(clippy::single_element_loop)]
9081        for &(find_this, param_name) in [("{+name}", "name")].iter() {
9082            url = params.uri_replacement(url, param_name, find_this, true);
9083        }
9084        {
9085            let to_remove = ["name"];
9086            params.remove_params(&to_remove);
9087        }
9088
9089        let url = params.parse_with_url(&url);
9090
9091        let mut json_mime_type = mime::APPLICATION_JSON;
9092        let mut request_value_reader = {
9093            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
9094            common::remove_json_null_values(&mut value);
9095            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
9096            serde_json::to_writer(&mut dst, &value).unwrap();
9097            dst
9098        };
9099        let request_size = request_value_reader
9100            .seek(std::io::SeekFrom::End(0))
9101            .unwrap();
9102        request_value_reader
9103            .seek(std::io::SeekFrom::Start(0))
9104            .unwrap();
9105
9106        loop {
9107            let token = match self
9108                .hub
9109                .auth
9110                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
9111                .await
9112            {
9113                Ok(token) => token,
9114                Err(e) => match dlg.token(e) {
9115                    Ok(token) => token,
9116                    Err(e) => {
9117                        dlg.finished(false);
9118                        return Err(common::Error::MissingToken(e));
9119                    }
9120                },
9121            };
9122            request_value_reader
9123                .seek(std::io::SeekFrom::Start(0))
9124                .unwrap();
9125            let mut req_result = {
9126                let client = &self.hub.client;
9127                dlg.pre_request();
9128                let mut req_builder = hyper::Request::builder()
9129                    .method(hyper::Method::POST)
9130                    .uri(url.as_str())
9131                    .header(USER_AGENT, self.hub._user_agent.clone());
9132
9133                if let Some(token) = token.as_ref() {
9134                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
9135                }
9136
9137                let request = req_builder
9138                    .header(CONTENT_TYPE, json_mime_type.to_string())
9139                    .header(CONTENT_LENGTH, request_size as u64)
9140                    .body(common::to_body(
9141                        request_value_reader.get_ref().clone().into(),
9142                    ));
9143
9144                client.request(request.unwrap()).await
9145            };
9146
9147            match req_result {
9148                Err(err) => {
9149                    if let common::Retry::After(d) = dlg.http_error(&err) {
9150                        sleep(d).await;
9151                        continue;
9152                    }
9153                    dlg.finished(false);
9154                    return Err(common::Error::HttpError(err));
9155                }
9156                Ok(res) => {
9157                    let (mut parts, body) = res.into_parts();
9158                    let mut body = common::Body::new(body);
9159                    if !parts.status.is_success() {
9160                        let bytes = common::to_bytes(body).await.unwrap_or_default();
9161                        let error = serde_json::from_str(&common::to_string(&bytes));
9162                        let response = common::to_response(parts, bytes.into());
9163
9164                        if let common::Retry::After(d) =
9165                            dlg.http_failure(&response, error.as_ref().ok())
9166                        {
9167                            sleep(d).await;
9168                            continue;
9169                        }
9170
9171                        dlg.finished(false);
9172
9173                        return Err(match error {
9174                            Ok(value) => common::Error::BadRequest(value),
9175                            _ => common::Error::Failure(response),
9176                        });
9177                    }
9178                    let response = {
9179                        let bytes = common::to_bytes(body).await.unwrap_or_default();
9180                        let encoded = common::to_string(&bytes);
9181                        match serde_json::from_str(&encoded) {
9182                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
9183                            Err(error) => {
9184                                dlg.response_json_decode_error(&encoded, &error);
9185                                return Err(common::Error::JsonDecodeError(
9186                                    encoded.to_string(),
9187                                    error,
9188                                ));
9189                            }
9190                        }
9191                    };
9192
9193                    dlg.finished(true);
9194                    return Ok(response);
9195                }
9196            }
9197        }
9198    }
9199
9200    ///
9201    /// Sets the *request* property to the given value.
9202    ///
9203    /// Even though the property as already been set when instantiating this call,
9204    /// we provide this method for API completeness.
9205    pub fn request(
9206        mut self,
9207        new_value: CancelOperationRequest,
9208    ) -> ProjectLocationOperationCancelCall<'a, C> {
9209        self._request = new_value;
9210        self
9211    }
9212    /// The name of the operation resource to be cancelled.
9213    ///
9214    /// Sets the *name* path property to the given value.
9215    ///
9216    /// Even though the property as already been set when instantiating this call,
9217    /// we provide this method for API completeness.
9218    pub fn name(mut self, new_value: &str) -> ProjectLocationOperationCancelCall<'a, C> {
9219        self._name = new_value.to_string();
9220        self
9221    }
9222    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
9223    /// while executing the actual API request.
9224    ///
9225    /// ````text
9226    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
9227    /// ````
9228    ///
9229    /// Sets the *delegate* property to the given value.
9230    pub fn delegate(
9231        mut self,
9232        new_value: &'a mut dyn common::Delegate,
9233    ) -> ProjectLocationOperationCancelCall<'a, C> {
9234        self._delegate = Some(new_value);
9235        self
9236    }
9237
9238    /// Set any additional parameter of the query string used in the request.
9239    /// It should be used to set parameters which are not yet available through their own
9240    /// setters.
9241    ///
9242    /// Please note that this method must not be used to set any of the known parameters
9243    /// which have their own setter method. If done anyway, the request will fail.
9244    ///
9245    /// # Additional Parameters
9246    ///
9247    /// * *$.xgafv* (query-string) - V1 error format.
9248    /// * *access_token* (query-string) - OAuth access token.
9249    /// * *alt* (query-string) - Data format for response.
9250    /// * *callback* (query-string) - JSONP
9251    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
9252    /// * *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.
9253    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
9254    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
9255    /// * *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.
9256    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
9257    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
9258    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationOperationCancelCall<'a, C>
9259    where
9260        T: AsRef<str>,
9261    {
9262        self._additional_params
9263            .insert(name.as_ref().to_string(), value.as_ref().to_string());
9264        self
9265    }
9266
9267    /// Identifies the authorization scope for the method you are building.
9268    ///
9269    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
9270    /// [`Scope::CloudPlatform`].
9271    ///
9272    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
9273    /// tokens for more than one scope.
9274    ///
9275    /// Usually there is more than one suitable scope to authorize an operation, some of which may
9276    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
9277    /// sufficient, a read-write scope will do as well.
9278    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationOperationCancelCall<'a, C>
9279    where
9280        St: AsRef<str>,
9281    {
9282        self._scopes.insert(String::from(scope.as_ref()));
9283        self
9284    }
9285    /// Identifies the authorization scope(s) for the method you are building.
9286    ///
9287    /// See [`Self::add_scope()`] for details.
9288    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationOperationCancelCall<'a, C>
9289    where
9290        I: IntoIterator<Item = St>,
9291        St: AsRef<str>,
9292    {
9293        self._scopes
9294            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
9295        self
9296    }
9297
9298    /// Removes all scopes, and no default scope will be used either.
9299    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
9300    /// for details).
9301    pub fn clear_scopes(mut self) -> ProjectLocationOperationCancelCall<'a, C> {
9302        self._scopes.clear();
9303        self
9304    }
9305}
9306
9307/// Deletes a long-running operation. This method indicates that the client is no longer interested in the operation result. It does not cancel the operation. If the server doesn't support this method, it returns `google.rpc.Code.UNIMPLEMENTED`.
9308///
9309/// A builder for the *locations.operations.delete* method supported by a *project* resource.
9310/// It is not used directly, but through a [`ProjectMethods`] instance.
9311///
9312/// # Example
9313///
9314/// Instantiate a resource method builder
9315///
9316/// ```test_harness,no_run
9317/// # extern crate hyper;
9318/// # extern crate hyper_rustls;
9319/// # extern crate google_file1_beta1 as file1_beta1;
9320/// # async fn dox() {
9321/// # use file1_beta1::{CloudFilestore, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9322///
9323/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
9324/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
9325/// #     secret,
9326/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9327/// # ).build().await.unwrap();
9328///
9329/// # let client = hyper_util::client::legacy::Client::builder(
9330/// #     hyper_util::rt::TokioExecutor::new()
9331/// # )
9332/// # .build(
9333/// #     hyper_rustls::HttpsConnectorBuilder::new()
9334/// #         .with_native_roots()
9335/// #         .unwrap()
9336/// #         .https_or_http()
9337/// #         .enable_http1()
9338/// #         .build()
9339/// # );
9340/// # let mut hub = CloudFilestore::new(client, auth);
9341/// // You can configure optional parameters by calling the respective setters at will, and
9342/// // execute the final call using `doit()`.
9343/// // Values shown here are possibly random and not representative !
9344/// let result = hub.projects().locations_operations_delete("name")
9345///              .doit().await;
9346/// # }
9347/// ```
9348pub struct ProjectLocationOperationDeleteCall<'a, C>
9349where
9350    C: 'a,
9351{
9352    hub: &'a CloudFilestore<C>,
9353    _name: String,
9354    _delegate: Option<&'a mut dyn common::Delegate>,
9355    _additional_params: HashMap<String, String>,
9356    _scopes: BTreeSet<String>,
9357}
9358
9359impl<'a, C> common::CallBuilder for ProjectLocationOperationDeleteCall<'a, C> {}
9360
9361impl<'a, C> ProjectLocationOperationDeleteCall<'a, C>
9362where
9363    C: common::Connector,
9364{
9365    /// Perform the operation you have build so far.
9366    pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
9367        use std::borrow::Cow;
9368        use std::io::{Read, Seek};
9369
9370        use common::{url::Params, ToParts};
9371        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
9372
9373        let mut dd = common::DefaultDelegate;
9374        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
9375        dlg.begin(common::MethodInfo {
9376            id: "file.projects.locations.operations.delete",
9377            http_method: hyper::Method::DELETE,
9378        });
9379
9380        for &field in ["alt", "name"].iter() {
9381            if self._additional_params.contains_key(field) {
9382                dlg.finished(false);
9383                return Err(common::Error::FieldClash(field));
9384            }
9385        }
9386
9387        let mut params = Params::with_capacity(3 + self._additional_params.len());
9388        params.push("name", self._name);
9389
9390        params.extend(self._additional_params.iter());
9391
9392        params.push("alt", "json");
9393        let mut url = self.hub._base_url.clone() + "v1beta1/{+name}";
9394        if self._scopes.is_empty() {
9395            self._scopes
9396                .insert(Scope::CloudPlatform.as_ref().to_string());
9397        }
9398
9399        #[allow(clippy::single_element_loop)]
9400        for &(find_this, param_name) in [("{+name}", "name")].iter() {
9401            url = params.uri_replacement(url, param_name, find_this, true);
9402        }
9403        {
9404            let to_remove = ["name"];
9405            params.remove_params(&to_remove);
9406        }
9407
9408        let url = params.parse_with_url(&url);
9409
9410        loop {
9411            let token = match self
9412                .hub
9413                .auth
9414                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
9415                .await
9416            {
9417                Ok(token) => token,
9418                Err(e) => match dlg.token(e) {
9419                    Ok(token) => token,
9420                    Err(e) => {
9421                        dlg.finished(false);
9422                        return Err(common::Error::MissingToken(e));
9423                    }
9424                },
9425            };
9426            let mut req_result = {
9427                let client = &self.hub.client;
9428                dlg.pre_request();
9429                let mut req_builder = hyper::Request::builder()
9430                    .method(hyper::Method::DELETE)
9431                    .uri(url.as_str())
9432                    .header(USER_AGENT, self.hub._user_agent.clone());
9433
9434                if let Some(token) = token.as_ref() {
9435                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
9436                }
9437
9438                let request = req_builder
9439                    .header(CONTENT_LENGTH, 0_u64)
9440                    .body(common::to_body::<String>(None));
9441
9442                client.request(request.unwrap()).await
9443            };
9444
9445            match req_result {
9446                Err(err) => {
9447                    if let common::Retry::After(d) = dlg.http_error(&err) {
9448                        sleep(d).await;
9449                        continue;
9450                    }
9451                    dlg.finished(false);
9452                    return Err(common::Error::HttpError(err));
9453                }
9454                Ok(res) => {
9455                    let (mut parts, body) = res.into_parts();
9456                    let mut body = common::Body::new(body);
9457                    if !parts.status.is_success() {
9458                        let bytes = common::to_bytes(body).await.unwrap_or_default();
9459                        let error = serde_json::from_str(&common::to_string(&bytes));
9460                        let response = common::to_response(parts, bytes.into());
9461
9462                        if let common::Retry::After(d) =
9463                            dlg.http_failure(&response, error.as_ref().ok())
9464                        {
9465                            sleep(d).await;
9466                            continue;
9467                        }
9468
9469                        dlg.finished(false);
9470
9471                        return Err(match error {
9472                            Ok(value) => common::Error::BadRequest(value),
9473                            _ => common::Error::Failure(response),
9474                        });
9475                    }
9476                    let response = {
9477                        let bytes = common::to_bytes(body).await.unwrap_or_default();
9478                        let encoded = common::to_string(&bytes);
9479                        match serde_json::from_str(&encoded) {
9480                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
9481                            Err(error) => {
9482                                dlg.response_json_decode_error(&encoded, &error);
9483                                return Err(common::Error::JsonDecodeError(
9484                                    encoded.to_string(),
9485                                    error,
9486                                ));
9487                            }
9488                        }
9489                    };
9490
9491                    dlg.finished(true);
9492                    return Ok(response);
9493                }
9494            }
9495        }
9496    }
9497
9498    /// The name of the operation resource to be deleted.
9499    ///
9500    /// Sets the *name* path property to the given value.
9501    ///
9502    /// Even though the property as already been set when instantiating this call,
9503    /// we provide this method for API completeness.
9504    pub fn name(mut self, new_value: &str) -> ProjectLocationOperationDeleteCall<'a, C> {
9505        self._name = new_value.to_string();
9506        self
9507    }
9508    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
9509    /// while executing the actual API request.
9510    ///
9511    /// ````text
9512    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
9513    /// ````
9514    ///
9515    /// Sets the *delegate* property to the given value.
9516    pub fn delegate(
9517        mut self,
9518        new_value: &'a mut dyn common::Delegate,
9519    ) -> ProjectLocationOperationDeleteCall<'a, C> {
9520        self._delegate = Some(new_value);
9521        self
9522    }
9523
9524    /// Set any additional parameter of the query string used in the request.
9525    /// It should be used to set parameters which are not yet available through their own
9526    /// setters.
9527    ///
9528    /// Please note that this method must not be used to set any of the known parameters
9529    /// which have their own setter method. If done anyway, the request will fail.
9530    ///
9531    /// # Additional Parameters
9532    ///
9533    /// * *$.xgafv* (query-string) - V1 error format.
9534    /// * *access_token* (query-string) - OAuth access token.
9535    /// * *alt* (query-string) - Data format for response.
9536    /// * *callback* (query-string) - JSONP
9537    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
9538    /// * *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.
9539    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
9540    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
9541    /// * *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.
9542    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
9543    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
9544    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationOperationDeleteCall<'a, C>
9545    where
9546        T: AsRef<str>,
9547    {
9548        self._additional_params
9549            .insert(name.as_ref().to_string(), value.as_ref().to_string());
9550        self
9551    }
9552
9553    /// Identifies the authorization scope for the method you are building.
9554    ///
9555    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
9556    /// [`Scope::CloudPlatform`].
9557    ///
9558    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
9559    /// tokens for more than one scope.
9560    ///
9561    /// Usually there is more than one suitable scope to authorize an operation, some of which may
9562    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
9563    /// sufficient, a read-write scope will do as well.
9564    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationOperationDeleteCall<'a, C>
9565    where
9566        St: AsRef<str>,
9567    {
9568        self._scopes.insert(String::from(scope.as_ref()));
9569        self
9570    }
9571    /// Identifies the authorization scope(s) for the method you are building.
9572    ///
9573    /// See [`Self::add_scope()`] for details.
9574    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationOperationDeleteCall<'a, C>
9575    where
9576        I: IntoIterator<Item = St>,
9577        St: AsRef<str>,
9578    {
9579        self._scopes
9580            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
9581        self
9582    }
9583
9584    /// Removes all scopes, and no default scope will be used either.
9585    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
9586    /// for details).
9587    pub fn clear_scopes(mut self) -> ProjectLocationOperationDeleteCall<'a, C> {
9588        self._scopes.clear();
9589        self
9590    }
9591}
9592
9593/// Gets the latest state of a long-running operation. Clients can use this method to poll the operation result at intervals as recommended by the API service.
9594///
9595/// A builder for the *locations.operations.get* method supported by a *project* resource.
9596/// It is not used directly, but through a [`ProjectMethods`] instance.
9597///
9598/// # Example
9599///
9600/// Instantiate a resource method builder
9601///
9602/// ```test_harness,no_run
9603/// # extern crate hyper;
9604/// # extern crate hyper_rustls;
9605/// # extern crate google_file1_beta1 as file1_beta1;
9606/// # async fn dox() {
9607/// # use file1_beta1::{CloudFilestore, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9608///
9609/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
9610/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
9611/// #     secret,
9612/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9613/// # ).build().await.unwrap();
9614///
9615/// # let client = hyper_util::client::legacy::Client::builder(
9616/// #     hyper_util::rt::TokioExecutor::new()
9617/// # )
9618/// # .build(
9619/// #     hyper_rustls::HttpsConnectorBuilder::new()
9620/// #         .with_native_roots()
9621/// #         .unwrap()
9622/// #         .https_or_http()
9623/// #         .enable_http1()
9624/// #         .build()
9625/// # );
9626/// # let mut hub = CloudFilestore::new(client, auth);
9627/// // You can configure optional parameters by calling the respective setters at will, and
9628/// // execute the final call using `doit()`.
9629/// // Values shown here are possibly random and not representative !
9630/// let result = hub.projects().locations_operations_get("name")
9631///              .doit().await;
9632/// # }
9633/// ```
9634pub struct ProjectLocationOperationGetCall<'a, C>
9635where
9636    C: 'a,
9637{
9638    hub: &'a CloudFilestore<C>,
9639    _name: String,
9640    _delegate: Option<&'a mut dyn common::Delegate>,
9641    _additional_params: HashMap<String, String>,
9642    _scopes: BTreeSet<String>,
9643}
9644
9645impl<'a, C> common::CallBuilder for ProjectLocationOperationGetCall<'a, C> {}
9646
9647impl<'a, C> ProjectLocationOperationGetCall<'a, C>
9648where
9649    C: common::Connector,
9650{
9651    /// Perform the operation you have build so far.
9652    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
9653        use std::borrow::Cow;
9654        use std::io::{Read, Seek};
9655
9656        use common::{url::Params, ToParts};
9657        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
9658
9659        let mut dd = common::DefaultDelegate;
9660        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
9661        dlg.begin(common::MethodInfo {
9662            id: "file.projects.locations.operations.get",
9663            http_method: hyper::Method::GET,
9664        });
9665
9666        for &field in ["alt", "name"].iter() {
9667            if self._additional_params.contains_key(field) {
9668                dlg.finished(false);
9669                return Err(common::Error::FieldClash(field));
9670            }
9671        }
9672
9673        let mut params = Params::with_capacity(3 + self._additional_params.len());
9674        params.push("name", self._name);
9675
9676        params.extend(self._additional_params.iter());
9677
9678        params.push("alt", "json");
9679        let mut url = self.hub._base_url.clone() + "v1beta1/{+name}";
9680        if self._scopes.is_empty() {
9681            self._scopes
9682                .insert(Scope::CloudPlatform.as_ref().to_string());
9683        }
9684
9685        #[allow(clippy::single_element_loop)]
9686        for &(find_this, param_name) in [("{+name}", "name")].iter() {
9687            url = params.uri_replacement(url, param_name, find_this, true);
9688        }
9689        {
9690            let to_remove = ["name"];
9691            params.remove_params(&to_remove);
9692        }
9693
9694        let url = params.parse_with_url(&url);
9695
9696        loop {
9697            let token = match self
9698                .hub
9699                .auth
9700                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
9701                .await
9702            {
9703                Ok(token) => token,
9704                Err(e) => match dlg.token(e) {
9705                    Ok(token) => token,
9706                    Err(e) => {
9707                        dlg.finished(false);
9708                        return Err(common::Error::MissingToken(e));
9709                    }
9710                },
9711            };
9712            let mut req_result = {
9713                let client = &self.hub.client;
9714                dlg.pre_request();
9715                let mut req_builder = hyper::Request::builder()
9716                    .method(hyper::Method::GET)
9717                    .uri(url.as_str())
9718                    .header(USER_AGENT, self.hub._user_agent.clone());
9719
9720                if let Some(token) = token.as_ref() {
9721                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
9722                }
9723
9724                let request = req_builder
9725                    .header(CONTENT_LENGTH, 0_u64)
9726                    .body(common::to_body::<String>(None));
9727
9728                client.request(request.unwrap()).await
9729            };
9730
9731            match req_result {
9732                Err(err) => {
9733                    if let common::Retry::After(d) = dlg.http_error(&err) {
9734                        sleep(d).await;
9735                        continue;
9736                    }
9737                    dlg.finished(false);
9738                    return Err(common::Error::HttpError(err));
9739                }
9740                Ok(res) => {
9741                    let (mut parts, body) = res.into_parts();
9742                    let mut body = common::Body::new(body);
9743                    if !parts.status.is_success() {
9744                        let bytes = common::to_bytes(body).await.unwrap_or_default();
9745                        let error = serde_json::from_str(&common::to_string(&bytes));
9746                        let response = common::to_response(parts, bytes.into());
9747
9748                        if let common::Retry::After(d) =
9749                            dlg.http_failure(&response, error.as_ref().ok())
9750                        {
9751                            sleep(d).await;
9752                            continue;
9753                        }
9754
9755                        dlg.finished(false);
9756
9757                        return Err(match error {
9758                            Ok(value) => common::Error::BadRequest(value),
9759                            _ => common::Error::Failure(response),
9760                        });
9761                    }
9762                    let response = {
9763                        let bytes = common::to_bytes(body).await.unwrap_or_default();
9764                        let encoded = common::to_string(&bytes);
9765                        match serde_json::from_str(&encoded) {
9766                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
9767                            Err(error) => {
9768                                dlg.response_json_decode_error(&encoded, &error);
9769                                return Err(common::Error::JsonDecodeError(
9770                                    encoded.to_string(),
9771                                    error,
9772                                ));
9773                            }
9774                        }
9775                    };
9776
9777                    dlg.finished(true);
9778                    return Ok(response);
9779                }
9780            }
9781        }
9782    }
9783
9784    /// The name of the operation resource.
9785    ///
9786    /// Sets the *name* path property to the given value.
9787    ///
9788    /// Even though the property as already been set when instantiating this call,
9789    /// we provide this method for API completeness.
9790    pub fn name(mut self, new_value: &str) -> ProjectLocationOperationGetCall<'a, C> {
9791        self._name = new_value.to_string();
9792        self
9793    }
9794    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
9795    /// while executing the actual API request.
9796    ///
9797    /// ````text
9798    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
9799    /// ````
9800    ///
9801    /// Sets the *delegate* property to the given value.
9802    pub fn delegate(
9803        mut self,
9804        new_value: &'a mut dyn common::Delegate,
9805    ) -> ProjectLocationOperationGetCall<'a, C> {
9806        self._delegate = Some(new_value);
9807        self
9808    }
9809
9810    /// Set any additional parameter of the query string used in the request.
9811    /// It should be used to set parameters which are not yet available through their own
9812    /// setters.
9813    ///
9814    /// Please note that this method must not be used to set any of the known parameters
9815    /// which have their own setter method. If done anyway, the request will fail.
9816    ///
9817    /// # Additional Parameters
9818    ///
9819    /// * *$.xgafv* (query-string) - V1 error format.
9820    /// * *access_token* (query-string) - OAuth access token.
9821    /// * *alt* (query-string) - Data format for response.
9822    /// * *callback* (query-string) - JSONP
9823    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
9824    /// * *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.
9825    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
9826    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
9827    /// * *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.
9828    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
9829    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
9830    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationOperationGetCall<'a, C>
9831    where
9832        T: AsRef<str>,
9833    {
9834        self._additional_params
9835            .insert(name.as_ref().to_string(), value.as_ref().to_string());
9836        self
9837    }
9838
9839    /// Identifies the authorization scope for the method you are building.
9840    ///
9841    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
9842    /// [`Scope::CloudPlatform`].
9843    ///
9844    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
9845    /// tokens for more than one scope.
9846    ///
9847    /// Usually there is more than one suitable scope to authorize an operation, some of which may
9848    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
9849    /// sufficient, a read-write scope will do as well.
9850    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationOperationGetCall<'a, C>
9851    where
9852        St: AsRef<str>,
9853    {
9854        self._scopes.insert(String::from(scope.as_ref()));
9855        self
9856    }
9857    /// Identifies the authorization scope(s) for the method you are building.
9858    ///
9859    /// See [`Self::add_scope()`] for details.
9860    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationOperationGetCall<'a, C>
9861    where
9862        I: IntoIterator<Item = St>,
9863        St: AsRef<str>,
9864    {
9865        self._scopes
9866            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
9867        self
9868    }
9869
9870    /// Removes all scopes, and no default scope will be used either.
9871    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
9872    /// for details).
9873    pub fn clear_scopes(mut self) -> ProjectLocationOperationGetCall<'a, C> {
9874        self._scopes.clear();
9875        self
9876    }
9877}
9878
9879/// Lists operations that match the specified filter in the request. If the server doesn't support this method, it returns `UNIMPLEMENTED`.
9880///
9881/// A builder for the *locations.operations.list* method supported by a *project* resource.
9882/// It is not used directly, but through a [`ProjectMethods`] instance.
9883///
9884/// # Example
9885///
9886/// Instantiate a resource method builder
9887///
9888/// ```test_harness,no_run
9889/// # extern crate hyper;
9890/// # extern crate hyper_rustls;
9891/// # extern crate google_file1_beta1 as file1_beta1;
9892/// # async fn dox() {
9893/// # use file1_beta1::{CloudFilestore, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9894///
9895/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
9896/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
9897/// #     secret,
9898/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9899/// # ).build().await.unwrap();
9900///
9901/// # let client = hyper_util::client::legacy::Client::builder(
9902/// #     hyper_util::rt::TokioExecutor::new()
9903/// # )
9904/// # .build(
9905/// #     hyper_rustls::HttpsConnectorBuilder::new()
9906/// #         .with_native_roots()
9907/// #         .unwrap()
9908/// #         .https_or_http()
9909/// #         .enable_http1()
9910/// #         .build()
9911/// # );
9912/// # let mut hub = CloudFilestore::new(client, auth);
9913/// // You can configure optional parameters by calling the respective setters at will, and
9914/// // execute the final call using `doit()`.
9915/// // Values shown here are possibly random and not representative !
9916/// let result = hub.projects().locations_operations_list("name")
9917///              .page_token("voluptua.")
9918///              .page_size(-2)
9919///              .filter("consetetur")
9920///              .doit().await;
9921/// # }
9922/// ```
9923pub struct ProjectLocationOperationListCall<'a, C>
9924where
9925    C: 'a,
9926{
9927    hub: &'a CloudFilestore<C>,
9928    _name: String,
9929    _page_token: Option<String>,
9930    _page_size: Option<i32>,
9931    _filter: Option<String>,
9932    _delegate: Option<&'a mut dyn common::Delegate>,
9933    _additional_params: HashMap<String, String>,
9934    _scopes: BTreeSet<String>,
9935}
9936
9937impl<'a, C> common::CallBuilder for ProjectLocationOperationListCall<'a, C> {}
9938
9939impl<'a, C> ProjectLocationOperationListCall<'a, C>
9940where
9941    C: common::Connector,
9942{
9943    /// Perform the operation you have build so far.
9944    pub async fn doit(mut self) -> common::Result<(common::Response, ListOperationsResponse)> {
9945        use std::borrow::Cow;
9946        use std::io::{Read, Seek};
9947
9948        use common::{url::Params, ToParts};
9949        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
9950
9951        let mut dd = common::DefaultDelegate;
9952        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
9953        dlg.begin(common::MethodInfo {
9954            id: "file.projects.locations.operations.list",
9955            http_method: hyper::Method::GET,
9956        });
9957
9958        for &field in ["alt", "name", "pageToken", "pageSize", "filter"].iter() {
9959            if self._additional_params.contains_key(field) {
9960                dlg.finished(false);
9961                return Err(common::Error::FieldClash(field));
9962            }
9963        }
9964
9965        let mut params = Params::with_capacity(6 + self._additional_params.len());
9966        params.push("name", self._name);
9967        if let Some(value) = self._page_token.as_ref() {
9968            params.push("pageToken", value);
9969        }
9970        if let Some(value) = self._page_size.as_ref() {
9971            params.push("pageSize", value.to_string());
9972        }
9973        if let Some(value) = self._filter.as_ref() {
9974            params.push("filter", value);
9975        }
9976
9977        params.extend(self._additional_params.iter());
9978
9979        params.push("alt", "json");
9980        let mut url = self.hub._base_url.clone() + "v1beta1/{+name}/operations";
9981        if self._scopes.is_empty() {
9982            self._scopes
9983                .insert(Scope::CloudPlatform.as_ref().to_string());
9984        }
9985
9986        #[allow(clippy::single_element_loop)]
9987        for &(find_this, param_name) in [("{+name}", "name")].iter() {
9988            url = params.uri_replacement(url, param_name, find_this, true);
9989        }
9990        {
9991            let to_remove = ["name"];
9992            params.remove_params(&to_remove);
9993        }
9994
9995        let url = params.parse_with_url(&url);
9996
9997        loop {
9998            let token = match self
9999                .hub
10000                .auth
10001                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
10002                .await
10003            {
10004                Ok(token) => token,
10005                Err(e) => match dlg.token(e) {
10006                    Ok(token) => token,
10007                    Err(e) => {
10008                        dlg.finished(false);
10009                        return Err(common::Error::MissingToken(e));
10010                    }
10011                },
10012            };
10013            let mut req_result = {
10014                let client = &self.hub.client;
10015                dlg.pre_request();
10016                let mut req_builder = hyper::Request::builder()
10017                    .method(hyper::Method::GET)
10018                    .uri(url.as_str())
10019                    .header(USER_AGENT, self.hub._user_agent.clone());
10020
10021                if let Some(token) = token.as_ref() {
10022                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
10023                }
10024
10025                let request = req_builder
10026                    .header(CONTENT_LENGTH, 0_u64)
10027                    .body(common::to_body::<String>(None));
10028
10029                client.request(request.unwrap()).await
10030            };
10031
10032            match req_result {
10033                Err(err) => {
10034                    if let common::Retry::After(d) = dlg.http_error(&err) {
10035                        sleep(d).await;
10036                        continue;
10037                    }
10038                    dlg.finished(false);
10039                    return Err(common::Error::HttpError(err));
10040                }
10041                Ok(res) => {
10042                    let (mut parts, body) = res.into_parts();
10043                    let mut body = common::Body::new(body);
10044                    if !parts.status.is_success() {
10045                        let bytes = common::to_bytes(body).await.unwrap_or_default();
10046                        let error = serde_json::from_str(&common::to_string(&bytes));
10047                        let response = common::to_response(parts, bytes.into());
10048
10049                        if let common::Retry::After(d) =
10050                            dlg.http_failure(&response, error.as_ref().ok())
10051                        {
10052                            sleep(d).await;
10053                            continue;
10054                        }
10055
10056                        dlg.finished(false);
10057
10058                        return Err(match error {
10059                            Ok(value) => common::Error::BadRequest(value),
10060                            _ => common::Error::Failure(response),
10061                        });
10062                    }
10063                    let response = {
10064                        let bytes = common::to_bytes(body).await.unwrap_or_default();
10065                        let encoded = common::to_string(&bytes);
10066                        match serde_json::from_str(&encoded) {
10067                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
10068                            Err(error) => {
10069                                dlg.response_json_decode_error(&encoded, &error);
10070                                return Err(common::Error::JsonDecodeError(
10071                                    encoded.to_string(),
10072                                    error,
10073                                ));
10074                            }
10075                        }
10076                    };
10077
10078                    dlg.finished(true);
10079                    return Ok(response);
10080                }
10081            }
10082        }
10083    }
10084
10085    /// The name of the operation's parent resource.
10086    ///
10087    /// Sets the *name* path property to the given value.
10088    ///
10089    /// Even though the property as already been set when instantiating this call,
10090    /// we provide this method for API completeness.
10091    pub fn name(mut self, new_value: &str) -> ProjectLocationOperationListCall<'a, C> {
10092        self._name = new_value.to_string();
10093        self
10094    }
10095    /// The standard list page token.
10096    ///
10097    /// Sets the *page token* query property to the given value.
10098    pub fn page_token(mut self, new_value: &str) -> ProjectLocationOperationListCall<'a, C> {
10099        self._page_token = Some(new_value.to_string());
10100        self
10101    }
10102    /// The standard list page size.
10103    ///
10104    /// Sets the *page size* query property to the given value.
10105    pub fn page_size(mut self, new_value: i32) -> ProjectLocationOperationListCall<'a, C> {
10106        self._page_size = Some(new_value);
10107        self
10108    }
10109    /// The standard list filter.
10110    ///
10111    /// Sets the *filter* query property to the given value.
10112    pub fn filter(mut self, new_value: &str) -> ProjectLocationOperationListCall<'a, C> {
10113        self._filter = Some(new_value.to_string());
10114        self
10115    }
10116    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
10117    /// while executing the actual API request.
10118    ///
10119    /// ````text
10120    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
10121    /// ````
10122    ///
10123    /// Sets the *delegate* property to the given value.
10124    pub fn delegate(
10125        mut self,
10126        new_value: &'a mut dyn common::Delegate,
10127    ) -> ProjectLocationOperationListCall<'a, C> {
10128        self._delegate = Some(new_value);
10129        self
10130    }
10131
10132    /// Set any additional parameter of the query string used in the request.
10133    /// It should be used to set parameters which are not yet available through their own
10134    /// setters.
10135    ///
10136    /// Please note that this method must not be used to set any of the known parameters
10137    /// which have their own setter method. If done anyway, the request will fail.
10138    ///
10139    /// # Additional Parameters
10140    ///
10141    /// * *$.xgafv* (query-string) - V1 error format.
10142    /// * *access_token* (query-string) - OAuth access token.
10143    /// * *alt* (query-string) - Data format for response.
10144    /// * *callback* (query-string) - JSONP
10145    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
10146    /// * *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.
10147    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
10148    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
10149    /// * *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.
10150    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
10151    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
10152    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationOperationListCall<'a, C>
10153    where
10154        T: AsRef<str>,
10155    {
10156        self._additional_params
10157            .insert(name.as_ref().to_string(), value.as_ref().to_string());
10158        self
10159    }
10160
10161    /// Identifies the authorization scope for the method you are building.
10162    ///
10163    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
10164    /// [`Scope::CloudPlatform`].
10165    ///
10166    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
10167    /// tokens for more than one scope.
10168    ///
10169    /// Usually there is more than one suitable scope to authorize an operation, some of which may
10170    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
10171    /// sufficient, a read-write scope will do as well.
10172    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationOperationListCall<'a, C>
10173    where
10174        St: AsRef<str>,
10175    {
10176        self._scopes.insert(String::from(scope.as_ref()));
10177        self
10178    }
10179    /// Identifies the authorization scope(s) for the method you are building.
10180    ///
10181    /// See [`Self::add_scope()`] for details.
10182    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationOperationListCall<'a, C>
10183    where
10184        I: IntoIterator<Item = St>,
10185        St: AsRef<str>,
10186    {
10187        self._scopes
10188            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
10189        self
10190    }
10191
10192    /// Removes all scopes, and no default scope will be used either.
10193    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
10194    /// for details).
10195    pub fn clear_scopes(mut self) -> ProjectLocationOperationListCall<'a, C> {
10196        self._scopes.clear();
10197        self
10198    }
10199}
10200
10201/// Gets information about a location.
10202///
10203/// A builder for the *locations.get* method supported by a *project* resource.
10204/// It is not used directly, but through a [`ProjectMethods`] instance.
10205///
10206/// # Example
10207///
10208/// Instantiate a resource method builder
10209///
10210/// ```test_harness,no_run
10211/// # extern crate hyper;
10212/// # extern crate hyper_rustls;
10213/// # extern crate google_file1_beta1 as file1_beta1;
10214/// # async fn dox() {
10215/// # use file1_beta1::{CloudFilestore, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
10216///
10217/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
10218/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
10219/// #     secret,
10220/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
10221/// # ).build().await.unwrap();
10222///
10223/// # let client = hyper_util::client::legacy::Client::builder(
10224/// #     hyper_util::rt::TokioExecutor::new()
10225/// # )
10226/// # .build(
10227/// #     hyper_rustls::HttpsConnectorBuilder::new()
10228/// #         .with_native_roots()
10229/// #         .unwrap()
10230/// #         .https_or_http()
10231/// #         .enable_http1()
10232/// #         .build()
10233/// # );
10234/// # let mut hub = CloudFilestore::new(client, auth);
10235/// // You can configure optional parameters by calling the respective setters at will, and
10236/// // execute the final call using `doit()`.
10237/// // Values shown here are possibly random and not representative !
10238/// let result = hub.projects().locations_get("name")
10239///              .doit().await;
10240/// # }
10241/// ```
10242pub struct ProjectLocationGetCall<'a, C>
10243where
10244    C: 'a,
10245{
10246    hub: &'a CloudFilestore<C>,
10247    _name: String,
10248    _delegate: Option<&'a mut dyn common::Delegate>,
10249    _additional_params: HashMap<String, String>,
10250    _scopes: BTreeSet<String>,
10251}
10252
10253impl<'a, C> common::CallBuilder for ProjectLocationGetCall<'a, C> {}
10254
10255impl<'a, C> ProjectLocationGetCall<'a, C>
10256where
10257    C: common::Connector,
10258{
10259    /// Perform the operation you have build so far.
10260    pub async fn doit(mut self) -> common::Result<(common::Response, Location)> {
10261        use std::borrow::Cow;
10262        use std::io::{Read, Seek};
10263
10264        use common::{url::Params, ToParts};
10265        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
10266
10267        let mut dd = common::DefaultDelegate;
10268        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
10269        dlg.begin(common::MethodInfo {
10270            id: "file.projects.locations.get",
10271            http_method: hyper::Method::GET,
10272        });
10273
10274        for &field in ["alt", "name"].iter() {
10275            if self._additional_params.contains_key(field) {
10276                dlg.finished(false);
10277                return Err(common::Error::FieldClash(field));
10278            }
10279        }
10280
10281        let mut params = Params::with_capacity(3 + self._additional_params.len());
10282        params.push("name", self._name);
10283
10284        params.extend(self._additional_params.iter());
10285
10286        params.push("alt", "json");
10287        let mut url = self.hub._base_url.clone() + "v1beta1/{+name}";
10288        if self._scopes.is_empty() {
10289            self._scopes
10290                .insert(Scope::CloudPlatform.as_ref().to_string());
10291        }
10292
10293        #[allow(clippy::single_element_loop)]
10294        for &(find_this, param_name) in [("{+name}", "name")].iter() {
10295            url = params.uri_replacement(url, param_name, find_this, true);
10296        }
10297        {
10298            let to_remove = ["name"];
10299            params.remove_params(&to_remove);
10300        }
10301
10302        let url = params.parse_with_url(&url);
10303
10304        loop {
10305            let token = match self
10306                .hub
10307                .auth
10308                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
10309                .await
10310            {
10311                Ok(token) => token,
10312                Err(e) => match dlg.token(e) {
10313                    Ok(token) => token,
10314                    Err(e) => {
10315                        dlg.finished(false);
10316                        return Err(common::Error::MissingToken(e));
10317                    }
10318                },
10319            };
10320            let mut req_result = {
10321                let client = &self.hub.client;
10322                dlg.pre_request();
10323                let mut req_builder = hyper::Request::builder()
10324                    .method(hyper::Method::GET)
10325                    .uri(url.as_str())
10326                    .header(USER_AGENT, self.hub._user_agent.clone());
10327
10328                if let Some(token) = token.as_ref() {
10329                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
10330                }
10331
10332                let request = req_builder
10333                    .header(CONTENT_LENGTH, 0_u64)
10334                    .body(common::to_body::<String>(None));
10335
10336                client.request(request.unwrap()).await
10337            };
10338
10339            match req_result {
10340                Err(err) => {
10341                    if let common::Retry::After(d) = dlg.http_error(&err) {
10342                        sleep(d).await;
10343                        continue;
10344                    }
10345                    dlg.finished(false);
10346                    return Err(common::Error::HttpError(err));
10347                }
10348                Ok(res) => {
10349                    let (mut parts, body) = res.into_parts();
10350                    let mut body = common::Body::new(body);
10351                    if !parts.status.is_success() {
10352                        let bytes = common::to_bytes(body).await.unwrap_or_default();
10353                        let error = serde_json::from_str(&common::to_string(&bytes));
10354                        let response = common::to_response(parts, bytes.into());
10355
10356                        if let common::Retry::After(d) =
10357                            dlg.http_failure(&response, error.as_ref().ok())
10358                        {
10359                            sleep(d).await;
10360                            continue;
10361                        }
10362
10363                        dlg.finished(false);
10364
10365                        return Err(match error {
10366                            Ok(value) => common::Error::BadRequest(value),
10367                            _ => common::Error::Failure(response),
10368                        });
10369                    }
10370                    let response = {
10371                        let bytes = common::to_bytes(body).await.unwrap_or_default();
10372                        let encoded = common::to_string(&bytes);
10373                        match serde_json::from_str(&encoded) {
10374                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
10375                            Err(error) => {
10376                                dlg.response_json_decode_error(&encoded, &error);
10377                                return Err(common::Error::JsonDecodeError(
10378                                    encoded.to_string(),
10379                                    error,
10380                                ));
10381                            }
10382                        }
10383                    };
10384
10385                    dlg.finished(true);
10386                    return Ok(response);
10387                }
10388            }
10389        }
10390    }
10391
10392    /// Resource name for the location.
10393    ///
10394    /// Sets the *name* path property to the given value.
10395    ///
10396    /// Even though the property as already been set when instantiating this call,
10397    /// we provide this method for API completeness.
10398    pub fn name(mut self, new_value: &str) -> ProjectLocationGetCall<'a, C> {
10399        self._name = new_value.to_string();
10400        self
10401    }
10402    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
10403    /// while executing the actual API request.
10404    ///
10405    /// ````text
10406    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
10407    /// ````
10408    ///
10409    /// Sets the *delegate* property to the given value.
10410    pub fn delegate(
10411        mut self,
10412        new_value: &'a mut dyn common::Delegate,
10413    ) -> ProjectLocationGetCall<'a, C> {
10414        self._delegate = Some(new_value);
10415        self
10416    }
10417
10418    /// Set any additional parameter of the query string used in the request.
10419    /// It should be used to set parameters which are not yet available through their own
10420    /// setters.
10421    ///
10422    /// Please note that this method must not be used to set any of the known parameters
10423    /// which have their own setter method. If done anyway, the request will fail.
10424    ///
10425    /// # Additional Parameters
10426    ///
10427    /// * *$.xgafv* (query-string) - V1 error format.
10428    /// * *access_token* (query-string) - OAuth access token.
10429    /// * *alt* (query-string) - Data format for response.
10430    /// * *callback* (query-string) - JSONP
10431    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
10432    /// * *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.
10433    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
10434    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
10435    /// * *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.
10436    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
10437    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
10438    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationGetCall<'a, C>
10439    where
10440        T: AsRef<str>,
10441    {
10442        self._additional_params
10443            .insert(name.as_ref().to_string(), value.as_ref().to_string());
10444        self
10445    }
10446
10447    /// Identifies the authorization scope for the method you are building.
10448    ///
10449    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
10450    /// [`Scope::CloudPlatform`].
10451    ///
10452    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
10453    /// tokens for more than one scope.
10454    ///
10455    /// Usually there is more than one suitable scope to authorize an operation, some of which may
10456    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
10457    /// sufficient, a read-write scope will do as well.
10458    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationGetCall<'a, C>
10459    where
10460        St: AsRef<str>,
10461    {
10462        self._scopes.insert(String::from(scope.as_ref()));
10463        self
10464    }
10465    /// Identifies the authorization scope(s) for the method you are building.
10466    ///
10467    /// See [`Self::add_scope()`] for details.
10468    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationGetCall<'a, C>
10469    where
10470        I: IntoIterator<Item = St>,
10471        St: AsRef<str>,
10472    {
10473        self._scopes
10474            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
10475        self
10476    }
10477
10478    /// Removes all scopes, and no default scope will be used either.
10479    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
10480    /// for details).
10481    pub fn clear_scopes(mut self) -> ProjectLocationGetCall<'a, C> {
10482        self._scopes.clear();
10483        self
10484    }
10485}
10486
10487/// Lists information about the supported locations for this service.
10488///
10489/// A builder for the *locations.list* method supported by a *project* resource.
10490/// It is not used directly, but through a [`ProjectMethods`] instance.
10491///
10492/// # Example
10493///
10494/// Instantiate a resource method builder
10495///
10496/// ```test_harness,no_run
10497/// # extern crate hyper;
10498/// # extern crate hyper_rustls;
10499/// # extern crate google_file1_beta1 as file1_beta1;
10500/// # async fn dox() {
10501/// # use file1_beta1::{CloudFilestore, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
10502///
10503/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
10504/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
10505/// #     secret,
10506/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
10507/// # ).build().await.unwrap();
10508///
10509/// # let client = hyper_util::client::legacy::Client::builder(
10510/// #     hyper_util::rt::TokioExecutor::new()
10511/// # )
10512/// # .build(
10513/// #     hyper_rustls::HttpsConnectorBuilder::new()
10514/// #         .with_native_roots()
10515/// #         .unwrap()
10516/// #         .https_or_http()
10517/// #         .enable_http1()
10518/// #         .build()
10519/// # );
10520/// # let mut hub = CloudFilestore::new(client, auth);
10521/// // You can configure optional parameters by calling the respective setters at will, and
10522/// // execute the final call using `doit()`.
10523/// // Values shown here are possibly random and not representative !
10524/// let result = hub.projects().locations_list("name")
10525///              .page_token("et")
10526///              .page_size(-22)
10527///              .include_unrevealed_locations(false)
10528///              .filter("Stet")
10529///              .doit().await;
10530/// # }
10531/// ```
10532pub struct ProjectLocationListCall<'a, C>
10533where
10534    C: 'a,
10535{
10536    hub: &'a CloudFilestore<C>,
10537    _name: String,
10538    _page_token: Option<String>,
10539    _page_size: Option<i32>,
10540    _include_unrevealed_locations: Option<bool>,
10541    _filter: Option<String>,
10542    _delegate: Option<&'a mut dyn common::Delegate>,
10543    _additional_params: HashMap<String, String>,
10544    _scopes: BTreeSet<String>,
10545}
10546
10547impl<'a, C> common::CallBuilder for ProjectLocationListCall<'a, C> {}
10548
10549impl<'a, C> ProjectLocationListCall<'a, C>
10550where
10551    C: common::Connector,
10552{
10553    /// Perform the operation you have build so far.
10554    pub async fn doit(mut self) -> common::Result<(common::Response, ListLocationsResponse)> {
10555        use std::borrow::Cow;
10556        use std::io::{Read, Seek};
10557
10558        use common::{url::Params, ToParts};
10559        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
10560
10561        let mut dd = common::DefaultDelegate;
10562        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
10563        dlg.begin(common::MethodInfo {
10564            id: "file.projects.locations.list",
10565            http_method: hyper::Method::GET,
10566        });
10567
10568        for &field in [
10569            "alt",
10570            "name",
10571            "pageToken",
10572            "pageSize",
10573            "includeUnrevealedLocations",
10574            "filter",
10575        ]
10576        .iter()
10577        {
10578            if self._additional_params.contains_key(field) {
10579                dlg.finished(false);
10580                return Err(common::Error::FieldClash(field));
10581            }
10582        }
10583
10584        let mut params = Params::with_capacity(7 + self._additional_params.len());
10585        params.push("name", self._name);
10586        if let Some(value) = self._page_token.as_ref() {
10587            params.push("pageToken", value);
10588        }
10589        if let Some(value) = self._page_size.as_ref() {
10590            params.push("pageSize", value.to_string());
10591        }
10592        if let Some(value) = self._include_unrevealed_locations.as_ref() {
10593            params.push("includeUnrevealedLocations", value.to_string());
10594        }
10595        if let Some(value) = self._filter.as_ref() {
10596            params.push("filter", value);
10597        }
10598
10599        params.extend(self._additional_params.iter());
10600
10601        params.push("alt", "json");
10602        let mut url = self.hub._base_url.clone() + "v1beta1/{+name}/locations";
10603        if self._scopes.is_empty() {
10604            self._scopes
10605                .insert(Scope::CloudPlatform.as_ref().to_string());
10606        }
10607
10608        #[allow(clippy::single_element_loop)]
10609        for &(find_this, param_name) in [("{+name}", "name")].iter() {
10610            url = params.uri_replacement(url, param_name, find_this, true);
10611        }
10612        {
10613            let to_remove = ["name"];
10614            params.remove_params(&to_remove);
10615        }
10616
10617        let url = params.parse_with_url(&url);
10618
10619        loop {
10620            let token = match self
10621                .hub
10622                .auth
10623                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
10624                .await
10625            {
10626                Ok(token) => token,
10627                Err(e) => match dlg.token(e) {
10628                    Ok(token) => token,
10629                    Err(e) => {
10630                        dlg.finished(false);
10631                        return Err(common::Error::MissingToken(e));
10632                    }
10633                },
10634            };
10635            let mut req_result = {
10636                let client = &self.hub.client;
10637                dlg.pre_request();
10638                let mut req_builder = hyper::Request::builder()
10639                    .method(hyper::Method::GET)
10640                    .uri(url.as_str())
10641                    .header(USER_AGENT, self.hub._user_agent.clone());
10642
10643                if let Some(token) = token.as_ref() {
10644                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
10645                }
10646
10647                let request = req_builder
10648                    .header(CONTENT_LENGTH, 0_u64)
10649                    .body(common::to_body::<String>(None));
10650
10651                client.request(request.unwrap()).await
10652            };
10653
10654            match req_result {
10655                Err(err) => {
10656                    if let common::Retry::After(d) = dlg.http_error(&err) {
10657                        sleep(d).await;
10658                        continue;
10659                    }
10660                    dlg.finished(false);
10661                    return Err(common::Error::HttpError(err));
10662                }
10663                Ok(res) => {
10664                    let (mut parts, body) = res.into_parts();
10665                    let mut body = common::Body::new(body);
10666                    if !parts.status.is_success() {
10667                        let bytes = common::to_bytes(body).await.unwrap_or_default();
10668                        let error = serde_json::from_str(&common::to_string(&bytes));
10669                        let response = common::to_response(parts, bytes.into());
10670
10671                        if let common::Retry::After(d) =
10672                            dlg.http_failure(&response, error.as_ref().ok())
10673                        {
10674                            sleep(d).await;
10675                            continue;
10676                        }
10677
10678                        dlg.finished(false);
10679
10680                        return Err(match error {
10681                            Ok(value) => common::Error::BadRequest(value),
10682                            _ => common::Error::Failure(response),
10683                        });
10684                    }
10685                    let response = {
10686                        let bytes = common::to_bytes(body).await.unwrap_or_default();
10687                        let encoded = common::to_string(&bytes);
10688                        match serde_json::from_str(&encoded) {
10689                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
10690                            Err(error) => {
10691                                dlg.response_json_decode_error(&encoded, &error);
10692                                return Err(common::Error::JsonDecodeError(
10693                                    encoded.to_string(),
10694                                    error,
10695                                ));
10696                            }
10697                        }
10698                    };
10699
10700                    dlg.finished(true);
10701                    return Ok(response);
10702                }
10703            }
10704        }
10705    }
10706
10707    /// The resource that owns the locations collection, if applicable.
10708    ///
10709    /// Sets the *name* path property to the given value.
10710    ///
10711    /// Even though the property as already been set when instantiating this call,
10712    /// we provide this method for API completeness.
10713    pub fn name(mut self, new_value: &str) -> ProjectLocationListCall<'a, C> {
10714        self._name = new_value.to_string();
10715        self
10716    }
10717    /// A page token received from the `next_page_token` field in the response. Send that page token to receive the subsequent page.
10718    ///
10719    /// Sets the *page token* query property to the given value.
10720    pub fn page_token(mut self, new_value: &str) -> ProjectLocationListCall<'a, C> {
10721        self._page_token = Some(new_value.to_string());
10722        self
10723    }
10724    /// The maximum number of results to return. If not set, the service selects a default.
10725    ///
10726    /// Sets the *page size* query property to the given value.
10727    pub fn page_size(mut self, new_value: i32) -> ProjectLocationListCall<'a, C> {
10728        self._page_size = Some(new_value);
10729        self
10730    }
10731    /// If true, the returned list will include locations which are not yet revealed.
10732    ///
10733    /// Sets the *include unrevealed locations* query property to the given value.
10734    pub fn include_unrevealed_locations(
10735        mut self,
10736        new_value: bool,
10737    ) -> ProjectLocationListCall<'a, C> {
10738        self._include_unrevealed_locations = Some(new_value);
10739        self
10740    }
10741    /// 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).
10742    ///
10743    /// Sets the *filter* query property to the given value.
10744    pub fn filter(mut self, new_value: &str) -> ProjectLocationListCall<'a, C> {
10745        self._filter = Some(new_value.to_string());
10746        self
10747    }
10748    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
10749    /// while executing the actual API request.
10750    ///
10751    /// ````text
10752    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
10753    /// ````
10754    ///
10755    /// Sets the *delegate* property to the given value.
10756    pub fn delegate(
10757        mut self,
10758        new_value: &'a mut dyn common::Delegate,
10759    ) -> ProjectLocationListCall<'a, C> {
10760        self._delegate = Some(new_value);
10761        self
10762    }
10763
10764    /// Set any additional parameter of the query string used in the request.
10765    /// It should be used to set parameters which are not yet available through their own
10766    /// setters.
10767    ///
10768    /// Please note that this method must not be used to set any of the known parameters
10769    /// which have their own setter method. If done anyway, the request will fail.
10770    ///
10771    /// # Additional Parameters
10772    ///
10773    /// * *$.xgafv* (query-string) - V1 error format.
10774    /// * *access_token* (query-string) - OAuth access token.
10775    /// * *alt* (query-string) - Data format for response.
10776    /// * *callback* (query-string) - JSONP
10777    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
10778    /// * *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.
10779    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
10780    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
10781    /// * *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.
10782    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
10783    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
10784    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationListCall<'a, C>
10785    where
10786        T: AsRef<str>,
10787    {
10788        self._additional_params
10789            .insert(name.as_ref().to_string(), value.as_ref().to_string());
10790        self
10791    }
10792
10793    /// Identifies the authorization scope for the method you are building.
10794    ///
10795    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
10796    /// [`Scope::CloudPlatform`].
10797    ///
10798    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
10799    /// tokens for more than one scope.
10800    ///
10801    /// Usually there is more than one suitable scope to authorize an operation, some of which may
10802    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
10803    /// sufficient, a read-write scope will do as well.
10804    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationListCall<'a, C>
10805    where
10806        St: AsRef<str>,
10807    {
10808        self._scopes.insert(String::from(scope.as_ref()));
10809        self
10810    }
10811    /// Identifies the authorization scope(s) for the method you are building.
10812    ///
10813    /// See [`Self::add_scope()`] for details.
10814    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationListCall<'a, C>
10815    where
10816        I: IntoIterator<Item = St>,
10817        St: AsRef<str>,
10818    {
10819        self._scopes
10820            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
10821        self
10822    }
10823
10824    /// Removes all scopes, and no default scope will be used either.
10825    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
10826    /// for details).
10827    pub fn clear_scopes(mut self) -> ProjectLocationListCall<'a, C> {
10828        self._scopes.clear();
10829        self
10830    }
10831}