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 connector = hyper_rustls::HttpsConnectorBuilder::new()
63///     .with_native_roots()
64///     .unwrap()
65///     .https_only()
66///     .enable_http2()
67///     .build();
68///
69/// let executor = hyper_util::rt::TokioExecutor::new();
70/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
71///     secret,
72///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
73///     yup_oauth2::client::CustomHyperClientBuilder::from(
74///         hyper_util::client::legacy::Client::builder(executor).build(connector),
75///     ),
76/// ).build().await.unwrap();
77///
78/// let client = hyper_util::client::legacy::Client::builder(
79///     hyper_util::rt::TokioExecutor::new()
80/// )
81/// .build(
82///     hyper_rustls::HttpsConnectorBuilder::new()
83///         .with_native_roots()
84///         .unwrap()
85///         .https_or_http()
86///         .enable_http2()
87///         .build()
88/// );
89/// let mut hub = CloudFilestore::new(client, auth);
90/// // As the method needs a request, you would usually fill it with the desired information
91/// // into the respective structure. Some of the parts shown here might not be applicable !
92/// // Values shown here are possibly random and not representative !
93/// let mut req = Backup::default();
94///
95/// // You can configure optional parameters by calling the respective setters at will, and
96/// // execute the final call using `doit()`.
97/// // Values shown here are possibly random and not representative !
98/// let result = hub.projects().locations_backups_create(req, "parent")
99///              .backup_id("At")
100///              .doit().await;
101///
102/// match result {
103///     Err(e) => match e {
104///         // The Error enum provides details about what exactly happened.
105///         // You can also just use its `Debug`, `Display` or `Error` traits
106///          Error::HttpError(_)
107///         |Error::Io(_)
108///         |Error::MissingAPIKey
109///         |Error::MissingToken(_)
110///         |Error::Cancelled
111///         |Error::UploadSizeLimitExceeded(_, _)
112///         |Error::Failure(_)
113///         |Error::BadRequest(_)
114///         |Error::FieldClash(_)
115///         |Error::JsonDecodeError(_, _) => println!("{}", e),
116///     },
117///     Ok(res) => println!("Success: {:?}", res),
118/// }
119/// # }
120/// ```
121#[derive(Clone)]
122pub struct CloudFilestore<C> {
123    pub client: common::Client<C>,
124    pub auth: Box<dyn common::GetToken>,
125    _user_agent: String,
126    _base_url: String,
127    _root_url: String,
128}
129
130impl<C> common::Hub for CloudFilestore<C> {}
131
132impl<'a, C> CloudFilestore<C> {
133    pub fn new<A: 'static + common::GetToken>(
134        client: common::Client<C>,
135        auth: A,
136    ) -> CloudFilestore<C> {
137        CloudFilestore {
138            client,
139            auth: Box::new(auth),
140            _user_agent: "google-api-rust-client/7.0.0".to_string(),
141            _base_url: "https://file.googleapis.com/".to_string(),
142            _root_url: "https://file.googleapis.com/".to_string(),
143        }
144    }
145
146    pub fn projects(&'a self) -> ProjectMethods<'a, C> {
147        ProjectMethods { hub: self }
148    }
149
150    /// Set the user-agent header field to use in all requests to the server.
151    /// It defaults to `google-api-rust-client/7.0.0`.
152    ///
153    /// Returns the previously set user-agent.
154    pub fn user_agent(&mut self, agent_name: String) -> String {
155        std::mem::replace(&mut self._user_agent, agent_name)
156    }
157
158    /// Set the base url to use in all requests to the server.
159    /// It defaults to `https://file.googleapis.com/`.
160    ///
161    /// Returns the previously set base url.
162    pub fn base_url(&mut self, new_base_url: String) -> String {
163        std::mem::replace(&mut self._base_url, new_base_url)
164    }
165
166    /// Set the root url to use in all requests to the server.
167    /// It defaults to `https://file.googleapis.com/`.
168    ///
169    /// Returns the previously set root url.
170    pub fn root_url(&mut self, new_root_url: String) -> String {
171        std::mem::replace(&mut self._root_url, new_root_url)
172    }
173}
174
175// ############
176// SCHEMAS ###
177// ##########
178/// A Filestore backup.
179///
180/// # Activities
181///
182/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
183/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
184///
185/// * [locations backups create projects](ProjectLocationBackupCreateCall) (request)
186/// * [locations backups get projects](ProjectLocationBackupGetCall) (response)
187/// * [locations backups patch projects](ProjectLocationBackupPatchCall) (request)
188#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
189#[serde_with::serde_as]
190#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
191pub struct Backup {
192    /// Output only. Capacity of the source file share when the backup was created.
193    #[serde(rename = "capacityGb")]
194    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
195    pub capacity_gb: Option<i64>,
196    /// Output only. The time when the backup was created.
197    #[serde(rename = "createTime")]
198    pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
199    /// A description of the backup with 2048 characters or less. Requests with longer descriptions will be rejected.
200    pub description: Option<String>,
201    /// Output only. Amount of bytes that will be downloaded if the backup is restored
202    #[serde(rename = "downloadBytes")]
203    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
204    pub download_bytes: Option<i64>,
205    /// Output only. The file system protocol of the source Filestore instance that this backup is created from.
206    #[serde(rename = "fileSystemProtocol")]
207    pub file_system_protocol: Option<String>,
208    /// Immutable. KMS key name used for data encryption.
209    #[serde(rename = "kmsKeyName")]
210    pub kms_key_name: Option<String>,
211    /// Resource labels to represent user provided metadata.
212    pub labels: Option<HashMap<String, String>>,
213    /// Output only. The resource name of the backup, in the format `projects/{project_id}/locations/{location_id}/backups/{backup_id}`.
214    pub name: Option<String>,
215    /// Output only. Reserved for future use.
216    #[serde(rename = "satisfiesPzi")]
217    pub satisfies_pzi: Option<bool>,
218    /// Output only. Reserved for future use.
219    #[serde(rename = "satisfiesPzs")]
220    pub satisfies_pzs: Option<bool>,
221    /// Name of the file share in the source Filestore instance that the backup is created from.
222    #[serde(rename = "sourceFileShare")]
223    pub source_file_share: Option<String>,
224    /// 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.
225    #[serde(rename = "sourceInstance")]
226    pub source_instance: Option<String>,
227    /// Output only. The service tier of the source Filestore instance that this backup is created from.
228    #[serde(rename = "sourceInstanceTier")]
229    pub source_instance_tier: Option<String>,
230    /// Output only. The backup state.
231    pub state: Option<String>,
232    /// 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.
233    #[serde(rename = "storageBytes")]
234    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
235    pub storage_bytes: Option<i64>,
236    /// Optional. Input only. Immutable. Tag key-value pairs bound to this resource. Each key must be a namespaced name and each value a short name. Example: "123456789012/environment" : "production", "123456789013/costCenter" : "marketing" See the documentation for more information: - Namespaced name: https://cloud.google.com/resource-manager/docs/tags/tags-creating-and-managing#retrieving_tag_key - Short name: https://cloud.google.com/resource-manager/docs/tags/tags-creating-and-managing#retrieving_tag_value
237    pub tags: Option<HashMap<String, String>>,
238}
239
240impl common::RequestValue for Backup {}
241impl common::ResponseResult for Backup {}
242
243/// The request message for Operations.CancelOperation.
244///
245/// # Activities
246///
247/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
248/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
249///
250/// * [locations operations cancel projects](ProjectLocationOperationCancelCall) (request)
251#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
252#[serde_with::serde_as]
253#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
254pub struct CancelOperationRequest {
255    _never_set: Option<bool>,
256}
257
258impl common::RequestValue for CancelOperationRequest {}
259
260/// Directory Services configuration.
261///
262/// This type is not used in any activity, and only used as *part* of another schema.
263///
264#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
265#[serde_with::serde_as]
266#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
267pub struct DirectoryServicesConfig {
268    /// Configuration for LDAP servers.
269    pub ldap: Option<LdapConfig>,
270    /// Configuration for Managed Service for Microsoft Active Directory.
271    #[serde(rename = "managedActiveDirectory")]
272    pub managed_active_directory: Option<ManagedActiveDirectoryConfig>,
273}
274
275impl common::Part for DirectoryServicesConfig {}
276
277/// 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); }
278///
279/// # Activities
280///
281/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
282/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
283///
284/// * [locations operations cancel projects](ProjectLocationOperationCancelCall) (response)
285/// * [locations operations delete projects](ProjectLocationOperationDeleteCall) (response)
286#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
287#[serde_with::serde_as]
288#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
289pub struct Empty {
290    _never_set: Option<bool>,
291}
292
293impl common::ResponseResult for Empty {}
294
295/// File share configuration for the instance.
296///
297/// This type is not used in any activity, and only used as *part* of another schema.
298///
299#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
300#[serde_with::serde_as]
301#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
302pub struct FileShareConfig {
303    /// File share capacity in gigabytes (GB). Filestore defines 1 GB as 1024^3 bytes.
304    #[serde(rename = "capacityGb")]
305    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
306    pub capacity_gb: Option<i64>,
307    /// 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.
308    pub name: Option<String>,
309    /// Nfs Export Options. There is a limit of 10 export options per file share.
310    #[serde(rename = "nfsExportOptions")]
311    pub nfs_export_options: Option<Vec<NfsExportOptions>>,
312    /// 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.
313    #[serde(rename = "sourceBackup")]
314    pub source_backup: Option<String>,
315    /// The resource name of the BackupDR backup, in the format `projects/{project_id}/locations/{location_id}/backupVaults/{backupvault_id}/dataSources/{datasource_id}/backups/{backup_id}`, TODO (b/443690479) - Remove visibility restrictions once the feature is ready
316    #[serde(rename = "sourceBackupdrBackup")]
317    pub source_backupdr_backup: Option<String>,
318}
319
320impl common::Part for FileShareConfig {}
321
322/// Fixed IOPS (input/output operations per second) parameters.
323///
324/// This type is not used in any activity, and only used as *part* of another schema.
325///
326#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
327#[serde_with::serde_as]
328#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
329pub struct FixedIOPS {
330    /// Required. Maximum IOPS.
331    #[serde(rename = "maxIops")]
332    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
333    pub max_iops: Option<i64>,
334}
335
336impl common::Part for FixedIOPS {}
337
338/// IOPS per TB. Filestore defines TB as 1024^4 bytes (TiB).
339///
340/// This type is not used in any activity, and only used as *part* of another schema.
341///
342#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
343#[serde_with::serde_as]
344#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
345pub struct IOPSPerTB {
346    /// Required. Maximum IOPS per TiB.
347    #[serde(rename = "maxIopsPerTb")]
348    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
349    pub max_iops_per_tb: Option<i64>,
350}
351
352impl common::Part for IOPSPerTB {}
353
354/// A Filestore instance.
355///
356/// # Activities
357///
358/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
359/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
360///
361/// * [locations instances create projects](ProjectLocationInstanceCreateCall) (request)
362/// * [locations instances get projects](ProjectLocationInstanceGetCall) (response)
363/// * [locations instances patch projects](ProjectLocationInstancePatchCall) (request)
364#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
365#[serde_with::serde_as]
366#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
367pub struct Instance {
368    /// Optional. Immutable. Designates the backend type of this instance. Intended to be used by internal tests and allowed customers.
369    #[serde(rename = "backendType")]
370    pub backend_type: Option<String>,
371    /// 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.
372    #[serde(rename = "capacityGb")]
373    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
374    pub capacity_gb: Option<i64>,
375    /// Output only. The incremental increase or decrease in capacity, designated in some number of GB.
376    #[serde(rename = "capacityStepSizeGb")]
377    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
378    pub capacity_step_size_gb: Option<i64>,
379    /// Output only. The time when the instance was created.
380    #[serde(rename = "createTime")]
381    pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
382    /// Output only. Indicates whether this instance supports configuring its performance. If true, the user can configure the instance's performance by using the 'performance_config' field.
383    #[serde(rename = "customPerformanceSupported")]
384    pub custom_performance_supported: Option<bool>,
385    /// Optional. Indicates whether the instance is protected against deletion.
386    #[serde(rename = "deletionProtectionEnabled")]
387    pub deletion_protection_enabled: Option<bool>,
388    /// Optional. The reason for enabling deletion protection.
389    #[serde(rename = "deletionProtectionReason")]
390    pub deletion_protection_reason: Option<String>,
391    /// The description of the instance (2048 characters or less).
392    pub description: Option<String>,
393    /// Optional. Directory Services configuration. Should only be set if protocol is "NFS_V4_1".
394    #[serde(rename = "directoryServices")]
395    pub directory_services: Option<DirectoryServicesConfig>,
396    /// Server-specified ETag for the instance resource to prevent simultaneous updates from overwriting each other.
397    pub etag: Option<String>,
398    /// File system shares on the instance. For this version, only a single file share is supported.
399    #[serde(rename = "fileShares")]
400    pub file_shares: Option<Vec<FileShareConfig>>,
401    /// KMS key name used for data encryption.
402    #[serde(rename = "kmsKeyName")]
403    pub kms_key_name: Option<String>,
404    /// Resource labels to represent user provided metadata.
405    pub labels: Option<HashMap<String, String>>,
406    /// Output only. The maximum capacity of the instance.
407    #[serde(rename = "maxCapacityGb")]
408    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
409    pub max_capacity_gb: Option<i64>,
410    /// The maximum number of shares allowed.
411    #[serde(rename = "maxShareCount")]
412    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
413    pub max_share_count: Option<i64>,
414    /// Output only. The minimum capacity of the instance.
415    #[serde(rename = "minCapacityGb")]
416    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
417    pub min_capacity_gb: Option<i64>,
418    /// 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.
419    #[serde(rename = "multiShareEnabled")]
420    pub multi_share_enabled: Option<bool>,
421    /// Output only. The resource name of the instance, in the format `projects/{project_id}/locations/{location_id}/instances/{instance_id}`.
422    pub name: Option<String>,
423    /// VPC networks to which the instance is connected. For this version, only a single network is supported.
424    pub networks: Option<Vec<NetworkConfig>>,
425    /// Optional. Used to configure performance.
426    #[serde(rename = "performanceConfig")]
427    pub performance_config: Option<PerformanceConfig>,
428    /// Output only. Used for getting performance limits.
429    #[serde(rename = "performanceLimits")]
430    pub performance_limits: Option<PerformanceLimits>,
431    /// 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`.
432    pub protocol: Option<String>,
433    /// Optional. Replication configuration.
434    pub replication: Option<Replication>,
435    /// Output only. Reserved for future use.
436    #[serde(rename = "satisfiesPzi")]
437    pub satisfies_pzi: Option<bool>,
438    /// Output only. Reserved for future use.
439    #[serde(rename = "satisfiesPzs")]
440    pub satisfies_pzs: Option<bool>,
441    /// Output only. The instance state.
442    pub state: Option<String>,
443    /// Output only. Additional information about the instance state, if available.
444    #[serde(rename = "statusMessage")]
445    pub status_message: Option<String>,
446    /// Output only. Field indicates all the reasons the instance is in "SUSPENDED" state.
447    #[serde(rename = "suspensionReasons")]
448    pub suspension_reasons: Option<Vec<String>>,
449    /// Optional. Input only. Immutable. Tag key-value pairs bound to this resource. Each key must be a namespaced name and each value a short name. Example: "123456789012/environment" : "production", "123456789013/costCenter" : "marketing" See the documentation for more information: - Namespaced name: https://cloud.google.com/resource-manager/docs/tags/tags-creating-and-managing#retrieving_tag_key - Short name: https://cloud.google.com/resource-manager/docs/tags/tags-creating-and-managing#retrieving_tag_value
450    pub tags: Option<HashMap<String, String>>,
451    /// The service tier of the instance.
452    pub tier: Option<String>,
453}
454
455impl common::RequestValue for Instance {}
456impl common::ResponseResult for Instance {}
457
458/// LdapConfig contains all the parameters for connecting to LDAP servers.
459///
460/// This type is not used in any activity, and only used as *part* of another schema.
461///
462#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
463#[serde_with::serde_as]
464#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
465pub struct LdapConfig {
466    /// Required. The LDAP domain name in the format of `my-domain.com`.
467    pub domain: Option<String>,
468    /// Optional. The groups Organizational Unit (OU) is optional. This parameter is a hint to allow faster lookup in the LDAP namespace. In case that this parameter is not provided, Filestore instance will query the whole LDAP namespace.
469    #[serde(rename = "groupsOu")]
470    pub groups_ou: Option<String>,
471    /// Required. The servers names are used for specifying the LDAP servers names. The LDAP servers names can come with two formats: 1. DNS name, for example: `ldap.example1.com`, `ldap.example2.com`. 2. IP address, for example: `10.0.0.1`, `10.0.0.2`, `10.0.0.3`. All servers names must be in the same format: either all DNS names or all IP addresses.
472    pub servers: Option<Vec<String>>,
473    /// Optional. The users Organizational Unit (OU) is optional. This parameter is a hint to allow faster lookup in the LDAP namespace. In case that this parameter is not provided, Filestore instance will query the whole LDAP namespace.
474    #[serde(rename = "usersOu")]
475    pub users_ou: Option<String>,
476}
477
478impl common::Part for LdapConfig {}
479
480/// ListBackupsResponse is the result of ListBackupsRequest.
481///
482/// # Activities
483///
484/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
485/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
486///
487/// * [locations backups list projects](ProjectLocationBackupListCall) (response)
488#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
489#[serde_with::serde_as]
490#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
491pub struct ListBackupsResponse {
492    /// 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.
493    pub backups: Option<Vec<Backup>>,
494    /// The token you can use to retrieve the next page of results. Not returned if there are no more results in the list.
495    #[serde(rename = "nextPageToken")]
496    pub next_page_token: Option<String>,
497    /// Unordered list. Locations that could not be reached.
498    pub unreachable: Option<Vec<String>>,
499}
500
501impl common::ResponseResult for ListBackupsResponse {}
502
503/// ListInstancesResponse is the result of ListInstancesRequest.
504///
505/// # Activities
506///
507/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
508/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
509///
510/// * [locations instances list projects](ProjectLocationInstanceListCall) (response)
511#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
512#[serde_with::serde_as]
513#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
514pub struct ListInstancesResponse {
515    /// 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.
516    pub instances: Option<Vec<Instance>>,
517    /// The token you can use to retrieve the next page of results. Not returned if there are no more results in the list.
518    #[serde(rename = "nextPageToken")]
519    pub next_page_token: Option<String>,
520    /// Unordered list. Locations that could not be reached.
521    pub unreachable: Option<Vec<String>>,
522}
523
524impl common::ResponseResult for ListInstancesResponse {}
525
526/// The response message for Locations.ListLocations.
527///
528/// # Activities
529///
530/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
531/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
532///
533/// * [locations list projects](ProjectLocationListCall) (response)
534#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
535#[serde_with::serde_as]
536#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
537pub struct ListLocationsResponse {
538    /// A list of locations that matches the specified filter in the request.
539    pub locations: Option<Vec<Location>>,
540    /// The standard List next-page token.
541    #[serde(rename = "nextPageToken")]
542    pub next_page_token: Option<String>,
543}
544
545impl common::ResponseResult for ListLocationsResponse {}
546
547/// The response message for Operations.ListOperations.
548///
549/// # Activities
550///
551/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
552/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
553///
554/// * [locations operations list projects](ProjectLocationOperationListCall) (response)
555#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
556#[serde_with::serde_as]
557#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
558pub struct ListOperationsResponse {
559    /// The standard List next-page token.
560    #[serde(rename = "nextPageToken")]
561    pub next_page_token: Option<String>,
562    /// A list of operations that matches the specified filter in the request.
563    pub operations: Option<Vec<Operation>>,
564    /// Unordered list. Unreachable resources. Populated when the request sets `ListOperationsRequest.return_partial_success` and reads across collections. For example, when attempting to list all resources across all supported locations.
565    pub unreachable: Option<Vec<String>>,
566}
567
568impl common::ResponseResult for ListOperationsResponse {}
569
570/// ListSharesResponse is the result of ListSharesRequest.
571///
572/// # Activities
573///
574/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
575/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
576///
577/// * [locations instances shares list projects](ProjectLocationInstanceShareListCall) (response)
578#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
579#[serde_with::serde_as]
580#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
581pub struct ListSharesResponse {
582    /// The token you can use to retrieve the next page of results. Not returned if there are no more results in the list.
583    #[serde(rename = "nextPageToken")]
584    pub next_page_token: Option<String>,
585    /// A list of shares in the project for the specified instance.
586    pub shares: Option<Vec<Share>>,
587    /// Unordered list. Locations that could not be reached.
588    pub unreachable: Option<Vec<String>>,
589}
590
591impl common::ResponseResult for ListSharesResponse {}
592
593/// ListSnapshotsResponse is the result of ListSnapshotsRequest.
594///
595/// # Activities
596///
597/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
598/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
599///
600/// * [locations instances snapshots list projects](ProjectLocationInstanceSnapshotListCall) (response)
601#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
602#[serde_with::serde_as]
603#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
604pub struct ListSnapshotsResponse {
605    /// The token you can use to retrieve the next page of results. Not returned if there are no more results in the list.
606    #[serde(rename = "nextPageToken")]
607    pub next_page_token: Option<String>,
608    /// A list of snapshots in the project for the specified instance.
609    pub snapshots: Option<Vec<Snapshot>>,
610    /// Unordered list. Locations that could not be reached.
611    pub unreachable: Option<Vec<String>>,
612}
613
614impl common::ResponseResult for ListSnapshotsResponse {}
615
616/// A resource that represents a Google Cloud location.
617///
618/// # Activities
619///
620/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
621/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
622///
623/// * [locations get projects](ProjectLocationGetCall) (response)
624#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
625#[serde_with::serde_as]
626#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
627pub struct Location {
628    /// The friendly name for this location, typically a nearby city name. For example, "Tokyo".
629    #[serde(rename = "displayName")]
630    pub display_name: Option<String>,
631    /// Cross-service attributes for the location. For example {"cloud.googleapis.com/region": "us-east1"}
632    pub labels: Option<HashMap<String, String>>,
633    /// The canonical id for this location. For example: `"us-east1"`.
634    #[serde(rename = "locationId")]
635    pub location_id: Option<String>,
636    /// Service-specific metadata. For example the available capacity at the given location.
637    pub metadata: Option<HashMap<String, serde_json::Value>>,
638    /// Resource name for the location, which may vary between implementations. For example: `"projects/example-project/locations/us-east1"`
639    pub name: Option<String>,
640}
641
642impl common::ResponseResult for Location {}
643
644/// ManagedActiveDirectoryConfig contains all the parameters for connecting to Managed Service for Microsoft Active Directory (Managed Microsoft AD).
645///
646/// This type is not used in any activity, and only used as *part* of another schema.
647///
648#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
649#[serde_with::serde_as]
650#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
651pub struct ManagedActiveDirectoryConfig {
652    /// Required. The computer name is used as a prefix in the command to mount the remote target. For example: if the computer is `my-computer`, the mount command will look like: `$mount -o vers=4.1,sec=krb5 my-computer.filestore.: `.
653    pub computer: Option<String>,
654    /// Required. The domain resource name, in the format `projects/{project_id}/locations/global/domains/{domain}`.
655    pub domain: Option<String>,
656}
657
658impl common::Part for ManagedActiveDirectoryConfig {}
659
660/// Network configuration for the instance.
661///
662/// This type is not used in any activity, and only used as *part* of another schema.
663///
664#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
665#[serde_with::serde_as]
666#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
667pub struct NetworkConfig {
668    /// The network connect mode of the Filestore instance. If not provided, the connect mode defaults to DIRECT_PEERING.
669    #[serde(rename = "connectMode")]
670    pub connect_mode: Option<String>,
671    /// 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}`.
672    #[serde(rename = "ipAddresses")]
673    pub ip_addresses: Option<Vec<String>>,
674    /// Internet protocol versions for which the instance has IP addresses assigned. For this version, only MODE_IPV4 is supported.
675    pub modes: Option<Vec<String>>,
676    /// The name of the Google Compute Engine [VPC network](https://cloud.google.com/vpc/docs/vpc) to which the instance is connected.
677    pub network: Option<String>,
678    /// Optional. Private Service Connect configuration. Should only be set when connect_mode is PRIVATE_SERVICE_CONNECT.
679    #[serde(rename = "pscConfig")]
680    pub psc_config: Option<PscConfig>,
681    /// 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.
682    #[serde(rename = "reservedIpRange")]
683    pub reserved_ip_range: Option<String>,
684}
685
686impl common::Part for NetworkConfig {}
687
688/// NFS export options specifications.
689///
690/// This type is not used in any activity, and only used as *part* of another schema.
691///
692#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
693#[serde_with::serde_as]
694#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
695pub struct NfsExportOptions {
696    /// 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.
697    #[serde(rename = "accessMode")]
698    pub access_mode: Option<String>,
699    /// 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.
700    #[serde(rename = "anonGid")]
701    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
702    pub anon_gid: Option<i64>,
703    /// 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.
704    #[serde(rename = "anonUid")]
705    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
706    pub anon_uid: Option<i64>,
707    /// 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.
708    #[serde(rename = "ipRanges")]
709    pub ip_ranges: Option<Vec<String>>,
710    /// Optional. The source VPC network for ip_ranges. Required for instances using Private Service Connect, optional otherwise. If provided, must be the same network specified in the `NetworkConfig.network` field.
711    pub network: Option<String>,
712    /// The security flavors allowed for mount operations. The default is AUTH_SYS.
713    #[serde(rename = "securityFlavors")]
714    pub security_flavors: Option<Vec<String>>,
715    /// 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.
716    #[serde(rename = "squashMode")]
717    pub squash_mode: Option<String>,
718}
719
720impl common::Part for NfsExportOptions {}
721
722/// This resource represents a long-running operation that is the result of a network API call.
723///
724/// # Activities
725///
726/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
727/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
728///
729/// * [locations backups create projects](ProjectLocationBackupCreateCall) (response)
730/// * [locations backups delete projects](ProjectLocationBackupDeleteCall) (response)
731/// * [locations backups patch projects](ProjectLocationBackupPatchCall) (response)
732/// * [locations instances shares create projects](ProjectLocationInstanceShareCreateCall) (response)
733/// * [locations instances shares delete projects](ProjectLocationInstanceShareDeleteCall) (response)
734/// * [locations instances shares patch projects](ProjectLocationInstanceSharePatchCall) (response)
735/// * [locations instances snapshots create projects](ProjectLocationInstanceSnapshotCreateCall) (response)
736/// * [locations instances snapshots delete projects](ProjectLocationInstanceSnapshotDeleteCall) (response)
737/// * [locations instances snapshots patch projects](ProjectLocationInstanceSnapshotPatchCall) (response)
738/// * [locations instances create projects](ProjectLocationInstanceCreateCall) (response)
739/// * [locations instances delete projects](ProjectLocationInstanceDeleteCall) (response)
740/// * [locations instances patch projects](ProjectLocationInstancePatchCall) (response)
741/// * [locations instances pause replica projects](ProjectLocationInstancePauseReplicaCall) (response)
742/// * [locations instances promote replica projects](ProjectLocationInstancePromoteReplicaCall) (response)
743/// * [locations instances restore projects](ProjectLocationInstanceRestoreCall) (response)
744/// * [locations instances resume replica projects](ProjectLocationInstanceResumeReplicaCall) (response)
745/// * [locations instances revert projects](ProjectLocationInstanceRevertCall) (response)
746/// * [locations operations get projects](ProjectLocationOperationGetCall) (response)
747#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
748#[serde_with::serde_as]
749#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
750pub struct Operation {
751    /// 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.
752    pub done: Option<bool>,
753    /// The error result of the operation in case of failure or cancellation.
754    pub error: Option<Status>,
755    /// 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.
756    pub metadata: Option<HashMap<String, serde_json::Value>>,
757    /// 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}`.
758    pub name: Option<String>,
759    /// 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`.
760    pub response: Option<HashMap<String, serde_json::Value>>,
761}
762
763impl common::ResponseResult for Operation {}
764
765/// PauseReplicaRequest pauses a Filestore standby instance (replica).
766///
767/// # Activities
768///
769/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
770/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
771///
772/// * [locations instances pause replica projects](ProjectLocationInstancePauseReplicaCall) (request)
773#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
774#[serde_with::serde_as]
775#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
776pub struct PauseReplicaRequest {
777    _never_set: Option<bool>,
778}
779
780impl common::RequestValue for PauseReplicaRequest {}
781
782/// Used for setting the performance configuration. If the user doesn't specify PerformanceConfig, automatically provision the default performance settings as described in https://cloud.google.com/filestore/docs/performance. Larger instances will be linearly set to more IOPS. If the instance's capacity is increased or decreased, its performance will be automatically adjusted upwards or downwards accordingly (respectively).
783///
784/// This type is not used in any activity, and only used as *part* of another schema.
785///
786#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
787#[serde_with::serde_as]
788#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
789pub struct PerformanceConfig {
790    /// 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.
791    #[serde(rename = "fixedIops")]
792    pub fixed_iops: Option<FixedIOPS>,
793    /// Provision IOPS dynamically based on the capacity of the instance. Provisioned IOPS will be calculated by multiplying the capacity of the instance in TiB by the `iops_per_tb` value. For example, for a 2 TiB instance with an `iops_per_tb` value of 17000 the provisioned IOPS will be 34000. 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.
794    #[serde(rename = "iopsPerTb")]
795    pub iops_per_tb: Option<IOPSPerTB>,
796}
797
798impl common::Part for PerformanceConfig {}
799
800/// The enforced performance limits, calculated from the instance's performance configuration.
801///
802/// This type is not used in any activity, and only used as *part* of another schema.
803///
804#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
805#[serde_with::serde_as]
806#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
807pub struct PerformanceLimits {
808    /// Output only. The maximum IOPS.
809    #[serde(rename = "maxIops")]
810    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
811    pub max_iops: Option<i64>,
812    /// Output only. The maximum read IOPS.
813    #[serde(rename = "maxReadIops")]
814    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
815    pub max_read_iops: Option<i64>,
816    /// Output only. The maximum read throughput in bytes per second.
817    #[serde(rename = "maxReadThroughputBps")]
818    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
819    pub max_read_throughput_bps: Option<i64>,
820    /// Output only. The maximum write IOPS.
821    #[serde(rename = "maxWriteIops")]
822    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
823    pub max_write_iops: Option<i64>,
824    /// Output only. The maximumwrite throughput in bytes per second.
825    #[serde(rename = "maxWriteThroughputBps")]
826    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
827    pub max_write_throughput_bps: Option<i64>,
828}
829
830impl common::Part for PerformanceLimits {}
831
832/// PromoteReplicaRequest promotes a Filestore standby instance (replica).
833///
834/// # Activities
835///
836/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
837/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
838///
839/// * [locations instances promote replica projects](ProjectLocationInstancePromoteReplicaCall) (request)
840#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
841#[serde_with::serde_as]
842#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
843pub struct PromoteReplicaRequest {
844    /// Optional. The resource name of the peer instance to promote, in the format `projects/{project_id}/locations/{location_id}/instances/{instance_id}`. The peer instance is required if the operation is called on an active instance.
845    #[serde(rename = "peerInstance")]
846    pub peer_instance: Option<String>,
847}
848
849impl common::RequestValue for PromoteReplicaRequest {}
850
851/// Private Service Connect configuration.
852///
853/// This type is not used in any activity, and only used as *part* of another schema.
854///
855#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
856#[serde_with::serde_as]
857#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
858pub struct PscConfig {
859    /// Consumer service project in which the Private Service Connect endpoint would be set up. This is optional, and only relevant in case the network is a shared VPC. If this is not specified, the endpoint would be setup in the VPC host project.
860    #[serde(rename = "endpointProject")]
861    pub endpoint_project: Option<String>,
862}
863
864impl common::Part for PscConfig {}
865
866/// Replica configuration for the instance.
867///
868/// This type is not used in any activity, and only used as *part* of another schema.
869///
870#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
871#[serde_with::serde_as]
872#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
873pub struct ReplicaConfig {
874    /// Output only. The timestamp of the latest replication snapshot taken on the active instance and is already replicated safely.
875    #[serde(rename = "lastActiveSyncTime")]
876    pub last_active_sync_time: Option<chrono::DateTime<chrono::offset::Utc>>,
877    /// The name of the source instance for the replica, in the format `projects/{project}/locations/{location}/instances/{instance}`. This field is required when creating a replica.
878    #[serde(rename = "peerInstance")]
879    pub peer_instance: Option<String>,
880    /// Output only. The replica state.
881    pub state: Option<String>,
882    /// Output only. Additional information about the replication state, if available.
883    #[serde(rename = "stateReasons")]
884    pub state_reasons: Option<Vec<String>>,
885    /// Output only. The time when the replica state was updated.
886    #[serde(rename = "stateUpdateTime")]
887    pub state_update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
888}
889
890impl common::Part for ReplicaConfig {}
891
892/// Optional. The configuration used to replicate an instance.
893///
894/// This type is not used in any activity, and only used as *part* of another schema.
895///
896#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
897#[serde_with::serde_as]
898#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
899pub struct Replication {
900    /// Replication configuration for the replica instance associated with this instance. Only a single replica is supported.
901    pub replicas: Option<Vec<ReplicaConfig>>,
902    /// Output only. The replication role. When creating a new replica, this field must be set to `STANDBY`.
903    pub role: Option<String>,
904}
905
906impl common::Part for Replication {}
907
908/// RestoreInstanceRequest restores an existing instance’s file share from a backup.
909///
910/// # Activities
911///
912/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
913/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
914///
915/// * [locations instances restore projects](ProjectLocationInstanceRestoreCall) (request)
916#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
917#[serde_with::serde_as]
918#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
919pub struct RestoreInstanceRequest {
920    /// Required. Name of the file share in the Filestore instance that the backup is being restored to.
921    #[serde(rename = "fileShare")]
922    pub file_share: Option<String>,
923    /// The resource name of the backup, in the format `projects/{project_id}/locations/{location_id}/backups/{backup_id}`.
924    #[serde(rename = "sourceBackup")]
925    pub source_backup: Option<String>,
926    /// The resource name of the snapshot, in the format `projects/{project_id}/locations/{location_id}/snapshots/{snapshot_id}`.
927    #[serde(rename = "sourceSnapshot")]
928    pub source_snapshot: Option<String>,
929}
930
931impl common::RequestValue for RestoreInstanceRequest {}
932
933/// ResumeReplicaRequest resumes a Filestore standby instance (replica).
934///
935/// # Activities
936///
937/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
938/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
939///
940/// * [locations instances resume replica projects](ProjectLocationInstanceResumeReplicaCall) (request)
941#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
942#[serde_with::serde_as]
943#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
944pub struct ResumeReplicaRequest {
945    _never_set: Option<bool>,
946}
947
948impl common::RequestValue for ResumeReplicaRequest {}
949
950/// RevertInstanceRequest reverts the given instance’s file share to the specified snapshot.
951///
952/// # Activities
953///
954/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
955/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
956///
957/// * [locations instances revert projects](ProjectLocationInstanceRevertCall) (request)
958#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
959#[serde_with::serde_as]
960#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
961pub struct RevertInstanceRequest {
962    /// 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}`
963    #[serde(rename = "targetSnapshotId")]
964    pub target_snapshot_id: Option<String>,
965}
966
967impl common::RequestValue for RevertInstanceRequest {}
968
969/// A Filestore share.
970///
971/// # Activities
972///
973/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
974/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
975///
976/// * [locations instances shares create projects](ProjectLocationInstanceShareCreateCall) (request)
977/// * [locations instances shares get projects](ProjectLocationInstanceShareGetCall) (response)
978/// * [locations instances shares patch projects](ProjectLocationInstanceSharePatchCall) (request)
979#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
980#[serde_with::serde_as]
981#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
982pub struct Share {
983    /// 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.
984    pub backup: Option<String>,
985    /// File share capacity in gigabytes (GB). Filestore defines 1 GB as 1024^3 bytes. Must be greater than 0.
986    #[serde(rename = "capacityGb")]
987    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
988    pub capacity_gb: Option<i64>,
989    /// Output only. The time when the share was created.
990    #[serde(rename = "createTime")]
991    pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
992    /// A description of the share with 2048 characters or less. Requests with longer descriptions will be rejected.
993    pub description: Option<String>,
994    /// Resource labels to represent user provided metadata.
995    pub labels: Option<HashMap<String, String>>,
996    /// The mount name of the share. Must be 63 characters or less and consist of uppercase or lowercase letters, numbers, and underscores.
997    #[serde(rename = "mountName")]
998    pub mount_name: Option<String>,
999    /// Output only. The resource name of the share, in the format `projects/{project_id}/locations/{location_id}/instances/{instance_id}/shares/{share_id}`.
1000    pub name: Option<String>,
1001    /// Nfs Export Options. There is a limit of 10 export options per file share.
1002    #[serde(rename = "nfsExportOptions")]
1003    pub nfs_export_options: Option<Vec<NfsExportOptions>>,
1004    /// Output only. The share state.
1005    pub state: Option<String>,
1006}
1007
1008impl common::RequestValue for Share {}
1009impl common::ResponseResult for Share {}
1010
1011/// A Filestore snapshot.
1012///
1013/// # Activities
1014///
1015/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1016/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1017///
1018/// * [locations instances snapshots create projects](ProjectLocationInstanceSnapshotCreateCall) (request)
1019/// * [locations instances snapshots get projects](ProjectLocationInstanceSnapshotGetCall) (response)
1020/// * [locations instances snapshots patch projects](ProjectLocationInstanceSnapshotPatchCall) (request)
1021#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1022#[serde_with::serde_as]
1023#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1024pub struct Snapshot {
1025    /// Output only. The time when the snapshot was created.
1026    #[serde(rename = "createTime")]
1027    pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1028    /// A description of the snapshot with 2048 characters or less. Requests with longer descriptions will be rejected.
1029    pub description: Option<String>,
1030    /// Output only. The amount of bytes needed to allocate a full copy of the snapshot content
1031    #[serde(rename = "filesystemUsedBytes")]
1032    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1033    pub filesystem_used_bytes: Option<i64>,
1034    /// Resource labels to represent user provided metadata.
1035    pub labels: Option<HashMap<String, String>>,
1036    /// Output only. The resource name of the snapshot, in the format `projects/{project_id}/locations/{location_id}/instances/{instance_id}/snapshots/{snapshot_id}`.
1037    pub name: Option<String>,
1038    /// Output only. The snapshot state.
1039    pub state: Option<String>,
1040    /// Optional. Input only. Immutable. Tag key-value pairs bound to this resource. Each key must be a namespaced name and each value a short name. Example: "123456789012/environment" : "production", "123456789013/costCenter" : "marketing" See the documentation for more information: - Namespaced name: https://cloud.google.com/resource-manager/docs/tags/tags-creating-and-managing#retrieving_tag_key - Short name: https://cloud.google.com/resource-manager/docs/tags/tags-creating-and-managing#retrieving_tag_value
1041    pub tags: Option<HashMap<String, String>>,
1042}
1043
1044impl common::RequestValue for Snapshot {}
1045impl common::ResponseResult for Snapshot {}
1046
1047/// 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).
1048///
1049/// This type is not used in any activity, and only used as *part* of another schema.
1050///
1051#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1052#[serde_with::serde_as]
1053#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1054pub struct Status {
1055    /// The status code, which should be an enum value of google.rpc.Code.
1056    pub code: Option<i32>,
1057    /// A list of messages that carry the error details. There is a common set of message types for APIs to use.
1058    pub details: Option<Vec<HashMap<String, serde_json::Value>>>,
1059    /// 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.
1060    pub message: Option<String>,
1061}
1062
1063impl common::Part for Status {}
1064
1065// ###################
1066// MethodBuilders ###
1067// #################
1068
1069/// A builder providing access to all methods supported on *project* resources.
1070/// It is not used directly, but through the [`CloudFilestore`] hub.
1071///
1072/// # Example
1073///
1074/// Instantiate a resource builder
1075///
1076/// ```test_harness,no_run
1077/// extern crate hyper;
1078/// extern crate hyper_rustls;
1079/// extern crate google_file1_beta1 as file1_beta1;
1080///
1081/// # async fn dox() {
1082/// use file1_beta1::{CloudFilestore, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
1083///
1084/// let secret: yup_oauth2::ApplicationSecret = Default::default();
1085/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
1086///     .with_native_roots()
1087///     .unwrap()
1088///     .https_only()
1089///     .enable_http2()
1090///     .build();
1091///
1092/// let executor = hyper_util::rt::TokioExecutor::new();
1093/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
1094///     secret,
1095///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
1096///     yup_oauth2::client::CustomHyperClientBuilder::from(
1097///         hyper_util::client::legacy::Client::builder(executor).build(connector),
1098///     ),
1099/// ).build().await.unwrap();
1100///
1101/// let client = hyper_util::client::legacy::Client::builder(
1102///     hyper_util::rt::TokioExecutor::new()
1103/// )
1104/// .build(
1105///     hyper_rustls::HttpsConnectorBuilder::new()
1106///         .with_native_roots()
1107///         .unwrap()
1108///         .https_or_http()
1109///         .enable_http2()
1110///         .build()
1111/// );
1112/// let mut hub = CloudFilestore::new(client, auth);
1113/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
1114/// // 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_pause_replica(...)`, `locations_instances_promote_replica(...)`, `locations_instances_restore(...)`, `locations_instances_resume_replica(...)`, `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(...)`
1115/// // to build up your call.
1116/// let rb = hub.projects();
1117/// # }
1118/// ```
1119pub struct ProjectMethods<'a, C>
1120where
1121    C: 'a,
1122{
1123    hub: &'a CloudFilestore<C>,
1124}
1125
1126impl<'a, C> common::MethodsBuilder for ProjectMethods<'a, C> {}
1127
1128impl<'a, C> ProjectMethods<'a, C> {
1129    /// Create a builder to help you perform the following task:
1130    ///
1131    /// Creates a backup.
1132    ///
1133    /// # Arguments
1134    ///
1135    /// * `request` - No description provided.
1136    /// * `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**.
1137    pub fn locations_backups_create(
1138        &self,
1139        request: Backup,
1140        parent: &str,
1141    ) -> ProjectLocationBackupCreateCall<'a, C> {
1142        ProjectLocationBackupCreateCall {
1143            hub: self.hub,
1144            _request: request,
1145            _parent: parent.to_string(),
1146            _backup_id: Default::default(),
1147            _delegate: Default::default(),
1148            _additional_params: Default::default(),
1149            _scopes: Default::default(),
1150        }
1151    }
1152
1153    /// Create a builder to help you perform the following task:
1154    ///
1155    /// Deletes a backup.
1156    ///
1157    /// # Arguments
1158    ///
1159    /// * `name` - Required. The backup resource name, in the format `projects/{project_id}/locations/{location}/backups/{backup_id}`
1160    pub fn locations_backups_delete(&self, name: &str) -> ProjectLocationBackupDeleteCall<'a, C> {
1161        ProjectLocationBackupDeleteCall {
1162            hub: self.hub,
1163            _name: name.to_string(),
1164            _delegate: Default::default(),
1165            _additional_params: Default::default(),
1166            _scopes: Default::default(),
1167        }
1168    }
1169
1170    /// Create a builder to help you perform the following task:
1171    ///
1172    /// Gets the details of a specific backup.
1173    ///
1174    /// # Arguments
1175    ///
1176    /// * `name` - Required. The backup resource name, in the format `projects/{project_id}/locations/{location}/backups/{backup_id}`.
1177    pub fn locations_backups_get(&self, name: &str) -> ProjectLocationBackupGetCall<'a, C> {
1178        ProjectLocationBackupGetCall {
1179            hub: self.hub,
1180            _name: name.to_string(),
1181            _delegate: Default::default(),
1182            _additional_params: Default::default(),
1183            _scopes: Default::default(),
1184        }
1185    }
1186
1187    /// Create a builder to help you perform the following task:
1188    ///
1189    /// Lists all backups in a project for either a specified location or for all locations.
1190    ///
1191    /// # Arguments
1192    ///
1193    /// * `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.
1194    pub fn locations_backups_list(&self, parent: &str) -> ProjectLocationBackupListCall<'a, C> {
1195        ProjectLocationBackupListCall {
1196            hub: self.hub,
1197            _parent: parent.to_string(),
1198            _page_token: Default::default(),
1199            _page_size: Default::default(),
1200            _order_by: Default::default(),
1201            _filter: Default::default(),
1202            _delegate: Default::default(),
1203            _additional_params: Default::default(),
1204            _scopes: Default::default(),
1205        }
1206    }
1207
1208    /// Create a builder to help you perform the following task:
1209    ///
1210    /// Updates the settings of a specific backup.
1211    ///
1212    /// # Arguments
1213    ///
1214    /// * `request` - No description provided.
1215    /// * `name` - Output only. The resource name of the backup, in the format `projects/{project_id}/locations/{location_id}/backups/{backup_id}`.
1216    pub fn locations_backups_patch(
1217        &self,
1218        request: Backup,
1219        name: &str,
1220    ) -> ProjectLocationBackupPatchCall<'a, C> {
1221        ProjectLocationBackupPatchCall {
1222            hub: self.hub,
1223            _request: request,
1224            _name: name.to_string(),
1225            _update_mask: Default::default(),
1226            _delegate: Default::default(),
1227            _additional_params: Default::default(),
1228            _scopes: Default::default(),
1229        }
1230    }
1231
1232    /// Create a builder to help you perform the following task:
1233    ///
1234    /// Creates a share.
1235    ///
1236    /// # Arguments
1237    ///
1238    /// * `request` - No description provided.
1239    /// * `parent` - Required. The Filestore Instance to create the share for, in the format `projects/{project_id}/locations/{location}/instances/{instance_id}`
1240    pub fn locations_instances_shares_create(
1241        &self,
1242        request: Share,
1243        parent: &str,
1244    ) -> ProjectLocationInstanceShareCreateCall<'a, C> {
1245        ProjectLocationInstanceShareCreateCall {
1246            hub: self.hub,
1247            _request: request,
1248            _parent: parent.to_string(),
1249            _share_id: Default::default(),
1250            _delegate: Default::default(),
1251            _additional_params: Default::default(),
1252            _scopes: Default::default(),
1253        }
1254    }
1255
1256    /// Create a builder to help you perform the following task:
1257    ///
1258    /// Deletes a share.
1259    ///
1260    /// # Arguments
1261    ///
1262    /// * `name` - Required. The share resource name, in the format `projects/{project_id}/locations/{location}/instances/{instance_id}/share/{share_id}`
1263    pub fn locations_instances_shares_delete(
1264        &self,
1265        name: &str,
1266    ) -> ProjectLocationInstanceShareDeleteCall<'a, C> {
1267        ProjectLocationInstanceShareDeleteCall {
1268            hub: self.hub,
1269            _name: name.to_string(),
1270            _delegate: Default::default(),
1271            _additional_params: Default::default(),
1272            _scopes: Default::default(),
1273        }
1274    }
1275
1276    /// Create a builder to help you perform the following task:
1277    ///
1278    /// Gets the details of a specific share.
1279    ///
1280    /// # Arguments
1281    ///
1282    /// * `name` - Required. The share resource name, in the format `projects/{project_id}/locations/{location}/instances/{instance_id}/shares/{share_id}`
1283    pub fn locations_instances_shares_get(
1284        &self,
1285        name: &str,
1286    ) -> ProjectLocationInstanceShareGetCall<'a, C> {
1287        ProjectLocationInstanceShareGetCall {
1288            hub: self.hub,
1289            _name: name.to_string(),
1290            _delegate: Default::default(),
1291            _additional_params: Default::default(),
1292            _scopes: Default::default(),
1293        }
1294    }
1295
1296    /// Create a builder to help you perform the following task:
1297    ///
1298    /// Lists all shares for a specified instance.
1299    ///
1300    /// # Arguments
1301    ///
1302    /// * `parent` - Required. The instance for which to retrieve share information, in the format `projects/{project_id}/locations/{location}/instances/{instance_id}`.
1303    pub fn locations_instances_shares_list(
1304        &self,
1305        parent: &str,
1306    ) -> ProjectLocationInstanceShareListCall<'a, C> {
1307        ProjectLocationInstanceShareListCall {
1308            hub: self.hub,
1309            _parent: parent.to_string(),
1310            _page_token: Default::default(),
1311            _page_size: Default::default(),
1312            _order_by: Default::default(),
1313            _filter: Default::default(),
1314            _delegate: Default::default(),
1315            _additional_params: Default::default(),
1316            _scopes: Default::default(),
1317        }
1318    }
1319
1320    /// Create a builder to help you perform the following task:
1321    ///
1322    /// Updates the settings of a specific share.
1323    ///
1324    /// # Arguments
1325    ///
1326    /// * `request` - No description provided.
1327    /// * `name` - Output only. The resource name of the share, in the format `projects/{project_id}/locations/{location_id}/instances/{instance_id}/shares/{share_id}`.
1328    pub fn locations_instances_shares_patch(
1329        &self,
1330        request: Share,
1331        name: &str,
1332    ) -> ProjectLocationInstanceSharePatchCall<'a, C> {
1333        ProjectLocationInstanceSharePatchCall {
1334            hub: self.hub,
1335            _request: request,
1336            _name: name.to_string(),
1337            _update_mask: Default::default(),
1338            _delegate: Default::default(),
1339            _additional_params: Default::default(),
1340            _scopes: Default::default(),
1341        }
1342    }
1343
1344    /// Create a builder to help you perform the following task:
1345    ///
1346    /// Creates a snapshot.
1347    ///
1348    /// # Arguments
1349    ///
1350    /// * `request` - No description provided.
1351    /// * `parent` - Required. The Filestore Instance to create the snapshots of, in the format `projects/{project_id}/locations/{location}/instances/{instance_id}`
1352    pub fn locations_instances_snapshots_create(
1353        &self,
1354        request: Snapshot,
1355        parent: &str,
1356    ) -> ProjectLocationInstanceSnapshotCreateCall<'a, C> {
1357        ProjectLocationInstanceSnapshotCreateCall {
1358            hub: self.hub,
1359            _request: request,
1360            _parent: parent.to_string(),
1361            _snapshot_id: Default::default(),
1362            _delegate: Default::default(),
1363            _additional_params: Default::default(),
1364            _scopes: Default::default(),
1365        }
1366    }
1367
1368    /// Create a builder to help you perform the following task:
1369    ///
1370    /// Deletes a snapshot.
1371    ///
1372    /// # Arguments
1373    ///
1374    /// * `name` - Required. The snapshot resource name, in the format `projects/{project_id}/locations/{location}/instances/{instance_id}/snapshots/{snapshot_id}`
1375    pub fn locations_instances_snapshots_delete(
1376        &self,
1377        name: &str,
1378    ) -> ProjectLocationInstanceSnapshotDeleteCall<'a, C> {
1379        ProjectLocationInstanceSnapshotDeleteCall {
1380            hub: self.hub,
1381            _name: name.to_string(),
1382            _delegate: Default::default(),
1383            _additional_params: Default::default(),
1384            _scopes: Default::default(),
1385        }
1386    }
1387
1388    /// Create a builder to help you perform the following task:
1389    ///
1390    /// Gets the details of a specific snapshot.
1391    ///
1392    /// # Arguments
1393    ///
1394    /// * `name` - Required. The snapshot resource name, in the format `projects/{project_id}/locations/{location}/instances/{instance_id}/snapshots/{snapshot_id}`
1395    pub fn locations_instances_snapshots_get(
1396        &self,
1397        name: &str,
1398    ) -> ProjectLocationInstanceSnapshotGetCall<'a, C> {
1399        ProjectLocationInstanceSnapshotGetCall {
1400            hub: self.hub,
1401            _name: name.to_string(),
1402            _delegate: Default::default(),
1403            _additional_params: Default::default(),
1404            _scopes: Default::default(),
1405        }
1406    }
1407
1408    /// Create a builder to help you perform the following task:
1409    ///
1410    /// Lists all snapshots in a project for either a specified location or for all locations.
1411    ///
1412    /// # Arguments
1413    ///
1414    /// * `parent` - Required. The instance for which to retrieve snapshot information, in the format `projects/{project_id}/locations/{location}/instances/{instance_id}`.
1415    pub fn locations_instances_snapshots_list(
1416        &self,
1417        parent: &str,
1418    ) -> ProjectLocationInstanceSnapshotListCall<'a, C> {
1419        ProjectLocationInstanceSnapshotListCall {
1420            hub: self.hub,
1421            _parent: parent.to_string(),
1422            _return_partial_success: Default::default(),
1423            _page_token: Default::default(),
1424            _page_size: Default::default(),
1425            _order_by: Default::default(),
1426            _filter: Default::default(),
1427            _delegate: Default::default(),
1428            _additional_params: Default::default(),
1429            _scopes: Default::default(),
1430        }
1431    }
1432
1433    /// Create a builder to help you perform the following task:
1434    ///
1435    /// Updates the settings of a specific snapshot.
1436    ///
1437    /// # Arguments
1438    ///
1439    /// * `request` - No description provided.
1440    /// * `name` - Output only. The resource name of the snapshot, in the format `projects/{project_id}/locations/{location_id}/instances/{instance_id}/snapshots/{snapshot_id}`.
1441    pub fn locations_instances_snapshots_patch(
1442        &self,
1443        request: Snapshot,
1444        name: &str,
1445    ) -> ProjectLocationInstanceSnapshotPatchCall<'a, C> {
1446        ProjectLocationInstanceSnapshotPatchCall {
1447            hub: self.hub,
1448            _request: request,
1449            _name: name.to_string(),
1450            _update_mask: Default::default(),
1451            _delegate: Default::default(),
1452            _additional_params: Default::default(),
1453            _scopes: Default::default(),
1454        }
1455    }
1456
1457    /// Create a builder to help you perform the following task:
1458    ///
1459    /// 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).
1460    ///
1461    /// # Arguments
1462    ///
1463    /// * `request` - No description provided.
1464    /// * `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**.
1465    pub fn locations_instances_create(
1466        &self,
1467        request: Instance,
1468        parent: &str,
1469    ) -> ProjectLocationInstanceCreateCall<'a, C> {
1470        ProjectLocationInstanceCreateCall {
1471            hub: self.hub,
1472            _request: request,
1473            _parent: parent.to_string(),
1474            _instance_id: Default::default(),
1475            _delegate: Default::default(),
1476            _additional_params: Default::default(),
1477            _scopes: Default::default(),
1478        }
1479    }
1480
1481    /// Create a builder to help you perform the following task:
1482    ///
1483    /// Deletes an instance.
1484    ///
1485    /// # Arguments
1486    ///
1487    /// * `name` - Required. The instance resource name, in the format `projects/{project_id}/locations/{location}/instances/{instance_id}`
1488    pub fn locations_instances_delete(
1489        &self,
1490        name: &str,
1491    ) -> ProjectLocationInstanceDeleteCall<'a, C> {
1492        ProjectLocationInstanceDeleteCall {
1493            hub: self.hub,
1494            _name: name.to_string(),
1495            _force: Default::default(),
1496            _delegate: Default::default(),
1497            _additional_params: Default::default(),
1498            _scopes: Default::default(),
1499        }
1500    }
1501
1502    /// Create a builder to help you perform the following task:
1503    ///
1504    /// Gets the details of a specific instance.
1505    ///
1506    /// # Arguments
1507    ///
1508    /// * `name` - Required. The instance resource name, in the format `projects/{project_id}/locations/{location}/instances/{instance_id}`.
1509    pub fn locations_instances_get(&self, name: &str) -> ProjectLocationInstanceGetCall<'a, C> {
1510        ProjectLocationInstanceGetCall {
1511            hub: self.hub,
1512            _name: name.to_string(),
1513            _delegate: Default::default(),
1514            _additional_params: Default::default(),
1515            _scopes: Default::default(),
1516        }
1517    }
1518
1519    /// Create a builder to help you perform the following task:
1520    ///
1521    /// Lists all instances in a project for either a specified location or for all locations.
1522    ///
1523    /// # Arguments
1524    ///
1525    /// * `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.
1526    pub fn locations_instances_list(&self, parent: &str) -> ProjectLocationInstanceListCall<'a, C> {
1527        ProjectLocationInstanceListCall {
1528            hub: self.hub,
1529            _parent: parent.to_string(),
1530            _page_token: Default::default(),
1531            _page_size: Default::default(),
1532            _order_by: Default::default(),
1533            _filter: Default::default(),
1534            _delegate: Default::default(),
1535            _additional_params: Default::default(),
1536            _scopes: Default::default(),
1537        }
1538    }
1539
1540    /// Create a builder to help you perform the following task:
1541    ///
1542    /// Updates the settings of a specific instance.
1543    ///
1544    /// # Arguments
1545    ///
1546    /// * `request` - No description provided.
1547    /// * `name` - Output only. The resource name of the instance, in the format `projects/{project_id}/locations/{location_id}/instances/{instance_id}`.
1548    pub fn locations_instances_patch(
1549        &self,
1550        request: Instance,
1551        name: &str,
1552    ) -> ProjectLocationInstancePatchCall<'a, C> {
1553        ProjectLocationInstancePatchCall {
1554            hub: self.hub,
1555            _request: request,
1556            _name: name.to_string(),
1557            _update_mask: Default::default(),
1558            _delegate: Default::default(),
1559            _additional_params: Default::default(),
1560            _scopes: Default::default(),
1561        }
1562    }
1563
1564    /// Create a builder to help you perform the following task:
1565    ///
1566    /// Pause the standby instance (replica). WARNING: This operation makes the standby instance's NFS filesystem writable. Any data written to the standby instance while paused will be lost when the replica is resumed or promoted.
1567    ///
1568    /// # Arguments
1569    ///
1570    /// * `request` - No description provided.
1571    /// * `name` - Required. The resource name of the instance, in the format `projects/{project_id}/locations/{location_id}/instances/{instance_id}`.
1572    pub fn locations_instances_pause_replica(
1573        &self,
1574        request: PauseReplicaRequest,
1575        name: &str,
1576    ) -> ProjectLocationInstancePauseReplicaCall<'a, C> {
1577        ProjectLocationInstancePauseReplicaCall {
1578            hub: self.hub,
1579            _request: request,
1580            _name: name.to_string(),
1581            _delegate: Default::default(),
1582            _additional_params: Default::default(),
1583            _scopes: Default::default(),
1584        }
1585    }
1586
1587    /// Create a builder to help you perform the following task:
1588    ///
1589    /// Promote the standby instance (replica).
1590    ///
1591    /// # Arguments
1592    ///
1593    /// * `request` - No description provided.
1594    /// * `name` - Required. The resource name of the instance, in the format `projects/{project_id}/locations/{location_id}/instances/{instance_id}`.
1595    pub fn locations_instances_promote_replica(
1596        &self,
1597        request: PromoteReplicaRequest,
1598        name: &str,
1599    ) -> ProjectLocationInstancePromoteReplicaCall<'a, C> {
1600        ProjectLocationInstancePromoteReplicaCall {
1601            hub: self.hub,
1602            _request: request,
1603            _name: name.to_string(),
1604            _delegate: Default::default(),
1605            _additional_params: Default::default(),
1606            _scopes: Default::default(),
1607        }
1608    }
1609
1610    /// Create a builder to help you perform the following task:
1611    ///
1612    /// 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).
1613    ///
1614    /// # Arguments
1615    ///
1616    /// * `request` - No description provided.
1617    /// * `name` - Required. The resource name of the instance, in the format `projects/{project_id}/locations/{location_id}/instances/{instance_id}`.
1618    pub fn locations_instances_restore(
1619        &self,
1620        request: RestoreInstanceRequest,
1621        name: &str,
1622    ) -> ProjectLocationInstanceRestoreCall<'a, C> {
1623        ProjectLocationInstanceRestoreCall {
1624            hub: self.hub,
1625            _request: request,
1626            _name: name.to_string(),
1627            _delegate: Default::default(),
1628            _additional_params: Default::default(),
1629            _scopes: Default::default(),
1630        }
1631    }
1632
1633    /// Create a builder to help you perform the following task:
1634    ///
1635    /// Resume the standby instance (replica). WARNING: Any data written to the standby instance while paused will be lost when the replica is resumed.
1636    ///
1637    /// # Arguments
1638    ///
1639    /// * `request` - No description provided.
1640    /// * `name` - Required. The resource name of the instance, in the format `projects/{project_id}/locations/{location_id}/instances/{instance_id}`.
1641    pub fn locations_instances_resume_replica(
1642        &self,
1643        request: ResumeReplicaRequest,
1644        name: &str,
1645    ) -> ProjectLocationInstanceResumeReplicaCall<'a, C> {
1646        ProjectLocationInstanceResumeReplicaCall {
1647            hub: self.hub,
1648            _request: request,
1649            _name: name.to_string(),
1650            _delegate: Default::default(),
1651            _additional_params: Default::default(),
1652            _scopes: Default::default(),
1653        }
1654    }
1655
1656    /// Create a builder to help you perform the following task:
1657    ///
1658    /// Revert an existing instance's file system to a specified snapshot.
1659    ///
1660    /// # Arguments
1661    ///
1662    /// * `request` - No description provided.
1663    /// * `name` - Required. The resource name of the instance, in the format `projects/{project_id}/locations/{location_id}/instances/{instance_id}`.
1664    pub fn locations_instances_revert(
1665        &self,
1666        request: RevertInstanceRequest,
1667        name: &str,
1668    ) -> ProjectLocationInstanceRevertCall<'a, C> {
1669        ProjectLocationInstanceRevertCall {
1670            hub: self.hub,
1671            _request: request,
1672            _name: name.to_string(),
1673            _delegate: Default::default(),
1674            _additional_params: Default::default(),
1675            _scopes: Default::default(),
1676        }
1677    }
1678
1679    /// Create a builder to help you perform the following task:
1680    ///
1681    /// 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`.
1682    ///
1683    /// # Arguments
1684    ///
1685    /// * `request` - No description provided.
1686    /// * `name` - The name of the operation resource to be cancelled.
1687    pub fn locations_operations_cancel(
1688        &self,
1689        request: CancelOperationRequest,
1690        name: &str,
1691    ) -> ProjectLocationOperationCancelCall<'a, C> {
1692        ProjectLocationOperationCancelCall {
1693            hub: self.hub,
1694            _request: request,
1695            _name: name.to_string(),
1696            _delegate: Default::default(),
1697            _additional_params: Default::default(),
1698            _scopes: Default::default(),
1699        }
1700    }
1701
1702    /// Create a builder to help you perform the following task:
1703    ///
1704    /// 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`.
1705    ///
1706    /// # Arguments
1707    ///
1708    /// * `name` - The name of the operation resource to be deleted.
1709    pub fn locations_operations_delete(
1710        &self,
1711        name: &str,
1712    ) -> ProjectLocationOperationDeleteCall<'a, C> {
1713        ProjectLocationOperationDeleteCall {
1714            hub: self.hub,
1715            _name: name.to_string(),
1716            _delegate: Default::default(),
1717            _additional_params: Default::default(),
1718            _scopes: Default::default(),
1719        }
1720    }
1721
1722    /// Create a builder to help you perform the following task:
1723    ///
1724    /// 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.
1725    ///
1726    /// # Arguments
1727    ///
1728    /// * `name` - The name of the operation resource.
1729    pub fn locations_operations_get(&self, name: &str) -> ProjectLocationOperationGetCall<'a, C> {
1730        ProjectLocationOperationGetCall {
1731            hub: self.hub,
1732            _name: name.to_string(),
1733            _delegate: Default::default(),
1734            _additional_params: Default::default(),
1735            _scopes: Default::default(),
1736        }
1737    }
1738
1739    /// Create a builder to help you perform the following task:
1740    ///
1741    /// Lists operations that match the specified filter in the request. If the server doesn't support this method, it returns `UNIMPLEMENTED`.
1742    ///
1743    /// # Arguments
1744    ///
1745    /// * `name` - The name of the operation's parent resource.
1746    pub fn locations_operations_list(&self, name: &str) -> ProjectLocationOperationListCall<'a, C> {
1747        ProjectLocationOperationListCall {
1748            hub: self.hub,
1749            _name: name.to_string(),
1750            _return_partial_success: Default::default(),
1751            _page_token: Default::default(),
1752            _page_size: Default::default(),
1753            _filter: Default::default(),
1754            _delegate: Default::default(),
1755            _additional_params: Default::default(),
1756            _scopes: Default::default(),
1757        }
1758    }
1759
1760    /// Create a builder to help you perform the following task:
1761    ///
1762    /// Gets information about a location.
1763    ///
1764    /// # Arguments
1765    ///
1766    /// * `name` - Resource name for the location.
1767    pub fn locations_get(&self, name: &str) -> ProjectLocationGetCall<'a, C> {
1768        ProjectLocationGetCall {
1769            hub: self.hub,
1770            _name: name.to_string(),
1771            _delegate: Default::default(),
1772            _additional_params: Default::default(),
1773            _scopes: Default::default(),
1774        }
1775    }
1776
1777    /// Create a builder to help you perform the following task:
1778    ///
1779    /// Lists information about the supported locations for this service.
1780    ///
1781    /// # Arguments
1782    ///
1783    /// * `name` - The resource that owns the locations collection, if applicable.
1784    pub fn locations_list(&self, name: &str) -> ProjectLocationListCall<'a, C> {
1785        ProjectLocationListCall {
1786            hub: self.hub,
1787            _name: name.to_string(),
1788            _page_token: Default::default(),
1789            _page_size: Default::default(),
1790            _filter: Default::default(),
1791            _extra_location_types: Default::default(),
1792            _delegate: Default::default(),
1793            _additional_params: Default::default(),
1794            _scopes: Default::default(),
1795        }
1796    }
1797}
1798
1799// ###################
1800// CallBuilders   ###
1801// #################
1802
1803/// Creates a backup.
1804///
1805/// A builder for the *locations.backups.create* method supported by a *project* resource.
1806/// It is not used directly, but through a [`ProjectMethods`] instance.
1807///
1808/// # Example
1809///
1810/// Instantiate a resource method builder
1811///
1812/// ```test_harness,no_run
1813/// # extern crate hyper;
1814/// # extern crate hyper_rustls;
1815/// # extern crate google_file1_beta1 as file1_beta1;
1816/// use file1_beta1::api::Backup;
1817/// # async fn dox() {
1818/// # use file1_beta1::{CloudFilestore, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
1819///
1820/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
1821/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
1822/// #     .with_native_roots()
1823/// #     .unwrap()
1824/// #     .https_only()
1825/// #     .enable_http2()
1826/// #     .build();
1827///
1828/// # let executor = hyper_util::rt::TokioExecutor::new();
1829/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
1830/// #     secret,
1831/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
1832/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
1833/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
1834/// #     ),
1835/// # ).build().await.unwrap();
1836///
1837/// # let client = hyper_util::client::legacy::Client::builder(
1838/// #     hyper_util::rt::TokioExecutor::new()
1839/// # )
1840/// # .build(
1841/// #     hyper_rustls::HttpsConnectorBuilder::new()
1842/// #         .with_native_roots()
1843/// #         .unwrap()
1844/// #         .https_or_http()
1845/// #         .enable_http2()
1846/// #         .build()
1847/// # );
1848/// # let mut hub = CloudFilestore::new(client, auth);
1849/// // As the method needs a request, you would usually fill it with the desired information
1850/// // into the respective structure. Some of the parts shown here might not be applicable !
1851/// // Values shown here are possibly random and not representative !
1852/// let mut req = Backup::default();
1853///
1854/// // You can configure optional parameters by calling the respective setters at will, and
1855/// // execute the final call using `doit()`.
1856/// // Values shown here are possibly random and not representative !
1857/// let result = hub.projects().locations_backups_create(req, "parent")
1858///              .backup_id("sed")
1859///              .doit().await;
1860/// # }
1861/// ```
1862pub struct ProjectLocationBackupCreateCall<'a, C>
1863where
1864    C: 'a,
1865{
1866    hub: &'a CloudFilestore<C>,
1867    _request: Backup,
1868    _parent: String,
1869    _backup_id: Option<String>,
1870    _delegate: Option<&'a mut dyn common::Delegate>,
1871    _additional_params: HashMap<String, String>,
1872    _scopes: BTreeSet<String>,
1873}
1874
1875impl<'a, C> common::CallBuilder for ProjectLocationBackupCreateCall<'a, C> {}
1876
1877impl<'a, C> ProjectLocationBackupCreateCall<'a, C>
1878where
1879    C: common::Connector,
1880{
1881    /// Perform the operation you have build so far.
1882    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
1883        use std::borrow::Cow;
1884        use std::io::{Read, Seek};
1885
1886        use common::{url::Params, ToParts};
1887        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
1888
1889        let mut dd = common::DefaultDelegate;
1890        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
1891        dlg.begin(common::MethodInfo {
1892            id: "file.projects.locations.backups.create",
1893            http_method: hyper::Method::POST,
1894        });
1895
1896        for &field in ["alt", "parent", "backupId"].iter() {
1897            if self._additional_params.contains_key(field) {
1898                dlg.finished(false);
1899                return Err(common::Error::FieldClash(field));
1900            }
1901        }
1902
1903        let mut params = Params::with_capacity(5 + self._additional_params.len());
1904        params.push("parent", self._parent);
1905        if let Some(value) = self._backup_id.as_ref() {
1906            params.push("backupId", value);
1907        }
1908
1909        params.extend(self._additional_params.iter());
1910
1911        params.push("alt", "json");
1912        let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/backups";
1913        if self._scopes.is_empty() {
1914            self._scopes
1915                .insert(Scope::CloudPlatform.as_ref().to_string());
1916        }
1917
1918        #[allow(clippy::single_element_loop)]
1919        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
1920            url = params.uri_replacement(url, param_name, find_this, true);
1921        }
1922        {
1923            let to_remove = ["parent"];
1924            params.remove_params(&to_remove);
1925        }
1926
1927        let url = params.parse_with_url(&url);
1928
1929        let mut json_mime_type = mime::APPLICATION_JSON;
1930        let mut request_value_reader = {
1931            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
1932            common::remove_json_null_values(&mut value);
1933            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
1934            serde_json::to_writer(&mut dst, &value).unwrap();
1935            dst
1936        };
1937        let request_size = request_value_reader
1938            .seek(std::io::SeekFrom::End(0))
1939            .unwrap();
1940        request_value_reader
1941            .seek(std::io::SeekFrom::Start(0))
1942            .unwrap();
1943
1944        loop {
1945            let token = match self
1946                .hub
1947                .auth
1948                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
1949                .await
1950            {
1951                Ok(token) => token,
1952                Err(e) => match dlg.token(e) {
1953                    Ok(token) => token,
1954                    Err(e) => {
1955                        dlg.finished(false);
1956                        return Err(common::Error::MissingToken(e));
1957                    }
1958                },
1959            };
1960            request_value_reader
1961                .seek(std::io::SeekFrom::Start(0))
1962                .unwrap();
1963            let mut req_result = {
1964                let client = &self.hub.client;
1965                dlg.pre_request();
1966                let mut req_builder = hyper::Request::builder()
1967                    .method(hyper::Method::POST)
1968                    .uri(url.as_str())
1969                    .header(USER_AGENT, self.hub._user_agent.clone());
1970
1971                if let Some(token) = token.as_ref() {
1972                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
1973                }
1974
1975                let request = req_builder
1976                    .header(CONTENT_TYPE, json_mime_type.to_string())
1977                    .header(CONTENT_LENGTH, request_size as u64)
1978                    .body(common::to_body(
1979                        request_value_reader.get_ref().clone().into(),
1980                    ));
1981
1982                client.request(request.unwrap()).await
1983            };
1984
1985            match req_result {
1986                Err(err) => {
1987                    if let common::Retry::After(d) = dlg.http_error(&err) {
1988                        sleep(d).await;
1989                        continue;
1990                    }
1991                    dlg.finished(false);
1992                    return Err(common::Error::HttpError(err));
1993                }
1994                Ok(res) => {
1995                    let (mut parts, body) = res.into_parts();
1996                    let mut body = common::Body::new(body);
1997                    if !parts.status.is_success() {
1998                        let bytes = common::to_bytes(body).await.unwrap_or_default();
1999                        let error = serde_json::from_str(&common::to_string(&bytes));
2000                        let response = common::to_response(parts, bytes.into());
2001
2002                        if let common::Retry::After(d) =
2003                            dlg.http_failure(&response, error.as_ref().ok())
2004                        {
2005                            sleep(d).await;
2006                            continue;
2007                        }
2008
2009                        dlg.finished(false);
2010
2011                        return Err(match error {
2012                            Ok(value) => common::Error::BadRequest(value),
2013                            _ => common::Error::Failure(response),
2014                        });
2015                    }
2016                    let response = {
2017                        let bytes = common::to_bytes(body).await.unwrap_or_default();
2018                        let encoded = common::to_string(&bytes);
2019                        match serde_json::from_str(&encoded) {
2020                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
2021                            Err(error) => {
2022                                dlg.response_json_decode_error(&encoded, &error);
2023                                return Err(common::Error::JsonDecodeError(
2024                                    encoded.to_string(),
2025                                    error,
2026                                ));
2027                            }
2028                        }
2029                    };
2030
2031                    dlg.finished(true);
2032                    return Ok(response);
2033                }
2034            }
2035        }
2036    }
2037
2038    ///
2039    /// Sets the *request* property to the given value.
2040    ///
2041    /// Even though the property as already been set when instantiating this call,
2042    /// we provide this method for API completeness.
2043    pub fn request(mut self, new_value: Backup) -> ProjectLocationBackupCreateCall<'a, C> {
2044        self._request = new_value;
2045        self
2046    }
2047    /// 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**.
2048    ///
2049    /// Sets the *parent* path property to the given value.
2050    ///
2051    /// Even though the property as already been set when instantiating this call,
2052    /// we provide this method for API completeness.
2053    pub fn parent(mut self, new_value: &str) -> ProjectLocationBackupCreateCall<'a, C> {
2054        self._parent = new_value.to_string();
2055        self
2056    }
2057    /// 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.
2058    ///
2059    /// Sets the *backup id* query property to the given value.
2060    pub fn backup_id(mut self, new_value: &str) -> ProjectLocationBackupCreateCall<'a, C> {
2061        self._backup_id = Some(new_value.to_string());
2062        self
2063    }
2064    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
2065    /// while executing the actual API request.
2066    ///
2067    /// ````text
2068    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
2069    /// ````
2070    ///
2071    /// Sets the *delegate* property to the given value.
2072    pub fn delegate(
2073        mut self,
2074        new_value: &'a mut dyn common::Delegate,
2075    ) -> ProjectLocationBackupCreateCall<'a, C> {
2076        self._delegate = Some(new_value);
2077        self
2078    }
2079
2080    /// Set any additional parameter of the query string used in the request.
2081    /// It should be used to set parameters which are not yet available through their own
2082    /// setters.
2083    ///
2084    /// Please note that this method must not be used to set any of the known parameters
2085    /// which have their own setter method. If done anyway, the request will fail.
2086    ///
2087    /// # Additional Parameters
2088    ///
2089    /// * *$.xgafv* (query-string) - V1 error format.
2090    /// * *access_token* (query-string) - OAuth access token.
2091    /// * *alt* (query-string) - Data format for response.
2092    /// * *callback* (query-string) - JSONP
2093    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
2094    /// * *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.
2095    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
2096    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
2097    /// * *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.
2098    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
2099    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
2100    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationBackupCreateCall<'a, C>
2101    where
2102        T: AsRef<str>,
2103    {
2104        self._additional_params
2105            .insert(name.as_ref().to_string(), value.as_ref().to_string());
2106        self
2107    }
2108
2109    /// Identifies the authorization scope for the method you are building.
2110    ///
2111    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
2112    /// [`Scope::CloudPlatform`].
2113    ///
2114    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
2115    /// tokens for more than one scope.
2116    ///
2117    /// Usually there is more than one suitable scope to authorize an operation, some of which may
2118    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
2119    /// sufficient, a read-write scope will do as well.
2120    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationBackupCreateCall<'a, C>
2121    where
2122        St: AsRef<str>,
2123    {
2124        self._scopes.insert(String::from(scope.as_ref()));
2125        self
2126    }
2127    /// Identifies the authorization scope(s) for the method you are building.
2128    ///
2129    /// See [`Self::add_scope()`] for details.
2130    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationBackupCreateCall<'a, C>
2131    where
2132        I: IntoIterator<Item = St>,
2133        St: AsRef<str>,
2134    {
2135        self._scopes
2136            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
2137        self
2138    }
2139
2140    /// Removes all scopes, and no default scope will be used either.
2141    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
2142    /// for details).
2143    pub fn clear_scopes(mut self) -> ProjectLocationBackupCreateCall<'a, C> {
2144        self._scopes.clear();
2145        self
2146    }
2147}
2148
2149/// Deletes a backup.
2150///
2151/// A builder for the *locations.backups.delete* method supported by a *project* resource.
2152/// It is not used directly, but through a [`ProjectMethods`] instance.
2153///
2154/// # Example
2155///
2156/// Instantiate a resource method builder
2157///
2158/// ```test_harness,no_run
2159/// # extern crate hyper;
2160/// # extern crate hyper_rustls;
2161/// # extern crate google_file1_beta1 as file1_beta1;
2162/// # async fn dox() {
2163/// # use file1_beta1::{CloudFilestore, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2164///
2165/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
2166/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
2167/// #     .with_native_roots()
2168/// #     .unwrap()
2169/// #     .https_only()
2170/// #     .enable_http2()
2171/// #     .build();
2172///
2173/// # let executor = hyper_util::rt::TokioExecutor::new();
2174/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
2175/// #     secret,
2176/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2177/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
2178/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
2179/// #     ),
2180/// # ).build().await.unwrap();
2181///
2182/// # let client = hyper_util::client::legacy::Client::builder(
2183/// #     hyper_util::rt::TokioExecutor::new()
2184/// # )
2185/// # .build(
2186/// #     hyper_rustls::HttpsConnectorBuilder::new()
2187/// #         .with_native_roots()
2188/// #         .unwrap()
2189/// #         .https_or_http()
2190/// #         .enable_http2()
2191/// #         .build()
2192/// # );
2193/// # let mut hub = CloudFilestore::new(client, auth);
2194/// // You can configure optional parameters by calling the respective setters at will, and
2195/// // execute the final call using `doit()`.
2196/// // Values shown here are possibly random and not representative !
2197/// let result = hub.projects().locations_backups_delete("name")
2198///              .doit().await;
2199/// # }
2200/// ```
2201pub struct ProjectLocationBackupDeleteCall<'a, C>
2202where
2203    C: 'a,
2204{
2205    hub: &'a CloudFilestore<C>,
2206    _name: String,
2207    _delegate: Option<&'a mut dyn common::Delegate>,
2208    _additional_params: HashMap<String, String>,
2209    _scopes: BTreeSet<String>,
2210}
2211
2212impl<'a, C> common::CallBuilder for ProjectLocationBackupDeleteCall<'a, C> {}
2213
2214impl<'a, C> ProjectLocationBackupDeleteCall<'a, C>
2215where
2216    C: common::Connector,
2217{
2218    /// Perform the operation you have build so far.
2219    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
2220        use std::borrow::Cow;
2221        use std::io::{Read, Seek};
2222
2223        use common::{url::Params, ToParts};
2224        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
2225
2226        let mut dd = common::DefaultDelegate;
2227        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
2228        dlg.begin(common::MethodInfo {
2229            id: "file.projects.locations.backups.delete",
2230            http_method: hyper::Method::DELETE,
2231        });
2232
2233        for &field in ["alt", "name"].iter() {
2234            if self._additional_params.contains_key(field) {
2235                dlg.finished(false);
2236                return Err(common::Error::FieldClash(field));
2237            }
2238        }
2239
2240        let mut params = Params::with_capacity(3 + self._additional_params.len());
2241        params.push("name", self._name);
2242
2243        params.extend(self._additional_params.iter());
2244
2245        params.push("alt", "json");
2246        let mut url = self.hub._base_url.clone() + "v1beta1/{+name}";
2247        if self._scopes.is_empty() {
2248            self._scopes
2249                .insert(Scope::CloudPlatform.as_ref().to_string());
2250        }
2251
2252        #[allow(clippy::single_element_loop)]
2253        for &(find_this, param_name) in [("{+name}", "name")].iter() {
2254            url = params.uri_replacement(url, param_name, find_this, true);
2255        }
2256        {
2257            let to_remove = ["name"];
2258            params.remove_params(&to_remove);
2259        }
2260
2261        let url = params.parse_with_url(&url);
2262
2263        loop {
2264            let token = match self
2265                .hub
2266                .auth
2267                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
2268                .await
2269            {
2270                Ok(token) => token,
2271                Err(e) => match dlg.token(e) {
2272                    Ok(token) => token,
2273                    Err(e) => {
2274                        dlg.finished(false);
2275                        return Err(common::Error::MissingToken(e));
2276                    }
2277                },
2278            };
2279            let mut req_result = {
2280                let client = &self.hub.client;
2281                dlg.pre_request();
2282                let mut req_builder = hyper::Request::builder()
2283                    .method(hyper::Method::DELETE)
2284                    .uri(url.as_str())
2285                    .header(USER_AGENT, self.hub._user_agent.clone());
2286
2287                if let Some(token) = token.as_ref() {
2288                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
2289                }
2290
2291                let request = req_builder
2292                    .header(CONTENT_LENGTH, 0_u64)
2293                    .body(common::to_body::<String>(None));
2294
2295                client.request(request.unwrap()).await
2296            };
2297
2298            match req_result {
2299                Err(err) => {
2300                    if let common::Retry::After(d) = dlg.http_error(&err) {
2301                        sleep(d).await;
2302                        continue;
2303                    }
2304                    dlg.finished(false);
2305                    return Err(common::Error::HttpError(err));
2306                }
2307                Ok(res) => {
2308                    let (mut parts, body) = res.into_parts();
2309                    let mut body = common::Body::new(body);
2310                    if !parts.status.is_success() {
2311                        let bytes = common::to_bytes(body).await.unwrap_or_default();
2312                        let error = serde_json::from_str(&common::to_string(&bytes));
2313                        let response = common::to_response(parts, bytes.into());
2314
2315                        if let common::Retry::After(d) =
2316                            dlg.http_failure(&response, error.as_ref().ok())
2317                        {
2318                            sleep(d).await;
2319                            continue;
2320                        }
2321
2322                        dlg.finished(false);
2323
2324                        return Err(match error {
2325                            Ok(value) => common::Error::BadRequest(value),
2326                            _ => common::Error::Failure(response),
2327                        });
2328                    }
2329                    let response = {
2330                        let bytes = common::to_bytes(body).await.unwrap_or_default();
2331                        let encoded = common::to_string(&bytes);
2332                        match serde_json::from_str(&encoded) {
2333                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
2334                            Err(error) => {
2335                                dlg.response_json_decode_error(&encoded, &error);
2336                                return Err(common::Error::JsonDecodeError(
2337                                    encoded.to_string(),
2338                                    error,
2339                                ));
2340                            }
2341                        }
2342                    };
2343
2344                    dlg.finished(true);
2345                    return Ok(response);
2346                }
2347            }
2348        }
2349    }
2350
2351    /// Required. The backup resource name, in the format `projects/{project_id}/locations/{location}/backups/{backup_id}`
2352    ///
2353    /// Sets the *name* path property to the given value.
2354    ///
2355    /// Even though the property as already been set when instantiating this call,
2356    /// we provide this method for API completeness.
2357    pub fn name(mut self, new_value: &str) -> ProjectLocationBackupDeleteCall<'a, C> {
2358        self._name = new_value.to_string();
2359        self
2360    }
2361    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
2362    /// while executing the actual API request.
2363    ///
2364    /// ````text
2365    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
2366    /// ````
2367    ///
2368    /// Sets the *delegate* property to the given value.
2369    pub fn delegate(
2370        mut self,
2371        new_value: &'a mut dyn common::Delegate,
2372    ) -> ProjectLocationBackupDeleteCall<'a, C> {
2373        self._delegate = Some(new_value);
2374        self
2375    }
2376
2377    /// Set any additional parameter of the query string used in the request.
2378    /// It should be used to set parameters which are not yet available through their own
2379    /// setters.
2380    ///
2381    /// Please note that this method must not be used to set any of the known parameters
2382    /// which have their own setter method. If done anyway, the request will fail.
2383    ///
2384    /// # Additional Parameters
2385    ///
2386    /// * *$.xgafv* (query-string) - V1 error format.
2387    /// * *access_token* (query-string) - OAuth access token.
2388    /// * *alt* (query-string) - Data format for response.
2389    /// * *callback* (query-string) - JSONP
2390    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
2391    /// * *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.
2392    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
2393    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
2394    /// * *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.
2395    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
2396    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
2397    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationBackupDeleteCall<'a, C>
2398    where
2399        T: AsRef<str>,
2400    {
2401        self._additional_params
2402            .insert(name.as_ref().to_string(), value.as_ref().to_string());
2403        self
2404    }
2405
2406    /// Identifies the authorization scope for the method you are building.
2407    ///
2408    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
2409    /// [`Scope::CloudPlatform`].
2410    ///
2411    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
2412    /// tokens for more than one scope.
2413    ///
2414    /// Usually there is more than one suitable scope to authorize an operation, some of which may
2415    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
2416    /// sufficient, a read-write scope will do as well.
2417    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationBackupDeleteCall<'a, C>
2418    where
2419        St: AsRef<str>,
2420    {
2421        self._scopes.insert(String::from(scope.as_ref()));
2422        self
2423    }
2424    /// Identifies the authorization scope(s) for the method you are building.
2425    ///
2426    /// See [`Self::add_scope()`] for details.
2427    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationBackupDeleteCall<'a, C>
2428    where
2429        I: IntoIterator<Item = St>,
2430        St: AsRef<str>,
2431    {
2432        self._scopes
2433            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
2434        self
2435    }
2436
2437    /// Removes all scopes, and no default scope will be used either.
2438    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
2439    /// for details).
2440    pub fn clear_scopes(mut self) -> ProjectLocationBackupDeleteCall<'a, C> {
2441        self._scopes.clear();
2442        self
2443    }
2444}
2445
2446/// Gets the details of a specific backup.
2447///
2448/// A builder for the *locations.backups.get* method supported by a *project* resource.
2449/// It is not used directly, but through a [`ProjectMethods`] instance.
2450///
2451/// # Example
2452///
2453/// Instantiate a resource method builder
2454///
2455/// ```test_harness,no_run
2456/// # extern crate hyper;
2457/// # extern crate hyper_rustls;
2458/// # extern crate google_file1_beta1 as file1_beta1;
2459/// # async fn dox() {
2460/// # use file1_beta1::{CloudFilestore, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2461///
2462/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
2463/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
2464/// #     .with_native_roots()
2465/// #     .unwrap()
2466/// #     .https_only()
2467/// #     .enable_http2()
2468/// #     .build();
2469///
2470/// # let executor = hyper_util::rt::TokioExecutor::new();
2471/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
2472/// #     secret,
2473/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2474/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
2475/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
2476/// #     ),
2477/// # ).build().await.unwrap();
2478///
2479/// # let client = hyper_util::client::legacy::Client::builder(
2480/// #     hyper_util::rt::TokioExecutor::new()
2481/// # )
2482/// # .build(
2483/// #     hyper_rustls::HttpsConnectorBuilder::new()
2484/// #         .with_native_roots()
2485/// #         .unwrap()
2486/// #         .https_or_http()
2487/// #         .enable_http2()
2488/// #         .build()
2489/// # );
2490/// # let mut hub = CloudFilestore::new(client, auth);
2491/// // You can configure optional parameters by calling the respective setters at will, and
2492/// // execute the final call using `doit()`.
2493/// // Values shown here are possibly random and not representative !
2494/// let result = hub.projects().locations_backups_get("name")
2495///              .doit().await;
2496/// # }
2497/// ```
2498pub struct ProjectLocationBackupGetCall<'a, C>
2499where
2500    C: 'a,
2501{
2502    hub: &'a CloudFilestore<C>,
2503    _name: String,
2504    _delegate: Option<&'a mut dyn common::Delegate>,
2505    _additional_params: HashMap<String, String>,
2506    _scopes: BTreeSet<String>,
2507}
2508
2509impl<'a, C> common::CallBuilder for ProjectLocationBackupGetCall<'a, C> {}
2510
2511impl<'a, C> ProjectLocationBackupGetCall<'a, C>
2512where
2513    C: common::Connector,
2514{
2515    /// Perform the operation you have build so far.
2516    pub async fn doit(mut self) -> common::Result<(common::Response, Backup)> {
2517        use std::borrow::Cow;
2518        use std::io::{Read, Seek};
2519
2520        use common::{url::Params, ToParts};
2521        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
2522
2523        let mut dd = common::DefaultDelegate;
2524        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
2525        dlg.begin(common::MethodInfo {
2526            id: "file.projects.locations.backups.get",
2527            http_method: hyper::Method::GET,
2528        });
2529
2530        for &field in ["alt", "name"].iter() {
2531            if self._additional_params.contains_key(field) {
2532                dlg.finished(false);
2533                return Err(common::Error::FieldClash(field));
2534            }
2535        }
2536
2537        let mut params = Params::with_capacity(3 + self._additional_params.len());
2538        params.push("name", self._name);
2539
2540        params.extend(self._additional_params.iter());
2541
2542        params.push("alt", "json");
2543        let mut url = self.hub._base_url.clone() + "v1beta1/{+name}";
2544        if self._scopes.is_empty() {
2545            self._scopes
2546                .insert(Scope::CloudPlatform.as_ref().to_string());
2547        }
2548
2549        #[allow(clippy::single_element_loop)]
2550        for &(find_this, param_name) in [("{+name}", "name")].iter() {
2551            url = params.uri_replacement(url, param_name, find_this, true);
2552        }
2553        {
2554            let to_remove = ["name"];
2555            params.remove_params(&to_remove);
2556        }
2557
2558        let url = params.parse_with_url(&url);
2559
2560        loop {
2561            let token = match self
2562                .hub
2563                .auth
2564                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
2565                .await
2566            {
2567                Ok(token) => token,
2568                Err(e) => match dlg.token(e) {
2569                    Ok(token) => token,
2570                    Err(e) => {
2571                        dlg.finished(false);
2572                        return Err(common::Error::MissingToken(e));
2573                    }
2574                },
2575            };
2576            let mut req_result = {
2577                let client = &self.hub.client;
2578                dlg.pre_request();
2579                let mut req_builder = hyper::Request::builder()
2580                    .method(hyper::Method::GET)
2581                    .uri(url.as_str())
2582                    .header(USER_AGENT, self.hub._user_agent.clone());
2583
2584                if let Some(token) = token.as_ref() {
2585                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
2586                }
2587
2588                let request = req_builder
2589                    .header(CONTENT_LENGTH, 0_u64)
2590                    .body(common::to_body::<String>(None));
2591
2592                client.request(request.unwrap()).await
2593            };
2594
2595            match req_result {
2596                Err(err) => {
2597                    if let common::Retry::After(d) = dlg.http_error(&err) {
2598                        sleep(d).await;
2599                        continue;
2600                    }
2601                    dlg.finished(false);
2602                    return Err(common::Error::HttpError(err));
2603                }
2604                Ok(res) => {
2605                    let (mut parts, body) = res.into_parts();
2606                    let mut body = common::Body::new(body);
2607                    if !parts.status.is_success() {
2608                        let bytes = common::to_bytes(body).await.unwrap_or_default();
2609                        let error = serde_json::from_str(&common::to_string(&bytes));
2610                        let response = common::to_response(parts, bytes.into());
2611
2612                        if let common::Retry::After(d) =
2613                            dlg.http_failure(&response, error.as_ref().ok())
2614                        {
2615                            sleep(d).await;
2616                            continue;
2617                        }
2618
2619                        dlg.finished(false);
2620
2621                        return Err(match error {
2622                            Ok(value) => common::Error::BadRequest(value),
2623                            _ => common::Error::Failure(response),
2624                        });
2625                    }
2626                    let response = {
2627                        let bytes = common::to_bytes(body).await.unwrap_or_default();
2628                        let encoded = common::to_string(&bytes);
2629                        match serde_json::from_str(&encoded) {
2630                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
2631                            Err(error) => {
2632                                dlg.response_json_decode_error(&encoded, &error);
2633                                return Err(common::Error::JsonDecodeError(
2634                                    encoded.to_string(),
2635                                    error,
2636                                ));
2637                            }
2638                        }
2639                    };
2640
2641                    dlg.finished(true);
2642                    return Ok(response);
2643                }
2644            }
2645        }
2646    }
2647
2648    /// Required. The backup resource name, in the format `projects/{project_id}/locations/{location}/backups/{backup_id}`.
2649    ///
2650    /// Sets the *name* path property to the given value.
2651    ///
2652    /// Even though the property as already been set when instantiating this call,
2653    /// we provide this method for API completeness.
2654    pub fn name(mut self, new_value: &str) -> ProjectLocationBackupGetCall<'a, C> {
2655        self._name = new_value.to_string();
2656        self
2657    }
2658    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
2659    /// while executing the actual API request.
2660    ///
2661    /// ````text
2662    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
2663    /// ````
2664    ///
2665    /// Sets the *delegate* property to the given value.
2666    pub fn delegate(
2667        mut self,
2668        new_value: &'a mut dyn common::Delegate,
2669    ) -> ProjectLocationBackupGetCall<'a, C> {
2670        self._delegate = Some(new_value);
2671        self
2672    }
2673
2674    /// Set any additional parameter of the query string used in the request.
2675    /// It should be used to set parameters which are not yet available through their own
2676    /// setters.
2677    ///
2678    /// Please note that this method must not be used to set any of the known parameters
2679    /// which have their own setter method. If done anyway, the request will fail.
2680    ///
2681    /// # Additional Parameters
2682    ///
2683    /// * *$.xgafv* (query-string) - V1 error format.
2684    /// * *access_token* (query-string) - OAuth access token.
2685    /// * *alt* (query-string) - Data format for response.
2686    /// * *callback* (query-string) - JSONP
2687    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
2688    /// * *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.
2689    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
2690    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
2691    /// * *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.
2692    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
2693    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
2694    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationBackupGetCall<'a, C>
2695    where
2696        T: AsRef<str>,
2697    {
2698        self._additional_params
2699            .insert(name.as_ref().to_string(), value.as_ref().to_string());
2700        self
2701    }
2702
2703    /// Identifies the authorization scope for the method you are building.
2704    ///
2705    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
2706    /// [`Scope::CloudPlatform`].
2707    ///
2708    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
2709    /// tokens for more than one scope.
2710    ///
2711    /// Usually there is more than one suitable scope to authorize an operation, some of which may
2712    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
2713    /// sufficient, a read-write scope will do as well.
2714    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationBackupGetCall<'a, C>
2715    where
2716        St: AsRef<str>,
2717    {
2718        self._scopes.insert(String::from(scope.as_ref()));
2719        self
2720    }
2721    /// Identifies the authorization scope(s) for the method you are building.
2722    ///
2723    /// See [`Self::add_scope()`] for details.
2724    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationBackupGetCall<'a, C>
2725    where
2726        I: IntoIterator<Item = St>,
2727        St: AsRef<str>,
2728    {
2729        self._scopes
2730            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
2731        self
2732    }
2733
2734    /// Removes all scopes, and no default scope will be used either.
2735    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
2736    /// for details).
2737    pub fn clear_scopes(mut self) -> ProjectLocationBackupGetCall<'a, C> {
2738        self._scopes.clear();
2739        self
2740    }
2741}
2742
2743/// Lists all backups in a project for either a specified location or for all locations.
2744///
2745/// A builder for the *locations.backups.list* method supported by a *project* resource.
2746/// It is not used directly, but through a [`ProjectMethods`] instance.
2747///
2748/// # Example
2749///
2750/// Instantiate a resource method builder
2751///
2752/// ```test_harness,no_run
2753/// # extern crate hyper;
2754/// # extern crate hyper_rustls;
2755/// # extern crate google_file1_beta1 as file1_beta1;
2756/// # async fn dox() {
2757/// # use file1_beta1::{CloudFilestore, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2758///
2759/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
2760/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
2761/// #     .with_native_roots()
2762/// #     .unwrap()
2763/// #     .https_only()
2764/// #     .enable_http2()
2765/// #     .build();
2766///
2767/// # let executor = hyper_util::rt::TokioExecutor::new();
2768/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
2769/// #     secret,
2770/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2771/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
2772/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
2773/// #     ),
2774/// # ).build().await.unwrap();
2775///
2776/// # let client = hyper_util::client::legacy::Client::builder(
2777/// #     hyper_util::rt::TokioExecutor::new()
2778/// # )
2779/// # .build(
2780/// #     hyper_rustls::HttpsConnectorBuilder::new()
2781/// #         .with_native_roots()
2782/// #         .unwrap()
2783/// #         .https_or_http()
2784/// #         .enable_http2()
2785/// #         .build()
2786/// # );
2787/// # let mut hub = CloudFilestore::new(client, auth);
2788/// // You can configure optional parameters by calling the respective setters at will, and
2789/// // execute the final call using `doit()`.
2790/// // Values shown here are possibly random and not representative !
2791/// let result = hub.projects().locations_backups_list("parent")
2792///              .page_token("duo")
2793///              .page_size(-55)
2794///              .order_by("gubergren")
2795///              .filter("Lorem")
2796///              .doit().await;
2797/// # }
2798/// ```
2799pub struct ProjectLocationBackupListCall<'a, C>
2800where
2801    C: 'a,
2802{
2803    hub: &'a CloudFilestore<C>,
2804    _parent: String,
2805    _page_token: Option<String>,
2806    _page_size: Option<i32>,
2807    _order_by: Option<String>,
2808    _filter: Option<String>,
2809    _delegate: Option<&'a mut dyn common::Delegate>,
2810    _additional_params: HashMap<String, String>,
2811    _scopes: BTreeSet<String>,
2812}
2813
2814impl<'a, C> common::CallBuilder for ProjectLocationBackupListCall<'a, C> {}
2815
2816impl<'a, C> ProjectLocationBackupListCall<'a, C>
2817where
2818    C: common::Connector,
2819{
2820    /// Perform the operation you have build so far.
2821    pub async fn doit(mut self) -> common::Result<(common::Response, ListBackupsResponse)> {
2822        use std::borrow::Cow;
2823        use std::io::{Read, Seek};
2824
2825        use common::{url::Params, ToParts};
2826        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
2827
2828        let mut dd = common::DefaultDelegate;
2829        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
2830        dlg.begin(common::MethodInfo {
2831            id: "file.projects.locations.backups.list",
2832            http_method: hyper::Method::GET,
2833        });
2834
2835        for &field in [
2836            "alt",
2837            "parent",
2838            "pageToken",
2839            "pageSize",
2840            "orderBy",
2841            "filter",
2842        ]
2843        .iter()
2844        {
2845            if self._additional_params.contains_key(field) {
2846                dlg.finished(false);
2847                return Err(common::Error::FieldClash(field));
2848            }
2849        }
2850
2851        let mut params = Params::with_capacity(7 + self._additional_params.len());
2852        params.push("parent", self._parent);
2853        if let Some(value) = self._page_token.as_ref() {
2854            params.push("pageToken", value);
2855        }
2856        if let Some(value) = self._page_size.as_ref() {
2857            params.push("pageSize", value.to_string());
2858        }
2859        if let Some(value) = self._order_by.as_ref() {
2860            params.push("orderBy", value);
2861        }
2862        if let Some(value) = self._filter.as_ref() {
2863            params.push("filter", value);
2864        }
2865
2866        params.extend(self._additional_params.iter());
2867
2868        params.push("alt", "json");
2869        let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/backups";
2870        if self._scopes.is_empty() {
2871            self._scopes
2872                .insert(Scope::CloudPlatform.as_ref().to_string());
2873        }
2874
2875        #[allow(clippy::single_element_loop)]
2876        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
2877            url = params.uri_replacement(url, param_name, find_this, true);
2878        }
2879        {
2880            let to_remove = ["parent"];
2881            params.remove_params(&to_remove);
2882        }
2883
2884        let url = params.parse_with_url(&url);
2885
2886        loop {
2887            let token = match self
2888                .hub
2889                .auth
2890                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
2891                .await
2892            {
2893                Ok(token) => token,
2894                Err(e) => match dlg.token(e) {
2895                    Ok(token) => token,
2896                    Err(e) => {
2897                        dlg.finished(false);
2898                        return Err(common::Error::MissingToken(e));
2899                    }
2900                },
2901            };
2902            let mut req_result = {
2903                let client = &self.hub.client;
2904                dlg.pre_request();
2905                let mut req_builder = hyper::Request::builder()
2906                    .method(hyper::Method::GET)
2907                    .uri(url.as_str())
2908                    .header(USER_AGENT, self.hub._user_agent.clone());
2909
2910                if let Some(token) = token.as_ref() {
2911                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
2912                }
2913
2914                let request = req_builder
2915                    .header(CONTENT_LENGTH, 0_u64)
2916                    .body(common::to_body::<String>(None));
2917
2918                client.request(request.unwrap()).await
2919            };
2920
2921            match req_result {
2922                Err(err) => {
2923                    if let common::Retry::After(d) = dlg.http_error(&err) {
2924                        sleep(d).await;
2925                        continue;
2926                    }
2927                    dlg.finished(false);
2928                    return Err(common::Error::HttpError(err));
2929                }
2930                Ok(res) => {
2931                    let (mut parts, body) = res.into_parts();
2932                    let mut body = common::Body::new(body);
2933                    if !parts.status.is_success() {
2934                        let bytes = common::to_bytes(body).await.unwrap_or_default();
2935                        let error = serde_json::from_str(&common::to_string(&bytes));
2936                        let response = common::to_response(parts, bytes.into());
2937
2938                        if let common::Retry::After(d) =
2939                            dlg.http_failure(&response, error.as_ref().ok())
2940                        {
2941                            sleep(d).await;
2942                            continue;
2943                        }
2944
2945                        dlg.finished(false);
2946
2947                        return Err(match error {
2948                            Ok(value) => common::Error::BadRequest(value),
2949                            _ => common::Error::Failure(response),
2950                        });
2951                    }
2952                    let response = {
2953                        let bytes = common::to_bytes(body).await.unwrap_or_default();
2954                        let encoded = common::to_string(&bytes);
2955                        match serde_json::from_str(&encoded) {
2956                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
2957                            Err(error) => {
2958                                dlg.response_json_decode_error(&encoded, &error);
2959                                return Err(common::Error::JsonDecodeError(
2960                                    encoded.to_string(),
2961                                    error,
2962                                ));
2963                            }
2964                        }
2965                    };
2966
2967                    dlg.finished(true);
2968                    return Ok(response);
2969                }
2970            }
2971        }
2972    }
2973
2974    /// 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.
2975    ///
2976    /// Sets the *parent* path property to the given value.
2977    ///
2978    /// Even though the property as already been set when instantiating this call,
2979    /// we provide this method for API completeness.
2980    pub fn parent(mut self, new_value: &str) -> ProjectLocationBackupListCall<'a, C> {
2981        self._parent = new_value.to_string();
2982        self
2983    }
2984    /// The next_page_token value to use if there are additional results to retrieve for this list request.
2985    ///
2986    /// Sets the *page token* query property to the given value.
2987    pub fn page_token(mut self, new_value: &str) -> ProjectLocationBackupListCall<'a, C> {
2988        self._page_token = Some(new_value.to_string());
2989        self
2990    }
2991    /// The maximum number of items to return.
2992    ///
2993    /// Sets the *page size* query property to the given value.
2994    pub fn page_size(mut self, new_value: i32) -> ProjectLocationBackupListCall<'a, C> {
2995        self._page_size = Some(new_value);
2996        self
2997    }
2998    /// Sort results. Supported values are "name", "name desc" or "" (unsorted).
2999    ///
3000    /// Sets the *order by* query property to the given value.
3001    pub fn order_by(mut self, new_value: &str) -> ProjectLocationBackupListCall<'a, C> {
3002        self._order_by = Some(new_value.to_string());
3003        self
3004    }
3005    /// List filter.
3006    ///
3007    /// Sets the *filter* query property to the given value.
3008    pub fn filter(mut self, new_value: &str) -> ProjectLocationBackupListCall<'a, C> {
3009        self._filter = Some(new_value.to_string());
3010        self
3011    }
3012    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3013    /// while executing the actual API request.
3014    ///
3015    /// ````text
3016    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
3017    /// ````
3018    ///
3019    /// Sets the *delegate* property to the given value.
3020    pub fn delegate(
3021        mut self,
3022        new_value: &'a mut dyn common::Delegate,
3023    ) -> ProjectLocationBackupListCall<'a, C> {
3024        self._delegate = Some(new_value);
3025        self
3026    }
3027
3028    /// Set any additional parameter of the query string used in the request.
3029    /// It should be used to set parameters which are not yet available through their own
3030    /// setters.
3031    ///
3032    /// Please note that this method must not be used to set any of the known parameters
3033    /// which have their own setter method. If done anyway, the request will fail.
3034    ///
3035    /// # Additional Parameters
3036    ///
3037    /// * *$.xgafv* (query-string) - V1 error format.
3038    /// * *access_token* (query-string) - OAuth access token.
3039    /// * *alt* (query-string) - Data format for response.
3040    /// * *callback* (query-string) - JSONP
3041    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
3042    /// * *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.
3043    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3044    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
3045    /// * *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.
3046    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
3047    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
3048    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationBackupListCall<'a, C>
3049    where
3050        T: AsRef<str>,
3051    {
3052        self._additional_params
3053            .insert(name.as_ref().to_string(), value.as_ref().to_string());
3054        self
3055    }
3056
3057    /// Identifies the authorization scope for the method you are building.
3058    ///
3059    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
3060    /// [`Scope::CloudPlatform`].
3061    ///
3062    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
3063    /// tokens for more than one scope.
3064    ///
3065    /// Usually there is more than one suitable scope to authorize an operation, some of which may
3066    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
3067    /// sufficient, a read-write scope will do as well.
3068    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationBackupListCall<'a, C>
3069    where
3070        St: AsRef<str>,
3071    {
3072        self._scopes.insert(String::from(scope.as_ref()));
3073        self
3074    }
3075    /// Identifies the authorization scope(s) for the method you are building.
3076    ///
3077    /// See [`Self::add_scope()`] for details.
3078    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationBackupListCall<'a, C>
3079    where
3080        I: IntoIterator<Item = St>,
3081        St: AsRef<str>,
3082    {
3083        self._scopes
3084            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
3085        self
3086    }
3087
3088    /// Removes all scopes, and no default scope will be used either.
3089    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
3090    /// for details).
3091    pub fn clear_scopes(mut self) -> ProjectLocationBackupListCall<'a, C> {
3092        self._scopes.clear();
3093        self
3094    }
3095}
3096
3097/// Updates the settings of a specific backup.
3098///
3099/// A builder for the *locations.backups.patch* method supported by a *project* resource.
3100/// It is not used directly, but through a [`ProjectMethods`] instance.
3101///
3102/// # Example
3103///
3104/// Instantiate a resource method builder
3105///
3106/// ```test_harness,no_run
3107/// # extern crate hyper;
3108/// # extern crate hyper_rustls;
3109/// # extern crate google_file1_beta1 as file1_beta1;
3110/// use file1_beta1::api::Backup;
3111/// # async fn dox() {
3112/// # use file1_beta1::{CloudFilestore, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3113///
3114/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
3115/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
3116/// #     .with_native_roots()
3117/// #     .unwrap()
3118/// #     .https_only()
3119/// #     .enable_http2()
3120/// #     .build();
3121///
3122/// # let executor = hyper_util::rt::TokioExecutor::new();
3123/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
3124/// #     secret,
3125/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3126/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
3127/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
3128/// #     ),
3129/// # ).build().await.unwrap();
3130///
3131/// # let client = hyper_util::client::legacy::Client::builder(
3132/// #     hyper_util::rt::TokioExecutor::new()
3133/// # )
3134/// # .build(
3135/// #     hyper_rustls::HttpsConnectorBuilder::new()
3136/// #         .with_native_roots()
3137/// #         .unwrap()
3138/// #         .https_or_http()
3139/// #         .enable_http2()
3140/// #         .build()
3141/// # );
3142/// # let mut hub = CloudFilestore::new(client, auth);
3143/// // As the method needs a request, you would usually fill it with the desired information
3144/// // into the respective structure. Some of the parts shown here might not be applicable !
3145/// // Values shown here are possibly random and not representative !
3146/// let mut req = Backup::default();
3147///
3148/// // You can configure optional parameters by calling the respective setters at will, and
3149/// // execute the final call using `doit()`.
3150/// // Values shown here are possibly random and not representative !
3151/// let result = hub.projects().locations_backups_patch(req, "name")
3152///              .update_mask(FieldMask::new::<&str>(&[]))
3153///              .doit().await;
3154/// # }
3155/// ```
3156pub struct ProjectLocationBackupPatchCall<'a, C>
3157where
3158    C: 'a,
3159{
3160    hub: &'a CloudFilestore<C>,
3161    _request: Backup,
3162    _name: String,
3163    _update_mask: Option<common::FieldMask>,
3164    _delegate: Option<&'a mut dyn common::Delegate>,
3165    _additional_params: HashMap<String, String>,
3166    _scopes: BTreeSet<String>,
3167}
3168
3169impl<'a, C> common::CallBuilder for ProjectLocationBackupPatchCall<'a, C> {}
3170
3171impl<'a, C> ProjectLocationBackupPatchCall<'a, C>
3172where
3173    C: common::Connector,
3174{
3175    /// Perform the operation you have build so far.
3176    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
3177        use std::borrow::Cow;
3178        use std::io::{Read, Seek};
3179
3180        use common::{url::Params, ToParts};
3181        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
3182
3183        let mut dd = common::DefaultDelegate;
3184        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
3185        dlg.begin(common::MethodInfo {
3186            id: "file.projects.locations.backups.patch",
3187            http_method: hyper::Method::PATCH,
3188        });
3189
3190        for &field in ["alt", "name", "updateMask"].iter() {
3191            if self._additional_params.contains_key(field) {
3192                dlg.finished(false);
3193                return Err(common::Error::FieldClash(field));
3194            }
3195        }
3196
3197        let mut params = Params::with_capacity(5 + self._additional_params.len());
3198        params.push("name", self._name);
3199        if let Some(value) = self._update_mask.as_ref() {
3200            params.push("updateMask", value.to_string());
3201        }
3202
3203        params.extend(self._additional_params.iter());
3204
3205        params.push("alt", "json");
3206        let mut url = self.hub._base_url.clone() + "v1beta1/{+name}";
3207        if self._scopes.is_empty() {
3208            self._scopes
3209                .insert(Scope::CloudPlatform.as_ref().to_string());
3210        }
3211
3212        #[allow(clippy::single_element_loop)]
3213        for &(find_this, param_name) in [("{+name}", "name")].iter() {
3214            url = params.uri_replacement(url, param_name, find_this, true);
3215        }
3216        {
3217            let to_remove = ["name"];
3218            params.remove_params(&to_remove);
3219        }
3220
3221        let url = params.parse_with_url(&url);
3222
3223        let mut json_mime_type = mime::APPLICATION_JSON;
3224        let mut request_value_reader = {
3225            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
3226            common::remove_json_null_values(&mut value);
3227            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
3228            serde_json::to_writer(&mut dst, &value).unwrap();
3229            dst
3230        };
3231        let request_size = request_value_reader
3232            .seek(std::io::SeekFrom::End(0))
3233            .unwrap();
3234        request_value_reader
3235            .seek(std::io::SeekFrom::Start(0))
3236            .unwrap();
3237
3238        loop {
3239            let token = match self
3240                .hub
3241                .auth
3242                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
3243                .await
3244            {
3245                Ok(token) => token,
3246                Err(e) => match dlg.token(e) {
3247                    Ok(token) => token,
3248                    Err(e) => {
3249                        dlg.finished(false);
3250                        return Err(common::Error::MissingToken(e));
3251                    }
3252                },
3253            };
3254            request_value_reader
3255                .seek(std::io::SeekFrom::Start(0))
3256                .unwrap();
3257            let mut req_result = {
3258                let client = &self.hub.client;
3259                dlg.pre_request();
3260                let mut req_builder = hyper::Request::builder()
3261                    .method(hyper::Method::PATCH)
3262                    .uri(url.as_str())
3263                    .header(USER_AGENT, self.hub._user_agent.clone());
3264
3265                if let Some(token) = token.as_ref() {
3266                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
3267                }
3268
3269                let request = req_builder
3270                    .header(CONTENT_TYPE, json_mime_type.to_string())
3271                    .header(CONTENT_LENGTH, request_size as u64)
3272                    .body(common::to_body(
3273                        request_value_reader.get_ref().clone().into(),
3274                    ));
3275
3276                client.request(request.unwrap()).await
3277            };
3278
3279            match req_result {
3280                Err(err) => {
3281                    if let common::Retry::After(d) = dlg.http_error(&err) {
3282                        sleep(d).await;
3283                        continue;
3284                    }
3285                    dlg.finished(false);
3286                    return Err(common::Error::HttpError(err));
3287                }
3288                Ok(res) => {
3289                    let (mut parts, body) = res.into_parts();
3290                    let mut body = common::Body::new(body);
3291                    if !parts.status.is_success() {
3292                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3293                        let error = serde_json::from_str(&common::to_string(&bytes));
3294                        let response = common::to_response(parts, bytes.into());
3295
3296                        if let common::Retry::After(d) =
3297                            dlg.http_failure(&response, error.as_ref().ok())
3298                        {
3299                            sleep(d).await;
3300                            continue;
3301                        }
3302
3303                        dlg.finished(false);
3304
3305                        return Err(match error {
3306                            Ok(value) => common::Error::BadRequest(value),
3307                            _ => common::Error::Failure(response),
3308                        });
3309                    }
3310                    let response = {
3311                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3312                        let encoded = common::to_string(&bytes);
3313                        match serde_json::from_str(&encoded) {
3314                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
3315                            Err(error) => {
3316                                dlg.response_json_decode_error(&encoded, &error);
3317                                return Err(common::Error::JsonDecodeError(
3318                                    encoded.to_string(),
3319                                    error,
3320                                ));
3321                            }
3322                        }
3323                    };
3324
3325                    dlg.finished(true);
3326                    return Ok(response);
3327                }
3328            }
3329        }
3330    }
3331
3332    ///
3333    /// Sets the *request* property to the given value.
3334    ///
3335    /// Even though the property as already been set when instantiating this call,
3336    /// we provide this method for API completeness.
3337    pub fn request(mut self, new_value: Backup) -> ProjectLocationBackupPatchCall<'a, C> {
3338        self._request = new_value;
3339        self
3340    }
3341    /// Output only. The resource name of the backup, in the format `projects/{project_id}/locations/{location_id}/backups/{backup_id}`.
3342    ///
3343    /// Sets the *name* path property to the given value.
3344    ///
3345    /// Even though the property as already been set when instantiating this call,
3346    /// we provide this method for API completeness.
3347    pub fn name(mut self, new_value: &str) -> ProjectLocationBackupPatchCall<'a, C> {
3348        self._name = new_value.to_string();
3349        self
3350    }
3351    /// Required. Mask of fields to update. At least one path must be supplied in this field.
3352    ///
3353    /// Sets the *update mask* query property to the given value.
3354    pub fn update_mask(
3355        mut self,
3356        new_value: common::FieldMask,
3357    ) -> ProjectLocationBackupPatchCall<'a, C> {
3358        self._update_mask = Some(new_value);
3359        self
3360    }
3361    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3362    /// while executing the actual API request.
3363    ///
3364    /// ````text
3365    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
3366    /// ````
3367    ///
3368    /// Sets the *delegate* property to the given value.
3369    pub fn delegate(
3370        mut self,
3371        new_value: &'a mut dyn common::Delegate,
3372    ) -> ProjectLocationBackupPatchCall<'a, C> {
3373        self._delegate = Some(new_value);
3374        self
3375    }
3376
3377    /// Set any additional parameter of the query string used in the request.
3378    /// It should be used to set parameters which are not yet available through their own
3379    /// setters.
3380    ///
3381    /// Please note that this method must not be used to set any of the known parameters
3382    /// which have their own setter method. If done anyway, the request will fail.
3383    ///
3384    /// # Additional Parameters
3385    ///
3386    /// * *$.xgafv* (query-string) - V1 error format.
3387    /// * *access_token* (query-string) - OAuth access token.
3388    /// * *alt* (query-string) - Data format for response.
3389    /// * *callback* (query-string) - JSONP
3390    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
3391    /// * *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.
3392    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3393    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
3394    /// * *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.
3395    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
3396    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
3397    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationBackupPatchCall<'a, C>
3398    where
3399        T: AsRef<str>,
3400    {
3401        self._additional_params
3402            .insert(name.as_ref().to_string(), value.as_ref().to_string());
3403        self
3404    }
3405
3406    /// Identifies the authorization scope for the method you are building.
3407    ///
3408    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
3409    /// [`Scope::CloudPlatform`].
3410    ///
3411    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
3412    /// tokens for more than one scope.
3413    ///
3414    /// Usually there is more than one suitable scope to authorize an operation, some of which may
3415    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
3416    /// sufficient, a read-write scope will do as well.
3417    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationBackupPatchCall<'a, C>
3418    where
3419        St: AsRef<str>,
3420    {
3421        self._scopes.insert(String::from(scope.as_ref()));
3422        self
3423    }
3424    /// Identifies the authorization scope(s) for the method you are building.
3425    ///
3426    /// See [`Self::add_scope()`] for details.
3427    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationBackupPatchCall<'a, C>
3428    where
3429        I: IntoIterator<Item = St>,
3430        St: AsRef<str>,
3431    {
3432        self._scopes
3433            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
3434        self
3435    }
3436
3437    /// Removes all scopes, and no default scope will be used either.
3438    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
3439    /// for details).
3440    pub fn clear_scopes(mut self) -> ProjectLocationBackupPatchCall<'a, C> {
3441        self._scopes.clear();
3442        self
3443    }
3444}
3445
3446/// Creates a share.
3447///
3448/// A builder for the *locations.instances.shares.create* method supported by a *project* resource.
3449/// It is not used directly, but through a [`ProjectMethods`] instance.
3450///
3451/// # Example
3452///
3453/// Instantiate a resource method builder
3454///
3455/// ```test_harness,no_run
3456/// # extern crate hyper;
3457/// # extern crate hyper_rustls;
3458/// # extern crate google_file1_beta1 as file1_beta1;
3459/// use file1_beta1::api::Share;
3460/// # async fn dox() {
3461/// # use file1_beta1::{CloudFilestore, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3462///
3463/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
3464/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
3465/// #     .with_native_roots()
3466/// #     .unwrap()
3467/// #     .https_only()
3468/// #     .enable_http2()
3469/// #     .build();
3470///
3471/// # let executor = hyper_util::rt::TokioExecutor::new();
3472/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
3473/// #     secret,
3474/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3475/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
3476/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
3477/// #     ),
3478/// # ).build().await.unwrap();
3479///
3480/// # let client = hyper_util::client::legacy::Client::builder(
3481/// #     hyper_util::rt::TokioExecutor::new()
3482/// # )
3483/// # .build(
3484/// #     hyper_rustls::HttpsConnectorBuilder::new()
3485/// #         .with_native_roots()
3486/// #         .unwrap()
3487/// #         .https_or_http()
3488/// #         .enable_http2()
3489/// #         .build()
3490/// # );
3491/// # let mut hub = CloudFilestore::new(client, auth);
3492/// // As the method needs a request, you would usually fill it with the desired information
3493/// // into the respective structure. Some of the parts shown here might not be applicable !
3494/// // Values shown here are possibly random and not representative !
3495/// let mut req = Share::default();
3496///
3497/// // You can configure optional parameters by calling the respective setters at will, and
3498/// // execute the final call using `doit()`.
3499/// // Values shown here are possibly random and not representative !
3500/// let result = hub.projects().locations_instances_shares_create(req, "parent")
3501///              .share_id("dolor")
3502///              .doit().await;
3503/// # }
3504/// ```
3505pub struct ProjectLocationInstanceShareCreateCall<'a, C>
3506where
3507    C: 'a,
3508{
3509    hub: &'a CloudFilestore<C>,
3510    _request: Share,
3511    _parent: String,
3512    _share_id: Option<String>,
3513    _delegate: Option<&'a mut dyn common::Delegate>,
3514    _additional_params: HashMap<String, String>,
3515    _scopes: BTreeSet<String>,
3516}
3517
3518impl<'a, C> common::CallBuilder for ProjectLocationInstanceShareCreateCall<'a, C> {}
3519
3520impl<'a, C> ProjectLocationInstanceShareCreateCall<'a, C>
3521where
3522    C: common::Connector,
3523{
3524    /// Perform the operation you have build so far.
3525    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
3526        use std::borrow::Cow;
3527        use std::io::{Read, Seek};
3528
3529        use common::{url::Params, ToParts};
3530        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
3531
3532        let mut dd = common::DefaultDelegate;
3533        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
3534        dlg.begin(common::MethodInfo {
3535            id: "file.projects.locations.instances.shares.create",
3536            http_method: hyper::Method::POST,
3537        });
3538
3539        for &field in ["alt", "parent", "shareId"].iter() {
3540            if self._additional_params.contains_key(field) {
3541                dlg.finished(false);
3542                return Err(common::Error::FieldClash(field));
3543            }
3544        }
3545
3546        let mut params = Params::with_capacity(5 + self._additional_params.len());
3547        params.push("parent", self._parent);
3548        if let Some(value) = self._share_id.as_ref() {
3549            params.push("shareId", value);
3550        }
3551
3552        params.extend(self._additional_params.iter());
3553
3554        params.push("alt", "json");
3555        let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/shares";
3556        if self._scopes.is_empty() {
3557            self._scopes
3558                .insert(Scope::CloudPlatform.as_ref().to_string());
3559        }
3560
3561        #[allow(clippy::single_element_loop)]
3562        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
3563            url = params.uri_replacement(url, param_name, find_this, true);
3564        }
3565        {
3566            let to_remove = ["parent"];
3567            params.remove_params(&to_remove);
3568        }
3569
3570        let url = params.parse_with_url(&url);
3571
3572        let mut json_mime_type = mime::APPLICATION_JSON;
3573        let mut request_value_reader = {
3574            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
3575            common::remove_json_null_values(&mut value);
3576            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
3577            serde_json::to_writer(&mut dst, &value).unwrap();
3578            dst
3579        };
3580        let request_size = request_value_reader
3581            .seek(std::io::SeekFrom::End(0))
3582            .unwrap();
3583        request_value_reader
3584            .seek(std::io::SeekFrom::Start(0))
3585            .unwrap();
3586
3587        loop {
3588            let token = match self
3589                .hub
3590                .auth
3591                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
3592                .await
3593            {
3594                Ok(token) => token,
3595                Err(e) => match dlg.token(e) {
3596                    Ok(token) => token,
3597                    Err(e) => {
3598                        dlg.finished(false);
3599                        return Err(common::Error::MissingToken(e));
3600                    }
3601                },
3602            };
3603            request_value_reader
3604                .seek(std::io::SeekFrom::Start(0))
3605                .unwrap();
3606            let mut req_result = {
3607                let client = &self.hub.client;
3608                dlg.pre_request();
3609                let mut req_builder = hyper::Request::builder()
3610                    .method(hyper::Method::POST)
3611                    .uri(url.as_str())
3612                    .header(USER_AGENT, self.hub._user_agent.clone());
3613
3614                if let Some(token) = token.as_ref() {
3615                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
3616                }
3617
3618                let request = req_builder
3619                    .header(CONTENT_TYPE, json_mime_type.to_string())
3620                    .header(CONTENT_LENGTH, request_size as u64)
3621                    .body(common::to_body(
3622                        request_value_reader.get_ref().clone().into(),
3623                    ));
3624
3625                client.request(request.unwrap()).await
3626            };
3627
3628            match req_result {
3629                Err(err) => {
3630                    if let common::Retry::After(d) = dlg.http_error(&err) {
3631                        sleep(d).await;
3632                        continue;
3633                    }
3634                    dlg.finished(false);
3635                    return Err(common::Error::HttpError(err));
3636                }
3637                Ok(res) => {
3638                    let (mut parts, body) = res.into_parts();
3639                    let mut body = common::Body::new(body);
3640                    if !parts.status.is_success() {
3641                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3642                        let error = serde_json::from_str(&common::to_string(&bytes));
3643                        let response = common::to_response(parts, bytes.into());
3644
3645                        if let common::Retry::After(d) =
3646                            dlg.http_failure(&response, error.as_ref().ok())
3647                        {
3648                            sleep(d).await;
3649                            continue;
3650                        }
3651
3652                        dlg.finished(false);
3653
3654                        return Err(match error {
3655                            Ok(value) => common::Error::BadRequest(value),
3656                            _ => common::Error::Failure(response),
3657                        });
3658                    }
3659                    let response = {
3660                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3661                        let encoded = common::to_string(&bytes);
3662                        match serde_json::from_str(&encoded) {
3663                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
3664                            Err(error) => {
3665                                dlg.response_json_decode_error(&encoded, &error);
3666                                return Err(common::Error::JsonDecodeError(
3667                                    encoded.to_string(),
3668                                    error,
3669                                ));
3670                            }
3671                        }
3672                    };
3673
3674                    dlg.finished(true);
3675                    return Ok(response);
3676                }
3677            }
3678        }
3679    }
3680
3681    ///
3682    /// Sets the *request* property to the given value.
3683    ///
3684    /// Even though the property as already been set when instantiating this call,
3685    /// we provide this method for API completeness.
3686    pub fn request(mut self, new_value: Share) -> ProjectLocationInstanceShareCreateCall<'a, C> {
3687        self._request = new_value;
3688        self
3689    }
3690    /// Required. The Filestore Instance to create the share for, in the format `projects/{project_id}/locations/{location}/instances/{instance_id}`
3691    ///
3692    /// Sets the *parent* path property to the given value.
3693    ///
3694    /// Even though the property as already been set when instantiating this call,
3695    /// we provide this method for API completeness.
3696    pub fn parent(mut self, new_value: &str) -> ProjectLocationInstanceShareCreateCall<'a, C> {
3697        self._parent = new_value.to_string();
3698        self
3699    }
3700    /// 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.
3701    ///
3702    /// Sets the *share id* query property to the given value.
3703    pub fn share_id(mut self, new_value: &str) -> ProjectLocationInstanceShareCreateCall<'a, C> {
3704        self._share_id = Some(new_value.to_string());
3705        self
3706    }
3707    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3708    /// while executing the actual API request.
3709    ///
3710    /// ````text
3711    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
3712    /// ````
3713    ///
3714    /// Sets the *delegate* property to the given value.
3715    pub fn delegate(
3716        mut self,
3717        new_value: &'a mut dyn common::Delegate,
3718    ) -> ProjectLocationInstanceShareCreateCall<'a, C> {
3719        self._delegate = Some(new_value);
3720        self
3721    }
3722
3723    /// Set any additional parameter of the query string used in the request.
3724    /// It should be used to set parameters which are not yet available through their own
3725    /// setters.
3726    ///
3727    /// Please note that this method must not be used to set any of the known parameters
3728    /// which have their own setter method. If done anyway, the request will fail.
3729    ///
3730    /// # Additional Parameters
3731    ///
3732    /// * *$.xgafv* (query-string) - V1 error format.
3733    /// * *access_token* (query-string) - OAuth access token.
3734    /// * *alt* (query-string) - Data format for response.
3735    /// * *callback* (query-string) - JSONP
3736    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
3737    /// * *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.
3738    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3739    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
3740    /// * *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.
3741    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
3742    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
3743    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationInstanceShareCreateCall<'a, C>
3744    where
3745        T: AsRef<str>,
3746    {
3747        self._additional_params
3748            .insert(name.as_ref().to_string(), value.as_ref().to_string());
3749        self
3750    }
3751
3752    /// Identifies the authorization scope for the method you are building.
3753    ///
3754    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
3755    /// [`Scope::CloudPlatform`].
3756    ///
3757    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
3758    /// tokens for more than one scope.
3759    ///
3760    /// Usually there is more than one suitable scope to authorize an operation, some of which may
3761    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
3762    /// sufficient, a read-write scope will do as well.
3763    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationInstanceShareCreateCall<'a, C>
3764    where
3765        St: AsRef<str>,
3766    {
3767        self._scopes.insert(String::from(scope.as_ref()));
3768        self
3769    }
3770    /// Identifies the authorization scope(s) for the method you are building.
3771    ///
3772    /// See [`Self::add_scope()`] for details.
3773    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationInstanceShareCreateCall<'a, C>
3774    where
3775        I: IntoIterator<Item = St>,
3776        St: AsRef<str>,
3777    {
3778        self._scopes
3779            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
3780        self
3781    }
3782
3783    /// Removes all scopes, and no default scope will be used either.
3784    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
3785    /// for details).
3786    pub fn clear_scopes(mut self) -> ProjectLocationInstanceShareCreateCall<'a, C> {
3787        self._scopes.clear();
3788        self
3789    }
3790}
3791
3792/// Deletes a share.
3793///
3794/// A builder for the *locations.instances.shares.delete* method supported by a *project* resource.
3795/// It is not used directly, but through a [`ProjectMethods`] instance.
3796///
3797/// # Example
3798///
3799/// Instantiate a resource method builder
3800///
3801/// ```test_harness,no_run
3802/// # extern crate hyper;
3803/// # extern crate hyper_rustls;
3804/// # extern crate google_file1_beta1 as file1_beta1;
3805/// # async fn dox() {
3806/// # use file1_beta1::{CloudFilestore, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3807///
3808/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
3809/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
3810/// #     .with_native_roots()
3811/// #     .unwrap()
3812/// #     .https_only()
3813/// #     .enable_http2()
3814/// #     .build();
3815///
3816/// # let executor = hyper_util::rt::TokioExecutor::new();
3817/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
3818/// #     secret,
3819/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3820/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
3821/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
3822/// #     ),
3823/// # ).build().await.unwrap();
3824///
3825/// # let client = hyper_util::client::legacy::Client::builder(
3826/// #     hyper_util::rt::TokioExecutor::new()
3827/// # )
3828/// # .build(
3829/// #     hyper_rustls::HttpsConnectorBuilder::new()
3830/// #         .with_native_roots()
3831/// #         .unwrap()
3832/// #         .https_or_http()
3833/// #         .enable_http2()
3834/// #         .build()
3835/// # );
3836/// # let mut hub = CloudFilestore::new(client, auth);
3837/// // You can configure optional parameters by calling the respective setters at will, and
3838/// // execute the final call using `doit()`.
3839/// // Values shown here are possibly random and not representative !
3840/// let result = hub.projects().locations_instances_shares_delete("name")
3841///              .doit().await;
3842/// # }
3843/// ```
3844pub struct ProjectLocationInstanceShareDeleteCall<'a, C>
3845where
3846    C: 'a,
3847{
3848    hub: &'a CloudFilestore<C>,
3849    _name: String,
3850    _delegate: Option<&'a mut dyn common::Delegate>,
3851    _additional_params: HashMap<String, String>,
3852    _scopes: BTreeSet<String>,
3853}
3854
3855impl<'a, C> common::CallBuilder for ProjectLocationInstanceShareDeleteCall<'a, C> {}
3856
3857impl<'a, C> ProjectLocationInstanceShareDeleteCall<'a, C>
3858where
3859    C: common::Connector,
3860{
3861    /// Perform the operation you have build so far.
3862    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
3863        use std::borrow::Cow;
3864        use std::io::{Read, Seek};
3865
3866        use common::{url::Params, ToParts};
3867        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
3868
3869        let mut dd = common::DefaultDelegate;
3870        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
3871        dlg.begin(common::MethodInfo {
3872            id: "file.projects.locations.instances.shares.delete",
3873            http_method: hyper::Method::DELETE,
3874        });
3875
3876        for &field in ["alt", "name"].iter() {
3877            if self._additional_params.contains_key(field) {
3878                dlg.finished(false);
3879                return Err(common::Error::FieldClash(field));
3880            }
3881        }
3882
3883        let mut params = Params::with_capacity(3 + self._additional_params.len());
3884        params.push("name", self._name);
3885
3886        params.extend(self._additional_params.iter());
3887
3888        params.push("alt", "json");
3889        let mut url = self.hub._base_url.clone() + "v1beta1/{+name}";
3890        if self._scopes.is_empty() {
3891            self._scopes
3892                .insert(Scope::CloudPlatform.as_ref().to_string());
3893        }
3894
3895        #[allow(clippy::single_element_loop)]
3896        for &(find_this, param_name) in [("{+name}", "name")].iter() {
3897            url = params.uri_replacement(url, param_name, find_this, true);
3898        }
3899        {
3900            let to_remove = ["name"];
3901            params.remove_params(&to_remove);
3902        }
3903
3904        let url = params.parse_with_url(&url);
3905
3906        loop {
3907            let token = match self
3908                .hub
3909                .auth
3910                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
3911                .await
3912            {
3913                Ok(token) => token,
3914                Err(e) => match dlg.token(e) {
3915                    Ok(token) => token,
3916                    Err(e) => {
3917                        dlg.finished(false);
3918                        return Err(common::Error::MissingToken(e));
3919                    }
3920                },
3921            };
3922            let mut req_result = {
3923                let client = &self.hub.client;
3924                dlg.pre_request();
3925                let mut req_builder = hyper::Request::builder()
3926                    .method(hyper::Method::DELETE)
3927                    .uri(url.as_str())
3928                    .header(USER_AGENT, self.hub._user_agent.clone());
3929
3930                if let Some(token) = token.as_ref() {
3931                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
3932                }
3933
3934                let request = req_builder
3935                    .header(CONTENT_LENGTH, 0_u64)
3936                    .body(common::to_body::<String>(None));
3937
3938                client.request(request.unwrap()).await
3939            };
3940
3941            match req_result {
3942                Err(err) => {
3943                    if let common::Retry::After(d) = dlg.http_error(&err) {
3944                        sleep(d).await;
3945                        continue;
3946                    }
3947                    dlg.finished(false);
3948                    return Err(common::Error::HttpError(err));
3949                }
3950                Ok(res) => {
3951                    let (mut parts, body) = res.into_parts();
3952                    let mut body = common::Body::new(body);
3953                    if !parts.status.is_success() {
3954                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3955                        let error = serde_json::from_str(&common::to_string(&bytes));
3956                        let response = common::to_response(parts, bytes.into());
3957
3958                        if let common::Retry::After(d) =
3959                            dlg.http_failure(&response, error.as_ref().ok())
3960                        {
3961                            sleep(d).await;
3962                            continue;
3963                        }
3964
3965                        dlg.finished(false);
3966
3967                        return Err(match error {
3968                            Ok(value) => common::Error::BadRequest(value),
3969                            _ => common::Error::Failure(response),
3970                        });
3971                    }
3972                    let response = {
3973                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3974                        let encoded = common::to_string(&bytes);
3975                        match serde_json::from_str(&encoded) {
3976                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
3977                            Err(error) => {
3978                                dlg.response_json_decode_error(&encoded, &error);
3979                                return Err(common::Error::JsonDecodeError(
3980                                    encoded.to_string(),
3981                                    error,
3982                                ));
3983                            }
3984                        }
3985                    };
3986
3987                    dlg.finished(true);
3988                    return Ok(response);
3989                }
3990            }
3991        }
3992    }
3993
3994    /// Required. The share resource name, in the format `projects/{project_id}/locations/{location}/instances/{instance_id}/share/{share_id}`
3995    ///
3996    /// Sets the *name* path property to the given value.
3997    ///
3998    /// Even though the property as already been set when instantiating this call,
3999    /// we provide this method for API completeness.
4000    pub fn name(mut self, new_value: &str) -> ProjectLocationInstanceShareDeleteCall<'a, C> {
4001        self._name = new_value.to_string();
4002        self
4003    }
4004    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4005    /// while executing the actual API request.
4006    ///
4007    /// ````text
4008    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
4009    /// ````
4010    ///
4011    /// Sets the *delegate* property to the given value.
4012    pub fn delegate(
4013        mut self,
4014        new_value: &'a mut dyn common::Delegate,
4015    ) -> ProjectLocationInstanceShareDeleteCall<'a, C> {
4016        self._delegate = Some(new_value);
4017        self
4018    }
4019
4020    /// Set any additional parameter of the query string used in the request.
4021    /// It should be used to set parameters which are not yet available through their own
4022    /// setters.
4023    ///
4024    /// Please note that this method must not be used to set any of the known parameters
4025    /// which have their own setter method. If done anyway, the request will fail.
4026    ///
4027    /// # Additional Parameters
4028    ///
4029    /// * *$.xgafv* (query-string) - V1 error format.
4030    /// * *access_token* (query-string) - OAuth access token.
4031    /// * *alt* (query-string) - Data format for response.
4032    /// * *callback* (query-string) - JSONP
4033    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4034    /// * *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.
4035    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4036    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4037    /// * *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.
4038    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4039    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4040    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationInstanceShareDeleteCall<'a, C>
4041    where
4042        T: AsRef<str>,
4043    {
4044        self._additional_params
4045            .insert(name.as_ref().to_string(), value.as_ref().to_string());
4046        self
4047    }
4048
4049    /// Identifies the authorization scope for the method you are building.
4050    ///
4051    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
4052    /// [`Scope::CloudPlatform`].
4053    ///
4054    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4055    /// tokens for more than one scope.
4056    ///
4057    /// Usually there is more than one suitable scope to authorize an operation, some of which may
4058    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
4059    /// sufficient, a read-write scope will do as well.
4060    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationInstanceShareDeleteCall<'a, C>
4061    where
4062        St: AsRef<str>,
4063    {
4064        self._scopes.insert(String::from(scope.as_ref()));
4065        self
4066    }
4067    /// Identifies the authorization scope(s) for the method you are building.
4068    ///
4069    /// See [`Self::add_scope()`] for details.
4070    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationInstanceShareDeleteCall<'a, C>
4071    where
4072        I: IntoIterator<Item = St>,
4073        St: AsRef<str>,
4074    {
4075        self._scopes
4076            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
4077        self
4078    }
4079
4080    /// Removes all scopes, and no default scope will be used either.
4081    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
4082    /// for details).
4083    pub fn clear_scopes(mut self) -> ProjectLocationInstanceShareDeleteCall<'a, C> {
4084        self._scopes.clear();
4085        self
4086    }
4087}
4088
4089/// Gets the details of a specific share.
4090///
4091/// A builder for the *locations.instances.shares.get* method supported by a *project* resource.
4092/// It is not used directly, but through a [`ProjectMethods`] instance.
4093///
4094/// # Example
4095///
4096/// Instantiate a resource method builder
4097///
4098/// ```test_harness,no_run
4099/// # extern crate hyper;
4100/// # extern crate hyper_rustls;
4101/// # extern crate google_file1_beta1 as file1_beta1;
4102/// # async fn dox() {
4103/// # use file1_beta1::{CloudFilestore, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4104///
4105/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4106/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
4107/// #     .with_native_roots()
4108/// #     .unwrap()
4109/// #     .https_only()
4110/// #     .enable_http2()
4111/// #     .build();
4112///
4113/// # let executor = hyper_util::rt::TokioExecutor::new();
4114/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
4115/// #     secret,
4116/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4117/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
4118/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
4119/// #     ),
4120/// # ).build().await.unwrap();
4121///
4122/// # let client = hyper_util::client::legacy::Client::builder(
4123/// #     hyper_util::rt::TokioExecutor::new()
4124/// # )
4125/// # .build(
4126/// #     hyper_rustls::HttpsConnectorBuilder::new()
4127/// #         .with_native_roots()
4128/// #         .unwrap()
4129/// #         .https_or_http()
4130/// #         .enable_http2()
4131/// #         .build()
4132/// # );
4133/// # let mut hub = CloudFilestore::new(client, auth);
4134/// // You can configure optional parameters by calling the respective setters at will, and
4135/// // execute the final call using `doit()`.
4136/// // Values shown here are possibly random and not representative !
4137/// let result = hub.projects().locations_instances_shares_get("name")
4138///              .doit().await;
4139/// # }
4140/// ```
4141pub struct ProjectLocationInstanceShareGetCall<'a, C>
4142where
4143    C: 'a,
4144{
4145    hub: &'a CloudFilestore<C>,
4146    _name: String,
4147    _delegate: Option<&'a mut dyn common::Delegate>,
4148    _additional_params: HashMap<String, String>,
4149    _scopes: BTreeSet<String>,
4150}
4151
4152impl<'a, C> common::CallBuilder for ProjectLocationInstanceShareGetCall<'a, C> {}
4153
4154impl<'a, C> ProjectLocationInstanceShareGetCall<'a, C>
4155where
4156    C: common::Connector,
4157{
4158    /// Perform the operation you have build so far.
4159    pub async fn doit(mut self) -> common::Result<(common::Response, Share)> {
4160        use std::borrow::Cow;
4161        use std::io::{Read, Seek};
4162
4163        use common::{url::Params, ToParts};
4164        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
4165
4166        let mut dd = common::DefaultDelegate;
4167        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
4168        dlg.begin(common::MethodInfo {
4169            id: "file.projects.locations.instances.shares.get",
4170            http_method: hyper::Method::GET,
4171        });
4172
4173        for &field in ["alt", "name"].iter() {
4174            if self._additional_params.contains_key(field) {
4175                dlg.finished(false);
4176                return Err(common::Error::FieldClash(field));
4177            }
4178        }
4179
4180        let mut params = Params::with_capacity(3 + self._additional_params.len());
4181        params.push("name", self._name);
4182
4183        params.extend(self._additional_params.iter());
4184
4185        params.push("alt", "json");
4186        let mut url = self.hub._base_url.clone() + "v1beta1/{+name}";
4187        if self._scopes.is_empty() {
4188            self._scopes
4189                .insert(Scope::CloudPlatform.as_ref().to_string());
4190        }
4191
4192        #[allow(clippy::single_element_loop)]
4193        for &(find_this, param_name) in [("{+name}", "name")].iter() {
4194            url = params.uri_replacement(url, param_name, find_this, true);
4195        }
4196        {
4197            let to_remove = ["name"];
4198            params.remove_params(&to_remove);
4199        }
4200
4201        let url = params.parse_with_url(&url);
4202
4203        loop {
4204            let token = match self
4205                .hub
4206                .auth
4207                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
4208                .await
4209            {
4210                Ok(token) => token,
4211                Err(e) => match dlg.token(e) {
4212                    Ok(token) => token,
4213                    Err(e) => {
4214                        dlg.finished(false);
4215                        return Err(common::Error::MissingToken(e));
4216                    }
4217                },
4218            };
4219            let mut req_result = {
4220                let client = &self.hub.client;
4221                dlg.pre_request();
4222                let mut req_builder = hyper::Request::builder()
4223                    .method(hyper::Method::GET)
4224                    .uri(url.as_str())
4225                    .header(USER_AGENT, self.hub._user_agent.clone());
4226
4227                if let Some(token) = token.as_ref() {
4228                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
4229                }
4230
4231                let request = req_builder
4232                    .header(CONTENT_LENGTH, 0_u64)
4233                    .body(common::to_body::<String>(None));
4234
4235                client.request(request.unwrap()).await
4236            };
4237
4238            match req_result {
4239                Err(err) => {
4240                    if let common::Retry::After(d) = dlg.http_error(&err) {
4241                        sleep(d).await;
4242                        continue;
4243                    }
4244                    dlg.finished(false);
4245                    return Err(common::Error::HttpError(err));
4246                }
4247                Ok(res) => {
4248                    let (mut parts, body) = res.into_parts();
4249                    let mut body = common::Body::new(body);
4250                    if !parts.status.is_success() {
4251                        let bytes = common::to_bytes(body).await.unwrap_or_default();
4252                        let error = serde_json::from_str(&common::to_string(&bytes));
4253                        let response = common::to_response(parts, bytes.into());
4254
4255                        if let common::Retry::After(d) =
4256                            dlg.http_failure(&response, error.as_ref().ok())
4257                        {
4258                            sleep(d).await;
4259                            continue;
4260                        }
4261
4262                        dlg.finished(false);
4263
4264                        return Err(match error {
4265                            Ok(value) => common::Error::BadRequest(value),
4266                            _ => common::Error::Failure(response),
4267                        });
4268                    }
4269                    let response = {
4270                        let bytes = common::to_bytes(body).await.unwrap_or_default();
4271                        let encoded = common::to_string(&bytes);
4272                        match serde_json::from_str(&encoded) {
4273                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4274                            Err(error) => {
4275                                dlg.response_json_decode_error(&encoded, &error);
4276                                return Err(common::Error::JsonDecodeError(
4277                                    encoded.to_string(),
4278                                    error,
4279                                ));
4280                            }
4281                        }
4282                    };
4283
4284                    dlg.finished(true);
4285                    return Ok(response);
4286                }
4287            }
4288        }
4289    }
4290
4291    /// Required. The share resource name, in the format `projects/{project_id}/locations/{location}/instances/{instance_id}/shares/{share_id}`
4292    ///
4293    /// Sets the *name* path property to the given value.
4294    ///
4295    /// Even though the property as already been set when instantiating this call,
4296    /// we provide this method for API completeness.
4297    pub fn name(mut self, new_value: &str) -> ProjectLocationInstanceShareGetCall<'a, C> {
4298        self._name = new_value.to_string();
4299        self
4300    }
4301    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4302    /// while executing the actual API request.
4303    ///
4304    /// ````text
4305    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
4306    /// ````
4307    ///
4308    /// Sets the *delegate* property to the given value.
4309    pub fn delegate(
4310        mut self,
4311        new_value: &'a mut dyn common::Delegate,
4312    ) -> ProjectLocationInstanceShareGetCall<'a, C> {
4313        self._delegate = Some(new_value);
4314        self
4315    }
4316
4317    /// Set any additional parameter of the query string used in the request.
4318    /// It should be used to set parameters which are not yet available through their own
4319    /// setters.
4320    ///
4321    /// Please note that this method must not be used to set any of the known parameters
4322    /// which have their own setter method. If done anyway, the request will fail.
4323    ///
4324    /// # Additional Parameters
4325    ///
4326    /// * *$.xgafv* (query-string) - V1 error format.
4327    /// * *access_token* (query-string) - OAuth access token.
4328    /// * *alt* (query-string) - Data format for response.
4329    /// * *callback* (query-string) - JSONP
4330    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4331    /// * *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.
4332    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4333    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4334    /// * *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.
4335    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4336    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4337    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationInstanceShareGetCall<'a, C>
4338    where
4339        T: AsRef<str>,
4340    {
4341        self._additional_params
4342            .insert(name.as_ref().to_string(), value.as_ref().to_string());
4343        self
4344    }
4345
4346    /// Identifies the authorization scope for the method you are building.
4347    ///
4348    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
4349    /// [`Scope::CloudPlatform`].
4350    ///
4351    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4352    /// tokens for more than one scope.
4353    ///
4354    /// Usually there is more than one suitable scope to authorize an operation, some of which may
4355    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
4356    /// sufficient, a read-write scope will do as well.
4357    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationInstanceShareGetCall<'a, C>
4358    where
4359        St: AsRef<str>,
4360    {
4361        self._scopes.insert(String::from(scope.as_ref()));
4362        self
4363    }
4364    /// Identifies the authorization scope(s) for the method you are building.
4365    ///
4366    /// See [`Self::add_scope()`] for details.
4367    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationInstanceShareGetCall<'a, C>
4368    where
4369        I: IntoIterator<Item = St>,
4370        St: AsRef<str>,
4371    {
4372        self._scopes
4373            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
4374        self
4375    }
4376
4377    /// Removes all scopes, and no default scope will be used either.
4378    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
4379    /// for details).
4380    pub fn clear_scopes(mut self) -> ProjectLocationInstanceShareGetCall<'a, C> {
4381        self._scopes.clear();
4382        self
4383    }
4384}
4385
4386/// Lists all shares for a specified instance.
4387///
4388/// A builder for the *locations.instances.shares.list* method supported by a *project* resource.
4389/// It is not used directly, but through a [`ProjectMethods`] instance.
4390///
4391/// # Example
4392///
4393/// Instantiate a resource method builder
4394///
4395/// ```test_harness,no_run
4396/// # extern crate hyper;
4397/// # extern crate hyper_rustls;
4398/// # extern crate google_file1_beta1 as file1_beta1;
4399/// # async fn dox() {
4400/// # use file1_beta1::{CloudFilestore, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4401///
4402/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4403/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
4404/// #     .with_native_roots()
4405/// #     .unwrap()
4406/// #     .https_only()
4407/// #     .enable_http2()
4408/// #     .build();
4409///
4410/// # let executor = hyper_util::rt::TokioExecutor::new();
4411/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
4412/// #     secret,
4413/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4414/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
4415/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
4416/// #     ),
4417/// # ).build().await.unwrap();
4418///
4419/// # let client = hyper_util::client::legacy::Client::builder(
4420/// #     hyper_util::rt::TokioExecutor::new()
4421/// # )
4422/// # .build(
4423/// #     hyper_rustls::HttpsConnectorBuilder::new()
4424/// #         .with_native_roots()
4425/// #         .unwrap()
4426/// #         .https_or_http()
4427/// #         .enable_http2()
4428/// #         .build()
4429/// # );
4430/// # let mut hub = CloudFilestore::new(client, auth);
4431/// // You can configure optional parameters by calling the respective setters at will, and
4432/// // execute the final call using `doit()`.
4433/// // Values shown here are possibly random and not representative !
4434/// let result = hub.projects().locations_instances_shares_list("parent")
4435///              .page_token("amet")
4436///              .page_size(-20)
4437///              .order_by("ipsum")
4438///              .filter("sed")
4439///              .doit().await;
4440/// # }
4441/// ```
4442pub struct ProjectLocationInstanceShareListCall<'a, C>
4443where
4444    C: 'a,
4445{
4446    hub: &'a CloudFilestore<C>,
4447    _parent: String,
4448    _page_token: Option<String>,
4449    _page_size: Option<i32>,
4450    _order_by: Option<String>,
4451    _filter: Option<String>,
4452    _delegate: Option<&'a mut dyn common::Delegate>,
4453    _additional_params: HashMap<String, String>,
4454    _scopes: BTreeSet<String>,
4455}
4456
4457impl<'a, C> common::CallBuilder for ProjectLocationInstanceShareListCall<'a, C> {}
4458
4459impl<'a, C> ProjectLocationInstanceShareListCall<'a, C>
4460where
4461    C: common::Connector,
4462{
4463    /// Perform the operation you have build so far.
4464    pub async fn doit(mut self) -> common::Result<(common::Response, ListSharesResponse)> {
4465        use std::borrow::Cow;
4466        use std::io::{Read, Seek};
4467
4468        use common::{url::Params, ToParts};
4469        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
4470
4471        let mut dd = common::DefaultDelegate;
4472        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
4473        dlg.begin(common::MethodInfo {
4474            id: "file.projects.locations.instances.shares.list",
4475            http_method: hyper::Method::GET,
4476        });
4477
4478        for &field in [
4479            "alt",
4480            "parent",
4481            "pageToken",
4482            "pageSize",
4483            "orderBy",
4484            "filter",
4485        ]
4486        .iter()
4487        {
4488            if self._additional_params.contains_key(field) {
4489                dlg.finished(false);
4490                return Err(common::Error::FieldClash(field));
4491            }
4492        }
4493
4494        let mut params = Params::with_capacity(7 + self._additional_params.len());
4495        params.push("parent", self._parent);
4496        if let Some(value) = self._page_token.as_ref() {
4497            params.push("pageToken", value);
4498        }
4499        if let Some(value) = self._page_size.as_ref() {
4500            params.push("pageSize", value.to_string());
4501        }
4502        if let Some(value) = self._order_by.as_ref() {
4503            params.push("orderBy", value);
4504        }
4505        if let Some(value) = self._filter.as_ref() {
4506            params.push("filter", value);
4507        }
4508
4509        params.extend(self._additional_params.iter());
4510
4511        params.push("alt", "json");
4512        let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/shares";
4513        if self._scopes.is_empty() {
4514            self._scopes
4515                .insert(Scope::CloudPlatform.as_ref().to_string());
4516        }
4517
4518        #[allow(clippy::single_element_loop)]
4519        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
4520            url = params.uri_replacement(url, param_name, find_this, true);
4521        }
4522        {
4523            let to_remove = ["parent"];
4524            params.remove_params(&to_remove);
4525        }
4526
4527        let url = params.parse_with_url(&url);
4528
4529        loop {
4530            let token = match self
4531                .hub
4532                .auth
4533                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
4534                .await
4535            {
4536                Ok(token) => token,
4537                Err(e) => match dlg.token(e) {
4538                    Ok(token) => token,
4539                    Err(e) => {
4540                        dlg.finished(false);
4541                        return Err(common::Error::MissingToken(e));
4542                    }
4543                },
4544            };
4545            let mut req_result = {
4546                let client = &self.hub.client;
4547                dlg.pre_request();
4548                let mut req_builder = hyper::Request::builder()
4549                    .method(hyper::Method::GET)
4550                    .uri(url.as_str())
4551                    .header(USER_AGENT, self.hub._user_agent.clone());
4552
4553                if let Some(token) = token.as_ref() {
4554                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
4555                }
4556
4557                let request = req_builder
4558                    .header(CONTENT_LENGTH, 0_u64)
4559                    .body(common::to_body::<String>(None));
4560
4561                client.request(request.unwrap()).await
4562            };
4563
4564            match req_result {
4565                Err(err) => {
4566                    if let common::Retry::After(d) = dlg.http_error(&err) {
4567                        sleep(d).await;
4568                        continue;
4569                    }
4570                    dlg.finished(false);
4571                    return Err(common::Error::HttpError(err));
4572                }
4573                Ok(res) => {
4574                    let (mut parts, body) = res.into_parts();
4575                    let mut body = common::Body::new(body);
4576                    if !parts.status.is_success() {
4577                        let bytes = common::to_bytes(body).await.unwrap_or_default();
4578                        let error = serde_json::from_str(&common::to_string(&bytes));
4579                        let response = common::to_response(parts, bytes.into());
4580
4581                        if let common::Retry::After(d) =
4582                            dlg.http_failure(&response, error.as_ref().ok())
4583                        {
4584                            sleep(d).await;
4585                            continue;
4586                        }
4587
4588                        dlg.finished(false);
4589
4590                        return Err(match error {
4591                            Ok(value) => common::Error::BadRequest(value),
4592                            _ => common::Error::Failure(response),
4593                        });
4594                    }
4595                    let response = {
4596                        let bytes = common::to_bytes(body).await.unwrap_or_default();
4597                        let encoded = common::to_string(&bytes);
4598                        match serde_json::from_str(&encoded) {
4599                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4600                            Err(error) => {
4601                                dlg.response_json_decode_error(&encoded, &error);
4602                                return Err(common::Error::JsonDecodeError(
4603                                    encoded.to_string(),
4604                                    error,
4605                                ));
4606                            }
4607                        }
4608                    };
4609
4610                    dlg.finished(true);
4611                    return Ok(response);
4612                }
4613            }
4614        }
4615    }
4616
4617    /// Required. The instance for which to retrieve share information, in the format `projects/{project_id}/locations/{location}/instances/{instance_id}`.
4618    ///
4619    /// Sets the *parent* path property to the given value.
4620    ///
4621    /// Even though the property as already been set when instantiating this call,
4622    /// we provide this method for API completeness.
4623    pub fn parent(mut self, new_value: &str) -> ProjectLocationInstanceShareListCall<'a, C> {
4624        self._parent = new_value.to_string();
4625        self
4626    }
4627    /// The next_page_token value to use if there are additional results to retrieve for this list request.
4628    ///
4629    /// Sets the *page token* query property to the given value.
4630    pub fn page_token(mut self, new_value: &str) -> ProjectLocationInstanceShareListCall<'a, C> {
4631        self._page_token = Some(new_value.to_string());
4632        self
4633    }
4634    /// The maximum number of items to return.
4635    ///
4636    /// Sets the *page size* query property to the given value.
4637    pub fn page_size(mut self, new_value: i32) -> ProjectLocationInstanceShareListCall<'a, C> {
4638        self._page_size = Some(new_value);
4639        self
4640    }
4641    /// Sort results. Supported values are "name", "name desc" or "" (unsorted).
4642    ///
4643    /// Sets the *order by* query property to the given value.
4644    pub fn order_by(mut self, new_value: &str) -> ProjectLocationInstanceShareListCall<'a, C> {
4645        self._order_by = Some(new_value.to_string());
4646        self
4647    }
4648    /// List filter.
4649    ///
4650    /// Sets the *filter* query property to the given value.
4651    pub fn filter(mut self, new_value: &str) -> ProjectLocationInstanceShareListCall<'a, C> {
4652        self._filter = Some(new_value.to_string());
4653        self
4654    }
4655    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4656    /// while executing the actual API request.
4657    ///
4658    /// ````text
4659    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
4660    /// ````
4661    ///
4662    /// Sets the *delegate* property to the given value.
4663    pub fn delegate(
4664        mut self,
4665        new_value: &'a mut dyn common::Delegate,
4666    ) -> ProjectLocationInstanceShareListCall<'a, C> {
4667        self._delegate = Some(new_value);
4668        self
4669    }
4670
4671    /// Set any additional parameter of the query string used in the request.
4672    /// It should be used to set parameters which are not yet available through their own
4673    /// setters.
4674    ///
4675    /// Please note that this method must not be used to set any of the known parameters
4676    /// which have their own setter method. If done anyway, the request will fail.
4677    ///
4678    /// # Additional Parameters
4679    ///
4680    /// * *$.xgafv* (query-string) - V1 error format.
4681    /// * *access_token* (query-string) - OAuth access token.
4682    /// * *alt* (query-string) - Data format for response.
4683    /// * *callback* (query-string) - JSONP
4684    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4685    /// * *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.
4686    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4687    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4688    /// * *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.
4689    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4690    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4691    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationInstanceShareListCall<'a, C>
4692    where
4693        T: AsRef<str>,
4694    {
4695        self._additional_params
4696            .insert(name.as_ref().to_string(), value.as_ref().to_string());
4697        self
4698    }
4699
4700    /// Identifies the authorization scope for the method you are building.
4701    ///
4702    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
4703    /// [`Scope::CloudPlatform`].
4704    ///
4705    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4706    /// tokens for more than one scope.
4707    ///
4708    /// Usually there is more than one suitable scope to authorize an operation, some of which may
4709    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
4710    /// sufficient, a read-write scope will do as well.
4711    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationInstanceShareListCall<'a, C>
4712    where
4713        St: AsRef<str>,
4714    {
4715        self._scopes.insert(String::from(scope.as_ref()));
4716        self
4717    }
4718    /// Identifies the authorization scope(s) for the method you are building.
4719    ///
4720    /// See [`Self::add_scope()`] for details.
4721    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationInstanceShareListCall<'a, C>
4722    where
4723        I: IntoIterator<Item = St>,
4724        St: AsRef<str>,
4725    {
4726        self._scopes
4727            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
4728        self
4729    }
4730
4731    /// Removes all scopes, and no default scope will be used either.
4732    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
4733    /// for details).
4734    pub fn clear_scopes(mut self) -> ProjectLocationInstanceShareListCall<'a, C> {
4735        self._scopes.clear();
4736        self
4737    }
4738}
4739
4740/// Updates the settings of a specific share.
4741///
4742/// A builder for the *locations.instances.shares.patch* method supported by a *project* resource.
4743/// It is not used directly, but through a [`ProjectMethods`] instance.
4744///
4745/// # Example
4746///
4747/// Instantiate a resource method builder
4748///
4749/// ```test_harness,no_run
4750/// # extern crate hyper;
4751/// # extern crate hyper_rustls;
4752/// # extern crate google_file1_beta1 as file1_beta1;
4753/// use file1_beta1::api::Share;
4754/// # async fn dox() {
4755/// # use file1_beta1::{CloudFilestore, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4756///
4757/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4758/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
4759/// #     .with_native_roots()
4760/// #     .unwrap()
4761/// #     .https_only()
4762/// #     .enable_http2()
4763/// #     .build();
4764///
4765/// # let executor = hyper_util::rt::TokioExecutor::new();
4766/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
4767/// #     secret,
4768/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4769/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
4770/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
4771/// #     ),
4772/// # ).build().await.unwrap();
4773///
4774/// # let client = hyper_util::client::legacy::Client::builder(
4775/// #     hyper_util::rt::TokioExecutor::new()
4776/// # )
4777/// # .build(
4778/// #     hyper_rustls::HttpsConnectorBuilder::new()
4779/// #         .with_native_roots()
4780/// #         .unwrap()
4781/// #         .https_or_http()
4782/// #         .enable_http2()
4783/// #         .build()
4784/// # );
4785/// # let mut hub = CloudFilestore::new(client, auth);
4786/// // As the method needs a request, you would usually fill it with the desired information
4787/// // into the respective structure. Some of the parts shown here might not be applicable !
4788/// // Values shown here are possibly random and not representative !
4789/// let mut req = Share::default();
4790///
4791/// // You can configure optional parameters by calling the respective setters at will, and
4792/// // execute the final call using `doit()`.
4793/// // Values shown here are possibly random and not representative !
4794/// let result = hub.projects().locations_instances_shares_patch(req, "name")
4795///              .update_mask(FieldMask::new::<&str>(&[]))
4796///              .doit().await;
4797/// # }
4798/// ```
4799pub struct ProjectLocationInstanceSharePatchCall<'a, C>
4800where
4801    C: 'a,
4802{
4803    hub: &'a CloudFilestore<C>,
4804    _request: Share,
4805    _name: String,
4806    _update_mask: Option<common::FieldMask>,
4807    _delegate: Option<&'a mut dyn common::Delegate>,
4808    _additional_params: HashMap<String, String>,
4809    _scopes: BTreeSet<String>,
4810}
4811
4812impl<'a, C> common::CallBuilder for ProjectLocationInstanceSharePatchCall<'a, C> {}
4813
4814impl<'a, C> ProjectLocationInstanceSharePatchCall<'a, C>
4815where
4816    C: common::Connector,
4817{
4818    /// Perform the operation you have build so far.
4819    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
4820        use std::borrow::Cow;
4821        use std::io::{Read, Seek};
4822
4823        use common::{url::Params, ToParts};
4824        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
4825
4826        let mut dd = common::DefaultDelegate;
4827        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
4828        dlg.begin(common::MethodInfo {
4829            id: "file.projects.locations.instances.shares.patch",
4830            http_method: hyper::Method::PATCH,
4831        });
4832
4833        for &field in ["alt", "name", "updateMask"].iter() {
4834            if self._additional_params.contains_key(field) {
4835                dlg.finished(false);
4836                return Err(common::Error::FieldClash(field));
4837            }
4838        }
4839
4840        let mut params = Params::with_capacity(5 + self._additional_params.len());
4841        params.push("name", self._name);
4842        if let Some(value) = self._update_mask.as_ref() {
4843            params.push("updateMask", value.to_string());
4844        }
4845
4846        params.extend(self._additional_params.iter());
4847
4848        params.push("alt", "json");
4849        let mut url = self.hub._base_url.clone() + "v1beta1/{+name}";
4850        if self._scopes.is_empty() {
4851            self._scopes
4852                .insert(Scope::CloudPlatform.as_ref().to_string());
4853        }
4854
4855        #[allow(clippy::single_element_loop)]
4856        for &(find_this, param_name) in [("{+name}", "name")].iter() {
4857            url = params.uri_replacement(url, param_name, find_this, true);
4858        }
4859        {
4860            let to_remove = ["name"];
4861            params.remove_params(&to_remove);
4862        }
4863
4864        let url = params.parse_with_url(&url);
4865
4866        let mut json_mime_type = mime::APPLICATION_JSON;
4867        let mut request_value_reader = {
4868            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
4869            common::remove_json_null_values(&mut value);
4870            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
4871            serde_json::to_writer(&mut dst, &value).unwrap();
4872            dst
4873        };
4874        let request_size = request_value_reader
4875            .seek(std::io::SeekFrom::End(0))
4876            .unwrap();
4877        request_value_reader
4878            .seek(std::io::SeekFrom::Start(0))
4879            .unwrap();
4880
4881        loop {
4882            let token = match self
4883                .hub
4884                .auth
4885                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
4886                .await
4887            {
4888                Ok(token) => token,
4889                Err(e) => match dlg.token(e) {
4890                    Ok(token) => token,
4891                    Err(e) => {
4892                        dlg.finished(false);
4893                        return Err(common::Error::MissingToken(e));
4894                    }
4895                },
4896            };
4897            request_value_reader
4898                .seek(std::io::SeekFrom::Start(0))
4899                .unwrap();
4900            let mut req_result = {
4901                let client = &self.hub.client;
4902                dlg.pre_request();
4903                let mut req_builder = hyper::Request::builder()
4904                    .method(hyper::Method::PATCH)
4905                    .uri(url.as_str())
4906                    .header(USER_AGENT, self.hub._user_agent.clone());
4907
4908                if let Some(token) = token.as_ref() {
4909                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
4910                }
4911
4912                let request = req_builder
4913                    .header(CONTENT_TYPE, json_mime_type.to_string())
4914                    .header(CONTENT_LENGTH, request_size as u64)
4915                    .body(common::to_body(
4916                        request_value_reader.get_ref().clone().into(),
4917                    ));
4918
4919                client.request(request.unwrap()).await
4920            };
4921
4922            match req_result {
4923                Err(err) => {
4924                    if let common::Retry::After(d) = dlg.http_error(&err) {
4925                        sleep(d).await;
4926                        continue;
4927                    }
4928                    dlg.finished(false);
4929                    return Err(common::Error::HttpError(err));
4930                }
4931                Ok(res) => {
4932                    let (mut parts, body) = res.into_parts();
4933                    let mut body = common::Body::new(body);
4934                    if !parts.status.is_success() {
4935                        let bytes = common::to_bytes(body).await.unwrap_or_default();
4936                        let error = serde_json::from_str(&common::to_string(&bytes));
4937                        let response = common::to_response(parts, bytes.into());
4938
4939                        if let common::Retry::After(d) =
4940                            dlg.http_failure(&response, error.as_ref().ok())
4941                        {
4942                            sleep(d).await;
4943                            continue;
4944                        }
4945
4946                        dlg.finished(false);
4947
4948                        return Err(match error {
4949                            Ok(value) => common::Error::BadRequest(value),
4950                            _ => common::Error::Failure(response),
4951                        });
4952                    }
4953                    let response = {
4954                        let bytes = common::to_bytes(body).await.unwrap_or_default();
4955                        let encoded = common::to_string(&bytes);
4956                        match serde_json::from_str(&encoded) {
4957                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4958                            Err(error) => {
4959                                dlg.response_json_decode_error(&encoded, &error);
4960                                return Err(common::Error::JsonDecodeError(
4961                                    encoded.to_string(),
4962                                    error,
4963                                ));
4964                            }
4965                        }
4966                    };
4967
4968                    dlg.finished(true);
4969                    return Ok(response);
4970                }
4971            }
4972        }
4973    }
4974
4975    ///
4976    /// Sets the *request* property to the given value.
4977    ///
4978    /// Even though the property as already been set when instantiating this call,
4979    /// we provide this method for API completeness.
4980    pub fn request(mut self, new_value: Share) -> ProjectLocationInstanceSharePatchCall<'a, C> {
4981        self._request = new_value;
4982        self
4983    }
4984    /// Output only. The resource name of the share, in the format `projects/{project_id}/locations/{location_id}/instances/{instance_id}/shares/{share_id}`.
4985    ///
4986    /// Sets the *name* path property to the given value.
4987    ///
4988    /// Even though the property as already been set when instantiating this call,
4989    /// we provide this method for API completeness.
4990    pub fn name(mut self, new_value: &str) -> ProjectLocationInstanceSharePatchCall<'a, C> {
4991        self._name = new_value.to_string();
4992        self
4993    }
4994    /// 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"
4995    ///
4996    /// Sets the *update mask* query property to the given value.
4997    pub fn update_mask(
4998        mut self,
4999        new_value: common::FieldMask,
5000    ) -> ProjectLocationInstanceSharePatchCall<'a, C> {
5001        self._update_mask = Some(new_value);
5002        self
5003    }
5004    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5005    /// while executing the actual API request.
5006    ///
5007    /// ````text
5008    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
5009    /// ````
5010    ///
5011    /// Sets the *delegate* property to the given value.
5012    pub fn delegate(
5013        mut self,
5014        new_value: &'a mut dyn common::Delegate,
5015    ) -> ProjectLocationInstanceSharePatchCall<'a, C> {
5016        self._delegate = Some(new_value);
5017        self
5018    }
5019
5020    /// Set any additional parameter of the query string used in the request.
5021    /// It should be used to set parameters which are not yet available through their own
5022    /// setters.
5023    ///
5024    /// Please note that this method must not be used to set any of the known parameters
5025    /// which have their own setter method. If done anyway, the request will fail.
5026    ///
5027    /// # Additional Parameters
5028    ///
5029    /// * *$.xgafv* (query-string) - V1 error format.
5030    /// * *access_token* (query-string) - OAuth access token.
5031    /// * *alt* (query-string) - Data format for response.
5032    /// * *callback* (query-string) - JSONP
5033    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5034    /// * *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.
5035    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5036    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5037    /// * *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.
5038    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5039    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5040    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationInstanceSharePatchCall<'a, C>
5041    where
5042        T: AsRef<str>,
5043    {
5044        self._additional_params
5045            .insert(name.as_ref().to_string(), value.as_ref().to_string());
5046        self
5047    }
5048
5049    /// Identifies the authorization scope for the method you are building.
5050    ///
5051    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5052    /// [`Scope::CloudPlatform`].
5053    ///
5054    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5055    /// tokens for more than one scope.
5056    ///
5057    /// Usually there is more than one suitable scope to authorize an operation, some of which may
5058    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5059    /// sufficient, a read-write scope will do as well.
5060    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationInstanceSharePatchCall<'a, C>
5061    where
5062        St: AsRef<str>,
5063    {
5064        self._scopes.insert(String::from(scope.as_ref()));
5065        self
5066    }
5067    /// Identifies the authorization scope(s) for the method you are building.
5068    ///
5069    /// See [`Self::add_scope()`] for details.
5070    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationInstanceSharePatchCall<'a, C>
5071    where
5072        I: IntoIterator<Item = St>,
5073        St: AsRef<str>,
5074    {
5075        self._scopes
5076            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5077        self
5078    }
5079
5080    /// Removes all scopes, and no default scope will be used either.
5081    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5082    /// for details).
5083    pub fn clear_scopes(mut self) -> ProjectLocationInstanceSharePatchCall<'a, C> {
5084        self._scopes.clear();
5085        self
5086    }
5087}
5088
5089/// Creates a snapshot.
5090///
5091/// A builder for the *locations.instances.snapshots.create* method supported by a *project* resource.
5092/// It is not used directly, but through a [`ProjectMethods`] instance.
5093///
5094/// # Example
5095///
5096/// Instantiate a resource method builder
5097///
5098/// ```test_harness,no_run
5099/// # extern crate hyper;
5100/// # extern crate hyper_rustls;
5101/// # extern crate google_file1_beta1 as file1_beta1;
5102/// use file1_beta1::api::Snapshot;
5103/// # async fn dox() {
5104/// # use file1_beta1::{CloudFilestore, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5105///
5106/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5107/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
5108/// #     .with_native_roots()
5109/// #     .unwrap()
5110/// #     .https_only()
5111/// #     .enable_http2()
5112/// #     .build();
5113///
5114/// # let executor = hyper_util::rt::TokioExecutor::new();
5115/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
5116/// #     secret,
5117/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5118/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
5119/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
5120/// #     ),
5121/// # ).build().await.unwrap();
5122///
5123/// # let client = hyper_util::client::legacy::Client::builder(
5124/// #     hyper_util::rt::TokioExecutor::new()
5125/// # )
5126/// # .build(
5127/// #     hyper_rustls::HttpsConnectorBuilder::new()
5128/// #         .with_native_roots()
5129/// #         .unwrap()
5130/// #         .https_or_http()
5131/// #         .enable_http2()
5132/// #         .build()
5133/// # );
5134/// # let mut hub = CloudFilestore::new(client, auth);
5135/// // As the method needs a request, you would usually fill it with the desired information
5136/// // into the respective structure. Some of the parts shown here might not be applicable !
5137/// // Values shown here are possibly random and not representative !
5138/// let mut req = Snapshot::default();
5139///
5140/// // You can configure optional parameters by calling the respective setters at will, and
5141/// // execute the final call using `doit()`.
5142/// // Values shown here are possibly random and not representative !
5143/// let result = hub.projects().locations_instances_snapshots_create(req, "parent")
5144///              .snapshot_id("rebum.")
5145///              .doit().await;
5146/// # }
5147/// ```
5148pub struct ProjectLocationInstanceSnapshotCreateCall<'a, C>
5149where
5150    C: 'a,
5151{
5152    hub: &'a CloudFilestore<C>,
5153    _request: Snapshot,
5154    _parent: String,
5155    _snapshot_id: Option<String>,
5156    _delegate: Option<&'a mut dyn common::Delegate>,
5157    _additional_params: HashMap<String, String>,
5158    _scopes: BTreeSet<String>,
5159}
5160
5161impl<'a, C> common::CallBuilder for ProjectLocationInstanceSnapshotCreateCall<'a, C> {}
5162
5163impl<'a, C> ProjectLocationInstanceSnapshotCreateCall<'a, C>
5164where
5165    C: common::Connector,
5166{
5167    /// Perform the operation you have build so far.
5168    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
5169        use std::borrow::Cow;
5170        use std::io::{Read, Seek};
5171
5172        use common::{url::Params, ToParts};
5173        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5174
5175        let mut dd = common::DefaultDelegate;
5176        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5177        dlg.begin(common::MethodInfo {
5178            id: "file.projects.locations.instances.snapshots.create",
5179            http_method: hyper::Method::POST,
5180        });
5181
5182        for &field in ["alt", "parent", "snapshotId"].iter() {
5183            if self._additional_params.contains_key(field) {
5184                dlg.finished(false);
5185                return Err(common::Error::FieldClash(field));
5186            }
5187        }
5188
5189        let mut params = Params::with_capacity(5 + self._additional_params.len());
5190        params.push("parent", self._parent);
5191        if let Some(value) = self._snapshot_id.as_ref() {
5192            params.push("snapshotId", value);
5193        }
5194
5195        params.extend(self._additional_params.iter());
5196
5197        params.push("alt", "json");
5198        let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/snapshots";
5199        if self._scopes.is_empty() {
5200            self._scopes
5201                .insert(Scope::CloudPlatform.as_ref().to_string());
5202        }
5203
5204        #[allow(clippy::single_element_loop)]
5205        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
5206            url = params.uri_replacement(url, param_name, find_this, true);
5207        }
5208        {
5209            let to_remove = ["parent"];
5210            params.remove_params(&to_remove);
5211        }
5212
5213        let url = params.parse_with_url(&url);
5214
5215        let mut json_mime_type = mime::APPLICATION_JSON;
5216        let mut request_value_reader = {
5217            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
5218            common::remove_json_null_values(&mut value);
5219            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
5220            serde_json::to_writer(&mut dst, &value).unwrap();
5221            dst
5222        };
5223        let request_size = request_value_reader
5224            .seek(std::io::SeekFrom::End(0))
5225            .unwrap();
5226        request_value_reader
5227            .seek(std::io::SeekFrom::Start(0))
5228            .unwrap();
5229
5230        loop {
5231            let token = match self
5232                .hub
5233                .auth
5234                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5235                .await
5236            {
5237                Ok(token) => token,
5238                Err(e) => match dlg.token(e) {
5239                    Ok(token) => token,
5240                    Err(e) => {
5241                        dlg.finished(false);
5242                        return Err(common::Error::MissingToken(e));
5243                    }
5244                },
5245            };
5246            request_value_reader
5247                .seek(std::io::SeekFrom::Start(0))
5248                .unwrap();
5249            let mut req_result = {
5250                let client = &self.hub.client;
5251                dlg.pre_request();
5252                let mut req_builder = hyper::Request::builder()
5253                    .method(hyper::Method::POST)
5254                    .uri(url.as_str())
5255                    .header(USER_AGENT, self.hub._user_agent.clone());
5256
5257                if let Some(token) = token.as_ref() {
5258                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5259                }
5260
5261                let request = req_builder
5262                    .header(CONTENT_TYPE, json_mime_type.to_string())
5263                    .header(CONTENT_LENGTH, request_size as u64)
5264                    .body(common::to_body(
5265                        request_value_reader.get_ref().clone().into(),
5266                    ));
5267
5268                client.request(request.unwrap()).await
5269            };
5270
5271            match req_result {
5272                Err(err) => {
5273                    if let common::Retry::After(d) = dlg.http_error(&err) {
5274                        sleep(d).await;
5275                        continue;
5276                    }
5277                    dlg.finished(false);
5278                    return Err(common::Error::HttpError(err));
5279                }
5280                Ok(res) => {
5281                    let (mut parts, body) = res.into_parts();
5282                    let mut body = common::Body::new(body);
5283                    if !parts.status.is_success() {
5284                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5285                        let error = serde_json::from_str(&common::to_string(&bytes));
5286                        let response = common::to_response(parts, bytes.into());
5287
5288                        if let common::Retry::After(d) =
5289                            dlg.http_failure(&response, error.as_ref().ok())
5290                        {
5291                            sleep(d).await;
5292                            continue;
5293                        }
5294
5295                        dlg.finished(false);
5296
5297                        return Err(match error {
5298                            Ok(value) => common::Error::BadRequest(value),
5299                            _ => common::Error::Failure(response),
5300                        });
5301                    }
5302                    let response = {
5303                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5304                        let encoded = common::to_string(&bytes);
5305                        match serde_json::from_str(&encoded) {
5306                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5307                            Err(error) => {
5308                                dlg.response_json_decode_error(&encoded, &error);
5309                                return Err(common::Error::JsonDecodeError(
5310                                    encoded.to_string(),
5311                                    error,
5312                                ));
5313                            }
5314                        }
5315                    };
5316
5317                    dlg.finished(true);
5318                    return Ok(response);
5319                }
5320            }
5321        }
5322    }
5323
5324    ///
5325    /// Sets the *request* property to the given value.
5326    ///
5327    /// Even though the property as already been set when instantiating this call,
5328    /// we provide this method for API completeness.
5329    pub fn request(
5330        mut self,
5331        new_value: Snapshot,
5332    ) -> ProjectLocationInstanceSnapshotCreateCall<'a, C> {
5333        self._request = new_value;
5334        self
5335    }
5336    /// Required. The Filestore Instance to create the snapshots of, in the format `projects/{project_id}/locations/{location}/instances/{instance_id}`
5337    ///
5338    /// Sets the *parent* path property to the given value.
5339    ///
5340    /// Even though the property as already been set when instantiating this call,
5341    /// we provide this method for API completeness.
5342    pub fn parent(mut self, new_value: &str) -> ProjectLocationInstanceSnapshotCreateCall<'a, C> {
5343        self._parent = new_value.to_string();
5344        self
5345    }
5346    /// 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.
5347    ///
5348    /// Sets the *snapshot id* query property to the given value.
5349    pub fn snapshot_id(
5350        mut self,
5351        new_value: &str,
5352    ) -> ProjectLocationInstanceSnapshotCreateCall<'a, C> {
5353        self._snapshot_id = Some(new_value.to_string());
5354        self
5355    }
5356    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5357    /// while executing the actual API request.
5358    ///
5359    /// ````text
5360    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
5361    /// ````
5362    ///
5363    /// Sets the *delegate* property to the given value.
5364    pub fn delegate(
5365        mut self,
5366        new_value: &'a mut dyn common::Delegate,
5367    ) -> ProjectLocationInstanceSnapshotCreateCall<'a, C> {
5368        self._delegate = Some(new_value);
5369        self
5370    }
5371
5372    /// Set any additional parameter of the query string used in the request.
5373    /// It should be used to set parameters which are not yet available through their own
5374    /// setters.
5375    ///
5376    /// Please note that this method must not be used to set any of the known parameters
5377    /// which have their own setter method. If done anyway, the request will fail.
5378    ///
5379    /// # Additional Parameters
5380    ///
5381    /// * *$.xgafv* (query-string) - V1 error format.
5382    /// * *access_token* (query-string) - OAuth access token.
5383    /// * *alt* (query-string) - Data format for response.
5384    /// * *callback* (query-string) - JSONP
5385    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5386    /// * *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.
5387    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5388    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5389    /// * *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.
5390    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5391    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5392    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationInstanceSnapshotCreateCall<'a, C>
5393    where
5394        T: AsRef<str>,
5395    {
5396        self._additional_params
5397            .insert(name.as_ref().to_string(), value.as_ref().to_string());
5398        self
5399    }
5400
5401    /// Identifies the authorization scope for the method you are building.
5402    ///
5403    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5404    /// [`Scope::CloudPlatform`].
5405    ///
5406    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5407    /// tokens for more than one scope.
5408    ///
5409    /// Usually there is more than one suitable scope to authorize an operation, some of which may
5410    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5411    /// sufficient, a read-write scope will do as well.
5412    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationInstanceSnapshotCreateCall<'a, C>
5413    where
5414        St: AsRef<str>,
5415    {
5416        self._scopes.insert(String::from(scope.as_ref()));
5417        self
5418    }
5419    /// Identifies the authorization scope(s) for the method you are building.
5420    ///
5421    /// See [`Self::add_scope()`] for details.
5422    pub fn add_scopes<I, St>(
5423        mut self,
5424        scopes: I,
5425    ) -> ProjectLocationInstanceSnapshotCreateCall<'a, C>
5426    where
5427        I: IntoIterator<Item = St>,
5428        St: AsRef<str>,
5429    {
5430        self._scopes
5431            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5432        self
5433    }
5434
5435    /// Removes all scopes, and no default scope will be used either.
5436    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5437    /// for details).
5438    pub fn clear_scopes(mut self) -> ProjectLocationInstanceSnapshotCreateCall<'a, C> {
5439        self._scopes.clear();
5440        self
5441    }
5442}
5443
5444/// Deletes a snapshot.
5445///
5446/// A builder for the *locations.instances.snapshots.delete* method supported by a *project* resource.
5447/// It is not used directly, but through a [`ProjectMethods`] instance.
5448///
5449/// # Example
5450///
5451/// Instantiate a resource method builder
5452///
5453/// ```test_harness,no_run
5454/// # extern crate hyper;
5455/// # extern crate hyper_rustls;
5456/// # extern crate google_file1_beta1 as file1_beta1;
5457/// # async fn dox() {
5458/// # use file1_beta1::{CloudFilestore, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5459///
5460/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5461/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
5462/// #     .with_native_roots()
5463/// #     .unwrap()
5464/// #     .https_only()
5465/// #     .enable_http2()
5466/// #     .build();
5467///
5468/// # let executor = hyper_util::rt::TokioExecutor::new();
5469/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
5470/// #     secret,
5471/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5472/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
5473/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
5474/// #     ),
5475/// # ).build().await.unwrap();
5476///
5477/// # let client = hyper_util::client::legacy::Client::builder(
5478/// #     hyper_util::rt::TokioExecutor::new()
5479/// # )
5480/// # .build(
5481/// #     hyper_rustls::HttpsConnectorBuilder::new()
5482/// #         .with_native_roots()
5483/// #         .unwrap()
5484/// #         .https_or_http()
5485/// #         .enable_http2()
5486/// #         .build()
5487/// # );
5488/// # let mut hub = CloudFilestore::new(client, auth);
5489/// // You can configure optional parameters by calling the respective setters at will, and
5490/// // execute the final call using `doit()`.
5491/// // Values shown here are possibly random and not representative !
5492/// let result = hub.projects().locations_instances_snapshots_delete("name")
5493///              .doit().await;
5494/// # }
5495/// ```
5496pub struct ProjectLocationInstanceSnapshotDeleteCall<'a, C>
5497where
5498    C: 'a,
5499{
5500    hub: &'a CloudFilestore<C>,
5501    _name: String,
5502    _delegate: Option<&'a mut dyn common::Delegate>,
5503    _additional_params: HashMap<String, String>,
5504    _scopes: BTreeSet<String>,
5505}
5506
5507impl<'a, C> common::CallBuilder for ProjectLocationInstanceSnapshotDeleteCall<'a, C> {}
5508
5509impl<'a, C> ProjectLocationInstanceSnapshotDeleteCall<'a, C>
5510where
5511    C: common::Connector,
5512{
5513    /// Perform the operation you have build so far.
5514    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
5515        use std::borrow::Cow;
5516        use std::io::{Read, Seek};
5517
5518        use common::{url::Params, ToParts};
5519        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5520
5521        let mut dd = common::DefaultDelegate;
5522        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5523        dlg.begin(common::MethodInfo {
5524            id: "file.projects.locations.instances.snapshots.delete",
5525            http_method: hyper::Method::DELETE,
5526        });
5527
5528        for &field in ["alt", "name"].iter() {
5529            if self._additional_params.contains_key(field) {
5530                dlg.finished(false);
5531                return Err(common::Error::FieldClash(field));
5532            }
5533        }
5534
5535        let mut params = Params::with_capacity(3 + self._additional_params.len());
5536        params.push("name", self._name);
5537
5538        params.extend(self._additional_params.iter());
5539
5540        params.push("alt", "json");
5541        let mut url = self.hub._base_url.clone() + "v1beta1/{+name}";
5542        if self._scopes.is_empty() {
5543            self._scopes
5544                .insert(Scope::CloudPlatform.as_ref().to_string());
5545        }
5546
5547        #[allow(clippy::single_element_loop)]
5548        for &(find_this, param_name) in [("{+name}", "name")].iter() {
5549            url = params.uri_replacement(url, param_name, find_this, true);
5550        }
5551        {
5552            let to_remove = ["name"];
5553            params.remove_params(&to_remove);
5554        }
5555
5556        let url = params.parse_with_url(&url);
5557
5558        loop {
5559            let token = match self
5560                .hub
5561                .auth
5562                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5563                .await
5564            {
5565                Ok(token) => token,
5566                Err(e) => match dlg.token(e) {
5567                    Ok(token) => token,
5568                    Err(e) => {
5569                        dlg.finished(false);
5570                        return Err(common::Error::MissingToken(e));
5571                    }
5572                },
5573            };
5574            let mut req_result = {
5575                let client = &self.hub.client;
5576                dlg.pre_request();
5577                let mut req_builder = hyper::Request::builder()
5578                    .method(hyper::Method::DELETE)
5579                    .uri(url.as_str())
5580                    .header(USER_AGENT, self.hub._user_agent.clone());
5581
5582                if let Some(token) = token.as_ref() {
5583                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5584                }
5585
5586                let request = req_builder
5587                    .header(CONTENT_LENGTH, 0_u64)
5588                    .body(common::to_body::<String>(None));
5589
5590                client.request(request.unwrap()).await
5591            };
5592
5593            match req_result {
5594                Err(err) => {
5595                    if let common::Retry::After(d) = dlg.http_error(&err) {
5596                        sleep(d).await;
5597                        continue;
5598                    }
5599                    dlg.finished(false);
5600                    return Err(common::Error::HttpError(err));
5601                }
5602                Ok(res) => {
5603                    let (mut parts, body) = res.into_parts();
5604                    let mut body = common::Body::new(body);
5605                    if !parts.status.is_success() {
5606                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5607                        let error = serde_json::from_str(&common::to_string(&bytes));
5608                        let response = common::to_response(parts, bytes.into());
5609
5610                        if let common::Retry::After(d) =
5611                            dlg.http_failure(&response, error.as_ref().ok())
5612                        {
5613                            sleep(d).await;
5614                            continue;
5615                        }
5616
5617                        dlg.finished(false);
5618
5619                        return Err(match error {
5620                            Ok(value) => common::Error::BadRequest(value),
5621                            _ => common::Error::Failure(response),
5622                        });
5623                    }
5624                    let response = {
5625                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5626                        let encoded = common::to_string(&bytes);
5627                        match serde_json::from_str(&encoded) {
5628                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5629                            Err(error) => {
5630                                dlg.response_json_decode_error(&encoded, &error);
5631                                return Err(common::Error::JsonDecodeError(
5632                                    encoded.to_string(),
5633                                    error,
5634                                ));
5635                            }
5636                        }
5637                    };
5638
5639                    dlg.finished(true);
5640                    return Ok(response);
5641                }
5642            }
5643        }
5644    }
5645
5646    /// Required. The snapshot resource name, in the format `projects/{project_id}/locations/{location}/instances/{instance_id}/snapshots/{snapshot_id}`
5647    ///
5648    /// Sets the *name* path property to the given value.
5649    ///
5650    /// Even though the property as already been set when instantiating this call,
5651    /// we provide this method for API completeness.
5652    pub fn name(mut self, new_value: &str) -> ProjectLocationInstanceSnapshotDeleteCall<'a, C> {
5653        self._name = new_value.to_string();
5654        self
5655    }
5656    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5657    /// while executing the actual API request.
5658    ///
5659    /// ````text
5660    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
5661    /// ````
5662    ///
5663    /// Sets the *delegate* property to the given value.
5664    pub fn delegate(
5665        mut self,
5666        new_value: &'a mut dyn common::Delegate,
5667    ) -> ProjectLocationInstanceSnapshotDeleteCall<'a, C> {
5668        self._delegate = Some(new_value);
5669        self
5670    }
5671
5672    /// Set any additional parameter of the query string used in the request.
5673    /// It should be used to set parameters which are not yet available through their own
5674    /// setters.
5675    ///
5676    /// Please note that this method must not be used to set any of the known parameters
5677    /// which have their own setter method. If done anyway, the request will fail.
5678    ///
5679    /// # Additional Parameters
5680    ///
5681    /// * *$.xgafv* (query-string) - V1 error format.
5682    /// * *access_token* (query-string) - OAuth access token.
5683    /// * *alt* (query-string) - Data format for response.
5684    /// * *callback* (query-string) - JSONP
5685    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5686    /// * *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.
5687    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5688    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5689    /// * *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.
5690    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5691    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5692    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationInstanceSnapshotDeleteCall<'a, C>
5693    where
5694        T: AsRef<str>,
5695    {
5696        self._additional_params
5697            .insert(name.as_ref().to_string(), value.as_ref().to_string());
5698        self
5699    }
5700
5701    /// Identifies the authorization scope for the method you are building.
5702    ///
5703    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5704    /// [`Scope::CloudPlatform`].
5705    ///
5706    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5707    /// tokens for more than one scope.
5708    ///
5709    /// Usually there is more than one suitable scope to authorize an operation, some of which may
5710    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5711    /// sufficient, a read-write scope will do as well.
5712    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationInstanceSnapshotDeleteCall<'a, C>
5713    where
5714        St: AsRef<str>,
5715    {
5716        self._scopes.insert(String::from(scope.as_ref()));
5717        self
5718    }
5719    /// Identifies the authorization scope(s) for the method you are building.
5720    ///
5721    /// See [`Self::add_scope()`] for details.
5722    pub fn add_scopes<I, St>(
5723        mut self,
5724        scopes: I,
5725    ) -> ProjectLocationInstanceSnapshotDeleteCall<'a, C>
5726    where
5727        I: IntoIterator<Item = St>,
5728        St: AsRef<str>,
5729    {
5730        self._scopes
5731            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5732        self
5733    }
5734
5735    /// Removes all scopes, and no default scope will be used either.
5736    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5737    /// for details).
5738    pub fn clear_scopes(mut self) -> ProjectLocationInstanceSnapshotDeleteCall<'a, C> {
5739        self._scopes.clear();
5740        self
5741    }
5742}
5743
5744/// Gets the details of a specific snapshot.
5745///
5746/// A builder for the *locations.instances.snapshots.get* method supported by a *project* resource.
5747/// It is not used directly, but through a [`ProjectMethods`] instance.
5748///
5749/// # Example
5750///
5751/// Instantiate a resource method builder
5752///
5753/// ```test_harness,no_run
5754/// # extern crate hyper;
5755/// # extern crate hyper_rustls;
5756/// # extern crate google_file1_beta1 as file1_beta1;
5757/// # async fn dox() {
5758/// # use file1_beta1::{CloudFilestore, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5759///
5760/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5761/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
5762/// #     .with_native_roots()
5763/// #     .unwrap()
5764/// #     .https_only()
5765/// #     .enable_http2()
5766/// #     .build();
5767///
5768/// # let executor = hyper_util::rt::TokioExecutor::new();
5769/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
5770/// #     secret,
5771/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5772/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
5773/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
5774/// #     ),
5775/// # ).build().await.unwrap();
5776///
5777/// # let client = hyper_util::client::legacy::Client::builder(
5778/// #     hyper_util::rt::TokioExecutor::new()
5779/// # )
5780/// # .build(
5781/// #     hyper_rustls::HttpsConnectorBuilder::new()
5782/// #         .with_native_roots()
5783/// #         .unwrap()
5784/// #         .https_or_http()
5785/// #         .enable_http2()
5786/// #         .build()
5787/// # );
5788/// # let mut hub = CloudFilestore::new(client, auth);
5789/// // You can configure optional parameters by calling the respective setters at will, and
5790/// // execute the final call using `doit()`.
5791/// // Values shown here are possibly random and not representative !
5792/// let result = hub.projects().locations_instances_snapshots_get("name")
5793///              .doit().await;
5794/// # }
5795/// ```
5796pub struct ProjectLocationInstanceSnapshotGetCall<'a, C>
5797where
5798    C: 'a,
5799{
5800    hub: &'a CloudFilestore<C>,
5801    _name: String,
5802    _delegate: Option<&'a mut dyn common::Delegate>,
5803    _additional_params: HashMap<String, String>,
5804    _scopes: BTreeSet<String>,
5805}
5806
5807impl<'a, C> common::CallBuilder for ProjectLocationInstanceSnapshotGetCall<'a, C> {}
5808
5809impl<'a, C> ProjectLocationInstanceSnapshotGetCall<'a, C>
5810where
5811    C: common::Connector,
5812{
5813    /// Perform the operation you have build so far.
5814    pub async fn doit(mut self) -> common::Result<(common::Response, Snapshot)> {
5815        use std::borrow::Cow;
5816        use std::io::{Read, Seek};
5817
5818        use common::{url::Params, ToParts};
5819        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5820
5821        let mut dd = common::DefaultDelegate;
5822        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5823        dlg.begin(common::MethodInfo {
5824            id: "file.projects.locations.instances.snapshots.get",
5825            http_method: hyper::Method::GET,
5826        });
5827
5828        for &field in ["alt", "name"].iter() {
5829            if self._additional_params.contains_key(field) {
5830                dlg.finished(false);
5831                return Err(common::Error::FieldClash(field));
5832            }
5833        }
5834
5835        let mut params = Params::with_capacity(3 + self._additional_params.len());
5836        params.push("name", self._name);
5837
5838        params.extend(self._additional_params.iter());
5839
5840        params.push("alt", "json");
5841        let mut url = self.hub._base_url.clone() + "v1beta1/{+name}";
5842        if self._scopes.is_empty() {
5843            self._scopes
5844                .insert(Scope::CloudPlatform.as_ref().to_string());
5845        }
5846
5847        #[allow(clippy::single_element_loop)]
5848        for &(find_this, param_name) in [("{+name}", "name")].iter() {
5849            url = params.uri_replacement(url, param_name, find_this, true);
5850        }
5851        {
5852            let to_remove = ["name"];
5853            params.remove_params(&to_remove);
5854        }
5855
5856        let url = params.parse_with_url(&url);
5857
5858        loop {
5859            let token = match self
5860                .hub
5861                .auth
5862                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5863                .await
5864            {
5865                Ok(token) => token,
5866                Err(e) => match dlg.token(e) {
5867                    Ok(token) => token,
5868                    Err(e) => {
5869                        dlg.finished(false);
5870                        return Err(common::Error::MissingToken(e));
5871                    }
5872                },
5873            };
5874            let mut req_result = {
5875                let client = &self.hub.client;
5876                dlg.pre_request();
5877                let mut req_builder = hyper::Request::builder()
5878                    .method(hyper::Method::GET)
5879                    .uri(url.as_str())
5880                    .header(USER_AGENT, self.hub._user_agent.clone());
5881
5882                if let Some(token) = token.as_ref() {
5883                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5884                }
5885
5886                let request = req_builder
5887                    .header(CONTENT_LENGTH, 0_u64)
5888                    .body(common::to_body::<String>(None));
5889
5890                client.request(request.unwrap()).await
5891            };
5892
5893            match req_result {
5894                Err(err) => {
5895                    if let common::Retry::After(d) = dlg.http_error(&err) {
5896                        sleep(d).await;
5897                        continue;
5898                    }
5899                    dlg.finished(false);
5900                    return Err(common::Error::HttpError(err));
5901                }
5902                Ok(res) => {
5903                    let (mut parts, body) = res.into_parts();
5904                    let mut body = common::Body::new(body);
5905                    if !parts.status.is_success() {
5906                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5907                        let error = serde_json::from_str(&common::to_string(&bytes));
5908                        let response = common::to_response(parts, bytes.into());
5909
5910                        if let common::Retry::After(d) =
5911                            dlg.http_failure(&response, error.as_ref().ok())
5912                        {
5913                            sleep(d).await;
5914                            continue;
5915                        }
5916
5917                        dlg.finished(false);
5918
5919                        return Err(match error {
5920                            Ok(value) => common::Error::BadRequest(value),
5921                            _ => common::Error::Failure(response),
5922                        });
5923                    }
5924                    let response = {
5925                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5926                        let encoded = common::to_string(&bytes);
5927                        match serde_json::from_str(&encoded) {
5928                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5929                            Err(error) => {
5930                                dlg.response_json_decode_error(&encoded, &error);
5931                                return Err(common::Error::JsonDecodeError(
5932                                    encoded.to_string(),
5933                                    error,
5934                                ));
5935                            }
5936                        }
5937                    };
5938
5939                    dlg.finished(true);
5940                    return Ok(response);
5941                }
5942            }
5943        }
5944    }
5945
5946    /// Required. The snapshot resource name, in the format `projects/{project_id}/locations/{location}/instances/{instance_id}/snapshots/{snapshot_id}`
5947    ///
5948    /// Sets the *name* path property to the given value.
5949    ///
5950    /// Even though the property as already been set when instantiating this call,
5951    /// we provide this method for API completeness.
5952    pub fn name(mut self, new_value: &str) -> ProjectLocationInstanceSnapshotGetCall<'a, C> {
5953        self._name = new_value.to_string();
5954        self
5955    }
5956    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5957    /// while executing the actual API request.
5958    ///
5959    /// ````text
5960    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
5961    /// ````
5962    ///
5963    /// Sets the *delegate* property to the given value.
5964    pub fn delegate(
5965        mut self,
5966        new_value: &'a mut dyn common::Delegate,
5967    ) -> ProjectLocationInstanceSnapshotGetCall<'a, C> {
5968        self._delegate = Some(new_value);
5969        self
5970    }
5971
5972    /// Set any additional parameter of the query string used in the request.
5973    /// It should be used to set parameters which are not yet available through their own
5974    /// setters.
5975    ///
5976    /// Please note that this method must not be used to set any of the known parameters
5977    /// which have their own setter method. If done anyway, the request will fail.
5978    ///
5979    /// # Additional Parameters
5980    ///
5981    /// * *$.xgafv* (query-string) - V1 error format.
5982    /// * *access_token* (query-string) - OAuth access token.
5983    /// * *alt* (query-string) - Data format for response.
5984    /// * *callback* (query-string) - JSONP
5985    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5986    /// * *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.
5987    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5988    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5989    /// * *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.
5990    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5991    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5992    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationInstanceSnapshotGetCall<'a, C>
5993    where
5994        T: AsRef<str>,
5995    {
5996        self._additional_params
5997            .insert(name.as_ref().to_string(), value.as_ref().to_string());
5998        self
5999    }
6000
6001    /// Identifies the authorization scope for the method you are building.
6002    ///
6003    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6004    /// [`Scope::CloudPlatform`].
6005    ///
6006    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6007    /// tokens for more than one scope.
6008    ///
6009    /// Usually there is more than one suitable scope to authorize an operation, some of which may
6010    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6011    /// sufficient, a read-write scope will do as well.
6012    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationInstanceSnapshotGetCall<'a, C>
6013    where
6014        St: AsRef<str>,
6015    {
6016        self._scopes.insert(String::from(scope.as_ref()));
6017        self
6018    }
6019    /// Identifies the authorization scope(s) for the method you are building.
6020    ///
6021    /// See [`Self::add_scope()`] for details.
6022    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationInstanceSnapshotGetCall<'a, C>
6023    where
6024        I: IntoIterator<Item = St>,
6025        St: AsRef<str>,
6026    {
6027        self._scopes
6028            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6029        self
6030    }
6031
6032    /// Removes all scopes, and no default scope will be used either.
6033    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6034    /// for details).
6035    pub fn clear_scopes(mut self) -> ProjectLocationInstanceSnapshotGetCall<'a, C> {
6036        self._scopes.clear();
6037        self
6038    }
6039}
6040
6041/// Lists all snapshots in a project for either a specified location or for all locations.
6042///
6043/// A builder for the *locations.instances.snapshots.list* method supported by a *project* resource.
6044/// It is not used directly, but through a [`ProjectMethods`] instance.
6045///
6046/// # Example
6047///
6048/// Instantiate a resource method builder
6049///
6050/// ```test_harness,no_run
6051/// # extern crate hyper;
6052/// # extern crate hyper_rustls;
6053/// # extern crate google_file1_beta1 as file1_beta1;
6054/// # async fn dox() {
6055/// # use file1_beta1::{CloudFilestore, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6056///
6057/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6058/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
6059/// #     .with_native_roots()
6060/// #     .unwrap()
6061/// #     .https_only()
6062/// #     .enable_http2()
6063/// #     .build();
6064///
6065/// # let executor = hyper_util::rt::TokioExecutor::new();
6066/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
6067/// #     secret,
6068/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6069/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
6070/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
6071/// #     ),
6072/// # ).build().await.unwrap();
6073///
6074/// # let client = hyper_util::client::legacy::Client::builder(
6075/// #     hyper_util::rt::TokioExecutor::new()
6076/// # )
6077/// # .build(
6078/// #     hyper_rustls::HttpsConnectorBuilder::new()
6079/// #         .with_native_roots()
6080/// #         .unwrap()
6081/// #         .https_or_http()
6082/// #         .enable_http2()
6083/// #         .build()
6084/// # );
6085/// # let mut hub = CloudFilestore::new(client, auth);
6086/// // You can configure optional parameters by calling the respective setters at will, and
6087/// // execute the final call using `doit()`.
6088/// // Values shown here are possibly random and not representative !
6089/// let result = hub.projects().locations_instances_snapshots_list("parent")
6090///              .return_partial_success(true)
6091///              .page_token("ea")
6092///              .page_size(-99)
6093///              .order_by("Lorem")
6094///              .filter("eos")
6095///              .doit().await;
6096/// # }
6097/// ```
6098pub struct ProjectLocationInstanceSnapshotListCall<'a, C>
6099where
6100    C: 'a,
6101{
6102    hub: &'a CloudFilestore<C>,
6103    _parent: String,
6104    _return_partial_success: Option<bool>,
6105    _page_token: Option<String>,
6106    _page_size: Option<i32>,
6107    _order_by: Option<String>,
6108    _filter: Option<String>,
6109    _delegate: Option<&'a mut dyn common::Delegate>,
6110    _additional_params: HashMap<String, String>,
6111    _scopes: BTreeSet<String>,
6112}
6113
6114impl<'a, C> common::CallBuilder for ProjectLocationInstanceSnapshotListCall<'a, C> {}
6115
6116impl<'a, C> ProjectLocationInstanceSnapshotListCall<'a, C>
6117where
6118    C: common::Connector,
6119{
6120    /// Perform the operation you have build so far.
6121    pub async fn doit(mut self) -> common::Result<(common::Response, ListSnapshotsResponse)> {
6122        use std::borrow::Cow;
6123        use std::io::{Read, Seek};
6124
6125        use common::{url::Params, ToParts};
6126        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6127
6128        let mut dd = common::DefaultDelegate;
6129        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6130        dlg.begin(common::MethodInfo {
6131            id: "file.projects.locations.instances.snapshots.list",
6132            http_method: hyper::Method::GET,
6133        });
6134
6135        for &field in [
6136            "alt",
6137            "parent",
6138            "returnPartialSuccess",
6139            "pageToken",
6140            "pageSize",
6141            "orderBy",
6142            "filter",
6143        ]
6144        .iter()
6145        {
6146            if self._additional_params.contains_key(field) {
6147                dlg.finished(false);
6148                return Err(common::Error::FieldClash(field));
6149            }
6150        }
6151
6152        let mut params = Params::with_capacity(8 + self._additional_params.len());
6153        params.push("parent", self._parent);
6154        if let Some(value) = self._return_partial_success.as_ref() {
6155            params.push("returnPartialSuccess", value.to_string());
6156        }
6157        if let Some(value) = self._page_token.as_ref() {
6158            params.push("pageToken", value);
6159        }
6160        if let Some(value) = self._page_size.as_ref() {
6161            params.push("pageSize", value.to_string());
6162        }
6163        if let Some(value) = self._order_by.as_ref() {
6164            params.push("orderBy", value);
6165        }
6166        if let Some(value) = self._filter.as_ref() {
6167            params.push("filter", value);
6168        }
6169
6170        params.extend(self._additional_params.iter());
6171
6172        params.push("alt", "json");
6173        let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/snapshots";
6174        if self._scopes.is_empty() {
6175            self._scopes
6176                .insert(Scope::CloudPlatform.as_ref().to_string());
6177        }
6178
6179        #[allow(clippy::single_element_loop)]
6180        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
6181            url = params.uri_replacement(url, param_name, find_this, true);
6182        }
6183        {
6184            let to_remove = ["parent"];
6185            params.remove_params(&to_remove);
6186        }
6187
6188        let url = params.parse_with_url(&url);
6189
6190        loop {
6191            let token = match self
6192                .hub
6193                .auth
6194                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6195                .await
6196            {
6197                Ok(token) => token,
6198                Err(e) => match dlg.token(e) {
6199                    Ok(token) => token,
6200                    Err(e) => {
6201                        dlg.finished(false);
6202                        return Err(common::Error::MissingToken(e));
6203                    }
6204                },
6205            };
6206            let mut req_result = {
6207                let client = &self.hub.client;
6208                dlg.pre_request();
6209                let mut req_builder = hyper::Request::builder()
6210                    .method(hyper::Method::GET)
6211                    .uri(url.as_str())
6212                    .header(USER_AGENT, self.hub._user_agent.clone());
6213
6214                if let Some(token) = token.as_ref() {
6215                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6216                }
6217
6218                let request = req_builder
6219                    .header(CONTENT_LENGTH, 0_u64)
6220                    .body(common::to_body::<String>(None));
6221
6222                client.request(request.unwrap()).await
6223            };
6224
6225            match req_result {
6226                Err(err) => {
6227                    if let common::Retry::After(d) = dlg.http_error(&err) {
6228                        sleep(d).await;
6229                        continue;
6230                    }
6231                    dlg.finished(false);
6232                    return Err(common::Error::HttpError(err));
6233                }
6234                Ok(res) => {
6235                    let (mut parts, body) = res.into_parts();
6236                    let mut body = common::Body::new(body);
6237                    if !parts.status.is_success() {
6238                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6239                        let error = serde_json::from_str(&common::to_string(&bytes));
6240                        let response = common::to_response(parts, bytes.into());
6241
6242                        if let common::Retry::After(d) =
6243                            dlg.http_failure(&response, error.as_ref().ok())
6244                        {
6245                            sleep(d).await;
6246                            continue;
6247                        }
6248
6249                        dlg.finished(false);
6250
6251                        return Err(match error {
6252                            Ok(value) => common::Error::BadRequest(value),
6253                            _ => common::Error::Failure(response),
6254                        });
6255                    }
6256                    let response = {
6257                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6258                        let encoded = common::to_string(&bytes);
6259                        match serde_json::from_str(&encoded) {
6260                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6261                            Err(error) => {
6262                                dlg.response_json_decode_error(&encoded, &error);
6263                                return Err(common::Error::JsonDecodeError(
6264                                    encoded.to_string(),
6265                                    error,
6266                                ));
6267                            }
6268                        }
6269                    };
6270
6271                    dlg.finished(true);
6272                    return Ok(response);
6273                }
6274            }
6275        }
6276    }
6277
6278    /// Required. The instance for which to retrieve snapshot information, in the format `projects/{project_id}/locations/{location}/instances/{instance_id}`.
6279    ///
6280    /// Sets the *parent* path property to the given value.
6281    ///
6282    /// Even though the property as already been set when instantiating this call,
6283    /// we provide this method for API completeness.
6284    pub fn parent(mut self, new_value: &str) -> ProjectLocationInstanceSnapshotListCall<'a, C> {
6285        self._parent = new_value.to_string();
6286        self
6287    }
6288    /// Optional. If true, allow partial responses for multi-regional Aggregated List requests.
6289    ///
6290    /// Sets the *return partial success* query property to the given value.
6291    pub fn return_partial_success(
6292        mut self,
6293        new_value: bool,
6294    ) -> ProjectLocationInstanceSnapshotListCall<'a, C> {
6295        self._return_partial_success = Some(new_value);
6296        self
6297    }
6298    /// The next_page_token value to use if there are additional results to retrieve for this list request.
6299    ///
6300    /// Sets the *page token* query property to the given value.
6301    pub fn page_token(mut self, new_value: &str) -> ProjectLocationInstanceSnapshotListCall<'a, C> {
6302        self._page_token = Some(new_value.to_string());
6303        self
6304    }
6305    /// The maximum number of items to return.
6306    ///
6307    /// Sets the *page size* query property to the given value.
6308    pub fn page_size(mut self, new_value: i32) -> ProjectLocationInstanceSnapshotListCall<'a, C> {
6309        self._page_size = Some(new_value);
6310        self
6311    }
6312    /// Sort results. Supported values are "name", "name desc" or "" (unsorted).
6313    ///
6314    /// Sets the *order by* query property to the given value.
6315    pub fn order_by(mut self, new_value: &str) -> ProjectLocationInstanceSnapshotListCall<'a, C> {
6316        self._order_by = Some(new_value.to_string());
6317        self
6318    }
6319    /// List filter.
6320    ///
6321    /// Sets the *filter* query property to the given value.
6322    pub fn filter(mut self, new_value: &str) -> ProjectLocationInstanceSnapshotListCall<'a, C> {
6323        self._filter = Some(new_value.to_string());
6324        self
6325    }
6326    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6327    /// while executing the actual API request.
6328    ///
6329    /// ````text
6330    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
6331    /// ````
6332    ///
6333    /// Sets the *delegate* property to the given value.
6334    pub fn delegate(
6335        mut self,
6336        new_value: &'a mut dyn common::Delegate,
6337    ) -> ProjectLocationInstanceSnapshotListCall<'a, C> {
6338        self._delegate = Some(new_value);
6339        self
6340    }
6341
6342    /// Set any additional parameter of the query string used in the request.
6343    /// It should be used to set parameters which are not yet available through their own
6344    /// setters.
6345    ///
6346    /// Please note that this method must not be used to set any of the known parameters
6347    /// which have their own setter method. If done anyway, the request will fail.
6348    ///
6349    /// # Additional Parameters
6350    ///
6351    /// * *$.xgafv* (query-string) - V1 error format.
6352    /// * *access_token* (query-string) - OAuth access token.
6353    /// * *alt* (query-string) - Data format for response.
6354    /// * *callback* (query-string) - JSONP
6355    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6356    /// * *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.
6357    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6358    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6359    /// * *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.
6360    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6361    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6362    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationInstanceSnapshotListCall<'a, C>
6363    where
6364        T: AsRef<str>,
6365    {
6366        self._additional_params
6367            .insert(name.as_ref().to_string(), value.as_ref().to_string());
6368        self
6369    }
6370
6371    /// Identifies the authorization scope for the method you are building.
6372    ///
6373    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6374    /// [`Scope::CloudPlatform`].
6375    ///
6376    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6377    /// tokens for more than one scope.
6378    ///
6379    /// Usually there is more than one suitable scope to authorize an operation, some of which may
6380    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6381    /// sufficient, a read-write scope will do as well.
6382    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationInstanceSnapshotListCall<'a, C>
6383    where
6384        St: AsRef<str>,
6385    {
6386        self._scopes.insert(String::from(scope.as_ref()));
6387        self
6388    }
6389    /// Identifies the authorization scope(s) for the method you are building.
6390    ///
6391    /// See [`Self::add_scope()`] for details.
6392    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationInstanceSnapshotListCall<'a, C>
6393    where
6394        I: IntoIterator<Item = St>,
6395        St: AsRef<str>,
6396    {
6397        self._scopes
6398            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6399        self
6400    }
6401
6402    /// Removes all scopes, and no default scope will be used either.
6403    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6404    /// for details).
6405    pub fn clear_scopes(mut self) -> ProjectLocationInstanceSnapshotListCall<'a, C> {
6406        self._scopes.clear();
6407        self
6408    }
6409}
6410
6411/// Updates the settings of a specific snapshot.
6412///
6413/// A builder for the *locations.instances.snapshots.patch* method supported by a *project* resource.
6414/// It is not used directly, but through a [`ProjectMethods`] instance.
6415///
6416/// # Example
6417///
6418/// Instantiate a resource method builder
6419///
6420/// ```test_harness,no_run
6421/// # extern crate hyper;
6422/// # extern crate hyper_rustls;
6423/// # extern crate google_file1_beta1 as file1_beta1;
6424/// use file1_beta1::api::Snapshot;
6425/// # async fn dox() {
6426/// # use file1_beta1::{CloudFilestore, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6427///
6428/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6429/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
6430/// #     .with_native_roots()
6431/// #     .unwrap()
6432/// #     .https_only()
6433/// #     .enable_http2()
6434/// #     .build();
6435///
6436/// # let executor = hyper_util::rt::TokioExecutor::new();
6437/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
6438/// #     secret,
6439/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6440/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
6441/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
6442/// #     ),
6443/// # ).build().await.unwrap();
6444///
6445/// # let client = hyper_util::client::legacy::Client::builder(
6446/// #     hyper_util::rt::TokioExecutor::new()
6447/// # )
6448/// # .build(
6449/// #     hyper_rustls::HttpsConnectorBuilder::new()
6450/// #         .with_native_roots()
6451/// #         .unwrap()
6452/// #         .https_or_http()
6453/// #         .enable_http2()
6454/// #         .build()
6455/// # );
6456/// # let mut hub = CloudFilestore::new(client, auth);
6457/// // As the method needs a request, you would usually fill it with the desired information
6458/// // into the respective structure. Some of the parts shown here might not be applicable !
6459/// // Values shown here are possibly random and not representative !
6460/// let mut req = Snapshot::default();
6461///
6462/// // You can configure optional parameters by calling the respective setters at will, and
6463/// // execute the final call using `doit()`.
6464/// // Values shown here are possibly random and not representative !
6465/// let result = hub.projects().locations_instances_snapshots_patch(req, "name")
6466///              .update_mask(FieldMask::new::<&str>(&[]))
6467///              .doit().await;
6468/// # }
6469/// ```
6470pub struct ProjectLocationInstanceSnapshotPatchCall<'a, C>
6471where
6472    C: 'a,
6473{
6474    hub: &'a CloudFilestore<C>,
6475    _request: Snapshot,
6476    _name: String,
6477    _update_mask: Option<common::FieldMask>,
6478    _delegate: Option<&'a mut dyn common::Delegate>,
6479    _additional_params: HashMap<String, String>,
6480    _scopes: BTreeSet<String>,
6481}
6482
6483impl<'a, C> common::CallBuilder for ProjectLocationInstanceSnapshotPatchCall<'a, C> {}
6484
6485impl<'a, C> ProjectLocationInstanceSnapshotPatchCall<'a, C>
6486where
6487    C: common::Connector,
6488{
6489    /// Perform the operation you have build so far.
6490    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
6491        use std::borrow::Cow;
6492        use std::io::{Read, Seek};
6493
6494        use common::{url::Params, ToParts};
6495        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6496
6497        let mut dd = common::DefaultDelegate;
6498        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6499        dlg.begin(common::MethodInfo {
6500            id: "file.projects.locations.instances.snapshots.patch",
6501            http_method: hyper::Method::PATCH,
6502        });
6503
6504        for &field in ["alt", "name", "updateMask"].iter() {
6505            if self._additional_params.contains_key(field) {
6506                dlg.finished(false);
6507                return Err(common::Error::FieldClash(field));
6508            }
6509        }
6510
6511        let mut params = Params::with_capacity(5 + self._additional_params.len());
6512        params.push("name", self._name);
6513        if let Some(value) = self._update_mask.as_ref() {
6514            params.push("updateMask", value.to_string());
6515        }
6516
6517        params.extend(self._additional_params.iter());
6518
6519        params.push("alt", "json");
6520        let mut url = self.hub._base_url.clone() + "v1beta1/{+name}";
6521        if self._scopes.is_empty() {
6522            self._scopes
6523                .insert(Scope::CloudPlatform.as_ref().to_string());
6524        }
6525
6526        #[allow(clippy::single_element_loop)]
6527        for &(find_this, param_name) in [("{+name}", "name")].iter() {
6528            url = params.uri_replacement(url, param_name, find_this, true);
6529        }
6530        {
6531            let to_remove = ["name"];
6532            params.remove_params(&to_remove);
6533        }
6534
6535        let url = params.parse_with_url(&url);
6536
6537        let mut json_mime_type = mime::APPLICATION_JSON;
6538        let mut request_value_reader = {
6539            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
6540            common::remove_json_null_values(&mut value);
6541            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
6542            serde_json::to_writer(&mut dst, &value).unwrap();
6543            dst
6544        };
6545        let request_size = request_value_reader
6546            .seek(std::io::SeekFrom::End(0))
6547            .unwrap();
6548        request_value_reader
6549            .seek(std::io::SeekFrom::Start(0))
6550            .unwrap();
6551
6552        loop {
6553            let token = match self
6554                .hub
6555                .auth
6556                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6557                .await
6558            {
6559                Ok(token) => token,
6560                Err(e) => match dlg.token(e) {
6561                    Ok(token) => token,
6562                    Err(e) => {
6563                        dlg.finished(false);
6564                        return Err(common::Error::MissingToken(e));
6565                    }
6566                },
6567            };
6568            request_value_reader
6569                .seek(std::io::SeekFrom::Start(0))
6570                .unwrap();
6571            let mut req_result = {
6572                let client = &self.hub.client;
6573                dlg.pre_request();
6574                let mut req_builder = hyper::Request::builder()
6575                    .method(hyper::Method::PATCH)
6576                    .uri(url.as_str())
6577                    .header(USER_AGENT, self.hub._user_agent.clone());
6578
6579                if let Some(token) = token.as_ref() {
6580                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6581                }
6582
6583                let request = req_builder
6584                    .header(CONTENT_TYPE, json_mime_type.to_string())
6585                    .header(CONTENT_LENGTH, request_size as u64)
6586                    .body(common::to_body(
6587                        request_value_reader.get_ref().clone().into(),
6588                    ));
6589
6590                client.request(request.unwrap()).await
6591            };
6592
6593            match req_result {
6594                Err(err) => {
6595                    if let common::Retry::After(d) = dlg.http_error(&err) {
6596                        sleep(d).await;
6597                        continue;
6598                    }
6599                    dlg.finished(false);
6600                    return Err(common::Error::HttpError(err));
6601                }
6602                Ok(res) => {
6603                    let (mut parts, body) = res.into_parts();
6604                    let mut body = common::Body::new(body);
6605                    if !parts.status.is_success() {
6606                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6607                        let error = serde_json::from_str(&common::to_string(&bytes));
6608                        let response = common::to_response(parts, bytes.into());
6609
6610                        if let common::Retry::After(d) =
6611                            dlg.http_failure(&response, error.as_ref().ok())
6612                        {
6613                            sleep(d).await;
6614                            continue;
6615                        }
6616
6617                        dlg.finished(false);
6618
6619                        return Err(match error {
6620                            Ok(value) => common::Error::BadRequest(value),
6621                            _ => common::Error::Failure(response),
6622                        });
6623                    }
6624                    let response = {
6625                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6626                        let encoded = common::to_string(&bytes);
6627                        match serde_json::from_str(&encoded) {
6628                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6629                            Err(error) => {
6630                                dlg.response_json_decode_error(&encoded, &error);
6631                                return Err(common::Error::JsonDecodeError(
6632                                    encoded.to_string(),
6633                                    error,
6634                                ));
6635                            }
6636                        }
6637                    };
6638
6639                    dlg.finished(true);
6640                    return Ok(response);
6641                }
6642            }
6643        }
6644    }
6645
6646    ///
6647    /// Sets the *request* property to the given value.
6648    ///
6649    /// Even though the property as already been set when instantiating this call,
6650    /// we provide this method for API completeness.
6651    pub fn request(
6652        mut self,
6653        new_value: Snapshot,
6654    ) -> ProjectLocationInstanceSnapshotPatchCall<'a, C> {
6655        self._request = new_value;
6656        self
6657    }
6658    /// Output only. The resource name of the snapshot, in the format `projects/{project_id}/locations/{location_id}/instances/{instance_id}/snapshots/{snapshot_id}`.
6659    ///
6660    /// Sets the *name* path property to the given value.
6661    ///
6662    /// Even though the property as already been set when instantiating this call,
6663    /// we provide this method for API completeness.
6664    pub fn name(mut self, new_value: &str) -> ProjectLocationInstanceSnapshotPatchCall<'a, C> {
6665        self._name = new_value.to_string();
6666        self
6667    }
6668    /// Required. Mask of fields to update. At least one path must be supplied in this field.
6669    ///
6670    /// Sets the *update mask* query property to the given value.
6671    pub fn update_mask(
6672        mut self,
6673        new_value: common::FieldMask,
6674    ) -> ProjectLocationInstanceSnapshotPatchCall<'a, C> {
6675        self._update_mask = Some(new_value);
6676        self
6677    }
6678    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6679    /// while executing the actual API request.
6680    ///
6681    /// ````text
6682    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
6683    /// ````
6684    ///
6685    /// Sets the *delegate* property to the given value.
6686    pub fn delegate(
6687        mut self,
6688        new_value: &'a mut dyn common::Delegate,
6689    ) -> ProjectLocationInstanceSnapshotPatchCall<'a, C> {
6690        self._delegate = Some(new_value);
6691        self
6692    }
6693
6694    /// Set any additional parameter of the query string used in the request.
6695    /// It should be used to set parameters which are not yet available through their own
6696    /// setters.
6697    ///
6698    /// Please note that this method must not be used to set any of the known parameters
6699    /// which have their own setter method. If done anyway, the request will fail.
6700    ///
6701    /// # Additional Parameters
6702    ///
6703    /// * *$.xgafv* (query-string) - V1 error format.
6704    /// * *access_token* (query-string) - OAuth access token.
6705    /// * *alt* (query-string) - Data format for response.
6706    /// * *callback* (query-string) - JSONP
6707    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6708    /// * *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.
6709    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6710    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6711    /// * *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.
6712    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6713    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6714    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationInstanceSnapshotPatchCall<'a, C>
6715    where
6716        T: AsRef<str>,
6717    {
6718        self._additional_params
6719            .insert(name.as_ref().to_string(), value.as_ref().to_string());
6720        self
6721    }
6722
6723    /// Identifies the authorization scope for the method you are building.
6724    ///
6725    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6726    /// [`Scope::CloudPlatform`].
6727    ///
6728    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6729    /// tokens for more than one scope.
6730    ///
6731    /// Usually there is more than one suitable scope to authorize an operation, some of which may
6732    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6733    /// sufficient, a read-write scope will do as well.
6734    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationInstanceSnapshotPatchCall<'a, C>
6735    where
6736        St: AsRef<str>,
6737    {
6738        self._scopes.insert(String::from(scope.as_ref()));
6739        self
6740    }
6741    /// Identifies the authorization scope(s) for the method you are building.
6742    ///
6743    /// See [`Self::add_scope()`] for details.
6744    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationInstanceSnapshotPatchCall<'a, C>
6745    where
6746        I: IntoIterator<Item = St>,
6747        St: AsRef<str>,
6748    {
6749        self._scopes
6750            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6751        self
6752    }
6753
6754    /// Removes all scopes, and no default scope will be used either.
6755    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6756    /// for details).
6757    pub fn clear_scopes(mut self) -> ProjectLocationInstanceSnapshotPatchCall<'a, C> {
6758        self._scopes.clear();
6759        self
6760    }
6761}
6762
6763/// 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).
6764///
6765/// A builder for the *locations.instances.create* method supported by a *project* resource.
6766/// It is not used directly, but through a [`ProjectMethods`] instance.
6767///
6768/// # Example
6769///
6770/// Instantiate a resource method builder
6771///
6772/// ```test_harness,no_run
6773/// # extern crate hyper;
6774/// # extern crate hyper_rustls;
6775/// # extern crate google_file1_beta1 as file1_beta1;
6776/// use file1_beta1::api::Instance;
6777/// # async fn dox() {
6778/// # use file1_beta1::{CloudFilestore, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6779///
6780/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6781/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
6782/// #     .with_native_roots()
6783/// #     .unwrap()
6784/// #     .https_only()
6785/// #     .enable_http2()
6786/// #     .build();
6787///
6788/// # let executor = hyper_util::rt::TokioExecutor::new();
6789/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
6790/// #     secret,
6791/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6792/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
6793/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
6794/// #     ),
6795/// # ).build().await.unwrap();
6796///
6797/// # let client = hyper_util::client::legacy::Client::builder(
6798/// #     hyper_util::rt::TokioExecutor::new()
6799/// # )
6800/// # .build(
6801/// #     hyper_rustls::HttpsConnectorBuilder::new()
6802/// #         .with_native_roots()
6803/// #         .unwrap()
6804/// #         .https_or_http()
6805/// #         .enable_http2()
6806/// #         .build()
6807/// # );
6808/// # let mut hub = CloudFilestore::new(client, auth);
6809/// // As the method needs a request, you would usually fill it with the desired information
6810/// // into the respective structure. Some of the parts shown here might not be applicable !
6811/// // Values shown here are possibly random and not representative !
6812/// let mut req = Instance::default();
6813///
6814/// // You can configure optional parameters by calling the respective setters at will, and
6815/// // execute the final call using `doit()`.
6816/// // Values shown here are possibly random and not representative !
6817/// let result = hub.projects().locations_instances_create(req, "parent")
6818///              .instance_id("duo")
6819///              .doit().await;
6820/// # }
6821/// ```
6822pub struct ProjectLocationInstanceCreateCall<'a, C>
6823where
6824    C: 'a,
6825{
6826    hub: &'a CloudFilestore<C>,
6827    _request: Instance,
6828    _parent: String,
6829    _instance_id: Option<String>,
6830    _delegate: Option<&'a mut dyn common::Delegate>,
6831    _additional_params: HashMap<String, String>,
6832    _scopes: BTreeSet<String>,
6833}
6834
6835impl<'a, C> common::CallBuilder for ProjectLocationInstanceCreateCall<'a, C> {}
6836
6837impl<'a, C> ProjectLocationInstanceCreateCall<'a, C>
6838where
6839    C: common::Connector,
6840{
6841    /// Perform the operation you have build so far.
6842    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
6843        use std::borrow::Cow;
6844        use std::io::{Read, Seek};
6845
6846        use common::{url::Params, ToParts};
6847        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6848
6849        let mut dd = common::DefaultDelegate;
6850        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6851        dlg.begin(common::MethodInfo {
6852            id: "file.projects.locations.instances.create",
6853            http_method: hyper::Method::POST,
6854        });
6855
6856        for &field in ["alt", "parent", "instanceId"].iter() {
6857            if self._additional_params.contains_key(field) {
6858                dlg.finished(false);
6859                return Err(common::Error::FieldClash(field));
6860            }
6861        }
6862
6863        let mut params = Params::with_capacity(5 + self._additional_params.len());
6864        params.push("parent", self._parent);
6865        if let Some(value) = self._instance_id.as_ref() {
6866            params.push("instanceId", value);
6867        }
6868
6869        params.extend(self._additional_params.iter());
6870
6871        params.push("alt", "json");
6872        let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/instances";
6873        if self._scopes.is_empty() {
6874            self._scopes
6875                .insert(Scope::CloudPlatform.as_ref().to_string());
6876        }
6877
6878        #[allow(clippy::single_element_loop)]
6879        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
6880            url = params.uri_replacement(url, param_name, find_this, true);
6881        }
6882        {
6883            let to_remove = ["parent"];
6884            params.remove_params(&to_remove);
6885        }
6886
6887        let url = params.parse_with_url(&url);
6888
6889        let mut json_mime_type = mime::APPLICATION_JSON;
6890        let mut request_value_reader = {
6891            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
6892            common::remove_json_null_values(&mut value);
6893            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
6894            serde_json::to_writer(&mut dst, &value).unwrap();
6895            dst
6896        };
6897        let request_size = request_value_reader
6898            .seek(std::io::SeekFrom::End(0))
6899            .unwrap();
6900        request_value_reader
6901            .seek(std::io::SeekFrom::Start(0))
6902            .unwrap();
6903
6904        loop {
6905            let token = match self
6906                .hub
6907                .auth
6908                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6909                .await
6910            {
6911                Ok(token) => token,
6912                Err(e) => match dlg.token(e) {
6913                    Ok(token) => token,
6914                    Err(e) => {
6915                        dlg.finished(false);
6916                        return Err(common::Error::MissingToken(e));
6917                    }
6918                },
6919            };
6920            request_value_reader
6921                .seek(std::io::SeekFrom::Start(0))
6922                .unwrap();
6923            let mut req_result = {
6924                let client = &self.hub.client;
6925                dlg.pre_request();
6926                let mut req_builder = hyper::Request::builder()
6927                    .method(hyper::Method::POST)
6928                    .uri(url.as_str())
6929                    .header(USER_AGENT, self.hub._user_agent.clone());
6930
6931                if let Some(token) = token.as_ref() {
6932                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6933                }
6934
6935                let request = req_builder
6936                    .header(CONTENT_TYPE, json_mime_type.to_string())
6937                    .header(CONTENT_LENGTH, request_size as u64)
6938                    .body(common::to_body(
6939                        request_value_reader.get_ref().clone().into(),
6940                    ));
6941
6942                client.request(request.unwrap()).await
6943            };
6944
6945            match req_result {
6946                Err(err) => {
6947                    if let common::Retry::After(d) = dlg.http_error(&err) {
6948                        sleep(d).await;
6949                        continue;
6950                    }
6951                    dlg.finished(false);
6952                    return Err(common::Error::HttpError(err));
6953                }
6954                Ok(res) => {
6955                    let (mut parts, body) = res.into_parts();
6956                    let mut body = common::Body::new(body);
6957                    if !parts.status.is_success() {
6958                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6959                        let error = serde_json::from_str(&common::to_string(&bytes));
6960                        let response = common::to_response(parts, bytes.into());
6961
6962                        if let common::Retry::After(d) =
6963                            dlg.http_failure(&response, error.as_ref().ok())
6964                        {
6965                            sleep(d).await;
6966                            continue;
6967                        }
6968
6969                        dlg.finished(false);
6970
6971                        return Err(match error {
6972                            Ok(value) => common::Error::BadRequest(value),
6973                            _ => common::Error::Failure(response),
6974                        });
6975                    }
6976                    let response = {
6977                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6978                        let encoded = common::to_string(&bytes);
6979                        match serde_json::from_str(&encoded) {
6980                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6981                            Err(error) => {
6982                                dlg.response_json_decode_error(&encoded, &error);
6983                                return Err(common::Error::JsonDecodeError(
6984                                    encoded.to_string(),
6985                                    error,
6986                                ));
6987                            }
6988                        }
6989                    };
6990
6991                    dlg.finished(true);
6992                    return Ok(response);
6993                }
6994            }
6995        }
6996    }
6997
6998    ///
6999    /// Sets the *request* property to the given value.
7000    ///
7001    /// Even though the property as already been set when instantiating this call,
7002    /// we provide this method for API completeness.
7003    pub fn request(mut self, new_value: Instance) -> ProjectLocationInstanceCreateCall<'a, C> {
7004        self._request = new_value;
7005        self
7006    }
7007    /// 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**.
7008    ///
7009    /// Sets the *parent* path property to the given value.
7010    ///
7011    /// Even though the property as already been set when instantiating this call,
7012    /// we provide this method for API completeness.
7013    pub fn parent(mut self, new_value: &str) -> ProjectLocationInstanceCreateCall<'a, C> {
7014        self._parent = new_value.to_string();
7015        self
7016    }
7017    /// 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.
7018    ///
7019    /// Sets the *instance id* query property to the given value.
7020    pub fn instance_id(mut self, new_value: &str) -> ProjectLocationInstanceCreateCall<'a, C> {
7021        self._instance_id = Some(new_value.to_string());
7022        self
7023    }
7024    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7025    /// while executing the actual API request.
7026    ///
7027    /// ````text
7028    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
7029    /// ````
7030    ///
7031    /// Sets the *delegate* property to the given value.
7032    pub fn delegate(
7033        mut self,
7034        new_value: &'a mut dyn common::Delegate,
7035    ) -> ProjectLocationInstanceCreateCall<'a, C> {
7036        self._delegate = Some(new_value);
7037        self
7038    }
7039
7040    /// Set any additional parameter of the query string used in the request.
7041    /// It should be used to set parameters which are not yet available through their own
7042    /// setters.
7043    ///
7044    /// Please note that this method must not be used to set any of the known parameters
7045    /// which have their own setter method. If done anyway, the request will fail.
7046    ///
7047    /// # Additional Parameters
7048    ///
7049    /// * *$.xgafv* (query-string) - V1 error format.
7050    /// * *access_token* (query-string) - OAuth access token.
7051    /// * *alt* (query-string) - Data format for response.
7052    /// * *callback* (query-string) - JSONP
7053    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7054    /// * *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.
7055    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7056    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7057    /// * *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.
7058    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7059    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7060    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationInstanceCreateCall<'a, C>
7061    where
7062        T: AsRef<str>,
7063    {
7064        self._additional_params
7065            .insert(name.as_ref().to_string(), value.as_ref().to_string());
7066        self
7067    }
7068
7069    /// Identifies the authorization scope for the method you are building.
7070    ///
7071    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7072    /// [`Scope::CloudPlatform`].
7073    ///
7074    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7075    /// tokens for more than one scope.
7076    ///
7077    /// Usually there is more than one suitable scope to authorize an operation, some of which may
7078    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7079    /// sufficient, a read-write scope will do as well.
7080    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationInstanceCreateCall<'a, C>
7081    where
7082        St: AsRef<str>,
7083    {
7084        self._scopes.insert(String::from(scope.as_ref()));
7085        self
7086    }
7087    /// Identifies the authorization scope(s) for the method you are building.
7088    ///
7089    /// See [`Self::add_scope()`] for details.
7090    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationInstanceCreateCall<'a, C>
7091    where
7092        I: IntoIterator<Item = St>,
7093        St: AsRef<str>,
7094    {
7095        self._scopes
7096            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7097        self
7098    }
7099
7100    /// Removes all scopes, and no default scope will be used either.
7101    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7102    /// for details).
7103    pub fn clear_scopes(mut self) -> ProjectLocationInstanceCreateCall<'a, C> {
7104        self._scopes.clear();
7105        self
7106    }
7107}
7108
7109/// Deletes an instance.
7110///
7111/// A builder for the *locations.instances.delete* method supported by a *project* resource.
7112/// It is not used directly, but through a [`ProjectMethods`] instance.
7113///
7114/// # Example
7115///
7116/// Instantiate a resource method builder
7117///
7118/// ```test_harness,no_run
7119/// # extern crate hyper;
7120/// # extern crate hyper_rustls;
7121/// # extern crate google_file1_beta1 as file1_beta1;
7122/// # async fn dox() {
7123/// # use file1_beta1::{CloudFilestore, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7124///
7125/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7126/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
7127/// #     .with_native_roots()
7128/// #     .unwrap()
7129/// #     .https_only()
7130/// #     .enable_http2()
7131/// #     .build();
7132///
7133/// # let executor = hyper_util::rt::TokioExecutor::new();
7134/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
7135/// #     secret,
7136/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7137/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
7138/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
7139/// #     ),
7140/// # ).build().await.unwrap();
7141///
7142/// # let client = hyper_util::client::legacy::Client::builder(
7143/// #     hyper_util::rt::TokioExecutor::new()
7144/// # )
7145/// # .build(
7146/// #     hyper_rustls::HttpsConnectorBuilder::new()
7147/// #         .with_native_roots()
7148/// #         .unwrap()
7149/// #         .https_or_http()
7150/// #         .enable_http2()
7151/// #         .build()
7152/// # );
7153/// # let mut hub = CloudFilestore::new(client, auth);
7154/// // You can configure optional parameters by calling the respective setters at will, and
7155/// // execute the final call using `doit()`.
7156/// // Values shown here are possibly random and not representative !
7157/// let result = hub.projects().locations_instances_delete("name")
7158///              .force(true)
7159///              .doit().await;
7160/// # }
7161/// ```
7162pub struct ProjectLocationInstanceDeleteCall<'a, C>
7163where
7164    C: 'a,
7165{
7166    hub: &'a CloudFilestore<C>,
7167    _name: String,
7168    _force: Option<bool>,
7169    _delegate: Option<&'a mut dyn common::Delegate>,
7170    _additional_params: HashMap<String, String>,
7171    _scopes: BTreeSet<String>,
7172}
7173
7174impl<'a, C> common::CallBuilder for ProjectLocationInstanceDeleteCall<'a, C> {}
7175
7176impl<'a, C> ProjectLocationInstanceDeleteCall<'a, C>
7177where
7178    C: common::Connector,
7179{
7180    /// Perform the operation you have build so far.
7181    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
7182        use std::borrow::Cow;
7183        use std::io::{Read, Seek};
7184
7185        use common::{url::Params, ToParts};
7186        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7187
7188        let mut dd = common::DefaultDelegate;
7189        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7190        dlg.begin(common::MethodInfo {
7191            id: "file.projects.locations.instances.delete",
7192            http_method: hyper::Method::DELETE,
7193        });
7194
7195        for &field in ["alt", "name", "force"].iter() {
7196            if self._additional_params.contains_key(field) {
7197                dlg.finished(false);
7198                return Err(common::Error::FieldClash(field));
7199            }
7200        }
7201
7202        let mut params = Params::with_capacity(4 + self._additional_params.len());
7203        params.push("name", self._name);
7204        if let Some(value) = self._force.as_ref() {
7205            params.push("force", value.to_string());
7206        }
7207
7208        params.extend(self._additional_params.iter());
7209
7210        params.push("alt", "json");
7211        let mut url = self.hub._base_url.clone() + "v1beta1/{+name}";
7212        if self._scopes.is_empty() {
7213            self._scopes
7214                .insert(Scope::CloudPlatform.as_ref().to_string());
7215        }
7216
7217        #[allow(clippy::single_element_loop)]
7218        for &(find_this, param_name) in [("{+name}", "name")].iter() {
7219            url = params.uri_replacement(url, param_name, find_this, true);
7220        }
7221        {
7222            let to_remove = ["name"];
7223            params.remove_params(&to_remove);
7224        }
7225
7226        let url = params.parse_with_url(&url);
7227
7228        loop {
7229            let token = match self
7230                .hub
7231                .auth
7232                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
7233                .await
7234            {
7235                Ok(token) => token,
7236                Err(e) => match dlg.token(e) {
7237                    Ok(token) => token,
7238                    Err(e) => {
7239                        dlg.finished(false);
7240                        return Err(common::Error::MissingToken(e));
7241                    }
7242                },
7243            };
7244            let mut req_result = {
7245                let client = &self.hub.client;
7246                dlg.pre_request();
7247                let mut req_builder = hyper::Request::builder()
7248                    .method(hyper::Method::DELETE)
7249                    .uri(url.as_str())
7250                    .header(USER_AGENT, self.hub._user_agent.clone());
7251
7252                if let Some(token) = token.as_ref() {
7253                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7254                }
7255
7256                let request = req_builder
7257                    .header(CONTENT_LENGTH, 0_u64)
7258                    .body(common::to_body::<String>(None));
7259
7260                client.request(request.unwrap()).await
7261            };
7262
7263            match req_result {
7264                Err(err) => {
7265                    if let common::Retry::After(d) = dlg.http_error(&err) {
7266                        sleep(d).await;
7267                        continue;
7268                    }
7269                    dlg.finished(false);
7270                    return Err(common::Error::HttpError(err));
7271                }
7272                Ok(res) => {
7273                    let (mut parts, body) = res.into_parts();
7274                    let mut body = common::Body::new(body);
7275                    if !parts.status.is_success() {
7276                        let bytes = common::to_bytes(body).await.unwrap_or_default();
7277                        let error = serde_json::from_str(&common::to_string(&bytes));
7278                        let response = common::to_response(parts, bytes.into());
7279
7280                        if let common::Retry::After(d) =
7281                            dlg.http_failure(&response, error.as_ref().ok())
7282                        {
7283                            sleep(d).await;
7284                            continue;
7285                        }
7286
7287                        dlg.finished(false);
7288
7289                        return Err(match error {
7290                            Ok(value) => common::Error::BadRequest(value),
7291                            _ => common::Error::Failure(response),
7292                        });
7293                    }
7294                    let response = {
7295                        let bytes = common::to_bytes(body).await.unwrap_or_default();
7296                        let encoded = common::to_string(&bytes);
7297                        match serde_json::from_str(&encoded) {
7298                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
7299                            Err(error) => {
7300                                dlg.response_json_decode_error(&encoded, &error);
7301                                return Err(common::Error::JsonDecodeError(
7302                                    encoded.to_string(),
7303                                    error,
7304                                ));
7305                            }
7306                        }
7307                    };
7308
7309                    dlg.finished(true);
7310                    return Ok(response);
7311                }
7312            }
7313        }
7314    }
7315
7316    /// Required. The instance resource name, in the format `projects/{project_id}/locations/{location}/instances/{instance_id}`
7317    ///
7318    /// Sets the *name* path property to the given value.
7319    ///
7320    /// Even though the property as already been set when instantiating this call,
7321    /// we provide this method for API completeness.
7322    pub fn name(mut self, new_value: &str) -> ProjectLocationInstanceDeleteCall<'a, C> {
7323        self._name = new_value.to_string();
7324        self
7325    }
7326    /// 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.)
7327    ///
7328    /// Sets the *force* query property to the given value.
7329    pub fn force(mut self, new_value: bool) -> ProjectLocationInstanceDeleteCall<'a, C> {
7330        self._force = Some(new_value);
7331        self
7332    }
7333    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7334    /// while executing the actual API request.
7335    ///
7336    /// ````text
7337    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
7338    /// ````
7339    ///
7340    /// Sets the *delegate* property to the given value.
7341    pub fn delegate(
7342        mut self,
7343        new_value: &'a mut dyn common::Delegate,
7344    ) -> ProjectLocationInstanceDeleteCall<'a, C> {
7345        self._delegate = Some(new_value);
7346        self
7347    }
7348
7349    /// Set any additional parameter of the query string used in the request.
7350    /// It should be used to set parameters which are not yet available through their own
7351    /// setters.
7352    ///
7353    /// Please note that this method must not be used to set any of the known parameters
7354    /// which have their own setter method. If done anyway, the request will fail.
7355    ///
7356    /// # Additional Parameters
7357    ///
7358    /// * *$.xgafv* (query-string) - V1 error format.
7359    /// * *access_token* (query-string) - OAuth access token.
7360    /// * *alt* (query-string) - Data format for response.
7361    /// * *callback* (query-string) - JSONP
7362    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7363    /// * *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.
7364    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7365    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7366    /// * *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.
7367    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7368    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7369    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationInstanceDeleteCall<'a, C>
7370    where
7371        T: AsRef<str>,
7372    {
7373        self._additional_params
7374            .insert(name.as_ref().to_string(), value.as_ref().to_string());
7375        self
7376    }
7377
7378    /// Identifies the authorization scope for the method you are building.
7379    ///
7380    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7381    /// [`Scope::CloudPlatform`].
7382    ///
7383    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7384    /// tokens for more than one scope.
7385    ///
7386    /// Usually there is more than one suitable scope to authorize an operation, some of which may
7387    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7388    /// sufficient, a read-write scope will do as well.
7389    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationInstanceDeleteCall<'a, C>
7390    where
7391        St: AsRef<str>,
7392    {
7393        self._scopes.insert(String::from(scope.as_ref()));
7394        self
7395    }
7396    /// Identifies the authorization scope(s) for the method you are building.
7397    ///
7398    /// See [`Self::add_scope()`] for details.
7399    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationInstanceDeleteCall<'a, C>
7400    where
7401        I: IntoIterator<Item = St>,
7402        St: AsRef<str>,
7403    {
7404        self._scopes
7405            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7406        self
7407    }
7408
7409    /// Removes all scopes, and no default scope will be used either.
7410    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7411    /// for details).
7412    pub fn clear_scopes(mut self) -> ProjectLocationInstanceDeleteCall<'a, C> {
7413        self._scopes.clear();
7414        self
7415    }
7416}
7417
7418/// Gets the details of a specific instance.
7419///
7420/// A builder for the *locations.instances.get* method supported by a *project* resource.
7421/// It is not used directly, but through a [`ProjectMethods`] instance.
7422///
7423/// # Example
7424///
7425/// Instantiate a resource method builder
7426///
7427/// ```test_harness,no_run
7428/// # extern crate hyper;
7429/// # extern crate hyper_rustls;
7430/// # extern crate google_file1_beta1 as file1_beta1;
7431/// # async fn dox() {
7432/// # use file1_beta1::{CloudFilestore, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7433///
7434/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7435/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
7436/// #     .with_native_roots()
7437/// #     .unwrap()
7438/// #     .https_only()
7439/// #     .enable_http2()
7440/// #     .build();
7441///
7442/// # let executor = hyper_util::rt::TokioExecutor::new();
7443/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
7444/// #     secret,
7445/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7446/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
7447/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
7448/// #     ),
7449/// # ).build().await.unwrap();
7450///
7451/// # let client = hyper_util::client::legacy::Client::builder(
7452/// #     hyper_util::rt::TokioExecutor::new()
7453/// # )
7454/// # .build(
7455/// #     hyper_rustls::HttpsConnectorBuilder::new()
7456/// #         .with_native_roots()
7457/// #         .unwrap()
7458/// #         .https_or_http()
7459/// #         .enable_http2()
7460/// #         .build()
7461/// # );
7462/// # let mut hub = CloudFilestore::new(client, auth);
7463/// // You can configure optional parameters by calling the respective setters at will, and
7464/// // execute the final call using `doit()`.
7465/// // Values shown here are possibly random and not representative !
7466/// let result = hub.projects().locations_instances_get("name")
7467///              .doit().await;
7468/// # }
7469/// ```
7470pub struct ProjectLocationInstanceGetCall<'a, C>
7471where
7472    C: 'a,
7473{
7474    hub: &'a CloudFilestore<C>,
7475    _name: String,
7476    _delegate: Option<&'a mut dyn common::Delegate>,
7477    _additional_params: HashMap<String, String>,
7478    _scopes: BTreeSet<String>,
7479}
7480
7481impl<'a, C> common::CallBuilder for ProjectLocationInstanceGetCall<'a, C> {}
7482
7483impl<'a, C> ProjectLocationInstanceGetCall<'a, C>
7484where
7485    C: common::Connector,
7486{
7487    /// Perform the operation you have build so far.
7488    pub async fn doit(mut self) -> common::Result<(common::Response, Instance)> {
7489        use std::borrow::Cow;
7490        use std::io::{Read, Seek};
7491
7492        use common::{url::Params, ToParts};
7493        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7494
7495        let mut dd = common::DefaultDelegate;
7496        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7497        dlg.begin(common::MethodInfo {
7498            id: "file.projects.locations.instances.get",
7499            http_method: hyper::Method::GET,
7500        });
7501
7502        for &field in ["alt", "name"].iter() {
7503            if self._additional_params.contains_key(field) {
7504                dlg.finished(false);
7505                return Err(common::Error::FieldClash(field));
7506            }
7507        }
7508
7509        let mut params = Params::with_capacity(3 + self._additional_params.len());
7510        params.push("name", self._name);
7511
7512        params.extend(self._additional_params.iter());
7513
7514        params.push("alt", "json");
7515        let mut url = self.hub._base_url.clone() + "v1beta1/{+name}";
7516        if self._scopes.is_empty() {
7517            self._scopes
7518                .insert(Scope::CloudPlatform.as_ref().to_string());
7519        }
7520
7521        #[allow(clippy::single_element_loop)]
7522        for &(find_this, param_name) in [("{+name}", "name")].iter() {
7523            url = params.uri_replacement(url, param_name, find_this, true);
7524        }
7525        {
7526            let to_remove = ["name"];
7527            params.remove_params(&to_remove);
7528        }
7529
7530        let url = params.parse_with_url(&url);
7531
7532        loop {
7533            let token = match self
7534                .hub
7535                .auth
7536                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
7537                .await
7538            {
7539                Ok(token) => token,
7540                Err(e) => match dlg.token(e) {
7541                    Ok(token) => token,
7542                    Err(e) => {
7543                        dlg.finished(false);
7544                        return Err(common::Error::MissingToken(e));
7545                    }
7546                },
7547            };
7548            let mut req_result = {
7549                let client = &self.hub.client;
7550                dlg.pre_request();
7551                let mut req_builder = hyper::Request::builder()
7552                    .method(hyper::Method::GET)
7553                    .uri(url.as_str())
7554                    .header(USER_AGENT, self.hub._user_agent.clone());
7555
7556                if let Some(token) = token.as_ref() {
7557                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7558                }
7559
7560                let request = req_builder
7561                    .header(CONTENT_LENGTH, 0_u64)
7562                    .body(common::to_body::<String>(None));
7563
7564                client.request(request.unwrap()).await
7565            };
7566
7567            match req_result {
7568                Err(err) => {
7569                    if let common::Retry::After(d) = dlg.http_error(&err) {
7570                        sleep(d).await;
7571                        continue;
7572                    }
7573                    dlg.finished(false);
7574                    return Err(common::Error::HttpError(err));
7575                }
7576                Ok(res) => {
7577                    let (mut parts, body) = res.into_parts();
7578                    let mut body = common::Body::new(body);
7579                    if !parts.status.is_success() {
7580                        let bytes = common::to_bytes(body).await.unwrap_or_default();
7581                        let error = serde_json::from_str(&common::to_string(&bytes));
7582                        let response = common::to_response(parts, bytes.into());
7583
7584                        if let common::Retry::After(d) =
7585                            dlg.http_failure(&response, error.as_ref().ok())
7586                        {
7587                            sleep(d).await;
7588                            continue;
7589                        }
7590
7591                        dlg.finished(false);
7592
7593                        return Err(match error {
7594                            Ok(value) => common::Error::BadRequest(value),
7595                            _ => common::Error::Failure(response),
7596                        });
7597                    }
7598                    let response = {
7599                        let bytes = common::to_bytes(body).await.unwrap_or_default();
7600                        let encoded = common::to_string(&bytes);
7601                        match serde_json::from_str(&encoded) {
7602                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
7603                            Err(error) => {
7604                                dlg.response_json_decode_error(&encoded, &error);
7605                                return Err(common::Error::JsonDecodeError(
7606                                    encoded.to_string(),
7607                                    error,
7608                                ));
7609                            }
7610                        }
7611                    };
7612
7613                    dlg.finished(true);
7614                    return Ok(response);
7615                }
7616            }
7617        }
7618    }
7619
7620    /// Required. The instance resource name, in the format `projects/{project_id}/locations/{location}/instances/{instance_id}`.
7621    ///
7622    /// Sets the *name* path property to the given value.
7623    ///
7624    /// Even though the property as already been set when instantiating this call,
7625    /// we provide this method for API completeness.
7626    pub fn name(mut self, new_value: &str) -> ProjectLocationInstanceGetCall<'a, C> {
7627        self._name = new_value.to_string();
7628        self
7629    }
7630    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7631    /// while executing the actual API request.
7632    ///
7633    /// ````text
7634    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
7635    /// ````
7636    ///
7637    /// Sets the *delegate* property to the given value.
7638    pub fn delegate(
7639        mut self,
7640        new_value: &'a mut dyn common::Delegate,
7641    ) -> ProjectLocationInstanceGetCall<'a, C> {
7642        self._delegate = Some(new_value);
7643        self
7644    }
7645
7646    /// Set any additional parameter of the query string used in the request.
7647    /// It should be used to set parameters which are not yet available through their own
7648    /// setters.
7649    ///
7650    /// Please note that this method must not be used to set any of the known parameters
7651    /// which have their own setter method. If done anyway, the request will fail.
7652    ///
7653    /// # Additional Parameters
7654    ///
7655    /// * *$.xgafv* (query-string) - V1 error format.
7656    /// * *access_token* (query-string) - OAuth access token.
7657    /// * *alt* (query-string) - Data format for response.
7658    /// * *callback* (query-string) - JSONP
7659    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7660    /// * *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.
7661    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7662    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7663    /// * *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.
7664    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7665    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7666    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationInstanceGetCall<'a, C>
7667    where
7668        T: AsRef<str>,
7669    {
7670        self._additional_params
7671            .insert(name.as_ref().to_string(), value.as_ref().to_string());
7672        self
7673    }
7674
7675    /// Identifies the authorization scope for the method you are building.
7676    ///
7677    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7678    /// [`Scope::CloudPlatform`].
7679    ///
7680    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7681    /// tokens for more than one scope.
7682    ///
7683    /// Usually there is more than one suitable scope to authorize an operation, some of which may
7684    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7685    /// sufficient, a read-write scope will do as well.
7686    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationInstanceGetCall<'a, C>
7687    where
7688        St: AsRef<str>,
7689    {
7690        self._scopes.insert(String::from(scope.as_ref()));
7691        self
7692    }
7693    /// Identifies the authorization scope(s) for the method you are building.
7694    ///
7695    /// See [`Self::add_scope()`] for details.
7696    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationInstanceGetCall<'a, C>
7697    where
7698        I: IntoIterator<Item = St>,
7699        St: AsRef<str>,
7700    {
7701        self._scopes
7702            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7703        self
7704    }
7705
7706    /// Removes all scopes, and no default scope will be used either.
7707    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7708    /// for details).
7709    pub fn clear_scopes(mut self) -> ProjectLocationInstanceGetCall<'a, C> {
7710        self._scopes.clear();
7711        self
7712    }
7713}
7714
7715/// Lists all instances in a project for either a specified location or for all locations.
7716///
7717/// A builder for the *locations.instances.list* method supported by a *project* resource.
7718/// It is not used directly, but through a [`ProjectMethods`] instance.
7719///
7720/// # Example
7721///
7722/// Instantiate a resource method builder
7723///
7724/// ```test_harness,no_run
7725/// # extern crate hyper;
7726/// # extern crate hyper_rustls;
7727/// # extern crate google_file1_beta1 as file1_beta1;
7728/// # async fn dox() {
7729/// # use file1_beta1::{CloudFilestore, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7730///
7731/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7732/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
7733/// #     .with_native_roots()
7734/// #     .unwrap()
7735/// #     .https_only()
7736/// #     .enable_http2()
7737/// #     .build();
7738///
7739/// # let executor = hyper_util::rt::TokioExecutor::new();
7740/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
7741/// #     secret,
7742/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7743/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
7744/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
7745/// #     ),
7746/// # ).build().await.unwrap();
7747///
7748/// # let client = hyper_util::client::legacy::Client::builder(
7749/// #     hyper_util::rt::TokioExecutor::new()
7750/// # )
7751/// # .build(
7752/// #     hyper_rustls::HttpsConnectorBuilder::new()
7753/// #         .with_native_roots()
7754/// #         .unwrap()
7755/// #         .https_or_http()
7756/// #         .enable_http2()
7757/// #         .build()
7758/// # );
7759/// # let mut hub = CloudFilestore::new(client, auth);
7760/// // You can configure optional parameters by calling the respective setters at will, and
7761/// // execute the final call using `doit()`.
7762/// // Values shown here are possibly random and not representative !
7763/// let result = hub.projects().locations_instances_list("parent")
7764///              .page_token("et")
7765///              .page_size(-43)
7766///              .order_by("et")
7767///              .filter("et")
7768///              .doit().await;
7769/// # }
7770/// ```
7771pub struct ProjectLocationInstanceListCall<'a, C>
7772where
7773    C: 'a,
7774{
7775    hub: &'a CloudFilestore<C>,
7776    _parent: String,
7777    _page_token: Option<String>,
7778    _page_size: Option<i32>,
7779    _order_by: Option<String>,
7780    _filter: Option<String>,
7781    _delegate: Option<&'a mut dyn common::Delegate>,
7782    _additional_params: HashMap<String, String>,
7783    _scopes: BTreeSet<String>,
7784}
7785
7786impl<'a, C> common::CallBuilder for ProjectLocationInstanceListCall<'a, C> {}
7787
7788impl<'a, C> ProjectLocationInstanceListCall<'a, C>
7789where
7790    C: common::Connector,
7791{
7792    /// Perform the operation you have build so far.
7793    pub async fn doit(mut self) -> common::Result<(common::Response, ListInstancesResponse)> {
7794        use std::borrow::Cow;
7795        use std::io::{Read, Seek};
7796
7797        use common::{url::Params, ToParts};
7798        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7799
7800        let mut dd = common::DefaultDelegate;
7801        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7802        dlg.begin(common::MethodInfo {
7803            id: "file.projects.locations.instances.list",
7804            http_method: hyper::Method::GET,
7805        });
7806
7807        for &field in [
7808            "alt",
7809            "parent",
7810            "pageToken",
7811            "pageSize",
7812            "orderBy",
7813            "filter",
7814        ]
7815        .iter()
7816        {
7817            if self._additional_params.contains_key(field) {
7818                dlg.finished(false);
7819                return Err(common::Error::FieldClash(field));
7820            }
7821        }
7822
7823        let mut params = Params::with_capacity(7 + self._additional_params.len());
7824        params.push("parent", self._parent);
7825        if let Some(value) = self._page_token.as_ref() {
7826            params.push("pageToken", value);
7827        }
7828        if let Some(value) = self._page_size.as_ref() {
7829            params.push("pageSize", value.to_string());
7830        }
7831        if let Some(value) = self._order_by.as_ref() {
7832            params.push("orderBy", value);
7833        }
7834        if let Some(value) = self._filter.as_ref() {
7835            params.push("filter", value);
7836        }
7837
7838        params.extend(self._additional_params.iter());
7839
7840        params.push("alt", "json");
7841        let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/instances";
7842        if self._scopes.is_empty() {
7843            self._scopes
7844                .insert(Scope::CloudPlatform.as_ref().to_string());
7845        }
7846
7847        #[allow(clippy::single_element_loop)]
7848        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
7849            url = params.uri_replacement(url, param_name, find_this, true);
7850        }
7851        {
7852            let to_remove = ["parent"];
7853            params.remove_params(&to_remove);
7854        }
7855
7856        let url = params.parse_with_url(&url);
7857
7858        loop {
7859            let token = match self
7860                .hub
7861                .auth
7862                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
7863                .await
7864            {
7865                Ok(token) => token,
7866                Err(e) => match dlg.token(e) {
7867                    Ok(token) => token,
7868                    Err(e) => {
7869                        dlg.finished(false);
7870                        return Err(common::Error::MissingToken(e));
7871                    }
7872                },
7873            };
7874            let mut req_result = {
7875                let client = &self.hub.client;
7876                dlg.pre_request();
7877                let mut req_builder = hyper::Request::builder()
7878                    .method(hyper::Method::GET)
7879                    .uri(url.as_str())
7880                    .header(USER_AGENT, self.hub._user_agent.clone());
7881
7882                if let Some(token) = token.as_ref() {
7883                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7884                }
7885
7886                let request = req_builder
7887                    .header(CONTENT_LENGTH, 0_u64)
7888                    .body(common::to_body::<String>(None));
7889
7890                client.request(request.unwrap()).await
7891            };
7892
7893            match req_result {
7894                Err(err) => {
7895                    if let common::Retry::After(d) = dlg.http_error(&err) {
7896                        sleep(d).await;
7897                        continue;
7898                    }
7899                    dlg.finished(false);
7900                    return Err(common::Error::HttpError(err));
7901                }
7902                Ok(res) => {
7903                    let (mut parts, body) = res.into_parts();
7904                    let mut body = common::Body::new(body);
7905                    if !parts.status.is_success() {
7906                        let bytes = common::to_bytes(body).await.unwrap_or_default();
7907                        let error = serde_json::from_str(&common::to_string(&bytes));
7908                        let response = common::to_response(parts, bytes.into());
7909
7910                        if let common::Retry::After(d) =
7911                            dlg.http_failure(&response, error.as_ref().ok())
7912                        {
7913                            sleep(d).await;
7914                            continue;
7915                        }
7916
7917                        dlg.finished(false);
7918
7919                        return Err(match error {
7920                            Ok(value) => common::Error::BadRequest(value),
7921                            _ => common::Error::Failure(response),
7922                        });
7923                    }
7924                    let response = {
7925                        let bytes = common::to_bytes(body).await.unwrap_or_default();
7926                        let encoded = common::to_string(&bytes);
7927                        match serde_json::from_str(&encoded) {
7928                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
7929                            Err(error) => {
7930                                dlg.response_json_decode_error(&encoded, &error);
7931                                return Err(common::Error::JsonDecodeError(
7932                                    encoded.to_string(),
7933                                    error,
7934                                ));
7935                            }
7936                        }
7937                    };
7938
7939                    dlg.finished(true);
7940                    return Ok(response);
7941                }
7942            }
7943        }
7944    }
7945
7946    /// 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.
7947    ///
7948    /// Sets the *parent* path property to the given value.
7949    ///
7950    /// Even though the property as already been set when instantiating this call,
7951    /// we provide this method for API completeness.
7952    pub fn parent(mut self, new_value: &str) -> ProjectLocationInstanceListCall<'a, C> {
7953        self._parent = new_value.to_string();
7954        self
7955    }
7956    /// The next_page_token value to use if there are additional results to retrieve for this list request.
7957    ///
7958    /// Sets the *page token* query property to the given value.
7959    pub fn page_token(mut self, new_value: &str) -> ProjectLocationInstanceListCall<'a, C> {
7960        self._page_token = Some(new_value.to_string());
7961        self
7962    }
7963    /// The maximum number of items to return.
7964    ///
7965    /// Sets the *page size* query property to the given value.
7966    pub fn page_size(mut self, new_value: i32) -> ProjectLocationInstanceListCall<'a, C> {
7967        self._page_size = Some(new_value);
7968        self
7969    }
7970    /// Sort results. Supported values are "name", "name desc" or "" (unsorted).
7971    ///
7972    /// Sets the *order by* query property to the given value.
7973    pub fn order_by(mut self, new_value: &str) -> ProjectLocationInstanceListCall<'a, C> {
7974        self._order_by = Some(new_value.to_string());
7975        self
7976    }
7977    /// List filter.
7978    ///
7979    /// Sets the *filter* query property to the given value.
7980    pub fn filter(mut self, new_value: &str) -> ProjectLocationInstanceListCall<'a, C> {
7981        self._filter = Some(new_value.to_string());
7982        self
7983    }
7984    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7985    /// while executing the actual API request.
7986    ///
7987    /// ````text
7988    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
7989    /// ````
7990    ///
7991    /// Sets the *delegate* property to the given value.
7992    pub fn delegate(
7993        mut self,
7994        new_value: &'a mut dyn common::Delegate,
7995    ) -> ProjectLocationInstanceListCall<'a, C> {
7996        self._delegate = Some(new_value);
7997        self
7998    }
7999
8000    /// Set any additional parameter of the query string used in the request.
8001    /// It should be used to set parameters which are not yet available through their own
8002    /// setters.
8003    ///
8004    /// Please note that this method must not be used to set any of the known parameters
8005    /// which have their own setter method. If done anyway, the request will fail.
8006    ///
8007    /// # Additional Parameters
8008    ///
8009    /// * *$.xgafv* (query-string) - V1 error format.
8010    /// * *access_token* (query-string) - OAuth access token.
8011    /// * *alt* (query-string) - Data format for response.
8012    /// * *callback* (query-string) - JSONP
8013    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8014    /// * *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.
8015    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8016    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8017    /// * *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.
8018    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8019    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8020    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationInstanceListCall<'a, C>
8021    where
8022        T: AsRef<str>,
8023    {
8024        self._additional_params
8025            .insert(name.as_ref().to_string(), value.as_ref().to_string());
8026        self
8027    }
8028
8029    /// Identifies the authorization scope for the method you are building.
8030    ///
8031    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
8032    /// [`Scope::CloudPlatform`].
8033    ///
8034    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
8035    /// tokens for more than one scope.
8036    ///
8037    /// Usually there is more than one suitable scope to authorize an operation, some of which may
8038    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
8039    /// sufficient, a read-write scope will do as well.
8040    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationInstanceListCall<'a, C>
8041    where
8042        St: AsRef<str>,
8043    {
8044        self._scopes.insert(String::from(scope.as_ref()));
8045        self
8046    }
8047    /// Identifies the authorization scope(s) for the method you are building.
8048    ///
8049    /// See [`Self::add_scope()`] for details.
8050    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationInstanceListCall<'a, C>
8051    where
8052        I: IntoIterator<Item = St>,
8053        St: AsRef<str>,
8054    {
8055        self._scopes
8056            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
8057        self
8058    }
8059
8060    /// Removes all scopes, and no default scope will be used either.
8061    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
8062    /// for details).
8063    pub fn clear_scopes(mut self) -> ProjectLocationInstanceListCall<'a, C> {
8064        self._scopes.clear();
8065        self
8066    }
8067}
8068
8069/// Updates the settings of a specific instance.
8070///
8071/// A builder for the *locations.instances.patch* method supported by a *project* resource.
8072/// It is not used directly, but through a [`ProjectMethods`] instance.
8073///
8074/// # Example
8075///
8076/// Instantiate a resource method builder
8077///
8078/// ```test_harness,no_run
8079/// # extern crate hyper;
8080/// # extern crate hyper_rustls;
8081/// # extern crate google_file1_beta1 as file1_beta1;
8082/// use file1_beta1::api::Instance;
8083/// # async fn dox() {
8084/// # use file1_beta1::{CloudFilestore, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8085///
8086/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
8087/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
8088/// #     .with_native_roots()
8089/// #     .unwrap()
8090/// #     .https_only()
8091/// #     .enable_http2()
8092/// #     .build();
8093///
8094/// # let executor = hyper_util::rt::TokioExecutor::new();
8095/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
8096/// #     secret,
8097/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8098/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
8099/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
8100/// #     ),
8101/// # ).build().await.unwrap();
8102///
8103/// # let client = hyper_util::client::legacy::Client::builder(
8104/// #     hyper_util::rt::TokioExecutor::new()
8105/// # )
8106/// # .build(
8107/// #     hyper_rustls::HttpsConnectorBuilder::new()
8108/// #         .with_native_roots()
8109/// #         .unwrap()
8110/// #         .https_or_http()
8111/// #         .enable_http2()
8112/// #         .build()
8113/// # );
8114/// # let mut hub = CloudFilestore::new(client, auth);
8115/// // As the method needs a request, you would usually fill it with the desired information
8116/// // into the respective structure. Some of the parts shown here might not be applicable !
8117/// // Values shown here are possibly random and not representative !
8118/// let mut req = Instance::default();
8119///
8120/// // You can configure optional parameters by calling the respective setters at will, and
8121/// // execute the final call using `doit()`.
8122/// // Values shown here are possibly random and not representative !
8123/// let result = hub.projects().locations_instances_patch(req, "name")
8124///              .update_mask(FieldMask::new::<&str>(&[]))
8125///              .doit().await;
8126/// # }
8127/// ```
8128pub struct ProjectLocationInstancePatchCall<'a, C>
8129where
8130    C: 'a,
8131{
8132    hub: &'a CloudFilestore<C>,
8133    _request: Instance,
8134    _name: String,
8135    _update_mask: Option<common::FieldMask>,
8136    _delegate: Option<&'a mut dyn common::Delegate>,
8137    _additional_params: HashMap<String, String>,
8138    _scopes: BTreeSet<String>,
8139}
8140
8141impl<'a, C> common::CallBuilder for ProjectLocationInstancePatchCall<'a, C> {}
8142
8143impl<'a, C> ProjectLocationInstancePatchCall<'a, C>
8144where
8145    C: common::Connector,
8146{
8147    /// Perform the operation you have build so far.
8148    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
8149        use std::borrow::Cow;
8150        use std::io::{Read, Seek};
8151
8152        use common::{url::Params, ToParts};
8153        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
8154
8155        let mut dd = common::DefaultDelegate;
8156        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
8157        dlg.begin(common::MethodInfo {
8158            id: "file.projects.locations.instances.patch",
8159            http_method: hyper::Method::PATCH,
8160        });
8161
8162        for &field in ["alt", "name", "updateMask"].iter() {
8163            if self._additional_params.contains_key(field) {
8164                dlg.finished(false);
8165                return Err(common::Error::FieldClash(field));
8166            }
8167        }
8168
8169        let mut params = Params::with_capacity(5 + self._additional_params.len());
8170        params.push("name", self._name);
8171        if let Some(value) = self._update_mask.as_ref() {
8172            params.push("updateMask", value.to_string());
8173        }
8174
8175        params.extend(self._additional_params.iter());
8176
8177        params.push("alt", "json");
8178        let mut url = self.hub._base_url.clone() + "v1beta1/{+name}";
8179        if self._scopes.is_empty() {
8180            self._scopes
8181                .insert(Scope::CloudPlatform.as_ref().to_string());
8182        }
8183
8184        #[allow(clippy::single_element_loop)]
8185        for &(find_this, param_name) in [("{+name}", "name")].iter() {
8186            url = params.uri_replacement(url, param_name, find_this, true);
8187        }
8188        {
8189            let to_remove = ["name"];
8190            params.remove_params(&to_remove);
8191        }
8192
8193        let url = params.parse_with_url(&url);
8194
8195        let mut json_mime_type = mime::APPLICATION_JSON;
8196        let mut request_value_reader = {
8197            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
8198            common::remove_json_null_values(&mut value);
8199            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
8200            serde_json::to_writer(&mut dst, &value).unwrap();
8201            dst
8202        };
8203        let request_size = request_value_reader
8204            .seek(std::io::SeekFrom::End(0))
8205            .unwrap();
8206        request_value_reader
8207            .seek(std::io::SeekFrom::Start(0))
8208            .unwrap();
8209
8210        loop {
8211            let token = match self
8212                .hub
8213                .auth
8214                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
8215                .await
8216            {
8217                Ok(token) => token,
8218                Err(e) => match dlg.token(e) {
8219                    Ok(token) => token,
8220                    Err(e) => {
8221                        dlg.finished(false);
8222                        return Err(common::Error::MissingToken(e));
8223                    }
8224                },
8225            };
8226            request_value_reader
8227                .seek(std::io::SeekFrom::Start(0))
8228                .unwrap();
8229            let mut req_result = {
8230                let client = &self.hub.client;
8231                dlg.pre_request();
8232                let mut req_builder = hyper::Request::builder()
8233                    .method(hyper::Method::PATCH)
8234                    .uri(url.as_str())
8235                    .header(USER_AGENT, self.hub._user_agent.clone());
8236
8237                if let Some(token) = token.as_ref() {
8238                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8239                }
8240
8241                let request = req_builder
8242                    .header(CONTENT_TYPE, json_mime_type.to_string())
8243                    .header(CONTENT_LENGTH, request_size as u64)
8244                    .body(common::to_body(
8245                        request_value_reader.get_ref().clone().into(),
8246                    ));
8247
8248                client.request(request.unwrap()).await
8249            };
8250
8251            match req_result {
8252                Err(err) => {
8253                    if let common::Retry::After(d) = dlg.http_error(&err) {
8254                        sleep(d).await;
8255                        continue;
8256                    }
8257                    dlg.finished(false);
8258                    return Err(common::Error::HttpError(err));
8259                }
8260                Ok(res) => {
8261                    let (mut parts, body) = res.into_parts();
8262                    let mut body = common::Body::new(body);
8263                    if !parts.status.is_success() {
8264                        let bytes = common::to_bytes(body).await.unwrap_or_default();
8265                        let error = serde_json::from_str(&common::to_string(&bytes));
8266                        let response = common::to_response(parts, bytes.into());
8267
8268                        if let common::Retry::After(d) =
8269                            dlg.http_failure(&response, error.as_ref().ok())
8270                        {
8271                            sleep(d).await;
8272                            continue;
8273                        }
8274
8275                        dlg.finished(false);
8276
8277                        return Err(match error {
8278                            Ok(value) => common::Error::BadRequest(value),
8279                            _ => common::Error::Failure(response),
8280                        });
8281                    }
8282                    let response = {
8283                        let bytes = common::to_bytes(body).await.unwrap_or_default();
8284                        let encoded = common::to_string(&bytes);
8285                        match serde_json::from_str(&encoded) {
8286                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8287                            Err(error) => {
8288                                dlg.response_json_decode_error(&encoded, &error);
8289                                return Err(common::Error::JsonDecodeError(
8290                                    encoded.to_string(),
8291                                    error,
8292                                ));
8293                            }
8294                        }
8295                    };
8296
8297                    dlg.finished(true);
8298                    return Ok(response);
8299                }
8300            }
8301        }
8302    }
8303
8304    ///
8305    /// Sets the *request* property to the given value.
8306    ///
8307    /// Even though the property as already been set when instantiating this call,
8308    /// we provide this method for API completeness.
8309    pub fn request(mut self, new_value: Instance) -> ProjectLocationInstancePatchCall<'a, C> {
8310        self._request = new_value;
8311        self
8312    }
8313    /// Output only. The resource name of the instance, in the format `projects/{project_id}/locations/{location_id}/instances/{instance_id}`.
8314    ///
8315    /// Sets the *name* path property to the given value.
8316    ///
8317    /// Even though the property as already been set when instantiating this call,
8318    /// we provide this method for API completeness.
8319    pub fn name(mut self, new_value: &str) -> ProjectLocationInstancePatchCall<'a, C> {
8320        self._name = new_value.to_string();
8321        self
8322    }
8323    /// 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" * "performance_config" * "deletion_protection_enabled" * "deletion_protection_reason"
8324    ///
8325    /// Sets the *update mask* query property to the given value.
8326    pub fn update_mask(
8327        mut self,
8328        new_value: common::FieldMask,
8329    ) -> ProjectLocationInstancePatchCall<'a, C> {
8330        self._update_mask = Some(new_value);
8331        self
8332    }
8333    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8334    /// while executing the actual API request.
8335    ///
8336    /// ````text
8337    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
8338    /// ````
8339    ///
8340    /// Sets the *delegate* property to the given value.
8341    pub fn delegate(
8342        mut self,
8343        new_value: &'a mut dyn common::Delegate,
8344    ) -> ProjectLocationInstancePatchCall<'a, C> {
8345        self._delegate = Some(new_value);
8346        self
8347    }
8348
8349    /// Set any additional parameter of the query string used in the request.
8350    /// It should be used to set parameters which are not yet available through their own
8351    /// setters.
8352    ///
8353    /// Please note that this method must not be used to set any of the known parameters
8354    /// which have their own setter method. If done anyway, the request will fail.
8355    ///
8356    /// # Additional Parameters
8357    ///
8358    /// * *$.xgafv* (query-string) - V1 error format.
8359    /// * *access_token* (query-string) - OAuth access token.
8360    /// * *alt* (query-string) - Data format for response.
8361    /// * *callback* (query-string) - JSONP
8362    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8363    /// * *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.
8364    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8365    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8366    /// * *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.
8367    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8368    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8369    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationInstancePatchCall<'a, C>
8370    where
8371        T: AsRef<str>,
8372    {
8373        self._additional_params
8374            .insert(name.as_ref().to_string(), value.as_ref().to_string());
8375        self
8376    }
8377
8378    /// Identifies the authorization scope for the method you are building.
8379    ///
8380    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
8381    /// [`Scope::CloudPlatform`].
8382    ///
8383    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
8384    /// tokens for more than one scope.
8385    ///
8386    /// Usually there is more than one suitable scope to authorize an operation, some of which may
8387    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
8388    /// sufficient, a read-write scope will do as well.
8389    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationInstancePatchCall<'a, C>
8390    where
8391        St: AsRef<str>,
8392    {
8393        self._scopes.insert(String::from(scope.as_ref()));
8394        self
8395    }
8396    /// Identifies the authorization scope(s) for the method you are building.
8397    ///
8398    /// See [`Self::add_scope()`] for details.
8399    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationInstancePatchCall<'a, C>
8400    where
8401        I: IntoIterator<Item = St>,
8402        St: AsRef<str>,
8403    {
8404        self._scopes
8405            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
8406        self
8407    }
8408
8409    /// Removes all scopes, and no default scope will be used either.
8410    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
8411    /// for details).
8412    pub fn clear_scopes(mut self) -> ProjectLocationInstancePatchCall<'a, C> {
8413        self._scopes.clear();
8414        self
8415    }
8416}
8417
8418/// Pause the standby instance (replica). WARNING: This operation makes the standby instance's NFS filesystem writable. Any data written to the standby instance while paused will be lost when the replica is resumed or promoted.
8419///
8420/// A builder for the *locations.instances.pauseReplica* method supported by a *project* resource.
8421/// It is not used directly, but through a [`ProjectMethods`] instance.
8422///
8423/// # Example
8424///
8425/// Instantiate a resource method builder
8426///
8427/// ```test_harness,no_run
8428/// # extern crate hyper;
8429/// # extern crate hyper_rustls;
8430/// # extern crate google_file1_beta1 as file1_beta1;
8431/// use file1_beta1::api::PauseReplicaRequest;
8432/// # async fn dox() {
8433/// # use file1_beta1::{CloudFilestore, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8434///
8435/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
8436/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
8437/// #     .with_native_roots()
8438/// #     .unwrap()
8439/// #     .https_only()
8440/// #     .enable_http2()
8441/// #     .build();
8442///
8443/// # let executor = hyper_util::rt::TokioExecutor::new();
8444/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
8445/// #     secret,
8446/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8447/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
8448/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
8449/// #     ),
8450/// # ).build().await.unwrap();
8451///
8452/// # let client = hyper_util::client::legacy::Client::builder(
8453/// #     hyper_util::rt::TokioExecutor::new()
8454/// # )
8455/// # .build(
8456/// #     hyper_rustls::HttpsConnectorBuilder::new()
8457/// #         .with_native_roots()
8458/// #         .unwrap()
8459/// #         .https_or_http()
8460/// #         .enable_http2()
8461/// #         .build()
8462/// # );
8463/// # let mut hub = CloudFilestore::new(client, auth);
8464/// // As the method needs a request, you would usually fill it with the desired information
8465/// // into the respective structure. Some of the parts shown here might not be applicable !
8466/// // Values shown here are possibly random and not representative !
8467/// let mut req = PauseReplicaRequest::default();
8468///
8469/// // You can configure optional parameters by calling the respective setters at will, and
8470/// // execute the final call using `doit()`.
8471/// // Values shown here are possibly random and not representative !
8472/// let result = hub.projects().locations_instances_pause_replica(req, "name")
8473///              .doit().await;
8474/// # }
8475/// ```
8476pub struct ProjectLocationInstancePauseReplicaCall<'a, C>
8477where
8478    C: 'a,
8479{
8480    hub: &'a CloudFilestore<C>,
8481    _request: PauseReplicaRequest,
8482    _name: String,
8483    _delegate: Option<&'a mut dyn common::Delegate>,
8484    _additional_params: HashMap<String, String>,
8485    _scopes: BTreeSet<String>,
8486}
8487
8488impl<'a, C> common::CallBuilder for ProjectLocationInstancePauseReplicaCall<'a, C> {}
8489
8490impl<'a, C> ProjectLocationInstancePauseReplicaCall<'a, C>
8491where
8492    C: common::Connector,
8493{
8494    /// Perform the operation you have build so far.
8495    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
8496        use std::borrow::Cow;
8497        use std::io::{Read, Seek};
8498
8499        use common::{url::Params, ToParts};
8500        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
8501
8502        let mut dd = common::DefaultDelegate;
8503        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
8504        dlg.begin(common::MethodInfo {
8505            id: "file.projects.locations.instances.pauseReplica",
8506            http_method: hyper::Method::POST,
8507        });
8508
8509        for &field in ["alt", "name"].iter() {
8510            if self._additional_params.contains_key(field) {
8511                dlg.finished(false);
8512                return Err(common::Error::FieldClash(field));
8513            }
8514        }
8515
8516        let mut params = Params::with_capacity(4 + self._additional_params.len());
8517        params.push("name", self._name);
8518
8519        params.extend(self._additional_params.iter());
8520
8521        params.push("alt", "json");
8522        let mut url = self.hub._base_url.clone() + "v1beta1/{+name}:pauseReplica";
8523        if self._scopes.is_empty() {
8524            self._scopes
8525                .insert(Scope::CloudPlatform.as_ref().to_string());
8526        }
8527
8528        #[allow(clippy::single_element_loop)]
8529        for &(find_this, param_name) in [("{+name}", "name")].iter() {
8530            url = params.uri_replacement(url, param_name, find_this, true);
8531        }
8532        {
8533            let to_remove = ["name"];
8534            params.remove_params(&to_remove);
8535        }
8536
8537        let url = params.parse_with_url(&url);
8538
8539        let mut json_mime_type = mime::APPLICATION_JSON;
8540        let mut request_value_reader = {
8541            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
8542            common::remove_json_null_values(&mut value);
8543            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
8544            serde_json::to_writer(&mut dst, &value).unwrap();
8545            dst
8546        };
8547        let request_size = request_value_reader
8548            .seek(std::io::SeekFrom::End(0))
8549            .unwrap();
8550        request_value_reader
8551            .seek(std::io::SeekFrom::Start(0))
8552            .unwrap();
8553
8554        loop {
8555            let token = match self
8556                .hub
8557                .auth
8558                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
8559                .await
8560            {
8561                Ok(token) => token,
8562                Err(e) => match dlg.token(e) {
8563                    Ok(token) => token,
8564                    Err(e) => {
8565                        dlg.finished(false);
8566                        return Err(common::Error::MissingToken(e));
8567                    }
8568                },
8569            };
8570            request_value_reader
8571                .seek(std::io::SeekFrom::Start(0))
8572                .unwrap();
8573            let mut req_result = {
8574                let client = &self.hub.client;
8575                dlg.pre_request();
8576                let mut req_builder = hyper::Request::builder()
8577                    .method(hyper::Method::POST)
8578                    .uri(url.as_str())
8579                    .header(USER_AGENT, self.hub._user_agent.clone());
8580
8581                if let Some(token) = token.as_ref() {
8582                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8583                }
8584
8585                let request = req_builder
8586                    .header(CONTENT_TYPE, json_mime_type.to_string())
8587                    .header(CONTENT_LENGTH, request_size as u64)
8588                    .body(common::to_body(
8589                        request_value_reader.get_ref().clone().into(),
8590                    ));
8591
8592                client.request(request.unwrap()).await
8593            };
8594
8595            match req_result {
8596                Err(err) => {
8597                    if let common::Retry::After(d) = dlg.http_error(&err) {
8598                        sleep(d).await;
8599                        continue;
8600                    }
8601                    dlg.finished(false);
8602                    return Err(common::Error::HttpError(err));
8603                }
8604                Ok(res) => {
8605                    let (mut parts, body) = res.into_parts();
8606                    let mut body = common::Body::new(body);
8607                    if !parts.status.is_success() {
8608                        let bytes = common::to_bytes(body).await.unwrap_or_default();
8609                        let error = serde_json::from_str(&common::to_string(&bytes));
8610                        let response = common::to_response(parts, bytes.into());
8611
8612                        if let common::Retry::After(d) =
8613                            dlg.http_failure(&response, error.as_ref().ok())
8614                        {
8615                            sleep(d).await;
8616                            continue;
8617                        }
8618
8619                        dlg.finished(false);
8620
8621                        return Err(match error {
8622                            Ok(value) => common::Error::BadRequest(value),
8623                            _ => common::Error::Failure(response),
8624                        });
8625                    }
8626                    let response = {
8627                        let bytes = common::to_bytes(body).await.unwrap_or_default();
8628                        let encoded = common::to_string(&bytes);
8629                        match serde_json::from_str(&encoded) {
8630                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8631                            Err(error) => {
8632                                dlg.response_json_decode_error(&encoded, &error);
8633                                return Err(common::Error::JsonDecodeError(
8634                                    encoded.to_string(),
8635                                    error,
8636                                ));
8637                            }
8638                        }
8639                    };
8640
8641                    dlg.finished(true);
8642                    return Ok(response);
8643                }
8644            }
8645        }
8646    }
8647
8648    ///
8649    /// Sets the *request* property to the given value.
8650    ///
8651    /// Even though the property as already been set when instantiating this call,
8652    /// we provide this method for API completeness.
8653    pub fn request(
8654        mut self,
8655        new_value: PauseReplicaRequest,
8656    ) -> ProjectLocationInstancePauseReplicaCall<'a, C> {
8657        self._request = new_value;
8658        self
8659    }
8660    /// Required. The resource name of the instance, in the format `projects/{project_id}/locations/{location_id}/instances/{instance_id}`.
8661    ///
8662    /// Sets the *name* path property to the given value.
8663    ///
8664    /// Even though the property as already been set when instantiating this call,
8665    /// we provide this method for API completeness.
8666    pub fn name(mut self, new_value: &str) -> ProjectLocationInstancePauseReplicaCall<'a, C> {
8667        self._name = new_value.to_string();
8668        self
8669    }
8670    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8671    /// while executing the actual API request.
8672    ///
8673    /// ````text
8674    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
8675    /// ````
8676    ///
8677    /// Sets the *delegate* property to the given value.
8678    pub fn delegate(
8679        mut self,
8680        new_value: &'a mut dyn common::Delegate,
8681    ) -> ProjectLocationInstancePauseReplicaCall<'a, C> {
8682        self._delegate = Some(new_value);
8683        self
8684    }
8685
8686    /// Set any additional parameter of the query string used in the request.
8687    /// It should be used to set parameters which are not yet available through their own
8688    /// setters.
8689    ///
8690    /// Please note that this method must not be used to set any of the known parameters
8691    /// which have their own setter method. If done anyway, the request will fail.
8692    ///
8693    /// # Additional Parameters
8694    ///
8695    /// * *$.xgafv* (query-string) - V1 error format.
8696    /// * *access_token* (query-string) - OAuth access token.
8697    /// * *alt* (query-string) - Data format for response.
8698    /// * *callback* (query-string) - JSONP
8699    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8700    /// * *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.
8701    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8702    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8703    /// * *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.
8704    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8705    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8706    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationInstancePauseReplicaCall<'a, C>
8707    where
8708        T: AsRef<str>,
8709    {
8710        self._additional_params
8711            .insert(name.as_ref().to_string(), value.as_ref().to_string());
8712        self
8713    }
8714
8715    /// Identifies the authorization scope for the method you are building.
8716    ///
8717    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
8718    /// [`Scope::CloudPlatform`].
8719    ///
8720    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
8721    /// tokens for more than one scope.
8722    ///
8723    /// Usually there is more than one suitable scope to authorize an operation, some of which may
8724    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
8725    /// sufficient, a read-write scope will do as well.
8726    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationInstancePauseReplicaCall<'a, C>
8727    where
8728        St: AsRef<str>,
8729    {
8730        self._scopes.insert(String::from(scope.as_ref()));
8731        self
8732    }
8733    /// Identifies the authorization scope(s) for the method you are building.
8734    ///
8735    /// See [`Self::add_scope()`] for details.
8736    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationInstancePauseReplicaCall<'a, C>
8737    where
8738        I: IntoIterator<Item = St>,
8739        St: AsRef<str>,
8740    {
8741        self._scopes
8742            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
8743        self
8744    }
8745
8746    /// Removes all scopes, and no default scope will be used either.
8747    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
8748    /// for details).
8749    pub fn clear_scopes(mut self) -> ProjectLocationInstancePauseReplicaCall<'a, C> {
8750        self._scopes.clear();
8751        self
8752    }
8753}
8754
8755/// Promote the standby instance (replica).
8756///
8757/// A builder for the *locations.instances.promoteReplica* method supported by a *project* resource.
8758/// It is not used directly, but through a [`ProjectMethods`] instance.
8759///
8760/// # Example
8761///
8762/// Instantiate a resource method builder
8763///
8764/// ```test_harness,no_run
8765/// # extern crate hyper;
8766/// # extern crate hyper_rustls;
8767/// # extern crate google_file1_beta1 as file1_beta1;
8768/// use file1_beta1::api::PromoteReplicaRequest;
8769/// # async fn dox() {
8770/// # use file1_beta1::{CloudFilestore, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8771///
8772/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
8773/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
8774/// #     .with_native_roots()
8775/// #     .unwrap()
8776/// #     .https_only()
8777/// #     .enable_http2()
8778/// #     .build();
8779///
8780/// # let executor = hyper_util::rt::TokioExecutor::new();
8781/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
8782/// #     secret,
8783/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8784/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
8785/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
8786/// #     ),
8787/// # ).build().await.unwrap();
8788///
8789/// # let client = hyper_util::client::legacy::Client::builder(
8790/// #     hyper_util::rt::TokioExecutor::new()
8791/// # )
8792/// # .build(
8793/// #     hyper_rustls::HttpsConnectorBuilder::new()
8794/// #         .with_native_roots()
8795/// #         .unwrap()
8796/// #         .https_or_http()
8797/// #         .enable_http2()
8798/// #         .build()
8799/// # );
8800/// # let mut hub = CloudFilestore::new(client, auth);
8801/// // As the method needs a request, you would usually fill it with the desired information
8802/// // into the respective structure. Some of the parts shown here might not be applicable !
8803/// // Values shown here are possibly random and not representative !
8804/// let mut req = PromoteReplicaRequest::default();
8805///
8806/// // You can configure optional parameters by calling the respective setters at will, and
8807/// // execute the final call using `doit()`.
8808/// // Values shown here are possibly random and not representative !
8809/// let result = hub.projects().locations_instances_promote_replica(req, "name")
8810///              .doit().await;
8811/// # }
8812/// ```
8813pub struct ProjectLocationInstancePromoteReplicaCall<'a, C>
8814where
8815    C: 'a,
8816{
8817    hub: &'a CloudFilestore<C>,
8818    _request: PromoteReplicaRequest,
8819    _name: String,
8820    _delegate: Option<&'a mut dyn common::Delegate>,
8821    _additional_params: HashMap<String, String>,
8822    _scopes: BTreeSet<String>,
8823}
8824
8825impl<'a, C> common::CallBuilder for ProjectLocationInstancePromoteReplicaCall<'a, C> {}
8826
8827impl<'a, C> ProjectLocationInstancePromoteReplicaCall<'a, C>
8828where
8829    C: common::Connector,
8830{
8831    /// Perform the operation you have build so far.
8832    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
8833        use std::borrow::Cow;
8834        use std::io::{Read, Seek};
8835
8836        use common::{url::Params, ToParts};
8837        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
8838
8839        let mut dd = common::DefaultDelegate;
8840        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
8841        dlg.begin(common::MethodInfo {
8842            id: "file.projects.locations.instances.promoteReplica",
8843            http_method: hyper::Method::POST,
8844        });
8845
8846        for &field in ["alt", "name"].iter() {
8847            if self._additional_params.contains_key(field) {
8848                dlg.finished(false);
8849                return Err(common::Error::FieldClash(field));
8850            }
8851        }
8852
8853        let mut params = Params::with_capacity(4 + self._additional_params.len());
8854        params.push("name", self._name);
8855
8856        params.extend(self._additional_params.iter());
8857
8858        params.push("alt", "json");
8859        let mut url = self.hub._base_url.clone() + "v1beta1/{+name}:promoteReplica";
8860        if self._scopes.is_empty() {
8861            self._scopes
8862                .insert(Scope::CloudPlatform.as_ref().to_string());
8863        }
8864
8865        #[allow(clippy::single_element_loop)]
8866        for &(find_this, param_name) in [("{+name}", "name")].iter() {
8867            url = params.uri_replacement(url, param_name, find_this, true);
8868        }
8869        {
8870            let to_remove = ["name"];
8871            params.remove_params(&to_remove);
8872        }
8873
8874        let url = params.parse_with_url(&url);
8875
8876        let mut json_mime_type = mime::APPLICATION_JSON;
8877        let mut request_value_reader = {
8878            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
8879            common::remove_json_null_values(&mut value);
8880            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
8881            serde_json::to_writer(&mut dst, &value).unwrap();
8882            dst
8883        };
8884        let request_size = request_value_reader
8885            .seek(std::io::SeekFrom::End(0))
8886            .unwrap();
8887        request_value_reader
8888            .seek(std::io::SeekFrom::Start(0))
8889            .unwrap();
8890
8891        loop {
8892            let token = match self
8893                .hub
8894                .auth
8895                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
8896                .await
8897            {
8898                Ok(token) => token,
8899                Err(e) => match dlg.token(e) {
8900                    Ok(token) => token,
8901                    Err(e) => {
8902                        dlg.finished(false);
8903                        return Err(common::Error::MissingToken(e));
8904                    }
8905                },
8906            };
8907            request_value_reader
8908                .seek(std::io::SeekFrom::Start(0))
8909                .unwrap();
8910            let mut req_result = {
8911                let client = &self.hub.client;
8912                dlg.pre_request();
8913                let mut req_builder = hyper::Request::builder()
8914                    .method(hyper::Method::POST)
8915                    .uri(url.as_str())
8916                    .header(USER_AGENT, self.hub._user_agent.clone());
8917
8918                if let Some(token) = token.as_ref() {
8919                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8920                }
8921
8922                let request = req_builder
8923                    .header(CONTENT_TYPE, json_mime_type.to_string())
8924                    .header(CONTENT_LENGTH, request_size as u64)
8925                    .body(common::to_body(
8926                        request_value_reader.get_ref().clone().into(),
8927                    ));
8928
8929                client.request(request.unwrap()).await
8930            };
8931
8932            match req_result {
8933                Err(err) => {
8934                    if let common::Retry::After(d) = dlg.http_error(&err) {
8935                        sleep(d).await;
8936                        continue;
8937                    }
8938                    dlg.finished(false);
8939                    return Err(common::Error::HttpError(err));
8940                }
8941                Ok(res) => {
8942                    let (mut parts, body) = res.into_parts();
8943                    let mut body = common::Body::new(body);
8944                    if !parts.status.is_success() {
8945                        let bytes = common::to_bytes(body).await.unwrap_or_default();
8946                        let error = serde_json::from_str(&common::to_string(&bytes));
8947                        let response = common::to_response(parts, bytes.into());
8948
8949                        if let common::Retry::After(d) =
8950                            dlg.http_failure(&response, error.as_ref().ok())
8951                        {
8952                            sleep(d).await;
8953                            continue;
8954                        }
8955
8956                        dlg.finished(false);
8957
8958                        return Err(match error {
8959                            Ok(value) => common::Error::BadRequest(value),
8960                            _ => common::Error::Failure(response),
8961                        });
8962                    }
8963                    let response = {
8964                        let bytes = common::to_bytes(body).await.unwrap_or_default();
8965                        let encoded = common::to_string(&bytes);
8966                        match serde_json::from_str(&encoded) {
8967                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8968                            Err(error) => {
8969                                dlg.response_json_decode_error(&encoded, &error);
8970                                return Err(common::Error::JsonDecodeError(
8971                                    encoded.to_string(),
8972                                    error,
8973                                ));
8974                            }
8975                        }
8976                    };
8977
8978                    dlg.finished(true);
8979                    return Ok(response);
8980                }
8981            }
8982        }
8983    }
8984
8985    ///
8986    /// Sets the *request* property to the given value.
8987    ///
8988    /// Even though the property as already been set when instantiating this call,
8989    /// we provide this method for API completeness.
8990    pub fn request(
8991        mut self,
8992        new_value: PromoteReplicaRequest,
8993    ) -> ProjectLocationInstancePromoteReplicaCall<'a, C> {
8994        self._request = new_value;
8995        self
8996    }
8997    /// Required. The resource name of the instance, in the format `projects/{project_id}/locations/{location_id}/instances/{instance_id}`.
8998    ///
8999    /// Sets the *name* path property to the given value.
9000    ///
9001    /// Even though the property as already been set when instantiating this call,
9002    /// we provide this method for API completeness.
9003    pub fn name(mut self, new_value: &str) -> ProjectLocationInstancePromoteReplicaCall<'a, C> {
9004        self._name = new_value.to_string();
9005        self
9006    }
9007    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
9008    /// while executing the actual API request.
9009    ///
9010    /// ````text
9011    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
9012    /// ````
9013    ///
9014    /// Sets the *delegate* property to the given value.
9015    pub fn delegate(
9016        mut self,
9017        new_value: &'a mut dyn common::Delegate,
9018    ) -> ProjectLocationInstancePromoteReplicaCall<'a, C> {
9019        self._delegate = Some(new_value);
9020        self
9021    }
9022
9023    /// Set any additional parameter of the query string used in the request.
9024    /// It should be used to set parameters which are not yet available through their own
9025    /// setters.
9026    ///
9027    /// Please note that this method must not be used to set any of the known parameters
9028    /// which have their own setter method. If done anyway, the request will fail.
9029    ///
9030    /// # Additional Parameters
9031    ///
9032    /// * *$.xgafv* (query-string) - V1 error format.
9033    /// * *access_token* (query-string) - OAuth access token.
9034    /// * *alt* (query-string) - Data format for response.
9035    /// * *callback* (query-string) - JSONP
9036    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
9037    /// * *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.
9038    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
9039    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
9040    /// * *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.
9041    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
9042    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
9043    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationInstancePromoteReplicaCall<'a, C>
9044    where
9045        T: AsRef<str>,
9046    {
9047        self._additional_params
9048            .insert(name.as_ref().to_string(), value.as_ref().to_string());
9049        self
9050    }
9051
9052    /// Identifies the authorization scope for the method you are building.
9053    ///
9054    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
9055    /// [`Scope::CloudPlatform`].
9056    ///
9057    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
9058    /// tokens for more than one scope.
9059    ///
9060    /// Usually there is more than one suitable scope to authorize an operation, some of which may
9061    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
9062    /// sufficient, a read-write scope will do as well.
9063    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationInstancePromoteReplicaCall<'a, C>
9064    where
9065        St: AsRef<str>,
9066    {
9067        self._scopes.insert(String::from(scope.as_ref()));
9068        self
9069    }
9070    /// Identifies the authorization scope(s) for the method you are building.
9071    ///
9072    /// See [`Self::add_scope()`] for details.
9073    pub fn add_scopes<I, St>(
9074        mut self,
9075        scopes: I,
9076    ) -> ProjectLocationInstancePromoteReplicaCall<'a, C>
9077    where
9078        I: IntoIterator<Item = St>,
9079        St: AsRef<str>,
9080    {
9081        self._scopes
9082            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
9083        self
9084    }
9085
9086    /// Removes all scopes, and no default scope will be used either.
9087    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
9088    /// for details).
9089    pub fn clear_scopes(mut self) -> ProjectLocationInstancePromoteReplicaCall<'a, C> {
9090        self._scopes.clear();
9091        self
9092    }
9093}
9094
9095/// 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).
9096///
9097/// A builder for the *locations.instances.restore* method supported by a *project* resource.
9098/// It is not used directly, but through a [`ProjectMethods`] instance.
9099///
9100/// # Example
9101///
9102/// Instantiate a resource method builder
9103///
9104/// ```test_harness,no_run
9105/// # extern crate hyper;
9106/// # extern crate hyper_rustls;
9107/// # extern crate google_file1_beta1 as file1_beta1;
9108/// use file1_beta1::api::RestoreInstanceRequest;
9109/// # async fn dox() {
9110/// # use file1_beta1::{CloudFilestore, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9111///
9112/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
9113/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
9114/// #     .with_native_roots()
9115/// #     .unwrap()
9116/// #     .https_only()
9117/// #     .enable_http2()
9118/// #     .build();
9119///
9120/// # let executor = hyper_util::rt::TokioExecutor::new();
9121/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
9122/// #     secret,
9123/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9124/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
9125/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
9126/// #     ),
9127/// # ).build().await.unwrap();
9128///
9129/// # let client = hyper_util::client::legacy::Client::builder(
9130/// #     hyper_util::rt::TokioExecutor::new()
9131/// # )
9132/// # .build(
9133/// #     hyper_rustls::HttpsConnectorBuilder::new()
9134/// #         .with_native_roots()
9135/// #         .unwrap()
9136/// #         .https_or_http()
9137/// #         .enable_http2()
9138/// #         .build()
9139/// # );
9140/// # let mut hub = CloudFilestore::new(client, auth);
9141/// // As the method needs a request, you would usually fill it with the desired information
9142/// // into the respective structure. Some of the parts shown here might not be applicable !
9143/// // Values shown here are possibly random and not representative !
9144/// let mut req = RestoreInstanceRequest::default();
9145///
9146/// // You can configure optional parameters by calling the respective setters at will, and
9147/// // execute the final call using `doit()`.
9148/// // Values shown here are possibly random and not representative !
9149/// let result = hub.projects().locations_instances_restore(req, "name")
9150///              .doit().await;
9151/// # }
9152/// ```
9153pub struct ProjectLocationInstanceRestoreCall<'a, C>
9154where
9155    C: 'a,
9156{
9157    hub: &'a CloudFilestore<C>,
9158    _request: RestoreInstanceRequest,
9159    _name: String,
9160    _delegate: Option<&'a mut dyn common::Delegate>,
9161    _additional_params: HashMap<String, String>,
9162    _scopes: BTreeSet<String>,
9163}
9164
9165impl<'a, C> common::CallBuilder for ProjectLocationInstanceRestoreCall<'a, C> {}
9166
9167impl<'a, C> ProjectLocationInstanceRestoreCall<'a, C>
9168where
9169    C: common::Connector,
9170{
9171    /// Perform the operation you have build so far.
9172    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
9173        use std::borrow::Cow;
9174        use std::io::{Read, Seek};
9175
9176        use common::{url::Params, ToParts};
9177        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
9178
9179        let mut dd = common::DefaultDelegate;
9180        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
9181        dlg.begin(common::MethodInfo {
9182            id: "file.projects.locations.instances.restore",
9183            http_method: hyper::Method::POST,
9184        });
9185
9186        for &field in ["alt", "name"].iter() {
9187            if self._additional_params.contains_key(field) {
9188                dlg.finished(false);
9189                return Err(common::Error::FieldClash(field));
9190            }
9191        }
9192
9193        let mut params = Params::with_capacity(4 + self._additional_params.len());
9194        params.push("name", self._name);
9195
9196        params.extend(self._additional_params.iter());
9197
9198        params.push("alt", "json");
9199        let mut url = self.hub._base_url.clone() + "v1beta1/{+name}:restore";
9200        if self._scopes.is_empty() {
9201            self._scopes
9202                .insert(Scope::CloudPlatform.as_ref().to_string());
9203        }
9204
9205        #[allow(clippy::single_element_loop)]
9206        for &(find_this, param_name) in [("{+name}", "name")].iter() {
9207            url = params.uri_replacement(url, param_name, find_this, true);
9208        }
9209        {
9210            let to_remove = ["name"];
9211            params.remove_params(&to_remove);
9212        }
9213
9214        let url = params.parse_with_url(&url);
9215
9216        let mut json_mime_type = mime::APPLICATION_JSON;
9217        let mut request_value_reader = {
9218            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
9219            common::remove_json_null_values(&mut value);
9220            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
9221            serde_json::to_writer(&mut dst, &value).unwrap();
9222            dst
9223        };
9224        let request_size = request_value_reader
9225            .seek(std::io::SeekFrom::End(0))
9226            .unwrap();
9227        request_value_reader
9228            .seek(std::io::SeekFrom::Start(0))
9229            .unwrap();
9230
9231        loop {
9232            let token = match self
9233                .hub
9234                .auth
9235                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
9236                .await
9237            {
9238                Ok(token) => token,
9239                Err(e) => match dlg.token(e) {
9240                    Ok(token) => token,
9241                    Err(e) => {
9242                        dlg.finished(false);
9243                        return Err(common::Error::MissingToken(e));
9244                    }
9245                },
9246            };
9247            request_value_reader
9248                .seek(std::io::SeekFrom::Start(0))
9249                .unwrap();
9250            let mut req_result = {
9251                let client = &self.hub.client;
9252                dlg.pre_request();
9253                let mut req_builder = hyper::Request::builder()
9254                    .method(hyper::Method::POST)
9255                    .uri(url.as_str())
9256                    .header(USER_AGENT, self.hub._user_agent.clone());
9257
9258                if let Some(token) = token.as_ref() {
9259                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
9260                }
9261
9262                let request = req_builder
9263                    .header(CONTENT_TYPE, json_mime_type.to_string())
9264                    .header(CONTENT_LENGTH, request_size as u64)
9265                    .body(common::to_body(
9266                        request_value_reader.get_ref().clone().into(),
9267                    ));
9268
9269                client.request(request.unwrap()).await
9270            };
9271
9272            match req_result {
9273                Err(err) => {
9274                    if let common::Retry::After(d) = dlg.http_error(&err) {
9275                        sleep(d).await;
9276                        continue;
9277                    }
9278                    dlg.finished(false);
9279                    return Err(common::Error::HttpError(err));
9280                }
9281                Ok(res) => {
9282                    let (mut parts, body) = res.into_parts();
9283                    let mut body = common::Body::new(body);
9284                    if !parts.status.is_success() {
9285                        let bytes = common::to_bytes(body).await.unwrap_or_default();
9286                        let error = serde_json::from_str(&common::to_string(&bytes));
9287                        let response = common::to_response(parts, bytes.into());
9288
9289                        if let common::Retry::After(d) =
9290                            dlg.http_failure(&response, error.as_ref().ok())
9291                        {
9292                            sleep(d).await;
9293                            continue;
9294                        }
9295
9296                        dlg.finished(false);
9297
9298                        return Err(match error {
9299                            Ok(value) => common::Error::BadRequest(value),
9300                            _ => common::Error::Failure(response),
9301                        });
9302                    }
9303                    let response = {
9304                        let bytes = common::to_bytes(body).await.unwrap_or_default();
9305                        let encoded = common::to_string(&bytes);
9306                        match serde_json::from_str(&encoded) {
9307                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
9308                            Err(error) => {
9309                                dlg.response_json_decode_error(&encoded, &error);
9310                                return Err(common::Error::JsonDecodeError(
9311                                    encoded.to_string(),
9312                                    error,
9313                                ));
9314                            }
9315                        }
9316                    };
9317
9318                    dlg.finished(true);
9319                    return Ok(response);
9320                }
9321            }
9322        }
9323    }
9324
9325    ///
9326    /// Sets the *request* property to the given value.
9327    ///
9328    /// Even though the property as already been set when instantiating this call,
9329    /// we provide this method for API completeness.
9330    pub fn request(
9331        mut self,
9332        new_value: RestoreInstanceRequest,
9333    ) -> ProjectLocationInstanceRestoreCall<'a, C> {
9334        self._request = new_value;
9335        self
9336    }
9337    /// Required. The resource name of the instance, in the format `projects/{project_id}/locations/{location_id}/instances/{instance_id}`.
9338    ///
9339    /// Sets the *name* path property to the given value.
9340    ///
9341    /// Even though the property as already been set when instantiating this call,
9342    /// we provide this method for API completeness.
9343    pub fn name(mut self, new_value: &str) -> ProjectLocationInstanceRestoreCall<'a, C> {
9344        self._name = new_value.to_string();
9345        self
9346    }
9347    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
9348    /// while executing the actual API request.
9349    ///
9350    /// ````text
9351    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
9352    /// ````
9353    ///
9354    /// Sets the *delegate* property to the given value.
9355    pub fn delegate(
9356        mut self,
9357        new_value: &'a mut dyn common::Delegate,
9358    ) -> ProjectLocationInstanceRestoreCall<'a, C> {
9359        self._delegate = Some(new_value);
9360        self
9361    }
9362
9363    /// Set any additional parameter of the query string used in the request.
9364    /// It should be used to set parameters which are not yet available through their own
9365    /// setters.
9366    ///
9367    /// Please note that this method must not be used to set any of the known parameters
9368    /// which have their own setter method. If done anyway, the request will fail.
9369    ///
9370    /// # Additional Parameters
9371    ///
9372    /// * *$.xgafv* (query-string) - V1 error format.
9373    /// * *access_token* (query-string) - OAuth access token.
9374    /// * *alt* (query-string) - Data format for response.
9375    /// * *callback* (query-string) - JSONP
9376    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
9377    /// * *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.
9378    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
9379    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
9380    /// * *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.
9381    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
9382    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
9383    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationInstanceRestoreCall<'a, C>
9384    where
9385        T: AsRef<str>,
9386    {
9387        self._additional_params
9388            .insert(name.as_ref().to_string(), value.as_ref().to_string());
9389        self
9390    }
9391
9392    /// Identifies the authorization scope for the method you are building.
9393    ///
9394    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
9395    /// [`Scope::CloudPlatform`].
9396    ///
9397    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
9398    /// tokens for more than one scope.
9399    ///
9400    /// Usually there is more than one suitable scope to authorize an operation, some of which may
9401    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
9402    /// sufficient, a read-write scope will do as well.
9403    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationInstanceRestoreCall<'a, C>
9404    where
9405        St: AsRef<str>,
9406    {
9407        self._scopes.insert(String::from(scope.as_ref()));
9408        self
9409    }
9410    /// Identifies the authorization scope(s) for the method you are building.
9411    ///
9412    /// See [`Self::add_scope()`] for details.
9413    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationInstanceRestoreCall<'a, C>
9414    where
9415        I: IntoIterator<Item = St>,
9416        St: AsRef<str>,
9417    {
9418        self._scopes
9419            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
9420        self
9421    }
9422
9423    /// Removes all scopes, and no default scope will be used either.
9424    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
9425    /// for details).
9426    pub fn clear_scopes(mut self) -> ProjectLocationInstanceRestoreCall<'a, C> {
9427        self._scopes.clear();
9428        self
9429    }
9430}
9431
9432/// Resume the standby instance (replica). WARNING: Any data written to the standby instance while paused will be lost when the replica is resumed.
9433///
9434/// A builder for the *locations.instances.resumeReplica* method supported by a *project* resource.
9435/// It is not used directly, but through a [`ProjectMethods`] instance.
9436///
9437/// # Example
9438///
9439/// Instantiate a resource method builder
9440///
9441/// ```test_harness,no_run
9442/// # extern crate hyper;
9443/// # extern crate hyper_rustls;
9444/// # extern crate google_file1_beta1 as file1_beta1;
9445/// use file1_beta1::api::ResumeReplicaRequest;
9446/// # async fn dox() {
9447/// # use file1_beta1::{CloudFilestore, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9448///
9449/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
9450/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
9451/// #     .with_native_roots()
9452/// #     .unwrap()
9453/// #     .https_only()
9454/// #     .enable_http2()
9455/// #     .build();
9456///
9457/// # let executor = hyper_util::rt::TokioExecutor::new();
9458/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
9459/// #     secret,
9460/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9461/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
9462/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
9463/// #     ),
9464/// # ).build().await.unwrap();
9465///
9466/// # let client = hyper_util::client::legacy::Client::builder(
9467/// #     hyper_util::rt::TokioExecutor::new()
9468/// # )
9469/// # .build(
9470/// #     hyper_rustls::HttpsConnectorBuilder::new()
9471/// #         .with_native_roots()
9472/// #         .unwrap()
9473/// #         .https_or_http()
9474/// #         .enable_http2()
9475/// #         .build()
9476/// # );
9477/// # let mut hub = CloudFilestore::new(client, auth);
9478/// // As the method needs a request, you would usually fill it with the desired information
9479/// // into the respective structure. Some of the parts shown here might not be applicable !
9480/// // Values shown here are possibly random and not representative !
9481/// let mut req = ResumeReplicaRequest::default();
9482///
9483/// // You can configure optional parameters by calling the respective setters at will, and
9484/// // execute the final call using `doit()`.
9485/// // Values shown here are possibly random and not representative !
9486/// let result = hub.projects().locations_instances_resume_replica(req, "name")
9487///              .doit().await;
9488/// # }
9489/// ```
9490pub struct ProjectLocationInstanceResumeReplicaCall<'a, C>
9491where
9492    C: 'a,
9493{
9494    hub: &'a CloudFilestore<C>,
9495    _request: ResumeReplicaRequest,
9496    _name: String,
9497    _delegate: Option<&'a mut dyn common::Delegate>,
9498    _additional_params: HashMap<String, String>,
9499    _scopes: BTreeSet<String>,
9500}
9501
9502impl<'a, C> common::CallBuilder for ProjectLocationInstanceResumeReplicaCall<'a, C> {}
9503
9504impl<'a, C> ProjectLocationInstanceResumeReplicaCall<'a, C>
9505where
9506    C: common::Connector,
9507{
9508    /// Perform the operation you have build so far.
9509    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
9510        use std::borrow::Cow;
9511        use std::io::{Read, Seek};
9512
9513        use common::{url::Params, ToParts};
9514        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
9515
9516        let mut dd = common::DefaultDelegate;
9517        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
9518        dlg.begin(common::MethodInfo {
9519            id: "file.projects.locations.instances.resumeReplica",
9520            http_method: hyper::Method::POST,
9521        });
9522
9523        for &field in ["alt", "name"].iter() {
9524            if self._additional_params.contains_key(field) {
9525                dlg.finished(false);
9526                return Err(common::Error::FieldClash(field));
9527            }
9528        }
9529
9530        let mut params = Params::with_capacity(4 + self._additional_params.len());
9531        params.push("name", self._name);
9532
9533        params.extend(self._additional_params.iter());
9534
9535        params.push("alt", "json");
9536        let mut url = self.hub._base_url.clone() + "v1beta1/{+name}:resumeReplica";
9537        if self._scopes.is_empty() {
9538            self._scopes
9539                .insert(Scope::CloudPlatform.as_ref().to_string());
9540        }
9541
9542        #[allow(clippy::single_element_loop)]
9543        for &(find_this, param_name) in [("{+name}", "name")].iter() {
9544            url = params.uri_replacement(url, param_name, find_this, true);
9545        }
9546        {
9547            let to_remove = ["name"];
9548            params.remove_params(&to_remove);
9549        }
9550
9551        let url = params.parse_with_url(&url);
9552
9553        let mut json_mime_type = mime::APPLICATION_JSON;
9554        let mut request_value_reader = {
9555            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
9556            common::remove_json_null_values(&mut value);
9557            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
9558            serde_json::to_writer(&mut dst, &value).unwrap();
9559            dst
9560        };
9561        let request_size = request_value_reader
9562            .seek(std::io::SeekFrom::End(0))
9563            .unwrap();
9564        request_value_reader
9565            .seek(std::io::SeekFrom::Start(0))
9566            .unwrap();
9567
9568        loop {
9569            let token = match self
9570                .hub
9571                .auth
9572                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
9573                .await
9574            {
9575                Ok(token) => token,
9576                Err(e) => match dlg.token(e) {
9577                    Ok(token) => token,
9578                    Err(e) => {
9579                        dlg.finished(false);
9580                        return Err(common::Error::MissingToken(e));
9581                    }
9582                },
9583            };
9584            request_value_reader
9585                .seek(std::io::SeekFrom::Start(0))
9586                .unwrap();
9587            let mut req_result = {
9588                let client = &self.hub.client;
9589                dlg.pre_request();
9590                let mut req_builder = hyper::Request::builder()
9591                    .method(hyper::Method::POST)
9592                    .uri(url.as_str())
9593                    .header(USER_AGENT, self.hub._user_agent.clone());
9594
9595                if let Some(token) = token.as_ref() {
9596                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
9597                }
9598
9599                let request = req_builder
9600                    .header(CONTENT_TYPE, json_mime_type.to_string())
9601                    .header(CONTENT_LENGTH, request_size as u64)
9602                    .body(common::to_body(
9603                        request_value_reader.get_ref().clone().into(),
9604                    ));
9605
9606                client.request(request.unwrap()).await
9607            };
9608
9609            match req_result {
9610                Err(err) => {
9611                    if let common::Retry::After(d) = dlg.http_error(&err) {
9612                        sleep(d).await;
9613                        continue;
9614                    }
9615                    dlg.finished(false);
9616                    return Err(common::Error::HttpError(err));
9617                }
9618                Ok(res) => {
9619                    let (mut parts, body) = res.into_parts();
9620                    let mut body = common::Body::new(body);
9621                    if !parts.status.is_success() {
9622                        let bytes = common::to_bytes(body).await.unwrap_or_default();
9623                        let error = serde_json::from_str(&common::to_string(&bytes));
9624                        let response = common::to_response(parts, bytes.into());
9625
9626                        if let common::Retry::After(d) =
9627                            dlg.http_failure(&response, error.as_ref().ok())
9628                        {
9629                            sleep(d).await;
9630                            continue;
9631                        }
9632
9633                        dlg.finished(false);
9634
9635                        return Err(match error {
9636                            Ok(value) => common::Error::BadRequest(value),
9637                            _ => common::Error::Failure(response),
9638                        });
9639                    }
9640                    let response = {
9641                        let bytes = common::to_bytes(body).await.unwrap_or_default();
9642                        let encoded = common::to_string(&bytes);
9643                        match serde_json::from_str(&encoded) {
9644                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
9645                            Err(error) => {
9646                                dlg.response_json_decode_error(&encoded, &error);
9647                                return Err(common::Error::JsonDecodeError(
9648                                    encoded.to_string(),
9649                                    error,
9650                                ));
9651                            }
9652                        }
9653                    };
9654
9655                    dlg.finished(true);
9656                    return Ok(response);
9657                }
9658            }
9659        }
9660    }
9661
9662    ///
9663    /// Sets the *request* property to the given value.
9664    ///
9665    /// Even though the property as already been set when instantiating this call,
9666    /// we provide this method for API completeness.
9667    pub fn request(
9668        mut self,
9669        new_value: ResumeReplicaRequest,
9670    ) -> ProjectLocationInstanceResumeReplicaCall<'a, C> {
9671        self._request = new_value;
9672        self
9673    }
9674    /// Required. The resource name of the instance, in the format `projects/{project_id}/locations/{location_id}/instances/{instance_id}`.
9675    ///
9676    /// Sets the *name* path property to the given value.
9677    ///
9678    /// Even though the property as already been set when instantiating this call,
9679    /// we provide this method for API completeness.
9680    pub fn name(mut self, new_value: &str) -> ProjectLocationInstanceResumeReplicaCall<'a, C> {
9681        self._name = new_value.to_string();
9682        self
9683    }
9684    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
9685    /// while executing the actual API request.
9686    ///
9687    /// ````text
9688    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
9689    /// ````
9690    ///
9691    /// Sets the *delegate* property to the given value.
9692    pub fn delegate(
9693        mut self,
9694        new_value: &'a mut dyn common::Delegate,
9695    ) -> ProjectLocationInstanceResumeReplicaCall<'a, C> {
9696        self._delegate = Some(new_value);
9697        self
9698    }
9699
9700    /// Set any additional parameter of the query string used in the request.
9701    /// It should be used to set parameters which are not yet available through their own
9702    /// setters.
9703    ///
9704    /// Please note that this method must not be used to set any of the known parameters
9705    /// which have their own setter method. If done anyway, the request will fail.
9706    ///
9707    /// # Additional Parameters
9708    ///
9709    /// * *$.xgafv* (query-string) - V1 error format.
9710    /// * *access_token* (query-string) - OAuth access token.
9711    /// * *alt* (query-string) - Data format for response.
9712    /// * *callback* (query-string) - JSONP
9713    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
9714    /// * *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.
9715    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
9716    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
9717    /// * *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.
9718    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
9719    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
9720    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationInstanceResumeReplicaCall<'a, C>
9721    where
9722        T: AsRef<str>,
9723    {
9724        self._additional_params
9725            .insert(name.as_ref().to_string(), value.as_ref().to_string());
9726        self
9727    }
9728
9729    /// Identifies the authorization scope for the method you are building.
9730    ///
9731    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
9732    /// [`Scope::CloudPlatform`].
9733    ///
9734    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
9735    /// tokens for more than one scope.
9736    ///
9737    /// Usually there is more than one suitable scope to authorize an operation, some of which may
9738    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
9739    /// sufficient, a read-write scope will do as well.
9740    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationInstanceResumeReplicaCall<'a, C>
9741    where
9742        St: AsRef<str>,
9743    {
9744        self._scopes.insert(String::from(scope.as_ref()));
9745        self
9746    }
9747    /// Identifies the authorization scope(s) for the method you are building.
9748    ///
9749    /// See [`Self::add_scope()`] for details.
9750    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationInstanceResumeReplicaCall<'a, C>
9751    where
9752        I: IntoIterator<Item = St>,
9753        St: AsRef<str>,
9754    {
9755        self._scopes
9756            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
9757        self
9758    }
9759
9760    /// Removes all scopes, and no default scope will be used either.
9761    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
9762    /// for details).
9763    pub fn clear_scopes(mut self) -> ProjectLocationInstanceResumeReplicaCall<'a, C> {
9764        self._scopes.clear();
9765        self
9766    }
9767}
9768
9769/// Revert an existing instance's file system to a specified snapshot.
9770///
9771/// A builder for the *locations.instances.revert* method supported by a *project* resource.
9772/// It is not used directly, but through a [`ProjectMethods`] instance.
9773///
9774/// # Example
9775///
9776/// Instantiate a resource method builder
9777///
9778/// ```test_harness,no_run
9779/// # extern crate hyper;
9780/// # extern crate hyper_rustls;
9781/// # extern crate google_file1_beta1 as file1_beta1;
9782/// use file1_beta1::api::RevertInstanceRequest;
9783/// # async fn dox() {
9784/// # use file1_beta1::{CloudFilestore, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9785///
9786/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
9787/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
9788/// #     .with_native_roots()
9789/// #     .unwrap()
9790/// #     .https_only()
9791/// #     .enable_http2()
9792/// #     .build();
9793///
9794/// # let executor = hyper_util::rt::TokioExecutor::new();
9795/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
9796/// #     secret,
9797/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9798/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
9799/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
9800/// #     ),
9801/// # ).build().await.unwrap();
9802///
9803/// # let client = hyper_util::client::legacy::Client::builder(
9804/// #     hyper_util::rt::TokioExecutor::new()
9805/// # )
9806/// # .build(
9807/// #     hyper_rustls::HttpsConnectorBuilder::new()
9808/// #         .with_native_roots()
9809/// #         .unwrap()
9810/// #         .https_or_http()
9811/// #         .enable_http2()
9812/// #         .build()
9813/// # );
9814/// # let mut hub = CloudFilestore::new(client, auth);
9815/// // As the method needs a request, you would usually fill it with the desired information
9816/// // into the respective structure. Some of the parts shown here might not be applicable !
9817/// // Values shown here are possibly random and not representative !
9818/// let mut req = RevertInstanceRequest::default();
9819///
9820/// // You can configure optional parameters by calling the respective setters at will, and
9821/// // execute the final call using `doit()`.
9822/// // Values shown here are possibly random and not representative !
9823/// let result = hub.projects().locations_instances_revert(req, "name")
9824///              .doit().await;
9825/// # }
9826/// ```
9827pub struct ProjectLocationInstanceRevertCall<'a, C>
9828where
9829    C: 'a,
9830{
9831    hub: &'a CloudFilestore<C>,
9832    _request: RevertInstanceRequest,
9833    _name: String,
9834    _delegate: Option<&'a mut dyn common::Delegate>,
9835    _additional_params: HashMap<String, String>,
9836    _scopes: BTreeSet<String>,
9837}
9838
9839impl<'a, C> common::CallBuilder for ProjectLocationInstanceRevertCall<'a, C> {}
9840
9841impl<'a, C> ProjectLocationInstanceRevertCall<'a, C>
9842where
9843    C: common::Connector,
9844{
9845    /// Perform the operation you have build so far.
9846    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
9847        use std::borrow::Cow;
9848        use std::io::{Read, Seek};
9849
9850        use common::{url::Params, ToParts};
9851        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
9852
9853        let mut dd = common::DefaultDelegate;
9854        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
9855        dlg.begin(common::MethodInfo {
9856            id: "file.projects.locations.instances.revert",
9857            http_method: hyper::Method::POST,
9858        });
9859
9860        for &field in ["alt", "name"].iter() {
9861            if self._additional_params.contains_key(field) {
9862                dlg.finished(false);
9863                return Err(common::Error::FieldClash(field));
9864            }
9865        }
9866
9867        let mut params = Params::with_capacity(4 + self._additional_params.len());
9868        params.push("name", self._name);
9869
9870        params.extend(self._additional_params.iter());
9871
9872        params.push("alt", "json");
9873        let mut url = self.hub._base_url.clone() + "v1beta1/{+name}:revert";
9874        if self._scopes.is_empty() {
9875            self._scopes
9876                .insert(Scope::CloudPlatform.as_ref().to_string());
9877        }
9878
9879        #[allow(clippy::single_element_loop)]
9880        for &(find_this, param_name) in [("{+name}", "name")].iter() {
9881            url = params.uri_replacement(url, param_name, find_this, true);
9882        }
9883        {
9884            let to_remove = ["name"];
9885            params.remove_params(&to_remove);
9886        }
9887
9888        let url = params.parse_with_url(&url);
9889
9890        let mut json_mime_type = mime::APPLICATION_JSON;
9891        let mut request_value_reader = {
9892            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
9893            common::remove_json_null_values(&mut value);
9894            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
9895            serde_json::to_writer(&mut dst, &value).unwrap();
9896            dst
9897        };
9898        let request_size = request_value_reader
9899            .seek(std::io::SeekFrom::End(0))
9900            .unwrap();
9901        request_value_reader
9902            .seek(std::io::SeekFrom::Start(0))
9903            .unwrap();
9904
9905        loop {
9906            let token = match self
9907                .hub
9908                .auth
9909                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
9910                .await
9911            {
9912                Ok(token) => token,
9913                Err(e) => match dlg.token(e) {
9914                    Ok(token) => token,
9915                    Err(e) => {
9916                        dlg.finished(false);
9917                        return Err(common::Error::MissingToken(e));
9918                    }
9919                },
9920            };
9921            request_value_reader
9922                .seek(std::io::SeekFrom::Start(0))
9923                .unwrap();
9924            let mut req_result = {
9925                let client = &self.hub.client;
9926                dlg.pre_request();
9927                let mut req_builder = hyper::Request::builder()
9928                    .method(hyper::Method::POST)
9929                    .uri(url.as_str())
9930                    .header(USER_AGENT, self.hub._user_agent.clone());
9931
9932                if let Some(token) = token.as_ref() {
9933                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
9934                }
9935
9936                let request = req_builder
9937                    .header(CONTENT_TYPE, json_mime_type.to_string())
9938                    .header(CONTENT_LENGTH, request_size as u64)
9939                    .body(common::to_body(
9940                        request_value_reader.get_ref().clone().into(),
9941                    ));
9942
9943                client.request(request.unwrap()).await
9944            };
9945
9946            match req_result {
9947                Err(err) => {
9948                    if let common::Retry::After(d) = dlg.http_error(&err) {
9949                        sleep(d).await;
9950                        continue;
9951                    }
9952                    dlg.finished(false);
9953                    return Err(common::Error::HttpError(err));
9954                }
9955                Ok(res) => {
9956                    let (mut parts, body) = res.into_parts();
9957                    let mut body = common::Body::new(body);
9958                    if !parts.status.is_success() {
9959                        let bytes = common::to_bytes(body).await.unwrap_or_default();
9960                        let error = serde_json::from_str(&common::to_string(&bytes));
9961                        let response = common::to_response(parts, bytes.into());
9962
9963                        if let common::Retry::After(d) =
9964                            dlg.http_failure(&response, error.as_ref().ok())
9965                        {
9966                            sleep(d).await;
9967                            continue;
9968                        }
9969
9970                        dlg.finished(false);
9971
9972                        return Err(match error {
9973                            Ok(value) => common::Error::BadRequest(value),
9974                            _ => common::Error::Failure(response),
9975                        });
9976                    }
9977                    let response = {
9978                        let bytes = common::to_bytes(body).await.unwrap_or_default();
9979                        let encoded = common::to_string(&bytes);
9980                        match serde_json::from_str(&encoded) {
9981                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
9982                            Err(error) => {
9983                                dlg.response_json_decode_error(&encoded, &error);
9984                                return Err(common::Error::JsonDecodeError(
9985                                    encoded.to_string(),
9986                                    error,
9987                                ));
9988                            }
9989                        }
9990                    };
9991
9992                    dlg.finished(true);
9993                    return Ok(response);
9994                }
9995            }
9996        }
9997    }
9998
9999    ///
10000    /// Sets the *request* property to the given value.
10001    ///
10002    /// Even though the property as already been set when instantiating this call,
10003    /// we provide this method for API completeness.
10004    pub fn request(
10005        mut self,
10006        new_value: RevertInstanceRequest,
10007    ) -> ProjectLocationInstanceRevertCall<'a, C> {
10008        self._request = new_value;
10009        self
10010    }
10011    /// Required. The resource name of the instance, in the format `projects/{project_id}/locations/{location_id}/instances/{instance_id}`.
10012    ///
10013    /// Sets the *name* path property to the given value.
10014    ///
10015    /// Even though the property as already been set when instantiating this call,
10016    /// we provide this method for API completeness.
10017    pub fn name(mut self, new_value: &str) -> ProjectLocationInstanceRevertCall<'a, C> {
10018        self._name = new_value.to_string();
10019        self
10020    }
10021    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
10022    /// while executing the actual API request.
10023    ///
10024    /// ````text
10025    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
10026    /// ````
10027    ///
10028    /// Sets the *delegate* property to the given value.
10029    pub fn delegate(
10030        mut self,
10031        new_value: &'a mut dyn common::Delegate,
10032    ) -> ProjectLocationInstanceRevertCall<'a, C> {
10033        self._delegate = Some(new_value);
10034        self
10035    }
10036
10037    /// Set any additional parameter of the query string used in the request.
10038    /// It should be used to set parameters which are not yet available through their own
10039    /// setters.
10040    ///
10041    /// Please note that this method must not be used to set any of the known parameters
10042    /// which have their own setter method. If done anyway, the request will fail.
10043    ///
10044    /// # Additional Parameters
10045    ///
10046    /// * *$.xgafv* (query-string) - V1 error format.
10047    /// * *access_token* (query-string) - OAuth access token.
10048    /// * *alt* (query-string) - Data format for response.
10049    /// * *callback* (query-string) - JSONP
10050    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
10051    /// * *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.
10052    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
10053    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
10054    /// * *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.
10055    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
10056    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
10057    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationInstanceRevertCall<'a, C>
10058    where
10059        T: AsRef<str>,
10060    {
10061        self._additional_params
10062            .insert(name.as_ref().to_string(), value.as_ref().to_string());
10063        self
10064    }
10065
10066    /// Identifies the authorization scope for the method you are building.
10067    ///
10068    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
10069    /// [`Scope::CloudPlatform`].
10070    ///
10071    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
10072    /// tokens for more than one scope.
10073    ///
10074    /// Usually there is more than one suitable scope to authorize an operation, some of which may
10075    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
10076    /// sufficient, a read-write scope will do as well.
10077    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationInstanceRevertCall<'a, C>
10078    where
10079        St: AsRef<str>,
10080    {
10081        self._scopes.insert(String::from(scope.as_ref()));
10082        self
10083    }
10084    /// Identifies the authorization scope(s) for the method you are building.
10085    ///
10086    /// See [`Self::add_scope()`] for details.
10087    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationInstanceRevertCall<'a, C>
10088    where
10089        I: IntoIterator<Item = St>,
10090        St: AsRef<str>,
10091    {
10092        self._scopes
10093            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
10094        self
10095    }
10096
10097    /// Removes all scopes, and no default scope will be used either.
10098    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
10099    /// for details).
10100    pub fn clear_scopes(mut self) -> ProjectLocationInstanceRevertCall<'a, C> {
10101        self._scopes.clear();
10102        self
10103    }
10104}
10105
10106/// 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`.
10107///
10108/// A builder for the *locations.operations.cancel* method supported by a *project* resource.
10109/// It is not used directly, but through a [`ProjectMethods`] instance.
10110///
10111/// # Example
10112///
10113/// Instantiate a resource method builder
10114///
10115/// ```test_harness,no_run
10116/// # extern crate hyper;
10117/// # extern crate hyper_rustls;
10118/// # extern crate google_file1_beta1 as file1_beta1;
10119/// use file1_beta1::api::CancelOperationRequest;
10120/// # async fn dox() {
10121/// # use file1_beta1::{CloudFilestore, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
10122///
10123/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
10124/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
10125/// #     .with_native_roots()
10126/// #     .unwrap()
10127/// #     .https_only()
10128/// #     .enable_http2()
10129/// #     .build();
10130///
10131/// # let executor = hyper_util::rt::TokioExecutor::new();
10132/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
10133/// #     secret,
10134/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
10135/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
10136/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
10137/// #     ),
10138/// # ).build().await.unwrap();
10139///
10140/// # let client = hyper_util::client::legacy::Client::builder(
10141/// #     hyper_util::rt::TokioExecutor::new()
10142/// # )
10143/// # .build(
10144/// #     hyper_rustls::HttpsConnectorBuilder::new()
10145/// #         .with_native_roots()
10146/// #         .unwrap()
10147/// #         .https_or_http()
10148/// #         .enable_http2()
10149/// #         .build()
10150/// # );
10151/// # let mut hub = CloudFilestore::new(client, auth);
10152/// // As the method needs a request, you would usually fill it with the desired information
10153/// // into the respective structure. Some of the parts shown here might not be applicable !
10154/// // Values shown here are possibly random and not representative !
10155/// let mut req = CancelOperationRequest::default();
10156///
10157/// // You can configure optional parameters by calling the respective setters at will, and
10158/// // execute the final call using `doit()`.
10159/// // Values shown here are possibly random and not representative !
10160/// let result = hub.projects().locations_operations_cancel(req, "name")
10161///              .doit().await;
10162/// # }
10163/// ```
10164pub struct ProjectLocationOperationCancelCall<'a, C>
10165where
10166    C: 'a,
10167{
10168    hub: &'a CloudFilestore<C>,
10169    _request: CancelOperationRequest,
10170    _name: String,
10171    _delegate: Option<&'a mut dyn common::Delegate>,
10172    _additional_params: HashMap<String, String>,
10173    _scopes: BTreeSet<String>,
10174}
10175
10176impl<'a, C> common::CallBuilder for ProjectLocationOperationCancelCall<'a, C> {}
10177
10178impl<'a, C> ProjectLocationOperationCancelCall<'a, C>
10179where
10180    C: common::Connector,
10181{
10182    /// Perform the operation you have build so far.
10183    pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
10184        use std::borrow::Cow;
10185        use std::io::{Read, Seek};
10186
10187        use common::{url::Params, ToParts};
10188        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
10189
10190        let mut dd = common::DefaultDelegate;
10191        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
10192        dlg.begin(common::MethodInfo {
10193            id: "file.projects.locations.operations.cancel",
10194            http_method: hyper::Method::POST,
10195        });
10196
10197        for &field in ["alt", "name"].iter() {
10198            if self._additional_params.contains_key(field) {
10199                dlg.finished(false);
10200                return Err(common::Error::FieldClash(field));
10201            }
10202        }
10203
10204        let mut params = Params::with_capacity(4 + self._additional_params.len());
10205        params.push("name", self._name);
10206
10207        params.extend(self._additional_params.iter());
10208
10209        params.push("alt", "json");
10210        let mut url = self.hub._base_url.clone() + "v1beta1/{+name}:cancel";
10211        if self._scopes.is_empty() {
10212            self._scopes
10213                .insert(Scope::CloudPlatform.as_ref().to_string());
10214        }
10215
10216        #[allow(clippy::single_element_loop)]
10217        for &(find_this, param_name) in [("{+name}", "name")].iter() {
10218            url = params.uri_replacement(url, param_name, find_this, true);
10219        }
10220        {
10221            let to_remove = ["name"];
10222            params.remove_params(&to_remove);
10223        }
10224
10225        let url = params.parse_with_url(&url);
10226
10227        let mut json_mime_type = mime::APPLICATION_JSON;
10228        let mut request_value_reader = {
10229            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
10230            common::remove_json_null_values(&mut value);
10231            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
10232            serde_json::to_writer(&mut dst, &value).unwrap();
10233            dst
10234        };
10235        let request_size = request_value_reader
10236            .seek(std::io::SeekFrom::End(0))
10237            .unwrap();
10238        request_value_reader
10239            .seek(std::io::SeekFrom::Start(0))
10240            .unwrap();
10241
10242        loop {
10243            let token = match self
10244                .hub
10245                .auth
10246                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
10247                .await
10248            {
10249                Ok(token) => token,
10250                Err(e) => match dlg.token(e) {
10251                    Ok(token) => token,
10252                    Err(e) => {
10253                        dlg.finished(false);
10254                        return Err(common::Error::MissingToken(e));
10255                    }
10256                },
10257            };
10258            request_value_reader
10259                .seek(std::io::SeekFrom::Start(0))
10260                .unwrap();
10261            let mut req_result = {
10262                let client = &self.hub.client;
10263                dlg.pre_request();
10264                let mut req_builder = hyper::Request::builder()
10265                    .method(hyper::Method::POST)
10266                    .uri(url.as_str())
10267                    .header(USER_AGENT, self.hub._user_agent.clone());
10268
10269                if let Some(token) = token.as_ref() {
10270                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
10271                }
10272
10273                let request = req_builder
10274                    .header(CONTENT_TYPE, json_mime_type.to_string())
10275                    .header(CONTENT_LENGTH, request_size as u64)
10276                    .body(common::to_body(
10277                        request_value_reader.get_ref().clone().into(),
10278                    ));
10279
10280                client.request(request.unwrap()).await
10281            };
10282
10283            match req_result {
10284                Err(err) => {
10285                    if let common::Retry::After(d) = dlg.http_error(&err) {
10286                        sleep(d).await;
10287                        continue;
10288                    }
10289                    dlg.finished(false);
10290                    return Err(common::Error::HttpError(err));
10291                }
10292                Ok(res) => {
10293                    let (mut parts, body) = res.into_parts();
10294                    let mut body = common::Body::new(body);
10295                    if !parts.status.is_success() {
10296                        let bytes = common::to_bytes(body).await.unwrap_or_default();
10297                        let error = serde_json::from_str(&common::to_string(&bytes));
10298                        let response = common::to_response(parts, bytes.into());
10299
10300                        if let common::Retry::After(d) =
10301                            dlg.http_failure(&response, error.as_ref().ok())
10302                        {
10303                            sleep(d).await;
10304                            continue;
10305                        }
10306
10307                        dlg.finished(false);
10308
10309                        return Err(match error {
10310                            Ok(value) => common::Error::BadRequest(value),
10311                            _ => common::Error::Failure(response),
10312                        });
10313                    }
10314                    let response = {
10315                        let bytes = common::to_bytes(body).await.unwrap_or_default();
10316                        let encoded = common::to_string(&bytes);
10317                        match serde_json::from_str(&encoded) {
10318                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
10319                            Err(error) => {
10320                                dlg.response_json_decode_error(&encoded, &error);
10321                                return Err(common::Error::JsonDecodeError(
10322                                    encoded.to_string(),
10323                                    error,
10324                                ));
10325                            }
10326                        }
10327                    };
10328
10329                    dlg.finished(true);
10330                    return Ok(response);
10331                }
10332            }
10333        }
10334    }
10335
10336    ///
10337    /// Sets the *request* property to the given value.
10338    ///
10339    /// Even though the property as already been set when instantiating this call,
10340    /// we provide this method for API completeness.
10341    pub fn request(
10342        mut self,
10343        new_value: CancelOperationRequest,
10344    ) -> ProjectLocationOperationCancelCall<'a, C> {
10345        self._request = new_value;
10346        self
10347    }
10348    /// The name of the operation resource to be cancelled.
10349    ///
10350    /// Sets the *name* path property to the given value.
10351    ///
10352    /// Even though the property as already been set when instantiating this call,
10353    /// we provide this method for API completeness.
10354    pub fn name(mut self, new_value: &str) -> ProjectLocationOperationCancelCall<'a, C> {
10355        self._name = new_value.to_string();
10356        self
10357    }
10358    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
10359    /// while executing the actual API request.
10360    ///
10361    /// ````text
10362    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
10363    /// ````
10364    ///
10365    /// Sets the *delegate* property to the given value.
10366    pub fn delegate(
10367        mut self,
10368        new_value: &'a mut dyn common::Delegate,
10369    ) -> ProjectLocationOperationCancelCall<'a, C> {
10370        self._delegate = Some(new_value);
10371        self
10372    }
10373
10374    /// Set any additional parameter of the query string used in the request.
10375    /// It should be used to set parameters which are not yet available through their own
10376    /// setters.
10377    ///
10378    /// Please note that this method must not be used to set any of the known parameters
10379    /// which have their own setter method. If done anyway, the request will fail.
10380    ///
10381    /// # Additional Parameters
10382    ///
10383    /// * *$.xgafv* (query-string) - V1 error format.
10384    /// * *access_token* (query-string) - OAuth access token.
10385    /// * *alt* (query-string) - Data format for response.
10386    /// * *callback* (query-string) - JSONP
10387    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
10388    /// * *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.
10389    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
10390    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
10391    /// * *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.
10392    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
10393    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
10394    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationOperationCancelCall<'a, C>
10395    where
10396        T: AsRef<str>,
10397    {
10398        self._additional_params
10399            .insert(name.as_ref().to_string(), value.as_ref().to_string());
10400        self
10401    }
10402
10403    /// Identifies the authorization scope for the method you are building.
10404    ///
10405    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
10406    /// [`Scope::CloudPlatform`].
10407    ///
10408    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
10409    /// tokens for more than one scope.
10410    ///
10411    /// Usually there is more than one suitable scope to authorize an operation, some of which may
10412    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
10413    /// sufficient, a read-write scope will do as well.
10414    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationOperationCancelCall<'a, C>
10415    where
10416        St: AsRef<str>,
10417    {
10418        self._scopes.insert(String::from(scope.as_ref()));
10419        self
10420    }
10421    /// Identifies the authorization scope(s) for the method you are building.
10422    ///
10423    /// See [`Self::add_scope()`] for details.
10424    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationOperationCancelCall<'a, C>
10425    where
10426        I: IntoIterator<Item = St>,
10427        St: AsRef<str>,
10428    {
10429        self._scopes
10430            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
10431        self
10432    }
10433
10434    /// Removes all scopes, and no default scope will be used either.
10435    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
10436    /// for details).
10437    pub fn clear_scopes(mut self) -> ProjectLocationOperationCancelCall<'a, C> {
10438        self._scopes.clear();
10439        self
10440    }
10441}
10442
10443/// 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`.
10444///
10445/// A builder for the *locations.operations.delete* method supported by a *project* resource.
10446/// It is not used directly, but through a [`ProjectMethods`] instance.
10447///
10448/// # Example
10449///
10450/// Instantiate a resource method builder
10451///
10452/// ```test_harness,no_run
10453/// # extern crate hyper;
10454/// # extern crate hyper_rustls;
10455/// # extern crate google_file1_beta1 as file1_beta1;
10456/// # async fn dox() {
10457/// # use file1_beta1::{CloudFilestore, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
10458///
10459/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
10460/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
10461/// #     .with_native_roots()
10462/// #     .unwrap()
10463/// #     .https_only()
10464/// #     .enable_http2()
10465/// #     .build();
10466///
10467/// # let executor = hyper_util::rt::TokioExecutor::new();
10468/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
10469/// #     secret,
10470/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
10471/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
10472/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
10473/// #     ),
10474/// # ).build().await.unwrap();
10475///
10476/// # let client = hyper_util::client::legacy::Client::builder(
10477/// #     hyper_util::rt::TokioExecutor::new()
10478/// # )
10479/// # .build(
10480/// #     hyper_rustls::HttpsConnectorBuilder::new()
10481/// #         .with_native_roots()
10482/// #         .unwrap()
10483/// #         .https_or_http()
10484/// #         .enable_http2()
10485/// #         .build()
10486/// # );
10487/// # let mut hub = CloudFilestore::new(client, auth);
10488/// // You can configure optional parameters by calling the respective setters at will, and
10489/// // execute the final call using `doit()`.
10490/// // Values shown here are possibly random and not representative !
10491/// let result = hub.projects().locations_operations_delete("name")
10492///              .doit().await;
10493/// # }
10494/// ```
10495pub struct ProjectLocationOperationDeleteCall<'a, C>
10496where
10497    C: 'a,
10498{
10499    hub: &'a CloudFilestore<C>,
10500    _name: String,
10501    _delegate: Option<&'a mut dyn common::Delegate>,
10502    _additional_params: HashMap<String, String>,
10503    _scopes: BTreeSet<String>,
10504}
10505
10506impl<'a, C> common::CallBuilder for ProjectLocationOperationDeleteCall<'a, C> {}
10507
10508impl<'a, C> ProjectLocationOperationDeleteCall<'a, C>
10509where
10510    C: common::Connector,
10511{
10512    /// Perform the operation you have build so far.
10513    pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
10514        use std::borrow::Cow;
10515        use std::io::{Read, Seek};
10516
10517        use common::{url::Params, ToParts};
10518        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
10519
10520        let mut dd = common::DefaultDelegate;
10521        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
10522        dlg.begin(common::MethodInfo {
10523            id: "file.projects.locations.operations.delete",
10524            http_method: hyper::Method::DELETE,
10525        });
10526
10527        for &field in ["alt", "name"].iter() {
10528            if self._additional_params.contains_key(field) {
10529                dlg.finished(false);
10530                return Err(common::Error::FieldClash(field));
10531            }
10532        }
10533
10534        let mut params = Params::with_capacity(3 + self._additional_params.len());
10535        params.push("name", self._name);
10536
10537        params.extend(self._additional_params.iter());
10538
10539        params.push("alt", "json");
10540        let mut url = self.hub._base_url.clone() + "v1beta1/{+name}";
10541        if self._scopes.is_empty() {
10542            self._scopes
10543                .insert(Scope::CloudPlatform.as_ref().to_string());
10544        }
10545
10546        #[allow(clippy::single_element_loop)]
10547        for &(find_this, param_name) in [("{+name}", "name")].iter() {
10548            url = params.uri_replacement(url, param_name, find_this, true);
10549        }
10550        {
10551            let to_remove = ["name"];
10552            params.remove_params(&to_remove);
10553        }
10554
10555        let url = params.parse_with_url(&url);
10556
10557        loop {
10558            let token = match self
10559                .hub
10560                .auth
10561                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
10562                .await
10563            {
10564                Ok(token) => token,
10565                Err(e) => match dlg.token(e) {
10566                    Ok(token) => token,
10567                    Err(e) => {
10568                        dlg.finished(false);
10569                        return Err(common::Error::MissingToken(e));
10570                    }
10571                },
10572            };
10573            let mut req_result = {
10574                let client = &self.hub.client;
10575                dlg.pre_request();
10576                let mut req_builder = hyper::Request::builder()
10577                    .method(hyper::Method::DELETE)
10578                    .uri(url.as_str())
10579                    .header(USER_AGENT, self.hub._user_agent.clone());
10580
10581                if let Some(token) = token.as_ref() {
10582                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
10583                }
10584
10585                let request = req_builder
10586                    .header(CONTENT_LENGTH, 0_u64)
10587                    .body(common::to_body::<String>(None));
10588
10589                client.request(request.unwrap()).await
10590            };
10591
10592            match req_result {
10593                Err(err) => {
10594                    if let common::Retry::After(d) = dlg.http_error(&err) {
10595                        sleep(d).await;
10596                        continue;
10597                    }
10598                    dlg.finished(false);
10599                    return Err(common::Error::HttpError(err));
10600                }
10601                Ok(res) => {
10602                    let (mut parts, body) = res.into_parts();
10603                    let mut body = common::Body::new(body);
10604                    if !parts.status.is_success() {
10605                        let bytes = common::to_bytes(body).await.unwrap_or_default();
10606                        let error = serde_json::from_str(&common::to_string(&bytes));
10607                        let response = common::to_response(parts, bytes.into());
10608
10609                        if let common::Retry::After(d) =
10610                            dlg.http_failure(&response, error.as_ref().ok())
10611                        {
10612                            sleep(d).await;
10613                            continue;
10614                        }
10615
10616                        dlg.finished(false);
10617
10618                        return Err(match error {
10619                            Ok(value) => common::Error::BadRequest(value),
10620                            _ => common::Error::Failure(response),
10621                        });
10622                    }
10623                    let response = {
10624                        let bytes = common::to_bytes(body).await.unwrap_or_default();
10625                        let encoded = common::to_string(&bytes);
10626                        match serde_json::from_str(&encoded) {
10627                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
10628                            Err(error) => {
10629                                dlg.response_json_decode_error(&encoded, &error);
10630                                return Err(common::Error::JsonDecodeError(
10631                                    encoded.to_string(),
10632                                    error,
10633                                ));
10634                            }
10635                        }
10636                    };
10637
10638                    dlg.finished(true);
10639                    return Ok(response);
10640                }
10641            }
10642        }
10643    }
10644
10645    /// The name of the operation resource to be deleted.
10646    ///
10647    /// Sets the *name* path property to the given value.
10648    ///
10649    /// Even though the property as already been set when instantiating this call,
10650    /// we provide this method for API completeness.
10651    pub fn name(mut self, new_value: &str) -> ProjectLocationOperationDeleteCall<'a, C> {
10652        self._name = new_value.to_string();
10653        self
10654    }
10655    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
10656    /// while executing the actual API request.
10657    ///
10658    /// ````text
10659    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
10660    /// ````
10661    ///
10662    /// Sets the *delegate* property to the given value.
10663    pub fn delegate(
10664        mut self,
10665        new_value: &'a mut dyn common::Delegate,
10666    ) -> ProjectLocationOperationDeleteCall<'a, C> {
10667        self._delegate = Some(new_value);
10668        self
10669    }
10670
10671    /// Set any additional parameter of the query string used in the request.
10672    /// It should be used to set parameters which are not yet available through their own
10673    /// setters.
10674    ///
10675    /// Please note that this method must not be used to set any of the known parameters
10676    /// which have their own setter method. If done anyway, the request will fail.
10677    ///
10678    /// # Additional Parameters
10679    ///
10680    /// * *$.xgafv* (query-string) - V1 error format.
10681    /// * *access_token* (query-string) - OAuth access token.
10682    /// * *alt* (query-string) - Data format for response.
10683    /// * *callback* (query-string) - JSONP
10684    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
10685    /// * *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.
10686    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
10687    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
10688    /// * *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.
10689    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
10690    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
10691    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationOperationDeleteCall<'a, C>
10692    where
10693        T: AsRef<str>,
10694    {
10695        self._additional_params
10696            .insert(name.as_ref().to_string(), value.as_ref().to_string());
10697        self
10698    }
10699
10700    /// Identifies the authorization scope for the method you are building.
10701    ///
10702    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
10703    /// [`Scope::CloudPlatform`].
10704    ///
10705    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
10706    /// tokens for more than one scope.
10707    ///
10708    /// Usually there is more than one suitable scope to authorize an operation, some of which may
10709    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
10710    /// sufficient, a read-write scope will do as well.
10711    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationOperationDeleteCall<'a, C>
10712    where
10713        St: AsRef<str>,
10714    {
10715        self._scopes.insert(String::from(scope.as_ref()));
10716        self
10717    }
10718    /// Identifies the authorization scope(s) for the method you are building.
10719    ///
10720    /// See [`Self::add_scope()`] for details.
10721    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationOperationDeleteCall<'a, C>
10722    where
10723        I: IntoIterator<Item = St>,
10724        St: AsRef<str>,
10725    {
10726        self._scopes
10727            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
10728        self
10729    }
10730
10731    /// Removes all scopes, and no default scope will be used either.
10732    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
10733    /// for details).
10734    pub fn clear_scopes(mut self) -> ProjectLocationOperationDeleteCall<'a, C> {
10735        self._scopes.clear();
10736        self
10737    }
10738}
10739
10740/// 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.
10741///
10742/// A builder for the *locations.operations.get* method supported by a *project* resource.
10743/// It is not used directly, but through a [`ProjectMethods`] instance.
10744///
10745/// # Example
10746///
10747/// Instantiate a resource method builder
10748///
10749/// ```test_harness,no_run
10750/// # extern crate hyper;
10751/// # extern crate hyper_rustls;
10752/// # extern crate google_file1_beta1 as file1_beta1;
10753/// # async fn dox() {
10754/// # use file1_beta1::{CloudFilestore, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
10755///
10756/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
10757/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
10758/// #     .with_native_roots()
10759/// #     .unwrap()
10760/// #     .https_only()
10761/// #     .enable_http2()
10762/// #     .build();
10763///
10764/// # let executor = hyper_util::rt::TokioExecutor::new();
10765/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
10766/// #     secret,
10767/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
10768/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
10769/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
10770/// #     ),
10771/// # ).build().await.unwrap();
10772///
10773/// # let client = hyper_util::client::legacy::Client::builder(
10774/// #     hyper_util::rt::TokioExecutor::new()
10775/// # )
10776/// # .build(
10777/// #     hyper_rustls::HttpsConnectorBuilder::new()
10778/// #         .with_native_roots()
10779/// #         .unwrap()
10780/// #         .https_or_http()
10781/// #         .enable_http2()
10782/// #         .build()
10783/// # );
10784/// # let mut hub = CloudFilestore::new(client, auth);
10785/// // You can configure optional parameters by calling the respective setters at will, and
10786/// // execute the final call using `doit()`.
10787/// // Values shown here are possibly random and not representative !
10788/// let result = hub.projects().locations_operations_get("name")
10789///              .doit().await;
10790/// # }
10791/// ```
10792pub struct ProjectLocationOperationGetCall<'a, C>
10793where
10794    C: 'a,
10795{
10796    hub: &'a CloudFilestore<C>,
10797    _name: String,
10798    _delegate: Option<&'a mut dyn common::Delegate>,
10799    _additional_params: HashMap<String, String>,
10800    _scopes: BTreeSet<String>,
10801}
10802
10803impl<'a, C> common::CallBuilder for ProjectLocationOperationGetCall<'a, C> {}
10804
10805impl<'a, C> ProjectLocationOperationGetCall<'a, C>
10806where
10807    C: common::Connector,
10808{
10809    /// Perform the operation you have build so far.
10810    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
10811        use std::borrow::Cow;
10812        use std::io::{Read, Seek};
10813
10814        use common::{url::Params, ToParts};
10815        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
10816
10817        let mut dd = common::DefaultDelegate;
10818        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
10819        dlg.begin(common::MethodInfo {
10820            id: "file.projects.locations.operations.get",
10821            http_method: hyper::Method::GET,
10822        });
10823
10824        for &field in ["alt", "name"].iter() {
10825            if self._additional_params.contains_key(field) {
10826                dlg.finished(false);
10827                return Err(common::Error::FieldClash(field));
10828            }
10829        }
10830
10831        let mut params = Params::with_capacity(3 + self._additional_params.len());
10832        params.push("name", self._name);
10833
10834        params.extend(self._additional_params.iter());
10835
10836        params.push("alt", "json");
10837        let mut url = self.hub._base_url.clone() + "v1beta1/{+name}";
10838        if self._scopes.is_empty() {
10839            self._scopes
10840                .insert(Scope::CloudPlatform.as_ref().to_string());
10841        }
10842
10843        #[allow(clippy::single_element_loop)]
10844        for &(find_this, param_name) in [("{+name}", "name")].iter() {
10845            url = params.uri_replacement(url, param_name, find_this, true);
10846        }
10847        {
10848            let to_remove = ["name"];
10849            params.remove_params(&to_remove);
10850        }
10851
10852        let url = params.parse_with_url(&url);
10853
10854        loop {
10855            let token = match self
10856                .hub
10857                .auth
10858                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
10859                .await
10860            {
10861                Ok(token) => token,
10862                Err(e) => match dlg.token(e) {
10863                    Ok(token) => token,
10864                    Err(e) => {
10865                        dlg.finished(false);
10866                        return Err(common::Error::MissingToken(e));
10867                    }
10868                },
10869            };
10870            let mut req_result = {
10871                let client = &self.hub.client;
10872                dlg.pre_request();
10873                let mut req_builder = hyper::Request::builder()
10874                    .method(hyper::Method::GET)
10875                    .uri(url.as_str())
10876                    .header(USER_AGENT, self.hub._user_agent.clone());
10877
10878                if let Some(token) = token.as_ref() {
10879                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
10880                }
10881
10882                let request = req_builder
10883                    .header(CONTENT_LENGTH, 0_u64)
10884                    .body(common::to_body::<String>(None));
10885
10886                client.request(request.unwrap()).await
10887            };
10888
10889            match req_result {
10890                Err(err) => {
10891                    if let common::Retry::After(d) = dlg.http_error(&err) {
10892                        sleep(d).await;
10893                        continue;
10894                    }
10895                    dlg.finished(false);
10896                    return Err(common::Error::HttpError(err));
10897                }
10898                Ok(res) => {
10899                    let (mut parts, body) = res.into_parts();
10900                    let mut body = common::Body::new(body);
10901                    if !parts.status.is_success() {
10902                        let bytes = common::to_bytes(body).await.unwrap_or_default();
10903                        let error = serde_json::from_str(&common::to_string(&bytes));
10904                        let response = common::to_response(parts, bytes.into());
10905
10906                        if let common::Retry::After(d) =
10907                            dlg.http_failure(&response, error.as_ref().ok())
10908                        {
10909                            sleep(d).await;
10910                            continue;
10911                        }
10912
10913                        dlg.finished(false);
10914
10915                        return Err(match error {
10916                            Ok(value) => common::Error::BadRequest(value),
10917                            _ => common::Error::Failure(response),
10918                        });
10919                    }
10920                    let response = {
10921                        let bytes = common::to_bytes(body).await.unwrap_or_default();
10922                        let encoded = common::to_string(&bytes);
10923                        match serde_json::from_str(&encoded) {
10924                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
10925                            Err(error) => {
10926                                dlg.response_json_decode_error(&encoded, &error);
10927                                return Err(common::Error::JsonDecodeError(
10928                                    encoded.to_string(),
10929                                    error,
10930                                ));
10931                            }
10932                        }
10933                    };
10934
10935                    dlg.finished(true);
10936                    return Ok(response);
10937                }
10938            }
10939        }
10940    }
10941
10942    /// The name of the operation resource.
10943    ///
10944    /// Sets the *name* path property to the given value.
10945    ///
10946    /// Even though the property as already been set when instantiating this call,
10947    /// we provide this method for API completeness.
10948    pub fn name(mut self, new_value: &str) -> ProjectLocationOperationGetCall<'a, C> {
10949        self._name = new_value.to_string();
10950        self
10951    }
10952    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
10953    /// while executing the actual API request.
10954    ///
10955    /// ````text
10956    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
10957    /// ````
10958    ///
10959    /// Sets the *delegate* property to the given value.
10960    pub fn delegate(
10961        mut self,
10962        new_value: &'a mut dyn common::Delegate,
10963    ) -> ProjectLocationOperationGetCall<'a, C> {
10964        self._delegate = Some(new_value);
10965        self
10966    }
10967
10968    /// Set any additional parameter of the query string used in the request.
10969    /// It should be used to set parameters which are not yet available through their own
10970    /// setters.
10971    ///
10972    /// Please note that this method must not be used to set any of the known parameters
10973    /// which have their own setter method. If done anyway, the request will fail.
10974    ///
10975    /// # Additional Parameters
10976    ///
10977    /// * *$.xgafv* (query-string) - V1 error format.
10978    /// * *access_token* (query-string) - OAuth access token.
10979    /// * *alt* (query-string) - Data format for response.
10980    /// * *callback* (query-string) - JSONP
10981    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
10982    /// * *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.
10983    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
10984    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
10985    /// * *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.
10986    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
10987    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
10988    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationOperationGetCall<'a, C>
10989    where
10990        T: AsRef<str>,
10991    {
10992        self._additional_params
10993            .insert(name.as_ref().to_string(), value.as_ref().to_string());
10994        self
10995    }
10996
10997    /// Identifies the authorization scope for the method you are building.
10998    ///
10999    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
11000    /// [`Scope::CloudPlatform`].
11001    ///
11002    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
11003    /// tokens for more than one scope.
11004    ///
11005    /// Usually there is more than one suitable scope to authorize an operation, some of which may
11006    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
11007    /// sufficient, a read-write scope will do as well.
11008    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationOperationGetCall<'a, C>
11009    where
11010        St: AsRef<str>,
11011    {
11012        self._scopes.insert(String::from(scope.as_ref()));
11013        self
11014    }
11015    /// Identifies the authorization scope(s) for the method you are building.
11016    ///
11017    /// See [`Self::add_scope()`] for details.
11018    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationOperationGetCall<'a, C>
11019    where
11020        I: IntoIterator<Item = St>,
11021        St: AsRef<str>,
11022    {
11023        self._scopes
11024            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
11025        self
11026    }
11027
11028    /// Removes all scopes, and no default scope will be used either.
11029    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
11030    /// for details).
11031    pub fn clear_scopes(mut self) -> ProjectLocationOperationGetCall<'a, C> {
11032        self._scopes.clear();
11033        self
11034    }
11035}
11036
11037/// Lists operations that match the specified filter in the request. If the server doesn't support this method, it returns `UNIMPLEMENTED`.
11038///
11039/// A builder for the *locations.operations.list* method supported by a *project* resource.
11040/// It is not used directly, but through a [`ProjectMethods`] instance.
11041///
11042/// # Example
11043///
11044/// Instantiate a resource method builder
11045///
11046/// ```test_harness,no_run
11047/// # extern crate hyper;
11048/// # extern crate hyper_rustls;
11049/// # extern crate google_file1_beta1 as file1_beta1;
11050/// # async fn dox() {
11051/// # use file1_beta1::{CloudFilestore, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
11052///
11053/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
11054/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
11055/// #     .with_native_roots()
11056/// #     .unwrap()
11057/// #     .https_only()
11058/// #     .enable_http2()
11059/// #     .build();
11060///
11061/// # let executor = hyper_util::rt::TokioExecutor::new();
11062/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
11063/// #     secret,
11064/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
11065/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
11066/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
11067/// #     ),
11068/// # ).build().await.unwrap();
11069///
11070/// # let client = hyper_util::client::legacy::Client::builder(
11071/// #     hyper_util::rt::TokioExecutor::new()
11072/// # )
11073/// # .build(
11074/// #     hyper_rustls::HttpsConnectorBuilder::new()
11075/// #         .with_native_roots()
11076/// #         .unwrap()
11077/// #         .https_or_http()
11078/// #         .enable_http2()
11079/// #         .build()
11080/// # );
11081/// # let mut hub = CloudFilestore::new(client, auth);
11082/// // You can configure optional parameters by calling the respective setters at will, and
11083/// // execute the final call using `doit()`.
11084/// // Values shown here are possibly random and not representative !
11085/// let result = hub.projects().locations_operations_list("name")
11086///              .return_partial_success(true)
11087///              .page_token("et")
11088///              .page_size(-22)
11089///              .filter("sadipscing")
11090///              .doit().await;
11091/// # }
11092/// ```
11093pub struct ProjectLocationOperationListCall<'a, C>
11094where
11095    C: 'a,
11096{
11097    hub: &'a CloudFilestore<C>,
11098    _name: String,
11099    _return_partial_success: Option<bool>,
11100    _page_token: Option<String>,
11101    _page_size: Option<i32>,
11102    _filter: Option<String>,
11103    _delegate: Option<&'a mut dyn common::Delegate>,
11104    _additional_params: HashMap<String, String>,
11105    _scopes: BTreeSet<String>,
11106}
11107
11108impl<'a, C> common::CallBuilder for ProjectLocationOperationListCall<'a, C> {}
11109
11110impl<'a, C> ProjectLocationOperationListCall<'a, C>
11111where
11112    C: common::Connector,
11113{
11114    /// Perform the operation you have build so far.
11115    pub async fn doit(mut self) -> common::Result<(common::Response, ListOperationsResponse)> {
11116        use std::borrow::Cow;
11117        use std::io::{Read, Seek};
11118
11119        use common::{url::Params, ToParts};
11120        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
11121
11122        let mut dd = common::DefaultDelegate;
11123        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
11124        dlg.begin(common::MethodInfo {
11125            id: "file.projects.locations.operations.list",
11126            http_method: hyper::Method::GET,
11127        });
11128
11129        for &field in [
11130            "alt",
11131            "name",
11132            "returnPartialSuccess",
11133            "pageToken",
11134            "pageSize",
11135            "filter",
11136        ]
11137        .iter()
11138        {
11139            if self._additional_params.contains_key(field) {
11140                dlg.finished(false);
11141                return Err(common::Error::FieldClash(field));
11142            }
11143        }
11144
11145        let mut params = Params::with_capacity(7 + self._additional_params.len());
11146        params.push("name", self._name);
11147        if let Some(value) = self._return_partial_success.as_ref() {
11148            params.push("returnPartialSuccess", value.to_string());
11149        }
11150        if let Some(value) = self._page_token.as_ref() {
11151            params.push("pageToken", value);
11152        }
11153        if let Some(value) = self._page_size.as_ref() {
11154            params.push("pageSize", value.to_string());
11155        }
11156        if let Some(value) = self._filter.as_ref() {
11157            params.push("filter", value);
11158        }
11159
11160        params.extend(self._additional_params.iter());
11161
11162        params.push("alt", "json");
11163        let mut url = self.hub._base_url.clone() + "v1beta1/{+name}/operations";
11164        if self._scopes.is_empty() {
11165            self._scopes
11166                .insert(Scope::CloudPlatform.as_ref().to_string());
11167        }
11168
11169        #[allow(clippy::single_element_loop)]
11170        for &(find_this, param_name) in [("{+name}", "name")].iter() {
11171            url = params.uri_replacement(url, param_name, find_this, true);
11172        }
11173        {
11174            let to_remove = ["name"];
11175            params.remove_params(&to_remove);
11176        }
11177
11178        let url = params.parse_with_url(&url);
11179
11180        loop {
11181            let token = match self
11182                .hub
11183                .auth
11184                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
11185                .await
11186            {
11187                Ok(token) => token,
11188                Err(e) => match dlg.token(e) {
11189                    Ok(token) => token,
11190                    Err(e) => {
11191                        dlg.finished(false);
11192                        return Err(common::Error::MissingToken(e));
11193                    }
11194                },
11195            };
11196            let mut req_result = {
11197                let client = &self.hub.client;
11198                dlg.pre_request();
11199                let mut req_builder = hyper::Request::builder()
11200                    .method(hyper::Method::GET)
11201                    .uri(url.as_str())
11202                    .header(USER_AGENT, self.hub._user_agent.clone());
11203
11204                if let Some(token) = token.as_ref() {
11205                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
11206                }
11207
11208                let request = req_builder
11209                    .header(CONTENT_LENGTH, 0_u64)
11210                    .body(common::to_body::<String>(None));
11211
11212                client.request(request.unwrap()).await
11213            };
11214
11215            match req_result {
11216                Err(err) => {
11217                    if let common::Retry::After(d) = dlg.http_error(&err) {
11218                        sleep(d).await;
11219                        continue;
11220                    }
11221                    dlg.finished(false);
11222                    return Err(common::Error::HttpError(err));
11223                }
11224                Ok(res) => {
11225                    let (mut parts, body) = res.into_parts();
11226                    let mut body = common::Body::new(body);
11227                    if !parts.status.is_success() {
11228                        let bytes = common::to_bytes(body).await.unwrap_or_default();
11229                        let error = serde_json::from_str(&common::to_string(&bytes));
11230                        let response = common::to_response(parts, bytes.into());
11231
11232                        if let common::Retry::After(d) =
11233                            dlg.http_failure(&response, error.as_ref().ok())
11234                        {
11235                            sleep(d).await;
11236                            continue;
11237                        }
11238
11239                        dlg.finished(false);
11240
11241                        return Err(match error {
11242                            Ok(value) => common::Error::BadRequest(value),
11243                            _ => common::Error::Failure(response),
11244                        });
11245                    }
11246                    let response = {
11247                        let bytes = common::to_bytes(body).await.unwrap_or_default();
11248                        let encoded = common::to_string(&bytes);
11249                        match serde_json::from_str(&encoded) {
11250                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
11251                            Err(error) => {
11252                                dlg.response_json_decode_error(&encoded, &error);
11253                                return Err(common::Error::JsonDecodeError(
11254                                    encoded.to_string(),
11255                                    error,
11256                                ));
11257                            }
11258                        }
11259                    };
11260
11261                    dlg.finished(true);
11262                    return Ok(response);
11263                }
11264            }
11265        }
11266    }
11267
11268    /// The name of the operation's parent resource.
11269    ///
11270    /// Sets the *name* path property to the given value.
11271    ///
11272    /// Even though the property as already been set when instantiating this call,
11273    /// we provide this method for API completeness.
11274    pub fn name(mut self, new_value: &str) -> ProjectLocationOperationListCall<'a, C> {
11275        self._name = new_value.to_string();
11276        self
11277    }
11278    /// When set to `true`, operations that are reachable are returned as normal, and those that are unreachable are returned in the ListOperationsResponse.unreachable field. This can only be `true` when reading across collections. For example, when `parent` is set to `"projects/example/locations/-"`. This field is not supported by default and will result in an `UNIMPLEMENTED` error if set unless explicitly documented otherwise in service or product specific documentation.
11279    ///
11280    /// Sets the *return partial success* query property to the given value.
11281    pub fn return_partial_success(
11282        mut self,
11283        new_value: bool,
11284    ) -> ProjectLocationOperationListCall<'a, C> {
11285        self._return_partial_success = Some(new_value);
11286        self
11287    }
11288    /// The standard list page token.
11289    ///
11290    /// Sets the *page token* query property to the given value.
11291    pub fn page_token(mut self, new_value: &str) -> ProjectLocationOperationListCall<'a, C> {
11292        self._page_token = Some(new_value.to_string());
11293        self
11294    }
11295    /// The standard list page size.
11296    ///
11297    /// Sets the *page size* query property to the given value.
11298    pub fn page_size(mut self, new_value: i32) -> ProjectLocationOperationListCall<'a, C> {
11299        self._page_size = Some(new_value);
11300        self
11301    }
11302    /// The standard list filter.
11303    ///
11304    /// Sets the *filter* query property to the given value.
11305    pub fn filter(mut self, new_value: &str) -> ProjectLocationOperationListCall<'a, C> {
11306        self._filter = Some(new_value.to_string());
11307        self
11308    }
11309    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
11310    /// while executing the actual API request.
11311    ///
11312    /// ````text
11313    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
11314    /// ````
11315    ///
11316    /// Sets the *delegate* property to the given value.
11317    pub fn delegate(
11318        mut self,
11319        new_value: &'a mut dyn common::Delegate,
11320    ) -> ProjectLocationOperationListCall<'a, C> {
11321        self._delegate = Some(new_value);
11322        self
11323    }
11324
11325    /// Set any additional parameter of the query string used in the request.
11326    /// It should be used to set parameters which are not yet available through their own
11327    /// setters.
11328    ///
11329    /// Please note that this method must not be used to set any of the known parameters
11330    /// which have their own setter method. If done anyway, the request will fail.
11331    ///
11332    /// # Additional Parameters
11333    ///
11334    /// * *$.xgafv* (query-string) - V1 error format.
11335    /// * *access_token* (query-string) - OAuth access token.
11336    /// * *alt* (query-string) - Data format for response.
11337    /// * *callback* (query-string) - JSONP
11338    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
11339    /// * *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.
11340    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
11341    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
11342    /// * *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.
11343    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
11344    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
11345    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationOperationListCall<'a, C>
11346    where
11347        T: AsRef<str>,
11348    {
11349        self._additional_params
11350            .insert(name.as_ref().to_string(), value.as_ref().to_string());
11351        self
11352    }
11353
11354    /// Identifies the authorization scope for the method you are building.
11355    ///
11356    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
11357    /// [`Scope::CloudPlatform`].
11358    ///
11359    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
11360    /// tokens for more than one scope.
11361    ///
11362    /// Usually there is more than one suitable scope to authorize an operation, some of which may
11363    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
11364    /// sufficient, a read-write scope will do as well.
11365    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationOperationListCall<'a, C>
11366    where
11367        St: AsRef<str>,
11368    {
11369        self._scopes.insert(String::from(scope.as_ref()));
11370        self
11371    }
11372    /// Identifies the authorization scope(s) for the method you are building.
11373    ///
11374    /// See [`Self::add_scope()`] for details.
11375    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationOperationListCall<'a, C>
11376    where
11377        I: IntoIterator<Item = St>,
11378        St: AsRef<str>,
11379    {
11380        self._scopes
11381            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
11382        self
11383    }
11384
11385    /// Removes all scopes, and no default scope will be used either.
11386    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
11387    /// for details).
11388    pub fn clear_scopes(mut self) -> ProjectLocationOperationListCall<'a, C> {
11389        self._scopes.clear();
11390        self
11391    }
11392}
11393
11394/// Gets information about a location.
11395///
11396/// A builder for the *locations.get* method supported by a *project* resource.
11397/// It is not used directly, but through a [`ProjectMethods`] instance.
11398///
11399/// # Example
11400///
11401/// Instantiate a resource method builder
11402///
11403/// ```test_harness,no_run
11404/// # extern crate hyper;
11405/// # extern crate hyper_rustls;
11406/// # extern crate google_file1_beta1 as file1_beta1;
11407/// # async fn dox() {
11408/// # use file1_beta1::{CloudFilestore, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
11409///
11410/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
11411/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
11412/// #     .with_native_roots()
11413/// #     .unwrap()
11414/// #     .https_only()
11415/// #     .enable_http2()
11416/// #     .build();
11417///
11418/// # let executor = hyper_util::rt::TokioExecutor::new();
11419/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
11420/// #     secret,
11421/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
11422/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
11423/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
11424/// #     ),
11425/// # ).build().await.unwrap();
11426///
11427/// # let client = hyper_util::client::legacy::Client::builder(
11428/// #     hyper_util::rt::TokioExecutor::new()
11429/// # )
11430/// # .build(
11431/// #     hyper_rustls::HttpsConnectorBuilder::new()
11432/// #         .with_native_roots()
11433/// #         .unwrap()
11434/// #         .https_or_http()
11435/// #         .enable_http2()
11436/// #         .build()
11437/// # );
11438/// # let mut hub = CloudFilestore::new(client, auth);
11439/// // You can configure optional parameters by calling the respective setters at will, and
11440/// // execute the final call using `doit()`.
11441/// // Values shown here are possibly random and not representative !
11442/// let result = hub.projects().locations_get("name")
11443///              .doit().await;
11444/// # }
11445/// ```
11446pub struct ProjectLocationGetCall<'a, C>
11447where
11448    C: 'a,
11449{
11450    hub: &'a CloudFilestore<C>,
11451    _name: String,
11452    _delegate: Option<&'a mut dyn common::Delegate>,
11453    _additional_params: HashMap<String, String>,
11454    _scopes: BTreeSet<String>,
11455}
11456
11457impl<'a, C> common::CallBuilder for ProjectLocationGetCall<'a, C> {}
11458
11459impl<'a, C> ProjectLocationGetCall<'a, C>
11460where
11461    C: common::Connector,
11462{
11463    /// Perform the operation you have build so far.
11464    pub async fn doit(mut self) -> common::Result<(common::Response, Location)> {
11465        use std::borrow::Cow;
11466        use std::io::{Read, Seek};
11467
11468        use common::{url::Params, ToParts};
11469        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
11470
11471        let mut dd = common::DefaultDelegate;
11472        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
11473        dlg.begin(common::MethodInfo {
11474            id: "file.projects.locations.get",
11475            http_method: hyper::Method::GET,
11476        });
11477
11478        for &field in ["alt", "name"].iter() {
11479            if self._additional_params.contains_key(field) {
11480                dlg.finished(false);
11481                return Err(common::Error::FieldClash(field));
11482            }
11483        }
11484
11485        let mut params = Params::with_capacity(3 + self._additional_params.len());
11486        params.push("name", self._name);
11487
11488        params.extend(self._additional_params.iter());
11489
11490        params.push("alt", "json");
11491        let mut url = self.hub._base_url.clone() + "v1beta1/{+name}";
11492        if self._scopes.is_empty() {
11493            self._scopes
11494                .insert(Scope::CloudPlatform.as_ref().to_string());
11495        }
11496
11497        #[allow(clippy::single_element_loop)]
11498        for &(find_this, param_name) in [("{+name}", "name")].iter() {
11499            url = params.uri_replacement(url, param_name, find_this, true);
11500        }
11501        {
11502            let to_remove = ["name"];
11503            params.remove_params(&to_remove);
11504        }
11505
11506        let url = params.parse_with_url(&url);
11507
11508        loop {
11509            let token = match self
11510                .hub
11511                .auth
11512                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
11513                .await
11514            {
11515                Ok(token) => token,
11516                Err(e) => match dlg.token(e) {
11517                    Ok(token) => token,
11518                    Err(e) => {
11519                        dlg.finished(false);
11520                        return Err(common::Error::MissingToken(e));
11521                    }
11522                },
11523            };
11524            let mut req_result = {
11525                let client = &self.hub.client;
11526                dlg.pre_request();
11527                let mut req_builder = hyper::Request::builder()
11528                    .method(hyper::Method::GET)
11529                    .uri(url.as_str())
11530                    .header(USER_AGENT, self.hub._user_agent.clone());
11531
11532                if let Some(token) = token.as_ref() {
11533                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
11534                }
11535
11536                let request = req_builder
11537                    .header(CONTENT_LENGTH, 0_u64)
11538                    .body(common::to_body::<String>(None));
11539
11540                client.request(request.unwrap()).await
11541            };
11542
11543            match req_result {
11544                Err(err) => {
11545                    if let common::Retry::After(d) = dlg.http_error(&err) {
11546                        sleep(d).await;
11547                        continue;
11548                    }
11549                    dlg.finished(false);
11550                    return Err(common::Error::HttpError(err));
11551                }
11552                Ok(res) => {
11553                    let (mut parts, body) = res.into_parts();
11554                    let mut body = common::Body::new(body);
11555                    if !parts.status.is_success() {
11556                        let bytes = common::to_bytes(body).await.unwrap_or_default();
11557                        let error = serde_json::from_str(&common::to_string(&bytes));
11558                        let response = common::to_response(parts, bytes.into());
11559
11560                        if let common::Retry::After(d) =
11561                            dlg.http_failure(&response, error.as_ref().ok())
11562                        {
11563                            sleep(d).await;
11564                            continue;
11565                        }
11566
11567                        dlg.finished(false);
11568
11569                        return Err(match error {
11570                            Ok(value) => common::Error::BadRequest(value),
11571                            _ => common::Error::Failure(response),
11572                        });
11573                    }
11574                    let response = {
11575                        let bytes = common::to_bytes(body).await.unwrap_or_default();
11576                        let encoded = common::to_string(&bytes);
11577                        match serde_json::from_str(&encoded) {
11578                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
11579                            Err(error) => {
11580                                dlg.response_json_decode_error(&encoded, &error);
11581                                return Err(common::Error::JsonDecodeError(
11582                                    encoded.to_string(),
11583                                    error,
11584                                ));
11585                            }
11586                        }
11587                    };
11588
11589                    dlg.finished(true);
11590                    return Ok(response);
11591                }
11592            }
11593        }
11594    }
11595
11596    /// Resource name for the location.
11597    ///
11598    /// Sets the *name* path property to the given value.
11599    ///
11600    /// Even though the property as already been set when instantiating this call,
11601    /// we provide this method for API completeness.
11602    pub fn name(mut self, new_value: &str) -> ProjectLocationGetCall<'a, C> {
11603        self._name = new_value.to_string();
11604        self
11605    }
11606    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
11607    /// while executing the actual API request.
11608    ///
11609    /// ````text
11610    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
11611    /// ````
11612    ///
11613    /// Sets the *delegate* property to the given value.
11614    pub fn delegate(
11615        mut self,
11616        new_value: &'a mut dyn common::Delegate,
11617    ) -> ProjectLocationGetCall<'a, C> {
11618        self._delegate = Some(new_value);
11619        self
11620    }
11621
11622    /// Set any additional parameter of the query string used in the request.
11623    /// It should be used to set parameters which are not yet available through their own
11624    /// setters.
11625    ///
11626    /// Please note that this method must not be used to set any of the known parameters
11627    /// which have their own setter method. If done anyway, the request will fail.
11628    ///
11629    /// # Additional Parameters
11630    ///
11631    /// * *$.xgafv* (query-string) - V1 error format.
11632    /// * *access_token* (query-string) - OAuth access token.
11633    /// * *alt* (query-string) - Data format for response.
11634    /// * *callback* (query-string) - JSONP
11635    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
11636    /// * *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.
11637    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
11638    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
11639    /// * *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.
11640    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
11641    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
11642    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationGetCall<'a, C>
11643    where
11644        T: AsRef<str>,
11645    {
11646        self._additional_params
11647            .insert(name.as_ref().to_string(), value.as_ref().to_string());
11648        self
11649    }
11650
11651    /// Identifies the authorization scope for the method you are building.
11652    ///
11653    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
11654    /// [`Scope::CloudPlatform`].
11655    ///
11656    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
11657    /// tokens for more than one scope.
11658    ///
11659    /// Usually there is more than one suitable scope to authorize an operation, some of which may
11660    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
11661    /// sufficient, a read-write scope will do as well.
11662    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationGetCall<'a, C>
11663    where
11664        St: AsRef<str>,
11665    {
11666        self._scopes.insert(String::from(scope.as_ref()));
11667        self
11668    }
11669    /// Identifies the authorization scope(s) for the method you are building.
11670    ///
11671    /// See [`Self::add_scope()`] for details.
11672    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationGetCall<'a, C>
11673    where
11674        I: IntoIterator<Item = St>,
11675        St: AsRef<str>,
11676    {
11677        self._scopes
11678            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
11679        self
11680    }
11681
11682    /// Removes all scopes, and no default scope will be used either.
11683    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
11684    /// for details).
11685    pub fn clear_scopes(mut self) -> ProjectLocationGetCall<'a, C> {
11686        self._scopes.clear();
11687        self
11688    }
11689}
11690
11691/// Lists information about the supported locations for this service.
11692///
11693/// A builder for the *locations.list* method supported by a *project* resource.
11694/// It is not used directly, but through a [`ProjectMethods`] instance.
11695///
11696/// # Example
11697///
11698/// Instantiate a resource method builder
11699///
11700/// ```test_harness,no_run
11701/// # extern crate hyper;
11702/// # extern crate hyper_rustls;
11703/// # extern crate google_file1_beta1 as file1_beta1;
11704/// # async fn dox() {
11705/// # use file1_beta1::{CloudFilestore, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
11706///
11707/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
11708/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
11709/// #     .with_native_roots()
11710/// #     .unwrap()
11711/// #     .https_only()
11712/// #     .enable_http2()
11713/// #     .build();
11714///
11715/// # let executor = hyper_util::rt::TokioExecutor::new();
11716/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
11717/// #     secret,
11718/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
11719/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
11720/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
11721/// #     ),
11722/// # ).build().await.unwrap();
11723///
11724/// # let client = hyper_util::client::legacy::Client::builder(
11725/// #     hyper_util::rt::TokioExecutor::new()
11726/// # )
11727/// # .build(
11728/// #     hyper_rustls::HttpsConnectorBuilder::new()
11729/// #         .with_native_roots()
11730/// #         .unwrap()
11731/// #         .https_or_http()
11732/// #         .enable_http2()
11733/// #         .build()
11734/// # );
11735/// # let mut hub = CloudFilestore::new(client, auth);
11736/// // You can configure optional parameters by calling the respective setters at will, and
11737/// // execute the final call using `doit()`.
11738/// // Values shown here are possibly random and not representative !
11739/// let result = hub.projects().locations_list("name")
11740///              .page_token("duo")
11741///              .page_size(-76)
11742///              .filter("vero")
11743///              .add_extra_location_types("invidunt")
11744///              .doit().await;
11745/// # }
11746/// ```
11747pub struct ProjectLocationListCall<'a, C>
11748where
11749    C: 'a,
11750{
11751    hub: &'a CloudFilestore<C>,
11752    _name: String,
11753    _page_token: Option<String>,
11754    _page_size: Option<i32>,
11755    _filter: Option<String>,
11756    _extra_location_types: Vec<String>,
11757    _delegate: Option<&'a mut dyn common::Delegate>,
11758    _additional_params: HashMap<String, String>,
11759    _scopes: BTreeSet<String>,
11760}
11761
11762impl<'a, C> common::CallBuilder for ProjectLocationListCall<'a, C> {}
11763
11764impl<'a, C> ProjectLocationListCall<'a, C>
11765where
11766    C: common::Connector,
11767{
11768    /// Perform the operation you have build so far.
11769    pub async fn doit(mut self) -> common::Result<(common::Response, ListLocationsResponse)> {
11770        use std::borrow::Cow;
11771        use std::io::{Read, Seek};
11772
11773        use common::{url::Params, ToParts};
11774        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
11775
11776        let mut dd = common::DefaultDelegate;
11777        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
11778        dlg.begin(common::MethodInfo {
11779            id: "file.projects.locations.list",
11780            http_method: hyper::Method::GET,
11781        });
11782
11783        for &field in [
11784            "alt",
11785            "name",
11786            "pageToken",
11787            "pageSize",
11788            "filter",
11789            "extraLocationTypes",
11790        ]
11791        .iter()
11792        {
11793            if self._additional_params.contains_key(field) {
11794                dlg.finished(false);
11795                return Err(common::Error::FieldClash(field));
11796            }
11797        }
11798
11799        let mut params = Params::with_capacity(7 + self._additional_params.len());
11800        params.push("name", self._name);
11801        if let Some(value) = self._page_token.as_ref() {
11802            params.push("pageToken", value);
11803        }
11804        if let Some(value) = self._page_size.as_ref() {
11805            params.push("pageSize", value.to_string());
11806        }
11807        if let Some(value) = self._filter.as_ref() {
11808            params.push("filter", value);
11809        }
11810        if !self._extra_location_types.is_empty() {
11811            for f in self._extra_location_types.iter() {
11812                params.push("extraLocationTypes", f);
11813            }
11814        }
11815
11816        params.extend(self._additional_params.iter());
11817
11818        params.push("alt", "json");
11819        let mut url = self.hub._base_url.clone() + "v1beta1/{+name}/locations";
11820        if self._scopes.is_empty() {
11821            self._scopes
11822                .insert(Scope::CloudPlatform.as_ref().to_string());
11823        }
11824
11825        #[allow(clippy::single_element_loop)]
11826        for &(find_this, param_name) in [("{+name}", "name")].iter() {
11827            url = params.uri_replacement(url, param_name, find_this, true);
11828        }
11829        {
11830            let to_remove = ["name"];
11831            params.remove_params(&to_remove);
11832        }
11833
11834        let url = params.parse_with_url(&url);
11835
11836        loop {
11837            let token = match self
11838                .hub
11839                .auth
11840                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
11841                .await
11842            {
11843                Ok(token) => token,
11844                Err(e) => match dlg.token(e) {
11845                    Ok(token) => token,
11846                    Err(e) => {
11847                        dlg.finished(false);
11848                        return Err(common::Error::MissingToken(e));
11849                    }
11850                },
11851            };
11852            let mut req_result = {
11853                let client = &self.hub.client;
11854                dlg.pre_request();
11855                let mut req_builder = hyper::Request::builder()
11856                    .method(hyper::Method::GET)
11857                    .uri(url.as_str())
11858                    .header(USER_AGENT, self.hub._user_agent.clone());
11859
11860                if let Some(token) = token.as_ref() {
11861                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
11862                }
11863
11864                let request = req_builder
11865                    .header(CONTENT_LENGTH, 0_u64)
11866                    .body(common::to_body::<String>(None));
11867
11868                client.request(request.unwrap()).await
11869            };
11870
11871            match req_result {
11872                Err(err) => {
11873                    if let common::Retry::After(d) = dlg.http_error(&err) {
11874                        sleep(d).await;
11875                        continue;
11876                    }
11877                    dlg.finished(false);
11878                    return Err(common::Error::HttpError(err));
11879                }
11880                Ok(res) => {
11881                    let (mut parts, body) = res.into_parts();
11882                    let mut body = common::Body::new(body);
11883                    if !parts.status.is_success() {
11884                        let bytes = common::to_bytes(body).await.unwrap_or_default();
11885                        let error = serde_json::from_str(&common::to_string(&bytes));
11886                        let response = common::to_response(parts, bytes.into());
11887
11888                        if let common::Retry::After(d) =
11889                            dlg.http_failure(&response, error.as_ref().ok())
11890                        {
11891                            sleep(d).await;
11892                            continue;
11893                        }
11894
11895                        dlg.finished(false);
11896
11897                        return Err(match error {
11898                            Ok(value) => common::Error::BadRequest(value),
11899                            _ => common::Error::Failure(response),
11900                        });
11901                    }
11902                    let response = {
11903                        let bytes = common::to_bytes(body).await.unwrap_or_default();
11904                        let encoded = common::to_string(&bytes);
11905                        match serde_json::from_str(&encoded) {
11906                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
11907                            Err(error) => {
11908                                dlg.response_json_decode_error(&encoded, &error);
11909                                return Err(common::Error::JsonDecodeError(
11910                                    encoded.to_string(),
11911                                    error,
11912                                ));
11913                            }
11914                        }
11915                    };
11916
11917                    dlg.finished(true);
11918                    return Ok(response);
11919                }
11920            }
11921        }
11922    }
11923
11924    /// The resource that owns the locations collection, if applicable.
11925    ///
11926    /// Sets the *name* path property to the given value.
11927    ///
11928    /// Even though the property as already been set when instantiating this call,
11929    /// we provide this method for API completeness.
11930    pub fn name(mut self, new_value: &str) -> ProjectLocationListCall<'a, C> {
11931        self._name = new_value.to_string();
11932        self
11933    }
11934    /// A page token received from the `next_page_token` field in the response. Send that page token to receive the subsequent page.
11935    ///
11936    /// Sets the *page token* query property to the given value.
11937    pub fn page_token(mut self, new_value: &str) -> ProjectLocationListCall<'a, C> {
11938        self._page_token = Some(new_value.to_string());
11939        self
11940    }
11941    /// The maximum number of results to return. If not set, the service selects a default.
11942    ///
11943    /// Sets the *page size* query property to the given value.
11944    pub fn page_size(mut self, new_value: i32) -> ProjectLocationListCall<'a, C> {
11945        self._page_size = Some(new_value);
11946        self
11947    }
11948    /// 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).
11949    ///
11950    /// Sets the *filter* query property to the given value.
11951    pub fn filter(mut self, new_value: &str) -> ProjectLocationListCall<'a, C> {
11952        self._filter = Some(new_value.to_string());
11953        self
11954    }
11955    /// Optional. Do not use this field. It is unsupported and is ignored unless explicitly documented otherwise. This is primarily for internal usage.
11956    ///
11957    /// Append the given value to the *extra location types* query property.
11958    /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
11959    pub fn add_extra_location_types(mut self, new_value: &str) -> ProjectLocationListCall<'a, C> {
11960        self._extra_location_types.push(new_value.to_string());
11961        self
11962    }
11963    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
11964    /// while executing the actual API request.
11965    ///
11966    /// ````text
11967    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
11968    /// ````
11969    ///
11970    /// Sets the *delegate* property to the given value.
11971    pub fn delegate(
11972        mut self,
11973        new_value: &'a mut dyn common::Delegate,
11974    ) -> ProjectLocationListCall<'a, C> {
11975        self._delegate = Some(new_value);
11976        self
11977    }
11978
11979    /// Set any additional parameter of the query string used in the request.
11980    /// It should be used to set parameters which are not yet available through their own
11981    /// setters.
11982    ///
11983    /// Please note that this method must not be used to set any of the known parameters
11984    /// which have their own setter method. If done anyway, the request will fail.
11985    ///
11986    /// # Additional Parameters
11987    ///
11988    /// * *$.xgafv* (query-string) - V1 error format.
11989    /// * *access_token* (query-string) - OAuth access token.
11990    /// * *alt* (query-string) - Data format for response.
11991    /// * *callback* (query-string) - JSONP
11992    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
11993    /// * *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.
11994    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
11995    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
11996    /// * *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.
11997    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
11998    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
11999    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationListCall<'a, C>
12000    where
12001        T: AsRef<str>,
12002    {
12003        self._additional_params
12004            .insert(name.as_ref().to_string(), value.as_ref().to_string());
12005        self
12006    }
12007
12008    /// Identifies the authorization scope for the method you are building.
12009    ///
12010    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
12011    /// [`Scope::CloudPlatform`].
12012    ///
12013    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
12014    /// tokens for more than one scope.
12015    ///
12016    /// Usually there is more than one suitable scope to authorize an operation, some of which may
12017    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
12018    /// sufficient, a read-write scope will do as well.
12019    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationListCall<'a, C>
12020    where
12021        St: AsRef<str>,
12022    {
12023        self._scopes.insert(String::from(scope.as_ref()));
12024        self
12025    }
12026    /// Identifies the authorization scope(s) for the method you are building.
12027    ///
12028    /// See [`Self::add_scope()`] for details.
12029    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationListCall<'a, C>
12030    where
12031        I: IntoIterator<Item = St>,
12032        St: AsRef<str>,
12033    {
12034        self._scopes
12035            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
12036        self
12037    }
12038
12039    /// Removes all scopes, and no default scope will be used either.
12040    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
12041    /// for details).
12042    pub fn clear_scopes(mut self) -> ProjectLocationListCall<'a, C> {
12043        self._scopes.clear();
12044        self
12045    }
12046}