google_managedidentities1/
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 ManagedServiceForMicrosoftActiveDirectoryConsumerAPI 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_managedidentities1 as managedidentities1;
49/// use managedidentities1::api::Backup;
50/// use managedidentities1::{Result, Error};
51/// # async fn dox() {
52/// use managedidentities1::{ManagedServiceForMicrosoftActiveDirectoryConsumerAPI, 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 = ManagedServiceForMicrosoftActiveDirectoryConsumerAPI::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_global_domains_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 ManagedServiceForMicrosoftActiveDirectoryConsumerAPI<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 ManagedServiceForMicrosoftActiveDirectoryConsumerAPI<C> {}
131
132impl<'a, C> ManagedServiceForMicrosoftActiveDirectoryConsumerAPI<C> {
133    pub fn new<A: 'static + common::GetToken>(
134        client: common::Client<C>,
135        auth: A,
136    ) -> ManagedServiceForMicrosoftActiveDirectoryConsumerAPI<C> {
137        ManagedServiceForMicrosoftActiveDirectoryConsumerAPI {
138            client,
139            auth: Box::new(auth),
140            _user_agent: "google-api-rust-client/7.0.0".to_string(),
141            _base_url: "https://managedidentities.googleapis.com/".to_string(),
142            _root_url: "https://managedidentities.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://managedidentities.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://managedidentities.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/// Request message for AttachTrust
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 global domains attach trust projects](ProjectLocationGlobalDomainAttachTrustCall) (request)
186#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
187#[serde_with::serde_as]
188#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
189pub struct AttachTrustRequest {
190    /// Required. The domain trust resource.
191    pub trust: Option<Trust>,
192}
193
194impl common::RequestValue for AttachTrustRequest {}
195
196/// Represents a Managed Microsoft Identities backup.
197///
198/// # Activities
199///
200/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
201/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
202///
203/// * [locations global domains backups create projects](ProjectLocationGlobalDomainBackupCreateCall) (request)
204/// * [locations global domains backups get projects](ProjectLocationGlobalDomainBackupGetCall) (response)
205/// * [locations global domains backups patch projects](ProjectLocationGlobalDomainBackupPatchCall) (request)
206#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
207#[serde_with::serde_as]
208#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
209pub struct Backup {
210    /// Output only. The time the backups was created.
211    #[serde(rename = "createTime")]
212    pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
213    /// Optional. Resource labels to represent user provided metadata.
214    pub labels: Option<HashMap<String, String>>,
215    /// Output only. The unique name of the Backup in the form of `projects/{project_id}/locations/global/domains/{domain_name}/backups/{name}`
216    pub name: Option<String>,
217    /// Output only. The current state of the backup.
218    pub state: Option<String>,
219    /// Output only. Additional information about the current status of this backup, if available.
220    #[serde(rename = "statusMessage")]
221    pub status_message: Option<String>,
222    /// Output only. Indicates whether it’s an on-demand backup or scheduled.
223    #[serde(rename = "type")]
224    pub type_: Option<String>,
225    /// Output only. Last update time.
226    #[serde(rename = "updateTime")]
227    pub update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
228}
229
230impl common::RequestValue for Backup {}
231impl common::ResponseResult for Backup {}
232
233/// Associates `members`, or principals, with a `role`.
234///
235/// This type is not used in any activity, and only used as *part* of another schema.
236///
237#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
238#[serde_with::serde_as]
239#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
240pub struct Binding {
241    /// The condition that is associated with this binding. If the condition evaluates to `true`, then this binding applies to the current request. If the condition evaluates to `false`, then this binding does not apply to the current request. However, a different role binding might grant the same role to one or more of the principals in this binding. To learn which resources support conditions in their IAM policies, see the [IAM documentation](https://cloud.google.com/iam/help/conditions/resource-policies).
242    pub condition: Option<Expr>,
243    /// Specifies the principals requesting access for a Google Cloud resource. `members` can have the following values: * `allUsers`: A special identifier that represents anyone who is on the internet; with or without a Google account. * `allAuthenticatedUsers`: A special identifier that represents anyone who is authenticated with a Google account or a service account. Does not include identities that come from external identity providers (IdPs) through identity federation. * `user:{emailid}`: An email address that represents a specific Google account. For example, `alice@example.com` . * `serviceAccount:{emailid}`: An email address that represents a Google service account. For example, `my-other-app@appspot.gserviceaccount.com`. * `serviceAccount:{projectid}.svc.id.goog[{namespace}/{kubernetes-sa}]`: An identifier for a [Kubernetes service account](https://cloud.google.com/kubernetes-engine/docs/how-to/kubernetes-service-accounts). For example, `my-project.svc.id.goog[my-namespace/my-kubernetes-sa]`. * `group:{emailid}`: An email address that represents a Google group. For example, `admins@example.com`. * `domain:{domain}`: The G Suite domain (primary) that represents all the users of that domain. For example, `google.com` or `example.com`. * `principal://iam.googleapis.com/locations/global/workforcePools/{pool_id}/subject/{subject_attribute_value}`: A single identity in a workforce identity pool. * `principalSet://iam.googleapis.com/locations/global/workforcePools/{pool_id}/group/{group_id}`: All workforce identities in a group. * `principalSet://iam.googleapis.com/locations/global/workforcePools/{pool_id}/attribute.{attribute_name}/{attribute_value}`: All workforce identities with a specific attribute value. * `principalSet://iam.googleapis.com/locations/global/workforcePools/{pool_id}/*`: All identities in a workforce identity pool. * `principal://iam.googleapis.com/projects/{project_number}/locations/global/workloadIdentityPools/{pool_id}/subject/{subject_attribute_value}`: A single identity in a workload identity pool. * `principalSet://iam.googleapis.com/projects/{project_number}/locations/global/workloadIdentityPools/{pool_id}/group/{group_id}`: A workload identity pool group. * `principalSet://iam.googleapis.com/projects/{project_number}/locations/global/workloadIdentityPools/{pool_id}/attribute.{attribute_name}/{attribute_value}`: All identities in a workload identity pool with a certain attribute. * `principalSet://iam.googleapis.com/projects/{project_number}/locations/global/workloadIdentityPools/{pool_id}/*`: All identities in a workload identity pool. * `deleted:user:{emailid}?uid={uniqueid}`: An email address (plus unique identifier) representing a user that has been recently deleted. For example, `alice@example.com?uid=123456789012345678901`. If the user is recovered, this value reverts to `user:{emailid}` and the recovered user retains the role in the binding. * `deleted:serviceAccount:{emailid}?uid={uniqueid}`: An email address (plus unique identifier) representing a service account that has been recently deleted. For example, `my-other-app@appspot.gserviceaccount.com?uid=123456789012345678901`. If the service account is undeleted, this value reverts to `serviceAccount:{emailid}` and the undeleted service account retains the role in the binding. * `deleted:group:{emailid}?uid={uniqueid}`: An email address (plus unique identifier) representing a Google group that has been recently deleted. For example, `admins@example.com?uid=123456789012345678901`. If the group is recovered, this value reverts to `group:{emailid}` and the recovered group retains the role in the binding. * `deleted:principal://iam.googleapis.com/locations/global/workforcePools/{pool_id}/subject/{subject_attribute_value}`: Deleted single identity in a workforce identity pool. For example, `deleted:principal://iam.googleapis.com/locations/global/workforcePools/my-pool-id/subject/my-subject-attribute-value`.
244    pub members: Option<Vec<String>>,
245    /// Role that is assigned to the list of `members`, or principals. For example, `roles/viewer`, `roles/editor`, or `roles/owner`. For an overview of the IAM roles and permissions, see the [IAM documentation](https://cloud.google.com/iam/docs/roles-overview). For a list of the available pre-defined roles, see [here](https://cloud.google.com/iam/docs/understanding-roles).
246    pub role: Option<String>,
247}
248
249impl common::Part for Binding {}
250
251/// The request message for Operations.CancelOperation.
252///
253/// # Activities
254///
255/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
256/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
257///
258/// * [locations global operations cancel projects](ProjectLocationGlobalOperationCancelCall) (request)
259#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
260#[serde_with::serde_as]
261#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
262pub struct CancelOperationRequest {
263    _never_set: Option<bool>,
264}
265
266impl common::RequestValue for CancelOperationRequest {}
267
268/// Certificate used to configure LDAPS.
269///
270/// This type is not used in any activity, and only used as *part* of another schema.
271///
272#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
273#[serde_with::serde_as]
274#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
275pub struct Certificate {
276    /// The certificate expire time.
277    #[serde(rename = "expireTime")]
278    pub expire_time: Option<chrono::DateTime<chrono::offset::Utc>>,
279    /// The issuer of this certificate.
280    #[serde(rename = "issuingCertificate")]
281    pub issuing_certificate: Option<Option<Box<Certificate>>>,
282    /// The certificate subject.
283    pub subject: Option<String>,
284    /// The additional hostnames for the domain.
285    #[serde(rename = "subjectAlternativeName")]
286    pub subject_alternative_name: Option<Vec<String>>,
287    /// The certificate thumbprint which uniquely identifies the certificate.
288    pub thumbprint: Option<String>,
289}
290
291impl common::Part for Certificate {}
292
293/// CheckMigrationPermissionRequest is the request message for CheckMigrationPermission method.
294///
295/// # Activities
296///
297/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
298/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
299///
300/// * [locations global domains check migration permission projects](ProjectLocationGlobalDomainCheckMigrationPermissionCall) (request)
301#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
302#[serde_with::serde_as]
303#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
304pub struct CheckMigrationPermissionRequest {
305    _never_set: Option<bool>,
306}
307
308impl common::RequestValue for CheckMigrationPermissionRequest {}
309
310/// CheckMigrationPermissionResponse is the response message for CheckMigrationPermission method.
311///
312/// # Activities
313///
314/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
315/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
316///
317/// * [locations global domains check migration permission projects](ProjectLocationGlobalDomainCheckMigrationPermissionCall) (response)
318#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
319#[serde_with::serde_as]
320#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
321pub struct CheckMigrationPermissionResponse {
322    /// The state of SID filtering of all the domains which has trust established.
323    #[serde(rename = "onpremDomains")]
324    pub onprem_domains: Option<Vec<OnPremDomainSIDDetails>>,
325    /// The state of DomainMigration.
326    pub state: Option<String>,
327}
328
329impl common::ResponseResult for CheckMigrationPermissionResponse {}
330
331/// Request message for DetachTrust
332///
333/// # Activities
334///
335/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
336/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
337///
338/// * [locations global domains detach trust projects](ProjectLocationGlobalDomainDetachTrustCall) (request)
339#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
340#[serde_with::serde_as]
341#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
342pub struct DetachTrustRequest {
343    /// Required. The domain trust resource to removed.
344    pub trust: Option<Trust>,
345}
346
347impl common::RequestValue for DetachTrustRequest {}
348
349/// DisableMigrationRequest is the request message for DisableMigration method.
350///
351/// # Activities
352///
353/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
354/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
355///
356/// * [locations global domains disable migration projects](ProjectLocationGlobalDomainDisableMigrationCall) (request)
357#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
358#[serde_with::serde_as]
359#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
360pub struct DisableMigrationRequest {
361    _never_set: Option<bool>,
362}
363
364impl common::RequestValue for DisableMigrationRequest {}
365
366/// Represents a managed Microsoft Active Directory domain. If the domain is being changed, it will be placed into the UPDATING state, which indicates that the resource is being reconciled. At this point, Get will reflect an intermediate state.
367///
368/// # Activities
369///
370/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
371/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
372///
373/// * [locations global domains create projects](ProjectLocationGlobalDomainCreateCall) (request)
374/// * [locations global domains get projects](ProjectLocationGlobalDomainGetCall) (response)
375/// * [locations global domains patch projects](ProjectLocationGlobalDomainPatchCall) (request)
376#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
377#[serde_with::serde_as]
378#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
379pub struct Domain {
380    /// Optional. The name of delegated administrator account used to perform Active Directory operations. If not specified, `setupadmin` will be used.
381    pub admin: Option<String>,
382    /// Optional. Configuration for audit logs. True if audit logs are enabled, else false. Default is audit logs disabled.
383    #[serde(rename = "auditLogsEnabled")]
384    pub audit_logs_enabled: Option<bool>,
385    /// Optional. The full names of the Google Compute Engine [networks](https://cloud.google.com/compute/docs/networks-and-firewalls#networks) the domain instance is connected to. Networks can be added using UpdateDomain. The domain is only available on networks listed in `authorized_networks`. If CIDR subnets overlap between networks, domain creation will fail.
386    #[serde(rename = "authorizedNetworks")]
387    pub authorized_networks: Option<Vec<String>>,
388    /// Output only. The time the instance was created.
389    #[serde(rename = "createTime")]
390    pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
391    /// Output only. The fully-qualified domain name of the exposed domain used by clients to connect to the service. Similar to what would be chosen for an Active Directory set up on an internal network.
392    pub fqdn: Option<String>,
393    /// Optional. Resource labels that can contain user-provided metadata.
394    pub labels: Option<HashMap<String, String>>,
395    /// Required. Locations where domain needs to be provisioned. The locations can be specified according to https://cloud.google.com/compute/docs/regions-zones, such as `us-west1` or `us-east4`. Each domain supports up to 4 locations, separated by commas. Each location will use a /26 block.
396    pub locations: Option<Vec<String>>,
397    /// Required. The unique name of the domain using the form: `projects/{project_id}/locations/global/domains/{domain_name}`.
398    pub name: Option<String>,
399    /// Required. The CIDR range of internal addresses that are reserved for this domain. Reserved networks must be /24 or larger. Ranges must be unique and non-overlapping with existing subnets in [Domain].[authorized_networks].
400    #[serde(rename = "reservedIpRange")]
401    pub reserved_ip_range: Option<String>,
402    /// Output only. The current state of this domain.
403    pub state: Option<String>,
404    /// Output only. Additional information about the current status of this domain, if available.
405    #[serde(rename = "statusMessage")]
406    pub status_message: Option<String>,
407    /// Output only. The current trusts associated with the domain.
408    pub trusts: Option<Vec<Trust>>,
409    /// Output only. The last update time.
410    #[serde(rename = "updateTime")]
411    pub update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
412}
413
414impl common::RequestValue for Domain {}
415impl common::ResponseResult for Domain {}
416
417/// DomainJoinMachineRequest is the request message for DomainJoinMachine method
418///
419/// # Activities
420///
421/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
422/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
423///
424/// * [locations global domains domain join machine projects](ProjectLocationGlobalDomainDomainJoinMachineCall) (request)
425#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
426#[serde_with::serde_as]
427#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
428pub struct DomainJoinMachineRequest {
429    /// Optional. force if True, forces domain join even if the computer account already exists.
430    pub force: Option<bool>,
431    /// Optional. OU name where the VM needs to be domain joined
432    #[serde(rename = "ouName")]
433    pub ou_name: Option<String>,
434    /// Required. Full instance id token of compute engine VM to verify instance identity. More about this: https://cloud.google.com/compute/docs/instances/verifying-instance-identity#request_signature
435    #[serde(rename = "vmIdToken")]
436    pub vm_id_token: Option<String>,
437}
438
439impl common::RequestValue for DomainJoinMachineRequest {}
440
441/// DomainJoinMachineResponse is the response message for DomainJoinMachine method
442///
443/// # Activities
444///
445/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
446/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
447///
448/// * [locations global domains domain join machine projects](ProjectLocationGlobalDomainDomainJoinMachineCall) (response)
449#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
450#[serde_with::serde_as]
451#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
452pub struct DomainJoinMachineResponse {
453    /// Offline domain join blob as the response
454    #[serde(rename = "domainJoinBlob")]
455    pub domain_join_blob: Option<String>,
456}
457
458impl common::ResponseResult for DomainJoinMachineResponse {}
459
460/// 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); }
461///
462/// # Activities
463///
464/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
465/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
466///
467/// * [locations global operations cancel projects](ProjectLocationGlobalOperationCancelCall) (response)
468/// * [locations global operations delete projects](ProjectLocationGlobalOperationDeleteCall) (response)
469#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
470#[serde_with::serde_as]
471#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
472pub struct Empty {
473    _never_set: Option<bool>,
474}
475
476impl common::ResponseResult for Empty {}
477
478/// EnableMigrationRequest is the request message for EnableMigration method.
479///
480/// # Activities
481///
482/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
483/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
484///
485/// * [locations global domains enable migration projects](ProjectLocationGlobalDomainEnableMigrationCall) (request)
486#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
487#[serde_with::serde_as]
488#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
489pub struct EnableMigrationRequest {
490    /// Required. List of the on-prem domains to be migrated.
491    #[serde(rename = "migratingDomains")]
492    pub migrating_domains: Option<Vec<OnPremDomainDetails>>,
493}
494
495impl common::RequestValue for EnableMigrationRequest {}
496
497/// Represents a textual expression in the Common Expression Language (CEL) syntax. CEL is a C-like expression language. The syntax and semantics of CEL are documented at https://github.com/google/cel-spec. Example (Comparison): title: "Summary size limit" description: "Determines if a summary is less than 100 chars" expression: "document.summary.size() < 100" Example (Equality): title: "Requestor is owner" description: "Determines if requestor is the document owner" expression: "document.owner == request.auth.claims.email" Example (Logic): title: "Public documents" description: "Determine whether the document should be publicly visible" expression: "document.type != 'private' && document.type != 'internal'" Example (Data Manipulation): title: "Notification string" description: "Create a notification string with a timestamp." expression: "'New message received at ' + string(document.create_time)" The exact variables and functions that may be referenced within an expression are determined by the service that evaluates it. See the service documentation for additional information.
498///
499/// This type is not used in any activity, and only used as *part* of another schema.
500///
501#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
502#[serde_with::serde_as]
503#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
504pub struct Expr {
505    /// Optional. Description of the expression. This is a longer text which describes the expression, e.g. when hovered over it in a UI.
506    pub description: Option<String>,
507    /// Textual representation of an expression in Common Expression Language syntax.
508    pub expression: Option<String>,
509    /// Optional. String indicating the location of the expression for error reporting, e.g. a file name and a position in the file.
510    pub location: Option<String>,
511    /// Optional. Title for the expression, i.e. a short string describing its purpose. This can be used e.g. in UIs which allow to enter the expression.
512    pub title: Option<String>,
513}
514
515impl common::Part for Expr {}
516
517/// ExtendSchemaRequest is the request message for ExtendSchema method.
518///
519/// # Activities
520///
521/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
522/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
523///
524/// * [locations global domains extend schema projects](ProjectLocationGlobalDomainExtendSchemaCall) (request)
525#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
526#[serde_with::serde_as]
527#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
528pub struct ExtendSchemaRequest {
529    /// Required. Description for Schema Change.
530    pub description: Option<String>,
531    /// File uploaded as a byte stream input.
532    #[serde(rename = "fileContents")]
533    #[serde_as(as = "Option<common::serde::standard_base64::Wrapper>")]
534    pub file_contents: Option<Vec<u8>>,
535    /// File stored in Cloud Storage bucket and represented in the form projects/{project_id}/buckets/{bucket_name}/objects/{object_name} File should be in the same project as the domain.
536    #[serde(rename = "gcsPath")]
537    pub gcs_path: Option<String>,
538}
539
540impl common::RequestValue for ExtendSchemaRequest {}
541
542/// LDAPSSettings represents the ldaps settings for domain resource. LDAP is the Lightweight Directory Access Protocol, defined in https://tools.ietf.org/html/rfc4511. The settings object configures LDAP over SSL/TLS, whether it is over port 636 or the StartTLS operation. If LDAPSSettings is being changed, it will be placed into the UPDATING state, which indicates that the resource is being reconciled. At this point, Get will reflect an intermediate state.
543///
544/// # Activities
545///
546/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
547/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
548///
549/// * [locations global domains get ldapssettings projects](ProjectLocationGlobalDomainGetLdapssettingCall) (response)
550/// * [locations global domains update ldapssettings projects](ProjectLocationGlobalDomainUpdateLdapssettingCall) (request)
551#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
552#[serde_with::serde_as]
553#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
554pub struct LDAPSSettings {
555    /// Output only. The certificate used to configure LDAPS. Certificates can be chained with a maximum length of 15.
556    pub certificate: Option<Certificate>,
557    /// Input only. The password used to encrypt the uploaded PFX certificate.
558    #[serde(rename = "certificatePassword")]
559    pub certificate_password: Option<String>,
560    /// Input only. The uploaded PKCS12-formatted certificate to configure LDAPS with. It will enable the domain controllers in this domain to accept LDAPS connections (either LDAP over SSL/TLS or the StartTLS operation). A valid certificate chain must form a valid x.509 certificate chain (or be comprised of a single self-signed certificate. It must be encrypted with either: 1) PBES2 + PBKDF2 + AES256 encryption and SHA256 PRF; or 2) pbeWithSHA1And3-KeyTripleDES-CBC Private key must be included for the leaf / single self-signed certificate. Note: For a fqdn your-example-domain.com, the wildcard fqdn is *.your-example-domain.com. Specifically the leaf certificate must have: - Either a blank subject or a subject with CN matching the wildcard fqdn. - Exactly two SANs - the fqdn and wildcard fqdn. - Encipherment and digital key signature key usages. - Server authentication extended key usage (OID=1.3.6.1.5.5.7.3.1) - Private key must be in one of the following formats: RSA, ECDSA, ED25519. - Private key must have appropriate key length: 2048 for RSA, 256 for ECDSA - Signature algorithm of the leaf certificate cannot be MD2, MD5 or SHA1.
561    #[serde(rename = "certificatePfx")]
562    #[serde_as(as = "Option<common::serde::standard_base64::Wrapper>")]
563    pub certificate_pfx: Option<Vec<u8>>,
564    /// The resource name of the LDAPS settings. Uses the form: `projects/{project}/locations/{location}/domains/{domain}`.
565    pub name: Option<String>,
566    /// Output only. The current state of this LDAPS settings.
567    pub state: Option<String>,
568    /// Output only. Last update time.
569    #[serde(rename = "updateTime")]
570    pub update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
571}
572
573impl common::RequestValue for LDAPSSettings {}
574impl common::ResponseResult for LDAPSSettings {}
575
576/// ListBackupsResponse is the response message for ListBackups method.
577///
578/// # Activities
579///
580/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
581/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
582///
583/// * [locations global domains backups list projects](ProjectLocationGlobalDomainBackupListCall) (response)
584#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
585#[serde_with::serde_as]
586#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
587pub struct ListBackupsResponse {
588    /// A list of Cloud AD backups in the domain.
589    pub backups: Option<Vec<Backup>>,
590    /// Token to retrieve the next page of results, or empty if there are no more results in the list.
591    #[serde(rename = "nextPageToken")]
592    pub next_page_token: Option<String>,
593    /// Locations that could not be reached.
594    pub unreachable: Option<Vec<String>>,
595}
596
597impl common::ResponseResult for ListBackupsResponse {}
598
599/// Response message for ListDomains
600///
601/// # Activities
602///
603/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
604/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
605///
606/// * [locations global domains list projects](ProjectLocationGlobalDomainListCall) (response)
607#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
608#[serde_with::serde_as]
609#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
610pub struct ListDomainsResponse {
611    /// A list of Managed Identities Service domains in the project.
612    pub domains: Option<Vec<Domain>>,
613    /// A token to retrieve the next page of results, or empty if there are no more results in the list.
614    #[serde(rename = "nextPageToken")]
615    pub next_page_token: Option<String>,
616    /// A list of locations that could not be reached.
617    pub unreachable: Option<Vec<String>>,
618}
619
620impl common::ResponseResult for ListDomainsResponse {}
621
622/// The response message for Locations.ListLocations.
623///
624/// # Activities
625///
626/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
627/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
628///
629/// * [locations list projects](ProjectLocationListCall) (response)
630#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
631#[serde_with::serde_as]
632#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
633pub struct ListLocationsResponse {
634    /// A list of locations that matches the specified filter in the request.
635    pub locations: Option<Vec<Location>>,
636    /// The standard List next-page token.
637    #[serde(rename = "nextPageToken")]
638    pub next_page_token: Option<String>,
639}
640
641impl common::ResponseResult for ListLocationsResponse {}
642
643/// The response message for Operations.ListOperations.
644///
645/// # Activities
646///
647/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
648/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
649///
650/// * [locations global operations list projects](ProjectLocationGlobalOperationListCall) (response)
651#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
652#[serde_with::serde_as]
653#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
654pub struct ListOperationsResponse {
655    /// The standard List next-page token.
656    #[serde(rename = "nextPageToken")]
657    pub next_page_token: Option<String>,
658    /// A list of operations that matches the specified filter in the request.
659    pub operations: Option<Vec<Operation>>,
660}
661
662impl common::ResponseResult for ListOperationsResponse {}
663
664/// ListPeeringsResponse is the response message for ListPeerings method.
665///
666/// # Activities
667///
668/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
669/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
670///
671/// * [locations global peerings list projects](ProjectLocationGlobalPeeringListCall) (response)
672#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
673#[serde_with::serde_as]
674#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
675pub struct ListPeeringsResponse {
676    /// Token to retrieve the next page of results, or empty if there are no more results in the list.
677    #[serde(rename = "nextPageToken")]
678    pub next_page_token: Option<String>,
679    /// A list of Managed Identities Service Peerings in the project.
680    pub peerings: Option<Vec<Peering>>,
681    /// Locations that could not be reached.
682    pub unreachable: Option<Vec<String>>,
683}
684
685impl common::ResponseResult for ListPeeringsResponse {}
686
687/// ListSqlIntegrationsResponse is the response message for ListSqlIntegrations method.
688///
689/// # Activities
690///
691/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
692/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
693///
694/// * [locations global domains sql integrations list projects](ProjectLocationGlobalDomainSqlIntegrationListCall) (response)
695#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
696#[serde_with::serde_as]
697#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
698pub struct ListSqlIntegrationsResponse {
699    /// Token to retrieve the next page of results, or empty if there are no more results in the list.
700    #[serde(rename = "nextPageToken")]
701    pub next_page_token: Option<String>,
702    /// A list of SQLIntegrations of a domain.
703    #[serde(rename = "sqlIntegrations")]
704    pub sql_integrations: Option<Vec<SqlIntegration>>,
705    /// A list of locations that could not be reached.
706    pub unreachable: Option<Vec<String>>,
707}
708
709impl common::ResponseResult for ListSqlIntegrationsResponse {}
710
711/// A resource that represents a Google Cloud location.
712///
713/// # Activities
714///
715/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
716/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
717///
718/// * [locations get projects](ProjectLocationGetCall) (response)
719#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
720#[serde_with::serde_as]
721#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
722pub struct Location {
723    /// The friendly name for this location, typically a nearby city name. For example, "Tokyo".
724    #[serde(rename = "displayName")]
725    pub display_name: Option<String>,
726    /// Cross-service attributes for the location. For example {"cloud.googleapis.com/region": "us-east1"}
727    pub labels: Option<HashMap<String, String>>,
728    /// The canonical id for this location. For example: `"us-east1"`.
729    #[serde(rename = "locationId")]
730    pub location_id: Option<String>,
731    /// Service-specific metadata. For example the available capacity at the given location.
732    pub metadata: Option<HashMap<String, serde_json::Value>>,
733    /// Resource name for the location, which may vary between implementations. For example: `"projects/example-project/locations/us-east1"`
734    pub name: Option<String>,
735}
736
737impl common::ResponseResult for Location {}
738
739/// OnPremDomainDetails is the message which contains details of on-prem domain which is trusted and needs to be migrated.
740///
741/// This type is not used in any activity, and only used as *part* of another schema.
742///
743#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
744#[serde_with::serde_as]
745#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
746pub struct OnPremDomainDetails {
747    /// Optional. Option to disable SID filtering.
748    #[serde(rename = "disableSidFiltering")]
749    pub disable_sid_filtering: Option<bool>,
750    /// Required. FQDN of the on-prem domain being migrated.
751    #[serde(rename = "domainName")]
752    pub domain_name: Option<String>,
753}
754
755impl common::Part for OnPremDomainDetails {}
756
757/// OnPremDomainDetails is the message which contains details of on-prem domain which is trusted and needs to be migrated.
758///
759/// This type is not used in any activity, and only used as *part* of another schema.
760///
761#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
762#[serde_with::serde_as]
763#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
764pub struct OnPremDomainSIDDetails {
765    /// FQDN of the on-prem domain being migrated.
766    pub name: Option<String>,
767    /// Current SID filtering state.
768    #[serde(rename = "sidFilteringState")]
769    pub sid_filtering_state: Option<String>,
770}
771
772impl common::Part for OnPremDomainSIDDetails {}
773
774/// This resource represents a long-running operation that is the result of a network API call.
775///
776/// # Activities
777///
778/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
779/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
780///
781/// * [locations global domains backups create projects](ProjectLocationGlobalDomainBackupCreateCall) (response)
782/// * [locations global domains backups delete projects](ProjectLocationGlobalDomainBackupDeleteCall) (response)
783/// * [locations global domains backups patch projects](ProjectLocationGlobalDomainBackupPatchCall) (response)
784/// * [locations global domains attach trust projects](ProjectLocationGlobalDomainAttachTrustCall) (response)
785/// * [locations global domains create projects](ProjectLocationGlobalDomainCreateCall) (response)
786/// * [locations global domains delete projects](ProjectLocationGlobalDomainDeleteCall) (response)
787/// * [locations global domains detach trust projects](ProjectLocationGlobalDomainDetachTrustCall) (response)
788/// * [locations global domains disable migration projects](ProjectLocationGlobalDomainDisableMigrationCall) (response)
789/// * [locations global domains enable migration projects](ProjectLocationGlobalDomainEnableMigrationCall) (response)
790/// * [locations global domains extend schema projects](ProjectLocationGlobalDomainExtendSchemaCall) (response)
791/// * [locations global domains patch projects](ProjectLocationGlobalDomainPatchCall) (response)
792/// * [locations global domains reconfigure trust projects](ProjectLocationGlobalDomainReconfigureTrustCall) (response)
793/// * [locations global domains restore projects](ProjectLocationGlobalDomainRestoreCall) (response)
794/// * [locations global domains update ldapssettings projects](ProjectLocationGlobalDomainUpdateLdapssettingCall) (response)
795/// * [locations global domains validate trust projects](ProjectLocationGlobalDomainValidateTrustCall) (response)
796/// * [locations global operations get projects](ProjectLocationGlobalOperationGetCall) (response)
797/// * [locations global peerings create projects](ProjectLocationGlobalPeeringCreateCall) (response)
798/// * [locations global peerings delete projects](ProjectLocationGlobalPeeringDeleteCall) (response)
799/// * [locations global peerings patch projects](ProjectLocationGlobalPeeringPatchCall) (response)
800#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
801#[serde_with::serde_as]
802#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
803pub struct Operation {
804    /// 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.
805    pub done: Option<bool>,
806    /// The error result of the operation in case of failure or cancellation.
807    pub error: Option<Status>,
808    /// 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.
809    pub metadata: Option<HashMap<String, serde_json::Value>>,
810    /// 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}`.
811    pub name: Option<String>,
812    /// 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`.
813    pub response: Option<HashMap<String, serde_json::Value>>,
814}
815
816impl common::ResponseResult for Operation {}
817
818/// Represents a Managed Service for Microsoft Active Directory Peering.
819///
820/// # Activities
821///
822/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
823/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
824///
825/// * [locations global peerings create projects](ProjectLocationGlobalPeeringCreateCall) (request)
826/// * [locations global peerings get projects](ProjectLocationGlobalPeeringGetCall) (response)
827/// * [locations global peerings patch projects](ProjectLocationGlobalPeeringPatchCall) (request)
828#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
829#[serde_with::serde_as]
830#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
831pub struct Peering {
832    /// Required. The full names of the Google Compute Engine [networks](https://cloud.google.com/compute/docs/networks-and-firewalls#networks) to which the instance is connected. Caller needs to make sure that CIDR subnets do not overlap between networks, else peering creation will fail.
833    #[serde(rename = "authorizedNetwork")]
834    pub authorized_network: Option<String>,
835    /// Output only. The time the instance was created.
836    #[serde(rename = "createTime")]
837    pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
838    /// Required. Full domain resource path for the Managed AD Domain involved in peering. The resource path should be in the form: `projects/{project_id}/locations/global/domains/{domain_name}`
839    #[serde(rename = "domainResource")]
840    pub domain_resource: Option<String>,
841    /// Optional. Resource labels to represent user-provided metadata.
842    pub labels: Option<HashMap<String, String>>,
843    /// Output only. Unique name of the peering in this scope including projects and location using the form: `projects/{project_id}/locations/global/peerings/{peering_id}`.
844    pub name: Option<String>,
845    /// Output only. The current state of this Peering.
846    pub state: Option<String>,
847    /// Output only. Additional information about the current status of this peering, if available.
848    #[serde(rename = "statusMessage")]
849    pub status_message: Option<String>,
850    /// Output only. Last update time.
851    #[serde(rename = "updateTime")]
852    pub update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
853}
854
855impl common::RequestValue for Peering {}
856impl common::ResponseResult for Peering {}
857
858/// An Identity and Access Management (IAM) policy, which specifies access controls for Google Cloud resources. A `Policy` is a collection of `bindings`. A `binding` binds one or more `members`, or principals, to a single `role`. Principals can be user accounts, service accounts, Google groups, and domains (such as G Suite). A `role` is a named list of permissions; each `role` can be an IAM predefined role or a user-created custom role. For some types of Google Cloud resources, a `binding` can also specify a `condition`, which is a logical expression that allows access to a resource only if the expression evaluates to `true`. A condition can add constraints based on attributes of the request, the resource, or both. To learn which resources support conditions in their IAM policies, see the [IAM documentation](https://cloud.google.com/iam/help/conditions/resource-policies). **JSON example:** `{ "bindings": [ { "role": "roles/resourcemanager.organizationAdmin", "members": [ "user:mike@example.com", "group:admins@example.com", "domain:google.com", "serviceAccount:my-project-id@appspot.gserviceaccount.com" ] }, { "role": "roles/resourcemanager.organizationViewer", "members": [ "user:eve@example.com" ], "condition": { "title": "expirable access", "description": "Does not grant access after Sep 2020", "expression": "request.time < timestamp('2020-10-01T00:00:00.000Z')", } } ], "etag": "BwWWja0YfJA=", "version": 3 }` **YAML example:** `bindings: - members: - user:mike@example.com - group:admins@example.com - domain:google.com - serviceAccount:my-project-id@appspot.gserviceaccount.com role: roles/resourcemanager.organizationAdmin - members: - user:eve@example.com role: roles/resourcemanager.organizationViewer condition: title: expirable access description: Does not grant access after Sep 2020 expression: request.time < timestamp('2020-10-01T00:00:00.000Z') etag: BwWWja0YfJA= version: 3` For a description of IAM and its features, see the [IAM documentation](https://cloud.google.com/iam/docs/).
859///
860/// # Activities
861///
862/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
863/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
864///
865/// * [locations global domains backups get iam policy projects](ProjectLocationGlobalDomainBackupGetIamPolicyCall) (response)
866/// * [locations global domains backups set iam policy projects](ProjectLocationGlobalDomainBackupSetIamPolicyCall) (response)
867/// * [locations global domains get iam policy projects](ProjectLocationGlobalDomainGetIamPolicyCall) (response)
868/// * [locations global domains set iam policy projects](ProjectLocationGlobalDomainSetIamPolicyCall) (response)
869/// * [locations global peerings get iam policy projects](ProjectLocationGlobalPeeringGetIamPolicyCall) (response)
870/// * [locations global peerings set iam policy projects](ProjectLocationGlobalPeeringSetIamPolicyCall) (response)
871#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
872#[serde_with::serde_as]
873#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
874pub struct Policy {
875    /// Associates a list of `members`, or principals, with a `role`. Optionally, may specify a `condition` that determines how and when the `bindings` are applied. Each of the `bindings` must contain at least one principal. The `bindings` in a `Policy` can refer to up to 1,500 principals; up to 250 of these principals can be Google groups. Each occurrence of a principal counts towards these limits. For example, if the `bindings` grant 50 different roles to `user:alice@example.com`, and not to any other principal, then you can add another 1,450 principals to the `bindings` in the `Policy`.
876    pub bindings: Option<Vec<Binding>>,
877    /// `etag` is used for optimistic concurrency control as a way to help prevent simultaneous updates of a policy from overwriting each other. It is strongly suggested that systems make use of the `etag` in the read-modify-write cycle to perform policy updates in order to avoid race conditions: An `etag` is returned in the response to `getIamPolicy`, and systems are expected to put that etag in the request to `setIamPolicy` to ensure that their change will be applied to the same version of the policy. **Important:** If you use IAM Conditions, you must include the `etag` field whenever you call `setIamPolicy`. If you omit this field, then IAM allows you to overwrite a version `3` policy with a version `1` policy, and all of the conditions in the version `3` policy are lost.
878    #[serde_as(as = "Option<common::serde::standard_base64::Wrapper>")]
879    pub etag: Option<Vec<u8>>,
880    /// Specifies the format of the policy. Valid values are `0`, `1`, and `3`. Requests that specify an invalid value are rejected. Any operation that affects conditional role bindings must specify version `3`. This requirement applies to the following operations: * Getting a policy that includes a conditional role binding * Adding a conditional role binding to a policy * Changing a conditional role binding in a policy * Removing any role binding, with or without a condition, from a policy that includes conditions **Important:** If you use IAM Conditions, you must include the `etag` field whenever you call `setIamPolicy`. If you omit this field, then IAM allows you to overwrite a version `3` policy with a version `1` policy, and all of the conditions in the version `3` policy are lost. If a policy does not include any conditions, operations on that policy may specify any valid version or leave the field unset. To learn which resources support conditions in their IAM policies, see the [IAM documentation](https://cloud.google.com/iam/help/conditions/resource-policies).
881    pub version: Option<i32>,
882}
883
884impl common::ResponseResult for Policy {}
885
886/// Request message for ReconfigureTrust
887///
888/// # Activities
889///
890/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
891/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
892///
893/// * [locations global domains reconfigure trust projects](ProjectLocationGlobalDomainReconfigureTrustCall) (request)
894#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
895#[serde_with::serde_as]
896#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
897pub struct ReconfigureTrustRequest {
898    /// Required. The target DNS server IP addresses to resolve the remote domain involved in the trust.
899    #[serde(rename = "targetDnsIpAddresses")]
900    pub target_dns_ip_addresses: Option<Vec<String>>,
901    /// Required. The fully-qualified target domain name which will be in trust with current domain.
902    #[serde(rename = "targetDomainName")]
903    pub target_domain_name: Option<String>,
904}
905
906impl common::RequestValue for ReconfigureTrustRequest {}
907
908/// Request message for ResetAdminPassword
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 global domains reset admin password projects](ProjectLocationGlobalDomainResetAdminPasswordCall) (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 ResetAdminPasswordRequest {
920    _never_set: Option<bool>,
921}
922
923impl common::RequestValue for ResetAdminPasswordRequest {}
924
925/// Response message for ResetAdminPassword
926///
927/// # Activities
928///
929/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
930/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
931///
932/// * [locations global domains reset admin password projects](ProjectLocationGlobalDomainResetAdminPasswordCall) (response)
933#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
934#[serde_with::serde_as]
935#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
936pub struct ResetAdminPasswordResponse {
937    /// A random password. See admin for more information.
938    pub password: Option<String>,
939}
940
941impl common::ResponseResult for ResetAdminPasswordResponse {}
942
943/// RestoreDomainRequest is the request received by RestoreDomain rpc
944///
945/// # Activities
946///
947/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
948/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
949///
950/// * [locations global domains restore projects](ProjectLocationGlobalDomainRestoreCall) (request)
951#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
952#[serde_with::serde_as]
953#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
954pub struct RestoreDomainRequest {
955    /// Required. ID of the backup to be restored
956    #[serde(rename = "backupId")]
957    pub backup_id: Option<String>,
958}
959
960impl common::RequestValue for RestoreDomainRequest {}
961
962/// Request message for `SetIamPolicy` method.
963///
964/// # Activities
965///
966/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
967/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
968///
969/// * [locations global domains backups set iam policy projects](ProjectLocationGlobalDomainBackupSetIamPolicyCall) (request)
970/// * [locations global domains set iam policy projects](ProjectLocationGlobalDomainSetIamPolicyCall) (request)
971/// * [locations global peerings set iam policy projects](ProjectLocationGlobalPeeringSetIamPolicyCall) (request)
972#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
973#[serde_with::serde_as]
974#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
975pub struct SetIamPolicyRequest {
976    /// REQUIRED: The complete policy to be applied to the `resource`. The size of the policy is limited to a few 10s of KB. An empty policy is a valid policy but certain Google Cloud services (such as Projects) might reject them.
977    pub policy: Option<Policy>,
978}
979
980impl common::RequestValue for SetIamPolicyRequest {}
981
982/// Represents the SQL instance integrated with Managed AD.
983///
984/// # Activities
985///
986/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
987/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
988///
989/// * [locations global domains sql integrations get projects](ProjectLocationGlobalDomainSqlIntegrationGetCall) (response)
990#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
991#[serde_with::serde_as]
992#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
993pub struct SqlIntegration {
994    /// Output only. The time the SQL integration was created.
995    #[serde(rename = "createTime")]
996    pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
997    /// The unique name of the SQL integration in the form of `projects/{project_id}/locations/global/domains/{domain_name}/sqlIntegrations/{sql_integration}`
998    pub name: Option<String>,
999    /// The full resource name of an integrated SQL instance
1000    #[serde(rename = "sqlInstance")]
1001    pub sql_instance: Option<String>,
1002    /// Output only. The current state of the SQL integration.
1003    pub state: Option<String>,
1004    /// Output only. The time the SQL integration was updated.
1005    #[serde(rename = "updateTime")]
1006    pub update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1007}
1008
1009impl common::ResponseResult for SqlIntegration {}
1010
1011/// 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).
1012///
1013/// This type is not used in any activity, and only used as *part* of another schema.
1014///
1015#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1016#[serde_with::serde_as]
1017#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1018pub struct Status {
1019    /// The status code, which should be an enum value of google.rpc.Code.
1020    pub code: Option<i32>,
1021    /// A list of messages that carry the error details. There is a common set of message types for APIs to use.
1022    pub details: Option<Vec<HashMap<String, serde_json::Value>>>,
1023    /// 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.
1024    pub message: Option<String>,
1025}
1026
1027impl common::Part for Status {}
1028
1029/// Request message for `TestIamPermissions` method.
1030///
1031/// # Activities
1032///
1033/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1034/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1035///
1036/// * [locations global domains backups test iam permissions projects](ProjectLocationGlobalDomainBackupTestIamPermissionCall) (request)
1037/// * [locations global domains test iam permissions projects](ProjectLocationGlobalDomainTestIamPermissionCall) (request)
1038/// * [locations global peerings test iam permissions projects](ProjectLocationGlobalPeeringTestIamPermissionCall) (request)
1039#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1040#[serde_with::serde_as]
1041#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1042pub struct TestIamPermissionsRequest {
1043    /// The set of permissions to check for the `resource`. Permissions with wildcards (such as `*` or `storage.*`) are not allowed. For more information see [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions).
1044    pub permissions: Option<Vec<String>>,
1045}
1046
1047impl common::RequestValue for TestIamPermissionsRequest {}
1048
1049/// Response message for `TestIamPermissions` method.
1050///
1051/// # Activities
1052///
1053/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1054/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1055///
1056/// * [locations global domains backups test iam permissions projects](ProjectLocationGlobalDomainBackupTestIamPermissionCall) (response)
1057/// * [locations global domains test iam permissions projects](ProjectLocationGlobalDomainTestIamPermissionCall) (response)
1058/// * [locations global peerings test iam permissions projects](ProjectLocationGlobalPeeringTestIamPermissionCall) (response)
1059#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1060#[serde_with::serde_as]
1061#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1062pub struct TestIamPermissionsResponse {
1063    /// A subset of `TestPermissionsRequest.permissions` that the caller is allowed.
1064    pub permissions: Option<Vec<String>>,
1065}
1066
1067impl common::ResponseResult for TestIamPermissionsResponse {}
1068
1069/// Represents a relationship between two domains. This allows a controller in one domain to authenticate a user in another domain. If the trust is being changed, it will be placed into the UPDATING state, which indicates that the resource is being reconciled. At this point, Get will reflect an intermediate state.
1070///
1071/// This type is not used in any activity, and only used as *part* of another schema.
1072///
1073#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1074#[serde_with::serde_as]
1075#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1076pub struct Trust {
1077    /// Output only. The time the instance was created.
1078    #[serde(rename = "createTime")]
1079    pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1080    /// Output only. The last heartbeat time when the trust was known to be connected.
1081    #[serde(rename = "lastTrustHeartbeatTime")]
1082    pub last_trust_heartbeat_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1083    /// Optional. The trust authentication type, which decides whether the trusted side has forest/domain wide access or selective access to an approved set of resources.
1084    #[serde(rename = "selectiveAuthentication")]
1085    pub selective_authentication: Option<bool>,
1086    /// Output only. The current state of the trust.
1087    pub state: Option<String>,
1088    /// Output only. Additional information about the current state of the trust, if available.
1089    #[serde(rename = "stateDescription")]
1090    pub state_description: Option<String>,
1091    /// Required. The target DNS server IP addresses which can resolve the remote domain involved in the trust.
1092    #[serde(rename = "targetDnsIpAddresses")]
1093    pub target_dns_ip_addresses: Option<Vec<String>>,
1094    /// Required. The fully qualified target domain name which will be in trust with the current domain.
1095    #[serde(rename = "targetDomainName")]
1096    pub target_domain_name: Option<String>,
1097    /// Required. The trust direction, which decides if the current domain is trusted, trusting, or both.
1098    #[serde(rename = "trustDirection")]
1099    pub trust_direction: Option<String>,
1100    /// Required. The trust secret used for the handshake with the target domain. This will not be stored.
1101    #[serde(rename = "trustHandshakeSecret")]
1102    pub trust_handshake_secret: Option<String>,
1103    /// Required. The type of trust represented by the trust resource.
1104    #[serde(rename = "trustType")]
1105    pub trust_type: Option<String>,
1106    /// Output only. The last update time.
1107    #[serde(rename = "updateTime")]
1108    pub update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1109}
1110
1111impl common::Part for Trust {}
1112
1113/// Request message for ValidateTrust
1114///
1115/// # Activities
1116///
1117/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1118/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1119///
1120/// * [locations global domains validate trust projects](ProjectLocationGlobalDomainValidateTrustCall) (request)
1121#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1122#[serde_with::serde_as]
1123#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1124pub struct ValidateTrustRequest {
1125    /// Required. The domain trust to validate trust state for.
1126    pub trust: Option<Trust>,
1127}
1128
1129impl common::RequestValue for ValidateTrustRequest {}
1130
1131// ###################
1132// MethodBuilders ###
1133// #################
1134
1135/// A builder providing access to all methods supported on *project* resources.
1136/// It is not used directly, but through the [`ManagedServiceForMicrosoftActiveDirectoryConsumerAPI`] hub.
1137///
1138/// # Example
1139///
1140/// Instantiate a resource builder
1141///
1142/// ```test_harness,no_run
1143/// extern crate hyper;
1144/// extern crate hyper_rustls;
1145/// extern crate google_managedidentities1 as managedidentities1;
1146///
1147/// # async fn dox() {
1148/// use managedidentities1::{ManagedServiceForMicrosoftActiveDirectoryConsumerAPI, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
1149///
1150/// let secret: yup_oauth2::ApplicationSecret = Default::default();
1151/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
1152///     .with_native_roots()
1153///     .unwrap()
1154///     .https_only()
1155///     .enable_http2()
1156///     .build();
1157///
1158/// let executor = hyper_util::rt::TokioExecutor::new();
1159/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
1160///     secret,
1161///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
1162///     yup_oauth2::client::CustomHyperClientBuilder::from(
1163///         hyper_util::client::legacy::Client::builder(executor).build(connector),
1164///     ),
1165/// ).build().await.unwrap();
1166///
1167/// let client = hyper_util::client::legacy::Client::builder(
1168///     hyper_util::rt::TokioExecutor::new()
1169/// )
1170/// .build(
1171///     hyper_rustls::HttpsConnectorBuilder::new()
1172///         .with_native_roots()
1173///         .unwrap()
1174///         .https_or_http()
1175///         .enable_http2()
1176///         .build()
1177/// );
1178/// let mut hub = ManagedServiceForMicrosoftActiveDirectoryConsumerAPI::new(client, auth);
1179/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
1180/// // like `locations_get(...)`, `locations_global_domains_attach_trust(...)`, `locations_global_domains_backups_create(...)`, `locations_global_domains_backups_delete(...)`, `locations_global_domains_backups_get(...)`, `locations_global_domains_backups_get_iam_policy(...)`, `locations_global_domains_backups_list(...)`, `locations_global_domains_backups_patch(...)`, `locations_global_domains_backups_set_iam_policy(...)`, `locations_global_domains_backups_test_iam_permissions(...)`, `locations_global_domains_check_migration_permission(...)`, `locations_global_domains_create(...)`, `locations_global_domains_delete(...)`, `locations_global_domains_detach_trust(...)`, `locations_global_domains_disable_migration(...)`, `locations_global_domains_domain_join_machine(...)`, `locations_global_domains_enable_migration(...)`, `locations_global_domains_extend_schema(...)`, `locations_global_domains_get(...)`, `locations_global_domains_get_iam_policy(...)`, `locations_global_domains_get_ldapssettings(...)`, `locations_global_domains_list(...)`, `locations_global_domains_patch(...)`, `locations_global_domains_reconfigure_trust(...)`, `locations_global_domains_reset_admin_password(...)`, `locations_global_domains_restore(...)`, `locations_global_domains_set_iam_policy(...)`, `locations_global_domains_sql_integrations_get(...)`, `locations_global_domains_sql_integrations_list(...)`, `locations_global_domains_test_iam_permissions(...)`, `locations_global_domains_update_ldapssettings(...)`, `locations_global_domains_validate_trust(...)`, `locations_global_operations_cancel(...)`, `locations_global_operations_delete(...)`, `locations_global_operations_get(...)`, `locations_global_operations_list(...)`, `locations_global_peerings_create(...)`, `locations_global_peerings_delete(...)`, `locations_global_peerings_get(...)`, `locations_global_peerings_get_iam_policy(...)`, `locations_global_peerings_list(...)`, `locations_global_peerings_patch(...)`, `locations_global_peerings_set_iam_policy(...)`, `locations_global_peerings_test_iam_permissions(...)` and `locations_list(...)`
1181/// // to build up your call.
1182/// let rb = hub.projects();
1183/// # }
1184/// ```
1185pub struct ProjectMethods<'a, C>
1186where
1187    C: 'a,
1188{
1189    hub: &'a ManagedServiceForMicrosoftActiveDirectoryConsumerAPI<C>,
1190}
1191
1192impl<'a, C> common::MethodsBuilder for ProjectMethods<'a, C> {}
1193
1194impl<'a, C> ProjectMethods<'a, C> {
1195    /// Create a builder to help you perform the following task:
1196    ///
1197    /// Creates a Backup for a domain.
1198    ///
1199    /// # Arguments
1200    ///
1201    /// * `request` - No description provided.
1202    /// * `parent` - Required. The domain resource name using the form: `projects/{project_id}/locations/global/domains/{domain_name}`
1203    pub fn locations_global_domains_backups_create(
1204        &self,
1205        request: Backup,
1206        parent: &str,
1207    ) -> ProjectLocationGlobalDomainBackupCreateCall<'a, C> {
1208        ProjectLocationGlobalDomainBackupCreateCall {
1209            hub: self.hub,
1210            _request: request,
1211            _parent: parent.to_string(),
1212            _backup_id: Default::default(),
1213            _delegate: Default::default(),
1214            _additional_params: Default::default(),
1215            _scopes: Default::default(),
1216        }
1217    }
1218
1219    /// Create a builder to help you perform the following task:
1220    ///
1221    /// Deletes identified Backup.
1222    ///
1223    /// # Arguments
1224    ///
1225    /// * `name` - Required. The backup resource name using the form: `projects/{project_id}/locations/global/domains/{domain_name}/backups/{backup_id}`
1226    pub fn locations_global_domains_backups_delete(
1227        &self,
1228        name: &str,
1229    ) -> ProjectLocationGlobalDomainBackupDeleteCall<'a, C> {
1230        ProjectLocationGlobalDomainBackupDeleteCall {
1231            hub: self.hub,
1232            _name: name.to_string(),
1233            _delegate: Default::default(),
1234            _additional_params: Default::default(),
1235            _scopes: Default::default(),
1236        }
1237    }
1238
1239    /// Create a builder to help you perform the following task:
1240    ///
1241    /// Gets details of a single Backup.
1242    ///
1243    /// # Arguments
1244    ///
1245    /// * `name` - Required. The backup resource name using the form: `projects/{project_id}/locations/global/domains/{domain_name}/backups/{backup_id}`
1246    pub fn locations_global_domains_backups_get(
1247        &self,
1248        name: &str,
1249    ) -> ProjectLocationGlobalDomainBackupGetCall<'a, C> {
1250        ProjectLocationGlobalDomainBackupGetCall {
1251            hub: self.hub,
1252            _name: name.to_string(),
1253            _delegate: Default::default(),
1254            _additional_params: Default::default(),
1255            _scopes: Default::default(),
1256        }
1257    }
1258
1259    /// Create a builder to help you perform the following task:
1260    ///
1261    /// Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.
1262    ///
1263    /// # Arguments
1264    ///
1265    /// * `resource` - REQUIRED: The resource for which the policy is being requested. See [Resource names](https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
1266    pub fn locations_global_domains_backups_get_iam_policy(
1267        &self,
1268        resource: &str,
1269    ) -> ProjectLocationGlobalDomainBackupGetIamPolicyCall<'a, C> {
1270        ProjectLocationGlobalDomainBackupGetIamPolicyCall {
1271            hub: self.hub,
1272            _resource: resource.to_string(),
1273            _options_requested_policy_version: Default::default(),
1274            _delegate: Default::default(),
1275            _additional_params: Default::default(),
1276            _scopes: Default::default(),
1277        }
1278    }
1279
1280    /// Create a builder to help you perform the following task:
1281    ///
1282    /// Lists Backup in a given project.
1283    ///
1284    /// # Arguments
1285    ///
1286    /// * `parent` - Required. The domain resource name using the form: `projects/{project_id}/locations/global/domains/{domain_name}`
1287    pub fn locations_global_domains_backups_list(
1288        &self,
1289        parent: &str,
1290    ) -> ProjectLocationGlobalDomainBackupListCall<'a, C> {
1291        ProjectLocationGlobalDomainBackupListCall {
1292            hub: self.hub,
1293            _parent: parent.to_string(),
1294            _page_token: Default::default(),
1295            _page_size: Default::default(),
1296            _order_by: Default::default(),
1297            _filter: Default::default(),
1298            _delegate: Default::default(),
1299            _additional_params: Default::default(),
1300            _scopes: Default::default(),
1301        }
1302    }
1303
1304    /// Create a builder to help you perform the following task:
1305    ///
1306    /// Updates the labels for specified Backup.
1307    ///
1308    /// # Arguments
1309    ///
1310    /// * `request` - No description provided.
1311    /// * `name` - Output only. The unique name of the Backup in the form of `projects/{project_id}/locations/global/domains/{domain_name}/backups/{name}`
1312    pub fn locations_global_domains_backups_patch(
1313        &self,
1314        request: Backup,
1315        name: &str,
1316    ) -> ProjectLocationGlobalDomainBackupPatchCall<'a, C> {
1317        ProjectLocationGlobalDomainBackupPatchCall {
1318            hub: self.hub,
1319            _request: request,
1320            _name: name.to_string(),
1321            _update_mask: Default::default(),
1322            _delegate: Default::default(),
1323            _additional_params: Default::default(),
1324            _scopes: Default::default(),
1325        }
1326    }
1327
1328    /// Create a builder to help you perform the following task:
1329    ///
1330    /// Sets the access control policy on the specified resource. Replaces any existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` errors.
1331    ///
1332    /// # Arguments
1333    ///
1334    /// * `request` - No description provided.
1335    /// * `resource` - REQUIRED: The resource for which the policy is being specified. See [Resource names](https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
1336    pub fn locations_global_domains_backups_set_iam_policy(
1337        &self,
1338        request: SetIamPolicyRequest,
1339        resource: &str,
1340    ) -> ProjectLocationGlobalDomainBackupSetIamPolicyCall<'a, C> {
1341        ProjectLocationGlobalDomainBackupSetIamPolicyCall {
1342            hub: self.hub,
1343            _request: request,
1344            _resource: resource.to_string(),
1345            _delegate: Default::default(),
1346            _additional_params: Default::default(),
1347            _scopes: Default::default(),
1348        }
1349    }
1350
1351    /// Create a builder to help you perform the following task:
1352    ///
1353    /// Returns permissions that a caller has on the specified resource. If the resource does not exist, this will return an empty set of permissions, not a `NOT_FOUND` error. Note: This operation is designed to be used for building permission-aware UIs and command-line tools, not for authorization checking. This operation may "fail open" without warning.
1354    ///
1355    /// # Arguments
1356    ///
1357    /// * `request` - No description provided.
1358    /// * `resource` - REQUIRED: The resource for which the policy detail is being requested. See [Resource names](https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
1359    pub fn locations_global_domains_backups_test_iam_permissions(
1360        &self,
1361        request: TestIamPermissionsRequest,
1362        resource: &str,
1363    ) -> ProjectLocationGlobalDomainBackupTestIamPermissionCall<'a, C> {
1364        ProjectLocationGlobalDomainBackupTestIamPermissionCall {
1365            hub: self.hub,
1366            _request: request,
1367            _resource: resource.to_string(),
1368            _delegate: Default::default(),
1369            _additional_params: Default::default(),
1370            _scopes: Default::default(),
1371        }
1372    }
1373
1374    /// Create a builder to help you perform the following task:
1375    ///
1376    /// Gets details of a single sqlIntegration.
1377    ///
1378    /// # Arguments
1379    ///
1380    /// * `name` - Required. SQLIntegration resource name using the form: `projects/{project_id}/locations/global/domains/{domain}/sqlIntegrations/{name}`
1381    pub fn locations_global_domains_sql_integrations_get(
1382        &self,
1383        name: &str,
1384    ) -> ProjectLocationGlobalDomainSqlIntegrationGetCall<'a, C> {
1385        ProjectLocationGlobalDomainSqlIntegrationGetCall {
1386            hub: self.hub,
1387            _name: name.to_string(),
1388            _delegate: Default::default(),
1389            _additional_params: Default::default(),
1390            _scopes: Default::default(),
1391        }
1392    }
1393
1394    /// Create a builder to help you perform the following task:
1395    ///
1396    /// Lists SqlIntegrations in a given domain.
1397    ///
1398    /// # Arguments
1399    ///
1400    /// * `parent` - Required. The resource name of the SqlIntegrations using the form: `projects/{project_id}/locations/global/domains/*`
1401    pub fn locations_global_domains_sql_integrations_list(
1402        &self,
1403        parent: &str,
1404    ) -> ProjectLocationGlobalDomainSqlIntegrationListCall<'a, C> {
1405        ProjectLocationGlobalDomainSqlIntegrationListCall {
1406            hub: self.hub,
1407            _parent: parent.to_string(),
1408            _page_token: Default::default(),
1409            _page_size: Default::default(),
1410            _order_by: Default::default(),
1411            _filter: Default::default(),
1412            _delegate: Default::default(),
1413            _additional_params: Default::default(),
1414            _scopes: Default::default(),
1415        }
1416    }
1417
1418    /// Create a builder to help you perform the following task:
1419    ///
1420    /// Adds an AD trust to a domain.
1421    ///
1422    /// # Arguments
1423    ///
1424    /// * `request` - No description provided.
1425    /// * `name` - Required. The resource domain name, project name and location using the form: `projects/{project_id}/locations/global/domains/{domain_name}`
1426    pub fn locations_global_domains_attach_trust(
1427        &self,
1428        request: AttachTrustRequest,
1429        name: &str,
1430    ) -> ProjectLocationGlobalDomainAttachTrustCall<'a, C> {
1431        ProjectLocationGlobalDomainAttachTrustCall {
1432            hub: self.hub,
1433            _request: request,
1434            _name: name.to_string(),
1435            _delegate: Default::default(),
1436            _additional_params: Default::default(),
1437            _scopes: Default::default(),
1438        }
1439    }
1440
1441    /// Create a builder to help you perform the following task:
1442    ///
1443    /// CheckMigrationPermission API gets the current state of DomainMigration
1444    ///
1445    /// # Arguments
1446    ///
1447    /// * `request` - No description provided.
1448    /// * `domain` - Required. The domain resource name using the form: `projects/{project_id}/locations/global/domains/{domain_name}`
1449    pub fn locations_global_domains_check_migration_permission(
1450        &self,
1451        request: CheckMigrationPermissionRequest,
1452        domain: &str,
1453    ) -> ProjectLocationGlobalDomainCheckMigrationPermissionCall<'a, C> {
1454        ProjectLocationGlobalDomainCheckMigrationPermissionCall {
1455            hub: self.hub,
1456            _request: request,
1457            _domain: domain.to_string(),
1458            _delegate: Default::default(),
1459            _additional_params: Default::default(),
1460            _scopes: Default::default(),
1461        }
1462    }
1463
1464    /// Create a builder to help you perform the following task:
1465    ///
1466    /// Creates a Microsoft AD domain.
1467    ///
1468    /// # Arguments
1469    ///
1470    /// * `request` - No description provided.
1471    /// * `parent` - Required. The resource project name and location using the form: `projects/{project_id}/locations/global`
1472    pub fn locations_global_domains_create(
1473        &self,
1474        request: Domain,
1475        parent: &str,
1476    ) -> ProjectLocationGlobalDomainCreateCall<'a, C> {
1477        ProjectLocationGlobalDomainCreateCall {
1478            hub: self.hub,
1479            _request: request,
1480            _parent: parent.to_string(),
1481            _domain_name: Default::default(),
1482            _delegate: Default::default(),
1483            _additional_params: Default::default(),
1484            _scopes: Default::default(),
1485        }
1486    }
1487
1488    /// Create a builder to help you perform the following task:
1489    ///
1490    /// Deletes a domain.
1491    ///
1492    /// # Arguments
1493    ///
1494    /// * `name` - Required. The domain resource name using the form: `projects/{project_id}/locations/global/domains/{domain_name}`
1495    pub fn locations_global_domains_delete(
1496        &self,
1497        name: &str,
1498    ) -> ProjectLocationGlobalDomainDeleteCall<'a, C> {
1499        ProjectLocationGlobalDomainDeleteCall {
1500            hub: self.hub,
1501            _name: name.to_string(),
1502            _delegate: Default::default(),
1503            _additional_params: Default::default(),
1504            _scopes: Default::default(),
1505        }
1506    }
1507
1508    /// Create a builder to help you perform the following task:
1509    ///
1510    /// Removes an AD trust.
1511    ///
1512    /// # Arguments
1513    ///
1514    /// * `request` - No description provided.
1515    /// * `name` - Required. The resource domain name, project name, and location using the form: `projects/{project_id}/locations/global/domains/{domain_name}`
1516    pub fn locations_global_domains_detach_trust(
1517        &self,
1518        request: DetachTrustRequest,
1519        name: &str,
1520    ) -> ProjectLocationGlobalDomainDetachTrustCall<'a, C> {
1521        ProjectLocationGlobalDomainDetachTrustCall {
1522            hub: self.hub,
1523            _request: request,
1524            _name: name.to_string(),
1525            _delegate: Default::default(),
1526            _additional_params: Default::default(),
1527            _scopes: Default::default(),
1528        }
1529    }
1530
1531    /// Create a builder to help you perform the following task:
1532    ///
1533    /// Disable Domain Migration
1534    ///
1535    /// # Arguments
1536    ///
1537    /// * `request` - No description provided.
1538    /// * `domain` - Required. The domain resource name using the form: `projects/{project_id}/locations/global/domains/{domain_name}`
1539    pub fn locations_global_domains_disable_migration(
1540        &self,
1541        request: DisableMigrationRequest,
1542        domain: &str,
1543    ) -> ProjectLocationGlobalDomainDisableMigrationCall<'a, C> {
1544        ProjectLocationGlobalDomainDisableMigrationCall {
1545            hub: self.hub,
1546            _request: request,
1547            _domain: domain.to_string(),
1548            _delegate: Default::default(),
1549            _additional_params: Default::default(),
1550            _scopes: Default::default(),
1551        }
1552    }
1553
1554    /// Create a builder to help you perform the following task:
1555    ///
1556    /// DomainJoinMachine API joins a Compute Engine VM to the domain
1557    ///
1558    /// # Arguments
1559    ///
1560    /// * `request` - No description provided.
1561    /// * `domain` - Required. The domain resource name using the form: projects/{project_id}/locations/global/domains/{domain_name}
1562    pub fn locations_global_domains_domain_join_machine(
1563        &self,
1564        request: DomainJoinMachineRequest,
1565        domain: &str,
1566    ) -> ProjectLocationGlobalDomainDomainJoinMachineCall<'a, C> {
1567        ProjectLocationGlobalDomainDomainJoinMachineCall {
1568            hub: self.hub,
1569            _request: request,
1570            _domain: domain.to_string(),
1571            _delegate: Default::default(),
1572            _additional_params: Default::default(),
1573            _scopes: Default::default(),
1574        }
1575    }
1576
1577    /// Create a builder to help you perform the following task:
1578    ///
1579    /// Enable Domain Migration
1580    ///
1581    /// # Arguments
1582    ///
1583    /// * `request` - No description provided.
1584    /// * `domain` - Required. The domain resource name using the form: `projects/{project_id}/locations/global/domains/{domain_name}`
1585    pub fn locations_global_domains_enable_migration(
1586        &self,
1587        request: EnableMigrationRequest,
1588        domain: &str,
1589    ) -> ProjectLocationGlobalDomainEnableMigrationCall<'a, C> {
1590        ProjectLocationGlobalDomainEnableMigrationCall {
1591            hub: self.hub,
1592            _request: request,
1593            _domain: domain.to_string(),
1594            _delegate: Default::default(),
1595            _additional_params: Default::default(),
1596            _scopes: Default::default(),
1597        }
1598    }
1599
1600    /// Create a builder to help you perform the following task:
1601    ///
1602    /// Extend Schema for Domain
1603    ///
1604    /// # Arguments
1605    ///
1606    /// * `request` - No description provided.
1607    /// * `domain` - Required. The domain resource name using the form: `projects/{project_id}/locations/global/domains/{domain_name}`
1608    pub fn locations_global_domains_extend_schema(
1609        &self,
1610        request: ExtendSchemaRequest,
1611        domain: &str,
1612    ) -> ProjectLocationGlobalDomainExtendSchemaCall<'a, C> {
1613        ProjectLocationGlobalDomainExtendSchemaCall {
1614            hub: self.hub,
1615            _request: request,
1616            _domain: domain.to_string(),
1617            _delegate: Default::default(),
1618            _additional_params: Default::default(),
1619            _scopes: Default::default(),
1620        }
1621    }
1622
1623    /// Create a builder to help you perform the following task:
1624    ///
1625    /// Gets information about a domain.
1626    ///
1627    /// # Arguments
1628    ///
1629    /// * `name` - Required. The domain resource name using the form: `projects/{project_id}/locations/global/domains/{domain_name}`
1630    pub fn locations_global_domains_get(
1631        &self,
1632        name: &str,
1633    ) -> ProjectLocationGlobalDomainGetCall<'a, C> {
1634        ProjectLocationGlobalDomainGetCall {
1635            hub: self.hub,
1636            _name: name.to_string(),
1637            _delegate: Default::default(),
1638            _additional_params: Default::default(),
1639            _scopes: Default::default(),
1640        }
1641    }
1642
1643    /// Create a builder to help you perform the following task:
1644    ///
1645    /// Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.
1646    ///
1647    /// # Arguments
1648    ///
1649    /// * `resource` - REQUIRED: The resource for which the policy is being requested. See [Resource names](https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
1650    pub fn locations_global_domains_get_iam_policy(
1651        &self,
1652        resource: &str,
1653    ) -> ProjectLocationGlobalDomainGetIamPolicyCall<'a, C> {
1654        ProjectLocationGlobalDomainGetIamPolicyCall {
1655            hub: self.hub,
1656            _resource: resource.to_string(),
1657            _options_requested_policy_version: Default::default(),
1658            _delegate: Default::default(),
1659            _additional_params: Default::default(),
1660            _scopes: Default::default(),
1661        }
1662    }
1663
1664    /// Create a builder to help you perform the following task:
1665    ///
1666    /// Gets the domain ldaps settings.
1667    ///
1668    /// # Arguments
1669    ///
1670    /// * `name` - Required. The domain resource name using the form: `projects/{project_id}/locations/global/domains/{domain_name}`
1671    pub fn locations_global_domains_get_ldapssettings(
1672        &self,
1673        name: &str,
1674    ) -> ProjectLocationGlobalDomainGetLdapssettingCall<'a, C> {
1675        ProjectLocationGlobalDomainGetLdapssettingCall {
1676            hub: self.hub,
1677            _name: name.to_string(),
1678            _delegate: Default::default(),
1679            _additional_params: Default::default(),
1680            _scopes: Default::default(),
1681        }
1682    }
1683
1684    /// Create a builder to help you perform the following task:
1685    ///
1686    /// Lists domains in a project.
1687    ///
1688    /// # Arguments
1689    ///
1690    /// * `parent` - Required. The resource name of the domain location using the form: `projects/{project_id}/locations/global`
1691    pub fn locations_global_domains_list(
1692        &self,
1693        parent: &str,
1694    ) -> ProjectLocationGlobalDomainListCall<'a, C> {
1695        ProjectLocationGlobalDomainListCall {
1696            hub: self.hub,
1697            _parent: parent.to_string(),
1698            _page_token: Default::default(),
1699            _page_size: Default::default(),
1700            _order_by: Default::default(),
1701            _filter: Default::default(),
1702            _delegate: Default::default(),
1703            _additional_params: Default::default(),
1704            _scopes: Default::default(),
1705        }
1706    }
1707
1708    /// Create a builder to help you perform the following task:
1709    ///
1710    /// Updates the metadata and configuration of a domain.
1711    ///
1712    /// # Arguments
1713    ///
1714    /// * `request` - No description provided.
1715    /// * `name` - Required. The unique name of the domain using the form: `projects/{project_id}/locations/global/domains/{domain_name}`.
1716    pub fn locations_global_domains_patch(
1717        &self,
1718        request: Domain,
1719        name: &str,
1720    ) -> ProjectLocationGlobalDomainPatchCall<'a, C> {
1721        ProjectLocationGlobalDomainPatchCall {
1722            hub: self.hub,
1723            _request: request,
1724            _name: name.to_string(),
1725            _update_mask: Default::default(),
1726            _delegate: Default::default(),
1727            _additional_params: Default::default(),
1728            _scopes: Default::default(),
1729        }
1730    }
1731
1732    /// Create a builder to help you perform the following task:
1733    ///
1734    /// Updates the DNS conditional forwarder.
1735    ///
1736    /// # Arguments
1737    ///
1738    /// * `request` - No description provided.
1739    /// * `name` - Required. The resource domain name, project name and location using the form: `projects/{project_id}/locations/global/domains/{domain_name}`
1740    pub fn locations_global_domains_reconfigure_trust(
1741        &self,
1742        request: ReconfigureTrustRequest,
1743        name: &str,
1744    ) -> ProjectLocationGlobalDomainReconfigureTrustCall<'a, C> {
1745        ProjectLocationGlobalDomainReconfigureTrustCall {
1746            hub: self.hub,
1747            _request: request,
1748            _name: name.to_string(),
1749            _delegate: Default::default(),
1750            _additional_params: Default::default(),
1751            _scopes: Default::default(),
1752        }
1753    }
1754
1755    /// Create a builder to help you perform the following task:
1756    ///
1757    /// Resets a domain's administrator password.
1758    ///
1759    /// # Arguments
1760    ///
1761    /// * `request` - No description provided.
1762    /// * `name` - Required. The domain resource name using the form: `projects/{project_id}/locations/global/domains/{domain_name}`
1763    pub fn locations_global_domains_reset_admin_password(
1764        &self,
1765        request: ResetAdminPasswordRequest,
1766        name: &str,
1767    ) -> ProjectLocationGlobalDomainResetAdminPasswordCall<'a, C> {
1768        ProjectLocationGlobalDomainResetAdminPasswordCall {
1769            hub: self.hub,
1770            _request: request,
1771            _name: name.to_string(),
1772            _delegate: Default::default(),
1773            _additional_params: Default::default(),
1774            _scopes: Default::default(),
1775        }
1776    }
1777
1778    /// Create a builder to help you perform the following task:
1779    ///
1780    /// RestoreDomain restores domain backup mentioned in the RestoreDomainRequest
1781    ///
1782    /// # Arguments
1783    ///
1784    /// * `request` - No description provided.
1785    /// * `name` - Required. Resource name for the domain to which the backup belongs
1786    pub fn locations_global_domains_restore(
1787        &self,
1788        request: RestoreDomainRequest,
1789        name: &str,
1790    ) -> ProjectLocationGlobalDomainRestoreCall<'a, C> {
1791        ProjectLocationGlobalDomainRestoreCall {
1792            hub: self.hub,
1793            _request: request,
1794            _name: name.to_string(),
1795            _delegate: Default::default(),
1796            _additional_params: Default::default(),
1797            _scopes: Default::default(),
1798        }
1799    }
1800
1801    /// Create a builder to help you perform the following task:
1802    ///
1803    /// Sets the access control policy on the specified resource. Replaces any existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` errors.
1804    ///
1805    /// # Arguments
1806    ///
1807    /// * `request` - No description provided.
1808    /// * `resource` - REQUIRED: The resource for which the policy is being specified. See [Resource names](https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
1809    pub fn locations_global_domains_set_iam_policy(
1810        &self,
1811        request: SetIamPolicyRequest,
1812        resource: &str,
1813    ) -> ProjectLocationGlobalDomainSetIamPolicyCall<'a, C> {
1814        ProjectLocationGlobalDomainSetIamPolicyCall {
1815            hub: self.hub,
1816            _request: request,
1817            _resource: resource.to_string(),
1818            _delegate: Default::default(),
1819            _additional_params: Default::default(),
1820            _scopes: Default::default(),
1821        }
1822    }
1823
1824    /// Create a builder to help you perform the following task:
1825    ///
1826    /// Returns permissions that a caller has on the specified resource. If the resource does not exist, this will return an empty set of permissions, not a `NOT_FOUND` error. Note: This operation is designed to be used for building permission-aware UIs and command-line tools, not for authorization checking. This operation may "fail open" without warning.
1827    ///
1828    /// # Arguments
1829    ///
1830    /// * `request` - No description provided.
1831    /// * `resource` - REQUIRED: The resource for which the policy detail is being requested. See [Resource names](https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
1832    pub fn locations_global_domains_test_iam_permissions(
1833        &self,
1834        request: TestIamPermissionsRequest,
1835        resource: &str,
1836    ) -> ProjectLocationGlobalDomainTestIamPermissionCall<'a, C> {
1837        ProjectLocationGlobalDomainTestIamPermissionCall {
1838            hub: self.hub,
1839            _request: request,
1840            _resource: resource.to_string(),
1841            _delegate: Default::default(),
1842            _additional_params: Default::default(),
1843            _scopes: Default::default(),
1844        }
1845    }
1846
1847    /// Create a builder to help you perform the following task:
1848    ///
1849    /// Patches a single ldaps settings.
1850    ///
1851    /// # Arguments
1852    ///
1853    /// * `request` - No description provided.
1854    /// * `name` - The resource name of the LDAPS settings. Uses the form: `projects/{project}/locations/{location}/domains/{domain}`.
1855    pub fn locations_global_domains_update_ldapssettings(
1856        &self,
1857        request: LDAPSSettings,
1858        name: &str,
1859    ) -> ProjectLocationGlobalDomainUpdateLdapssettingCall<'a, C> {
1860        ProjectLocationGlobalDomainUpdateLdapssettingCall {
1861            hub: self.hub,
1862            _request: request,
1863            _name: name.to_string(),
1864            _update_mask: Default::default(),
1865            _delegate: Default::default(),
1866            _additional_params: Default::default(),
1867            _scopes: Default::default(),
1868        }
1869    }
1870
1871    /// Create a builder to help you perform the following task:
1872    ///
1873    /// Validates a trust state, that the target domain is reachable, and that the target domain is able to accept incoming trust requests.
1874    ///
1875    /// # Arguments
1876    ///
1877    /// * `request` - No description provided.
1878    /// * `name` - Required. The resource domain name, project name, and location using the form: `projects/{project_id}/locations/global/domains/{domain_name}`
1879    pub fn locations_global_domains_validate_trust(
1880        &self,
1881        request: ValidateTrustRequest,
1882        name: &str,
1883    ) -> ProjectLocationGlobalDomainValidateTrustCall<'a, C> {
1884        ProjectLocationGlobalDomainValidateTrustCall {
1885            hub: self.hub,
1886            _request: request,
1887            _name: name.to_string(),
1888            _delegate: Default::default(),
1889            _additional_params: Default::default(),
1890            _scopes: Default::default(),
1891        }
1892    }
1893
1894    /// Create a builder to help you perform the following task:
1895    ///
1896    /// 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`.
1897    ///
1898    /// # Arguments
1899    ///
1900    /// * `request` - No description provided.
1901    /// * `name` - The name of the operation resource to be cancelled.
1902    pub fn locations_global_operations_cancel(
1903        &self,
1904        request: CancelOperationRequest,
1905        name: &str,
1906    ) -> ProjectLocationGlobalOperationCancelCall<'a, C> {
1907        ProjectLocationGlobalOperationCancelCall {
1908            hub: self.hub,
1909            _request: request,
1910            _name: name.to_string(),
1911            _delegate: Default::default(),
1912            _additional_params: Default::default(),
1913            _scopes: Default::default(),
1914        }
1915    }
1916
1917    /// Create a builder to help you perform the following task:
1918    ///
1919    /// 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`.
1920    ///
1921    /// # Arguments
1922    ///
1923    /// * `name` - The name of the operation resource to be deleted.
1924    pub fn locations_global_operations_delete(
1925        &self,
1926        name: &str,
1927    ) -> ProjectLocationGlobalOperationDeleteCall<'a, C> {
1928        ProjectLocationGlobalOperationDeleteCall {
1929            hub: self.hub,
1930            _name: name.to_string(),
1931            _delegate: Default::default(),
1932            _additional_params: Default::default(),
1933            _scopes: Default::default(),
1934        }
1935    }
1936
1937    /// Create a builder to help you perform the following task:
1938    ///
1939    /// 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.
1940    ///
1941    /// # Arguments
1942    ///
1943    /// * `name` - The name of the operation resource.
1944    pub fn locations_global_operations_get(
1945        &self,
1946        name: &str,
1947    ) -> ProjectLocationGlobalOperationGetCall<'a, C> {
1948        ProjectLocationGlobalOperationGetCall {
1949            hub: self.hub,
1950            _name: name.to_string(),
1951            _delegate: Default::default(),
1952            _additional_params: Default::default(),
1953            _scopes: Default::default(),
1954        }
1955    }
1956
1957    /// Create a builder to help you perform the following task:
1958    ///
1959    /// Lists operations that match the specified filter in the request. If the server doesn't support this method, it returns `UNIMPLEMENTED`.
1960    ///
1961    /// # Arguments
1962    ///
1963    /// * `name` - The name of the operation's parent resource.
1964    pub fn locations_global_operations_list(
1965        &self,
1966        name: &str,
1967    ) -> ProjectLocationGlobalOperationListCall<'a, C> {
1968        ProjectLocationGlobalOperationListCall {
1969            hub: self.hub,
1970            _name: name.to_string(),
1971            _page_token: Default::default(),
1972            _page_size: Default::default(),
1973            _filter: Default::default(),
1974            _delegate: Default::default(),
1975            _additional_params: Default::default(),
1976            _scopes: Default::default(),
1977        }
1978    }
1979
1980    /// Create a builder to help you perform the following task:
1981    ///
1982    /// Creates a Peering for Managed AD instance.
1983    ///
1984    /// # Arguments
1985    ///
1986    /// * `request` - No description provided.
1987    /// * `parent` - Required. Resource project name and location using the form: `projects/{project_id}/locations/global`
1988    pub fn locations_global_peerings_create(
1989        &self,
1990        request: Peering,
1991        parent: &str,
1992    ) -> ProjectLocationGlobalPeeringCreateCall<'a, C> {
1993        ProjectLocationGlobalPeeringCreateCall {
1994            hub: self.hub,
1995            _request: request,
1996            _parent: parent.to_string(),
1997            _peering_id: Default::default(),
1998            _delegate: Default::default(),
1999            _additional_params: Default::default(),
2000            _scopes: Default::default(),
2001        }
2002    }
2003
2004    /// Create a builder to help you perform the following task:
2005    ///
2006    /// Deletes identified Peering.
2007    ///
2008    /// # Arguments
2009    ///
2010    /// * `name` - Required. Peering resource name using the form: `projects/{project_id}/locations/global/peerings/{peering_id}`
2011    pub fn locations_global_peerings_delete(
2012        &self,
2013        name: &str,
2014    ) -> ProjectLocationGlobalPeeringDeleteCall<'a, C> {
2015        ProjectLocationGlobalPeeringDeleteCall {
2016            hub: self.hub,
2017            _name: name.to_string(),
2018            _delegate: Default::default(),
2019            _additional_params: Default::default(),
2020            _scopes: Default::default(),
2021        }
2022    }
2023
2024    /// Create a builder to help you perform the following task:
2025    ///
2026    /// Gets details of a single Peering.
2027    ///
2028    /// # Arguments
2029    ///
2030    /// * `name` - Required. Peering resource name using the form: `projects/{project_id}/locations/global/peerings/{peering_id}`
2031    pub fn locations_global_peerings_get(
2032        &self,
2033        name: &str,
2034    ) -> ProjectLocationGlobalPeeringGetCall<'a, C> {
2035        ProjectLocationGlobalPeeringGetCall {
2036            hub: self.hub,
2037            _name: name.to_string(),
2038            _delegate: Default::default(),
2039            _additional_params: Default::default(),
2040            _scopes: Default::default(),
2041        }
2042    }
2043
2044    /// Create a builder to help you perform the following task:
2045    ///
2046    /// Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.
2047    ///
2048    /// # Arguments
2049    ///
2050    /// * `resource` - REQUIRED: The resource for which the policy is being requested. See [Resource names](https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
2051    pub fn locations_global_peerings_get_iam_policy(
2052        &self,
2053        resource: &str,
2054    ) -> ProjectLocationGlobalPeeringGetIamPolicyCall<'a, C> {
2055        ProjectLocationGlobalPeeringGetIamPolicyCall {
2056            hub: self.hub,
2057            _resource: resource.to_string(),
2058            _options_requested_policy_version: Default::default(),
2059            _delegate: Default::default(),
2060            _additional_params: Default::default(),
2061            _scopes: Default::default(),
2062        }
2063    }
2064
2065    /// Create a builder to help you perform the following task:
2066    ///
2067    /// Lists Peerings in a given project.
2068    ///
2069    /// # Arguments
2070    ///
2071    /// * `parent` - Required. The resource name of the peering location using the form: `projects/{project_id}/locations/global`
2072    pub fn locations_global_peerings_list(
2073        &self,
2074        parent: &str,
2075    ) -> ProjectLocationGlobalPeeringListCall<'a, C> {
2076        ProjectLocationGlobalPeeringListCall {
2077            hub: self.hub,
2078            _parent: parent.to_string(),
2079            _page_token: Default::default(),
2080            _page_size: Default::default(),
2081            _order_by: Default::default(),
2082            _filter: Default::default(),
2083            _delegate: Default::default(),
2084            _additional_params: Default::default(),
2085            _scopes: Default::default(),
2086        }
2087    }
2088
2089    /// Create a builder to help you perform the following task:
2090    ///
2091    /// Updates the labels for specified Peering.
2092    ///
2093    /// # Arguments
2094    ///
2095    /// * `request` - No description provided.
2096    /// * `name` - Output only. Unique name of the peering in this scope including projects and location using the form: `projects/{project_id}/locations/global/peerings/{peering_id}`.
2097    pub fn locations_global_peerings_patch(
2098        &self,
2099        request: Peering,
2100        name: &str,
2101    ) -> ProjectLocationGlobalPeeringPatchCall<'a, C> {
2102        ProjectLocationGlobalPeeringPatchCall {
2103            hub: self.hub,
2104            _request: request,
2105            _name: name.to_string(),
2106            _update_mask: Default::default(),
2107            _delegate: Default::default(),
2108            _additional_params: Default::default(),
2109            _scopes: Default::default(),
2110        }
2111    }
2112
2113    /// Create a builder to help you perform the following task:
2114    ///
2115    /// Sets the access control policy on the specified resource. Replaces any existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` errors.
2116    ///
2117    /// # Arguments
2118    ///
2119    /// * `request` - No description provided.
2120    /// * `resource` - REQUIRED: The resource for which the policy is being specified. See [Resource names](https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
2121    pub fn locations_global_peerings_set_iam_policy(
2122        &self,
2123        request: SetIamPolicyRequest,
2124        resource: &str,
2125    ) -> ProjectLocationGlobalPeeringSetIamPolicyCall<'a, C> {
2126        ProjectLocationGlobalPeeringSetIamPolicyCall {
2127            hub: self.hub,
2128            _request: request,
2129            _resource: resource.to_string(),
2130            _delegate: Default::default(),
2131            _additional_params: Default::default(),
2132            _scopes: Default::default(),
2133        }
2134    }
2135
2136    /// Create a builder to help you perform the following task:
2137    ///
2138    /// Returns permissions that a caller has on the specified resource. If the resource does not exist, this will return an empty set of permissions, not a `NOT_FOUND` error. Note: This operation is designed to be used for building permission-aware UIs and command-line tools, not for authorization checking. This operation may "fail open" without warning.
2139    ///
2140    /// # Arguments
2141    ///
2142    /// * `request` - No description provided.
2143    /// * `resource` - REQUIRED: The resource for which the policy detail is being requested. See [Resource names](https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
2144    pub fn locations_global_peerings_test_iam_permissions(
2145        &self,
2146        request: TestIamPermissionsRequest,
2147        resource: &str,
2148    ) -> ProjectLocationGlobalPeeringTestIamPermissionCall<'a, C> {
2149        ProjectLocationGlobalPeeringTestIamPermissionCall {
2150            hub: self.hub,
2151            _request: request,
2152            _resource: resource.to_string(),
2153            _delegate: Default::default(),
2154            _additional_params: Default::default(),
2155            _scopes: Default::default(),
2156        }
2157    }
2158
2159    /// Create a builder to help you perform the following task:
2160    ///
2161    /// Gets information about a location.
2162    ///
2163    /// # Arguments
2164    ///
2165    /// * `name` - Resource name for the location.
2166    pub fn locations_get(&self, name: &str) -> ProjectLocationGetCall<'a, C> {
2167        ProjectLocationGetCall {
2168            hub: self.hub,
2169            _name: name.to_string(),
2170            _delegate: Default::default(),
2171            _additional_params: Default::default(),
2172            _scopes: Default::default(),
2173        }
2174    }
2175
2176    /// Create a builder to help you perform the following task:
2177    ///
2178    /// Lists information about the supported locations for this service.
2179    ///
2180    /// # Arguments
2181    ///
2182    /// * `name` - The resource that owns the locations collection, if applicable.
2183    pub fn locations_list(&self, name: &str) -> ProjectLocationListCall<'a, C> {
2184        ProjectLocationListCall {
2185            hub: self.hub,
2186            _name: name.to_string(),
2187            _page_token: Default::default(),
2188            _page_size: Default::default(),
2189            _filter: Default::default(),
2190            _delegate: Default::default(),
2191            _additional_params: Default::default(),
2192            _scopes: Default::default(),
2193        }
2194    }
2195}
2196
2197// ###################
2198// CallBuilders   ###
2199// #################
2200
2201/// Creates a Backup for a domain.
2202///
2203/// A builder for the *locations.global.domains.backups.create* method supported by a *project* resource.
2204/// It is not used directly, but through a [`ProjectMethods`] instance.
2205///
2206/// # Example
2207///
2208/// Instantiate a resource method builder
2209///
2210/// ```test_harness,no_run
2211/// # extern crate hyper;
2212/// # extern crate hyper_rustls;
2213/// # extern crate google_managedidentities1 as managedidentities1;
2214/// use managedidentities1::api::Backup;
2215/// # async fn dox() {
2216/// # use managedidentities1::{ManagedServiceForMicrosoftActiveDirectoryConsumerAPI, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2217///
2218/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
2219/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
2220/// #     .with_native_roots()
2221/// #     .unwrap()
2222/// #     .https_only()
2223/// #     .enable_http2()
2224/// #     .build();
2225///
2226/// # let executor = hyper_util::rt::TokioExecutor::new();
2227/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
2228/// #     secret,
2229/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2230/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
2231/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
2232/// #     ),
2233/// # ).build().await.unwrap();
2234///
2235/// # let client = hyper_util::client::legacy::Client::builder(
2236/// #     hyper_util::rt::TokioExecutor::new()
2237/// # )
2238/// # .build(
2239/// #     hyper_rustls::HttpsConnectorBuilder::new()
2240/// #         .with_native_roots()
2241/// #         .unwrap()
2242/// #         .https_or_http()
2243/// #         .enable_http2()
2244/// #         .build()
2245/// # );
2246/// # let mut hub = ManagedServiceForMicrosoftActiveDirectoryConsumerAPI::new(client, auth);
2247/// // As the method needs a request, you would usually fill it with the desired information
2248/// // into the respective structure. Some of the parts shown here might not be applicable !
2249/// // Values shown here are possibly random and not representative !
2250/// let mut req = Backup::default();
2251///
2252/// // You can configure optional parameters by calling the respective setters at will, and
2253/// // execute the final call using `doit()`.
2254/// // Values shown here are possibly random and not representative !
2255/// let result = hub.projects().locations_global_domains_backups_create(req, "parent")
2256///              .backup_id("sed")
2257///              .doit().await;
2258/// # }
2259/// ```
2260pub struct ProjectLocationGlobalDomainBackupCreateCall<'a, C>
2261where
2262    C: 'a,
2263{
2264    hub: &'a ManagedServiceForMicrosoftActiveDirectoryConsumerAPI<C>,
2265    _request: Backup,
2266    _parent: String,
2267    _backup_id: Option<String>,
2268    _delegate: Option<&'a mut dyn common::Delegate>,
2269    _additional_params: HashMap<String, String>,
2270    _scopes: BTreeSet<String>,
2271}
2272
2273impl<'a, C> common::CallBuilder for ProjectLocationGlobalDomainBackupCreateCall<'a, C> {}
2274
2275impl<'a, C> ProjectLocationGlobalDomainBackupCreateCall<'a, C>
2276where
2277    C: common::Connector,
2278{
2279    /// Perform the operation you have build so far.
2280    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
2281        use std::borrow::Cow;
2282        use std::io::{Read, Seek};
2283
2284        use common::{url::Params, ToParts};
2285        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
2286
2287        let mut dd = common::DefaultDelegate;
2288        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
2289        dlg.begin(common::MethodInfo {
2290            id: "managedidentities.projects.locations.global.domains.backups.create",
2291            http_method: hyper::Method::POST,
2292        });
2293
2294        for &field in ["alt", "parent", "backupId"].iter() {
2295            if self._additional_params.contains_key(field) {
2296                dlg.finished(false);
2297                return Err(common::Error::FieldClash(field));
2298            }
2299        }
2300
2301        let mut params = Params::with_capacity(5 + self._additional_params.len());
2302        params.push("parent", self._parent);
2303        if let Some(value) = self._backup_id.as_ref() {
2304            params.push("backupId", value);
2305        }
2306
2307        params.extend(self._additional_params.iter());
2308
2309        params.push("alt", "json");
2310        let mut url = self.hub._base_url.clone() + "v1/{+parent}/backups";
2311        if self._scopes.is_empty() {
2312            self._scopes
2313                .insert(Scope::CloudPlatform.as_ref().to_string());
2314        }
2315
2316        #[allow(clippy::single_element_loop)]
2317        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
2318            url = params.uri_replacement(url, param_name, find_this, true);
2319        }
2320        {
2321            let to_remove = ["parent"];
2322            params.remove_params(&to_remove);
2323        }
2324
2325        let url = params.parse_with_url(&url);
2326
2327        let mut json_mime_type = mime::APPLICATION_JSON;
2328        let mut request_value_reader = {
2329            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
2330            common::remove_json_null_values(&mut value);
2331            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
2332            serde_json::to_writer(&mut dst, &value).unwrap();
2333            dst
2334        };
2335        let request_size = request_value_reader
2336            .seek(std::io::SeekFrom::End(0))
2337            .unwrap();
2338        request_value_reader
2339            .seek(std::io::SeekFrom::Start(0))
2340            .unwrap();
2341
2342        loop {
2343            let token = match self
2344                .hub
2345                .auth
2346                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
2347                .await
2348            {
2349                Ok(token) => token,
2350                Err(e) => match dlg.token(e) {
2351                    Ok(token) => token,
2352                    Err(e) => {
2353                        dlg.finished(false);
2354                        return Err(common::Error::MissingToken(e));
2355                    }
2356                },
2357            };
2358            request_value_reader
2359                .seek(std::io::SeekFrom::Start(0))
2360                .unwrap();
2361            let mut req_result = {
2362                let client = &self.hub.client;
2363                dlg.pre_request();
2364                let mut req_builder = hyper::Request::builder()
2365                    .method(hyper::Method::POST)
2366                    .uri(url.as_str())
2367                    .header(USER_AGENT, self.hub._user_agent.clone());
2368
2369                if let Some(token) = token.as_ref() {
2370                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
2371                }
2372
2373                let request = req_builder
2374                    .header(CONTENT_TYPE, json_mime_type.to_string())
2375                    .header(CONTENT_LENGTH, request_size as u64)
2376                    .body(common::to_body(
2377                        request_value_reader.get_ref().clone().into(),
2378                    ));
2379
2380                client.request(request.unwrap()).await
2381            };
2382
2383            match req_result {
2384                Err(err) => {
2385                    if let common::Retry::After(d) = dlg.http_error(&err) {
2386                        sleep(d).await;
2387                        continue;
2388                    }
2389                    dlg.finished(false);
2390                    return Err(common::Error::HttpError(err));
2391                }
2392                Ok(res) => {
2393                    let (mut parts, body) = res.into_parts();
2394                    let mut body = common::Body::new(body);
2395                    if !parts.status.is_success() {
2396                        let bytes = common::to_bytes(body).await.unwrap_or_default();
2397                        let error = serde_json::from_str(&common::to_string(&bytes));
2398                        let response = common::to_response(parts, bytes.into());
2399
2400                        if let common::Retry::After(d) =
2401                            dlg.http_failure(&response, error.as_ref().ok())
2402                        {
2403                            sleep(d).await;
2404                            continue;
2405                        }
2406
2407                        dlg.finished(false);
2408
2409                        return Err(match error {
2410                            Ok(value) => common::Error::BadRequest(value),
2411                            _ => common::Error::Failure(response),
2412                        });
2413                    }
2414                    let response = {
2415                        let bytes = common::to_bytes(body).await.unwrap_or_default();
2416                        let encoded = common::to_string(&bytes);
2417                        match serde_json::from_str(&encoded) {
2418                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
2419                            Err(error) => {
2420                                dlg.response_json_decode_error(&encoded, &error);
2421                                return Err(common::Error::JsonDecodeError(
2422                                    encoded.to_string(),
2423                                    error,
2424                                ));
2425                            }
2426                        }
2427                    };
2428
2429                    dlg.finished(true);
2430                    return Ok(response);
2431                }
2432            }
2433        }
2434    }
2435
2436    ///
2437    /// Sets the *request* property to the given value.
2438    ///
2439    /// Even though the property as already been set when instantiating this call,
2440    /// we provide this method for API completeness.
2441    pub fn request(
2442        mut self,
2443        new_value: Backup,
2444    ) -> ProjectLocationGlobalDomainBackupCreateCall<'a, C> {
2445        self._request = new_value;
2446        self
2447    }
2448    /// Required. The domain resource name using the form: `projects/{project_id}/locations/global/domains/{domain_name}`
2449    ///
2450    /// Sets the *parent* path property to the given value.
2451    ///
2452    /// Even though the property as already been set when instantiating this call,
2453    /// we provide this method for API completeness.
2454    pub fn parent(mut self, new_value: &str) -> ProjectLocationGlobalDomainBackupCreateCall<'a, C> {
2455        self._parent = new_value.to_string();
2456        self
2457    }
2458    /// Required. Backup Id, unique name to identify the backups with the following restrictions: * Must be lowercase letters, numbers, and hyphens * Must start with a letter. * Must contain between 1-63 characters. * Must end with a number or a letter. * Must be unique within the domain.
2459    ///
2460    /// Sets the *backup id* query property to the given value.
2461    pub fn backup_id(
2462        mut self,
2463        new_value: &str,
2464    ) -> ProjectLocationGlobalDomainBackupCreateCall<'a, C> {
2465        self._backup_id = Some(new_value.to_string());
2466        self
2467    }
2468    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
2469    /// while executing the actual API request.
2470    ///
2471    /// ````text
2472    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
2473    /// ````
2474    ///
2475    /// Sets the *delegate* property to the given value.
2476    pub fn delegate(
2477        mut self,
2478        new_value: &'a mut dyn common::Delegate,
2479    ) -> ProjectLocationGlobalDomainBackupCreateCall<'a, C> {
2480        self._delegate = Some(new_value);
2481        self
2482    }
2483
2484    /// Set any additional parameter of the query string used in the request.
2485    /// It should be used to set parameters which are not yet available through their own
2486    /// setters.
2487    ///
2488    /// Please note that this method must not be used to set any of the known parameters
2489    /// which have their own setter method. If done anyway, the request will fail.
2490    ///
2491    /// # Additional Parameters
2492    ///
2493    /// * *$.xgafv* (query-string) - V1 error format.
2494    /// * *access_token* (query-string) - OAuth access token.
2495    /// * *alt* (query-string) - Data format for response.
2496    /// * *callback* (query-string) - JSONP
2497    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
2498    /// * *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.
2499    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
2500    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
2501    /// * *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.
2502    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
2503    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
2504    pub fn param<T>(
2505        mut self,
2506        name: T,
2507        value: T,
2508    ) -> ProjectLocationGlobalDomainBackupCreateCall<'a, C>
2509    where
2510        T: AsRef<str>,
2511    {
2512        self._additional_params
2513            .insert(name.as_ref().to_string(), value.as_ref().to_string());
2514        self
2515    }
2516
2517    /// Identifies the authorization scope for the method you are building.
2518    ///
2519    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
2520    /// [`Scope::CloudPlatform`].
2521    ///
2522    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
2523    /// tokens for more than one scope.
2524    ///
2525    /// Usually there is more than one suitable scope to authorize an operation, some of which may
2526    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
2527    /// sufficient, a read-write scope will do as well.
2528    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationGlobalDomainBackupCreateCall<'a, C>
2529    where
2530        St: AsRef<str>,
2531    {
2532        self._scopes.insert(String::from(scope.as_ref()));
2533        self
2534    }
2535    /// Identifies the authorization scope(s) for the method you are building.
2536    ///
2537    /// See [`Self::add_scope()`] for details.
2538    pub fn add_scopes<I, St>(
2539        mut self,
2540        scopes: I,
2541    ) -> ProjectLocationGlobalDomainBackupCreateCall<'a, C>
2542    where
2543        I: IntoIterator<Item = St>,
2544        St: AsRef<str>,
2545    {
2546        self._scopes
2547            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
2548        self
2549    }
2550
2551    /// Removes all scopes, and no default scope will be used either.
2552    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
2553    /// for details).
2554    pub fn clear_scopes(mut self) -> ProjectLocationGlobalDomainBackupCreateCall<'a, C> {
2555        self._scopes.clear();
2556        self
2557    }
2558}
2559
2560/// Deletes identified Backup.
2561///
2562/// A builder for the *locations.global.domains.backups.delete* method supported by a *project* resource.
2563/// It is not used directly, but through a [`ProjectMethods`] instance.
2564///
2565/// # Example
2566///
2567/// Instantiate a resource method builder
2568///
2569/// ```test_harness,no_run
2570/// # extern crate hyper;
2571/// # extern crate hyper_rustls;
2572/// # extern crate google_managedidentities1 as managedidentities1;
2573/// # async fn dox() {
2574/// # use managedidentities1::{ManagedServiceForMicrosoftActiveDirectoryConsumerAPI, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2575///
2576/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
2577/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
2578/// #     .with_native_roots()
2579/// #     .unwrap()
2580/// #     .https_only()
2581/// #     .enable_http2()
2582/// #     .build();
2583///
2584/// # let executor = hyper_util::rt::TokioExecutor::new();
2585/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
2586/// #     secret,
2587/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2588/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
2589/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
2590/// #     ),
2591/// # ).build().await.unwrap();
2592///
2593/// # let client = hyper_util::client::legacy::Client::builder(
2594/// #     hyper_util::rt::TokioExecutor::new()
2595/// # )
2596/// # .build(
2597/// #     hyper_rustls::HttpsConnectorBuilder::new()
2598/// #         .with_native_roots()
2599/// #         .unwrap()
2600/// #         .https_or_http()
2601/// #         .enable_http2()
2602/// #         .build()
2603/// # );
2604/// # let mut hub = ManagedServiceForMicrosoftActiveDirectoryConsumerAPI::new(client, auth);
2605/// // You can configure optional parameters by calling the respective setters at will, and
2606/// // execute the final call using `doit()`.
2607/// // Values shown here are possibly random and not representative !
2608/// let result = hub.projects().locations_global_domains_backups_delete("name")
2609///              .doit().await;
2610/// # }
2611/// ```
2612pub struct ProjectLocationGlobalDomainBackupDeleteCall<'a, C>
2613where
2614    C: 'a,
2615{
2616    hub: &'a ManagedServiceForMicrosoftActiveDirectoryConsumerAPI<C>,
2617    _name: String,
2618    _delegate: Option<&'a mut dyn common::Delegate>,
2619    _additional_params: HashMap<String, String>,
2620    _scopes: BTreeSet<String>,
2621}
2622
2623impl<'a, C> common::CallBuilder for ProjectLocationGlobalDomainBackupDeleteCall<'a, C> {}
2624
2625impl<'a, C> ProjectLocationGlobalDomainBackupDeleteCall<'a, C>
2626where
2627    C: common::Connector,
2628{
2629    /// Perform the operation you have build so far.
2630    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
2631        use std::borrow::Cow;
2632        use std::io::{Read, Seek};
2633
2634        use common::{url::Params, ToParts};
2635        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
2636
2637        let mut dd = common::DefaultDelegate;
2638        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
2639        dlg.begin(common::MethodInfo {
2640            id: "managedidentities.projects.locations.global.domains.backups.delete",
2641            http_method: hyper::Method::DELETE,
2642        });
2643
2644        for &field in ["alt", "name"].iter() {
2645            if self._additional_params.contains_key(field) {
2646                dlg.finished(false);
2647                return Err(common::Error::FieldClash(field));
2648            }
2649        }
2650
2651        let mut params = Params::with_capacity(3 + self._additional_params.len());
2652        params.push("name", self._name);
2653
2654        params.extend(self._additional_params.iter());
2655
2656        params.push("alt", "json");
2657        let mut url = self.hub._base_url.clone() + "v1/{+name}";
2658        if self._scopes.is_empty() {
2659            self._scopes
2660                .insert(Scope::CloudPlatform.as_ref().to_string());
2661        }
2662
2663        #[allow(clippy::single_element_loop)]
2664        for &(find_this, param_name) in [("{+name}", "name")].iter() {
2665            url = params.uri_replacement(url, param_name, find_this, true);
2666        }
2667        {
2668            let to_remove = ["name"];
2669            params.remove_params(&to_remove);
2670        }
2671
2672        let url = params.parse_with_url(&url);
2673
2674        loop {
2675            let token = match self
2676                .hub
2677                .auth
2678                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
2679                .await
2680            {
2681                Ok(token) => token,
2682                Err(e) => match dlg.token(e) {
2683                    Ok(token) => token,
2684                    Err(e) => {
2685                        dlg.finished(false);
2686                        return Err(common::Error::MissingToken(e));
2687                    }
2688                },
2689            };
2690            let mut req_result = {
2691                let client = &self.hub.client;
2692                dlg.pre_request();
2693                let mut req_builder = hyper::Request::builder()
2694                    .method(hyper::Method::DELETE)
2695                    .uri(url.as_str())
2696                    .header(USER_AGENT, self.hub._user_agent.clone());
2697
2698                if let Some(token) = token.as_ref() {
2699                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
2700                }
2701
2702                let request = req_builder
2703                    .header(CONTENT_LENGTH, 0_u64)
2704                    .body(common::to_body::<String>(None));
2705
2706                client.request(request.unwrap()).await
2707            };
2708
2709            match req_result {
2710                Err(err) => {
2711                    if let common::Retry::After(d) = dlg.http_error(&err) {
2712                        sleep(d).await;
2713                        continue;
2714                    }
2715                    dlg.finished(false);
2716                    return Err(common::Error::HttpError(err));
2717                }
2718                Ok(res) => {
2719                    let (mut parts, body) = res.into_parts();
2720                    let mut body = common::Body::new(body);
2721                    if !parts.status.is_success() {
2722                        let bytes = common::to_bytes(body).await.unwrap_or_default();
2723                        let error = serde_json::from_str(&common::to_string(&bytes));
2724                        let response = common::to_response(parts, bytes.into());
2725
2726                        if let common::Retry::After(d) =
2727                            dlg.http_failure(&response, error.as_ref().ok())
2728                        {
2729                            sleep(d).await;
2730                            continue;
2731                        }
2732
2733                        dlg.finished(false);
2734
2735                        return Err(match error {
2736                            Ok(value) => common::Error::BadRequest(value),
2737                            _ => common::Error::Failure(response),
2738                        });
2739                    }
2740                    let response = {
2741                        let bytes = common::to_bytes(body).await.unwrap_or_default();
2742                        let encoded = common::to_string(&bytes);
2743                        match serde_json::from_str(&encoded) {
2744                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
2745                            Err(error) => {
2746                                dlg.response_json_decode_error(&encoded, &error);
2747                                return Err(common::Error::JsonDecodeError(
2748                                    encoded.to_string(),
2749                                    error,
2750                                ));
2751                            }
2752                        }
2753                    };
2754
2755                    dlg.finished(true);
2756                    return Ok(response);
2757                }
2758            }
2759        }
2760    }
2761
2762    /// Required. The backup resource name using the form: `projects/{project_id}/locations/global/domains/{domain_name}/backups/{backup_id}`
2763    ///
2764    /// Sets the *name* path property to the given value.
2765    ///
2766    /// Even though the property as already been set when instantiating this call,
2767    /// we provide this method for API completeness.
2768    pub fn name(mut self, new_value: &str) -> ProjectLocationGlobalDomainBackupDeleteCall<'a, C> {
2769        self._name = new_value.to_string();
2770        self
2771    }
2772    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
2773    /// while executing the actual API request.
2774    ///
2775    /// ````text
2776    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
2777    /// ````
2778    ///
2779    /// Sets the *delegate* property to the given value.
2780    pub fn delegate(
2781        mut self,
2782        new_value: &'a mut dyn common::Delegate,
2783    ) -> ProjectLocationGlobalDomainBackupDeleteCall<'a, C> {
2784        self._delegate = Some(new_value);
2785        self
2786    }
2787
2788    /// Set any additional parameter of the query string used in the request.
2789    /// It should be used to set parameters which are not yet available through their own
2790    /// setters.
2791    ///
2792    /// Please note that this method must not be used to set any of the known parameters
2793    /// which have their own setter method. If done anyway, the request will fail.
2794    ///
2795    /// # Additional Parameters
2796    ///
2797    /// * *$.xgafv* (query-string) - V1 error format.
2798    /// * *access_token* (query-string) - OAuth access token.
2799    /// * *alt* (query-string) - Data format for response.
2800    /// * *callback* (query-string) - JSONP
2801    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
2802    /// * *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.
2803    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
2804    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
2805    /// * *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.
2806    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
2807    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
2808    pub fn param<T>(
2809        mut self,
2810        name: T,
2811        value: T,
2812    ) -> ProjectLocationGlobalDomainBackupDeleteCall<'a, C>
2813    where
2814        T: AsRef<str>,
2815    {
2816        self._additional_params
2817            .insert(name.as_ref().to_string(), value.as_ref().to_string());
2818        self
2819    }
2820
2821    /// Identifies the authorization scope for the method you are building.
2822    ///
2823    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
2824    /// [`Scope::CloudPlatform`].
2825    ///
2826    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
2827    /// tokens for more than one scope.
2828    ///
2829    /// Usually there is more than one suitable scope to authorize an operation, some of which may
2830    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
2831    /// sufficient, a read-write scope will do as well.
2832    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationGlobalDomainBackupDeleteCall<'a, C>
2833    where
2834        St: AsRef<str>,
2835    {
2836        self._scopes.insert(String::from(scope.as_ref()));
2837        self
2838    }
2839    /// Identifies the authorization scope(s) for the method you are building.
2840    ///
2841    /// See [`Self::add_scope()`] for details.
2842    pub fn add_scopes<I, St>(
2843        mut self,
2844        scopes: I,
2845    ) -> ProjectLocationGlobalDomainBackupDeleteCall<'a, C>
2846    where
2847        I: IntoIterator<Item = St>,
2848        St: AsRef<str>,
2849    {
2850        self._scopes
2851            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
2852        self
2853    }
2854
2855    /// Removes all scopes, and no default scope will be used either.
2856    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
2857    /// for details).
2858    pub fn clear_scopes(mut self) -> ProjectLocationGlobalDomainBackupDeleteCall<'a, C> {
2859        self._scopes.clear();
2860        self
2861    }
2862}
2863
2864/// Gets details of a single Backup.
2865///
2866/// A builder for the *locations.global.domains.backups.get* method supported by a *project* resource.
2867/// It is not used directly, but through a [`ProjectMethods`] instance.
2868///
2869/// # Example
2870///
2871/// Instantiate a resource method builder
2872///
2873/// ```test_harness,no_run
2874/// # extern crate hyper;
2875/// # extern crate hyper_rustls;
2876/// # extern crate google_managedidentities1 as managedidentities1;
2877/// # async fn dox() {
2878/// # use managedidentities1::{ManagedServiceForMicrosoftActiveDirectoryConsumerAPI, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2879///
2880/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
2881/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
2882/// #     .with_native_roots()
2883/// #     .unwrap()
2884/// #     .https_only()
2885/// #     .enable_http2()
2886/// #     .build();
2887///
2888/// # let executor = hyper_util::rt::TokioExecutor::new();
2889/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
2890/// #     secret,
2891/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2892/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
2893/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
2894/// #     ),
2895/// # ).build().await.unwrap();
2896///
2897/// # let client = hyper_util::client::legacy::Client::builder(
2898/// #     hyper_util::rt::TokioExecutor::new()
2899/// # )
2900/// # .build(
2901/// #     hyper_rustls::HttpsConnectorBuilder::new()
2902/// #         .with_native_roots()
2903/// #         .unwrap()
2904/// #         .https_or_http()
2905/// #         .enable_http2()
2906/// #         .build()
2907/// # );
2908/// # let mut hub = ManagedServiceForMicrosoftActiveDirectoryConsumerAPI::new(client, auth);
2909/// // You can configure optional parameters by calling the respective setters at will, and
2910/// // execute the final call using `doit()`.
2911/// // Values shown here are possibly random and not representative !
2912/// let result = hub.projects().locations_global_domains_backups_get("name")
2913///              .doit().await;
2914/// # }
2915/// ```
2916pub struct ProjectLocationGlobalDomainBackupGetCall<'a, C>
2917where
2918    C: 'a,
2919{
2920    hub: &'a ManagedServiceForMicrosoftActiveDirectoryConsumerAPI<C>,
2921    _name: String,
2922    _delegate: Option<&'a mut dyn common::Delegate>,
2923    _additional_params: HashMap<String, String>,
2924    _scopes: BTreeSet<String>,
2925}
2926
2927impl<'a, C> common::CallBuilder for ProjectLocationGlobalDomainBackupGetCall<'a, C> {}
2928
2929impl<'a, C> ProjectLocationGlobalDomainBackupGetCall<'a, C>
2930where
2931    C: common::Connector,
2932{
2933    /// Perform the operation you have build so far.
2934    pub async fn doit(mut self) -> common::Result<(common::Response, Backup)> {
2935        use std::borrow::Cow;
2936        use std::io::{Read, Seek};
2937
2938        use common::{url::Params, ToParts};
2939        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
2940
2941        let mut dd = common::DefaultDelegate;
2942        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
2943        dlg.begin(common::MethodInfo {
2944            id: "managedidentities.projects.locations.global.domains.backups.get",
2945            http_method: hyper::Method::GET,
2946        });
2947
2948        for &field in ["alt", "name"].iter() {
2949            if self._additional_params.contains_key(field) {
2950                dlg.finished(false);
2951                return Err(common::Error::FieldClash(field));
2952            }
2953        }
2954
2955        let mut params = Params::with_capacity(3 + self._additional_params.len());
2956        params.push("name", self._name);
2957
2958        params.extend(self._additional_params.iter());
2959
2960        params.push("alt", "json");
2961        let mut url = self.hub._base_url.clone() + "v1/{+name}";
2962        if self._scopes.is_empty() {
2963            self._scopes
2964                .insert(Scope::CloudPlatform.as_ref().to_string());
2965        }
2966
2967        #[allow(clippy::single_element_loop)]
2968        for &(find_this, param_name) in [("{+name}", "name")].iter() {
2969            url = params.uri_replacement(url, param_name, find_this, true);
2970        }
2971        {
2972            let to_remove = ["name"];
2973            params.remove_params(&to_remove);
2974        }
2975
2976        let url = params.parse_with_url(&url);
2977
2978        loop {
2979            let token = match self
2980                .hub
2981                .auth
2982                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
2983                .await
2984            {
2985                Ok(token) => token,
2986                Err(e) => match dlg.token(e) {
2987                    Ok(token) => token,
2988                    Err(e) => {
2989                        dlg.finished(false);
2990                        return Err(common::Error::MissingToken(e));
2991                    }
2992                },
2993            };
2994            let mut req_result = {
2995                let client = &self.hub.client;
2996                dlg.pre_request();
2997                let mut req_builder = hyper::Request::builder()
2998                    .method(hyper::Method::GET)
2999                    .uri(url.as_str())
3000                    .header(USER_AGENT, self.hub._user_agent.clone());
3001
3002                if let Some(token) = token.as_ref() {
3003                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
3004                }
3005
3006                let request = req_builder
3007                    .header(CONTENT_LENGTH, 0_u64)
3008                    .body(common::to_body::<String>(None));
3009
3010                client.request(request.unwrap()).await
3011            };
3012
3013            match req_result {
3014                Err(err) => {
3015                    if let common::Retry::After(d) = dlg.http_error(&err) {
3016                        sleep(d).await;
3017                        continue;
3018                    }
3019                    dlg.finished(false);
3020                    return Err(common::Error::HttpError(err));
3021                }
3022                Ok(res) => {
3023                    let (mut parts, body) = res.into_parts();
3024                    let mut body = common::Body::new(body);
3025                    if !parts.status.is_success() {
3026                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3027                        let error = serde_json::from_str(&common::to_string(&bytes));
3028                        let response = common::to_response(parts, bytes.into());
3029
3030                        if let common::Retry::After(d) =
3031                            dlg.http_failure(&response, error.as_ref().ok())
3032                        {
3033                            sleep(d).await;
3034                            continue;
3035                        }
3036
3037                        dlg.finished(false);
3038
3039                        return Err(match error {
3040                            Ok(value) => common::Error::BadRequest(value),
3041                            _ => common::Error::Failure(response),
3042                        });
3043                    }
3044                    let response = {
3045                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3046                        let encoded = common::to_string(&bytes);
3047                        match serde_json::from_str(&encoded) {
3048                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
3049                            Err(error) => {
3050                                dlg.response_json_decode_error(&encoded, &error);
3051                                return Err(common::Error::JsonDecodeError(
3052                                    encoded.to_string(),
3053                                    error,
3054                                ));
3055                            }
3056                        }
3057                    };
3058
3059                    dlg.finished(true);
3060                    return Ok(response);
3061                }
3062            }
3063        }
3064    }
3065
3066    /// Required. The backup resource name using the form: `projects/{project_id}/locations/global/domains/{domain_name}/backups/{backup_id}`
3067    ///
3068    /// Sets the *name* path property to the given value.
3069    ///
3070    /// Even though the property as already been set when instantiating this call,
3071    /// we provide this method for API completeness.
3072    pub fn name(mut self, new_value: &str) -> ProjectLocationGlobalDomainBackupGetCall<'a, C> {
3073        self._name = new_value.to_string();
3074        self
3075    }
3076    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3077    /// while executing the actual API request.
3078    ///
3079    /// ````text
3080    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
3081    /// ````
3082    ///
3083    /// Sets the *delegate* property to the given value.
3084    pub fn delegate(
3085        mut self,
3086        new_value: &'a mut dyn common::Delegate,
3087    ) -> ProjectLocationGlobalDomainBackupGetCall<'a, C> {
3088        self._delegate = Some(new_value);
3089        self
3090    }
3091
3092    /// Set any additional parameter of the query string used in the request.
3093    /// It should be used to set parameters which are not yet available through their own
3094    /// setters.
3095    ///
3096    /// Please note that this method must not be used to set any of the known parameters
3097    /// which have their own setter method. If done anyway, the request will fail.
3098    ///
3099    /// # Additional Parameters
3100    ///
3101    /// * *$.xgafv* (query-string) - V1 error format.
3102    /// * *access_token* (query-string) - OAuth access token.
3103    /// * *alt* (query-string) - Data format for response.
3104    /// * *callback* (query-string) - JSONP
3105    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
3106    /// * *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.
3107    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3108    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
3109    /// * *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.
3110    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
3111    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
3112    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationGlobalDomainBackupGetCall<'a, C>
3113    where
3114        T: AsRef<str>,
3115    {
3116        self._additional_params
3117            .insert(name.as_ref().to_string(), value.as_ref().to_string());
3118        self
3119    }
3120
3121    /// Identifies the authorization scope for the method you are building.
3122    ///
3123    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
3124    /// [`Scope::CloudPlatform`].
3125    ///
3126    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
3127    /// tokens for more than one scope.
3128    ///
3129    /// Usually there is more than one suitable scope to authorize an operation, some of which may
3130    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
3131    /// sufficient, a read-write scope will do as well.
3132    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationGlobalDomainBackupGetCall<'a, C>
3133    where
3134        St: AsRef<str>,
3135    {
3136        self._scopes.insert(String::from(scope.as_ref()));
3137        self
3138    }
3139    /// Identifies the authorization scope(s) for the method you are building.
3140    ///
3141    /// See [`Self::add_scope()`] for details.
3142    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationGlobalDomainBackupGetCall<'a, C>
3143    where
3144        I: IntoIterator<Item = St>,
3145        St: AsRef<str>,
3146    {
3147        self._scopes
3148            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
3149        self
3150    }
3151
3152    /// Removes all scopes, and no default scope will be used either.
3153    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
3154    /// for details).
3155    pub fn clear_scopes(mut self) -> ProjectLocationGlobalDomainBackupGetCall<'a, C> {
3156        self._scopes.clear();
3157        self
3158    }
3159}
3160
3161/// Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.
3162///
3163/// A builder for the *locations.global.domains.backups.getIamPolicy* method supported by a *project* resource.
3164/// It is not used directly, but through a [`ProjectMethods`] instance.
3165///
3166/// # Example
3167///
3168/// Instantiate a resource method builder
3169///
3170/// ```test_harness,no_run
3171/// # extern crate hyper;
3172/// # extern crate hyper_rustls;
3173/// # extern crate google_managedidentities1 as managedidentities1;
3174/// # async fn dox() {
3175/// # use managedidentities1::{ManagedServiceForMicrosoftActiveDirectoryConsumerAPI, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3176///
3177/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
3178/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
3179/// #     .with_native_roots()
3180/// #     .unwrap()
3181/// #     .https_only()
3182/// #     .enable_http2()
3183/// #     .build();
3184///
3185/// # let executor = hyper_util::rt::TokioExecutor::new();
3186/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
3187/// #     secret,
3188/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3189/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
3190/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
3191/// #     ),
3192/// # ).build().await.unwrap();
3193///
3194/// # let client = hyper_util::client::legacy::Client::builder(
3195/// #     hyper_util::rt::TokioExecutor::new()
3196/// # )
3197/// # .build(
3198/// #     hyper_rustls::HttpsConnectorBuilder::new()
3199/// #         .with_native_roots()
3200/// #         .unwrap()
3201/// #         .https_or_http()
3202/// #         .enable_http2()
3203/// #         .build()
3204/// # );
3205/// # let mut hub = ManagedServiceForMicrosoftActiveDirectoryConsumerAPI::new(client, auth);
3206/// // You can configure optional parameters by calling the respective setters at will, and
3207/// // execute the final call using `doit()`.
3208/// // Values shown here are possibly random and not representative !
3209/// let result = hub.projects().locations_global_domains_backups_get_iam_policy("resource")
3210///              .options_requested_policy_version(-20)
3211///              .doit().await;
3212/// # }
3213/// ```
3214pub struct ProjectLocationGlobalDomainBackupGetIamPolicyCall<'a, C>
3215where
3216    C: 'a,
3217{
3218    hub: &'a ManagedServiceForMicrosoftActiveDirectoryConsumerAPI<C>,
3219    _resource: String,
3220    _options_requested_policy_version: Option<i32>,
3221    _delegate: Option<&'a mut dyn common::Delegate>,
3222    _additional_params: HashMap<String, String>,
3223    _scopes: BTreeSet<String>,
3224}
3225
3226impl<'a, C> common::CallBuilder for ProjectLocationGlobalDomainBackupGetIamPolicyCall<'a, C> {}
3227
3228impl<'a, C> ProjectLocationGlobalDomainBackupGetIamPolicyCall<'a, C>
3229where
3230    C: common::Connector,
3231{
3232    /// Perform the operation you have build so far.
3233    pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
3234        use std::borrow::Cow;
3235        use std::io::{Read, Seek};
3236
3237        use common::{url::Params, ToParts};
3238        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
3239
3240        let mut dd = common::DefaultDelegate;
3241        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
3242        dlg.begin(common::MethodInfo {
3243            id: "managedidentities.projects.locations.global.domains.backups.getIamPolicy",
3244            http_method: hyper::Method::GET,
3245        });
3246
3247        for &field in ["alt", "resource", "options.requestedPolicyVersion"].iter() {
3248            if self._additional_params.contains_key(field) {
3249                dlg.finished(false);
3250                return Err(common::Error::FieldClash(field));
3251            }
3252        }
3253
3254        let mut params = Params::with_capacity(4 + self._additional_params.len());
3255        params.push("resource", self._resource);
3256        if let Some(value) = self._options_requested_policy_version.as_ref() {
3257            params.push("options.requestedPolicyVersion", value.to_string());
3258        }
3259
3260        params.extend(self._additional_params.iter());
3261
3262        params.push("alt", "json");
3263        let mut url = self.hub._base_url.clone() + "v1/{+resource}:getIamPolicy";
3264        if self._scopes.is_empty() {
3265            self._scopes
3266                .insert(Scope::CloudPlatform.as_ref().to_string());
3267        }
3268
3269        #[allow(clippy::single_element_loop)]
3270        for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
3271            url = params.uri_replacement(url, param_name, find_this, true);
3272        }
3273        {
3274            let to_remove = ["resource"];
3275            params.remove_params(&to_remove);
3276        }
3277
3278        let url = params.parse_with_url(&url);
3279
3280        loop {
3281            let token = match self
3282                .hub
3283                .auth
3284                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
3285                .await
3286            {
3287                Ok(token) => token,
3288                Err(e) => match dlg.token(e) {
3289                    Ok(token) => token,
3290                    Err(e) => {
3291                        dlg.finished(false);
3292                        return Err(common::Error::MissingToken(e));
3293                    }
3294                },
3295            };
3296            let mut req_result = {
3297                let client = &self.hub.client;
3298                dlg.pre_request();
3299                let mut req_builder = hyper::Request::builder()
3300                    .method(hyper::Method::GET)
3301                    .uri(url.as_str())
3302                    .header(USER_AGENT, self.hub._user_agent.clone());
3303
3304                if let Some(token) = token.as_ref() {
3305                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
3306                }
3307
3308                let request = req_builder
3309                    .header(CONTENT_LENGTH, 0_u64)
3310                    .body(common::to_body::<String>(None));
3311
3312                client.request(request.unwrap()).await
3313            };
3314
3315            match req_result {
3316                Err(err) => {
3317                    if let common::Retry::After(d) = dlg.http_error(&err) {
3318                        sleep(d).await;
3319                        continue;
3320                    }
3321                    dlg.finished(false);
3322                    return Err(common::Error::HttpError(err));
3323                }
3324                Ok(res) => {
3325                    let (mut parts, body) = res.into_parts();
3326                    let mut body = common::Body::new(body);
3327                    if !parts.status.is_success() {
3328                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3329                        let error = serde_json::from_str(&common::to_string(&bytes));
3330                        let response = common::to_response(parts, bytes.into());
3331
3332                        if let common::Retry::After(d) =
3333                            dlg.http_failure(&response, error.as_ref().ok())
3334                        {
3335                            sleep(d).await;
3336                            continue;
3337                        }
3338
3339                        dlg.finished(false);
3340
3341                        return Err(match error {
3342                            Ok(value) => common::Error::BadRequest(value),
3343                            _ => common::Error::Failure(response),
3344                        });
3345                    }
3346                    let response = {
3347                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3348                        let encoded = common::to_string(&bytes);
3349                        match serde_json::from_str(&encoded) {
3350                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
3351                            Err(error) => {
3352                                dlg.response_json_decode_error(&encoded, &error);
3353                                return Err(common::Error::JsonDecodeError(
3354                                    encoded.to_string(),
3355                                    error,
3356                                ));
3357                            }
3358                        }
3359                    };
3360
3361                    dlg.finished(true);
3362                    return Ok(response);
3363                }
3364            }
3365        }
3366    }
3367
3368    /// REQUIRED: The resource for which the policy is being requested. See [Resource names](https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
3369    ///
3370    /// Sets the *resource* path property to the given value.
3371    ///
3372    /// Even though the property as already been set when instantiating this call,
3373    /// we provide this method for API completeness.
3374    pub fn resource(
3375        mut self,
3376        new_value: &str,
3377    ) -> ProjectLocationGlobalDomainBackupGetIamPolicyCall<'a, C> {
3378        self._resource = new_value.to_string();
3379        self
3380    }
3381    /// Optional. The maximum policy version that will be used to format the policy. Valid values are 0, 1, and 3. Requests specifying an invalid value will be rejected. Requests for policies with any conditional role bindings must specify version 3. Policies with no conditional role bindings may specify any valid value or leave the field unset. The policy in the response might use the policy version that you specified, or it might use a lower policy version. For example, if you specify version 3, but the policy has no conditional role bindings, the response uses version 1. To learn which resources support conditions in their IAM policies, see the [IAM documentation](https://cloud.google.com/iam/help/conditions/resource-policies).
3382    ///
3383    /// Sets the *options.requested policy version* query property to the given value.
3384    pub fn options_requested_policy_version(
3385        mut self,
3386        new_value: i32,
3387    ) -> ProjectLocationGlobalDomainBackupGetIamPolicyCall<'a, C> {
3388        self._options_requested_policy_version = Some(new_value);
3389        self
3390    }
3391    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3392    /// while executing the actual API request.
3393    ///
3394    /// ````text
3395    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
3396    /// ````
3397    ///
3398    /// Sets the *delegate* property to the given value.
3399    pub fn delegate(
3400        mut self,
3401        new_value: &'a mut dyn common::Delegate,
3402    ) -> ProjectLocationGlobalDomainBackupGetIamPolicyCall<'a, C> {
3403        self._delegate = Some(new_value);
3404        self
3405    }
3406
3407    /// Set any additional parameter of the query string used in the request.
3408    /// It should be used to set parameters which are not yet available through their own
3409    /// setters.
3410    ///
3411    /// Please note that this method must not be used to set any of the known parameters
3412    /// which have their own setter method. If done anyway, the request will fail.
3413    ///
3414    /// # Additional Parameters
3415    ///
3416    /// * *$.xgafv* (query-string) - V1 error format.
3417    /// * *access_token* (query-string) - OAuth access token.
3418    /// * *alt* (query-string) - Data format for response.
3419    /// * *callback* (query-string) - JSONP
3420    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
3421    /// * *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.
3422    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3423    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
3424    /// * *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.
3425    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
3426    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
3427    pub fn param<T>(
3428        mut self,
3429        name: T,
3430        value: T,
3431    ) -> ProjectLocationGlobalDomainBackupGetIamPolicyCall<'a, C>
3432    where
3433        T: AsRef<str>,
3434    {
3435        self._additional_params
3436            .insert(name.as_ref().to_string(), value.as_ref().to_string());
3437        self
3438    }
3439
3440    /// Identifies the authorization scope for the method you are building.
3441    ///
3442    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
3443    /// [`Scope::CloudPlatform`].
3444    ///
3445    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
3446    /// tokens for more than one scope.
3447    ///
3448    /// Usually there is more than one suitable scope to authorize an operation, some of which may
3449    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
3450    /// sufficient, a read-write scope will do as well.
3451    pub fn add_scope<St>(
3452        mut self,
3453        scope: St,
3454    ) -> ProjectLocationGlobalDomainBackupGetIamPolicyCall<'a, C>
3455    where
3456        St: AsRef<str>,
3457    {
3458        self._scopes.insert(String::from(scope.as_ref()));
3459        self
3460    }
3461    /// Identifies the authorization scope(s) for the method you are building.
3462    ///
3463    /// See [`Self::add_scope()`] for details.
3464    pub fn add_scopes<I, St>(
3465        mut self,
3466        scopes: I,
3467    ) -> ProjectLocationGlobalDomainBackupGetIamPolicyCall<'a, C>
3468    where
3469        I: IntoIterator<Item = St>,
3470        St: AsRef<str>,
3471    {
3472        self._scopes
3473            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
3474        self
3475    }
3476
3477    /// Removes all scopes, and no default scope will be used either.
3478    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
3479    /// for details).
3480    pub fn clear_scopes(mut self) -> ProjectLocationGlobalDomainBackupGetIamPolicyCall<'a, C> {
3481        self._scopes.clear();
3482        self
3483    }
3484}
3485
3486/// Lists Backup in a given project.
3487///
3488/// A builder for the *locations.global.domains.backups.list* method supported by a *project* resource.
3489/// It is not used directly, but through a [`ProjectMethods`] instance.
3490///
3491/// # Example
3492///
3493/// Instantiate a resource method builder
3494///
3495/// ```test_harness,no_run
3496/// # extern crate hyper;
3497/// # extern crate hyper_rustls;
3498/// # extern crate google_managedidentities1 as managedidentities1;
3499/// # async fn dox() {
3500/// # use managedidentities1::{ManagedServiceForMicrosoftActiveDirectoryConsumerAPI, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3501///
3502/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
3503/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
3504/// #     .with_native_roots()
3505/// #     .unwrap()
3506/// #     .https_only()
3507/// #     .enable_http2()
3508/// #     .build();
3509///
3510/// # let executor = hyper_util::rt::TokioExecutor::new();
3511/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
3512/// #     secret,
3513/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3514/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
3515/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
3516/// #     ),
3517/// # ).build().await.unwrap();
3518///
3519/// # let client = hyper_util::client::legacy::Client::builder(
3520/// #     hyper_util::rt::TokioExecutor::new()
3521/// # )
3522/// # .build(
3523/// #     hyper_rustls::HttpsConnectorBuilder::new()
3524/// #         .with_native_roots()
3525/// #         .unwrap()
3526/// #         .https_or_http()
3527/// #         .enable_http2()
3528/// #         .build()
3529/// # );
3530/// # let mut hub = ManagedServiceForMicrosoftActiveDirectoryConsumerAPI::new(client, auth);
3531/// // You can configure optional parameters by calling the respective setters at will, and
3532/// // execute the final call using `doit()`.
3533/// // Values shown here are possibly random and not representative !
3534/// let result = hub.projects().locations_global_domains_backups_list("parent")
3535///              .page_token("gubergren")
3536///              .page_size(-51)
3537///              .order_by("gubergren")
3538///              .filter("eos")
3539///              .doit().await;
3540/// # }
3541/// ```
3542pub struct ProjectLocationGlobalDomainBackupListCall<'a, C>
3543where
3544    C: 'a,
3545{
3546    hub: &'a ManagedServiceForMicrosoftActiveDirectoryConsumerAPI<C>,
3547    _parent: String,
3548    _page_token: Option<String>,
3549    _page_size: Option<i32>,
3550    _order_by: Option<String>,
3551    _filter: Option<String>,
3552    _delegate: Option<&'a mut dyn common::Delegate>,
3553    _additional_params: HashMap<String, String>,
3554    _scopes: BTreeSet<String>,
3555}
3556
3557impl<'a, C> common::CallBuilder for ProjectLocationGlobalDomainBackupListCall<'a, C> {}
3558
3559impl<'a, C> ProjectLocationGlobalDomainBackupListCall<'a, C>
3560where
3561    C: common::Connector,
3562{
3563    /// Perform the operation you have build so far.
3564    pub async fn doit(mut self) -> common::Result<(common::Response, ListBackupsResponse)> {
3565        use std::borrow::Cow;
3566        use std::io::{Read, Seek};
3567
3568        use common::{url::Params, ToParts};
3569        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
3570
3571        let mut dd = common::DefaultDelegate;
3572        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
3573        dlg.begin(common::MethodInfo {
3574            id: "managedidentities.projects.locations.global.domains.backups.list",
3575            http_method: hyper::Method::GET,
3576        });
3577
3578        for &field in [
3579            "alt",
3580            "parent",
3581            "pageToken",
3582            "pageSize",
3583            "orderBy",
3584            "filter",
3585        ]
3586        .iter()
3587        {
3588            if self._additional_params.contains_key(field) {
3589                dlg.finished(false);
3590                return Err(common::Error::FieldClash(field));
3591            }
3592        }
3593
3594        let mut params = Params::with_capacity(7 + self._additional_params.len());
3595        params.push("parent", self._parent);
3596        if let Some(value) = self._page_token.as_ref() {
3597            params.push("pageToken", value);
3598        }
3599        if let Some(value) = self._page_size.as_ref() {
3600            params.push("pageSize", value.to_string());
3601        }
3602        if let Some(value) = self._order_by.as_ref() {
3603            params.push("orderBy", value);
3604        }
3605        if let Some(value) = self._filter.as_ref() {
3606            params.push("filter", value);
3607        }
3608
3609        params.extend(self._additional_params.iter());
3610
3611        params.push("alt", "json");
3612        let mut url = self.hub._base_url.clone() + "v1/{+parent}/backups";
3613        if self._scopes.is_empty() {
3614            self._scopes
3615                .insert(Scope::CloudPlatform.as_ref().to_string());
3616        }
3617
3618        #[allow(clippy::single_element_loop)]
3619        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
3620            url = params.uri_replacement(url, param_name, find_this, true);
3621        }
3622        {
3623            let to_remove = ["parent"];
3624            params.remove_params(&to_remove);
3625        }
3626
3627        let url = params.parse_with_url(&url);
3628
3629        loop {
3630            let token = match self
3631                .hub
3632                .auth
3633                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
3634                .await
3635            {
3636                Ok(token) => token,
3637                Err(e) => match dlg.token(e) {
3638                    Ok(token) => token,
3639                    Err(e) => {
3640                        dlg.finished(false);
3641                        return Err(common::Error::MissingToken(e));
3642                    }
3643                },
3644            };
3645            let mut req_result = {
3646                let client = &self.hub.client;
3647                dlg.pre_request();
3648                let mut req_builder = hyper::Request::builder()
3649                    .method(hyper::Method::GET)
3650                    .uri(url.as_str())
3651                    .header(USER_AGENT, self.hub._user_agent.clone());
3652
3653                if let Some(token) = token.as_ref() {
3654                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
3655                }
3656
3657                let request = req_builder
3658                    .header(CONTENT_LENGTH, 0_u64)
3659                    .body(common::to_body::<String>(None));
3660
3661                client.request(request.unwrap()).await
3662            };
3663
3664            match req_result {
3665                Err(err) => {
3666                    if let common::Retry::After(d) = dlg.http_error(&err) {
3667                        sleep(d).await;
3668                        continue;
3669                    }
3670                    dlg.finished(false);
3671                    return Err(common::Error::HttpError(err));
3672                }
3673                Ok(res) => {
3674                    let (mut parts, body) = res.into_parts();
3675                    let mut body = common::Body::new(body);
3676                    if !parts.status.is_success() {
3677                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3678                        let error = serde_json::from_str(&common::to_string(&bytes));
3679                        let response = common::to_response(parts, bytes.into());
3680
3681                        if let common::Retry::After(d) =
3682                            dlg.http_failure(&response, error.as_ref().ok())
3683                        {
3684                            sleep(d).await;
3685                            continue;
3686                        }
3687
3688                        dlg.finished(false);
3689
3690                        return Err(match error {
3691                            Ok(value) => common::Error::BadRequest(value),
3692                            _ => common::Error::Failure(response),
3693                        });
3694                    }
3695                    let response = {
3696                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3697                        let encoded = common::to_string(&bytes);
3698                        match serde_json::from_str(&encoded) {
3699                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
3700                            Err(error) => {
3701                                dlg.response_json_decode_error(&encoded, &error);
3702                                return Err(common::Error::JsonDecodeError(
3703                                    encoded.to_string(),
3704                                    error,
3705                                ));
3706                            }
3707                        }
3708                    };
3709
3710                    dlg.finished(true);
3711                    return Ok(response);
3712                }
3713            }
3714        }
3715    }
3716
3717    /// Required. The domain resource name using the form: `projects/{project_id}/locations/global/domains/{domain_name}`
3718    ///
3719    /// Sets the *parent* path property to the given value.
3720    ///
3721    /// Even though the property as already been set when instantiating this call,
3722    /// we provide this method for API completeness.
3723    pub fn parent(mut self, new_value: &str) -> ProjectLocationGlobalDomainBackupListCall<'a, C> {
3724        self._parent = new_value.to_string();
3725        self
3726    }
3727    /// Optional. The `next_page_token` value returned from a previous List request, if any.
3728    ///
3729    /// Sets the *page token* query property to the given value.
3730    pub fn page_token(
3731        mut self,
3732        new_value: &str,
3733    ) -> ProjectLocationGlobalDomainBackupListCall<'a, C> {
3734        self._page_token = Some(new_value.to_string());
3735        self
3736    }
3737    /// Optional. The maximum number of items to return. If not specified, a default value of 1000 will be used by the service. Regardless of the page_size value, the response may include a partial list and a caller should only rely on response's next_page_token to determine if there are more instances left to be queried.
3738    ///
3739    /// Sets the *page size* query property to the given value.
3740    pub fn page_size(mut self, new_value: i32) -> ProjectLocationGlobalDomainBackupListCall<'a, C> {
3741        self._page_size = Some(new_value);
3742        self
3743    }
3744    /// Optional. Specifies the ordering of results following syntax at https://cloud.google.com/apis/design/design_patterns#sorting_order.
3745    ///
3746    /// Sets the *order by* query property to the given value.
3747    pub fn order_by(mut self, new_value: &str) -> ProjectLocationGlobalDomainBackupListCall<'a, C> {
3748        self._order_by = Some(new_value.to_string());
3749        self
3750    }
3751    /// Optional. Filter specifying constraints of a list operation.
3752    ///
3753    /// Sets the *filter* query property to the given value.
3754    pub fn filter(mut self, new_value: &str) -> ProjectLocationGlobalDomainBackupListCall<'a, C> {
3755        self._filter = Some(new_value.to_string());
3756        self
3757    }
3758    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3759    /// while executing the actual API request.
3760    ///
3761    /// ````text
3762    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
3763    /// ````
3764    ///
3765    /// Sets the *delegate* property to the given value.
3766    pub fn delegate(
3767        mut self,
3768        new_value: &'a mut dyn common::Delegate,
3769    ) -> ProjectLocationGlobalDomainBackupListCall<'a, C> {
3770        self._delegate = Some(new_value);
3771        self
3772    }
3773
3774    /// Set any additional parameter of the query string used in the request.
3775    /// It should be used to set parameters which are not yet available through their own
3776    /// setters.
3777    ///
3778    /// Please note that this method must not be used to set any of the known parameters
3779    /// which have their own setter method. If done anyway, the request will fail.
3780    ///
3781    /// # Additional Parameters
3782    ///
3783    /// * *$.xgafv* (query-string) - V1 error format.
3784    /// * *access_token* (query-string) - OAuth access token.
3785    /// * *alt* (query-string) - Data format for response.
3786    /// * *callback* (query-string) - JSONP
3787    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
3788    /// * *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.
3789    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3790    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
3791    /// * *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.
3792    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
3793    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
3794    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationGlobalDomainBackupListCall<'a, C>
3795    where
3796        T: AsRef<str>,
3797    {
3798        self._additional_params
3799            .insert(name.as_ref().to_string(), value.as_ref().to_string());
3800        self
3801    }
3802
3803    /// Identifies the authorization scope for the method you are building.
3804    ///
3805    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
3806    /// [`Scope::CloudPlatform`].
3807    ///
3808    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
3809    /// tokens for more than one scope.
3810    ///
3811    /// Usually there is more than one suitable scope to authorize an operation, some of which may
3812    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
3813    /// sufficient, a read-write scope will do as well.
3814    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationGlobalDomainBackupListCall<'a, C>
3815    where
3816        St: AsRef<str>,
3817    {
3818        self._scopes.insert(String::from(scope.as_ref()));
3819        self
3820    }
3821    /// Identifies the authorization scope(s) for the method you are building.
3822    ///
3823    /// See [`Self::add_scope()`] for details.
3824    pub fn add_scopes<I, St>(
3825        mut self,
3826        scopes: I,
3827    ) -> ProjectLocationGlobalDomainBackupListCall<'a, C>
3828    where
3829        I: IntoIterator<Item = St>,
3830        St: AsRef<str>,
3831    {
3832        self._scopes
3833            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
3834        self
3835    }
3836
3837    /// Removes all scopes, and no default scope will be used either.
3838    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
3839    /// for details).
3840    pub fn clear_scopes(mut self) -> ProjectLocationGlobalDomainBackupListCall<'a, C> {
3841        self._scopes.clear();
3842        self
3843    }
3844}
3845
3846/// Updates the labels for specified Backup.
3847///
3848/// A builder for the *locations.global.domains.backups.patch* method supported by a *project* resource.
3849/// It is not used directly, but through a [`ProjectMethods`] instance.
3850///
3851/// # Example
3852///
3853/// Instantiate a resource method builder
3854///
3855/// ```test_harness,no_run
3856/// # extern crate hyper;
3857/// # extern crate hyper_rustls;
3858/// # extern crate google_managedidentities1 as managedidentities1;
3859/// use managedidentities1::api::Backup;
3860/// # async fn dox() {
3861/// # use managedidentities1::{ManagedServiceForMicrosoftActiveDirectoryConsumerAPI, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3862///
3863/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
3864/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
3865/// #     .with_native_roots()
3866/// #     .unwrap()
3867/// #     .https_only()
3868/// #     .enable_http2()
3869/// #     .build();
3870///
3871/// # let executor = hyper_util::rt::TokioExecutor::new();
3872/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
3873/// #     secret,
3874/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3875/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
3876/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
3877/// #     ),
3878/// # ).build().await.unwrap();
3879///
3880/// # let client = hyper_util::client::legacy::Client::builder(
3881/// #     hyper_util::rt::TokioExecutor::new()
3882/// # )
3883/// # .build(
3884/// #     hyper_rustls::HttpsConnectorBuilder::new()
3885/// #         .with_native_roots()
3886/// #         .unwrap()
3887/// #         .https_or_http()
3888/// #         .enable_http2()
3889/// #         .build()
3890/// # );
3891/// # let mut hub = ManagedServiceForMicrosoftActiveDirectoryConsumerAPI::new(client, auth);
3892/// // As the method needs a request, you would usually fill it with the desired information
3893/// // into the respective structure. Some of the parts shown here might not be applicable !
3894/// // Values shown here are possibly random and not representative !
3895/// let mut req = Backup::default();
3896///
3897/// // You can configure optional parameters by calling the respective setters at will, and
3898/// // execute the final call using `doit()`.
3899/// // Values shown here are possibly random and not representative !
3900/// let result = hub.projects().locations_global_domains_backups_patch(req, "name")
3901///              .update_mask(FieldMask::new::<&str>(&[]))
3902///              .doit().await;
3903/// # }
3904/// ```
3905pub struct ProjectLocationGlobalDomainBackupPatchCall<'a, C>
3906where
3907    C: 'a,
3908{
3909    hub: &'a ManagedServiceForMicrosoftActiveDirectoryConsumerAPI<C>,
3910    _request: Backup,
3911    _name: String,
3912    _update_mask: Option<common::FieldMask>,
3913    _delegate: Option<&'a mut dyn common::Delegate>,
3914    _additional_params: HashMap<String, String>,
3915    _scopes: BTreeSet<String>,
3916}
3917
3918impl<'a, C> common::CallBuilder for ProjectLocationGlobalDomainBackupPatchCall<'a, C> {}
3919
3920impl<'a, C> ProjectLocationGlobalDomainBackupPatchCall<'a, C>
3921where
3922    C: common::Connector,
3923{
3924    /// Perform the operation you have build so far.
3925    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
3926        use std::borrow::Cow;
3927        use std::io::{Read, Seek};
3928
3929        use common::{url::Params, ToParts};
3930        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
3931
3932        let mut dd = common::DefaultDelegate;
3933        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
3934        dlg.begin(common::MethodInfo {
3935            id: "managedidentities.projects.locations.global.domains.backups.patch",
3936            http_method: hyper::Method::PATCH,
3937        });
3938
3939        for &field in ["alt", "name", "updateMask"].iter() {
3940            if self._additional_params.contains_key(field) {
3941                dlg.finished(false);
3942                return Err(common::Error::FieldClash(field));
3943            }
3944        }
3945
3946        let mut params = Params::with_capacity(5 + self._additional_params.len());
3947        params.push("name", self._name);
3948        if let Some(value) = self._update_mask.as_ref() {
3949            params.push("updateMask", value.to_string());
3950        }
3951
3952        params.extend(self._additional_params.iter());
3953
3954        params.push("alt", "json");
3955        let mut url = self.hub._base_url.clone() + "v1/{+name}";
3956        if self._scopes.is_empty() {
3957            self._scopes
3958                .insert(Scope::CloudPlatform.as_ref().to_string());
3959        }
3960
3961        #[allow(clippy::single_element_loop)]
3962        for &(find_this, param_name) in [("{+name}", "name")].iter() {
3963            url = params.uri_replacement(url, param_name, find_this, true);
3964        }
3965        {
3966            let to_remove = ["name"];
3967            params.remove_params(&to_remove);
3968        }
3969
3970        let url = params.parse_with_url(&url);
3971
3972        let mut json_mime_type = mime::APPLICATION_JSON;
3973        let mut request_value_reader = {
3974            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
3975            common::remove_json_null_values(&mut value);
3976            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
3977            serde_json::to_writer(&mut dst, &value).unwrap();
3978            dst
3979        };
3980        let request_size = request_value_reader
3981            .seek(std::io::SeekFrom::End(0))
3982            .unwrap();
3983        request_value_reader
3984            .seek(std::io::SeekFrom::Start(0))
3985            .unwrap();
3986
3987        loop {
3988            let token = match self
3989                .hub
3990                .auth
3991                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
3992                .await
3993            {
3994                Ok(token) => token,
3995                Err(e) => match dlg.token(e) {
3996                    Ok(token) => token,
3997                    Err(e) => {
3998                        dlg.finished(false);
3999                        return Err(common::Error::MissingToken(e));
4000                    }
4001                },
4002            };
4003            request_value_reader
4004                .seek(std::io::SeekFrom::Start(0))
4005                .unwrap();
4006            let mut req_result = {
4007                let client = &self.hub.client;
4008                dlg.pre_request();
4009                let mut req_builder = hyper::Request::builder()
4010                    .method(hyper::Method::PATCH)
4011                    .uri(url.as_str())
4012                    .header(USER_AGENT, self.hub._user_agent.clone());
4013
4014                if let Some(token) = token.as_ref() {
4015                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
4016                }
4017
4018                let request = req_builder
4019                    .header(CONTENT_TYPE, json_mime_type.to_string())
4020                    .header(CONTENT_LENGTH, request_size as u64)
4021                    .body(common::to_body(
4022                        request_value_reader.get_ref().clone().into(),
4023                    ));
4024
4025                client.request(request.unwrap()).await
4026            };
4027
4028            match req_result {
4029                Err(err) => {
4030                    if let common::Retry::After(d) = dlg.http_error(&err) {
4031                        sleep(d).await;
4032                        continue;
4033                    }
4034                    dlg.finished(false);
4035                    return Err(common::Error::HttpError(err));
4036                }
4037                Ok(res) => {
4038                    let (mut parts, body) = res.into_parts();
4039                    let mut body = common::Body::new(body);
4040                    if !parts.status.is_success() {
4041                        let bytes = common::to_bytes(body).await.unwrap_or_default();
4042                        let error = serde_json::from_str(&common::to_string(&bytes));
4043                        let response = common::to_response(parts, bytes.into());
4044
4045                        if let common::Retry::After(d) =
4046                            dlg.http_failure(&response, error.as_ref().ok())
4047                        {
4048                            sleep(d).await;
4049                            continue;
4050                        }
4051
4052                        dlg.finished(false);
4053
4054                        return Err(match error {
4055                            Ok(value) => common::Error::BadRequest(value),
4056                            _ => common::Error::Failure(response),
4057                        });
4058                    }
4059                    let response = {
4060                        let bytes = common::to_bytes(body).await.unwrap_or_default();
4061                        let encoded = common::to_string(&bytes);
4062                        match serde_json::from_str(&encoded) {
4063                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4064                            Err(error) => {
4065                                dlg.response_json_decode_error(&encoded, &error);
4066                                return Err(common::Error::JsonDecodeError(
4067                                    encoded.to_string(),
4068                                    error,
4069                                ));
4070                            }
4071                        }
4072                    };
4073
4074                    dlg.finished(true);
4075                    return Ok(response);
4076                }
4077            }
4078        }
4079    }
4080
4081    ///
4082    /// Sets the *request* property to the given value.
4083    ///
4084    /// Even though the property as already been set when instantiating this call,
4085    /// we provide this method for API completeness.
4086    pub fn request(
4087        mut self,
4088        new_value: Backup,
4089    ) -> ProjectLocationGlobalDomainBackupPatchCall<'a, C> {
4090        self._request = new_value;
4091        self
4092    }
4093    /// Output only. The unique name of the Backup in the form of `projects/{project_id}/locations/global/domains/{domain_name}/backups/{name}`
4094    ///
4095    /// Sets the *name* path property to the given value.
4096    ///
4097    /// Even though the property as already been set when instantiating this call,
4098    /// we provide this method for API completeness.
4099    pub fn name(mut self, new_value: &str) -> ProjectLocationGlobalDomainBackupPatchCall<'a, C> {
4100        self._name = new_value.to_string();
4101        self
4102    }
4103    /// 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 from Backup: * `labels`
4104    ///
4105    /// Sets the *update mask* query property to the given value.
4106    pub fn update_mask(
4107        mut self,
4108        new_value: common::FieldMask,
4109    ) -> ProjectLocationGlobalDomainBackupPatchCall<'a, C> {
4110        self._update_mask = Some(new_value);
4111        self
4112    }
4113    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4114    /// while executing the actual API request.
4115    ///
4116    /// ````text
4117    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
4118    /// ````
4119    ///
4120    /// Sets the *delegate* property to the given value.
4121    pub fn delegate(
4122        mut self,
4123        new_value: &'a mut dyn common::Delegate,
4124    ) -> ProjectLocationGlobalDomainBackupPatchCall<'a, C> {
4125        self._delegate = Some(new_value);
4126        self
4127    }
4128
4129    /// Set any additional parameter of the query string used in the request.
4130    /// It should be used to set parameters which are not yet available through their own
4131    /// setters.
4132    ///
4133    /// Please note that this method must not be used to set any of the known parameters
4134    /// which have their own setter method. If done anyway, the request will fail.
4135    ///
4136    /// # Additional Parameters
4137    ///
4138    /// * *$.xgafv* (query-string) - V1 error format.
4139    /// * *access_token* (query-string) - OAuth access token.
4140    /// * *alt* (query-string) - Data format for response.
4141    /// * *callback* (query-string) - JSONP
4142    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4143    /// * *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.
4144    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4145    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4146    /// * *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.
4147    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4148    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4149    pub fn param<T>(
4150        mut self,
4151        name: T,
4152        value: T,
4153    ) -> ProjectLocationGlobalDomainBackupPatchCall<'a, C>
4154    where
4155        T: AsRef<str>,
4156    {
4157        self._additional_params
4158            .insert(name.as_ref().to_string(), value.as_ref().to_string());
4159        self
4160    }
4161
4162    /// Identifies the authorization scope for the method you are building.
4163    ///
4164    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
4165    /// [`Scope::CloudPlatform`].
4166    ///
4167    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4168    /// tokens for more than one scope.
4169    ///
4170    /// Usually there is more than one suitable scope to authorize an operation, some of which may
4171    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
4172    /// sufficient, a read-write scope will do as well.
4173    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationGlobalDomainBackupPatchCall<'a, C>
4174    where
4175        St: AsRef<str>,
4176    {
4177        self._scopes.insert(String::from(scope.as_ref()));
4178        self
4179    }
4180    /// Identifies the authorization scope(s) for the method you are building.
4181    ///
4182    /// See [`Self::add_scope()`] for details.
4183    pub fn add_scopes<I, St>(
4184        mut self,
4185        scopes: I,
4186    ) -> ProjectLocationGlobalDomainBackupPatchCall<'a, C>
4187    where
4188        I: IntoIterator<Item = St>,
4189        St: AsRef<str>,
4190    {
4191        self._scopes
4192            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
4193        self
4194    }
4195
4196    /// Removes all scopes, and no default scope will be used either.
4197    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
4198    /// for details).
4199    pub fn clear_scopes(mut self) -> ProjectLocationGlobalDomainBackupPatchCall<'a, C> {
4200        self._scopes.clear();
4201        self
4202    }
4203}
4204
4205/// Sets the access control policy on the specified resource. Replaces any existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` errors.
4206///
4207/// A builder for the *locations.global.domains.backups.setIamPolicy* method supported by a *project* resource.
4208/// It is not used directly, but through a [`ProjectMethods`] instance.
4209///
4210/// # Example
4211///
4212/// Instantiate a resource method builder
4213///
4214/// ```test_harness,no_run
4215/// # extern crate hyper;
4216/// # extern crate hyper_rustls;
4217/// # extern crate google_managedidentities1 as managedidentities1;
4218/// use managedidentities1::api::SetIamPolicyRequest;
4219/// # async fn dox() {
4220/// # use managedidentities1::{ManagedServiceForMicrosoftActiveDirectoryConsumerAPI, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4221///
4222/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4223/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
4224/// #     .with_native_roots()
4225/// #     .unwrap()
4226/// #     .https_only()
4227/// #     .enable_http2()
4228/// #     .build();
4229///
4230/// # let executor = hyper_util::rt::TokioExecutor::new();
4231/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
4232/// #     secret,
4233/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4234/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
4235/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
4236/// #     ),
4237/// # ).build().await.unwrap();
4238///
4239/// # let client = hyper_util::client::legacy::Client::builder(
4240/// #     hyper_util::rt::TokioExecutor::new()
4241/// # )
4242/// # .build(
4243/// #     hyper_rustls::HttpsConnectorBuilder::new()
4244/// #         .with_native_roots()
4245/// #         .unwrap()
4246/// #         .https_or_http()
4247/// #         .enable_http2()
4248/// #         .build()
4249/// # );
4250/// # let mut hub = ManagedServiceForMicrosoftActiveDirectoryConsumerAPI::new(client, auth);
4251/// // As the method needs a request, you would usually fill it with the desired information
4252/// // into the respective structure. Some of the parts shown here might not be applicable !
4253/// // Values shown here are possibly random and not representative !
4254/// let mut req = SetIamPolicyRequest::default();
4255///
4256/// // You can configure optional parameters by calling the respective setters at will, and
4257/// // execute the final call using `doit()`.
4258/// // Values shown here are possibly random and not representative !
4259/// let result = hub.projects().locations_global_domains_backups_set_iam_policy(req, "resource")
4260///              .doit().await;
4261/// # }
4262/// ```
4263pub struct ProjectLocationGlobalDomainBackupSetIamPolicyCall<'a, C>
4264where
4265    C: 'a,
4266{
4267    hub: &'a ManagedServiceForMicrosoftActiveDirectoryConsumerAPI<C>,
4268    _request: SetIamPolicyRequest,
4269    _resource: String,
4270    _delegate: Option<&'a mut dyn common::Delegate>,
4271    _additional_params: HashMap<String, String>,
4272    _scopes: BTreeSet<String>,
4273}
4274
4275impl<'a, C> common::CallBuilder for ProjectLocationGlobalDomainBackupSetIamPolicyCall<'a, C> {}
4276
4277impl<'a, C> ProjectLocationGlobalDomainBackupSetIamPolicyCall<'a, C>
4278where
4279    C: common::Connector,
4280{
4281    /// Perform the operation you have build so far.
4282    pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
4283        use std::borrow::Cow;
4284        use std::io::{Read, Seek};
4285
4286        use common::{url::Params, ToParts};
4287        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
4288
4289        let mut dd = common::DefaultDelegate;
4290        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
4291        dlg.begin(common::MethodInfo {
4292            id: "managedidentities.projects.locations.global.domains.backups.setIamPolicy",
4293            http_method: hyper::Method::POST,
4294        });
4295
4296        for &field in ["alt", "resource"].iter() {
4297            if self._additional_params.contains_key(field) {
4298                dlg.finished(false);
4299                return Err(common::Error::FieldClash(field));
4300            }
4301        }
4302
4303        let mut params = Params::with_capacity(4 + self._additional_params.len());
4304        params.push("resource", self._resource);
4305
4306        params.extend(self._additional_params.iter());
4307
4308        params.push("alt", "json");
4309        let mut url = self.hub._base_url.clone() + "v1/{+resource}:setIamPolicy";
4310        if self._scopes.is_empty() {
4311            self._scopes
4312                .insert(Scope::CloudPlatform.as_ref().to_string());
4313        }
4314
4315        #[allow(clippy::single_element_loop)]
4316        for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
4317            url = params.uri_replacement(url, param_name, find_this, true);
4318        }
4319        {
4320            let to_remove = ["resource"];
4321            params.remove_params(&to_remove);
4322        }
4323
4324        let url = params.parse_with_url(&url);
4325
4326        let mut json_mime_type = mime::APPLICATION_JSON;
4327        let mut request_value_reader = {
4328            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
4329            common::remove_json_null_values(&mut value);
4330            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
4331            serde_json::to_writer(&mut dst, &value).unwrap();
4332            dst
4333        };
4334        let request_size = request_value_reader
4335            .seek(std::io::SeekFrom::End(0))
4336            .unwrap();
4337        request_value_reader
4338            .seek(std::io::SeekFrom::Start(0))
4339            .unwrap();
4340
4341        loop {
4342            let token = match self
4343                .hub
4344                .auth
4345                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
4346                .await
4347            {
4348                Ok(token) => token,
4349                Err(e) => match dlg.token(e) {
4350                    Ok(token) => token,
4351                    Err(e) => {
4352                        dlg.finished(false);
4353                        return Err(common::Error::MissingToken(e));
4354                    }
4355                },
4356            };
4357            request_value_reader
4358                .seek(std::io::SeekFrom::Start(0))
4359                .unwrap();
4360            let mut req_result = {
4361                let client = &self.hub.client;
4362                dlg.pre_request();
4363                let mut req_builder = hyper::Request::builder()
4364                    .method(hyper::Method::POST)
4365                    .uri(url.as_str())
4366                    .header(USER_AGENT, self.hub._user_agent.clone());
4367
4368                if let Some(token) = token.as_ref() {
4369                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
4370                }
4371
4372                let request = req_builder
4373                    .header(CONTENT_TYPE, json_mime_type.to_string())
4374                    .header(CONTENT_LENGTH, request_size as u64)
4375                    .body(common::to_body(
4376                        request_value_reader.get_ref().clone().into(),
4377                    ));
4378
4379                client.request(request.unwrap()).await
4380            };
4381
4382            match req_result {
4383                Err(err) => {
4384                    if let common::Retry::After(d) = dlg.http_error(&err) {
4385                        sleep(d).await;
4386                        continue;
4387                    }
4388                    dlg.finished(false);
4389                    return Err(common::Error::HttpError(err));
4390                }
4391                Ok(res) => {
4392                    let (mut parts, body) = res.into_parts();
4393                    let mut body = common::Body::new(body);
4394                    if !parts.status.is_success() {
4395                        let bytes = common::to_bytes(body).await.unwrap_or_default();
4396                        let error = serde_json::from_str(&common::to_string(&bytes));
4397                        let response = common::to_response(parts, bytes.into());
4398
4399                        if let common::Retry::After(d) =
4400                            dlg.http_failure(&response, error.as_ref().ok())
4401                        {
4402                            sleep(d).await;
4403                            continue;
4404                        }
4405
4406                        dlg.finished(false);
4407
4408                        return Err(match error {
4409                            Ok(value) => common::Error::BadRequest(value),
4410                            _ => common::Error::Failure(response),
4411                        });
4412                    }
4413                    let response = {
4414                        let bytes = common::to_bytes(body).await.unwrap_or_default();
4415                        let encoded = common::to_string(&bytes);
4416                        match serde_json::from_str(&encoded) {
4417                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4418                            Err(error) => {
4419                                dlg.response_json_decode_error(&encoded, &error);
4420                                return Err(common::Error::JsonDecodeError(
4421                                    encoded.to_string(),
4422                                    error,
4423                                ));
4424                            }
4425                        }
4426                    };
4427
4428                    dlg.finished(true);
4429                    return Ok(response);
4430                }
4431            }
4432        }
4433    }
4434
4435    ///
4436    /// Sets the *request* property to the given value.
4437    ///
4438    /// Even though the property as already been set when instantiating this call,
4439    /// we provide this method for API completeness.
4440    pub fn request(
4441        mut self,
4442        new_value: SetIamPolicyRequest,
4443    ) -> ProjectLocationGlobalDomainBackupSetIamPolicyCall<'a, C> {
4444        self._request = new_value;
4445        self
4446    }
4447    /// REQUIRED: The resource for which the policy is being specified. See [Resource names](https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
4448    ///
4449    /// Sets the *resource* path property to the given value.
4450    ///
4451    /// Even though the property as already been set when instantiating this call,
4452    /// we provide this method for API completeness.
4453    pub fn resource(
4454        mut self,
4455        new_value: &str,
4456    ) -> ProjectLocationGlobalDomainBackupSetIamPolicyCall<'a, C> {
4457        self._resource = new_value.to_string();
4458        self
4459    }
4460    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4461    /// while executing the actual API request.
4462    ///
4463    /// ````text
4464    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
4465    /// ````
4466    ///
4467    /// Sets the *delegate* property to the given value.
4468    pub fn delegate(
4469        mut self,
4470        new_value: &'a mut dyn common::Delegate,
4471    ) -> ProjectLocationGlobalDomainBackupSetIamPolicyCall<'a, C> {
4472        self._delegate = Some(new_value);
4473        self
4474    }
4475
4476    /// Set any additional parameter of the query string used in the request.
4477    /// It should be used to set parameters which are not yet available through their own
4478    /// setters.
4479    ///
4480    /// Please note that this method must not be used to set any of the known parameters
4481    /// which have their own setter method. If done anyway, the request will fail.
4482    ///
4483    /// # Additional Parameters
4484    ///
4485    /// * *$.xgafv* (query-string) - V1 error format.
4486    /// * *access_token* (query-string) - OAuth access token.
4487    /// * *alt* (query-string) - Data format for response.
4488    /// * *callback* (query-string) - JSONP
4489    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4490    /// * *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.
4491    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4492    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4493    /// * *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.
4494    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4495    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4496    pub fn param<T>(
4497        mut self,
4498        name: T,
4499        value: T,
4500    ) -> ProjectLocationGlobalDomainBackupSetIamPolicyCall<'a, C>
4501    where
4502        T: AsRef<str>,
4503    {
4504        self._additional_params
4505            .insert(name.as_ref().to_string(), value.as_ref().to_string());
4506        self
4507    }
4508
4509    /// Identifies the authorization scope for the method you are building.
4510    ///
4511    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
4512    /// [`Scope::CloudPlatform`].
4513    ///
4514    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4515    /// tokens for more than one scope.
4516    ///
4517    /// Usually there is more than one suitable scope to authorize an operation, some of which may
4518    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
4519    /// sufficient, a read-write scope will do as well.
4520    pub fn add_scope<St>(
4521        mut self,
4522        scope: St,
4523    ) -> ProjectLocationGlobalDomainBackupSetIamPolicyCall<'a, C>
4524    where
4525        St: AsRef<str>,
4526    {
4527        self._scopes.insert(String::from(scope.as_ref()));
4528        self
4529    }
4530    /// Identifies the authorization scope(s) for the method you are building.
4531    ///
4532    /// See [`Self::add_scope()`] for details.
4533    pub fn add_scopes<I, St>(
4534        mut self,
4535        scopes: I,
4536    ) -> ProjectLocationGlobalDomainBackupSetIamPolicyCall<'a, C>
4537    where
4538        I: IntoIterator<Item = St>,
4539        St: AsRef<str>,
4540    {
4541        self._scopes
4542            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
4543        self
4544    }
4545
4546    /// Removes all scopes, and no default scope will be used either.
4547    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
4548    /// for details).
4549    pub fn clear_scopes(mut self) -> ProjectLocationGlobalDomainBackupSetIamPolicyCall<'a, C> {
4550        self._scopes.clear();
4551        self
4552    }
4553}
4554
4555/// Returns permissions that a caller has on the specified resource. If the resource does not exist, this will return an empty set of permissions, not a `NOT_FOUND` error. Note: This operation is designed to be used for building permission-aware UIs and command-line tools, not for authorization checking. This operation may "fail open" without warning.
4556///
4557/// A builder for the *locations.global.domains.backups.testIamPermissions* method supported by a *project* resource.
4558/// It is not used directly, but through a [`ProjectMethods`] instance.
4559///
4560/// # Example
4561///
4562/// Instantiate a resource method builder
4563///
4564/// ```test_harness,no_run
4565/// # extern crate hyper;
4566/// # extern crate hyper_rustls;
4567/// # extern crate google_managedidentities1 as managedidentities1;
4568/// use managedidentities1::api::TestIamPermissionsRequest;
4569/// # async fn dox() {
4570/// # use managedidentities1::{ManagedServiceForMicrosoftActiveDirectoryConsumerAPI, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4571///
4572/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4573/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
4574/// #     .with_native_roots()
4575/// #     .unwrap()
4576/// #     .https_only()
4577/// #     .enable_http2()
4578/// #     .build();
4579///
4580/// # let executor = hyper_util::rt::TokioExecutor::new();
4581/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
4582/// #     secret,
4583/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4584/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
4585/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
4586/// #     ),
4587/// # ).build().await.unwrap();
4588///
4589/// # let client = hyper_util::client::legacy::Client::builder(
4590/// #     hyper_util::rt::TokioExecutor::new()
4591/// # )
4592/// # .build(
4593/// #     hyper_rustls::HttpsConnectorBuilder::new()
4594/// #         .with_native_roots()
4595/// #         .unwrap()
4596/// #         .https_or_http()
4597/// #         .enable_http2()
4598/// #         .build()
4599/// # );
4600/// # let mut hub = ManagedServiceForMicrosoftActiveDirectoryConsumerAPI::new(client, auth);
4601/// // As the method needs a request, you would usually fill it with the desired information
4602/// // into the respective structure. Some of the parts shown here might not be applicable !
4603/// // Values shown here are possibly random and not representative !
4604/// let mut req = TestIamPermissionsRequest::default();
4605///
4606/// // You can configure optional parameters by calling the respective setters at will, and
4607/// // execute the final call using `doit()`.
4608/// // Values shown here are possibly random and not representative !
4609/// let result = hub.projects().locations_global_domains_backups_test_iam_permissions(req, "resource")
4610///              .doit().await;
4611/// # }
4612/// ```
4613pub struct ProjectLocationGlobalDomainBackupTestIamPermissionCall<'a, C>
4614where
4615    C: 'a,
4616{
4617    hub: &'a ManagedServiceForMicrosoftActiveDirectoryConsumerAPI<C>,
4618    _request: TestIamPermissionsRequest,
4619    _resource: String,
4620    _delegate: Option<&'a mut dyn common::Delegate>,
4621    _additional_params: HashMap<String, String>,
4622    _scopes: BTreeSet<String>,
4623}
4624
4625impl<'a, C> common::CallBuilder for ProjectLocationGlobalDomainBackupTestIamPermissionCall<'a, C> {}
4626
4627impl<'a, C> ProjectLocationGlobalDomainBackupTestIamPermissionCall<'a, C>
4628where
4629    C: common::Connector,
4630{
4631    /// Perform the operation you have build so far.
4632    pub async fn doit(mut self) -> common::Result<(common::Response, TestIamPermissionsResponse)> {
4633        use std::borrow::Cow;
4634        use std::io::{Read, Seek};
4635
4636        use common::{url::Params, ToParts};
4637        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
4638
4639        let mut dd = common::DefaultDelegate;
4640        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
4641        dlg.begin(common::MethodInfo {
4642            id: "managedidentities.projects.locations.global.domains.backups.testIamPermissions",
4643            http_method: hyper::Method::POST,
4644        });
4645
4646        for &field in ["alt", "resource"].iter() {
4647            if self._additional_params.contains_key(field) {
4648                dlg.finished(false);
4649                return Err(common::Error::FieldClash(field));
4650            }
4651        }
4652
4653        let mut params = Params::with_capacity(4 + self._additional_params.len());
4654        params.push("resource", self._resource);
4655
4656        params.extend(self._additional_params.iter());
4657
4658        params.push("alt", "json");
4659        let mut url = self.hub._base_url.clone() + "v1/{+resource}:testIamPermissions";
4660        if self._scopes.is_empty() {
4661            self._scopes
4662                .insert(Scope::CloudPlatform.as_ref().to_string());
4663        }
4664
4665        #[allow(clippy::single_element_loop)]
4666        for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
4667            url = params.uri_replacement(url, param_name, find_this, true);
4668        }
4669        {
4670            let to_remove = ["resource"];
4671            params.remove_params(&to_remove);
4672        }
4673
4674        let url = params.parse_with_url(&url);
4675
4676        let mut json_mime_type = mime::APPLICATION_JSON;
4677        let mut request_value_reader = {
4678            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
4679            common::remove_json_null_values(&mut value);
4680            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
4681            serde_json::to_writer(&mut dst, &value).unwrap();
4682            dst
4683        };
4684        let request_size = request_value_reader
4685            .seek(std::io::SeekFrom::End(0))
4686            .unwrap();
4687        request_value_reader
4688            .seek(std::io::SeekFrom::Start(0))
4689            .unwrap();
4690
4691        loop {
4692            let token = match self
4693                .hub
4694                .auth
4695                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
4696                .await
4697            {
4698                Ok(token) => token,
4699                Err(e) => match dlg.token(e) {
4700                    Ok(token) => token,
4701                    Err(e) => {
4702                        dlg.finished(false);
4703                        return Err(common::Error::MissingToken(e));
4704                    }
4705                },
4706            };
4707            request_value_reader
4708                .seek(std::io::SeekFrom::Start(0))
4709                .unwrap();
4710            let mut req_result = {
4711                let client = &self.hub.client;
4712                dlg.pre_request();
4713                let mut req_builder = hyper::Request::builder()
4714                    .method(hyper::Method::POST)
4715                    .uri(url.as_str())
4716                    .header(USER_AGENT, self.hub._user_agent.clone());
4717
4718                if let Some(token) = token.as_ref() {
4719                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
4720                }
4721
4722                let request = req_builder
4723                    .header(CONTENT_TYPE, json_mime_type.to_string())
4724                    .header(CONTENT_LENGTH, request_size as u64)
4725                    .body(common::to_body(
4726                        request_value_reader.get_ref().clone().into(),
4727                    ));
4728
4729                client.request(request.unwrap()).await
4730            };
4731
4732            match req_result {
4733                Err(err) => {
4734                    if let common::Retry::After(d) = dlg.http_error(&err) {
4735                        sleep(d).await;
4736                        continue;
4737                    }
4738                    dlg.finished(false);
4739                    return Err(common::Error::HttpError(err));
4740                }
4741                Ok(res) => {
4742                    let (mut parts, body) = res.into_parts();
4743                    let mut body = common::Body::new(body);
4744                    if !parts.status.is_success() {
4745                        let bytes = common::to_bytes(body).await.unwrap_or_default();
4746                        let error = serde_json::from_str(&common::to_string(&bytes));
4747                        let response = common::to_response(parts, bytes.into());
4748
4749                        if let common::Retry::After(d) =
4750                            dlg.http_failure(&response, error.as_ref().ok())
4751                        {
4752                            sleep(d).await;
4753                            continue;
4754                        }
4755
4756                        dlg.finished(false);
4757
4758                        return Err(match error {
4759                            Ok(value) => common::Error::BadRequest(value),
4760                            _ => common::Error::Failure(response),
4761                        });
4762                    }
4763                    let response = {
4764                        let bytes = common::to_bytes(body).await.unwrap_or_default();
4765                        let encoded = common::to_string(&bytes);
4766                        match serde_json::from_str(&encoded) {
4767                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4768                            Err(error) => {
4769                                dlg.response_json_decode_error(&encoded, &error);
4770                                return Err(common::Error::JsonDecodeError(
4771                                    encoded.to_string(),
4772                                    error,
4773                                ));
4774                            }
4775                        }
4776                    };
4777
4778                    dlg.finished(true);
4779                    return Ok(response);
4780                }
4781            }
4782        }
4783    }
4784
4785    ///
4786    /// Sets the *request* property to the given value.
4787    ///
4788    /// Even though the property as already been set when instantiating this call,
4789    /// we provide this method for API completeness.
4790    pub fn request(
4791        mut self,
4792        new_value: TestIamPermissionsRequest,
4793    ) -> ProjectLocationGlobalDomainBackupTestIamPermissionCall<'a, C> {
4794        self._request = new_value;
4795        self
4796    }
4797    /// REQUIRED: The resource for which the policy detail is being requested. See [Resource names](https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
4798    ///
4799    /// Sets the *resource* path property to the given value.
4800    ///
4801    /// Even though the property as already been set when instantiating this call,
4802    /// we provide this method for API completeness.
4803    pub fn resource(
4804        mut self,
4805        new_value: &str,
4806    ) -> ProjectLocationGlobalDomainBackupTestIamPermissionCall<'a, C> {
4807        self._resource = new_value.to_string();
4808        self
4809    }
4810    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4811    /// while executing the actual API request.
4812    ///
4813    /// ````text
4814    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
4815    /// ````
4816    ///
4817    /// Sets the *delegate* property to the given value.
4818    pub fn delegate(
4819        mut self,
4820        new_value: &'a mut dyn common::Delegate,
4821    ) -> ProjectLocationGlobalDomainBackupTestIamPermissionCall<'a, C> {
4822        self._delegate = Some(new_value);
4823        self
4824    }
4825
4826    /// Set any additional parameter of the query string used in the request.
4827    /// It should be used to set parameters which are not yet available through their own
4828    /// setters.
4829    ///
4830    /// Please note that this method must not be used to set any of the known parameters
4831    /// which have their own setter method. If done anyway, the request will fail.
4832    ///
4833    /// # Additional Parameters
4834    ///
4835    /// * *$.xgafv* (query-string) - V1 error format.
4836    /// * *access_token* (query-string) - OAuth access token.
4837    /// * *alt* (query-string) - Data format for response.
4838    /// * *callback* (query-string) - JSONP
4839    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4840    /// * *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.
4841    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4842    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4843    /// * *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.
4844    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4845    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4846    pub fn param<T>(
4847        mut self,
4848        name: T,
4849        value: T,
4850    ) -> ProjectLocationGlobalDomainBackupTestIamPermissionCall<'a, C>
4851    where
4852        T: AsRef<str>,
4853    {
4854        self._additional_params
4855            .insert(name.as_ref().to_string(), value.as_ref().to_string());
4856        self
4857    }
4858
4859    /// Identifies the authorization scope for the method you are building.
4860    ///
4861    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
4862    /// [`Scope::CloudPlatform`].
4863    ///
4864    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4865    /// tokens for more than one scope.
4866    ///
4867    /// Usually there is more than one suitable scope to authorize an operation, some of which may
4868    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
4869    /// sufficient, a read-write scope will do as well.
4870    pub fn add_scope<St>(
4871        mut self,
4872        scope: St,
4873    ) -> ProjectLocationGlobalDomainBackupTestIamPermissionCall<'a, C>
4874    where
4875        St: AsRef<str>,
4876    {
4877        self._scopes.insert(String::from(scope.as_ref()));
4878        self
4879    }
4880    /// Identifies the authorization scope(s) for the method you are building.
4881    ///
4882    /// See [`Self::add_scope()`] for details.
4883    pub fn add_scopes<I, St>(
4884        mut self,
4885        scopes: I,
4886    ) -> ProjectLocationGlobalDomainBackupTestIamPermissionCall<'a, C>
4887    where
4888        I: IntoIterator<Item = St>,
4889        St: AsRef<str>,
4890    {
4891        self._scopes
4892            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
4893        self
4894    }
4895
4896    /// Removes all scopes, and no default scope will be used either.
4897    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
4898    /// for details).
4899    pub fn clear_scopes(mut self) -> ProjectLocationGlobalDomainBackupTestIamPermissionCall<'a, C> {
4900        self._scopes.clear();
4901        self
4902    }
4903}
4904
4905/// Gets details of a single sqlIntegration.
4906///
4907/// A builder for the *locations.global.domains.sqlIntegrations.get* method supported by a *project* resource.
4908/// It is not used directly, but through a [`ProjectMethods`] instance.
4909///
4910/// # Example
4911///
4912/// Instantiate a resource method builder
4913///
4914/// ```test_harness,no_run
4915/// # extern crate hyper;
4916/// # extern crate hyper_rustls;
4917/// # extern crate google_managedidentities1 as managedidentities1;
4918/// # async fn dox() {
4919/// # use managedidentities1::{ManagedServiceForMicrosoftActiveDirectoryConsumerAPI, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4920///
4921/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4922/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
4923/// #     .with_native_roots()
4924/// #     .unwrap()
4925/// #     .https_only()
4926/// #     .enable_http2()
4927/// #     .build();
4928///
4929/// # let executor = hyper_util::rt::TokioExecutor::new();
4930/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
4931/// #     secret,
4932/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4933/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
4934/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
4935/// #     ),
4936/// # ).build().await.unwrap();
4937///
4938/// # let client = hyper_util::client::legacy::Client::builder(
4939/// #     hyper_util::rt::TokioExecutor::new()
4940/// # )
4941/// # .build(
4942/// #     hyper_rustls::HttpsConnectorBuilder::new()
4943/// #         .with_native_roots()
4944/// #         .unwrap()
4945/// #         .https_or_http()
4946/// #         .enable_http2()
4947/// #         .build()
4948/// # );
4949/// # let mut hub = ManagedServiceForMicrosoftActiveDirectoryConsumerAPI::new(client, auth);
4950/// // You can configure optional parameters by calling the respective setters at will, and
4951/// // execute the final call using `doit()`.
4952/// // Values shown here are possibly random and not representative !
4953/// let result = hub.projects().locations_global_domains_sql_integrations_get("name")
4954///              .doit().await;
4955/// # }
4956/// ```
4957pub struct ProjectLocationGlobalDomainSqlIntegrationGetCall<'a, C>
4958where
4959    C: 'a,
4960{
4961    hub: &'a ManagedServiceForMicrosoftActiveDirectoryConsumerAPI<C>,
4962    _name: String,
4963    _delegate: Option<&'a mut dyn common::Delegate>,
4964    _additional_params: HashMap<String, String>,
4965    _scopes: BTreeSet<String>,
4966}
4967
4968impl<'a, C> common::CallBuilder for ProjectLocationGlobalDomainSqlIntegrationGetCall<'a, C> {}
4969
4970impl<'a, C> ProjectLocationGlobalDomainSqlIntegrationGetCall<'a, C>
4971where
4972    C: common::Connector,
4973{
4974    /// Perform the operation you have build so far.
4975    pub async fn doit(mut self) -> common::Result<(common::Response, SqlIntegration)> {
4976        use std::borrow::Cow;
4977        use std::io::{Read, Seek};
4978
4979        use common::{url::Params, ToParts};
4980        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
4981
4982        let mut dd = common::DefaultDelegate;
4983        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
4984        dlg.begin(common::MethodInfo {
4985            id: "managedidentities.projects.locations.global.domains.sqlIntegrations.get",
4986            http_method: hyper::Method::GET,
4987        });
4988
4989        for &field in ["alt", "name"].iter() {
4990            if self._additional_params.contains_key(field) {
4991                dlg.finished(false);
4992                return Err(common::Error::FieldClash(field));
4993            }
4994        }
4995
4996        let mut params = Params::with_capacity(3 + self._additional_params.len());
4997        params.push("name", self._name);
4998
4999        params.extend(self._additional_params.iter());
5000
5001        params.push("alt", "json");
5002        let mut url = self.hub._base_url.clone() + "v1/{+name}";
5003        if self._scopes.is_empty() {
5004            self._scopes
5005                .insert(Scope::CloudPlatform.as_ref().to_string());
5006        }
5007
5008        #[allow(clippy::single_element_loop)]
5009        for &(find_this, param_name) in [("{+name}", "name")].iter() {
5010            url = params.uri_replacement(url, param_name, find_this, true);
5011        }
5012        {
5013            let to_remove = ["name"];
5014            params.remove_params(&to_remove);
5015        }
5016
5017        let url = params.parse_with_url(&url);
5018
5019        loop {
5020            let token = match self
5021                .hub
5022                .auth
5023                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5024                .await
5025            {
5026                Ok(token) => token,
5027                Err(e) => match dlg.token(e) {
5028                    Ok(token) => token,
5029                    Err(e) => {
5030                        dlg.finished(false);
5031                        return Err(common::Error::MissingToken(e));
5032                    }
5033                },
5034            };
5035            let mut req_result = {
5036                let client = &self.hub.client;
5037                dlg.pre_request();
5038                let mut req_builder = hyper::Request::builder()
5039                    .method(hyper::Method::GET)
5040                    .uri(url.as_str())
5041                    .header(USER_AGENT, self.hub._user_agent.clone());
5042
5043                if let Some(token) = token.as_ref() {
5044                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5045                }
5046
5047                let request = req_builder
5048                    .header(CONTENT_LENGTH, 0_u64)
5049                    .body(common::to_body::<String>(None));
5050
5051                client.request(request.unwrap()).await
5052            };
5053
5054            match req_result {
5055                Err(err) => {
5056                    if let common::Retry::After(d) = dlg.http_error(&err) {
5057                        sleep(d).await;
5058                        continue;
5059                    }
5060                    dlg.finished(false);
5061                    return Err(common::Error::HttpError(err));
5062                }
5063                Ok(res) => {
5064                    let (mut parts, body) = res.into_parts();
5065                    let mut body = common::Body::new(body);
5066                    if !parts.status.is_success() {
5067                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5068                        let error = serde_json::from_str(&common::to_string(&bytes));
5069                        let response = common::to_response(parts, bytes.into());
5070
5071                        if let common::Retry::After(d) =
5072                            dlg.http_failure(&response, error.as_ref().ok())
5073                        {
5074                            sleep(d).await;
5075                            continue;
5076                        }
5077
5078                        dlg.finished(false);
5079
5080                        return Err(match error {
5081                            Ok(value) => common::Error::BadRequest(value),
5082                            _ => common::Error::Failure(response),
5083                        });
5084                    }
5085                    let response = {
5086                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5087                        let encoded = common::to_string(&bytes);
5088                        match serde_json::from_str(&encoded) {
5089                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5090                            Err(error) => {
5091                                dlg.response_json_decode_error(&encoded, &error);
5092                                return Err(common::Error::JsonDecodeError(
5093                                    encoded.to_string(),
5094                                    error,
5095                                ));
5096                            }
5097                        }
5098                    };
5099
5100                    dlg.finished(true);
5101                    return Ok(response);
5102                }
5103            }
5104        }
5105    }
5106
5107    /// Required. SQLIntegration resource name using the form: `projects/{project_id}/locations/global/domains/{domain}/sqlIntegrations/{name}`
5108    ///
5109    /// Sets the *name* path property to the given value.
5110    ///
5111    /// Even though the property as already been set when instantiating this call,
5112    /// we provide this method for API completeness.
5113    pub fn name(
5114        mut self,
5115        new_value: &str,
5116    ) -> ProjectLocationGlobalDomainSqlIntegrationGetCall<'a, C> {
5117        self._name = new_value.to_string();
5118        self
5119    }
5120    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5121    /// while executing the actual API request.
5122    ///
5123    /// ````text
5124    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
5125    /// ````
5126    ///
5127    /// Sets the *delegate* property to the given value.
5128    pub fn delegate(
5129        mut self,
5130        new_value: &'a mut dyn common::Delegate,
5131    ) -> ProjectLocationGlobalDomainSqlIntegrationGetCall<'a, C> {
5132        self._delegate = Some(new_value);
5133        self
5134    }
5135
5136    /// Set any additional parameter of the query string used in the request.
5137    /// It should be used to set parameters which are not yet available through their own
5138    /// setters.
5139    ///
5140    /// Please note that this method must not be used to set any of the known parameters
5141    /// which have their own setter method. If done anyway, the request will fail.
5142    ///
5143    /// # Additional Parameters
5144    ///
5145    /// * *$.xgafv* (query-string) - V1 error format.
5146    /// * *access_token* (query-string) - OAuth access token.
5147    /// * *alt* (query-string) - Data format for response.
5148    /// * *callback* (query-string) - JSONP
5149    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5150    /// * *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.
5151    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5152    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5153    /// * *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.
5154    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5155    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5156    pub fn param<T>(
5157        mut self,
5158        name: T,
5159        value: T,
5160    ) -> ProjectLocationGlobalDomainSqlIntegrationGetCall<'a, C>
5161    where
5162        T: AsRef<str>,
5163    {
5164        self._additional_params
5165            .insert(name.as_ref().to_string(), value.as_ref().to_string());
5166        self
5167    }
5168
5169    /// Identifies the authorization scope for the method you are building.
5170    ///
5171    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5172    /// [`Scope::CloudPlatform`].
5173    ///
5174    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5175    /// tokens for more than one scope.
5176    ///
5177    /// Usually there is more than one suitable scope to authorize an operation, some of which may
5178    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5179    /// sufficient, a read-write scope will do as well.
5180    pub fn add_scope<St>(
5181        mut self,
5182        scope: St,
5183    ) -> ProjectLocationGlobalDomainSqlIntegrationGetCall<'a, C>
5184    where
5185        St: AsRef<str>,
5186    {
5187        self._scopes.insert(String::from(scope.as_ref()));
5188        self
5189    }
5190    /// Identifies the authorization scope(s) for the method you are building.
5191    ///
5192    /// See [`Self::add_scope()`] for details.
5193    pub fn add_scopes<I, St>(
5194        mut self,
5195        scopes: I,
5196    ) -> ProjectLocationGlobalDomainSqlIntegrationGetCall<'a, C>
5197    where
5198        I: IntoIterator<Item = St>,
5199        St: AsRef<str>,
5200    {
5201        self._scopes
5202            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5203        self
5204    }
5205
5206    /// Removes all scopes, and no default scope will be used either.
5207    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5208    /// for details).
5209    pub fn clear_scopes(mut self) -> ProjectLocationGlobalDomainSqlIntegrationGetCall<'a, C> {
5210        self._scopes.clear();
5211        self
5212    }
5213}
5214
5215/// Lists SqlIntegrations in a given domain.
5216///
5217/// A builder for the *locations.global.domains.sqlIntegrations.list* method supported by a *project* resource.
5218/// It is not used directly, but through a [`ProjectMethods`] instance.
5219///
5220/// # Example
5221///
5222/// Instantiate a resource method builder
5223///
5224/// ```test_harness,no_run
5225/// # extern crate hyper;
5226/// # extern crate hyper_rustls;
5227/// # extern crate google_managedidentities1 as managedidentities1;
5228/// # async fn dox() {
5229/// # use managedidentities1::{ManagedServiceForMicrosoftActiveDirectoryConsumerAPI, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5230///
5231/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5232/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
5233/// #     .with_native_roots()
5234/// #     .unwrap()
5235/// #     .https_only()
5236/// #     .enable_http2()
5237/// #     .build();
5238///
5239/// # let executor = hyper_util::rt::TokioExecutor::new();
5240/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
5241/// #     secret,
5242/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5243/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
5244/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
5245/// #     ),
5246/// # ).build().await.unwrap();
5247///
5248/// # let client = hyper_util::client::legacy::Client::builder(
5249/// #     hyper_util::rt::TokioExecutor::new()
5250/// # )
5251/// # .build(
5252/// #     hyper_rustls::HttpsConnectorBuilder::new()
5253/// #         .with_native_roots()
5254/// #         .unwrap()
5255/// #         .https_or_http()
5256/// #         .enable_http2()
5257/// #         .build()
5258/// # );
5259/// # let mut hub = ManagedServiceForMicrosoftActiveDirectoryConsumerAPI::new(client, auth);
5260/// // You can configure optional parameters by calling the respective setters at will, and
5261/// // execute the final call using `doit()`.
5262/// // Values shown here are possibly random and not representative !
5263/// let result = hub.projects().locations_global_domains_sql_integrations_list("parent")
5264///              .page_token("duo")
5265///              .page_size(-50)
5266///              .order_by("sed")
5267///              .filter("ut")
5268///              .doit().await;
5269/// # }
5270/// ```
5271pub struct ProjectLocationGlobalDomainSqlIntegrationListCall<'a, C>
5272where
5273    C: 'a,
5274{
5275    hub: &'a ManagedServiceForMicrosoftActiveDirectoryConsumerAPI<C>,
5276    _parent: String,
5277    _page_token: Option<String>,
5278    _page_size: Option<i32>,
5279    _order_by: Option<String>,
5280    _filter: Option<String>,
5281    _delegate: Option<&'a mut dyn common::Delegate>,
5282    _additional_params: HashMap<String, String>,
5283    _scopes: BTreeSet<String>,
5284}
5285
5286impl<'a, C> common::CallBuilder for ProjectLocationGlobalDomainSqlIntegrationListCall<'a, C> {}
5287
5288impl<'a, C> ProjectLocationGlobalDomainSqlIntegrationListCall<'a, C>
5289where
5290    C: common::Connector,
5291{
5292    /// Perform the operation you have build so far.
5293    pub async fn doit(mut self) -> common::Result<(common::Response, ListSqlIntegrationsResponse)> {
5294        use std::borrow::Cow;
5295        use std::io::{Read, Seek};
5296
5297        use common::{url::Params, ToParts};
5298        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5299
5300        let mut dd = common::DefaultDelegate;
5301        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5302        dlg.begin(common::MethodInfo {
5303            id: "managedidentities.projects.locations.global.domains.sqlIntegrations.list",
5304            http_method: hyper::Method::GET,
5305        });
5306
5307        for &field in [
5308            "alt",
5309            "parent",
5310            "pageToken",
5311            "pageSize",
5312            "orderBy",
5313            "filter",
5314        ]
5315        .iter()
5316        {
5317            if self._additional_params.contains_key(field) {
5318                dlg.finished(false);
5319                return Err(common::Error::FieldClash(field));
5320            }
5321        }
5322
5323        let mut params = Params::with_capacity(7 + self._additional_params.len());
5324        params.push("parent", self._parent);
5325        if let Some(value) = self._page_token.as_ref() {
5326            params.push("pageToken", value);
5327        }
5328        if let Some(value) = self._page_size.as_ref() {
5329            params.push("pageSize", value.to_string());
5330        }
5331        if let Some(value) = self._order_by.as_ref() {
5332            params.push("orderBy", value);
5333        }
5334        if let Some(value) = self._filter.as_ref() {
5335            params.push("filter", value);
5336        }
5337
5338        params.extend(self._additional_params.iter());
5339
5340        params.push("alt", "json");
5341        let mut url = self.hub._base_url.clone() + "v1/{+parent}/sqlIntegrations";
5342        if self._scopes.is_empty() {
5343            self._scopes
5344                .insert(Scope::CloudPlatform.as_ref().to_string());
5345        }
5346
5347        #[allow(clippy::single_element_loop)]
5348        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
5349            url = params.uri_replacement(url, param_name, find_this, true);
5350        }
5351        {
5352            let to_remove = ["parent"];
5353            params.remove_params(&to_remove);
5354        }
5355
5356        let url = params.parse_with_url(&url);
5357
5358        loop {
5359            let token = match self
5360                .hub
5361                .auth
5362                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5363                .await
5364            {
5365                Ok(token) => token,
5366                Err(e) => match dlg.token(e) {
5367                    Ok(token) => token,
5368                    Err(e) => {
5369                        dlg.finished(false);
5370                        return Err(common::Error::MissingToken(e));
5371                    }
5372                },
5373            };
5374            let mut req_result = {
5375                let client = &self.hub.client;
5376                dlg.pre_request();
5377                let mut req_builder = hyper::Request::builder()
5378                    .method(hyper::Method::GET)
5379                    .uri(url.as_str())
5380                    .header(USER_AGENT, self.hub._user_agent.clone());
5381
5382                if let Some(token) = token.as_ref() {
5383                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5384                }
5385
5386                let request = req_builder
5387                    .header(CONTENT_LENGTH, 0_u64)
5388                    .body(common::to_body::<String>(None));
5389
5390                client.request(request.unwrap()).await
5391            };
5392
5393            match req_result {
5394                Err(err) => {
5395                    if let common::Retry::After(d) = dlg.http_error(&err) {
5396                        sleep(d).await;
5397                        continue;
5398                    }
5399                    dlg.finished(false);
5400                    return Err(common::Error::HttpError(err));
5401                }
5402                Ok(res) => {
5403                    let (mut parts, body) = res.into_parts();
5404                    let mut body = common::Body::new(body);
5405                    if !parts.status.is_success() {
5406                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5407                        let error = serde_json::from_str(&common::to_string(&bytes));
5408                        let response = common::to_response(parts, bytes.into());
5409
5410                        if let common::Retry::After(d) =
5411                            dlg.http_failure(&response, error.as_ref().ok())
5412                        {
5413                            sleep(d).await;
5414                            continue;
5415                        }
5416
5417                        dlg.finished(false);
5418
5419                        return Err(match error {
5420                            Ok(value) => common::Error::BadRequest(value),
5421                            _ => common::Error::Failure(response),
5422                        });
5423                    }
5424                    let response = {
5425                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5426                        let encoded = common::to_string(&bytes);
5427                        match serde_json::from_str(&encoded) {
5428                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5429                            Err(error) => {
5430                                dlg.response_json_decode_error(&encoded, &error);
5431                                return Err(common::Error::JsonDecodeError(
5432                                    encoded.to_string(),
5433                                    error,
5434                                ));
5435                            }
5436                        }
5437                    };
5438
5439                    dlg.finished(true);
5440                    return Ok(response);
5441                }
5442            }
5443        }
5444    }
5445
5446    /// Required. The resource name of the SqlIntegrations using the form: `projects/{project_id}/locations/global/domains/*`
5447    ///
5448    /// Sets the *parent* path property to the given value.
5449    ///
5450    /// Even though the property as already been set when instantiating this call,
5451    /// we provide this method for API completeness.
5452    pub fn parent(
5453        mut self,
5454        new_value: &str,
5455    ) -> ProjectLocationGlobalDomainSqlIntegrationListCall<'a, C> {
5456        self._parent = new_value.to_string();
5457        self
5458    }
5459    /// Optional. The next_page_token value returned from a previous List request, if any.
5460    ///
5461    /// Sets the *page token* query property to the given value.
5462    pub fn page_token(
5463        mut self,
5464        new_value: &str,
5465    ) -> ProjectLocationGlobalDomainSqlIntegrationListCall<'a, C> {
5466        self._page_token = Some(new_value.to_string());
5467        self
5468    }
5469    /// Optional. The maximum number of items to return. If not specified, a default value of 1000 will be used by the service. Regardless of the page_size value, the response may include a partial list and a caller should only rely on response'ANIZATIONs next_page_token to determine if there are more instances left to be queried.
5470    ///
5471    /// Sets the *page size* query property to the given value.
5472    pub fn page_size(
5473        mut self,
5474        new_value: i32,
5475    ) -> ProjectLocationGlobalDomainSqlIntegrationListCall<'a, C> {
5476        self._page_size = Some(new_value);
5477        self
5478    }
5479    /// Optional. Specifies the ordering of results following syntax at https://cloud.google.com/apis/design/design_patterns#sorting_order.
5480    ///
5481    /// Sets the *order by* query property to the given value.
5482    pub fn order_by(
5483        mut self,
5484        new_value: &str,
5485    ) -> ProjectLocationGlobalDomainSqlIntegrationListCall<'a, C> {
5486        self._order_by = Some(new_value.to_string());
5487        self
5488    }
5489    /// Optional. Filter specifying constraints of a list operation. For example, `SqlIntegration.name="sql"`.
5490    ///
5491    /// Sets the *filter* query property to the given value.
5492    pub fn filter(
5493        mut self,
5494        new_value: &str,
5495    ) -> ProjectLocationGlobalDomainSqlIntegrationListCall<'a, C> {
5496        self._filter = Some(new_value.to_string());
5497        self
5498    }
5499    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5500    /// while executing the actual API request.
5501    ///
5502    /// ````text
5503    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
5504    /// ````
5505    ///
5506    /// Sets the *delegate* property to the given value.
5507    pub fn delegate(
5508        mut self,
5509        new_value: &'a mut dyn common::Delegate,
5510    ) -> ProjectLocationGlobalDomainSqlIntegrationListCall<'a, C> {
5511        self._delegate = Some(new_value);
5512        self
5513    }
5514
5515    /// Set any additional parameter of the query string used in the request.
5516    /// It should be used to set parameters which are not yet available through their own
5517    /// setters.
5518    ///
5519    /// Please note that this method must not be used to set any of the known parameters
5520    /// which have their own setter method. If done anyway, the request will fail.
5521    ///
5522    /// # Additional Parameters
5523    ///
5524    /// * *$.xgafv* (query-string) - V1 error format.
5525    /// * *access_token* (query-string) - OAuth access token.
5526    /// * *alt* (query-string) - Data format for response.
5527    /// * *callback* (query-string) - JSONP
5528    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5529    /// * *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.
5530    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5531    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5532    /// * *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.
5533    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5534    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5535    pub fn param<T>(
5536        mut self,
5537        name: T,
5538        value: T,
5539    ) -> ProjectLocationGlobalDomainSqlIntegrationListCall<'a, C>
5540    where
5541        T: AsRef<str>,
5542    {
5543        self._additional_params
5544            .insert(name.as_ref().to_string(), value.as_ref().to_string());
5545        self
5546    }
5547
5548    /// Identifies the authorization scope for the method you are building.
5549    ///
5550    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5551    /// [`Scope::CloudPlatform`].
5552    ///
5553    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5554    /// tokens for more than one scope.
5555    ///
5556    /// Usually there is more than one suitable scope to authorize an operation, some of which may
5557    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5558    /// sufficient, a read-write scope will do as well.
5559    pub fn add_scope<St>(
5560        mut self,
5561        scope: St,
5562    ) -> ProjectLocationGlobalDomainSqlIntegrationListCall<'a, C>
5563    where
5564        St: AsRef<str>,
5565    {
5566        self._scopes.insert(String::from(scope.as_ref()));
5567        self
5568    }
5569    /// Identifies the authorization scope(s) for the method you are building.
5570    ///
5571    /// See [`Self::add_scope()`] for details.
5572    pub fn add_scopes<I, St>(
5573        mut self,
5574        scopes: I,
5575    ) -> ProjectLocationGlobalDomainSqlIntegrationListCall<'a, C>
5576    where
5577        I: IntoIterator<Item = St>,
5578        St: AsRef<str>,
5579    {
5580        self._scopes
5581            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5582        self
5583    }
5584
5585    /// Removes all scopes, and no default scope will be used either.
5586    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5587    /// for details).
5588    pub fn clear_scopes(mut self) -> ProjectLocationGlobalDomainSqlIntegrationListCall<'a, C> {
5589        self._scopes.clear();
5590        self
5591    }
5592}
5593
5594/// Adds an AD trust to a domain.
5595///
5596/// A builder for the *locations.global.domains.attachTrust* method supported by a *project* resource.
5597/// It is not used directly, but through a [`ProjectMethods`] instance.
5598///
5599/// # Example
5600///
5601/// Instantiate a resource method builder
5602///
5603/// ```test_harness,no_run
5604/// # extern crate hyper;
5605/// # extern crate hyper_rustls;
5606/// # extern crate google_managedidentities1 as managedidentities1;
5607/// use managedidentities1::api::AttachTrustRequest;
5608/// # async fn dox() {
5609/// # use managedidentities1::{ManagedServiceForMicrosoftActiveDirectoryConsumerAPI, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5610///
5611/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5612/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
5613/// #     .with_native_roots()
5614/// #     .unwrap()
5615/// #     .https_only()
5616/// #     .enable_http2()
5617/// #     .build();
5618///
5619/// # let executor = hyper_util::rt::TokioExecutor::new();
5620/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
5621/// #     secret,
5622/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5623/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
5624/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
5625/// #     ),
5626/// # ).build().await.unwrap();
5627///
5628/// # let client = hyper_util::client::legacy::Client::builder(
5629/// #     hyper_util::rt::TokioExecutor::new()
5630/// # )
5631/// # .build(
5632/// #     hyper_rustls::HttpsConnectorBuilder::new()
5633/// #         .with_native_roots()
5634/// #         .unwrap()
5635/// #         .https_or_http()
5636/// #         .enable_http2()
5637/// #         .build()
5638/// # );
5639/// # let mut hub = ManagedServiceForMicrosoftActiveDirectoryConsumerAPI::new(client, auth);
5640/// // As the method needs a request, you would usually fill it with the desired information
5641/// // into the respective structure. Some of the parts shown here might not be applicable !
5642/// // Values shown here are possibly random and not representative !
5643/// let mut req = AttachTrustRequest::default();
5644///
5645/// // You can configure optional parameters by calling the respective setters at will, and
5646/// // execute the final call using `doit()`.
5647/// // Values shown here are possibly random and not representative !
5648/// let result = hub.projects().locations_global_domains_attach_trust(req, "name")
5649///              .doit().await;
5650/// # }
5651/// ```
5652pub struct ProjectLocationGlobalDomainAttachTrustCall<'a, C>
5653where
5654    C: 'a,
5655{
5656    hub: &'a ManagedServiceForMicrosoftActiveDirectoryConsumerAPI<C>,
5657    _request: AttachTrustRequest,
5658    _name: String,
5659    _delegate: Option<&'a mut dyn common::Delegate>,
5660    _additional_params: HashMap<String, String>,
5661    _scopes: BTreeSet<String>,
5662}
5663
5664impl<'a, C> common::CallBuilder for ProjectLocationGlobalDomainAttachTrustCall<'a, C> {}
5665
5666impl<'a, C> ProjectLocationGlobalDomainAttachTrustCall<'a, C>
5667where
5668    C: common::Connector,
5669{
5670    /// Perform the operation you have build so far.
5671    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
5672        use std::borrow::Cow;
5673        use std::io::{Read, Seek};
5674
5675        use common::{url::Params, ToParts};
5676        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5677
5678        let mut dd = common::DefaultDelegate;
5679        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5680        dlg.begin(common::MethodInfo {
5681            id: "managedidentities.projects.locations.global.domains.attachTrust",
5682            http_method: hyper::Method::POST,
5683        });
5684
5685        for &field in ["alt", "name"].iter() {
5686            if self._additional_params.contains_key(field) {
5687                dlg.finished(false);
5688                return Err(common::Error::FieldClash(field));
5689            }
5690        }
5691
5692        let mut params = Params::with_capacity(4 + self._additional_params.len());
5693        params.push("name", self._name);
5694
5695        params.extend(self._additional_params.iter());
5696
5697        params.push("alt", "json");
5698        let mut url = self.hub._base_url.clone() + "v1/{+name}:attachTrust";
5699        if self._scopes.is_empty() {
5700            self._scopes
5701                .insert(Scope::CloudPlatform.as_ref().to_string());
5702        }
5703
5704        #[allow(clippy::single_element_loop)]
5705        for &(find_this, param_name) in [("{+name}", "name")].iter() {
5706            url = params.uri_replacement(url, param_name, find_this, true);
5707        }
5708        {
5709            let to_remove = ["name"];
5710            params.remove_params(&to_remove);
5711        }
5712
5713        let url = params.parse_with_url(&url);
5714
5715        let mut json_mime_type = mime::APPLICATION_JSON;
5716        let mut request_value_reader = {
5717            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
5718            common::remove_json_null_values(&mut value);
5719            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
5720            serde_json::to_writer(&mut dst, &value).unwrap();
5721            dst
5722        };
5723        let request_size = request_value_reader
5724            .seek(std::io::SeekFrom::End(0))
5725            .unwrap();
5726        request_value_reader
5727            .seek(std::io::SeekFrom::Start(0))
5728            .unwrap();
5729
5730        loop {
5731            let token = match self
5732                .hub
5733                .auth
5734                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5735                .await
5736            {
5737                Ok(token) => token,
5738                Err(e) => match dlg.token(e) {
5739                    Ok(token) => token,
5740                    Err(e) => {
5741                        dlg.finished(false);
5742                        return Err(common::Error::MissingToken(e));
5743                    }
5744                },
5745            };
5746            request_value_reader
5747                .seek(std::io::SeekFrom::Start(0))
5748                .unwrap();
5749            let mut req_result = {
5750                let client = &self.hub.client;
5751                dlg.pre_request();
5752                let mut req_builder = hyper::Request::builder()
5753                    .method(hyper::Method::POST)
5754                    .uri(url.as_str())
5755                    .header(USER_AGENT, self.hub._user_agent.clone());
5756
5757                if let Some(token) = token.as_ref() {
5758                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5759                }
5760
5761                let request = req_builder
5762                    .header(CONTENT_TYPE, json_mime_type.to_string())
5763                    .header(CONTENT_LENGTH, request_size as u64)
5764                    .body(common::to_body(
5765                        request_value_reader.get_ref().clone().into(),
5766                    ));
5767
5768                client.request(request.unwrap()).await
5769            };
5770
5771            match req_result {
5772                Err(err) => {
5773                    if let common::Retry::After(d) = dlg.http_error(&err) {
5774                        sleep(d).await;
5775                        continue;
5776                    }
5777                    dlg.finished(false);
5778                    return Err(common::Error::HttpError(err));
5779                }
5780                Ok(res) => {
5781                    let (mut parts, body) = res.into_parts();
5782                    let mut body = common::Body::new(body);
5783                    if !parts.status.is_success() {
5784                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5785                        let error = serde_json::from_str(&common::to_string(&bytes));
5786                        let response = common::to_response(parts, bytes.into());
5787
5788                        if let common::Retry::After(d) =
5789                            dlg.http_failure(&response, error.as_ref().ok())
5790                        {
5791                            sleep(d).await;
5792                            continue;
5793                        }
5794
5795                        dlg.finished(false);
5796
5797                        return Err(match error {
5798                            Ok(value) => common::Error::BadRequest(value),
5799                            _ => common::Error::Failure(response),
5800                        });
5801                    }
5802                    let response = {
5803                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5804                        let encoded = common::to_string(&bytes);
5805                        match serde_json::from_str(&encoded) {
5806                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5807                            Err(error) => {
5808                                dlg.response_json_decode_error(&encoded, &error);
5809                                return Err(common::Error::JsonDecodeError(
5810                                    encoded.to_string(),
5811                                    error,
5812                                ));
5813                            }
5814                        }
5815                    };
5816
5817                    dlg.finished(true);
5818                    return Ok(response);
5819                }
5820            }
5821        }
5822    }
5823
5824    ///
5825    /// Sets the *request* property to the given value.
5826    ///
5827    /// Even though the property as already been set when instantiating this call,
5828    /// we provide this method for API completeness.
5829    pub fn request(
5830        mut self,
5831        new_value: AttachTrustRequest,
5832    ) -> ProjectLocationGlobalDomainAttachTrustCall<'a, C> {
5833        self._request = new_value;
5834        self
5835    }
5836    /// Required. The resource domain name, project name and location using the form: `projects/{project_id}/locations/global/domains/{domain_name}`
5837    ///
5838    /// Sets the *name* path property to the given value.
5839    ///
5840    /// Even though the property as already been set when instantiating this call,
5841    /// we provide this method for API completeness.
5842    pub fn name(mut self, new_value: &str) -> ProjectLocationGlobalDomainAttachTrustCall<'a, C> {
5843        self._name = new_value.to_string();
5844        self
5845    }
5846    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5847    /// while executing the actual API request.
5848    ///
5849    /// ````text
5850    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
5851    /// ````
5852    ///
5853    /// Sets the *delegate* property to the given value.
5854    pub fn delegate(
5855        mut self,
5856        new_value: &'a mut dyn common::Delegate,
5857    ) -> ProjectLocationGlobalDomainAttachTrustCall<'a, C> {
5858        self._delegate = Some(new_value);
5859        self
5860    }
5861
5862    /// Set any additional parameter of the query string used in the request.
5863    /// It should be used to set parameters which are not yet available through their own
5864    /// setters.
5865    ///
5866    /// Please note that this method must not be used to set any of the known parameters
5867    /// which have their own setter method. If done anyway, the request will fail.
5868    ///
5869    /// # Additional Parameters
5870    ///
5871    /// * *$.xgafv* (query-string) - V1 error format.
5872    /// * *access_token* (query-string) - OAuth access token.
5873    /// * *alt* (query-string) - Data format for response.
5874    /// * *callback* (query-string) - JSONP
5875    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5876    /// * *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.
5877    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5878    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5879    /// * *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.
5880    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5881    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5882    pub fn param<T>(
5883        mut self,
5884        name: T,
5885        value: T,
5886    ) -> ProjectLocationGlobalDomainAttachTrustCall<'a, C>
5887    where
5888        T: AsRef<str>,
5889    {
5890        self._additional_params
5891            .insert(name.as_ref().to_string(), value.as_ref().to_string());
5892        self
5893    }
5894
5895    /// Identifies the authorization scope for the method you are building.
5896    ///
5897    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5898    /// [`Scope::CloudPlatform`].
5899    ///
5900    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5901    /// tokens for more than one scope.
5902    ///
5903    /// Usually there is more than one suitable scope to authorize an operation, some of which may
5904    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5905    /// sufficient, a read-write scope will do as well.
5906    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationGlobalDomainAttachTrustCall<'a, C>
5907    where
5908        St: AsRef<str>,
5909    {
5910        self._scopes.insert(String::from(scope.as_ref()));
5911        self
5912    }
5913    /// Identifies the authorization scope(s) for the method you are building.
5914    ///
5915    /// See [`Self::add_scope()`] for details.
5916    pub fn add_scopes<I, St>(
5917        mut self,
5918        scopes: I,
5919    ) -> ProjectLocationGlobalDomainAttachTrustCall<'a, C>
5920    where
5921        I: IntoIterator<Item = St>,
5922        St: AsRef<str>,
5923    {
5924        self._scopes
5925            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5926        self
5927    }
5928
5929    /// Removes all scopes, and no default scope will be used either.
5930    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5931    /// for details).
5932    pub fn clear_scopes(mut self) -> ProjectLocationGlobalDomainAttachTrustCall<'a, C> {
5933        self._scopes.clear();
5934        self
5935    }
5936}
5937
5938/// CheckMigrationPermission API gets the current state of DomainMigration
5939///
5940/// A builder for the *locations.global.domains.checkMigrationPermission* method supported by a *project* resource.
5941/// It is not used directly, but through a [`ProjectMethods`] instance.
5942///
5943/// # Example
5944///
5945/// Instantiate a resource method builder
5946///
5947/// ```test_harness,no_run
5948/// # extern crate hyper;
5949/// # extern crate hyper_rustls;
5950/// # extern crate google_managedidentities1 as managedidentities1;
5951/// use managedidentities1::api::CheckMigrationPermissionRequest;
5952/// # async fn dox() {
5953/// # use managedidentities1::{ManagedServiceForMicrosoftActiveDirectoryConsumerAPI, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5954///
5955/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5956/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
5957/// #     .with_native_roots()
5958/// #     .unwrap()
5959/// #     .https_only()
5960/// #     .enable_http2()
5961/// #     .build();
5962///
5963/// # let executor = hyper_util::rt::TokioExecutor::new();
5964/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
5965/// #     secret,
5966/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5967/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
5968/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
5969/// #     ),
5970/// # ).build().await.unwrap();
5971///
5972/// # let client = hyper_util::client::legacy::Client::builder(
5973/// #     hyper_util::rt::TokioExecutor::new()
5974/// # )
5975/// # .build(
5976/// #     hyper_rustls::HttpsConnectorBuilder::new()
5977/// #         .with_native_roots()
5978/// #         .unwrap()
5979/// #         .https_or_http()
5980/// #         .enable_http2()
5981/// #         .build()
5982/// # );
5983/// # let mut hub = ManagedServiceForMicrosoftActiveDirectoryConsumerAPI::new(client, auth);
5984/// // As the method needs a request, you would usually fill it with the desired information
5985/// // into the respective structure. Some of the parts shown here might not be applicable !
5986/// // Values shown here are possibly random and not representative !
5987/// let mut req = CheckMigrationPermissionRequest::default();
5988///
5989/// // You can configure optional parameters by calling the respective setters at will, and
5990/// // execute the final call using `doit()`.
5991/// // Values shown here are possibly random and not representative !
5992/// let result = hub.projects().locations_global_domains_check_migration_permission(req, "domain")
5993///              .doit().await;
5994/// # }
5995/// ```
5996pub struct ProjectLocationGlobalDomainCheckMigrationPermissionCall<'a, C>
5997where
5998    C: 'a,
5999{
6000    hub: &'a ManagedServiceForMicrosoftActiveDirectoryConsumerAPI<C>,
6001    _request: CheckMigrationPermissionRequest,
6002    _domain: String,
6003    _delegate: Option<&'a mut dyn common::Delegate>,
6004    _additional_params: HashMap<String, String>,
6005    _scopes: BTreeSet<String>,
6006}
6007
6008impl<'a, C> common::CallBuilder for ProjectLocationGlobalDomainCheckMigrationPermissionCall<'a, C> {}
6009
6010impl<'a, C> ProjectLocationGlobalDomainCheckMigrationPermissionCall<'a, C>
6011where
6012    C: common::Connector,
6013{
6014    /// Perform the operation you have build so far.
6015    pub async fn doit(
6016        mut self,
6017    ) -> common::Result<(common::Response, CheckMigrationPermissionResponse)> {
6018        use std::borrow::Cow;
6019        use std::io::{Read, Seek};
6020
6021        use common::{url::Params, ToParts};
6022        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6023
6024        let mut dd = common::DefaultDelegate;
6025        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6026        dlg.begin(common::MethodInfo {
6027            id: "managedidentities.projects.locations.global.domains.checkMigrationPermission",
6028            http_method: hyper::Method::POST,
6029        });
6030
6031        for &field in ["alt", "domain"].iter() {
6032            if self._additional_params.contains_key(field) {
6033                dlg.finished(false);
6034                return Err(common::Error::FieldClash(field));
6035            }
6036        }
6037
6038        let mut params = Params::with_capacity(4 + self._additional_params.len());
6039        params.push("domain", self._domain);
6040
6041        params.extend(self._additional_params.iter());
6042
6043        params.push("alt", "json");
6044        let mut url = self.hub._base_url.clone() + "v1/{+domain}:checkMigrationPermission";
6045        if self._scopes.is_empty() {
6046            self._scopes
6047                .insert(Scope::CloudPlatform.as_ref().to_string());
6048        }
6049
6050        #[allow(clippy::single_element_loop)]
6051        for &(find_this, param_name) in [("{+domain}", "domain")].iter() {
6052            url = params.uri_replacement(url, param_name, find_this, true);
6053        }
6054        {
6055            let to_remove = ["domain"];
6056            params.remove_params(&to_remove);
6057        }
6058
6059        let url = params.parse_with_url(&url);
6060
6061        let mut json_mime_type = mime::APPLICATION_JSON;
6062        let mut request_value_reader = {
6063            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
6064            common::remove_json_null_values(&mut value);
6065            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
6066            serde_json::to_writer(&mut dst, &value).unwrap();
6067            dst
6068        };
6069        let request_size = request_value_reader
6070            .seek(std::io::SeekFrom::End(0))
6071            .unwrap();
6072        request_value_reader
6073            .seek(std::io::SeekFrom::Start(0))
6074            .unwrap();
6075
6076        loop {
6077            let token = match self
6078                .hub
6079                .auth
6080                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6081                .await
6082            {
6083                Ok(token) => token,
6084                Err(e) => match dlg.token(e) {
6085                    Ok(token) => token,
6086                    Err(e) => {
6087                        dlg.finished(false);
6088                        return Err(common::Error::MissingToken(e));
6089                    }
6090                },
6091            };
6092            request_value_reader
6093                .seek(std::io::SeekFrom::Start(0))
6094                .unwrap();
6095            let mut req_result = {
6096                let client = &self.hub.client;
6097                dlg.pre_request();
6098                let mut req_builder = hyper::Request::builder()
6099                    .method(hyper::Method::POST)
6100                    .uri(url.as_str())
6101                    .header(USER_AGENT, self.hub._user_agent.clone());
6102
6103                if let Some(token) = token.as_ref() {
6104                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6105                }
6106
6107                let request = req_builder
6108                    .header(CONTENT_TYPE, json_mime_type.to_string())
6109                    .header(CONTENT_LENGTH, request_size as u64)
6110                    .body(common::to_body(
6111                        request_value_reader.get_ref().clone().into(),
6112                    ));
6113
6114                client.request(request.unwrap()).await
6115            };
6116
6117            match req_result {
6118                Err(err) => {
6119                    if let common::Retry::After(d) = dlg.http_error(&err) {
6120                        sleep(d).await;
6121                        continue;
6122                    }
6123                    dlg.finished(false);
6124                    return Err(common::Error::HttpError(err));
6125                }
6126                Ok(res) => {
6127                    let (mut parts, body) = res.into_parts();
6128                    let mut body = common::Body::new(body);
6129                    if !parts.status.is_success() {
6130                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6131                        let error = serde_json::from_str(&common::to_string(&bytes));
6132                        let response = common::to_response(parts, bytes.into());
6133
6134                        if let common::Retry::After(d) =
6135                            dlg.http_failure(&response, error.as_ref().ok())
6136                        {
6137                            sleep(d).await;
6138                            continue;
6139                        }
6140
6141                        dlg.finished(false);
6142
6143                        return Err(match error {
6144                            Ok(value) => common::Error::BadRequest(value),
6145                            _ => common::Error::Failure(response),
6146                        });
6147                    }
6148                    let response = {
6149                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6150                        let encoded = common::to_string(&bytes);
6151                        match serde_json::from_str(&encoded) {
6152                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6153                            Err(error) => {
6154                                dlg.response_json_decode_error(&encoded, &error);
6155                                return Err(common::Error::JsonDecodeError(
6156                                    encoded.to_string(),
6157                                    error,
6158                                ));
6159                            }
6160                        }
6161                    };
6162
6163                    dlg.finished(true);
6164                    return Ok(response);
6165                }
6166            }
6167        }
6168    }
6169
6170    ///
6171    /// Sets the *request* property to the given value.
6172    ///
6173    /// Even though the property as already been set when instantiating this call,
6174    /// we provide this method for API completeness.
6175    pub fn request(
6176        mut self,
6177        new_value: CheckMigrationPermissionRequest,
6178    ) -> ProjectLocationGlobalDomainCheckMigrationPermissionCall<'a, C> {
6179        self._request = new_value;
6180        self
6181    }
6182    /// Required. The domain resource name using the form: `projects/{project_id}/locations/global/domains/{domain_name}`
6183    ///
6184    /// Sets the *domain* path property to the given value.
6185    ///
6186    /// Even though the property as already been set when instantiating this call,
6187    /// we provide this method for API completeness.
6188    pub fn domain(
6189        mut self,
6190        new_value: &str,
6191    ) -> ProjectLocationGlobalDomainCheckMigrationPermissionCall<'a, C> {
6192        self._domain = new_value.to_string();
6193        self
6194    }
6195    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6196    /// while executing the actual API request.
6197    ///
6198    /// ````text
6199    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
6200    /// ````
6201    ///
6202    /// Sets the *delegate* property to the given value.
6203    pub fn delegate(
6204        mut self,
6205        new_value: &'a mut dyn common::Delegate,
6206    ) -> ProjectLocationGlobalDomainCheckMigrationPermissionCall<'a, C> {
6207        self._delegate = Some(new_value);
6208        self
6209    }
6210
6211    /// Set any additional parameter of the query string used in the request.
6212    /// It should be used to set parameters which are not yet available through their own
6213    /// setters.
6214    ///
6215    /// Please note that this method must not be used to set any of the known parameters
6216    /// which have their own setter method. If done anyway, the request will fail.
6217    ///
6218    /// # Additional Parameters
6219    ///
6220    /// * *$.xgafv* (query-string) - V1 error format.
6221    /// * *access_token* (query-string) - OAuth access token.
6222    /// * *alt* (query-string) - Data format for response.
6223    /// * *callback* (query-string) - JSONP
6224    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6225    /// * *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.
6226    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6227    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6228    /// * *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.
6229    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6230    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6231    pub fn param<T>(
6232        mut self,
6233        name: T,
6234        value: T,
6235    ) -> ProjectLocationGlobalDomainCheckMigrationPermissionCall<'a, C>
6236    where
6237        T: AsRef<str>,
6238    {
6239        self._additional_params
6240            .insert(name.as_ref().to_string(), value.as_ref().to_string());
6241        self
6242    }
6243
6244    /// Identifies the authorization scope for the method you are building.
6245    ///
6246    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6247    /// [`Scope::CloudPlatform`].
6248    ///
6249    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6250    /// tokens for more than one scope.
6251    ///
6252    /// Usually there is more than one suitable scope to authorize an operation, some of which may
6253    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6254    /// sufficient, a read-write scope will do as well.
6255    pub fn add_scope<St>(
6256        mut self,
6257        scope: St,
6258    ) -> ProjectLocationGlobalDomainCheckMigrationPermissionCall<'a, C>
6259    where
6260        St: AsRef<str>,
6261    {
6262        self._scopes.insert(String::from(scope.as_ref()));
6263        self
6264    }
6265    /// Identifies the authorization scope(s) for the method you are building.
6266    ///
6267    /// See [`Self::add_scope()`] for details.
6268    pub fn add_scopes<I, St>(
6269        mut self,
6270        scopes: I,
6271    ) -> ProjectLocationGlobalDomainCheckMigrationPermissionCall<'a, C>
6272    where
6273        I: IntoIterator<Item = St>,
6274        St: AsRef<str>,
6275    {
6276        self._scopes
6277            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6278        self
6279    }
6280
6281    /// Removes all scopes, and no default scope will be used either.
6282    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6283    /// for details).
6284    pub fn clear_scopes(
6285        mut self,
6286    ) -> ProjectLocationGlobalDomainCheckMigrationPermissionCall<'a, C> {
6287        self._scopes.clear();
6288        self
6289    }
6290}
6291
6292/// Creates a Microsoft AD domain.
6293///
6294/// A builder for the *locations.global.domains.create* method supported by a *project* resource.
6295/// It is not used directly, but through a [`ProjectMethods`] instance.
6296///
6297/// # Example
6298///
6299/// Instantiate a resource method builder
6300///
6301/// ```test_harness,no_run
6302/// # extern crate hyper;
6303/// # extern crate hyper_rustls;
6304/// # extern crate google_managedidentities1 as managedidentities1;
6305/// use managedidentities1::api::Domain;
6306/// # async fn dox() {
6307/// # use managedidentities1::{ManagedServiceForMicrosoftActiveDirectoryConsumerAPI, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6308///
6309/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6310/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
6311/// #     .with_native_roots()
6312/// #     .unwrap()
6313/// #     .https_only()
6314/// #     .enable_http2()
6315/// #     .build();
6316///
6317/// # let executor = hyper_util::rt::TokioExecutor::new();
6318/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
6319/// #     secret,
6320/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6321/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
6322/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
6323/// #     ),
6324/// # ).build().await.unwrap();
6325///
6326/// # let client = hyper_util::client::legacy::Client::builder(
6327/// #     hyper_util::rt::TokioExecutor::new()
6328/// # )
6329/// # .build(
6330/// #     hyper_rustls::HttpsConnectorBuilder::new()
6331/// #         .with_native_roots()
6332/// #         .unwrap()
6333/// #         .https_or_http()
6334/// #         .enable_http2()
6335/// #         .build()
6336/// # );
6337/// # let mut hub = ManagedServiceForMicrosoftActiveDirectoryConsumerAPI::new(client, auth);
6338/// // As the method needs a request, you would usually fill it with the desired information
6339/// // into the respective structure. Some of the parts shown here might not be applicable !
6340/// // Values shown here are possibly random and not representative !
6341/// let mut req = Domain::default();
6342///
6343/// // You can configure optional parameters by calling the respective setters at will, and
6344/// // execute the final call using `doit()`.
6345/// // Values shown here are possibly random and not representative !
6346/// let result = hub.projects().locations_global_domains_create(req, "parent")
6347///              .domain_name("ipsum")
6348///              .doit().await;
6349/// # }
6350/// ```
6351pub struct ProjectLocationGlobalDomainCreateCall<'a, C>
6352where
6353    C: 'a,
6354{
6355    hub: &'a ManagedServiceForMicrosoftActiveDirectoryConsumerAPI<C>,
6356    _request: Domain,
6357    _parent: String,
6358    _domain_name: Option<String>,
6359    _delegate: Option<&'a mut dyn common::Delegate>,
6360    _additional_params: HashMap<String, String>,
6361    _scopes: BTreeSet<String>,
6362}
6363
6364impl<'a, C> common::CallBuilder for ProjectLocationGlobalDomainCreateCall<'a, C> {}
6365
6366impl<'a, C> ProjectLocationGlobalDomainCreateCall<'a, C>
6367where
6368    C: common::Connector,
6369{
6370    /// Perform the operation you have build so far.
6371    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
6372        use std::borrow::Cow;
6373        use std::io::{Read, Seek};
6374
6375        use common::{url::Params, ToParts};
6376        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6377
6378        let mut dd = common::DefaultDelegate;
6379        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6380        dlg.begin(common::MethodInfo {
6381            id: "managedidentities.projects.locations.global.domains.create",
6382            http_method: hyper::Method::POST,
6383        });
6384
6385        for &field in ["alt", "parent", "domainName"].iter() {
6386            if self._additional_params.contains_key(field) {
6387                dlg.finished(false);
6388                return Err(common::Error::FieldClash(field));
6389            }
6390        }
6391
6392        let mut params = Params::with_capacity(5 + self._additional_params.len());
6393        params.push("parent", self._parent);
6394        if let Some(value) = self._domain_name.as_ref() {
6395            params.push("domainName", value);
6396        }
6397
6398        params.extend(self._additional_params.iter());
6399
6400        params.push("alt", "json");
6401        let mut url = self.hub._base_url.clone() + "v1/{+parent}/domains";
6402        if self._scopes.is_empty() {
6403            self._scopes
6404                .insert(Scope::CloudPlatform.as_ref().to_string());
6405        }
6406
6407        #[allow(clippy::single_element_loop)]
6408        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
6409            url = params.uri_replacement(url, param_name, find_this, true);
6410        }
6411        {
6412            let to_remove = ["parent"];
6413            params.remove_params(&to_remove);
6414        }
6415
6416        let url = params.parse_with_url(&url);
6417
6418        let mut json_mime_type = mime::APPLICATION_JSON;
6419        let mut request_value_reader = {
6420            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
6421            common::remove_json_null_values(&mut value);
6422            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
6423            serde_json::to_writer(&mut dst, &value).unwrap();
6424            dst
6425        };
6426        let request_size = request_value_reader
6427            .seek(std::io::SeekFrom::End(0))
6428            .unwrap();
6429        request_value_reader
6430            .seek(std::io::SeekFrom::Start(0))
6431            .unwrap();
6432
6433        loop {
6434            let token = match self
6435                .hub
6436                .auth
6437                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6438                .await
6439            {
6440                Ok(token) => token,
6441                Err(e) => match dlg.token(e) {
6442                    Ok(token) => token,
6443                    Err(e) => {
6444                        dlg.finished(false);
6445                        return Err(common::Error::MissingToken(e));
6446                    }
6447                },
6448            };
6449            request_value_reader
6450                .seek(std::io::SeekFrom::Start(0))
6451                .unwrap();
6452            let mut req_result = {
6453                let client = &self.hub.client;
6454                dlg.pre_request();
6455                let mut req_builder = hyper::Request::builder()
6456                    .method(hyper::Method::POST)
6457                    .uri(url.as_str())
6458                    .header(USER_AGENT, self.hub._user_agent.clone());
6459
6460                if let Some(token) = token.as_ref() {
6461                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6462                }
6463
6464                let request = req_builder
6465                    .header(CONTENT_TYPE, json_mime_type.to_string())
6466                    .header(CONTENT_LENGTH, request_size as u64)
6467                    .body(common::to_body(
6468                        request_value_reader.get_ref().clone().into(),
6469                    ));
6470
6471                client.request(request.unwrap()).await
6472            };
6473
6474            match req_result {
6475                Err(err) => {
6476                    if let common::Retry::After(d) = dlg.http_error(&err) {
6477                        sleep(d).await;
6478                        continue;
6479                    }
6480                    dlg.finished(false);
6481                    return Err(common::Error::HttpError(err));
6482                }
6483                Ok(res) => {
6484                    let (mut parts, body) = res.into_parts();
6485                    let mut body = common::Body::new(body);
6486                    if !parts.status.is_success() {
6487                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6488                        let error = serde_json::from_str(&common::to_string(&bytes));
6489                        let response = common::to_response(parts, bytes.into());
6490
6491                        if let common::Retry::After(d) =
6492                            dlg.http_failure(&response, error.as_ref().ok())
6493                        {
6494                            sleep(d).await;
6495                            continue;
6496                        }
6497
6498                        dlg.finished(false);
6499
6500                        return Err(match error {
6501                            Ok(value) => common::Error::BadRequest(value),
6502                            _ => common::Error::Failure(response),
6503                        });
6504                    }
6505                    let response = {
6506                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6507                        let encoded = common::to_string(&bytes);
6508                        match serde_json::from_str(&encoded) {
6509                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6510                            Err(error) => {
6511                                dlg.response_json_decode_error(&encoded, &error);
6512                                return Err(common::Error::JsonDecodeError(
6513                                    encoded.to_string(),
6514                                    error,
6515                                ));
6516                            }
6517                        }
6518                    };
6519
6520                    dlg.finished(true);
6521                    return Ok(response);
6522                }
6523            }
6524        }
6525    }
6526
6527    ///
6528    /// Sets the *request* property to the given value.
6529    ///
6530    /// Even though the property as already been set when instantiating this call,
6531    /// we provide this method for API completeness.
6532    pub fn request(mut self, new_value: Domain) -> ProjectLocationGlobalDomainCreateCall<'a, C> {
6533        self._request = new_value;
6534        self
6535    }
6536    /// Required. The resource project name and location using the form: `projects/{project_id}/locations/global`
6537    ///
6538    /// Sets the *parent* path property to the given value.
6539    ///
6540    /// Even though the property as already been set when instantiating this call,
6541    /// we provide this method for API completeness.
6542    pub fn parent(mut self, new_value: &str) -> ProjectLocationGlobalDomainCreateCall<'a, C> {
6543        self._parent = new_value.to_string();
6544        self
6545    }
6546    /// Required. The fully qualified domain name. e.g. mydomain.myorganization.com, with the following restrictions: * Must contain only lowercase letters, numbers, periods and hyphens. * Must start with a letter. * Must contain between 2-64 characters. * Must end with a number or a letter. * Must not start with period. * First segment length (mydomain for example above) shouldn't exceed 15 chars. * The last segment cannot be fully numeric. * Must be unique within the customer project.
6547    ///
6548    /// Sets the *domain name* query property to the given value.
6549    pub fn domain_name(mut self, new_value: &str) -> ProjectLocationGlobalDomainCreateCall<'a, C> {
6550        self._domain_name = Some(new_value.to_string());
6551        self
6552    }
6553    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6554    /// while executing the actual API request.
6555    ///
6556    /// ````text
6557    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
6558    /// ````
6559    ///
6560    /// Sets the *delegate* property to the given value.
6561    pub fn delegate(
6562        mut self,
6563        new_value: &'a mut dyn common::Delegate,
6564    ) -> ProjectLocationGlobalDomainCreateCall<'a, C> {
6565        self._delegate = Some(new_value);
6566        self
6567    }
6568
6569    /// Set any additional parameter of the query string used in the request.
6570    /// It should be used to set parameters which are not yet available through their own
6571    /// setters.
6572    ///
6573    /// Please note that this method must not be used to set any of the known parameters
6574    /// which have their own setter method. If done anyway, the request will fail.
6575    ///
6576    /// # Additional Parameters
6577    ///
6578    /// * *$.xgafv* (query-string) - V1 error format.
6579    /// * *access_token* (query-string) - OAuth access token.
6580    /// * *alt* (query-string) - Data format for response.
6581    /// * *callback* (query-string) - JSONP
6582    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6583    /// * *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.
6584    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6585    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6586    /// * *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.
6587    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6588    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6589    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationGlobalDomainCreateCall<'a, C>
6590    where
6591        T: AsRef<str>,
6592    {
6593        self._additional_params
6594            .insert(name.as_ref().to_string(), value.as_ref().to_string());
6595        self
6596    }
6597
6598    /// Identifies the authorization scope for the method you are building.
6599    ///
6600    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6601    /// [`Scope::CloudPlatform`].
6602    ///
6603    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6604    /// tokens for more than one scope.
6605    ///
6606    /// Usually there is more than one suitable scope to authorize an operation, some of which may
6607    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6608    /// sufficient, a read-write scope will do as well.
6609    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationGlobalDomainCreateCall<'a, C>
6610    where
6611        St: AsRef<str>,
6612    {
6613        self._scopes.insert(String::from(scope.as_ref()));
6614        self
6615    }
6616    /// Identifies the authorization scope(s) for the method you are building.
6617    ///
6618    /// See [`Self::add_scope()`] for details.
6619    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationGlobalDomainCreateCall<'a, C>
6620    where
6621        I: IntoIterator<Item = St>,
6622        St: AsRef<str>,
6623    {
6624        self._scopes
6625            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6626        self
6627    }
6628
6629    /// Removes all scopes, and no default scope will be used either.
6630    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6631    /// for details).
6632    pub fn clear_scopes(mut self) -> ProjectLocationGlobalDomainCreateCall<'a, C> {
6633        self._scopes.clear();
6634        self
6635    }
6636}
6637
6638/// Deletes a domain.
6639///
6640/// A builder for the *locations.global.domains.delete* method supported by a *project* resource.
6641/// It is not used directly, but through a [`ProjectMethods`] instance.
6642///
6643/// # Example
6644///
6645/// Instantiate a resource method builder
6646///
6647/// ```test_harness,no_run
6648/// # extern crate hyper;
6649/// # extern crate hyper_rustls;
6650/// # extern crate google_managedidentities1 as managedidentities1;
6651/// # async fn dox() {
6652/// # use managedidentities1::{ManagedServiceForMicrosoftActiveDirectoryConsumerAPI, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6653///
6654/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6655/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
6656/// #     .with_native_roots()
6657/// #     .unwrap()
6658/// #     .https_only()
6659/// #     .enable_http2()
6660/// #     .build();
6661///
6662/// # let executor = hyper_util::rt::TokioExecutor::new();
6663/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
6664/// #     secret,
6665/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6666/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
6667/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
6668/// #     ),
6669/// # ).build().await.unwrap();
6670///
6671/// # let client = hyper_util::client::legacy::Client::builder(
6672/// #     hyper_util::rt::TokioExecutor::new()
6673/// # )
6674/// # .build(
6675/// #     hyper_rustls::HttpsConnectorBuilder::new()
6676/// #         .with_native_roots()
6677/// #         .unwrap()
6678/// #         .https_or_http()
6679/// #         .enable_http2()
6680/// #         .build()
6681/// # );
6682/// # let mut hub = ManagedServiceForMicrosoftActiveDirectoryConsumerAPI::new(client, auth);
6683/// // You can configure optional parameters by calling the respective setters at will, and
6684/// // execute the final call using `doit()`.
6685/// // Values shown here are possibly random and not representative !
6686/// let result = hub.projects().locations_global_domains_delete("name")
6687///              .doit().await;
6688/// # }
6689/// ```
6690pub struct ProjectLocationGlobalDomainDeleteCall<'a, C>
6691where
6692    C: 'a,
6693{
6694    hub: &'a ManagedServiceForMicrosoftActiveDirectoryConsumerAPI<C>,
6695    _name: String,
6696    _delegate: Option<&'a mut dyn common::Delegate>,
6697    _additional_params: HashMap<String, String>,
6698    _scopes: BTreeSet<String>,
6699}
6700
6701impl<'a, C> common::CallBuilder for ProjectLocationGlobalDomainDeleteCall<'a, C> {}
6702
6703impl<'a, C> ProjectLocationGlobalDomainDeleteCall<'a, C>
6704where
6705    C: common::Connector,
6706{
6707    /// Perform the operation you have build so far.
6708    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
6709        use std::borrow::Cow;
6710        use std::io::{Read, Seek};
6711
6712        use common::{url::Params, ToParts};
6713        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6714
6715        let mut dd = common::DefaultDelegate;
6716        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6717        dlg.begin(common::MethodInfo {
6718            id: "managedidentities.projects.locations.global.domains.delete",
6719            http_method: hyper::Method::DELETE,
6720        });
6721
6722        for &field in ["alt", "name"].iter() {
6723            if self._additional_params.contains_key(field) {
6724                dlg.finished(false);
6725                return Err(common::Error::FieldClash(field));
6726            }
6727        }
6728
6729        let mut params = Params::with_capacity(3 + self._additional_params.len());
6730        params.push("name", self._name);
6731
6732        params.extend(self._additional_params.iter());
6733
6734        params.push("alt", "json");
6735        let mut url = self.hub._base_url.clone() + "v1/{+name}";
6736        if self._scopes.is_empty() {
6737            self._scopes
6738                .insert(Scope::CloudPlatform.as_ref().to_string());
6739        }
6740
6741        #[allow(clippy::single_element_loop)]
6742        for &(find_this, param_name) in [("{+name}", "name")].iter() {
6743            url = params.uri_replacement(url, param_name, find_this, true);
6744        }
6745        {
6746            let to_remove = ["name"];
6747            params.remove_params(&to_remove);
6748        }
6749
6750        let url = params.parse_with_url(&url);
6751
6752        loop {
6753            let token = match self
6754                .hub
6755                .auth
6756                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6757                .await
6758            {
6759                Ok(token) => token,
6760                Err(e) => match dlg.token(e) {
6761                    Ok(token) => token,
6762                    Err(e) => {
6763                        dlg.finished(false);
6764                        return Err(common::Error::MissingToken(e));
6765                    }
6766                },
6767            };
6768            let mut req_result = {
6769                let client = &self.hub.client;
6770                dlg.pre_request();
6771                let mut req_builder = hyper::Request::builder()
6772                    .method(hyper::Method::DELETE)
6773                    .uri(url.as_str())
6774                    .header(USER_AGENT, self.hub._user_agent.clone());
6775
6776                if let Some(token) = token.as_ref() {
6777                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6778                }
6779
6780                let request = req_builder
6781                    .header(CONTENT_LENGTH, 0_u64)
6782                    .body(common::to_body::<String>(None));
6783
6784                client.request(request.unwrap()).await
6785            };
6786
6787            match req_result {
6788                Err(err) => {
6789                    if let common::Retry::After(d) = dlg.http_error(&err) {
6790                        sleep(d).await;
6791                        continue;
6792                    }
6793                    dlg.finished(false);
6794                    return Err(common::Error::HttpError(err));
6795                }
6796                Ok(res) => {
6797                    let (mut parts, body) = res.into_parts();
6798                    let mut body = common::Body::new(body);
6799                    if !parts.status.is_success() {
6800                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6801                        let error = serde_json::from_str(&common::to_string(&bytes));
6802                        let response = common::to_response(parts, bytes.into());
6803
6804                        if let common::Retry::After(d) =
6805                            dlg.http_failure(&response, error.as_ref().ok())
6806                        {
6807                            sleep(d).await;
6808                            continue;
6809                        }
6810
6811                        dlg.finished(false);
6812
6813                        return Err(match error {
6814                            Ok(value) => common::Error::BadRequest(value),
6815                            _ => common::Error::Failure(response),
6816                        });
6817                    }
6818                    let response = {
6819                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6820                        let encoded = common::to_string(&bytes);
6821                        match serde_json::from_str(&encoded) {
6822                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6823                            Err(error) => {
6824                                dlg.response_json_decode_error(&encoded, &error);
6825                                return Err(common::Error::JsonDecodeError(
6826                                    encoded.to_string(),
6827                                    error,
6828                                ));
6829                            }
6830                        }
6831                    };
6832
6833                    dlg.finished(true);
6834                    return Ok(response);
6835                }
6836            }
6837        }
6838    }
6839
6840    /// Required. The domain resource name using the form: `projects/{project_id}/locations/global/domains/{domain_name}`
6841    ///
6842    /// Sets the *name* path property to the given value.
6843    ///
6844    /// Even though the property as already been set when instantiating this call,
6845    /// we provide this method for API completeness.
6846    pub fn name(mut self, new_value: &str) -> ProjectLocationGlobalDomainDeleteCall<'a, C> {
6847        self._name = new_value.to_string();
6848        self
6849    }
6850    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6851    /// while executing the actual API request.
6852    ///
6853    /// ````text
6854    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
6855    /// ````
6856    ///
6857    /// Sets the *delegate* property to the given value.
6858    pub fn delegate(
6859        mut self,
6860        new_value: &'a mut dyn common::Delegate,
6861    ) -> ProjectLocationGlobalDomainDeleteCall<'a, C> {
6862        self._delegate = Some(new_value);
6863        self
6864    }
6865
6866    /// Set any additional parameter of the query string used in the request.
6867    /// It should be used to set parameters which are not yet available through their own
6868    /// setters.
6869    ///
6870    /// Please note that this method must not be used to set any of the known parameters
6871    /// which have their own setter method. If done anyway, the request will fail.
6872    ///
6873    /// # Additional Parameters
6874    ///
6875    /// * *$.xgafv* (query-string) - V1 error format.
6876    /// * *access_token* (query-string) - OAuth access token.
6877    /// * *alt* (query-string) - Data format for response.
6878    /// * *callback* (query-string) - JSONP
6879    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6880    /// * *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.
6881    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6882    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6883    /// * *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.
6884    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6885    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6886    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationGlobalDomainDeleteCall<'a, C>
6887    where
6888        T: AsRef<str>,
6889    {
6890        self._additional_params
6891            .insert(name.as_ref().to_string(), value.as_ref().to_string());
6892        self
6893    }
6894
6895    /// Identifies the authorization scope for the method you are building.
6896    ///
6897    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6898    /// [`Scope::CloudPlatform`].
6899    ///
6900    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6901    /// tokens for more than one scope.
6902    ///
6903    /// Usually there is more than one suitable scope to authorize an operation, some of which may
6904    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6905    /// sufficient, a read-write scope will do as well.
6906    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationGlobalDomainDeleteCall<'a, C>
6907    where
6908        St: AsRef<str>,
6909    {
6910        self._scopes.insert(String::from(scope.as_ref()));
6911        self
6912    }
6913    /// Identifies the authorization scope(s) for the method you are building.
6914    ///
6915    /// See [`Self::add_scope()`] for details.
6916    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationGlobalDomainDeleteCall<'a, C>
6917    where
6918        I: IntoIterator<Item = St>,
6919        St: AsRef<str>,
6920    {
6921        self._scopes
6922            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6923        self
6924    }
6925
6926    /// Removes all scopes, and no default scope will be used either.
6927    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6928    /// for details).
6929    pub fn clear_scopes(mut self) -> ProjectLocationGlobalDomainDeleteCall<'a, C> {
6930        self._scopes.clear();
6931        self
6932    }
6933}
6934
6935/// Removes an AD trust.
6936///
6937/// A builder for the *locations.global.domains.detachTrust* method supported by a *project* resource.
6938/// It is not used directly, but through a [`ProjectMethods`] instance.
6939///
6940/// # Example
6941///
6942/// Instantiate a resource method builder
6943///
6944/// ```test_harness,no_run
6945/// # extern crate hyper;
6946/// # extern crate hyper_rustls;
6947/// # extern crate google_managedidentities1 as managedidentities1;
6948/// use managedidentities1::api::DetachTrustRequest;
6949/// # async fn dox() {
6950/// # use managedidentities1::{ManagedServiceForMicrosoftActiveDirectoryConsumerAPI, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6951///
6952/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6953/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
6954/// #     .with_native_roots()
6955/// #     .unwrap()
6956/// #     .https_only()
6957/// #     .enable_http2()
6958/// #     .build();
6959///
6960/// # let executor = hyper_util::rt::TokioExecutor::new();
6961/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
6962/// #     secret,
6963/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6964/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
6965/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
6966/// #     ),
6967/// # ).build().await.unwrap();
6968///
6969/// # let client = hyper_util::client::legacy::Client::builder(
6970/// #     hyper_util::rt::TokioExecutor::new()
6971/// # )
6972/// # .build(
6973/// #     hyper_rustls::HttpsConnectorBuilder::new()
6974/// #         .with_native_roots()
6975/// #         .unwrap()
6976/// #         .https_or_http()
6977/// #         .enable_http2()
6978/// #         .build()
6979/// # );
6980/// # let mut hub = ManagedServiceForMicrosoftActiveDirectoryConsumerAPI::new(client, auth);
6981/// // As the method needs a request, you would usually fill it with the desired information
6982/// // into the respective structure. Some of the parts shown here might not be applicable !
6983/// // Values shown here are possibly random and not representative !
6984/// let mut req = DetachTrustRequest::default();
6985///
6986/// // You can configure optional parameters by calling the respective setters at will, and
6987/// // execute the final call using `doit()`.
6988/// // Values shown here are possibly random and not representative !
6989/// let result = hub.projects().locations_global_domains_detach_trust(req, "name")
6990///              .doit().await;
6991/// # }
6992/// ```
6993pub struct ProjectLocationGlobalDomainDetachTrustCall<'a, C>
6994where
6995    C: 'a,
6996{
6997    hub: &'a ManagedServiceForMicrosoftActiveDirectoryConsumerAPI<C>,
6998    _request: DetachTrustRequest,
6999    _name: String,
7000    _delegate: Option<&'a mut dyn common::Delegate>,
7001    _additional_params: HashMap<String, String>,
7002    _scopes: BTreeSet<String>,
7003}
7004
7005impl<'a, C> common::CallBuilder for ProjectLocationGlobalDomainDetachTrustCall<'a, C> {}
7006
7007impl<'a, C> ProjectLocationGlobalDomainDetachTrustCall<'a, C>
7008where
7009    C: common::Connector,
7010{
7011    /// Perform the operation you have build so far.
7012    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
7013        use std::borrow::Cow;
7014        use std::io::{Read, Seek};
7015
7016        use common::{url::Params, ToParts};
7017        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7018
7019        let mut dd = common::DefaultDelegate;
7020        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7021        dlg.begin(common::MethodInfo {
7022            id: "managedidentities.projects.locations.global.domains.detachTrust",
7023            http_method: hyper::Method::POST,
7024        });
7025
7026        for &field in ["alt", "name"].iter() {
7027            if self._additional_params.contains_key(field) {
7028                dlg.finished(false);
7029                return Err(common::Error::FieldClash(field));
7030            }
7031        }
7032
7033        let mut params = Params::with_capacity(4 + self._additional_params.len());
7034        params.push("name", self._name);
7035
7036        params.extend(self._additional_params.iter());
7037
7038        params.push("alt", "json");
7039        let mut url = self.hub._base_url.clone() + "v1/{+name}:detachTrust";
7040        if self._scopes.is_empty() {
7041            self._scopes
7042                .insert(Scope::CloudPlatform.as_ref().to_string());
7043        }
7044
7045        #[allow(clippy::single_element_loop)]
7046        for &(find_this, param_name) in [("{+name}", "name")].iter() {
7047            url = params.uri_replacement(url, param_name, find_this, true);
7048        }
7049        {
7050            let to_remove = ["name"];
7051            params.remove_params(&to_remove);
7052        }
7053
7054        let url = params.parse_with_url(&url);
7055
7056        let mut json_mime_type = mime::APPLICATION_JSON;
7057        let mut request_value_reader = {
7058            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
7059            common::remove_json_null_values(&mut value);
7060            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
7061            serde_json::to_writer(&mut dst, &value).unwrap();
7062            dst
7063        };
7064        let request_size = request_value_reader
7065            .seek(std::io::SeekFrom::End(0))
7066            .unwrap();
7067        request_value_reader
7068            .seek(std::io::SeekFrom::Start(0))
7069            .unwrap();
7070
7071        loop {
7072            let token = match self
7073                .hub
7074                .auth
7075                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
7076                .await
7077            {
7078                Ok(token) => token,
7079                Err(e) => match dlg.token(e) {
7080                    Ok(token) => token,
7081                    Err(e) => {
7082                        dlg.finished(false);
7083                        return Err(common::Error::MissingToken(e));
7084                    }
7085                },
7086            };
7087            request_value_reader
7088                .seek(std::io::SeekFrom::Start(0))
7089                .unwrap();
7090            let mut req_result = {
7091                let client = &self.hub.client;
7092                dlg.pre_request();
7093                let mut req_builder = hyper::Request::builder()
7094                    .method(hyper::Method::POST)
7095                    .uri(url.as_str())
7096                    .header(USER_AGENT, self.hub._user_agent.clone());
7097
7098                if let Some(token) = token.as_ref() {
7099                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7100                }
7101
7102                let request = req_builder
7103                    .header(CONTENT_TYPE, json_mime_type.to_string())
7104                    .header(CONTENT_LENGTH, request_size as u64)
7105                    .body(common::to_body(
7106                        request_value_reader.get_ref().clone().into(),
7107                    ));
7108
7109                client.request(request.unwrap()).await
7110            };
7111
7112            match req_result {
7113                Err(err) => {
7114                    if let common::Retry::After(d) = dlg.http_error(&err) {
7115                        sleep(d).await;
7116                        continue;
7117                    }
7118                    dlg.finished(false);
7119                    return Err(common::Error::HttpError(err));
7120                }
7121                Ok(res) => {
7122                    let (mut parts, body) = res.into_parts();
7123                    let mut body = common::Body::new(body);
7124                    if !parts.status.is_success() {
7125                        let bytes = common::to_bytes(body).await.unwrap_or_default();
7126                        let error = serde_json::from_str(&common::to_string(&bytes));
7127                        let response = common::to_response(parts, bytes.into());
7128
7129                        if let common::Retry::After(d) =
7130                            dlg.http_failure(&response, error.as_ref().ok())
7131                        {
7132                            sleep(d).await;
7133                            continue;
7134                        }
7135
7136                        dlg.finished(false);
7137
7138                        return Err(match error {
7139                            Ok(value) => common::Error::BadRequest(value),
7140                            _ => common::Error::Failure(response),
7141                        });
7142                    }
7143                    let response = {
7144                        let bytes = common::to_bytes(body).await.unwrap_or_default();
7145                        let encoded = common::to_string(&bytes);
7146                        match serde_json::from_str(&encoded) {
7147                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
7148                            Err(error) => {
7149                                dlg.response_json_decode_error(&encoded, &error);
7150                                return Err(common::Error::JsonDecodeError(
7151                                    encoded.to_string(),
7152                                    error,
7153                                ));
7154                            }
7155                        }
7156                    };
7157
7158                    dlg.finished(true);
7159                    return Ok(response);
7160                }
7161            }
7162        }
7163    }
7164
7165    ///
7166    /// Sets the *request* property to the given value.
7167    ///
7168    /// Even though the property as already been set when instantiating this call,
7169    /// we provide this method for API completeness.
7170    pub fn request(
7171        mut self,
7172        new_value: DetachTrustRequest,
7173    ) -> ProjectLocationGlobalDomainDetachTrustCall<'a, C> {
7174        self._request = new_value;
7175        self
7176    }
7177    /// Required. The resource domain name, project name, and location using the form: `projects/{project_id}/locations/global/domains/{domain_name}`
7178    ///
7179    /// Sets the *name* path property to the given value.
7180    ///
7181    /// Even though the property as already been set when instantiating this call,
7182    /// we provide this method for API completeness.
7183    pub fn name(mut self, new_value: &str) -> ProjectLocationGlobalDomainDetachTrustCall<'a, C> {
7184        self._name = new_value.to_string();
7185        self
7186    }
7187    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7188    /// while executing the actual API request.
7189    ///
7190    /// ````text
7191    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
7192    /// ````
7193    ///
7194    /// Sets the *delegate* property to the given value.
7195    pub fn delegate(
7196        mut self,
7197        new_value: &'a mut dyn common::Delegate,
7198    ) -> ProjectLocationGlobalDomainDetachTrustCall<'a, C> {
7199        self._delegate = Some(new_value);
7200        self
7201    }
7202
7203    /// Set any additional parameter of the query string used in the request.
7204    /// It should be used to set parameters which are not yet available through their own
7205    /// setters.
7206    ///
7207    /// Please note that this method must not be used to set any of the known parameters
7208    /// which have their own setter method. If done anyway, the request will fail.
7209    ///
7210    /// # Additional Parameters
7211    ///
7212    /// * *$.xgafv* (query-string) - V1 error format.
7213    /// * *access_token* (query-string) - OAuth access token.
7214    /// * *alt* (query-string) - Data format for response.
7215    /// * *callback* (query-string) - JSONP
7216    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7217    /// * *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.
7218    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7219    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7220    /// * *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.
7221    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7222    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7223    pub fn param<T>(
7224        mut self,
7225        name: T,
7226        value: T,
7227    ) -> ProjectLocationGlobalDomainDetachTrustCall<'a, C>
7228    where
7229        T: AsRef<str>,
7230    {
7231        self._additional_params
7232            .insert(name.as_ref().to_string(), value.as_ref().to_string());
7233        self
7234    }
7235
7236    /// Identifies the authorization scope for the method you are building.
7237    ///
7238    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7239    /// [`Scope::CloudPlatform`].
7240    ///
7241    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7242    /// tokens for more than one scope.
7243    ///
7244    /// Usually there is more than one suitable scope to authorize an operation, some of which may
7245    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7246    /// sufficient, a read-write scope will do as well.
7247    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationGlobalDomainDetachTrustCall<'a, C>
7248    where
7249        St: AsRef<str>,
7250    {
7251        self._scopes.insert(String::from(scope.as_ref()));
7252        self
7253    }
7254    /// Identifies the authorization scope(s) for the method you are building.
7255    ///
7256    /// See [`Self::add_scope()`] for details.
7257    pub fn add_scopes<I, St>(
7258        mut self,
7259        scopes: I,
7260    ) -> ProjectLocationGlobalDomainDetachTrustCall<'a, C>
7261    where
7262        I: IntoIterator<Item = St>,
7263        St: AsRef<str>,
7264    {
7265        self._scopes
7266            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7267        self
7268    }
7269
7270    /// Removes all scopes, and no default scope will be used either.
7271    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7272    /// for details).
7273    pub fn clear_scopes(mut self) -> ProjectLocationGlobalDomainDetachTrustCall<'a, C> {
7274        self._scopes.clear();
7275        self
7276    }
7277}
7278
7279/// Disable Domain Migration
7280///
7281/// A builder for the *locations.global.domains.disableMigration* method supported by a *project* resource.
7282/// It is not used directly, but through a [`ProjectMethods`] instance.
7283///
7284/// # Example
7285///
7286/// Instantiate a resource method builder
7287///
7288/// ```test_harness,no_run
7289/// # extern crate hyper;
7290/// # extern crate hyper_rustls;
7291/// # extern crate google_managedidentities1 as managedidentities1;
7292/// use managedidentities1::api::DisableMigrationRequest;
7293/// # async fn dox() {
7294/// # use managedidentities1::{ManagedServiceForMicrosoftActiveDirectoryConsumerAPI, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7295///
7296/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7297/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
7298/// #     .with_native_roots()
7299/// #     .unwrap()
7300/// #     .https_only()
7301/// #     .enable_http2()
7302/// #     .build();
7303///
7304/// # let executor = hyper_util::rt::TokioExecutor::new();
7305/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
7306/// #     secret,
7307/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7308/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
7309/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
7310/// #     ),
7311/// # ).build().await.unwrap();
7312///
7313/// # let client = hyper_util::client::legacy::Client::builder(
7314/// #     hyper_util::rt::TokioExecutor::new()
7315/// # )
7316/// # .build(
7317/// #     hyper_rustls::HttpsConnectorBuilder::new()
7318/// #         .with_native_roots()
7319/// #         .unwrap()
7320/// #         .https_or_http()
7321/// #         .enable_http2()
7322/// #         .build()
7323/// # );
7324/// # let mut hub = ManagedServiceForMicrosoftActiveDirectoryConsumerAPI::new(client, auth);
7325/// // As the method needs a request, you would usually fill it with the desired information
7326/// // into the respective structure. Some of the parts shown here might not be applicable !
7327/// // Values shown here are possibly random and not representative !
7328/// let mut req = DisableMigrationRequest::default();
7329///
7330/// // You can configure optional parameters by calling the respective setters at will, and
7331/// // execute the final call using `doit()`.
7332/// // Values shown here are possibly random and not representative !
7333/// let result = hub.projects().locations_global_domains_disable_migration(req, "domain")
7334///              .doit().await;
7335/// # }
7336/// ```
7337pub struct ProjectLocationGlobalDomainDisableMigrationCall<'a, C>
7338where
7339    C: 'a,
7340{
7341    hub: &'a ManagedServiceForMicrosoftActiveDirectoryConsumerAPI<C>,
7342    _request: DisableMigrationRequest,
7343    _domain: String,
7344    _delegate: Option<&'a mut dyn common::Delegate>,
7345    _additional_params: HashMap<String, String>,
7346    _scopes: BTreeSet<String>,
7347}
7348
7349impl<'a, C> common::CallBuilder for ProjectLocationGlobalDomainDisableMigrationCall<'a, C> {}
7350
7351impl<'a, C> ProjectLocationGlobalDomainDisableMigrationCall<'a, C>
7352where
7353    C: common::Connector,
7354{
7355    /// Perform the operation you have build so far.
7356    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
7357        use std::borrow::Cow;
7358        use std::io::{Read, Seek};
7359
7360        use common::{url::Params, ToParts};
7361        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7362
7363        let mut dd = common::DefaultDelegate;
7364        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7365        dlg.begin(common::MethodInfo {
7366            id: "managedidentities.projects.locations.global.domains.disableMigration",
7367            http_method: hyper::Method::POST,
7368        });
7369
7370        for &field in ["alt", "domain"].iter() {
7371            if self._additional_params.contains_key(field) {
7372                dlg.finished(false);
7373                return Err(common::Error::FieldClash(field));
7374            }
7375        }
7376
7377        let mut params = Params::with_capacity(4 + self._additional_params.len());
7378        params.push("domain", self._domain);
7379
7380        params.extend(self._additional_params.iter());
7381
7382        params.push("alt", "json");
7383        let mut url = self.hub._base_url.clone() + "v1/{+domain}:disableMigration";
7384        if self._scopes.is_empty() {
7385            self._scopes
7386                .insert(Scope::CloudPlatform.as_ref().to_string());
7387        }
7388
7389        #[allow(clippy::single_element_loop)]
7390        for &(find_this, param_name) in [("{+domain}", "domain")].iter() {
7391            url = params.uri_replacement(url, param_name, find_this, true);
7392        }
7393        {
7394            let to_remove = ["domain"];
7395            params.remove_params(&to_remove);
7396        }
7397
7398        let url = params.parse_with_url(&url);
7399
7400        let mut json_mime_type = mime::APPLICATION_JSON;
7401        let mut request_value_reader = {
7402            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
7403            common::remove_json_null_values(&mut value);
7404            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
7405            serde_json::to_writer(&mut dst, &value).unwrap();
7406            dst
7407        };
7408        let request_size = request_value_reader
7409            .seek(std::io::SeekFrom::End(0))
7410            .unwrap();
7411        request_value_reader
7412            .seek(std::io::SeekFrom::Start(0))
7413            .unwrap();
7414
7415        loop {
7416            let token = match self
7417                .hub
7418                .auth
7419                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
7420                .await
7421            {
7422                Ok(token) => token,
7423                Err(e) => match dlg.token(e) {
7424                    Ok(token) => token,
7425                    Err(e) => {
7426                        dlg.finished(false);
7427                        return Err(common::Error::MissingToken(e));
7428                    }
7429                },
7430            };
7431            request_value_reader
7432                .seek(std::io::SeekFrom::Start(0))
7433                .unwrap();
7434            let mut req_result = {
7435                let client = &self.hub.client;
7436                dlg.pre_request();
7437                let mut req_builder = hyper::Request::builder()
7438                    .method(hyper::Method::POST)
7439                    .uri(url.as_str())
7440                    .header(USER_AGENT, self.hub._user_agent.clone());
7441
7442                if let Some(token) = token.as_ref() {
7443                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7444                }
7445
7446                let request = req_builder
7447                    .header(CONTENT_TYPE, json_mime_type.to_string())
7448                    .header(CONTENT_LENGTH, request_size as u64)
7449                    .body(common::to_body(
7450                        request_value_reader.get_ref().clone().into(),
7451                    ));
7452
7453                client.request(request.unwrap()).await
7454            };
7455
7456            match req_result {
7457                Err(err) => {
7458                    if let common::Retry::After(d) = dlg.http_error(&err) {
7459                        sleep(d).await;
7460                        continue;
7461                    }
7462                    dlg.finished(false);
7463                    return Err(common::Error::HttpError(err));
7464                }
7465                Ok(res) => {
7466                    let (mut parts, body) = res.into_parts();
7467                    let mut body = common::Body::new(body);
7468                    if !parts.status.is_success() {
7469                        let bytes = common::to_bytes(body).await.unwrap_or_default();
7470                        let error = serde_json::from_str(&common::to_string(&bytes));
7471                        let response = common::to_response(parts, bytes.into());
7472
7473                        if let common::Retry::After(d) =
7474                            dlg.http_failure(&response, error.as_ref().ok())
7475                        {
7476                            sleep(d).await;
7477                            continue;
7478                        }
7479
7480                        dlg.finished(false);
7481
7482                        return Err(match error {
7483                            Ok(value) => common::Error::BadRequest(value),
7484                            _ => common::Error::Failure(response),
7485                        });
7486                    }
7487                    let response = {
7488                        let bytes = common::to_bytes(body).await.unwrap_or_default();
7489                        let encoded = common::to_string(&bytes);
7490                        match serde_json::from_str(&encoded) {
7491                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
7492                            Err(error) => {
7493                                dlg.response_json_decode_error(&encoded, &error);
7494                                return Err(common::Error::JsonDecodeError(
7495                                    encoded.to_string(),
7496                                    error,
7497                                ));
7498                            }
7499                        }
7500                    };
7501
7502                    dlg.finished(true);
7503                    return Ok(response);
7504                }
7505            }
7506        }
7507    }
7508
7509    ///
7510    /// Sets the *request* property to the given value.
7511    ///
7512    /// Even though the property as already been set when instantiating this call,
7513    /// we provide this method for API completeness.
7514    pub fn request(
7515        mut self,
7516        new_value: DisableMigrationRequest,
7517    ) -> ProjectLocationGlobalDomainDisableMigrationCall<'a, C> {
7518        self._request = new_value;
7519        self
7520    }
7521    /// Required. The domain resource name using the form: `projects/{project_id}/locations/global/domains/{domain_name}`
7522    ///
7523    /// Sets the *domain* path property to the given value.
7524    ///
7525    /// Even though the property as already been set when instantiating this call,
7526    /// we provide this method for API completeness.
7527    pub fn domain(
7528        mut self,
7529        new_value: &str,
7530    ) -> ProjectLocationGlobalDomainDisableMigrationCall<'a, C> {
7531        self._domain = new_value.to_string();
7532        self
7533    }
7534    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7535    /// while executing the actual API request.
7536    ///
7537    /// ````text
7538    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
7539    /// ````
7540    ///
7541    /// Sets the *delegate* property to the given value.
7542    pub fn delegate(
7543        mut self,
7544        new_value: &'a mut dyn common::Delegate,
7545    ) -> ProjectLocationGlobalDomainDisableMigrationCall<'a, C> {
7546        self._delegate = Some(new_value);
7547        self
7548    }
7549
7550    /// Set any additional parameter of the query string used in the request.
7551    /// It should be used to set parameters which are not yet available through their own
7552    /// setters.
7553    ///
7554    /// Please note that this method must not be used to set any of the known parameters
7555    /// which have their own setter method. If done anyway, the request will fail.
7556    ///
7557    /// # Additional Parameters
7558    ///
7559    /// * *$.xgafv* (query-string) - V1 error format.
7560    /// * *access_token* (query-string) - OAuth access token.
7561    /// * *alt* (query-string) - Data format for response.
7562    /// * *callback* (query-string) - JSONP
7563    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7564    /// * *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.
7565    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7566    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7567    /// * *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.
7568    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7569    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7570    pub fn param<T>(
7571        mut self,
7572        name: T,
7573        value: T,
7574    ) -> ProjectLocationGlobalDomainDisableMigrationCall<'a, C>
7575    where
7576        T: AsRef<str>,
7577    {
7578        self._additional_params
7579            .insert(name.as_ref().to_string(), value.as_ref().to_string());
7580        self
7581    }
7582
7583    /// Identifies the authorization scope for the method you are building.
7584    ///
7585    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7586    /// [`Scope::CloudPlatform`].
7587    ///
7588    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7589    /// tokens for more than one scope.
7590    ///
7591    /// Usually there is more than one suitable scope to authorize an operation, some of which may
7592    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7593    /// sufficient, a read-write scope will do as well.
7594    pub fn add_scope<St>(
7595        mut self,
7596        scope: St,
7597    ) -> ProjectLocationGlobalDomainDisableMigrationCall<'a, C>
7598    where
7599        St: AsRef<str>,
7600    {
7601        self._scopes.insert(String::from(scope.as_ref()));
7602        self
7603    }
7604    /// Identifies the authorization scope(s) for the method you are building.
7605    ///
7606    /// See [`Self::add_scope()`] for details.
7607    pub fn add_scopes<I, St>(
7608        mut self,
7609        scopes: I,
7610    ) -> ProjectLocationGlobalDomainDisableMigrationCall<'a, C>
7611    where
7612        I: IntoIterator<Item = St>,
7613        St: AsRef<str>,
7614    {
7615        self._scopes
7616            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7617        self
7618    }
7619
7620    /// Removes all scopes, and no default scope will be used either.
7621    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7622    /// for details).
7623    pub fn clear_scopes(mut self) -> ProjectLocationGlobalDomainDisableMigrationCall<'a, C> {
7624        self._scopes.clear();
7625        self
7626    }
7627}
7628
7629/// DomainJoinMachine API joins a Compute Engine VM to the domain
7630///
7631/// A builder for the *locations.global.domains.domainJoinMachine* method supported by a *project* resource.
7632/// It is not used directly, but through a [`ProjectMethods`] instance.
7633///
7634/// # Example
7635///
7636/// Instantiate a resource method builder
7637///
7638/// ```test_harness,no_run
7639/// # extern crate hyper;
7640/// # extern crate hyper_rustls;
7641/// # extern crate google_managedidentities1 as managedidentities1;
7642/// use managedidentities1::api::DomainJoinMachineRequest;
7643/// # async fn dox() {
7644/// # use managedidentities1::{ManagedServiceForMicrosoftActiveDirectoryConsumerAPI, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7645///
7646/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7647/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
7648/// #     .with_native_roots()
7649/// #     .unwrap()
7650/// #     .https_only()
7651/// #     .enable_http2()
7652/// #     .build();
7653///
7654/// # let executor = hyper_util::rt::TokioExecutor::new();
7655/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
7656/// #     secret,
7657/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7658/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
7659/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
7660/// #     ),
7661/// # ).build().await.unwrap();
7662///
7663/// # let client = hyper_util::client::legacy::Client::builder(
7664/// #     hyper_util::rt::TokioExecutor::new()
7665/// # )
7666/// # .build(
7667/// #     hyper_rustls::HttpsConnectorBuilder::new()
7668/// #         .with_native_roots()
7669/// #         .unwrap()
7670/// #         .https_or_http()
7671/// #         .enable_http2()
7672/// #         .build()
7673/// # );
7674/// # let mut hub = ManagedServiceForMicrosoftActiveDirectoryConsumerAPI::new(client, auth);
7675/// // As the method needs a request, you would usually fill it with the desired information
7676/// // into the respective structure. Some of the parts shown here might not be applicable !
7677/// // Values shown here are possibly random and not representative !
7678/// let mut req = DomainJoinMachineRequest::default();
7679///
7680/// // You can configure optional parameters by calling the respective setters at will, and
7681/// // execute the final call using `doit()`.
7682/// // Values shown here are possibly random and not representative !
7683/// let result = hub.projects().locations_global_domains_domain_join_machine(req, "domain")
7684///              .doit().await;
7685/// # }
7686/// ```
7687pub struct ProjectLocationGlobalDomainDomainJoinMachineCall<'a, C>
7688where
7689    C: 'a,
7690{
7691    hub: &'a ManagedServiceForMicrosoftActiveDirectoryConsumerAPI<C>,
7692    _request: DomainJoinMachineRequest,
7693    _domain: String,
7694    _delegate: Option<&'a mut dyn common::Delegate>,
7695    _additional_params: HashMap<String, String>,
7696    _scopes: BTreeSet<String>,
7697}
7698
7699impl<'a, C> common::CallBuilder for ProjectLocationGlobalDomainDomainJoinMachineCall<'a, C> {}
7700
7701impl<'a, C> ProjectLocationGlobalDomainDomainJoinMachineCall<'a, C>
7702where
7703    C: common::Connector,
7704{
7705    /// Perform the operation you have build so far.
7706    pub async fn doit(mut self) -> common::Result<(common::Response, DomainJoinMachineResponse)> {
7707        use std::borrow::Cow;
7708        use std::io::{Read, Seek};
7709
7710        use common::{url::Params, ToParts};
7711        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7712
7713        let mut dd = common::DefaultDelegate;
7714        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7715        dlg.begin(common::MethodInfo {
7716            id: "managedidentities.projects.locations.global.domains.domainJoinMachine",
7717            http_method: hyper::Method::POST,
7718        });
7719
7720        for &field in ["alt", "domain"].iter() {
7721            if self._additional_params.contains_key(field) {
7722                dlg.finished(false);
7723                return Err(common::Error::FieldClash(field));
7724            }
7725        }
7726
7727        let mut params = Params::with_capacity(4 + self._additional_params.len());
7728        params.push("domain", self._domain);
7729
7730        params.extend(self._additional_params.iter());
7731
7732        params.push("alt", "json");
7733        let mut url = self.hub._base_url.clone() + "v1/{+domain}:domainJoinMachine";
7734        if self._scopes.is_empty() {
7735            self._scopes
7736                .insert(Scope::CloudPlatform.as_ref().to_string());
7737        }
7738
7739        #[allow(clippy::single_element_loop)]
7740        for &(find_this, param_name) in [("{+domain}", "domain")].iter() {
7741            url = params.uri_replacement(url, param_name, find_this, true);
7742        }
7743        {
7744            let to_remove = ["domain"];
7745            params.remove_params(&to_remove);
7746        }
7747
7748        let url = params.parse_with_url(&url);
7749
7750        let mut json_mime_type = mime::APPLICATION_JSON;
7751        let mut request_value_reader = {
7752            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
7753            common::remove_json_null_values(&mut value);
7754            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
7755            serde_json::to_writer(&mut dst, &value).unwrap();
7756            dst
7757        };
7758        let request_size = request_value_reader
7759            .seek(std::io::SeekFrom::End(0))
7760            .unwrap();
7761        request_value_reader
7762            .seek(std::io::SeekFrom::Start(0))
7763            .unwrap();
7764
7765        loop {
7766            let token = match self
7767                .hub
7768                .auth
7769                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
7770                .await
7771            {
7772                Ok(token) => token,
7773                Err(e) => match dlg.token(e) {
7774                    Ok(token) => token,
7775                    Err(e) => {
7776                        dlg.finished(false);
7777                        return Err(common::Error::MissingToken(e));
7778                    }
7779                },
7780            };
7781            request_value_reader
7782                .seek(std::io::SeekFrom::Start(0))
7783                .unwrap();
7784            let mut req_result = {
7785                let client = &self.hub.client;
7786                dlg.pre_request();
7787                let mut req_builder = hyper::Request::builder()
7788                    .method(hyper::Method::POST)
7789                    .uri(url.as_str())
7790                    .header(USER_AGENT, self.hub._user_agent.clone());
7791
7792                if let Some(token) = token.as_ref() {
7793                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7794                }
7795
7796                let request = req_builder
7797                    .header(CONTENT_TYPE, json_mime_type.to_string())
7798                    .header(CONTENT_LENGTH, request_size as u64)
7799                    .body(common::to_body(
7800                        request_value_reader.get_ref().clone().into(),
7801                    ));
7802
7803                client.request(request.unwrap()).await
7804            };
7805
7806            match req_result {
7807                Err(err) => {
7808                    if let common::Retry::After(d) = dlg.http_error(&err) {
7809                        sleep(d).await;
7810                        continue;
7811                    }
7812                    dlg.finished(false);
7813                    return Err(common::Error::HttpError(err));
7814                }
7815                Ok(res) => {
7816                    let (mut parts, body) = res.into_parts();
7817                    let mut body = common::Body::new(body);
7818                    if !parts.status.is_success() {
7819                        let bytes = common::to_bytes(body).await.unwrap_or_default();
7820                        let error = serde_json::from_str(&common::to_string(&bytes));
7821                        let response = common::to_response(parts, bytes.into());
7822
7823                        if let common::Retry::After(d) =
7824                            dlg.http_failure(&response, error.as_ref().ok())
7825                        {
7826                            sleep(d).await;
7827                            continue;
7828                        }
7829
7830                        dlg.finished(false);
7831
7832                        return Err(match error {
7833                            Ok(value) => common::Error::BadRequest(value),
7834                            _ => common::Error::Failure(response),
7835                        });
7836                    }
7837                    let response = {
7838                        let bytes = common::to_bytes(body).await.unwrap_or_default();
7839                        let encoded = common::to_string(&bytes);
7840                        match serde_json::from_str(&encoded) {
7841                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
7842                            Err(error) => {
7843                                dlg.response_json_decode_error(&encoded, &error);
7844                                return Err(common::Error::JsonDecodeError(
7845                                    encoded.to_string(),
7846                                    error,
7847                                ));
7848                            }
7849                        }
7850                    };
7851
7852                    dlg.finished(true);
7853                    return Ok(response);
7854                }
7855            }
7856        }
7857    }
7858
7859    ///
7860    /// Sets the *request* property to the given value.
7861    ///
7862    /// Even though the property as already been set when instantiating this call,
7863    /// we provide this method for API completeness.
7864    pub fn request(
7865        mut self,
7866        new_value: DomainJoinMachineRequest,
7867    ) -> ProjectLocationGlobalDomainDomainJoinMachineCall<'a, C> {
7868        self._request = new_value;
7869        self
7870    }
7871    /// Required. The domain resource name using the form: projects/{project_id}/locations/global/domains/{domain_name}
7872    ///
7873    /// Sets the *domain* path property to the given value.
7874    ///
7875    /// Even though the property as already been set when instantiating this call,
7876    /// we provide this method for API completeness.
7877    pub fn domain(
7878        mut self,
7879        new_value: &str,
7880    ) -> ProjectLocationGlobalDomainDomainJoinMachineCall<'a, C> {
7881        self._domain = new_value.to_string();
7882        self
7883    }
7884    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7885    /// while executing the actual API request.
7886    ///
7887    /// ````text
7888    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
7889    /// ````
7890    ///
7891    /// Sets the *delegate* property to the given value.
7892    pub fn delegate(
7893        mut self,
7894        new_value: &'a mut dyn common::Delegate,
7895    ) -> ProjectLocationGlobalDomainDomainJoinMachineCall<'a, C> {
7896        self._delegate = Some(new_value);
7897        self
7898    }
7899
7900    /// Set any additional parameter of the query string used in the request.
7901    /// It should be used to set parameters which are not yet available through their own
7902    /// setters.
7903    ///
7904    /// Please note that this method must not be used to set any of the known parameters
7905    /// which have their own setter method. If done anyway, the request will fail.
7906    ///
7907    /// # Additional Parameters
7908    ///
7909    /// * *$.xgafv* (query-string) - V1 error format.
7910    /// * *access_token* (query-string) - OAuth access token.
7911    /// * *alt* (query-string) - Data format for response.
7912    /// * *callback* (query-string) - JSONP
7913    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7914    /// * *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.
7915    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7916    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7917    /// * *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.
7918    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7919    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7920    pub fn param<T>(
7921        mut self,
7922        name: T,
7923        value: T,
7924    ) -> ProjectLocationGlobalDomainDomainJoinMachineCall<'a, C>
7925    where
7926        T: AsRef<str>,
7927    {
7928        self._additional_params
7929            .insert(name.as_ref().to_string(), value.as_ref().to_string());
7930        self
7931    }
7932
7933    /// Identifies the authorization scope for the method you are building.
7934    ///
7935    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7936    /// [`Scope::CloudPlatform`].
7937    ///
7938    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7939    /// tokens for more than one scope.
7940    ///
7941    /// Usually there is more than one suitable scope to authorize an operation, some of which may
7942    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7943    /// sufficient, a read-write scope will do as well.
7944    pub fn add_scope<St>(
7945        mut self,
7946        scope: St,
7947    ) -> ProjectLocationGlobalDomainDomainJoinMachineCall<'a, C>
7948    where
7949        St: AsRef<str>,
7950    {
7951        self._scopes.insert(String::from(scope.as_ref()));
7952        self
7953    }
7954    /// Identifies the authorization scope(s) for the method you are building.
7955    ///
7956    /// See [`Self::add_scope()`] for details.
7957    pub fn add_scopes<I, St>(
7958        mut self,
7959        scopes: I,
7960    ) -> ProjectLocationGlobalDomainDomainJoinMachineCall<'a, C>
7961    where
7962        I: IntoIterator<Item = St>,
7963        St: AsRef<str>,
7964    {
7965        self._scopes
7966            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7967        self
7968    }
7969
7970    /// Removes all scopes, and no default scope will be used either.
7971    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7972    /// for details).
7973    pub fn clear_scopes(mut self) -> ProjectLocationGlobalDomainDomainJoinMachineCall<'a, C> {
7974        self._scopes.clear();
7975        self
7976    }
7977}
7978
7979/// Enable Domain Migration
7980///
7981/// A builder for the *locations.global.domains.enableMigration* method supported by a *project* resource.
7982/// It is not used directly, but through a [`ProjectMethods`] instance.
7983///
7984/// # Example
7985///
7986/// Instantiate a resource method builder
7987///
7988/// ```test_harness,no_run
7989/// # extern crate hyper;
7990/// # extern crate hyper_rustls;
7991/// # extern crate google_managedidentities1 as managedidentities1;
7992/// use managedidentities1::api::EnableMigrationRequest;
7993/// # async fn dox() {
7994/// # use managedidentities1::{ManagedServiceForMicrosoftActiveDirectoryConsumerAPI, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7995///
7996/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7997/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
7998/// #     .with_native_roots()
7999/// #     .unwrap()
8000/// #     .https_only()
8001/// #     .enable_http2()
8002/// #     .build();
8003///
8004/// # let executor = hyper_util::rt::TokioExecutor::new();
8005/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
8006/// #     secret,
8007/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8008/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
8009/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
8010/// #     ),
8011/// # ).build().await.unwrap();
8012///
8013/// # let client = hyper_util::client::legacy::Client::builder(
8014/// #     hyper_util::rt::TokioExecutor::new()
8015/// # )
8016/// # .build(
8017/// #     hyper_rustls::HttpsConnectorBuilder::new()
8018/// #         .with_native_roots()
8019/// #         .unwrap()
8020/// #         .https_or_http()
8021/// #         .enable_http2()
8022/// #         .build()
8023/// # );
8024/// # let mut hub = ManagedServiceForMicrosoftActiveDirectoryConsumerAPI::new(client, auth);
8025/// // As the method needs a request, you would usually fill it with the desired information
8026/// // into the respective structure. Some of the parts shown here might not be applicable !
8027/// // Values shown here are possibly random and not representative !
8028/// let mut req = EnableMigrationRequest::default();
8029///
8030/// // You can configure optional parameters by calling the respective setters at will, and
8031/// // execute the final call using `doit()`.
8032/// // Values shown here are possibly random and not representative !
8033/// let result = hub.projects().locations_global_domains_enable_migration(req, "domain")
8034///              .doit().await;
8035/// # }
8036/// ```
8037pub struct ProjectLocationGlobalDomainEnableMigrationCall<'a, C>
8038where
8039    C: 'a,
8040{
8041    hub: &'a ManagedServiceForMicrosoftActiveDirectoryConsumerAPI<C>,
8042    _request: EnableMigrationRequest,
8043    _domain: String,
8044    _delegate: Option<&'a mut dyn common::Delegate>,
8045    _additional_params: HashMap<String, String>,
8046    _scopes: BTreeSet<String>,
8047}
8048
8049impl<'a, C> common::CallBuilder for ProjectLocationGlobalDomainEnableMigrationCall<'a, C> {}
8050
8051impl<'a, C> ProjectLocationGlobalDomainEnableMigrationCall<'a, C>
8052where
8053    C: common::Connector,
8054{
8055    /// Perform the operation you have build so far.
8056    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
8057        use std::borrow::Cow;
8058        use std::io::{Read, Seek};
8059
8060        use common::{url::Params, ToParts};
8061        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
8062
8063        let mut dd = common::DefaultDelegate;
8064        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
8065        dlg.begin(common::MethodInfo {
8066            id: "managedidentities.projects.locations.global.domains.enableMigration",
8067            http_method: hyper::Method::POST,
8068        });
8069
8070        for &field in ["alt", "domain"].iter() {
8071            if self._additional_params.contains_key(field) {
8072                dlg.finished(false);
8073                return Err(common::Error::FieldClash(field));
8074            }
8075        }
8076
8077        let mut params = Params::with_capacity(4 + self._additional_params.len());
8078        params.push("domain", self._domain);
8079
8080        params.extend(self._additional_params.iter());
8081
8082        params.push("alt", "json");
8083        let mut url = self.hub._base_url.clone() + "v1/{+domain}:enableMigration";
8084        if self._scopes.is_empty() {
8085            self._scopes
8086                .insert(Scope::CloudPlatform.as_ref().to_string());
8087        }
8088
8089        #[allow(clippy::single_element_loop)]
8090        for &(find_this, param_name) in [("{+domain}", "domain")].iter() {
8091            url = params.uri_replacement(url, param_name, find_this, true);
8092        }
8093        {
8094            let to_remove = ["domain"];
8095            params.remove_params(&to_remove);
8096        }
8097
8098        let url = params.parse_with_url(&url);
8099
8100        let mut json_mime_type = mime::APPLICATION_JSON;
8101        let mut request_value_reader = {
8102            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
8103            common::remove_json_null_values(&mut value);
8104            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
8105            serde_json::to_writer(&mut dst, &value).unwrap();
8106            dst
8107        };
8108        let request_size = request_value_reader
8109            .seek(std::io::SeekFrom::End(0))
8110            .unwrap();
8111        request_value_reader
8112            .seek(std::io::SeekFrom::Start(0))
8113            .unwrap();
8114
8115        loop {
8116            let token = match self
8117                .hub
8118                .auth
8119                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
8120                .await
8121            {
8122                Ok(token) => token,
8123                Err(e) => match dlg.token(e) {
8124                    Ok(token) => token,
8125                    Err(e) => {
8126                        dlg.finished(false);
8127                        return Err(common::Error::MissingToken(e));
8128                    }
8129                },
8130            };
8131            request_value_reader
8132                .seek(std::io::SeekFrom::Start(0))
8133                .unwrap();
8134            let mut req_result = {
8135                let client = &self.hub.client;
8136                dlg.pre_request();
8137                let mut req_builder = hyper::Request::builder()
8138                    .method(hyper::Method::POST)
8139                    .uri(url.as_str())
8140                    .header(USER_AGENT, self.hub._user_agent.clone());
8141
8142                if let Some(token) = token.as_ref() {
8143                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8144                }
8145
8146                let request = req_builder
8147                    .header(CONTENT_TYPE, json_mime_type.to_string())
8148                    .header(CONTENT_LENGTH, request_size as u64)
8149                    .body(common::to_body(
8150                        request_value_reader.get_ref().clone().into(),
8151                    ));
8152
8153                client.request(request.unwrap()).await
8154            };
8155
8156            match req_result {
8157                Err(err) => {
8158                    if let common::Retry::After(d) = dlg.http_error(&err) {
8159                        sleep(d).await;
8160                        continue;
8161                    }
8162                    dlg.finished(false);
8163                    return Err(common::Error::HttpError(err));
8164                }
8165                Ok(res) => {
8166                    let (mut parts, body) = res.into_parts();
8167                    let mut body = common::Body::new(body);
8168                    if !parts.status.is_success() {
8169                        let bytes = common::to_bytes(body).await.unwrap_or_default();
8170                        let error = serde_json::from_str(&common::to_string(&bytes));
8171                        let response = common::to_response(parts, bytes.into());
8172
8173                        if let common::Retry::After(d) =
8174                            dlg.http_failure(&response, error.as_ref().ok())
8175                        {
8176                            sleep(d).await;
8177                            continue;
8178                        }
8179
8180                        dlg.finished(false);
8181
8182                        return Err(match error {
8183                            Ok(value) => common::Error::BadRequest(value),
8184                            _ => common::Error::Failure(response),
8185                        });
8186                    }
8187                    let response = {
8188                        let bytes = common::to_bytes(body).await.unwrap_or_default();
8189                        let encoded = common::to_string(&bytes);
8190                        match serde_json::from_str(&encoded) {
8191                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8192                            Err(error) => {
8193                                dlg.response_json_decode_error(&encoded, &error);
8194                                return Err(common::Error::JsonDecodeError(
8195                                    encoded.to_string(),
8196                                    error,
8197                                ));
8198                            }
8199                        }
8200                    };
8201
8202                    dlg.finished(true);
8203                    return Ok(response);
8204                }
8205            }
8206        }
8207    }
8208
8209    ///
8210    /// Sets the *request* property to the given value.
8211    ///
8212    /// Even though the property as already been set when instantiating this call,
8213    /// we provide this method for API completeness.
8214    pub fn request(
8215        mut self,
8216        new_value: EnableMigrationRequest,
8217    ) -> ProjectLocationGlobalDomainEnableMigrationCall<'a, C> {
8218        self._request = new_value;
8219        self
8220    }
8221    /// Required. The domain resource name using the form: `projects/{project_id}/locations/global/domains/{domain_name}`
8222    ///
8223    /// Sets the *domain* path property to the given value.
8224    ///
8225    /// Even though the property as already been set when instantiating this call,
8226    /// we provide this method for API completeness.
8227    pub fn domain(
8228        mut self,
8229        new_value: &str,
8230    ) -> ProjectLocationGlobalDomainEnableMigrationCall<'a, C> {
8231        self._domain = new_value.to_string();
8232        self
8233    }
8234    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8235    /// while executing the actual API request.
8236    ///
8237    /// ````text
8238    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
8239    /// ````
8240    ///
8241    /// Sets the *delegate* property to the given value.
8242    pub fn delegate(
8243        mut self,
8244        new_value: &'a mut dyn common::Delegate,
8245    ) -> ProjectLocationGlobalDomainEnableMigrationCall<'a, C> {
8246        self._delegate = Some(new_value);
8247        self
8248    }
8249
8250    /// Set any additional parameter of the query string used in the request.
8251    /// It should be used to set parameters which are not yet available through their own
8252    /// setters.
8253    ///
8254    /// Please note that this method must not be used to set any of the known parameters
8255    /// which have their own setter method. If done anyway, the request will fail.
8256    ///
8257    /// # Additional Parameters
8258    ///
8259    /// * *$.xgafv* (query-string) - V1 error format.
8260    /// * *access_token* (query-string) - OAuth access token.
8261    /// * *alt* (query-string) - Data format for response.
8262    /// * *callback* (query-string) - JSONP
8263    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8264    /// * *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.
8265    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8266    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8267    /// * *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.
8268    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8269    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8270    pub fn param<T>(
8271        mut self,
8272        name: T,
8273        value: T,
8274    ) -> ProjectLocationGlobalDomainEnableMigrationCall<'a, C>
8275    where
8276        T: AsRef<str>,
8277    {
8278        self._additional_params
8279            .insert(name.as_ref().to_string(), value.as_ref().to_string());
8280        self
8281    }
8282
8283    /// Identifies the authorization scope for the method you are building.
8284    ///
8285    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
8286    /// [`Scope::CloudPlatform`].
8287    ///
8288    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
8289    /// tokens for more than one scope.
8290    ///
8291    /// Usually there is more than one suitable scope to authorize an operation, some of which may
8292    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
8293    /// sufficient, a read-write scope will do as well.
8294    pub fn add_scope<St>(
8295        mut self,
8296        scope: St,
8297    ) -> ProjectLocationGlobalDomainEnableMigrationCall<'a, C>
8298    where
8299        St: AsRef<str>,
8300    {
8301        self._scopes.insert(String::from(scope.as_ref()));
8302        self
8303    }
8304    /// Identifies the authorization scope(s) for the method you are building.
8305    ///
8306    /// See [`Self::add_scope()`] for details.
8307    pub fn add_scopes<I, St>(
8308        mut self,
8309        scopes: I,
8310    ) -> ProjectLocationGlobalDomainEnableMigrationCall<'a, C>
8311    where
8312        I: IntoIterator<Item = St>,
8313        St: AsRef<str>,
8314    {
8315        self._scopes
8316            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
8317        self
8318    }
8319
8320    /// Removes all scopes, and no default scope will be used either.
8321    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
8322    /// for details).
8323    pub fn clear_scopes(mut self) -> ProjectLocationGlobalDomainEnableMigrationCall<'a, C> {
8324        self._scopes.clear();
8325        self
8326    }
8327}
8328
8329/// Extend Schema for Domain
8330///
8331/// A builder for the *locations.global.domains.extendSchema* method supported by a *project* resource.
8332/// It is not used directly, but through a [`ProjectMethods`] instance.
8333///
8334/// # Example
8335///
8336/// Instantiate a resource method builder
8337///
8338/// ```test_harness,no_run
8339/// # extern crate hyper;
8340/// # extern crate hyper_rustls;
8341/// # extern crate google_managedidentities1 as managedidentities1;
8342/// use managedidentities1::api::ExtendSchemaRequest;
8343/// # async fn dox() {
8344/// # use managedidentities1::{ManagedServiceForMicrosoftActiveDirectoryConsumerAPI, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8345///
8346/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
8347/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
8348/// #     .with_native_roots()
8349/// #     .unwrap()
8350/// #     .https_only()
8351/// #     .enable_http2()
8352/// #     .build();
8353///
8354/// # let executor = hyper_util::rt::TokioExecutor::new();
8355/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
8356/// #     secret,
8357/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8358/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
8359/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
8360/// #     ),
8361/// # ).build().await.unwrap();
8362///
8363/// # let client = hyper_util::client::legacy::Client::builder(
8364/// #     hyper_util::rt::TokioExecutor::new()
8365/// # )
8366/// # .build(
8367/// #     hyper_rustls::HttpsConnectorBuilder::new()
8368/// #         .with_native_roots()
8369/// #         .unwrap()
8370/// #         .https_or_http()
8371/// #         .enable_http2()
8372/// #         .build()
8373/// # );
8374/// # let mut hub = ManagedServiceForMicrosoftActiveDirectoryConsumerAPI::new(client, auth);
8375/// // As the method needs a request, you would usually fill it with the desired information
8376/// // into the respective structure. Some of the parts shown here might not be applicable !
8377/// // Values shown here are possibly random and not representative !
8378/// let mut req = ExtendSchemaRequest::default();
8379///
8380/// // You can configure optional parameters by calling the respective setters at will, and
8381/// // execute the final call using `doit()`.
8382/// // Values shown here are possibly random and not representative !
8383/// let result = hub.projects().locations_global_domains_extend_schema(req, "domain")
8384///              .doit().await;
8385/// # }
8386/// ```
8387pub struct ProjectLocationGlobalDomainExtendSchemaCall<'a, C>
8388where
8389    C: 'a,
8390{
8391    hub: &'a ManagedServiceForMicrosoftActiveDirectoryConsumerAPI<C>,
8392    _request: ExtendSchemaRequest,
8393    _domain: String,
8394    _delegate: Option<&'a mut dyn common::Delegate>,
8395    _additional_params: HashMap<String, String>,
8396    _scopes: BTreeSet<String>,
8397}
8398
8399impl<'a, C> common::CallBuilder for ProjectLocationGlobalDomainExtendSchemaCall<'a, C> {}
8400
8401impl<'a, C> ProjectLocationGlobalDomainExtendSchemaCall<'a, C>
8402where
8403    C: common::Connector,
8404{
8405    /// Perform the operation you have build so far.
8406    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
8407        use std::borrow::Cow;
8408        use std::io::{Read, Seek};
8409
8410        use common::{url::Params, ToParts};
8411        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
8412
8413        let mut dd = common::DefaultDelegate;
8414        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
8415        dlg.begin(common::MethodInfo {
8416            id: "managedidentities.projects.locations.global.domains.extendSchema",
8417            http_method: hyper::Method::POST,
8418        });
8419
8420        for &field in ["alt", "domain"].iter() {
8421            if self._additional_params.contains_key(field) {
8422                dlg.finished(false);
8423                return Err(common::Error::FieldClash(field));
8424            }
8425        }
8426
8427        let mut params = Params::with_capacity(4 + self._additional_params.len());
8428        params.push("domain", self._domain);
8429
8430        params.extend(self._additional_params.iter());
8431
8432        params.push("alt", "json");
8433        let mut url = self.hub._base_url.clone() + "v1/{+domain}:extendSchema";
8434        if self._scopes.is_empty() {
8435            self._scopes
8436                .insert(Scope::CloudPlatform.as_ref().to_string());
8437        }
8438
8439        #[allow(clippy::single_element_loop)]
8440        for &(find_this, param_name) in [("{+domain}", "domain")].iter() {
8441            url = params.uri_replacement(url, param_name, find_this, true);
8442        }
8443        {
8444            let to_remove = ["domain"];
8445            params.remove_params(&to_remove);
8446        }
8447
8448        let url = params.parse_with_url(&url);
8449
8450        let mut json_mime_type = mime::APPLICATION_JSON;
8451        let mut request_value_reader = {
8452            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
8453            common::remove_json_null_values(&mut value);
8454            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
8455            serde_json::to_writer(&mut dst, &value).unwrap();
8456            dst
8457        };
8458        let request_size = request_value_reader
8459            .seek(std::io::SeekFrom::End(0))
8460            .unwrap();
8461        request_value_reader
8462            .seek(std::io::SeekFrom::Start(0))
8463            .unwrap();
8464
8465        loop {
8466            let token = match self
8467                .hub
8468                .auth
8469                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
8470                .await
8471            {
8472                Ok(token) => token,
8473                Err(e) => match dlg.token(e) {
8474                    Ok(token) => token,
8475                    Err(e) => {
8476                        dlg.finished(false);
8477                        return Err(common::Error::MissingToken(e));
8478                    }
8479                },
8480            };
8481            request_value_reader
8482                .seek(std::io::SeekFrom::Start(0))
8483                .unwrap();
8484            let mut req_result = {
8485                let client = &self.hub.client;
8486                dlg.pre_request();
8487                let mut req_builder = hyper::Request::builder()
8488                    .method(hyper::Method::POST)
8489                    .uri(url.as_str())
8490                    .header(USER_AGENT, self.hub._user_agent.clone());
8491
8492                if let Some(token) = token.as_ref() {
8493                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8494                }
8495
8496                let request = req_builder
8497                    .header(CONTENT_TYPE, json_mime_type.to_string())
8498                    .header(CONTENT_LENGTH, request_size as u64)
8499                    .body(common::to_body(
8500                        request_value_reader.get_ref().clone().into(),
8501                    ));
8502
8503                client.request(request.unwrap()).await
8504            };
8505
8506            match req_result {
8507                Err(err) => {
8508                    if let common::Retry::After(d) = dlg.http_error(&err) {
8509                        sleep(d).await;
8510                        continue;
8511                    }
8512                    dlg.finished(false);
8513                    return Err(common::Error::HttpError(err));
8514                }
8515                Ok(res) => {
8516                    let (mut parts, body) = res.into_parts();
8517                    let mut body = common::Body::new(body);
8518                    if !parts.status.is_success() {
8519                        let bytes = common::to_bytes(body).await.unwrap_or_default();
8520                        let error = serde_json::from_str(&common::to_string(&bytes));
8521                        let response = common::to_response(parts, bytes.into());
8522
8523                        if let common::Retry::After(d) =
8524                            dlg.http_failure(&response, error.as_ref().ok())
8525                        {
8526                            sleep(d).await;
8527                            continue;
8528                        }
8529
8530                        dlg.finished(false);
8531
8532                        return Err(match error {
8533                            Ok(value) => common::Error::BadRequest(value),
8534                            _ => common::Error::Failure(response),
8535                        });
8536                    }
8537                    let response = {
8538                        let bytes = common::to_bytes(body).await.unwrap_or_default();
8539                        let encoded = common::to_string(&bytes);
8540                        match serde_json::from_str(&encoded) {
8541                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8542                            Err(error) => {
8543                                dlg.response_json_decode_error(&encoded, &error);
8544                                return Err(common::Error::JsonDecodeError(
8545                                    encoded.to_string(),
8546                                    error,
8547                                ));
8548                            }
8549                        }
8550                    };
8551
8552                    dlg.finished(true);
8553                    return Ok(response);
8554                }
8555            }
8556        }
8557    }
8558
8559    ///
8560    /// Sets the *request* property to the given value.
8561    ///
8562    /// Even though the property as already been set when instantiating this call,
8563    /// we provide this method for API completeness.
8564    pub fn request(
8565        mut self,
8566        new_value: ExtendSchemaRequest,
8567    ) -> ProjectLocationGlobalDomainExtendSchemaCall<'a, C> {
8568        self._request = new_value;
8569        self
8570    }
8571    /// Required. The domain resource name using the form: `projects/{project_id}/locations/global/domains/{domain_name}`
8572    ///
8573    /// Sets the *domain* path property to the given value.
8574    ///
8575    /// Even though the property as already been set when instantiating this call,
8576    /// we provide this method for API completeness.
8577    pub fn domain(mut self, new_value: &str) -> ProjectLocationGlobalDomainExtendSchemaCall<'a, C> {
8578        self._domain = new_value.to_string();
8579        self
8580    }
8581    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8582    /// while executing the actual API request.
8583    ///
8584    /// ````text
8585    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
8586    /// ````
8587    ///
8588    /// Sets the *delegate* property to the given value.
8589    pub fn delegate(
8590        mut self,
8591        new_value: &'a mut dyn common::Delegate,
8592    ) -> ProjectLocationGlobalDomainExtendSchemaCall<'a, C> {
8593        self._delegate = Some(new_value);
8594        self
8595    }
8596
8597    /// Set any additional parameter of the query string used in the request.
8598    /// It should be used to set parameters which are not yet available through their own
8599    /// setters.
8600    ///
8601    /// Please note that this method must not be used to set any of the known parameters
8602    /// which have their own setter method. If done anyway, the request will fail.
8603    ///
8604    /// # Additional Parameters
8605    ///
8606    /// * *$.xgafv* (query-string) - V1 error format.
8607    /// * *access_token* (query-string) - OAuth access token.
8608    /// * *alt* (query-string) - Data format for response.
8609    /// * *callback* (query-string) - JSONP
8610    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8611    /// * *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.
8612    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8613    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8614    /// * *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.
8615    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8616    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8617    pub fn param<T>(
8618        mut self,
8619        name: T,
8620        value: T,
8621    ) -> ProjectLocationGlobalDomainExtendSchemaCall<'a, C>
8622    where
8623        T: AsRef<str>,
8624    {
8625        self._additional_params
8626            .insert(name.as_ref().to_string(), value.as_ref().to_string());
8627        self
8628    }
8629
8630    /// Identifies the authorization scope for the method you are building.
8631    ///
8632    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
8633    /// [`Scope::CloudPlatform`].
8634    ///
8635    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
8636    /// tokens for more than one scope.
8637    ///
8638    /// Usually there is more than one suitable scope to authorize an operation, some of which may
8639    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
8640    /// sufficient, a read-write scope will do as well.
8641    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationGlobalDomainExtendSchemaCall<'a, C>
8642    where
8643        St: AsRef<str>,
8644    {
8645        self._scopes.insert(String::from(scope.as_ref()));
8646        self
8647    }
8648    /// Identifies the authorization scope(s) for the method you are building.
8649    ///
8650    /// See [`Self::add_scope()`] for details.
8651    pub fn add_scopes<I, St>(
8652        mut self,
8653        scopes: I,
8654    ) -> ProjectLocationGlobalDomainExtendSchemaCall<'a, C>
8655    where
8656        I: IntoIterator<Item = St>,
8657        St: AsRef<str>,
8658    {
8659        self._scopes
8660            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
8661        self
8662    }
8663
8664    /// Removes all scopes, and no default scope will be used either.
8665    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
8666    /// for details).
8667    pub fn clear_scopes(mut self) -> ProjectLocationGlobalDomainExtendSchemaCall<'a, C> {
8668        self._scopes.clear();
8669        self
8670    }
8671}
8672
8673/// Gets information about a domain.
8674///
8675/// A builder for the *locations.global.domains.get* method supported by a *project* resource.
8676/// It is not used directly, but through a [`ProjectMethods`] instance.
8677///
8678/// # Example
8679///
8680/// Instantiate a resource method builder
8681///
8682/// ```test_harness,no_run
8683/// # extern crate hyper;
8684/// # extern crate hyper_rustls;
8685/// # extern crate google_managedidentities1 as managedidentities1;
8686/// # async fn dox() {
8687/// # use managedidentities1::{ManagedServiceForMicrosoftActiveDirectoryConsumerAPI, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8688///
8689/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
8690/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
8691/// #     .with_native_roots()
8692/// #     .unwrap()
8693/// #     .https_only()
8694/// #     .enable_http2()
8695/// #     .build();
8696///
8697/// # let executor = hyper_util::rt::TokioExecutor::new();
8698/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
8699/// #     secret,
8700/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8701/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
8702/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
8703/// #     ),
8704/// # ).build().await.unwrap();
8705///
8706/// # let client = hyper_util::client::legacy::Client::builder(
8707/// #     hyper_util::rt::TokioExecutor::new()
8708/// # )
8709/// # .build(
8710/// #     hyper_rustls::HttpsConnectorBuilder::new()
8711/// #         .with_native_roots()
8712/// #         .unwrap()
8713/// #         .https_or_http()
8714/// #         .enable_http2()
8715/// #         .build()
8716/// # );
8717/// # let mut hub = ManagedServiceForMicrosoftActiveDirectoryConsumerAPI::new(client, auth);
8718/// // You can configure optional parameters by calling the respective setters at will, and
8719/// // execute the final call using `doit()`.
8720/// // Values shown here are possibly random and not representative !
8721/// let result = hub.projects().locations_global_domains_get("name")
8722///              .doit().await;
8723/// # }
8724/// ```
8725pub struct ProjectLocationGlobalDomainGetCall<'a, C>
8726where
8727    C: 'a,
8728{
8729    hub: &'a ManagedServiceForMicrosoftActiveDirectoryConsumerAPI<C>,
8730    _name: String,
8731    _delegate: Option<&'a mut dyn common::Delegate>,
8732    _additional_params: HashMap<String, String>,
8733    _scopes: BTreeSet<String>,
8734}
8735
8736impl<'a, C> common::CallBuilder for ProjectLocationGlobalDomainGetCall<'a, C> {}
8737
8738impl<'a, C> ProjectLocationGlobalDomainGetCall<'a, C>
8739where
8740    C: common::Connector,
8741{
8742    /// Perform the operation you have build so far.
8743    pub async fn doit(mut self) -> common::Result<(common::Response, Domain)> {
8744        use std::borrow::Cow;
8745        use std::io::{Read, Seek};
8746
8747        use common::{url::Params, ToParts};
8748        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
8749
8750        let mut dd = common::DefaultDelegate;
8751        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
8752        dlg.begin(common::MethodInfo {
8753            id: "managedidentities.projects.locations.global.domains.get",
8754            http_method: hyper::Method::GET,
8755        });
8756
8757        for &field in ["alt", "name"].iter() {
8758            if self._additional_params.contains_key(field) {
8759                dlg.finished(false);
8760                return Err(common::Error::FieldClash(field));
8761            }
8762        }
8763
8764        let mut params = Params::with_capacity(3 + self._additional_params.len());
8765        params.push("name", self._name);
8766
8767        params.extend(self._additional_params.iter());
8768
8769        params.push("alt", "json");
8770        let mut url = self.hub._base_url.clone() + "v1/{+name}";
8771        if self._scopes.is_empty() {
8772            self._scopes
8773                .insert(Scope::CloudPlatform.as_ref().to_string());
8774        }
8775
8776        #[allow(clippy::single_element_loop)]
8777        for &(find_this, param_name) in [("{+name}", "name")].iter() {
8778            url = params.uri_replacement(url, param_name, find_this, true);
8779        }
8780        {
8781            let to_remove = ["name"];
8782            params.remove_params(&to_remove);
8783        }
8784
8785        let url = params.parse_with_url(&url);
8786
8787        loop {
8788            let token = match self
8789                .hub
8790                .auth
8791                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
8792                .await
8793            {
8794                Ok(token) => token,
8795                Err(e) => match dlg.token(e) {
8796                    Ok(token) => token,
8797                    Err(e) => {
8798                        dlg.finished(false);
8799                        return Err(common::Error::MissingToken(e));
8800                    }
8801                },
8802            };
8803            let mut req_result = {
8804                let client = &self.hub.client;
8805                dlg.pre_request();
8806                let mut req_builder = hyper::Request::builder()
8807                    .method(hyper::Method::GET)
8808                    .uri(url.as_str())
8809                    .header(USER_AGENT, self.hub._user_agent.clone());
8810
8811                if let Some(token) = token.as_ref() {
8812                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8813                }
8814
8815                let request = req_builder
8816                    .header(CONTENT_LENGTH, 0_u64)
8817                    .body(common::to_body::<String>(None));
8818
8819                client.request(request.unwrap()).await
8820            };
8821
8822            match req_result {
8823                Err(err) => {
8824                    if let common::Retry::After(d) = dlg.http_error(&err) {
8825                        sleep(d).await;
8826                        continue;
8827                    }
8828                    dlg.finished(false);
8829                    return Err(common::Error::HttpError(err));
8830                }
8831                Ok(res) => {
8832                    let (mut parts, body) = res.into_parts();
8833                    let mut body = common::Body::new(body);
8834                    if !parts.status.is_success() {
8835                        let bytes = common::to_bytes(body).await.unwrap_or_default();
8836                        let error = serde_json::from_str(&common::to_string(&bytes));
8837                        let response = common::to_response(parts, bytes.into());
8838
8839                        if let common::Retry::After(d) =
8840                            dlg.http_failure(&response, error.as_ref().ok())
8841                        {
8842                            sleep(d).await;
8843                            continue;
8844                        }
8845
8846                        dlg.finished(false);
8847
8848                        return Err(match error {
8849                            Ok(value) => common::Error::BadRequest(value),
8850                            _ => common::Error::Failure(response),
8851                        });
8852                    }
8853                    let response = {
8854                        let bytes = common::to_bytes(body).await.unwrap_or_default();
8855                        let encoded = common::to_string(&bytes);
8856                        match serde_json::from_str(&encoded) {
8857                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8858                            Err(error) => {
8859                                dlg.response_json_decode_error(&encoded, &error);
8860                                return Err(common::Error::JsonDecodeError(
8861                                    encoded.to_string(),
8862                                    error,
8863                                ));
8864                            }
8865                        }
8866                    };
8867
8868                    dlg.finished(true);
8869                    return Ok(response);
8870                }
8871            }
8872        }
8873    }
8874
8875    /// Required. The domain resource name using the form: `projects/{project_id}/locations/global/domains/{domain_name}`
8876    ///
8877    /// Sets the *name* path property to the given value.
8878    ///
8879    /// Even though the property as already been set when instantiating this call,
8880    /// we provide this method for API completeness.
8881    pub fn name(mut self, new_value: &str) -> ProjectLocationGlobalDomainGetCall<'a, C> {
8882        self._name = new_value.to_string();
8883        self
8884    }
8885    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8886    /// while executing the actual API request.
8887    ///
8888    /// ````text
8889    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
8890    /// ````
8891    ///
8892    /// Sets the *delegate* property to the given value.
8893    pub fn delegate(
8894        mut self,
8895        new_value: &'a mut dyn common::Delegate,
8896    ) -> ProjectLocationGlobalDomainGetCall<'a, C> {
8897        self._delegate = Some(new_value);
8898        self
8899    }
8900
8901    /// Set any additional parameter of the query string used in the request.
8902    /// It should be used to set parameters which are not yet available through their own
8903    /// setters.
8904    ///
8905    /// Please note that this method must not be used to set any of the known parameters
8906    /// which have their own setter method. If done anyway, the request will fail.
8907    ///
8908    /// # Additional Parameters
8909    ///
8910    /// * *$.xgafv* (query-string) - V1 error format.
8911    /// * *access_token* (query-string) - OAuth access token.
8912    /// * *alt* (query-string) - Data format for response.
8913    /// * *callback* (query-string) - JSONP
8914    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8915    /// * *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.
8916    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8917    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8918    /// * *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.
8919    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8920    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8921    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationGlobalDomainGetCall<'a, C>
8922    where
8923        T: AsRef<str>,
8924    {
8925        self._additional_params
8926            .insert(name.as_ref().to_string(), value.as_ref().to_string());
8927        self
8928    }
8929
8930    /// Identifies the authorization scope for the method you are building.
8931    ///
8932    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
8933    /// [`Scope::CloudPlatform`].
8934    ///
8935    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
8936    /// tokens for more than one scope.
8937    ///
8938    /// Usually there is more than one suitable scope to authorize an operation, some of which may
8939    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
8940    /// sufficient, a read-write scope will do as well.
8941    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationGlobalDomainGetCall<'a, C>
8942    where
8943        St: AsRef<str>,
8944    {
8945        self._scopes.insert(String::from(scope.as_ref()));
8946        self
8947    }
8948    /// Identifies the authorization scope(s) for the method you are building.
8949    ///
8950    /// See [`Self::add_scope()`] for details.
8951    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationGlobalDomainGetCall<'a, C>
8952    where
8953        I: IntoIterator<Item = St>,
8954        St: AsRef<str>,
8955    {
8956        self._scopes
8957            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
8958        self
8959    }
8960
8961    /// Removes all scopes, and no default scope will be used either.
8962    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
8963    /// for details).
8964    pub fn clear_scopes(mut self) -> ProjectLocationGlobalDomainGetCall<'a, C> {
8965        self._scopes.clear();
8966        self
8967    }
8968}
8969
8970/// Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.
8971///
8972/// A builder for the *locations.global.domains.getIamPolicy* method supported by a *project* resource.
8973/// It is not used directly, but through a [`ProjectMethods`] instance.
8974///
8975/// # Example
8976///
8977/// Instantiate a resource method builder
8978///
8979/// ```test_harness,no_run
8980/// # extern crate hyper;
8981/// # extern crate hyper_rustls;
8982/// # extern crate google_managedidentities1 as managedidentities1;
8983/// # async fn dox() {
8984/// # use managedidentities1::{ManagedServiceForMicrosoftActiveDirectoryConsumerAPI, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8985///
8986/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
8987/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
8988/// #     .with_native_roots()
8989/// #     .unwrap()
8990/// #     .https_only()
8991/// #     .enable_http2()
8992/// #     .build();
8993///
8994/// # let executor = hyper_util::rt::TokioExecutor::new();
8995/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
8996/// #     secret,
8997/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8998/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
8999/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
9000/// #     ),
9001/// # ).build().await.unwrap();
9002///
9003/// # let client = hyper_util::client::legacy::Client::builder(
9004/// #     hyper_util::rt::TokioExecutor::new()
9005/// # )
9006/// # .build(
9007/// #     hyper_rustls::HttpsConnectorBuilder::new()
9008/// #         .with_native_roots()
9009/// #         .unwrap()
9010/// #         .https_or_http()
9011/// #         .enable_http2()
9012/// #         .build()
9013/// # );
9014/// # let mut hub = ManagedServiceForMicrosoftActiveDirectoryConsumerAPI::new(client, auth);
9015/// // You can configure optional parameters by calling the respective setters at will, and
9016/// // execute the final call using `doit()`.
9017/// // Values shown here are possibly random and not representative !
9018/// let result = hub.projects().locations_global_domains_get_iam_policy("resource")
9019///              .options_requested_policy_version(-43)
9020///              .doit().await;
9021/// # }
9022/// ```
9023pub struct ProjectLocationGlobalDomainGetIamPolicyCall<'a, C>
9024where
9025    C: 'a,
9026{
9027    hub: &'a ManagedServiceForMicrosoftActiveDirectoryConsumerAPI<C>,
9028    _resource: String,
9029    _options_requested_policy_version: Option<i32>,
9030    _delegate: Option<&'a mut dyn common::Delegate>,
9031    _additional_params: HashMap<String, String>,
9032    _scopes: BTreeSet<String>,
9033}
9034
9035impl<'a, C> common::CallBuilder for ProjectLocationGlobalDomainGetIamPolicyCall<'a, C> {}
9036
9037impl<'a, C> ProjectLocationGlobalDomainGetIamPolicyCall<'a, C>
9038where
9039    C: common::Connector,
9040{
9041    /// Perform the operation you have build so far.
9042    pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
9043        use std::borrow::Cow;
9044        use std::io::{Read, Seek};
9045
9046        use common::{url::Params, ToParts};
9047        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
9048
9049        let mut dd = common::DefaultDelegate;
9050        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
9051        dlg.begin(common::MethodInfo {
9052            id: "managedidentities.projects.locations.global.domains.getIamPolicy",
9053            http_method: hyper::Method::GET,
9054        });
9055
9056        for &field in ["alt", "resource", "options.requestedPolicyVersion"].iter() {
9057            if self._additional_params.contains_key(field) {
9058                dlg.finished(false);
9059                return Err(common::Error::FieldClash(field));
9060            }
9061        }
9062
9063        let mut params = Params::with_capacity(4 + self._additional_params.len());
9064        params.push("resource", self._resource);
9065        if let Some(value) = self._options_requested_policy_version.as_ref() {
9066            params.push("options.requestedPolicyVersion", value.to_string());
9067        }
9068
9069        params.extend(self._additional_params.iter());
9070
9071        params.push("alt", "json");
9072        let mut url = self.hub._base_url.clone() + "v1/{+resource}:getIamPolicy";
9073        if self._scopes.is_empty() {
9074            self._scopes
9075                .insert(Scope::CloudPlatform.as_ref().to_string());
9076        }
9077
9078        #[allow(clippy::single_element_loop)]
9079        for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
9080            url = params.uri_replacement(url, param_name, find_this, true);
9081        }
9082        {
9083            let to_remove = ["resource"];
9084            params.remove_params(&to_remove);
9085        }
9086
9087        let url = params.parse_with_url(&url);
9088
9089        loop {
9090            let token = match self
9091                .hub
9092                .auth
9093                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
9094                .await
9095            {
9096                Ok(token) => token,
9097                Err(e) => match dlg.token(e) {
9098                    Ok(token) => token,
9099                    Err(e) => {
9100                        dlg.finished(false);
9101                        return Err(common::Error::MissingToken(e));
9102                    }
9103                },
9104            };
9105            let mut req_result = {
9106                let client = &self.hub.client;
9107                dlg.pre_request();
9108                let mut req_builder = hyper::Request::builder()
9109                    .method(hyper::Method::GET)
9110                    .uri(url.as_str())
9111                    .header(USER_AGENT, self.hub._user_agent.clone());
9112
9113                if let Some(token) = token.as_ref() {
9114                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
9115                }
9116
9117                let request = req_builder
9118                    .header(CONTENT_LENGTH, 0_u64)
9119                    .body(common::to_body::<String>(None));
9120
9121                client.request(request.unwrap()).await
9122            };
9123
9124            match req_result {
9125                Err(err) => {
9126                    if let common::Retry::After(d) = dlg.http_error(&err) {
9127                        sleep(d).await;
9128                        continue;
9129                    }
9130                    dlg.finished(false);
9131                    return Err(common::Error::HttpError(err));
9132                }
9133                Ok(res) => {
9134                    let (mut parts, body) = res.into_parts();
9135                    let mut body = common::Body::new(body);
9136                    if !parts.status.is_success() {
9137                        let bytes = common::to_bytes(body).await.unwrap_or_default();
9138                        let error = serde_json::from_str(&common::to_string(&bytes));
9139                        let response = common::to_response(parts, bytes.into());
9140
9141                        if let common::Retry::After(d) =
9142                            dlg.http_failure(&response, error.as_ref().ok())
9143                        {
9144                            sleep(d).await;
9145                            continue;
9146                        }
9147
9148                        dlg.finished(false);
9149
9150                        return Err(match error {
9151                            Ok(value) => common::Error::BadRequest(value),
9152                            _ => common::Error::Failure(response),
9153                        });
9154                    }
9155                    let response = {
9156                        let bytes = common::to_bytes(body).await.unwrap_or_default();
9157                        let encoded = common::to_string(&bytes);
9158                        match serde_json::from_str(&encoded) {
9159                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
9160                            Err(error) => {
9161                                dlg.response_json_decode_error(&encoded, &error);
9162                                return Err(common::Error::JsonDecodeError(
9163                                    encoded.to_string(),
9164                                    error,
9165                                ));
9166                            }
9167                        }
9168                    };
9169
9170                    dlg.finished(true);
9171                    return Ok(response);
9172                }
9173            }
9174        }
9175    }
9176
9177    /// REQUIRED: The resource for which the policy is being requested. See [Resource names](https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
9178    ///
9179    /// Sets the *resource* path property to the given value.
9180    ///
9181    /// Even though the property as already been set when instantiating this call,
9182    /// we provide this method for API completeness.
9183    pub fn resource(
9184        mut self,
9185        new_value: &str,
9186    ) -> ProjectLocationGlobalDomainGetIamPolicyCall<'a, C> {
9187        self._resource = new_value.to_string();
9188        self
9189    }
9190    /// Optional. The maximum policy version that will be used to format the policy. Valid values are 0, 1, and 3. Requests specifying an invalid value will be rejected. Requests for policies with any conditional role bindings must specify version 3. Policies with no conditional role bindings may specify any valid value or leave the field unset. The policy in the response might use the policy version that you specified, or it might use a lower policy version. For example, if you specify version 3, but the policy has no conditional role bindings, the response uses version 1. To learn which resources support conditions in their IAM policies, see the [IAM documentation](https://cloud.google.com/iam/help/conditions/resource-policies).
9191    ///
9192    /// Sets the *options.requested policy version* query property to the given value.
9193    pub fn options_requested_policy_version(
9194        mut self,
9195        new_value: i32,
9196    ) -> ProjectLocationGlobalDomainGetIamPolicyCall<'a, C> {
9197        self._options_requested_policy_version = Some(new_value);
9198        self
9199    }
9200    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
9201    /// while executing the actual API request.
9202    ///
9203    /// ````text
9204    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
9205    /// ````
9206    ///
9207    /// Sets the *delegate* property to the given value.
9208    pub fn delegate(
9209        mut self,
9210        new_value: &'a mut dyn common::Delegate,
9211    ) -> ProjectLocationGlobalDomainGetIamPolicyCall<'a, C> {
9212        self._delegate = Some(new_value);
9213        self
9214    }
9215
9216    /// Set any additional parameter of the query string used in the request.
9217    /// It should be used to set parameters which are not yet available through their own
9218    /// setters.
9219    ///
9220    /// Please note that this method must not be used to set any of the known parameters
9221    /// which have their own setter method. If done anyway, the request will fail.
9222    ///
9223    /// # Additional Parameters
9224    ///
9225    /// * *$.xgafv* (query-string) - V1 error format.
9226    /// * *access_token* (query-string) - OAuth access token.
9227    /// * *alt* (query-string) - Data format for response.
9228    /// * *callback* (query-string) - JSONP
9229    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
9230    /// * *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.
9231    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
9232    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
9233    /// * *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.
9234    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
9235    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
9236    pub fn param<T>(
9237        mut self,
9238        name: T,
9239        value: T,
9240    ) -> ProjectLocationGlobalDomainGetIamPolicyCall<'a, C>
9241    where
9242        T: AsRef<str>,
9243    {
9244        self._additional_params
9245            .insert(name.as_ref().to_string(), value.as_ref().to_string());
9246        self
9247    }
9248
9249    /// Identifies the authorization scope for the method you are building.
9250    ///
9251    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
9252    /// [`Scope::CloudPlatform`].
9253    ///
9254    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
9255    /// tokens for more than one scope.
9256    ///
9257    /// Usually there is more than one suitable scope to authorize an operation, some of which may
9258    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
9259    /// sufficient, a read-write scope will do as well.
9260    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationGlobalDomainGetIamPolicyCall<'a, C>
9261    where
9262        St: AsRef<str>,
9263    {
9264        self._scopes.insert(String::from(scope.as_ref()));
9265        self
9266    }
9267    /// Identifies the authorization scope(s) for the method you are building.
9268    ///
9269    /// See [`Self::add_scope()`] for details.
9270    pub fn add_scopes<I, St>(
9271        mut self,
9272        scopes: I,
9273    ) -> ProjectLocationGlobalDomainGetIamPolicyCall<'a, C>
9274    where
9275        I: IntoIterator<Item = St>,
9276        St: AsRef<str>,
9277    {
9278        self._scopes
9279            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
9280        self
9281    }
9282
9283    /// Removes all scopes, and no default scope will be used either.
9284    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
9285    /// for details).
9286    pub fn clear_scopes(mut self) -> ProjectLocationGlobalDomainGetIamPolicyCall<'a, C> {
9287        self._scopes.clear();
9288        self
9289    }
9290}
9291
9292/// Gets the domain ldaps settings.
9293///
9294/// A builder for the *locations.global.domains.getLdapssettings* method supported by a *project* resource.
9295/// It is not used directly, but through a [`ProjectMethods`] instance.
9296///
9297/// # Example
9298///
9299/// Instantiate a resource method builder
9300///
9301/// ```test_harness,no_run
9302/// # extern crate hyper;
9303/// # extern crate hyper_rustls;
9304/// # extern crate google_managedidentities1 as managedidentities1;
9305/// # async fn dox() {
9306/// # use managedidentities1::{ManagedServiceForMicrosoftActiveDirectoryConsumerAPI, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9307///
9308/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
9309/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
9310/// #     .with_native_roots()
9311/// #     .unwrap()
9312/// #     .https_only()
9313/// #     .enable_http2()
9314/// #     .build();
9315///
9316/// # let executor = hyper_util::rt::TokioExecutor::new();
9317/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
9318/// #     secret,
9319/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9320/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
9321/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
9322/// #     ),
9323/// # ).build().await.unwrap();
9324///
9325/// # let client = hyper_util::client::legacy::Client::builder(
9326/// #     hyper_util::rt::TokioExecutor::new()
9327/// # )
9328/// # .build(
9329/// #     hyper_rustls::HttpsConnectorBuilder::new()
9330/// #         .with_native_roots()
9331/// #         .unwrap()
9332/// #         .https_or_http()
9333/// #         .enable_http2()
9334/// #         .build()
9335/// # );
9336/// # let mut hub = ManagedServiceForMicrosoftActiveDirectoryConsumerAPI::new(client, auth);
9337/// // You can configure optional parameters by calling the respective setters at will, and
9338/// // execute the final call using `doit()`.
9339/// // Values shown here are possibly random and not representative !
9340/// let result = hub.projects().locations_global_domains_get_ldapssettings("name")
9341///              .doit().await;
9342/// # }
9343/// ```
9344pub struct ProjectLocationGlobalDomainGetLdapssettingCall<'a, C>
9345where
9346    C: 'a,
9347{
9348    hub: &'a ManagedServiceForMicrosoftActiveDirectoryConsumerAPI<C>,
9349    _name: String,
9350    _delegate: Option<&'a mut dyn common::Delegate>,
9351    _additional_params: HashMap<String, String>,
9352    _scopes: BTreeSet<String>,
9353}
9354
9355impl<'a, C> common::CallBuilder for ProjectLocationGlobalDomainGetLdapssettingCall<'a, C> {}
9356
9357impl<'a, C> ProjectLocationGlobalDomainGetLdapssettingCall<'a, C>
9358where
9359    C: common::Connector,
9360{
9361    /// Perform the operation you have build so far.
9362    pub async fn doit(mut self) -> common::Result<(common::Response, LDAPSSettings)> {
9363        use std::borrow::Cow;
9364        use std::io::{Read, Seek};
9365
9366        use common::{url::Params, ToParts};
9367        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
9368
9369        let mut dd = common::DefaultDelegate;
9370        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
9371        dlg.begin(common::MethodInfo {
9372            id: "managedidentities.projects.locations.global.domains.getLdapssettings",
9373            http_method: hyper::Method::GET,
9374        });
9375
9376        for &field in ["alt", "name"].iter() {
9377            if self._additional_params.contains_key(field) {
9378                dlg.finished(false);
9379                return Err(common::Error::FieldClash(field));
9380            }
9381        }
9382
9383        let mut params = Params::with_capacity(3 + self._additional_params.len());
9384        params.push("name", self._name);
9385
9386        params.extend(self._additional_params.iter());
9387
9388        params.push("alt", "json");
9389        let mut url = self.hub._base_url.clone() + "v1/{+name}/ldapssettings";
9390        if self._scopes.is_empty() {
9391            self._scopes
9392                .insert(Scope::CloudPlatform.as_ref().to_string());
9393        }
9394
9395        #[allow(clippy::single_element_loop)]
9396        for &(find_this, param_name) in [("{+name}", "name")].iter() {
9397            url = params.uri_replacement(url, param_name, find_this, true);
9398        }
9399        {
9400            let to_remove = ["name"];
9401            params.remove_params(&to_remove);
9402        }
9403
9404        let url = params.parse_with_url(&url);
9405
9406        loop {
9407            let token = match self
9408                .hub
9409                .auth
9410                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
9411                .await
9412            {
9413                Ok(token) => token,
9414                Err(e) => match dlg.token(e) {
9415                    Ok(token) => token,
9416                    Err(e) => {
9417                        dlg.finished(false);
9418                        return Err(common::Error::MissingToken(e));
9419                    }
9420                },
9421            };
9422            let mut req_result = {
9423                let client = &self.hub.client;
9424                dlg.pre_request();
9425                let mut req_builder = hyper::Request::builder()
9426                    .method(hyper::Method::GET)
9427                    .uri(url.as_str())
9428                    .header(USER_AGENT, self.hub._user_agent.clone());
9429
9430                if let Some(token) = token.as_ref() {
9431                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
9432                }
9433
9434                let request = req_builder
9435                    .header(CONTENT_LENGTH, 0_u64)
9436                    .body(common::to_body::<String>(None));
9437
9438                client.request(request.unwrap()).await
9439            };
9440
9441            match req_result {
9442                Err(err) => {
9443                    if let common::Retry::After(d) = dlg.http_error(&err) {
9444                        sleep(d).await;
9445                        continue;
9446                    }
9447                    dlg.finished(false);
9448                    return Err(common::Error::HttpError(err));
9449                }
9450                Ok(res) => {
9451                    let (mut parts, body) = res.into_parts();
9452                    let mut body = common::Body::new(body);
9453                    if !parts.status.is_success() {
9454                        let bytes = common::to_bytes(body).await.unwrap_or_default();
9455                        let error = serde_json::from_str(&common::to_string(&bytes));
9456                        let response = common::to_response(parts, bytes.into());
9457
9458                        if let common::Retry::After(d) =
9459                            dlg.http_failure(&response, error.as_ref().ok())
9460                        {
9461                            sleep(d).await;
9462                            continue;
9463                        }
9464
9465                        dlg.finished(false);
9466
9467                        return Err(match error {
9468                            Ok(value) => common::Error::BadRequest(value),
9469                            _ => common::Error::Failure(response),
9470                        });
9471                    }
9472                    let response = {
9473                        let bytes = common::to_bytes(body).await.unwrap_or_default();
9474                        let encoded = common::to_string(&bytes);
9475                        match serde_json::from_str(&encoded) {
9476                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
9477                            Err(error) => {
9478                                dlg.response_json_decode_error(&encoded, &error);
9479                                return Err(common::Error::JsonDecodeError(
9480                                    encoded.to_string(),
9481                                    error,
9482                                ));
9483                            }
9484                        }
9485                    };
9486
9487                    dlg.finished(true);
9488                    return Ok(response);
9489                }
9490            }
9491        }
9492    }
9493
9494    /// Required. The domain resource name using the form: `projects/{project_id}/locations/global/domains/{domain_name}`
9495    ///
9496    /// Sets the *name* path property to the given value.
9497    ///
9498    /// Even though the property as already been set when instantiating this call,
9499    /// we provide this method for API completeness.
9500    pub fn name(
9501        mut self,
9502        new_value: &str,
9503    ) -> ProjectLocationGlobalDomainGetLdapssettingCall<'a, C> {
9504        self._name = new_value.to_string();
9505        self
9506    }
9507    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
9508    /// while executing the actual API request.
9509    ///
9510    /// ````text
9511    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
9512    /// ````
9513    ///
9514    /// Sets the *delegate* property to the given value.
9515    pub fn delegate(
9516        mut self,
9517        new_value: &'a mut dyn common::Delegate,
9518    ) -> ProjectLocationGlobalDomainGetLdapssettingCall<'a, C> {
9519        self._delegate = Some(new_value);
9520        self
9521    }
9522
9523    /// Set any additional parameter of the query string used in the request.
9524    /// It should be used to set parameters which are not yet available through their own
9525    /// setters.
9526    ///
9527    /// Please note that this method must not be used to set any of the known parameters
9528    /// which have their own setter method. If done anyway, the request will fail.
9529    ///
9530    /// # Additional Parameters
9531    ///
9532    /// * *$.xgafv* (query-string) - V1 error format.
9533    /// * *access_token* (query-string) - OAuth access token.
9534    /// * *alt* (query-string) - Data format for response.
9535    /// * *callback* (query-string) - JSONP
9536    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
9537    /// * *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.
9538    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
9539    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
9540    /// * *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.
9541    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
9542    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
9543    pub fn param<T>(
9544        mut self,
9545        name: T,
9546        value: T,
9547    ) -> ProjectLocationGlobalDomainGetLdapssettingCall<'a, C>
9548    where
9549        T: AsRef<str>,
9550    {
9551        self._additional_params
9552            .insert(name.as_ref().to_string(), value.as_ref().to_string());
9553        self
9554    }
9555
9556    /// Identifies the authorization scope for the method you are building.
9557    ///
9558    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
9559    /// [`Scope::CloudPlatform`].
9560    ///
9561    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
9562    /// tokens for more than one scope.
9563    ///
9564    /// Usually there is more than one suitable scope to authorize an operation, some of which may
9565    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
9566    /// sufficient, a read-write scope will do as well.
9567    pub fn add_scope<St>(
9568        mut self,
9569        scope: St,
9570    ) -> ProjectLocationGlobalDomainGetLdapssettingCall<'a, C>
9571    where
9572        St: AsRef<str>,
9573    {
9574        self._scopes.insert(String::from(scope.as_ref()));
9575        self
9576    }
9577    /// Identifies the authorization scope(s) for the method you are building.
9578    ///
9579    /// See [`Self::add_scope()`] for details.
9580    pub fn add_scopes<I, St>(
9581        mut self,
9582        scopes: I,
9583    ) -> ProjectLocationGlobalDomainGetLdapssettingCall<'a, C>
9584    where
9585        I: IntoIterator<Item = St>,
9586        St: AsRef<str>,
9587    {
9588        self._scopes
9589            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
9590        self
9591    }
9592
9593    /// Removes all scopes, and no default scope will be used either.
9594    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
9595    /// for details).
9596    pub fn clear_scopes(mut self) -> ProjectLocationGlobalDomainGetLdapssettingCall<'a, C> {
9597        self._scopes.clear();
9598        self
9599    }
9600}
9601
9602/// Lists domains in a project.
9603///
9604/// A builder for the *locations.global.domains.list* method supported by a *project* resource.
9605/// It is not used directly, but through a [`ProjectMethods`] instance.
9606///
9607/// # Example
9608///
9609/// Instantiate a resource method builder
9610///
9611/// ```test_harness,no_run
9612/// # extern crate hyper;
9613/// # extern crate hyper_rustls;
9614/// # extern crate google_managedidentities1 as managedidentities1;
9615/// # async fn dox() {
9616/// # use managedidentities1::{ManagedServiceForMicrosoftActiveDirectoryConsumerAPI, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9617///
9618/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
9619/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
9620/// #     .with_native_roots()
9621/// #     .unwrap()
9622/// #     .https_only()
9623/// #     .enable_http2()
9624/// #     .build();
9625///
9626/// # let executor = hyper_util::rt::TokioExecutor::new();
9627/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
9628/// #     secret,
9629/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9630/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
9631/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
9632/// #     ),
9633/// # ).build().await.unwrap();
9634///
9635/// # let client = hyper_util::client::legacy::Client::builder(
9636/// #     hyper_util::rt::TokioExecutor::new()
9637/// # )
9638/// # .build(
9639/// #     hyper_rustls::HttpsConnectorBuilder::new()
9640/// #         .with_native_roots()
9641/// #         .unwrap()
9642/// #         .https_or_http()
9643/// #         .enable_http2()
9644/// #         .build()
9645/// # );
9646/// # let mut hub = ManagedServiceForMicrosoftActiveDirectoryConsumerAPI::new(client, auth);
9647/// // You can configure optional parameters by calling the respective setters at will, and
9648/// // execute the final call using `doit()`.
9649/// // Values shown here are possibly random and not representative !
9650/// let result = hub.projects().locations_global_domains_list("parent")
9651///              .page_token("no")
9652///              .page_size(-15)
9653///              .order_by("kasd")
9654///              .filter("et")
9655///              .doit().await;
9656/// # }
9657/// ```
9658pub struct ProjectLocationGlobalDomainListCall<'a, C>
9659where
9660    C: 'a,
9661{
9662    hub: &'a ManagedServiceForMicrosoftActiveDirectoryConsumerAPI<C>,
9663    _parent: String,
9664    _page_token: Option<String>,
9665    _page_size: Option<i32>,
9666    _order_by: Option<String>,
9667    _filter: Option<String>,
9668    _delegate: Option<&'a mut dyn common::Delegate>,
9669    _additional_params: HashMap<String, String>,
9670    _scopes: BTreeSet<String>,
9671}
9672
9673impl<'a, C> common::CallBuilder for ProjectLocationGlobalDomainListCall<'a, C> {}
9674
9675impl<'a, C> ProjectLocationGlobalDomainListCall<'a, C>
9676where
9677    C: common::Connector,
9678{
9679    /// Perform the operation you have build so far.
9680    pub async fn doit(mut self) -> common::Result<(common::Response, ListDomainsResponse)> {
9681        use std::borrow::Cow;
9682        use std::io::{Read, Seek};
9683
9684        use common::{url::Params, ToParts};
9685        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
9686
9687        let mut dd = common::DefaultDelegate;
9688        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
9689        dlg.begin(common::MethodInfo {
9690            id: "managedidentities.projects.locations.global.domains.list",
9691            http_method: hyper::Method::GET,
9692        });
9693
9694        for &field in [
9695            "alt",
9696            "parent",
9697            "pageToken",
9698            "pageSize",
9699            "orderBy",
9700            "filter",
9701        ]
9702        .iter()
9703        {
9704            if self._additional_params.contains_key(field) {
9705                dlg.finished(false);
9706                return Err(common::Error::FieldClash(field));
9707            }
9708        }
9709
9710        let mut params = Params::with_capacity(7 + self._additional_params.len());
9711        params.push("parent", self._parent);
9712        if let Some(value) = self._page_token.as_ref() {
9713            params.push("pageToken", value);
9714        }
9715        if let Some(value) = self._page_size.as_ref() {
9716            params.push("pageSize", value.to_string());
9717        }
9718        if let Some(value) = self._order_by.as_ref() {
9719            params.push("orderBy", value);
9720        }
9721        if let Some(value) = self._filter.as_ref() {
9722            params.push("filter", value);
9723        }
9724
9725        params.extend(self._additional_params.iter());
9726
9727        params.push("alt", "json");
9728        let mut url = self.hub._base_url.clone() + "v1/{+parent}/domains";
9729        if self._scopes.is_empty() {
9730            self._scopes
9731                .insert(Scope::CloudPlatform.as_ref().to_string());
9732        }
9733
9734        #[allow(clippy::single_element_loop)]
9735        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
9736            url = params.uri_replacement(url, param_name, find_this, true);
9737        }
9738        {
9739            let to_remove = ["parent"];
9740            params.remove_params(&to_remove);
9741        }
9742
9743        let url = params.parse_with_url(&url);
9744
9745        loop {
9746            let token = match self
9747                .hub
9748                .auth
9749                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
9750                .await
9751            {
9752                Ok(token) => token,
9753                Err(e) => match dlg.token(e) {
9754                    Ok(token) => token,
9755                    Err(e) => {
9756                        dlg.finished(false);
9757                        return Err(common::Error::MissingToken(e));
9758                    }
9759                },
9760            };
9761            let mut req_result = {
9762                let client = &self.hub.client;
9763                dlg.pre_request();
9764                let mut req_builder = hyper::Request::builder()
9765                    .method(hyper::Method::GET)
9766                    .uri(url.as_str())
9767                    .header(USER_AGENT, self.hub._user_agent.clone());
9768
9769                if let Some(token) = token.as_ref() {
9770                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
9771                }
9772
9773                let request = req_builder
9774                    .header(CONTENT_LENGTH, 0_u64)
9775                    .body(common::to_body::<String>(None));
9776
9777                client.request(request.unwrap()).await
9778            };
9779
9780            match req_result {
9781                Err(err) => {
9782                    if let common::Retry::After(d) = dlg.http_error(&err) {
9783                        sleep(d).await;
9784                        continue;
9785                    }
9786                    dlg.finished(false);
9787                    return Err(common::Error::HttpError(err));
9788                }
9789                Ok(res) => {
9790                    let (mut parts, body) = res.into_parts();
9791                    let mut body = common::Body::new(body);
9792                    if !parts.status.is_success() {
9793                        let bytes = common::to_bytes(body).await.unwrap_or_default();
9794                        let error = serde_json::from_str(&common::to_string(&bytes));
9795                        let response = common::to_response(parts, bytes.into());
9796
9797                        if let common::Retry::After(d) =
9798                            dlg.http_failure(&response, error.as_ref().ok())
9799                        {
9800                            sleep(d).await;
9801                            continue;
9802                        }
9803
9804                        dlg.finished(false);
9805
9806                        return Err(match error {
9807                            Ok(value) => common::Error::BadRequest(value),
9808                            _ => common::Error::Failure(response),
9809                        });
9810                    }
9811                    let response = {
9812                        let bytes = common::to_bytes(body).await.unwrap_or_default();
9813                        let encoded = common::to_string(&bytes);
9814                        match serde_json::from_str(&encoded) {
9815                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
9816                            Err(error) => {
9817                                dlg.response_json_decode_error(&encoded, &error);
9818                                return Err(common::Error::JsonDecodeError(
9819                                    encoded.to_string(),
9820                                    error,
9821                                ));
9822                            }
9823                        }
9824                    };
9825
9826                    dlg.finished(true);
9827                    return Ok(response);
9828                }
9829            }
9830        }
9831    }
9832
9833    /// Required. The resource name of the domain location using the form: `projects/{project_id}/locations/global`
9834    ///
9835    /// Sets the *parent* path property to the given value.
9836    ///
9837    /// Even though the property as already been set when instantiating this call,
9838    /// we provide this method for API completeness.
9839    pub fn parent(mut self, new_value: &str) -> ProjectLocationGlobalDomainListCall<'a, C> {
9840        self._parent = new_value.to_string();
9841        self
9842    }
9843    /// Optional. The `next_page_token` value returned from a previous ListDomainsRequest request, if any.
9844    ///
9845    /// Sets the *page token* query property to the given value.
9846    pub fn page_token(mut self, new_value: &str) -> ProjectLocationGlobalDomainListCall<'a, C> {
9847        self._page_token = Some(new_value.to_string());
9848        self
9849    }
9850    /// Optional. The maximum number of items to return. If not specified, a default value of 1000 will be used. Regardless of the page_size value, the response may include a partial list. Callers should rely on a response's next_page_token to determine if there are additional results to list.
9851    ///
9852    /// Sets the *page size* query property to the given value.
9853    pub fn page_size(mut self, new_value: i32) -> ProjectLocationGlobalDomainListCall<'a, C> {
9854        self._page_size = Some(new_value);
9855        self
9856    }
9857    /// Optional. Specifies the ordering of results. See [Sorting order](https://cloud.google.com/apis/design/design_patterns#sorting_order) for more information.
9858    ///
9859    /// Sets the *order by* query property to the given value.
9860    pub fn order_by(mut self, new_value: &str) -> ProjectLocationGlobalDomainListCall<'a, C> {
9861        self._order_by = Some(new_value.to_string());
9862        self
9863    }
9864    /// Optional. A filter specifying constraints of a list operation. For example, `Domain.fqdn="mydomain.myorginization"`.
9865    ///
9866    /// Sets the *filter* query property to the given value.
9867    pub fn filter(mut self, new_value: &str) -> ProjectLocationGlobalDomainListCall<'a, C> {
9868        self._filter = Some(new_value.to_string());
9869        self
9870    }
9871    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
9872    /// while executing the actual API request.
9873    ///
9874    /// ````text
9875    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
9876    /// ````
9877    ///
9878    /// Sets the *delegate* property to the given value.
9879    pub fn delegate(
9880        mut self,
9881        new_value: &'a mut dyn common::Delegate,
9882    ) -> ProjectLocationGlobalDomainListCall<'a, C> {
9883        self._delegate = Some(new_value);
9884        self
9885    }
9886
9887    /// Set any additional parameter of the query string used in the request.
9888    /// It should be used to set parameters which are not yet available through their own
9889    /// setters.
9890    ///
9891    /// Please note that this method must not be used to set any of the known parameters
9892    /// which have their own setter method. If done anyway, the request will fail.
9893    ///
9894    /// # Additional Parameters
9895    ///
9896    /// * *$.xgafv* (query-string) - V1 error format.
9897    /// * *access_token* (query-string) - OAuth access token.
9898    /// * *alt* (query-string) - Data format for response.
9899    /// * *callback* (query-string) - JSONP
9900    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
9901    /// * *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.
9902    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
9903    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
9904    /// * *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.
9905    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
9906    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
9907    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationGlobalDomainListCall<'a, C>
9908    where
9909        T: AsRef<str>,
9910    {
9911        self._additional_params
9912            .insert(name.as_ref().to_string(), value.as_ref().to_string());
9913        self
9914    }
9915
9916    /// Identifies the authorization scope for the method you are building.
9917    ///
9918    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
9919    /// [`Scope::CloudPlatform`].
9920    ///
9921    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
9922    /// tokens for more than one scope.
9923    ///
9924    /// Usually there is more than one suitable scope to authorize an operation, some of which may
9925    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
9926    /// sufficient, a read-write scope will do as well.
9927    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationGlobalDomainListCall<'a, C>
9928    where
9929        St: AsRef<str>,
9930    {
9931        self._scopes.insert(String::from(scope.as_ref()));
9932        self
9933    }
9934    /// Identifies the authorization scope(s) for the method you are building.
9935    ///
9936    /// See [`Self::add_scope()`] for details.
9937    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationGlobalDomainListCall<'a, C>
9938    where
9939        I: IntoIterator<Item = St>,
9940        St: AsRef<str>,
9941    {
9942        self._scopes
9943            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
9944        self
9945    }
9946
9947    /// Removes all scopes, and no default scope will be used either.
9948    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
9949    /// for details).
9950    pub fn clear_scopes(mut self) -> ProjectLocationGlobalDomainListCall<'a, C> {
9951        self._scopes.clear();
9952        self
9953    }
9954}
9955
9956/// Updates the metadata and configuration of a domain.
9957///
9958/// A builder for the *locations.global.domains.patch* method supported by a *project* resource.
9959/// It is not used directly, but through a [`ProjectMethods`] instance.
9960///
9961/// # Example
9962///
9963/// Instantiate a resource method builder
9964///
9965/// ```test_harness,no_run
9966/// # extern crate hyper;
9967/// # extern crate hyper_rustls;
9968/// # extern crate google_managedidentities1 as managedidentities1;
9969/// use managedidentities1::api::Domain;
9970/// # async fn dox() {
9971/// # use managedidentities1::{ManagedServiceForMicrosoftActiveDirectoryConsumerAPI, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9972///
9973/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
9974/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
9975/// #     .with_native_roots()
9976/// #     .unwrap()
9977/// #     .https_only()
9978/// #     .enable_http2()
9979/// #     .build();
9980///
9981/// # let executor = hyper_util::rt::TokioExecutor::new();
9982/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
9983/// #     secret,
9984/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9985/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
9986/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
9987/// #     ),
9988/// # ).build().await.unwrap();
9989///
9990/// # let client = hyper_util::client::legacy::Client::builder(
9991/// #     hyper_util::rt::TokioExecutor::new()
9992/// # )
9993/// # .build(
9994/// #     hyper_rustls::HttpsConnectorBuilder::new()
9995/// #         .with_native_roots()
9996/// #         .unwrap()
9997/// #         .https_or_http()
9998/// #         .enable_http2()
9999/// #         .build()
10000/// # );
10001/// # let mut hub = ManagedServiceForMicrosoftActiveDirectoryConsumerAPI::new(client, auth);
10002/// // As the method needs a request, you would usually fill it with the desired information
10003/// // into the respective structure. Some of the parts shown here might not be applicable !
10004/// // Values shown here are possibly random and not representative !
10005/// let mut req = Domain::default();
10006///
10007/// // You can configure optional parameters by calling the respective setters at will, and
10008/// // execute the final call using `doit()`.
10009/// // Values shown here are possibly random and not representative !
10010/// let result = hub.projects().locations_global_domains_patch(req, "name")
10011///              .update_mask(FieldMask::new::<&str>(&[]))
10012///              .doit().await;
10013/// # }
10014/// ```
10015pub struct ProjectLocationGlobalDomainPatchCall<'a, C>
10016where
10017    C: 'a,
10018{
10019    hub: &'a ManagedServiceForMicrosoftActiveDirectoryConsumerAPI<C>,
10020    _request: Domain,
10021    _name: String,
10022    _update_mask: Option<common::FieldMask>,
10023    _delegate: Option<&'a mut dyn common::Delegate>,
10024    _additional_params: HashMap<String, String>,
10025    _scopes: BTreeSet<String>,
10026}
10027
10028impl<'a, C> common::CallBuilder for ProjectLocationGlobalDomainPatchCall<'a, C> {}
10029
10030impl<'a, C> ProjectLocationGlobalDomainPatchCall<'a, C>
10031where
10032    C: common::Connector,
10033{
10034    /// Perform the operation you have build so far.
10035    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
10036        use std::borrow::Cow;
10037        use std::io::{Read, Seek};
10038
10039        use common::{url::Params, ToParts};
10040        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
10041
10042        let mut dd = common::DefaultDelegate;
10043        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
10044        dlg.begin(common::MethodInfo {
10045            id: "managedidentities.projects.locations.global.domains.patch",
10046            http_method: hyper::Method::PATCH,
10047        });
10048
10049        for &field in ["alt", "name", "updateMask"].iter() {
10050            if self._additional_params.contains_key(field) {
10051                dlg.finished(false);
10052                return Err(common::Error::FieldClash(field));
10053            }
10054        }
10055
10056        let mut params = Params::with_capacity(5 + self._additional_params.len());
10057        params.push("name", self._name);
10058        if let Some(value) = self._update_mask.as_ref() {
10059            params.push("updateMask", value.to_string());
10060        }
10061
10062        params.extend(self._additional_params.iter());
10063
10064        params.push("alt", "json");
10065        let mut url = self.hub._base_url.clone() + "v1/{+name}";
10066        if self._scopes.is_empty() {
10067            self._scopes
10068                .insert(Scope::CloudPlatform.as_ref().to_string());
10069        }
10070
10071        #[allow(clippy::single_element_loop)]
10072        for &(find_this, param_name) in [("{+name}", "name")].iter() {
10073            url = params.uri_replacement(url, param_name, find_this, true);
10074        }
10075        {
10076            let to_remove = ["name"];
10077            params.remove_params(&to_remove);
10078        }
10079
10080        let url = params.parse_with_url(&url);
10081
10082        let mut json_mime_type = mime::APPLICATION_JSON;
10083        let mut request_value_reader = {
10084            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
10085            common::remove_json_null_values(&mut value);
10086            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
10087            serde_json::to_writer(&mut dst, &value).unwrap();
10088            dst
10089        };
10090        let request_size = request_value_reader
10091            .seek(std::io::SeekFrom::End(0))
10092            .unwrap();
10093        request_value_reader
10094            .seek(std::io::SeekFrom::Start(0))
10095            .unwrap();
10096
10097        loop {
10098            let token = match self
10099                .hub
10100                .auth
10101                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
10102                .await
10103            {
10104                Ok(token) => token,
10105                Err(e) => match dlg.token(e) {
10106                    Ok(token) => token,
10107                    Err(e) => {
10108                        dlg.finished(false);
10109                        return Err(common::Error::MissingToken(e));
10110                    }
10111                },
10112            };
10113            request_value_reader
10114                .seek(std::io::SeekFrom::Start(0))
10115                .unwrap();
10116            let mut req_result = {
10117                let client = &self.hub.client;
10118                dlg.pre_request();
10119                let mut req_builder = hyper::Request::builder()
10120                    .method(hyper::Method::PATCH)
10121                    .uri(url.as_str())
10122                    .header(USER_AGENT, self.hub._user_agent.clone());
10123
10124                if let Some(token) = token.as_ref() {
10125                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
10126                }
10127
10128                let request = req_builder
10129                    .header(CONTENT_TYPE, json_mime_type.to_string())
10130                    .header(CONTENT_LENGTH, request_size as u64)
10131                    .body(common::to_body(
10132                        request_value_reader.get_ref().clone().into(),
10133                    ));
10134
10135                client.request(request.unwrap()).await
10136            };
10137
10138            match req_result {
10139                Err(err) => {
10140                    if let common::Retry::After(d) = dlg.http_error(&err) {
10141                        sleep(d).await;
10142                        continue;
10143                    }
10144                    dlg.finished(false);
10145                    return Err(common::Error::HttpError(err));
10146                }
10147                Ok(res) => {
10148                    let (mut parts, body) = res.into_parts();
10149                    let mut body = common::Body::new(body);
10150                    if !parts.status.is_success() {
10151                        let bytes = common::to_bytes(body).await.unwrap_or_default();
10152                        let error = serde_json::from_str(&common::to_string(&bytes));
10153                        let response = common::to_response(parts, bytes.into());
10154
10155                        if let common::Retry::After(d) =
10156                            dlg.http_failure(&response, error.as_ref().ok())
10157                        {
10158                            sleep(d).await;
10159                            continue;
10160                        }
10161
10162                        dlg.finished(false);
10163
10164                        return Err(match error {
10165                            Ok(value) => common::Error::BadRequest(value),
10166                            _ => common::Error::Failure(response),
10167                        });
10168                    }
10169                    let response = {
10170                        let bytes = common::to_bytes(body).await.unwrap_or_default();
10171                        let encoded = common::to_string(&bytes);
10172                        match serde_json::from_str(&encoded) {
10173                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
10174                            Err(error) => {
10175                                dlg.response_json_decode_error(&encoded, &error);
10176                                return Err(common::Error::JsonDecodeError(
10177                                    encoded.to_string(),
10178                                    error,
10179                                ));
10180                            }
10181                        }
10182                    };
10183
10184                    dlg.finished(true);
10185                    return Ok(response);
10186                }
10187            }
10188        }
10189    }
10190
10191    ///
10192    /// Sets the *request* property to the given value.
10193    ///
10194    /// Even though the property as already been set when instantiating this call,
10195    /// we provide this method for API completeness.
10196    pub fn request(mut self, new_value: Domain) -> ProjectLocationGlobalDomainPatchCall<'a, C> {
10197        self._request = new_value;
10198        self
10199    }
10200    /// Required. The unique name of the domain using the form: `projects/{project_id}/locations/global/domains/{domain_name}`.
10201    ///
10202    /// Sets the *name* path property to the given value.
10203    ///
10204    /// Even though the property as already been set when instantiating this call,
10205    /// we provide this method for API completeness.
10206    pub fn name(mut self, new_value: &str) -> ProjectLocationGlobalDomainPatchCall<'a, C> {
10207        self._name = new_value.to_string();
10208        self
10209    }
10210    /// 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 fields from Domain: * `labels` * `locations` * `authorized_networks` * `audit_logs_enabled`
10211    ///
10212    /// Sets the *update mask* query property to the given value.
10213    pub fn update_mask(
10214        mut self,
10215        new_value: common::FieldMask,
10216    ) -> ProjectLocationGlobalDomainPatchCall<'a, C> {
10217        self._update_mask = Some(new_value);
10218        self
10219    }
10220    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
10221    /// while executing the actual API request.
10222    ///
10223    /// ````text
10224    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
10225    /// ````
10226    ///
10227    /// Sets the *delegate* property to the given value.
10228    pub fn delegate(
10229        mut self,
10230        new_value: &'a mut dyn common::Delegate,
10231    ) -> ProjectLocationGlobalDomainPatchCall<'a, C> {
10232        self._delegate = Some(new_value);
10233        self
10234    }
10235
10236    /// Set any additional parameter of the query string used in the request.
10237    /// It should be used to set parameters which are not yet available through their own
10238    /// setters.
10239    ///
10240    /// Please note that this method must not be used to set any of the known parameters
10241    /// which have their own setter method. If done anyway, the request will fail.
10242    ///
10243    /// # Additional Parameters
10244    ///
10245    /// * *$.xgafv* (query-string) - V1 error format.
10246    /// * *access_token* (query-string) - OAuth access token.
10247    /// * *alt* (query-string) - Data format for response.
10248    /// * *callback* (query-string) - JSONP
10249    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
10250    /// * *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.
10251    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
10252    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
10253    /// * *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.
10254    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
10255    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
10256    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationGlobalDomainPatchCall<'a, C>
10257    where
10258        T: AsRef<str>,
10259    {
10260        self._additional_params
10261            .insert(name.as_ref().to_string(), value.as_ref().to_string());
10262        self
10263    }
10264
10265    /// Identifies the authorization scope for the method you are building.
10266    ///
10267    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
10268    /// [`Scope::CloudPlatform`].
10269    ///
10270    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
10271    /// tokens for more than one scope.
10272    ///
10273    /// Usually there is more than one suitable scope to authorize an operation, some of which may
10274    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
10275    /// sufficient, a read-write scope will do as well.
10276    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationGlobalDomainPatchCall<'a, C>
10277    where
10278        St: AsRef<str>,
10279    {
10280        self._scopes.insert(String::from(scope.as_ref()));
10281        self
10282    }
10283    /// Identifies the authorization scope(s) for the method you are building.
10284    ///
10285    /// See [`Self::add_scope()`] for details.
10286    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationGlobalDomainPatchCall<'a, C>
10287    where
10288        I: IntoIterator<Item = St>,
10289        St: AsRef<str>,
10290    {
10291        self._scopes
10292            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
10293        self
10294    }
10295
10296    /// Removes all scopes, and no default scope will be used either.
10297    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
10298    /// for details).
10299    pub fn clear_scopes(mut self) -> ProjectLocationGlobalDomainPatchCall<'a, C> {
10300        self._scopes.clear();
10301        self
10302    }
10303}
10304
10305/// Updates the DNS conditional forwarder.
10306///
10307/// A builder for the *locations.global.domains.reconfigureTrust* method supported by a *project* resource.
10308/// It is not used directly, but through a [`ProjectMethods`] instance.
10309///
10310/// # Example
10311///
10312/// Instantiate a resource method builder
10313///
10314/// ```test_harness,no_run
10315/// # extern crate hyper;
10316/// # extern crate hyper_rustls;
10317/// # extern crate google_managedidentities1 as managedidentities1;
10318/// use managedidentities1::api::ReconfigureTrustRequest;
10319/// # async fn dox() {
10320/// # use managedidentities1::{ManagedServiceForMicrosoftActiveDirectoryConsumerAPI, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
10321///
10322/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
10323/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
10324/// #     .with_native_roots()
10325/// #     .unwrap()
10326/// #     .https_only()
10327/// #     .enable_http2()
10328/// #     .build();
10329///
10330/// # let executor = hyper_util::rt::TokioExecutor::new();
10331/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
10332/// #     secret,
10333/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
10334/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
10335/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
10336/// #     ),
10337/// # ).build().await.unwrap();
10338///
10339/// # let client = hyper_util::client::legacy::Client::builder(
10340/// #     hyper_util::rt::TokioExecutor::new()
10341/// # )
10342/// # .build(
10343/// #     hyper_rustls::HttpsConnectorBuilder::new()
10344/// #         .with_native_roots()
10345/// #         .unwrap()
10346/// #         .https_or_http()
10347/// #         .enable_http2()
10348/// #         .build()
10349/// # );
10350/// # let mut hub = ManagedServiceForMicrosoftActiveDirectoryConsumerAPI::new(client, auth);
10351/// // As the method needs a request, you would usually fill it with the desired information
10352/// // into the respective structure. Some of the parts shown here might not be applicable !
10353/// // Values shown here are possibly random and not representative !
10354/// let mut req = ReconfigureTrustRequest::default();
10355///
10356/// // You can configure optional parameters by calling the respective setters at will, and
10357/// // execute the final call using `doit()`.
10358/// // Values shown here are possibly random and not representative !
10359/// let result = hub.projects().locations_global_domains_reconfigure_trust(req, "name")
10360///              .doit().await;
10361/// # }
10362/// ```
10363pub struct ProjectLocationGlobalDomainReconfigureTrustCall<'a, C>
10364where
10365    C: 'a,
10366{
10367    hub: &'a ManagedServiceForMicrosoftActiveDirectoryConsumerAPI<C>,
10368    _request: ReconfigureTrustRequest,
10369    _name: String,
10370    _delegate: Option<&'a mut dyn common::Delegate>,
10371    _additional_params: HashMap<String, String>,
10372    _scopes: BTreeSet<String>,
10373}
10374
10375impl<'a, C> common::CallBuilder for ProjectLocationGlobalDomainReconfigureTrustCall<'a, C> {}
10376
10377impl<'a, C> ProjectLocationGlobalDomainReconfigureTrustCall<'a, C>
10378where
10379    C: common::Connector,
10380{
10381    /// Perform the operation you have build so far.
10382    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
10383        use std::borrow::Cow;
10384        use std::io::{Read, Seek};
10385
10386        use common::{url::Params, ToParts};
10387        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
10388
10389        let mut dd = common::DefaultDelegate;
10390        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
10391        dlg.begin(common::MethodInfo {
10392            id: "managedidentities.projects.locations.global.domains.reconfigureTrust",
10393            http_method: hyper::Method::POST,
10394        });
10395
10396        for &field in ["alt", "name"].iter() {
10397            if self._additional_params.contains_key(field) {
10398                dlg.finished(false);
10399                return Err(common::Error::FieldClash(field));
10400            }
10401        }
10402
10403        let mut params = Params::with_capacity(4 + self._additional_params.len());
10404        params.push("name", self._name);
10405
10406        params.extend(self._additional_params.iter());
10407
10408        params.push("alt", "json");
10409        let mut url = self.hub._base_url.clone() + "v1/{+name}:reconfigureTrust";
10410        if self._scopes.is_empty() {
10411            self._scopes
10412                .insert(Scope::CloudPlatform.as_ref().to_string());
10413        }
10414
10415        #[allow(clippy::single_element_loop)]
10416        for &(find_this, param_name) in [("{+name}", "name")].iter() {
10417            url = params.uri_replacement(url, param_name, find_this, true);
10418        }
10419        {
10420            let to_remove = ["name"];
10421            params.remove_params(&to_remove);
10422        }
10423
10424        let url = params.parse_with_url(&url);
10425
10426        let mut json_mime_type = mime::APPLICATION_JSON;
10427        let mut request_value_reader = {
10428            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
10429            common::remove_json_null_values(&mut value);
10430            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
10431            serde_json::to_writer(&mut dst, &value).unwrap();
10432            dst
10433        };
10434        let request_size = request_value_reader
10435            .seek(std::io::SeekFrom::End(0))
10436            .unwrap();
10437        request_value_reader
10438            .seek(std::io::SeekFrom::Start(0))
10439            .unwrap();
10440
10441        loop {
10442            let token = match self
10443                .hub
10444                .auth
10445                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
10446                .await
10447            {
10448                Ok(token) => token,
10449                Err(e) => match dlg.token(e) {
10450                    Ok(token) => token,
10451                    Err(e) => {
10452                        dlg.finished(false);
10453                        return Err(common::Error::MissingToken(e));
10454                    }
10455                },
10456            };
10457            request_value_reader
10458                .seek(std::io::SeekFrom::Start(0))
10459                .unwrap();
10460            let mut req_result = {
10461                let client = &self.hub.client;
10462                dlg.pre_request();
10463                let mut req_builder = hyper::Request::builder()
10464                    .method(hyper::Method::POST)
10465                    .uri(url.as_str())
10466                    .header(USER_AGENT, self.hub._user_agent.clone());
10467
10468                if let Some(token) = token.as_ref() {
10469                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
10470                }
10471
10472                let request = req_builder
10473                    .header(CONTENT_TYPE, json_mime_type.to_string())
10474                    .header(CONTENT_LENGTH, request_size as u64)
10475                    .body(common::to_body(
10476                        request_value_reader.get_ref().clone().into(),
10477                    ));
10478
10479                client.request(request.unwrap()).await
10480            };
10481
10482            match req_result {
10483                Err(err) => {
10484                    if let common::Retry::After(d) = dlg.http_error(&err) {
10485                        sleep(d).await;
10486                        continue;
10487                    }
10488                    dlg.finished(false);
10489                    return Err(common::Error::HttpError(err));
10490                }
10491                Ok(res) => {
10492                    let (mut parts, body) = res.into_parts();
10493                    let mut body = common::Body::new(body);
10494                    if !parts.status.is_success() {
10495                        let bytes = common::to_bytes(body).await.unwrap_or_default();
10496                        let error = serde_json::from_str(&common::to_string(&bytes));
10497                        let response = common::to_response(parts, bytes.into());
10498
10499                        if let common::Retry::After(d) =
10500                            dlg.http_failure(&response, error.as_ref().ok())
10501                        {
10502                            sleep(d).await;
10503                            continue;
10504                        }
10505
10506                        dlg.finished(false);
10507
10508                        return Err(match error {
10509                            Ok(value) => common::Error::BadRequest(value),
10510                            _ => common::Error::Failure(response),
10511                        });
10512                    }
10513                    let response = {
10514                        let bytes = common::to_bytes(body).await.unwrap_or_default();
10515                        let encoded = common::to_string(&bytes);
10516                        match serde_json::from_str(&encoded) {
10517                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
10518                            Err(error) => {
10519                                dlg.response_json_decode_error(&encoded, &error);
10520                                return Err(common::Error::JsonDecodeError(
10521                                    encoded.to_string(),
10522                                    error,
10523                                ));
10524                            }
10525                        }
10526                    };
10527
10528                    dlg.finished(true);
10529                    return Ok(response);
10530                }
10531            }
10532        }
10533    }
10534
10535    ///
10536    /// Sets the *request* property to the given value.
10537    ///
10538    /// Even though the property as already been set when instantiating this call,
10539    /// we provide this method for API completeness.
10540    pub fn request(
10541        mut self,
10542        new_value: ReconfigureTrustRequest,
10543    ) -> ProjectLocationGlobalDomainReconfigureTrustCall<'a, C> {
10544        self._request = new_value;
10545        self
10546    }
10547    /// Required. The resource domain name, project name and location using the form: `projects/{project_id}/locations/global/domains/{domain_name}`
10548    ///
10549    /// Sets the *name* path property to the given value.
10550    ///
10551    /// Even though the property as already been set when instantiating this call,
10552    /// we provide this method for API completeness.
10553    pub fn name(
10554        mut self,
10555        new_value: &str,
10556    ) -> ProjectLocationGlobalDomainReconfigureTrustCall<'a, C> {
10557        self._name = new_value.to_string();
10558        self
10559    }
10560    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
10561    /// while executing the actual API request.
10562    ///
10563    /// ````text
10564    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
10565    /// ````
10566    ///
10567    /// Sets the *delegate* property to the given value.
10568    pub fn delegate(
10569        mut self,
10570        new_value: &'a mut dyn common::Delegate,
10571    ) -> ProjectLocationGlobalDomainReconfigureTrustCall<'a, C> {
10572        self._delegate = Some(new_value);
10573        self
10574    }
10575
10576    /// Set any additional parameter of the query string used in the request.
10577    /// It should be used to set parameters which are not yet available through their own
10578    /// setters.
10579    ///
10580    /// Please note that this method must not be used to set any of the known parameters
10581    /// which have their own setter method. If done anyway, the request will fail.
10582    ///
10583    /// # Additional Parameters
10584    ///
10585    /// * *$.xgafv* (query-string) - V1 error format.
10586    /// * *access_token* (query-string) - OAuth access token.
10587    /// * *alt* (query-string) - Data format for response.
10588    /// * *callback* (query-string) - JSONP
10589    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
10590    /// * *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.
10591    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
10592    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
10593    /// * *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.
10594    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
10595    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
10596    pub fn param<T>(
10597        mut self,
10598        name: T,
10599        value: T,
10600    ) -> ProjectLocationGlobalDomainReconfigureTrustCall<'a, C>
10601    where
10602        T: AsRef<str>,
10603    {
10604        self._additional_params
10605            .insert(name.as_ref().to_string(), value.as_ref().to_string());
10606        self
10607    }
10608
10609    /// Identifies the authorization scope for the method you are building.
10610    ///
10611    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
10612    /// [`Scope::CloudPlatform`].
10613    ///
10614    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
10615    /// tokens for more than one scope.
10616    ///
10617    /// Usually there is more than one suitable scope to authorize an operation, some of which may
10618    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
10619    /// sufficient, a read-write scope will do as well.
10620    pub fn add_scope<St>(
10621        mut self,
10622        scope: St,
10623    ) -> ProjectLocationGlobalDomainReconfigureTrustCall<'a, C>
10624    where
10625        St: AsRef<str>,
10626    {
10627        self._scopes.insert(String::from(scope.as_ref()));
10628        self
10629    }
10630    /// Identifies the authorization scope(s) for the method you are building.
10631    ///
10632    /// See [`Self::add_scope()`] for details.
10633    pub fn add_scopes<I, St>(
10634        mut self,
10635        scopes: I,
10636    ) -> ProjectLocationGlobalDomainReconfigureTrustCall<'a, C>
10637    where
10638        I: IntoIterator<Item = St>,
10639        St: AsRef<str>,
10640    {
10641        self._scopes
10642            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
10643        self
10644    }
10645
10646    /// Removes all scopes, and no default scope will be used either.
10647    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
10648    /// for details).
10649    pub fn clear_scopes(mut self) -> ProjectLocationGlobalDomainReconfigureTrustCall<'a, C> {
10650        self._scopes.clear();
10651        self
10652    }
10653}
10654
10655/// Resets a domain's administrator password.
10656///
10657/// A builder for the *locations.global.domains.resetAdminPassword* method supported by a *project* resource.
10658/// It is not used directly, but through a [`ProjectMethods`] instance.
10659///
10660/// # Example
10661///
10662/// Instantiate a resource method builder
10663///
10664/// ```test_harness,no_run
10665/// # extern crate hyper;
10666/// # extern crate hyper_rustls;
10667/// # extern crate google_managedidentities1 as managedidentities1;
10668/// use managedidentities1::api::ResetAdminPasswordRequest;
10669/// # async fn dox() {
10670/// # use managedidentities1::{ManagedServiceForMicrosoftActiveDirectoryConsumerAPI, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
10671///
10672/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
10673/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
10674/// #     .with_native_roots()
10675/// #     .unwrap()
10676/// #     .https_only()
10677/// #     .enable_http2()
10678/// #     .build();
10679///
10680/// # let executor = hyper_util::rt::TokioExecutor::new();
10681/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
10682/// #     secret,
10683/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
10684/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
10685/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
10686/// #     ),
10687/// # ).build().await.unwrap();
10688///
10689/// # let client = hyper_util::client::legacy::Client::builder(
10690/// #     hyper_util::rt::TokioExecutor::new()
10691/// # )
10692/// # .build(
10693/// #     hyper_rustls::HttpsConnectorBuilder::new()
10694/// #         .with_native_roots()
10695/// #         .unwrap()
10696/// #         .https_or_http()
10697/// #         .enable_http2()
10698/// #         .build()
10699/// # );
10700/// # let mut hub = ManagedServiceForMicrosoftActiveDirectoryConsumerAPI::new(client, auth);
10701/// // As the method needs a request, you would usually fill it with the desired information
10702/// // into the respective structure. Some of the parts shown here might not be applicable !
10703/// // Values shown here are possibly random and not representative !
10704/// let mut req = ResetAdminPasswordRequest::default();
10705///
10706/// // You can configure optional parameters by calling the respective setters at will, and
10707/// // execute the final call using `doit()`.
10708/// // Values shown here are possibly random and not representative !
10709/// let result = hub.projects().locations_global_domains_reset_admin_password(req, "name")
10710///              .doit().await;
10711/// # }
10712/// ```
10713pub struct ProjectLocationGlobalDomainResetAdminPasswordCall<'a, C>
10714where
10715    C: 'a,
10716{
10717    hub: &'a ManagedServiceForMicrosoftActiveDirectoryConsumerAPI<C>,
10718    _request: ResetAdminPasswordRequest,
10719    _name: String,
10720    _delegate: Option<&'a mut dyn common::Delegate>,
10721    _additional_params: HashMap<String, String>,
10722    _scopes: BTreeSet<String>,
10723}
10724
10725impl<'a, C> common::CallBuilder for ProjectLocationGlobalDomainResetAdminPasswordCall<'a, C> {}
10726
10727impl<'a, C> ProjectLocationGlobalDomainResetAdminPasswordCall<'a, C>
10728where
10729    C: common::Connector,
10730{
10731    /// Perform the operation you have build so far.
10732    pub async fn doit(mut self) -> common::Result<(common::Response, ResetAdminPasswordResponse)> {
10733        use std::borrow::Cow;
10734        use std::io::{Read, Seek};
10735
10736        use common::{url::Params, ToParts};
10737        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
10738
10739        let mut dd = common::DefaultDelegate;
10740        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
10741        dlg.begin(common::MethodInfo {
10742            id: "managedidentities.projects.locations.global.domains.resetAdminPassword",
10743            http_method: hyper::Method::POST,
10744        });
10745
10746        for &field in ["alt", "name"].iter() {
10747            if self._additional_params.contains_key(field) {
10748                dlg.finished(false);
10749                return Err(common::Error::FieldClash(field));
10750            }
10751        }
10752
10753        let mut params = Params::with_capacity(4 + self._additional_params.len());
10754        params.push("name", self._name);
10755
10756        params.extend(self._additional_params.iter());
10757
10758        params.push("alt", "json");
10759        let mut url = self.hub._base_url.clone() + "v1/{+name}:resetAdminPassword";
10760        if self._scopes.is_empty() {
10761            self._scopes
10762                .insert(Scope::CloudPlatform.as_ref().to_string());
10763        }
10764
10765        #[allow(clippy::single_element_loop)]
10766        for &(find_this, param_name) in [("{+name}", "name")].iter() {
10767            url = params.uri_replacement(url, param_name, find_this, true);
10768        }
10769        {
10770            let to_remove = ["name"];
10771            params.remove_params(&to_remove);
10772        }
10773
10774        let url = params.parse_with_url(&url);
10775
10776        let mut json_mime_type = mime::APPLICATION_JSON;
10777        let mut request_value_reader = {
10778            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
10779            common::remove_json_null_values(&mut value);
10780            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
10781            serde_json::to_writer(&mut dst, &value).unwrap();
10782            dst
10783        };
10784        let request_size = request_value_reader
10785            .seek(std::io::SeekFrom::End(0))
10786            .unwrap();
10787        request_value_reader
10788            .seek(std::io::SeekFrom::Start(0))
10789            .unwrap();
10790
10791        loop {
10792            let token = match self
10793                .hub
10794                .auth
10795                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
10796                .await
10797            {
10798                Ok(token) => token,
10799                Err(e) => match dlg.token(e) {
10800                    Ok(token) => token,
10801                    Err(e) => {
10802                        dlg.finished(false);
10803                        return Err(common::Error::MissingToken(e));
10804                    }
10805                },
10806            };
10807            request_value_reader
10808                .seek(std::io::SeekFrom::Start(0))
10809                .unwrap();
10810            let mut req_result = {
10811                let client = &self.hub.client;
10812                dlg.pre_request();
10813                let mut req_builder = hyper::Request::builder()
10814                    .method(hyper::Method::POST)
10815                    .uri(url.as_str())
10816                    .header(USER_AGENT, self.hub._user_agent.clone());
10817
10818                if let Some(token) = token.as_ref() {
10819                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
10820                }
10821
10822                let request = req_builder
10823                    .header(CONTENT_TYPE, json_mime_type.to_string())
10824                    .header(CONTENT_LENGTH, request_size as u64)
10825                    .body(common::to_body(
10826                        request_value_reader.get_ref().clone().into(),
10827                    ));
10828
10829                client.request(request.unwrap()).await
10830            };
10831
10832            match req_result {
10833                Err(err) => {
10834                    if let common::Retry::After(d) = dlg.http_error(&err) {
10835                        sleep(d).await;
10836                        continue;
10837                    }
10838                    dlg.finished(false);
10839                    return Err(common::Error::HttpError(err));
10840                }
10841                Ok(res) => {
10842                    let (mut parts, body) = res.into_parts();
10843                    let mut body = common::Body::new(body);
10844                    if !parts.status.is_success() {
10845                        let bytes = common::to_bytes(body).await.unwrap_or_default();
10846                        let error = serde_json::from_str(&common::to_string(&bytes));
10847                        let response = common::to_response(parts, bytes.into());
10848
10849                        if let common::Retry::After(d) =
10850                            dlg.http_failure(&response, error.as_ref().ok())
10851                        {
10852                            sleep(d).await;
10853                            continue;
10854                        }
10855
10856                        dlg.finished(false);
10857
10858                        return Err(match error {
10859                            Ok(value) => common::Error::BadRequest(value),
10860                            _ => common::Error::Failure(response),
10861                        });
10862                    }
10863                    let response = {
10864                        let bytes = common::to_bytes(body).await.unwrap_or_default();
10865                        let encoded = common::to_string(&bytes);
10866                        match serde_json::from_str(&encoded) {
10867                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
10868                            Err(error) => {
10869                                dlg.response_json_decode_error(&encoded, &error);
10870                                return Err(common::Error::JsonDecodeError(
10871                                    encoded.to_string(),
10872                                    error,
10873                                ));
10874                            }
10875                        }
10876                    };
10877
10878                    dlg.finished(true);
10879                    return Ok(response);
10880                }
10881            }
10882        }
10883    }
10884
10885    ///
10886    /// Sets the *request* property to the given value.
10887    ///
10888    /// Even though the property as already been set when instantiating this call,
10889    /// we provide this method for API completeness.
10890    pub fn request(
10891        mut self,
10892        new_value: ResetAdminPasswordRequest,
10893    ) -> ProjectLocationGlobalDomainResetAdminPasswordCall<'a, C> {
10894        self._request = new_value;
10895        self
10896    }
10897    /// Required. The domain resource name using the form: `projects/{project_id}/locations/global/domains/{domain_name}`
10898    ///
10899    /// Sets the *name* path property to the given value.
10900    ///
10901    /// Even though the property as already been set when instantiating this call,
10902    /// we provide this method for API completeness.
10903    pub fn name(
10904        mut self,
10905        new_value: &str,
10906    ) -> ProjectLocationGlobalDomainResetAdminPasswordCall<'a, C> {
10907        self._name = new_value.to_string();
10908        self
10909    }
10910    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
10911    /// while executing the actual API request.
10912    ///
10913    /// ````text
10914    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
10915    /// ````
10916    ///
10917    /// Sets the *delegate* property to the given value.
10918    pub fn delegate(
10919        mut self,
10920        new_value: &'a mut dyn common::Delegate,
10921    ) -> ProjectLocationGlobalDomainResetAdminPasswordCall<'a, C> {
10922        self._delegate = Some(new_value);
10923        self
10924    }
10925
10926    /// Set any additional parameter of the query string used in the request.
10927    /// It should be used to set parameters which are not yet available through their own
10928    /// setters.
10929    ///
10930    /// Please note that this method must not be used to set any of the known parameters
10931    /// which have their own setter method. If done anyway, the request will fail.
10932    ///
10933    /// # Additional Parameters
10934    ///
10935    /// * *$.xgafv* (query-string) - V1 error format.
10936    /// * *access_token* (query-string) - OAuth access token.
10937    /// * *alt* (query-string) - Data format for response.
10938    /// * *callback* (query-string) - JSONP
10939    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
10940    /// * *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.
10941    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
10942    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
10943    /// * *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.
10944    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
10945    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
10946    pub fn param<T>(
10947        mut self,
10948        name: T,
10949        value: T,
10950    ) -> ProjectLocationGlobalDomainResetAdminPasswordCall<'a, C>
10951    where
10952        T: AsRef<str>,
10953    {
10954        self._additional_params
10955            .insert(name.as_ref().to_string(), value.as_ref().to_string());
10956        self
10957    }
10958
10959    /// Identifies the authorization scope for the method you are building.
10960    ///
10961    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
10962    /// [`Scope::CloudPlatform`].
10963    ///
10964    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
10965    /// tokens for more than one scope.
10966    ///
10967    /// Usually there is more than one suitable scope to authorize an operation, some of which may
10968    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
10969    /// sufficient, a read-write scope will do as well.
10970    pub fn add_scope<St>(
10971        mut self,
10972        scope: St,
10973    ) -> ProjectLocationGlobalDomainResetAdminPasswordCall<'a, C>
10974    where
10975        St: AsRef<str>,
10976    {
10977        self._scopes.insert(String::from(scope.as_ref()));
10978        self
10979    }
10980    /// Identifies the authorization scope(s) for the method you are building.
10981    ///
10982    /// See [`Self::add_scope()`] for details.
10983    pub fn add_scopes<I, St>(
10984        mut self,
10985        scopes: I,
10986    ) -> ProjectLocationGlobalDomainResetAdminPasswordCall<'a, C>
10987    where
10988        I: IntoIterator<Item = St>,
10989        St: AsRef<str>,
10990    {
10991        self._scopes
10992            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
10993        self
10994    }
10995
10996    /// Removes all scopes, and no default scope will be used either.
10997    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
10998    /// for details).
10999    pub fn clear_scopes(mut self) -> ProjectLocationGlobalDomainResetAdminPasswordCall<'a, C> {
11000        self._scopes.clear();
11001        self
11002    }
11003}
11004
11005/// RestoreDomain restores domain backup mentioned in the RestoreDomainRequest
11006///
11007/// A builder for the *locations.global.domains.restore* method supported by a *project* resource.
11008/// It is not used directly, but through a [`ProjectMethods`] instance.
11009///
11010/// # Example
11011///
11012/// Instantiate a resource method builder
11013///
11014/// ```test_harness,no_run
11015/// # extern crate hyper;
11016/// # extern crate hyper_rustls;
11017/// # extern crate google_managedidentities1 as managedidentities1;
11018/// use managedidentities1::api::RestoreDomainRequest;
11019/// # async fn dox() {
11020/// # use managedidentities1::{ManagedServiceForMicrosoftActiveDirectoryConsumerAPI, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
11021///
11022/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
11023/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
11024/// #     .with_native_roots()
11025/// #     .unwrap()
11026/// #     .https_only()
11027/// #     .enable_http2()
11028/// #     .build();
11029///
11030/// # let executor = hyper_util::rt::TokioExecutor::new();
11031/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
11032/// #     secret,
11033/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
11034/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
11035/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
11036/// #     ),
11037/// # ).build().await.unwrap();
11038///
11039/// # let client = hyper_util::client::legacy::Client::builder(
11040/// #     hyper_util::rt::TokioExecutor::new()
11041/// # )
11042/// # .build(
11043/// #     hyper_rustls::HttpsConnectorBuilder::new()
11044/// #         .with_native_roots()
11045/// #         .unwrap()
11046/// #         .https_or_http()
11047/// #         .enable_http2()
11048/// #         .build()
11049/// # );
11050/// # let mut hub = ManagedServiceForMicrosoftActiveDirectoryConsumerAPI::new(client, auth);
11051/// // As the method needs a request, you would usually fill it with the desired information
11052/// // into the respective structure. Some of the parts shown here might not be applicable !
11053/// // Values shown here are possibly random and not representative !
11054/// let mut req = RestoreDomainRequest::default();
11055///
11056/// // You can configure optional parameters by calling the respective setters at will, and
11057/// // execute the final call using `doit()`.
11058/// // Values shown here are possibly random and not representative !
11059/// let result = hub.projects().locations_global_domains_restore(req, "name")
11060///              .doit().await;
11061/// # }
11062/// ```
11063pub struct ProjectLocationGlobalDomainRestoreCall<'a, C>
11064where
11065    C: 'a,
11066{
11067    hub: &'a ManagedServiceForMicrosoftActiveDirectoryConsumerAPI<C>,
11068    _request: RestoreDomainRequest,
11069    _name: String,
11070    _delegate: Option<&'a mut dyn common::Delegate>,
11071    _additional_params: HashMap<String, String>,
11072    _scopes: BTreeSet<String>,
11073}
11074
11075impl<'a, C> common::CallBuilder for ProjectLocationGlobalDomainRestoreCall<'a, C> {}
11076
11077impl<'a, C> ProjectLocationGlobalDomainRestoreCall<'a, C>
11078where
11079    C: common::Connector,
11080{
11081    /// Perform the operation you have build so far.
11082    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
11083        use std::borrow::Cow;
11084        use std::io::{Read, Seek};
11085
11086        use common::{url::Params, ToParts};
11087        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
11088
11089        let mut dd = common::DefaultDelegate;
11090        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
11091        dlg.begin(common::MethodInfo {
11092            id: "managedidentities.projects.locations.global.domains.restore",
11093            http_method: hyper::Method::POST,
11094        });
11095
11096        for &field in ["alt", "name"].iter() {
11097            if self._additional_params.contains_key(field) {
11098                dlg.finished(false);
11099                return Err(common::Error::FieldClash(field));
11100            }
11101        }
11102
11103        let mut params = Params::with_capacity(4 + self._additional_params.len());
11104        params.push("name", self._name);
11105
11106        params.extend(self._additional_params.iter());
11107
11108        params.push("alt", "json");
11109        let mut url = self.hub._base_url.clone() + "v1/{+name}:restore";
11110        if self._scopes.is_empty() {
11111            self._scopes
11112                .insert(Scope::CloudPlatform.as_ref().to_string());
11113        }
11114
11115        #[allow(clippy::single_element_loop)]
11116        for &(find_this, param_name) in [("{+name}", "name")].iter() {
11117            url = params.uri_replacement(url, param_name, find_this, true);
11118        }
11119        {
11120            let to_remove = ["name"];
11121            params.remove_params(&to_remove);
11122        }
11123
11124        let url = params.parse_with_url(&url);
11125
11126        let mut json_mime_type = mime::APPLICATION_JSON;
11127        let mut request_value_reader = {
11128            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
11129            common::remove_json_null_values(&mut value);
11130            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
11131            serde_json::to_writer(&mut dst, &value).unwrap();
11132            dst
11133        };
11134        let request_size = request_value_reader
11135            .seek(std::io::SeekFrom::End(0))
11136            .unwrap();
11137        request_value_reader
11138            .seek(std::io::SeekFrom::Start(0))
11139            .unwrap();
11140
11141        loop {
11142            let token = match self
11143                .hub
11144                .auth
11145                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
11146                .await
11147            {
11148                Ok(token) => token,
11149                Err(e) => match dlg.token(e) {
11150                    Ok(token) => token,
11151                    Err(e) => {
11152                        dlg.finished(false);
11153                        return Err(common::Error::MissingToken(e));
11154                    }
11155                },
11156            };
11157            request_value_reader
11158                .seek(std::io::SeekFrom::Start(0))
11159                .unwrap();
11160            let mut req_result = {
11161                let client = &self.hub.client;
11162                dlg.pre_request();
11163                let mut req_builder = hyper::Request::builder()
11164                    .method(hyper::Method::POST)
11165                    .uri(url.as_str())
11166                    .header(USER_AGENT, self.hub._user_agent.clone());
11167
11168                if let Some(token) = token.as_ref() {
11169                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
11170                }
11171
11172                let request = req_builder
11173                    .header(CONTENT_TYPE, json_mime_type.to_string())
11174                    .header(CONTENT_LENGTH, request_size as u64)
11175                    .body(common::to_body(
11176                        request_value_reader.get_ref().clone().into(),
11177                    ));
11178
11179                client.request(request.unwrap()).await
11180            };
11181
11182            match req_result {
11183                Err(err) => {
11184                    if let common::Retry::After(d) = dlg.http_error(&err) {
11185                        sleep(d).await;
11186                        continue;
11187                    }
11188                    dlg.finished(false);
11189                    return Err(common::Error::HttpError(err));
11190                }
11191                Ok(res) => {
11192                    let (mut parts, body) = res.into_parts();
11193                    let mut body = common::Body::new(body);
11194                    if !parts.status.is_success() {
11195                        let bytes = common::to_bytes(body).await.unwrap_or_default();
11196                        let error = serde_json::from_str(&common::to_string(&bytes));
11197                        let response = common::to_response(parts, bytes.into());
11198
11199                        if let common::Retry::After(d) =
11200                            dlg.http_failure(&response, error.as_ref().ok())
11201                        {
11202                            sleep(d).await;
11203                            continue;
11204                        }
11205
11206                        dlg.finished(false);
11207
11208                        return Err(match error {
11209                            Ok(value) => common::Error::BadRequest(value),
11210                            _ => common::Error::Failure(response),
11211                        });
11212                    }
11213                    let response = {
11214                        let bytes = common::to_bytes(body).await.unwrap_or_default();
11215                        let encoded = common::to_string(&bytes);
11216                        match serde_json::from_str(&encoded) {
11217                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
11218                            Err(error) => {
11219                                dlg.response_json_decode_error(&encoded, &error);
11220                                return Err(common::Error::JsonDecodeError(
11221                                    encoded.to_string(),
11222                                    error,
11223                                ));
11224                            }
11225                        }
11226                    };
11227
11228                    dlg.finished(true);
11229                    return Ok(response);
11230                }
11231            }
11232        }
11233    }
11234
11235    ///
11236    /// Sets the *request* property to the given value.
11237    ///
11238    /// Even though the property as already been set when instantiating this call,
11239    /// we provide this method for API completeness.
11240    pub fn request(
11241        mut self,
11242        new_value: RestoreDomainRequest,
11243    ) -> ProjectLocationGlobalDomainRestoreCall<'a, C> {
11244        self._request = new_value;
11245        self
11246    }
11247    /// Required. Resource name for the domain to which the backup belongs
11248    ///
11249    /// Sets the *name* path property to the given value.
11250    ///
11251    /// Even though the property as already been set when instantiating this call,
11252    /// we provide this method for API completeness.
11253    pub fn name(mut self, new_value: &str) -> ProjectLocationGlobalDomainRestoreCall<'a, C> {
11254        self._name = new_value.to_string();
11255        self
11256    }
11257    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
11258    /// while executing the actual API request.
11259    ///
11260    /// ````text
11261    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
11262    /// ````
11263    ///
11264    /// Sets the *delegate* property to the given value.
11265    pub fn delegate(
11266        mut self,
11267        new_value: &'a mut dyn common::Delegate,
11268    ) -> ProjectLocationGlobalDomainRestoreCall<'a, C> {
11269        self._delegate = Some(new_value);
11270        self
11271    }
11272
11273    /// Set any additional parameter of the query string used in the request.
11274    /// It should be used to set parameters which are not yet available through their own
11275    /// setters.
11276    ///
11277    /// Please note that this method must not be used to set any of the known parameters
11278    /// which have their own setter method. If done anyway, the request will fail.
11279    ///
11280    /// # Additional Parameters
11281    ///
11282    /// * *$.xgafv* (query-string) - V1 error format.
11283    /// * *access_token* (query-string) - OAuth access token.
11284    /// * *alt* (query-string) - Data format for response.
11285    /// * *callback* (query-string) - JSONP
11286    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
11287    /// * *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.
11288    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
11289    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
11290    /// * *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.
11291    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
11292    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
11293    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationGlobalDomainRestoreCall<'a, C>
11294    where
11295        T: AsRef<str>,
11296    {
11297        self._additional_params
11298            .insert(name.as_ref().to_string(), value.as_ref().to_string());
11299        self
11300    }
11301
11302    /// Identifies the authorization scope for the method you are building.
11303    ///
11304    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
11305    /// [`Scope::CloudPlatform`].
11306    ///
11307    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
11308    /// tokens for more than one scope.
11309    ///
11310    /// Usually there is more than one suitable scope to authorize an operation, some of which may
11311    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
11312    /// sufficient, a read-write scope will do as well.
11313    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationGlobalDomainRestoreCall<'a, C>
11314    where
11315        St: AsRef<str>,
11316    {
11317        self._scopes.insert(String::from(scope.as_ref()));
11318        self
11319    }
11320    /// Identifies the authorization scope(s) for the method you are building.
11321    ///
11322    /// See [`Self::add_scope()`] for details.
11323    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationGlobalDomainRestoreCall<'a, C>
11324    where
11325        I: IntoIterator<Item = St>,
11326        St: AsRef<str>,
11327    {
11328        self._scopes
11329            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
11330        self
11331    }
11332
11333    /// Removes all scopes, and no default scope will be used either.
11334    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
11335    /// for details).
11336    pub fn clear_scopes(mut self) -> ProjectLocationGlobalDomainRestoreCall<'a, C> {
11337        self._scopes.clear();
11338        self
11339    }
11340}
11341
11342/// Sets the access control policy on the specified resource. Replaces any existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` errors.
11343///
11344/// A builder for the *locations.global.domains.setIamPolicy* method supported by a *project* resource.
11345/// It is not used directly, but through a [`ProjectMethods`] instance.
11346///
11347/// # Example
11348///
11349/// Instantiate a resource method builder
11350///
11351/// ```test_harness,no_run
11352/// # extern crate hyper;
11353/// # extern crate hyper_rustls;
11354/// # extern crate google_managedidentities1 as managedidentities1;
11355/// use managedidentities1::api::SetIamPolicyRequest;
11356/// # async fn dox() {
11357/// # use managedidentities1::{ManagedServiceForMicrosoftActiveDirectoryConsumerAPI, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
11358///
11359/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
11360/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
11361/// #     .with_native_roots()
11362/// #     .unwrap()
11363/// #     .https_only()
11364/// #     .enable_http2()
11365/// #     .build();
11366///
11367/// # let executor = hyper_util::rt::TokioExecutor::new();
11368/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
11369/// #     secret,
11370/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
11371/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
11372/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
11373/// #     ),
11374/// # ).build().await.unwrap();
11375///
11376/// # let client = hyper_util::client::legacy::Client::builder(
11377/// #     hyper_util::rt::TokioExecutor::new()
11378/// # )
11379/// # .build(
11380/// #     hyper_rustls::HttpsConnectorBuilder::new()
11381/// #         .with_native_roots()
11382/// #         .unwrap()
11383/// #         .https_or_http()
11384/// #         .enable_http2()
11385/// #         .build()
11386/// # );
11387/// # let mut hub = ManagedServiceForMicrosoftActiveDirectoryConsumerAPI::new(client, auth);
11388/// // As the method needs a request, you would usually fill it with the desired information
11389/// // into the respective structure. Some of the parts shown here might not be applicable !
11390/// // Values shown here are possibly random and not representative !
11391/// let mut req = SetIamPolicyRequest::default();
11392///
11393/// // You can configure optional parameters by calling the respective setters at will, and
11394/// // execute the final call using `doit()`.
11395/// // Values shown here are possibly random and not representative !
11396/// let result = hub.projects().locations_global_domains_set_iam_policy(req, "resource")
11397///              .doit().await;
11398/// # }
11399/// ```
11400pub struct ProjectLocationGlobalDomainSetIamPolicyCall<'a, C>
11401where
11402    C: 'a,
11403{
11404    hub: &'a ManagedServiceForMicrosoftActiveDirectoryConsumerAPI<C>,
11405    _request: SetIamPolicyRequest,
11406    _resource: String,
11407    _delegate: Option<&'a mut dyn common::Delegate>,
11408    _additional_params: HashMap<String, String>,
11409    _scopes: BTreeSet<String>,
11410}
11411
11412impl<'a, C> common::CallBuilder for ProjectLocationGlobalDomainSetIamPolicyCall<'a, C> {}
11413
11414impl<'a, C> ProjectLocationGlobalDomainSetIamPolicyCall<'a, C>
11415where
11416    C: common::Connector,
11417{
11418    /// Perform the operation you have build so far.
11419    pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
11420        use std::borrow::Cow;
11421        use std::io::{Read, Seek};
11422
11423        use common::{url::Params, ToParts};
11424        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
11425
11426        let mut dd = common::DefaultDelegate;
11427        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
11428        dlg.begin(common::MethodInfo {
11429            id: "managedidentities.projects.locations.global.domains.setIamPolicy",
11430            http_method: hyper::Method::POST,
11431        });
11432
11433        for &field in ["alt", "resource"].iter() {
11434            if self._additional_params.contains_key(field) {
11435                dlg.finished(false);
11436                return Err(common::Error::FieldClash(field));
11437            }
11438        }
11439
11440        let mut params = Params::with_capacity(4 + self._additional_params.len());
11441        params.push("resource", self._resource);
11442
11443        params.extend(self._additional_params.iter());
11444
11445        params.push("alt", "json");
11446        let mut url = self.hub._base_url.clone() + "v1/{+resource}:setIamPolicy";
11447        if self._scopes.is_empty() {
11448            self._scopes
11449                .insert(Scope::CloudPlatform.as_ref().to_string());
11450        }
11451
11452        #[allow(clippy::single_element_loop)]
11453        for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
11454            url = params.uri_replacement(url, param_name, find_this, true);
11455        }
11456        {
11457            let to_remove = ["resource"];
11458            params.remove_params(&to_remove);
11459        }
11460
11461        let url = params.parse_with_url(&url);
11462
11463        let mut json_mime_type = mime::APPLICATION_JSON;
11464        let mut request_value_reader = {
11465            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
11466            common::remove_json_null_values(&mut value);
11467            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
11468            serde_json::to_writer(&mut dst, &value).unwrap();
11469            dst
11470        };
11471        let request_size = request_value_reader
11472            .seek(std::io::SeekFrom::End(0))
11473            .unwrap();
11474        request_value_reader
11475            .seek(std::io::SeekFrom::Start(0))
11476            .unwrap();
11477
11478        loop {
11479            let token = match self
11480                .hub
11481                .auth
11482                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
11483                .await
11484            {
11485                Ok(token) => token,
11486                Err(e) => match dlg.token(e) {
11487                    Ok(token) => token,
11488                    Err(e) => {
11489                        dlg.finished(false);
11490                        return Err(common::Error::MissingToken(e));
11491                    }
11492                },
11493            };
11494            request_value_reader
11495                .seek(std::io::SeekFrom::Start(0))
11496                .unwrap();
11497            let mut req_result = {
11498                let client = &self.hub.client;
11499                dlg.pre_request();
11500                let mut req_builder = hyper::Request::builder()
11501                    .method(hyper::Method::POST)
11502                    .uri(url.as_str())
11503                    .header(USER_AGENT, self.hub._user_agent.clone());
11504
11505                if let Some(token) = token.as_ref() {
11506                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
11507                }
11508
11509                let request = req_builder
11510                    .header(CONTENT_TYPE, json_mime_type.to_string())
11511                    .header(CONTENT_LENGTH, request_size as u64)
11512                    .body(common::to_body(
11513                        request_value_reader.get_ref().clone().into(),
11514                    ));
11515
11516                client.request(request.unwrap()).await
11517            };
11518
11519            match req_result {
11520                Err(err) => {
11521                    if let common::Retry::After(d) = dlg.http_error(&err) {
11522                        sleep(d).await;
11523                        continue;
11524                    }
11525                    dlg.finished(false);
11526                    return Err(common::Error::HttpError(err));
11527                }
11528                Ok(res) => {
11529                    let (mut parts, body) = res.into_parts();
11530                    let mut body = common::Body::new(body);
11531                    if !parts.status.is_success() {
11532                        let bytes = common::to_bytes(body).await.unwrap_or_default();
11533                        let error = serde_json::from_str(&common::to_string(&bytes));
11534                        let response = common::to_response(parts, bytes.into());
11535
11536                        if let common::Retry::After(d) =
11537                            dlg.http_failure(&response, error.as_ref().ok())
11538                        {
11539                            sleep(d).await;
11540                            continue;
11541                        }
11542
11543                        dlg.finished(false);
11544
11545                        return Err(match error {
11546                            Ok(value) => common::Error::BadRequest(value),
11547                            _ => common::Error::Failure(response),
11548                        });
11549                    }
11550                    let response = {
11551                        let bytes = common::to_bytes(body).await.unwrap_or_default();
11552                        let encoded = common::to_string(&bytes);
11553                        match serde_json::from_str(&encoded) {
11554                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
11555                            Err(error) => {
11556                                dlg.response_json_decode_error(&encoded, &error);
11557                                return Err(common::Error::JsonDecodeError(
11558                                    encoded.to_string(),
11559                                    error,
11560                                ));
11561                            }
11562                        }
11563                    };
11564
11565                    dlg.finished(true);
11566                    return Ok(response);
11567                }
11568            }
11569        }
11570    }
11571
11572    ///
11573    /// Sets the *request* property to the given value.
11574    ///
11575    /// Even though the property as already been set when instantiating this call,
11576    /// we provide this method for API completeness.
11577    pub fn request(
11578        mut self,
11579        new_value: SetIamPolicyRequest,
11580    ) -> ProjectLocationGlobalDomainSetIamPolicyCall<'a, C> {
11581        self._request = new_value;
11582        self
11583    }
11584    /// REQUIRED: The resource for which the policy is being specified. See [Resource names](https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
11585    ///
11586    /// Sets the *resource* path property to the given value.
11587    ///
11588    /// Even though the property as already been set when instantiating this call,
11589    /// we provide this method for API completeness.
11590    pub fn resource(
11591        mut self,
11592        new_value: &str,
11593    ) -> ProjectLocationGlobalDomainSetIamPolicyCall<'a, C> {
11594        self._resource = new_value.to_string();
11595        self
11596    }
11597    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
11598    /// while executing the actual API request.
11599    ///
11600    /// ````text
11601    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
11602    /// ````
11603    ///
11604    /// Sets the *delegate* property to the given value.
11605    pub fn delegate(
11606        mut self,
11607        new_value: &'a mut dyn common::Delegate,
11608    ) -> ProjectLocationGlobalDomainSetIamPolicyCall<'a, C> {
11609        self._delegate = Some(new_value);
11610        self
11611    }
11612
11613    /// Set any additional parameter of the query string used in the request.
11614    /// It should be used to set parameters which are not yet available through their own
11615    /// setters.
11616    ///
11617    /// Please note that this method must not be used to set any of the known parameters
11618    /// which have their own setter method. If done anyway, the request will fail.
11619    ///
11620    /// # Additional Parameters
11621    ///
11622    /// * *$.xgafv* (query-string) - V1 error format.
11623    /// * *access_token* (query-string) - OAuth access token.
11624    /// * *alt* (query-string) - Data format for response.
11625    /// * *callback* (query-string) - JSONP
11626    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
11627    /// * *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.
11628    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
11629    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
11630    /// * *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.
11631    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
11632    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
11633    pub fn param<T>(
11634        mut self,
11635        name: T,
11636        value: T,
11637    ) -> ProjectLocationGlobalDomainSetIamPolicyCall<'a, C>
11638    where
11639        T: AsRef<str>,
11640    {
11641        self._additional_params
11642            .insert(name.as_ref().to_string(), value.as_ref().to_string());
11643        self
11644    }
11645
11646    /// Identifies the authorization scope for the method you are building.
11647    ///
11648    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
11649    /// [`Scope::CloudPlatform`].
11650    ///
11651    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
11652    /// tokens for more than one scope.
11653    ///
11654    /// Usually there is more than one suitable scope to authorize an operation, some of which may
11655    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
11656    /// sufficient, a read-write scope will do as well.
11657    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationGlobalDomainSetIamPolicyCall<'a, C>
11658    where
11659        St: AsRef<str>,
11660    {
11661        self._scopes.insert(String::from(scope.as_ref()));
11662        self
11663    }
11664    /// Identifies the authorization scope(s) for the method you are building.
11665    ///
11666    /// See [`Self::add_scope()`] for details.
11667    pub fn add_scopes<I, St>(
11668        mut self,
11669        scopes: I,
11670    ) -> ProjectLocationGlobalDomainSetIamPolicyCall<'a, C>
11671    where
11672        I: IntoIterator<Item = St>,
11673        St: AsRef<str>,
11674    {
11675        self._scopes
11676            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
11677        self
11678    }
11679
11680    /// Removes all scopes, and no default scope will be used either.
11681    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
11682    /// for details).
11683    pub fn clear_scopes(mut self) -> ProjectLocationGlobalDomainSetIamPolicyCall<'a, C> {
11684        self._scopes.clear();
11685        self
11686    }
11687}
11688
11689/// Returns permissions that a caller has on the specified resource. If the resource does not exist, this will return an empty set of permissions, not a `NOT_FOUND` error. Note: This operation is designed to be used for building permission-aware UIs and command-line tools, not for authorization checking. This operation may "fail open" without warning.
11690///
11691/// A builder for the *locations.global.domains.testIamPermissions* method supported by a *project* resource.
11692/// It is not used directly, but through a [`ProjectMethods`] instance.
11693///
11694/// # Example
11695///
11696/// Instantiate a resource method builder
11697///
11698/// ```test_harness,no_run
11699/// # extern crate hyper;
11700/// # extern crate hyper_rustls;
11701/// # extern crate google_managedidentities1 as managedidentities1;
11702/// use managedidentities1::api::TestIamPermissionsRequest;
11703/// # async fn dox() {
11704/// # use managedidentities1::{ManagedServiceForMicrosoftActiveDirectoryConsumerAPI, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
11705///
11706/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
11707/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
11708/// #     .with_native_roots()
11709/// #     .unwrap()
11710/// #     .https_only()
11711/// #     .enable_http2()
11712/// #     .build();
11713///
11714/// # let executor = hyper_util::rt::TokioExecutor::new();
11715/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
11716/// #     secret,
11717/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
11718/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
11719/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
11720/// #     ),
11721/// # ).build().await.unwrap();
11722///
11723/// # let client = hyper_util::client::legacy::Client::builder(
11724/// #     hyper_util::rt::TokioExecutor::new()
11725/// # )
11726/// # .build(
11727/// #     hyper_rustls::HttpsConnectorBuilder::new()
11728/// #         .with_native_roots()
11729/// #         .unwrap()
11730/// #         .https_or_http()
11731/// #         .enable_http2()
11732/// #         .build()
11733/// # );
11734/// # let mut hub = ManagedServiceForMicrosoftActiveDirectoryConsumerAPI::new(client, auth);
11735/// // As the method needs a request, you would usually fill it with the desired information
11736/// // into the respective structure. Some of the parts shown here might not be applicable !
11737/// // Values shown here are possibly random and not representative !
11738/// let mut req = TestIamPermissionsRequest::default();
11739///
11740/// // You can configure optional parameters by calling the respective setters at will, and
11741/// // execute the final call using `doit()`.
11742/// // Values shown here are possibly random and not representative !
11743/// let result = hub.projects().locations_global_domains_test_iam_permissions(req, "resource")
11744///              .doit().await;
11745/// # }
11746/// ```
11747pub struct ProjectLocationGlobalDomainTestIamPermissionCall<'a, C>
11748where
11749    C: 'a,
11750{
11751    hub: &'a ManagedServiceForMicrosoftActiveDirectoryConsumerAPI<C>,
11752    _request: TestIamPermissionsRequest,
11753    _resource: String,
11754    _delegate: Option<&'a mut dyn common::Delegate>,
11755    _additional_params: HashMap<String, String>,
11756    _scopes: BTreeSet<String>,
11757}
11758
11759impl<'a, C> common::CallBuilder for ProjectLocationGlobalDomainTestIamPermissionCall<'a, C> {}
11760
11761impl<'a, C> ProjectLocationGlobalDomainTestIamPermissionCall<'a, C>
11762where
11763    C: common::Connector,
11764{
11765    /// Perform the operation you have build so far.
11766    pub async fn doit(mut self) -> common::Result<(common::Response, TestIamPermissionsResponse)> {
11767        use std::borrow::Cow;
11768        use std::io::{Read, Seek};
11769
11770        use common::{url::Params, ToParts};
11771        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
11772
11773        let mut dd = common::DefaultDelegate;
11774        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
11775        dlg.begin(common::MethodInfo {
11776            id: "managedidentities.projects.locations.global.domains.testIamPermissions",
11777            http_method: hyper::Method::POST,
11778        });
11779
11780        for &field in ["alt", "resource"].iter() {
11781            if self._additional_params.contains_key(field) {
11782                dlg.finished(false);
11783                return Err(common::Error::FieldClash(field));
11784            }
11785        }
11786
11787        let mut params = Params::with_capacity(4 + self._additional_params.len());
11788        params.push("resource", self._resource);
11789
11790        params.extend(self._additional_params.iter());
11791
11792        params.push("alt", "json");
11793        let mut url = self.hub._base_url.clone() + "v1/{+resource}:testIamPermissions";
11794        if self._scopes.is_empty() {
11795            self._scopes
11796                .insert(Scope::CloudPlatform.as_ref().to_string());
11797        }
11798
11799        #[allow(clippy::single_element_loop)]
11800        for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
11801            url = params.uri_replacement(url, param_name, find_this, true);
11802        }
11803        {
11804            let to_remove = ["resource"];
11805            params.remove_params(&to_remove);
11806        }
11807
11808        let url = params.parse_with_url(&url);
11809
11810        let mut json_mime_type = mime::APPLICATION_JSON;
11811        let mut request_value_reader = {
11812            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
11813            common::remove_json_null_values(&mut value);
11814            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
11815            serde_json::to_writer(&mut dst, &value).unwrap();
11816            dst
11817        };
11818        let request_size = request_value_reader
11819            .seek(std::io::SeekFrom::End(0))
11820            .unwrap();
11821        request_value_reader
11822            .seek(std::io::SeekFrom::Start(0))
11823            .unwrap();
11824
11825        loop {
11826            let token = match self
11827                .hub
11828                .auth
11829                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
11830                .await
11831            {
11832                Ok(token) => token,
11833                Err(e) => match dlg.token(e) {
11834                    Ok(token) => token,
11835                    Err(e) => {
11836                        dlg.finished(false);
11837                        return Err(common::Error::MissingToken(e));
11838                    }
11839                },
11840            };
11841            request_value_reader
11842                .seek(std::io::SeekFrom::Start(0))
11843                .unwrap();
11844            let mut req_result = {
11845                let client = &self.hub.client;
11846                dlg.pre_request();
11847                let mut req_builder = hyper::Request::builder()
11848                    .method(hyper::Method::POST)
11849                    .uri(url.as_str())
11850                    .header(USER_AGENT, self.hub._user_agent.clone());
11851
11852                if let Some(token) = token.as_ref() {
11853                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
11854                }
11855
11856                let request = req_builder
11857                    .header(CONTENT_TYPE, json_mime_type.to_string())
11858                    .header(CONTENT_LENGTH, request_size as u64)
11859                    .body(common::to_body(
11860                        request_value_reader.get_ref().clone().into(),
11861                    ));
11862
11863                client.request(request.unwrap()).await
11864            };
11865
11866            match req_result {
11867                Err(err) => {
11868                    if let common::Retry::After(d) = dlg.http_error(&err) {
11869                        sleep(d).await;
11870                        continue;
11871                    }
11872                    dlg.finished(false);
11873                    return Err(common::Error::HttpError(err));
11874                }
11875                Ok(res) => {
11876                    let (mut parts, body) = res.into_parts();
11877                    let mut body = common::Body::new(body);
11878                    if !parts.status.is_success() {
11879                        let bytes = common::to_bytes(body).await.unwrap_or_default();
11880                        let error = serde_json::from_str(&common::to_string(&bytes));
11881                        let response = common::to_response(parts, bytes.into());
11882
11883                        if let common::Retry::After(d) =
11884                            dlg.http_failure(&response, error.as_ref().ok())
11885                        {
11886                            sleep(d).await;
11887                            continue;
11888                        }
11889
11890                        dlg.finished(false);
11891
11892                        return Err(match error {
11893                            Ok(value) => common::Error::BadRequest(value),
11894                            _ => common::Error::Failure(response),
11895                        });
11896                    }
11897                    let response = {
11898                        let bytes = common::to_bytes(body).await.unwrap_or_default();
11899                        let encoded = common::to_string(&bytes);
11900                        match serde_json::from_str(&encoded) {
11901                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
11902                            Err(error) => {
11903                                dlg.response_json_decode_error(&encoded, &error);
11904                                return Err(common::Error::JsonDecodeError(
11905                                    encoded.to_string(),
11906                                    error,
11907                                ));
11908                            }
11909                        }
11910                    };
11911
11912                    dlg.finished(true);
11913                    return Ok(response);
11914                }
11915            }
11916        }
11917    }
11918
11919    ///
11920    /// Sets the *request* property to the given value.
11921    ///
11922    /// Even though the property as already been set when instantiating this call,
11923    /// we provide this method for API completeness.
11924    pub fn request(
11925        mut self,
11926        new_value: TestIamPermissionsRequest,
11927    ) -> ProjectLocationGlobalDomainTestIamPermissionCall<'a, C> {
11928        self._request = new_value;
11929        self
11930    }
11931    /// REQUIRED: The resource for which the policy detail is being requested. See [Resource names](https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
11932    ///
11933    /// Sets the *resource* path property to the given value.
11934    ///
11935    /// Even though the property as already been set when instantiating this call,
11936    /// we provide this method for API completeness.
11937    pub fn resource(
11938        mut self,
11939        new_value: &str,
11940    ) -> ProjectLocationGlobalDomainTestIamPermissionCall<'a, C> {
11941        self._resource = new_value.to_string();
11942        self
11943    }
11944    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
11945    /// while executing the actual API request.
11946    ///
11947    /// ````text
11948    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
11949    /// ````
11950    ///
11951    /// Sets the *delegate* property to the given value.
11952    pub fn delegate(
11953        mut self,
11954        new_value: &'a mut dyn common::Delegate,
11955    ) -> ProjectLocationGlobalDomainTestIamPermissionCall<'a, C> {
11956        self._delegate = Some(new_value);
11957        self
11958    }
11959
11960    /// Set any additional parameter of the query string used in the request.
11961    /// It should be used to set parameters which are not yet available through their own
11962    /// setters.
11963    ///
11964    /// Please note that this method must not be used to set any of the known parameters
11965    /// which have their own setter method. If done anyway, the request will fail.
11966    ///
11967    /// # Additional Parameters
11968    ///
11969    /// * *$.xgafv* (query-string) - V1 error format.
11970    /// * *access_token* (query-string) - OAuth access token.
11971    /// * *alt* (query-string) - Data format for response.
11972    /// * *callback* (query-string) - JSONP
11973    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
11974    /// * *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.
11975    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
11976    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
11977    /// * *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.
11978    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
11979    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
11980    pub fn param<T>(
11981        mut self,
11982        name: T,
11983        value: T,
11984    ) -> ProjectLocationGlobalDomainTestIamPermissionCall<'a, C>
11985    where
11986        T: AsRef<str>,
11987    {
11988        self._additional_params
11989            .insert(name.as_ref().to_string(), value.as_ref().to_string());
11990        self
11991    }
11992
11993    /// Identifies the authorization scope for the method you are building.
11994    ///
11995    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
11996    /// [`Scope::CloudPlatform`].
11997    ///
11998    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
11999    /// tokens for more than one scope.
12000    ///
12001    /// Usually there is more than one suitable scope to authorize an operation, some of which may
12002    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
12003    /// sufficient, a read-write scope will do as well.
12004    pub fn add_scope<St>(
12005        mut self,
12006        scope: St,
12007    ) -> ProjectLocationGlobalDomainTestIamPermissionCall<'a, C>
12008    where
12009        St: AsRef<str>,
12010    {
12011        self._scopes.insert(String::from(scope.as_ref()));
12012        self
12013    }
12014    /// Identifies the authorization scope(s) for the method you are building.
12015    ///
12016    /// See [`Self::add_scope()`] for details.
12017    pub fn add_scopes<I, St>(
12018        mut self,
12019        scopes: I,
12020    ) -> ProjectLocationGlobalDomainTestIamPermissionCall<'a, C>
12021    where
12022        I: IntoIterator<Item = St>,
12023        St: AsRef<str>,
12024    {
12025        self._scopes
12026            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
12027        self
12028    }
12029
12030    /// Removes all scopes, and no default scope will be used either.
12031    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
12032    /// for details).
12033    pub fn clear_scopes(mut self) -> ProjectLocationGlobalDomainTestIamPermissionCall<'a, C> {
12034        self._scopes.clear();
12035        self
12036    }
12037}
12038
12039/// Patches a single ldaps settings.
12040///
12041/// A builder for the *locations.global.domains.updateLdapssettings* method supported by a *project* resource.
12042/// It is not used directly, but through a [`ProjectMethods`] instance.
12043///
12044/// # Example
12045///
12046/// Instantiate a resource method builder
12047///
12048/// ```test_harness,no_run
12049/// # extern crate hyper;
12050/// # extern crate hyper_rustls;
12051/// # extern crate google_managedidentities1 as managedidentities1;
12052/// use managedidentities1::api::LDAPSSettings;
12053/// # async fn dox() {
12054/// # use managedidentities1::{ManagedServiceForMicrosoftActiveDirectoryConsumerAPI, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
12055///
12056/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
12057/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
12058/// #     .with_native_roots()
12059/// #     .unwrap()
12060/// #     .https_only()
12061/// #     .enable_http2()
12062/// #     .build();
12063///
12064/// # let executor = hyper_util::rt::TokioExecutor::new();
12065/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
12066/// #     secret,
12067/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
12068/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
12069/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
12070/// #     ),
12071/// # ).build().await.unwrap();
12072///
12073/// # let client = hyper_util::client::legacy::Client::builder(
12074/// #     hyper_util::rt::TokioExecutor::new()
12075/// # )
12076/// # .build(
12077/// #     hyper_rustls::HttpsConnectorBuilder::new()
12078/// #         .with_native_roots()
12079/// #         .unwrap()
12080/// #         .https_or_http()
12081/// #         .enable_http2()
12082/// #         .build()
12083/// # );
12084/// # let mut hub = ManagedServiceForMicrosoftActiveDirectoryConsumerAPI::new(client, auth);
12085/// // As the method needs a request, you would usually fill it with the desired information
12086/// // into the respective structure. Some of the parts shown here might not be applicable !
12087/// // Values shown here are possibly random and not representative !
12088/// let mut req = LDAPSSettings::default();
12089///
12090/// // You can configure optional parameters by calling the respective setters at will, and
12091/// // execute the final call using `doit()`.
12092/// // Values shown here are possibly random and not representative !
12093/// let result = hub.projects().locations_global_domains_update_ldapssettings(req, "name")
12094///              .update_mask(FieldMask::new::<&str>(&[]))
12095///              .doit().await;
12096/// # }
12097/// ```
12098pub struct ProjectLocationGlobalDomainUpdateLdapssettingCall<'a, C>
12099where
12100    C: 'a,
12101{
12102    hub: &'a ManagedServiceForMicrosoftActiveDirectoryConsumerAPI<C>,
12103    _request: LDAPSSettings,
12104    _name: String,
12105    _update_mask: Option<common::FieldMask>,
12106    _delegate: Option<&'a mut dyn common::Delegate>,
12107    _additional_params: HashMap<String, String>,
12108    _scopes: BTreeSet<String>,
12109}
12110
12111impl<'a, C> common::CallBuilder for ProjectLocationGlobalDomainUpdateLdapssettingCall<'a, C> {}
12112
12113impl<'a, C> ProjectLocationGlobalDomainUpdateLdapssettingCall<'a, C>
12114where
12115    C: common::Connector,
12116{
12117    /// Perform the operation you have build so far.
12118    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
12119        use std::borrow::Cow;
12120        use std::io::{Read, Seek};
12121
12122        use common::{url::Params, ToParts};
12123        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
12124
12125        let mut dd = common::DefaultDelegate;
12126        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
12127        dlg.begin(common::MethodInfo {
12128            id: "managedidentities.projects.locations.global.domains.updateLdapssettings",
12129            http_method: hyper::Method::PATCH,
12130        });
12131
12132        for &field in ["alt", "name", "updateMask"].iter() {
12133            if self._additional_params.contains_key(field) {
12134                dlg.finished(false);
12135                return Err(common::Error::FieldClash(field));
12136            }
12137        }
12138
12139        let mut params = Params::with_capacity(5 + self._additional_params.len());
12140        params.push("name", self._name);
12141        if let Some(value) = self._update_mask.as_ref() {
12142            params.push("updateMask", value.to_string());
12143        }
12144
12145        params.extend(self._additional_params.iter());
12146
12147        params.push("alt", "json");
12148        let mut url = self.hub._base_url.clone() + "v1/{+name}/ldapssettings";
12149        if self._scopes.is_empty() {
12150            self._scopes
12151                .insert(Scope::CloudPlatform.as_ref().to_string());
12152        }
12153
12154        #[allow(clippy::single_element_loop)]
12155        for &(find_this, param_name) in [("{+name}", "name")].iter() {
12156            url = params.uri_replacement(url, param_name, find_this, true);
12157        }
12158        {
12159            let to_remove = ["name"];
12160            params.remove_params(&to_remove);
12161        }
12162
12163        let url = params.parse_with_url(&url);
12164
12165        let mut json_mime_type = mime::APPLICATION_JSON;
12166        let mut request_value_reader = {
12167            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
12168            common::remove_json_null_values(&mut value);
12169            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
12170            serde_json::to_writer(&mut dst, &value).unwrap();
12171            dst
12172        };
12173        let request_size = request_value_reader
12174            .seek(std::io::SeekFrom::End(0))
12175            .unwrap();
12176        request_value_reader
12177            .seek(std::io::SeekFrom::Start(0))
12178            .unwrap();
12179
12180        loop {
12181            let token = match self
12182                .hub
12183                .auth
12184                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
12185                .await
12186            {
12187                Ok(token) => token,
12188                Err(e) => match dlg.token(e) {
12189                    Ok(token) => token,
12190                    Err(e) => {
12191                        dlg.finished(false);
12192                        return Err(common::Error::MissingToken(e));
12193                    }
12194                },
12195            };
12196            request_value_reader
12197                .seek(std::io::SeekFrom::Start(0))
12198                .unwrap();
12199            let mut req_result = {
12200                let client = &self.hub.client;
12201                dlg.pre_request();
12202                let mut req_builder = hyper::Request::builder()
12203                    .method(hyper::Method::PATCH)
12204                    .uri(url.as_str())
12205                    .header(USER_AGENT, self.hub._user_agent.clone());
12206
12207                if let Some(token) = token.as_ref() {
12208                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
12209                }
12210
12211                let request = req_builder
12212                    .header(CONTENT_TYPE, json_mime_type.to_string())
12213                    .header(CONTENT_LENGTH, request_size as u64)
12214                    .body(common::to_body(
12215                        request_value_reader.get_ref().clone().into(),
12216                    ));
12217
12218                client.request(request.unwrap()).await
12219            };
12220
12221            match req_result {
12222                Err(err) => {
12223                    if let common::Retry::After(d) = dlg.http_error(&err) {
12224                        sleep(d).await;
12225                        continue;
12226                    }
12227                    dlg.finished(false);
12228                    return Err(common::Error::HttpError(err));
12229                }
12230                Ok(res) => {
12231                    let (mut parts, body) = res.into_parts();
12232                    let mut body = common::Body::new(body);
12233                    if !parts.status.is_success() {
12234                        let bytes = common::to_bytes(body).await.unwrap_or_default();
12235                        let error = serde_json::from_str(&common::to_string(&bytes));
12236                        let response = common::to_response(parts, bytes.into());
12237
12238                        if let common::Retry::After(d) =
12239                            dlg.http_failure(&response, error.as_ref().ok())
12240                        {
12241                            sleep(d).await;
12242                            continue;
12243                        }
12244
12245                        dlg.finished(false);
12246
12247                        return Err(match error {
12248                            Ok(value) => common::Error::BadRequest(value),
12249                            _ => common::Error::Failure(response),
12250                        });
12251                    }
12252                    let response = {
12253                        let bytes = common::to_bytes(body).await.unwrap_or_default();
12254                        let encoded = common::to_string(&bytes);
12255                        match serde_json::from_str(&encoded) {
12256                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
12257                            Err(error) => {
12258                                dlg.response_json_decode_error(&encoded, &error);
12259                                return Err(common::Error::JsonDecodeError(
12260                                    encoded.to_string(),
12261                                    error,
12262                                ));
12263                            }
12264                        }
12265                    };
12266
12267                    dlg.finished(true);
12268                    return Ok(response);
12269                }
12270            }
12271        }
12272    }
12273
12274    ///
12275    /// Sets the *request* property to the given value.
12276    ///
12277    /// Even though the property as already been set when instantiating this call,
12278    /// we provide this method for API completeness.
12279    pub fn request(
12280        mut self,
12281        new_value: LDAPSSettings,
12282    ) -> ProjectLocationGlobalDomainUpdateLdapssettingCall<'a, C> {
12283        self._request = new_value;
12284        self
12285    }
12286    /// The resource name of the LDAPS settings. Uses the form: `projects/{project}/locations/{location}/domains/{domain}`.
12287    ///
12288    /// Sets the *name* path property to the given value.
12289    ///
12290    /// Even though the property as already been set when instantiating this call,
12291    /// we provide this method for API completeness.
12292    pub fn name(
12293        mut self,
12294        new_value: &str,
12295    ) -> ProjectLocationGlobalDomainUpdateLdapssettingCall<'a, C> {
12296        self._name = new_value.to_string();
12297        self
12298    }
12299    /// Required. Mask of fields to update. At least one path must be supplied in this field. For the `FieldMask` definition, see https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask
12300    ///
12301    /// Sets the *update mask* query property to the given value.
12302    pub fn update_mask(
12303        mut self,
12304        new_value: common::FieldMask,
12305    ) -> ProjectLocationGlobalDomainUpdateLdapssettingCall<'a, C> {
12306        self._update_mask = Some(new_value);
12307        self
12308    }
12309    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
12310    /// while executing the actual API request.
12311    ///
12312    /// ````text
12313    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
12314    /// ````
12315    ///
12316    /// Sets the *delegate* property to the given value.
12317    pub fn delegate(
12318        mut self,
12319        new_value: &'a mut dyn common::Delegate,
12320    ) -> ProjectLocationGlobalDomainUpdateLdapssettingCall<'a, C> {
12321        self._delegate = Some(new_value);
12322        self
12323    }
12324
12325    /// Set any additional parameter of the query string used in the request.
12326    /// It should be used to set parameters which are not yet available through their own
12327    /// setters.
12328    ///
12329    /// Please note that this method must not be used to set any of the known parameters
12330    /// which have their own setter method. If done anyway, the request will fail.
12331    ///
12332    /// # Additional Parameters
12333    ///
12334    /// * *$.xgafv* (query-string) - V1 error format.
12335    /// * *access_token* (query-string) - OAuth access token.
12336    /// * *alt* (query-string) - Data format for response.
12337    /// * *callback* (query-string) - JSONP
12338    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
12339    /// * *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.
12340    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
12341    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
12342    /// * *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.
12343    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
12344    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
12345    pub fn param<T>(
12346        mut self,
12347        name: T,
12348        value: T,
12349    ) -> ProjectLocationGlobalDomainUpdateLdapssettingCall<'a, C>
12350    where
12351        T: AsRef<str>,
12352    {
12353        self._additional_params
12354            .insert(name.as_ref().to_string(), value.as_ref().to_string());
12355        self
12356    }
12357
12358    /// Identifies the authorization scope for the method you are building.
12359    ///
12360    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
12361    /// [`Scope::CloudPlatform`].
12362    ///
12363    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
12364    /// tokens for more than one scope.
12365    ///
12366    /// Usually there is more than one suitable scope to authorize an operation, some of which may
12367    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
12368    /// sufficient, a read-write scope will do as well.
12369    pub fn add_scope<St>(
12370        mut self,
12371        scope: St,
12372    ) -> ProjectLocationGlobalDomainUpdateLdapssettingCall<'a, C>
12373    where
12374        St: AsRef<str>,
12375    {
12376        self._scopes.insert(String::from(scope.as_ref()));
12377        self
12378    }
12379    /// Identifies the authorization scope(s) for the method you are building.
12380    ///
12381    /// See [`Self::add_scope()`] for details.
12382    pub fn add_scopes<I, St>(
12383        mut self,
12384        scopes: I,
12385    ) -> ProjectLocationGlobalDomainUpdateLdapssettingCall<'a, C>
12386    where
12387        I: IntoIterator<Item = St>,
12388        St: AsRef<str>,
12389    {
12390        self._scopes
12391            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
12392        self
12393    }
12394
12395    /// Removes all scopes, and no default scope will be used either.
12396    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
12397    /// for details).
12398    pub fn clear_scopes(mut self) -> ProjectLocationGlobalDomainUpdateLdapssettingCall<'a, C> {
12399        self._scopes.clear();
12400        self
12401    }
12402}
12403
12404/// Validates a trust state, that the target domain is reachable, and that the target domain is able to accept incoming trust requests.
12405///
12406/// A builder for the *locations.global.domains.validateTrust* method supported by a *project* resource.
12407/// It is not used directly, but through a [`ProjectMethods`] instance.
12408///
12409/// # Example
12410///
12411/// Instantiate a resource method builder
12412///
12413/// ```test_harness,no_run
12414/// # extern crate hyper;
12415/// # extern crate hyper_rustls;
12416/// # extern crate google_managedidentities1 as managedidentities1;
12417/// use managedidentities1::api::ValidateTrustRequest;
12418/// # async fn dox() {
12419/// # use managedidentities1::{ManagedServiceForMicrosoftActiveDirectoryConsumerAPI, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
12420///
12421/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
12422/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
12423/// #     .with_native_roots()
12424/// #     .unwrap()
12425/// #     .https_only()
12426/// #     .enable_http2()
12427/// #     .build();
12428///
12429/// # let executor = hyper_util::rt::TokioExecutor::new();
12430/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
12431/// #     secret,
12432/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
12433/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
12434/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
12435/// #     ),
12436/// # ).build().await.unwrap();
12437///
12438/// # let client = hyper_util::client::legacy::Client::builder(
12439/// #     hyper_util::rt::TokioExecutor::new()
12440/// # )
12441/// # .build(
12442/// #     hyper_rustls::HttpsConnectorBuilder::new()
12443/// #         .with_native_roots()
12444/// #         .unwrap()
12445/// #         .https_or_http()
12446/// #         .enable_http2()
12447/// #         .build()
12448/// # );
12449/// # let mut hub = ManagedServiceForMicrosoftActiveDirectoryConsumerAPI::new(client, auth);
12450/// // As the method needs a request, you would usually fill it with the desired information
12451/// // into the respective structure. Some of the parts shown here might not be applicable !
12452/// // Values shown here are possibly random and not representative !
12453/// let mut req = ValidateTrustRequest::default();
12454///
12455/// // You can configure optional parameters by calling the respective setters at will, and
12456/// // execute the final call using `doit()`.
12457/// // Values shown here are possibly random and not representative !
12458/// let result = hub.projects().locations_global_domains_validate_trust(req, "name")
12459///              .doit().await;
12460/// # }
12461/// ```
12462pub struct ProjectLocationGlobalDomainValidateTrustCall<'a, C>
12463where
12464    C: 'a,
12465{
12466    hub: &'a ManagedServiceForMicrosoftActiveDirectoryConsumerAPI<C>,
12467    _request: ValidateTrustRequest,
12468    _name: String,
12469    _delegate: Option<&'a mut dyn common::Delegate>,
12470    _additional_params: HashMap<String, String>,
12471    _scopes: BTreeSet<String>,
12472}
12473
12474impl<'a, C> common::CallBuilder for ProjectLocationGlobalDomainValidateTrustCall<'a, C> {}
12475
12476impl<'a, C> ProjectLocationGlobalDomainValidateTrustCall<'a, C>
12477where
12478    C: common::Connector,
12479{
12480    /// Perform the operation you have build so far.
12481    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
12482        use std::borrow::Cow;
12483        use std::io::{Read, Seek};
12484
12485        use common::{url::Params, ToParts};
12486        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
12487
12488        let mut dd = common::DefaultDelegate;
12489        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
12490        dlg.begin(common::MethodInfo {
12491            id: "managedidentities.projects.locations.global.domains.validateTrust",
12492            http_method: hyper::Method::POST,
12493        });
12494
12495        for &field in ["alt", "name"].iter() {
12496            if self._additional_params.contains_key(field) {
12497                dlg.finished(false);
12498                return Err(common::Error::FieldClash(field));
12499            }
12500        }
12501
12502        let mut params = Params::with_capacity(4 + self._additional_params.len());
12503        params.push("name", self._name);
12504
12505        params.extend(self._additional_params.iter());
12506
12507        params.push("alt", "json");
12508        let mut url = self.hub._base_url.clone() + "v1/{+name}:validateTrust";
12509        if self._scopes.is_empty() {
12510            self._scopes
12511                .insert(Scope::CloudPlatform.as_ref().to_string());
12512        }
12513
12514        #[allow(clippy::single_element_loop)]
12515        for &(find_this, param_name) in [("{+name}", "name")].iter() {
12516            url = params.uri_replacement(url, param_name, find_this, true);
12517        }
12518        {
12519            let to_remove = ["name"];
12520            params.remove_params(&to_remove);
12521        }
12522
12523        let url = params.parse_with_url(&url);
12524
12525        let mut json_mime_type = mime::APPLICATION_JSON;
12526        let mut request_value_reader = {
12527            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
12528            common::remove_json_null_values(&mut value);
12529            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
12530            serde_json::to_writer(&mut dst, &value).unwrap();
12531            dst
12532        };
12533        let request_size = request_value_reader
12534            .seek(std::io::SeekFrom::End(0))
12535            .unwrap();
12536        request_value_reader
12537            .seek(std::io::SeekFrom::Start(0))
12538            .unwrap();
12539
12540        loop {
12541            let token = match self
12542                .hub
12543                .auth
12544                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
12545                .await
12546            {
12547                Ok(token) => token,
12548                Err(e) => match dlg.token(e) {
12549                    Ok(token) => token,
12550                    Err(e) => {
12551                        dlg.finished(false);
12552                        return Err(common::Error::MissingToken(e));
12553                    }
12554                },
12555            };
12556            request_value_reader
12557                .seek(std::io::SeekFrom::Start(0))
12558                .unwrap();
12559            let mut req_result = {
12560                let client = &self.hub.client;
12561                dlg.pre_request();
12562                let mut req_builder = hyper::Request::builder()
12563                    .method(hyper::Method::POST)
12564                    .uri(url.as_str())
12565                    .header(USER_AGENT, self.hub._user_agent.clone());
12566
12567                if let Some(token) = token.as_ref() {
12568                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
12569                }
12570
12571                let request = req_builder
12572                    .header(CONTENT_TYPE, json_mime_type.to_string())
12573                    .header(CONTENT_LENGTH, request_size as u64)
12574                    .body(common::to_body(
12575                        request_value_reader.get_ref().clone().into(),
12576                    ));
12577
12578                client.request(request.unwrap()).await
12579            };
12580
12581            match req_result {
12582                Err(err) => {
12583                    if let common::Retry::After(d) = dlg.http_error(&err) {
12584                        sleep(d).await;
12585                        continue;
12586                    }
12587                    dlg.finished(false);
12588                    return Err(common::Error::HttpError(err));
12589                }
12590                Ok(res) => {
12591                    let (mut parts, body) = res.into_parts();
12592                    let mut body = common::Body::new(body);
12593                    if !parts.status.is_success() {
12594                        let bytes = common::to_bytes(body).await.unwrap_or_default();
12595                        let error = serde_json::from_str(&common::to_string(&bytes));
12596                        let response = common::to_response(parts, bytes.into());
12597
12598                        if let common::Retry::After(d) =
12599                            dlg.http_failure(&response, error.as_ref().ok())
12600                        {
12601                            sleep(d).await;
12602                            continue;
12603                        }
12604
12605                        dlg.finished(false);
12606
12607                        return Err(match error {
12608                            Ok(value) => common::Error::BadRequest(value),
12609                            _ => common::Error::Failure(response),
12610                        });
12611                    }
12612                    let response = {
12613                        let bytes = common::to_bytes(body).await.unwrap_or_default();
12614                        let encoded = common::to_string(&bytes);
12615                        match serde_json::from_str(&encoded) {
12616                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
12617                            Err(error) => {
12618                                dlg.response_json_decode_error(&encoded, &error);
12619                                return Err(common::Error::JsonDecodeError(
12620                                    encoded.to_string(),
12621                                    error,
12622                                ));
12623                            }
12624                        }
12625                    };
12626
12627                    dlg.finished(true);
12628                    return Ok(response);
12629                }
12630            }
12631        }
12632    }
12633
12634    ///
12635    /// Sets the *request* property to the given value.
12636    ///
12637    /// Even though the property as already been set when instantiating this call,
12638    /// we provide this method for API completeness.
12639    pub fn request(
12640        mut self,
12641        new_value: ValidateTrustRequest,
12642    ) -> ProjectLocationGlobalDomainValidateTrustCall<'a, C> {
12643        self._request = new_value;
12644        self
12645    }
12646    /// Required. The resource domain name, project name, and location using the form: `projects/{project_id}/locations/global/domains/{domain_name}`
12647    ///
12648    /// Sets the *name* path property to the given value.
12649    ///
12650    /// Even though the property as already been set when instantiating this call,
12651    /// we provide this method for API completeness.
12652    pub fn name(mut self, new_value: &str) -> ProjectLocationGlobalDomainValidateTrustCall<'a, C> {
12653        self._name = new_value.to_string();
12654        self
12655    }
12656    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
12657    /// while executing the actual API request.
12658    ///
12659    /// ````text
12660    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
12661    /// ````
12662    ///
12663    /// Sets the *delegate* property to the given value.
12664    pub fn delegate(
12665        mut self,
12666        new_value: &'a mut dyn common::Delegate,
12667    ) -> ProjectLocationGlobalDomainValidateTrustCall<'a, C> {
12668        self._delegate = Some(new_value);
12669        self
12670    }
12671
12672    /// Set any additional parameter of the query string used in the request.
12673    /// It should be used to set parameters which are not yet available through their own
12674    /// setters.
12675    ///
12676    /// Please note that this method must not be used to set any of the known parameters
12677    /// which have their own setter method. If done anyway, the request will fail.
12678    ///
12679    /// # Additional Parameters
12680    ///
12681    /// * *$.xgafv* (query-string) - V1 error format.
12682    /// * *access_token* (query-string) - OAuth access token.
12683    /// * *alt* (query-string) - Data format for response.
12684    /// * *callback* (query-string) - JSONP
12685    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
12686    /// * *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.
12687    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
12688    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
12689    /// * *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.
12690    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
12691    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
12692    pub fn param<T>(
12693        mut self,
12694        name: T,
12695        value: T,
12696    ) -> ProjectLocationGlobalDomainValidateTrustCall<'a, C>
12697    where
12698        T: AsRef<str>,
12699    {
12700        self._additional_params
12701            .insert(name.as_ref().to_string(), value.as_ref().to_string());
12702        self
12703    }
12704
12705    /// Identifies the authorization scope for the method you are building.
12706    ///
12707    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
12708    /// [`Scope::CloudPlatform`].
12709    ///
12710    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
12711    /// tokens for more than one scope.
12712    ///
12713    /// Usually there is more than one suitable scope to authorize an operation, some of which may
12714    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
12715    /// sufficient, a read-write scope will do as well.
12716    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationGlobalDomainValidateTrustCall<'a, C>
12717    where
12718        St: AsRef<str>,
12719    {
12720        self._scopes.insert(String::from(scope.as_ref()));
12721        self
12722    }
12723    /// Identifies the authorization scope(s) for the method you are building.
12724    ///
12725    /// See [`Self::add_scope()`] for details.
12726    pub fn add_scopes<I, St>(
12727        mut self,
12728        scopes: I,
12729    ) -> ProjectLocationGlobalDomainValidateTrustCall<'a, C>
12730    where
12731        I: IntoIterator<Item = St>,
12732        St: AsRef<str>,
12733    {
12734        self._scopes
12735            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
12736        self
12737    }
12738
12739    /// Removes all scopes, and no default scope will be used either.
12740    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
12741    /// for details).
12742    pub fn clear_scopes(mut self) -> ProjectLocationGlobalDomainValidateTrustCall<'a, C> {
12743        self._scopes.clear();
12744        self
12745    }
12746}
12747
12748/// 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`.
12749///
12750/// A builder for the *locations.global.operations.cancel* method supported by a *project* resource.
12751/// It is not used directly, but through a [`ProjectMethods`] instance.
12752///
12753/// # Example
12754///
12755/// Instantiate a resource method builder
12756///
12757/// ```test_harness,no_run
12758/// # extern crate hyper;
12759/// # extern crate hyper_rustls;
12760/// # extern crate google_managedidentities1 as managedidentities1;
12761/// use managedidentities1::api::CancelOperationRequest;
12762/// # async fn dox() {
12763/// # use managedidentities1::{ManagedServiceForMicrosoftActiveDirectoryConsumerAPI, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
12764///
12765/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
12766/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
12767/// #     .with_native_roots()
12768/// #     .unwrap()
12769/// #     .https_only()
12770/// #     .enable_http2()
12771/// #     .build();
12772///
12773/// # let executor = hyper_util::rt::TokioExecutor::new();
12774/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
12775/// #     secret,
12776/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
12777/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
12778/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
12779/// #     ),
12780/// # ).build().await.unwrap();
12781///
12782/// # let client = hyper_util::client::legacy::Client::builder(
12783/// #     hyper_util::rt::TokioExecutor::new()
12784/// # )
12785/// # .build(
12786/// #     hyper_rustls::HttpsConnectorBuilder::new()
12787/// #         .with_native_roots()
12788/// #         .unwrap()
12789/// #         .https_or_http()
12790/// #         .enable_http2()
12791/// #         .build()
12792/// # );
12793/// # let mut hub = ManagedServiceForMicrosoftActiveDirectoryConsumerAPI::new(client, auth);
12794/// // As the method needs a request, you would usually fill it with the desired information
12795/// // into the respective structure. Some of the parts shown here might not be applicable !
12796/// // Values shown here are possibly random and not representative !
12797/// let mut req = CancelOperationRequest::default();
12798///
12799/// // You can configure optional parameters by calling the respective setters at will, and
12800/// // execute the final call using `doit()`.
12801/// // Values shown here are possibly random and not representative !
12802/// let result = hub.projects().locations_global_operations_cancel(req, "name")
12803///              .doit().await;
12804/// # }
12805/// ```
12806pub struct ProjectLocationGlobalOperationCancelCall<'a, C>
12807where
12808    C: 'a,
12809{
12810    hub: &'a ManagedServiceForMicrosoftActiveDirectoryConsumerAPI<C>,
12811    _request: CancelOperationRequest,
12812    _name: String,
12813    _delegate: Option<&'a mut dyn common::Delegate>,
12814    _additional_params: HashMap<String, String>,
12815    _scopes: BTreeSet<String>,
12816}
12817
12818impl<'a, C> common::CallBuilder for ProjectLocationGlobalOperationCancelCall<'a, C> {}
12819
12820impl<'a, C> ProjectLocationGlobalOperationCancelCall<'a, C>
12821where
12822    C: common::Connector,
12823{
12824    /// Perform the operation you have build so far.
12825    pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
12826        use std::borrow::Cow;
12827        use std::io::{Read, Seek};
12828
12829        use common::{url::Params, ToParts};
12830        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
12831
12832        let mut dd = common::DefaultDelegate;
12833        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
12834        dlg.begin(common::MethodInfo {
12835            id: "managedidentities.projects.locations.global.operations.cancel",
12836            http_method: hyper::Method::POST,
12837        });
12838
12839        for &field in ["alt", "name"].iter() {
12840            if self._additional_params.contains_key(field) {
12841                dlg.finished(false);
12842                return Err(common::Error::FieldClash(field));
12843            }
12844        }
12845
12846        let mut params = Params::with_capacity(4 + self._additional_params.len());
12847        params.push("name", self._name);
12848
12849        params.extend(self._additional_params.iter());
12850
12851        params.push("alt", "json");
12852        let mut url = self.hub._base_url.clone() + "v1/{+name}:cancel";
12853        if self._scopes.is_empty() {
12854            self._scopes
12855                .insert(Scope::CloudPlatform.as_ref().to_string());
12856        }
12857
12858        #[allow(clippy::single_element_loop)]
12859        for &(find_this, param_name) in [("{+name}", "name")].iter() {
12860            url = params.uri_replacement(url, param_name, find_this, true);
12861        }
12862        {
12863            let to_remove = ["name"];
12864            params.remove_params(&to_remove);
12865        }
12866
12867        let url = params.parse_with_url(&url);
12868
12869        let mut json_mime_type = mime::APPLICATION_JSON;
12870        let mut request_value_reader = {
12871            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
12872            common::remove_json_null_values(&mut value);
12873            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
12874            serde_json::to_writer(&mut dst, &value).unwrap();
12875            dst
12876        };
12877        let request_size = request_value_reader
12878            .seek(std::io::SeekFrom::End(0))
12879            .unwrap();
12880        request_value_reader
12881            .seek(std::io::SeekFrom::Start(0))
12882            .unwrap();
12883
12884        loop {
12885            let token = match self
12886                .hub
12887                .auth
12888                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
12889                .await
12890            {
12891                Ok(token) => token,
12892                Err(e) => match dlg.token(e) {
12893                    Ok(token) => token,
12894                    Err(e) => {
12895                        dlg.finished(false);
12896                        return Err(common::Error::MissingToken(e));
12897                    }
12898                },
12899            };
12900            request_value_reader
12901                .seek(std::io::SeekFrom::Start(0))
12902                .unwrap();
12903            let mut req_result = {
12904                let client = &self.hub.client;
12905                dlg.pre_request();
12906                let mut req_builder = hyper::Request::builder()
12907                    .method(hyper::Method::POST)
12908                    .uri(url.as_str())
12909                    .header(USER_AGENT, self.hub._user_agent.clone());
12910
12911                if let Some(token) = token.as_ref() {
12912                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
12913                }
12914
12915                let request = req_builder
12916                    .header(CONTENT_TYPE, json_mime_type.to_string())
12917                    .header(CONTENT_LENGTH, request_size as u64)
12918                    .body(common::to_body(
12919                        request_value_reader.get_ref().clone().into(),
12920                    ));
12921
12922                client.request(request.unwrap()).await
12923            };
12924
12925            match req_result {
12926                Err(err) => {
12927                    if let common::Retry::After(d) = dlg.http_error(&err) {
12928                        sleep(d).await;
12929                        continue;
12930                    }
12931                    dlg.finished(false);
12932                    return Err(common::Error::HttpError(err));
12933                }
12934                Ok(res) => {
12935                    let (mut parts, body) = res.into_parts();
12936                    let mut body = common::Body::new(body);
12937                    if !parts.status.is_success() {
12938                        let bytes = common::to_bytes(body).await.unwrap_or_default();
12939                        let error = serde_json::from_str(&common::to_string(&bytes));
12940                        let response = common::to_response(parts, bytes.into());
12941
12942                        if let common::Retry::After(d) =
12943                            dlg.http_failure(&response, error.as_ref().ok())
12944                        {
12945                            sleep(d).await;
12946                            continue;
12947                        }
12948
12949                        dlg.finished(false);
12950
12951                        return Err(match error {
12952                            Ok(value) => common::Error::BadRequest(value),
12953                            _ => common::Error::Failure(response),
12954                        });
12955                    }
12956                    let response = {
12957                        let bytes = common::to_bytes(body).await.unwrap_or_default();
12958                        let encoded = common::to_string(&bytes);
12959                        match serde_json::from_str(&encoded) {
12960                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
12961                            Err(error) => {
12962                                dlg.response_json_decode_error(&encoded, &error);
12963                                return Err(common::Error::JsonDecodeError(
12964                                    encoded.to_string(),
12965                                    error,
12966                                ));
12967                            }
12968                        }
12969                    };
12970
12971                    dlg.finished(true);
12972                    return Ok(response);
12973                }
12974            }
12975        }
12976    }
12977
12978    ///
12979    /// Sets the *request* property to the given value.
12980    ///
12981    /// Even though the property as already been set when instantiating this call,
12982    /// we provide this method for API completeness.
12983    pub fn request(
12984        mut self,
12985        new_value: CancelOperationRequest,
12986    ) -> ProjectLocationGlobalOperationCancelCall<'a, C> {
12987        self._request = new_value;
12988        self
12989    }
12990    /// The name of the operation resource to be cancelled.
12991    ///
12992    /// Sets the *name* path property to the given value.
12993    ///
12994    /// Even though the property as already been set when instantiating this call,
12995    /// we provide this method for API completeness.
12996    pub fn name(mut self, new_value: &str) -> ProjectLocationGlobalOperationCancelCall<'a, C> {
12997        self._name = new_value.to_string();
12998        self
12999    }
13000    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
13001    /// while executing the actual API request.
13002    ///
13003    /// ````text
13004    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
13005    /// ````
13006    ///
13007    /// Sets the *delegate* property to the given value.
13008    pub fn delegate(
13009        mut self,
13010        new_value: &'a mut dyn common::Delegate,
13011    ) -> ProjectLocationGlobalOperationCancelCall<'a, C> {
13012        self._delegate = Some(new_value);
13013        self
13014    }
13015
13016    /// Set any additional parameter of the query string used in the request.
13017    /// It should be used to set parameters which are not yet available through their own
13018    /// setters.
13019    ///
13020    /// Please note that this method must not be used to set any of the known parameters
13021    /// which have their own setter method. If done anyway, the request will fail.
13022    ///
13023    /// # Additional Parameters
13024    ///
13025    /// * *$.xgafv* (query-string) - V1 error format.
13026    /// * *access_token* (query-string) - OAuth access token.
13027    /// * *alt* (query-string) - Data format for response.
13028    /// * *callback* (query-string) - JSONP
13029    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
13030    /// * *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.
13031    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
13032    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
13033    /// * *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.
13034    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
13035    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
13036    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationGlobalOperationCancelCall<'a, C>
13037    where
13038        T: AsRef<str>,
13039    {
13040        self._additional_params
13041            .insert(name.as_ref().to_string(), value.as_ref().to_string());
13042        self
13043    }
13044
13045    /// Identifies the authorization scope for the method you are building.
13046    ///
13047    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
13048    /// [`Scope::CloudPlatform`].
13049    ///
13050    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
13051    /// tokens for more than one scope.
13052    ///
13053    /// Usually there is more than one suitable scope to authorize an operation, some of which may
13054    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
13055    /// sufficient, a read-write scope will do as well.
13056    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationGlobalOperationCancelCall<'a, C>
13057    where
13058        St: AsRef<str>,
13059    {
13060        self._scopes.insert(String::from(scope.as_ref()));
13061        self
13062    }
13063    /// Identifies the authorization scope(s) for the method you are building.
13064    ///
13065    /// See [`Self::add_scope()`] for details.
13066    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationGlobalOperationCancelCall<'a, C>
13067    where
13068        I: IntoIterator<Item = St>,
13069        St: AsRef<str>,
13070    {
13071        self._scopes
13072            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
13073        self
13074    }
13075
13076    /// Removes all scopes, and no default scope will be used either.
13077    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
13078    /// for details).
13079    pub fn clear_scopes(mut self) -> ProjectLocationGlobalOperationCancelCall<'a, C> {
13080        self._scopes.clear();
13081        self
13082    }
13083}
13084
13085/// 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`.
13086///
13087/// A builder for the *locations.global.operations.delete* method supported by a *project* resource.
13088/// It is not used directly, but through a [`ProjectMethods`] instance.
13089///
13090/// # Example
13091///
13092/// Instantiate a resource method builder
13093///
13094/// ```test_harness,no_run
13095/// # extern crate hyper;
13096/// # extern crate hyper_rustls;
13097/// # extern crate google_managedidentities1 as managedidentities1;
13098/// # async fn dox() {
13099/// # use managedidentities1::{ManagedServiceForMicrosoftActiveDirectoryConsumerAPI, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
13100///
13101/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
13102/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
13103/// #     .with_native_roots()
13104/// #     .unwrap()
13105/// #     .https_only()
13106/// #     .enable_http2()
13107/// #     .build();
13108///
13109/// # let executor = hyper_util::rt::TokioExecutor::new();
13110/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
13111/// #     secret,
13112/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
13113/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
13114/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
13115/// #     ),
13116/// # ).build().await.unwrap();
13117///
13118/// # let client = hyper_util::client::legacy::Client::builder(
13119/// #     hyper_util::rt::TokioExecutor::new()
13120/// # )
13121/// # .build(
13122/// #     hyper_rustls::HttpsConnectorBuilder::new()
13123/// #         .with_native_roots()
13124/// #         .unwrap()
13125/// #         .https_or_http()
13126/// #         .enable_http2()
13127/// #         .build()
13128/// # );
13129/// # let mut hub = ManagedServiceForMicrosoftActiveDirectoryConsumerAPI::new(client, auth);
13130/// // You can configure optional parameters by calling the respective setters at will, and
13131/// // execute the final call using `doit()`.
13132/// // Values shown here are possibly random and not representative !
13133/// let result = hub.projects().locations_global_operations_delete("name")
13134///              .doit().await;
13135/// # }
13136/// ```
13137pub struct ProjectLocationGlobalOperationDeleteCall<'a, C>
13138where
13139    C: 'a,
13140{
13141    hub: &'a ManagedServiceForMicrosoftActiveDirectoryConsumerAPI<C>,
13142    _name: String,
13143    _delegate: Option<&'a mut dyn common::Delegate>,
13144    _additional_params: HashMap<String, String>,
13145    _scopes: BTreeSet<String>,
13146}
13147
13148impl<'a, C> common::CallBuilder for ProjectLocationGlobalOperationDeleteCall<'a, C> {}
13149
13150impl<'a, C> ProjectLocationGlobalOperationDeleteCall<'a, C>
13151where
13152    C: common::Connector,
13153{
13154    /// Perform the operation you have build so far.
13155    pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
13156        use std::borrow::Cow;
13157        use std::io::{Read, Seek};
13158
13159        use common::{url::Params, ToParts};
13160        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
13161
13162        let mut dd = common::DefaultDelegate;
13163        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
13164        dlg.begin(common::MethodInfo {
13165            id: "managedidentities.projects.locations.global.operations.delete",
13166            http_method: hyper::Method::DELETE,
13167        });
13168
13169        for &field in ["alt", "name"].iter() {
13170            if self._additional_params.contains_key(field) {
13171                dlg.finished(false);
13172                return Err(common::Error::FieldClash(field));
13173            }
13174        }
13175
13176        let mut params = Params::with_capacity(3 + self._additional_params.len());
13177        params.push("name", self._name);
13178
13179        params.extend(self._additional_params.iter());
13180
13181        params.push("alt", "json");
13182        let mut url = self.hub._base_url.clone() + "v1/{+name}";
13183        if self._scopes.is_empty() {
13184            self._scopes
13185                .insert(Scope::CloudPlatform.as_ref().to_string());
13186        }
13187
13188        #[allow(clippy::single_element_loop)]
13189        for &(find_this, param_name) in [("{+name}", "name")].iter() {
13190            url = params.uri_replacement(url, param_name, find_this, true);
13191        }
13192        {
13193            let to_remove = ["name"];
13194            params.remove_params(&to_remove);
13195        }
13196
13197        let url = params.parse_with_url(&url);
13198
13199        loop {
13200            let token = match self
13201                .hub
13202                .auth
13203                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
13204                .await
13205            {
13206                Ok(token) => token,
13207                Err(e) => match dlg.token(e) {
13208                    Ok(token) => token,
13209                    Err(e) => {
13210                        dlg.finished(false);
13211                        return Err(common::Error::MissingToken(e));
13212                    }
13213                },
13214            };
13215            let mut req_result = {
13216                let client = &self.hub.client;
13217                dlg.pre_request();
13218                let mut req_builder = hyper::Request::builder()
13219                    .method(hyper::Method::DELETE)
13220                    .uri(url.as_str())
13221                    .header(USER_AGENT, self.hub._user_agent.clone());
13222
13223                if let Some(token) = token.as_ref() {
13224                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
13225                }
13226
13227                let request = req_builder
13228                    .header(CONTENT_LENGTH, 0_u64)
13229                    .body(common::to_body::<String>(None));
13230
13231                client.request(request.unwrap()).await
13232            };
13233
13234            match req_result {
13235                Err(err) => {
13236                    if let common::Retry::After(d) = dlg.http_error(&err) {
13237                        sleep(d).await;
13238                        continue;
13239                    }
13240                    dlg.finished(false);
13241                    return Err(common::Error::HttpError(err));
13242                }
13243                Ok(res) => {
13244                    let (mut parts, body) = res.into_parts();
13245                    let mut body = common::Body::new(body);
13246                    if !parts.status.is_success() {
13247                        let bytes = common::to_bytes(body).await.unwrap_or_default();
13248                        let error = serde_json::from_str(&common::to_string(&bytes));
13249                        let response = common::to_response(parts, bytes.into());
13250
13251                        if let common::Retry::After(d) =
13252                            dlg.http_failure(&response, error.as_ref().ok())
13253                        {
13254                            sleep(d).await;
13255                            continue;
13256                        }
13257
13258                        dlg.finished(false);
13259
13260                        return Err(match error {
13261                            Ok(value) => common::Error::BadRequest(value),
13262                            _ => common::Error::Failure(response),
13263                        });
13264                    }
13265                    let response = {
13266                        let bytes = common::to_bytes(body).await.unwrap_or_default();
13267                        let encoded = common::to_string(&bytes);
13268                        match serde_json::from_str(&encoded) {
13269                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
13270                            Err(error) => {
13271                                dlg.response_json_decode_error(&encoded, &error);
13272                                return Err(common::Error::JsonDecodeError(
13273                                    encoded.to_string(),
13274                                    error,
13275                                ));
13276                            }
13277                        }
13278                    };
13279
13280                    dlg.finished(true);
13281                    return Ok(response);
13282                }
13283            }
13284        }
13285    }
13286
13287    /// The name of the operation resource to be deleted.
13288    ///
13289    /// Sets the *name* path property to the given value.
13290    ///
13291    /// Even though the property as already been set when instantiating this call,
13292    /// we provide this method for API completeness.
13293    pub fn name(mut self, new_value: &str) -> ProjectLocationGlobalOperationDeleteCall<'a, C> {
13294        self._name = new_value.to_string();
13295        self
13296    }
13297    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
13298    /// while executing the actual API request.
13299    ///
13300    /// ````text
13301    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
13302    /// ````
13303    ///
13304    /// Sets the *delegate* property to the given value.
13305    pub fn delegate(
13306        mut self,
13307        new_value: &'a mut dyn common::Delegate,
13308    ) -> ProjectLocationGlobalOperationDeleteCall<'a, C> {
13309        self._delegate = Some(new_value);
13310        self
13311    }
13312
13313    /// Set any additional parameter of the query string used in the request.
13314    /// It should be used to set parameters which are not yet available through their own
13315    /// setters.
13316    ///
13317    /// Please note that this method must not be used to set any of the known parameters
13318    /// which have their own setter method. If done anyway, the request will fail.
13319    ///
13320    /// # Additional Parameters
13321    ///
13322    /// * *$.xgafv* (query-string) - V1 error format.
13323    /// * *access_token* (query-string) - OAuth access token.
13324    /// * *alt* (query-string) - Data format for response.
13325    /// * *callback* (query-string) - JSONP
13326    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
13327    /// * *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.
13328    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
13329    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
13330    /// * *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.
13331    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
13332    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
13333    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationGlobalOperationDeleteCall<'a, C>
13334    where
13335        T: AsRef<str>,
13336    {
13337        self._additional_params
13338            .insert(name.as_ref().to_string(), value.as_ref().to_string());
13339        self
13340    }
13341
13342    /// Identifies the authorization scope for the method you are building.
13343    ///
13344    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
13345    /// [`Scope::CloudPlatform`].
13346    ///
13347    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
13348    /// tokens for more than one scope.
13349    ///
13350    /// Usually there is more than one suitable scope to authorize an operation, some of which may
13351    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
13352    /// sufficient, a read-write scope will do as well.
13353    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationGlobalOperationDeleteCall<'a, C>
13354    where
13355        St: AsRef<str>,
13356    {
13357        self._scopes.insert(String::from(scope.as_ref()));
13358        self
13359    }
13360    /// Identifies the authorization scope(s) for the method you are building.
13361    ///
13362    /// See [`Self::add_scope()`] for details.
13363    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationGlobalOperationDeleteCall<'a, C>
13364    where
13365        I: IntoIterator<Item = St>,
13366        St: AsRef<str>,
13367    {
13368        self._scopes
13369            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
13370        self
13371    }
13372
13373    /// Removes all scopes, and no default scope will be used either.
13374    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
13375    /// for details).
13376    pub fn clear_scopes(mut self) -> ProjectLocationGlobalOperationDeleteCall<'a, C> {
13377        self._scopes.clear();
13378        self
13379    }
13380}
13381
13382/// 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.
13383///
13384/// A builder for the *locations.global.operations.get* method supported by a *project* resource.
13385/// It is not used directly, but through a [`ProjectMethods`] instance.
13386///
13387/// # Example
13388///
13389/// Instantiate a resource method builder
13390///
13391/// ```test_harness,no_run
13392/// # extern crate hyper;
13393/// # extern crate hyper_rustls;
13394/// # extern crate google_managedidentities1 as managedidentities1;
13395/// # async fn dox() {
13396/// # use managedidentities1::{ManagedServiceForMicrosoftActiveDirectoryConsumerAPI, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
13397///
13398/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
13399/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
13400/// #     .with_native_roots()
13401/// #     .unwrap()
13402/// #     .https_only()
13403/// #     .enable_http2()
13404/// #     .build();
13405///
13406/// # let executor = hyper_util::rt::TokioExecutor::new();
13407/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
13408/// #     secret,
13409/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
13410/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
13411/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
13412/// #     ),
13413/// # ).build().await.unwrap();
13414///
13415/// # let client = hyper_util::client::legacy::Client::builder(
13416/// #     hyper_util::rt::TokioExecutor::new()
13417/// # )
13418/// # .build(
13419/// #     hyper_rustls::HttpsConnectorBuilder::new()
13420/// #         .with_native_roots()
13421/// #         .unwrap()
13422/// #         .https_or_http()
13423/// #         .enable_http2()
13424/// #         .build()
13425/// # );
13426/// # let mut hub = ManagedServiceForMicrosoftActiveDirectoryConsumerAPI::new(client, auth);
13427/// // You can configure optional parameters by calling the respective setters at will, and
13428/// // execute the final call using `doit()`.
13429/// // Values shown here are possibly random and not representative !
13430/// let result = hub.projects().locations_global_operations_get("name")
13431///              .doit().await;
13432/// # }
13433/// ```
13434pub struct ProjectLocationGlobalOperationGetCall<'a, C>
13435where
13436    C: 'a,
13437{
13438    hub: &'a ManagedServiceForMicrosoftActiveDirectoryConsumerAPI<C>,
13439    _name: String,
13440    _delegate: Option<&'a mut dyn common::Delegate>,
13441    _additional_params: HashMap<String, String>,
13442    _scopes: BTreeSet<String>,
13443}
13444
13445impl<'a, C> common::CallBuilder for ProjectLocationGlobalOperationGetCall<'a, C> {}
13446
13447impl<'a, C> ProjectLocationGlobalOperationGetCall<'a, C>
13448where
13449    C: common::Connector,
13450{
13451    /// Perform the operation you have build so far.
13452    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
13453        use std::borrow::Cow;
13454        use std::io::{Read, Seek};
13455
13456        use common::{url::Params, ToParts};
13457        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
13458
13459        let mut dd = common::DefaultDelegate;
13460        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
13461        dlg.begin(common::MethodInfo {
13462            id: "managedidentities.projects.locations.global.operations.get",
13463            http_method: hyper::Method::GET,
13464        });
13465
13466        for &field in ["alt", "name"].iter() {
13467            if self._additional_params.contains_key(field) {
13468                dlg.finished(false);
13469                return Err(common::Error::FieldClash(field));
13470            }
13471        }
13472
13473        let mut params = Params::with_capacity(3 + self._additional_params.len());
13474        params.push("name", self._name);
13475
13476        params.extend(self._additional_params.iter());
13477
13478        params.push("alt", "json");
13479        let mut url = self.hub._base_url.clone() + "v1/{+name}";
13480        if self._scopes.is_empty() {
13481            self._scopes
13482                .insert(Scope::CloudPlatform.as_ref().to_string());
13483        }
13484
13485        #[allow(clippy::single_element_loop)]
13486        for &(find_this, param_name) in [("{+name}", "name")].iter() {
13487            url = params.uri_replacement(url, param_name, find_this, true);
13488        }
13489        {
13490            let to_remove = ["name"];
13491            params.remove_params(&to_remove);
13492        }
13493
13494        let url = params.parse_with_url(&url);
13495
13496        loop {
13497            let token = match self
13498                .hub
13499                .auth
13500                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
13501                .await
13502            {
13503                Ok(token) => token,
13504                Err(e) => match dlg.token(e) {
13505                    Ok(token) => token,
13506                    Err(e) => {
13507                        dlg.finished(false);
13508                        return Err(common::Error::MissingToken(e));
13509                    }
13510                },
13511            };
13512            let mut req_result = {
13513                let client = &self.hub.client;
13514                dlg.pre_request();
13515                let mut req_builder = hyper::Request::builder()
13516                    .method(hyper::Method::GET)
13517                    .uri(url.as_str())
13518                    .header(USER_AGENT, self.hub._user_agent.clone());
13519
13520                if let Some(token) = token.as_ref() {
13521                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
13522                }
13523
13524                let request = req_builder
13525                    .header(CONTENT_LENGTH, 0_u64)
13526                    .body(common::to_body::<String>(None));
13527
13528                client.request(request.unwrap()).await
13529            };
13530
13531            match req_result {
13532                Err(err) => {
13533                    if let common::Retry::After(d) = dlg.http_error(&err) {
13534                        sleep(d).await;
13535                        continue;
13536                    }
13537                    dlg.finished(false);
13538                    return Err(common::Error::HttpError(err));
13539                }
13540                Ok(res) => {
13541                    let (mut parts, body) = res.into_parts();
13542                    let mut body = common::Body::new(body);
13543                    if !parts.status.is_success() {
13544                        let bytes = common::to_bytes(body).await.unwrap_or_default();
13545                        let error = serde_json::from_str(&common::to_string(&bytes));
13546                        let response = common::to_response(parts, bytes.into());
13547
13548                        if let common::Retry::After(d) =
13549                            dlg.http_failure(&response, error.as_ref().ok())
13550                        {
13551                            sleep(d).await;
13552                            continue;
13553                        }
13554
13555                        dlg.finished(false);
13556
13557                        return Err(match error {
13558                            Ok(value) => common::Error::BadRequest(value),
13559                            _ => common::Error::Failure(response),
13560                        });
13561                    }
13562                    let response = {
13563                        let bytes = common::to_bytes(body).await.unwrap_or_default();
13564                        let encoded = common::to_string(&bytes);
13565                        match serde_json::from_str(&encoded) {
13566                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
13567                            Err(error) => {
13568                                dlg.response_json_decode_error(&encoded, &error);
13569                                return Err(common::Error::JsonDecodeError(
13570                                    encoded.to_string(),
13571                                    error,
13572                                ));
13573                            }
13574                        }
13575                    };
13576
13577                    dlg.finished(true);
13578                    return Ok(response);
13579                }
13580            }
13581        }
13582    }
13583
13584    /// The name of the operation resource.
13585    ///
13586    /// Sets the *name* path property to the given value.
13587    ///
13588    /// Even though the property as already been set when instantiating this call,
13589    /// we provide this method for API completeness.
13590    pub fn name(mut self, new_value: &str) -> ProjectLocationGlobalOperationGetCall<'a, C> {
13591        self._name = new_value.to_string();
13592        self
13593    }
13594    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
13595    /// while executing the actual API request.
13596    ///
13597    /// ````text
13598    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
13599    /// ````
13600    ///
13601    /// Sets the *delegate* property to the given value.
13602    pub fn delegate(
13603        mut self,
13604        new_value: &'a mut dyn common::Delegate,
13605    ) -> ProjectLocationGlobalOperationGetCall<'a, C> {
13606        self._delegate = Some(new_value);
13607        self
13608    }
13609
13610    /// Set any additional parameter of the query string used in the request.
13611    /// It should be used to set parameters which are not yet available through their own
13612    /// setters.
13613    ///
13614    /// Please note that this method must not be used to set any of the known parameters
13615    /// which have their own setter method. If done anyway, the request will fail.
13616    ///
13617    /// # Additional Parameters
13618    ///
13619    /// * *$.xgafv* (query-string) - V1 error format.
13620    /// * *access_token* (query-string) - OAuth access token.
13621    /// * *alt* (query-string) - Data format for response.
13622    /// * *callback* (query-string) - JSONP
13623    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
13624    /// * *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.
13625    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
13626    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
13627    /// * *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.
13628    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
13629    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
13630    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationGlobalOperationGetCall<'a, C>
13631    where
13632        T: AsRef<str>,
13633    {
13634        self._additional_params
13635            .insert(name.as_ref().to_string(), value.as_ref().to_string());
13636        self
13637    }
13638
13639    /// Identifies the authorization scope for the method you are building.
13640    ///
13641    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
13642    /// [`Scope::CloudPlatform`].
13643    ///
13644    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
13645    /// tokens for more than one scope.
13646    ///
13647    /// Usually there is more than one suitable scope to authorize an operation, some of which may
13648    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
13649    /// sufficient, a read-write scope will do as well.
13650    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationGlobalOperationGetCall<'a, C>
13651    where
13652        St: AsRef<str>,
13653    {
13654        self._scopes.insert(String::from(scope.as_ref()));
13655        self
13656    }
13657    /// Identifies the authorization scope(s) for the method you are building.
13658    ///
13659    /// See [`Self::add_scope()`] for details.
13660    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationGlobalOperationGetCall<'a, C>
13661    where
13662        I: IntoIterator<Item = St>,
13663        St: AsRef<str>,
13664    {
13665        self._scopes
13666            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
13667        self
13668    }
13669
13670    /// Removes all scopes, and no default scope will be used either.
13671    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
13672    /// for details).
13673    pub fn clear_scopes(mut self) -> ProjectLocationGlobalOperationGetCall<'a, C> {
13674        self._scopes.clear();
13675        self
13676    }
13677}
13678
13679/// Lists operations that match the specified filter in the request. If the server doesn't support this method, it returns `UNIMPLEMENTED`.
13680///
13681/// A builder for the *locations.global.operations.list* method supported by a *project* resource.
13682/// It is not used directly, but through a [`ProjectMethods`] instance.
13683///
13684/// # Example
13685///
13686/// Instantiate a resource method builder
13687///
13688/// ```test_harness,no_run
13689/// # extern crate hyper;
13690/// # extern crate hyper_rustls;
13691/// # extern crate google_managedidentities1 as managedidentities1;
13692/// # async fn dox() {
13693/// # use managedidentities1::{ManagedServiceForMicrosoftActiveDirectoryConsumerAPI, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
13694///
13695/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
13696/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
13697/// #     .with_native_roots()
13698/// #     .unwrap()
13699/// #     .https_only()
13700/// #     .enable_http2()
13701/// #     .build();
13702///
13703/// # let executor = hyper_util::rt::TokioExecutor::new();
13704/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
13705/// #     secret,
13706/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
13707/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
13708/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
13709/// #     ),
13710/// # ).build().await.unwrap();
13711///
13712/// # let client = hyper_util::client::legacy::Client::builder(
13713/// #     hyper_util::rt::TokioExecutor::new()
13714/// # )
13715/// # .build(
13716/// #     hyper_rustls::HttpsConnectorBuilder::new()
13717/// #         .with_native_roots()
13718/// #         .unwrap()
13719/// #         .https_or_http()
13720/// #         .enable_http2()
13721/// #         .build()
13722/// # );
13723/// # let mut hub = ManagedServiceForMicrosoftActiveDirectoryConsumerAPI::new(client, auth);
13724/// // You can configure optional parameters by calling the respective setters at will, and
13725/// // execute the final call using `doit()`.
13726/// // Values shown here are possibly random and not representative !
13727/// let result = hub.projects().locations_global_operations_list("name")
13728///              .page_token("diam")
13729///              .page_size(-49)
13730///              .filter("et")
13731///              .doit().await;
13732/// # }
13733/// ```
13734pub struct ProjectLocationGlobalOperationListCall<'a, C>
13735where
13736    C: 'a,
13737{
13738    hub: &'a ManagedServiceForMicrosoftActiveDirectoryConsumerAPI<C>,
13739    _name: String,
13740    _page_token: Option<String>,
13741    _page_size: Option<i32>,
13742    _filter: Option<String>,
13743    _delegate: Option<&'a mut dyn common::Delegate>,
13744    _additional_params: HashMap<String, String>,
13745    _scopes: BTreeSet<String>,
13746}
13747
13748impl<'a, C> common::CallBuilder for ProjectLocationGlobalOperationListCall<'a, C> {}
13749
13750impl<'a, C> ProjectLocationGlobalOperationListCall<'a, C>
13751where
13752    C: common::Connector,
13753{
13754    /// Perform the operation you have build so far.
13755    pub async fn doit(mut self) -> common::Result<(common::Response, ListOperationsResponse)> {
13756        use std::borrow::Cow;
13757        use std::io::{Read, Seek};
13758
13759        use common::{url::Params, ToParts};
13760        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
13761
13762        let mut dd = common::DefaultDelegate;
13763        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
13764        dlg.begin(common::MethodInfo {
13765            id: "managedidentities.projects.locations.global.operations.list",
13766            http_method: hyper::Method::GET,
13767        });
13768
13769        for &field in ["alt", "name", "pageToken", "pageSize", "filter"].iter() {
13770            if self._additional_params.contains_key(field) {
13771                dlg.finished(false);
13772                return Err(common::Error::FieldClash(field));
13773            }
13774        }
13775
13776        let mut params = Params::with_capacity(6 + self._additional_params.len());
13777        params.push("name", self._name);
13778        if let Some(value) = self._page_token.as_ref() {
13779            params.push("pageToken", value);
13780        }
13781        if let Some(value) = self._page_size.as_ref() {
13782            params.push("pageSize", value.to_string());
13783        }
13784        if let Some(value) = self._filter.as_ref() {
13785            params.push("filter", value);
13786        }
13787
13788        params.extend(self._additional_params.iter());
13789
13790        params.push("alt", "json");
13791        let mut url = self.hub._base_url.clone() + "v1/{+name}";
13792        if self._scopes.is_empty() {
13793            self._scopes
13794                .insert(Scope::CloudPlatform.as_ref().to_string());
13795        }
13796
13797        #[allow(clippy::single_element_loop)]
13798        for &(find_this, param_name) in [("{+name}", "name")].iter() {
13799            url = params.uri_replacement(url, param_name, find_this, true);
13800        }
13801        {
13802            let to_remove = ["name"];
13803            params.remove_params(&to_remove);
13804        }
13805
13806        let url = params.parse_with_url(&url);
13807
13808        loop {
13809            let token = match self
13810                .hub
13811                .auth
13812                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
13813                .await
13814            {
13815                Ok(token) => token,
13816                Err(e) => match dlg.token(e) {
13817                    Ok(token) => token,
13818                    Err(e) => {
13819                        dlg.finished(false);
13820                        return Err(common::Error::MissingToken(e));
13821                    }
13822                },
13823            };
13824            let mut req_result = {
13825                let client = &self.hub.client;
13826                dlg.pre_request();
13827                let mut req_builder = hyper::Request::builder()
13828                    .method(hyper::Method::GET)
13829                    .uri(url.as_str())
13830                    .header(USER_AGENT, self.hub._user_agent.clone());
13831
13832                if let Some(token) = token.as_ref() {
13833                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
13834                }
13835
13836                let request = req_builder
13837                    .header(CONTENT_LENGTH, 0_u64)
13838                    .body(common::to_body::<String>(None));
13839
13840                client.request(request.unwrap()).await
13841            };
13842
13843            match req_result {
13844                Err(err) => {
13845                    if let common::Retry::After(d) = dlg.http_error(&err) {
13846                        sleep(d).await;
13847                        continue;
13848                    }
13849                    dlg.finished(false);
13850                    return Err(common::Error::HttpError(err));
13851                }
13852                Ok(res) => {
13853                    let (mut parts, body) = res.into_parts();
13854                    let mut body = common::Body::new(body);
13855                    if !parts.status.is_success() {
13856                        let bytes = common::to_bytes(body).await.unwrap_or_default();
13857                        let error = serde_json::from_str(&common::to_string(&bytes));
13858                        let response = common::to_response(parts, bytes.into());
13859
13860                        if let common::Retry::After(d) =
13861                            dlg.http_failure(&response, error.as_ref().ok())
13862                        {
13863                            sleep(d).await;
13864                            continue;
13865                        }
13866
13867                        dlg.finished(false);
13868
13869                        return Err(match error {
13870                            Ok(value) => common::Error::BadRequest(value),
13871                            _ => common::Error::Failure(response),
13872                        });
13873                    }
13874                    let response = {
13875                        let bytes = common::to_bytes(body).await.unwrap_or_default();
13876                        let encoded = common::to_string(&bytes);
13877                        match serde_json::from_str(&encoded) {
13878                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
13879                            Err(error) => {
13880                                dlg.response_json_decode_error(&encoded, &error);
13881                                return Err(common::Error::JsonDecodeError(
13882                                    encoded.to_string(),
13883                                    error,
13884                                ));
13885                            }
13886                        }
13887                    };
13888
13889                    dlg.finished(true);
13890                    return Ok(response);
13891                }
13892            }
13893        }
13894    }
13895
13896    /// The name of the operation's parent resource.
13897    ///
13898    /// Sets the *name* path property to the given value.
13899    ///
13900    /// Even though the property as already been set when instantiating this call,
13901    /// we provide this method for API completeness.
13902    pub fn name(mut self, new_value: &str) -> ProjectLocationGlobalOperationListCall<'a, C> {
13903        self._name = new_value.to_string();
13904        self
13905    }
13906    /// The standard list page token.
13907    ///
13908    /// Sets the *page token* query property to the given value.
13909    pub fn page_token(mut self, new_value: &str) -> ProjectLocationGlobalOperationListCall<'a, C> {
13910        self._page_token = Some(new_value.to_string());
13911        self
13912    }
13913    /// The standard list page size.
13914    ///
13915    /// Sets the *page size* query property to the given value.
13916    pub fn page_size(mut self, new_value: i32) -> ProjectLocationGlobalOperationListCall<'a, C> {
13917        self._page_size = Some(new_value);
13918        self
13919    }
13920    /// The standard list filter.
13921    ///
13922    /// Sets the *filter* query property to the given value.
13923    pub fn filter(mut self, new_value: &str) -> ProjectLocationGlobalOperationListCall<'a, C> {
13924        self._filter = Some(new_value.to_string());
13925        self
13926    }
13927    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
13928    /// while executing the actual API request.
13929    ///
13930    /// ````text
13931    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
13932    /// ````
13933    ///
13934    /// Sets the *delegate* property to the given value.
13935    pub fn delegate(
13936        mut self,
13937        new_value: &'a mut dyn common::Delegate,
13938    ) -> ProjectLocationGlobalOperationListCall<'a, C> {
13939        self._delegate = Some(new_value);
13940        self
13941    }
13942
13943    /// Set any additional parameter of the query string used in the request.
13944    /// It should be used to set parameters which are not yet available through their own
13945    /// setters.
13946    ///
13947    /// Please note that this method must not be used to set any of the known parameters
13948    /// which have their own setter method. If done anyway, the request will fail.
13949    ///
13950    /// # Additional Parameters
13951    ///
13952    /// * *$.xgafv* (query-string) - V1 error format.
13953    /// * *access_token* (query-string) - OAuth access token.
13954    /// * *alt* (query-string) - Data format for response.
13955    /// * *callback* (query-string) - JSONP
13956    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
13957    /// * *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.
13958    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
13959    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
13960    /// * *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.
13961    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
13962    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
13963    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationGlobalOperationListCall<'a, C>
13964    where
13965        T: AsRef<str>,
13966    {
13967        self._additional_params
13968            .insert(name.as_ref().to_string(), value.as_ref().to_string());
13969        self
13970    }
13971
13972    /// Identifies the authorization scope for the method you are building.
13973    ///
13974    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
13975    /// [`Scope::CloudPlatform`].
13976    ///
13977    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
13978    /// tokens for more than one scope.
13979    ///
13980    /// Usually there is more than one suitable scope to authorize an operation, some of which may
13981    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
13982    /// sufficient, a read-write scope will do as well.
13983    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationGlobalOperationListCall<'a, C>
13984    where
13985        St: AsRef<str>,
13986    {
13987        self._scopes.insert(String::from(scope.as_ref()));
13988        self
13989    }
13990    /// Identifies the authorization scope(s) for the method you are building.
13991    ///
13992    /// See [`Self::add_scope()`] for details.
13993    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationGlobalOperationListCall<'a, C>
13994    where
13995        I: IntoIterator<Item = St>,
13996        St: AsRef<str>,
13997    {
13998        self._scopes
13999            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
14000        self
14001    }
14002
14003    /// Removes all scopes, and no default scope will be used either.
14004    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
14005    /// for details).
14006    pub fn clear_scopes(mut self) -> ProjectLocationGlobalOperationListCall<'a, C> {
14007        self._scopes.clear();
14008        self
14009    }
14010}
14011
14012/// Creates a Peering for Managed AD instance.
14013///
14014/// A builder for the *locations.global.peerings.create* method supported by a *project* resource.
14015/// It is not used directly, but through a [`ProjectMethods`] instance.
14016///
14017/// # Example
14018///
14019/// Instantiate a resource method builder
14020///
14021/// ```test_harness,no_run
14022/// # extern crate hyper;
14023/// # extern crate hyper_rustls;
14024/// # extern crate google_managedidentities1 as managedidentities1;
14025/// use managedidentities1::api::Peering;
14026/// # async fn dox() {
14027/// # use managedidentities1::{ManagedServiceForMicrosoftActiveDirectoryConsumerAPI, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
14028///
14029/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
14030/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
14031/// #     .with_native_roots()
14032/// #     .unwrap()
14033/// #     .https_only()
14034/// #     .enable_http2()
14035/// #     .build();
14036///
14037/// # let executor = hyper_util::rt::TokioExecutor::new();
14038/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
14039/// #     secret,
14040/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
14041/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
14042/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
14043/// #     ),
14044/// # ).build().await.unwrap();
14045///
14046/// # let client = hyper_util::client::legacy::Client::builder(
14047/// #     hyper_util::rt::TokioExecutor::new()
14048/// # )
14049/// # .build(
14050/// #     hyper_rustls::HttpsConnectorBuilder::new()
14051/// #         .with_native_roots()
14052/// #         .unwrap()
14053/// #         .https_or_http()
14054/// #         .enable_http2()
14055/// #         .build()
14056/// # );
14057/// # let mut hub = ManagedServiceForMicrosoftActiveDirectoryConsumerAPI::new(client, auth);
14058/// // As the method needs a request, you would usually fill it with the desired information
14059/// // into the respective structure. Some of the parts shown here might not be applicable !
14060/// // Values shown here are possibly random and not representative !
14061/// let mut req = Peering::default();
14062///
14063/// // You can configure optional parameters by calling the respective setters at will, and
14064/// // execute the final call using `doit()`.
14065/// // Values shown here are possibly random and not representative !
14066/// let result = hub.projects().locations_global_peerings_create(req, "parent")
14067///              .peering_id("sadipscing")
14068///              .doit().await;
14069/// # }
14070/// ```
14071pub struct ProjectLocationGlobalPeeringCreateCall<'a, C>
14072where
14073    C: 'a,
14074{
14075    hub: &'a ManagedServiceForMicrosoftActiveDirectoryConsumerAPI<C>,
14076    _request: Peering,
14077    _parent: String,
14078    _peering_id: Option<String>,
14079    _delegate: Option<&'a mut dyn common::Delegate>,
14080    _additional_params: HashMap<String, String>,
14081    _scopes: BTreeSet<String>,
14082}
14083
14084impl<'a, C> common::CallBuilder for ProjectLocationGlobalPeeringCreateCall<'a, C> {}
14085
14086impl<'a, C> ProjectLocationGlobalPeeringCreateCall<'a, C>
14087where
14088    C: common::Connector,
14089{
14090    /// Perform the operation you have build so far.
14091    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
14092        use std::borrow::Cow;
14093        use std::io::{Read, Seek};
14094
14095        use common::{url::Params, ToParts};
14096        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
14097
14098        let mut dd = common::DefaultDelegate;
14099        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
14100        dlg.begin(common::MethodInfo {
14101            id: "managedidentities.projects.locations.global.peerings.create",
14102            http_method: hyper::Method::POST,
14103        });
14104
14105        for &field in ["alt", "parent", "peeringId"].iter() {
14106            if self._additional_params.contains_key(field) {
14107                dlg.finished(false);
14108                return Err(common::Error::FieldClash(field));
14109            }
14110        }
14111
14112        let mut params = Params::with_capacity(5 + self._additional_params.len());
14113        params.push("parent", self._parent);
14114        if let Some(value) = self._peering_id.as_ref() {
14115            params.push("peeringId", value);
14116        }
14117
14118        params.extend(self._additional_params.iter());
14119
14120        params.push("alt", "json");
14121        let mut url = self.hub._base_url.clone() + "v1/{+parent}/peerings";
14122        if self._scopes.is_empty() {
14123            self._scopes
14124                .insert(Scope::CloudPlatform.as_ref().to_string());
14125        }
14126
14127        #[allow(clippy::single_element_loop)]
14128        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
14129            url = params.uri_replacement(url, param_name, find_this, true);
14130        }
14131        {
14132            let to_remove = ["parent"];
14133            params.remove_params(&to_remove);
14134        }
14135
14136        let url = params.parse_with_url(&url);
14137
14138        let mut json_mime_type = mime::APPLICATION_JSON;
14139        let mut request_value_reader = {
14140            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
14141            common::remove_json_null_values(&mut value);
14142            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
14143            serde_json::to_writer(&mut dst, &value).unwrap();
14144            dst
14145        };
14146        let request_size = request_value_reader
14147            .seek(std::io::SeekFrom::End(0))
14148            .unwrap();
14149        request_value_reader
14150            .seek(std::io::SeekFrom::Start(0))
14151            .unwrap();
14152
14153        loop {
14154            let token = match self
14155                .hub
14156                .auth
14157                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
14158                .await
14159            {
14160                Ok(token) => token,
14161                Err(e) => match dlg.token(e) {
14162                    Ok(token) => token,
14163                    Err(e) => {
14164                        dlg.finished(false);
14165                        return Err(common::Error::MissingToken(e));
14166                    }
14167                },
14168            };
14169            request_value_reader
14170                .seek(std::io::SeekFrom::Start(0))
14171                .unwrap();
14172            let mut req_result = {
14173                let client = &self.hub.client;
14174                dlg.pre_request();
14175                let mut req_builder = hyper::Request::builder()
14176                    .method(hyper::Method::POST)
14177                    .uri(url.as_str())
14178                    .header(USER_AGENT, self.hub._user_agent.clone());
14179
14180                if let Some(token) = token.as_ref() {
14181                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
14182                }
14183
14184                let request = req_builder
14185                    .header(CONTENT_TYPE, json_mime_type.to_string())
14186                    .header(CONTENT_LENGTH, request_size as u64)
14187                    .body(common::to_body(
14188                        request_value_reader.get_ref().clone().into(),
14189                    ));
14190
14191                client.request(request.unwrap()).await
14192            };
14193
14194            match req_result {
14195                Err(err) => {
14196                    if let common::Retry::After(d) = dlg.http_error(&err) {
14197                        sleep(d).await;
14198                        continue;
14199                    }
14200                    dlg.finished(false);
14201                    return Err(common::Error::HttpError(err));
14202                }
14203                Ok(res) => {
14204                    let (mut parts, body) = res.into_parts();
14205                    let mut body = common::Body::new(body);
14206                    if !parts.status.is_success() {
14207                        let bytes = common::to_bytes(body).await.unwrap_or_default();
14208                        let error = serde_json::from_str(&common::to_string(&bytes));
14209                        let response = common::to_response(parts, bytes.into());
14210
14211                        if let common::Retry::After(d) =
14212                            dlg.http_failure(&response, error.as_ref().ok())
14213                        {
14214                            sleep(d).await;
14215                            continue;
14216                        }
14217
14218                        dlg.finished(false);
14219
14220                        return Err(match error {
14221                            Ok(value) => common::Error::BadRequest(value),
14222                            _ => common::Error::Failure(response),
14223                        });
14224                    }
14225                    let response = {
14226                        let bytes = common::to_bytes(body).await.unwrap_or_default();
14227                        let encoded = common::to_string(&bytes);
14228                        match serde_json::from_str(&encoded) {
14229                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
14230                            Err(error) => {
14231                                dlg.response_json_decode_error(&encoded, &error);
14232                                return Err(common::Error::JsonDecodeError(
14233                                    encoded.to_string(),
14234                                    error,
14235                                ));
14236                            }
14237                        }
14238                    };
14239
14240                    dlg.finished(true);
14241                    return Ok(response);
14242                }
14243            }
14244        }
14245    }
14246
14247    ///
14248    /// Sets the *request* property to the given value.
14249    ///
14250    /// Even though the property as already been set when instantiating this call,
14251    /// we provide this method for API completeness.
14252    pub fn request(mut self, new_value: Peering) -> ProjectLocationGlobalPeeringCreateCall<'a, C> {
14253        self._request = new_value;
14254        self
14255    }
14256    /// Required. Resource project name and location using the form: `projects/{project_id}/locations/global`
14257    ///
14258    /// Sets the *parent* path property to the given value.
14259    ///
14260    /// Even though the property as already been set when instantiating this call,
14261    /// we provide this method for API completeness.
14262    pub fn parent(mut self, new_value: &str) -> ProjectLocationGlobalPeeringCreateCall<'a, C> {
14263        self._parent = new_value.to_string();
14264        self
14265    }
14266    /// Required. Peering Id, unique name to identify peering. It should follow the regex format “^(?:[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?)$”
14267    ///
14268    /// Sets the *peering id* query property to the given value.
14269    pub fn peering_id(mut self, new_value: &str) -> ProjectLocationGlobalPeeringCreateCall<'a, C> {
14270        self._peering_id = Some(new_value.to_string());
14271        self
14272    }
14273    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
14274    /// while executing the actual API request.
14275    ///
14276    /// ````text
14277    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
14278    /// ````
14279    ///
14280    /// Sets the *delegate* property to the given value.
14281    pub fn delegate(
14282        mut self,
14283        new_value: &'a mut dyn common::Delegate,
14284    ) -> ProjectLocationGlobalPeeringCreateCall<'a, C> {
14285        self._delegate = Some(new_value);
14286        self
14287    }
14288
14289    /// Set any additional parameter of the query string used in the request.
14290    /// It should be used to set parameters which are not yet available through their own
14291    /// setters.
14292    ///
14293    /// Please note that this method must not be used to set any of the known parameters
14294    /// which have their own setter method. If done anyway, the request will fail.
14295    ///
14296    /// # Additional Parameters
14297    ///
14298    /// * *$.xgafv* (query-string) - V1 error format.
14299    /// * *access_token* (query-string) - OAuth access token.
14300    /// * *alt* (query-string) - Data format for response.
14301    /// * *callback* (query-string) - JSONP
14302    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
14303    /// * *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.
14304    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
14305    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
14306    /// * *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.
14307    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
14308    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
14309    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationGlobalPeeringCreateCall<'a, C>
14310    where
14311        T: AsRef<str>,
14312    {
14313        self._additional_params
14314            .insert(name.as_ref().to_string(), value.as_ref().to_string());
14315        self
14316    }
14317
14318    /// Identifies the authorization scope for the method you are building.
14319    ///
14320    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
14321    /// [`Scope::CloudPlatform`].
14322    ///
14323    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
14324    /// tokens for more than one scope.
14325    ///
14326    /// Usually there is more than one suitable scope to authorize an operation, some of which may
14327    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
14328    /// sufficient, a read-write scope will do as well.
14329    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationGlobalPeeringCreateCall<'a, C>
14330    where
14331        St: AsRef<str>,
14332    {
14333        self._scopes.insert(String::from(scope.as_ref()));
14334        self
14335    }
14336    /// Identifies the authorization scope(s) for the method you are building.
14337    ///
14338    /// See [`Self::add_scope()`] for details.
14339    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationGlobalPeeringCreateCall<'a, C>
14340    where
14341        I: IntoIterator<Item = St>,
14342        St: AsRef<str>,
14343    {
14344        self._scopes
14345            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
14346        self
14347    }
14348
14349    /// Removes all scopes, and no default scope will be used either.
14350    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
14351    /// for details).
14352    pub fn clear_scopes(mut self) -> ProjectLocationGlobalPeeringCreateCall<'a, C> {
14353        self._scopes.clear();
14354        self
14355    }
14356}
14357
14358/// Deletes identified Peering.
14359///
14360/// A builder for the *locations.global.peerings.delete* method supported by a *project* resource.
14361/// It is not used directly, but through a [`ProjectMethods`] instance.
14362///
14363/// # Example
14364///
14365/// Instantiate a resource method builder
14366///
14367/// ```test_harness,no_run
14368/// # extern crate hyper;
14369/// # extern crate hyper_rustls;
14370/// # extern crate google_managedidentities1 as managedidentities1;
14371/// # async fn dox() {
14372/// # use managedidentities1::{ManagedServiceForMicrosoftActiveDirectoryConsumerAPI, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
14373///
14374/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
14375/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
14376/// #     .with_native_roots()
14377/// #     .unwrap()
14378/// #     .https_only()
14379/// #     .enable_http2()
14380/// #     .build();
14381///
14382/// # let executor = hyper_util::rt::TokioExecutor::new();
14383/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
14384/// #     secret,
14385/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
14386/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
14387/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
14388/// #     ),
14389/// # ).build().await.unwrap();
14390///
14391/// # let client = hyper_util::client::legacy::Client::builder(
14392/// #     hyper_util::rt::TokioExecutor::new()
14393/// # )
14394/// # .build(
14395/// #     hyper_rustls::HttpsConnectorBuilder::new()
14396/// #         .with_native_roots()
14397/// #         .unwrap()
14398/// #         .https_or_http()
14399/// #         .enable_http2()
14400/// #         .build()
14401/// # );
14402/// # let mut hub = ManagedServiceForMicrosoftActiveDirectoryConsumerAPI::new(client, auth);
14403/// // You can configure optional parameters by calling the respective setters at will, and
14404/// // execute the final call using `doit()`.
14405/// // Values shown here are possibly random and not representative !
14406/// let result = hub.projects().locations_global_peerings_delete("name")
14407///              .doit().await;
14408/// # }
14409/// ```
14410pub struct ProjectLocationGlobalPeeringDeleteCall<'a, C>
14411where
14412    C: 'a,
14413{
14414    hub: &'a ManagedServiceForMicrosoftActiveDirectoryConsumerAPI<C>,
14415    _name: String,
14416    _delegate: Option<&'a mut dyn common::Delegate>,
14417    _additional_params: HashMap<String, String>,
14418    _scopes: BTreeSet<String>,
14419}
14420
14421impl<'a, C> common::CallBuilder for ProjectLocationGlobalPeeringDeleteCall<'a, C> {}
14422
14423impl<'a, C> ProjectLocationGlobalPeeringDeleteCall<'a, C>
14424where
14425    C: common::Connector,
14426{
14427    /// Perform the operation you have build so far.
14428    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
14429        use std::borrow::Cow;
14430        use std::io::{Read, Seek};
14431
14432        use common::{url::Params, ToParts};
14433        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
14434
14435        let mut dd = common::DefaultDelegate;
14436        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
14437        dlg.begin(common::MethodInfo {
14438            id: "managedidentities.projects.locations.global.peerings.delete",
14439            http_method: hyper::Method::DELETE,
14440        });
14441
14442        for &field in ["alt", "name"].iter() {
14443            if self._additional_params.contains_key(field) {
14444                dlg.finished(false);
14445                return Err(common::Error::FieldClash(field));
14446            }
14447        }
14448
14449        let mut params = Params::with_capacity(3 + self._additional_params.len());
14450        params.push("name", self._name);
14451
14452        params.extend(self._additional_params.iter());
14453
14454        params.push("alt", "json");
14455        let mut url = self.hub._base_url.clone() + "v1/{+name}";
14456        if self._scopes.is_empty() {
14457            self._scopes
14458                .insert(Scope::CloudPlatform.as_ref().to_string());
14459        }
14460
14461        #[allow(clippy::single_element_loop)]
14462        for &(find_this, param_name) in [("{+name}", "name")].iter() {
14463            url = params.uri_replacement(url, param_name, find_this, true);
14464        }
14465        {
14466            let to_remove = ["name"];
14467            params.remove_params(&to_remove);
14468        }
14469
14470        let url = params.parse_with_url(&url);
14471
14472        loop {
14473            let token = match self
14474                .hub
14475                .auth
14476                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
14477                .await
14478            {
14479                Ok(token) => token,
14480                Err(e) => match dlg.token(e) {
14481                    Ok(token) => token,
14482                    Err(e) => {
14483                        dlg.finished(false);
14484                        return Err(common::Error::MissingToken(e));
14485                    }
14486                },
14487            };
14488            let mut req_result = {
14489                let client = &self.hub.client;
14490                dlg.pre_request();
14491                let mut req_builder = hyper::Request::builder()
14492                    .method(hyper::Method::DELETE)
14493                    .uri(url.as_str())
14494                    .header(USER_AGENT, self.hub._user_agent.clone());
14495
14496                if let Some(token) = token.as_ref() {
14497                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
14498                }
14499
14500                let request = req_builder
14501                    .header(CONTENT_LENGTH, 0_u64)
14502                    .body(common::to_body::<String>(None));
14503
14504                client.request(request.unwrap()).await
14505            };
14506
14507            match req_result {
14508                Err(err) => {
14509                    if let common::Retry::After(d) = dlg.http_error(&err) {
14510                        sleep(d).await;
14511                        continue;
14512                    }
14513                    dlg.finished(false);
14514                    return Err(common::Error::HttpError(err));
14515                }
14516                Ok(res) => {
14517                    let (mut parts, body) = res.into_parts();
14518                    let mut body = common::Body::new(body);
14519                    if !parts.status.is_success() {
14520                        let bytes = common::to_bytes(body).await.unwrap_or_default();
14521                        let error = serde_json::from_str(&common::to_string(&bytes));
14522                        let response = common::to_response(parts, bytes.into());
14523
14524                        if let common::Retry::After(d) =
14525                            dlg.http_failure(&response, error.as_ref().ok())
14526                        {
14527                            sleep(d).await;
14528                            continue;
14529                        }
14530
14531                        dlg.finished(false);
14532
14533                        return Err(match error {
14534                            Ok(value) => common::Error::BadRequest(value),
14535                            _ => common::Error::Failure(response),
14536                        });
14537                    }
14538                    let response = {
14539                        let bytes = common::to_bytes(body).await.unwrap_or_default();
14540                        let encoded = common::to_string(&bytes);
14541                        match serde_json::from_str(&encoded) {
14542                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
14543                            Err(error) => {
14544                                dlg.response_json_decode_error(&encoded, &error);
14545                                return Err(common::Error::JsonDecodeError(
14546                                    encoded.to_string(),
14547                                    error,
14548                                ));
14549                            }
14550                        }
14551                    };
14552
14553                    dlg.finished(true);
14554                    return Ok(response);
14555                }
14556            }
14557        }
14558    }
14559
14560    /// Required. Peering resource name using the form: `projects/{project_id}/locations/global/peerings/{peering_id}`
14561    ///
14562    /// Sets the *name* path property to the given value.
14563    ///
14564    /// Even though the property as already been set when instantiating this call,
14565    /// we provide this method for API completeness.
14566    pub fn name(mut self, new_value: &str) -> ProjectLocationGlobalPeeringDeleteCall<'a, C> {
14567        self._name = new_value.to_string();
14568        self
14569    }
14570    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
14571    /// while executing the actual API request.
14572    ///
14573    /// ````text
14574    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
14575    /// ````
14576    ///
14577    /// Sets the *delegate* property to the given value.
14578    pub fn delegate(
14579        mut self,
14580        new_value: &'a mut dyn common::Delegate,
14581    ) -> ProjectLocationGlobalPeeringDeleteCall<'a, C> {
14582        self._delegate = Some(new_value);
14583        self
14584    }
14585
14586    /// Set any additional parameter of the query string used in the request.
14587    /// It should be used to set parameters which are not yet available through their own
14588    /// setters.
14589    ///
14590    /// Please note that this method must not be used to set any of the known parameters
14591    /// which have their own setter method. If done anyway, the request will fail.
14592    ///
14593    /// # Additional Parameters
14594    ///
14595    /// * *$.xgafv* (query-string) - V1 error format.
14596    /// * *access_token* (query-string) - OAuth access token.
14597    /// * *alt* (query-string) - Data format for response.
14598    /// * *callback* (query-string) - JSONP
14599    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
14600    /// * *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.
14601    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
14602    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
14603    /// * *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.
14604    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
14605    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
14606    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationGlobalPeeringDeleteCall<'a, C>
14607    where
14608        T: AsRef<str>,
14609    {
14610        self._additional_params
14611            .insert(name.as_ref().to_string(), value.as_ref().to_string());
14612        self
14613    }
14614
14615    /// Identifies the authorization scope for the method you are building.
14616    ///
14617    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
14618    /// [`Scope::CloudPlatform`].
14619    ///
14620    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
14621    /// tokens for more than one scope.
14622    ///
14623    /// Usually there is more than one suitable scope to authorize an operation, some of which may
14624    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
14625    /// sufficient, a read-write scope will do as well.
14626    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationGlobalPeeringDeleteCall<'a, C>
14627    where
14628        St: AsRef<str>,
14629    {
14630        self._scopes.insert(String::from(scope.as_ref()));
14631        self
14632    }
14633    /// Identifies the authorization scope(s) for the method you are building.
14634    ///
14635    /// See [`Self::add_scope()`] for details.
14636    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationGlobalPeeringDeleteCall<'a, C>
14637    where
14638        I: IntoIterator<Item = St>,
14639        St: AsRef<str>,
14640    {
14641        self._scopes
14642            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
14643        self
14644    }
14645
14646    /// Removes all scopes, and no default scope will be used either.
14647    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
14648    /// for details).
14649    pub fn clear_scopes(mut self) -> ProjectLocationGlobalPeeringDeleteCall<'a, C> {
14650        self._scopes.clear();
14651        self
14652    }
14653}
14654
14655/// Gets details of a single Peering.
14656///
14657/// A builder for the *locations.global.peerings.get* method supported by a *project* resource.
14658/// It is not used directly, but through a [`ProjectMethods`] instance.
14659///
14660/// # Example
14661///
14662/// Instantiate a resource method builder
14663///
14664/// ```test_harness,no_run
14665/// # extern crate hyper;
14666/// # extern crate hyper_rustls;
14667/// # extern crate google_managedidentities1 as managedidentities1;
14668/// # async fn dox() {
14669/// # use managedidentities1::{ManagedServiceForMicrosoftActiveDirectoryConsumerAPI, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
14670///
14671/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
14672/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
14673/// #     .with_native_roots()
14674/// #     .unwrap()
14675/// #     .https_only()
14676/// #     .enable_http2()
14677/// #     .build();
14678///
14679/// # let executor = hyper_util::rt::TokioExecutor::new();
14680/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
14681/// #     secret,
14682/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
14683/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
14684/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
14685/// #     ),
14686/// # ).build().await.unwrap();
14687///
14688/// # let client = hyper_util::client::legacy::Client::builder(
14689/// #     hyper_util::rt::TokioExecutor::new()
14690/// # )
14691/// # .build(
14692/// #     hyper_rustls::HttpsConnectorBuilder::new()
14693/// #         .with_native_roots()
14694/// #         .unwrap()
14695/// #         .https_or_http()
14696/// #         .enable_http2()
14697/// #         .build()
14698/// # );
14699/// # let mut hub = ManagedServiceForMicrosoftActiveDirectoryConsumerAPI::new(client, auth);
14700/// // You can configure optional parameters by calling the respective setters at will, and
14701/// // execute the final call using `doit()`.
14702/// // Values shown here are possibly random and not representative !
14703/// let result = hub.projects().locations_global_peerings_get("name")
14704///              .doit().await;
14705/// # }
14706/// ```
14707pub struct ProjectLocationGlobalPeeringGetCall<'a, C>
14708where
14709    C: 'a,
14710{
14711    hub: &'a ManagedServiceForMicrosoftActiveDirectoryConsumerAPI<C>,
14712    _name: String,
14713    _delegate: Option<&'a mut dyn common::Delegate>,
14714    _additional_params: HashMap<String, String>,
14715    _scopes: BTreeSet<String>,
14716}
14717
14718impl<'a, C> common::CallBuilder for ProjectLocationGlobalPeeringGetCall<'a, C> {}
14719
14720impl<'a, C> ProjectLocationGlobalPeeringGetCall<'a, C>
14721where
14722    C: common::Connector,
14723{
14724    /// Perform the operation you have build so far.
14725    pub async fn doit(mut self) -> common::Result<(common::Response, Peering)> {
14726        use std::borrow::Cow;
14727        use std::io::{Read, Seek};
14728
14729        use common::{url::Params, ToParts};
14730        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
14731
14732        let mut dd = common::DefaultDelegate;
14733        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
14734        dlg.begin(common::MethodInfo {
14735            id: "managedidentities.projects.locations.global.peerings.get",
14736            http_method: hyper::Method::GET,
14737        });
14738
14739        for &field in ["alt", "name"].iter() {
14740            if self._additional_params.contains_key(field) {
14741                dlg.finished(false);
14742                return Err(common::Error::FieldClash(field));
14743            }
14744        }
14745
14746        let mut params = Params::with_capacity(3 + self._additional_params.len());
14747        params.push("name", self._name);
14748
14749        params.extend(self._additional_params.iter());
14750
14751        params.push("alt", "json");
14752        let mut url = self.hub._base_url.clone() + "v1/{+name}";
14753        if self._scopes.is_empty() {
14754            self._scopes
14755                .insert(Scope::CloudPlatform.as_ref().to_string());
14756        }
14757
14758        #[allow(clippy::single_element_loop)]
14759        for &(find_this, param_name) in [("{+name}", "name")].iter() {
14760            url = params.uri_replacement(url, param_name, find_this, true);
14761        }
14762        {
14763            let to_remove = ["name"];
14764            params.remove_params(&to_remove);
14765        }
14766
14767        let url = params.parse_with_url(&url);
14768
14769        loop {
14770            let token = match self
14771                .hub
14772                .auth
14773                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
14774                .await
14775            {
14776                Ok(token) => token,
14777                Err(e) => match dlg.token(e) {
14778                    Ok(token) => token,
14779                    Err(e) => {
14780                        dlg.finished(false);
14781                        return Err(common::Error::MissingToken(e));
14782                    }
14783                },
14784            };
14785            let mut req_result = {
14786                let client = &self.hub.client;
14787                dlg.pre_request();
14788                let mut req_builder = hyper::Request::builder()
14789                    .method(hyper::Method::GET)
14790                    .uri(url.as_str())
14791                    .header(USER_AGENT, self.hub._user_agent.clone());
14792
14793                if let Some(token) = token.as_ref() {
14794                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
14795                }
14796
14797                let request = req_builder
14798                    .header(CONTENT_LENGTH, 0_u64)
14799                    .body(common::to_body::<String>(None));
14800
14801                client.request(request.unwrap()).await
14802            };
14803
14804            match req_result {
14805                Err(err) => {
14806                    if let common::Retry::After(d) = dlg.http_error(&err) {
14807                        sleep(d).await;
14808                        continue;
14809                    }
14810                    dlg.finished(false);
14811                    return Err(common::Error::HttpError(err));
14812                }
14813                Ok(res) => {
14814                    let (mut parts, body) = res.into_parts();
14815                    let mut body = common::Body::new(body);
14816                    if !parts.status.is_success() {
14817                        let bytes = common::to_bytes(body).await.unwrap_or_default();
14818                        let error = serde_json::from_str(&common::to_string(&bytes));
14819                        let response = common::to_response(parts, bytes.into());
14820
14821                        if let common::Retry::After(d) =
14822                            dlg.http_failure(&response, error.as_ref().ok())
14823                        {
14824                            sleep(d).await;
14825                            continue;
14826                        }
14827
14828                        dlg.finished(false);
14829
14830                        return Err(match error {
14831                            Ok(value) => common::Error::BadRequest(value),
14832                            _ => common::Error::Failure(response),
14833                        });
14834                    }
14835                    let response = {
14836                        let bytes = common::to_bytes(body).await.unwrap_or_default();
14837                        let encoded = common::to_string(&bytes);
14838                        match serde_json::from_str(&encoded) {
14839                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
14840                            Err(error) => {
14841                                dlg.response_json_decode_error(&encoded, &error);
14842                                return Err(common::Error::JsonDecodeError(
14843                                    encoded.to_string(),
14844                                    error,
14845                                ));
14846                            }
14847                        }
14848                    };
14849
14850                    dlg.finished(true);
14851                    return Ok(response);
14852                }
14853            }
14854        }
14855    }
14856
14857    /// Required. Peering resource name using the form: `projects/{project_id}/locations/global/peerings/{peering_id}`
14858    ///
14859    /// Sets the *name* path property to the given value.
14860    ///
14861    /// Even though the property as already been set when instantiating this call,
14862    /// we provide this method for API completeness.
14863    pub fn name(mut self, new_value: &str) -> ProjectLocationGlobalPeeringGetCall<'a, C> {
14864        self._name = new_value.to_string();
14865        self
14866    }
14867    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
14868    /// while executing the actual API request.
14869    ///
14870    /// ````text
14871    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
14872    /// ````
14873    ///
14874    /// Sets the *delegate* property to the given value.
14875    pub fn delegate(
14876        mut self,
14877        new_value: &'a mut dyn common::Delegate,
14878    ) -> ProjectLocationGlobalPeeringGetCall<'a, C> {
14879        self._delegate = Some(new_value);
14880        self
14881    }
14882
14883    /// Set any additional parameter of the query string used in the request.
14884    /// It should be used to set parameters which are not yet available through their own
14885    /// setters.
14886    ///
14887    /// Please note that this method must not be used to set any of the known parameters
14888    /// which have their own setter method. If done anyway, the request will fail.
14889    ///
14890    /// # Additional Parameters
14891    ///
14892    /// * *$.xgafv* (query-string) - V1 error format.
14893    /// * *access_token* (query-string) - OAuth access token.
14894    /// * *alt* (query-string) - Data format for response.
14895    /// * *callback* (query-string) - JSONP
14896    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
14897    /// * *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.
14898    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
14899    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
14900    /// * *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.
14901    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
14902    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
14903    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationGlobalPeeringGetCall<'a, C>
14904    where
14905        T: AsRef<str>,
14906    {
14907        self._additional_params
14908            .insert(name.as_ref().to_string(), value.as_ref().to_string());
14909        self
14910    }
14911
14912    /// Identifies the authorization scope for the method you are building.
14913    ///
14914    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
14915    /// [`Scope::CloudPlatform`].
14916    ///
14917    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
14918    /// tokens for more than one scope.
14919    ///
14920    /// Usually there is more than one suitable scope to authorize an operation, some of which may
14921    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
14922    /// sufficient, a read-write scope will do as well.
14923    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationGlobalPeeringGetCall<'a, C>
14924    where
14925        St: AsRef<str>,
14926    {
14927        self._scopes.insert(String::from(scope.as_ref()));
14928        self
14929    }
14930    /// Identifies the authorization scope(s) for the method you are building.
14931    ///
14932    /// See [`Self::add_scope()`] for details.
14933    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationGlobalPeeringGetCall<'a, C>
14934    where
14935        I: IntoIterator<Item = St>,
14936        St: AsRef<str>,
14937    {
14938        self._scopes
14939            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
14940        self
14941    }
14942
14943    /// Removes all scopes, and no default scope will be used either.
14944    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
14945    /// for details).
14946    pub fn clear_scopes(mut self) -> ProjectLocationGlobalPeeringGetCall<'a, C> {
14947        self._scopes.clear();
14948        self
14949    }
14950}
14951
14952/// Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.
14953///
14954/// A builder for the *locations.global.peerings.getIamPolicy* method supported by a *project* resource.
14955/// It is not used directly, but through a [`ProjectMethods`] instance.
14956///
14957/// # Example
14958///
14959/// Instantiate a resource method builder
14960///
14961/// ```test_harness,no_run
14962/// # extern crate hyper;
14963/// # extern crate hyper_rustls;
14964/// # extern crate google_managedidentities1 as managedidentities1;
14965/// # async fn dox() {
14966/// # use managedidentities1::{ManagedServiceForMicrosoftActiveDirectoryConsumerAPI, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
14967///
14968/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
14969/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
14970/// #     .with_native_roots()
14971/// #     .unwrap()
14972/// #     .https_only()
14973/// #     .enable_http2()
14974/// #     .build();
14975///
14976/// # let executor = hyper_util::rt::TokioExecutor::new();
14977/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
14978/// #     secret,
14979/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
14980/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
14981/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
14982/// #     ),
14983/// # ).build().await.unwrap();
14984///
14985/// # let client = hyper_util::client::legacy::Client::builder(
14986/// #     hyper_util::rt::TokioExecutor::new()
14987/// # )
14988/// # .build(
14989/// #     hyper_rustls::HttpsConnectorBuilder::new()
14990/// #         .with_native_roots()
14991/// #         .unwrap()
14992/// #         .https_or_http()
14993/// #         .enable_http2()
14994/// #         .build()
14995/// # );
14996/// # let mut hub = ManagedServiceForMicrosoftActiveDirectoryConsumerAPI::new(client, auth);
14997/// // You can configure optional parameters by calling the respective setters at will, and
14998/// // execute the final call using `doit()`.
14999/// // Values shown here are possibly random and not representative !
15000/// let result = hub.projects().locations_global_peerings_get_iam_policy("resource")
15001///              .options_requested_policy_version(-76)
15002///              .doit().await;
15003/// # }
15004/// ```
15005pub struct ProjectLocationGlobalPeeringGetIamPolicyCall<'a, C>
15006where
15007    C: 'a,
15008{
15009    hub: &'a ManagedServiceForMicrosoftActiveDirectoryConsumerAPI<C>,
15010    _resource: String,
15011    _options_requested_policy_version: Option<i32>,
15012    _delegate: Option<&'a mut dyn common::Delegate>,
15013    _additional_params: HashMap<String, String>,
15014    _scopes: BTreeSet<String>,
15015}
15016
15017impl<'a, C> common::CallBuilder for ProjectLocationGlobalPeeringGetIamPolicyCall<'a, C> {}
15018
15019impl<'a, C> ProjectLocationGlobalPeeringGetIamPolicyCall<'a, C>
15020where
15021    C: common::Connector,
15022{
15023    /// Perform the operation you have build so far.
15024    pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
15025        use std::borrow::Cow;
15026        use std::io::{Read, Seek};
15027
15028        use common::{url::Params, ToParts};
15029        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
15030
15031        let mut dd = common::DefaultDelegate;
15032        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
15033        dlg.begin(common::MethodInfo {
15034            id: "managedidentities.projects.locations.global.peerings.getIamPolicy",
15035            http_method: hyper::Method::GET,
15036        });
15037
15038        for &field in ["alt", "resource", "options.requestedPolicyVersion"].iter() {
15039            if self._additional_params.contains_key(field) {
15040                dlg.finished(false);
15041                return Err(common::Error::FieldClash(field));
15042            }
15043        }
15044
15045        let mut params = Params::with_capacity(4 + self._additional_params.len());
15046        params.push("resource", self._resource);
15047        if let Some(value) = self._options_requested_policy_version.as_ref() {
15048            params.push("options.requestedPolicyVersion", value.to_string());
15049        }
15050
15051        params.extend(self._additional_params.iter());
15052
15053        params.push("alt", "json");
15054        let mut url = self.hub._base_url.clone() + "v1/{+resource}:getIamPolicy";
15055        if self._scopes.is_empty() {
15056            self._scopes
15057                .insert(Scope::CloudPlatform.as_ref().to_string());
15058        }
15059
15060        #[allow(clippy::single_element_loop)]
15061        for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
15062            url = params.uri_replacement(url, param_name, find_this, true);
15063        }
15064        {
15065            let to_remove = ["resource"];
15066            params.remove_params(&to_remove);
15067        }
15068
15069        let url = params.parse_with_url(&url);
15070
15071        loop {
15072            let token = match self
15073                .hub
15074                .auth
15075                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
15076                .await
15077            {
15078                Ok(token) => token,
15079                Err(e) => match dlg.token(e) {
15080                    Ok(token) => token,
15081                    Err(e) => {
15082                        dlg.finished(false);
15083                        return Err(common::Error::MissingToken(e));
15084                    }
15085                },
15086            };
15087            let mut req_result = {
15088                let client = &self.hub.client;
15089                dlg.pre_request();
15090                let mut req_builder = hyper::Request::builder()
15091                    .method(hyper::Method::GET)
15092                    .uri(url.as_str())
15093                    .header(USER_AGENT, self.hub._user_agent.clone());
15094
15095                if let Some(token) = token.as_ref() {
15096                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
15097                }
15098
15099                let request = req_builder
15100                    .header(CONTENT_LENGTH, 0_u64)
15101                    .body(common::to_body::<String>(None));
15102
15103                client.request(request.unwrap()).await
15104            };
15105
15106            match req_result {
15107                Err(err) => {
15108                    if let common::Retry::After(d) = dlg.http_error(&err) {
15109                        sleep(d).await;
15110                        continue;
15111                    }
15112                    dlg.finished(false);
15113                    return Err(common::Error::HttpError(err));
15114                }
15115                Ok(res) => {
15116                    let (mut parts, body) = res.into_parts();
15117                    let mut body = common::Body::new(body);
15118                    if !parts.status.is_success() {
15119                        let bytes = common::to_bytes(body).await.unwrap_or_default();
15120                        let error = serde_json::from_str(&common::to_string(&bytes));
15121                        let response = common::to_response(parts, bytes.into());
15122
15123                        if let common::Retry::After(d) =
15124                            dlg.http_failure(&response, error.as_ref().ok())
15125                        {
15126                            sleep(d).await;
15127                            continue;
15128                        }
15129
15130                        dlg.finished(false);
15131
15132                        return Err(match error {
15133                            Ok(value) => common::Error::BadRequest(value),
15134                            _ => common::Error::Failure(response),
15135                        });
15136                    }
15137                    let response = {
15138                        let bytes = common::to_bytes(body).await.unwrap_or_default();
15139                        let encoded = common::to_string(&bytes);
15140                        match serde_json::from_str(&encoded) {
15141                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
15142                            Err(error) => {
15143                                dlg.response_json_decode_error(&encoded, &error);
15144                                return Err(common::Error::JsonDecodeError(
15145                                    encoded.to_string(),
15146                                    error,
15147                                ));
15148                            }
15149                        }
15150                    };
15151
15152                    dlg.finished(true);
15153                    return Ok(response);
15154                }
15155            }
15156        }
15157    }
15158
15159    /// REQUIRED: The resource for which the policy is being requested. See [Resource names](https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
15160    ///
15161    /// Sets the *resource* path property to the given value.
15162    ///
15163    /// Even though the property as already been set when instantiating this call,
15164    /// we provide this method for API completeness.
15165    pub fn resource(
15166        mut self,
15167        new_value: &str,
15168    ) -> ProjectLocationGlobalPeeringGetIamPolicyCall<'a, C> {
15169        self._resource = new_value.to_string();
15170        self
15171    }
15172    /// Optional. The maximum policy version that will be used to format the policy. Valid values are 0, 1, and 3. Requests specifying an invalid value will be rejected. Requests for policies with any conditional role bindings must specify version 3. Policies with no conditional role bindings may specify any valid value or leave the field unset. The policy in the response might use the policy version that you specified, or it might use a lower policy version. For example, if you specify version 3, but the policy has no conditional role bindings, the response uses version 1. To learn which resources support conditions in their IAM policies, see the [IAM documentation](https://cloud.google.com/iam/help/conditions/resource-policies).
15173    ///
15174    /// Sets the *options.requested policy version* query property to the given value.
15175    pub fn options_requested_policy_version(
15176        mut self,
15177        new_value: i32,
15178    ) -> ProjectLocationGlobalPeeringGetIamPolicyCall<'a, C> {
15179        self._options_requested_policy_version = Some(new_value);
15180        self
15181    }
15182    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
15183    /// while executing the actual API request.
15184    ///
15185    /// ````text
15186    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
15187    /// ````
15188    ///
15189    /// Sets the *delegate* property to the given value.
15190    pub fn delegate(
15191        mut self,
15192        new_value: &'a mut dyn common::Delegate,
15193    ) -> ProjectLocationGlobalPeeringGetIamPolicyCall<'a, C> {
15194        self._delegate = Some(new_value);
15195        self
15196    }
15197
15198    /// Set any additional parameter of the query string used in the request.
15199    /// It should be used to set parameters which are not yet available through their own
15200    /// setters.
15201    ///
15202    /// Please note that this method must not be used to set any of the known parameters
15203    /// which have their own setter method. If done anyway, the request will fail.
15204    ///
15205    /// # Additional Parameters
15206    ///
15207    /// * *$.xgafv* (query-string) - V1 error format.
15208    /// * *access_token* (query-string) - OAuth access token.
15209    /// * *alt* (query-string) - Data format for response.
15210    /// * *callback* (query-string) - JSONP
15211    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
15212    /// * *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.
15213    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
15214    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
15215    /// * *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.
15216    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
15217    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
15218    pub fn param<T>(
15219        mut self,
15220        name: T,
15221        value: T,
15222    ) -> ProjectLocationGlobalPeeringGetIamPolicyCall<'a, C>
15223    where
15224        T: AsRef<str>,
15225    {
15226        self._additional_params
15227            .insert(name.as_ref().to_string(), value.as_ref().to_string());
15228        self
15229    }
15230
15231    /// Identifies the authorization scope for the method you are building.
15232    ///
15233    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
15234    /// [`Scope::CloudPlatform`].
15235    ///
15236    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
15237    /// tokens for more than one scope.
15238    ///
15239    /// Usually there is more than one suitable scope to authorize an operation, some of which may
15240    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
15241    /// sufficient, a read-write scope will do as well.
15242    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationGlobalPeeringGetIamPolicyCall<'a, C>
15243    where
15244        St: AsRef<str>,
15245    {
15246        self._scopes.insert(String::from(scope.as_ref()));
15247        self
15248    }
15249    /// Identifies the authorization scope(s) for the method you are building.
15250    ///
15251    /// See [`Self::add_scope()`] for details.
15252    pub fn add_scopes<I, St>(
15253        mut self,
15254        scopes: I,
15255    ) -> ProjectLocationGlobalPeeringGetIamPolicyCall<'a, C>
15256    where
15257        I: IntoIterator<Item = St>,
15258        St: AsRef<str>,
15259    {
15260        self._scopes
15261            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
15262        self
15263    }
15264
15265    /// Removes all scopes, and no default scope will be used either.
15266    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
15267    /// for details).
15268    pub fn clear_scopes(mut self) -> ProjectLocationGlobalPeeringGetIamPolicyCall<'a, C> {
15269        self._scopes.clear();
15270        self
15271    }
15272}
15273
15274/// Lists Peerings in a given project.
15275///
15276/// A builder for the *locations.global.peerings.list* method supported by a *project* resource.
15277/// It is not used directly, but through a [`ProjectMethods`] instance.
15278///
15279/// # Example
15280///
15281/// Instantiate a resource method builder
15282///
15283/// ```test_harness,no_run
15284/// # extern crate hyper;
15285/// # extern crate hyper_rustls;
15286/// # extern crate google_managedidentities1 as managedidentities1;
15287/// # async fn dox() {
15288/// # use managedidentities1::{ManagedServiceForMicrosoftActiveDirectoryConsumerAPI, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
15289///
15290/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
15291/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
15292/// #     .with_native_roots()
15293/// #     .unwrap()
15294/// #     .https_only()
15295/// #     .enable_http2()
15296/// #     .build();
15297///
15298/// # let executor = hyper_util::rt::TokioExecutor::new();
15299/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
15300/// #     secret,
15301/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
15302/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
15303/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
15304/// #     ),
15305/// # ).build().await.unwrap();
15306///
15307/// # let client = hyper_util::client::legacy::Client::builder(
15308/// #     hyper_util::rt::TokioExecutor::new()
15309/// # )
15310/// # .build(
15311/// #     hyper_rustls::HttpsConnectorBuilder::new()
15312/// #         .with_native_roots()
15313/// #         .unwrap()
15314/// #         .https_or_http()
15315/// #         .enable_http2()
15316/// #         .build()
15317/// # );
15318/// # let mut hub = ManagedServiceForMicrosoftActiveDirectoryConsumerAPI::new(client, auth);
15319/// // You can configure optional parameters by calling the respective setters at will, and
15320/// // execute the final call using `doit()`.
15321/// // Values shown here are possibly random and not representative !
15322/// let result = hub.projects().locations_global_peerings_list("parent")
15323///              .page_token("invidunt")
15324///              .page_size(-65)
15325///              .order_by("vero")
15326///              .filter("elitr")
15327///              .doit().await;
15328/// # }
15329/// ```
15330pub struct ProjectLocationGlobalPeeringListCall<'a, C>
15331where
15332    C: 'a,
15333{
15334    hub: &'a ManagedServiceForMicrosoftActiveDirectoryConsumerAPI<C>,
15335    _parent: String,
15336    _page_token: Option<String>,
15337    _page_size: Option<i32>,
15338    _order_by: Option<String>,
15339    _filter: Option<String>,
15340    _delegate: Option<&'a mut dyn common::Delegate>,
15341    _additional_params: HashMap<String, String>,
15342    _scopes: BTreeSet<String>,
15343}
15344
15345impl<'a, C> common::CallBuilder for ProjectLocationGlobalPeeringListCall<'a, C> {}
15346
15347impl<'a, C> ProjectLocationGlobalPeeringListCall<'a, C>
15348where
15349    C: common::Connector,
15350{
15351    /// Perform the operation you have build so far.
15352    pub async fn doit(mut self) -> common::Result<(common::Response, ListPeeringsResponse)> {
15353        use std::borrow::Cow;
15354        use std::io::{Read, Seek};
15355
15356        use common::{url::Params, ToParts};
15357        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
15358
15359        let mut dd = common::DefaultDelegate;
15360        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
15361        dlg.begin(common::MethodInfo {
15362            id: "managedidentities.projects.locations.global.peerings.list",
15363            http_method: hyper::Method::GET,
15364        });
15365
15366        for &field in [
15367            "alt",
15368            "parent",
15369            "pageToken",
15370            "pageSize",
15371            "orderBy",
15372            "filter",
15373        ]
15374        .iter()
15375        {
15376            if self._additional_params.contains_key(field) {
15377                dlg.finished(false);
15378                return Err(common::Error::FieldClash(field));
15379            }
15380        }
15381
15382        let mut params = Params::with_capacity(7 + self._additional_params.len());
15383        params.push("parent", self._parent);
15384        if let Some(value) = self._page_token.as_ref() {
15385            params.push("pageToken", value);
15386        }
15387        if let Some(value) = self._page_size.as_ref() {
15388            params.push("pageSize", value.to_string());
15389        }
15390        if let Some(value) = self._order_by.as_ref() {
15391            params.push("orderBy", value);
15392        }
15393        if let Some(value) = self._filter.as_ref() {
15394            params.push("filter", value);
15395        }
15396
15397        params.extend(self._additional_params.iter());
15398
15399        params.push("alt", "json");
15400        let mut url = self.hub._base_url.clone() + "v1/{+parent}/peerings";
15401        if self._scopes.is_empty() {
15402            self._scopes
15403                .insert(Scope::CloudPlatform.as_ref().to_string());
15404        }
15405
15406        #[allow(clippy::single_element_loop)]
15407        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
15408            url = params.uri_replacement(url, param_name, find_this, true);
15409        }
15410        {
15411            let to_remove = ["parent"];
15412            params.remove_params(&to_remove);
15413        }
15414
15415        let url = params.parse_with_url(&url);
15416
15417        loop {
15418            let token = match self
15419                .hub
15420                .auth
15421                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
15422                .await
15423            {
15424                Ok(token) => token,
15425                Err(e) => match dlg.token(e) {
15426                    Ok(token) => token,
15427                    Err(e) => {
15428                        dlg.finished(false);
15429                        return Err(common::Error::MissingToken(e));
15430                    }
15431                },
15432            };
15433            let mut req_result = {
15434                let client = &self.hub.client;
15435                dlg.pre_request();
15436                let mut req_builder = hyper::Request::builder()
15437                    .method(hyper::Method::GET)
15438                    .uri(url.as_str())
15439                    .header(USER_AGENT, self.hub._user_agent.clone());
15440
15441                if let Some(token) = token.as_ref() {
15442                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
15443                }
15444
15445                let request = req_builder
15446                    .header(CONTENT_LENGTH, 0_u64)
15447                    .body(common::to_body::<String>(None));
15448
15449                client.request(request.unwrap()).await
15450            };
15451
15452            match req_result {
15453                Err(err) => {
15454                    if let common::Retry::After(d) = dlg.http_error(&err) {
15455                        sleep(d).await;
15456                        continue;
15457                    }
15458                    dlg.finished(false);
15459                    return Err(common::Error::HttpError(err));
15460                }
15461                Ok(res) => {
15462                    let (mut parts, body) = res.into_parts();
15463                    let mut body = common::Body::new(body);
15464                    if !parts.status.is_success() {
15465                        let bytes = common::to_bytes(body).await.unwrap_or_default();
15466                        let error = serde_json::from_str(&common::to_string(&bytes));
15467                        let response = common::to_response(parts, bytes.into());
15468
15469                        if let common::Retry::After(d) =
15470                            dlg.http_failure(&response, error.as_ref().ok())
15471                        {
15472                            sleep(d).await;
15473                            continue;
15474                        }
15475
15476                        dlg.finished(false);
15477
15478                        return Err(match error {
15479                            Ok(value) => common::Error::BadRequest(value),
15480                            _ => common::Error::Failure(response),
15481                        });
15482                    }
15483                    let response = {
15484                        let bytes = common::to_bytes(body).await.unwrap_or_default();
15485                        let encoded = common::to_string(&bytes);
15486                        match serde_json::from_str(&encoded) {
15487                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
15488                            Err(error) => {
15489                                dlg.response_json_decode_error(&encoded, &error);
15490                                return Err(common::Error::JsonDecodeError(
15491                                    encoded.to_string(),
15492                                    error,
15493                                ));
15494                            }
15495                        }
15496                    };
15497
15498                    dlg.finished(true);
15499                    return Ok(response);
15500                }
15501            }
15502        }
15503    }
15504
15505    /// Required. The resource name of the peering location using the form: `projects/{project_id}/locations/global`
15506    ///
15507    /// Sets the *parent* path property to the given value.
15508    ///
15509    /// Even though the property as already been set when instantiating this call,
15510    /// we provide this method for API completeness.
15511    pub fn parent(mut self, new_value: &str) -> ProjectLocationGlobalPeeringListCall<'a, C> {
15512        self._parent = new_value.to_string();
15513        self
15514    }
15515    /// Optional. The next_page_token value returned from a previous List request, if any.
15516    ///
15517    /// Sets the *page token* query property to the given value.
15518    pub fn page_token(mut self, new_value: &str) -> ProjectLocationGlobalPeeringListCall<'a, C> {
15519        self._page_token = Some(new_value.to_string());
15520        self
15521    }
15522    /// Optional. The maximum number of items to return. If not specified, a default value of 1000 will be used by the service. Regardless of the page_size value, the response may include a partial list and a caller should only rely on response's next_page_token to determine if there are more instances left to be queried.
15523    ///
15524    /// Sets the *page size* query property to the given value.
15525    pub fn page_size(mut self, new_value: i32) -> ProjectLocationGlobalPeeringListCall<'a, C> {
15526        self._page_size = Some(new_value);
15527        self
15528    }
15529    /// Optional. Specifies the ordering of results following syntax at https://cloud.google.com/apis/design/design_patterns#sorting_order.
15530    ///
15531    /// Sets the *order by* query property to the given value.
15532    pub fn order_by(mut self, new_value: &str) -> ProjectLocationGlobalPeeringListCall<'a, C> {
15533        self._order_by = Some(new_value.to_string());
15534        self
15535    }
15536    /// Optional. Filter specifying constraints of a list operation. For example, `peering.authorized_network="projects/myprojectid/global/networks/mynetwork"`.
15537    ///
15538    /// Sets the *filter* query property to the given value.
15539    pub fn filter(mut self, new_value: &str) -> ProjectLocationGlobalPeeringListCall<'a, C> {
15540        self._filter = Some(new_value.to_string());
15541        self
15542    }
15543    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
15544    /// while executing the actual API request.
15545    ///
15546    /// ````text
15547    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
15548    /// ````
15549    ///
15550    /// Sets the *delegate* property to the given value.
15551    pub fn delegate(
15552        mut self,
15553        new_value: &'a mut dyn common::Delegate,
15554    ) -> ProjectLocationGlobalPeeringListCall<'a, C> {
15555        self._delegate = Some(new_value);
15556        self
15557    }
15558
15559    /// Set any additional parameter of the query string used in the request.
15560    /// It should be used to set parameters which are not yet available through their own
15561    /// setters.
15562    ///
15563    /// Please note that this method must not be used to set any of the known parameters
15564    /// which have their own setter method. If done anyway, the request will fail.
15565    ///
15566    /// # Additional Parameters
15567    ///
15568    /// * *$.xgafv* (query-string) - V1 error format.
15569    /// * *access_token* (query-string) - OAuth access token.
15570    /// * *alt* (query-string) - Data format for response.
15571    /// * *callback* (query-string) - JSONP
15572    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
15573    /// * *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.
15574    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
15575    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
15576    /// * *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.
15577    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
15578    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
15579    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationGlobalPeeringListCall<'a, C>
15580    where
15581        T: AsRef<str>,
15582    {
15583        self._additional_params
15584            .insert(name.as_ref().to_string(), value.as_ref().to_string());
15585        self
15586    }
15587
15588    /// Identifies the authorization scope for the method you are building.
15589    ///
15590    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
15591    /// [`Scope::CloudPlatform`].
15592    ///
15593    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
15594    /// tokens for more than one scope.
15595    ///
15596    /// Usually there is more than one suitable scope to authorize an operation, some of which may
15597    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
15598    /// sufficient, a read-write scope will do as well.
15599    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationGlobalPeeringListCall<'a, C>
15600    where
15601        St: AsRef<str>,
15602    {
15603        self._scopes.insert(String::from(scope.as_ref()));
15604        self
15605    }
15606    /// Identifies the authorization scope(s) for the method you are building.
15607    ///
15608    /// See [`Self::add_scope()`] for details.
15609    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationGlobalPeeringListCall<'a, C>
15610    where
15611        I: IntoIterator<Item = St>,
15612        St: AsRef<str>,
15613    {
15614        self._scopes
15615            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
15616        self
15617    }
15618
15619    /// Removes all scopes, and no default scope will be used either.
15620    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
15621    /// for details).
15622    pub fn clear_scopes(mut self) -> ProjectLocationGlobalPeeringListCall<'a, C> {
15623        self._scopes.clear();
15624        self
15625    }
15626}
15627
15628/// Updates the labels for specified Peering.
15629///
15630/// A builder for the *locations.global.peerings.patch* method supported by a *project* resource.
15631/// It is not used directly, but through a [`ProjectMethods`] instance.
15632///
15633/// # Example
15634///
15635/// Instantiate a resource method builder
15636///
15637/// ```test_harness,no_run
15638/// # extern crate hyper;
15639/// # extern crate hyper_rustls;
15640/// # extern crate google_managedidentities1 as managedidentities1;
15641/// use managedidentities1::api::Peering;
15642/// # async fn dox() {
15643/// # use managedidentities1::{ManagedServiceForMicrosoftActiveDirectoryConsumerAPI, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
15644///
15645/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
15646/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
15647/// #     .with_native_roots()
15648/// #     .unwrap()
15649/// #     .https_only()
15650/// #     .enable_http2()
15651/// #     .build();
15652///
15653/// # let executor = hyper_util::rt::TokioExecutor::new();
15654/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
15655/// #     secret,
15656/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
15657/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
15658/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
15659/// #     ),
15660/// # ).build().await.unwrap();
15661///
15662/// # let client = hyper_util::client::legacy::Client::builder(
15663/// #     hyper_util::rt::TokioExecutor::new()
15664/// # )
15665/// # .build(
15666/// #     hyper_rustls::HttpsConnectorBuilder::new()
15667/// #         .with_native_roots()
15668/// #         .unwrap()
15669/// #         .https_or_http()
15670/// #         .enable_http2()
15671/// #         .build()
15672/// # );
15673/// # let mut hub = ManagedServiceForMicrosoftActiveDirectoryConsumerAPI::new(client, auth);
15674/// // As the method needs a request, you would usually fill it with the desired information
15675/// // into the respective structure. Some of the parts shown here might not be applicable !
15676/// // Values shown here are possibly random and not representative !
15677/// let mut req = Peering::default();
15678///
15679/// // You can configure optional parameters by calling the respective setters at will, and
15680/// // execute the final call using `doit()`.
15681/// // Values shown here are possibly random and not representative !
15682/// let result = hub.projects().locations_global_peerings_patch(req, "name")
15683///              .update_mask(FieldMask::new::<&str>(&[]))
15684///              .doit().await;
15685/// # }
15686/// ```
15687pub struct ProjectLocationGlobalPeeringPatchCall<'a, C>
15688where
15689    C: 'a,
15690{
15691    hub: &'a ManagedServiceForMicrosoftActiveDirectoryConsumerAPI<C>,
15692    _request: Peering,
15693    _name: String,
15694    _update_mask: Option<common::FieldMask>,
15695    _delegate: Option<&'a mut dyn common::Delegate>,
15696    _additional_params: HashMap<String, String>,
15697    _scopes: BTreeSet<String>,
15698}
15699
15700impl<'a, C> common::CallBuilder for ProjectLocationGlobalPeeringPatchCall<'a, C> {}
15701
15702impl<'a, C> ProjectLocationGlobalPeeringPatchCall<'a, C>
15703where
15704    C: common::Connector,
15705{
15706    /// Perform the operation you have build so far.
15707    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
15708        use std::borrow::Cow;
15709        use std::io::{Read, Seek};
15710
15711        use common::{url::Params, ToParts};
15712        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
15713
15714        let mut dd = common::DefaultDelegate;
15715        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
15716        dlg.begin(common::MethodInfo {
15717            id: "managedidentities.projects.locations.global.peerings.patch",
15718            http_method: hyper::Method::PATCH,
15719        });
15720
15721        for &field in ["alt", "name", "updateMask"].iter() {
15722            if self._additional_params.contains_key(field) {
15723                dlg.finished(false);
15724                return Err(common::Error::FieldClash(field));
15725            }
15726        }
15727
15728        let mut params = Params::with_capacity(5 + self._additional_params.len());
15729        params.push("name", self._name);
15730        if let Some(value) = self._update_mask.as_ref() {
15731            params.push("updateMask", value.to_string());
15732        }
15733
15734        params.extend(self._additional_params.iter());
15735
15736        params.push("alt", "json");
15737        let mut url = self.hub._base_url.clone() + "v1/{+name}";
15738        if self._scopes.is_empty() {
15739            self._scopes
15740                .insert(Scope::CloudPlatform.as_ref().to_string());
15741        }
15742
15743        #[allow(clippy::single_element_loop)]
15744        for &(find_this, param_name) in [("{+name}", "name")].iter() {
15745            url = params.uri_replacement(url, param_name, find_this, true);
15746        }
15747        {
15748            let to_remove = ["name"];
15749            params.remove_params(&to_remove);
15750        }
15751
15752        let url = params.parse_with_url(&url);
15753
15754        let mut json_mime_type = mime::APPLICATION_JSON;
15755        let mut request_value_reader = {
15756            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
15757            common::remove_json_null_values(&mut value);
15758            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
15759            serde_json::to_writer(&mut dst, &value).unwrap();
15760            dst
15761        };
15762        let request_size = request_value_reader
15763            .seek(std::io::SeekFrom::End(0))
15764            .unwrap();
15765        request_value_reader
15766            .seek(std::io::SeekFrom::Start(0))
15767            .unwrap();
15768
15769        loop {
15770            let token = match self
15771                .hub
15772                .auth
15773                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
15774                .await
15775            {
15776                Ok(token) => token,
15777                Err(e) => match dlg.token(e) {
15778                    Ok(token) => token,
15779                    Err(e) => {
15780                        dlg.finished(false);
15781                        return Err(common::Error::MissingToken(e));
15782                    }
15783                },
15784            };
15785            request_value_reader
15786                .seek(std::io::SeekFrom::Start(0))
15787                .unwrap();
15788            let mut req_result = {
15789                let client = &self.hub.client;
15790                dlg.pre_request();
15791                let mut req_builder = hyper::Request::builder()
15792                    .method(hyper::Method::PATCH)
15793                    .uri(url.as_str())
15794                    .header(USER_AGENT, self.hub._user_agent.clone());
15795
15796                if let Some(token) = token.as_ref() {
15797                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
15798                }
15799
15800                let request = req_builder
15801                    .header(CONTENT_TYPE, json_mime_type.to_string())
15802                    .header(CONTENT_LENGTH, request_size as u64)
15803                    .body(common::to_body(
15804                        request_value_reader.get_ref().clone().into(),
15805                    ));
15806
15807                client.request(request.unwrap()).await
15808            };
15809
15810            match req_result {
15811                Err(err) => {
15812                    if let common::Retry::After(d) = dlg.http_error(&err) {
15813                        sleep(d).await;
15814                        continue;
15815                    }
15816                    dlg.finished(false);
15817                    return Err(common::Error::HttpError(err));
15818                }
15819                Ok(res) => {
15820                    let (mut parts, body) = res.into_parts();
15821                    let mut body = common::Body::new(body);
15822                    if !parts.status.is_success() {
15823                        let bytes = common::to_bytes(body).await.unwrap_or_default();
15824                        let error = serde_json::from_str(&common::to_string(&bytes));
15825                        let response = common::to_response(parts, bytes.into());
15826
15827                        if let common::Retry::After(d) =
15828                            dlg.http_failure(&response, error.as_ref().ok())
15829                        {
15830                            sleep(d).await;
15831                            continue;
15832                        }
15833
15834                        dlg.finished(false);
15835
15836                        return Err(match error {
15837                            Ok(value) => common::Error::BadRequest(value),
15838                            _ => common::Error::Failure(response),
15839                        });
15840                    }
15841                    let response = {
15842                        let bytes = common::to_bytes(body).await.unwrap_or_default();
15843                        let encoded = common::to_string(&bytes);
15844                        match serde_json::from_str(&encoded) {
15845                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
15846                            Err(error) => {
15847                                dlg.response_json_decode_error(&encoded, &error);
15848                                return Err(common::Error::JsonDecodeError(
15849                                    encoded.to_string(),
15850                                    error,
15851                                ));
15852                            }
15853                        }
15854                    };
15855
15856                    dlg.finished(true);
15857                    return Ok(response);
15858                }
15859            }
15860        }
15861    }
15862
15863    ///
15864    /// Sets the *request* property to the given value.
15865    ///
15866    /// Even though the property as already been set when instantiating this call,
15867    /// we provide this method for API completeness.
15868    pub fn request(mut self, new_value: Peering) -> ProjectLocationGlobalPeeringPatchCall<'a, C> {
15869        self._request = new_value;
15870        self
15871    }
15872    /// Output only. Unique name of the peering in this scope including projects and location using the form: `projects/{project_id}/locations/global/peerings/{peering_id}`.
15873    ///
15874    /// Sets the *name* path property to the given value.
15875    ///
15876    /// Even though the property as already been set when instantiating this call,
15877    /// we provide this method for API completeness.
15878    pub fn name(mut self, new_value: &str) -> ProjectLocationGlobalPeeringPatchCall<'a, C> {
15879        self._name = new_value.to_string();
15880        self
15881    }
15882    /// 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 from Peering: * `labels`
15883    ///
15884    /// Sets the *update mask* query property to the given value.
15885    pub fn update_mask(
15886        mut self,
15887        new_value: common::FieldMask,
15888    ) -> ProjectLocationGlobalPeeringPatchCall<'a, C> {
15889        self._update_mask = Some(new_value);
15890        self
15891    }
15892    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
15893    /// while executing the actual API request.
15894    ///
15895    /// ````text
15896    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
15897    /// ````
15898    ///
15899    /// Sets the *delegate* property to the given value.
15900    pub fn delegate(
15901        mut self,
15902        new_value: &'a mut dyn common::Delegate,
15903    ) -> ProjectLocationGlobalPeeringPatchCall<'a, C> {
15904        self._delegate = Some(new_value);
15905        self
15906    }
15907
15908    /// Set any additional parameter of the query string used in the request.
15909    /// It should be used to set parameters which are not yet available through their own
15910    /// setters.
15911    ///
15912    /// Please note that this method must not be used to set any of the known parameters
15913    /// which have their own setter method. If done anyway, the request will fail.
15914    ///
15915    /// # Additional Parameters
15916    ///
15917    /// * *$.xgafv* (query-string) - V1 error format.
15918    /// * *access_token* (query-string) - OAuth access token.
15919    /// * *alt* (query-string) - Data format for response.
15920    /// * *callback* (query-string) - JSONP
15921    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
15922    /// * *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.
15923    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
15924    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
15925    /// * *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.
15926    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
15927    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
15928    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationGlobalPeeringPatchCall<'a, C>
15929    where
15930        T: AsRef<str>,
15931    {
15932        self._additional_params
15933            .insert(name.as_ref().to_string(), value.as_ref().to_string());
15934        self
15935    }
15936
15937    /// Identifies the authorization scope for the method you are building.
15938    ///
15939    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
15940    /// [`Scope::CloudPlatform`].
15941    ///
15942    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
15943    /// tokens for more than one scope.
15944    ///
15945    /// Usually there is more than one suitable scope to authorize an operation, some of which may
15946    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
15947    /// sufficient, a read-write scope will do as well.
15948    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationGlobalPeeringPatchCall<'a, C>
15949    where
15950        St: AsRef<str>,
15951    {
15952        self._scopes.insert(String::from(scope.as_ref()));
15953        self
15954    }
15955    /// Identifies the authorization scope(s) for the method you are building.
15956    ///
15957    /// See [`Self::add_scope()`] for details.
15958    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationGlobalPeeringPatchCall<'a, C>
15959    where
15960        I: IntoIterator<Item = St>,
15961        St: AsRef<str>,
15962    {
15963        self._scopes
15964            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
15965        self
15966    }
15967
15968    /// Removes all scopes, and no default scope will be used either.
15969    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
15970    /// for details).
15971    pub fn clear_scopes(mut self) -> ProjectLocationGlobalPeeringPatchCall<'a, C> {
15972        self._scopes.clear();
15973        self
15974    }
15975}
15976
15977/// Sets the access control policy on the specified resource. Replaces any existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` errors.
15978///
15979/// A builder for the *locations.global.peerings.setIamPolicy* method supported by a *project* resource.
15980/// It is not used directly, but through a [`ProjectMethods`] instance.
15981///
15982/// # Example
15983///
15984/// Instantiate a resource method builder
15985///
15986/// ```test_harness,no_run
15987/// # extern crate hyper;
15988/// # extern crate hyper_rustls;
15989/// # extern crate google_managedidentities1 as managedidentities1;
15990/// use managedidentities1::api::SetIamPolicyRequest;
15991/// # async fn dox() {
15992/// # use managedidentities1::{ManagedServiceForMicrosoftActiveDirectoryConsumerAPI, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
15993///
15994/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
15995/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
15996/// #     .with_native_roots()
15997/// #     .unwrap()
15998/// #     .https_only()
15999/// #     .enable_http2()
16000/// #     .build();
16001///
16002/// # let executor = hyper_util::rt::TokioExecutor::new();
16003/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
16004/// #     secret,
16005/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
16006/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
16007/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
16008/// #     ),
16009/// # ).build().await.unwrap();
16010///
16011/// # let client = hyper_util::client::legacy::Client::builder(
16012/// #     hyper_util::rt::TokioExecutor::new()
16013/// # )
16014/// # .build(
16015/// #     hyper_rustls::HttpsConnectorBuilder::new()
16016/// #         .with_native_roots()
16017/// #         .unwrap()
16018/// #         .https_or_http()
16019/// #         .enable_http2()
16020/// #         .build()
16021/// # );
16022/// # let mut hub = ManagedServiceForMicrosoftActiveDirectoryConsumerAPI::new(client, auth);
16023/// // As the method needs a request, you would usually fill it with the desired information
16024/// // into the respective structure. Some of the parts shown here might not be applicable !
16025/// // Values shown here are possibly random and not representative !
16026/// let mut req = SetIamPolicyRequest::default();
16027///
16028/// // You can configure optional parameters by calling the respective setters at will, and
16029/// // execute the final call using `doit()`.
16030/// // Values shown here are possibly random and not representative !
16031/// let result = hub.projects().locations_global_peerings_set_iam_policy(req, "resource")
16032///              .doit().await;
16033/// # }
16034/// ```
16035pub struct ProjectLocationGlobalPeeringSetIamPolicyCall<'a, C>
16036where
16037    C: 'a,
16038{
16039    hub: &'a ManagedServiceForMicrosoftActiveDirectoryConsumerAPI<C>,
16040    _request: SetIamPolicyRequest,
16041    _resource: String,
16042    _delegate: Option<&'a mut dyn common::Delegate>,
16043    _additional_params: HashMap<String, String>,
16044    _scopes: BTreeSet<String>,
16045}
16046
16047impl<'a, C> common::CallBuilder for ProjectLocationGlobalPeeringSetIamPolicyCall<'a, C> {}
16048
16049impl<'a, C> ProjectLocationGlobalPeeringSetIamPolicyCall<'a, C>
16050where
16051    C: common::Connector,
16052{
16053    /// Perform the operation you have build so far.
16054    pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
16055        use std::borrow::Cow;
16056        use std::io::{Read, Seek};
16057
16058        use common::{url::Params, ToParts};
16059        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
16060
16061        let mut dd = common::DefaultDelegate;
16062        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
16063        dlg.begin(common::MethodInfo {
16064            id: "managedidentities.projects.locations.global.peerings.setIamPolicy",
16065            http_method: hyper::Method::POST,
16066        });
16067
16068        for &field in ["alt", "resource"].iter() {
16069            if self._additional_params.contains_key(field) {
16070                dlg.finished(false);
16071                return Err(common::Error::FieldClash(field));
16072            }
16073        }
16074
16075        let mut params = Params::with_capacity(4 + self._additional_params.len());
16076        params.push("resource", self._resource);
16077
16078        params.extend(self._additional_params.iter());
16079
16080        params.push("alt", "json");
16081        let mut url = self.hub._base_url.clone() + "v1/{+resource}:setIamPolicy";
16082        if self._scopes.is_empty() {
16083            self._scopes
16084                .insert(Scope::CloudPlatform.as_ref().to_string());
16085        }
16086
16087        #[allow(clippy::single_element_loop)]
16088        for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
16089            url = params.uri_replacement(url, param_name, find_this, true);
16090        }
16091        {
16092            let to_remove = ["resource"];
16093            params.remove_params(&to_remove);
16094        }
16095
16096        let url = params.parse_with_url(&url);
16097
16098        let mut json_mime_type = mime::APPLICATION_JSON;
16099        let mut request_value_reader = {
16100            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
16101            common::remove_json_null_values(&mut value);
16102            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
16103            serde_json::to_writer(&mut dst, &value).unwrap();
16104            dst
16105        };
16106        let request_size = request_value_reader
16107            .seek(std::io::SeekFrom::End(0))
16108            .unwrap();
16109        request_value_reader
16110            .seek(std::io::SeekFrom::Start(0))
16111            .unwrap();
16112
16113        loop {
16114            let token = match self
16115                .hub
16116                .auth
16117                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
16118                .await
16119            {
16120                Ok(token) => token,
16121                Err(e) => match dlg.token(e) {
16122                    Ok(token) => token,
16123                    Err(e) => {
16124                        dlg.finished(false);
16125                        return Err(common::Error::MissingToken(e));
16126                    }
16127                },
16128            };
16129            request_value_reader
16130                .seek(std::io::SeekFrom::Start(0))
16131                .unwrap();
16132            let mut req_result = {
16133                let client = &self.hub.client;
16134                dlg.pre_request();
16135                let mut req_builder = hyper::Request::builder()
16136                    .method(hyper::Method::POST)
16137                    .uri(url.as_str())
16138                    .header(USER_AGENT, self.hub._user_agent.clone());
16139
16140                if let Some(token) = token.as_ref() {
16141                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
16142                }
16143
16144                let request = req_builder
16145                    .header(CONTENT_TYPE, json_mime_type.to_string())
16146                    .header(CONTENT_LENGTH, request_size as u64)
16147                    .body(common::to_body(
16148                        request_value_reader.get_ref().clone().into(),
16149                    ));
16150
16151                client.request(request.unwrap()).await
16152            };
16153
16154            match req_result {
16155                Err(err) => {
16156                    if let common::Retry::After(d) = dlg.http_error(&err) {
16157                        sleep(d).await;
16158                        continue;
16159                    }
16160                    dlg.finished(false);
16161                    return Err(common::Error::HttpError(err));
16162                }
16163                Ok(res) => {
16164                    let (mut parts, body) = res.into_parts();
16165                    let mut body = common::Body::new(body);
16166                    if !parts.status.is_success() {
16167                        let bytes = common::to_bytes(body).await.unwrap_or_default();
16168                        let error = serde_json::from_str(&common::to_string(&bytes));
16169                        let response = common::to_response(parts, bytes.into());
16170
16171                        if let common::Retry::After(d) =
16172                            dlg.http_failure(&response, error.as_ref().ok())
16173                        {
16174                            sleep(d).await;
16175                            continue;
16176                        }
16177
16178                        dlg.finished(false);
16179
16180                        return Err(match error {
16181                            Ok(value) => common::Error::BadRequest(value),
16182                            _ => common::Error::Failure(response),
16183                        });
16184                    }
16185                    let response = {
16186                        let bytes = common::to_bytes(body).await.unwrap_or_default();
16187                        let encoded = common::to_string(&bytes);
16188                        match serde_json::from_str(&encoded) {
16189                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
16190                            Err(error) => {
16191                                dlg.response_json_decode_error(&encoded, &error);
16192                                return Err(common::Error::JsonDecodeError(
16193                                    encoded.to_string(),
16194                                    error,
16195                                ));
16196                            }
16197                        }
16198                    };
16199
16200                    dlg.finished(true);
16201                    return Ok(response);
16202                }
16203            }
16204        }
16205    }
16206
16207    ///
16208    /// Sets the *request* property to the given value.
16209    ///
16210    /// Even though the property as already been set when instantiating this call,
16211    /// we provide this method for API completeness.
16212    pub fn request(
16213        mut self,
16214        new_value: SetIamPolicyRequest,
16215    ) -> ProjectLocationGlobalPeeringSetIamPolicyCall<'a, C> {
16216        self._request = new_value;
16217        self
16218    }
16219    /// REQUIRED: The resource for which the policy is being specified. See [Resource names](https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
16220    ///
16221    /// Sets the *resource* path property to the given value.
16222    ///
16223    /// Even though the property as already been set when instantiating this call,
16224    /// we provide this method for API completeness.
16225    pub fn resource(
16226        mut self,
16227        new_value: &str,
16228    ) -> ProjectLocationGlobalPeeringSetIamPolicyCall<'a, C> {
16229        self._resource = new_value.to_string();
16230        self
16231    }
16232    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
16233    /// while executing the actual API request.
16234    ///
16235    /// ````text
16236    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
16237    /// ````
16238    ///
16239    /// Sets the *delegate* property to the given value.
16240    pub fn delegate(
16241        mut self,
16242        new_value: &'a mut dyn common::Delegate,
16243    ) -> ProjectLocationGlobalPeeringSetIamPolicyCall<'a, C> {
16244        self._delegate = Some(new_value);
16245        self
16246    }
16247
16248    /// Set any additional parameter of the query string used in the request.
16249    /// It should be used to set parameters which are not yet available through their own
16250    /// setters.
16251    ///
16252    /// Please note that this method must not be used to set any of the known parameters
16253    /// which have their own setter method. If done anyway, the request will fail.
16254    ///
16255    /// # Additional Parameters
16256    ///
16257    /// * *$.xgafv* (query-string) - V1 error format.
16258    /// * *access_token* (query-string) - OAuth access token.
16259    /// * *alt* (query-string) - Data format for response.
16260    /// * *callback* (query-string) - JSONP
16261    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
16262    /// * *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.
16263    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
16264    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
16265    /// * *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.
16266    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
16267    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
16268    pub fn param<T>(
16269        mut self,
16270        name: T,
16271        value: T,
16272    ) -> ProjectLocationGlobalPeeringSetIamPolicyCall<'a, C>
16273    where
16274        T: AsRef<str>,
16275    {
16276        self._additional_params
16277            .insert(name.as_ref().to_string(), value.as_ref().to_string());
16278        self
16279    }
16280
16281    /// Identifies the authorization scope for the method you are building.
16282    ///
16283    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
16284    /// [`Scope::CloudPlatform`].
16285    ///
16286    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
16287    /// tokens for more than one scope.
16288    ///
16289    /// Usually there is more than one suitable scope to authorize an operation, some of which may
16290    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
16291    /// sufficient, a read-write scope will do as well.
16292    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationGlobalPeeringSetIamPolicyCall<'a, C>
16293    where
16294        St: AsRef<str>,
16295    {
16296        self._scopes.insert(String::from(scope.as_ref()));
16297        self
16298    }
16299    /// Identifies the authorization scope(s) for the method you are building.
16300    ///
16301    /// See [`Self::add_scope()`] for details.
16302    pub fn add_scopes<I, St>(
16303        mut self,
16304        scopes: I,
16305    ) -> ProjectLocationGlobalPeeringSetIamPolicyCall<'a, C>
16306    where
16307        I: IntoIterator<Item = St>,
16308        St: AsRef<str>,
16309    {
16310        self._scopes
16311            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
16312        self
16313    }
16314
16315    /// Removes all scopes, and no default scope will be used either.
16316    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
16317    /// for details).
16318    pub fn clear_scopes(mut self) -> ProjectLocationGlobalPeeringSetIamPolicyCall<'a, C> {
16319        self._scopes.clear();
16320        self
16321    }
16322}
16323
16324/// Returns permissions that a caller has on the specified resource. If the resource does not exist, this will return an empty set of permissions, not a `NOT_FOUND` error. Note: This operation is designed to be used for building permission-aware UIs and command-line tools, not for authorization checking. This operation may "fail open" without warning.
16325///
16326/// A builder for the *locations.global.peerings.testIamPermissions* method supported by a *project* resource.
16327/// It is not used directly, but through a [`ProjectMethods`] instance.
16328///
16329/// # Example
16330///
16331/// Instantiate a resource method builder
16332///
16333/// ```test_harness,no_run
16334/// # extern crate hyper;
16335/// # extern crate hyper_rustls;
16336/// # extern crate google_managedidentities1 as managedidentities1;
16337/// use managedidentities1::api::TestIamPermissionsRequest;
16338/// # async fn dox() {
16339/// # use managedidentities1::{ManagedServiceForMicrosoftActiveDirectoryConsumerAPI, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
16340///
16341/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
16342/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
16343/// #     .with_native_roots()
16344/// #     .unwrap()
16345/// #     .https_only()
16346/// #     .enable_http2()
16347/// #     .build();
16348///
16349/// # let executor = hyper_util::rt::TokioExecutor::new();
16350/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
16351/// #     secret,
16352/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
16353/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
16354/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
16355/// #     ),
16356/// # ).build().await.unwrap();
16357///
16358/// # let client = hyper_util::client::legacy::Client::builder(
16359/// #     hyper_util::rt::TokioExecutor::new()
16360/// # )
16361/// # .build(
16362/// #     hyper_rustls::HttpsConnectorBuilder::new()
16363/// #         .with_native_roots()
16364/// #         .unwrap()
16365/// #         .https_or_http()
16366/// #         .enable_http2()
16367/// #         .build()
16368/// # );
16369/// # let mut hub = ManagedServiceForMicrosoftActiveDirectoryConsumerAPI::new(client, auth);
16370/// // As the method needs a request, you would usually fill it with the desired information
16371/// // into the respective structure. Some of the parts shown here might not be applicable !
16372/// // Values shown here are possibly random and not representative !
16373/// let mut req = TestIamPermissionsRequest::default();
16374///
16375/// // You can configure optional parameters by calling the respective setters at will, and
16376/// // execute the final call using `doit()`.
16377/// // Values shown here are possibly random and not representative !
16378/// let result = hub.projects().locations_global_peerings_test_iam_permissions(req, "resource")
16379///              .doit().await;
16380/// # }
16381/// ```
16382pub struct ProjectLocationGlobalPeeringTestIamPermissionCall<'a, C>
16383where
16384    C: 'a,
16385{
16386    hub: &'a ManagedServiceForMicrosoftActiveDirectoryConsumerAPI<C>,
16387    _request: TestIamPermissionsRequest,
16388    _resource: String,
16389    _delegate: Option<&'a mut dyn common::Delegate>,
16390    _additional_params: HashMap<String, String>,
16391    _scopes: BTreeSet<String>,
16392}
16393
16394impl<'a, C> common::CallBuilder for ProjectLocationGlobalPeeringTestIamPermissionCall<'a, C> {}
16395
16396impl<'a, C> ProjectLocationGlobalPeeringTestIamPermissionCall<'a, C>
16397where
16398    C: common::Connector,
16399{
16400    /// Perform the operation you have build so far.
16401    pub async fn doit(mut self) -> common::Result<(common::Response, TestIamPermissionsResponse)> {
16402        use std::borrow::Cow;
16403        use std::io::{Read, Seek};
16404
16405        use common::{url::Params, ToParts};
16406        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
16407
16408        let mut dd = common::DefaultDelegate;
16409        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
16410        dlg.begin(common::MethodInfo {
16411            id: "managedidentities.projects.locations.global.peerings.testIamPermissions",
16412            http_method: hyper::Method::POST,
16413        });
16414
16415        for &field in ["alt", "resource"].iter() {
16416            if self._additional_params.contains_key(field) {
16417                dlg.finished(false);
16418                return Err(common::Error::FieldClash(field));
16419            }
16420        }
16421
16422        let mut params = Params::with_capacity(4 + self._additional_params.len());
16423        params.push("resource", self._resource);
16424
16425        params.extend(self._additional_params.iter());
16426
16427        params.push("alt", "json");
16428        let mut url = self.hub._base_url.clone() + "v1/{+resource}:testIamPermissions";
16429        if self._scopes.is_empty() {
16430            self._scopes
16431                .insert(Scope::CloudPlatform.as_ref().to_string());
16432        }
16433
16434        #[allow(clippy::single_element_loop)]
16435        for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
16436            url = params.uri_replacement(url, param_name, find_this, true);
16437        }
16438        {
16439            let to_remove = ["resource"];
16440            params.remove_params(&to_remove);
16441        }
16442
16443        let url = params.parse_with_url(&url);
16444
16445        let mut json_mime_type = mime::APPLICATION_JSON;
16446        let mut request_value_reader = {
16447            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
16448            common::remove_json_null_values(&mut value);
16449            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
16450            serde_json::to_writer(&mut dst, &value).unwrap();
16451            dst
16452        };
16453        let request_size = request_value_reader
16454            .seek(std::io::SeekFrom::End(0))
16455            .unwrap();
16456        request_value_reader
16457            .seek(std::io::SeekFrom::Start(0))
16458            .unwrap();
16459
16460        loop {
16461            let token = match self
16462                .hub
16463                .auth
16464                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
16465                .await
16466            {
16467                Ok(token) => token,
16468                Err(e) => match dlg.token(e) {
16469                    Ok(token) => token,
16470                    Err(e) => {
16471                        dlg.finished(false);
16472                        return Err(common::Error::MissingToken(e));
16473                    }
16474                },
16475            };
16476            request_value_reader
16477                .seek(std::io::SeekFrom::Start(0))
16478                .unwrap();
16479            let mut req_result = {
16480                let client = &self.hub.client;
16481                dlg.pre_request();
16482                let mut req_builder = hyper::Request::builder()
16483                    .method(hyper::Method::POST)
16484                    .uri(url.as_str())
16485                    .header(USER_AGENT, self.hub._user_agent.clone());
16486
16487                if let Some(token) = token.as_ref() {
16488                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
16489                }
16490
16491                let request = req_builder
16492                    .header(CONTENT_TYPE, json_mime_type.to_string())
16493                    .header(CONTENT_LENGTH, request_size as u64)
16494                    .body(common::to_body(
16495                        request_value_reader.get_ref().clone().into(),
16496                    ));
16497
16498                client.request(request.unwrap()).await
16499            };
16500
16501            match req_result {
16502                Err(err) => {
16503                    if let common::Retry::After(d) = dlg.http_error(&err) {
16504                        sleep(d).await;
16505                        continue;
16506                    }
16507                    dlg.finished(false);
16508                    return Err(common::Error::HttpError(err));
16509                }
16510                Ok(res) => {
16511                    let (mut parts, body) = res.into_parts();
16512                    let mut body = common::Body::new(body);
16513                    if !parts.status.is_success() {
16514                        let bytes = common::to_bytes(body).await.unwrap_or_default();
16515                        let error = serde_json::from_str(&common::to_string(&bytes));
16516                        let response = common::to_response(parts, bytes.into());
16517
16518                        if let common::Retry::After(d) =
16519                            dlg.http_failure(&response, error.as_ref().ok())
16520                        {
16521                            sleep(d).await;
16522                            continue;
16523                        }
16524
16525                        dlg.finished(false);
16526
16527                        return Err(match error {
16528                            Ok(value) => common::Error::BadRequest(value),
16529                            _ => common::Error::Failure(response),
16530                        });
16531                    }
16532                    let response = {
16533                        let bytes = common::to_bytes(body).await.unwrap_or_default();
16534                        let encoded = common::to_string(&bytes);
16535                        match serde_json::from_str(&encoded) {
16536                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
16537                            Err(error) => {
16538                                dlg.response_json_decode_error(&encoded, &error);
16539                                return Err(common::Error::JsonDecodeError(
16540                                    encoded.to_string(),
16541                                    error,
16542                                ));
16543                            }
16544                        }
16545                    };
16546
16547                    dlg.finished(true);
16548                    return Ok(response);
16549                }
16550            }
16551        }
16552    }
16553
16554    ///
16555    /// Sets the *request* property to the given value.
16556    ///
16557    /// Even though the property as already been set when instantiating this call,
16558    /// we provide this method for API completeness.
16559    pub fn request(
16560        mut self,
16561        new_value: TestIamPermissionsRequest,
16562    ) -> ProjectLocationGlobalPeeringTestIamPermissionCall<'a, C> {
16563        self._request = new_value;
16564        self
16565    }
16566    /// REQUIRED: The resource for which the policy detail is being requested. See [Resource names](https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
16567    ///
16568    /// Sets the *resource* path property to the given value.
16569    ///
16570    /// Even though the property as already been set when instantiating this call,
16571    /// we provide this method for API completeness.
16572    pub fn resource(
16573        mut self,
16574        new_value: &str,
16575    ) -> ProjectLocationGlobalPeeringTestIamPermissionCall<'a, C> {
16576        self._resource = new_value.to_string();
16577        self
16578    }
16579    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
16580    /// while executing the actual API request.
16581    ///
16582    /// ````text
16583    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
16584    /// ````
16585    ///
16586    /// Sets the *delegate* property to the given value.
16587    pub fn delegate(
16588        mut self,
16589        new_value: &'a mut dyn common::Delegate,
16590    ) -> ProjectLocationGlobalPeeringTestIamPermissionCall<'a, C> {
16591        self._delegate = Some(new_value);
16592        self
16593    }
16594
16595    /// Set any additional parameter of the query string used in the request.
16596    /// It should be used to set parameters which are not yet available through their own
16597    /// setters.
16598    ///
16599    /// Please note that this method must not be used to set any of the known parameters
16600    /// which have their own setter method. If done anyway, the request will fail.
16601    ///
16602    /// # Additional Parameters
16603    ///
16604    /// * *$.xgafv* (query-string) - V1 error format.
16605    /// * *access_token* (query-string) - OAuth access token.
16606    /// * *alt* (query-string) - Data format for response.
16607    /// * *callback* (query-string) - JSONP
16608    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
16609    /// * *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.
16610    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
16611    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
16612    /// * *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.
16613    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
16614    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
16615    pub fn param<T>(
16616        mut self,
16617        name: T,
16618        value: T,
16619    ) -> ProjectLocationGlobalPeeringTestIamPermissionCall<'a, C>
16620    where
16621        T: AsRef<str>,
16622    {
16623        self._additional_params
16624            .insert(name.as_ref().to_string(), value.as_ref().to_string());
16625        self
16626    }
16627
16628    /// Identifies the authorization scope for the method you are building.
16629    ///
16630    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
16631    /// [`Scope::CloudPlatform`].
16632    ///
16633    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
16634    /// tokens for more than one scope.
16635    ///
16636    /// Usually there is more than one suitable scope to authorize an operation, some of which may
16637    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
16638    /// sufficient, a read-write scope will do as well.
16639    pub fn add_scope<St>(
16640        mut self,
16641        scope: St,
16642    ) -> ProjectLocationGlobalPeeringTestIamPermissionCall<'a, C>
16643    where
16644        St: AsRef<str>,
16645    {
16646        self._scopes.insert(String::from(scope.as_ref()));
16647        self
16648    }
16649    /// Identifies the authorization scope(s) for the method you are building.
16650    ///
16651    /// See [`Self::add_scope()`] for details.
16652    pub fn add_scopes<I, St>(
16653        mut self,
16654        scopes: I,
16655    ) -> ProjectLocationGlobalPeeringTestIamPermissionCall<'a, C>
16656    where
16657        I: IntoIterator<Item = St>,
16658        St: AsRef<str>,
16659    {
16660        self._scopes
16661            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
16662        self
16663    }
16664
16665    /// Removes all scopes, and no default scope will be used either.
16666    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
16667    /// for details).
16668    pub fn clear_scopes(mut self) -> ProjectLocationGlobalPeeringTestIamPermissionCall<'a, C> {
16669        self._scopes.clear();
16670        self
16671    }
16672}
16673
16674/// Gets information about a location.
16675///
16676/// A builder for the *locations.get* method supported by a *project* resource.
16677/// It is not used directly, but through a [`ProjectMethods`] instance.
16678///
16679/// # Example
16680///
16681/// Instantiate a resource method builder
16682///
16683/// ```test_harness,no_run
16684/// # extern crate hyper;
16685/// # extern crate hyper_rustls;
16686/// # extern crate google_managedidentities1 as managedidentities1;
16687/// # async fn dox() {
16688/// # use managedidentities1::{ManagedServiceForMicrosoftActiveDirectoryConsumerAPI, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
16689///
16690/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
16691/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
16692/// #     .with_native_roots()
16693/// #     .unwrap()
16694/// #     .https_only()
16695/// #     .enable_http2()
16696/// #     .build();
16697///
16698/// # let executor = hyper_util::rt::TokioExecutor::new();
16699/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
16700/// #     secret,
16701/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
16702/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
16703/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
16704/// #     ),
16705/// # ).build().await.unwrap();
16706///
16707/// # let client = hyper_util::client::legacy::Client::builder(
16708/// #     hyper_util::rt::TokioExecutor::new()
16709/// # )
16710/// # .build(
16711/// #     hyper_rustls::HttpsConnectorBuilder::new()
16712/// #         .with_native_roots()
16713/// #         .unwrap()
16714/// #         .https_or_http()
16715/// #         .enable_http2()
16716/// #         .build()
16717/// # );
16718/// # let mut hub = ManagedServiceForMicrosoftActiveDirectoryConsumerAPI::new(client, auth);
16719/// // You can configure optional parameters by calling the respective setters at will, and
16720/// // execute the final call using `doit()`.
16721/// // Values shown here are possibly random and not representative !
16722/// let result = hub.projects().locations_get("name")
16723///              .doit().await;
16724/// # }
16725/// ```
16726pub struct ProjectLocationGetCall<'a, C>
16727where
16728    C: 'a,
16729{
16730    hub: &'a ManagedServiceForMicrosoftActiveDirectoryConsumerAPI<C>,
16731    _name: String,
16732    _delegate: Option<&'a mut dyn common::Delegate>,
16733    _additional_params: HashMap<String, String>,
16734    _scopes: BTreeSet<String>,
16735}
16736
16737impl<'a, C> common::CallBuilder for ProjectLocationGetCall<'a, C> {}
16738
16739impl<'a, C> ProjectLocationGetCall<'a, C>
16740where
16741    C: common::Connector,
16742{
16743    /// Perform the operation you have build so far.
16744    pub async fn doit(mut self) -> common::Result<(common::Response, Location)> {
16745        use std::borrow::Cow;
16746        use std::io::{Read, Seek};
16747
16748        use common::{url::Params, ToParts};
16749        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
16750
16751        let mut dd = common::DefaultDelegate;
16752        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
16753        dlg.begin(common::MethodInfo {
16754            id: "managedidentities.projects.locations.get",
16755            http_method: hyper::Method::GET,
16756        });
16757
16758        for &field in ["alt", "name"].iter() {
16759            if self._additional_params.contains_key(field) {
16760                dlg.finished(false);
16761                return Err(common::Error::FieldClash(field));
16762            }
16763        }
16764
16765        let mut params = Params::with_capacity(3 + self._additional_params.len());
16766        params.push("name", self._name);
16767
16768        params.extend(self._additional_params.iter());
16769
16770        params.push("alt", "json");
16771        let mut url = self.hub._base_url.clone() + "v1/{+name}";
16772        if self._scopes.is_empty() {
16773            self._scopes
16774                .insert(Scope::CloudPlatform.as_ref().to_string());
16775        }
16776
16777        #[allow(clippy::single_element_loop)]
16778        for &(find_this, param_name) in [("{+name}", "name")].iter() {
16779            url = params.uri_replacement(url, param_name, find_this, true);
16780        }
16781        {
16782            let to_remove = ["name"];
16783            params.remove_params(&to_remove);
16784        }
16785
16786        let url = params.parse_with_url(&url);
16787
16788        loop {
16789            let token = match self
16790                .hub
16791                .auth
16792                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
16793                .await
16794            {
16795                Ok(token) => token,
16796                Err(e) => match dlg.token(e) {
16797                    Ok(token) => token,
16798                    Err(e) => {
16799                        dlg.finished(false);
16800                        return Err(common::Error::MissingToken(e));
16801                    }
16802                },
16803            };
16804            let mut req_result = {
16805                let client = &self.hub.client;
16806                dlg.pre_request();
16807                let mut req_builder = hyper::Request::builder()
16808                    .method(hyper::Method::GET)
16809                    .uri(url.as_str())
16810                    .header(USER_AGENT, self.hub._user_agent.clone());
16811
16812                if let Some(token) = token.as_ref() {
16813                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
16814                }
16815
16816                let request = req_builder
16817                    .header(CONTENT_LENGTH, 0_u64)
16818                    .body(common::to_body::<String>(None));
16819
16820                client.request(request.unwrap()).await
16821            };
16822
16823            match req_result {
16824                Err(err) => {
16825                    if let common::Retry::After(d) = dlg.http_error(&err) {
16826                        sleep(d).await;
16827                        continue;
16828                    }
16829                    dlg.finished(false);
16830                    return Err(common::Error::HttpError(err));
16831                }
16832                Ok(res) => {
16833                    let (mut parts, body) = res.into_parts();
16834                    let mut body = common::Body::new(body);
16835                    if !parts.status.is_success() {
16836                        let bytes = common::to_bytes(body).await.unwrap_or_default();
16837                        let error = serde_json::from_str(&common::to_string(&bytes));
16838                        let response = common::to_response(parts, bytes.into());
16839
16840                        if let common::Retry::After(d) =
16841                            dlg.http_failure(&response, error.as_ref().ok())
16842                        {
16843                            sleep(d).await;
16844                            continue;
16845                        }
16846
16847                        dlg.finished(false);
16848
16849                        return Err(match error {
16850                            Ok(value) => common::Error::BadRequest(value),
16851                            _ => common::Error::Failure(response),
16852                        });
16853                    }
16854                    let response = {
16855                        let bytes = common::to_bytes(body).await.unwrap_or_default();
16856                        let encoded = common::to_string(&bytes);
16857                        match serde_json::from_str(&encoded) {
16858                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
16859                            Err(error) => {
16860                                dlg.response_json_decode_error(&encoded, &error);
16861                                return Err(common::Error::JsonDecodeError(
16862                                    encoded.to_string(),
16863                                    error,
16864                                ));
16865                            }
16866                        }
16867                    };
16868
16869                    dlg.finished(true);
16870                    return Ok(response);
16871                }
16872            }
16873        }
16874    }
16875
16876    /// Resource name for the location.
16877    ///
16878    /// Sets the *name* path property to the given value.
16879    ///
16880    /// Even though the property as already been set when instantiating this call,
16881    /// we provide this method for API completeness.
16882    pub fn name(mut self, new_value: &str) -> ProjectLocationGetCall<'a, C> {
16883        self._name = new_value.to_string();
16884        self
16885    }
16886    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
16887    /// while executing the actual API request.
16888    ///
16889    /// ````text
16890    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
16891    /// ````
16892    ///
16893    /// Sets the *delegate* property to the given value.
16894    pub fn delegate(
16895        mut self,
16896        new_value: &'a mut dyn common::Delegate,
16897    ) -> ProjectLocationGetCall<'a, C> {
16898        self._delegate = Some(new_value);
16899        self
16900    }
16901
16902    /// Set any additional parameter of the query string used in the request.
16903    /// It should be used to set parameters which are not yet available through their own
16904    /// setters.
16905    ///
16906    /// Please note that this method must not be used to set any of the known parameters
16907    /// which have their own setter method. If done anyway, the request will fail.
16908    ///
16909    /// # Additional Parameters
16910    ///
16911    /// * *$.xgafv* (query-string) - V1 error format.
16912    /// * *access_token* (query-string) - OAuth access token.
16913    /// * *alt* (query-string) - Data format for response.
16914    /// * *callback* (query-string) - JSONP
16915    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
16916    /// * *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.
16917    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
16918    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
16919    /// * *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.
16920    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
16921    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
16922    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationGetCall<'a, C>
16923    where
16924        T: AsRef<str>,
16925    {
16926        self._additional_params
16927            .insert(name.as_ref().to_string(), value.as_ref().to_string());
16928        self
16929    }
16930
16931    /// Identifies the authorization scope for the method you are building.
16932    ///
16933    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
16934    /// [`Scope::CloudPlatform`].
16935    ///
16936    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
16937    /// tokens for more than one scope.
16938    ///
16939    /// Usually there is more than one suitable scope to authorize an operation, some of which may
16940    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
16941    /// sufficient, a read-write scope will do as well.
16942    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationGetCall<'a, C>
16943    where
16944        St: AsRef<str>,
16945    {
16946        self._scopes.insert(String::from(scope.as_ref()));
16947        self
16948    }
16949    /// Identifies the authorization scope(s) for the method you are building.
16950    ///
16951    /// See [`Self::add_scope()`] for details.
16952    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationGetCall<'a, C>
16953    where
16954        I: IntoIterator<Item = St>,
16955        St: AsRef<str>,
16956    {
16957        self._scopes
16958            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
16959        self
16960    }
16961
16962    /// Removes all scopes, and no default scope will be used either.
16963    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
16964    /// for details).
16965    pub fn clear_scopes(mut self) -> ProjectLocationGetCall<'a, C> {
16966        self._scopes.clear();
16967        self
16968    }
16969}
16970
16971/// Lists information about the supported locations for this service.
16972///
16973/// A builder for the *locations.list* method supported by a *project* resource.
16974/// It is not used directly, but through a [`ProjectMethods`] instance.
16975///
16976/// # Example
16977///
16978/// Instantiate a resource method builder
16979///
16980/// ```test_harness,no_run
16981/// # extern crate hyper;
16982/// # extern crate hyper_rustls;
16983/// # extern crate google_managedidentities1 as managedidentities1;
16984/// # async fn dox() {
16985/// # use managedidentities1::{ManagedServiceForMicrosoftActiveDirectoryConsumerAPI, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
16986///
16987/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
16988/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
16989/// #     .with_native_roots()
16990/// #     .unwrap()
16991/// #     .https_only()
16992/// #     .enable_http2()
16993/// #     .build();
16994///
16995/// # let executor = hyper_util::rt::TokioExecutor::new();
16996/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
16997/// #     secret,
16998/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
16999/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
17000/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
17001/// #     ),
17002/// # ).build().await.unwrap();
17003///
17004/// # let client = hyper_util::client::legacy::Client::builder(
17005/// #     hyper_util::rt::TokioExecutor::new()
17006/// # )
17007/// # .build(
17008/// #     hyper_rustls::HttpsConnectorBuilder::new()
17009/// #         .with_native_roots()
17010/// #         .unwrap()
17011/// #         .https_or_http()
17012/// #         .enable_http2()
17013/// #         .build()
17014/// # );
17015/// # let mut hub = ManagedServiceForMicrosoftActiveDirectoryConsumerAPI::new(client, auth);
17016/// // You can configure optional parameters by calling the respective setters at will, and
17017/// // execute the final call using `doit()`.
17018/// // Values shown here are possibly random and not representative !
17019/// let result = hub.projects().locations_list("name")
17020///              .page_token("takimata")
17021///              .page_size(-46)
17022///              .filter("voluptua.")
17023///              .doit().await;
17024/// # }
17025/// ```
17026pub struct ProjectLocationListCall<'a, C>
17027where
17028    C: 'a,
17029{
17030    hub: &'a ManagedServiceForMicrosoftActiveDirectoryConsumerAPI<C>,
17031    _name: String,
17032    _page_token: Option<String>,
17033    _page_size: Option<i32>,
17034    _filter: Option<String>,
17035    _delegate: Option<&'a mut dyn common::Delegate>,
17036    _additional_params: HashMap<String, String>,
17037    _scopes: BTreeSet<String>,
17038}
17039
17040impl<'a, C> common::CallBuilder for ProjectLocationListCall<'a, C> {}
17041
17042impl<'a, C> ProjectLocationListCall<'a, C>
17043where
17044    C: common::Connector,
17045{
17046    /// Perform the operation you have build so far.
17047    pub async fn doit(mut self) -> common::Result<(common::Response, ListLocationsResponse)> {
17048        use std::borrow::Cow;
17049        use std::io::{Read, Seek};
17050
17051        use common::{url::Params, ToParts};
17052        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
17053
17054        let mut dd = common::DefaultDelegate;
17055        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
17056        dlg.begin(common::MethodInfo {
17057            id: "managedidentities.projects.locations.list",
17058            http_method: hyper::Method::GET,
17059        });
17060
17061        for &field in ["alt", "name", "pageToken", "pageSize", "filter"].iter() {
17062            if self._additional_params.contains_key(field) {
17063                dlg.finished(false);
17064                return Err(common::Error::FieldClash(field));
17065            }
17066        }
17067
17068        let mut params = Params::with_capacity(6 + self._additional_params.len());
17069        params.push("name", self._name);
17070        if let Some(value) = self._page_token.as_ref() {
17071            params.push("pageToken", value);
17072        }
17073        if let Some(value) = self._page_size.as_ref() {
17074            params.push("pageSize", value.to_string());
17075        }
17076        if let Some(value) = self._filter.as_ref() {
17077            params.push("filter", value);
17078        }
17079
17080        params.extend(self._additional_params.iter());
17081
17082        params.push("alt", "json");
17083        let mut url = self.hub._base_url.clone() + "v1/{+name}/locations";
17084        if self._scopes.is_empty() {
17085            self._scopes
17086                .insert(Scope::CloudPlatform.as_ref().to_string());
17087        }
17088
17089        #[allow(clippy::single_element_loop)]
17090        for &(find_this, param_name) in [("{+name}", "name")].iter() {
17091            url = params.uri_replacement(url, param_name, find_this, true);
17092        }
17093        {
17094            let to_remove = ["name"];
17095            params.remove_params(&to_remove);
17096        }
17097
17098        let url = params.parse_with_url(&url);
17099
17100        loop {
17101            let token = match self
17102                .hub
17103                .auth
17104                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
17105                .await
17106            {
17107                Ok(token) => token,
17108                Err(e) => match dlg.token(e) {
17109                    Ok(token) => token,
17110                    Err(e) => {
17111                        dlg.finished(false);
17112                        return Err(common::Error::MissingToken(e));
17113                    }
17114                },
17115            };
17116            let mut req_result = {
17117                let client = &self.hub.client;
17118                dlg.pre_request();
17119                let mut req_builder = hyper::Request::builder()
17120                    .method(hyper::Method::GET)
17121                    .uri(url.as_str())
17122                    .header(USER_AGENT, self.hub._user_agent.clone());
17123
17124                if let Some(token) = token.as_ref() {
17125                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
17126                }
17127
17128                let request = req_builder
17129                    .header(CONTENT_LENGTH, 0_u64)
17130                    .body(common::to_body::<String>(None));
17131
17132                client.request(request.unwrap()).await
17133            };
17134
17135            match req_result {
17136                Err(err) => {
17137                    if let common::Retry::After(d) = dlg.http_error(&err) {
17138                        sleep(d).await;
17139                        continue;
17140                    }
17141                    dlg.finished(false);
17142                    return Err(common::Error::HttpError(err));
17143                }
17144                Ok(res) => {
17145                    let (mut parts, body) = res.into_parts();
17146                    let mut body = common::Body::new(body);
17147                    if !parts.status.is_success() {
17148                        let bytes = common::to_bytes(body).await.unwrap_or_default();
17149                        let error = serde_json::from_str(&common::to_string(&bytes));
17150                        let response = common::to_response(parts, bytes.into());
17151
17152                        if let common::Retry::After(d) =
17153                            dlg.http_failure(&response, error.as_ref().ok())
17154                        {
17155                            sleep(d).await;
17156                            continue;
17157                        }
17158
17159                        dlg.finished(false);
17160
17161                        return Err(match error {
17162                            Ok(value) => common::Error::BadRequest(value),
17163                            _ => common::Error::Failure(response),
17164                        });
17165                    }
17166                    let response = {
17167                        let bytes = common::to_bytes(body).await.unwrap_or_default();
17168                        let encoded = common::to_string(&bytes);
17169                        match serde_json::from_str(&encoded) {
17170                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
17171                            Err(error) => {
17172                                dlg.response_json_decode_error(&encoded, &error);
17173                                return Err(common::Error::JsonDecodeError(
17174                                    encoded.to_string(),
17175                                    error,
17176                                ));
17177                            }
17178                        }
17179                    };
17180
17181                    dlg.finished(true);
17182                    return Ok(response);
17183                }
17184            }
17185        }
17186    }
17187
17188    /// The resource that owns the locations collection, if applicable.
17189    ///
17190    /// Sets the *name* path property to the given value.
17191    ///
17192    /// Even though the property as already been set when instantiating this call,
17193    /// we provide this method for API completeness.
17194    pub fn name(mut self, new_value: &str) -> ProjectLocationListCall<'a, C> {
17195        self._name = new_value.to_string();
17196        self
17197    }
17198    /// A page token received from the `next_page_token` field in the response. Send that page token to receive the subsequent page.
17199    ///
17200    /// Sets the *page token* query property to the given value.
17201    pub fn page_token(mut self, new_value: &str) -> ProjectLocationListCall<'a, C> {
17202        self._page_token = Some(new_value.to_string());
17203        self
17204    }
17205    /// The maximum number of results to return. If not set, the service selects a default.
17206    ///
17207    /// Sets the *page size* query property to the given value.
17208    pub fn page_size(mut self, new_value: i32) -> ProjectLocationListCall<'a, C> {
17209        self._page_size = Some(new_value);
17210        self
17211    }
17212    /// 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).
17213    ///
17214    /// Sets the *filter* query property to the given value.
17215    pub fn filter(mut self, new_value: &str) -> ProjectLocationListCall<'a, C> {
17216        self._filter = Some(new_value.to_string());
17217        self
17218    }
17219    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
17220    /// while executing the actual API request.
17221    ///
17222    /// ````text
17223    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
17224    /// ````
17225    ///
17226    /// Sets the *delegate* property to the given value.
17227    pub fn delegate(
17228        mut self,
17229        new_value: &'a mut dyn common::Delegate,
17230    ) -> ProjectLocationListCall<'a, C> {
17231        self._delegate = Some(new_value);
17232        self
17233    }
17234
17235    /// Set any additional parameter of the query string used in the request.
17236    /// It should be used to set parameters which are not yet available through their own
17237    /// setters.
17238    ///
17239    /// Please note that this method must not be used to set any of the known parameters
17240    /// which have their own setter method. If done anyway, the request will fail.
17241    ///
17242    /// # Additional Parameters
17243    ///
17244    /// * *$.xgafv* (query-string) - V1 error format.
17245    /// * *access_token* (query-string) - OAuth access token.
17246    /// * *alt* (query-string) - Data format for response.
17247    /// * *callback* (query-string) - JSONP
17248    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
17249    /// * *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.
17250    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
17251    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
17252    /// * *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.
17253    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
17254    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
17255    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationListCall<'a, C>
17256    where
17257        T: AsRef<str>,
17258    {
17259        self._additional_params
17260            .insert(name.as_ref().to_string(), value.as_ref().to_string());
17261        self
17262    }
17263
17264    /// Identifies the authorization scope for the method you are building.
17265    ///
17266    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
17267    /// [`Scope::CloudPlatform`].
17268    ///
17269    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
17270    /// tokens for more than one scope.
17271    ///
17272    /// Usually there is more than one suitable scope to authorize an operation, some of which may
17273    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
17274    /// sufficient, a read-write scope will do as well.
17275    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationListCall<'a, C>
17276    where
17277        St: AsRef<str>,
17278    {
17279        self._scopes.insert(String::from(scope.as_ref()));
17280        self
17281    }
17282    /// Identifies the authorization scope(s) for the method you are building.
17283    ///
17284    /// See [`Self::add_scope()`] for details.
17285    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationListCall<'a, C>
17286    where
17287        I: IntoIterator<Item = St>,
17288        St: AsRef<str>,
17289    {
17290        self._scopes
17291            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
17292        self
17293    }
17294
17295    /// Removes all scopes, and no default scope will be used either.
17296    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
17297    /// for details).
17298    pub fn clear_scopes(mut self) -> ProjectLocationListCall<'a, C> {
17299        self._scopes.clear();
17300        self
17301    }
17302}