google_cloudidentity1/
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    /// Private Service: https://www.googleapis.com/auth/cloud-identity.devices
17    CloudIdentityDevice,
18
19    /// See your device details
20    CloudIdentityDeviceLookup,
21
22    /// Private Service: https://www.googleapis.com/auth/cloud-identity.devices.readonly
23    CloudIdentityDeviceReadonly,
24
25    /// See, change, create, and delete any of the Cloud Identity Groups that you can access, including the members of each group
26    CloudIdentityGroup,
27
28    /// See any Cloud Identity Groups that you can access, including group members and their emails
29    CloudIdentityGroupReadonly,
30
31    /// See and edit all of the Inbound SSO profiles and their assignments to any Org Units or Google Groups in your Cloud Identity Organization.
32    CloudIdentityInboundsso,
33
34    /// See all of the Inbound SSO profiles and their assignments to any Org Units or Google Groups in your Cloud Identity Organization.
35    CloudIdentityInboundssoReadonly,
36
37    /// See and edit policies in your Cloud Identity Organization.
38    CloudIdentityPolicy,
39
40    /// See policies in your Cloud Identity Organization.
41    CloudIdentityPolicyReadonly,
42
43    /// See, edit, configure, and delete your Google Cloud data and see the email address for your Google Account.
44    CloudPlatform,
45}
46
47impl AsRef<str> for Scope {
48    fn as_ref(&self) -> &str {
49        match *self {
50            Scope::CloudIdentityDevice => "https://www.googleapis.com/auth/cloud-identity.devices",
51            Scope::CloudIdentityDeviceLookup => {
52                "https://www.googleapis.com/auth/cloud-identity.devices.lookup"
53            }
54            Scope::CloudIdentityDeviceReadonly => {
55                "https://www.googleapis.com/auth/cloud-identity.devices.readonly"
56            }
57            Scope::CloudIdentityGroup => "https://www.googleapis.com/auth/cloud-identity.groups",
58            Scope::CloudIdentityGroupReadonly => {
59                "https://www.googleapis.com/auth/cloud-identity.groups.readonly"
60            }
61            Scope::CloudIdentityInboundsso => {
62                "https://www.googleapis.com/auth/cloud-identity.inboundsso"
63            }
64            Scope::CloudIdentityInboundssoReadonly => {
65                "https://www.googleapis.com/auth/cloud-identity.inboundsso.readonly"
66            }
67            Scope::CloudIdentityPolicy => "https://www.googleapis.com/auth/cloud-identity.policies",
68            Scope::CloudIdentityPolicyReadonly => {
69                "https://www.googleapis.com/auth/cloud-identity.policies.readonly"
70            }
71            Scope::CloudPlatform => "https://www.googleapis.com/auth/cloud-platform",
72        }
73    }
74}
75
76#[allow(clippy::derivable_impls)]
77impl Default for Scope {
78    fn default() -> Scope {
79        Scope::CloudIdentityDeviceReadonly
80    }
81}
82
83// ########
84// HUB ###
85// ######
86
87/// Central instance to access all CloudIdentity related resource activities
88///
89/// # Examples
90///
91/// Instantiate a new hub
92///
93/// ```test_harness,no_run
94/// extern crate hyper;
95/// extern crate hyper_rustls;
96/// extern crate google_cloudidentity1 as cloudidentity1;
97/// use cloudidentity1::api::GoogleAppsCloudidentityDevicesV1ClientState;
98/// use cloudidentity1::{Result, Error};
99/// # async fn dox() {
100/// use cloudidentity1::{CloudIdentity, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
101///
102/// // Get an ApplicationSecret instance by some means. It contains the `client_id` and
103/// // `client_secret`, among other things.
104/// let secret: yup_oauth2::ApplicationSecret = Default::default();
105/// // Instantiate the authenticator. It will choose a suitable authentication flow for you,
106/// // unless you replace  `None` with the desired Flow.
107/// // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about
108/// // what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and
109/// // retrieve them from storage.
110/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
111///     .with_native_roots()
112///     .unwrap()
113///     .https_only()
114///     .enable_http2()
115///     .build();
116///
117/// let executor = hyper_util::rt::TokioExecutor::new();
118/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
119///     secret,
120///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
121///     yup_oauth2::client::CustomHyperClientBuilder::from(
122///         hyper_util::client::legacy::Client::builder(executor).build(connector),
123///     ),
124/// ).build().await.unwrap();
125///
126/// let client = hyper_util::client::legacy::Client::builder(
127///     hyper_util::rt::TokioExecutor::new()
128/// )
129/// .build(
130///     hyper_rustls::HttpsConnectorBuilder::new()
131///         .with_native_roots()
132///         .unwrap()
133///         .https_or_http()
134///         .enable_http2()
135///         .build()
136/// );
137/// let mut hub = CloudIdentity::new(client, auth);
138/// // As the method needs a request, you would usually fill it with the desired information
139/// // into the respective structure. Some of the parts shown here might not be applicable !
140/// // Values shown here are possibly random and not representative !
141/// let mut req = GoogleAppsCloudidentityDevicesV1ClientState::default();
142///
143/// // You can configure optional parameters by calling the respective setters at will, and
144/// // execute the final call using `doit()`.
145/// // Values shown here are possibly random and not representative !
146/// let result = hub.devices().device_users_client_states_patch(req, "name")
147///              .update_mask(FieldMask::new::<&str>(&[]))
148///              .customer("At")
149///              .doit().await;
150///
151/// match result {
152///     Err(e) => match e {
153///         // The Error enum provides details about what exactly happened.
154///         // You can also just use its `Debug`, `Display` or `Error` traits
155///          Error::HttpError(_)
156///         |Error::Io(_)
157///         |Error::MissingAPIKey
158///         |Error::MissingToken(_)
159///         |Error::Cancelled
160///         |Error::UploadSizeLimitExceeded(_, _)
161///         |Error::Failure(_)
162///         |Error::BadRequest(_)
163///         |Error::FieldClash(_)
164///         |Error::JsonDecodeError(_, _) => println!("{}", e),
165///     },
166///     Ok(res) => println!("Success: {:?}", res),
167/// }
168/// # }
169/// ```
170#[derive(Clone)]
171pub struct CloudIdentity<C> {
172    pub client: common::Client<C>,
173    pub auth: Box<dyn common::GetToken>,
174    _user_agent: String,
175    _base_url: String,
176    _root_url: String,
177}
178
179impl<C> common::Hub for CloudIdentity<C> {}
180
181impl<'a, C> CloudIdentity<C> {
182    pub fn new<A: 'static + common::GetToken>(
183        client: common::Client<C>,
184        auth: A,
185    ) -> CloudIdentity<C> {
186        CloudIdentity {
187            client,
188            auth: Box::new(auth),
189            _user_agent: "google-api-rust-client/7.0.0".to_string(),
190            _base_url: "https://cloudidentity.googleapis.com/".to_string(),
191            _root_url: "https://cloudidentity.googleapis.com/".to_string(),
192        }
193    }
194
195    pub fn customers(&'a self) -> CustomerMethods<'a, C> {
196        CustomerMethods { hub: self }
197    }
198    pub fn devices(&'a self) -> DeviceMethods<'a, C> {
199        DeviceMethods { hub: self }
200    }
201    pub fn groups(&'a self) -> GroupMethods<'a, C> {
202        GroupMethods { hub: self }
203    }
204    pub fn inbound_oidc_sso_profiles(&'a self) -> InboundOidcSsoProfileMethods<'a, C> {
205        InboundOidcSsoProfileMethods { hub: self }
206    }
207    pub fn inbound_saml_sso_profiles(&'a self) -> InboundSamlSsoProfileMethods<'a, C> {
208        InboundSamlSsoProfileMethods { hub: self }
209    }
210    pub fn inbound_sso_assignments(&'a self) -> InboundSsoAssignmentMethods<'a, C> {
211        InboundSsoAssignmentMethods { hub: self }
212    }
213    pub fn policies(&'a self) -> PolicyMethods<'a, C> {
214        PolicyMethods { hub: self }
215    }
216
217    /// Set the user-agent header field to use in all requests to the server.
218    /// It defaults to `google-api-rust-client/7.0.0`.
219    ///
220    /// Returns the previously set user-agent.
221    pub fn user_agent(&mut self, agent_name: String) -> String {
222        std::mem::replace(&mut self._user_agent, agent_name)
223    }
224
225    /// Set the base url to use in all requests to the server.
226    /// It defaults to `https://cloudidentity.googleapis.com/`.
227    ///
228    /// Returns the previously set base url.
229    pub fn base_url(&mut self, new_base_url: String) -> String {
230        std::mem::replace(&mut self._base_url, new_base_url)
231    }
232
233    /// Set the root url to use in all requests to the server.
234    /// It defaults to `https://cloudidentity.googleapis.com/`.
235    ///
236    /// Returns the previously set root url.
237    pub fn root_url(&mut self, new_root_url: String) -> String {
238        std::mem::replace(&mut self._root_url, new_root_url)
239    }
240}
241
242// ############
243// SCHEMAS ###
244// ##########
245/// The request for creating an IdpCredential with its associated payload. An InboundSamlSsoProfile can own up to 2 credentials.
246///
247/// # Activities
248///
249/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
250/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
251///
252/// * [idp credentials add inbound saml sso profiles](InboundSamlSsoProfileIdpCredentialAddCall) (request)
253#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
254#[serde_with::serde_as]
255#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
256pub struct AddIdpCredentialRequest {
257    /// PEM encoded x509 certificate containing the public key for verifying IdP signatures.
258    #[serde(rename = "pemData")]
259    pub pem_data: Option<String>,
260}
261
262impl common::RequestValue for AddIdpCredentialRequest {}
263
264/// Request to cancel sent invitation for target email in UserInvitation.
265///
266/// # Activities
267///
268/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
269/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
270///
271/// * [userinvitations cancel customers](CustomerUserinvitationCancelCall) (request)
272#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
273#[serde_with::serde_as]
274#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
275pub struct CancelUserInvitationRequest {
276    _never_set: Option<bool>,
277}
278
279impl common::RequestValue for CancelUserInvitationRequest {}
280
281/// The response message for MembershipsService.CheckTransitiveMembership.
282///
283/// # Activities
284///
285/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
286/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
287///
288/// * [memberships check transitive membership groups](GroupMembershipCheckTransitiveMembershipCall) (response)
289#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
290#[serde_with::serde_as]
291#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
292pub struct CheckTransitiveMembershipResponse {
293    /// Response does not include the possible roles of a member since the behavior of this rpc is not all-or-nothing unlike the other rpcs. So, it may not be possible to list all the roles definitively, due to possible lack of authorization in some of the paths.
294    #[serde(rename = "hasMembership")]
295    pub has_membership: Option<bool>,
296}
297
298impl common::ResponseResult for CheckTransitiveMembershipResponse {}
299
300/// Information of a DSA public key.
301///
302/// This type is not used in any activity, and only used as *part* of another schema.
303///
304#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
305#[serde_with::serde_as]
306#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
307pub struct DsaPublicKeyInfo {
308    /// Key size in bits (size of parameter P).
309    #[serde(rename = "keySize")]
310    pub key_size: Option<i32>,
311}
312
313impl common::Part for DsaPublicKeyInfo {}
314
315/// Dynamic group metadata like queries and status.
316///
317/// This type is not used in any activity, and only used as *part* of another schema.
318///
319#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
320#[serde_with::serde_as]
321#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
322pub struct DynamicGroupMetadata {
323    /// Memberships will be the union of all queries. Only one entry with USER resource is currently supported. Customers can create up to 500 dynamic groups.
324    pub queries: Option<Vec<DynamicGroupQuery>>,
325    /// Output only. Status of the dynamic group.
326    pub status: Option<DynamicGroupStatus>,
327}
328
329impl common::Part for DynamicGroupMetadata {}
330
331/// Defines a query on a resource.
332///
333/// This type is not used in any activity, and only used as *part* of another schema.
334///
335#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
336#[serde_with::serde_as]
337#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
338pub struct DynamicGroupQuery {
339    /// Query that determines the memberships of the dynamic group. Examples: All users with at least one `organizations.department` of engineering. `user.organizations.exists(org, org.department=='engineering')` All users with at least one location that has `area` of `foo` and `building_id` of `bar`. `user.locations.exists(loc, loc.area=='foo' && loc.building_id=='bar')` All users with any variation of the name John Doe (case-insensitive queries add `equalsIgnoreCase()` to the value being queried). `user.name.value.equalsIgnoreCase('jOhn DoE')`
340    pub query: Option<String>,
341    /// Resource type for the Dynamic Group Query
342    #[serde(rename = "resourceType")]
343    pub resource_type: Option<String>,
344}
345
346impl common::Part for DynamicGroupQuery {}
347
348/// The current status of a dynamic group along with timestamp.
349///
350/// This type is not used in any activity, and only used as *part* of another schema.
351///
352#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
353#[serde_with::serde_as]
354#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
355pub struct DynamicGroupStatus {
356    /// Status of the dynamic group.
357    pub status: Option<String>,
358    /// The latest time at which the dynamic group is guaranteed to be in the given status. If status is `UP_TO_DATE`, the latest time at which the dynamic group was confirmed to be up-to-date. If status is `UPDATING_MEMBERSHIPS`, the time at which dynamic group was created.
359    #[serde(rename = "statusTime")]
360    pub status_time: Option<chrono::DateTime<chrono::offset::Utc>>,
361}
362
363impl common::Part for DynamicGroupStatus {}
364
365/// A unique identifier for an entity in the Cloud Identity Groups API. An entity can represent either a group with an optional `namespace` or a user without a `namespace`. The combination of `id` and `namespace` must be unique; however, the same `id` can be used with different `namespace`s.
366///
367/// This type is not used in any activity, and only used as *part* of another schema.
368///
369#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
370#[serde_with::serde_as]
371#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
372pub struct EntityKey {
373    /// The ID of the entity. For Google-managed entities, the `id` should be the email address of an existing group or user. Email addresses need to adhere to [name guidelines for users and groups](https://support.google.com/a/answer/9193374). For external-identity-mapped entities, the `id` must be a string conforming to the Identity Source's requirements. Must be unique within a `namespace`.
374    pub id: Option<String>,
375    /// The namespace in which the entity exists. If not specified, the `EntityKey` represents a Google-managed entity such as a Google user or a Google Group. If specified, the `EntityKey` represents an external-identity-mapped group. The namespace must correspond to an identity source created in Admin Console and must be in the form of `identitysources/{identity_source}`.
376    pub namespace: Option<String>,
377}
378
379impl common::Part for EntityKey {}
380
381/// The `MembershipRole` expiry details.
382///
383/// This type is not used in any activity, and only used as *part* of another schema.
384///
385#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
386#[serde_with::serde_as]
387#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
388pub struct ExpiryDetail {
389    /// The time at which the `MembershipRole` will expire.
390    #[serde(rename = "expireTime")]
391    pub expire_time: Option<chrono::DateTime<chrono::offset::Utc>>,
392}
393
394impl common::Part for ExpiryDetail {}
395
396/// Resource representing the Android specific attributes of a Device.
397///
398/// This type is not used in any activity, and only used as *part* of another schema.
399///
400#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
401#[serde_with::serde_as]
402#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
403pub struct GoogleAppsCloudidentityDevicesV1AndroidAttributes {
404    /// Whether the device passes Android CTS compliance.
405    #[serde(rename = "ctsProfileMatch")]
406    pub cts_profile_match: Option<bool>,
407    /// Whether applications from unknown sources can be installed on device.
408    #[serde(rename = "enabledUnknownSources")]
409    pub enabled_unknown_sources: Option<bool>,
410    /// Whether any potentially harmful apps were detected on the device.
411    #[serde(rename = "hasPotentiallyHarmfulApps")]
412    pub has_potentially_harmful_apps: Option<bool>,
413    /// Whether this account is on an owner/primary profile. For phones, only true for owner profiles. Android 4+ devices can have secondary or restricted user profiles.
414    #[serde(rename = "ownerProfileAccount")]
415    pub owner_profile_account: Option<bool>,
416    /// Ownership privileges on device.
417    #[serde(rename = "ownershipPrivilege")]
418    pub ownership_privilege: Option<String>,
419    /// Whether device supports Android work profiles. If false, this service will not block access to corp data even if an administrator turns on the "Enforce Work Profile" policy.
420    #[serde(rename = "supportsWorkProfile")]
421    pub supports_work_profile: Option<bool>,
422    /// Whether Android verified boot status is GREEN.
423    #[serde(rename = "verifiedBoot")]
424    pub verified_boot: Option<bool>,
425    /// Whether Google Play Protect Verify Apps is enabled.
426    #[serde(rename = "verifyAppsEnabled")]
427    pub verify_apps_enabled: Option<bool>,
428}
429
430impl common::Part for GoogleAppsCloudidentityDevicesV1AndroidAttributes {}
431
432/// Request message for approving the device to access user data.
433///
434/// # Activities
435///
436/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
437/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
438///
439/// * [device users approve devices](DeviceDeviceUserApproveCall) (request)
440#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
441#[serde_with::serde_as]
442#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
443pub struct GoogleAppsCloudidentityDevicesV1ApproveDeviceUserRequest {
444    /// Optional. [Resource name](https://cloud.google.com/apis/design/resource_names) of the customer. If you're using this API for your own organization, use `customers/my_customer` If you're using this API to manage another organization, use `customers/{customer}`, where customer is the customer to whom the device belongs.
445    pub customer: Option<String>,
446}
447
448impl common::RequestValue for GoogleAppsCloudidentityDevicesV1ApproveDeviceUserRequest {}
449
450/// Request message for blocking account on device.
451///
452/// # Activities
453///
454/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
455/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
456///
457/// * [device users block devices](DeviceDeviceUserBlockCall) (request)
458#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
459#[serde_with::serde_as]
460#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
461pub struct GoogleAppsCloudidentityDevicesV1BlockDeviceUserRequest {
462    /// Optional. [Resource name](https://cloud.google.com/apis/design/resource_names) of the customer. If you're using this API for your own organization, use `customers/my_customer` If you're using this API to manage another organization, use `customers/{customer}`, where customer is the customer to whom the device belongs.
463    pub customer: Option<String>,
464}
465
466impl common::RequestValue for GoogleAppsCloudidentityDevicesV1BlockDeviceUserRequest {}
467
468/// Contains information about browser profiles reported by the [Endpoint Verification extension](https://chromewebstore.google.com/detail/endpoint-verification/callobklhcbilhphinckomhgkigmfocg?pli=1).
469///
470/// This type is not used in any activity, and only used as *part* of another schema.
471///
472#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
473#[serde_with::serde_as]
474#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
475pub struct GoogleAppsCloudidentityDevicesV1BrowserAttributes {
476    /// Represents the current state of the [Chrome browser attributes](https://cloud.google.com/access-context-manager/docs/browser-attributes) sent by the [Endpoint Verification extension](https://chromewebstore.google.com/detail/endpoint-verification/callobklhcbilhphinckomhgkigmfocg?pli=1).
477    #[serde(rename = "chromeBrowserInfo")]
478    pub chrome_browser_info: Option<GoogleAppsCloudidentityDevicesV1BrowserInfo>,
479    /// Chrome profile ID that is exposed by the Chrome API. It is unique for each device.
480    #[serde(rename = "chromeProfileId")]
481    pub chrome_profile_id: Option<String>,
482    /// Timestamp in milliseconds since the Unix epoch when the profile/gcm id was last synced.
483    #[serde(rename = "lastProfileSyncTime")]
484    pub last_profile_sync_time: Option<chrono::DateTime<chrono::offset::Utc>>,
485}
486
487impl common::Part for GoogleAppsCloudidentityDevicesV1BrowserAttributes {}
488
489/// Browser-specific fields reported by the [Endpoint Verification extension](https://chromewebstore.google.com/detail/endpoint-verification/callobklhcbilhphinckomhgkigmfocg?pli=1).
490///
491/// This type is not used in any activity, and only used as *part* of another schema.
492///
493#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
494#[serde_with::serde_as]
495#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
496pub struct GoogleAppsCloudidentityDevicesV1BrowserInfo {
497    /// Output only. Browser's management state.
498    #[serde(rename = "browserManagementState")]
499    pub browser_management_state: Option<String>,
500    /// Version of the request initiating browser. E.g. `91.0.4442.4`.
501    #[serde(rename = "browserVersion")]
502    pub browser_version: Option<String>,
503    /// Current state of [built-in DNS client](https://chromeenterprise.google/policies/#BuiltInDnsClientEnabled).
504    #[serde(rename = "isBuiltInDnsClientEnabled")]
505    pub is_built_in_dns_client_enabled: Option<bool>,
506    /// Current state of [bulk data analysis](https://chromeenterprise.google/policies/#OnBulkDataEntryEnterpriseConnector). Set to true if provider list from Chrome is non-empty.
507    #[serde(rename = "isBulkDataEntryAnalysisEnabled")]
508    pub is_bulk_data_entry_analysis_enabled: Option<bool>,
509    /// Deprecated: This field is not used for Chrome version 118 and later. Current state of [Chrome Cleanup](https://chromeenterprise.google/policies/#ChromeCleanupEnabled).
510    #[serde(rename = "isChromeCleanupEnabled")]
511    pub is_chrome_cleanup_enabled: Option<bool>,
512    /// Current state of [Chrome Remote Desktop app](https://chromeenterprise.google/policies/#URLBlocklist).
513    #[serde(rename = "isChromeRemoteDesktopAppBlocked")]
514    pub is_chrome_remote_desktop_app_blocked: Option<bool>,
515    /// Current state of [file download analysis](https://chromeenterprise.google/policies/#OnFileDownloadedEnterpriseConnector). Set to true if provider list from Chrome is non-empty.
516    #[serde(rename = "isFileDownloadAnalysisEnabled")]
517    pub is_file_download_analysis_enabled: Option<bool>,
518    /// Current state of [file upload analysis](https://chromeenterprise.google/policies/#OnFileAttachedEnterpriseConnector). Set to true if provider list from Chrome is non-empty.
519    #[serde(rename = "isFileUploadAnalysisEnabled")]
520    pub is_file_upload_analysis_enabled: Option<bool>,
521    /// Current state of [real-time URL check](https://chromeenterprise.google/policies/#EnterpriseRealTimeUrlCheckMode). Set to true if provider list from Chrome is non-empty.
522    #[serde(rename = "isRealtimeUrlCheckEnabled")]
523    pub is_realtime_url_check_enabled: Option<bool>,
524    /// Current state of [security event analysis](https://chromeenterprise.google/policies/#OnSecurityEventEnterpriseConnector). Set to true if provider list from Chrome is non-empty.
525    #[serde(rename = "isSecurityEventAnalysisEnabled")]
526    pub is_security_event_analysis_enabled: Option<bool>,
527    /// Current state of [site isolation](https://chromeenterprise.google/policies/?policy=IsolateOrigins).
528    #[serde(rename = "isSiteIsolationEnabled")]
529    pub is_site_isolation_enabled: Option<bool>,
530    /// Current state of [third-party blocking](https://chromeenterprise.google/policies/#ThirdPartyBlockingEnabled).
531    #[serde(rename = "isThirdPartyBlockingEnabled")]
532    pub is_third_party_blocking_enabled: Option<bool>,
533    /// Current state of [password protection trigger](https://chromeenterprise.google/policies/#PasswordProtectionWarningTrigger).
534    #[serde(rename = "passwordProtectionWarningTrigger")]
535    pub password_protection_warning_trigger: Option<String>,
536    /// Current state of [Safe Browsing protection level](https://chromeenterprise.google/policies/#SafeBrowsingProtectionLevel).
537    #[serde(rename = "safeBrowsingProtectionLevel")]
538    pub safe_browsing_protection_level: Option<String>,
539}
540
541impl common::Part for GoogleAppsCloudidentityDevicesV1BrowserInfo {}
542
543/// Request message for cancelling an unfinished device wipe.
544///
545/// # Activities
546///
547/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
548/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
549///
550/// * [cancel wipe devices](DeviceCancelWipeCall) (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 GoogleAppsCloudidentityDevicesV1CancelWipeDeviceRequest {
555    /// Optional. [Resource name](https://cloud.google.com/apis/design/resource_names) of the customer. If you're using this API for your own organization, use `customers/my_customer` If you're using this API to manage another organization, use `customers/{customer}`, where customer is the customer to whom the device belongs.
556    pub customer: Option<String>,
557}
558
559impl common::RequestValue for GoogleAppsCloudidentityDevicesV1CancelWipeDeviceRequest {}
560
561/// Request message for cancelling an unfinished user account wipe.
562///
563/// # Activities
564///
565/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
566/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
567///
568/// * [device users cancel wipe devices](DeviceDeviceUserCancelWipeCall) (request)
569#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
570#[serde_with::serde_as]
571#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
572pub struct GoogleAppsCloudidentityDevicesV1CancelWipeDeviceUserRequest {
573    /// Optional. [Resource name](https://cloud.google.com/apis/design/resource_names) of the customer. If you're using this API for your own organization, use `customers/my_customer` If you're using this API to manage another organization, use `customers/{customer}`, where customer is the customer to whom the device belongs.
574    pub customer: Option<String>,
575}
576
577impl common::RequestValue for GoogleAppsCloudidentityDevicesV1CancelWipeDeviceUserRequest {}
578
579/// Stores information about a certificate.
580///
581/// This type is not used in any activity, and only used as *part* of another schema.
582///
583#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
584#[serde_with::serde_as]
585#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
586pub struct GoogleAppsCloudidentityDevicesV1CertificateAttributes {
587    /// The X.509 extension for CertificateTemplate.
588    #[serde(rename = "certificateTemplate")]
589    pub certificate_template: Option<GoogleAppsCloudidentityDevicesV1CertificateTemplate>,
590    /// The encoded certificate fingerprint.
591    pub fingerprint: Option<String>,
592    /// The name of the issuer of this certificate.
593    pub issuer: Option<String>,
594    /// Serial number of the certificate, Example: "123456789".
595    #[serde(rename = "serialNumber")]
596    pub serial_number: Option<String>,
597    /// The subject name of this certificate.
598    pub subject: Option<String>,
599    /// The certificate thumbprint.
600    pub thumbprint: Option<String>,
601    /// Output only. Validation state of this certificate.
602    #[serde(rename = "validationState")]
603    pub validation_state: Option<String>,
604    /// Certificate not valid at or after this timestamp.
605    #[serde(rename = "validityExpirationTime")]
606    pub validity_expiration_time: Option<chrono::DateTime<chrono::offset::Utc>>,
607    /// Certificate not valid before this timestamp.
608    #[serde(rename = "validityStartTime")]
609    pub validity_start_time: Option<chrono::DateTime<chrono::offset::Utc>>,
610}
611
612impl common::Part for GoogleAppsCloudidentityDevicesV1CertificateAttributes {}
613
614/// CertificateTemplate (v3 Extension in X.509).
615///
616/// This type is not used in any activity, and only used as *part* of another schema.
617///
618#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
619#[serde_with::serde_as]
620#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
621pub struct GoogleAppsCloudidentityDevicesV1CertificateTemplate {
622    /// The template id of the template. Example: "1.3.6.1.4.1.311.21.8.15608621.11768144.5720724.16068415.6889630.81.2472537.7784047".
623    pub id: Option<String>,
624    /// The Major version of the template. Example: 100.
625    #[serde(rename = "majorVersion")]
626    pub major_version: Option<i32>,
627    /// The minor version of the template. Example: 12.
628    #[serde(rename = "minorVersion")]
629    pub minor_version: Option<i32>,
630}
631
632impl common::Part for GoogleAppsCloudidentityDevicesV1CertificateTemplate {}
633
634/// Represents the state associated with an API client calling the Devices API. Resource representing ClientState and supports updates from API users
635///
636/// # Activities
637///
638/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
639/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
640///
641/// * [device users client states get devices](DeviceDeviceUserClientStateGetCall) (response)
642/// * [device users client states patch devices](DeviceDeviceUserClientStatePatchCall) (request)
643#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
644#[serde_with::serde_as]
645#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
646pub struct GoogleAppsCloudidentityDevicesV1ClientState {
647    /// The caller can specify asset tags for this resource
648    #[serde(rename = "assetTags")]
649    pub asset_tags: Option<Vec<String>>,
650    /// The compliance state of the resource as specified by the API client.
651    #[serde(rename = "complianceState")]
652    pub compliance_state: Option<String>,
653    /// Output only. The time the client state data was created.
654    #[serde(rename = "createTime")]
655    pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
656    /// This field may be used to store a unique identifier for the API resource within which these CustomAttributes are a field.
657    #[serde(rename = "customId")]
658    pub custom_id: Option<String>,
659    /// The token that needs to be passed back for concurrency control in updates. Token needs to be passed back in UpdateRequest
660    pub etag: Option<String>,
661    /// The Health score of the resource. The Health score is the callers specification of the condition of the device from a usability point of view. For example, a third-party device management provider may specify a health score based on its compliance with organizational policies.
662    #[serde(rename = "healthScore")]
663    pub health_score: Option<String>,
664    /// The map of key-value attributes stored by callers specific to a device. The total serialized length of this map may not exceed 10KB. No limit is placed on the number of attributes in a map.
665    #[serde(rename = "keyValuePairs")]
666    pub key_value_pairs:
667        Option<HashMap<String, GoogleAppsCloudidentityDevicesV1CustomAttributeValue>>,
668    /// Output only. The time the client state data was last updated.
669    #[serde(rename = "lastUpdateTime")]
670    pub last_update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
671    /// The management state of the resource as specified by the API client.
672    pub managed: Option<String>,
673    /// Output only. [Resource name](https://cloud.google.com/apis/design/resource_names) of the ClientState in format: `devices/{device}/deviceUsers/{device_user}/clientState/{partner}`, where partner corresponds to the partner storing the data. For partners belonging to the "BeyondCorp Alliance", this is the partner ID specified to you by Google. For all other callers, this is a string of the form: `{customer}-suffix`, where `customer` is your customer ID. The *suffix* is any string the caller specifies. This string will be displayed verbatim in the administration console. This suffix is used in setting up Custom Access Levels in Context-Aware Access. Your organization's customer ID can be obtained from the URL: `GET https://www.googleapis.com/admin/directory/v1/customers/my_customer` The `id` field in the response contains the customer ID starting with the letter 'C'. The customer ID to be used in this API is the string after the letter 'C' (not including 'C')
674    pub name: Option<String>,
675    /// Output only. The owner of the ClientState
676    #[serde(rename = "ownerType")]
677    pub owner_type: Option<String>,
678    /// A descriptive cause of the health score.
679    #[serde(rename = "scoreReason")]
680    pub score_reason: Option<String>,
681}
682
683impl common::RequestValue for GoogleAppsCloudidentityDevicesV1ClientState {}
684impl common::ResponseResult for GoogleAppsCloudidentityDevicesV1ClientState {}
685
686/// Additional custom attribute values may be one of these types
687///
688/// This type is not used in any activity, and only used as *part* of another schema.
689///
690#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
691#[serde_with::serde_as]
692#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
693pub struct GoogleAppsCloudidentityDevicesV1CustomAttributeValue {
694    /// Represents a boolean value.
695    #[serde(rename = "boolValue")]
696    pub bool_value: Option<bool>,
697    /// Represents a double value.
698    #[serde(rename = "numberValue")]
699    pub number_value: Option<f64>,
700    /// Represents a string value.
701    #[serde(rename = "stringValue")]
702    pub string_value: Option<String>,
703}
704
705impl common::Part for GoogleAppsCloudidentityDevicesV1CustomAttributeValue {}
706
707/// A Device within the Cloud Identity Devices API. Represents a Device known to Google Cloud, independent of the device ownership, type, and whether it is assigned or in use by a user.
708///
709/// # Activities
710///
711/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
712/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
713///
714/// * [create devices](DeviceCreateCall) (request)
715/// * [get devices](DeviceGetCall) (response)
716#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
717#[serde_with::serde_as]
718#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
719pub struct GoogleAppsCloudidentityDevicesV1Device {
720    /// Output only. Attributes specific to Android devices.
721    #[serde(rename = "androidSpecificAttributes")]
722    pub android_specific_attributes: Option<GoogleAppsCloudidentityDevicesV1AndroidAttributes>,
723    /// Asset tag of the device.
724    #[serde(rename = "assetTag")]
725    pub asset_tag: Option<String>,
726    /// Output only. Baseband version of the device.
727    #[serde(rename = "basebandVersion")]
728    pub baseband_version: Option<String>,
729    /// Output only. Device bootloader version. Example: 0.6.7.
730    #[serde(rename = "bootloaderVersion")]
731    pub bootloader_version: Option<String>,
732    /// Output only. Device brand. Example: Samsung.
733    pub brand: Option<String>,
734    /// Output only. Build number of the device.
735    #[serde(rename = "buildNumber")]
736    pub build_number: Option<String>,
737    /// Output only. Represents whether the Device is compromised.
738    #[serde(rename = "compromisedState")]
739    pub compromised_state: Option<String>,
740    /// Output only. When the Company-Owned device was imported. This field is empty for BYOD devices.
741    #[serde(rename = "createTime")]
742    pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
743    /// Unique identifier for the device.
744    #[serde(rename = "deviceId")]
745    pub device_id: Option<String>,
746    /// Output only. Type of device.
747    #[serde(rename = "deviceType")]
748    pub device_type: Option<String>,
749    /// Output only. Whether developer options is enabled on device.
750    #[serde(rename = "enabledDeveloperOptions")]
751    pub enabled_developer_options: Option<bool>,
752    /// Output only. Whether USB debugging is enabled on device.
753    #[serde(rename = "enabledUsbDebugging")]
754    pub enabled_usb_debugging: Option<bool>,
755    /// Output only. Device encryption state.
756    #[serde(rename = "encryptionState")]
757    pub encryption_state: Option<String>,
758    /// Output only. Attributes specific to [Endpoint Verification](https://cloud.google.com/endpoint-verification/docs/overview) devices.
759    #[serde(rename = "endpointVerificationSpecificAttributes")]
760    pub endpoint_verification_specific_attributes:
761        Option<GoogleAppsCloudidentityDevicesV1EndpointVerificationSpecificAttributes>,
762    /// Host name of the device.
763    pub hostname: Option<String>,
764    /// Output only. IMEI number of device if GSM device; empty otherwise.
765    pub imei: Option<String>,
766    /// Output only. Kernel version of the device.
767    #[serde(rename = "kernelVersion")]
768    pub kernel_version: Option<String>,
769    /// Most recent time when device synced with this service.
770    #[serde(rename = "lastSyncTime")]
771    pub last_sync_time: Option<chrono::DateTime<chrono::offset::Utc>>,
772    /// Output only. Management state of the device
773    #[serde(rename = "managementState")]
774    pub management_state: Option<String>,
775    /// Output only. Device manufacturer. Example: Motorola.
776    pub manufacturer: Option<String>,
777    /// Output only. MEID number of device if CDMA device; empty otherwise.
778    pub meid: Option<String>,
779    /// Output only. Model name of device. Example: Pixel 3.
780    pub model: Option<String>,
781    /// Output only. [Resource name](https://cloud.google.com/apis/design/resource_names) of the Device in format: `devices/{device}`, where device is the unique id assigned to the Device. Important: Device API scopes require that you use domain-wide delegation to access the API. For more information, see [Set up the Devices API](https://cloud.google.com/identity/docs/how-to/setup-devices).
782    pub name: Option<String>,
783    /// Output only. Mobile or network operator of device, if available.
784    #[serde(rename = "networkOperator")]
785    pub network_operator: Option<String>,
786    /// Output only. OS version of the device. Example: Android 8.1.0.
787    #[serde(rename = "osVersion")]
788    pub os_version: Option<String>,
789    /// Output only. Domain name for Google accounts on device. Type for other accounts on device. On Android, will only be populated if |ownership_privilege| is |PROFILE_OWNER| or |DEVICE_OWNER|. Does not include the account signed in to the device policy app if that account's domain has only one account. Examples: "com.example", "xyz.com".
790    #[serde(rename = "otherAccounts")]
791    pub other_accounts: Option<Vec<String>>,
792    /// Output only. Whether the device is owned by the company or an individual
793    #[serde(rename = "ownerType")]
794    pub owner_type: Option<String>,
795    /// Output only. OS release version. Example: 6.0.
796    #[serde(rename = "releaseVersion")]
797    pub release_version: Option<String>,
798    /// Output only. OS security patch update time on device.
799    #[serde(rename = "securityPatchTime")]
800    pub security_patch_time: Option<chrono::DateTime<chrono::offset::Utc>>,
801    /// Serial Number of device. Example: HT82V1A01076.
802    #[serde(rename = "serialNumber")]
803    pub serial_number: Option<String>,
804    /// Output only. Unified device id of the device.
805    #[serde(rename = "unifiedDeviceId")]
806    pub unified_device_id: Option<String>,
807    /// WiFi MAC addresses of device.
808    #[serde(rename = "wifiMacAddresses")]
809    pub wifi_mac_addresses: Option<Vec<String>>,
810}
811
812impl common::RequestValue for GoogleAppsCloudidentityDevicesV1Device {}
813impl common::ResponseResult for GoogleAppsCloudidentityDevicesV1Device {}
814
815/// Represents a user’s use of a Device in the Cloud Identity Devices API. A DeviceUser is a resource representing a user’s use of a Device
816///
817/// # Activities
818///
819/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
820/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
821///
822/// * [device users get devices](DeviceDeviceUserGetCall) (response)
823#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
824#[serde_with::serde_as]
825#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
826pub struct GoogleAppsCloudidentityDevicesV1DeviceUser {
827    /// Compromised State of the DeviceUser object
828    #[serde(rename = "compromisedState")]
829    pub compromised_state: Option<String>,
830    /// When the user first signed in to the device
831    #[serde(rename = "createTime")]
832    pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
833    /// Output only. Most recent time when user registered with this service.
834    #[serde(rename = "firstSyncTime")]
835    pub first_sync_time: Option<chrono::DateTime<chrono::offset::Utc>>,
836    /// Output only. Default locale used on device, in IETF BCP-47 format.
837    #[serde(rename = "languageCode")]
838    pub language_code: Option<String>,
839    /// Output only. Last time when user synced with policies.
840    #[serde(rename = "lastSyncTime")]
841    pub last_sync_time: Option<chrono::DateTime<chrono::offset::Utc>>,
842    /// Output only. Management state of the user on the device.
843    #[serde(rename = "managementState")]
844    pub management_state: Option<String>,
845    /// Output only. [Resource name](https://cloud.google.com/apis/design/resource_names) of the DeviceUser in format: `devices/{device}/deviceUsers/{device_user}`, where `device_user` uniquely identifies a user's use of a device.
846    pub name: Option<String>,
847    /// Password state of the DeviceUser object
848    #[serde(rename = "passwordState")]
849    pub password_state: Option<String>,
850    /// Output only. User agent on the device for this specific user
851    #[serde(rename = "userAgent")]
852    pub user_agent: Option<String>,
853    /// Email address of the user registered on the device.
854    #[serde(rename = "userEmail")]
855    pub user_email: Option<String>,
856}
857
858impl common::ResponseResult for GoogleAppsCloudidentityDevicesV1DeviceUser {}
859
860/// Resource representing the [Endpoint Verification-specific attributes](https://cloud.google.com/endpoint-verification/docs/device-information) of a device.
861///
862/// This type is not used in any activity, and only used as *part* of another schema.
863///
864#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
865#[serde_with::serde_as]
866#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
867pub struct GoogleAppsCloudidentityDevicesV1EndpointVerificationSpecificAttributes {
868    /// [Additional signals](https://cloud.google.com/endpoint-verification/docs/device-information) reported by Endpoint Verification. It includes the following attributes: * Non-configurable attributes: hotfixes, av_installed, av_enabled, windows_domain_name, is_os_native_firewall_enabled, and is_secure_boot_enabled. * [Configurable attributes](https://cloud.google.com/endpoint-verification/docs/collect-config-attributes): file, folder, and binary attributes; registry entries; and properties in a plist.
869    #[serde(rename = "additionalSignals")]
870    pub additional_signals: Option<HashMap<String, serde_json::Value>>,
871    /// Details of browser profiles reported by Endpoint Verification.
872    #[serde(rename = "browserAttributes")]
873    pub browser_attributes: Option<Vec<GoogleAppsCloudidentityDevicesV1BrowserAttributes>>,
874    /// Details of certificates.
875    #[serde(rename = "certificateAttributes")]
876    pub certificate_attributes: Option<Vec<GoogleAppsCloudidentityDevicesV1CertificateAttributes>>,
877}
878
879impl common::Part for GoogleAppsCloudidentityDevicesV1EndpointVerificationSpecificAttributes {}
880
881/// Response message that is returned in ListClientStates.
882///
883/// # Activities
884///
885/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
886/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
887///
888/// * [device users client states list devices](DeviceDeviceUserClientStateListCall) (response)
889#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
890#[serde_with::serde_as]
891#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
892pub struct GoogleAppsCloudidentityDevicesV1ListClientStatesResponse {
893    /// Client states meeting the list restrictions.
894    #[serde(rename = "clientStates")]
895    pub client_states: Option<Vec<GoogleAppsCloudidentityDevicesV1ClientState>>,
896    /// Token to retrieve the next page of results. Empty if there are no more results.
897    #[serde(rename = "nextPageToken")]
898    pub next_page_token: Option<String>,
899}
900
901impl common::ResponseResult for GoogleAppsCloudidentityDevicesV1ListClientStatesResponse {}
902
903/// Response message that is returned from the ListDeviceUsers method.
904///
905/// # Activities
906///
907/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
908/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
909///
910/// * [device users list devices](DeviceDeviceUserListCall) (response)
911#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
912#[serde_with::serde_as]
913#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
914pub struct GoogleAppsCloudidentityDevicesV1ListDeviceUsersResponse {
915    /// Devices meeting the list restrictions.
916    #[serde(rename = "deviceUsers")]
917    pub device_users: Option<Vec<GoogleAppsCloudidentityDevicesV1DeviceUser>>,
918    /// Token to retrieve the next page of results. Empty if there are no more results.
919    #[serde(rename = "nextPageToken")]
920    pub next_page_token: Option<String>,
921}
922
923impl common::ResponseResult for GoogleAppsCloudidentityDevicesV1ListDeviceUsersResponse {}
924
925/// Response message that is returned from the ListDevices method.
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/// * [list devices](DeviceListCall) (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 GoogleAppsCloudidentityDevicesV1ListDevicesResponse {
937    /// Devices meeting the list restrictions.
938    pub devices: Option<Vec<GoogleAppsCloudidentityDevicesV1Device>>,
939    /// Token to retrieve the next page of results. Empty if there are no more results.
940    #[serde(rename = "nextPageToken")]
941    pub next_page_token: Option<String>,
942}
943
944impl common::ResponseResult for GoogleAppsCloudidentityDevicesV1ListDevicesResponse {}
945
946/// Response containing resource names of the DeviceUsers associated with the caller’s credentials.
947///
948/// # Activities
949///
950/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
951/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
952///
953/// * [device users lookup devices](DeviceDeviceUserLookupCall) (response)
954#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
955#[serde_with::serde_as]
956#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
957pub struct GoogleAppsCloudidentityDevicesV1LookupSelfDeviceUsersResponse {
958    /// The customer resource name that may be passed back to other Devices API methods such as List, Get, etc.
959    pub customer: Option<String>,
960    /// [Resource names](https://cloud.google.com/apis/design/resource_names) of the DeviceUsers in the format: `devices/{device}/deviceUsers/{user_resource}`, where device is the unique ID assigned to a Device and user_resource is the unique user ID
961    pub names: Option<Vec<String>>,
962    /// Token to retrieve the next page of results. Empty if there are no more results.
963    #[serde(rename = "nextPageToken")]
964    pub next_page_token: Option<String>,
965}
966
967impl common::ResponseResult for GoogleAppsCloudidentityDevicesV1LookupSelfDeviceUsersResponse {}
968
969/// Request message for wiping all data on the device.
970///
971/// # Activities
972///
973/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
974/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
975///
976/// * [wipe devices](DeviceWipeCall) (request)
977#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
978#[serde_with::serde_as]
979#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
980pub struct GoogleAppsCloudidentityDevicesV1WipeDeviceRequest {
981    /// Optional. [Resource name](https://cloud.google.com/apis/design/resource_names) of the customer. If you're using this API for your own organization, use `customers/my_customer` If you're using this API to manage another organization, use `customers/{customer}`, where customer is the customer to whom the device belongs.
982    pub customer: Option<String>,
983    /// Optional. Specifies if a user is able to factory reset a device after a Device Wipe. On iOS, this is called "Activation Lock", while on Android, this is known as "Factory Reset Protection". If true, this protection will be removed from the device, so that a user can successfully factory reset. If false, the setting is untouched on the device.
984    #[serde(rename = "removeResetLock")]
985    pub remove_reset_lock: Option<bool>,
986}
987
988impl common::RequestValue for GoogleAppsCloudidentityDevicesV1WipeDeviceRequest {}
989
990/// Request message for starting an account wipe on device.
991///
992/// # Activities
993///
994/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
995/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
996///
997/// * [device users wipe devices](DeviceDeviceUserWipeCall) (request)
998#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
999#[serde_with::serde_as]
1000#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1001pub struct GoogleAppsCloudidentityDevicesV1WipeDeviceUserRequest {
1002    /// Optional. [Resource name](https://cloud.google.com/apis/design/resource_names) of the customer. If you're using this API for your own organization, use `customers/my_customer` If you're using this API to manage another organization, use `customers/{customer}`, where customer is the customer to whom the device belongs.
1003    pub customer: Option<String>,
1004}
1005
1006impl common::RequestValue for GoogleAppsCloudidentityDevicesV1WipeDeviceUserRequest {}
1007
1008/// A group within the Cloud Identity Groups API. A `Group` is a collection of entities, where each entity is either a user, another group, or a service account.
1009///
1010/// # Activities
1011///
1012/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1013/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1014///
1015/// * [memberships check transitive membership groups](GroupMembershipCheckTransitiveMembershipCall) (none)
1016/// * [memberships create groups](GroupMembershipCreateCall) (none)
1017/// * [memberships delete groups](GroupMembershipDeleteCall) (none)
1018/// * [memberships get groups](GroupMembershipGetCall) (none)
1019/// * [memberships get membership graph groups](GroupMembershipGetMembershipGraphCall) (none)
1020/// * [memberships list groups](GroupMembershipListCall) (none)
1021/// * [memberships lookup groups](GroupMembershipLookupCall) (none)
1022/// * [memberships modify membership roles groups](GroupMembershipModifyMembershipRoleCall) (none)
1023/// * [memberships search direct groups groups](GroupMembershipSearchDirectGroupCall) (none)
1024/// * [memberships search transitive groups groups](GroupMembershipSearchTransitiveGroupCall) (none)
1025/// * [memberships search transitive memberships groups](GroupMembershipSearchTransitiveMembershipCall) (none)
1026/// * [create groups](GroupCreateCall) (request)
1027/// * [delete groups](GroupDeleteCall) (none)
1028/// * [get groups](GroupGetCall) (response)
1029/// * [get security settings groups](GroupGetSecuritySettingCall) (none)
1030/// * [list groups](GroupListCall) (none)
1031/// * [lookup groups](GroupLookupCall) (none)
1032/// * [patch groups](GroupPatchCall) (request)
1033/// * [search groups](GroupSearchCall) (none)
1034/// * [update security settings groups](GroupUpdateSecuritySettingCall) (none)
1035#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1036#[serde_with::serde_as]
1037#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1038pub struct Group {
1039    /// Output only. Additional group keys associated with the Group.
1040    #[serde(rename = "additionalGroupKeys")]
1041    pub additional_group_keys: Option<Vec<EntityKey>>,
1042    /// Output only. The time when the `Group` was created.
1043    #[serde(rename = "createTime")]
1044    pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1045    /// An extended description to help users determine the purpose of a `Group`. Must not be longer than 4,096 characters.
1046    pub description: Option<String>,
1047    /// The display name of the `Group`.
1048    #[serde(rename = "displayName")]
1049    pub display_name: Option<String>,
1050    /// Optional. Dynamic group metadata like queries and status.
1051    #[serde(rename = "dynamicGroupMetadata")]
1052    pub dynamic_group_metadata: Option<DynamicGroupMetadata>,
1053    /// Required. The `EntityKey` of the `Group`.
1054    #[serde(rename = "groupKey")]
1055    pub group_key: Option<EntityKey>,
1056    /// Required. One or more label entries that apply to the Group. Labels contain a key with an empty value. Google Groups are the default type of group and have a label with a key of `cloudidentity.googleapis.com/groups.discussion_forum` and an empty value. Existing Google Groups can have an additional label with a key of `cloudidentity.googleapis.com/groups.security` and an empty value added to them. **This is an immutable change and the security label cannot be removed once added.** Dynamic groups have a label with a key of `cloudidentity.googleapis.com/groups.dynamic`. Identity-mapped groups for Cloud Search have a label with a key of `system/groups/external` and an empty value. Google Groups can be [locked](https://support.google.com/a?p=locked-groups). To lock a group, add a label with a key of `cloudidentity.googleapis.com/groups.locked` and an empty value. Doing so locks the group. To unlock the group, remove this label.
1057    pub labels: Option<HashMap<String, String>>,
1058    /// Output only. The [resource name](https://cloud.google.com/apis/design/resource_names) of the `Group`. Shall be of the form `groups/{group}`.
1059    pub name: Option<String>,
1060    /// Required. Immutable. The resource name of the entity under which this `Group` resides in the Cloud Identity resource hierarchy. Must be of the form `identitysources/{identity_source}` for external [identity-mapped groups](https://support.google.com/a/answer/9039510) or `customers/{customer_id}` for Google Groups. The `customer_id` must begin with "C" (for example, 'C046psxkn'). [Find your customer ID.] (https://support.google.com/cloudidentity/answer/10070793)
1061    pub parent: Option<String>,
1062    /// Output only. The time when the `Group` was last updated.
1063    #[serde(rename = "updateTime")]
1064    pub update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1065}
1066
1067impl common::RequestValue for Group {}
1068impl common::Resource for Group {}
1069impl common::ResponseResult for Group {}
1070
1071/// Message representing a transitive group of a user or a group.
1072///
1073/// This type is not used in any activity, and only used as *part* of another schema.
1074///
1075#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1076#[serde_with::serde_as]
1077#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1078pub struct GroupRelation {
1079    /// Display name for this group.
1080    #[serde(rename = "displayName")]
1081    pub display_name: Option<String>,
1082    /// Resource name for this group.
1083    pub group: Option<String>,
1084    /// Entity key has an id and a namespace. In case of discussion forums, the id will be an email address without a namespace.
1085    #[serde(rename = "groupKey")]
1086    pub group_key: Option<EntityKey>,
1087    /// Labels for Group resource.
1088    pub labels: Option<HashMap<String, String>>,
1089    /// The relation between the member and the transitive group.
1090    #[serde(rename = "relationType")]
1091    pub relation_type: Option<String>,
1092    /// Membership roles of the member for the group.
1093    pub roles: Option<Vec<TransitiveMembershipRole>>,
1094}
1095
1096impl common::Part for GroupRelation {}
1097
1098/// Credential for verifying signatures produced by the Identity Provider.
1099///
1100/// # Activities
1101///
1102/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1103/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1104///
1105/// * [idp credentials get inbound saml sso profiles](InboundSamlSsoProfileIdpCredentialGetCall) (response)
1106#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1107#[serde_with::serde_as]
1108#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1109pub struct IdpCredential {
1110    /// Output only. Information of a DSA public key.
1111    #[serde(rename = "dsaKeyInfo")]
1112    pub dsa_key_info: Option<DsaPublicKeyInfo>,
1113    /// Output only. [Resource name](https://cloud.google.com/apis/design/resource_names) of the credential.
1114    pub name: Option<String>,
1115    /// Output only. Information of a RSA public key.
1116    #[serde(rename = "rsaKeyInfo")]
1117    pub rsa_key_info: Option<RsaPublicKeyInfo>,
1118    /// Output only. Time when the `IdpCredential` was last updated.
1119    #[serde(rename = "updateTime")]
1120    pub update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1121}
1122
1123impl common::ResponseResult for IdpCredential {}
1124
1125/// An [OIDC](https://openid.net/developers/how-connect-works/) federation between a Google enterprise customer and an OIDC identity provider.
1126///
1127/// # Activities
1128///
1129/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1130/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1131///
1132/// * [create inbound oidc sso profiles](InboundOidcSsoProfileCreateCall) (request)
1133/// * [delete inbound oidc sso profiles](InboundOidcSsoProfileDeleteCall) (none)
1134/// * [get inbound oidc sso profiles](InboundOidcSsoProfileGetCall) (response)
1135/// * [list inbound oidc sso profiles](InboundOidcSsoProfileListCall) (none)
1136/// * [patch inbound oidc sso profiles](InboundOidcSsoProfilePatchCall) (request)
1137#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1138#[serde_with::serde_as]
1139#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1140pub struct InboundOidcSsoProfile {
1141    /// Immutable. The customer. For example: `customers/C0123abc`.
1142    pub customer: Option<String>,
1143    /// Human-readable name of the OIDC SSO profile.
1144    #[serde(rename = "displayName")]
1145    pub display_name: Option<String>,
1146    /// OIDC identity provider configuration.
1147    #[serde(rename = "idpConfig")]
1148    pub idp_config: Option<OidcIdpConfig>,
1149    /// Output only. [Resource name](https://cloud.google.com/apis/design/resource_names) of the OIDC SSO profile.
1150    pub name: Option<String>,
1151    /// OIDC relying party (RP) configuration for this OIDC SSO profile. These are the RP details provided by Google that should be configured on the corresponding identity provider.
1152    #[serde(rename = "rpConfig")]
1153    pub rp_config: Option<OidcRpConfig>,
1154}
1155
1156impl common::RequestValue for InboundOidcSsoProfile {}
1157impl common::Resource for InboundOidcSsoProfile {}
1158impl common::ResponseResult for InboundOidcSsoProfile {}
1159
1160/// A [SAML 2.0](https://www.oasis-open.org/standards#samlv2.0) federation between a Google enterprise customer and a SAML identity provider.
1161///
1162/// # Activities
1163///
1164/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1165/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1166///
1167/// * [idp credentials add inbound saml sso profiles](InboundSamlSsoProfileIdpCredentialAddCall) (none)
1168/// * [idp credentials delete inbound saml sso profiles](InboundSamlSsoProfileIdpCredentialDeleteCall) (none)
1169/// * [idp credentials get inbound saml sso profiles](InboundSamlSsoProfileIdpCredentialGetCall) (none)
1170/// * [idp credentials list inbound saml sso profiles](InboundSamlSsoProfileIdpCredentialListCall) (none)
1171/// * [create inbound saml sso profiles](InboundSamlSsoProfileCreateCall) (request)
1172/// * [delete inbound saml sso profiles](InboundSamlSsoProfileDeleteCall) (none)
1173/// * [get inbound saml sso profiles](InboundSamlSsoProfileGetCall) (response)
1174/// * [list inbound saml sso profiles](InboundSamlSsoProfileListCall) (none)
1175/// * [patch inbound saml sso profiles](InboundSamlSsoProfilePatchCall) (request)
1176#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1177#[serde_with::serde_as]
1178#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1179pub struct InboundSamlSsoProfile {
1180    /// Immutable. The customer. For example: `customers/C0123abc`.
1181    pub customer: Option<String>,
1182    /// Human-readable name of the SAML SSO profile.
1183    #[serde(rename = "displayName")]
1184    pub display_name: Option<String>,
1185    /// SAML identity provider configuration.
1186    #[serde(rename = "idpConfig")]
1187    pub idp_config: Option<SamlIdpConfig>,
1188    /// Output only. [Resource name](https://cloud.google.com/apis/design/resource_names) of the SAML SSO profile.
1189    pub name: Option<String>,
1190    /// SAML service provider configuration for this SAML SSO profile. These are the service provider details provided by Google that should be configured on the corresponding identity provider.
1191    #[serde(rename = "spConfig")]
1192    pub sp_config: Option<SamlSpConfig>,
1193}
1194
1195impl common::RequestValue for InboundSamlSsoProfile {}
1196impl common::Resource for InboundSamlSsoProfile {}
1197impl common::ResponseResult for InboundSamlSsoProfile {}
1198
1199/// Targets with “set” SSO assignments and their respective assignments.
1200///
1201/// # Activities
1202///
1203/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1204/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1205///
1206/// * [create inbound sso assignments](InboundSsoAssignmentCreateCall) (request)
1207/// * [delete inbound sso assignments](InboundSsoAssignmentDeleteCall) (none)
1208/// * [get inbound sso assignments](InboundSsoAssignmentGetCall) (response)
1209/// * [list inbound sso assignments](InboundSsoAssignmentListCall) (none)
1210/// * [patch inbound sso assignments](InboundSsoAssignmentPatchCall) (request)
1211#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1212#[serde_with::serde_as]
1213#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1214pub struct InboundSsoAssignment {
1215    /// Immutable. The customer. For example: `customers/C0123abc`.
1216    pub customer: Option<String>,
1217    /// Output only. [Resource name](https://cloud.google.com/apis/design/resource_names) of the Inbound SSO Assignment.
1218    pub name: Option<String>,
1219    /// OpenID Connect SSO details. Must be set if and only if `sso_mode` is set to `OIDC_SSO`.
1220    #[serde(rename = "oidcSsoInfo")]
1221    pub oidc_sso_info: Option<OidcSsoInfo>,
1222    /// Must be zero (which is the default value so it can be omitted) for assignments with `target_org_unit` set and must be greater-than-or-equal-to one for assignments with `target_group` set.
1223    pub rank: Option<i32>,
1224    /// SAML SSO details. Must be set if and only if `sso_mode` is set to `SAML_SSO`.
1225    #[serde(rename = "samlSsoInfo")]
1226    pub saml_sso_info: Option<SamlSsoInfo>,
1227    /// Assertions about users assigned to an IdP will always be accepted from that IdP. This controls whether/when Google should redirect a user to the IdP. Unset (defaults) is the recommended configuration.
1228    #[serde(rename = "signInBehavior")]
1229    pub sign_in_behavior: Option<SignInBehavior>,
1230    /// Inbound SSO behavior.
1231    #[serde(rename = "ssoMode")]
1232    pub sso_mode: Option<String>,
1233    /// Immutable. Must be of the form `groups/{group}`.
1234    #[serde(rename = "targetGroup")]
1235    pub target_group: Option<String>,
1236    /// Immutable. Must be of the form `orgUnits/{org_unit}`.
1237    #[serde(rename = "targetOrgUnit")]
1238    pub target_org_unit: Option<String>,
1239}
1240
1241impl common::RequestValue for InboundSsoAssignment {}
1242impl common::Resource for InboundSsoAssignment {}
1243impl common::ResponseResult for InboundSsoAssignment {}
1244
1245/// Response for IsInvitableUser RPC.
1246///
1247/// # Activities
1248///
1249/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1250/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1251///
1252/// * [userinvitations is invitable user customers](CustomerUserinvitationIsInvitableUserCall) (response)
1253#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1254#[serde_with::serde_as]
1255#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1256pub struct IsInvitableUserResponse {
1257    /// Returns true if the email address is invitable.
1258    #[serde(rename = "isInvitableUser")]
1259    pub is_invitable_user: Option<bool>,
1260}
1261
1262impl common::ResponseResult for IsInvitableUserResponse {}
1263
1264/// Response message for ListGroups operation.
1265///
1266/// # Activities
1267///
1268/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1269/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1270///
1271/// * [list groups](GroupListCall) (response)
1272#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1273#[serde_with::serde_as]
1274#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1275pub struct ListGroupsResponse {
1276    /// Groups returned in response to list request. The results are not sorted.
1277    pub groups: Option<Vec<Group>>,
1278    /// Token to retrieve the next page of results, or empty if there are no more results available for listing.
1279    #[serde(rename = "nextPageToken")]
1280    pub next_page_token: Option<String>,
1281}
1282
1283impl common::ResponseResult for ListGroupsResponse {}
1284
1285/// Response of the InboundSamlSsoProfilesService.ListIdpCredentials method.
1286///
1287/// # Activities
1288///
1289/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1290/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1291///
1292/// * [idp credentials list inbound saml sso profiles](InboundSamlSsoProfileIdpCredentialListCall) (response)
1293#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1294#[serde_with::serde_as]
1295#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1296pub struct ListIdpCredentialsResponse {
1297    /// The IdpCredentials from the specified InboundSamlSsoProfile.
1298    #[serde(rename = "idpCredentials")]
1299    pub idp_credentials: Option<Vec<IdpCredential>>,
1300    /// A token, which can be sent as `page_token` to retrieve the next page. If this field is omitted, there are no subsequent pages.
1301    #[serde(rename = "nextPageToken")]
1302    pub next_page_token: Option<String>,
1303}
1304
1305impl common::ResponseResult for ListIdpCredentialsResponse {}
1306
1307/// Response of the InboundOidcSsoProfilesService.ListInboundOidcSsoProfiles method.
1308///
1309/// # Activities
1310///
1311/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1312/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1313///
1314/// * [list inbound oidc sso profiles](InboundOidcSsoProfileListCall) (response)
1315#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1316#[serde_with::serde_as]
1317#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1318pub struct ListInboundOidcSsoProfilesResponse {
1319    /// List of InboundOidcSsoProfiles.
1320    #[serde(rename = "inboundOidcSsoProfiles")]
1321    pub inbound_oidc_sso_profiles: Option<Vec<InboundOidcSsoProfile>>,
1322    /// A token, which can be sent as `page_token` to retrieve the next page. If this field is omitted, there are no subsequent pages.
1323    #[serde(rename = "nextPageToken")]
1324    pub next_page_token: Option<String>,
1325}
1326
1327impl common::ResponseResult for ListInboundOidcSsoProfilesResponse {}
1328
1329/// Response of the InboundSamlSsoProfilesService.ListInboundSamlSsoProfiles method.
1330///
1331/// # Activities
1332///
1333/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1334/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1335///
1336/// * [list inbound saml sso profiles](InboundSamlSsoProfileListCall) (response)
1337#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1338#[serde_with::serde_as]
1339#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1340pub struct ListInboundSamlSsoProfilesResponse {
1341    /// List of InboundSamlSsoProfiles.
1342    #[serde(rename = "inboundSamlSsoProfiles")]
1343    pub inbound_saml_sso_profiles: Option<Vec<InboundSamlSsoProfile>>,
1344    /// A token, which can be sent as `page_token` to retrieve the next page. If this field is omitted, there are no subsequent pages.
1345    #[serde(rename = "nextPageToken")]
1346    pub next_page_token: Option<String>,
1347}
1348
1349impl common::ResponseResult for ListInboundSamlSsoProfilesResponse {}
1350
1351/// Response of the InboundSsoAssignmentsService.ListInboundSsoAssignments method.
1352///
1353/// # Activities
1354///
1355/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1356/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1357///
1358/// * [list inbound sso assignments](InboundSsoAssignmentListCall) (response)
1359#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1360#[serde_with::serde_as]
1361#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1362pub struct ListInboundSsoAssignmentsResponse {
1363    /// The assignments.
1364    #[serde(rename = "inboundSsoAssignments")]
1365    pub inbound_sso_assignments: Option<Vec<InboundSsoAssignment>>,
1366    /// A token, which can be sent as `page_token` to retrieve the next page. If this field is omitted, there are no subsequent pages.
1367    #[serde(rename = "nextPageToken")]
1368    pub next_page_token: Option<String>,
1369}
1370
1371impl common::ResponseResult for ListInboundSsoAssignmentsResponse {}
1372
1373/// The response message for MembershipsService.ListMemberships.
1374///
1375/// # Activities
1376///
1377/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1378/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1379///
1380/// * [memberships list groups](GroupMembershipListCall) (response)
1381#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1382#[serde_with::serde_as]
1383#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1384pub struct ListMembershipsResponse {
1385    /// The `Membership`s under the specified `parent`.
1386    pub memberships: Option<Vec<Membership>>,
1387    /// A continuation token to retrieve the next page of results, or empty if there are no more results available.
1388    #[serde(rename = "nextPageToken")]
1389    pub next_page_token: Option<String>,
1390}
1391
1392impl common::ResponseResult for ListMembershipsResponse {}
1393
1394/// The response message for PoliciesService.ListPolicies.
1395///
1396/// # Activities
1397///
1398/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1399/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1400///
1401/// * [list policies](PolicyListCall) (response)
1402#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1403#[serde_with::serde_as]
1404#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1405pub struct ListPoliciesResponse {
1406    /// The pagination token to retrieve the next page of results. If this field is empty, there are no subsequent pages.
1407    #[serde(rename = "nextPageToken")]
1408    pub next_page_token: Option<String>,
1409    /// The results
1410    pub policies: Option<Vec<Policy>>,
1411}
1412
1413impl common::ResponseResult for ListPoliciesResponse {}
1414
1415/// Response message for UserInvitation listing request.
1416///
1417/// # Activities
1418///
1419/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1420/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1421///
1422/// * [userinvitations list customers](CustomerUserinvitationListCall) (response)
1423#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1424#[serde_with::serde_as]
1425#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1426pub struct ListUserInvitationsResponse {
1427    /// The token for the next page. If not empty, indicates that there may be more `UserInvitation` resources that match the listing request; this value can be used in a subsequent ListUserInvitationsRequest to get continued results with the current list call.
1428    #[serde(rename = "nextPageToken")]
1429    pub next_page_token: Option<String>,
1430    /// The list of UserInvitation resources.
1431    #[serde(rename = "userInvitations")]
1432    pub user_invitations: Option<Vec<UserInvitation>>,
1433}
1434
1435impl common::ResponseResult for ListUserInvitationsResponse {}
1436
1437/// The response message for GroupsService.LookupGroupName.
1438///
1439/// # Activities
1440///
1441/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1442/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1443///
1444/// * [lookup groups](GroupLookupCall) (response)
1445#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1446#[serde_with::serde_as]
1447#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1448pub struct LookupGroupNameResponse {
1449    /// The [resource name](https://cloud.google.com/apis/design/resource_names) of the looked-up `Group`.
1450    pub name: Option<String>,
1451}
1452
1453impl common::ResponseResult for LookupGroupNameResponse {}
1454
1455/// The response message for MembershipsService.LookupMembershipName.
1456///
1457/// # Activities
1458///
1459/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1460/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1461///
1462/// * [memberships lookup groups](GroupMembershipLookupCall) (response)
1463#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1464#[serde_with::serde_as]
1465#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1466pub struct LookupMembershipNameResponse {
1467    /// The [resource name](https://cloud.google.com/apis/design/resource_names) of the looked-up `Membership`. Must be of the form `groups/{group}/memberships/{membership}`.
1468    pub name: Option<String>,
1469}
1470
1471impl common::ResponseResult for LookupMembershipNameResponse {}
1472
1473/// Message representing a transitive membership of a group.
1474///
1475/// This type is not used in any activity, and only used as *part* of another schema.
1476///
1477#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1478#[serde_with::serde_as]
1479#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1480pub struct MemberRelation {
1481    /// Resource name for this member.
1482    pub member: Option<String>,
1483    /// Entity key has an id and a namespace. In case of discussion forums, the id will be an email address without a namespace.
1484    #[serde(rename = "preferredMemberKey")]
1485    pub preferred_member_key: Option<Vec<EntityKey>>,
1486    /// The relation between the group and the transitive member.
1487    #[serde(rename = "relationType")]
1488    pub relation_type: Option<String>,
1489    /// The membership role details (i.e name of role and expiry time).
1490    pub roles: Option<Vec<TransitiveMembershipRole>>,
1491}
1492
1493impl common::Part for MemberRelation {}
1494
1495/// The definition of MemberRestriction
1496///
1497/// This type is not used in any activity, and only used as *part* of another schema.
1498///
1499#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1500#[serde_with::serde_as]
1501#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1502pub struct MemberRestriction {
1503    /// The evaluated state of this restriction on a group.
1504    pub evaluation: Option<RestrictionEvaluation>,
1505    /// Member Restriction as defined by CEL expression. Supported restrictions are: `member.customer_id` and `member.type`. Valid values for `member.type` are `1`, `2` and `3`. They correspond to USER, SERVICE_ACCOUNT, and GROUP respectively. The value for `member.customer_id` only supports `groupCustomerId()` currently which means the customer id of the group will be used for restriction. Supported operators are `&&`, `||` and `==`, corresponding to AND, OR, and EQUAL. Examples: Allow only service accounts of given customer to be members. `member.type == 2 && member.customer_id == groupCustomerId()` Allow only users or groups to be members. `member.type == 1 || member.type == 3`
1506    pub query: Option<String>,
1507}
1508
1509impl common::Part for MemberRestriction {}
1510
1511/// A membership within the Cloud Identity Groups API. A `Membership` defines a relationship between a `Group` and an entity belonging to that `Group`, referred to as a “member”.
1512///
1513/// # Activities
1514///
1515/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1516/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1517///
1518/// * [memberships create groups](GroupMembershipCreateCall) (request)
1519/// * [memberships get groups](GroupMembershipGetCall) (response)
1520#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1521#[serde_with::serde_as]
1522#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1523pub struct Membership {
1524    /// Output only. The time when the `Membership` was created.
1525    #[serde(rename = "createTime")]
1526    pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1527    /// Output only. Delivery setting associated with the membership.
1528    #[serde(rename = "deliverySetting")]
1529    pub delivery_setting: Option<String>,
1530    /// Output only. The [resource name](https://cloud.google.com/apis/design/resource_names) of the `Membership`. Shall be of the form `groups/{group}/memberships/{membership}`.
1531    pub name: Option<String>,
1532    /// Required. Immutable. The `EntityKey` of the member.
1533    #[serde(rename = "preferredMemberKey")]
1534    pub preferred_member_key: Option<EntityKey>,
1535    /// The `MembershipRole`s that apply to the `Membership`. If unspecified, defaults to a single `MembershipRole` with `name` `MEMBER`. Must not contain duplicate `MembershipRole`s with the same `name`.
1536    pub roles: Option<Vec<MembershipRole>>,
1537    /// Output only. The type of the membership.
1538    #[serde(rename = "type")]
1539    pub type_: Option<String>,
1540    /// Output only. The time when the `Membership` was last updated.
1541    #[serde(rename = "updateTime")]
1542    pub update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1543}
1544
1545impl common::RequestValue for Membership {}
1546impl common::ResponseResult for Membership {}
1547
1548/// Message containing membership relation.
1549///
1550/// This type is not used in any activity, and only used as *part* of another schema.
1551///
1552#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1553#[serde_with::serde_as]
1554#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1555pub struct MembershipRelation {
1556    /// An extended description to help users determine the purpose of a `Group`.
1557    pub description: Option<String>,
1558    /// The display name of the `Group`.
1559    #[serde(rename = "displayName")]
1560    pub display_name: Option<String>,
1561    /// The [resource name](https://cloud.google.com/apis/design/resource_names) of the `Group`. Shall be of the form `groups/{group_id}`.
1562    pub group: Option<String>,
1563    /// The `EntityKey` of the `Group`.
1564    #[serde(rename = "groupKey")]
1565    pub group_key: Option<EntityKey>,
1566    /// One or more label entries that apply to the Group. Currently supported labels contain a key with an empty value.
1567    pub labels: Option<HashMap<String, String>>,
1568    /// The [resource name](https://cloud.google.com/apis/design/resource_names) of the `Membership`. Shall be of the form `groups/{group_id}/memberships/{membership_id}`.
1569    pub membership: Option<String>,
1570    /// The `MembershipRole`s that apply to the `Membership`.
1571    pub roles: Option<Vec<MembershipRole>>,
1572}
1573
1574impl common::Part for MembershipRelation {}
1575
1576/// A membership role within the Cloud Identity Groups API. A `MembershipRole` defines the privileges granted to a `Membership`.
1577///
1578/// This type is not used in any activity, and only used as *part* of another schema.
1579///
1580#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1581#[serde_with::serde_as]
1582#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1583pub struct MembershipRole {
1584    /// The expiry details of the `MembershipRole`. Expiry details are only supported for `MEMBER` `MembershipRoles`. May be set if `name` is `MEMBER`. Must not be set if `name` is any other value.
1585    #[serde(rename = "expiryDetail")]
1586    pub expiry_detail: Option<ExpiryDetail>,
1587    /// The name of the `MembershipRole`. Must be one of `OWNER`, `MANAGER`, `MEMBER`.
1588    pub name: Option<String>,
1589    /// Evaluations of restrictions applied to parent group on this membership.
1590    #[serde(rename = "restrictionEvaluations")]
1591    pub restriction_evaluations: Option<RestrictionEvaluations>,
1592}
1593
1594impl common::Part for MembershipRole {}
1595
1596/// The evaluated state of this restriction.
1597///
1598/// This type is not used in any activity, and only used as *part* of another schema.
1599///
1600#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1601#[serde_with::serde_as]
1602#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1603pub struct MembershipRoleRestrictionEvaluation {
1604    /// Output only. The current state of the restriction
1605    pub state: Option<String>,
1606}
1607
1608impl common::Part for MembershipRoleRestrictionEvaluation {}
1609
1610/// The request message for MembershipsService.ModifyMembershipRoles.
1611///
1612/// # Activities
1613///
1614/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1615/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1616///
1617/// * [memberships modify membership roles groups](GroupMembershipModifyMembershipRoleCall) (request)
1618#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1619#[serde_with::serde_as]
1620#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1621pub struct ModifyMembershipRolesRequest {
1622    /// The `MembershipRole`s to be added. Adding or removing roles in the same request as updating roles is not supported. Must not be set if `update_roles_params` is set.
1623    #[serde(rename = "addRoles")]
1624    pub add_roles: Option<Vec<MembershipRole>>,
1625    /// The `name`s of the `MembershipRole`s to be removed. Adding or removing roles in the same request as updating roles is not supported. It is not possible to remove the `MEMBER` `MembershipRole`. If you wish to delete a `Membership`, call MembershipsService.DeleteMembership instead. Must not contain `MEMBER`. Must not be set if `update_roles_params` is set.
1626    #[serde(rename = "removeRoles")]
1627    pub remove_roles: Option<Vec<String>>,
1628    /// The `MembershipRole`s to be updated. Updating roles in the same request as adding or removing roles is not supported. Must not be set if either `add_roles` or `remove_roles` is set.
1629    #[serde(rename = "updateRolesParams")]
1630    pub update_roles_params: Option<Vec<UpdateMembershipRolesParams>>,
1631}
1632
1633impl common::RequestValue for ModifyMembershipRolesRequest {}
1634
1635/// The response message for MembershipsService.ModifyMembershipRoles.
1636///
1637/// # Activities
1638///
1639/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1640/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1641///
1642/// * [memberships modify membership roles groups](GroupMembershipModifyMembershipRoleCall) (response)
1643#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1644#[serde_with::serde_as]
1645#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1646pub struct ModifyMembershipRolesResponse {
1647    /// The `Membership` resource after modifying its `MembershipRole`s.
1648    pub membership: Option<Membership>,
1649}
1650
1651impl common::ResponseResult for ModifyMembershipRolesResponse {}
1652
1653/// OIDC IDP (identity provider) configuration.
1654///
1655/// This type is not used in any activity, and only used as *part* of another schema.
1656///
1657#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1658#[serde_with::serde_as]
1659#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1660pub struct OidcIdpConfig {
1661    /// The **Change Password URL** of the identity provider. Users will be sent to this URL when changing their passwords at `myaccount.google.com`. This takes precedence over the change password URL configured at customer-level. Must use `HTTPS`.
1662    #[serde(rename = "changePasswordUri")]
1663    pub change_password_uri: Option<String>,
1664    /// Required. The Issuer identifier for the IdP. Must be a URL. The discovery URL will be derived from this as described in Section 4 of [the OIDC specification](https://openid.net/specs/openid-connect-discovery-1_0.html).
1665    #[serde(rename = "issuerUri")]
1666    pub issuer_uri: Option<String>,
1667}
1668
1669impl common::Part for OidcIdpConfig {}
1670
1671/// OIDC RP (relying party) configuration.
1672///
1673/// This type is not used in any activity, and only used as *part* of another schema.
1674///
1675#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1676#[serde_with::serde_as]
1677#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1678pub struct OidcRpConfig {
1679    /// OAuth2 client ID for OIDC.
1680    #[serde(rename = "clientId")]
1681    pub client_id: Option<String>,
1682    /// Input only. OAuth2 client secret for OIDC.
1683    #[serde(rename = "clientSecret")]
1684    pub client_secret: Option<String>,
1685    /// Output only. The URL(s) that this client may use in authentication requests.
1686    #[serde(rename = "redirectUris")]
1687    pub redirect_uris: Option<Vec<String>>,
1688}
1689
1690impl common::Part for OidcRpConfig {}
1691
1692/// Details that are applicable when `sso_mode` is set to `OIDC_SSO`.
1693///
1694/// This type is not used in any activity, and only used as *part* of another schema.
1695///
1696#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1697#[serde_with::serde_as]
1698#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1699pub struct OidcSsoInfo {
1700    /// Required. Name of the `InboundOidcSsoProfile` to use. Must be of the form `inboundOidcSsoProfiles/{inbound_oidc_sso_profile}`.
1701    #[serde(rename = "inboundOidcSsoProfile")]
1702    pub inbound_oidc_sso_profile: Option<String>,
1703}
1704
1705impl common::Part for OidcSsoInfo {}
1706
1707/// This resource represents a long-running operation that is the result of a network API call.
1708///
1709/// # Activities
1710///
1711/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1712/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1713///
1714/// * [userinvitations cancel customers](CustomerUserinvitationCancelCall) (response)
1715/// * [userinvitations send customers](CustomerUserinvitationSendCall) (response)
1716/// * [device users client states patch devices](DeviceDeviceUserClientStatePatchCall) (response)
1717/// * [device users approve devices](DeviceDeviceUserApproveCall) (response)
1718/// * [device users block devices](DeviceDeviceUserBlockCall) (response)
1719/// * [device users cancel wipe devices](DeviceDeviceUserCancelWipeCall) (response)
1720/// * [device users delete devices](DeviceDeviceUserDeleteCall) (response)
1721/// * [device users wipe devices](DeviceDeviceUserWipeCall) (response)
1722/// * [cancel wipe devices](DeviceCancelWipeCall) (response)
1723/// * [create devices](DeviceCreateCall) (response)
1724/// * [delete devices](DeviceDeleteCall) (response)
1725/// * [wipe devices](DeviceWipeCall) (response)
1726/// * [memberships create groups](GroupMembershipCreateCall) (response)
1727/// * [memberships delete groups](GroupMembershipDeleteCall) (response)
1728/// * [memberships get membership graph groups](GroupMembershipGetMembershipGraphCall) (response)
1729/// * [create groups](GroupCreateCall) (response)
1730/// * [delete groups](GroupDeleteCall) (response)
1731/// * [patch groups](GroupPatchCall) (response)
1732/// * [update security settings groups](GroupUpdateSecuritySettingCall) (response)
1733/// * [create inbound oidc sso profiles](InboundOidcSsoProfileCreateCall) (response)
1734/// * [delete inbound oidc sso profiles](InboundOidcSsoProfileDeleteCall) (response)
1735/// * [patch inbound oidc sso profiles](InboundOidcSsoProfilePatchCall) (response)
1736/// * [idp credentials add inbound saml sso profiles](InboundSamlSsoProfileIdpCredentialAddCall) (response)
1737/// * [idp credentials delete inbound saml sso profiles](InboundSamlSsoProfileIdpCredentialDeleteCall) (response)
1738/// * [create inbound saml sso profiles](InboundSamlSsoProfileCreateCall) (response)
1739/// * [delete inbound saml sso profiles](InboundSamlSsoProfileDeleteCall) (response)
1740/// * [patch inbound saml sso profiles](InboundSamlSsoProfilePatchCall) (response)
1741/// * [create inbound sso assignments](InboundSsoAssignmentCreateCall) (response)
1742/// * [delete inbound sso assignments](InboundSsoAssignmentDeleteCall) (response)
1743/// * [patch inbound sso assignments](InboundSsoAssignmentPatchCall) (response)
1744#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1745#[serde_with::serde_as]
1746#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1747pub struct Operation {
1748    /// 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.
1749    pub done: Option<bool>,
1750    /// The error result of the operation in case of failure or cancellation.
1751    pub error: Option<Status>,
1752    /// 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.
1753    pub metadata: Option<HashMap<String, serde_json::Value>>,
1754    /// 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}`.
1755    pub name: Option<String>,
1756    /// 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`.
1757    pub response: Option<HashMap<String, serde_json::Value>>,
1758}
1759
1760impl common::ResponseResult for Operation {}
1761
1762/// A Policy resource binds an instance of a single Setting with the scope of a PolicyQuery. The Setting instance will be applied to all entities that satisfy the query.
1763///
1764/// # Activities
1765///
1766/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1767/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1768///
1769/// * [get policies](PolicyGetCall) (response)
1770#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1771#[serde_with::serde_as]
1772#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1773pub struct Policy {
1774    /// Immutable. Customer that the Policy belongs to. The value is in the format 'customers/{customerId}'. The `customerId` must begin with "C" To find your customer ID in Admin Console see https://support.google.com/a/answer/10070793.
1775    pub customer: Option<String>,
1776    /// Output only. Identifier. The [resource name](https://cloud.google.com/apis/design/resource_names) of the Policy. Format: policies/{policy}.
1777    pub name: Option<String>,
1778    /// Required. The PolicyQuery the Setting applies to.
1779    #[serde(rename = "policyQuery")]
1780    pub policy_query: Option<PolicyQuery>,
1781    /// Required. The Setting configured by this Policy.
1782    pub setting: Option<Setting>,
1783    /// Output only. The type of the policy.
1784    #[serde(rename = "type")]
1785    pub type_: Option<String>,
1786}
1787
1788impl common::ResponseResult for Policy {}
1789
1790/// PolicyQuery
1791///
1792/// This type is not used in any activity, and only used as *part* of another schema.
1793///
1794#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1795#[serde_with::serde_as]
1796#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1797pub struct PolicyQuery {
1798    /// Immutable. The group that the query applies to. This field is only set if there is a single value for group that satisfies all clauses of the query. If no group applies, this will be the empty string.
1799    pub group: Option<String>,
1800    /// Required. Immutable. Non-empty default. The OrgUnit the query applies to. This field is only set if there is a single value for org_unit that satisfies all clauses of the query.
1801    #[serde(rename = "orgUnit")]
1802    pub org_unit: Option<String>,
1803    /// Immutable. The CEL query that defines which entities the Policy applies to (ex. a User entity). For details about CEL see https://opensource.google.com/projects/cel. The OrgUnits the Policy applies to are represented by a clause like so: entity.org_units.exists(org_unit, org_unit.org_unit_id == orgUnitId('{orgUnitId}')) The Group the Policy applies to are represented by a clause like so: entity.groups.exists(group, group.group_id == groupId('{groupId}')) The Licenses the Policy applies to are represented by a clause like so: entity.licenses.exists(license, license in ['/product/{productId}/sku/{skuId}']) The above clauses can be present in any combination, and used in conjunction with the &&, || and ! operators. The org_unit and group fields below are helper fields that contain the corresponding value(s) as the query to make the query easier to use.
1804    pub query: Option<String>,
1805    /// Output only. The decimal sort order of this PolicyQuery. The value is relative to all other policies with the same setting type for the customer. (There are no duplicates within this set).
1806    #[serde(rename = "sortOrder")]
1807    pub sort_order: Option<f64>,
1808}
1809
1810impl common::Part for PolicyQuery {}
1811
1812/// The evaluated state of this restriction.
1813///
1814/// This type is not used in any activity, and only used as *part* of another schema.
1815///
1816#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1817#[serde_with::serde_as]
1818#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1819pub struct RestrictionEvaluation {
1820    /// Output only. The current state of the restriction
1821    pub state: Option<String>,
1822}
1823
1824impl common::Part for RestrictionEvaluation {}
1825
1826/// Evaluations of restrictions applied to parent group on this membership.
1827///
1828/// This type is not used in any activity, and only used as *part* of another schema.
1829///
1830#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1831#[serde_with::serde_as]
1832#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1833pub struct RestrictionEvaluations {
1834    /// Evaluation of the member restriction applied to this membership. Empty if the user lacks permission to view the restriction evaluation.
1835    #[serde(rename = "memberRestrictionEvaluation")]
1836    pub member_restriction_evaluation: Option<MembershipRoleRestrictionEvaluation>,
1837}
1838
1839impl common::Part for RestrictionEvaluations {}
1840
1841/// Information of a RSA public key.
1842///
1843/// This type is not used in any activity, and only used as *part* of another schema.
1844///
1845#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1846#[serde_with::serde_as]
1847#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1848pub struct RsaPublicKeyInfo {
1849    /// Key size in bits (size of the modulus).
1850    #[serde(rename = "keySize")]
1851    pub key_size: Option<i32>,
1852}
1853
1854impl common::Part for RsaPublicKeyInfo {}
1855
1856/// SAML IDP (identity provider) configuration.
1857///
1858/// This type is not used in any activity, and only used as *part* of another schema.
1859///
1860#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1861#[serde_with::serde_as]
1862#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1863pub struct SamlIdpConfig {
1864    /// The **Change Password URL** of the identity provider. Users will be sent to this URL when changing their passwords at `myaccount.google.com`. This takes precedence over the change password URL configured at customer-level. Must use `HTTPS`.
1865    #[serde(rename = "changePasswordUri")]
1866    pub change_password_uri: Option<String>,
1867    /// Required. The SAML **Entity ID** of the identity provider.
1868    #[serde(rename = "entityId")]
1869    pub entity_id: Option<String>,
1870    /// The **Logout Redirect URL** (sign-out page URL) of the identity provider. When a user clicks the sign-out link on a Google page, they will be redirected to this URL. This is a pure redirect with no attached SAML `LogoutRequest` i.e. SAML single logout is not supported. Must use `HTTPS`.
1871    #[serde(rename = "logoutRedirectUri")]
1872    pub logout_redirect_uri: Option<String>,
1873    /// Required. The `SingleSignOnService` endpoint location (sign-in page URL) of the identity provider. This is the URL where the `AuthnRequest` will be sent. Must use `HTTPS`. Assumed to accept the `HTTP-Redirect` binding.
1874    #[serde(rename = "singleSignOnServiceUri")]
1875    pub single_sign_on_service_uri: Option<String>,
1876}
1877
1878impl common::Part for SamlIdpConfig {}
1879
1880/// SAML SP (service provider) configuration.
1881///
1882/// This type is not used in any activity, and only used as *part* of another schema.
1883///
1884#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1885#[serde_with::serde_as]
1886#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1887pub struct SamlSpConfig {
1888    /// Output only. The SAML **Assertion Consumer Service (ACS) URL** to be used for the IDP-initiated login. Assumed to accept response messages via the `HTTP-POST` binding.
1889    #[serde(rename = "assertionConsumerServiceUri")]
1890    pub assertion_consumer_service_uri: Option<String>,
1891    /// Output only. The SAML **Entity ID** for this service provider.
1892    #[serde(rename = "entityId")]
1893    pub entity_id: Option<String>,
1894}
1895
1896impl common::Part for SamlSpConfig {}
1897
1898/// Details that are applicable when `sso_mode` == `SAML_SSO`.
1899///
1900/// This type is not used in any activity, and only used as *part* of another schema.
1901///
1902#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1903#[serde_with::serde_as]
1904#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1905pub struct SamlSsoInfo {
1906    /// Required. Name of the `InboundSamlSsoProfile` to use. Must be of the form `inboundSamlSsoProfiles/{inbound_saml_sso_profile}`.
1907    #[serde(rename = "inboundSamlSsoProfile")]
1908    pub inbound_saml_sso_profile: Option<String>,
1909}
1910
1911impl common::Part for SamlSsoInfo {}
1912
1913/// The response message for MembershipsService.SearchDirectGroups.
1914///
1915/// # Activities
1916///
1917/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1918/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1919///
1920/// * [memberships search direct groups groups](GroupMembershipSearchDirectGroupCall) (response)
1921#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1922#[serde_with::serde_as]
1923#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1924pub struct SearchDirectGroupsResponse {
1925    /// List of direct groups satisfying the query.
1926    pub memberships: Option<Vec<MembershipRelation>>,
1927    /// Token to retrieve the next page of results, or empty if there are no more results available for listing.
1928    #[serde(rename = "nextPageToken")]
1929    pub next_page_token: Option<String>,
1930}
1931
1932impl common::ResponseResult for SearchDirectGroupsResponse {}
1933
1934/// The response message for GroupsService.SearchGroups.
1935///
1936/// # Activities
1937///
1938/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1939/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1940///
1941/// * [search groups](GroupSearchCall) (response)
1942#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1943#[serde_with::serde_as]
1944#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1945pub struct SearchGroupsResponse {
1946    /// The `Group` resources that match the search query.
1947    pub groups: Option<Vec<Group>>,
1948    /// A continuation token to retrieve the next page of results, or empty if there are no more results available.
1949    #[serde(rename = "nextPageToken")]
1950    pub next_page_token: Option<String>,
1951}
1952
1953impl common::ResponseResult for SearchGroupsResponse {}
1954
1955/// The response message for MembershipsService.SearchTransitiveGroups.
1956///
1957/// # Activities
1958///
1959/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1960/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1961///
1962/// * [memberships search transitive groups groups](GroupMembershipSearchTransitiveGroupCall) (response)
1963#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1964#[serde_with::serde_as]
1965#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1966pub struct SearchTransitiveGroupsResponse {
1967    /// List of transitive groups satisfying the query.
1968    pub memberships: Option<Vec<GroupRelation>>,
1969    /// Token to retrieve the next page of results, or empty if there are no more results available for listing.
1970    #[serde(rename = "nextPageToken")]
1971    pub next_page_token: Option<String>,
1972}
1973
1974impl common::ResponseResult for SearchTransitiveGroupsResponse {}
1975
1976/// The response message for MembershipsService.SearchTransitiveMemberships.
1977///
1978/// # Activities
1979///
1980/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1981/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1982///
1983/// * [memberships search transitive memberships groups](GroupMembershipSearchTransitiveMembershipCall) (response)
1984#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1985#[serde_with::serde_as]
1986#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1987pub struct SearchTransitiveMembershipsResponse {
1988    /// List of transitive members satisfying the query.
1989    pub memberships: Option<Vec<MemberRelation>>,
1990    /// Token to retrieve the next page of results, or empty if there are no more results.
1991    #[serde(rename = "nextPageToken")]
1992    pub next_page_token: Option<String>,
1993}
1994
1995impl common::ResponseResult for SearchTransitiveMembershipsResponse {}
1996
1997/// The definition of security settings.
1998///
1999/// # Activities
2000///
2001/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2002/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2003///
2004/// * [get security settings groups](GroupGetSecuritySettingCall) (response)
2005/// * [update security settings groups](GroupUpdateSecuritySettingCall) (request)
2006#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2007#[serde_with::serde_as]
2008#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2009pub struct SecuritySettings {
2010    /// The Member Restriction value
2011    #[serde(rename = "memberRestriction")]
2012    pub member_restriction: Option<MemberRestriction>,
2013    /// Output only. The resource name of the security settings. Shall be of the form `groups/{group_id}/securitySettings`.
2014    pub name: Option<String>,
2015}
2016
2017impl common::RequestValue for SecuritySettings {}
2018impl common::ResponseResult for SecuritySettings {}
2019
2020/// A request to send email for inviting target user corresponding to the UserInvitation.
2021///
2022/// # Activities
2023///
2024/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2025/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2026///
2027/// * [userinvitations send customers](CustomerUserinvitationSendCall) (request)
2028#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2029#[serde_with::serde_as]
2030#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2031pub struct SendUserInvitationRequest {
2032    _never_set: Option<bool>,
2033}
2034
2035impl common::RequestValue for SendUserInvitationRequest {}
2036
2037/// Setting
2038///
2039/// This type is not used in any activity, and only used as *part* of another schema.
2040///
2041#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2042#[serde_with::serde_as]
2043#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2044pub struct Setting {
2045    /// Required. Immutable. The type of the Setting. .
2046    #[serde(rename = "type")]
2047    pub type_: Option<String>,
2048    /// Required. The value of the Setting.
2049    pub value: Option<HashMap<String, serde_json::Value>>,
2050}
2051
2052impl common::Part for Setting {}
2053
2054/// Controls sign-in behavior.
2055///
2056/// This type is not used in any activity, and only used as *part* of another schema.
2057///
2058#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2059#[serde_with::serde_as]
2060#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2061pub struct SignInBehavior {
2062    /// When to redirect sign-ins to the IdP.
2063    #[serde(rename = "redirectCondition")]
2064    pub redirect_condition: Option<String>,
2065}
2066
2067impl common::Part for SignInBehavior {}
2068
2069/// 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).
2070///
2071/// This type is not used in any activity, and only used as *part* of another schema.
2072///
2073#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2074#[serde_with::serde_as]
2075#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2076pub struct Status {
2077    /// The status code, which should be an enum value of google.rpc.Code.
2078    pub code: Option<i32>,
2079    /// A list of messages that carry the error details. There is a common set of message types for APIs to use.
2080    pub details: Option<Vec<HashMap<String, serde_json::Value>>>,
2081    /// 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.
2082    pub message: Option<String>,
2083}
2084
2085impl common::Part for Status {}
2086
2087/// Message representing the role of a TransitiveMembership.
2088///
2089/// This type is not used in any activity, and only used as *part* of another schema.
2090///
2091#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2092#[serde_with::serde_as]
2093#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2094pub struct TransitiveMembershipRole {
2095    /// TransitiveMembershipRole in string format. Currently supported TransitiveMembershipRoles: `"MEMBER"`, `"OWNER"`, and `"MANAGER"`.
2096    pub role: Option<String>,
2097}
2098
2099impl common::Part for TransitiveMembershipRole {}
2100
2101/// The details of an update to a `MembershipRole`.
2102///
2103/// This type is not used in any activity, and only used as *part* of another schema.
2104///
2105#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2106#[serde_with::serde_as]
2107#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2108pub struct UpdateMembershipRolesParams {
2109    /// The fully-qualified names of fields to update. May only contain the field `expiry_detail.expire_time`.
2110    #[serde(rename = "fieldMask")]
2111    pub field_mask: Option<common::FieldMask>,
2112    /// The `MembershipRole`s to be updated. Only `MEMBER` `MembershipRole` can currently be updated.
2113    #[serde(rename = "membershipRole")]
2114    pub membership_role: Option<MembershipRole>,
2115}
2116
2117impl common::Part for UpdateMembershipRolesParams {}
2118
2119/// The `UserInvitation` resource represents an email that can be sent to an unmanaged user account inviting them to join the customer’s Google Workspace or Cloud Identity account. An unmanaged account shares an email address domain with the Google Workspace or Cloud Identity account but is not managed by it yet. If the user accepts the `UserInvitation`, the user account will become managed.
2120///
2121/// # Activities
2122///
2123/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2124/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2125///
2126/// * [userinvitations get customers](CustomerUserinvitationGetCall) (response)
2127#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2128#[serde_with::serde_as]
2129#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2130pub struct UserInvitation {
2131    /// Number of invitation emails sent to the user.
2132    #[serde(rename = "mailsSentCount")]
2133    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
2134    pub mails_sent_count: Option<i64>,
2135    /// Shall be of the form `customers/{customer}/userinvitations/{user_email_address}`.
2136    pub name: Option<String>,
2137    /// State of the `UserInvitation`.
2138    pub state: Option<String>,
2139    /// Time when the `UserInvitation` was last updated.
2140    #[serde(rename = "updateTime")]
2141    pub update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
2142}
2143
2144impl common::ResponseResult for UserInvitation {}
2145
2146// ###################
2147// MethodBuilders ###
2148// #################
2149
2150/// A builder providing access to all methods supported on *customer* resources.
2151/// It is not used directly, but through the [`CloudIdentity`] hub.
2152///
2153/// # Example
2154///
2155/// Instantiate a resource builder
2156///
2157/// ```test_harness,no_run
2158/// extern crate hyper;
2159/// extern crate hyper_rustls;
2160/// extern crate google_cloudidentity1 as cloudidentity1;
2161///
2162/// # async fn dox() {
2163/// use cloudidentity1::{CloudIdentity, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2164///
2165/// let secret: yup_oauth2::ApplicationSecret = Default::default();
2166/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
2167///     .with_native_roots()
2168///     .unwrap()
2169///     .https_only()
2170///     .enable_http2()
2171///     .build();
2172///
2173/// let executor = hyper_util::rt::TokioExecutor::new();
2174/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
2175///     secret,
2176///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2177///     yup_oauth2::client::CustomHyperClientBuilder::from(
2178///         hyper_util::client::legacy::Client::builder(executor).build(connector),
2179///     ),
2180/// ).build().await.unwrap();
2181///
2182/// let client = hyper_util::client::legacy::Client::builder(
2183///     hyper_util::rt::TokioExecutor::new()
2184/// )
2185/// .build(
2186///     hyper_rustls::HttpsConnectorBuilder::new()
2187///         .with_native_roots()
2188///         .unwrap()
2189///         .https_or_http()
2190///         .enable_http2()
2191///         .build()
2192/// );
2193/// let mut hub = CloudIdentity::new(client, auth);
2194/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
2195/// // like `userinvitations_cancel(...)`, `userinvitations_get(...)`, `userinvitations_is_invitable_user(...)`, `userinvitations_list(...)` and `userinvitations_send(...)`
2196/// // to build up your call.
2197/// let rb = hub.customers();
2198/// # }
2199/// ```
2200pub struct CustomerMethods<'a, C>
2201where
2202    C: 'a,
2203{
2204    hub: &'a CloudIdentity<C>,
2205}
2206
2207impl<'a, C> common::MethodsBuilder for CustomerMethods<'a, C> {}
2208
2209impl<'a, C> CustomerMethods<'a, C> {
2210    /// Create a builder to help you perform the following task:
2211    ///
2212    /// Cancels a UserInvitation that was already sent.
2213    ///
2214    /// # Arguments
2215    ///
2216    /// * `request` - No description provided.
2217    /// * `name` - Required. `UserInvitation` name in the format `customers/{customer}/userinvitations/{user_email_address}`
2218    pub fn userinvitations_cancel(
2219        &self,
2220        request: CancelUserInvitationRequest,
2221        name: &str,
2222    ) -> CustomerUserinvitationCancelCall<'a, C> {
2223        CustomerUserinvitationCancelCall {
2224            hub: self.hub,
2225            _request: request,
2226            _name: name.to_string(),
2227            _delegate: Default::default(),
2228            _additional_params: Default::default(),
2229        }
2230    }
2231
2232    /// Create a builder to help you perform the following task:
2233    ///
2234    /// Retrieves a UserInvitation resource. **Note:** New consumer accounts with the customer's verified domain created within the previous 48 hours will not appear in the result. This delay also applies to newly-verified domains.
2235    ///
2236    /// # Arguments
2237    ///
2238    /// * `name` - Required. `UserInvitation` name in the format `customers/{customer}/userinvitations/{user_email_address}`
2239    pub fn userinvitations_get(&self, name: &str) -> CustomerUserinvitationGetCall<'a, C> {
2240        CustomerUserinvitationGetCall {
2241            hub: self.hub,
2242            _name: name.to_string(),
2243            _delegate: Default::default(),
2244            _additional_params: Default::default(),
2245        }
2246    }
2247
2248    /// Create a builder to help you perform the following task:
2249    ///
2250    /// Verifies whether a user account is eligible to receive a UserInvitation (is an unmanaged account). Eligibility is based on the following criteria: * the email address is a consumer account and it's the primary email address of the account, and * the domain of the email address matches an existing verified Google Workspace or Cloud Identity domain If both conditions are met, the user is eligible. **Note:** This method is not supported for Workspace Essentials customers.
2251    ///
2252    /// # Arguments
2253    ///
2254    /// * `name` - Required. `UserInvitation` name in the format `customers/{customer}/userinvitations/{user_email_address}`
2255    pub fn userinvitations_is_invitable_user(
2256        &self,
2257        name: &str,
2258    ) -> CustomerUserinvitationIsInvitableUserCall<'a, C> {
2259        CustomerUserinvitationIsInvitableUserCall {
2260            hub: self.hub,
2261            _name: name.to_string(),
2262            _delegate: Default::default(),
2263            _additional_params: Default::default(),
2264        }
2265    }
2266
2267    /// Create a builder to help you perform the following task:
2268    ///
2269    /// Retrieves a list of UserInvitation resources. **Note:** New consumer accounts with the customer's verified domain created within the previous 48 hours will not appear in the result. This delay also applies to newly-verified domains.
2270    ///
2271    /// # Arguments
2272    ///
2273    /// * `parent` - Required. The customer ID of the Google Workspace or Cloud Identity account the UserInvitation resources are associated with.
2274    pub fn userinvitations_list(&self, parent: &str) -> CustomerUserinvitationListCall<'a, C> {
2275        CustomerUserinvitationListCall {
2276            hub: self.hub,
2277            _parent: parent.to_string(),
2278            _page_token: Default::default(),
2279            _page_size: Default::default(),
2280            _order_by: Default::default(),
2281            _filter: Default::default(),
2282            _delegate: Default::default(),
2283            _additional_params: Default::default(),
2284        }
2285    }
2286
2287    /// Create a builder to help you perform the following task:
2288    ///
2289    /// Sends a UserInvitation to email. If the `UserInvitation` does not exist for this request and it is a valid request, the request creates a `UserInvitation`. **Note:** The `get` and `list` methods have a 48-hour delay where newly-created consumer accounts will not appear in the results. You can still send a `UserInvitation` to those accounts if you know the unmanaged email address and IsInvitableUser==True.
2290    ///
2291    /// # Arguments
2292    ///
2293    /// * `request` - No description provided.
2294    /// * `name` - Required. `UserInvitation` name in the format `customers/{customer}/userinvitations/{user_email_address}`
2295    pub fn userinvitations_send(
2296        &self,
2297        request: SendUserInvitationRequest,
2298        name: &str,
2299    ) -> CustomerUserinvitationSendCall<'a, C> {
2300        CustomerUserinvitationSendCall {
2301            hub: self.hub,
2302            _request: request,
2303            _name: name.to_string(),
2304            _delegate: Default::default(),
2305            _additional_params: Default::default(),
2306        }
2307    }
2308}
2309
2310/// A builder providing access to all methods supported on *device* resources.
2311/// It is not used directly, but through the [`CloudIdentity`] hub.
2312///
2313/// # Example
2314///
2315/// Instantiate a resource builder
2316///
2317/// ```test_harness,no_run
2318/// extern crate hyper;
2319/// extern crate hyper_rustls;
2320/// extern crate google_cloudidentity1 as cloudidentity1;
2321///
2322/// # async fn dox() {
2323/// use cloudidentity1::{CloudIdentity, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2324///
2325/// let secret: yup_oauth2::ApplicationSecret = Default::default();
2326/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
2327///     .with_native_roots()
2328///     .unwrap()
2329///     .https_only()
2330///     .enable_http2()
2331///     .build();
2332///
2333/// let executor = hyper_util::rt::TokioExecutor::new();
2334/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
2335///     secret,
2336///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2337///     yup_oauth2::client::CustomHyperClientBuilder::from(
2338///         hyper_util::client::legacy::Client::builder(executor).build(connector),
2339///     ),
2340/// ).build().await.unwrap();
2341///
2342/// let client = hyper_util::client::legacy::Client::builder(
2343///     hyper_util::rt::TokioExecutor::new()
2344/// )
2345/// .build(
2346///     hyper_rustls::HttpsConnectorBuilder::new()
2347///         .with_native_roots()
2348///         .unwrap()
2349///         .https_or_http()
2350///         .enable_http2()
2351///         .build()
2352/// );
2353/// let mut hub = CloudIdentity::new(client, auth);
2354/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
2355/// // like `cancel_wipe(...)`, `create(...)`, `delete(...)`, `device_users_approve(...)`, `device_users_block(...)`, `device_users_cancel_wipe(...)`, `device_users_client_states_get(...)`, `device_users_client_states_list(...)`, `device_users_client_states_patch(...)`, `device_users_delete(...)`, `device_users_get(...)`, `device_users_list(...)`, `device_users_lookup(...)`, `device_users_wipe(...)`, `get(...)`, `list(...)` and `wipe(...)`
2356/// // to build up your call.
2357/// let rb = hub.devices();
2358/// # }
2359/// ```
2360pub struct DeviceMethods<'a, C>
2361where
2362    C: 'a,
2363{
2364    hub: &'a CloudIdentity<C>,
2365}
2366
2367impl<'a, C> common::MethodsBuilder for DeviceMethods<'a, C> {}
2368
2369impl<'a, C> DeviceMethods<'a, C> {
2370    /// Create a builder to help you perform the following task:
2371    ///
2372    /// Gets the client state for the device user
2373    ///
2374    /// # Arguments
2375    ///
2376    /// * `name` - Required. [Resource name](https://cloud.google.com/apis/design/resource_names) of the ClientState in format: `devices/{device}/deviceUsers/{device_user}/clientStates/{partner}`, where `device` is the unique ID assigned to the Device, `device_user` is the unique ID assigned to the User and `partner` identifies the partner storing the data. To get the client state for devices belonging to your own organization, the `partnerId` is in the format: `customerId-*anystring*`. Where the `customerId` is your organization's customer ID and `anystring` is any suffix. This suffix is used in setting up Custom Access Levels in Context-Aware Access. You may use `my_customer` instead of the customer ID for devices managed by your own organization. You may specify `-` in place of the `{device}`, so the ClientState resource name can be: `devices/-/deviceUsers/{device_user_resource}/clientStates/{partner}`.
2377    pub fn device_users_client_states_get(
2378        &self,
2379        name: &str,
2380    ) -> DeviceDeviceUserClientStateGetCall<'a, C> {
2381        DeviceDeviceUserClientStateGetCall {
2382            hub: self.hub,
2383            _name: name.to_string(),
2384            _customer: Default::default(),
2385            _delegate: Default::default(),
2386            _additional_params: Default::default(),
2387            _scopes: Default::default(),
2388        }
2389    }
2390
2391    /// Create a builder to help you perform the following task:
2392    ///
2393    /// Lists the client states for the given search query.
2394    ///
2395    /// # Arguments
2396    ///
2397    /// * `parent` - Required. To list all ClientStates, set this to "devices/-/deviceUsers/-". To list all ClientStates owned by a DeviceUser, set this to the resource name of the DeviceUser. Format: devices/{device}/deviceUsers/{deviceUser}
2398    pub fn device_users_client_states_list(
2399        &self,
2400        parent: &str,
2401    ) -> DeviceDeviceUserClientStateListCall<'a, C> {
2402        DeviceDeviceUserClientStateListCall {
2403            hub: self.hub,
2404            _parent: parent.to_string(),
2405            _page_token: Default::default(),
2406            _order_by: Default::default(),
2407            _filter: Default::default(),
2408            _customer: Default::default(),
2409            _delegate: Default::default(),
2410            _additional_params: Default::default(),
2411            _scopes: Default::default(),
2412        }
2413    }
2414
2415    /// Create a builder to help you perform the following task:
2416    ///
2417    /// Updates the client state for the device user **Note**: This method is available only to customers who have one of the following SKUs: Enterprise Standard, Enterprise Plus, Enterprise for Education, and Cloud Identity Premium
2418    ///
2419    /// # Arguments
2420    ///
2421    /// * `request` - No description provided.
2422    /// * `name` - Output only. [Resource name](https://cloud.google.com/apis/design/resource_names) of the ClientState in format: `devices/{device}/deviceUsers/{device_user}/clientState/{partner}`, where partner corresponds to the partner storing the data. For partners belonging to the "BeyondCorp Alliance", this is the partner ID specified to you by Google. For all other callers, this is a string of the form: `{customer}-suffix`, where `customer` is your customer ID. The *suffix* is any string the caller specifies. This string will be displayed verbatim in the administration console. This suffix is used in setting up Custom Access Levels in Context-Aware Access. Your organization's customer ID can be obtained from the URL: `GET https://www.googleapis.com/admin/directory/v1/customers/my_customer` The `id` field in the response contains the customer ID starting with the letter 'C'. The customer ID to be used in this API is the string after the letter 'C' (not including 'C')
2423    pub fn device_users_client_states_patch(
2424        &self,
2425        request: GoogleAppsCloudidentityDevicesV1ClientState,
2426        name: &str,
2427    ) -> DeviceDeviceUserClientStatePatchCall<'a, C> {
2428        DeviceDeviceUserClientStatePatchCall {
2429            hub: self.hub,
2430            _request: request,
2431            _name: name.to_string(),
2432            _update_mask: Default::default(),
2433            _customer: Default::default(),
2434            _delegate: Default::default(),
2435            _additional_params: Default::default(),
2436            _scopes: Default::default(),
2437        }
2438    }
2439
2440    /// Create a builder to help you perform the following task:
2441    ///
2442    /// Approves device to access user data.
2443    ///
2444    /// # Arguments
2445    ///
2446    /// * `request` - No description provided.
2447    /// * `name` - Required. [Resource name](https://cloud.google.com/apis/design/resource_names) of the Device in format: `devices/{device}/deviceUsers/{device_user}`, where device is the unique ID assigned to the Device, and device_user is the unique ID assigned to the User.
2448    pub fn device_users_approve(
2449        &self,
2450        request: GoogleAppsCloudidentityDevicesV1ApproveDeviceUserRequest,
2451        name: &str,
2452    ) -> DeviceDeviceUserApproveCall<'a, C> {
2453        DeviceDeviceUserApproveCall {
2454            hub: self.hub,
2455            _request: request,
2456            _name: name.to_string(),
2457            _delegate: Default::default(),
2458            _additional_params: Default::default(),
2459            _scopes: Default::default(),
2460        }
2461    }
2462
2463    /// Create a builder to help you perform the following task:
2464    ///
2465    /// Blocks device from accessing user data
2466    ///
2467    /// # Arguments
2468    ///
2469    /// * `request` - No description provided.
2470    /// * `name` - Required. [Resource name](https://cloud.google.com/apis/design/resource_names) of the Device in format: `devices/{device}/deviceUsers/{device_user}`, where device is the unique ID assigned to the Device, and device_user is the unique ID assigned to the User.
2471    pub fn device_users_block(
2472        &self,
2473        request: GoogleAppsCloudidentityDevicesV1BlockDeviceUserRequest,
2474        name: &str,
2475    ) -> DeviceDeviceUserBlockCall<'a, C> {
2476        DeviceDeviceUserBlockCall {
2477            hub: self.hub,
2478            _request: request,
2479            _name: name.to_string(),
2480            _delegate: Default::default(),
2481            _additional_params: Default::default(),
2482            _scopes: Default::default(),
2483        }
2484    }
2485
2486    /// Create a builder to help you perform the following task:
2487    ///
2488    /// Cancels an unfinished user account wipe. This operation can be used to cancel device wipe in the gap between the wipe operation returning success and the device being wiped.
2489    ///
2490    /// # Arguments
2491    ///
2492    /// * `request` - No description provided.
2493    /// * `name` - Required. [Resource name](https://cloud.google.com/apis/design/resource_names) of the Device in format: `devices/{device}/deviceUsers/{device_user}`, where device is the unique ID assigned to the Device, and device_user is the unique ID assigned to the User.
2494    pub fn device_users_cancel_wipe(
2495        &self,
2496        request: GoogleAppsCloudidentityDevicesV1CancelWipeDeviceUserRequest,
2497        name: &str,
2498    ) -> DeviceDeviceUserCancelWipeCall<'a, C> {
2499        DeviceDeviceUserCancelWipeCall {
2500            hub: self.hub,
2501            _request: request,
2502            _name: name.to_string(),
2503            _delegate: Default::default(),
2504            _additional_params: Default::default(),
2505            _scopes: Default::default(),
2506        }
2507    }
2508
2509    /// Create a builder to help you perform the following task:
2510    ///
2511    /// Deletes the specified DeviceUser. This also revokes the user's access to device data.
2512    ///
2513    /// # Arguments
2514    ///
2515    /// * `name` - Required. [Resource name](https://cloud.google.com/apis/design/resource_names) of the Device in format: `devices/{device}/deviceUsers/{device_user}`, where device is the unique ID assigned to the Device, and device_user is the unique ID assigned to the User.
2516    pub fn device_users_delete(&self, name: &str) -> DeviceDeviceUserDeleteCall<'a, C> {
2517        DeviceDeviceUserDeleteCall {
2518            hub: self.hub,
2519            _name: name.to_string(),
2520            _customer: Default::default(),
2521            _delegate: Default::default(),
2522            _additional_params: Default::default(),
2523            _scopes: Default::default(),
2524        }
2525    }
2526
2527    /// Create a builder to help you perform the following task:
2528    ///
2529    /// Retrieves the specified DeviceUser
2530    ///
2531    /// # Arguments
2532    ///
2533    /// * `name` - Required. [Resource name](https://cloud.google.com/apis/design/resource_names) of the Device in format: `devices/{device}/deviceUsers/{device_user}`, where device is the unique ID assigned to the Device, and device_user is the unique ID assigned to the User.
2534    pub fn device_users_get(&self, name: &str) -> DeviceDeviceUserGetCall<'a, C> {
2535        DeviceDeviceUserGetCall {
2536            hub: self.hub,
2537            _name: name.to_string(),
2538            _customer: Default::default(),
2539            _delegate: Default::default(),
2540            _additional_params: Default::default(),
2541            _scopes: Default::default(),
2542        }
2543    }
2544
2545    /// Create a builder to help you perform the following task:
2546    ///
2547    /// Lists/Searches DeviceUsers.
2548    ///
2549    /// # Arguments
2550    ///
2551    /// * `parent` - Required. To list all DeviceUsers, set this to "devices/-". To list all DeviceUsers owned by a device, set this to the resource name of the device. Format: devices/{device}
2552    pub fn device_users_list(&self, parent: &str) -> DeviceDeviceUserListCall<'a, C> {
2553        DeviceDeviceUserListCall {
2554            hub: self.hub,
2555            _parent: parent.to_string(),
2556            _page_token: Default::default(),
2557            _page_size: Default::default(),
2558            _order_by: Default::default(),
2559            _filter: Default::default(),
2560            _customer: Default::default(),
2561            _delegate: Default::default(),
2562            _additional_params: Default::default(),
2563            _scopes: Default::default(),
2564        }
2565    }
2566
2567    /// Create a builder to help you perform the following task:
2568    ///
2569    /// Looks up resource names of the DeviceUsers associated with the caller's credentials, as well as the properties provided in the request. This method must be called with end-user credentials with the scope: https://www.googleapis.com/auth/cloud-identity.devices.lookup If multiple properties are provided, only DeviceUsers having all of these properties are considered as matches - i.e. the query behaves like an AND. Different platforms require different amounts of information from the caller to ensure that the DeviceUser is uniquely identified. - iOS: Specifying the 'partner' and 'ios_device_id' fields is required. - Android: Specifying the 'android_id' field is required. - Desktop: Specifying the 'raw_resource_id' field is required.
2570    ///
2571    /// # Arguments
2572    ///
2573    /// * `parent` - Must be set to "devices/-/deviceUsers" to search across all DeviceUser belonging to the user.
2574    pub fn device_users_lookup(&self, parent: &str) -> DeviceDeviceUserLookupCall<'a, C> {
2575        DeviceDeviceUserLookupCall {
2576            hub: self.hub,
2577            _parent: parent.to_string(),
2578            _user_id: Default::default(),
2579            _raw_resource_id: Default::default(),
2580            _partner: Default::default(),
2581            _page_token: Default::default(),
2582            _page_size: Default::default(),
2583            _ios_device_id: Default::default(),
2584            _android_id: Default::default(),
2585            _delegate: Default::default(),
2586            _additional_params: Default::default(),
2587            _scopes: Default::default(),
2588        }
2589    }
2590
2591    /// Create a builder to help you perform the following task:
2592    ///
2593    /// Wipes the user's account on a device. Other data on the device that is not associated with the user's work account is not affected. For example, if a Gmail app is installed on a device that is used for personal and work purposes, and the user is logged in to the Gmail app with their personal account as well as their work account, wiping the "deviceUser" by their work administrator will not affect their personal account within Gmail or other apps such as Photos.
2594    ///
2595    /// # Arguments
2596    ///
2597    /// * `request` - No description provided.
2598    /// * `name` - Required. [Resource name](https://cloud.google.com/apis/design/resource_names) of the Device in format: `devices/{device}/deviceUsers/{device_user}`, where device is the unique ID assigned to the Device, and device_user is the unique ID assigned to the User.
2599    pub fn device_users_wipe(
2600        &self,
2601        request: GoogleAppsCloudidentityDevicesV1WipeDeviceUserRequest,
2602        name: &str,
2603    ) -> DeviceDeviceUserWipeCall<'a, C> {
2604        DeviceDeviceUserWipeCall {
2605            hub: self.hub,
2606            _request: request,
2607            _name: name.to_string(),
2608            _delegate: Default::default(),
2609            _additional_params: Default::default(),
2610            _scopes: Default::default(),
2611        }
2612    }
2613
2614    /// Create a builder to help you perform the following task:
2615    ///
2616    /// Cancels an unfinished device wipe. This operation can be used to cancel device wipe in the gap between the wipe operation returning success and the device being wiped. This operation is possible when the device is in a "pending wipe" state. The device enters the "pending wipe" state when a wipe device command is issued, but has not yet been sent to the device. The cancel wipe will fail if the wipe command has already been issued to the device.
2617    ///
2618    /// # Arguments
2619    ///
2620    /// * `request` - No description provided.
2621    /// * `name` - Required. [Resource name](https://cloud.google.com/apis/design/resource_names) of the Device in format: `devices/{device}`, where device is the unique ID assigned to the Device.
2622    pub fn cancel_wipe(
2623        &self,
2624        request: GoogleAppsCloudidentityDevicesV1CancelWipeDeviceRequest,
2625        name: &str,
2626    ) -> DeviceCancelWipeCall<'a, C> {
2627        DeviceCancelWipeCall {
2628            hub: self.hub,
2629            _request: request,
2630            _name: name.to_string(),
2631            _delegate: Default::default(),
2632            _additional_params: Default::default(),
2633            _scopes: Default::default(),
2634        }
2635    }
2636
2637    /// Create a builder to help you perform the following task:
2638    ///
2639    /// Creates a device. Only company-owned device may be created. **Note**: This method is available only to customers who have one of the following SKUs: Enterprise Standard, Enterprise Plus, Enterprise for Education, and Cloud Identity Premium
2640    ///
2641    /// # Arguments
2642    ///
2643    /// * `request` - No description provided.
2644    pub fn create(
2645        &self,
2646        request: GoogleAppsCloudidentityDevicesV1Device,
2647    ) -> DeviceCreateCall<'a, C> {
2648        DeviceCreateCall {
2649            hub: self.hub,
2650            _request: request,
2651            _customer: Default::default(),
2652            _delegate: Default::default(),
2653            _additional_params: Default::default(),
2654            _scopes: Default::default(),
2655        }
2656    }
2657
2658    /// Create a builder to help you perform the following task:
2659    ///
2660    /// Deletes the specified device.
2661    ///
2662    /// # Arguments
2663    ///
2664    /// * `name` - Required. [Resource name](https://cloud.google.com/apis/design/resource_names) of the Device in format: `devices/{device}`, where device is the unique ID assigned to the Device.
2665    pub fn delete(&self, name: &str) -> DeviceDeleteCall<'a, C> {
2666        DeviceDeleteCall {
2667            hub: self.hub,
2668            _name: name.to_string(),
2669            _customer: Default::default(),
2670            _delegate: Default::default(),
2671            _additional_params: Default::default(),
2672            _scopes: Default::default(),
2673        }
2674    }
2675
2676    /// Create a builder to help you perform the following task:
2677    ///
2678    /// Retrieves the specified device.
2679    ///
2680    /// # Arguments
2681    ///
2682    /// * `name` - Required. [Resource name](https://cloud.google.com/apis/design/resource_names) of the Device in the format: `devices/{device}`, where device is the unique ID assigned to the Device.
2683    pub fn get(&self, name: &str) -> DeviceGetCall<'a, C> {
2684        DeviceGetCall {
2685            hub: self.hub,
2686            _name: name.to_string(),
2687            _customer: Default::default(),
2688            _delegate: Default::default(),
2689            _additional_params: Default::default(),
2690            _scopes: Default::default(),
2691        }
2692    }
2693
2694    /// Create a builder to help you perform the following task:
2695    ///
2696    /// Lists/Searches devices.
2697    pub fn list(&self) -> DeviceListCall<'a, C> {
2698        DeviceListCall {
2699            hub: self.hub,
2700            _view: Default::default(),
2701            _page_token: Default::default(),
2702            _page_size: Default::default(),
2703            _order_by: Default::default(),
2704            _filter: Default::default(),
2705            _customer: Default::default(),
2706            _delegate: Default::default(),
2707            _additional_params: Default::default(),
2708            _scopes: Default::default(),
2709        }
2710    }
2711
2712    /// Create a builder to help you perform the following task:
2713    ///
2714    /// Wipes all data on the specified device.
2715    ///
2716    /// # Arguments
2717    ///
2718    /// * `request` - No description provided.
2719    /// * `name` - Required. [Resource name](https://cloud.google.com/apis/design/resource_names) of the Device in format: `devices/{device}/deviceUsers/{device_user}`, where device is the unique ID assigned to the Device, and device_user is the unique ID assigned to the User.
2720    pub fn wipe(
2721        &self,
2722        request: GoogleAppsCloudidentityDevicesV1WipeDeviceRequest,
2723        name: &str,
2724    ) -> DeviceWipeCall<'a, C> {
2725        DeviceWipeCall {
2726            hub: self.hub,
2727            _request: request,
2728            _name: name.to_string(),
2729            _delegate: Default::default(),
2730            _additional_params: Default::default(),
2731            _scopes: Default::default(),
2732        }
2733    }
2734}
2735
2736/// A builder providing access to all methods supported on *group* resources.
2737/// It is not used directly, but through the [`CloudIdentity`] hub.
2738///
2739/// # Example
2740///
2741/// Instantiate a resource builder
2742///
2743/// ```test_harness,no_run
2744/// extern crate hyper;
2745/// extern crate hyper_rustls;
2746/// extern crate google_cloudidentity1 as cloudidentity1;
2747///
2748/// # async fn dox() {
2749/// use cloudidentity1::{CloudIdentity, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2750///
2751/// let secret: yup_oauth2::ApplicationSecret = Default::default();
2752/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
2753///     .with_native_roots()
2754///     .unwrap()
2755///     .https_only()
2756///     .enable_http2()
2757///     .build();
2758///
2759/// let executor = hyper_util::rt::TokioExecutor::new();
2760/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
2761///     secret,
2762///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2763///     yup_oauth2::client::CustomHyperClientBuilder::from(
2764///         hyper_util::client::legacy::Client::builder(executor).build(connector),
2765///     ),
2766/// ).build().await.unwrap();
2767///
2768/// let client = hyper_util::client::legacy::Client::builder(
2769///     hyper_util::rt::TokioExecutor::new()
2770/// )
2771/// .build(
2772///     hyper_rustls::HttpsConnectorBuilder::new()
2773///         .with_native_roots()
2774///         .unwrap()
2775///         .https_or_http()
2776///         .enable_http2()
2777///         .build()
2778/// );
2779/// let mut hub = CloudIdentity::new(client, auth);
2780/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
2781/// // like `create(...)`, `delete(...)`, `get(...)`, `get_security_settings(...)`, `list(...)`, `lookup(...)`, `memberships_check_transitive_membership(...)`, `memberships_create(...)`, `memberships_delete(...)`, `memberships_get(...)`, `memberships_get_membership_graph(...)`, `memberships_list(...)`, `memberships_lookup(...)`, `memberships_modify_membership_roles(...)`, `memberships_search_direct_groups(...)`, `memberships_search_transitive_groups(...)`, `memberships_search_transitive_memberships(...)`, `patch(...)`, `search(...)` and `update_security_settings(...)`
2782/// // to build up your call.
2783/// let rb = hub.groups();
2784/// # }
2785/// ```
2786pub struct GroupMethods<'a, C>
2787where
2788    C: 'a,
2789{
2790    hub: &'a CloudIdentity<C>,
2791}
2792
2793impl<'a, C> common::MethodsBuilder for GroupMethods<'a, C> {}
2794
2795impl<'a, C> GroupMethods<'a, C> {
2796    /// Create a builder to help you perform the following task:
2797    ///
2798    /// Check a potential member for membership in a group. **Note:** This feature is only available to Google Workspace Enterprise Standard, Enterprise Plus, and Enterprise for Education; and Cloud Identity Premium accounts. If the account of the member is not one of these, a 403 (PERMISSION_DENIED) HTTP status code will be returned. A member has membership to a group as long as there is a single viewable transitive membership between the group and the member. The actor must have view permissions to at least one transitive membership between the member and group.
2799    ///
2800    /// # Arguments
2801    ///
2802    /// * `parent` - [Resource name](https://cloud.google.com/apis/design/resource_names) of the group to check the transitive membership in. Format: `groups/{group}`, where `group` is the unique id assigned to the Group to which the Membership belongs to.
2803    pub fn memberships_check_transitive_membership(
2804        &self,
2805        parent: &str,
2806    ) -> GroupMembershipCheckTransitiveMembershipCall<'a, C> {
2807        GroupMembershipCheckTransitiveMembershipCall {
2808            hub: self.hub,
2809            _parent: parent.to_string(),
2810            _query: Default::default(),
2811            _delegate: Default::default(),
2812            _additional_params: Default::default(),
2813            _scopes: Default::default(),
2814        }
2815    }
2816
2817    /// Create a builder to help you perform the following task:
2818    ///
2819    /// Creates a `Membership`.
2820    ///
2821    /// # Arguments
2822    ///
2823    /// * `request` - No description provided.
2824    /// * `parent` - Required. The parent `Group` resource under which to create the `Membership`. Must be of the form `groups/{group}`.
2825    pub fn memberships_create(
2826        &self,
2827        request: Membership,
2828        parent: &str,
2829    ) -> GroupMembershipCreateCall<'a, C> {
2830        GroupMembershipCreateCall {
2831            hub: self.hub,
2832            _request: request,
2833            _parent: parent.to_string(),
2834            _delegate: Default::default(),
2835            _additional_params: Default::default(),
2836            _scopes: Default::default(),
2837        }
2838    }
2839
2840    /// Create a builder to help you perform the following task:
2841    ///
2842    /// Deletes a `Membership`.
2843    ///
2844    /// # Arguments
2845    ///
2846    /// * `name` - Required. The [resource name](https://cloud.google.com/apis/design/resource_names) of the `Membership` to delete. Must be of the form `groups/{group}/memberships/{membership}`
2847    pub fn memberships_delete(&self, name: &str) -> GroupMembershipDeleteCall<'a, C> {
2848        GroupMembershipDeleteCall {
2849            hub: self.hub,
2850            _name: name.to_string(),
2851            _delegate: Default::default(),
2852            _additional_params: Default::default(),
2853            _scopes: Default::default(),
2854        }
2855    }
2856
2857    /// Create a builder to help you perform the following task:
2858    ///
2859    /// Retrieves a `Membership`.
2860    ///
2861    /// # Arguments
2862    ///
2863    /// * `name` - Required. The [resource name](https://cloud.google.com/apis/design/resource_names) of the `Membership` to retrieve. Must be of the form `groups/{group}/memberships/{membership}`.
2864    pub fn memberships_get(&self, name: &str) -> GroupMembershipGetCall<'a, C> {
2865        GroupMembershipGetCall {
2866            hub: self.hub,
2867            _name: name.to_string(),
2868            _delegate: Default::default(),
2869            _additional_params: Default::default(),
2870            _scopes: Default::default(),
2871        }
2872    }
2873
2874    /// Create a builder to help you perform the following task:
2875    ///
2876    /// Get a membership graph of just a member or both a member and a group. **Note:** This feature is only available to Google Workspace Enterprise Standard, Enterprise Plus, and Enterprise for Education; and Cloud Identity Premium accounts. If the account of the member is not one of these, a 403 (PERMISSION_DENIED) HTTP status code will be returned. Given a member, the response will contain all membership paths from the member. Given both a group and a member, the response will contain all membership paths between the group and the member.
2877    ///
2878    /// # Arguments
2879    ///
2880    /// * `parent` - Required. [Resource name](https://cloud.google.com/apis/design/resource_names) of the group to search transitive memberships in. Format: `groups/{group}`, where `group` is the unique ID assigned to the Group to which the Membership belongs to. group can be a wildcard collection id "-". When a group is specified, the membership graph will be constrained to paths between the member (defined in the query) and the parent. If a wildcard collection is provided, all membership paths connected to the member will be returned.
2881    pub fn memberships_get_membership_graph(
2882        &self,
2883        parent: &str,
2884    ) -> GroupMembershipGetMembershipGraphCall<'a, C> {
2885        GroupMembershipGetMembershipGraphCall {
2886            hub: self.hub,
2887            _parent: parent.to_string(),
2888            _query: Default::default(),
2889            _delegate: Default::default(),
2890            _additional_params: Default::default(),
2891            _scopes: Default::default(),
2892        }
2893    }
2894
2895    /// Create a builder to help you perform the following task:
2896    ///
2897    /// Lists the `Membership`s within a `Group`.
2898    ///
2899    /// # Arguments
2900    ///
2901    /// * `parent` - Required. The parent `Group` resource under which to lookup the `Membership` name. Must be of the form `groups/{group}`.
2902    pub fn memberships_list(&self, parent: &str) -> GroupMembershipListCall<'a, C> {
2903        GroupMembershipListCall {
2904            hub: self.hub,
2905            _parent: parent.to_string(),
2906            _view: Default::default(),
2907            _page_token: Default::default(),
2908            _page_size: Default::default(),
2909            _delegate: Default::default(),
2910            _additional_params: Default::default(),
2911            _scopes: Default::default(),
2912        }
2913    }
2914
2915    /// Create a builder to help you perform the following task:
2916    ///
2917    /// Looks up the [resource name](https://cloud.google.com/apis/design/resource_names) of a `Membership` by its `EntityKey`.
2918    ///
2919    /// # Arguments
2920    ///
2921    /// * `parent` - Required. The parent `Group` resource under which to lookup the `Membership` name. Must be of the form `groups/{group}`.
2922    pub fn memberships_lookup(&self, parent: &str) -> GroupMembershipLookupCall<'a, C> {
2923        GroupMembershipLookupCall {
2924            hub: self.hub,
2925            _parent: parent.to_string(),
2926            _member_key_namespace: Default::default(),
2927            _member_key_id: Default::default(),
2928            _delegate: Default::default(),
2929            _additional_params: Default::default(),
2930            _scopes: Default::default(),
2931        }
2932    }
2933
2934    /// Create a builder to help you perform the following task:
2935    ///
2936    /// Modifies the `MembershipRole`s of a `Membership`.
2937    ///
2938    /// # Arguments
2939    ///
2940    /// * `request` - No description provided.
2941    /// * `name` - Required. The [resource name](https://cloud.google.com/apis/design/resource_names) of the `Membership` whose roles are to be modified. Must be of the form `groups/{group}/memberships/{membership}`.
2942    pub fn memberships_modify_membership_roles(
2943        &self,
2944        request: ModifyMembershipRolesRequest,
2945        name: &str,
2946    ) -> GroupMembershipModifyMembershipRoleCall<'a, C> {
2947        GroupMembershipModifyMembershipRoleCall {
2948            hub: self.hub,
2949            _request: request,
2950            _name: name.to_string(),
2951            _delegate: Default::default(),
2952            _additional_params: Default::default(),
2953            _scopes: Default::default(),
2954        }
2955    }
2956
2957    /// Create a builder to help you perform the following task:
2958    ///
2959    /// Searches direct groups of a member.
2960    ///
2961    /// # Arguments
2962    ///
2963    /// * `parent` - [Resource name](https://cloud.google.com/apis/design/resource_names) of the group to search transitive memberships in. Format: groups/{group_id}, where group_id is always '-' as this API will search across all groups for a given member.
2964    pub fn memberships_search_direct_groups(
2965        &self,
2966        parent: &str,
2967    ) -> GroupMembershipSearchDirectGroupCall<'a, C> {
2968        GroupMembershipSearchDirectGroupCall {
2969            hub: self.hub,
2970            _parent: parent.to_string(),
2971            _query: Default::default(),
2972            _page_token: Default::default(),
2973            _page_size: Default::default(),
2974            _order_by: Default::default(),
2975            _delegate: Default::default(),
2976            _additional_params: Default::default(),
2977            _scopes: Default::default(),
2978        }
2979    }
2980
2981    /// Create a builder to help you perform the following task:
2982    ///
2983    /// Search transitive groups of a member. **Note:** This feature is only available to Google Workspace Enterprise Standard, Enterprise Plus, and Enterprise for Education; and Cloud Identity Premium accounts. If the account of the member is not one of these, a 403 (PERMISSION_DENIED) HTTP status code will be returned. A transitive group is any group that has a direct or indirect membership to the member. Actor must have view permissions all transitive groups.
2984    ///
2985    /// # Arguments
2986    ///
2987    /// * `parent` - [Resource name](https://cloud.google.com/apis/design/resource_names) of the group to search transitive memberships in. Format: `groups/{group}`, where `group` is always '-' as this API will search across all groups for a given member.
2988    pub fn memberships_search_transitive_groups(
2989        &self,
2990        parent: &str,
2991    ) -> GroupMembershipSearchTransitiveGroupCall<'a, C> {
2992        GroupMembershipSearchTransitiveGroupCall {
2993            hub: self.hub,
2994            _parent: parent.to_string(),
2995            _query: Default::default(),
2996            _page_token: Default::default(),
2997            _page_size: Default::default(),
2998            _delegate: Default::default(),
2999            _additional_params: Default::default(),
3000            _scopes: Default::default(),
3001        }
3002    }
3003
3004    /// Create a builder to help you perform the following task:
3005    ///
3006    /// Search transitive memberships of a group. **Note:** This feature is only available to Google Workspace Enterprise Standard, Enterprise Plus, and Enterprise for Education; and Cloud Identity Premium accounts. If the account of the group is not one of these, a 403 (PERMISSION_DENIED) HTTP status code will be returned. A transitive membership is any direct or indirect membership of a group. Actor must have view permissions to all transitive memberships.
3007    ///
3008    /// # Arguments
3009    ///
3010    /// * `parent` - [Resource name](https://cloud.google.com/apis/design/resource_names) of the group to search transitive memberships in. Format: `groups/{group}`, where `group` is the unique ID assigned to the Group.
3011    pub fn memberships_search_transitive_memberships(
3012        &self,
3013        parent: &str,
3014    ) -> GroupMembershipSearchTransitiveMembershipCall<'a, C> {
3015        GroupMembershipSearchTransitiveMembershipCall {
3016            hub: self.hub,
3017            _parent: parent.to_string(),
3018            _page_token: Default::default(),
3019            _page_size: Default::default(),
3020            _delegate: Default::default(),
3021            _additional_params: Default::default(),
3022            _scopes: Default::default(),
3023        }
3024    }
3025
3026    /// Create a builder to help you perform the following task:
3027    ///
3028    /// Creates a Group.
3029    ///
3030    /// # Arguments
3031    ///
3032    /// * `request` - No description provided.
3033    pub fn create(&self, request: Group) -> GroupCreateCall<'a, C> {
3034        GroupCreateCall {
3035            hub: self.hub,
3036            _request: request,
3037            _initial_group_config: Default::default(),
3038            _delegate: Default::default(),
3039            _additional_params: Default::default(),
3040            _scopes: Default::default(),
3041        }
3042    }
3043
3044    /// Create a builder to help you perform the following task:
3045    ///
3046    /// Deletes a `Group`.
3047    ///
3048    /// # Arguments
3049    ///
3050    /// * `name` - Required. The [resource name](https://cloud.google.com/apis/design/resource_names) of the `Group` to retrieve. Must be of the form `groups/{group}`.
3051    pub fn delete(&self, name: &str) -> GroupDeleteCall<'a, C> {
3052        GroupDeleteCall {
3053            hub: self.hub,
3054            _name: name.to_string(),
3055            _delegate: Default::default(),
3056            _additional_params: Default::default(),
3057            _scopes: Default::default(),
3058        }
3059    }
3060
3061    /// Create a builder to help you perform the following task:
3062    ///
3063    /// Retrieves a `Group`.
3064    ///
3065    /// # Arguments
3066    ///
3067    /// * `name` - Required. The [resource name](https://cloud.google.com/apis/design/resource_names) of the `Group` to retrieve. Must be of the form `groups/{group}`.
3068    pub fn get(&self, name: &str) -> GroupGetCall<'a, C> {
3069        GroupGetCall {
3070            hub: self.hub,
3071            _name: name.to_string(),
3072            _delegate: Default::default(),
3073            _additional_params: Default::default(),
3074            _scopes: Default::default(),
3075        }
3076    }
3077
3078    /// Create a builder to help you perform the following task:
3079    ///
3080    /// Get Security Settings
3081    ///
3082    /// # Arguments
3083    ///
3084    /// * `name` - Required. The security settings to retrieve. Format: `groups/{group_id}/securitySettings`
3085    pub fn get_security_settings(&self, name: &str) -> GroupGetSecuritySettingCall<'a, C> {
3086        GroupGetSecuritySettingCall {
3087            hub: self.hub,
3088            _name: name.to_string(),
3089            _read_mask: Default::default(),
3090            _delegate: Default::default(),
3091            _additional_params: Default::default(),
3092            _scopes: Default::default(),
3093        }
3094    }
3095
3096    /// Create a builder to help you perform the following task:
3097    ///
3098    /// Lists the `Group` resources under a customer or namespace.
3099    pub fn list(&self) -> GroupListCall<'a, C> {
3100        GroupListCall {
3101            hub: self.hub,
3102            _view: Default::default(),
3103            _parent: Default::default(),
3104            _page_token: Default::default(),
3105            _page_size: Default::default(),
3106            _delegate: Default::default(),
3107            _additional_params: Default::default(),
3108            _scopes: Default::default(),
3109        }
3110    }
3111
3112    /// Create a builder to help you perform the following task:
3113    ///
3114    /// Looks up the [resource name](https://cloud.google.com/apis/design/resource_names) of a `Group` by its `EntityKey`.
3115    pub fn lookup(&self) -> GroupLookupCall<'a, C> {
3116        GroupLookupCall {
3117            hub: self.hub,
3118            _group_key_namespace: Default::default(),
3119            _group_key_id: Default::default(),
3120            _delegate: Default::default(),
3121            _additional_params: Default::default(),
3122            _scopes: Default::default(),
3123        }
3124    }
3125
3126    /// Create a builder to help you perform the following task:
3127    ///
3128    /// Updates a `Group`.
3129    ///
3130    /// # Arguments
3131    ///
3132    /// * `request` - No description provided.
3133    /// * `name` - Output only. The [resource name](https://cloud.google.com/apis/design/resource_names) of the `Group`. Shall be of the form `groups/{group}`.
3134    pub fn patch(&self, request: Group, name: &str) -> GroupPatchCall<'a, C> {
3135        GroupPatchCall {
3136            hub: self.hub,
3137            _request: request,
3138            _name: name.to_string(),
3139            _update_mask: Default::default(),
3140            _delegate: Default::default(),
3141            _additional_params: Default::default(),
3142            _scopes: Default::default(),
3143        }
3144    }
3145
3146    /// Create a builder to help you perform the following task:
3147    ///
3148    /// Searches for `Group` resources matching a specified query.
3149    pub fn search(&self) -> GroupSearchCall<'a, C> {
3150        GroupSearchCall {
3151            hub: self.hub,
3152            _view: Default::default(),
3153            _query: Default::default(),
3154            _page_token: Default::default(),
3155            _page_size: Default::default(),
3156            _delegate: Default::default(),
3157            _additional_params: Default::default(),
3158            _scopes: Default::default(),
3159        }
3160    }
3161
3162    /// Create a builder to help you perform the following task:
3163    ///
3164    /// Update Security Settings
3165    ///
3166    /// # Arguments
3167    ///
3168    /// * `request` - No description provided.
3169    /// * `name` - Output only. The resource name of the security settings. Shall be of the form `groups/{group_id}/securitySettings`.
3170    pub fn update_security_settings(
3171        &self,
3172        request: SecuritySettings,
3173        name: &str,
3174    ) -> GroupUpdateSecuritySettingCall<'a, C> {
3175        GroupUpdateSecuritySettingCall {
3176            hub: self.hub,
3177            _request: request,
3178            _name: name.to_string(),
3179            _update_mask: Default::default(),
3180            _delegate: Default::default(),
3181            _additional_params: Default::default(),
3182            _scopes: Default::default(),
3183        }
3184    }
3185}
3186
3187/// A builder providing access to all methods supported on *inboundOidcSsoProfile* resources.
3188/// It is not used directly, but through the [`CloudIdentity`] hub.
3189///
3190/// # Example
3191///
3192/// Instantiate a resource builder
3193///
3194/// ```test_harness,no_run
3195/// extern crate hyper;
3196/// extern crate hyper_rustls;
3197/// extern crate google_cloudidentity1 as cloudidentity1;
3198///
3199/// # async fn dox() {
3200/// use cloudidentity1::{CloudIdentity, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3201///
3202/// let secret: yup_oauth2::ApplicationSecret = Default::default();
3203/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
3204///     .with_native_roots()
3205///     .unwrap()
3206///     .https_only()
3207///     .enable_http2()
3208///     .build();
3209///
3210/// let executor = hyper_util::rt::TokioExecutor::new();
3211/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
3212///     secret,
3213///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3214///     yup_oauth2::client::CustomHyperClientBuilder::from(
3215///         hyper_util::client::legacy::Client::builder(executor).build(connector),
3216///     ),
3217/// ).build().await.unwrap();
3218///
3219/// let client = hyper_util::client::legacy::Client::builder(
3220///     hyper_util::rt::TokioExecutor::new()
3221/// )
3222/// .build(
3223///     hyper_rustls::HttpsConnectorBuilder::new()
3224///         .with_native_roots()
3225///         .unwrap()
3226///         .https_or_http()
3227///         .enable_http2()
3228///         .build()
3229/// );
3230/// let mut hub = CloudIdentity::new(client, auth);
3231/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
3232/// // like `create(...)`, `delete(...)`, `get(...)`, `list(...)` and `patch(...)`
3233/// // to build up your call.
3234/// let rb = hub.inbound_oidc_sso_profiles();
3235/// # }
3236/// ```
3237pub struct InboundOidcSsoProfileMethods<'a, C>
3238where
3239    C: 'a,
3240{
3241    hub: &'a CloudIdentity<C>,
3242}
3243
3244impl<'a, C> common::MethodsBuilder for InboundOidcSsoProfileMethods<'a, C> {}
3245
3246impl<'a, C> InboundOidcSsoProfileMethods<'a, C> {
3247    /// Create a builder to help you perform the following task:
3248    ///
3249    /// Creates an InboundOidcSsoProfile for a customer. When the target customer has enabled [Multi-party approval for sensitive actions](https://support.google.com/a/answer/13790448), the `Operation` in the response will have `"done": false`, it will not have a response, and the metadata will have `"state": "awaiting-multi-party-approval"`.
3250    ///
3251    /// # Arguments
3252    ///
3253    /// * `request` - No description provided.
3254    pub fn create(&self, request: InboundOidcSsoProfile) -> InboundOidcSsoProfileCreateCall<'a, C> {
3255        InboundOidcSsoProfileCreateCall {
3256            hub: self.hub,
3257            _request: request,
3258            _delegate: Default::default(),
3259            _additional_params: Default::default(),
3260            _scopes: Default::default(),
3261        }
3262    }
3263
3264    /// Create a builder to help you perform the following task:
3265    ///
3266    /// Deletes an InboundOidcSsoProfile.
3267    ///
3268    /// # Arguments
3269    ///
3270    /// * `name` - Required. The [resource name](https://cloud.google.com/apis/design/resource_names) of the InboundOidcSsoProfile to delete. Format: `inboundOidcSsoProfiles/{sso_profile_id}`
3271    pub fn delete(&self, name: &str) -> InboundOidcSsoProfileDeleteCall<'a, C> {
3272        InboundOidcSsoProfileDeleteCall {
3273            hub: self.hub,
3274            _name: name.to_string(),
3275            _delegate: Default::default(),
3276            _additional_params: Default::default(),
3277            _scopes: Default::default(),
3278        }
3279    }
3280
3281    /// Create a builder to help you perform the following task:
3282    ///
3283    /// Gets an InboundOidcSsoProfile.
3284    ///
3285    /// # Arguments
3286    ///
3287    /// * `name` - Required. The [resource name](https://cloud.google.com/apis/design/resource_names) of the InboundOidcSsoProfile to get. Format: `inboundOidcSsoProfiles/{sso_profile_id}`
3288    pub fn get(&self, name: &str) -> InboundOidcSsoProfileGetCall<'a, C> {
3289        InboundOidcSsoProfileGetCall {
3290            hub: self.hub,
3291            _name: name.to_string(),
3292            _delegate: Default::default(),
3293            _additional_params: Default::default(),
3294            _scopes: Default::default(),
3295        }
3296    }
3297
3298    /// Create a builder to help you perform the following task:
3299    ///
3300    /// Lists InboundOidcSsoProfile objects for a Google enterprise customer.
3301    pub fn list(&self) -> InboundOidcSsoProfileListCall<'a, C> {
3302        InboundOidcSsoProfileListCall {
3303            hub: self.hub,
3304            _page_token: Default::default(),
3305            _page_size: Default::default(),
3306            _filter: Default::default(),
3307            _delegate: Default::default(),
3308            _additional_params: Default::default(),
3309            _scopes: Default::default(),
3310        }
3311    }
3312
3313    /// Create a builder to help you perform the following task:
3314    ///
3315    /// Updates an InboundOidcSsoProfile. When the target customer has enabled [Multi-party approval for sensitive actions](https://support.google.com/a/answer/13790448), the `Operation` in the response will have `"done": false`, it will not have a response, and the metadata will have `"state": "awaiting-multi-party-approval"`.
3316    ///
3317    /// # Arguments
3318    ///
3319    /// * `request` - No description provided.
3320    /// * `name` - Output only. [Resource name](https://cloud.google.com/apis/design/resource_names) of the OIDC SSO profile.
3321    pub fn patch(
3322        &self,
3323        request: InboundOidcSsoProfile,
3324        name: &str,
3325    ) -> InboundOidcSsoProfilePatchCall<'a, C> {
3326        InboundOidcSsoProfilePatchCall {
3327            hub: self.hub,
3328            _request: request,
3329            _name: name.to_string(),
3330            _update_mask: Default::default(),
3331            _delegate: Default::default(),
3332            _additional_params: Default::default(),
3333            _scopes: Default::default(),
3334        }
3335    }
3336}
3337
3338/// A builder providing access to all methods supported on *inboundSamlSsoProfile* resources.
3339/// It is not used directly, but through the [`CloudIdentity`] hub.
3340///
3341/// # Example
3342///
3343/// Instantiate a resource builder
3344///
3345/// ```test_harness,no_run
3346/// extern crate hyper;
3347/// extern crate hyper_rustls;
3348/// extern crate google_cloudidentity1 as cloudidentity1;
3349///
3350/// # async fn dox() {
3351/// use cloudidentity1::{CloudIdentity, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3352///
3353/// let secret: yup_oauth2::ApplicationSecret = Default::default();
3354/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
3355///     .with_native_roots()
3356///     .unwrap()
3357///     .https_only()
3358///     .enable_http2()
3359///     .build();
3360///
3361/// let executor = hyper_util::rt::TokioExecutor::new();
3362/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
3363///     secret,
3364///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3365///     yup_oauth2::client::CustomHyperClientBuilder::from(
3366///         hyper_util::client::legacy::Client::builder(executor).build(connector),
3367///     ),
3368/// ).build().await.unwrap();
3369///
3370/// let client = hyper_util::client::legacy::Client::builder(
3371///     hyper_util::rt::TokioExecutor::new()
3372/// )
3373/// .build(
3374///     hyper_rustls::HttpsConnectorBuilder::new()
3375///         .with_native_roots()
3376///         .unwrap()
3377///         .https_or_http()
3378///         .enable_http2()
3379///         .build()
3380/// );
3381/// let mut hub = CloudIdentity::new(client, auth);
3382/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
3383/// // like `create(...)`, `delete(...)`, `get(...)`, `idp_credentials_add(...)`, `idp_credentials_delete(...)`, `idp_credentials_get(...)`, `idp_credentials_list(...)`, `list(...)` and `patch(...)`
3384/// // to build up your call.
3385/// let rb = hub.inbound_saml_sso_profiles();
3386/// # }
3387/// ```
3388pub struct InboundSamlSsoProfileMethods<'a, C>
3389where
3390    C: 'a,
3391{
3392    hub: &'a CloudIdentity<C>,
3393}
3394
3395impl<'a, C> common::MethodsBuilder for InboundSamlSsoProfileMethods<'a, C> {}
3396
3397impl<'a, C> InboundSamlSsoProfileMethods<'a, C> {
3398    /// Create a builder to help you perform the following task:
3399    ///
3400    /// Adds an IdpCredential. Up to 2 credentials are allowed. When the target customer has enabled [Multi-party approval for sensitive actions](https://support.google.com/a/answer/13790448), the `Operation` in the response will have `"done": false`, it will not have a response, and the metadata will have `"state": "awaiting-multi-party-approval"`.
3401    ///
3402    /// # Arguments
3403    ///
3404    /// * `request` - No description provided.
3405    /// * `parent` - Required. The InboundSamlSsoProfile that owns the IdpCredential. Format: `inboundSamlSsoProfiles/{sso_profile_id}`
3406    pub fn idp_credentials_add(
3407        &self,
3408        request: AddIdpCredentialRequest,
3409        parent: &str,
3410    ) -> InboundSamlSsoProfileIdpCredentialAddCall<'a, C> {
3411        InboundSamlSsoProfileIdpCredentialAddCall {
3412            hub: self.hub,
3413            _request: request,
3414            _parent: parent.to_string(),
3415            _delegate: Default::default(),
3416            _additional_params: Default::default(),
3417            _scopes: Default::default(),
3418        }
3419    }
3420
3421    /// Create a builder to help you perform the following task:
3422    ///
3423    /// Deletes an IdpCredential.
3424    ///
3425    /// # Arguments
3426    ///
3427    /// * `name` - Required. The [resource name](https://cloud.google.com/apis/design/resource_names) of the IdpCredential to delete. Format: `inboundSamlSsoProfiles/{sso_profile_id}/idpCredentials/{idp_credential_id}`
3428    pub fn idp_credentials_delete(
3429        &self,
3430        name: &str,
3431    ) -> InboundSamlSsoProfileIdpCredentialDeleteCall<'a, C> {
3432        InboundSamlSsoProfileIdpCredentialDeleteCall {
3433            hub: self.hub,
3434            _name: name.to_string(),
3435            _delegate: Default::default(),
3436            _additional_params: Default::default(),
3437            _scopes: Default::default(),
3438        }
3439    }
3440
3441    /// Create a builder to help you perform the following task:
3442    ///
3443    /// Gets an IdpCredential.
3444    ///
3445    /// # Arguments
3446    ///
3447    /// * `name` - Required. The [resource name](https://cloud.google.com/apis/design/resource_names) of the IdpCredential to retrieve. Format: `inboundSamlSsoProfiles/{sso_profile_id}/idpCredentials/{idp_credential_id}`
3448    pub fn idp_credentials_get(
3449        &self,
3450        name: &str,
3451    ) -> InboundSamlSsoProfileIdpCredentialGetCall<'a, C> {
3452        InboundSamlSsoProfileIdpCredentialGetCall {
3453            hub: self.hub,
3454            _name: name.to_string(),
3455            _delegate: Default::default(),
3456            _additional_params: Default::default(),
3457            _scopes: Default::default(),
3458        }
3459    }
3460
3461    /// Create a builder to help you perform the following task:
3462    ///
3463    /// Returns a list of IdpCredentials in an InboundSamlSsoProfile.
3464    ///
3465    /// # Arguments
3466    ///
3467    /// * `parent` - Required. The parent, which owns this collection of `IdpCredential`s. Format: `inboundSamlSsoProfiles/{sso_profile_id}`
3468    pub fn idp_credentials_list(
3469        &self,
3470        parent: &str,
3471    ) -> InboundSamlSsoProfileIdpCredentialListCall<'a, C> {
3472        InboundSamlSsoProfileIdpCredentialListCall {
3473            hub: self.hub,
3474            _parent: parent.to_string(),
3475            _page_token: Default::default(),
3476            _page_size: Default::default(),
3477            _delegate: Default::default(),
3478            _additional_params: Default::default(),
3479            _scopes: Default::default(),
3480        }
3481    }
3482
3483    /// Create a builder to help you perform the following task:
3484    ///
3485    /// Creates an InboundSamlSsoProfile for a customer. When the target customer has enabled [Multi-party approval for sensitive actions](https://support.google.com/a/answer/13790448), the `Operation` in the response will have `"done": false`, it will not have a response, and the metadata will have `"state": "awaiting-multi-party-approval"`.
3486    ///
3487    /// # Arguments
3488    ///
3489    /// * `request` - No description provided.
3490    pub fn create(&self, request: InboundSamlSsoProfile) -> InboundSamlSsoProfileCreateCall<'a, C> {
3491        InboundSamlSsoProfileCreateCall {
3492            hub: self.hub,
3493            _request: request,
3494            _delegate: Default::default(),
3495            _additional_params: Default::default(),
3496            _scopes: Default::default(),
3497        }
3498    }
3499
3500    /// Create a builder to help you perform the following task:
3501    ///
3502    /// Deletes an InboundSamlSsoProfile.
3503    ///
3504    /// # Arguments
3505    ///
3506    /// * `name` - Required. The [resource name](https://cloud.google.com/apis/design/resource_names) of the InboundSamlSsoProfile to delete. Format: `inboundSamlSsoProfiles/{sso_profile_id}`
3507    pub fn delete(&self, name: &str) -> InboundSamlSsoProfileDeleteCall<'a, C> {
3508        InboundSamlSsoProfileDeleteCall {
3509            hub: self.hub,
3510            _name: name.to_string(),
3511            _delegate: Default::default(),
3512            _additional_params: Default::default(),
3513            _scopes: Default::default(),
3514        }
3515    }
3516
3517    /// Create a builder to help you perform the following task:
3518    ///
3519    /// Gets an InboundSamlSsoProfile.
3520    ///
3521    /// # Arguments
3522    ///
3523    /// * `name` - Required. The [resource name](https://cloud.google.com/apis/design/resource_names) of the InboundSamlSsoProfile to get. Format: `inboundSamlSsoProfiles/{sso_profile_id}`
3524    pub fn get(&self, name: &str) -> InboundSamlSsoProfileGetCall<'a, C> {
3525        InboundSamlSsoProfileGetCall {
3526            hub: self.hub,
3527            _name: name.to_string(),
3528            _delegate: Default::default(),
3529            _additional_params: Default::default(),
3530            _scopes: Default::default(),
3531        }
3532    }
3533
3534    /// Create a builder to help you perform the following task:
3535    ///
3536    /// Lists InboundSamlSsoProfiles for a customer.
3537    pub fn list(&self) -> InboundSamlSsoProfileListCall<'a, C> {
3538        InboundSamlSsoProfileListCall {
3539            hub: self.hub,
3540            _page_token: Default::default(),
3541            _page_size: Default::default(),
3542            _filter: Default::default(),
3543            _delegate: Default::default(),
3544            _additional_params: Default::default(),
3545            _scopes: Default::default(),
3546        }
3547    }
3548
3549    /// Create a builder to help you perform the following task:
3550    ///
3551    /// Updates an InboundSamlSsoProfile. When the target customer has enabled [Multi-party approval for sensitive actions](https://support.google.com/a/answer/13790448), the `Operation` in the response will have `"done": false`, it will not have a response, and the metadata will have `"state": "awaiting-multi-party-approval"`.
3552    ///
3553    /// # Arguments
3554    ///
3555    /// * `request` - No description provided.
3556    /// * `name` - Output only. [Resource name](https://cloud.google.com/apis/design/resource_names) of the SAML SSO profile.
3557    pub fn patch(
3558        &self,
3559        request: InboundSamlSsoProfile,
3560        name: &str,
3561    ) -> InboundSamlSsoProfilePatchCall<'a, C> {
3562        InboundSamlSsoProfilePatchCall {
3563            hub: self.hub,
3564            _request: request,
3565            _name: name.to_string(),
3566            _update_mask: Default::default(),
3567            _delegate: Default::default(),
3568            _additional_params: Default::default(),
3569            _scopes: Default::default(),
3570        }
3571    }
3572}
3573
3574/// A builder providing access to all methods supported on *inboundSsoAssignment* resources.
3575/// It is not used directly, but through the [`CloudIdentity`] hub.
3576///
3577/// # Example
3578///
3579/// Instantiate a resource builder
3580///
3581/// ```test_harness,no_run
3582/// extern crate hyper;
3583/// extern crate hyper_rustls;
3584/// extern crate google_cloudidentity1 as cloudidentity1;
3585///
3586/// # async fn dox() {
3587/// use cloudidentity1::{CloudIdentity, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3588///
3589/// let secret: yup_oauth2::ApplicationSecret = Default::default();
3590/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
3591///     .with_native_roots()
3592///     .unwrap()
3593///     .https_only()
3594///     .enable_http2()
3595///     .build();
3596///
3597/// let executor = hyper_util::rt::TokioExecutor::new();
3598/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
3599///     secret,
3600///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3601///     yup_oauth2::client::CustomHyperClientBuilder::from(
3602///         hyper_util::client::legacy::Client::builder(executor).build(connector),
3603///     ),
3604/// ).build().await.unwrap();
3605///
3606/// let client = hyper_util::client::legacy::Client::builder(
3607///     hyper_util::rt::TokioExecutor::new()
3608/// )
3609/// .build(
3610///     hyper_rustls::HttpsConnectorBuilder::new()
3611///         .with_native_roots()
3612///         .unwrap()
3613///         .https_or_http()
3614///         .enable_http2()
3615///         .build()
3616/// );
3617/// let mut hub = CloudIdentity::new(client, auth);
3618/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
3619/// // like `create(...)`, `delete(...)`, `get(...)`, `list(...)` and `patch(...)`
3620/// // to build up your call.
3621/// let rb = hub.inbound_sso_assignments();
3622/// # }
3623/// ```
3624pub struct InboundSsoAssignmentMethods<'a, C>
3625where
3626    C: 'a,
3627{
3628    hub: &'a CloudIdentity<C>,
3629}
3630
3631impl<'a, C> common::MethodsBuilder for InboundSsoAssignmentMethods<'a, C> {}
3632
3633impl<'a, C> InboundSsoAssignmentMethods<'a, C> {
3634    /// Create a builder to help you perform the following task:
3635    ///
3636    /// Creates an InboundSsoAssignment for users and devices in a `Customer` under a given `Group` or `OrgUnit`.
3637    ///
3638    /// # Arguments
3639    ///
3640    /// * `request` - No description provided.
3641    pub fn create(&self, request: InboundSsoAssignment) -> InboundSsoAssignmentCreateCall<'a, C> {
3642        InboundSsoAssignmentCreateCall {
3643            hub: self.hub,
3644            _request: request,
3645            _delegate: Default::default(),
3646            _additional_params: Default::default(),
3647            _scopes: Default::default(),
3648        }
3649    }
3650
3651    /// Create a builder to help you perform the following task:
3652    ///
3653    /// Deletes an InboundSsoAssignment. To disable SSO, Create (or Update) an assignment that has `sso_mode` == `SSO_OFF`.
3654    ///
3655    /// # Arguments
3656    ///
3657    /// * `name` - Required. The [resource name](https://cloud.google.com/apis/design/resource_names) of the InboundSsoAssignment to delete. Format: `inboundSsoAssignments/{assignment}`
3658    pub fn delete(&self, name: &str) -> InboundSsoAssignmentDeleteCall<'a, C> {
3659        InboundSsoAssignmentDeleteCall {
3660            hub: self.hub,
3661            _name: name.to_string(),
3662            _delegate: Default::default(),
3663            _additional_params: Default::default(),
3664            _scopes: Default::default(),
3665        }
3666    }
3667
3668    /// Create a builder to help you perform the following task:
3669    ///
3670    /// Gets an InboundSsoAssignment.
3671    ///
3672    /// # Arguments
3673    ///
3674    /// * `name` - Required. The [resource name](https://cloud.google.com/apis/design/resource_names) of the InboundSsoAssignment to fetch. Format: `inboundSsoAssignments/{assignment}`
3675    pub fn get(&self, name: &str) -> InboundSsoAssignmentGetCall<'a, C> {
3676        InboundSsoAssignmentGetCall {
3677            hub: self.hub,
3678            _name: name.to_string(),
3679            _delegate: Default::default(),
3680            _additional_params: Default::default(),
3681            _scopes: Default::default(),
3682        }
3683    }
3684
3685    /// Create a builder to help you perform the following task:
3686    ///
3687    /// Lists the InboundSsoAssignments for a `Customer`.
3688    pub fn list(&self) -> InboundSsoAssignmentListCall<'a, C> {
3689        InboundSsoAssignmentListCall {
3690            hub: self.hub,
3691            _page_token: Default::default(),
3692            _page_size: Default::default(),
3693            _filter: Default::default(),
3694            _delegate: Default::default(),
3695            _additional_params: Default::default(),
3696            _scopes: Default::default(),
3697        }
3698    }
3699
3700    /// Create a builder to help you perform the following task:
3701    ///
3702    /// Updates an InboundSsoAssignment. The body of this request is the `inbound_sso_assignment` field and the `update_mask` is relative to that. For example: a PATCH to `/v1/inboundSsoAssignments/0abcdefg1234567&update_mask=rank` with a body of `{ "rank": 1 }` moves that (presumably group-targeted) SSO assignment to the highest priority and shifts any other group-targeted assignments down in priority.
3703    ///
3704    /// # Arguments
3705    ///
3706    /// * `request` - No description provided.
3707    /// * `name` - Output only. [Resource name](https://cloud.google.com/apis/design/resource_names) of the Inbound SSO Assignment.
3708    pub fn patch(
3709        &self,
3710        request: InboundSsoAssignment,
3711        name: &str,
3712    ) -> InboundSsoAssignmentPatchCall<'a, C> {
3713        InboundSsoAssignmentPatchCall {
3714            hub: self.hub,
3715            _request: request,
3716            _name: name.to_string(),
3717            _update_mask: Default::default(),
3718            _delegate: Default::default(),
3719            _additional_params: Default::default(),
3720            _scopes: Default::default(),
3721        }
3722    }
3723}
3724
3725/// A builder providing access to all methods supported on *policy* resources.
3726/// It is not used directly, but through the [`CloudIdentity`] hub.
3727///
3728/// # Example
3729///
3730/// Instantiate a resource builder
3731///
3732/// ```test_harness,no_run
3733/// extern crate hyper;
3734/// extern crate hyper_rustls;
3735/// extern crate google_cloudidentity1 as cloudidentity1;
3736///
3737/// # async fn dox() {
3738/// use cloudidentity1::{CloudIdentity, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3739///
3740/// let secret: yup_oauth2::ApplicationSecret = Default::default();
3741/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
3742///     .with_native_roots()
3743///     .unwrap()
3744///     .https_only()
3745///     .enable_http2()
3746///     .build();
3747///
3748/// let executor = hyper_util::rt::TokioExecutor::new();
3749/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
3750///     secret,
3751///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3752///     yup_oauth2::client::CustomHyperClientBuilder::from(
3753///         hyper_util::client::legacy::Client::builder(executor).build(connector),
3754///     ),
3755/// ).build().await.unwrap();
3756///
3757/// let client = hyper_util::client::legacy::Client::builder(
3758///     hyper_util::rt::TokioExecutor::new()
3759/// )
3760/// .build(
3761///     hyper_rustls::HttpsConnectorBuilder::new()
3762///         .with_native_roots()
3763///         .unwrap()
3764///         .https_or_http()
3765///         .enable_http2()
3766///         .build()
3767/// );
3768/// let mut hub = CloudIdentity::new(client, auth);
3769/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
3770/// // like `get(...)` and `list(...)`
3771/// // to build up your call.
3772/// let rb = hub.policies();
3773/// # }
3774/// ```
3775pub struct PolicyMethods<'a, C>
3776where
3777    C: 'a,
3778{
3779    hub: &'a CloudIdentity<C>,
3780}
3781
3782impl<'a, C> common::MethodsBuilder for PolicyMethods<'a, C> {}
3783
3784impl<'a, C> PolicyMethods<'a, C> {
3785    /// Create a builder to help you perform the following task:
3786    ///
3787    /// Get a policy.
3788    ///
3789    /// # Arguments
3790    ///
3791    /// * `name` - Required. The name of the policy to retrieve. Format: `policies/{policy}`.
3792    pub fn get(&self, name: &str) -> PolicyGetCall<'a, C> {
3793        PolicyGetCall {
3794            hub: self.hub,
3795            _name: name.to_string(),
3796            _delegate: Default::default(),
3797            _additional_params: Default::default(),
3798            _scopes: Default::default(),
3799        }
3800    }
3801
3802    /// Create a builder to help you perform the following task:
3803    ///
3804    /// List policies.
3805    pub fn list(&self) -> PolicyListCall<'a, C> {
3806        PolicyListCall {
3807            hub: self.hub,
3808            _page_token: Default::default(),
3809            _page_size: Default::default(),
3810            _filter: Default::default(),
3811            _delegate: Default::default(),
3812            _additional_params: Default::default(),
3813            _scopes: Default::default(),
3814        }
3815    }
3816}
3817
3818// ###################
3819// CallBuilders   ###
3820// #################
3821
3822/// Cancels a UserInvitation that was already sent.
3823///
3824/// A builder for the *userinvitations.cancel* method supported by a *customer* resource.
3825/// It is not used directly, but through a [`CustomerMethods`] instance.
3826///
3827/// # Example
3828///
3829/// Instantiate a resource method builder
3830///
3831/// ```test_harness,no_run
3832/// # extern crate hyper;
3833/// # extern crate hyper_rustls;
3834/// # extern crate google_cloudidentity1 as cloudidentity1;
3835/// use cloudidentity1::api::CancelUserInvitationRequest;
3836/// # async fn dox() {
3837/// # use cloudidentity1::{CloudIdentity, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3838///
3839/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
3840/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
3841/// #     .with_native_roots()
3842/// #     .unwrap()
3843/// #     .https_only()
3844/// #     .enable_http2()
3845/// #     .build();
3846///
3847/// # let executor = hyper_util::rt::TokioExecutor::new();
3848/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
3849/// #     secret,
3850/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3851/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
3852/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
3853/// #     ),
3854/// # ).build().await.unwrap();
3855///
3856/// # let client = hyper_util::client::legacy::Client::builder(
3857/// #     hyper_util::rt::TokioExecutor::new()
3858/// # )
3859/// # .build(
3860/// #     hyper_rustls::HttpsConnectorBuilder::new()
3861/// #         .with_native_roots()
3862/// #         .unwrap()
3863/// #         .https_or_http()
3864/// #         .enable_http2()
3865/// #         .build()
3866/// # );
3867/// # let mut hub = CloudIdentity::new(client, auth);
3868/// // As the method needs a request, you would usually fill it with the desired information
3869/// // into the respective structure. Some of the parts shown here might not be applicable !
3870/// // Values shown here are possibly random and not representative !
3871/// let mut req = CancelUserInvitationRequest::default();
3872///
3873/// // You can configure optional parameters by calling the respective setters at will, and
3874/// // execute the final call using `doit()`.
3875/// // Values shown here are possibly random and not representative !
3876/// let result = hub.customers().userinvitations_cancel(req, "name")
3877///              .doit().await;
3878/// # }
3879/// ```
3880pub struct CustomerUserinvitationCancelCall<'a, C>
3881where
3882    C: 'a,
3883{
3884    hub: &'a CloudIdentity<C>,
3885    _request: CancelUserInvitationRequest,
3886    _name: String,
3887    _delegate: Option<&'a mut dyn common::Delegate>,
3888    _additional_params: HashMap<String, String>,
3889}
3890
3891impl<'a, C> common::CallBuilder for CustomerUserinvitationCancelCall<'a, C> {}
3892
3893impl<'a, C> CustomerUserinvitationCancelCall<'a, C>
3894where
3895    C: common::Connector,
3896{
3897    /// Perform the operation you have build so far.
3898    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
3899        use std::borrow::Cow;
3900        use std::io::{Read, Seek};
3901
3902        use common::{url::Params, ToParts};
3903        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
3904
3905        let mut dd = common::DefaultDelegate;
3906        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
3907        dlg.begin(common::MethodInfo {
3908            id: "cloudidentity.customers.userinvitations.cancel",
3909            http_method: hyper::Method::POST,
3910        });
3911
3912        for &field in ["alt", "name"].iter() {
3913            if self._additional_params.contains_key(field) {
3914                dlg.finished(false);
3915                return Err(common::Error::FieldClash(field));
3916            }
3917        }
3918
3919        let mut params = Params::with_capacity(4 + self._additional_params.len());
3920        params.push("name", self._name);
3921
3922        params.extend(self._additional_params.iter());
3923
3924        params.push("alt", "json");
3925        let mut url = self.hub._base_url.clone() + "v1/{+name}:cancel";
3926
3927        match dlg.api_key() {
3928            Some(value) => params.push("key", value),
3929            None => {
3930                dlg.finished(false);
3931                return Err(common::Error::MissingAPIKey);
3932            }
3933        }
3934
3935        #[allow(clippy::single_element_loop)]
3936        for &(find_this, param_name) in [("{+name}", "name")].iter() {
3937            url = params.uri_replacement(url, param_name, find_this, true);
3938        }
3939        {
3940            let to_remove = ["name"];
3941            params.remove_params(&to_remove);
3942        }
3943
3944        let url = params.parse_with_url(&url);
3945
3946        let mut json_mime_type = mime::APPLICATION_JSON;
3947        let mut request_value_reader = {
3948            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
3949            common::remove_json_null_values(&mut value);
3950            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
3951            serde_json::to_writer(&mut dst, &value).unwrap();
3952            dst
3953        };
3954        let request_size = request_value_reader
3955            .seek(std::io::SeekFrom::End(0))
3956            .unwrap();
3957        request_value_reader
3958            .seek(std::io::SeekFrom::Start(0))
3959            .unwrap();
3960
3961        loop {
3962            request_value_reader
3963                .seek(std::io::SeekFrom::Start(0))
3964                .unwrap();
3965            let mut req_result = {
3966                let client = &self.hub.client;
3967                dlg.pre_request();
3968                let mut req_builder = hyper::Request::builder()
3969                    .method(hyper::Method::POST)
3970                    .uri(url.as_str())
3971                    .header(USER_AGENT, self.hub._user_agent.clone());
3972
3973                let request = req_builder
3974                    .header(CONTENT_TYPE, json_mime_type.to_string())
3975                    .header(CONTENT_LENGTH, request_size as u64)
3976                    .body(common::to_body(
3977                        request_value_reader.get_ref().clone().into(),
3978                    ));
3979
3980                client.request(request.unwrap()).await
3981            };
3982
3983            match req_result {
3984                Err(err) => {
3985                    if let common::Retry::After(d) = dlg.http_error(&err) {
3986                        sleep(d).await;
3987                        continue;
3988                    }
3989                    dlg.finished(false);
3990                    return Err(common::Error::HttpError(err));
3991                }
3992                Ok(res) => {
3993                    let (mut parts, body) = res.into_parts();
3994                    let mut body = common::Body::new(body);
3995                    if !parts.status.is_success() {
3996                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3997                        let error = serde_json::from_str(&common::to_string(&bytes));
3998                        let response = common::to_response(parts, bytes.into());
3999
4000                        if let common::Retry::After(d) =
4001                            dlg.http_failure(&response, error.as_ref().ok())
4002                        {
4003                            sleep(d).await;
4004                            continue;
4005                        }
4006
4007                        dlg.finished(false);
4008
4009                        return Err(match error {
4010                            Ok(value) => common::Error::BadRequest(value),
4011                            _ => common::Error::Failure(response),
4012                        });
4013                    }
4014                    let response = {
4015                        let bytes = common::to_bytes(body).await.unwrap_or_default();
4016                        let encoded = common::to_string(&bytes);
4017                        match serde_json::from_str(&encoded) {
4018                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4019                            Err(error) => {
4020                                dlg.response_json_decode_error(&encoded, &error);
4021                                return Err(common::Error::JsonDecodeError(
4022                                    encoded.to_string(),
4023                                    error,
4024                                ));
4025                            }
4026                        }
4027                    };
4028
4029                    dlg.finished(true);
4030                    return Ok(response);
4031                }
4032            }
4033        }
4034    }
4035
4036    ///
4037    /// Sets the *request* property to the given value.
4038    ///
4039    /// Even though the property as already been set when instantiating this call,
4040    /// we provide this method for API completeness.
4041    pub fn request(
4042        mut self,
4043        new_value: CancelUserInvitationRequest,
4044    ) -> CustomerUserinvitationCancelCall<'a, C> {
4045        self._request = new_value;
4046        self
4047    }
4048    /// Required. `UserInvitation` name in the format `customers/{customer}/userinvitations/{user_email_address}`
4049    ///
4050    /// Sets the *name* path property to the given value.
4051    ///
4052    /// Even though the property as already been set when instantiating this call,
4053    /// we provide this method for API completeness.
4054    pub fn name(mut self, new_value: &str) -> CustomerUserinvitationCancelCall<'a, C> {
4055        self._name = new_value.to_string();
4056        self
4057    }
4058    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4059    /// while executing the actual API request.
4060    ///
4061    /// ````text
4062    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
4063    /// ````
4064    ///
4065    /// Sets the *delegate* property to the given value.
4066    pub fn delegate(
4067        mut self,
4068        new_value: &'a mut dyn common::Delegate,
4069    ) -> CustomerUserinvitationCancelCall<'a, C> {
4070        self._delegate = Some(new_value);
4071        self
4072    }
4073
4074    /// Set any additional parameter of the query string used in the request.
4075    /// It should be used to set parameters which are not yet available through their own
4076    /// setters.
4077    ///
4078    /// Please note that this method must not be used to set any of the known parameters
4079    /// which have their own setter method. If done anyway, the request will fail.
4080    ///
4081    /// # Additional Parameters
4082    ///
4083    /// * *$.xgafv* (query-string) - V1 error format.
4084    /// * *access_token* (query-string) - OAuth access token.
4085    /// * *alt* (query-string) - Data format for response.
4086    /// * *callback* (query-string) - JSONP
4087    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4088    /// * *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.
4089    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4090    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4091    /// * *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.
4092    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4093    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4094    pub fn param<T>(mut self, name: T, value: T) -> CustomerUserinvitationCancelCall<'a, C>
4095    where
4096        T: AsRef<str>,
4097    {
4098        self._additional_params
4099            .insert(name.as_ref().to_string(), value.as_ref().to_string());
4100        self
4101    }
4102}
4103
4104/// Retrieves a UserInvitation resource. **Note:** New consumer accounts with the customer's verified domain created within the previous 48 hours will not appear in the result. This delay also applies to newly-verified domains.
4105///
4106/// A builder for the *userinvitations.get* method supported by a *customer* resource.
4107/// It is not used directly, but through a [`CustomerMethods`] instance.
4108///
4109/// # Example
4110///
4111/// Instantiate a resource method builder
4112///
4113/// ```test_harness,no_run
4114/// # extern crate hyper;
4115/// # extern crate hyper_rustls;
4116/// # extern crate google_cloudidentity1 as cloudidentity1;
4117/// # async fn dox() {
4118/// # use cloudidentity1::{CloudIdentity, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4119///
4120/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4121/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
4122/// #     .with_native_roots()
4123/// #     .unwrap()
4124/// #     .https_only()
4125/// #     .enable_http2()
4126/// #     .build();
4127///
4128/// # let executor = hyper_util::rt::TokioExecutor::new();
4129/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
4130/// #     secret,
4131/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4132/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
4133/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
4134/// #     ),
4135/// # ).build().await.unwrap();
4136///
4137/// # let client = hyper_util::client::legacy::Client::builder(
4138/// #     hyper_util::rt::TokioExecutor::new()
4139/// # )
4140/// # .build(
4141/// #     hyper_rustls::HttpsConnectorBuilder::new()
4142/// #         .with_native_roots()
4143/// #         .unwrap()
4144/// #         .https_or_http()
4145/// #         .enable_http2()
4146/// #         .build()
4147/// # );
4148/// # let mut hub = CloudIdentity::new(client, auth);
4149/// // You can configure optional parameters by calling the respective setters at will, and
4150/// // execute the final call using `doit()`.
4151/// // Values shown here are possibly random and not representative !
4152/// let result = hub.customers().userinvitations_get("name")
4153///              .doit().await;
4154/// # }
4155/// ```
4156pub struct CustomerUserinvitationGetCall<'a, C>
4157where
4158    C: 'a,
4159{
4160    hub: &'a CloudIdentity<C>,
4161    _name: String,
4162    _delegate: Option<&'a mut dyn common::Delegate>,
4163    _additional_params: HashMap<String, String>,
4164}
4165
4166impl<'a, C> common::CallBuilder for CustomerUserinvitationGetCall<'a, C> {}
4167
4168impl<'a, C> CustomerUserinvitationGetCall<'a, C>
4169where
4170    C: common::Connector,
4171{
4172    /// Perform the operation you have build so far.
4173    pub async fn doit(mut self) -> common::Result<(common::Response, UserInvitation)> {
4174        use std::borrow::Cow;
4175        use std::io::{Read, Seek};
4176
4177        use common::{url::Params, ToParts};
4178        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
4179
4180        let mut dd = common::DefaultDelegate;
4181        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
4182        dlg.begin(common::MethodInfo {
4183            id: "cloudidentity.customers.userinvitations.get",
4184            http_method: hyper::Method::GET,
4185        });
4186
4187        for &field in ["alt", "name"].iter() {
4188            if self._additional_params.contains_key(field) {
4189                dlg.finished(false);
4190                return Err(common::Error::FieldClash(field));
4191            }
4192        }
4193
4194        let mut params = Params::with_capacity(3 + self._additional_params.len());
4195        params.push("name", self._name);
4196
4197        params.extend(self._additional_params.iter());
4198
4199        params.push("alt", "json");
4200        let mut url = self.hub._base_url.clone() + "v1/{+name}";
4201
4202        match dlg.api_key() {
4203            Some(value) => params.push("key", value),
4204            None => {
4205                dlg.finished(false);
4206                return Err(common::Error::MissingAPIKey);
4207            }
4208        }
4209
4210        #[allow(clippy::single_element_loop)]
4211        for &(find_this, param_name) in [("{+name}", "name")].iter() {
4212            url = params.uri_replacement(url, param_name, find_this, true);
4213        }
4214        {
4215            let to_remove = ["name"];
4216            params.remove_params(&to_remove);
4217        }
4218
4219        let url = params.parse_with_url(&url);
4220
4221        loop {
4222            let mut req_result = {
4223                let client = &self.hub.client;
4224                dlg.pre_request();
4225                let mut req_builder = hyper::Request::builder()
4226                    .method(hyper::Method::GET)
4227                    .uri(url.as_str())
4228                    .header(USER_AGENT, self.hub._user_agent.clone());
4229
4230                let request = req_builder
4231                    .header(CONTENT_LENGTH, 0_u64)
4232                    .body(common::to_body::<String>(None));
4233
4234                client.request(request.unwrap()).await
4235            };
4236
4237            match req_result {
4238                Err(err) => {
4239                    if let common::Retry::After(d) = dlg.http_error(&err) {
4240                        sleep(d).await;
4241                        continue;
4242                    }
4243                    dlg.finished(false);
4244                    return Err(common::Error::HttpError(err));
4245                }
4246                Ok(res) => {
4247                    let (mut parts, body) = res.into_parts();
4248                    let mut body = common::Body::new(body);
4249                    if !parts.status.is_success() {
4250                        let bytes = common::to_bytes(body).await.unwrap_or_default();
4251                        let error = serde_json::from_str(&common::to_string(&bytes));
4252                        let response = common::to_response(parts, bytes.into());
4253
4254                        if let common::Retry::After(d) =
4255                            dlg.http_failure(&response, error.as_ref().ok())
4256                        {
4257                            sleep(d).await;
4258                            continue;
4259                        }
4260
4261                        dlg.finished(false);
4262
4263                        return Err(match error {
4264                            Ok(value) => common::Error::BadRequest(value),
4265                            _ => common::Error::Failure(response),
4266                        });
4267                    }
4268                    let response = {
4269                        let bytes = common::to_bytes(body).await.unwrap_or_default();
4270                        let encoded = common::to_string(&bytes);
4271                        match serde_json::from_str(&encoded) {
4272                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4273                            Err(error) => {
4274                                dlg.response_json_decode_error(&encoded, &error);
4275                                return Err(common::Error::JsonDecodeError(
4276                                    encoded.to_string(),
4277                                    error,
4278                                ));
4279                            }
4280                        }
4281                    };
4282
4283                    dlg.finished(true);
4284                    return Ok(response);
4285                }
4286            }
4287        }
4288    }
4289
4290    /// Required. `UserInvitation` name in the format `customers/{customer}/userinvitations/{user_email_address}`
4291    ///
4292    /// Sets the *name* path property to the given value.
4293    ///
4294    /// Even though the property as already been set when instantiating this call,
4295    /// we provide this method for API completeness.
4296    pub fn name(mut self, new_value: &str) -> CustomerUserinvitationGetCall<'a, C> {
4297        self._name = new_value.to_string();
4298        self
4299    }
4300    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4301    /// while executing the actual API request.
4302    ///
4303    /// ````text
4304    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
4305    /// ````
4306    ///
4307    /// Sets the *delegate* property to the given value.
4308    pub fn delegate(
4309        mut self,
4310        new_value: &'a mut dyn common::Delegate,
4311    ) -> CustomerUserinvitationGetCall<'a, C> {
4312        self._delegate = Some(new_value);
4313        self
4314    }
4315
4316    /// Set any additional parameter of the query string used in the request.
4317    /// It should be used to set parameters which are not yet available through their own
4318    /// setters.
4319    ///
4320    /// Please note that this method must not be used to set any of the known parameters
4321    /// which have their own setter method. If done anyway, the request will fail.
4322    ///
4323    /// # Additional Parameters
4324    ///
4325    /// * *$.xgafv* (query-string) - V1 error format.
4326    /// * *access_token* (query-string) - OAuth access token.
4327    /// * *alt* (query-string) - Data format for response.
4328    /// * *callback* (query-string) - JSONP
4329    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4330    /// * *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.
4331    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4332    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4333    /// * *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.
4334    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4335    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4336    pub fn param<T>(mut self, name: T, value: T) -> CustomerUserinvitationGetCall<'a, C>
4337    where
4338        T: AsRef<str>,
4339    {
4340        self._additional_params
4341            .insert(name.as_ref().to_string(), value.as_ref().to_string());
4342        self
4343    }
4344}
4345
4346/// Verifies whether a user account is eligible to receive a UserInvitation (is an unmanaged account). Eligibility is based on the following criteria: * the email address is a consumer account and it's the primary email address of the account, and * the domain of the email address matches an existing verified Google Workspace or Cloud Identity domain If both conditions are met, the user is eligible. **Note:** This method is not supported for Workspace Essentials customers.
4347///
4348/// A builder for the *userinvitations.isInvitableUser* method supported by a *customer* resource.
4349/// It is not used directly, but through a [`CustomerMethods`] instance.
4350///
4351/// # Example
4352///
4353/// Instantiate a resource method builder
4354///
4355/// ```test_harness,no_run
4356/// # extern crate hyper;
4357/// # extern crate hyper_rustls;
4358/// # extern crate google_cloudidentity1 as cloudidentity1;
4359/// # async fn dox() {
4360/// # use cloudidentity1::{CloudIdentity, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4361///
4362/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4363/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
4364/// #     .with_native_roots()
4365/// #     .unwrap()
4366/// #     .https_only()
4367/// #     .enable_http2()
4368/// #     .build();
4369///
4370/// # let executor = hyper_util::rt::TokioExecutor::new();
4371/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
4372/// #     secret,
4373/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4374/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
4375/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
4376/// #     ),
4377/// # ).build().await.unwrap();
4378///
4379/// # let client = hyper_util::client::legacy::Client::builder(
4380/// #     hyper_util::rt::TokioExecutor::new()
4381/// # )
4382/// # .build(
4383/// #     hyper_rustls::HttpsConnectorBuilder::new()
4384/// #         .with_native_roots()
4385/// #         .unwrap()
4386/// #         .https_or_http()
4387/// #         .enable_http2()
4388/// #         .build()
4389/// # );
4390/// # let mut hub = CloudIdentity::new(client, auth);
4391/// // You can configure optional parameters by calling the respective setters at will, and
4392/// // execute the final call using `doit()`.
4393/// // Values shown here are possibly random and not representative !
4394/// let result = hub.customers().userinvitations_is_invitable_user("name")
4395///              .doit().await;
4396/// # }
4397/// ```
4398pub struct CustomerUserinvitationIsInvitableUserCall<'a, C>
4399where
4400    C: 'a,
4401{
4402    hub: &'a CloudIdentity<C>,
4403    _name: String,
4404    _delegate: Option<&'a mut dyn common::Delegate>,
4405    _additional_params: HashMap<String, String>,
4406}
4407
4408impl<'a, C> common::CallBuilder for CustomerUserinvitationIsInvitableUserCall<'a, C> {}
4409
4410impl<'a, C> CustomerUserinvitationIsInvitableUserCall<'a, C>
4411where
4412    C: common::Connector,
4413{
4414    /// Perform the operation you have build so far.
4415    pub async fn doit(mut self) -> common::Result<(common::Response, IsInvitableUserResponse)> {
4416        use std::borrow::Cow;
4417        use std::io::{Read, Seek};
4418
4419        use common::{url::Params, ToParts};
4420        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
4421
4422        let mut dd = common::DefaultDelegate;
4423        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
4424        dlg.begin(common::MethodInfo {
4425            id: "cloudidentity.customers.userinvitations.isInvitableUser",
4426            http_method: hyper::Method::GET,
4427        });
4428
4429        for &field in ["alt", "name"].iter() {
4430            if self._additional_params.contains_key(field) {
4431                dlg.finished(false);
4432                return Err(common::Error::FieldClash(field));
4433            }
4434        }
4435
4436        let mut params = Params::with_capacity(3 + self._additional_params.len());
4437        params.push("name", self._name);
4438
4439        params.extend(self._additional_params.iter());
4440
4441        params.push("alt", "json");
4442        let mut url = self.hub._base_url.clone() + "v1/{+name}:isInvitableUser";
4443
4444        match dlg.api_key() {
4445            Some(value) => params.push("key", value),
4446            None => {
4447                dlg.finished(false);
4448                return Err(common::Error::MissingAPIKey);
4449            }
4450        }
4451
4452        #[allow(clippy::single_element_loop)]
4453        for &(find_this, param_name) in [("{+name}", "name")].iter() {
4454            url = params.uri_replacement(url, param_name, find_this, true);
4455        }
4456        {
4457            let to_remove = ["name"];
4458            params.remove_params(&to_remove);
4459        }
4460
4461        let url = params.parse_with_url(&url);
4462
4463        loop {
4464            let mut req_result = {
4465                let client = &self.hub.client;
4466                dlg.pre_request();
4467                let mut req_builder = hyper::Request::builder()
4468                    .method(hyper::Method::GET)
4469                    .uri(url.as_str())
4470                    .header(USER_AGENT, self.hub._user_agent.clone());
4471
4472                let request = req_builder
4473                    .header(CONTENT_LENGTH, 0_u64)
4474                    .body(common::to_body::<String>(None));
4475
4476                client.request(request.unwrap()).await
4477            };
4478
4479            match req_result {
4480                Err(err) => {
4481                    if let common::Retry::After(d) = dlg.http_error(&err) {
4482                        sleep(d).await;
4483                        continue;
4484                    }
4485                    dlg.finished(false);
4486                    return Err(common::Error::HttpError(err));
4487                }
4488                Ok(res) => {
4489                    let (mut parts, body) = res.into_parts();
4490                    let mut body = common::Body::new(body);
4491                    if !parts.status.is_success() {
4492                        let bytes = common::to_bytes(body).await.unwrap_or_default();
4493                        let error = serde_json::from_str(&common::to_string(&bytes));
4494                        let response = common::to_response(parts, bytes.into());
4495
4496                        if let common::Retry::After(d) =
4497                            dlg.http_failure(&response, error.as_ref().ok())
4498                        {
4499                            sleep(d).await;
4500                            continue;
4501                        }
4502
4503                        dlg.finished(false);
4504
4505                        return Err(match error {
4506                            Ok(value) => common::Error::BadRequest(value),
4507                            _ => common::Error::Failure(response),
4508                        });
4509                    }
4510                    let response = {
4511                        let bytes = common::to_bytes(body).await.unwrap_or_default();
4512                        let encoded = common::to_string(&bytes);
4513                        match serde_json::from_str(&encoded) {
4514                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4515                            Err(error) => {
4516                                dlg.response_json_decode_error(&encoded, &error);
4517                                return Err(common::Error::JsonDecodeError(
4518                                    encoded.to_string(),
4519                                    error,
4520                                ));
4521                            }
4522                        }
4523                    };
4524
4525                    dlg.finished(true);
4526                    return Ok(response);
4527                }
4528            }
4529        }
4530    }
4531
4532    /// Required. `UserInvitation` name in the format `customers/{customer}/userinvitations/{user_email_address}`
4533    ///
4534    /// Sets the *name* path property to the given value.
4535    ///
4536    /// Even though the property as already been set when instantiating this call,
4537    /// we provide this method for API completeness.
4538    pub fn name(mut self, new_value: &str) -> CustomerUserinvitationIsInvitableUserCall<'a, C> {
4539        self._name = new_value.to_string();
4540        self
4541    }
4542    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4543    /// while executing the actual API request.
4544    ///
4545    /// ````text
4546    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
4547    /// ````
4548    ///
4549    /// Sets the *delegate* property to the given value.
4550    pub fn delegate(
4551        mut self,
4552        new_value: &'a mut dyn common::Delegate,
4553    ) -> CustomerUserinvitationIsInvitableUserCall<'a, C> {
4554        self._delegate = Some(new_value);
4555        self
4556    }
4557
4558    /// Set any additional parameter of the query string used in the request.
4559    /// It should be used to set parameters which are not yet available through their own
4560    /// setters.
4561    ///
4562    /// Please note that this method must not be used to set any of the known parameters
4563    /// which have their own setter method. If done anyway, the request will fail.
4564    ///
4565    /// # Additional Parameters
4566    ///
4567    /// * *$.xgafv* (query-string) - V1 error format.
4568    /// * *access_token* (query-string) - OAuth access token.
4569    /// * *alt* (query-string) - Data format for response.
4570    /// * *callback* (query-string) - JSONP
4571    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4572    /// * *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.
4573    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4574    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4575    /// * *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.
4576    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4577    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4578    pub fn param<T>(mut self, name: T, value: T) -> CustomerUserinvitationIsInvitableUserCall<'a, C>
4579    where
4580        T: AsRef<str>,
4581    {
4582        self._additional_params
4583            .insert(name.as_ref().to_string(), value.as_ref().to_string());
4584        self
4585    }
4586}
4587
4588/// Retrieves a list of UserInvitation resources. **Note:** New consumer accounts with the customer's verified domain created within the previous 48 hours will not appear in the result. This delay also applies to newly-verified domains.
4589///
4590/// A builder for the *userinvitations.list* method supported by a *customer* resource.
4591/// It is not used directly, but through a [`CustomerMethods`] instance.
4592///
4593/// # Example
4594///
4595/// Instantiate a resource method builder
4596///
4597/// ```test_harness,no_run
4598/// # extern crate hyper;
4599/// # extern crate hyper_rustls;
4600/// # extern crate google_cloudidentity1 as cloudidentity1;
4601/// # async fn dox() {
4602/// # use cloudidentity1::{CloudIdentity, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4603///
4604/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4605/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
4606/// #     .with_native_roots()
4607/// #     .unwrap()
4608/// #     .https_only()
4609/// #     .enable_http2()
4610/// #     .build();
4611///
4612/// # let executor = hyper_util::rt::TokioExecutor::new();
4613/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
4614/// #     secret,
4615/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4616/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
4617/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
4618/// #     ),
4619/// # ).build().await.unwrap();
4620///
4621/// # let client = hyper_util::client::legacy::Client::builder(
4622/// #     hyper_util::rt::TokioExecutor::new()
4623/// # )
4624/// # .build(
4625/// #     hyper_rustls::HttpsConnectorBuilder::new()
4626/// #         .with_native_roots()
4627/// #         .unwrap()
4628/// #         .https_or_http()
4629/// #         .enable_http2()
4630/// #         .build()
4631/// # );
4632/// # let mut hub = CloudIdentity::new(client, auth);
4633/// // You can configure optional parameters by calling the respective setters at will, and
4634/// // execute the final call using `doit()`.
4635/// // Values shown here are possibly random and not representative !
4636/// let result = hub.customers().userinvitations_list("parent")
4637///              .page_token("amet.")
4638///              .page_size(-20)
4639///              .order_by("ipsum")
4640///              .filter("gubergren")
4641///              .doit().await;
4642/// # }
4643/// ```
4644pub struct CustomerUserinvitationListCall<'a, C>
4645where
4646    C: 'a,
4647{
4648    hub: &'a CloudIdentity<C>,
4649    _parent: String,
4650    _page_token: Option<String>,
4651    _page_size: Option<i32>,
4652    _order_by: Option<String>,
4653    _filter: Option<String>,
4654    _delegate: Option<&'a mut dyn common::Delegate>,
4655    _additional_params: HashMap<String, String>,
4656}
4657
4658impl<'a, C> common::CallBuilder for CustomerUserinvitationListCall<'a, C> {}
4659
4660impl<'a, C> CustomerUserinvitationListCall<'a, C>
4661where
4662    C: common::Connector,
4663{
4664    /// Perform the operation you have build so far.
4665    pub async fn doit(mut self) -> common::Result<(common::Response, ListUserInvitationsResponse)> {
4666        use std::borrow::Cow;
4667        use std::io::{Read, Seek};
4668
4669        use common::{url::Params, ToParts};
4670        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
4671
4672        let mut dd = common::DefaultDelegate;
4673        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
4674        dlg.begin(common::MethodInfo {
4675            id: "cloudidentity.customers.userinvitations.list",
4676            http_method: hyper::Method::GET,
4677        });
4678
4679        for &field in [
4680            "alt",
4681            "parent",
4682            "pageToken",
4683            "pageSize",
4684            "orderBy",
4685            "filter",
4686        ]
4687        .iter()
4688        {
4689            if self._additional_params.contains_key(field) {
4690                dlg.finished(false);
4691                return Err(common::Error::FieldClash(field));
4692            }
4693        }
4694
4695        let mut params = Params::with_capacity(7 + self._additional_params.len());
4696        params.push("parent", self._parent);
4697        if let Some(value) = self._page_token.as_ref() {
4698            params.push("pageToken", value);
4699        }
4700        if let Some(value) = self._page_size.as_ref() {
4701            params.push("pageSize", value.to_string());
4702        }
4703        if let Some(value) = self._order_by.as_ref() {
4704            params.push("orderBy", value);
4705        }
4706        if let Some(value) = self._filter.as_ref() {
4707            params.push("filter", value);
4708        }
4709
4710        params.extend(self._additional_params.iter());
4711
4712        params.push("alt", "json");
4713        let mut url = self.hub._base_url.clone() + "v1/{+parent}/userinvitations";
4714
4715        match dlg.api_key() {
4716            Some(value) => params.push("key", value),
4717            None => {
4718                dlg.finished(false);
4719                return Err(common::Error::MissingAPIKey);
4720            }
4721        }
4722
4723        #[allow(clippy::single_element_loop)]
4724        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
4725            url = params.uri_replacement(url, param_name, find_this, true);
4726        }
4727        {
4728            let to_remove = ["parent"];
4729            params.remove_params(&to_remove);
4730        }
4731
4732        let url = params.parse_with_url(&url);
4733
4734        loop {
4735            let mut req_result = {
4736                let client = &self.hub.client;
4737                dlg.pre_request();
4738                let mut req_builder = hyper::Request::builder()
4739                    .method(hyper::Method::GET)
4740                    .uri(url.as_str())
4741                    .header(USER_AGENT, self.hub._user_agent.clone());
4742
4743                let request = req_builder
4744                    .header(CONTENT_LENGTH, 0_u64)
4745                    .body(common::to_body::<String>(None));
4746
4747                client.request(request.unwrap()).await
4748            };
4749
4750            match req_result {
4751                Err(err) => {
4752                    if let common::Retry::After(d) = dlg.http_error(&err) {
4753                        sleep(d).await;
4754                        continue;
4755                    }
4756                    dlg.finished(false);
4757                    return Err(common::Error::HttpError(err));
4758                }
4759                Ok(res) => {
4760                    let (mut parts, body) = res.into_parts();
4761                    let mut body = common::Body::new(body);
4762                    if !parts.status.is_success() {
4763                        let bytes = common::to_bytes(body).await.unwrap_or_default();
4764                        let error = serde_json::from_str(&common::to_string(&bytes));
4765                        let response = common::to_response(parts, bytes.into());
4766
4767                        if let common::Retry::After(d) =
4768                            dlg.http_failure(&response, error.as_ref().ok())
4769                        {
4770                            sleep(d).await;
4771                            continue;
4772                        }
4773
4774                        dlg.finished(false);
4775
4776                        return Err(match error {
4777                            Ok(value) => common::Error::BadRequest(value),
4778                            _ => common::Error::Failure(response),
4779                        });
4780                    }
4781                    let response = {
4782                        let bytes = common::to_bytes(body).await.unwrap_or_default();
4783                        let encoded = common::to_string(&bytes);
4784                        match serde_json::from_str(&encoded) {
4785                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4786                            Err(error) => {
4787                                dlg.response_json_decode_error(&encoded, &error);
4788                                return Err(common::Error::JsonDecodeError(
4789                                    encoded.to_string(),
4790                                    error,
4791                                ));
4792                            }
4793                        }
4794                    };
4795
4796                    dlg.finished(true);
4797                    return Ok(response);
4798                }
4799            }
4800        }
4801    }
4802
4803    /// Required. The customer ID of the Google Workspace or Cloud Identity account the UserInvitation resources are associated with.
4804    ///
4805    /// Sets the *parent* path property to the given value.
4806    ///
4807    /// Even though the property as already been set when instantiating this call,
4808    /// we provide this method for API completeness.
4809    pub fn parent(mut self, new_value: &str) -> CustomerUserinvitationListCall<'a, C> {
4810        self._parent = new_value.to_string();
4811        self
4812    }
4813    /// Optional. A page token, received from a previous `ListUserInvitations` call. Provide this to retrieve the subsequent page. When paginating, all other parameters provided to `ListBooks` must match the call that provided the page token.
4814    ///
4815    /// Sets the *page token* query property to the given value.
4816    pub fn page_token(mut self, new_value: &str) -> CustomerUserinvitationListCall<'a, C> {
4817        self._page_token = Some(new_value.to_string());
4818        self
4819    }
4820    /// Optional. The maximum number of UserInvitation resources to return. If unspecified, at most 100 resources will be returned. The maximum value is 200; values above 200 will be set to 200.
4821    ///
4822    /// Sets the *page size* query property to the given value.
4823    pub fn page_size(mut self, new_value: i32) -> CustomerUserinvitationListCall<'a, C> {
4824        self._page_size = Some(new_value);
4825        self
4826    }
4827    /// Optional. The sort order of the list results. You can sort the results in descending order based on either email or last update timestamp but not both, using `order_by="email desc"`. Currently, sorting is supported for `update_time asc`, `update_time desc`, `email asc`, and `email desc`. If not specified, results will be returned based on `email asc` order.
4828    ///
4829    /// Sets the *order by* query property to the given value.
4830    pub fn order_by(mut self, new_value: &str) -> CustomerUserinvitationListCall<'a, C> {
4831        self._order_by = Some(new_value.to_string());
4832        self
4833    }
4834    /// Optional. A query string for filtering `UserInvitation` results by their current state, in the format: `"state=='invited'"`.
4835    ///
4836    /// Sets the *filter* query property to the given value.
4837    pub fn filter(mut self, new_value: &str) -> CustomerUserinvitationListCall<'a, C> {
4838        self._filter = Some(new_value.to_string());
4839        self
4840    }
4841    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4842    /// while executing the actual API request.
4843    ///
4844    /// ````text
4845    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
4846    /// ````
4847    ///
4848    /// Sets the *delegate* property to the given value.
4849    pub fn delegate(
4850        mut self,
4851        new_value: &'a mut dyn common::Delegate,
4852    ) -> CustomerUserinvitationListCall<'a, C> {
4853        self._delegate = Some(new_value);
4854        self
4855    }
4856
4857    /// Set any additional parameter of the query string used in the request.
4858    /// It should be used to set parameters which are not yet available through their own
4859    /// setters.
4860    ///
4861    /// Please note that this method must not be used to set any of the known parameters
4862    /// which have their own setter method. If done anyway, the request will fail.
4863    ///
4864    /// # Additional Parameters
4865    ///
4866    /// * *$.xgafv* (query-string) - V1 error format.
4867    /// * *access_token* (query-string) - OAuth access token.
4868    /// * *alt* (query-string) - Data format for response.
4869    /// * *callback* (query-string) - JSONP
4870    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4871    /// * *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.
4872    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4873    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4874    /// * *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.
4875    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4876    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4877    pub fn param<T>(mut self, name: T, value: T) -> CustomerUserinvitationListCall<'a, C>
4878    where
4879        T: AsRef<str>,
4880    {
4881        self._additional_params
4882            .insert(name.as_ref().to_string(), value.as_ref().to_string());
4883        self
4884    }
4885}
4886
4887/// Sends a UserInvitation to email. If the `UserInvitation` does not exist for this request and it is a valid request, the request creates a `UserInvitation`. **Note:** The `get` and `list` methods have a 48-hour delay where newly-created consumer accounts will not appear in the results. You can still send a `UserInvitation` to those accounts if you know the unmanaged email address and IsInvitableUser==True.
4888///
4889/// A builder for the *userinvitations.send* method supported by a *customer* resource.
4890/// It is not used directly, but through a [`CustomerMethods`] instance.
4891///
4892/// # Example
4893///
4894/// Instantiate a resource method builder
4895///
4896/// ```test_harness,no_run
4897/// # extern crate hyper;
4898/// # extern crate hyper_rustls;
4899/// # extern crate google_cloudidentity1 as cloudidentity1;
4900/// use cloudidentity1::api::SendUserInvitationRequest;
4901/// # async fn dox() {
4902/// # use cloudidentity1::{CloudIdentity, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4903///
4904/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4905/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
4906/// #     .with_native_roots()
4907/// #     .unwrap()
4908/// #     .https_only()
4909/// #     .enable_http2()
4910/// #     .build();
4911///
4912/// # let executor = hyper_util::rt::TokioExecutor::new();
4913/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
4914/// #     secret,
4915/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4916/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
4917/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
4918/// #     ),
4919/// # ).build().await.unwrap();
4920///
4921/// # let client = hyper_util::client::legacy::Client::builder(
4922/// #     hyper_util::rt::TokioExecutor::new()
4923/// # )
4924/// # .build(
4925/// #     hyper_rustls::HttpsConnectorBuilder::new()
4926/// #         .with_native_roots()
4927/// #         .unwrap()
4928/// #         .https_or_http()
4929/// #         .enable_http2()
4930/// #         .build()
4931/// # );
4932/// # let mut hub = CloudIdentity::new(client, auth);
4933/// // As the method needs a request, you would usually fill it with the desired information
4934/// // into the respective structure. Some of the parts shown here might not be applicable !
4935/// // Values shown here are possibly random and not representative !
4936/// let mut req = SendUserInvitationRequest::default();
4937///
4938/// // You can configure optional parameters by calling the respective setters at will, and
4939/// // execute the final call using `doit()`.
4940/// // Values shown here are possibly random and not representative !
4941/// let result = hub.customers().userinvitations_send(req, "name")
4942///              .doit().await;
4943/// # }
4944/// ```
4945pub struct CustomerUserinvitationSendCall<'a, C>
4946where
4947    C: 'a,
4948{
4949    hub: &'a CloudIdentity<C>,
4950    _request: SendUserInvitationRequest,
4951    _name: String,
4952    _delegate: Option<&'a mut dyn common::Delegate>,
4953    _additional_params: HashMap<String, String>,
4954}
4955
4956impl<'a, C> common::CallBuilder for CustomerUserinvitationSendCall<'a, C> {}
4957
4958impl<'a, C> CustomerUserinvitationSendCall<'a, C>
4959where
4960    C: common::Connector,
4961{
4962    /// Perform the operation you have build so far.
4963    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
4964        use std::borrow::Cow;
4965        use std::io::{Read, Seek};
4966
4967        use common::{url::Params, ToParts};
4968        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
4969
4970        let mut dd = common::DefaultDelegate;
4971        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
4972        dlg.begin(common::MethodInfo {
4973            id: "cloudidentity.customers.userinvitations.send",
4974            http_method: hyper::Method::POST,
4975        });
4976
4977        for &field in ["alt", "name"].iter() {
4978            if self._additional_params.contains_key(field) {
4979                dlg.finished(false);
4980                return Err(common::Error::FieldClash(field));
4981            }
4982        }
4983
4984        let mut params = Params::with_capacity(4 + self._additional_params.len());
4985        params.push("name", self._name);
4986
4987        params.extend(self._additional_params.iter());
4988
4989        params.push("alt", "json");
4990        let mut url = self.hub._base_url.clone() + "v1/{+name}:send";
4991
4992        match dlg.api_key() {
4993            Some(value) => params.push("key", value),
4994            None => {
4995                dlg.finished(false);
4996                return Err(common::Error::MissingAPIKey);
4997            }
4998        }
4999
5000        #[allow(clippy::single_element_loop)]
5001        for &(find_this, param_name) in [("{+name}", "name")].iter() {
5002            url = params.uri_replacement(url, param_name, find_this, true);
5003        }
5004        {
5005            let to_remove = ["name"];
5006            params.remove_params(&to_remove);
5007        }
5008
5009        let url = params.parse_with_url(&url);
5010
5011        let mut json_mime_type = mime::APPLICATION_JSON;
5012        let mut request_value_reader = {
5013            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
5014            common::remove_json_null_values(&mut value);
5015            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
5016            serde_json::to_writer(&mut dst, &value).unwrap();
5017            dst
5018        };
5019        let request_size = request_value_reader
5020            .seek(std::io::SeekFrom::End(0))
5021            .unwrap();
5022        request_value_reader
5023            .seek(std::io::SeekFrom::Start(0))
5024            .unwrap();
5025
5026        loop {
5027            request_value_reader
5028                .seek(std::io::SeekFrom::Start(0))
5029                .unwrap();
5030            let mut req_result = {
5031                let client = &self.hub.client;
5032                dlg.pre_request();
5033                let mut req_builder = hyper::Request::builder()
5034                    .method(hyper::Method::POST)
5035                    .uri(url.as_str())
5036                    .header(USER_AGENT, self.hub._user_agent.clone());
5037
5038                let request = req_builder
5039                    .header(CONTENT_TYPE, json_mime_type.to_string())
5040                    .header(CONTENT_LENGTH, request_size as u64)
5041                    .body(common::to_body(
5042                        request_value_reader.get_ref().clone().into(),
5043                    ));
5044
5045                client.request(request.unwrap()).await
5046            };
5047
5048            match req_result {
5049                Err(err) => {
5050                    if let common::Retry::After(d) = dlg.http_error(&err) {
5051                        sleep(d).await;
5052                        continue;
5053                    }
5054                    dlg.finished(false);
5055                    return Err(common::Error::HttpError(err));
5056                }
5057                Ok(res) => {
5058                    let (mut parts, body) = res.into_parts();
5059                    let mut body = common::Body::new(body);
5060                    if !parts.status.is_success() {
5061                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5062                        let error = serde_json::from_str(&common::to_string(&bytes));
5063                        let response = common::to_response(parts, bytes.into());
5064
5065                        if let common::Retry::After(d) =
5066                            dlg.http_failure(&response, error.as_ref().ok())
5067                        {
5068                            sleep(d).await;
5069                            continue;
5070                        }
5071
5072                        dlg.finished(false);
5073
5074                        return Err(match error {
5075                            Ok(value) => common::Error::BadRequest(value),
5076                            _ => common::Error::Failure(response),
5077                        });
5078                    }
5079                    let response = {
5080                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5081                        let encoded = common::to_string(&bytes);
5082                        match serde_json::from_str(&encoded) {
5083                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5084                            Err(error) => {
5085                                dlg.response_json_decode_error(&encoded, &error);
5086                                return Err(common::Error::JsonDecodeError(
5087                                    encoded.to_string(),
5088                                    error,
5089                                ));
5090                            }
5091                        }
5092                    };
5093
5094                    dlg.finished(true);
5095                    return Ok(response);
5096                }
5097            }
5098        }
5099    }
5100
5101    ///
5102    /// Sets the *request* property to the given value.
5103    ///
5104    /// Even though the property as already been set when instantiating this call,
5105    /// we provide this method for API completeness.
5106    pub fn request(
5107        mut self,
5108        new_value: SendUserInvitationRequest,
5109    ) -> CustomerUserinvitationSendCall<'a, C> {
5110        self._request = new_value;
5111        self
5112    }
5113    /// Required. `UserInvitation` name in the format `customers/{customer}/userinvitations/{user_email_address}`
5114    ///
5115    /// Sets the *name* path property to the given value.
5116    ///
5117    /// Even though the property as already been set when instantiating this call,
5118    /// we provide this method for API completeness.
5119    pub fn name(mut self, new_value: &str) -> CustomerUserinvitationSendCall<'a, C> {
5120        self._name = new_value.to_string();
5121        self
5122    }
5123    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5124    /// while executing the actual API request.
5125    ///
5126    /// ````text
5127    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
5128    /// ````
5129    ///
5130    /// Sets the *delegate* property to the given value.
5131    pub fn delegate(
5132        mut self,
5133        new_value: &'a mut dyn common::Delegate,
5134    ) -> CustomerUserinvitationSendCall<'a, C> {
5135        self._delegate = Some(new_value);
5136        self
5137    }
5138
5139    /// Set any additional parameter of the query string used in the request.
5140    /// It should be used to set parameters which are not yet available through their own
5141    /// setters.
5142    ///
5143    /// Please note that this method must not be used to set any of the known parameters
5144    /// which have their own setter method. If done anyway, the request will fail.
5145    ///
5146    /// # Additional Parameters
5147    ///
5148    /// * *$.xgafv* (query-string) - V1 error format.
5149    /// * *access_token* (query-string) - OAuth access token.
5150    /// * *alt* (query-string) - Data format for response.
5151    /// * *callback* (query-string) - JSONP
5152    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5153    /// * *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.
5154    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5155    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5156    /// * *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.
5157    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5158    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5159    pub fn param<T>(mut self, name: T, value: T) -> CustomerUserinvitationSendCall<'a, C>
5160    where
5161        T: AsRef<str>,
5162    {
5163        self._additional_params
5164            .insert(name.as_ref().to_string(), value.as_ref().to_string());
5165        self
5166    }
5167}
5168
5169/// Gets the client state for the device user
5170///
5171/// A builder for the *deviceUsers.clientStates.get* method supported by a *device* resource.
5172/// It is not used directly, but through a [`DeviceMethods`] instance.
5173///
5174/// # Example
5175///
5176/// Instantiate a resource method builder
5177///
5178/// ```test_harness,no_run
5179/// # extern crate hyper;
5180/// # extern crate hyper_rustls;
5181/// # extern crate google_cloudidentity1 as cloudidentity1;
5182/// # async fn dox() {
5183/// # use cloudidentity1::{CloudIdentity, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5184///
5185/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5186/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
5187/// #     .with_native_roots()
5188/// #     .unwrap()
5189/// #     .https_only()
5190/// #     .enable_http2()
5191/// #     .build();
5192///
5193/// # let executor = hyper_util::rt::TokioExecutor::new();
5194/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
5195/// #     secret,
5196/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5197/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
5198/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
5199/// #     ),
5200/// # ).build().await.unwrap();
5201///
5202/// # let client = hyper_util::client::legacy::Client::builder(
5203/// #     hyper_util::rt::TokioExecutor::new()
5204/// # )
5205/// # .build(
5206/// #     hyper_rustls::HttpsConnectorBuilder::new()
5207/// #         .with_native_roots()
5208/// #         .unwrap()
5209/// #         .https_or_http()
5210/// #         .enable_http2()
5211/// #         .build()
5212/// # );
5213/// # let mut hub = CloudIdentity::new(client, auth);
5214/// // You can configure optional parameters by calling the respective setters at will, and
5215/// // execute the final call using `doit()`.
5216/// // Values shown here are possibly random and not representative !
5217/// let result = hub.devices().device_users_client_states_get("name")
5218///              .customer("eos")
5219///              .doit().await;
5220/// # }
5221/// ```
5222pub struct DeviceDeviceUserClientStateGetCall<'a, C>
5223where
5224    C: 'a,
5225{
5226    hub: &'a CloudIdentity<C>,
5227    _name: String,
5228    _customer: Option<String>,
5229    _delegate: Option<&'a mut dyn common::Delegate>,
5230    _additional_params: HashMap<String, String>,
5231    _scopes: BTreeSet<String>,
5232}
5233
5234impl<'a, C> common::CallBuilder for DeviceDeviceUserClientStateGetCall<'a, C> {}
5235
5236impl<'a, C> DeviceDeviceUserClientStateGetCall<'a, C>
5237where
5238    C: common::Connector,
5239{
5240    /// Perform the operation you have build so far.
5241    pub async fn doit(
5242        mut self,
5243    ) -> common::Result<(
5244        common::Response,
5245        GoogleAppsCloudidentityDevicesV1ClientState,
5246    )> {
5247        use std::borrow::Cow;
5248        use std::io::{Read, Seek};
5249
5250        use common::{url::Params, ToParts};
5251        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5252
5253        let mut dd = common::DefaultDelegate;
5254        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5255        dlg.begin(common::MethodInfo {
5256            id: "cloudidentity.devices.deviceUsers.clientStates.get",
5257            http_method: hyper::Method::GET,
5258        });
5259
5260        for &field in ["alt", "name", "customer"].iter() {
5261            if self._additional_params.contains_key(field) {
5262                dlg.finished(false);
5263                return Err(common::Error::FieldClash(field));
5264            }
5265        }
5266
5267        let mut params = Params::with_capacity(4 + self._additional_params.len());
5268        params.push("name", self._name);
5269        if let Some(value) = self._customer.as_ref() {
5270            params.push("customer", value);
5271        }
5272
5273        params.extend(self._additional_params.iter());
5274
5275        params.push("alt", "json");
5276        let mut url = self.hub._base_url.clone() + "v1/{+name}";
5277        if self._scopes.is_empty() {
5278            self._scopes
5279                .insert(Scope::CloudIdentityDeviceReadonly.as_ref().to_string());
5280        }
5281
5282        #[allow(clippy::single_element_loop)]
5283        for &(find_this, param_name) in [("{+name}", "name")].iter() {
5284            url = params.uri_replacement(url, param_name, find_this, true);
5285        }
5286        {
5287            let to_remove = ["name"];
5288            params.remove_params(&to_remove);
5289        }
5290
5291        let url = params.parse_with_url(&url);
5292
5293        loop {
5294            let token = match self
5295                .hub
5296                .auth
5297                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5298                .await
5299            {
5300                Ok(token) => token,
5301                Err(e) => match dlg.token(e) {
5302                    Ok(token) => token,
5303                    Err(e) => {
5304                        dlg.finished(false);
5305                        return Err(common::Error::MissingToken(e));
5306                    }
5307                },
5308            };
5309            let mut req_result = {
5310                let client = &self.hub.client;
5311                dlg.pre_request();
5312                let mut req_builder = hyper::Request::builder()
5313                    .method(hyper::Method::GET)
5314                    .uri(url.as_str())
5315                    .header(USER_AGENT, self.hub._user_agent.clone());
5316
5317                if let Some(token) = token.as_ref() {
5318                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5319                }
5320
5321                let request = req_builder
5322                    .header(CONTENT_LENGTH, 0_u64)
5323                    .body(common::to_body::<String>(None));
5324
5325                client.request(request.unwrap()).await
5326            };
5327
5328            match req_result {
5329                Err(err) => {
5330                    if let common::Retry::After(d) = dlg.http_error(&err) {
5331                        sleep(d).await;
5332                        continue;
5333                    }
5334                    dlg.finished(false);
5335                    return Err(common::Error::HttpError(err));
5336                }
5337                Ok(res) => {
5338                    let (mut parts, body) = res.into_parts();
5339                    let mut body = common::Body::new(body);
5340                    if !parts.status.is_success() {
5341                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5342                        let error = serde_json::from_str(&common::to_string(&bytes));
5343                        let response = common::to_response(parts, bytes.into());
5344
5345                        if let common::Retry::After(d) =
5346                            dlg.http_failure(&response, error.as_ref().ok())
5347                        {
5348                            sleep(d).await;
5349                            continue;
5350                        }
5351
5352                        dlg.finished(false);
5353
5354                        return Err(match error {
5355                            Ok(value) => common::Error::BadRequest(value),
5356                            _ => common::Error::Failure(response),
5357                        });
5358                    }
5359                    let response = {
5360                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5361                        let encoded = common::to_string(&bytes);
5362                        match serde_json::from_str(&encoded) {
5363                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5364                            Err(error) => {
5365                                dlg.response_json_decode_error(&encoded, &error);
5366                                return Err(common::Error::JsonDecodeError(
5367                                    encoded.to_string(),
5368                                    error,
5369                                ));
5370                            }
5371                        }
5372                    };
5373
5374                    dlg.finished(true);
5375                    return Ok(response);
5376                }
5377            }
5378        }
5379    }
5380
5381    /// Required. [Resource name](https://cloud.google.com/apis/design/resource_names) of the ClientState in format: `devices/{device}/deviceUsers/{device_user}/clientStates/{partner}`, where `device` is the unique ID assigned to the Device, `device_user` is the unique ID assigned to the User and `partner` identifies the partner storing the data. To get the client state for devices belonging to your own organization, the `partnerId` is in the format: `customerId-*anystring*`. Where the `customerId` is your organization's customer ID and `anystring` is any suffix. This suffix is used in setting up Custom Access Levels in Context-Aware Access. You may use `my_customer` instead of the customer ID for devices managed by your own organization. You may specify `-` in place of the `{device}`, so the ClientState resource name can be: `devices/-/deviceUsers/{device_user_resource}/clientStates/{partner}`.
5382    ///
5383    /// Sets the *name* path property to the given value.
5384    ///
5385    /// Even though the property as already been set when instantiating this call,
5386    /// we provide this method for API completeness.
5387    pub fn name(mut self, new_value: &str) -> DeviceDeviceUserClientStateGetCall<'a, C> {
5388        self._name = new_value.to_string();
5389        self
5390    }
5391    /// Optional. [Resource name](https://cloud.google.com/apis/design/resource_names) of the customer. If you're using this API for your own organization, use `customers/my_customer` If you're using this API to manage another organization, use `customers/{customer}`, where customer is the customer to whom the device belongs.
5392    ///
5393    /// Sets the *customer* query property to the given value.
5394    pub fn customer(mut self, new_value: &str) -> DeviceDeviceUserClientStateGetCall<'a, C> {
5395        self._customer = Some(new_value.to_string());
5396        self
5397    }
5398    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5399    /// while executing the actual API request.
5400    ///
5401    /// ````text
5402    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
5403    /// ````
5404    ///
5405    /// Sets the *delegate* property to the given value.
5406    pub fn delegate(
5407        mut self,
5408        new_value: &'a mut dyn common::Delegate,
5409    ) -> DeviceDeviceUserClientStateGetCall<'a, C> {
5410        self._delegate = Some(new_value);
5411        self
5412    }
5413
5414    /// Set any additional parameter of the query string used in the request.
5415    /// It should be used to set parameters which are not yet available through their own
5416    /// setters.
5417    ///
5418    /// Please note that this method must not be used to set any of the known parameters
5419    /// which have their own setter method. If done anyway, the request will fail.
5420    ///
5421    /// # Additional Parameters
5422    ///
5423    /// * *$.xgafv* (query-string) - V1 error format.
5424    /// * *access_token* (query-string) - OAuth access token.
5425    /// * *alt* (query-string) - Data format for response.
5426    /// * *callback* (query-string) - JSONP
5427    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5428    /// * *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.
5429    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5430    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5431    /// * *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.
5432    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5433    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5434    pub fn param<T>(mut self, name: T, value: T) -> DeviceDeviceUserClientStateGetCall<'a, C>
5435    where
5436        T: AsRef<str>,
5437    {
5438        self._additional_params
5439            .insert(name.as_ref().to_string(), value.as_ref().to_string());
5440        self
5441    }
5442
5443    /// Identifies the authorization scope for the method you are building.
5444    ///
5445    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5446    /// [`Scope::CloudIdentityDeviceReadonly`].
5447    ///
5448    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5449    /// tokens for more than one scope.
5450    ///
5451    /// Usually there is more than one suitable scope to authorize an operation, some of which may
5452    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5453    /// sufficient, a read-write scope will do as well.
5454    pub fn add_scope<St>(mut self, scope: St) -> DeviceDeviceUserClientStateGetCall<'a, C>
5455    where
5456        St: AsRef<str>,
5457    {
5458        self._scopes.insert(String::from(scope.as_ref()));
5459        self
5460    }
5461    /// Identifies the authorization scope(s) for the method you are building.
5462    ///
5463    /// See [`Self::add_scope()`] for details.
5464    pub fn add_scopes<I, St>(mut self, scopes: I) -> DeviceDeviceUserClientStateGetCall<'a, C>
5465    where
5466        I: IntoIterator<Item = St>,
5467        St: AsRef<str>,
5468    {
5469        self._scopes
5470            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5471        self
5472    }
5473
5474    /// Removes all scopes, and no default scope will be used either.
5475    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5476    /// for details).
5477    pub fn clear_scopes(mut self) -> DeviceDeviceUserClientStateGetCall<'a, C> {
5478        self._scopes.clear();
5479        self
5480    }
5481}
5482
5483/// Lists the client states for the given search query.
5484///
5485/// A builder for the *deviceUsers.clientStates.list* method supported by a *device* resource.
5486/// It is not used directly, but through a [`DeviceMethods`] instance.
5487///
5488/// # Example
5489///
5490/// Instantiate a resource method builder
5491///
5492/// ```test_harness,no_run
5493/// # extern crate hyper;
5494/// # extern crate hyper_rustls;
5495/// # extern crate google_cloudidentity1 as cloudidentity1;
5496/// # async fn dox() {
5497/// # use cloudidentity1::{CloudIdentity, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5498///
5499/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5500/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
5501/// #     .with_native_roots()
5502/// #     .unwrap()
5503/// #     .https_only()
5504/// #     .enable_http2()
5505/// #     .build();
5506///
5507/// # let executor = hyper_util::rt::TokioExecutor::new();
5508/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
5509/// #     secret,
5510/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5511/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
5512/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
5513/// #     ),
5514/// # ).build().await.unwrap();
5515///
5516/// # let client = hyper_util::client::legacy::Client::builder(
5517/// #     hyper_util::rt::TokioExecutor::new()
5518/// # )
5519/// # .build(
5520/// #     hyper_rustls::HttpsConnectorBuilder::new()
5521/// #         .with_native_roots()
5522/// #         .unwrap()
5523/// #         .https_or_http()
5524/// #         .enable_http2()
5525/// #         .build()
5526/// # );
5527/// # let mut hub = CloudIdentity::new(client, auth);
5528/// // You can configure optional parameters by calling the respective setters at will, and
5529/// // execute the final call using `doit()`.
5530/// // Values shown here are possibly random and not representative !
5531/// let result = hub.devices().device_users_client_states_list("parent")
5532///              .page_token("ea")
5533///              .order_by("ipsum")
5534///              .filter("invidunt")
5535///              .customer("amet")
5536///              .doit().await;
5537/// # }
5538/// ```
5539pub struct DeviceDeviceUserClientStateListCall<'a, C>
5540where
5541    C: 'a,
5542{
5543    hub: &'a CloudIdentity<C>,
5544    _parent: String,
5545    _page_token: Option<String>,
5546    _order_by: Option<String>,
5547    _filter: Option<String>,
5548    _customer: Option<String>,
5549    _delegate: Option<&'a mut dyn common::Delegate>,
5550    _additional_params: HashMap<String, String>,
5551    _scopes: BTreeSet<String>,
5552}
5553
5554impl<'a, C> common::CallBuilder for DeviceDeviceUserClientStateListCall<'a, C> {}
5555
5556impl<'a, C> DeviceDeviceUserClientStateListCall<'a, C>
5557where
5558    C: common::Connector,
5559{
5560    /// Perform the operation you have build so far.
5561    pub async fn doit(
5562        mut self,
5563    ) -> common::Result<(
5564        common::Response,
5565        GoogleAppsCloudidentityDevicesV1ListClientStatesResponse,
5566    )> {
5567        use std::borrow::Cow;
5568        use std::io::{Read, Seek};
5569
5570        use common::{url::Params, ToParts};
5571        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5572
5573        let mut dd = common::DefaultDelegate;
5574        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5575        dlg.begin(common::MethodInfo {
5576            id: "cloudidentity.devices.deviceUsers.clientStates.list",
5577            http_method: hyper::Method::GET,
5578        });
5579
5580        for &field in [
5581            "alt",
5582            "parent",
5583            "pageToken",
5584            "orderBy",
5585            "filter",
5586            "customer",
5587        ]
5588        .iter()
5589        {
5590            if self._additional_params.contains_key(field) {
5591                dlg.finished(false);
5592                return Err(common::Error::FieldClash(field));
5593            }
5594        }
5595
5596        let mut params = Params::with_capacity(7 + self._additional_params.len());
5597        params.push("parent", self._parent);
5598        if let Some(value) = self._page_token.as_ref() {
5599            params.push("pageToken", value);
5600        }
5601        if let Some(value) = self._order_by.as_ref() {
5602            params.push("orderBy", value);
5603        }
5604        if let Some(value) = self._filter.as_ref() {
5605            params.push("filter", value);
5606        }
5607        if let Some(value) = self._customer.as_ref() {
5608            params.push("customer", value);
5609        }
5610
5611        params.extend(self._additional_params.iter());
5612
5613        params.push("alt", "json");
5614        let mut url = self.hub._base_url.clone() + "v1/{+parent}/clientStates";
5615        if self._scopes.is_empty() {
5616            self._scopes
5617                .insert(Scope::CloudIdentityDeviceReadonly.as_ref().to_string());
5618        }
5619
5620        #[allow(clippy::single_element_loop)]
5621        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
5622            url = params.uri_replacement(url, param_name, find_this, true);
5623        }
5624        {
5625            let to_remove = ["parent"];
5626            params.remove_params(&to_remove);
5627        }
5628
5629        let url = params.parse_with_url(&url);
5630
5631        loop {
5632            let token = match self
5633                .hub
5634                .auth
5635                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5636                .await
5637            {
5638                Ok(token) => token,
5639                Err(e) => match dlg.token(e) {
5640                    Ok(token) => token,
5641                    Err(e) => {
5642                        dlg.finished(false);
5643                        return Err(common::Error::MissingToken(e));
5644                    }
5645                },
5646            };
5647            let mut req_result = {
5648                let client = &self.hub.client;
5649                dlg.pre_request();
5650                let mut req_builder = hyper::Request::builder()
5651                    .method(hyper::Method::GET)
5652                    .uri(url.as_str())
5653                    .header(USER_AGENT, self.hub._user_agent.clone());
5654
5655                if let Some(token) = token.as_ref() {
5656                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5657                }
5658
5659                let request = req_builder
5660                    .header(CONTENT_LENGTH, 0_u64)
5661                    .body(common::to_body::<String>(None));
5662
5663                client.request(request.unwrap()).await
5664            };
5665
5666            match req_result {
5667                Err(err) => {
5668                    if let common::Retry::After(d) = dlg.http_error(&err) {
5669                        sleep(d).await;
5670                        continue;
5671                    }
5672                    dlg.finished(false);
5673                    return Err(common::Error::HttpError(err));
5674                }
5675                Ok(res) => {
5676                    let (mut parts, body) = res.into_parts();
5677                    let mut body = common::Body::new(body);
5678                    if !parts.status.is_success() {
5679                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5680                        let error = serde_json::from_str(&common::to_string(&bytes));
5681                        let response = common::to_response(parts, bytes.into());
5682
5683                        if let common::Retry::After(d) =
5684                            dlg.http_failure(&response, error.as_ref().ok())
5685                        {
5686                            sleep(d).await;
5687                            continue;
5688                        }
5689
5690                        dlg.finished(false);
5691
5692                        return Err(match error {
5693                            Ok(value) => common::Error::BadRequest(value),
5694                            _ => common::Error::Failure(response),
5695                        });
5696                    }
5697                    let response = {
5698                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5699                        let encoded = common::to_string(&bytes);
5700                        match serde_json::from_str(&encoded) {
5701                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5702                            Err(error) => {
5703                                dlg.response_json_decode_error(&encoded, &error);
5704                                return Err(common::Error::JsonDecodeError(
5705                                    encoded.to_string(),
5706                                    error,
5707                                ));
5708                            }
5709                        }
5710                    };
5711
5712                    dlg.finished(true);
5713                    return Ok(response);
5714                }
5715            }
5716        }
5717    }
5718
5719    /// Required. To list all ClientStates, set this to "devices/-/deviceUsers/-". To list all ClientStates owned by a DeviceUser, set this to the resource name of the DeviceUser. Format: devices/{device}/deviceUsers/{deviceUser}
5720    ///
5721    /// Sets the *parent* path property to the given value.
5722    ///
5723    /// Even though the property as already been set when instantiating this call,
5724    /// we provide this method for API completeness.
5725    pub fn parent(mut self, new_value: &str) -> DeviceDeviceUserClientStateListCall<'a, C> {
5726        self._parent = new_value.to_string();
5727        self
5728    }
5729    /// Optional. A page token, received from a previous `ListClientStates` call. Provide this to retrieve the subsequent page. When paginating, all other parameters provided to `ListClientStates` must match the call that provided the page token.
5730    ///
5731    /// Sets the *page token* query property to the given value.
5732    pub fn page_token(mut self, new_value: &str) -> DeviceDeviceUserClientStateListCall<'a, C> {
5733        self._page_token = Some(new_value.to_string());
5734        self
5735    }
5736    /// Optional. Order specification for client states in the response.
5737    ///
5738    /// Sets the *order by* query property to the given value.
5739    pub fn order_by(mut self, new_value: &str) -> DeviceDeviceUserClientStateListCall<'a, C> {
5740        self._order_by = Some(new_value.to_string());
5741        self
5742    }
5743    /// Optional. Additional restrictions when fetching list of client states.
5744    ///
5745    /// Sets the *filter* query property to the given value.
5746    pub fn filter(mut self, new_value: &str) -> DeviceDeviceUserClientStateListCall<'a, C> {
5747        self._filter = Some(new_value.to_string());
5748        self
5749    }
5750    /// Optional. [Resource name](https://cloud.google.com/apis/design/resource_names) of the customer. If you're using this API for your own organization, use `customers/my_customer` If you're using this API to manage another organization, use `customers/{customer}`, where customer is the customer to whom the device belongs.
5751    ///
5752    /// Sets the *customer* query property to the given value.
5753    pub fn customer(mut self, new_value: &str) -> DeviceDeviceUserClientStateListCall<'a, C> {
5754        self._customer = Some(new_value.to_string());
5755        self
5756    }
5757    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5758    /// while executing the actual API request.
5759    ///
5760    /// ````text
5761    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
5762    /// ````
5763    ///
5764    /// Sets the *delegate* property to the given value.
5765    pub fn delegate(
5766        mut self,
5767        new_value: &'a mut dyn common::Delegate,
5768    ) -> DeviceDeviceUserClientStateListCall<'a, C> {
5769        self._delegate = Some(new_value);
5770        self
5771    }
5772
5773    /// Set any additional parameter of the query string used in the request.
5774    /// It should be used to set parameters which are not yet available through their own
5775    /// setters.
5776    ///
5777    /// Please note that this method must not be used to set any of the known parameters
5778    /// which have their own setter method. If done anyway, the request will fail.
5779    ///
5780    /// # Additional Parameters
5781    ///
5782    /// * *$.xgafv* (query-string) - V1 error format.
5783    /// * *access_token* (query-string) - OAuth access token.
5784    /// * *alt* (query-string) - Data format for response.
5785    /// * *callback* (query-string) - JSONP
5786    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5787    /// * *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.
5788    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5789    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5790    /// * *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.
5791    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5792    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5793    pub fn param<T>(mut self, name: T, value: T) -> DeviceDeviceUserClientStateListCall<'a, C>
5794    where
5795        T: AsRef<str>,
5796    {
5797        self._additional_params
5798            .insert(name.as_ref().to_string(), value.as_ref().to_string());
5799        self
5800    }
5801
5802    /// Identifies the authorization scope for the method you are building.
5803    ///
5804    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5805    /// [`Scope::CloudIdentityDeviceReadonly`].
5806    ///
5807    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5808    /// tokens for more than one scope.
5809    ///
5810    /// Usually there is more than one suitable scope to authorize an operation, some of which may
5811    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5812    /// sufficient, a read-write scope will do as well.
5813    pub fn add_scope<St>(mut self, scope: St) -> DeviceDeviceUserClientStateListCall<'a, C>
5814    where
5815        St: AsRef<str>,
5816    {
5817        self._scopes.insert(String::from(scope.as_ref()));
5818        self
5819    }
5820    /// Identifies the authorization scope(s) for the method you are building.
5821    ///
5822    /// See [`Self::add_scope()`] for details.
5823    pub fn add_scopes<I, St>(mut self, scopes: I) -> DeviceDeviceUserClientStateListCall<'a, C>
5824    where
5825        I: IntoIterator<Item = St>,
5826        St: AsRef<str>,
5827    {
5828        self._scopes
5829            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5830        self
5831    }
5832
5833    /// Removes all scopes, and no default scope will be used either.
5834    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5835    /// for details).
5836    pub fn clear_scopes(mut self) -> DeviceDeviceUserClientStateListCall<'a, C> {
5837        self._scopes.clear();
5838        self
5839    }
5840}
5841
5842/// Updates the client state for the device user **Note**: This method is available only to customers who have one of the following SKUs: Enterprise Standard, Enterprise Plus, Enterprise for Education, and Cloud Identity Premium
5843///
5844/// A builder for the *deviceUsers.clientStates.patch* method supported by a *device* resource.
5845/// It is not used directly, but through a [`DeviceMethods`] instance.
5846///
5847/// # Example
5848///
5849/// Instantiate a resource method builder
5850///
5851/// ```test_harness,no_run
5852/// # extern crate hyper;
5853/// # extern crate hyper_rustls;
5854/// # extern crate google_cloudidentity1 as cloudidentity1;
5855/// use cloudidentity1::api::GoogleAppsCloudidentityDevicesV1ClientState;
5856/// # async fn dox() {
5857/// # use cloudidentity1::{CloudIdentity, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5858///
5859/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5860/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
5861/// #     .with_native_roots()
5862/// #     .unwrap()
5863/// #     .https_only()
5864/// #     .enable_http2()
5865/// #     .build();
5866///
5867/// # let executor = hyper_util::rt::TokioExecutor::new();
5868/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
5869/// #     secret,
5870/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5871/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
5872/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
5873/// #     ),
5874/// # ).build().await.unwrap();
5875///
5876/// # let client = hyper_util::client::legacy::Client::builder(
5877/// #     hyper_util::rt::TokioExecutor::new()
5878/// # )
5879/// # .build(
5880/// #     hyper_rustls::HttpsConnectorBuilder::new()
5881/// #         .with_native_roots()
5882/// #         .unwrap()
5883/// #         .https_or_http()
5884/// #         .enable_http2()
5885/// #         .build()
5886/// # );
5887/// # let mut hub = CloudIdentity::new(client, auth);
5888/// // As the method needs a request, you would usually fill it with the desired information
5889/// // into the respective structure. Some of the parts shown here might not be applicable !
5890/// // Values shown here are possibly random and not representative !
5891/// let mut req = GoogleAppsCloudidentityDevicesV1ClientState::default();
5892///
5893/// // You can configure optional parameters by calling the respective setters at will, and
5894/// // execute the final call using `doit()`.
5895/// // Values shown here are possibly random and not representative !
5896/// let result = hub.devices().device_users_client_states_patch(req, "name")
5897///              .update_mask(FieldMask::new::<&str>(&[]))
5898///              .customer("ipsum")
5899///              .doit().await;
5900/// # }
5901/// ```
5902pub struct DeviceDeviceUserClientStatePatchCall<'a, C>
5903where
5904    C: 'a,
5905{
5906    hub: &'a CloudIdentity<C>,
5907    _request: GoogleAppsCloudidentityDevicesV1ClientState,
5908    _name: String,
5909    _update_mask: Option<common::FieldMask>,
5910    _customer: Option<String>,
5911    _delegate: Option<&'a mut dyn common::Delegate>,
5912    _additional_params: HashMap<String, String>,
5913    _scopes: BTreeSet<String>,
5914}
5915
5916impl<'a, C> common::CallBuilder for DeviceDeviceUserClientStatePatchCall<'a, C> {}
5917
5918impl<'a, C> DeviceDeviceUserClientStatePatchCall<'a, C>
5919where
5920    C: common::Connector,
5921{
5922    /// Perform the operation you have build so far.
5923    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
5924        use std::borrow::Cow;
5925        use std::io::{Read, Seek};
5926
5927        use common::{url::Params, ToParts};
5928        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5929
5930        let mut dd = common::DefaultDelegate;
5931        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5932        dlg.begin(common::MethodInfo {
5933            id: "cloudidentity.devices.deviceUsers.clientStates.patch",
5934            http_method: hyper::Method::PATCH,
5935        });
5936
5937        for &field in ["alt", "name", "updateMask", "customer"].iter() {
5938            if self._additional_params.contains_key(field) {
5939                dlg.finished(false);
5940                return Err(common::Error::FieldClash(field));
5941            }
5942        }
5943
5944        let mut params = Params::with_capacity(6 + self._additional_params.len());
5945        params.push("name", self._name);
5946        if let Some(value) = self._update_mask.as_ref() {
5947            params.push("updateMask", value.to_string());
5948        }
5949        if let Some(value) = self._customer.as_ref() {
5950            params.push("customer", value);
5951        }
5952
5953        params.extend(self._additional_params.iter());
5954
5955        params.push("alt", "json");
5956        let mut url = self.hub._base_url.clone() + "v1/{+name}";
5957        if self._scopes.is_empty() {
5958            self._scopes
5959                .insert(Scope::CloudIdentityDevice.as_ref().to_string());
5960        }
5961
5962        #[allow(clippy::single_element_loop)]
5963        for &(find_this, param_name) in [("{+name}", "name")].iter() {
5964            url = params.uri_replacement(url, param_name, find_this, true);
5965        }
5966        {
5967            let to_remove = ["name"];
5968            params.remove_params(&to_remove);
5969        }
5970
5971        let url = params.parse_with_url(&url);
5972
5973        let mut json_mime_type = mime::APPLICATION_JSON;
5974        let mut request_value_reader = {
5975            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
5976            common::remove_json_null_values(&mut value);
5977            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
5978            serde_json::to_writer(&mut dst, &value).unwrap();
5979            dst
5980        };
5981        let request_size = request_value_reader
5982            .seek(std::io::SeekFrom::End(0))
5983            .unwrap();
5984        request_value_reader
5985            .seek(std::io::SeekFrom::Start(0))
5986            .unwrap();
5987
5988        loop {
5989            let token = match self
5990                .hub
5991                .auth
5992                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5993                .await
5994            {
5995                Ok(token) => token,
5996                Err(e) => match dlg.token(e) {
5997                    Ok(token) => token,
5998                    Err(e) => {
5999                        dlg.finished(false);
6000                        return Err(common::Error::MissingToken(e));
6001                    }
6002                },
6003            };
6004            request_value_reader
6005                .seek(std::io::SeekFrom::Start(0))
6006                .unwrap();
6007            let mut req_result = {
6008                let client = &self.hub.client;
6009                dlg.pre_request();
6010                let mut req_builder = hyper::Request::builder()
6011                    .method(hyper::Method::PATCH)
6012                    .uri(url.as_str())
6013                    .header(USER_AGENT, self.hub._user_agent.clone());
6014
6015                if let Some(token) = token.as_ref() {
6016                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6017                }
6018
6019                let request = req_builder
6020                    .header(CONTENT_TYPE, json_mime_type.to_string())
6021                    .header(CONTENT_LENGTH, request_size as u64)
6022                    .body(common::to_body(
6023                        request_value_reader.get_ref().clone().into(),
6024                    ));
6025
6026                client.request(request.unwrap()).await
6027            };
6028
6029            match req_result {
6030                Err(err) => {
6031                    if let common::Retry::After(d) = dlg.http_error(&err) {
6032                        sleep(d).await;
6033                        continue;
6034                    }
6035                    dlg.finished(false);
6036                    return Err(common::Error::HttpError(err));
6037                }
6038                Ok(res) => {
6039                    let (mut parts, body) = res.into_parts();
6040                    let mut body = common::Body::new(body);
6041                    if !parts.status.is_success() {
6042                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6043                        let error = serde_json::from_str(&common::to_string(&bytes));
6044                        let response = common::to_response(parts, bytes.into());
6045
6046                        if let common::Retry::After(d) =
6047                            dlg.http_failure(&response, error.as_ref().ok())
6048                        {
6049                            sleep(d).await;
6050                            continue;
6051                        }
6052
6053                        dlg.finished(false);
6054
6055                        return Err(match error {
6056                            Ok(value) => common::Error::BadRequest(value),
6057                            _ => common::Error::Failure(response),
6058                        });
6059                    }
6060                    let response = {
6061                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6062                        let encoded = common::to_string(&bytes);
6063                        match serde_json::from_str(&encoded) {
6064                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6065                            Err(error) => {
6066                                dlg.response_json_decode_error(&encoded, &error);
6067                                return Err(common::Error::JsonDecodeError(
6068                                    encoded.to_string(),
6069                                    error,
6070                                ));
6071                            }
6072                        }
6073                    };
6074
6075                    dlg.finished(true);
6076                    return Ok(response);
6077                }
6078            }
6079        }
6080    }
6081
6082    ///
6083    /// Sets the *request* property to the given value.
6084    ///
6085    /// Even though the property as already been set when instantiating this call,
6086    /// we provide this method for API completeness.
6087    pub fn request(
6088        mut self,
6089        new_value: GoogleAppsCloudidentityDevicesV1ClientState,
6090    ) -> DeviceDeviceUserClientStatePatchCall<'a, C> {
6091        self._request = new_value;
6092        self
6093    }
6094    /// Output only. [Resource name](https://cloud.google.com/apis/design/resource_names) of the ClientState in format: `devices/{device}/deviceUsers/{device_user}/clientState/{partner}`, where partner corresponds to the partner storing the data. For partners belonging to the "BeyondCorp Alliance", this is the partner ID specified to you by Google. For all other callers, this is a string of the form: `{customer}-suffix`, where `customer` is your customer ID. The *suffix* is any string the caller specifies. This string will be displayed verbatim in the administration console. This suffix is used in setting up Custom Access Levels in Context-Aware Access. Your organization's customer ID can be obtained from the URL: `GET https://www.googleapis.com/admin/directory/v1/customers/my_customer` The `id` field in the response contains the customer ID starting with the letter 'C'. The customer ID to be used in this API is the string after the letter 'C' (not including 'C')
6095    ///
6096    /// Sets the *name* path property to the given value.
6097    ///
6098    /// Even though the property as already been set when instantiating this call,
6099    /// we provide this method for API completeness.
6100    pub fn name(mut self, new_value: &str) -> DeviceDeviceUserClientStatePatchCall<'a, C> {
6101        self._name = new_value.to_string();
6102        self
6103    }
6104    /// Optional. Comma-separated list of fully qualified names of fields to be updated. If not specified, all updatable fields in ClientState are updated.
6105    ///
6106    /// Sets the *update mask* query property to the given value.
6107    pub fn update_mask(
6108        mut self,
6109        new_value: common::FieldMask,
6110    ) -> DeviceDeviceUserClientStatePatchCall<'a, C> {
6111        self._update_mask = Some(new_value);
6112        self
6113    }
6114    /// Optional. [Resource name](https://cloud.google.com/apis/design/resource_names) of the customer. If you're using this API for your own organization, use `customers/my_customer` If you're using this API to manage another organization, use `customers/{customer}`, where customer is the customer to whom the device belongs.
6115    ///
6116    /// Sets the *customer* query property to the given value.
6117    pub fn customer(mut self, new_value: &str) -> DeviceDeviceUserClientStatePatchCall<'a, C> {
6118        self._customer = Some(new_value.to_string());
6119        self
6120    }
6121    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6122    /// while executing the actual API request.
6123    ///
6124    /// ````text
6125    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
6126    /// ````
6127    ///
6128    /// Sets the *delegate* property to the given value.
6129    pub fn delegate(
6130        mut self,
6131        new_value: &'a mut dyn common::Delegate,
6132    ) -> DeviceDeviceUserClientStatePatchCall<'a, C> {
6133        self._delegate = Some(new_value);
6134        self
6135    }
6136
6137    /// Set any additional parameter of the query string used in the request.
6138    /// It should be used to set parameters which are not yet available through their own
6139    /// setters.
6140    ///
6141    /// Please note that this method must not be used to set any of the known parameters
6142    /// which have their own setter method. If done anyway, the request will fail.
6143    ///
6144    /// # Additional Parameters
6145    ///
6146    /// * *$.xgafv* (query-string) - V1 error format.
6147    /// * *access_token* (query-string) - OAuth access token.
6148    /// * *alt* (query-string) - Data format for response.
6149    /// * *callback* (query-string) - JSONP
6150    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6151    /// * *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.
6152    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6153    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6154    /// * *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.
6155    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6156    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6157    pub fn param<T>(mut self, name: T, value: T) -> DeviceDeviceUserClientStatePatchCall<'a, C>
6158    where
6159        T: AsRef<str>,
6160    {
6161        self._additional_params
6162            .insert(name.as_ref().to_string(), value.as_ref().to_string());
6163        self
6164    }
6165
6166    /// Identifies the authorization scope for the method you are building.
6167    ///
6168    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6169    /// [`Scope::CloudIdentityDevice`].
6170    ///
6171    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6172    /// tokens for more than one scope.
6173    ///
6174    /// Usually there is more than one suitable scope to authorize an operation, some of which may
6175    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6176    /// sufficient, a read-write scope will do as well.
6177    pub fn add_scope<St>(mut self, scope: St) -> DeviceDeviceUserClientStatePatchCall<'a, C>
6178    where
6179        St: AsRef<str>,
6180    {
6181        self._scopes.insert(String::from(scope.as_ref()));
6182        self
6183    }
6184    /// Identifies the authorization scope(s) for the method you are building.
6185    ///
6186    /// See [`Self::add_scope()`] for details.
6187    pub fn add_scopes<I, St>(mut self, scopes: I) -> DeviceDeviceUserClientStatePatchCall<'a, C>
6188    where
6189        I: IntoIterator<Item = St>,
6190        St: AsRef<str>,
6191    {
6192        self._scopes
6193            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6194        self
6195    }
6196
6197    /// Removes all scopes, and no default scope will be used either.
6198    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6199    /// for details).
6200    pub fn clear_scopes(mut self) -> DeviceDeviceUserClientStatePatchCall<'a, C> {
6201        self._scopes.clear();
6202        self
6203    }
6204}
6205
6206/// Approves device to access user data.
6207///
6208/// A builder for the *deviceUsers.approve* method supported by a *device* resource.
6209/// It is not used directly, but through a [`DeviceMethods`] instance.
6210///
6211/// # Example
6212///
6213/// Instantiate a resource method builder
6214///
6215/// ```test_harness,no_run
6216/// # extern crate hyper;
6217/// # extern crate hyper_rustls;
6218/// # extern crate google_cloudidentity1 as cloudidentity1;
6219/// use cloudidentity1::api::GoogleAppsCloudidentityDevicesV1ApproveDeviceUserRequest;
6220/// # async fn dox() {
6221/// # use cloudidentity1::{CloudIdentity, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6222///
6223/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6224/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
6225/// #     .with_native_roots()
6226/// #     .unwrap()
6227/// #     .https_only()
6228/// #     .enable_http2()
6229/// #     .build();
6230///
6231/// # let executor = hyper_util::rt::TokioExecutor::new();
6232/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
6233/// #     secret,
6234/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6235/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
6236/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
6237/// #     ),
6238/// # ).build().await.unwrap();
6239///
6240/// # let client = hyper_util::client::legacy::Client::builder(
6241/// #     hyper_util::rt::TokioExecutor::new()
6242/// # )
6243/// # .build(
6244/// #     hyper_rustls::HttpsConnectorBuilder::new()
6245/// #         .with_native_roots()
6246/// #         .unwrap()
6247/// #         .https_or_http()
6248/// #         .enable_http2()
6249/// #         .build()
6250/// # );
6251/// # let mut hub = CloudIdentity::new(client, auth);
6252/// // As the method needs a request, you would usually fill it with the desired information
6253/// // into the respective structure. Some of the parts shown here might not be applicable !
6254/// // Values shown here are possibly random and not representative !
6255/// let mut req = GoogleAppsCloudidentityDevicesV1ApproveDeviceUserRequest::default();
6256///
6257/// // You can configure optional parameters by calling the respective setters at will, and
6258/// // execute the final call using `doit()`.
6259/// // Values shown here are possibly random and not representative !
6260/// let result = hub.devices().device_users_approve(req, "name")
6261///              .doit().await;
6262/// # }
6263/// ```
6264pub struct DeviceDeviceUserApproveCall<'a, C>
6265where
6266    C: 'a,
6267{
6268    hub: &'a CloudIdentity<C>,
6269    _request: GoogleAppsCloudidentityDevicesV1ApproveDeviceUserRequest,
6270    _name: String,
6271    _delegate: Option<&'a mut dyn common::Delegate>,
6272    _additional_params: HashMap<String, String>,
6273    _scopes: BTreeSet<String>,
6274}
6275
6276impl<'a, C> common::CallBuilder for DeviceDeviceUserApproveCall<'a, C> {}
6277
6278impl<'a, C> DeviceDeviceUserApproveCall<'a, C>
6279where
6280    C: common::Connector,
6281{
6282    /// Perform the operation you have build so far.
6283    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
6284        use std::borrow::Cow;
6285        use std::io::{Read, Seek};
6286
6287        use common::{url::Params, ToParts};
6288        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6289
6290        let mut dd = common::DefaultDelegate;
6291        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6292        dlg.begin(common::MethodInfo {
6293            id: "cloudidentity.devices.deviceUsers.approve",
6294            http_method: hyper::Method::POST,
6295        });
6296
6297        for &field in ["alt", "name"].iter() {
6298            if self._additional_params.contains_key(field) {
6299                dlg.finished(false);
6300                return Err(common::Error::FieldClash(field));
6301            }
6302        }
6303
6304        let mut params = Params::with_capacity(4 + self._additional_params.len());
6305        params.push("name", self._name);
6306
6307        params.extend(self._additional_params.iter());
6308
6309        params.push("alt", "json");
6310        let mut url = self.hub._base_url.clone() + "v1/{+name}:approve";
6311        if self._scopes.is_empty() {
6312            self._scopes
6313                .insert(Scope::CloudIdentityDevice.as_ref().to_string());
6314        }
6315
6316        #[allow(clippy::single_element_loop)]
6317        for &(find_this, param_name) in [("{+name}", "name")].iter() {
6318            url = params.uri_replacement(url, param_name, find_this, true);
6319        }
6320        {
6321            let to_remove = ["name"];
6322            params.remove_params(&to_remove);
6323        }
6324
6325        let url = params.parse_with_url(&url);
6326
6327        let mut json_mime_type = mime::APPLICATION_JSON;
6328        let mut request_value_reader = {
6329            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
6330            common::remove_json_null_values(&mut value);
6331            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
6332            serde_json::to_writer(&mut dst, &value).unwrap();
6333            dst
6334        };
6335        let request_size = request_value_reader
6336            .seek(std::io::SeekFrom::End(0))
6337            .unwrap();
6338        request_value_reader
6339            .seek(std::io::SeekFrom::Start(0))
6340            .unwrap();
6341
6342        loop {
6343            let token = match self
6344                .hub
6345                .auth
6346                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6347                .await
6348            {
6349                Ok(token) => token,
6350                Err(e) => match dlg.token(e) {
6351                    Ok(token) => token,
6352                    Err(e) => {
6353                        dlg.finished(false);
6354                        return Err(common::Error::MissingToken(e));
6355                    }
6356                },
6357            };
6358            request_value_reader
6359                .seek(std::io::SeekFrom::Start(0))
6360                .unwrap();
6361            let mut req_result = {
6362                let client = &self.hub.client;
6363                dlg.pre_request();
6364                let mut req_builder = hyper::Request::builder()
6365                    .method(hyper::Method::POST)
6366                    .uri(url.as_str())
6367                    .header(USER_AGENT, self.hub._user_agent.clone());
6368
6369                if let Some(token) = token.as_ref() {
6370                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6371                }
6372
6373                let request = req_builder
6374                    .header(CONTENT_TYPE, json_mime_type.to_string())
6375                    .header(CONTENT_LENGTH, request_size as u64)
6376                    .body(common::to_body(
6377                        request_value_reader.get_ref().clone().into(),
6378                    ));
6379
6380                client.request(request.unwrap()).await
6381            };
6382
6383            match req_result {
6384                Err(err) => {
6385                    if let common::Retry::After(d) = dlg.http_error(&err) {
6386                        sleep(d).await;
6387                        continue;
6388                    }
6389                    dlg.finished(false);
6390                    return Err(common::Error::HttpError(err));
6391                }
6392                Ok(res) => {
6393                    let (mut parts, body) = res.into_parts();
6394                    let mut body = common::Body::new(body);
6395                    if !parts.status.is_success() {
6396                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6397                        let error = serde_json::from_str(&common::to_string(&bytes));
6398                        let response = common::to_response(parts, bytes.into());
6399
6400                        if let common::Retry::After(d) =
6401                            dlg.http_failure(&response, error.as_ref().ok())
6402                        {
6403                            sleep(d).await;
6404                            continue;
6405                        }
6406
6407                        dlg.finished(false);
6408
6409                        return Err(match error {
6410                            Ok(value) => common::Error::BadRequest(value),
6411                            _ => common::Error::Failure(response),
6412                        });
6413                    }
6414                    let response = {
6415                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6416                        let encoded = common::to_string(&bytes);
6417                        match serde_json::from_str(&encoded) {
6418                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6419                            Err(error) => {
6420                                dlg.response_json_decode_error(&encoded, &error);
6421                                return Err(common::Error::JsonDecodeError(
6422                                    encoded.to_string(),
6423                                    error,
6424                                ));
6425                            }
6426                        }
6427                    };
6428
6429                    dlg.finished(true);
6430                    return Ok(response);
6431                }
6432            }
6433        }
6434    }
6435
6436    ///
6437    /// Sets the *request* property to the given value.
6438    ///
6439    /// Even though the property as already been set when instantiating this call,
6440    /// we provide this method for API completeness.
6441    pub fn request(
6442        mut self,
6443        new_value: GoogleAppsCloudidentityDevicesV1ApproveDeviceUserRequest,
6444    ) -> DeviceDeviceUserApproveCall<'a, C> {
6445        self._request = new_value;
6446        self
6447    }
6448    /// Required. [Resource name](https://cloud.google.com/apis/design/resource_names) of the Device in format: `devices/{device}/deviceUsers/{device_user}`, where device is the unique ID assigned to the Device, and device_user is the unique ID assigned to the User.
6449    ///
6450    /// Sets the *name* path property to the given value.
6451    ///
6452    /// Even though the property as already been set when instantiating this call,
6453    /// we provide this method for API completeness.
6454    pub fn name(mut self, new_value: &str) -> DeviceDeviceUserApproveCall<'a, C> {
6455        self._name = new_value.to_string();
6456        self
6457    }
6458    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6459    /// while executing the actual API request.
6460    ///
6461    /// ````text
6462    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
6463    /// ````
6464    ///
6465    /// Sets the *delegate* property to the given value.
6466    pub fn delegate(
6467        mut self,
6468        new_value: &'a mut dyn common::Delegate,
6469    ) -> DeviceDeviceUserApproveCall<'a, C> {
6470        self._delegate = Some(new_value);
6471        self
6472    }
6473
6474    /// Set any additional parameter of the query string used in the request.
6475    /// It should be used to set parameters which are not yet available through their own
6476    /// setters.
6477    ///
6478    /// Please note that this method must not be used to set any of the known parameters
6479    /// which have their own setter method. If done anyway, the request will fail.
6480    ///
6481    /// # Additional Parameters
6482    ///
6483    /// * *$.xgafv* (query-string) - V1 error format.
6484    /// * *access_token* (query-string) - OAuth access token.
6485    /// * *alt* (query-string) - Data format for response.
6486    /// * *callback* (query-string) - JSONP
6487    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6488    /// * *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.
6489    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6490    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6491    /// * *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.
6492    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6493    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6494    pub fn param<T>(mut self, name: T, value: T) -> DeviceDeviceUserApproveCall<'a, C>
6495    where
6496        T: AsRef<str>,
6497    {
6498        self._additional_params
6499            .insert(name.as_ref().to_string(), value.as_ref().to_string());
6500        self
6501    }
6502
6503    /// Identifies the authorization scope for the method you are building.
6504    ///
6505    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6506    /// [`Scope::CloudIdentityDevice`].
6507    ///
6508    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6509    /// tokens for more than one scope.
6510    ///
6511    /// Usually there is more than one suitable scope to authorize an operation, some of which may
6512    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6513    /// sufficient, a read-write scope will do as well.
6514    pub fn add_scope<St>(mut self, scope: St) -> DeviceDeviceUserApproveCall<'a, C>
6515    where
6516        St: AsRef<str>,
6517    {
6518        self._scopes.insert(String::from(scope.as_ref()));
6519        self
6520    }
6521    /// Identifies the authorization scope(s) for the method you are building.
6522    ///
6523    /// See [`Self::add_scope()`] for details.
6524    pub fn add_scopes<I, St>(mut self, scopes: I) -> DeviceDeviceUserApproveCall<'a, C>
6525    where
6526        I: IntoIterator<Item = St>,
6527        St: AsRef<str>,
6528    {
6529        self._scopes
6530            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6531        self
6532    }
6533
6534    /// Removes all scopes, and no default scope will be used either.
6535    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6536    /// for details).
6537    pub fn clear_scopes(mut self) -> DeviceDeviceUserApproveCall<'a, C> {
6538        self._scopes.clear();
6539        self
6540    }
6541}
6542
6543/// Blocks device from accessing user data
6544///
6545/// A builder for the *deviceUsers.block* method supported by a *device* resource.
6546/// It is not used directly, but through a [`DeviceMethods`] instance.
6547///
6548/// # Example
6549///
6550/// Instantiate a resource method builder
6551///
6552/// ```test_harness,no_run
6553/// # extern crate hyper;
6554/// # extern crate hyper_rustls;
6555/// # extern crate google_cloudidentity1 as cloudidentity1;
6556/// use cloudidentity1::api::GoogleAppsCloudidentityDevicesV1BlockDeviceUserRequest;
6557/// # async fn dox() {
6558/// # use cloudidentity1::{CloudIdentity, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6559///
6560/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6561/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
6562/// #     .with_native_roots()
6563/// #     .unwrap()
6564/// #     .https_only()
6565/// #     .enable_http2()
6566/// #     .build();
6567///
6568/// # let executor = hyper_util::rt::TokioExecutor::new();
6569/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
6570/// #     secret,
6571/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6572/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
6573/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
6574/// #     ),
6575/// # ).build().await.unwrap();
6576///
6577/// # let client = hyper_util::client::legacy::Client::builder(
6578/// #     hyper_util::rt::TokioExecutor::new()
6579/// # )
6580/// # .build(
6581/// #     hyper_rustls::HttpsConnectorBuilder::new()
6582/// #         .with_native_roots()
6583/// #         .unwrap()
6584/// #         .https_or_http()
6585/// #         .enable_http2()
6586/// #         .build()
6587/// # );
6588/// # let mut hub = CloudIdentity::new(client, auth);
6589/// // As the method needs a request, you would usually fill it with the desired information
6590/// // into the respective structure. Some of the parts shown here might not be applicable !
6591/// // Values shown here are possibly random and not representative !
6592/// let mut req = GoogleAppsCloudidentityDevicesV1BlockDeviceUserRequest::default();
6593///
6594/// // You can configure optional parameters by calling the respective setters at will, and
6595/// // execute the final call using `doit()`.
6596/// // Values shown here are possibly random and not representative !
6597/// let result = hub.devices().device_users_block(req, "name")
6598///              .doit().await;
6599/// # }
6600/// ```
6601pub struct DeviceDeviceUserBlockCall<'a, C>
6602where
6603    C: 'a,
6604{
6605    hub: &'a CloudIdentity<C>,
6606    _request: GoogleAppsCloudidentityDevicesV1BlockDeviceUserRequest,
6607    _name: String,
6608    _delegate: Option<&'a mut dyn common::Delegate>,
6609    _additional_params: HashMap<String, String>,
6610    _scopes: BTreeSet<String>,
6611}
6612
6613impl<'a, C> common::CallBuilder for DeviceDeviceUserBlockCall<'a, C> {}
6614
6615impl<'a, C> DeviceDeviceUserBlockCall<'a, C>
6616where
6617    C: common::Connector,
6618{
6619    /// Perform the operation you have build so far.
6620    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
6621        use std::borrow::Cow;
6622        use std::io::{Read, Seek};
6623
6624        use common::{url::Params, ToParts};
6625        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6626
6627        let mut dd = common::DefaultDelegate;
6628        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6629        dlg.begin(common::MethodInfo {
6630            id: "cloudidentity.devices.deviceUsers.block",
6631            http_method: hyper::Method::POST,
6632        });
6633
6634        for &field in ["alt", "name"].iter() {
6635            if self._additional_params.contains_key(field) {
6636                dlg.finished(false);
6637                return Err(common::Error::FieldClash(field));
6638            }
6639        }
6640
6641        let mut params = Params::with_capacity(4 + self._additional_params.len());
6642        params.push("name", self._name);
6643
6644        params.extend(self._additional_params.iter());
6645
6646        params.push("alt", "json");
6647        let mut url = self.hub._base_url.clone() + "v1/{+name}:block";
6648        if self._scopes.is_empty() {
6649            self._scopes
6650                .insert(Scope::CloudIdentityDevice.as_ref().to_string());
6651        }
6652
6653        #[allow(clippy::single_element_loop)]
6654        for &(find_this, param_name) in [("{+name}", "name")].iter() {
6655            url = params.uri_replacement(url, param_name, find_this, true);
6656        }
6657        {
6658            let to_remove = ["name"];
6659            params.remove_params(&to_remove);
6660        }
6661
6662        let url = params.parse_with_url(&url);
6663
6664        let mut json_mime_type = mime::APPLICATION_JSON;
6665        let mut request_value_reader = {
6666            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
6667            common::remove_json_null_values(&mut value);
6668            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
6669            serde_json::to_writer(&mut dst, &value).unwrap();
6670            dst
6671        };
6672        let request_size = request_value_reader
6673            .seek(std::io::SeekFrom::End(0))
6674            .unwrap();
6675        request_value_reader
6676            .seek(std::io::SeekFrom::Start(0))
6677            .unwrap();
6678
6679        loop {
6680            let token = match self
6681                .hub
6682                .auth
6683                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6684                .await
6685            {
6686                Ok(token) => token,
6687                Err(e) => match dlg.token(e) {
6688                    Ok(token) => token,
6689                    Err(e) => {
6690                        dlg.finished(false);
6691                        return Err(common::Error::MissingToken(e));
6692                    }
6693                },
6694            };
6695            request_value_reader
6696                .seek(std::io::SeekFrom::Start(0))
6697                .unwrap();
6698            let mut req_result = {
6699                let client = &self.hub.client;
6700                dlg.pre_request();
6701                let mut req_builder = hyper::Request::builder()
6702                    .method(hyper::Method::POST)
6703                    .uri(url.as_str())
6704                    .header(USER_AGENT, self.hub._user_agent.clone());
6705
6706                if let Some(token) = token.as_ref() {
6707                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6708                }
6709
6710                let request = req_builder
6711                    .header(CONTENT_TYPE, json_mime_type.to_string())
6712                    .header(CONTENT_LENGTH, request_size as u64)
6713                    .body(common::to_body(
6714                        request_value_reader.get_ref().clone().into(),
6715                    ));
6716
6717                client.request(request.unwrap()).await
6718            };
6719
6720            match req_result {
6721                Err(err) => {
6722                    if let common::Retry::After(d) = dlg.http_error(&err) {
6723                        sleep(d).await;
6724                        continue;
6725                    }
6726                    dlg.finished(false);
6727                    return Err(common::Error::HttpError(err));
6728                }
6729                Ok(res) => {
6730                    let (mut parts, body) = res.into_parts();
6731                    let mut body = common::Body::new(body);
6732                    if !parts.status.is_success() {
6733                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6734                        let error = serde_json::from_str(&common::to_string(&bytes));
6735                        let response = common::to_response(parts, bytes.into());
6736
6737                        if let common::Retry::After(d) =
6738                            dlg.http_failure(&response, error.as_ref().ok())
6739                        {
6740                            sleep(d).await;
6741                            continue;
6742                        }
6743
6744                        dlg.finished(false);
6745
6746                        return Err(match error {
6747                            Ok(value) => common::Error::BadRequest(value),
6748                            _ => common::Error::Failure(response),
6749                        });
6750                    }
6751                    let response = {
6752                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6753                        let encoded = common::to_string(&bytes);
6754                        match serde_json::from_str(&encoded) {
6755                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6756                            Err(error) => {
6757                                dlg.response_json_decode_error(&encoded, &error);
6758                                return Err(common::Error::JsonDecodeError(
6759                                    encoded.to_string(),
6760                                    error,
6761                                ));
6762                            }
6763                        }
6764                    };
6765
6766                    dlg.finished(true);
6767                    return Ok(response);
6768                }
6769            }
6770        }
6771    }
6772
6773    ///
6774    /// Sets the *request* property to the given value.
6775    ///
6776    /// Even though the property as already been set when instantiating this call,
6777    /// we provide this method for API completeness.
6778    pub fn request(
6779        mut self,
6780        new_value: GoogleAppsCloudidentityDevicesV1BlockDeviceUserRequest,
6781    ) -> DeviceDeviceUserBlockCall<'a, C> {
6782        self._request = new_value;
6783        self
6784    }
6785    /// Required. [Resource name](https://cloud.google.com/apis/design/resource_names) of the Device in format: `devices/{device}/deviceUsers/{device_user}`, where device is the unique ID assigned to the Device, and device_user is the unique ID assigned to the User.
6786    ///
6787    /// Sets the *name* path property to the given value.
6788    ///
6789    /// Even though the property as already been set when instantiating this call,
6790    /// we provide this method for API completeness.
6791    pub fn name(mut self, new_value: &str) -> DeviceDeviceUserBlockCall<'a, C> {
6792        self._name = new_value.to_string();
6793        self
6794    }
6795    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6796    /// while executing the actual API request.
6797    ///
6798    /// ````text
6799    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
6800    /// ````
6801    ///
6802    /// Sets the *delegate* property to the given value.
6803    pub fn delegate(
6804        mut self,
6805        new_value: &'a mut dyn common::Delegate,
6806    ) -> DeviceDeviceUserBlockCall<'a, C> {
6807        self._delegate = Some(new_value);
6808        self
6809    }
6810
6811    /// Set any additional parameter of the query string used in the request.
6812    /// It should be used to set parameters which are not yet available through their own
6813    /// setters.
6814    ///
6815    /// Please note that this method must not be used to set any of the known parameters
6816    /// which have their own setter method. If done anyway, the request will fail.
6817    ///
6818    /// # Additional Parameters
6819    ///
6820    /// * *$.xgafv* (query-string) - V1 error format.
6821    /// * *access_token* (query-string) - OAuth access token.
6822    /// * *alt* (query-string) - Data format for response.
6823    /// * *callback* (query-string) - JSONP
6824    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6825    /// * *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.
6826    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6827    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6828    /// * *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.
6829    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6830    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6831    pub fn param<T>(mut self, name: T, value: T) -> DeviceDeviceUserBlockCall<'a, C>
6832    where
6833        T: AsRef<str>,
6834    {
6835        self._additional_params
6836            .insert(name.as_ref().to_string(), value.as_ref().to_string());
6837        self
6838    }
6839
6840    /// Identifies the authorization scope for the method you are building.
6841    ///
6842    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6843    /// [`Scope::CloudIdentityDevice`].
6844    ///
6845    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6846    /// tokens for more than one scope.
6847    ///
6848    /// Usually there is more than one suitable scope to authorize an operation, some of which may
6849    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6850    /// sufficient, a read-write scope will do as well.
6851    pub fn add_scope<St>(mut self, scope: St) -> DeviceDeviceUserBlockCall<'a, C>
6852    where
6853        St: AsRef<str>,
6854    {
6855        self._scopes.insert(String::from(scope.as_ref()));
6856        self
6857    }
6858    /// Identifies the authorization scope(s) for the method you are building.
6859    ///
6860    /// See [`Self::add_scope()`] for details.
6861    pub fn add_scopes<I, St>(mut self, scopes: I) -> DeviceDeviceUserBlockCall<'a, C>
6862    where
6863        I: IntoIterator<Item = St>,
6864        St: AsRef<str>,
6865    {
6866        self._scopes
6867            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6868        self
6869    }
6870
6871    /// Removes all scopes, and no default scope will be used either.
6872    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6873    /// for details).
6874    pub fn clear_scopes(mut self) -> DeviceDeviceUserBlockCall<'a, C> {
6875        self._scopes.clear();
6876        self
6877    }
6878}
6879
6880/// Cancels an unfinished user account wipe. This operation can be used to cancel device wipe in the gap between the wipe operation returning success and the device being wiped.
6881///
6882/// A builder for the *deviceUsers.cancelWipe* method supported by a *device* resource.
6883/// It is not used directly, but through a [`DeviceMethods`] instance.
6884///
6885/// # Example
6886///
6887/// Instantiate a resource method builder
6888///
6889/// ```test_harness,no_run
6890/// # extern crate hyper;
6891/// # extern crate hyper_rustls;
6892/// # extern crate google_cloudidentity1 as cloudidentity1;
6893/// use cloudidentity1::api::GoogleAppsCloudidentityDevicesV1CancelWipeDeviceUserRequest;
6894/// # async fn dox() {
6895/// # use cloudidentity1::{CloudIdentity, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6896///
6897/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6898/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
6899/// #     .with_native_roots()
6900/// #     .unwrap()
6901/// #     .https_only()
6902/// #     .enable_http2()
6903/// #     .build();
6904///
6905/// # let executor = hyper_util::rt::TokioExecutor::new();
6906/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
6907/// #     secret,
6908/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6909/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
6910/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
6911/// #     ),
6912/// # ).build().await.unwrap();
6913///
6914/// # let client = hyper_util::client::legacy::Client::builder(
6915/// #     hyper_util::rt::TokioExecutor::new()
6916/// # )
6917/// # .build(
6918/// #     hyper_rustls::HttpsConnectorBuilder::new()
6919/// #         .with_native_roots()
6920/// #         .unwrap()
6921/// #         .https_or_http()
6922/// #         .enable_http2()
6923/// #         .build()
6924/// # );
6925/// # let mut hub = CloudIdentity::new(client, auth);
6926/// // As the method needs a request, you would usually fill it with the desired information
6927/// // into the respective structure. Some of the parts shown here might not be applicable !
6928/// // Values shown here are possibly random and not representative !
6929/// let mut req = GoogleAppsCloudidentityDevicesV1CancelWipeDeviceUserRequest::default();
6930///
6931/// // You can configure optional parameters by calling the respective setters at will, and
6932/// // execute the final call using `doit()`.
6933/// // Values shown here are possibly random and not representative !
6934/// let result = hub.devices().device_users_cancel_wipe(req, "name")
6935///              .doit().await;
6936/// # }
6937/// ```
6938pub struct DeviceDeviceUserCancelWipeCall<'a, C>
6939where
6940    C: 'a,
6941{
6942    hub: &'a CloudIdentity<C>,
6943    _request: GoogleAppsCloudidentityDevicesV1CancelWipeDeviceUserRequest,
6944    _name: String,
6945    _delegate: Option<&'a mut dyn common::Delegate>,
6946    _additional_params: HashMap<String, String>,
6947    _scopes: BTreeSet<String>,
6948}
6949
6950impl<'a, C> common::CallBuilder for DeviceDeviceUserCancelWipeCall<'a, C> {}
6951
6952impl<'a, C> DeviceDeviceUserCancelWipeCall<'a, C>
6953where
6954    C: common::Connector,
6955{
6956    /// Perform the operation you have build so far.
6957    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
6958        use std::borrow::Cow;
6959        use std::io::{Read, Seek};
6960
6961        use common::{url::Params, ToParts};
6962        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6963
6964        let mut dd = common::DefaultDelegate;
6965        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6966        dlg.begin(common::MethodInfo {
6967            id: "cloudidentity.devices.deviceUsers.cancelWipe",
6968            http_method: hyper::Method::POST,
6969        });
6970
6971        for &field in ["alt", "name"].iter() {
6972            if self._additional_params.contains_key(field) {
6973                dlg.finished(false);
6974                return Err(common::Error::FieldClash(field));
6975            }
6976        }
6977
6978        let mut params = Params::with_capacity(4 + self._additional_params.len());
6979        params.push("name", self._name);
6980
6981        params.extend(self._additional_params.iter());
6982
6983        params.push("alt", "json");
6984        let mut url = self.hub._base_url.clone() + "v1/{+name}:cancelWipe";
6985        if self._scopes.is_empty() {
6986            self._scopes
6987                .insert(Scope::CloudIdentityDevice.as_ref().to_string());
6988        }
6989
6990        #[allow(clippy::single_element_loop)]
6991        for &(find_this, param_name) in [("{+name}", "name")].iter() {
6992            url = params.uri_replacement(url, param_name, find_this, true);
6993        }
6994        {
6995            let to_remove = ["name"];
6996            params.remove_params(&to_remove);
6997        }
6998
6999        let url = params.parse_with_url(&url);
7000
7001        let mut json_mime_type = mime::APPLICATION_JSON;
7002        let mut request_value_reader = {
7003            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
7004            common::remove_json_null_values(&mut value);
7005            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
7006            serde_json::to_writer(&mut dst, &value).unwrap();
7007            dst
7008        };
7009        let request_size = request_value_reader
7010            .seek(std::io::SeekFrom::End(0))
7011            .unwrap();
7012        request_value_reader
7013            .seek(std::io::SeekFrom::Start(0))
7014            .unwrap();
7015
7016        loop {
7017            let token = match self
7018                .hub
7019                .auth
7020                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
7021                .await
7022            {
7023                Ok(token) => token,
7024                Err(e) => match dlg.token(e) {
7025                    Ok(token) => token,
7026                    Err(e) => {
7027                        dlg.finished(false);
7028                        return Err(common::Error::MissingToken(e));
7029                    }
7030                },
7031            };
7032            request_value_reader
7033                .seek(std::io::SeekFrom::Start(0))
7034                .unwrap();
7035            let mut req_result = {
7036                let client = &self.hub.client;
7037                dlg.pre_request();
7038                let mut req_builder = hyper::Request::builder()
7039                    .method(hyper::Method::POST)
7040                    .uri(url.as_str())
7041                    .header(USER_AGENT, self.hub._user_agent.clone());
7042
7043                if let Some(token) = token.as_ref() {
7044                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7045                }
7046
7047                let request = req_builder
7048                    .header(CONTENT_TYPE, json_mime_type.to_string())
7049                    .header(CONTENT_LENGTH, request_size as u64)
7050                    .body(common::to_body(
7051                        request_value_reader.get_ref().clone().into(),
7052                    ));
7053
7054                client.request(request.unwrap()).await
7055            };
7056
7057            match req_result {
7058                Err(err) => {
7059                    if let common::Retry::After(d) = dlg.http_error(&err) {
7060                        sleep(d).await;
7061                        continue;
7062                    }
7063                    dlg.finished(false);
7064                    return Err(common::Error::HttpError(err));
7065                }
7066                Ok(res) => {
7067                    let (mut parts, body) = res.into_parts();
7068                    let mut body = common::Body::new(body);
7069                    if !parts.status.is_success() {
7070                        let bytes = common::to_bytes(body).await.unwrap_or_default();
7071                        let error = serde_json::from_str(&common::to_string(&bytes));
7072                        let response = common::to_response(parts, bytes.into());
7073
7074                        if let common::Retry::After(d) =
7075                            dlg.http_failure(&response, error.as_ref().ok())
7076                        {
7077                            sleep(d).await;
7078                            continue;
7079                        }
7080
7081                        dlg.finished(false);
7082
7083                        return Err(match error {
7084                            Ok(value) => common::Error::BadRequest(value),
7085                            _ => common::Error::Failure(response),
7086                        });
7087                    }
7088                    let response = {
7089                        let bytes = common::to_bytes(body).await.unwrap_or_default();
7090                        let encoded = common::to_string(&bytes);
7091                        match serde_json::from_str(&encoded) {
7092                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
7093                            Err(error) => {
7094                                dlg.response_json_decode_error(&encoded, &error);
7095                                return Err(common::Error::JsonDecodeError(
7096                                    encoded.to_string(),
7097                                    error,
7098                                ));
7099                            }
7100                        }
7101                    };
7102
7103                    dlg.finished(true);
7104                    return Ok(response);
7105                }
7106            }
7107        }
7108    }
7109
7110    ///
7111    /// Sets the *request* property to the given value.
7112    ///
7113    /// Even though the property as already been set when instantiating this call,
7114    /// we provide this method for API completeness.
7115    pub fn request(
7116        mut self,
7117        new_value: GoogleAppsCloudidentityDevicesV1CancelWipeDeviceUserRequest,
7118    ) -> DeviceDeviceUserCancelWipeCall<'a, C> {
7119        self._request = new_value;
7120        self
7121    }
7122    /// Required. [Resource name](https://cloud.google.com/apis/design/resource_names) of the Device in format: `devices/{device}/deviceUsers/{device_user}`, where device is the unique ID assigned to the Device, and device_user is the unique ID assigned to the User.
7123    ///
7124    /// Sets the *name* path property to the given value.
7125    ///
7126    /// Even though the property as already been set when instantiating this call,
7127    /// we provide this method for API completeness.
7128    pub fn name(mut self, new_value: &str) -> DeviceDeviceUserCancelWipeCall<'a, C> {
7129        self._name = new_value.to_string();
7130        self
7131    }
7132    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7133    /// while executing the actual API request.
7134    ///
7135    /// ````text
7136    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
7137    /// ````
7138    ///
7139    /// Sets the *delegate* property to the given value.
7140    pub fn delegate(
7141        mut self,
7142        new_value: &'a mut dyn common::Delegate,
7143    ) -> DeviceDeviceUserCancelWipeCall<'a, C> {
7144        self._delegate = Some(new_value);
7145        self
7146    }
7147
7148    /// Set any additional parameter of the query string used in the request.
7149    /// It should be used to set parameters which are not yet available through their own
7150    /// setters.
7151    ///
7152    /// Please note that this method must not be used to set any of the known parameters
7153    /// which have their own setter method. If done anyway, the request will fail.
7154    ///
7155    /// # Additional Parameters
7156    ///
7157    /// * *$.xgafv* (query-string) - V1 error format.
7158    /// * *access_token* (query-string) - OAuth access token.
7159    /// * *alt* (query-string) - Data format for response.
7160    /// * *callback* (query-string) - JSONP
7161    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7162    /// * *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.
7163    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7164    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7165    /// * *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.
7166    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7167    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7168    pub fn param<T>(mut self, name: T, value: T) -> DeviceDeviceUserCancelWipeCall<'a, C>
7169    where
7170        T: AsRef<str>,
7171    {
7172        self._additional_params
7173            .insert(name.as_ref().to_string(), value.as_ref().to_string());
7174        self
7175    }
7176
7177    /// Identifies the authorization scope for the method you are building.
7178    ///
7179    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7180    /// [`Scope::CloudIdentityDevice`].
7181    ///
7182    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7183    /// tokens for more than one scope.
7184    ///
7185    /// Usually there is more than one suitable scope to authorize an operation, some of which may
7186    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7187    /// sufficient, a read-write scope will do as well.
7188    pub fn add_scope<St>(mut self, scope: St) -> DeviceDeviceUserCancelWipeCall<'a, C>
7189    where
7190        St: AsRef<str>,
7191    {
7192        self._scopes.insert(String::from(scope.as_ref()));
7193        self
7194    }
7195    /// Identifies the authorization scope(s) for the method you are building.
7196    ///
7197    /// See [`Self::add_scope()`] for details.
7198    pub fn add_scopes<I, St>(mut self, scopes: I) -> DeviceDeviceUserCancelWipeCall<'a, C>
7199    where
7200        I: IntoIterator<Item = St>,
7201        St: AsRef<str>,
7202    {
7203        self._scopes
7204            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7205        self
7206    }
7207
7208    /// Removes all scopes, and no default scope will be used either.
7209    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7210    /// for details).
7211    pub fn clear_scopes(mut self) -> DeviceDeviceUserCancelWipeCall<'a, C> {
7212        self._scopes.clear();
7213        self
7214    }
7215}
7216
7217/// Deletes the specified DeviceUser. This also revokes the user's access to device data.
7218///
7219/// A builder for the *deviceUsers.delete* method supported by a *device* resource.
7220/// It is not used directly, but through a [`DeviceMethods`] instance.
7221///
7222/// # Example
7223///
7224/// Instantiate a resource method builder
7225///
7226/// ```test_harness,no_run
7227/// # extern crate hyper;
7228/// # extern crate hyper_rustls;
7229/// # extern crate google_cloudidentity1 as cloudidentity1;
7230/// # async fn dox() {
7231/// # use cloudidentity1::{CloudIdentity, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7232///
7233/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7234/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
7235/// #     .with_native_roots()
7236/// #     .unwrap()
7237/// #     .https_only()
7238/// #     .enable_http2()
7239/// #     .build();
7240///
7241/// # let executor = hyper_util::rt::TokioExecutor::new();
7242/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
7243/// #     secret,
7244/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7245/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
7246/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
7247/// #     ),
7248/// # ).build().await.unwrap();
7249///
7250/// # let client = hyper_util::client::legacy::Client::builder(
7251/// #     hyper_util::rt::TokioExecutor::new()
7252/// # )
7253/// # .build(
7254/// #     hyper_rustls::HttpsConnectorBuilder::new()
7255/// #         .with_native_roots()
7256/// #         .unwrap()
7257/// #         .https_or_http()
7258/// #         .enable_http2()
7259/// #         .build()
7260/// # );
7261/// # let mut hub = CloudIdentity::new(client, auth);
7262/// // You can configure optional parameters by calling the respective setters at will, and
7263/// // execute the final call using `doit()`.
7264/// // Values shown here are possibly random and not representative !
7265/// let result = hub.devices().device_users_delete("name")
7266///              .customer("est")
7267///              .doit().await;
7268/// # }
7269/// ```
7270pub struct DeviceDeviceUserDeleteCall<'a, C>
7271where
7272    C: 'a,
7273{
7274    hub: &'a CloudIdentity<C>,
7275    _name: String,
7276    _customer: Option<String>,
7277    _delegate: Option<&'a mut dyn common::Delegate>,
7278    _additional_params: HashMap<String, String>,
7279    _scopes: BTreeSet<String>,
7280}
7281
7282impl<'a, C> common::CallBuilder for DeviceDeviceUserDeleteCall<'a, C> {}
7283
7284impl<'a, C> DeviceDeviceUserDeleteCall<'a, C>
7285where
7286    C: common::Connector,
7287{
7288    /// Perform the operation you have build so far.
7289    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
7290        use std::borrow::Cow;
7291        use std::io::{Read, Seek};
7292
7293        use common::{url::Params, ToParts};
7294        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7295
7296        let mut dd = common::DefaultDelegate;
7297        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7298        dlg.begin(common::MethodInfo {
7299            id: "cloudidentity.devices.deviceUsers.delete",
7300            http_method: hyper::Method::DELETE,
7301        });
7302
7303        for &field in ["alt", "name", "customer"].iter() {
7304            if self._additional_params.contains_key(field) {
7305                dlg.finished(false);
7306                return Err(common::Error::FieldClash(field));
7307            }
7308        }
7309
7310        let mut params = Params::with_capacity(4 + self._additional_params.len());
7311        params.push("name", self._name);
7312        if let Some(value) = self._customer.as_ref() {
7313            params.push("customer", value);
7314        }
7315
7316        params.extend(self._additional_params.iter());
7317
7318        params.push("alt", "json");
7319        let mut url = self.hub._base_url.clone() + "v1/{+name}";
7320        if self._scopes.is_empty() {
7321            self._scopes
7322                .insert(Scope::CloudIdentityDevice.as_ref().to_string());
7323        }
7324
7325        #[allow(clippy::single_element_loop)]
7326        for &(find_this, param_name) in [("{+name}", "name")].iter() {
7327            url = params.uri_replacement(url, param_name, find_this, true);
7328        }
7329        {
7330            let to_remove = ["name"];
7331            params.remove_params(&to_remove);
7332        }
7333
7334        let url = params.parse_with_url(&url);
7335
7336        loop {
7337            let token = match self
7338                .hub
7339                .auth
7340                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
7341                .await
7342            {
7343                Ok(token) => token,
7344                Err(e) => match dlg.token(e) {
7345                    Ok(token) => token,
7346                    Err(e) => {
7347                        dlg.finished(false);
7348                        return Err(common::Error::MissingToken(e));
7349                    }
7350                },
7351            };
7352            let mut req_result = {
7353                let client = &self.hub.client;
7354                dlg.pre_request();
7355                let mut req_builder = hyper::Request::builder()
7356                    .method(hyper::Method::DELETE)
7357                    .uri(url.as_str())
7358                    .header(USER_AGENT, self.hub._user_agent.clone());
7359
7360                if let Some(token) = token.as_ref() {
7361                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7362                }
7363
7364                let request = req_builder
7365                    .header(CONTENT_LENGTH, 0_u64)
7366                    .body(common::to_body::<String>(None));
7367
7368                client.request(request.unwrap()).await
7369            };
7370
7371            match req_result {
7372                Err(err) => {
7373                    if let common::Retry::After(d) = dlg.http_error(&err) {
7374                        sleep(d).await;
7375                        continue;
7376                    }
7377                    dlg.finished(false);
7378                    return Err(common::Error::HttpError(err));
7379                }
7380                Ok(res) => {
7381                    let (mut parts, body) = res.into_parts();
7382                    let mut body = common::Body::new(body);
7383                    if !parts.status.is_success() {
7384                        let bytes = common::to_bytes(body).await.unwrap_or_default();
7385                        let error = serde_json::from_str(&common::to_string(&bytes));
7386                        let response = common::to_response(parts, bytes.into());
7387
7388                        if let common::Retry::After(d) =
7389                            dlg.http_failure(&response, error.as_ref().ok())
7390                        {
7391                            sleep(d).await;
7392                            continue;
7393                        }
7394
7395                        dlg.finished(false);
7396
7397                        return Err(match error {
7398                            Ok(value) => common::Error::BadRequest(value),
7399                            _ => common::Error::Failure(response),
7400                        });
7401                    }
7402                    let response = {
7403                        let bytes = common::to_bytes(body).await.unwrap_or_default();
7404                        let encoded = common::to_string(&bytes);
7405                        match serde_json::from_str(&encoded) {
7406                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
7407                            Err(error) => {
7408                                dlg.response_json_decode_error(&encoded, &error);
7409                                return Err(common::Error::JsonDecodeError(
7410                                    encoded.to_string(),
7411                                    error,
7412                                ));
7413                            }
7414                        }
7415                    };
7416
7417                    dlg.finished(true);
7418                    return Ok(response);
7419                }
7420            }
7421        }
7422    }
7423
7424    /// Required. [Resource name](https://cloud.google.com/apis/design/resource_names) of the Device in format: `devices/{device}/deviceUsers/{device_user}`, where device is the unique ID assigned to the Device, and device_user is the unique ID assigned to the User.
7425    ///
7426    /// Sets the *name* path property to the given value.
7427    ///
7428    /// Even though the property as already been set when instantiating this call,
7429    /// we provide this method for API completeness.
7430    pub fn name(mut self, new_value: &str) -> DeviceDeviceUserDeleteCall<'a, C> {
7431        self._name = new_value.to_string();
7432        self
7433    }
7434    /// Optional. [Resource name](https://cloud.google.com/apis/design/resource_names) of the customer. If you're using this API for your own organization, use `customers/my_customer` If you're using this API to manage another organization, use `customers/{customer}`, where customer is the customer to whom the device belongs.
7435    ///
7436    /// Sets the *customer* query property to the given value.
7437    pub fn customer(mut self, new_value: &str) -> DeviceDeviceUserDeleteCall<'a, C> {
7438        self._customer = Some(new_value.to_string());
7439        self
7440    }
7441    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7442    /// while executing the actual API request.
7443    ///
7444    /// ````text
7445    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
7446    /// ````
7447    ///
7448    /// Sets the *delegate* property to the given value.
7449    pub fn delegate(
7450        mut self,
7451        new_value: &'a mut dyn common::Delegate,
7452    ) -> DeviceDeviceUserDeleteCall<'a, C> {
7453        self._delegate = Some(new_value);
7454        self
7455    }
7456
7457    /// Set any additional parameter of the query string used in the request.
7458    /// It should be used to set parameters which are not yet available through their own
7459    /// setters.
7460    ///
7461    /// Please note that this method must not be used to set any of the known parameters
7462    /// which have their own setter method. If done anyway, the request will fail.
7463    ///
7464    /// # Additional Parameters
7465    ///
7466    /// * *$.xgafv* (query-string) - V1 error format.
7467    /// * *access_token* (query-string) - OAuth access token.
7468    /// * *alt* (query-string) - Data format for response.
7469    /// * *callback* (query-string) - JSONP
7470    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7471    /// * *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.
7472    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7473    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7474    /// * *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.
7475    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7476    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7477    pub fn param<T>(mut self, name: T, value: T) -> DeviceDeviceUserDeleteCall<'a, C>
7478    where
7479        T: AsRef<str>,
7480    {
7481        self._additional_params
7482            .insert(name.as_ref().to_string(), value.as_ref().to_string());
7483        self
7484    }
7485
7486    /// Identifies the authorization scope for the method you are building.
7487    ///
7488    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7489    /// [`Scope::CloudIdentityDevice`].
7490    ///
7491    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7492    /// tokens for more than one scope.
7493    ///
7494    /// Usually there is more than one suitable scope to authorize an operation, some of which may
7495    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7496    /// sufficient, a read-write scope will do as well.
7497    pub fn add_scope<St>(mut self, scope: St) -> DeviceDeviceUserDeleteCall<'a, C>
7498    where
7499        St: AsRef<str>,
7500    {
7501        self._scopes.insert(String::from(scope.as_ref()));
7502        self
7503    }
7504    /// Identifies the authorization scope(s) for the method you are building.
7505    ///
7506    /// See [`Self::add_scope()`] for details.
7507    pub fn add_scopes<I, St>(mut self, scopes: I) -> DeviceDeviceUserDeleteCall<'a, C>
7508    where
7509        I: IntoIterator<Item = St>,
7510        St: AsRef<str>,
7511    {
7512        self._scopes
7513            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7514        self
7515    }
7516
7517    /// Removes all scopes, and no default scope will be used either.
7518    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7519    /// for details).
7520    pub fn clear_scopes(mut self) -> DeviceDeviceUserDeleteCall<'a, C> {
7521        self._scopes.clear();
7522        self
7523    }
7524}
7525
7526/// Retrieves the specified DeviceUser
7527///
7528/// A builder for the *deviceUsers.get* method supported by a *device* resource.
7529/// It is not used directly, but through a [`DeviceMethods`] instance.
7530///
7531/// # Example
7532///
7533/// Instantiate a resource method builder
7534///
7535/// ```test_harness,no_run
7536/// # extern crate hyper;
7537/// # extern crate hyper_rustls;
7538/// # extern crate google_cloudidentity1 as cloudidentity1;
7539/// # async fn dox() {
7540/// # use cloudidentity1::{CloudIdentity, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7541///
7542/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7543/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
7544/// #     .with_native_roots()
7545/// #     .unwrap()
7546/// #     .https_only()
7547/// #     .enable_http2()
7548/// #     .build();
7549///
7550/// # let executor = hyper_util::rt::TokioExecutor::new();
7551/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
7552/// #     secret,
7553/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7554/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
7555/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
7556/// #     ),
7557/// # ).build().await.unwrap();
7558///
7559/// # let client = hyper_util::client::legacy::Client::builder(
7560/// #     hyper_util::rt::TokioExecutor::new()
7561/// # )
7562/// # .build(
7563/// #     hyper_rustls::HttpsConnectorBuilder::new()
7564/// #         .with_native_roots()
7565/// #         .unwrap()
7566/// #         .https_or_http()
7567/// #         .enable_http2()
7568/// #         .build()
7569/// # );
7570/// # let mut hub = CloudIdentity::new(client, auth);
7571/// // You can configure optional parameters by calling the respective setters at will, and
7572/// // execute the final call using `doit()`.
7573/// // Values shown here are possibly random and not representative !
7574/// let result = hub.devices().device_users_get("name")
7575///              .customer("ipsum")
7576///              .doit().await;
7577/// # }
7578/// ```
7579pub struct DeviceDeviceUserGetCall<'a, C>
7580where
7581    C: 'a,
7582{
7583    hub: &'a CloudIdentity<C>,
7584    _name: String,
7585    _customer: Option<String>,
7586    _delegate: Option<&'a mut dyn common::Delegate>,
7587    _additional_params: HashMap<String, String>,
7588    _scopes: BTreeSet<String>,
7589}
7590
7591impl<'a, C> common::CallBuilder for DeviceDeviceUserGetCall<'a, C> {}
7592
7593impl<'a, C> DeviceDeviceUserGetCall<'a, C>
7594where
7595    C: common::Connector,
7596{
7597    /// Perform the operation you have build so far.
7598    pub async fn doit(
7599        mut self,
7600    ) -> common::Result<(common::Response, GoogleAppsCloudidentityDevicesV1DeviceUser)> {
7601        use std::borrow::Cow;
7602        use std::io::{Read, Seek};
7603
7604        use common::{url::Params, ToParts};
7605        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7606
7607        let mut dd = common::DefaultDelegate;
7608        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7609        dlg.begin(common::MethodInfo {
7610            id: "cloudidentity.devices.deviceUsers.get",
7611            http_method: hyper::Method::GET,
7612        });
7613
7614        for &field in ["alt", "name", "customer"].iter() {
7615            if self._additional_params.contains_key(field) {
7616                dlg.finished(false);
7617                return Err(common::Error::FieldClash(field));
7618            }
7619        }
7620
7621        let mut params = Params::with_capacity(4 + self._additional_params.len());
7622        params.push("name", self._name);
7623        if let Some(value) = self._customer.as_ref() {
7624            params.push("customer", value);
7625        }
7626
7627        params.extend(self._additional_params.iter());
7628
7629        params.push("alt", "json");
7630        let mut url = self.hub._base_url.clone() + "v1/{+name}";
7631        if self._scopes.is_empty() {
7632            self._scopes
7633                .insert(Scope::CloudIdentityDeviceReadonly.as_ref().to_string());
7634        }
7635
7636        #[allow(clippy::single_element_loop)]
7637        for &(find_this, param_name) in [("{+name}", "name")].iter() {
7638            url = params.uri_replacement(url, param_name, find_this, true);
7639        }
7640        {
7641            let to_remove = ["name"];
7642            params.remove_params(&to_remove);
7643        }
7644
7645        let url = params.parse_with_url(&url);
7646
7647        loop {
7648            let token = match self
7649                .hub
7650                .auth
7651                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
7652                .await
7653            {
7654                Ok(token) => token,
7655                Err(e) => match dlg.token(e) {
7656                    Ok(token) => token,
7657                    Err(e) => {
7658                        dlg.finished(false);
7659                        return Err(common::Error::MissingToken(e));
7660                    }
7661                },
7662            };
7663            let mut req_result = {
7664                let client = &self.hub.client;
7665                dlg.pre_request();
7666                let mut req_builder = hyper::Request::builder()
7667                    .method(hyper::Method::GET)
7668                    .uri(url.as_str())
7669                    .header(USER_AGENT, self.hub._user_agent.clone());
7670
7671                if let Some(token) = token.as_ref() {
7672                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7673                }
7674
7675                let request = req_builder
7676                    .header(CONTENT_LENGTH, 0_u64)
7677                    .body(common::to_body::<String>(None));
7678
7679                client.request(request.unwrap()).await
7680            };
7681
7682            match req_result {
7683                Err(err) => {
7684                    if let common::Retry::After(d) = dlg.http_error(&err) {
7685                        sleep(d).await;
7686                        continue;
7687                    }
7688                    dlg.finished(false);
7689                    return Err(common::Error::HttpError(err));
7690                }
7691                Ok(res) => {
7692                    let (mut parts, body) = res.into_parts();
7693                    let mut body = common::Body::new(body);
7694                    if !parts.status.is_success() {
7695                        let bytes = common::to_bytes(body).await.unwrap_or_default();
7696                        let error = serde_json::from_str(&common::to_string(&bytes));
7697                        let response = common::to_response(parts, bytes.into());
7698
7699                        if let common::Retry::After(d) =
7700                            dlg.http_failure(&response, error.as_ref().ok())
7701                        {
7702                            sleep(d).await;
7703                            continue;
7704                        }
7705
7706                        dlg.finished(false);
7707
7708                        return Err(match error {
7709                            Ok(value) => common::Error::BadRequest(value),
7710                            _ => common::Error::Failure(response),
7711                        });
7712                    }
7713                    let response = {
7714                        let bytes = common::to_bytes(body).await.unwrap_or_default();
7715                        let encoded = common::to_string(&bytes);
7716                        match serde_json::from_str(&encoded) {
7717                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
7718                            Err(error) => {
7719                                dlg.response_json_decode_error(&encoded, &error);
7720                                return Err(common::Error::JsonDecodeError(
7721                                    encoded.to_string(),
7722                                    error,
7723                                ));
7724                            }
7725                        }
7726                    };
7727
7728                    dlg.finished(true);
7729                    return Ok(response);
7730                }
7731            }
7732        }
7733    }
7734
7735    /// Required. [Resource name](https://cloud.google.com/apis/design/resource_names) of the Device in format: `devices/{device}/deviceUsers/{device_user}`, where device is the unique ID assigned to the Device, and device_user is the unique ID assigned to the User.
7736    ///
7737    /// Sets the *name* path property to the given value.
7738    ///
7739    /// Even though the property as already been set when instantiating this call,
7740    /// we provide this method for API completeness.
7741    pub fn name(mut self, new_value: &str) -> DeviceDeviceUserGetCall<'a, C> {
7742        self._name = new_value.to_string();
7743        self
7744    }
7745    /// Optional. [Resource name](https://cloud.google.com/apis/design/resource_names) of the customer. If you're using this API for your own organization, use `customers/my_customer` If you're using this API to manage another organization, use `customers/{customer}`, where customer is the customer to whom the device belongs.
7746    ///
7747    /// Sets the *customer* query property to the given value.
7748    pub fn customer(mut self, new_value: &str) -> DeviceDeviceUserGetCall<'a, C> {
7749        self._customer = Some(new_value.to_string());
7750        self
7751    }
7752    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7753    /// while executing the actual API request.
7754    ///
7755    /// ````text
7756    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
7757    /// ````
7758    ///
7759    /// Sets the *delegate* property to the given value.
7760    pub fn delegate(
7761        mut self,
7762        new_value: &'a mut dyn common::Delegate,
7763    ) -> DeviceDeviceUserGetCall<'a, C> {
7764        self._delegate = Some(new_value);
7765        self
7766    }
7767
7768    /// Set any additional parameter of the query string used in the request.
7769    /// It should be used to set parameters which are not yet available through their own
7770    /// setters.
7771    ///
7772    /// Please note that this method must not be used to set any of the known parameters
7773    /// which have their own setter method. If done anyway, the request will fail.
7774    ///
7775    /// # Additional Parameters
7776    ///
7777    /// * *$.xgafv* (query-string) - V1 error format.
7778    /// * *access_token* (query-string) - OAuth access token.
7779    /// * *alt* (query-string) - Data format for response.
7780    /// * *callback* (query-string) - JSONP
7781    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7782    /// * *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.
7783    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7784    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7785    /// * *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.
7786    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7787    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7788    pub fn param<T>(mut self, name: T, value: T) -> DeviceDeviceUserGetCall<'a, C>
7789    where
7790        T: AsRef<str>,
7791    {
7792        self._additional_params
7793            .insert(name.as_ref().to_string(), value.as_ref().to_string());
7794        self
7795    }
7796
7797    /// Identifies the authorization scope for the method you are building.
7798    ///
7799    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7800    /// [`Scope::CloudIdentityDeviceReadonly`].
7801    ///
7802    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7803    /// tokens for more than one scope.
7804    ///
7805    /// Usually there is more than one suitable scope to authorize an operation, some of which may
7806    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7807    /// sufficient, a read-write scope will do as well.
7808    pub fn add_scope<St>(mut self, scope: St) -> DeviceDeviceUserGetCall<'a, C>
7809    where
7810        St: AsRef<str>,
7811    {
7812        self._scopes.insert(String::from(scope.as_ref()));
7813        self
7814    }
7815    /// Identifies the authorization scope(s) for the method you are building.
7816    ///
7817    /// See [`Self::add_scope()`] for details.
7818    pub fn add_scopes<I, St>(mut self, scopes: I) -> DeviceDeviceUserGetCall<'a, C>
7819    where
7820        I: IntoIterator<Item = St>,
7821        St: AsRef<str>,
7822    {
7823        self._scopes
7824            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7825        self
7826    }
7827
7828    /// Removes all scopes, and no default scope will be used either.
7829    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7830    /// for details).
7831    pub fn clear_scopes(mut self) -> DeviceDeviceUserGetCall<'a, C> {
7832        self._scopes.clear();
7833        self
7834    }
7835}
7836
7837/// Lists/Searches DeviceUsers.
7838///
7839/// A builder for the *deviceUsers.list* method supported by a *device* resource.
7840/// It is not used directly, but through a [`DeviceMethods`] instance.
7841///
7842/// # Example
7843///
7844/// Instantiate a resource method builder
7845///
7846/// ```test_harness,no_run
7847/// # extern crate hyper;
7848/// # extern crate hyper_rustls;
7849/// # extern crate google_cloudidentity1 as cloudidentity1;
7850/// # async fn dox() {
7851/// # use cloudidentity1::{CloudIdentity, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7852///
7853/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7854/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
7855/// #     .with_native_roots()
7856/// #     .unwrap()
7857/// #     .https_only()
7858/// #     .enable_http2()
7859/// #     .build();
7860///
7861/// # let executor = hyper_util::rt::TokioExecutor::new();
7862/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
7863/// #     secret,
7864/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7865/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
7866/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
7867/// #     ),
7868/// # ).build().await.unwrap();
7869///
7870/// # let client = hyper_util::client::legacy::Client::builder(
7871/// #     hyper_util::rt::TokioExecutor::new()
7872/// # )
7873/// # .build(
7874/// #     hyper_rustls::HttpsConnectorBuilder::new()
7875/// #         .with_native_roots()
7876/// #         .unwrap()
7877/// #         .https_or_http()
7878/// #         .enable_http2()
7879/// #         .build()
7880/// # );
7881/// # let mut hub = CloudIdentity::new(client, auth);
7882/// // You can configure optional parameters by calling the respective setters at will, and
7883/// // execute the final call using `doit()`.
7884/// // Values shown here are possibly random and not representative !
7885/// let result = hub.devices().device_users_list("parent")
7886///              .page_token("gubergren")
7887///              .page_size(-17)
7888///              .order_by("dolor")
7889///              .filter("Lorem")
7890///              .customer("eos")
7891///              .doit().await;
7892/// # }
7893/// ```
7894pub struct DeviceDeviceUserListCall<'a, C>
7895where
7896    C: 'a,
7897{
7898    hub: &'a CloudIdentity<C>,
7899    _parent: String,
7900    _page_token: Option<String>,
7901    _page_size: Option<i32>,
7902    _order_by: Option<String>,
7903    _filter: Option<String>,
7904    _customer: Option<String>,
7905    _delegate: Option<&'a mut dyn common::Delegate>,
7906    _additional_params: HashMap<String, String>,
7907    _scopes: BTreeSet<String>,
7908}
7909
7910impl<'a, C> common::CallBuilder for DeviceDeviceUserListCall<'a, C> {}
7911
7912impl<'a, C> DeviceDeviceUserListCall<'a, C>
7913where
7914    C: common::Connector,
7915{
7916    /// Perform the operation you have build so far.
7917    pub async fn doit(
7918        mut self,
7919    ) -> common::Result<(
7920        common::Response,
7921        GoogleAppsCloudidentityDevicesV1ListDeviceUsersResponse,
7922    )> {
7923        use std::borrow::Cow;
7924        use std::io::{Read, Seek};
7925
7926        use common::{url::Params, ToParts};
7927        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7928
7929        let mut dd = common::DefaultDelegate;
7930        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7931        dlg.begin(common::MethodInfo {
7932            id: "cloudidentity.devices.deviceUsers.list",
7933            http_method: hyper::Method::GET,
7934        });
7935
7936        for &field in [
7937            "alt",
7938            "parent",
7939            "pageToken",
7940            "pageSize",
7941            "orderBy",
7942            "filter",
7943            "customer",
7944        ]
7945        .iter()
7946        {
7947            if self._additional_params.contains_key(field) {
7948                dlg.finished(false);
7949                return Err(common::Error::FieldClash(field));
7950            }
7951        }
7952
7953        let mut params = Params::with_capacity(8 + self._additional_params.len());
7954        params.push("parent", self._parent);
7955        if let Some(value) = self._page_token.as_ref() {
7956            params.push("pageToken", value);
7957        }
7958        if let Some(value) = self._page_size.as_ref() {
7959            params.push("pageSize", value.to_string());
7960        }
7961        if let Some(value) = self._order_by.as_ref() {
7962            params.push("orderBy", value);
7963        }
7964        if let Some(value) = self._filter.as_ref() {
7965            params.push("filter", value);
7966        }
7967        if let Some(value) = self._customer.as_ref() {
7968            params.push("customer", value);
7969        }
7970
7971        params.extend(self._additional_params.iter());
7972
7973        params.push("alt", "json");
7974        let mut url = self.hub._base_url.clone() + "v1/{+parent}/deviceUsers";
7975        if self._scopes.is_empty() {
7976            self._scopes
7977                .insert(Scope::CloudIdentityDeviceReadonly.as_ref().to_string());
7978        }
7979
7980        #[allow(clippy::single_element_loop)]
7981        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
7982            url = params.uri_replacement(url, param_name, find_this, true);
7983        }
7984        {
7985            let to_remove = ["parent"];
7986            params.remove_params(&to_remove);
7987        }
7988
7989        let url = params.parse_with_url(&url);
7990
7991        loop {
7992            let token = match self
7993                .hub
7994                .auth
7995                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
7996                .await
7997            {
7998                Ok(token) => token,
7999                Err(e) => match dlg.token(e) {
8000                    Ok(token) => token,
8001                    Err(e) => {
8002                        dlg.finished(false);
8003                        return Err(common::Error::MissingToken(e));
8004                    }
8005                },
8006            };
8007            let mut req_result = {
8008                let client = &self.hub.client;
8009                dlg.pre_request();
8010                let mut req_builder = hyper::Request::builder()
8011                    .method(hyper::Method::GET)
8012                    .uri(url.as_str())
8013                    .header(USER_AGENT, self.hub._user_agent.clone());
8014
8015                if let Some(token) = token.as_ref() {
8016                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8017                }
8018
8019                let request = req_builder
8020                    .header(CONTENT_LENGTH, 0_u64)
8021                    .body(common::to_body::<String>(None));
8022
8023                client.request(request.unwrap()).await
8024            };
8025
8026            match req_result {
8027                Err(err) => {
8028                    if let common::Retry::After(d) = dlg.http_error(&err) {
8029                        sleep(d).await;
8030                        continue;
8031                    }
8032                    dlg.finished(false);
8033                    return Err(common::Error::HttpError(err));
8034                }
8035                Ok(res) => {
8036                    let (mut parts, body) = res.into_parts();
8037                    let mut body = common::Body::new(body);
8038                    if !parts.status.is_success() {
8039                        let bytes = common::to_bytes(body).await.unwrap_or_default();
8040                        let error = serde_json::from_str(&common::to_string(&bytes));
8041                        let response = common::to_response(parts, bytes.into());
8042
8043                        if let common::Retry::After(d) =
8044                            dlg.http_failure(&response, error.as_ref().ok())
8045                        {
8046                            sleep(d).await;
8047                            continue;
8048                        }
8049
8050                        dlg.finished(false);
8051
8052                        return Err(match error {
8053                            Ok(value) => common::Error::BadRequest(value),
8054                            _ => common::Error::Failure(response),
8055                        });
8056                    }
8057                    let response = {
8058                        let bytes = common::to_bytes(body).await.unwrap_or_default();
8059                        let encoded = common::to_string(&bytes);
8060                        match serde_json::from_str(&encoded) {
8061                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8062                            Err(error) => {
8063                                dlg.response_json_decode_error(&encoded, &error);
8064                                return Err(common::Error::JsonDecodeError(
8065                                    encoded.to_string(),
8066                                    error,
8067                                ));
8068                            }
8069                        }
8070                    };
8071
8072                    dlg.finished(true);
8073                    return Ok(response);
8074                }
8075            }
8076        }
8077    }
8078
8079    /// Required. To list all DeviceUsers, set this to "devices/-". To list all DeviceUsers owned by a device, set this to the resource name of the device. Format: devices/{device}
8080    ///
8081    /// Sets the *parent* path property to the given value.
8082    ///
8083    /// Even though the property as already been set when instantiating this call,
8084    /// we provide this method for API completeness.
8085    pub fn parent(mut self, new_value: &str) -> DeviceDeviceUserListCall<'a, C> {
8086        self._parent = new_value.to_string();
8087        self
8088    }
8089    /// Optional. A page token, received from a previous `ListDeviceUsers` call. Provide this to retrieve the subsequent page. When paginating, all other parameters provided to `ListBooks` must match the call that provided the page token.
8090    ///
8091    /// Sets the *page token* query property to the given value.
8092    pub fn page_token(mut self, new_value: &str) -> DeviceDeviceUserListCall<'a, C> {
8093        self._page_token = Some(new_value.to_string());
8094        self
8095    }
8096    /// Optional. The maximum number of DeviceUsers to return. If unspecified, at most 5 DeviceUsers will be returned. The maximum value is 20; values above 20 will be coerced to 20.
8097    ///
8098    /// Sets the *page size* query property to the given value.
8099    pub fn page_size(mut self, new_value: i32) -> DeviceDeviceUserListCall<'a, C> {
8100        self._page_size = Some(new_value);
8101        self
8102    }
8103    /// Optional. Order specification for devices in the response.
8104    ///
8105    /// Sets the *order by* query property to the given value.
8106    pub fn order_by(mut self, new_value: &str) -> DeviceDeviceUserListCall<'a, C> {
8107        self._order_by = Some(new_value.to_string());
8108        self
8109    }
8110    /// Optional. Additional restrictions when fetching list of devices. For a list of search fields, refer to [Mobile device search fields](https://developers.google.com/admin-sdk/directory/v1/search-operators). Multiple search fields are separated by the space character.
8111    ///
8112    /// Sets the *filter* query property to the given value.
8113    pub fn filter(mut self, new_value: &str) -> DeviceDeviceUserListCall<'a, C> {
8114        self._filter = Some(new_value.to_string());
8115        self
8116    }
8117    /// Optional. [Resource name](https://cloud.google.com/apis/design/resource_names) of the customer. If you're using this API for your own organization, use `customers/my_customer` If you're using this API to manage another organization, use `customers/{customer}`, where customer is the customer to whom the device belongs.
8118    ///
8119    /// Sets the *customer* query property to the given value.
8120    pub fn customer(mut self, new_value: &str) -> DeviceDeviceUserListCall<'a, C> {
8121        self._customer = Some(new_value.to_string());
8122        self
8123    }
8124    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8125    /// while executing the actual API request.
8126    ///
8127    /// ````text
8128    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
8129    /// ````
8130    ///
8131    /// Sets the *delegate* property to the given value.
8132    pub fn delegate(
8133        mut self,
8134        new_value: &'a mut dyn common::Delegate,
8135    ) -> DeviceDeviceUserListCall<'a, C> {
8136        self._delegate = Some(new_value);
8137        self
8138    }
8139
8140    /// Set any additional parameter of the query string used in the request.
8141    /// It should be used to set parameters which are not yet available through their own
8142    /// setters.
8143    ///
8144    /// Please note that this method must not be used to set any of the known parameters
8145    /// which have their own setter method. If done anyway, the request will fail.
8146    ///
8147    /// # Additional Parameters
8148    ///
8149    /// * *$.xgafv* (query-string) - V1 error format.
8150    /// * *access_token* (query-string) - OAuth access token.
8151    /// * *alt* (query-string) - Data format for response.
8152    /// * *callback* (query-string) - JSONP
8153    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8154    /// * *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.
8155    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8156    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8157    /// * *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.
8158    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8159    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8160    pub fn param<T>(mut self, name: T, value: T) -> DeviceDeviceUserListCall<'a, C>
8161    where
8162        T: AsRef<str>,
8163    {
8164        self._additional_params
8165            .insert(name.as_ref().to_string(), value.as_ref().to_string());
8166        self
8167    }
8168
8169    /// Identifies the authorization scope for the method you are building.
8170    ///
8171    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
8172    /// [`Scope::CloudIdentityDeviceReadonly`].
8173    ///
8174    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
8175    /// tokens for more than one scope.
8176    ///
8177    /// Usually there is more than one suitable scope to authorize an operation, some of which may
8178    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
8179    /// sufficient, a read-write scope will do as well.
8180    pub fn add_scope<St>(mut self, scope: St) -> DeviceDeviceUserListCall<'a, C>
8181    where
8182        St: AsRef<str>,
8183    {
8184        self._scopes.insert(String::from(scope.as_ref()));
8185        self
8186    }
8187    /// Identifies the authorization scope(s) for the method you are building.
8188    ///
8189    /// See [`Self::add_scope()`] for details.
8190    pub fn add_scopes<I, St>(mut self, scopes: I) -> DeviceDeviceUserListCall<'a, C>
8191    where
8192        I: IntoIterator<Item = St>,
8193        St: AsRef<str>,
8194    {
8195        self._scopes
8196            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
8197        self
8198    }
8199
8200    /// Removes all scopes, and no default scope will be used either.
8201    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
8202    /// for details).
8203    pub fn clear_scopes(mut self) -> DeviceDeviceUserListCall<'a, C> {
8204        self._scopes.clear();
8205        self
8206    }
8207}
8208
8209/// Looks up resource names of the DeviceUsers associated with the caller's credentials, as well as the properties provided in the request. This method must be called with end-user credentials with the scope: https://www.googleapis.com/auth/cloud-identity.devices.lookup If multiple properties are provided, only DeviceUsers having all of these properties are considered as matches - i.e. the query behaves like an AND. Different platforms require different amounts of information from the caller to ensure that the DeviceUser is uniquely identified. - iOS: Specifying the 'partner' and 'ios_device_id' fields is required. - Android: Specifying the 'android_id' field is required. - Desktop: Specifying the 'raw_resource_id' field is required.
8210///
8211/// A builder for the *deviceUsers.lookup* method supported by a *device* resource.
8212/// It is not used directly, but through a [`DeviceMethods`] instance.
8213///
8214/// # Example
8215///
8216/// Instantiate a resource method builder
8217///
8218/// ```test_harness,no_run
8219/// # extern crate hyper;
8220/// # extern crate hyper_rustls;
8221/// # extern crate google_cloudidentity1 as cloudidentity1;
8222/// # async fn dox() {
8223/// # use cloudidentity1::{CloudIdentity, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8224///
8225/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
8226/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
8227/// #     .with_native_roots()
8228/// #     .unwrap()
8229/// #     .https_only()
8230/// #     .enable_http2()
8231/// #     .build();
8232///
8233/// # let executor = hyper_util::rt::TokioExecutor::new();
8234/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
8235/// #     secret,
8236/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8237/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
8238/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
8239/// #     ),
8240/// # ).build().await.unwrap();
8241///
8242/// # let client = hyper_util::client::legacy::Client::builder(
8243/// #     hyper_util::rt::TokioExecutor::new()
8244/// # )
8245/// # .build(
8246/// #     hyper_rustls::HttpsConnectorBuilder::new()
8247/// #         .with_native_roots()
8248/// #         .unwrap()
8249/// #         .https_or_http()
8250/// #         .enable_http2()
8251/// #         .build()
8252/// # );
8253/// # let mut hub = CloudIdentity::new(client, auth);
8254/// // You can configure optional parameters by calling the respective setters at will, and
8255/// // execute the final call using `doit()`.
8256/// // Values shown here are possibly random and not representative !
8257/// let result = hub.devices().device_users_lookup("parent")
8258///              .user_id("sed")
8259///              .raw_resource_id("duo")
8260///              .partner("sed")
8261///              .page_token("no")
8262///              .page_size(-15)
8263///              .ios_device_id("kasd")
8264///              .android_id("et")
8265///              .doit().await;
8266/// # }
8267/// ```
8268pub struct DeviceDeviceUserLookupCall<'a, C>
8269where
8270    C: 'a,
8271{
8272    hub: &'a CloudIdentity<C>,
8273    _parent: String,
8274    _user_id: Option<String>,
8275    _raw_resource_id: Option<String>,
8276    _partner: Option<String>,
8277    _page_token: Option<String>,
8278    _page_size: Option<i32>,
8279    _ios_device_id: Option<String>,
8280    _android_id: Option<String>,
8281    _delegate: Option<&'a mut dyn common::Delegate>,
8282    _additional_params: HashMap<String, String>,
8283    _scopes: BTreeSet<String>,
8284}
8285
8286impl<'a, C> common::CallBuilder for DeviceDeviceUserLookupCall<'a, C> {}
8287
8288impl<'a, C> DeviceDeviceUserLookupCall<'a, C>
8289where
8290    C: common::Connector,
8291{
8292    /// Perform the operation you have build so far.
8293    pub async fn doit(
8294        mut self,
8295    ) -> common::Result<(
8296        common::Response,
8297        GoogleAppsCloudidentityDevicesV1LookupSelfDeviceUsersResponse,
8298    )> {
8299        use std::borrow::Cow;
8300        use std::io::{Read, Seek};
8301
8302        use common::{url::Params, ToParts};
8303        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
8304
8305        let mut dd = common::DefaultDelegate;
8306        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
8307        dlg.begin(common::MethodInfo {
8308            id: "cloudidentity.devices.deviceUsers.lookup",
8309            http_method: hyper::Method::GET,
8310        });
8311
8312        for &field in [
8313            "alt",
8314            "parent",
8315            "userId",
8316            "rawResourceId",
8317            "partner",
8318            "pageToken",
8319            "pageSize",
8320            "iosDeviceId",
8321            "androidId",
8322        ]
8323        .iter()
8324        {
8325            if self._additional_params.contains_key(field) {
8326                dlg.finished(false);
8327                return Err(common::Error::FieldClash(field));
8328            }
8329        }
8330
8331        let mut params = Params::with_capacity(10 + self._additional_params.len());
8332        params.push("parent", self._parent);
8333        if let Some(value) = self._user_id.as_ref() {
8334            params.push("userId", value);
8335        }
8336        if let Some(value) = self._raw_resource_id.as_ref() {
8337            params.push("rawResourceId", value);
8338        }
8339        if let Some(value) = self._partner.as_ref() {
8340            params.push("partner", value);
8341        }
8342        if let Some(value) = self._page_token.as_ref() {
8343            params.push("pageToken", value);
8344        }
8345        if let Some(value) = self._page_size.as_ref() {
8346            params.push("pageSize", value.to_string());
8347        }
8348        if let Some(value) = self._ios_device_id.as_ref() {
8349            params.push("iosDeviceId", value);
8350        }
8351        if let Some(value) = self._android_id.as_ref() {
8352            params.push("androidId", value);
8353        }
8354
8355        params.extend(self._additional_params.iter());
8356
8357        params.push("alt", "json");
8358        let mut url = self.hub._base_url.clone() + "v1/{+parent}:lookup";
8359        if self._scopes.is_empty() {
8360            self._scopes
8361                .insert(Scope::CloudIdentityDeviceLookup.as_ref().to_string());
8362        }
8363
8364        #[allow(clippy::single_element_loop)]
8365        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
8366            url = params.uri_replacement(url, param_name, find_this, true);
8367        }
8368        {
8369            let to_remove = ["parent"];
8370            params.remove_params(&to_remove);
8371        }
8372
8373        let url = params.parse_with_url(&url);
8374
8375        loop {
8376            let token = match self
8377                .hub
8378                .auth
8379                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
8380                .await
8381            {
8382                Ok(token) => token,
8383                Err(e) => match dlg.token(e) {
8384                    Ok(token) => token,
8385                    Err(e) => {
8386                        dlg.finished(false);
8387                        return Err(common::Error::MissingToken(e));
8388                    }
8389                },
8390            };
8391            let mut req_result = {
8392                let client = &self.hub.client;
8393                dlg.pre_request();
8394                let mut req_builder = hyper::Request::builder()
8395                    .method(hyper::Method::GET)
8396                    .uri(url.as_str())
8397                    .header(USER_AGENT, self.hub._user_agent.clone());
8398
8399                if let Some(token) = token.as_ref() {
8400                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8401                }
8402
8403                let request = req_builder
8404                    .header(CONTENT_LENGTH, 0_u64)
8405                    .body(common::to_body::<String>(None));
8406
8407                client.request(request.unwrap()).await
8408            };
8409
8410            match req_result {
8411                Err(err) => {
8412                    if let common::Retry::After(d) = dlg.http_error(&err) {
8413                        sleep(d).await;
8414                        continue;
8415                    }
8416                    dlg.finished(false);
8417                    return Err(common::Error::HttpError(err));
8418                }
8419                Ok(res) => {
8420                    let (mut parts, body) = res.into_parts();
8421                    let mut body = common::Body::new(body);
8422                    if !parts.status.is_success() {
8423                        let bytes = common::to_bytes(body).await.unwrap_or_default();
8424                        let error = serde_json::from_str(&common::to_string(&bytes));
8425                        let response = common::to_response(parts, bytes.into());
8426
8427                        if let common::Retry::After(d) =
8428                            dlg.http_failure(&response, error.as_ref().ok())
8429                        {
8430                            sleep(d).await;
8431                            continue;
8432                        }
8433
8434                        dlg.finished(false);
8435
8436                        return Err(match error {
8437                            Ok(value) => common::Error::BadRequest(value),
8438                            _ => common::Error::Failure(response),
8439                        });
8440                    }
8441                    let response = {
8442                        let bytes = common::to_bytes(body).await.unwrap_or_default();
8443                        let encoded = common::to_string(&bytes);
8444                        match serde_json::from_str(&encoded) {
8445                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8446                            Err(error) => {
8447                                dlg.response_json_decode_error(&encoded, &error);
8448                                return Err(common::Error::JsonDecodeError(
8449                                    encoded.to_string(),
8450                                    error,
8451                                ));
8452                            }
8453                        }
8454                    };
8455
8456                    dlg.finished(true);
8457                    return Ok(response);
8458                }
8459            }
8460        }
8461    }
8462
8463    /// Must be set to "devices/-/deviceUsers" to search across all DeviceUser belonging to the user.
8464    ///
8465    /// Sets the *parent* path property to the given value.
8466    ///
8467    /// Even though the property as already been set when instantiating this call,
8468    /// we provide this method for API completeness.
8469    pub fn parent(mut self, new_value: &str) -> DeviceDeviceUserLookupCall<'a, C> {
8470        self._parent = new_value.to_string();
8471        self
8472    }
8473    /// The user whose DeviceUser's resource name will be fetched. Must be set to 'me' to fetch the DeviceUser's resource name for the calling user.
8474    ///
8475    /// Sets the *user id* query property to the given value.
8476    pub fn user_id(mut self, new_value: &str) -> DeviceDeviceUserLookupCall<'a, C> {
8477        self._user_id = Some(new_value.to_string());
8478        self
8479    }
8480    /// Raw Resource Id used by Google Endpoint Verification. If the user is enrolled into Google Endpoint Verification, this id will be saved as the 'device_resource_id' field in the following platform dependent files. Mac: ~/.secureConnect/context_aware_config.json Windows: C:\Users\%USERPROFILE%\.secureConnect\context_aware_config.json Linux: ~/.secureConnect/context_aware_config.json
8481    ///
8482    /// Sets the *raw resource id* query property to the given value.
8483    pub fn raw_resource_id(mut self, new_value: &str) -> DeviceDeviceUserLookupCall<'a, C> {
8484        self._raw_resource_id = Some(new_value.to_string());
8485        self
8486    }
8487    /// Optional. The partner ID of the calling iOS app. This string must match the value of the partner key within the app configuration dictionary provided to Google Workspace apps.
8488    ///
8489    /// Sets the *partner* query property to the given value.
8490    pub fn partner(mut self, new_value: &str) -> DeviceDeviceUserLookupCall<'a, C> {
8491        self._partner = Some(new_value.to_string());
8492        self
8493    }
8494    /// A page token, received from a previous `LookupDeviceUsers` call. Provide this to retrieve the subsequent page. When paginating, all other parameters provided to `LookupDeviceUsers` must match the call that provided the page token.
8495    ///
8496    /// Sets the *page token* query property to the given value.
8497    pub fn page_token(mut self, new_value: &str) -> DeviceDeviceUserLookupCall<'a, C> {
8498        self._page_token = Some(new_value.to_string());
8499        self
8500    }
8501    /// The maximum number of DeviceUsers to return. If unspecified, at most 20 DeviceUsers will be returned. The maximum value is 20; values above 20 will be coerced to 20.
8502    ///
8503    /// Sets the *page size* query property to the given value.
8504    pub fn page_size(mut self, new_value: i32) -> DeviceDeviceUserLookupCall<'a, C> {
8505        self._page_size = Some(new_value);
8506        self
8507    }
8508    /// Optional. The partner-specified device identifier assigned to the iOS device that initiated the Lookup API call. This string must match the value of the iosDeviceId key in the app config dictionary provided to Google Workspace apps.
8509    ///
8510    /// Sets the *ios device id* query property to the given value.
8511    pub fn ios_device_id(mut self, new_value: &str) -> DeviceDeviceUserLookupCall<'a, C> {
8512        self._ios_device_id = Some(new_value.to_string());
8513        self
8514    }
8515    /// Android Id returned by [Settings.Secure#ANDROID_ID](https://developer.android.com/reference/android/provider/Settings.Secure.html#ANDROID_ID).
8516    ///
8517    /// Sets the *android id* query property to the given value.
8518    pub fn android_id(mut self, new_value: &str) -> DeviceDeviceUserLookupCall<'a, C> {
8519        self._android_id = Some(new_value.to_string());
8520        self
8521    }
8522    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8523    /// while executing the actual API request.
8524    ///
8525    /// ````text
8526    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
8527    /// ````
8528    ///
8529    /// Sets the *delegate* property to the given value.
8530    pub fn delegate(
8531        mut self,
8532        new_value: &'a mut dyn common::Delegate,
8533    ) -> DeviceDeviceUserLookupCall<'a, C> {
8534        self._delegate = Some(new_value);
8535        self
8536    }
8537
8538    /// Set any additional parameter of the query string used in the request.
8539    /// It should be used to set parameters which are not yet available through their own
8540    /// setters.
8541    ///
8542    /// Please note that this method must not be used to set any of the known parameters
8543    /// which have their own setter method. If done anyway, the request will fail.
8544    ///
8545    /// # Additional Parameters
8546    ///
8547    /// * *$.xgafv* (query-string) - V1 error format.
8548    /// * *access_token* (query-string) - OAuth access token.
8549    /// * *alt* (query-string) - Data format for response.
8550    /// * *callback* (query-string) - JSONP
8551    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8552    /// * *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.
8553    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8554    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8555    /// * *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.
8556    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8557    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8558    pub fn param<T>(mut self, name: T, value: T) -> DeviceDeviceUserLookupCall<'a, C>
8559    where
8560        T: AsRef<str>,
8561    {
8562        self._additional_params
8563            .insert(name.as_ref().to_string(), value.as_ref().to_string());
8564        self
8565    }
8566
8567    /// Identifies the authorization scope for the method you are building.
8568    ///
8569    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
8570    /// [`Scope::CloudIdentityDeviceLookup`].
8571    ///
8572    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
8573    /// tokens for more than one scope.
8574    ///
8575    /// Usually there is more than one suitable scope to authorize an operation, some of which may
8576    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
8577    /// sufficient, a read-write scope will do as well.
8578    pub fn add_scope<St>(mut self, scope: St) -> DeviceDeviceUserLookupCall<'a, C>
8579    where
8580        St: AsRef<str>,
8581    {
8582        self._scopes.insert(String::from(scope.as_ref()));
8583        self
8584    }
8585    /// Identifies the authorization scope(s) for the method you are building.
8586    ///
8587    /// See [`Self::add_scope()`] for details.
8588    pub fn add_scopes<I, St>(mut self, scopes: I) -> DeviceDeviceUserLookupCall<'a, C>
8589    where
8590        I: IntoIterator<Item = St>,
8591        St: AsRef<str>,
8592    {
8593        self._scopes
8594            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
8595        self
8596    }
8597
8598    /// Removes all scopes, and no default scope will be used either.
8599    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
8600    /// for details).
8601    pub fn clear_scopes(mut self) -> DeviceDeviceUserLookupCall<'a, C> {
8602        self._scopes.clear();
8603        self
8604    }
8605}
8606
8607/// Wipes the user's account on a device. Other data on the device that is not associated with the user's work account is not affected. For example, if a Gmail app is installed on a device that is used for personal and work purposes, and the user is logged in to the Gmail app with their personal account as well as their work account, wiping the "deviceUser" by their work administrator will not affect their personal account within Gmail or other apps such as Photos.
8608///
8609/// A builder for the *deviceUsers.wipe* method supported by a *device* resource.
8610/// It is not used directly, but through a [`DeviceMethods`] instance.
8611///
8612/// # Example
8613///
8614/// Instantiate a resource method builder
8615///
8616/// ```test_harness,no_run
8617/// # extern crate hyper;
8618/// # extern crate hyper_rustls;
8619/// # extern crate google_cloudidentity1 as cloudidentity1;
8620/// use cloudidentity1::api::GoogleAppsCloudidentityDevicesV1WipeDeviceUserRequest;
8621/// # async fn dox() {
8622/// # use cloudidentity1::{CloudIdentity, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8623///
8624/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
8625/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
8626/// #     .with_native_roots()
8627/// #     .unwrap()
8628/// #     .https_only()
8629/// #     .enable_http2()
8630/// #     .build();
8631///
8632/// # let executor = hyper_util::rt::TokioExecutor::new();
8633/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
8634/// #     secret,
8635/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8636/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
8637/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
8638/// #     ),
8639/// # ).build().await.unwrap();
8640///
8641/// # let client = hyper_util::client::legacy::Client::builder(
8642/// #     hyper_util::rt::TokioExecutor::new()
8643/// # )
8644/// # .build(
8645/// #     hyper_rustls::HttpsConnectorBuilder::new()
8646/// #         .with_native_roots()
8647/// #         .unwrap()
8648/// #         .https_or_http()
8649/// #         .enable_http2()
8650/// #         .build()
8651/// # );
8652/// # let mut hub = CloudIdentity::new(client, auth);
8653/// // As the method needs a request, you would usually fill it with the desired information
8654/// // into the respective structure. Some of the parts shown here might not be applicable !
8655/// // Values shown here are possibly random and not representative !
8656/// let mut req = GoogleAppsCloudidentityDevicesV1WipeDeviceUserRequest::default();
8657///
8658/// // You can configure optional parameters by calling the respective setters at will, and
8659/// // execute the final call using `doit()`.
8660/// // Values shown here are possibly random and not representative !
8661/// let result = hub.devices().device_users_wipe(req, "name")
8662///              .doit().await;
8663/// # }
8664/// ```
8665pub struct DeviceDeviceUserWipeCall<'a, C>
8666where
8667    C: 'a,
8668{
8669    hub: &'a CloudIdentity<C>,
8670    _request: GoogleAppsCloudidentityDevicesV1WipeDeviceUserRequest,
8671    _name: String,
8672    _delegate: Option<&'a mut dyn common::Delegate>,
8673    _additional_params: HashMap<String, String>,
8674    _scopes: BTreeSet<String>,
8675}
8676
8677impl<'a, C> common::CallBuilder for DeviceDeviceUserWipeCall<'a, C> {}
8678
8679impl<'a, C> DeviceDeviceUserWipeCall<'a, C>
8680where
8681    C: common::Connector,
8682{
8683    /// Perform the operation you have build so far.
8684    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
8685        use std::borrow::Cow;
8686        use std::io::{Read, Seek};
8687
8688        use common::{url::Params, ToParts};
8689        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
8690
8691        let mut dd = common::DefaultDelegate;
8692        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
8693        dlg.begin(common::MethodInfo {
8694            id: "cloudidentity.devices.deviceUsers.wipe",
8695            http_method: hyper::Method::POST,
8696        });
8697
8698        for &field in ["alt", "name"].iter() {
8699            if self._additional_params.contains_key(field) {
8700                dlg.finished(false);
8701                return Err(common::Error::FieldClash(field));
8702            }
8703        }
8704
8705        let mut params = Params::with_capacity(4 + self._additional_params.len());
8706        params.push("name", self._name);
8707
8708        params.extend(self._additional_params.iter());
8709
8710        params.push("alt", "json");
8711        let mut url = self.hub._base_url.clone() + "v1/{+name}:wipe";
8712        if self._scopes.is_empty() {
8713            self._scopes
8714                .insert(Scope::CloudIdentityDevice.as_ref().to_string());
8715        }
8716
8717        #[allow(clippy::single_element_loop)]
8718        for &(find_this, param_name) in [("{+name}", "name")].iter() {
8719            url = params.uri_replacement(url, param_name, find_this, true);
8720        }
8721        {
8722            let to_remove = ["name"];
8723            params.remove_params(&to_remove);
8724        }
8725
8726        let url = params.parse_with_url(&url);
8727
8728        let mut json_mime_type = mime::APPLICATION_JSON;
8729        let mut request_value_reader = {
8730            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
8731            common::remove_json_null_values(&mut value);
8732            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
8733            serde_json::to_writer(&mut dst, &value).unwrap();
8734            dst
8735        };
8736        let request_size = request_value_reader
8737            .seek(std::io::SeekFrom::End(0))
8738            .unwrap();
8739        request_value_reader
8740            .seek(std::io::SeekFrom::Start(0))
8741            .unwrap();
8742
8743        loop {
8744            let token = match self
8745                .hub
8746                .auth
8747                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
8748                .await
8749            {
8750                Ok(token) => token,
8751                Err(e) => match dlg.token(e) {
8752                    Ok(token) => token,
8753                    Err(e) => {
8754                        dlg.finished(false);
8755                        return Err(common::Error::MissingToken(e));
8756                    }
8757                },
8758            };
8759            request_value_reader
8760                .seek(std::io::SeekFrom::Start(0))
8761                .unwrap();
8762            let mut req_result = {
8763                let client = &self.hub.client;
8764                dlg.pre_request();
8765                let mut req_builder = hyper::Request::builder()
8766                    .method(hyper::Method::POST)
8767                    .uri(url.as_str())
8768                    .header(USER_AGENT, self.hub._user_agent.clone());
8769
8770                if let Some(token) = token.as_ref() {
8771                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8772                }
8773
8774                let request = req_builder
8775                    .header(CONTENT_TYPE, json_mime_type.to_string())
8776                    .header(CONTENT_LENGTH, request_size as u64)
8777                    .body(common::to_body(
8778                        request_value_reader.get_ref().clone().into(),
8779                    ));
8780
8781                client.request(request.unwrap()).await
8782            };
8783
8784            match req_result {
8785                Err(err) => {
8786                    if let common::Retry::After(d) = dlg.http_error(&err) {
8787                        sleep(d).await;
8788                        continue;
8789                    }
8790                    dlg.finished(false);
8791                    return Err(common::Error::HttpError(err));
8792                }
8793                Ok(res) => {
8794                    let (mut parts, body) = res.into_parts();
8795                    let mut body = common::Body::new(body);
8796                    if !parts.status.is_success() {
8797                        let bytes = common::to_bytes(body).await.unwrap_or_default();
8798                        let error = serde_json::from_str(&common::to_string(&bytes));
8799                        let response = common::to_response(parts, bytes.into());
8800
8801                        if let common::Retry::After(d) =
8802                            dlg.http_failure(&response, error.as_ref().ok())
8803                        {
8804                            sleep(d).await;
8805                            continue;
8806                        }
8807
8808                        dlg.finished(false);
8809
8810                        return Err(match error {
8811                            Ok(value) => common::Error::BadRequest(value),
8812                            _ => common::Error::Failure(response),
8813                        });
8814                    }
8815                    let response = {
8816                        let bytes = common::to_bytes(body).await.unwrap_or_default();
8817                        let encoded = common::to_string(&bytes);
8818                        match serde_json::from_str(&encoded) {
8819                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8820                            Err(error) => {
8821                                dlg.response_json_decode_error(&encoded, &error);
8822                                return Err(common::Error::JsonDecodeError(
8823                                    encoded.to_string(),
8824                                    error,
8825                                ));
8826                            }
8827                        }
8828                    };
8829
8830                    dlg.finished(true);
8831                    return Ok(response);
8832                }
8833            }
8834        }
8835    }
8836
8837    ///
8838    /// Sets the *request* property to the given value.
8839    ///
8840    /// Even though the property as already been set when instantiating this call,
8841    /// we provide this method for API completeness.
8842    pub fn request(
8843        mut self,
8844        new_value: GoogleAppsCloudidentityDevicesV1WipeDeviceUserRequest,
8845    ) -> DeviceDeviceUserWipeCall<'a, C> {
8846        self._request = new_value;
8847        self
8848    }
8849    /// Required. [Resource name](https://cloud.google.com/apis/design/resource_names) of the Device in format: `devices/{device}/deviceUsers/{device_user}`, where device is the unique ID assigned to the Device, and device_user is the unique ID assigned to the User.
8850    ///
8851    /// Sets the *name* path property to the given value.
8852    ///
8853    /// Even though the property as already been set when instantiating this call,
8854    /// we provide this method for API completeness.
8855    pub fn name(mut self, new_value: &str) -> DeviceDeviceUserWipeCall<'a, C> {
8856        self._name = new_value.to_string();
8857        self
8858    }
8859    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8860    /// while executing the actual API request.
8861    ///
8862    /// ````text
8863    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
8864    /// ````
8865    ///
8866    /// Sets the *delegate* property to the given value.
8867    pub fn delegate(
8868        mut self,
8869        new_value: &'a mut dyn common::Delegate,
8870    ) -> DeviceDeviceUserWipeCall<'a, C> {
8871        self._delegate = Some(new_value);
8872        self
8873    }
8874
8875    /// Set any additional parameter of the query string used in the request.
8876    /// It should be used to set parameters which are not yet available through their own
8877    /// setters.
8878    ///
8879    /// Please note that this method must not be used to set any of the known parameters
8880    /// which have their own setter method. If done anyway, the request will fail.
8881    ///
8882    /// # Additional Parameters
8883    ///
8884    /// * *$.xgafv* (query-string) - V1 error format.
8885    /// * *access_token* (query-string) - OAuth access token.
8886    /// * *alt* (query-string) - Data format for response.
8887    /// * *callback* (query-string) - JSONP
8888    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8889    /// * *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.
8890    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8891    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8892    /// * *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.
8893    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8894    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8895    pub fn param<T>(mut self, name: T, value: T) -> DeviceDeviceUserWipeCall<'a, C>
8896    where
8897        T: AsRef<str>,
8898    {
8899        self._additional_params
8900            .insert(name.as_ref().to_string(), value.as_ref().to_string());
8901        self
8902    }
8903
8904    /// Identifies the authorization scope for the method you are building.
8905    ///
8906    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
8907    /// [`Scope::CloudIdentityDevice`].
8908    ///
8909    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
8910    /// tokens for more than one scope.
8911    ///
8912    /// Usually there is more than one suitable scope to authorize an operation, some of which may
8913    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
8914    /// sufficient, a read-write scope will do as well.
8915    pub fn add_scope<St>(mut self, scope: St) -> DeviceDeviceUserWipeCall<'a, C>
8916    where
8917        St: AsRef<str>,
8918    {
8919        self._scopes.insert(String::from(scope.as_ref()));
8920        self
8921    }
8922    /// Identifies the authorization scope(s) for the method you are building.
8923    ///
8924    /// See [`Self::add_scope()`] for details.
8925    pub fn add_scopes<I, St>(mut self, scopes: I) -> DeviceDeviceUserWipeCall<'a, C>
8926    where
8927        I: IntoIterator<Item = St>,
8928        St: AsRef<str>,
8929    {
8930        self._scopes
8931            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
8932        self
8933    }
8934
8935    /// Removes all scopes, and no default scope will be used either.
8936    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
8937    /// for details).
8938    pub fn clear_scopes(mut self) -> DeviceDeviceUserWipeCall<'a, C> {
8939        self._scopes.clear();
8940        self
8941    }
8942}
8943
8944/// Cancels an unfinished device wipe. This operation can be used to cancel device wipe in the gap between the wipe operation returning success and the device being wiped. This operation is possible when the device is in a "pending wipe" state. The device enters the "pending wipe" state when a wipe device command is issued, but has not yet been sent to the device. The cancel wipe will fail if the wipe command has already been issued to the device.
8945///
8946/// A builder for the *cancelWipe* method supported by a *device* resource.
8947/// It is not used directly, but through a [`DeviceMethods`] instance.
8948///
8949/// # Example
8950///
8951/// Instantiate a resource method builder
8952///
8953/// ```test_harness,no_run
8954/// # extern crate hyper;
8955/// # extern crate hyper_rustls;
8956/// # extern crate google_cloudidentity1 as cloudidentity1;
8957/// use cloudidentity1::api::GoogleAppsCloudidentityDevicesV1CancelWipeDeviceRequest;
8958/// # async fn dox() {
8959/// # use cloudidentity1::{CloudIdentity, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8960///
8961/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
8962/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
8963/// #     .with_native_roots()
8964/// #     .unwrap()
8965/// #     .https_only()
8966/// #     .enable_http2()
8967/// #     .build();
8968///
8969/// # let executor = hyper_util::rt::TokioExecutor::new();
8970/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
8971/// #     secret,
8972/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8973/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
8974/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
8975/// #     ),
8976/// # ).build().await.unwrap();
8977///
8978/// # let client = hyper_util::client::legacy::Client::builder(
8979/// #     hyper_util::rt::TokioExecutor::new()
8980/// # )
8981/// # .build(
8982/// #     hyper_rustls::HttpsConnectorBuilder::new()
8983/// #         .with_native_roots()
8984/// #         .unwrap()
8985/// #         .https_or_http()
8986/// #         .enable_http2()
8987/// #         .build()
8988/// # );
8989/// # let mut hub = CloudIdentity::new(client, auth);
8990/// // As the method needs a request, you would usually fill it with the desired information
8991/// // into the respective structure. Some of the parts shown here might not be applicable !
8992/// // Values shown here are possibly random and not representative !
8993/// let mut req = GoogleAppsCloudidentityDevicesV1CancelWipeDeviceRequest::default();
8994///
8995/// // You can configure optional parameters by calling the respective setters at will, and
8996/// // execute the final call using `doit()`.
8997/// // Values shown here are possibly random and not representative !
8998/// let result = hub.devices().cancel_wipe(req, "name")
8999///              .doit().await;
9000/// # }
9001/// ```
9002pub struct DeviceCancelWipeCall<'a, C>
9003where
9004    C: 'a,
9005{
9006    hub: &'a CloudIdentity<C>,
9007    _request: GoogleAppsCloudidentityDevicesV1CancelWipeDeviceRequest,
9008    _name: String,
9009    _delegate: Option<&'a mut dyn common::Delegate>,
9010    _additional_params: HashMap<String, String>,
9011    _scopes: BTreeSet<String>,
9012}
9013
9014impl<'a, C> common::CallBuilder for DeviceCancelWipeCall<'a, C> {}
9015
9016impl<'a, C> DeviceCancelWipeCall<'a, C>
9017where
9018    C: common::Connector,
9019{
9020    /// Perform the operation you have build so far.
9021    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
9022        use std::borrow::Cow;
9023        use std::io::{Read, Seek};
9024
9025        use common::{url::Params, ToParts};
9026        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
9027
9028        let mut dd = common::DefaultDelegate;
9029        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
9030        dlg.begin(common::MethodInfo {
9031            id: "cloudidentity.devices.cancelWipe",
9032            http_method: hyper::Method::POST,
9033        });
9034
9035        for &field in ["alt", "name"].iter() {
9036            if self._additional_params.contains_key(field) {
9037                dlg.finished(false);
9038                return Err(common::Error::FieldClash(field));
9039            }
9040        }
9041
9042        let mut params = Params::with_capacity(4 + self._additional_params.len());
9043        params.push("name", self._name);
9044
9045        params.extend(self._additional_params.iter());
9046
9047        params.push("alt", "json");
9048        let mut url = self.hub._base_url.clone() + "v1/{+name}:cancelWipe";
9049        if self._scopes.is_empty() {
9050            self._scopes
9051                .insert(Scope::CloudIdentityDevice.as_ref().to_string());
9052        }
9053
9054        #[allow(clippy::single_element_loop)]
9055        for &(find_this, param_name) in [("{+name}", "name")].iter() {
9056            url = params.uri_replacement(url, param_name, find_this, true);
9057        }
9058        {
9059            let to_remove = ["name"];
9060            params.remove_params(&to_remove);
9061        }
9062
9063        let url = params.parse_with_url(&url);
9064
9065        let mut json_mime_type = mime::APPLICATION_JSON;
9066        let mut request_value_reader = {
9067            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
9068            common::remove_json_null_values(&mut value);
9069            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
9070            serde_json::to_writer(&mut dst, &value).unwrap();
9071            dst
9072        };
9073        let request_size = request_value_reader
9074            .seek(std::io::SeekFrom::End(0))
9075            .unwrap();
9076        request_value_reader
9077            .seek(std::io::SeekFrom::Start(0))
9078            .unwrap();
9079
9080        loop {
9081            let token = match self
9082                .hub
9083                .auth
9084                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
9085                .await
9086            {
9087                Ok(token) => token,
9088                Err(e) => match dlg.token(e) {
9089                    Ok(token) => token,
9090                    Err(e) => {
9091                        dlg.finished(false);
9092                        return Err(common::Error::MissingToken(e));
9093                    }
9094                },
9095            };
9096            request_value_reader
9097                .seek(std::io::SeekFrom::Start(0))
9098                .unwrap();
9099            let mut req_result = {
9100                let client = &self.hub.client;
9101                dlg.pre_request();
9102                let mut req_builder = hyper::Request::builder()
9103                    .method(hyper::Method::POST)
9104                    .uri(url.as_str())
9105                    .header(USER_AGENT, self.hub._user_agent.clone());
9106
9107                if let Some(token) = token.as_ref() {
9108                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
9109                }
9110
9111                let request = req_builder
9112                    .header(CONTENT_TYPE, json_mime_type.to_string())
9113                    .header(CONTENT_LENGTH, request_size as u64)
9114                    .body(common::to_body(
9115                        request_value_reader.get_ref().clone().into(),
9116                    ));
9117
9118                client.request(request.unwrap()).await
9119            };
9120
9121            match req_result {
9122                Err(err) => {
9123                    if let common::Retry::After(d) = dlg.http_error(&err) {
9124                        sleep(d).await;
9125                        continue;
9126                    }
9127                    dlg.finished(false);
9128                    return Err(common::Error::HttpError(err));
9129                }
9130                Ok(res) => {
9131                    let (mut parts, body) = res.into_parts();
9132                    let mut body = common::Body::new(body);
9133                    if !parts.status.is_success() {
9134                        let bytes = common::to_bytes(body).await.unwrap_or_default();
9135                        let error = serde_json::from_str(&common::to_string(&bytes));
9136                        let response = common::to_response(parts, bytes.into());
9137
9138                        if let common::Retry::After(d) =
9139                            dlg.http_failure(&response, error.as_ref().ok())
9140                        {
9141                            sleep(d).await;
9142                            continue;
9143                        }
9144
9145                        dlg.finished(false);
9146
9147                        return Err(match error {
9148                            Ok(value) => common::Error::BadRequest(value),
9149                            _ => common::Error::Failure(response),
9150                        });
9151                    }
9152                    let response = {
9153                        let bytes = common::to_bytes(body).await.unwrap_or_default();
9154                        let encoded = common::to_string(&bytes);
9155                        match serde_json::from_str(&encoded) {
9156                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
9157                            Err(error) => {
9158                                dlg.response_json_decode_error(&encoded, &error);
9159                                return Err(common::Error::JsonDecodeError(
9160                                    encoded.to_string(),
9161                                    error,
9162                                ));
9163                            }
9164                        }
9165                    };
9166
9167                    dlg.finished(true);
9168                    return Ok(response);
9169                }
9170            }
9171        }
9172    }
9173
9174    ///
9175    /// Sets the *request* property to the given value.
9176    ///
9177    /// Even though the property as already been set when instantiating this call,
9178    /// we provide this method for API completeness.
9179    pub fn request(
9180        mut self,
9181        new_value: GoogleAppsCloudidentityDevicesV1CancelWipeDeviceRequest,
9182    ) -> DeviceCancelWipeCall<'a, C> {
9183        self._request = new_value;
9184        self
9185    }
9186    /// Required. [Resource name](https://cloud.google.com/apis/design/resource_names) of the Device in format: `devices/{device}`, where device is the unique ID assigned to the Device.
9187    ///
9188    /// Sets the *name* path property to the given value.
9189    ///
9190    /// Even though the property as already been set when instantiating this call,
9191    /// we provide this method for API completeness.
9192    pub fn name(mut self, new_value: &str) -> DeviceCancelWipeCall<'a, C> {
9193        self._name = new_value.to_string();
9194        self
9195    }
9196    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
9197    /// while executing the actual API request.
9198    ///
9199    /// ````text
9200    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
9201    /// ````
9202    ///
9203    /// Sets the *delegate* property to the given value.
9204    pub fn delegate(
9205        mut self,
9206        new_value: &'a mut dyn common::Delegate,
9207    ) -> DeviceCancelWipeCall<'a, C> {
9208        self._delegate = Some(new_value);
9209        self
9210    }
9211
9212    /// Set any additional parameter of the query string used in the request.
9213    /// It should be used to set parameters which are not yet available through their own
9214    /// setters.
9215    ///
9216    /// Please note that this method must not be used to set any of the known parameters
9217    /// which have their own setter method. If done anyway, the request will fail.
9218    ///
9219    /// # Additional Parameters
9220    ///
9221    /// * *$.xgafv* (query-string) - V1 error format.
9222    /// * *access_token* (query-string) - OAuth access token.
9223    /// * *alt* (query-string) - Data format for response.
9224    /// * *callback* (query-string) - JSONP
9225    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
9226    /// * *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.
9227    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
9228    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
9229    /// * *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.
9230    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
9231    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
9232    pub fn param<T>(mut self, name: T, value: T) -> DeviceCancelWipeCall<'a, C>
9233    where
9234        T: AsRef<str>,
9235    {
9236        self._additional_params
9237            .insert(name.as_ref().to_string(), value.as_ref().to_string());
9238        self
9239    }
9240
9241    /// Identifies the authorization scope for the method you are building.
9242    ///
9243    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
9244    /// [`Scope::CloudIdentityDevice`].
9245    ///
9246    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
9247    /// tokens for more than one scope.
9248    ///
9249    /// Usually there is more than one suitable scope to authorize an operation, some of which may
9250    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
9251    /// sufficient, a read-write scope will do as well.
9252    pub fn add_scope<St>(mut self, scope: St) -> DeviceCancelWipeCall<'a, C>
9253    where
9254        St: AsRef<str>,
9255    {
9256        self._scopes.insert(String::from(scope.as_ref()));
9257        self
9258    }
9259    /// Identifies the authorization scope(s) for the method you are building.
9260    ///
9261    /// See [`Self::add_scope()`] for details.
9262    pub fn add_scopes<I, St>(mut self, scopes: I) -> DeviceCancelWipeCall<'a, C>
9263    where
9264        I: IntoIterator<Item = St>,
9265        St: AsRef<str>,
9266    {
9267        self._scopes
9268            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
9269        self
9270    }
9271
9272    /// Removes all scopes, and no default scope will be used either.
9273    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
9274    /// for details).
9275    pub fn clear_scopes(mut self) -> DeviceCancelWipeCall<'a, C> {
9276        self._scopes.clear();
9277        self
9278    }
9279}
9280
9281/// Creates a device. Only company-owned device may be created. **Note**: This method is available only to customers who have one of the following SKUs: Enterprise Standard, Enterprise Plus, Enterprise for Education, and Cloud Identity Premium
9282///
9283/// A builder for the *create* method supported by a *device* resource.
9284/// It is not used directly, but through a [`DeviceMethods`] instance.
9285///
9286/// # Example
9287///
9288/// Instantiate a resource method builder
9289///
9290/// ```test_harness,no_run
9291/// # extern crate hyper;
9292/// # extern crate hyper_rustls;
9293/// # extern crate google_cloudidentity1 as cloudidentity1;
9294/// use cloudidentity1::api::GoogleAppsCloudidentityDevicesV1Device;
9295/// # async fn dox() {
9296/// # use cloudidentity1::{CloudIdentity, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9297///
9298/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
9299/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
9300/// #     .with_native_roots()
9301/// #     .unwrap()
9302/// #     .https_only()
9303/// #     .enable_http2()
9304/// #     .build();
9305///
9306/// # let executor = hyper_util::rt::TokioExecutor::new();
9307/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
9308/// #     secret,
9309/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9310/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
9311/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
9312/// #     ),
9313/// # ).build().await.unwrap();
9314///
9315/// # let client = hyper_util::client::legacy::Client::builder(
9316/// #     hyper_util::rt::TokioExecutor::new()
9317/// # )
9318/// # .build(
9319/// #     hyper_rustls::HttpsConnectorBuilder::new()
9320/// #         .with_native_roots()
9321/// #         .unwrap()
9322/// #         .https_or_http()
9323/// #         .enable_http2()
9324/// #         .build()
9325/// # );
9326/// # let mut hub = CloudIdentity::new(client, auth);
9327/// // As the method needs a request, you would usually fill it with the desired information
9328/// // into the respective structure. Some of the parts shown here might not be applicable !
9329/// // Values shown here are possibly random and not representative !
9330/// let mut req = GoogleAppsCloudidentityDevicesV1Device::default();
9331///
9332/// // You can configure optional parameters by calling the respective setters at will, and
9333/// // execute the final call using `doit()`.
9334/// // Values shown here are possibly random and not representative !
9335/// let result = hub.devices().create(req)
9336///              .customer("et")
9337///              .doit().await;
9338/// # }
9339/// ```
9340pub struct DeviceCreateCall<'a, C>
9341where
9342    C: 'a,
9343{
9344    hub: &'a CloudIdentity<C>,
9345    _request: GoogleAppsCloudidentityDevicesV1Device,
9346    _customer: Option<String>,
9347    _delegate: Option<&'a mut dyn common::Delegate>,
9348    _additional_params: HashMap<String, String>,
9349    _scopes: BTreeSet<String>,
9350}
9351
9352impl<'a, C> common::CallBuilder for DeviceCreateCall<'a, C> {}
9353
9354impl<'a, C> DeviceCreateCall<'a, C>
9355where
9356    C: common::Connector,
9357{
9358    /// Perform the operation you have build so far.
9359    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
9360        use std::borrow::Cow;
9361        use std::io::{Read, Seek};
9362
9363        use common::{url::Params, ToParts};
9364        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
9365
9366        let mut dd = common::DefaultDelegate;
9367        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
9368        dlg.begin(common::MethodInfo {
9369            id: "cloudidentity.devices.create",
9370            http_method: hyper::Method::POST,
9371        });
9372
9373        for &field in ["alt", "customer"].iter() {
9374            if self._additional_params.contains_key(field) {
9375                dlg.finished(false);
9376                return Err(common::Error::FieldClash(field));
9377            }
9378        }
9379
9380        let mut params = Params::with_capacity(4 + self._additional_params.len());
9381        if let Some(value) = self._customer.as_ref() {
9382            params.push("customer", value);
9383        }
9384
9385        params.extend(self._additional_params.iter());
9386
9387        params.push("alt", "json");
9388        let mut url = self.hub._base_url.clone() + "v1/devices";
9389        if self._scopes.is_empty() {
9390            self._scopes
9391                .insert(Scope::CloudIdentityDevice.as_ref().to_string());
9392        }
9393
9394        let url = params.parse_with_url(&url);
9395
9396        let mut json_mime_type = mime::APPLICATION_JSON;
9397        let mut request_value_reader = {
9398            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
9399            common::remove_json_null_values(&mut value);
9400            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
9401            serde_json::to_writer(&mut dst, &value).unwrap();
9402            dst
9403        };
9404        let request_size = request_value_reader
9405            .seek(std::io::SeekFrom::End(0))
9406            .unwrap();
9407        request_value_reader
9408            .seek(std::io::SeekFrom::Start(0))
9409            .unwrap();
9410
9411        loop {
9412            let token = match self
9413                .hub
9414                .auth
9415                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
9416                .await
9417            {
9418                Ok(token) => token,
9419                Err(e) => match dlg.token(e) {
9420                    Ok(token) => token,
9421                    Err(e) => {
9422                        dlg.finished(false);
9423                        return Err(common::Error::MissingToken(e));
9424                    }
9425                },
9426            };
9427            request_value_reader
9428                .seek(std::io::SeekFrom::Start(0))
9429                .unwrap();
9430            let mut req_result = {
9431                let client = &self.hub.client;
9432                dlg.pre_request();
9433                let mut req_builder = hyper::Request::builder()
9434                    .method(hyper::Method::POST)
9435                    .uri(url.as_str())
9436                    .header(USER_AGENT, self.hub._user_agent.clone());
9437
9438                if let Some(token) = token.as_ref() {
9439                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
9440                }
9441
9442                let request = req_builder
9443                    .header(CONTENT_TYPE, json_mime_type.to_string())
9444                    .header(CONTENT_LENGTH, request_size as u64)
9445                    .body(common::to_body(
9446                        request_value_reader.get_ref().clone().into(),
9447                    ));
9448
9449                client.request(request.unwrap()).await
9450            };
9451
9452            match req_result {
9453                Err(err) => {
9454                    if let common::Retry::After(d) = dlg.http_error(&err) {
9455                        sleep(d).await;
9456                        continue;
9457                    }
9458                    dlg.finished(false);
9459                    return Err(common::Error::HttpError(err));
9460                }
9461                Ok(res) => {
9462                    let (mut parts, body) = res.into_parts();
9463                    let mut body = common::Body::new(body);
9464                    if !parts.status.is_success() {
9465                        let bytes = common::to_bytes(body).await.unwrap_or_default();
9466                        let error = serde_json::from_str(&common::to_string(&bytes));
9467                        let response = common::to_response(parts, bytes.into());
9468
9469                        if let common::Retry::After(d) =
9470                            dlg.http_failure(&response, error.as_ref().ok())
9471                        {
9472                            sleep(d).await;
9473                            continue;
9474                        }
9475
9476                        dlg.finished(false);
9477
9478                        return Err(match error {
9479                            Ok(value) => common::Error::BadRequest(value),
9480                            _ => common::Error::Failure(response),
9481                        });
9482                    }
9483                    let response = {
9484                        let bytes = common::to_bytes(body).await.unwrap_or_default();
9485                        let encoded = common::to_string(&bytes);
9486                        match serde_json::from_str(&encoded) {
9487                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
9488                            Err(error) => {
9489                                dlg.response_json_decode_error(&encoded, &error);
9490                                return Err(common::Error::JsonDecodeError(
9491                                    encoded.to_string(),
9492                                    error,
9493                                ));
9494                            }
9495                        }
9496                    };
9497
9498                    dlg.finished(true);
9499                    return Ok(response);
9500                }
9501            }
9502        }
9503    }
9504
9505    ///
9506    /// Sets the *request* property to the given value.
9507    ///
9508    /// Even though the property as already been set when instantiating this call,
9509    /// we provide this method for API completeness.
9510    pub fn request(
9511        mut self,
9512        new_value: GoogleAppsCloudidentityDevicesV1Device,
9513    ) -> DeviceCreateCall<'a, C> {
9514        self._request = new_value;
9515        self
9516    }
9517    /// Optional. [Resource name](https://cloud.google.com/apis/design/resource_names) of the customer. If you're using this API for your own organization, use `customers/my_customer` If you're using this API to manage another organization, use `customers/{customer}`, where customer is the customer to whom the device belongs.
9518    ///
9519    /// Sets the *customer* query property to the given value.
9520    pub fn customer(mut self, new_value: &str) -> DeviceCreateCall<'a, C> {
9521        self._customer = Some(new_value.to_string());
9522        self
9523    }
9524    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
9525    /// while executing the actual API request.
9526    ///
9527    /// ````text
9528    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
9529    /// ````
9530    ///
9531    /// Sets the *delegate* property to the given value.
9532    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> DeviceCreateCall<'a, C> {
9533        self._delegate = Some(new_value);
9534        self
9535    }
9536
9537    /// Set any additional parameter of the query string used in the request.
9538    /// It should be used to set parameters which are not yet available through their own
9539    /// setters.
9540    ///
9541    /// Please note that this method must not be used to set any of the known parameters
9542    /// which have their own setter method. If done anyway, the request will fail.
9543    ///
9544    /// # Additional Parameters
9545    ///
9546    /// * *$.xgafv* (query-string) - V1 error format.
9547    /// * *access_token* (query-string) - OAuth access token.
9548    /// * *alt* (query-string) - Data format for response.
9549    /// * *callback* (query-string) - JSONP
9550    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
9551    /// * *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.
9552    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
9553    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
9554    /// * *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.
9555    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
9556    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
9557    pub fn param<T>(mut self, name: T, value: T) -> DeviceCreateCall<'a, C>
9558    where
9559        T: AsRef<str>,
9560    {
9561        self._additional_params
9562            .insert(name.as_ref().to_string(), value.as_ref().to_string());
9563        self
9564    }
9565
9566    /// Identifies the authorization scope for the method you are building.
9567    ///
9568    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
9569    /// [`Scope::CloudIdentityDevice`].
9570    ///
9571    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
9572    /// tokens for more than one scope.
9573    ///
9574    /// Usually there is more than one suitable scope to authorize an operation, some of which may
9575    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
9576    /// sufficient, a read-write scope will do as well.
9577    pub fn add_scope<St>(mut self, scope: St) -> DeviceCreateCall<'a, C>
9578    where
9579        St: AsRef<str>,
9580    {
9581        self._scopes.insert(String::from(scope.as_ref()));
9582        self
9583    }
9584    /// Identifies the authorization scope(s) for the method you are building.
9585    ///
9586    /// See [`Self::add_scope()`] for details.
9587    pub fn add_scopes<I, St>(mut self, scopes: I) -> DeviceCreateCall<'a, C>
9588    where
9589        I: IntoIterator<Item = St>,
9590        St: AsRef<str>,
9591    {
9592        self._scopes
9593            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
9594        self
9595    }
9596
9597    /// Removes all scopes, and no default scope will be used either.
9598    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
9599    /// for details).
9600    pub fn clear_scopes(mut self) -> DeviceCreateCall<'a, C> {
9601        self._scopes.clear();
9602        self
9603    }
9604}
9605
9606/// Deletes the specified device.
9607///
9608/// A builder for the *delete* method supported by a *device* resource.
9609/// It is not used directly, but through a [`DeviceMethods`] instance.
9610///
9611/// # Example
9612///
9613/// Instantiate a resource method builder
9614///
9615/// ```test_harness,no_run
9616/// # extern crate hyper;
9617/// # extern crate hyper_rustls;
9618/// # extern crate google_cloudidentity1 as cloudidentity1;
9619/// # async fn dox() {
9620/// # use cloudidentity1::{CloudIdentity, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9621///
9622/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
9623/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
9624/// #     .with_native_roots()
9625/// #     .unwrap()
9626/// #     .https_only()
9627/// #     .enable_http2()
9628/// #     .build();
9629///
9630/// # let executor = hyper_util::rt::TokioExecutor::new();
9631/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
9632/// #     secret,
9633/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9634/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
9635/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
9636/// #     ),
9637/// # ).build().await.unwrap();
9638///
9639/// # let client = hyper_util::client::legacy::Client::builder(
9640/// #     hyper_util::rt::TokioExecutor::new()
9641/// # )
9642/// # .build(
9643/// #     hyper_rustls::HttpsConnectorBuilder::new()
9644/// #         .with_native_roots()
9645/// #         .unwrap()
9646/// #         .https_or_http()
9647/// #         .enable_http2()
9648/// #         .build()
9649/// # );
9650/// # let mut hub = CloudIdentity::new(client, auth);
9651/// // You can configure optional parameters by calling the respective setters at will, and
9652/// // execute the final call using `doit()`.
9653/// // Values shown here are possibly random and not representative !
9654/// let result = hub.devices().delete("name")
9655///              .customer("erat")
9656///              .doit().await;
9657/// # }
9658/// ```
9659pub struct DeviceDeleteCall<'a, C>
9660where
9661    C: 'a,
9662{
9663    hub: &'a CloudIdentity<C>,
9664    _name: String,
9665    _customer: Option<String>,
9666    _delegate: Option<&'a mut dyn common::Delegate>,
9667    _additional_params: HashMap<String, String>,
9668    _scopes: BTreeSet<String>,
9669}
9670
9671impl<'a, C> common::CallBuilder for DeviceDeleteCall<'a, C> {}
9672
9673impl<'a, C> DeviceDeleteCall<'a, C>
9674where
9675    C: common::Connector,
9676{
9677    /// Perform the operation you have build so far.
9678    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
9679        use std::borrow::Cow;
9680        use std::io::{Read, Seek};
9681
9682        use common::{url::Params, ToParts};
9683        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
9684
9685        let mut dd = common::DefaultDelegate;
9686        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
9687        dlg.begin(common::MethodInfo {
9688            id: "cloudidentity.devices.delete",
9689            http_method: hyper::Method::DELETE,
9690        });
9691
9692        for &field in ["alt", "name", "customer"].iter() {
9693            if self._additional_params.contains_key(field) {
9694                dlg.finished(false);
9695                return Err(common::Error::FieldClash(field));
9696            }
9697        }
9698
9699        let mut params = Params::with_capacity(4 + self._additional_params.len());
9700        params.push("name", self._name);
9701        if let Some(value) = self._customer.as_ref() {
9702            params.push("customer", value);
9703        }
9704
9705        params.extend(self._additional_params.iter());
9706
9707        params.push("alt", "json");
9708        let mut url = self.hub._base_url.clone() + "v1/{+name}";
9709        if self._scopes.is_empty() {
9710            self._scopes
9711                .insert(Scope::CloudIdentityDevice.as_ref().to_string());
9712        }
9713
9714        #[allow(clippy::single_element_loop)]
9715        for &(find_this, param_name) in [("{+name}", "name")].iter() {
9716            url = params.uri_replacement(url, param_name, find_this, true);
9717        }
9718        {
9719            let to_remove = ["name"];
9720            params.remove_params(&to_remove);
9721        }
9722
9723        let url = params.parse_with_url(&url);
9724
9725        loop {
9726            let token = match self
9727                .hub
9728                .auth
9729                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
9730                .await
9731            {
9732                Ok(token) => token,
9733                Err(e) => match dlg.token(e) {
9734                    Ok(token) => token,
9735                    Err(e) => {
9736                        dlg.finished(false);
9737                        return Err(common::Error::MissingToken(e));
9738                    }
9739                },
9740            };
9741            let mut req_result = {
9742                let client = &self.hub.client;
9743                dlg.pre_request();
9744                let mut req_builder = hyper::Request::builder()
9745                    .method(hyper::Method::DELETE)
9746                    .uri(url.as_str())
9747                    .header(USER_AGENT, self.hub._user_agent.clone());
9748
9749                if let Some(token) = token.as_ref() {
9750                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
9751                }
9752
9753                let request = req_builder
9754                    .header(CONTENT_LENGTH, 0_u64)
9755                    .body(common::to_body::<String>(None));
9756
9757                client.request(request.unwrap()).await
9758            };
9759
9760            match req_result {
9761                Err(err) => {
9762                    if let common::Retry::After(d) = dlg.http_error(&err) {
9763                        sleep(d).await;
9764                        continue;
9765                    }
9766                    dlg.finished(false);
9767                    return Err(common::Error::HttpError(err));
9768                }
9769                Ok(res) => {
9770                    let (mut parts, body) = res.into_parts();
9771                    let mut body = common::Body::new(body);
9772                    if !parts.status.is_success() {
9773                        let bytes = common::to_bytes(body).await.unwrap_or_default();
9774                        let error = serde_json::from_str(&common::to_string(&bytes));
9775                        let response = common::to_response(parts, bytes.into());
9776
9777                        if let common::Retry::After(d) =
9778                            dlg.http_failure(&response, error.as_ref().ok())
9779                        {
9780                            sleep(d).await;
9781                            continue;
9782                        }
9783
9784                        dlg.finished(false);
9785
9786                        return Err(match error {
9787                            Ok(value) => common::Error::BadRequest(value),
9788                            _ => common::Error::Failure(response),
9789                        });
9790                    }
9791                    let response = {
9792                        let bytes = common::to_bytes(body).await.unwrap_or_default();
9793                        let encoded = common::to_string(&bytes);
9794                        match serde_json::from_str(&encoded) {
9795                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
9796                            Err(error) => {
9797                                dlg.response_json_decode_error(&encoded, &error);
9798                                return Err(common::Error::JsonDecodeError(
9799                                    encoded.to_string(),
9800                                    error,
9801                                ));
9802                            }
9803                        }
9804                    };
9805
9806                    dlg.finished(true);
9807                    return Ok(response);
9808                }
9809            }
9810        }
9811    }
9812
9813    /// Required. [Resource name](https://cloud.google.com/apis/design/resource_names) of the Device in format: `devices/{device}`, where device is the unique ID assigned to the Device.
9814    ///
9815    /// Sets the *name* path property to the given value.
9816    ///
9817    /// Even though the property as already been set when instantiating this call,
9818    /// we provide this method for API completeness.
9819    pub fn name(mut self, new_value: &str) -> DeviceDeleteCall<'a, C> {
9820        self._name = new_value.to_string();
9821        self
9822    }
9823    /// Optional. [Resource name](https://cloud.google.com/apis/design/resource_names) of the customer. If you're using this API for your own organization, use `customers/my_customer` If you're using this API to manage another organization, use `customers/{customer}`, where customer is the customer to whom the device belongs.
9824    ///
9825    /// Sets the *customer* query property to the given value.
9826    pub fn customer(mut self, new_value: &str) -> DeviceDeleteCall<'a, C> {
9827        self._customer = Some(new_value.to_string());
9828        self
9829    }
9830    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
9831    /// while executing the actual API request.
9832    ///
9833    /// ````text
9834    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
9835    /// ````
9836    ///
9837    /// Sets the *delegate* property to the given value.
9838    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> DeviceDeleteCall<'a, C> {
9839        self._delegate = Some(new_value);
9840        self
9841    }
9842
9843    /// Set any additional parameter of the query string used in the request.
9844    /// It should be used to set parameters which are not yet available through their own
9845    /// setters.
9846    ///
9847    /// Please note that this method must not be used to set any of the known parameters
9848    /// which have their own setter method. If done anyway, the request will fail.
9849    ///
9850    /// # Additional Parameters
9851    ///
9852    /// * *$.xgafv* (query-string) - V1 error format.
9853    /// * *access_token* (query-string) - OAuth access token.
9854    /// * *alt* (query-string) - Data format for response.
9855    /// * *callback* (query-string) - JSONP
9856    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
9857    /// * *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.
9858    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
9859    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
9860    /// * *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.
9861    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
9862    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
9863    pub fn param<T>(mut self, name: T, value: T) -> DeviceDeleteCall<'a, C>
9864    where
9865        T: AsRef<str>,
9866    {
9867        self._additional_params
9868            .insert(name.as_ref().to_string(), value.as_ref().to_string());
9869        self
9870    }
9871
9872    /// Identifies the authorization scope for the method you are building.
9873    ///
9874    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
9875    /// [`Scope::CloudIdentityDevice`].
9876    ///
9877    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
9878    /// tokens for more than one scope.
9879    ///
9880    /// Usually there is more than one suitable scope to authorize an operation, some of which may
9881    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
9882    /// sufficient, a read-write scope will do as well.
9883    pub fn add_scope<St>(mut self, scope: St) -> DeviceDeleteCall<'a, C>
9884    where
9885        St: AsRef<str>,
9886    {
9887        self._scopes.insert(String::from(scope.as_ref()));
9888        self
9889    }
9890    /// Identifies the authorization scope(s) for the method you are building.
9891    ///
9892    /// See [`Self::add_scope()`] for details.
9893    pub fn add_scopes<I, St>(mut self, scopes: I) -> DeviceDeleteCall<'a, C>
9894    where
9895        I: IntoIterator<Item = St>,
9896        St: AsRef<str>,
9897    {
9898        self._scopes
9899            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
9900        self
9901    }
9902
9903    /// Removes all scopes, and no default scope will be used either.
9904    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
9905    /// for details).
9906    pub fn clear_scopes(mut self) -> DeviceDeleteCall<'a, C> {
9907        self._scopes.clear();
9908        self
9909    }
9910}
9911
9912/// Retrieves the specified device.
9913///
9914/// A builder for the *get* method supported by a *device* resource.
9915/// It is not used directly, but through a [`DeviceMethods`] instance.
9916///
9917/// # Example
9918///
9919/// Instantiate a resource method builder
9920///
9921/// ```test_harness,no_run
9922/// # extern crate hyper;
9923/// # extern crate hyper_rustls;
9924/// # extern crate google_cloudidentity1 as cloudidentity1;
9925/// # async fn dox() {
9926/// # use cloudidentity1::{CloudIdentity, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9927///
9928/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
9929/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
9930/// #     .with_native_roots()
9931/// #     .unwrap()
9932/// #     .https_only()
9933/// #     .enable_http2()
9934/// #     .build();
9935///
9936/// # let executor = hyper_util::rt::TokioExecutor::new();
9937/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
9938/// #     secret,
9939/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9940/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
9941/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
9942/// #     ),
9943/// # ).build().await.unwrap();
9944///
9945/// # let client = hyper_util::client::legacy::Client::builder(
9946/// #     hyper_util::rt::TokioExecutor::new()
9947/// # )
9948/// # .build(
9949/// #     hyper_rustls::HttpsConnectorBuilder::new()
9950/// #         .with_native_roots()
9951/// #         .unwrap()
9952/// #         .https_or_http()
9953/// #         .enable_http2()
9954/// #         .build()
9955/// # );
9956/// # let mut hub = CloudIdentity::new(client, auth);
9957/// // You can configure optional parameters by calling the respective setters at will, and
9958/// // execute the final call using `doit()`.
9959/// // Values shown here are possibly random and not representative !
9960/// let result = hub.devices().get("name")
9961///              .customer("duo")
9962///              .doit().await;
9963/// # }
9964/// ```
9965pub struct DeviceGetCall<'a, C>
9966where
9967    C: 'a,
9968{
9969    hub: &'a CloudIdentity<C>,
9970    _name: String,
9971    _customer: Option<String>,
9972    _delegate: Option<&'a mut dyn common::Delegate>,
9973    _additional_params: HashMap<String, String>,
9974    _scopes: BTreeSet<String>,
9975}
9976
9977impl<'a, C> common::CallBuilder for DeviceGetCall<'a, C> {}
9978
9979impl<'a, C> DeviceGetCall<'a, C>
9980where
9981    C: common::Connector,
9982{
9983    /// Perform the operation you have build so far.
9984    pub async fn doit(
9985        mut self,
9986    ) -> common::Result<(common::Response, GoogleAppsCloudidentityDevicesV1Device)> {
9987        use std::borrow::Cow;
9988        use std::io::{Read, Seek};
9989
9990        use common::{url::Params, ToParts};
9991        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
9992
9993        let mut dd = common::DefaultDelegate;
9994        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
9995        dlg.begin(common::MethodInfo {
9996            id: "cloudidentity.devices.get",
9997            http_method: hyper::Method::GET,
9998        });
9999
10000        for &field in ["alt", "name", "customer"].iter() {
10001            if self._additional_params.contains_key(field) {
10002                dlg.finished(false);
10003                return Err(common::Error::FieldClash(field));
10004            }
10005        }
10006
10007        let mut params = Params::with_capacity(4 + self._additional_params.len());
10008        params.push("name", self._name);
10009        if let Some(value) = self._customer.as_ref() {
10010            params.push("customer", value);
10011        }
10012
10013        params.extend(self._additional_params.iter());
10014
10015        params.push("alt", "json");
10016        let mut url = self.hub._base_url.clone() + "v1/{+name}";
10017        if self._scopes.is_empty() {
10018            self._scopes
10019                .insert(Scope::CloudIdentityDeviceReadonly.as_ref().to_string());
10020        }
10021
10022        #[allow(clippy::single_element_loop)]
10023        for &(find_this, param_name) in [("{+name}", "name")].iter() {
10024            url = params.uri_replacement(url, param_name, find_this, true);
10025        }
10026        {
10027            let to_remove = ["name"];
10028            params.remove_params(&to_remove);
10029        }
10030
10031        let url = params.parse_with_url(&url);
10032
10033        loop {
10034            let token = match self
10035                .hub
10036                .auth
10037                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
10038                .await
10039            {
10040                Ok(token) => token,
10041                Err(e) => match dlg.token(e) {
10042                    Ok(token) => token,
10043                    Err(e) => {
10044                        dlg.finished(false);
10045                        return Err(common::Error::MissingToken(e));
10046                    }
10047                },
10048            };
10049            let mut req_result = {
10050                let client = &self.hub.client;
10051                dlg.pre_request();
10052                let mut req_builder = hyper::Request::builder()
10053                    .method(hyper::Method::GET)
10054                    .uri(url.as_str())
10055                    .header(USER_AGENT, self.hub._user_agent.clone());
10056
10057                if let Some(token) = token.as_ref() {
10058                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
10059                }
10060
10061                let request = req_builder
10062                    .header(CONTENT_LENGTH, 0_u64)
10063                    .body(common::to_body::<String>(None));
10064
10065                client.request(request.unwrap()).await
10066            };
10067
10068            match req_result {
10069                Err(err) => {
10070                    if let common::Retry::After(d) = dlg.http_error(&err) {
10071                        sleep(d).await;
10072                        continue;
10073                    }
10074                    dlg.finished(false);
10075                    return Err(common::Error::HttpError(err));
10076                }
10077                Ok(res) => {
10078                    let (mut parts, body) = res.into_parts();
10079                    let mut body = common::Body::new(body);
10080                    if !parts.status.is_success() {
10081                        let bytes = common::to_bytes(body).await.unwrap_or_default();
10082                        let error = serde_json::from_str(&common::to_string(&bytes));
10083                        let response = common::to_response(parts, bytes.into());
10084
10085                        if let common::Retry::After(d) =
10086                            dlg.http_failure(&response, error.as_ref().ok())
10087                        {
10088                            sleep(d).await;
10089                            continue;
10090                        }
10091
10092                        dlg.finished(false);
10093
10094                        return Err(match error {
10095                            Ok(value) => common::Error::BadRequest(value),
10096                            _ => common::Error::Failure(response),
10097                        });
10098                    }
10099                    let response = {
10100                        let bytes = common::to_bytes(body).await.unwrap_or_default();
10101                        let encoded = common::to_string(&bytes);
10102                        match serde_json::from_str(&encoded) {
10103                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
10104                            Err(error) => {
10105                                dlg.response_json_decode_error(&encoded, &error);
10106                                return Err(common::Error::JsonDecodeError(
10107                                    encoded.to_string(),
10108                                    error,
10109                                ));
10110                            }
10111                        }
10112                    };
10113
10114                    dlg.finished(true);
10115                    return Ok(response);
10116                }
10117            }
10118        }
10119    }
10120
10121    /// Required. [Resource name](https://cloud.google.com/apis/design/resource_names) of the Device in the format: `devices/{device}`, where device is the unique ID assigned to the Device.
10122    ///
10123    /// Sets the *name* path property to the given value.
10124    ///
10125    /// Even though the property as already been set when instantiating this call,
10126    /// we provide this method for API completeness.
10127    pub fn name(mut self, new_value: &str) -> DeviceGetCall<'a, C> {
10128        self._name = new_value.to_string();
10129        self
10130    }
10131    /// Optional. [Resource name](https://cloud.google.com/apis/design/resource_names) of the Customer in the format: `customers/{customer}`, where customer is the customer to whom the device belongs. If you're using this API for your own organization, use `customers/my_customer`. If you're using this API to manage another organization, use `customers/{customer}`, where customer is the customer to whom the device belongs.
10132    ///
10133    /// Sets the *customer* query property to the given value.
10134    pub fn customer(mut self, new_value: &str) -> DeviceGetCall<'a, C> {
10135        self._customer = Some(new_value.to_string());
10136        self
10137    }
10138    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
10139    /// while executing the actual API request.
10140    ///
10141    /// ````text
10142    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
10143    /// ````
10144    ///
10145    /// Sets the *delegate* property to the given value.
10146    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> DeviceGetCall<'a, C> {
10147        self._delegate = Some(new_value);
10148        self
10149    }
10150
10151    /// Set any additional parameter of the query string used in the request.
10152    /// It should be used to set parameters which are not yet available through their own
10153    /// setters.
10154    ///
10155    /// Please note that this method must not be used to set any of the known parameters
10156    /// which have their own setter method. If done anyway, the request will fail.
10157    ///
10158    /// # Additional Parameters
10159    ///
10160    /// * *$.xgafv* (query-string) - V1 error format.
10161    /// * *access_token* (query-string) - OAuth access token.
10162    /// * *alt* (query-string) - Data format for response.
10163    /// * *callback* (query-string) - JSONP
10164    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
10165    /// * *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.
10166    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
10167    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
10168    /// * *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.
10169    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
10170    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
10171    pub fn param<T>(mut self, name: T, value: T) -> DeviceGetCall<'a, C>
10172    where
10173        T: AsRef<str>,
10174    {
10175        self._additional_params
10176            .insert(name.as_ref().to_string(), value.as_ref().to_string());
10177        self
10178    }
10179
10180    /// Identifies the authorization scope for the method you are building.
10181    ///
10182    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
10183    /// [`Scope::CloudIdentityDeviceReadonly`].
10184    ///
10185    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
10186    /// tokens for more than one scope.
10187    ///
10188    /// Usually there is more than one suitable scope to authorize an operation, some of which may
10189    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
10190    /// sufficient, a read-write scope will do as well.
10191    pub fn add_scope<St>(mut self, scope: St) -> DeviceGetCall<'a, C>
10192    where
10193        St: AsRef<str>,
10194    {
10195        self._scopes.insert(String::from(scope.as_ref()));
10196        self
10197    }
10198    /// Identifies the authorization scope(s) for the method you are building.
10199    ///
10200    /// See [`Self::add_scope()`] for details.
10201    pub fn add_scopes<I, St>(mut self, scopes: I) -> DeviceGetCall<'a, C>
10202    where
10203        I: IntoIterator<Item = St>,
10204        St: AsRef<str>,
10205    {
10206        self._scopes
10207            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
10208        self
10209    }
10210
10211    /// Removes all scopes, and no default scope will be used either.
10212    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
10213    /// for details).
10214    pub fn clear_scopes(mut self) -> DeviceGetCall<'a, C> {
10215        self._scopes.clear();
10216        self
10217    }
10218}
10219
10220/// Lists/Searches devices.
10221///
10222/// A builder for the *list* method supported by a *device* resource.
10223/// It is not used directly, but through a [`DeviceMethods`] instance.
10224///
10225/// # Example
10226///
10227/// Instantiate a resource method builder
10228///
10229/// ```test_harness,no_run
10230/// # extern crate hyper;
10231/// # extern crate hyper_rustls;
10232/// # extern crate google_cloudidentity1 as cloudidentity1;
10233/// # async fn dox() {
10234/// # use cloudidentity1::{CloudIdentity, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
10235///
10236/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
10237/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
10238/// #     .with_native_roots()
10239/// #     .unwrap()
10240/// #     .https_only()
10241/// #     .enable_http2()
10242/// #     .build();
10243///
10244/// # let executor = hyper_util::rt::TokioExecutor::new();
10245/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
10246/// #     secret,
10247/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
10248/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
10249/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
10250/// #     ),
10251/// # ).build().await.unwrap();
10252///
10253/// # let client = hyper_util::client::legacy::Client::builder(
10254/// #     hyper_util::rt::TokioExecutor::new()
10255/// # )
10256/// # .build(
10257/// #     hyper_rustls::HttpsConnectorBuilder::new()
10258/// #         .with_native_roots()
10259/// #         .unwrap()
10260/// #         .https_or_http()
10261/// #         .enable_http2()
10262/// #         .build()
10263/// # );
10264/// # let mut hub = CloudIdentity::new(client, auth);
10265/// // You can configure optional parameters by calling the respective setters at will, and
10266/// // execute the final call using `doit()`.
10267/// // Values shown here are possibly random and not representative !
10268/// let result = hub.devices().list()
10269///              .view("dolore")
10270///              .page_token("et")
10271///              .page_size(-28)
10272///              .order_by("amet.")
10273///              .filter("consetetur")
10274///              .customer("diam")
10275///              .doit().await;
10276/// # }
10277/// ```
10278pub struct DeviceListCall<'a, C>
10279where
10280    C: 'a,
10281{
10282    hub: &'a CloudIdentity<C>,
10283    _view: Option<String>,
10284    _page_token: Option<String>,
10285    _page_size: Option<i32>,
10286    _order_by: Option<String>,
10287    _filter: Option<String>,
10288    _customer: Option<String>,
10289    _delegate: Option<&'a mut dyn common::Delegate>,
10290    _additional_params: HashMap<String, String>,
10291    _scopes: BTreeSet<String>,
10292}
10293
10294impl<'a, C> common::CallBuilder for DeviceListCall<'a, C> {}
10295
10296impl<'a, C> DeviceListCall<'a, C>
10297where
10298    C: common::Connector,
10299{
10300    /// Perform the operation you have build so far.
10301    pub async fn doit(
10302        mut self,
10303    ) -> common::Result<(
10304        common::Response,
10305        GoogleAppsCloudidentityDevicesV1ListDevicesResponse,
10306    )> {
10307        use std::borrow::Cow;
10308        use std::io::{Read, Seek};
10309
10310        use common::{url::Params, ToParts};
10311        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
10312
10313        let mut dd = common::DefaultDelegate;
10314        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
10315        dlg.begin(common::MethodInfo {
10316            id: "cloudidentity.devices.list",
10317            http_method: hyper::Method::GET,
10318        });
10319
10320        for &field in [
10321            "alt",
10322            "view",
10323            "pageToken",
10324            "pageSize",
10325            "orderBy",
10326            "filter",
10327            "customer",
10328        ]
10329        .iter()
10330        {
10331            if self._additional_params.contains_key(field) {
10332                dlg.finished(false);
10333                return Err(common::Error::FieldClash(field));
10334            }
10335        }
10336
10337        let mut params = Params::with_capacity(8 + self._additional_params.len());
10338        if let Some(value) = self._view.as_ref() {
10339            params.push("view", value);
10340        }
10341        if let Some(value) = self._page_token.as_ref() {
10342            params.push("pageToken", value);
10343        }
10344        if let Some(value) = self._page_size.as_ref() {
10345            params.push("pageSize", value.to_string());
10346        }
10347        if let Some(value) = self._order_by.as_ref() {
10348            params.push("orderBy", value);
10349        }
10350        if let Some(value) = self._filter.as_ref() {
10351            params.push("filter", value);
10352        }
10353        if let Some(value) = self._customer.as_ref() {
10354            params.push("customer", value);
10355        }
10356
10357        params.extend(self._additional_params.iter());
10358
10359        params.push("alt", "json");
10360        let mut url = self.hub._base_url.clone() + "v1/devices";
10361        if self._scopes.is_empty() {
10362            self._scopes
10363                .insert(Scope::CloudIdentityDeviceReadonly.as_ref().to_string());
10364        }
10365
10366        let url = params.parse_with_url(&url);
10367
10368        loop {
10369            let token = match self
10370                .hub
10371                .auth
10372                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
10373                .await
10374            {
10375                Ok(token) => token,
10376                Err(e) => match dlg.token(e) {
10377                    Ok(token) => token,
10378                    Err(e) => {
10379                        dlg.finished(false);
10380                        return Err(common::Error::MissingToken(e));
10381                    }
10382                },
10383            };
10384            let mut req_result = {
10385                let client = &self.hub.client;
10386                dlg.pre_request();
10387                let mut req_builder = hyper::Request::builder()
10388                    .method(hyper::Method::GET)
10389                    .uri(url.as_str())
10390                    .header(USER_AGENT, self.hub._user_agent.clone());
10391
10392                if let Some(token) = token.as_ref() {
10393                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
10394                }
10395
10396                let request = req_builder
10397                    .header(CONTENT_LENGTH, 0_u64)
10398                    .body(common::to_body::<String>(None));
10399
10400                client.request(request.unwrap()).await
10401            };
10402
10403            match req_result {
10404                Err(err) => {
10405                    if let common::Retry::After(d) = dlg.http_error(&err) {
10406                        sleep(d).await;
10407                        continue;
10408                    }
10409                    dlg.finished(false);
10410                    return Err(common::Error::HttpError(err));
10411                }
10412                Ok(res) => {
10413                    let (mut parts, body) = res.into_parts();
10414                    let mut body = common::Body::new(body);
10415                    if !parts.status.is_success() {
10416                        let bytes = common::to_bytes(body).await.unwrap_or_default();
10417                        let error = serde_json::from_str(&common::to_string(&bytes));
10418                        let response = common::to_response(parts, bytes.into());
10419
10420                        if let common::Retry::After(d) =
10421                            dlg.http_failure(&response, error.as_ref().ok())
10422                        {
10423                            sleep(d).await;
10424                            continue;
10425                        }
10426
10427                        dlg.finished(false);
10428
10429                        return Err(match error {
10430                            Ok(value) => common::Error::BadRequest(value),
10431                            _ => common::Error::Failure(response),
10432                        });
10433                    }
10434                    let response = {
10435                        let bytes = common::to_bytes(body).await.unwrap_or_default();
10436                        let encoded = common::to_string(&bytes);
10437                        match serde_json::from_str(&encoded) {
10438                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
10439                            Err(error) => {
10440                                dlg.response_json_decode_error(&encoded, &error);
10441                                return Err(common::Error::JsonDecodeError(
10442                                    encoded.to_string(),
10443                                    error,
10444                                ));
10445                            }
10446                        }
10447                    };
10448
10449                    dlg.finished(true);
10450                    return Ok(response);
10451                }
10452            }
10453        }
10454    }
10455
10456    /// Optional. The view to use for the List request.
10457    ///
10458    /// Sets the *view* query property to the given value.
10459    pub fn view(mut self, new_value: &str) -> DeviceListCall<'a, C> {
10460        self._view = Some(new_value.to_string());
10461        self
10462    }
10463    /// Optional. A page token, received from a previous `ListDevices` call. Provide this to retrieve the subsequent page. When paginating, all other parameters provided to `ListDevices` must match the call that provided the page token.
10464    ///
10465    /// Sets the *page token* query property to the given value.
10466    pub fn page_token(mut self, new_value: &str) -> DeviceListCall<'a, C> {
10467        self._page_token = Some(new_value.to_string());
10468        self
10469    }
10470    /// Optional. The maximum number of Devices to return. If unspecified, at most 20 Devices will be returned. The maximum value is 100; values above 100 will be coerced to 100.
10471    ///
10472    /// Sets the *page size* query property to the given value.
10473    pub fn page_size(mut self, new_value: i32) -> DeviceListCall<'a, C> {
10474        self._page_size = Some(new_value);
10475        self
10476    }
10477    /// Optional. Order specification for devices in the response. Only one of the following field names may be used to specify the order: `create_time`, `last_sync_time`, `model`, `os_version`, `device_type` and `serial_number`. `desc` may be specified optionally at the end to specify results to be sorted in descending order. Default order is ascending.
10478    ///
10479    /// Sets the *order by* query property to the given value.
10480    pub fn order_by(mut self, new_value: &str) -> DeviceListCall<'a, C> {
10481        self._order_by = Some(new_value.to_string());
10482        self
10483    }
10484    /// Optional. Additional restrictions when fetching list of devices. For a list of search fields, refer to [Mobile device search fields](https://developers.google.com/admin-sdk/directory/v1/search-operators). Multiple search fields are separated by the space character.
10485    ///
10486    /// Sets the *filter* query property to the given value.
10487    pub fn filter(mut self, new_value: &str) -> DeviceListCall<'a, C> {
10488        self._filter = Some(new_value.to_string());
10489        self
10490    }
10491    /// Optional. [Resource name](https://cloud.google.com/apis/design/resource_names) of the customer in the format: `customers/{customer}`, where customer is the customer to whom the device belongs. If you're using this API for your own organization, use `customers/my_customer`. If you're using this API to manage another organization, use `customers/{customer}`, where customer is the customer to whom the device belongs.
10492    ///
10493    /// Sets the *customer* query property to the given value.
10494    pub fn customer(mut self, new_value: &str) -> DeviceListCall<'a, C> {
10495        self._customer = Some(new_value.to_string());
10496        self
10497    }
10498    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
10499    /// while executing the actual API request.
10500    ///
10501    /// ````text
10502    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
10503    /// ````
10504    ///
10505    /// Sets the *delegate* property to the given value.
10506    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> DeviceListCall<'a, C> {
10507        self._delegate = Some(new_value);
10508        self
10509    }
10510
10511    /// Set any additional parameter of the query string used in the request.
10512    /// It should be used to set parameters which are not yet available through their own
10513    /// setters.
10514    ///
10515    /// Please note that this method must not be used to set any of the known parameters
10516    /// which have their own setter method. If done anyway, the request will fail.
10517    ///
10518    /// # Additional Parameters
10519    ///
10520    /// * *$.xgafv* (query-string) - V1 error format.
10521    /// * *access_token* (query-string) - OAuth access token.
10522    /// * *alt* (query-string) - Data format for response.
10523    /// * *callback* (query-string) - JSONP
10524    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
10525    /// * *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.
10526    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
10527    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
10528    /// * *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.
10529    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
10530    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
10531    pub fn param<T>(mut self, name: T, value: T) -> DeviceListCall<'a, C>
10532    where
10533        T: AsRef<str>,
10534    {
10535        self._additional_params
10536            .insert(name.as_ref().to_string(), value.as_ref().to_string());
10537        self
10538    }
10539
10540    /// Identifies the authorization scope for the method you are building.
10541    ///
10542    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
10543    /// [`Scope::CloudIdentityDeviceReadonly`].
10544    ///
10545    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
10546    /// tokens for more than one scope.
10547    ///
10548    /// Usually there is more than one suitable scope to authorize an operation, some of which may
10549    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
10550    /// sufficient, a read-write scope will do as well.
10551    pub fn add_scope<St>(mut self, scope: St) -> DeviceListCall<'a, C>
10552    where
10553        St: AsRef<str>,
10554    {
10555        self._scopes.insert(String::from(scope.as_ref()));
10556        self
10557    }
10558    /// Identifies the authorization scope(s) for the method you are building.
10559    ///
10560    /// See [`Self::add_scope()`] for details.
10561    pub fn add_scopes<I, St>(mut self, scopes: I) -> DeviceListCall<'a, C>
10562    where
10563        I: IntoIterator<Item = St>,
10564        St: AsRef<str>,
10565    {
10566        self._scopes
10567            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
10568        self
10569    }
10570
10571    /// Removes all scopes, and no default scope will be used either.
10572    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
10573    /// for details).
10574    pub fn clear_scopes(mut self) -> DeviceListCall<'a, C> {
10575        self._scopes.clear();
10576        self
10577    }
10578}
10579
10580/// Wipes all data on the specified device.
10581///
10582/// A builder for the *wipe* method supported by a *device* resource.
10583/// It is not used directly, but through a [`DeviceMethods`] instance.
10584///
10585/// # Example
10586///
10587/// Instantiate a resource method builder
10588///
10589/// ```test_harness,no_run
10590/// # extern crate hyper;
10591/// # extern crate hyper_rustls;
10592/// # extern crate google_cloudidentity1 as cloudidentity1;
10593/// use cloudidentity1::api::GoogleAppsCloudidentityDevicesV1WipeDeviceRequest;
10594/// # async fn dox() {
10595/// # use cloudidentity1::{CloudIdentity, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
10596///
10597/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
10598/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
10599/// #     .with_native_roots()
10600/// #     .unwrap()
10601/// #     .https_only()
10602/// #     .enable_http2()
10603/// #     .build();
10604///
10605/// # let executor = hyper_util::rt::TokioExecutor::new();
10606/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
10607/// #     secret,
10608/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
10609/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
10610/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
10611/// #     ),
10612/// # ).build().await.unwrap();
10613///
10614/// # let client = hyper_util::client::legacy::Client::builder(
10615/// #     hyper_util::rt::TokioExecutor::new()
10616/// # )
10617/// # .build(
10618/// #     hyper_rustls::HttpsConnectorBuilder::new()
10619/// #         .with_native_roots()
10620/// #         .unwrap()
10621/// #         .https_or_http()
10622/// #         .enable_http2()
10623/// #         .build()
10624/// # );
10625/// # let mut hub = CloudIdentity::new(client, auth);
10626/// // As the method needs a request, you would usually fill it with the desired information
10627/// // into the respective structure. Some of the parts shown here might not be applicable !
10628/// // Values shown here are possibly random and not representative !
10629/// let mut req = GoogleAppsCloudidentityDevicesV1WipeDeviceRequest::default();
10630///
10631/// // You can configure optional parameters by calling the respective setters at will, and
10632/// // execute the final call using `doit()`.
10633/// // Values shown here are possibly random and not representative !
10634/// let result = hub.devices().wipe(req, "name")
10635///              .doit().await;
10636/// # }
10637/// ```
10638pub struct DeviceWipeCall<'a, C>
10639where
10640    C: 'a,
10641{
10642    hub: &'a CloudIdentity<C>,
10643    _request: GoogleAppsCloudidentityDevicesV1WipeDeviceRequest,
10644    _name: String,
10645    _delegate: Option<&'a mut dyn common::Delegate>,
10646    _additional_params: HashMap<String, String>,
10647    _scopes: BTreeSet<String>,
10648}
10649
10650impl<'a, C> common::CallBuilder for DeviceWipeCall<'a, C> {}
10651
10652impl<'a, C> DeviceWipeCall<'a, C>
10653where
10654    C: common::Connector,
10655{
10656    /// Perform the operation you have build so far.
10657    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
10658        use std::borrow::Cow;
10659        use std::io::{Read, Seek};
10660
10661        use common::{url::Params, ToParts};
10662        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
10663
10664        let mut dd = common::DefaultDelegate;
10665        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
10666        dlg.begin(common::MethodInfo {
10667            id: "cloudidentity.devices.wipe",
10668            http_method: hyper::Method::POST,
10669        });
10670
10671        for &field in ["alt", "name"].iter() {
10672            if self._additional_params.contains_key(field) {
10673                dlg.finished(false);
10674                return Err(common::Error::FieldClash(field));
10675            }
10676        }
10677
10678        let mut params = Params::with_capacity(4 + self._additional_params.len());
10679        params.push("name", self._name);
10680
10681        params.extend(self._additional_params.iter());
10682
10683        params.push("alt", "json");
10684        let mut url = self.hub._base_url.clone() + "v1/{+name}:wipe";
10685        if self._scopes.is_empty() {
10686            self._scopes
10687                .insert(Scope::CloudIdentityDevice.as_ref().to_string());
10688        }
10689
10690        #[allow(clippy::single_element_loop)]
10691        for &(find_this, param_name) in [("{+name}", "name")].iter() {
10692            url = params.uri_replacement(url, param_name, find_this, true);
10693        }
10694        {
10695            let to_remove = ["name"];
10696            params.remove_params(&to_remove);
10697        }
10698
10699        let url = params.parse_with_url(&url);
10700
10701        let mut json_mime_type = mime::APPLICATION_JSON;
10702        let mut request_value_reader = {
10703            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
10704            common::remove_json_null_values(&mut value);
10705            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
10706            serde_json::to_writer(&mut dst, &value).unwrap();
10707            dst
10708        };
10709        let request_size = request_value_reader
10710            .seek(std::io::SeekFrom::End(0))
10711            .unwrap();
10712        request_value_reader
10713            .seek(std::io::SeekFrom::Start(0))
10714            .unwrap();
10715
10716        loop {
10717            let token = match self
10718                .hub
10719                .auth
10720                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
10721                .await
10722            {
10723                Ok(token) => token,
10724                Err(e) => match dlg.token(e) {
10725                    Ok(token) => token,
10726                    Err(e) => {
10727                        dlg.finished(false);
10728                        return Err(common::Error::MissingToken(e));
10729                    }
10730                },
10731            };
10732            request_value_reader
10733                .seek(std::io::SeekFrom::Start(0))
10734                .unwrap();
10735            let mut req_result = {
10736                let client = &self.hub.client;
10737                dlg.pre_request();
10738                let mut req_builder = hyper::Request::builder()
10739                    .method(hyper::Method::POST)
10740                    .uri(url.as_str())
10741                    .header(USER_AGENT, self.hub._user_agent.clone());
10742
10743                if let Some(token) = token.as_ref() {
10744                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
10745                }
10746
10747                let request = req_builder
10748                    .header(CONTENT_TYPE, json_mime_type.to_string())
10749                    .header(CONTENT_LENGTH, request_size as u64)
10750                    .body(common::to_body(
10751                        request_value_reader.get_ref().clone().into(),
10752                    ));
10753
10754                client.request(request.unwrap()).await
10755            };
10756
10757            match req_result {
10758                Err(err) => {
10759                    if let common::Retry::After(d) = dlg.http_error(&err) {
10760                        sleep(d).await;
10761                        continue;
10762                    }
10763                    dlg.finished(false);
10764                    return Err(common::Error::HttpError(err));
10765                }
10766                Ok(res) => {
10767                    let (mut parts, body) = res.into_parts();
10768                    let mut body = common::Body::new(body);
10769                    if !parts.status.is_success() {
10770                        let bytes = common::to_bytes(body).await.unwrap_or_default();
10771                        let error = serde_json::from_str(&common::to_string(&bytes));
10772                        let response = common::to_response(parts, bytes.into());
10773
10774                        if let common::Retry::After(d) =
10775                            dlg.http_failure(&response, error.as_ref().ok())
10776                        {
10777                            sleep(d).await;
10778                            continue;
10779                        }
10780
10781                        dlg.finished(false);
10782
10783                        return Err(match error {
10784                            Ok(value) => common::Error::BadRequest(value),
10785                            _ => common::Error::Failure(response),
10786                        });
10787                    }
10788                    let response = {
10789                        let bytes = common::to_bytes(body).await.unwrap_or_default();
10790                        let encoded = common::to_string(&bytes);
10791                        match serde_json::from_str(&encoded) {
10792                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
10793                            Err(error) => {
10794                                dlg.response_json_decode_error(&encoded, &error);
10795                                return Err(common::Error::JsonDecodeError(
10796                                    encoded.to_string(),
10797                                    error,
10798                                ));
10799                            }
10800                        }
10801                    };
10802
10803                    dlg.finished(true);
10804                    return Ok(response);
10805                }
10806            }
10807        }
10808    }
10809
10810    ///
10811    /// Sets the *request* property to the given value.
10812    ///
10813    /// Even though the property as already been set when instantiating this call,
10814    /// we provide this method for API completeness.
10815    pub fn request(
10816        mut self,
10817        new_value: GoogleAppsCloudidentityDevicesV1WipeDeviceRequest,
10818    ) -> DeviceWipeCall<'a, C> {
10819        self._request = new_value;
10820        self
10821    }
10822    /// Required. [Resource name](https://cloud.google.com/apis/design/resource_names) of the Device in format: `devices/{device}/deviceUsers/{device_user}`, where device is the unique ID assigned to the Device, and device_user is the unique ID assigned to the User.
10823    ///
10824    /// Sets the *name* path property to the given value.
10825    ///
10826    /// Even though the property as already been set when instantiating this call,
10827    /// we provide this method for API completeness.
10828    pub fn name(mut self, new_value: &str) -> DeviceWipeCall<'a, C> {
10829        self._name = new_value.to_string();
10830        self
10831    }
10832    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
10833    /// while executing the actual API request.
10834    ///
10835    /// ````text
10836    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
10837    /// ````
10838    ///
10839    /// Sets the *delegate* property to the given value.
10840    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> DeviceWipeCall<'a, C> {
10841        self._delegate = Some(new_value);
10842        self
10843    }
10844
10845    /// Set any additional parameter of the query string used in the request.
10846    /// It should be used to set parameters which are not yet available through their own
10847    /// setters.
10848    ///
10849    /// Please note that this method must not be used to set any of the known parameters
10850    /// which have their own setter method. If done anyway, the request will fail.
10851    ///
10852    /// # Additional Parameters
10853    ///
10854    /// * *$.xgafv* (query-string) - V1 error format.
10855    /// * *access_token* (query-string) - OAuth access token.
10856    /// * *alt* (query-string) - Data format for response.
10857    /// * *callback* (query-string) - JSONP
10858    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
10859    /// * *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.
10860    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
10861    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
10862    /// * *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.
10863    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
10864    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
10865    pub fn param<T>(mut self, name: T, value: T) -> DeviceWipeCall<'a, C>
10866    where
10867        T: AsRef<str>,
10868    {
10869        self._additional_params
10870            .insert(name.as_ref().to_string(), value.as_ref().to_string());
10871        self
10872    }
10873
10874    /// Identifies the authorization scope for the method you are building.
10875    ///
10876    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
10877    /// [`Scope::CloudIdentityDevice`].
10878    ///
10879    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
10880    /// tokens for more than one scope.
10881    ///
10882    /// Usually there is more than one suitable scope to authorize an operation, some of which may
10883    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
10884    /// sufficient, a read-write scope will do as well.
10885    pub fn add_scope<St>(mut self, scope: St) -> DeviceWipeCall<'a, C>
10886    where
10887        St: AsRef<str>,
10888    {
10889        self._scopes.insert(String::from(scope.as_ref()));
10890        self
10891    }
10892    /// Identifies the authorization scope(s) for the method you are building.
10893    ///
10894    /// See [`Self::add_scope()`] for details.
10895    pub fn add_scopes<I, St>(mut self, scopes: I) -> DeviceWipeCall<'a, C>
10896    where
10897        I: IntoIterator<Item = St>,
10898        St: AsRef<str>,
10899    {
10900        self._scopes
10901            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
10902        self
10903    }
10904
10905    /// Removes all scopes, and no default scope will be used either.
10906    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
10907    /// for details).
10908    pub fn clear_scopes(mut self) -> DeviceWipeCall<'a, C> {
10909        self._scopes.clear();
10910        self
10911    }
10912}
10913
10914/// Check a potential member for membership in a group. **Note:** This feature is only available to Google Workspace Enterprise Standard, Enterprise Plus, and Enterprise for Education; and Cloud Identity Premium accounts. If the account of the member is not one of these, a 403 (PERMISSION_DENIED) HTTP status code will be returned. A member has membership to a group as long as there is a single viewable transitive membership between the group and the member. The actor must have view permissions to at least one transitive membership between the member and group.
10915///
10916/// A builder for the *memberships.checkTransitiveMembership* method supported by a *group* resource.
10917/// It is not used directly, but through a [`GroupMethods`] instance.
10918///
10919/// # Example
10920///
10921/// Instantiate a resource method builder
10922///
10923/// ```test_harness,no_run
10924/// # extern crate hyper;
10925/// # extern crate hyper_rustls;
10926/// # extern crate google_cloudidentity1 as cloudidentity1;
10927/// # async fn dox() {
10928/// # use cloudidentity1::{CloudIdentity, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
10929///
10930/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
10931/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
10932/// #     .with_native_roots()
10933/// #     .unwrap()
10934/// #     .https_only()
10935/// #     .enable_http2()
10936/// #     .build();
10937///
10938/// # let executor = hyper_util::rt::TokioExecutor::new();
10939/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
10940/// #     secret,
10941/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
10942/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
10943/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
10944/// #     ),
10945/// # ).build().await.unwrap();
10946///
10947/// # let client = hyper_util::client::legacy::Client::builder(
10948/// #     hyper_util::rt::TokioExecutor::new()
10949/// # )
10950/// # .build(
10951/// #     hyper_rustls::HttpsConnectorBuilder::new()
10952/// #         .with_native_roots()
10953/// #         .unwrap()
10954/// #         .https_or_http()
10955/// #         .enable_http2()
10956/// #         .build()
10957/// # );
10958/// # let mut hub = CloudIdentity::new(client, auth);
10959/// // You can configure optional parameters by calling the respective setters at will, and
10960/// // execute the final call using `doit()`.
10961/// // Values shown here are possibly random and not representative !
10962/// let result = hub.groups().memberships_check_transitive_membership("parent")
10963///              .query("et")
10964///              .doit().await;
10965/// # }
10966/// ```
10967pub struct GroupMembershipCheckTransitiveMembershipCall<'a, C>
10968where
10969    C: 'a,
10970{
10971    hub: &'a CloudIdentity<C>,
10972    _parent: String,
10973    _query: Option<String>,
10974    _delegate: Option<&'a mut dyn common::Delegate>,
10975    _additional_params: HashMap<String, String>,
10976    _scopes: BTreeSet<String>,
10977}
10978
10979impl<'a, C> common::CallBuilder for GroupMembershipCheckTransitiveMembershipCall<'a, C> {}
10980
10981impl<'a, C> GroupMembershipCheckTransitiveMembershipCall<'a, C>
10982where
10983    C: common::Connector,
10984{
10985    /// Perform the operation you have build so far.
10986    pub async fn doit(
10987        mut self,
10988    ) -> common::Result<(common::Response, CheckTransitiveMembershipResponse)> {
10989        use std::borrow::Cow;
10990        use std::io::{Read, Seek};
10991
10992        use common::{url::Params, ToParts};
10993        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
10994
10995        let mut dd = common::DefaultDelegate;
10996        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
10997        dlg.begin(common::MethodInfo {
10998            id: "cloudidentity.groups.memberships.checkTransitiveMembership",
10999            http_method: hyper::Method::GET,
11000        });
11001
11002        for &field in ["alt", "parent", "query"].iter() {
11003            if self._additional_params.contains_key(field) {
11004                dlg.finished(false);
11005                return Err(common::Error::FieldClash(field));
11006            }
11007        }
11008
11009        let mut params = Params::with_capacity(4 + self._additional_params.len());
11010        params.push("parent", self._parent);
11011        if let Some(value) = self._query.as_ref() {
11012            params.push("query", value);
11013        }
11014
11015        params.extend(self._additional_params.iter());
11016
11017        params.push("alt", "json");
11018        let mut url =
11019            self.hub._base_url.clone() + "v1/{+parent}/memberships:checkTransitiveMembership";
11020        if self._scopes.is_empty() {
11021            self._scopes
11022                .insert(Scope::CloudIdentityGroupReadonly.as_ref().to_string());
11023        }
11024
11025        #[allow(clippy::single_element_loop)]
11026        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
11027            url = params.uri_replacement(url, param_name, find_this, true);
11028        }
11029        {
11030            let to_remove = ["parent"];
11031            params.remove_params(&to_remove);
11032        }
11033
11034        let url = params.parse_with_url(&url);
11035
11036        loop {
11037            let token = match self
11038                .hub
11039                .auth
11040                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
11041                .await
11042            {
11043                Ok(token) => token,
11044                Err(e) => match dlg.token(e) {
11045                    Ok(token) => token,
11046                    Err(e) => {
11047                        dlg.finished(false);
11048                        return Err(common::Error::MissingToken(e));
11049                    }
11050                },
11051            };
11052            let mut req_result = {
11053                let client = &self.hub.client;
11054                dlg.pre_request();
11055                let mut req_builder = hyper::Request::builder()
11056                    .method(hyper::Method::GET)
11057                    .uri(url.as_str())
11058                    .header(USER_AGENT, self.hub._user_agent.clone());
11059
11060                if let Some(token) = token.as_ref() {
11061                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
11062                }
11063
11064                let request = req_builder
11065                    .header(CONTENT_LENGTH, 0_u64)
11066                    .body(common::to_body::<String>(None));
11067
11068                client.request(request.unwrap()).await
11069            };
11070
11071            match req_result {
11072                Err(err) => {
11073                    if let common::Retry::After(d) = dlg.http_error(&err) {
11074                        sleep(d).await;
11075                        continue;
11076                    }
11077                    dlg.finished(false);
11078                    return Err(common::Error::HttpError(err));
11079                }
11080                Ok(res) => {
11081                    let (mut parts, body) = res.into_parts();
11082                    let mut body = common::Body::new(body);
11083                    if !parts.status.is_success() {
11084                        let bytes = common::to_bytes(body).await.unwrap_or_default();
11085                        let error = serde_json::from_str(&common::to_string(&bytes));
11086                        let response = common::to_response(parts, bytes.into());
11087
11088                        if let common::Retry::After(d) =
11089                            dlg.http_failure(&response, error.as_ref().ok())
11090                        {
11091                            sleep(d).await;
11092                            continue;
11093                        }
11094
11095                        dlg.finished(false);
11096
11097                        return Err(match error {
11098                            Ok(value) => common::Error::BadRequest(value),
11099                            _ => common::Error::Failure(response),
11100                        });
11101                    }
11102                    let response = {
11103                        let bytes = common::to_bytes(body).await.unwrap_or_default();
11104                        let encoded = common::to_string(&bytes);
11105                        match serde_json::from_str(&encoded) {
11106                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
11107                            Err(error) => {
11108                                dlg.response_json_decode_error(&encoded, &error);
11109                                return Err(common::Error::JsonDecodeError(
11110                                    encoded.to_string(),
11111                                    error,
11112                                ));
11113                            }
11114                        }
11115                    };
11116
11117                    dlg.finished(true);
11118                    return Ok(response);
11119                }
11120            }
11121        }
11122    }
11123
11124    /// [Resource name](https://cloud.google.com/apis/design/resource_names) of the group to check the transitive membership in. Format: `groups/{group}`, where `group` is the unique id assigned to the Group to which the Membership belongs to.
11125    ///
11126    /// Sets the *parent* path property to the given value.
11127    ///
11128    /// Even though the property as already been set when instantiating this call,
11129    /// we provide this method for API completeness.
11130    pub fn parent(
11131        mut self,
11132        new_value: &str,
11133    ) -> GroupMembershipCheckTransitiveMembershipCall<'a, C> {
11134        self._parent = new_value.to_string();
11135        self
11136    }
11137    /// Required. A CEL expression that MUST include member specification. This is a `required` field. Certain groups are uniquely identified by both a 'member_key_id' and a 'member_key_namespace', which requires an additional query input: 'member_key_namespace'. Example query: `member_key_id == 'member_key_id_value'`
11138    ///
11139    /// Sets the *query* query property to the given value.
11140    pub fn query(mut self, new_value: &str) -> GroupMembershipCheckTransitiveMembershipCall<'a, C> {
11141        self._query = Some(new_value.to_string());
11142        self
11143    }
11144    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
11145    /// while executing the actual API request.
11146    ///
11147    /// ````text
11148    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
11149    /// ````
11150    ///
11151    /// Sets the *delegate* property to the given value.
11152    pub fn delegate(
11153        mut self,
11154        new_value: &'a mut dyn common::Delegate,
11155    ) -> GroupMembershipCheckTransitiveMembershipCall<'a, C> {
11156        self._delegate = Some(new_value);
11157        self
11158    }
11159
11160    /// Set any additional parameter of the query string used in the request.
11161    /// It should be used to set parameters which are not yet available through their own
11162    /// setters.
11163    ///
11164    /// Please note that this method must not be used to set any of the known parameters
11165    /// which have their own setter method. If done anyway, the request will fail.
11166    ///
11167    /// # Additional Parameters
11168    ///
11169    /// * *$.xgafv* (query-string) - V1 error format.
11170    /// * *access_token* (query-string) - OAuth access token.
11171    /// * *alt* (query-string) - Data format for response.
11172    /// * *callback* (query-string) - JSONP
11173    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
11174    /// * *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.
11175    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
11176    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
11177    /// * *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.
11178    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
11179    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
11180    pub fn param<T>(
11181        mut self,
11182        name: T,
11183        value: T,
11184    ) -> GroupMembershipCheckTransitiveMembershipCall<'a, C>
11185    where
11186        T: AsRef<str>,
11187    {
11188        self._additional_params
11189            .insert(name.as_ref().to_string(), value.as_ref().to_string());
11190        self
11191    }
11192
11193    /// Identifies the authorization scope for the method you are building.
11194    ///
11195    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
11196    /// [`Scope::CloudIdentityGroupReadonly`].
11197    ///
11198    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
11199    /// tokens for more than one scope.
11200    ///
11201    /// Usually there is more than one suitable scope to authorize an operation, some of which may
11202    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
11203    /// sufficient, a read-write scope will do as well.
11204    pub fn add_scope<St>(mut self, scope: St) -> GroupMembershipCheckTransitiveMembershipCall<'a, C>
11205    where
11206        St: AsRef<str>,
11207    {
11208        self._scopes.insert(String::from(scope.as_ref()));
11209        self
11210    }
11211    /// Identifies the authorization scope(s) for the method you are building.
11212    ///
11213    /// See [`Self::add_scope()`] for details.
11214    pub fn add_scopes<I, St>(
11215        mut self,
11216        scopes: I,
11217    ) -> GroupMembershipCheckTransitiveMembershipCall<'a, C>
11218    where
11219        I: IntoIterator<Item = St>,
11220        St: AsRef<str>,
11221    {
11222        self._scopes
11223            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
11224        self
11225    }
11226
11227    /// Removes all scopes, and no default scope will be used either.
11228    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
11229    /// for details).
11230    pub fn clear_scopes(mut self) -> GroupMembershipCheckTransitiveMembershipCall<'a, C> {
11231        self._scopes.clear();
11232        self
11233    }
11234}
11235
11236/// Creates a `Membership`.
11237///
11238/// A builder for the *memberships.create* method supported by a *group* resource.
11239/// It is not used directly, but through a [`GroupMethods`] instance.
11240///
11241/// # Example
11242///
11243/// Instantiate a resource method builder
11244///
11245/// ```test_harness,no_run
11246/// # extern crate hyper;
11247/// # extern crate hyper_rustls;
11248/// # extern crate google_cloudidentity1 as cloudidentity1;
11249/// use cloudidentity1::api::Membership;
11250/// # async fn dox() {
11251/// # use cloudidentity1::{CloudIdentity, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
11252///
11253/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
11254/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
11255/// #     .with_native_roots()
11256/// #     .unwrap()
11257/// #     .https_only()
11258/// #     .enable_http2()
11259/// #     .build();
11260///
11261/// # let executor = hyper_util::rt::TokioExecutor::new();
11262/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
11263/// #     secret,
11264/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
11265/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
11266/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
11267/// #     ),
11268/// # ).build().await.unwrap();
11269///
11270/// # let client = hyper_util::client::legacy::Client::builder(
11271/// #     hyper_util::rt::TokioExecutor::new()
11272/// # )
11273/// # .build(
11274/// #     hyper_rustls::HttpsConnectorBuilder::new()
11275/// #         .with_native_roots()
11276/// #         .unwrap()
11277/// #         .https_or_http()
11278/// #         .enable_http2()
11279/// #         .build()
11280/// # );
11281/// # let mut hub = CloudIdentity::new(client, auth);
11282/// // As the method needs a request, you would usually fill it with the desired information
11283/// // into the respective structure. Some of the parts shown here might not be applicable !
11284/// // Values shown here are possibly random and not representative !
11285/// let mut req = Membership::default();
11286///
11287/// // You can configure optional parameters by calling the respective setters at will, and
11288/// // execute the final call using `doit()`.
11289/// // Values shown here are possibly random and not representative !
11290/// let result = hub.groups().memberships_create(req, "parent")
11291///              .doit().await;
11292/// # }
11293/// ```
11294pub struct GroupMembershipCreateCall<'a, C>
11295where
11296    C: 'a,
11297{
11298    hub: &'a CloudIdentity<C>,
11299    _request: Membership,
11300    _parent: String,
11301    _delegate: Option<&'a mut dyn common::Delegate>,
11302    _additional_params: HashMap<String, String>,
11303    _scopes: BTreeSet<String>,
11304}
11305
11306impl<'a, C> common::CallBuilder for GroupMembershipCreateCall<'a, C> {}
11307
11308impl<'a, C> GroupMembershipCreateCall<'a, C>
11309where
11310    C: common::Connector,
11311{
11312    /// Perform the operation you have build so far.
11313    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
11314        use std::borrow::Cow;
11315        use std::io::{Read, Seek};
11316
11317        use common::{url::Params, ToParts};
11318        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
11319
11320        let mut dd = common::DefaultDelegate;
11321        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
11322        dlg.begin(common::MethodInfo {
11323            id: "cloudidentity.groups.memberships.create",
11324            http_method: hyper::Method::POST,
11325        });
11326
11327        for &field in ["alt", "parent"].iter() {
11328            if self._additional_params.contains_key(field) {
11329                dlg.finished(false);
11330                return Err(common::Error::FieldClash(field));
11331            }
11332        }
11333
11334        let mut params = Params::with_capacity(4 + self._additional_params.len());
11335        params.push("parent", self._parent);
11336
11337        params.extend(self._additional_params.iter());
11338
11339        params.push("alt", "json");
11340        let mut url = self.hub._base_url.clone() + "v1/{+parent}/memberships";
11341        if self._scopes.is_empty() {
11342            self._scopes
11343                .insert(Scope::CloudPlatform.as_ref().to_string());
11344        }
11345
11346        #[allow(clippy::single_element_loop)]
11347        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
11348            url = params.uri_replacement(url, param_name, find_this, true);
11349        }
11350        {
11351            let to_remove = ["parent"];
11352            params.remove_params(&to_remove);
11353        }
11354
11355        let url = params.parse_with_url(&url);
11356
11357        let mut json_mime_type = mime::APPLICATION_JSON;
11358        let mut request_value_reader = {
11359            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
11360            common::remove_json_null_values(&mut value);
11361            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
11362            serde_json::to_writer(&mut dst, &value).unwrap();
11363            dst
11364        };
11365        let request_size = request_value_reader
11366            .seek(std::io::SeekFrom::End(0))
11367            .unwrap();
11368        request_value_reader
11369            .seek(std::io::SeekFrom::Start(0))
11370            .unwrap();
11371
11372        loop {
11373            let token = match self
11374                .hub
11375                .auth
11376                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
11377                .await
11378            {
11379                Ok(token) => token,
11380                Err(e) => match dlg.token(e) {
11381                    Ok(token) => token,
11382                    Err(e) => {
11383                        dlg.finished(false);
11384                        return Err(common::Error::MissingToken(e));
11385                    }
11386                },
11387            };
11388            request_value_reader
11389                .seek(std::io::SeekFrom::Start(0))
11390                .unwrap();
11391            let mut req_result = {
11392                let client = &self.hub.client;
11393                dlg.pre_request();
11394                let mut req_builder = hyper::Request::builder()
11395                    .method(hyper::Method::POST)
11396                    .uri(url.as_str())
11397                    .header(USER_AGENT, self.hub._user_agent.clone());
11398
11399                if let Some(token) = token.as_ref() {
11400                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
11401                }
11402
11403                let request = req_builder
11404                    .header(CONTENT_TYPE, json_mime_type.to_string())
11405                    .header(CONTENT_LENGTH, request_size as u64)
11406                    .body(common::to_body(
11407                        request_value_reader.get_ref().clone().into(),
11408                    ));
11409
11410                client.request(request.unwrap()).await
11411            };
11412
11413            match req_result {
11414                Err(err) => {
11415                    if let common::Retry::After(d) = dlg.http_error(&err) {
11416                        sleep(d).await;
11417                        continue;
11418                    }
11419                    dlg.finished(false);
11420                    return Err(common::Error::HttpError(err));
11421                }
11422                Ok(res) => {
11423                    let (mut parts, body) = res.into_parts();
11424                    let mut body = common::Body::new(body);
11425                    if !parts.status.is_success() {
11426                        let bytes = common::to_bytes(body).await.unwrap_or_default();
11427                        let error = serde_json::from_str(&common::to_string(&bytes));
11428                        let response = common::to_response(parts, bytes.into());
11429
11430                        if let common::Retry::After(d) =
11431                            dlg.http_failure(&response, error.as_ref().ok())
11432                        {
11433                            sleep(d).await;
11434                            continue;
11435                        }
11436
11437                        dlg.finished(false);
11438
11439                        return Err(match error {
11440                            Ok(value) => common::Error::BadRequest(value),
11441                            _ => common::Error::Failure(response),
11442                        });
11443                    }
11444                    let response = {
11445                        let bytes = common::to_bytes(body).await.unwrap_or_default();
11446                        let encoded = common::to_string(&bytes);
11447                        match serde_json::from_str(&encoded) {
11448                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
11449                            Err(error) => {
11450                                dlg.response_json_decode_error(&encoded, &error);
11451                                return Err(common::Error::JsonDecodeError(
11452                                    encoded.to_string(),
11453                                    error,
11454                                ));
11455                            }
11456                        }
11457                    };
11458
11459                    dlg.finished(true);
11460                    return Ok(response);
11461                }
11462            }
11463        }
11464    }
11465
11466    ///
11467    /// Sets the *request* property to the given value.
11468    ///
11469    /// Even though the property as already been set when instantiating this call,
11470    /// we provide this method for API completeness.
11471    pub fn request(mut self, new_value: Membership) -> GroupMembershipCreateCall<'a, C> {
11472        self._request = new_value;
11473        self
11474    }
11475    /// Required. The parent `Group` resource under which to create the `Membership`. Must be of the form `groups/{group}`.
11476    ///
11477    /// Sets the *parent* path property to the given value.
11478    ///
11479    /// Even though the property as already been set when instantiating this call,
11480    /// we provide this method for API completeness.
11481    pub fn parent(mut self, new_value: &str) -> GroupMembershipCreateCall<'a, C> {
11482        self._parent = new_value.to_string();
11483        self
11484    }
11485    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
11486    /// while executing the actual API request.
11487    ///
11488    /// ````text
11489    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
11490    /// ````
11491    ///
11492    /// Sets the *delegate* property to the given value.
11493    pub fn delegate(
11494        mut self,
11495        new_value: &'a mut dyn common::Delegate,
11496    ) -> GroupMembershipCreateCall<'a, C> {
11497        self._delegate = Some(new_value);
11498        self
11499    }
11500
11501    /// Set any additional parameter of the query string used in the request.
11502    /// It should be used to set parameters which are not yet available through their own
11503    /// setters.
11504    ///
11505    /// Please note that this method must not be used to set any of the known parameters
11506    /// which have their own setter method. If done anyway, the request will fail.
11507    ///
11508    /// # Additional Parameters
11509    ///
11510    /// * *$.xgafv* (query-string) - V1 error format.
11511    /// * *access_token* (query-string) - OAuth access token.
11512    /// * *alt* (query-string) - Data format for response.
11513    /// * *callback* (query-string) - JSONP
11514    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
11515    /// * *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.
11516    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
11517    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
11518    /// * *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.
11519    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
11520    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
11521    pub fn param<T>(mut self, name: T, value: T) -> GroupMembershipCreateCall<'a, C>
11522    where
11523        T: AsRef<str>,
11524    {
11525        self._additional_params
11526            .insert(name.as_ref().to_string(), value.as_ref().to_string());
11527        self
11528    }
11529
11530    /// Identifies the authorization scope for the method you are building.
11531    ///
11532    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
11533    /// [`Scope::CloudPlatform`].
11534    ///
11535    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
11536    /// tokens for more than one scope.
11537    ///
11538    /// Usually there is more than one suitable scope to authorize an operation, some of which may
11539    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
11540    /// sufficient, a read-write scope will do as well.
11541    pub fn add_scope<St>(mut self, scope: St) -> GroupMembershipCreateCall<'a, C>
11542    where
11543        St: AsRef<str>,
11544    {
11545        self._scopes.insert(String::from(scope.as_ref()));
11546        self
11547    }
11548    /// Identifies the authorization scope(s) for the method you are building.
11549    ///
11550    /// See [`Self::add_scope()`] for details.
11551    pub fn add_scopes<I, St>(mut self, scopes: I) -> GroupMembershipCreateCall<'a, C>
11552    where
11553        I: IntoIterator<Item = St>,
11554        St: AsRef<str>,
11555    {
11556        self._scopes
11557            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
11558        self
11559    }
11560
11561    /// Removes all scopes, and no default scope will be used either.
11562    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
11563    /// for details).
11564    pub fn clear_scopes(mut self) -> GroupMembershipCreateCall<'a, C> {
11565        self._scopes.clear();
11566        self
11567    }
11568}
11569
11570/// Deletes a `Membership`.
11571///
11572/// A builder for the *memberships.delete* method supported by a *group* resource.
11573/// It is not used directly, but through a [`GroupMethods`] instance.
11574///
11575/// # Example
11576///
11577/// Instantiate a resource method builder
11578///
11579/// ```test_harness,no_run
11580/// # extern crate hyper;
11581/// # extern crate hyper_rustls;
11582/// # extern crate google_cloudidentity1 as cloudidentity1;
11583/// # async fn dox() {
11584/// # use cloudidentity1::{CloudIdentity, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
11585///
11586/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
11587/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
11588/// #     .with_native_roots()
11589/// #     .unwrap()
11590/// #     .https_only()
11591/// #     .enable_http2()
11592/// #     .build();
11593///
11594/// # let executor = hyper_util::rt::TokioExecutor::new();
11595/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
11596/// #     secret,
11597/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
11598/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
11599/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
11600/// #     ),
11601/// # ).build().await.unwrap();
11602///
11603/// # let client = hyper_util::client::legacy::Client::builder(
11604/// #     hyper_util::rt::TokioExecutor::new()
11605/// # )
11606/// # .build(
11607/// #     hyper_rustls::HttpsConnectorBuilder::new()
11608/// #         .with_native_roots()
11609/// #         .unwrap()
11610/// #         .https_or_http()
11611/// #         .enable_http2()
11612/// #         .build()
11613/// # );
11614/// # let mut hub = CloudIdentity::new(client, auth);
11615/// // You can configure optional parameters by calling the respective setters at will, and
11616/// // execute the final call using `doit()`.
11617/// // Values shown here are possibly random and not representative !
11618/// let result = hub.groups().memberships_delete("name")
11619///              .doit().await;
11620/// # }
11621/// ```
11622pub struct GroupMembershipDeleteCall<'a, C>
11623where
11624    C: 'a,
11625{
11626    hub: &'a CloudIdentity<C>,
11627    _name: String,
11628    _delegate: Option<&'a mut dyn common::Delegate>,
11629    _additional_params: HashMap<String, String>,
11630    _scopes: BTreeSet<String>,
11631}
11632
11633impl<'a, C> common::CallBuilder for GroupMembershipDeleteCall<'a, C> {}
11634
11635impl<'a, C> GroupMembershipDeleteCall<'a, C>
11636where
11637    C: common::Connector,
11638{
11639    /// Perform the operation you have build so far.
11640    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
11641        use std::borrow::Cow;
11642        use std::io::{Read, Seek};
11643
11644        use common::{url::Params, ToParts};
11645        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
11646
11647        let mut dd = common::DefaultDelegate;
11648        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
11649        dlg.begin(common::MethodInfo {
11650            id: "cloudidentity.groups.memberships.delete",
11651            http_method: hyper::Method::DELETE,
11652        });
11653
11654        for &field in ["alt", "name"].iter() {
11655            if self._additional_params.contains_key(field) {
11656                dlg.finished(false);
11657                return Err(common::Error::FieldClash(field));
11658            }
11659        }
11660
11661        let mut params = Params::with_capacity(3 + self._additional_params.len());
11662        params.push("name", self._name);
11663
11664        params.extend(self._additional_params.iter());
11665
11666        params.push("alt", "json");
11667        let mut url = self.hub._base_url.clone() + "v1/{+name}";
11668        if self._scopes.is_empty() {
11669            self._scopes
11670                .insert(Scope::CloudPlatform.as_ref().to_string());
11671        }
11672
11673        #[allow(clippy::single_element_loop)]
11674        for &(find_this, param_name) in [("{+name}", "name")].iter() {
11675            url = params.uri_replacement(url, param_name, find_this, true);
11676        }
11677        {
11678            let to_remove = ["name"];
11679            params.remove_params(&to_remove);
11680        }
11681
11682        let url = params.parse_with_url(&url);
11683
11684        loop {
11685            let token = match self
11686                .hub
11687                .auth
11688                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
11689                .await
11690            {
11691                Ok(token) => token,
11692                Err(e) => match dlg.token(e) {
11693                    Ok(token) => token,
11694                    Err(e) => {
11695                        dlg.finished(false);
11696                        return Err(common::Error::MissingToken(e));
11697                    }
11698                },
11699            };
11700            let mut req_result = {
11701                let client = &self.hub.client;
11702                dlg.pre_request();
11703                let mut req_builder = hyper::Request::builder()
11704                    .method(hyper::Method::DELETE)
11705                    .uri(url.as_str())
11706                    .header(USER_AGENT, self.hub._user_agent.clone());
11707
11708                if let Some(token) = token.as_ref() {
11709                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
11710                }
11711
11712                let request = req_builder
11713                    .header(CONTENT_LENGTH, 0_u64)
11714                    .body(common::to_body::<String>(None));
11715
11716                client.request(request.unwrap()).await
11717            };
11718
11719            match req_result {
11720                Err(err) => {
11721                    if let common::Retry::After(d) = dlg.http_error(&err) {
11722                        sleep(d).await;
11723                        continue;
11724                    }
11725                    dlg.finished(false);
11726                    return Err(common::Error::HttpError(err));
11727                }
11728                Ok(res) => {
11729                    let (mut parts, body) = res.into_parts();
11730                    let mut body = common::Body::new(body);
11731                    if !parts.status.is_success() {
11732                        let bytes = common::to_bytes(body).await.unwrap_or_default();
11733                        let error = serde_json::from_str(&common::to_string(&bytes));
11734                        let response = common::to_response(parts, bytes.into());
11735
11736                        if let common::Retry::After(d) =
11737                            dlg.http_failure(&response, error.as_ref().ok())
11738                        {
11739                            sleep(d).await;
11740                            continue;
11741                        }
11742
11743                        dlg.finished(false);
11744
11745                        return Err(match error {
11746                            Ok(value) => common::Error::BadRequest(value),
11747                            _ => common::Error::Failure(response),
11748                        });
11749                    }
11750                    let response = {
11751                        let bytes = common::to_bytes(body).await.unwrap_or_default();
11752                        let encoded = common::to_string(&bytes);
11753                        match serde_json::from_str(&encoded) {
11754                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
11755                            Err(error) => {
11756                                dlg.response_json_decode_error(&encoded, &error);
11757                                return Err(common::Error::JsonDecodeError(
11758                                    encoded.to_string(),
11759                                    error,
11760                                ));
11761                            }
11762                        }
11763                    };
11764
11765                    dlg.finished(true);
11766                    return Ok(response);
11767                }
11768            }
11769        }
11770    }
11771
11772    /// Required. The [resource name](https://cloud.google.com/apis/design/resource_names) of the `Membership` to delete. Must be of the form `groups/{group}/memberships/{membership}`
11773    ///
11774    /// Sets the *name* path property to the given value.
11775    ///
11776    /// Even though the property as already been set when instantiating this call,
11777    /// we provide this method for API completeness.
11778    pub fn name(mut self, new_value: &str) -> GroupMembershipDeleteCall<'a, C> {
11779        self._name = new_value.to_string();
11780        self
11781    }
11782    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
11783    /// while executing the actual API request.
11784    ///
11785    /// ````text
11786    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
11787    /// ````
11788    ///
11789    /// Sets the *delegate* property to the given value.
11790    pub fn delegate(
11791        mut self,
11792        new_value: &'a mut dyn common::Delegate,
11793    ) -> GroupMembershipDeleteCall<'a, C> {
11794        self._delegate = Some(new_value);
11795        self
11796    }
11797
11798    /// Set any additional parameter of the query string used in the request.
11799    /// It should be used to set parameters which are not yet available through their own
11800    /// setters.
11801    ///
11802    /// Please note that this method must not be used to set any of the known parameters
11803    /// which have their own setter method. If done anyway, the request will fail.
11804    ///
11805    /// # Additional Parameters
11806    ///
11807    /// * *$.xgafv* (query-string) - V1 error format.
11808    /// * *access_token* (query-string) - OAuth access token.
11809    /// * *alt* (query-string) - Data format for response.
11810    /// * *callback* (query-string) - JSONP
11811    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
11812    /// * *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.
11813    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
11814    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
11815    /// * *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.
11816    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
11817    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
11818    pub fn param<T>(mut self, name: T, value: T) -> GroupMembershipDeleteCall<'a, C>
11819    where
11820        T: AsRef<str>,
11821    {
11822        self._additional_params
11823            .insert(name.as_ref().to_string(), value.as_ref().to_string());
11824        self
11825    }
11826
11827    /// Identifies the authorization scope for the method you are building.
11828    ///
11829    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
11830    /// [`Scope::CloudPlatform`].
11831    ///
11832    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
11833    /// tokens for more than one scope.
11834    ///
11835    /// Usually there is more than one suitable scope to authorize an operation, some of which may
11836    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
11837    /// sufficient, a read-write scope will do as well.
11838    pub fn add_scope<St>(mut self, scope: St) -> GroupMembershipDeleteCall<'a, C>
11839    where
11840        St: AsRef<str>,
11841    {
11842        self._scopes.insert(String::from(scope.as_ref()));
11843        self
11844    }
11845    /// Identifies the authorization scope(s) for the method you are building.
11846    ///
11847    /// See [`Self::add_scope()`] for details.
11848    pub fn add_scopes<I, St>(mut self, scopes: I) -> GroupMembershipDeleteCall<'a, C>
11849    where
11850        I: IntoIterator<Item = St>,
11851        St: AsRef<str>,
11852    {
11853        self._scopes
11854            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
11855        self
11856    }
11857
11858    /// Removes all scopes, and no default scope will be used either.
11859    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
11860    /// for details).
11861    pub fn clear_scopes(mut self) -> GroupMembershipDeleteCall<'a, C> {
11862        self._scopes.clear();
11863        self
11864    }
11865}
11866
11867/// Retrieves a `Membership`.
11868///
11869/// A builder for the *memberships.get* method supported by a *group* resource.
11870/// It is not used directly, but through a [`GroupMethods`] instance.
11871///
11872/// # Example
11873///
11874/// Instantiate a resource method builder
11875///
11876/// ```test_harness,no_run
11877/// # extern crate hyper;
11878/// # extern crate hyper_rustls;
11879/// # extern crate google_cloudidentity1 as cloudidentity1;
11880/// # async fn dox() {
11881/// # use cloudidentity1::{CloudIdentity, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
11882///
11883/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
11884/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
11885/// #     .with_native_roots()
11886/// #     .unwrap()
11887/// #     .https_only()
11888/// #     .enable_http2()
11889/// #     .build();
11890///
11891/// # let executor = hyper_util::rt::TokioExecutor::new();
11892/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
11893/// #     secret,
11894/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
11895/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
11896/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
11897/// #     ),
11898/// # ).build().await.unwrap();
11899///
11900/// # let client = hyper_util::client::legacy::Client::builder(
11901/// #     hyper_util::rt::TokioExecutor::new()
11902/// # )
11903/// # .build(
11904/// #     hyper_rustls::HttpsConnectorBuilder::new()
11905/// #         .with_native_roots()
11906/// #         .unwrap()
11907/// #         .https_or_http()
11908/// #         .enable_http2()
11909/// #         .build()
11910/// # );
11911/// # let mut hub = CloudIdentity::new(client, auth);
11912/// // You can configure optional parameters by calling the respective setters at will, and
11913/// // execute the final call using `doit()`.
11914/// // Values shown here are possibly random and not representative !
11915/// let result = hub.groups().memberships_get("name")
11916///              .doit().await;
11917/// # }
11918/// ```
11919pub struct GroupMembershipGetCall<'a, C>
11920where
11921    C: 'a,
11922{
11923    hub: &'a CloudIdentity<C>,
11924    _name: String,
11925    _delegate: Option<&'a mut dyn common::Delegate>,
11926    _additional_params: HashMap<String, String>,
11927    _scopes: BTreeSet<String>,
11928}
11929
11930impl<'a, C> common::CallBuilder for GroupMembershipGetCall<'a, C> {}
11931
11932impl<'a, C> GroupMembershipGetCall<'a, C>
11933where
11934    C: common::Connector,
11935{
11936    /// Perform the operation you have build so far.
11937    pub async fn doit(mut self) -> common::Result<(common::Response, Membership)> {
11938        use std::borrow::Cow;
11939        use std::io::{Read, Seek};
11940
11941        use common::{url::Params, ToParts};
11942        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
11943
11944        let mut dd = common::DefaultDelegate;
11945        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
11946        dlg.begin(common::MethodInfo {
11947            id: "cloudidentity.groups.memberships.get",
11948            http_method: hyper::Method::GET,
11949        });
11950
11951        for &field in ["alt", "name"].iter() {
11952            if self._additional_params.contains_key(field) {
11953                dlg.finished(false);
11954                return Err(common::Error::FieldClash(field));
11955            }
11956        }
11957
11958        let mut params = Params::with_capacity(3 + self._additional_params.len());
11959        params.push("name", self._name);
11960
11961        params.extend(self._additional_params.iter());
11962
11963        params.push("alt", "json");
11964        let mut url = self.hub._base_url.clone() + "v1/{+name}";
11965        if self._scopes.is_empty() {
11966            self._scopes
11967                .insert(Scope::CloudIdentityGroupReadonly.as_ref().to_string());
11968        }
11969
11970        #[allow(clippy::single_element_loop)]
11971        for &(find_this, param_name) in [("{+name}", "name")].iter() {
11972            url = params.uri_replacement(url, param_name, find_this, true);
11973        }
11974        {
11975            let to_remove = ["name"];
11976            params.remove_params(&to_remove);
11977        }
11978
11979        let url = params.parse_with_url(&url);
11980
11981        loop {
11982            let token = match self
11983                .hub
11984                .auth
11985                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
11986                .await
11987            {
11988                Ok(token) => token,
11989                Err(e) => match dlg.token(e) {
11990                    Ok(token) => token,
11991                    Err(e) => {
11992                        dlg.finished(false);
11993                        return Err(common::Error::MissingToken(e));
11994                    }
11995                },
11996            };
11997            let mut req_result = {
11998                let client = &self.hub.client;
11999                dlg.pre_request();
12000                let mut req_builder = hyper::Request::builder()
12001                    .method(hyper::Method::GET)
12002                    .uri(url.as_str())
12003                    .header(USER_AGENT, self.hub._user_agent.clone());
12004
12005                if let Some(token) = token.as_ref() {
12006                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
12007                }
12008
12009                let request = req_builder
12010                    .header(CONTENT_LENGTH, 0_u64)
12011                    .body(common::to_body::<String>(None));
12012
12013                client.request(request.unwrap()).await
12014            };
12015
12016            match req_result {
12017                Err(err) => {
12018                    if let common::Retry::After(d) = dlg.http_error(&err) {
12019                        sleep(d).await;
12020                        continue;
12021                    }
12022                    dlg.finished(false);
12023                    return Err(common::Error::HttpError(err));
12024                }
12025                Ok(res) => {
12026                    let (mut parts, body) = res.into_parts();
12027                    let mut body = common::Body::new(body);
12028                    if !parts.status.is_success() {
12029                        let bytes = common::to_bytes(body).await.unwrap_or_default();
12030                        let error = serde_json::from_str(&common::to_string(&bytes));
12031                        let response = common::to_response(parts, bytes.into());
12032
12033                        if let common::Retry::After(d) =
12034                            dlg.http_failure(&response, error.as_ref().ok())
12035                        {
12036                            sleep(d).await;
12037                            continue;
12038                        }
12039
12040                        dlg.finished(false);
12041
12042                        return Err(match error {
12043                            Ok(value) => common::Error::BadRequest(value),
12044                            _ => common::Error::Failure(response),
12045                        });
12046                    }
12047                    let response = {
12048                        let bytes = common::to_bytes(body).await.unwrap_or_default();
12049                        let encoded = common::to_string(&bytes);
12050                        match serde_json::from_str(&encoded) {
12051                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
12052                            Err(error) => {
12053                                dlg.response_json_decode_error(&encoded, &error);
12054                                return Err(common::Error::JsonDecodeError(
12055                                    encoded.to_string(),
12056                                    error,
12057                                ));
12058                            }
12059                        }
12060                    };
12061
12062                    dlg.finished(true);
12063                    return Ok(response);
12064                }
12065            }
12066        }
12067    }
12068
12069    /// Required. The [resource name](https://cloud.google.com/apis/design/resource_names) of the `Membership` to retrieve. Must be of the form `groups/{group}/memberships/{membership}`.
12070    ///
12071    /// Sets the *name* path property to the given value.
12072    ///
12073    /// Even though the property as already been set when instantiating this call,
12074    /// we provide this method for API completeness.
12075    pub fn name(mut self, new_value: &str) -> GroupMembershipGetCall<'a, C> {
12076        self._name = new_value.to_string();
12077        self
12078    }
12079    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
12080    /// while executing the actual API request.
12081    ///
12082    /// ````text
12083    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
12084    /// ````
12085    ///
12086    /// Sets the *delegate* property to the given value.
12087    pub fn delegate(
12088        mut self,
12089        new_value: &'a mut dyn common::Delegate,
12090    ) -> GroupMembershipGetCall<'a, C> {
12091        self._delegate = Some(new_value);
12092        self
12093    }
12094
12095    /// Set any additional parameter of the query string used in the request.
12096    /// It should be used to set parameters which are not yet available through their own
12097    /// setters.
12098    ///
12099    /// Please note that this method must not be used to set any of the known parameters
12100    /// which have their own setter method. If done anyway, the request will fail.
12101    ///
12102    /// # Additional Parameters
12103    ///
12104    /// * *$.xgafv* (query-string) - V1 error format.
12105    /// * *access_token* (query-string) - OAuth access token.
12106    /// * *alt* (query-string) - Data format for response.
12107    /// * *callback* (query-string) - JSONP
12108    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
12109    /// * *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.
12110    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
12111    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
12112    /// * *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.
12113    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
12114    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
12115    pub fn param<T>(mut self, name: T, value: T) -> GroupMembershipGetCall<'a, C>
12116    where
12117        T: AsRef<str>,
12118    {
12119        self._additional_params
12120            .insert(name.as_ref().to_string(), value.as_ref().to_string());
12121        self
12122    }
12123
12124    /// Identifies the authorization scope for the method you are building.
12125    ///
12126    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
12127    /// [`Scope::CloudIdentityGroupReadonly`].
12128    ///
12129    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
12130    /// tokens for more than one scope.
12131    ///
12132    /// Usually there is more than one suitable scope to authorize an operation, some of which may
12133    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
12134    /// sufficient, a read-write scope will do as well.
12135    pub fn add_scope<St>(mut self, scope: St) -> GroupMembershipGetCall<'a, C>
12136    where
12137        St: AsRef<str>,
12138    {
12139        self._scopes.insert(String::from(scope.as_ref()));
12140        self
12141    }
12142    /// Identifies the authorization scope(s) for the method you are building.
12143    ///
12144    /// See [`Self::add_scope()`] for details.
12145    pub fn add_scopes<I, St>(mut self, scopes: I) -> GroupMembershipGetCall<'a, C>
12146    where
12147        I: IntoIterator<Item = St>,
12148        St: AsRef<str>,
12149    {
12150        self._scopes
12151            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
12152        self
12153    }
12154
12155    /// Removes all scopes, and no default scope will be used either.
12156    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
12157    /// for details).
12158    pub fn clear_scopes(mut self) -> GroupMembershipGetCall<'a, C> {
12159        self._scopes.clear();
12160        self
12161    }
12162}
12163
12164/// Get a membership graph of just a member or both a member and a group. **Note:** This feature is only available to Google Workspace Enterprise Standard, Enterprise Plus, and Enterprise for Education; and Cloud Identity Premium accounts. If the account of the member is not one of these, a 403 (PERMISSION_DENIED) HTTP status code will be returned. Given a member, the response will contain all membership paths from the member. Given both a group and a member, the response will contain all membership paths between the group and the member.
12165///
12166/// A builder for the *memberships.getMembershipGraph* method supported by a *group* resource.
12167/// It is not used directly, but through a [`GroupMethods`] instance.
12168///
12169/// # Example
12170///
12171/// Instantiate a resource method builder
12172///
12173/// ```test_harness,no_run
12174/// # extern crate hyper;
12175/// # extern crate hyper_rustls;
12176/// # extern crate google_cloudidentity1 as cloudidentity1;
12177/// # async fn dox() {
12178/// # use cloudidentity1::{CloudIdentity, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
12179///
12180/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
12181/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
12182/// #     .with_native_roots()
12183/// #     .unwrap()
12184/// #     .https_only()
12185/// #     .enable_http2()
12186/// #     .build();
12187///
12188/// # let executor = hyper_util::rt::TokioExecutor::new();
12189/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
12190/// #     secret,
12191/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
12192/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
12193/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
12194/// #     ),
12195/// # ).build().await.unwrap();
12196///
12197/// # let client = hyper_util::client::legacy::Client::builder(
12198/// #     hyper_util::rt::TokioExecutor::new()
12199/// # )
12200/// # .build(
12201/// #     hyper_rustls::HttpsConnectorBuilder::new()
12202/// #         .with_native_roots()
12203/// #         .unwrap()
12204/// #         .https_or_http()
12205/// #         .enable_http2()
12206/// #         .build()
12207/// # );
12208/// # let mut hub = CloudIdentity::new(client, auth);
12209/// // You can configure optional parameters by calling the respective setters at will, and
12210/// // execute the final call using `doit()`.
12211/// // Values shown here are possibly random and not representative !
12212/// let result = hub.groups().memberships_get_membership_graph("parent")
12213///              .query("vero")
12214///              .doit().await;
12215/// # }
12216/// ```
12217pub struct GroupMembershipGetMembershipGraphCall<'a, C>
12218where
12219    C: 'a,
12220{
12221    hub: &'a CloudIdentity<C>,
12222    _parent: String,
12223    _query: Option<String>,
12224    _delegate: Option<&'a mut dyn common::Delegate>,
12225    _additional_params: HashMap<String, String>,
12226    _scopes: BTreeSet<String>,
12227}
12228
12229impl<'a, C> common::CallBuilder for GroupMembershipGetMembershipGraphCall<'a, C> {}
12230
12231impl<'a, C> GroupMembershipGetMembershipGraphCall<'a, C>
12232where
12233    C: common::Connector,
12234{
12235    /// Perform the operation you have build so far.
12236    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
12237        use std::borrow::Cow;
12238        use std::io::{Read, Seek};
12239
12240        use common::{url::Params, ToParts};
12241        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
12242
12243        let mut dd = common::DefaultDelegate;
12244        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
12245        dlg.begin(common::MethodInfo {
12246            id: "cloudidentity.groups.memberships.getMembershipGraph",
12247            http_method: hyper::Method::GET,
12248        });
12249
12250        for &field in ["alt", "parent", "query"].iter() {
12251            if self._additional_params.contains_key(field) {
12252                dlg.finished(false);
12253                return Err(common::Error::FieldClash(field));
12254            }
12255        }
12256
12257        let mut params = Params::with_capacity(4 + self._additional_params.len());
12258        params.push("parent", self._parent);
12259        if let Some(value) = self._query.as_ref() {
12260            params.push("query", value);
12261        }
12262
12263        params.extend(self._additional_params.iter());
12264
12265        params.push("alt", "json");
12266        let mut url = self.hub._base_url.clone() + "v1/{+parent}/memberships:getMembershipGraph";
12267        if self._scopes.is_empty() {
12268            self._scopes
12269                .insert(Scope::CloudIdentityGroupReadonly.as_ref().to_string());
12270        }
12271
12272        #[allow(clippy::single_element_loop)]
12273        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
12274            url = params.uri_replacement(url, param_name, find_this, true);
12275        }
12276        {
12277            let to_remove = ["parent"];
12278            params.remove_params(&to_remove);
12279        }
12280
12281        let url = params.parse_with_url(&url);
12282
12283        loop {
12284            let token = match self
12285                .hub
12286                .auth
12287                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
12288                .await
12289            {
12290                Ok(token) => token,
12291                Err(e) => match dlg.token(e) {
12292                    Ok(token) => token,
12293                    Err(e) => {
12294                        dlg.finished(false);
12295                        return Err(common::Error::MissingToken(e));
12296                    }
12297                },
12298            };
12299            let mut req_result = {
12300                let client = &self.hub.client;
12301                dlg.pre_request();
12302                let mut req_builder = hyper::Request::builder()
12303                    .method(hyper::Method::GET)
12304                    .uri(url.as_str())
12305                    .header(USER_AGENT, self.hub._user_agent.clone());
12306
12307                if let Some(token) = token.as_ref() {
12308                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
12309                }
12310
12311                let request = req_builder
12312                    .header(CONTENT_LENGTH, 0_u64)
12313                    .body(common::to_body::<String>(None));
12314
12315                client.request(request.unwrap()).await
12316            };
12317
12318            match req_result {
12319                Err(err) => {
12320                    if let common::Retry::After(d) = dlg.http_error(&err) {
12321                        sleep(d).await;
12322                        continue;
12323                    }
12324                    dlg.finished(false);
12325                    return Err(common::Error::HttpError(err));
12326                }
12327                Ok(res) => {
12328                    let (mut parts, body) = res.into_parts();
12329                    let mut body = common::Body::new(body);
12330                    if !parts.status.is_success() {
12331                        let bytes = common::to_bytes(body).await.unwrap_or_default();
12332                        let error = serde_json::from_str(&common::to_string(&bytes));
12333                        let response = common::to_response(parts, bytes.into());
12334
12335                        if let common::Retry::After(d) =
12336                            dlg.http_failure(&response, error.as_ref().ok())
12337                        {
12338                            sleep(d).await;
12339                            continue;
12340                        }
12341
12342                        dlg.finished(false);
12343
12344                        return Err(match error {
12345                            Ok(value) => common::Error::BadRequest(value),
12346                            _ => common::Error::Failure(response),
12347                        });
12348                    }
12349                    let response = {
12350                        let bytes = common::to_bytes(body).await.unwrap_or_default();
12351                        let encoded = common::to_string(&bytes);
12352                        match serde_json::from_str(&encoded) {
12353                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
12354                            Err(error) => {
12355                                dlg.response_json_decode_error(&encoded, &error);
12356                                return Err(common::Error::JsonDecodeError(
12357                                    encoded.to_string(),
12358                                    error,
12359                                ));
12360                            }
12361                        }
12362                    };
12363
12364                    dlg.finished(true);
12365                    return Ok(response);
12366                }
12367            }
12368        }
12369    }
12370
12371    /// Required. [Resource name](https://cloud.google.com/apis/design/resource_names) of the group to search transitive memberships in. Format: `groups/{group}`, where `group` is the unique ID assigned to the Group to which the Membership belongs to. group can be a wildcard collection id "-". When a group is specified, the membership graph will be constrained to paths between the member (defined in the query) and the parent. If a wildcard collection is provided, all membership paths connected to the member will be returned.
12372    ///
12373    /// Sets the *parent* path property to the given value.
12374    ///
12375    /// Even though the property as already been set when instantiating this call,
12376    /// we provide this method for API completeness.
12377    pub fn parent(mut self, new_value: &str) -> GroupMembershipGetMembershipGraphCall<'a, C> {
12378        self._parent = new_value.to_string();
12379        self
12380    }
12381    /// Required. A CEL expression that MUST include member specification AND label(s). Certain groups are uniquely identified by both a 'member_key_id' and a 'member_key_namespace', which requires an additional query input: 'member_key_namespace'. Example query: `member_key_id == 'member_key_id_value' && in labels`
12382    ///
12383    /// Sets the *query* query property to the given value.
12384    pub fn query(mut self, new_value: &str) -> GroupMembershipGetMembershipGraphCall<'a, C> {
12385        self._query = Some(new_value.to_string());
12386        self
12387    }
12388    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
12389    /// while executing the actual API request.
12390    ///
12391    /// ````text
12392    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
12393    /// ````
12394    ///
12395    /// Sets the *delegate* property to the given value.
12396    pub fn delegate(
12397        mut self,
12398        new_value: &'a mut dyn common::Delegate,
12399    ) -> GroupMembershipGetMembershipGraphCall<'a, C> {
12400        self._delegate = Some(new_value);
12401        self
12402    }
12403
12404    /// Set any additional parameter of the query string used in the request.
12405    /// It should be used to set parameters which are not yet available through their own
12406    /// setters.
12407    ///
12408    /// Please note that this method must not be used to set any of the known parameters
12409    /// which have their own setter method. If done anyway, the request will fail.
12410    ///
12411    /// # Additional Parameters
12412    ///
12413    /// * *$.xgafv* (query-string) - V1 error format.
12414    /// * *access_token* (query-string) - OAuth access token.
12415    /// * *alt* (query-string) - Data format for response.
12416    /// * *callback* (query-string) - JSONP
12417    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
12418    /// * *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.
12419    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
12420    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
12421    /// * *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.
12422    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
12423    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
12424    pub fn param<T>(mut self, name: T, value: T) -> GroupMembershipGetMembershipGraphCall<'a, C>
12425    where
12426        T: AsRef<str>,
12427    {
12428        self._additional_params
12429            .insert(name.as_ref().to_string(), value.as_ref().to_string());
12430        self
12431    }
12432
12433    /// Identifies the authorization scope for the method you are building.
12434    ///
12435    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
12436    /// [`Scope::CloudIdentityGroupReadonly`].
12437    ///
12438    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
12439    /// tokens for more than one scope.
12440    ///
12441    /// Usually there is more than one suitable scope to authorize an operation, some of which may
12442    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
12443    /// sufficient, a read-write scope will do as well.
12444    pub fn add_scope<St>(mut self, scope: St) -> GroupMembershipGetMembershipGraphCall<'a, C>
12445    where
12446        St: AsRef<str>,
12447    {
12448        self._scopes.insert(String::from(scope.as_ref()));
12449        self
12450    }
12451    /// Identifies the authorization scope(s) for the method you are building.
12452    ///
12453    /// See [`Self::add_scope()`] for details.
12454    pub fn add_scopes<I, St>(mut self, scopes: I) -> GroupMembershipGetMembershipGraphCall<'a, C>
12455    where
12456        I: IntoIterator<Item = St>,
12457        St: AsRef<str>,
12458    {
12459        self._scopes
12460            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
12461        self
12462    }
12463
12464    /// Removes all scopes, and no default scope will be used either.
12465    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
12466    /// for details).
12467    pub fn clear_scopes(mut self) -> GroupMembershipGetMembershipGraphCall<'a, C> {
12468        self._scopes.clear();
12469        self
12470    }
12471}
12472
12473/// Lists the `Membership`s within a `Group`.
12474///
12475/// A builder for the *memberships.list* method supported by a *group* resource.
12476/// It is not used directly, but through a [`GroupMethods`] instance.
12477///
12478/// # Example
12479///
12480/// Instantiate a resource method builder
12481///
12482/// ```test_harness,no_run
12483/// # extern crate hyper;
12484/// # extern crate hyper_rustls;
12485/// # extern crate google_cloudidentity1 as cloudidentity1;
12486/// # async fn dox() {
12487/// # use cloudidentity1::{CloudIdentity, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
12488///
12489/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
12490/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
12491/// #     .with_native_roots()
12492/// #     .unwrap()
12493/// #     .https_only()
12494/// #     .enable_http2()
12495/// #     .build();
12496///
12497/// # let executor = hyper_util::rt::TokioExecutor::new();
12498/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
12499/// #     secret,
12500/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
12501/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
12502/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
12503/// #     ),
12504/// # ).build().await.unwrap();
12505///
12506/// # let client = hyper_util::client::legacy::Client::builder(
12507/// #     hyper_util::rt::TokioExecutor::new()
12508/// # )
12509/// # .build(
12510/// #     hyper_rustls::HttpsConnectorBuilder::new()
12511/// #         .with_native_roots()
12512/// #         .unwrap()
12513/// #         .https_or_http()
12514/// #         .enable_http2()
12515/// #         .build()
12516/// # );
12517/// # let mut hub = CloudIdentity::new(client, auth);
12518/// // You can configure optional parameters by calling the respective setters at will, and
12519/// // execute the final call using `doit()`.
12520/// // Values shown here are possibly random and not representative !
12521/// let result = hub.groups().memberships_list("parent")
12522///              .view("invidunt")
12523///              .page_token("Stet")
12524///              .page_size(-76)
12525///              .doit().await;
12526/// # }
12527/// ```
12528pub struct GroupMembershipListCall<'a, C>
12529where
12530    C: 'a,
12531{
12532    hub: &'a CloudIdentity<C>,
12533    _parent: String,
12534    _view: Option<String>,
12535    _page_token: Option<String>,
12536    _page_size: Option<i32>,
12537    _delegate: Option<&'a mut dyn common::Delegate>,
12538    _additional_params: HashMap<String, String>,
12539    _scopes: BTreeSet<String>,
12540}
12541
12542impl<'a, C> common::CallBuilder for GroupMembershipListCall<'a, C> {}
12543
12544impl<'a, C> GroupMembershipListCall<'a, C>
12545where
12546    C: common::Connector,
12547{
12548    /// Perform the operation you have build so far.
12549    pub async fn doit(mut self) -> common::Result<(common::Response, ListMembershipsResponse)> {
12550        use std::borrow::Cow;
12551        use std::io::{Read, Seek};
12552
12553        use common::{url::Params, ToParts};
12554        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
12555
12556        let mut dd = common::DefaultDelegate;
12557        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
12558        dlg.begin(common::MethodInfo {
12559            id: "cloudidentity.groups.memberships.list",
12560            http_method: hyper::Method::GET,
12561        });
12562
12563        for &field in ["alt", "parent", "view", "pageToken", "pageSize"].iter() {
12564            if self._additional_params.contains_key(field) {
12565                dlg.finished(false);
12566                return Err(common::Error::FieldClash(field));
12567            }
12568        }
12569
12570        let mut params = Params::with_capacity(6 + self._additional_params.len());
12571        params.push("parent", self._parent);
12572        if let Some(value) = self._view.as_ref() {
12573            params.push("view", value);
12574        }
12575        if let Some(value) = self._page_token.as_ref() {
12576            params.push("pageToken", value);
12577        }
12578        if let Some(value) = self._page_size.as_ref() {
12579            params.push("pageSize", value.to_string());
12580        }
12581
12582        params.extend(self._additional_params.iter());
12583
12584        params.push("alt", "json");
12585        let mut url = self.hub._base_url.clone() + "v1/{+parent}/memberships";
12586        if self._scopes.is_empty() {
12587            self._scopes
12588                .insert(Scope::CloudIdentityGroupReadonly.as_ref().to_string());
12589        }
12590
12591        #[allow(clippy::single_element_loop)]
12592        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
12593            url = params.uri_replacement(url, param_name, find_this, true);
12594        }
12595        {
12596            let to_remove = ["parent"];
12597            params.remove_params(&to_remove);
12598        }
12599
12600        let url = params.parse_with_url(&url);
12601
12602        loop {
12603            let token = match self
12604                .hub
12605                .auth
12606                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
12607                .await
12608            {
12609                Ok(token) => token,
12610                Err(e) => match dlg.token(e) {
12611                    Ok(token) => token,
12612                    Err(e) => {
12613                        dlg.finished(false);
12614                        return Err(common::Error::MissingToken(e));
12615                    }
12616                },
12617            };
12618            let mut req_result = {
12619                let client = &self.hub.client;
12620                dlg.pre_request();
12621                let mut req_builder = hyper::Request::builder()
12622                    .method(hyper::Method::GET)
12623                    .uri(url.as_str())
12624                    .header(USER_AGENT, self.hub._user_agent.clone());
12625
12626                if let Some(token) = token.as_ref() {
12627                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
12628                }
12629
12630                let request = req_builder
12631                    .header(CONTENT_LENGTH, 0_u64)
12632                    .body(common::to_body::<String>(None));
12633
12634                client.request(request.unwrap()).await
12635            };
12636
12637            match req_result {
12638                Err(err) => {
12639                    if let common::Retry::After(d) = dlg.http_error(&err) {
12640                        sleep(d).await;
12641                        continue;
12642                    }
12643                    dlg.finished(false);
12644                    return Err(common::Error::HttpError(err));
12645                }
12646                Ok(res) => {
12647                    let (mut parts, body) = res.into_parts();
12648                    let mut body = common::Body::new(body);
12649                    if !parts.status.is_success() {
12650                        let bytes = common::to_bytes(body).await.unwrap_or_default();
12651                        let error = serde_json::from_str(&common::to_string(&bytes));
12652                        let response = common::to_response(parts, bytes.into());
12653
12654                        if let common::Retry::After(d) =
12655                            dlg.http_failure(&response, error.as_ref().ok())
12656                        {
12657                            sleep(d).await;
12658                            continue;
12659                        }
12660
12661                        dlg.finished(false);
12662
12663                        return Err(match error {
12664                            Ok(value) => common::Error::BadRequest(value),
12665                            _ => common::Error::Failure(response),
12666                        });
12667                    }
12668                    let response = {
12669                        let bytes = common::to_bytes(body).await.unwrap_or_default();
12670                        let encoded = common::to_string(&bytes);
12671                        match serde_json::from_str(&encoded) {
12672                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
12673                            Err(error) => {
12674                                dlg.response_json_decode_error(&encoded, &error);
12675                                return Err(common::Error::JsonDecodeError(
12676                                    encoded.to_string(),
12677                                    error,
12678                                ));
12679                            }
12680                        }
12681                    };
12682
12683                    dlg.finished(true);
12684                    return Ok(response);
12685                }
12686            }
12687        }
12688    }
12689
12690    /// Required. The parent `Group` resource under which to lookup the `Membership` name. Must be of the form `groups/{group}`.
12691    ///
12692    /// Sets the *parent* path property to the given value.
12693    ///
12694    /// Even though the property as already been set when instantiating this call,
12695    /// we provide this method for API completeness.
12696    pub fn parent(mut self, new_value: &str) -> GroupMembershipListCall<'a, C> {
12697        self._parent = new_value.to_string();
12698        self
12699    }
12700    /// The level of detail to be returned. If unspecified, defaults to `View.BASIC`.
12701    ///
12702    /// Sets the *view* query property to the given value.
12703    pub fn view(mut self, new_value: &str) -> GroupMembershipListCall<'a, C> {
12704        self._view = Some(new_value.to_string());
12705        self
12706    }
12707    /// The `next_page_token` value returned from a previous search request, if any.
12708    ///
12709    /// Sets the *page token* query property to the given value.
12710    pub fn page_token(mut self, new_value: &str) -> GroupMembershipListCall<'a, C> {
12711        self._page_token = Some(new_value.to_string());
12712        self
12713    }
12714    /// The maximum number of results to return. Note that the number of results returned may be less than this value even if there are more available results. To fetch all results, clients must continue calling this method repeatedly until the response no longer contains a `next_page_token`. If unspecified, defaults to 200 for `GroupView.BASIC` and to 50 for `GroupView.FULL`. Must not be greater than 1000 for `GroupView.BASIC` or 500 for `GroupView.FULL`.
12715    ///
12716    /// Sets the *page size* query property to the given value.
12717    pub fn page_size(mut self, new_value: i32) -> GroupMembershipListCall<'a, C> {
12718        self._page_size = Some(new_value);
12719        self
12720    }
12721    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
12722    /// while executing the actual API request.
12723    ///
12724    /// ````text
12725    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
12726    /// ````
12727    ///
12728    /// Sets the *delegate* property to the given value.
12729    pub fn delegate(
12730        mut self,
12731        new_value: &'a mut dyn common::Delegate,
12732    ) -> GroupMembershipListCall<'a, C> {
12733        self._delegate = Some(new_value);
12734        self
12735    }
12736
12737    /// Set any additional parameter of the query string used in the request.
12738    /// It should be used to set parameters which are not yet available through their own
12739    /// setters.
12740    ///
12741    /// Please note that this method must not be used to set any of the known parameters
12742    /// which have their own setter method. If done anyway, the request will fail.
12743    ///
12744    /// # Additional Parameters
12745    ///
12746    /// * *$.xgafv* (query-string) - V1 error format.
12747    /// * *access_token* (query-string) - OAuth access token.
12748    /// * *alt* (query-string) - Data format for response.
12749    /// * *callback* (query-string) - JSONP
12750    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
12751    /// * *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.
12752    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
12753    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
12754    /// * *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.
12755    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
12756    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
12757    pub fn param<T>(mut self, name: T, value: T) -> GroupMembershipListCall<'a, C>
12758    where
12759        T: AsRef<str>,
12760    {
12761        self._additional_params
12762            .insert(name.as_ref().to_string(), value.as_ref().to_string());
12763        self
12764    }
12765
12766    /// Identifies the authorization scope for the method you are building.
12767    ///
12768    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
12769    /// [`Scope::CloudIdentityGroupReadonly`].
12770    ///
12771    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
12772    /// tokens for more than one scope.
12773    ///
12774    /// Usually there is more than one suitable scope to authorize an operation, some of which may
12775    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
12776    /// sufficient, a read-write scope will do as well.
12777    pub fn add_scope<St>(mut self, scope: St) -> GroupMembershipListCall<'a, C>
12778    where
12779        St: AsRef<str>,
12780    {
12781        self._scopes.insert(String::from(scope.as_ref()));
12782        self
12783    }
12784    /// Identifies the authorization scope(s) for the method you are building.
12785    ///
12786    /// See [`Self::add_scope()`] for details.
12787    pub fn add_scopes<I, St>(mut self, scopes: I) -> GroupMembershipListCall<'a, C>
12788    where
12789        I: IntoIterator<Item = St>,
12790        St: AsRef<str>,
12791    {
12792        self._scopes
12793            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
12794        self
12795    }
12796
12797    /// Removes all scopes, and no default scope will be used either.
12798    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
12799    /// for details).
12800    pub fn clear_scopes(mut self) -> GroupMembershipListCall<'a, C> {
12801        self._scopes.clear();
12802        self
12803    }
12804}
12805
12806/// Looks up the [resource name](https://cloud.google.com/apis/design/resource_names) of a `Membership` by its `EntityKey`.
12807///
12808/// A builder for the *memberships.lookup* method supported by a *group* resource.
12809/// It is not used directly, but through a [`GroupMethods`] instance.
12810///
12811/// # Example
12812///
12813/// Instantiate a resource method builder
12814///
12815/// ```test_harness,no_run
12816/// # extern crate hyper;
12817/// # extern crate hyper_rustls;
12818/// # extern crate google_cloudidentity1 as cloudidentity1;
12819/// # async fn dox() {
12820/// # use cloudidentity1::{CloudIdentity, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
12821///
12822/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
12823/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
12824/// #     .with_native_roots()
12825/// #     .unwrap()
12826/// #     .https_only()
12827/// #     .enable_http2()
12828/// #     .build();
12829///
12830/// # let executor = hyper_util::rt::TokioExecutor::new();
12831/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
12832/// #     secret,
12833/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
12834/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
12835/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
12836/// #     ),
12837/// # ).build().await.unwrap();
12838///
12839/// # let client = hyper_util::client::legacy::Client::builder(
12840/// #     hyper_util::rt::TokioExecutor::new()
12841/// # )
12842/// # .build(
12843/// #     hyper_rustls::HttpsConnectorBuilder::new()
12844/// #         .with_native_roots()
12845/// #         .unwrap()
12846/// #         .https_or_http()
12847/// #         .enable_http2()
12848/// #         .build()
12849/// # );
12850/// # let mut hub = CloudIdentity::new(client, auth);
12851/// // You can configure optional parameters by calling the respective setters at will, and
12852/// // execute the final call using `doit()`.
12853/// // Values shown here are possibly random and not representative !
12854/// let result = hub.groups().memberships_lookup("parent")
12855///              .member_key_namespace("Lorem")
12856///              .member_key_id("diam")
12857///              .doit().await;
12858/// # }
12859/// ```
12860pub struct GroupMembershipLookupCall<'a, C>
12861where
12862    C: 'a,
12863{
12864    hub: &'a CloudIdentity<C>,
12865    _parent: String,
12866    _member_key_namespace: Option<String>,
12867    _member_key_id: Option<String>,
12868    _delegate: Option<&'a mut dyn common::Delegate>,
12869    _additional_params: HashMap<String, String>,
12870    _scopes: BTreeSet<String>,
12871}
12872
12873impl<'a, C> common::CallBuilder for GroupMembershipLookupCall<'a, C> {}
12874
12875impl<'a, C> GroupMembershipLookupCall<'a, C>
12876where
12877    C: common::Connector,
12878{
12879    /// Perform the operation you have build so far.
12880    pub async fn doit(
12881        mut self,
12882    ) -> common::Result<(common::Response, LookupMembershipNameResponse)> {
12883        use std::borrow::Cow;
12884        use std::io::{Read, Seek};
12885
12886        use common::{url::Params, ToParts};
12887        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
12888
12889        let mut dd = common::DefaultDelegate;
12890        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
12891        dlg.begin(common::MethodInfo {
12892            id: "cloudidentity.groups.memberships.lookup",
12893            http_method: hyper::Method::GET,
12894        });
12895
12896        for &field in ["alt", "parent", "memberKey.namespace", "memberKey.id"].iter() {
12897            if self._additional_params.contains_key(field) {
12898                dlg.finished(false);
12899                return Err(common::Error::FieldClash(field));
12900            }
12901        }
12902
12903        let mut params = Params::with_capacity(5 + self._additional_params.len());
12904        params.push("parent", self._parent);
12905        if let Some(value) = self._member_key_namespace.as_ref() {
12906            params.push("memberKey.namespace", value);
12907        }
12908        if let Some(value) = self._member_key_id.as_ref() {
12909            params.push("memberKey.id", value);
12910        }
12911
12912        params.extend(self._additional_params.iter());
12913
12914        params.push("alt", "json");
12915        let mut url = self.hub._base_url.clone() + "v1/{+parent}/memberships:lookup";
12916        if self._scopes.is_empty() {
12917            self._scopes
12918                .insert(Scope::CloudIdentityGroupReadonly.as_ref().to_string());
12919        }
12920
12921        #[allow(clippy::single_element_loop)]
12922        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
12923            url = params.uri_replacement(url, param_name, find_this, true);
12924        }
12925        {
12926            let to_remove = ["parent"];
12927            params.remove_params(&to_remove);
12928        }
12929
12930        let url = params.parse_with_url(&url);
12931
12932        loop {
12933            let token = match self
12934                .hub
12935                .auth
12936                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
12937                .await
12938            {
12939                Ok(token) => token,
12940                Err(e) => match dlg.token(e) {
12941                    Ok(token) => token,
12942                    Err(e) => {
12943                        dlg.finished(false);
12944                        return Err(common::Error::MissingToken(e));
12945                    }
12946                },
12947            };
12948            let mut req_result = {
12949                let client = &self.hub.client;
12950                dlg.pre_request();
12951                let mut req_builder = hyper::Request::builder()
12952                    .method(hyper::Method::GET)
12953                    .uri(url.as_str())
12954                    .header(USER_AGENT, self.hub._user_agent.clone());
12955
12956                if let Some(token) = token.as_ref() {
12957                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
12958                }
12959
12960                let request = req_builder
12961                    .header(CONTENT_LENGTH, 0_u64)
12962                    .body(common::to_body::<String>(None));
12963
12964                client.request(request.unwrap()).await
12965            };
12966
12967            match req_result {
12968                Err(err) => {
12969                    if let common::Retry::After(d) = dlg.http_error(&err) {
12970                        sleep(d).await;
12971                        continue;
12972                    }
12973                    dlg.finished(false);
12974                    return Err(common::Error::HttpError(err));
12975                }
12976                Ok(res) => {
12977                    let (mut parts, body) = res.into_parts();
12978                    let mut body = common::Body::new(body);
12979                    if !parts.status.is_success() {
12980                        let bytes = common::to_bytes(body).await.unwrap_or_default();
12981                        let error = serde_json::from_str(&common::to_string(&bytes));
12982                        let response = common::to_response(parts, bytes.into());
12983
12984                        if let common::Retry::After(d) =
12985                            dlg.http_failure(&response, error.as_ref().ok())
12986                        {
12987                            sleep(d).await;
12988                            continue;
12989                        }
12990
12991                        dlg.finished(false);
12992
12993                        return Err(match error {
12994                            Ok(value) => common::Error::BadRequest(value),
12995                            _ => common::Error::Failure(response),
12996                        });
12997                    }
12998                    let response = {
12999                        let bytes = common::to_bytes(body).await.unwrap_or_default();
13000                        let encoded = common::to_string(&bytes);
13001                        match serde_json::from_str(&encoded) {
13002                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
13003                            Err(error) => {
13004                                dlg.response_json_decode_error(&encoded, &error);
13005                                return Err(common::Error::JsonDecodeError(
13006                                    encoded.to_string(),
13007                                    error,
13008                                ));
13009                            }
13010                        }
13011                    };
13012
13013                    dlg.finished(true);
13014                    return Ok(response);
13015                }
13016            }
13017        }
13018    }
13019
13020    /// Required. The parent `Group` resource under which to lookup the `Membership` name. Must be of the form `groups/{group}`.
13021    ///
13022    /// Sets the *parent* path property to the given value.
13023    ///
13024    /// Even though the property as already been set when instantiating this call,
13025    /// we provide this method for API completeness.
13026    pub fn parent(mut self, new_value: &str) -> GroupMembershipLookupCall<'a, C> {
13027        self._parent = new_value.to_string();
13028        self
13029    }
13030    /// The namespace in which the entity exists. If not specified, the `EntityKey` represents a Google-managed entity such as a Google user or a Google Group. If specified, the `EntityKey` represents an external-identity-mapped group. The namespace must correspond to an identity source created in Admin Console and must be in the form of `identitysources/{identity_source}`.
13031    ///
13032    /// Sets the *member key.namespace* query property to the given value.
13033    pub fn member_key_namespace(mut self, new_value: &str) -> GroupMembershipLookupCall<'a, C> {
13034        self._member_key_namespace = Some(new_value.to_string());
13035        self
13036    }
13037    /// The ID of the entity. For Google-managed entities, the `id` should be the email address of an existing group or user. Email addresses need to adhere to [name guidelines for users and groups](https://support.google.com/a/answer/9193374). For external-identity-mapped entities, the `id` must be a string conforming to the Identity Source's requirements. Must be unique within a `namespace`.
13038    ///
13039    /// Sets the *member key.id* query property to the given value.
13040    pub fn member_key_id(mut self, new_value: &str) -> GroupMembershipLookupCall<'a, C> {
13041        self._member_key_id = Some(new_value.to_string());
13042        self
13043    }
13044    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
13045    /// while executing the actual API request.
13046    ///
13047    /// ````text
13048    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
13049    /// ````
13050    ///
13051    /// Sets the *delegate* property to the given value.
13052    pub fn delegate(
13053        mut self,
13054        new_value: &'a mut dyn common::Delegate,
13055    ) -> GroupMembershipLookupCall<'a, C> {
13056        self._delegate = Some(new_value);
13057        self
13058    }
13059
13060    /// Set any additional parameter of the query string used in the request.
13061    /// It should be used to set parameters which are not yet available through their own
13062    /// setters.
13063    ///
13064    /// Please note that this method must not be used to set any of the known parameters
13065    /// which have their own setter method. If done anyway, the request will fail.
13066    ///
13067    /// # Additional Parameters
13068    ///
13069    /// * *$.xgafv* (query-string) - V1 error format.
13070    /// * *access_token* (query-string) - OAuth access token.
13071    /// * *alt* (query-string) - Data format for response.
13072    /// * *callback* (query-string) - JSONP
13073    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
13074    /// * *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.
13075    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
13076    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
13077    /// * *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.
13078    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
13079    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
13080    pub fn param<T>(mut self, name: T, value: T) -> GroupMembershipLookupCall<'a, C>
13081    where
13082        T: AsRef<str>,
13083    {
13084        self._additional_params
13085            .insert(name.as_ref().to_string(), value.as_ref().to_string());
13086        self
13087    }
13088
13089    /// Identifies the authorization scope for the method you are building.
13090    ///
13091    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
13092    /// [`Scope::CloudIdentityGroupReadonly`].
13093    ///
13094    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
13095    /// tokens for more than one scope.
13096    ///
13097    /// Usually there is more than one suitable scope to authorize an operation, some of which may
13098    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
13099    /// sufficient, a read-write scope will do as well.
13100    pub fn add_scope<St>(mut self, scope: St) -> GroupMembershipLookupCall<'a, C>
13101    where
13102        St: AsRef<str>,
13103    {
13104        self._scopes.insert(String::from(scope.as_ref()));
13105        self
13106    }
13107    /// Identifies the authorization scope(s) for the method you are building.
13108    ///
13109    /// See [`Self::add_scope()`] for details.
13110    pub fn add_scopes<I, St>(mut self, scopes: I) -> GroupMembershipLookupCall<'a, C>
13111    where
13112        I: IntoIterator<Item = St>,
13113        St: AsRef<str>,
13114    {
13115        self._scopes
13116            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
13117        self
13118    }
13119
13120    /// Removes all scopes, and no default scope will be used either.
13121    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
13122    /// for details).
13123    pub fn clear_scopes(mut self) -> GroupMembershipLookupCall<'a, C> {
13124        self._scopes.clear();
13125        self
13126    }
13127}
13128
13129/// Modifies the `MembershipRole`s of a `Membership`.
13130///
13131/// A builder for the *memberships.modifyMembershipRoles* method supported by a *group* resource.
13132/// It is not used directly, but through a [`GroupMethods`] instance.
13133///
13134/// # Example
13135///
13136/// Instantiate a resource method builder
13137///
13138/// ```test_harness,no_run
13139/// # extern crate hyper;
13140/// # extern crate hyper_rustls;
13141/// # extern crate google_cloudidentity1 as cloudidentity1;
13142/// use cloudidentity1::api::ModifyMembershipRolesRequest;
13143/// # async fn dox() {
13144/// # use cloudidentity1::{CloudIdentity, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
13145///
13146/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
13147/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
13148/// #     .with_native_roots()
13149/// #     .unwrap()
13150/// #     .https_only()
13151/// #     .enable_http2()
13152/// #     .build();
13153///
13154/// # let executor = hyper_util::rt::TokioExecutor::new();
13155/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
13156/// #     secret,
13157/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
13158/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
13159/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
13160/// #     ),
13161/// # ).build().await.unwrap();
13162///
13163/// # let client = hyper_util::client::legacy::Client::builder(
13164/// #     hyper_util::rt::TokioExecutor::new()
13165/// # )
13166/// # .build(
13167/// #     hyper_rustls::HttpsConnectorBuilder::new()
13168/// #         .with_native_roots()
13169/// #         .unwrap()
13170/// #         .https_or_http()
13171/// #         .enable_http2()
13172/// #         .build()
13173/// # );
13174/// # let mut hub = CloudIdentity::new(client, auth);
13175/// // As the method needs a request, you would usually fill it with the desired information
13176/// // into the respective structure. Some of the parts shown here might not be applicable !
13177/// // Values shown here are possibly random and not representative !
13178/// let mut req = ModifyMembershipRolesRequest::default();
13179///
13180/// // You can configure optional parameters by calling the respective setters at will, and
13181/// // execute the final call using `doit()`.
13182/// // Values shown here are possibly random and not representative !
13183/// let result = hub.groups().memberships_modify_membership_roles(req, "name")
13184///              .doit().await;
13185/// # }
13186/// ```
13187pub struct GroupMembershipModifyMembershipRoleCall<'a, C>
13188where
13189    C: 'a,
13190{
13191    hub: &'a CloudIdentity<C>,
13192    _request: ModifyMembershipRolesRequest,
13193    _name: String,
13194    _delegate: Option<&'a mut dyn common::Delegate>,
13195    _additional_params: HashMap<String, String>,
13196    _scopes: BTreeSet<String>,
13197}
13198
13199impl<'a, C> common::CallBuilder for GroupMembershipModifyMembershipRoleCall<'a, C> {}
13200
13201impl<'a, C> GroupMembershipModifyMembershipRoleCall<'a, C>
13202where
13203    C: common::Connector,
13204{
13205    /// Perform the operation you have build so far.
13206    pub async fn doit(
13207        mut self,
13208    ) -> common::Result<(common::Response, ModifyMembershipRolesResponse)> {
13209        use std::borrow::Cow;
13210        use std::io::{Read, Seek};
13211
13212        use common::{url::Params, ToParts};
13213        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
13214
13215        let mut dd = common::DefaultDelegate;
13216        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
13217        dlg.begin(common::MethodInfo {
13218            id: "cloudidentity.groups.memberships.modifyMembershipRoles",
13219            http_method: hyper::Method::POST,
13220        });
13221
13222        for &field in ["alt", "name"].iter() {
13223            if self._additional_params.contains_key(field) {
13224                dlg.finished(false);
13225                return Err(common::Error::FieldClash(field));
13226            }
13227        }
13228
13229        let mut params = Params::with_capacity(4 + self._additional_params.len());
13230        params.push("name", self._name);
13231
13232        params.extend(self._additional_params.iter());
13233
13234        params.push("alt", "json");
13235        let mut url = self.hub._base_url.clone() + "v1/{+name}:modifyMembershipRoles";
13236        if self._scopes.is_empty() {
13237            self._scopes
13238                .insert(Scope::CloudPlatform.as_ref().to_string());
13239        }
13240
13241        #[allow(clippy::single_element_loop)]
13242        for &(find_this, param_name) in [("{+name}", "name")].iter() {
13243            url = params.uri_replacement(url, param_name, find_this, true);
13244        }
13245        {
13246            let to_remove = ["name"];
13247            params.remove_params(&to_remove);
13248        }
13249
13250        let url = params.parse_with_url(&url);
13251
13252        let mut json_mime_type = mime::APPLICATION_JSON;
13253        let mut request_value_reader = {
13254            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
13255            common::remove_json_null_values(&mut value);
13256            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
13257            serde_json::to_writer(&mut dst, &value).unwrap();
13258            dst
13259        };
13260        let request_size = request_value_reader
13261            .seek(std::io::SeekFrom::End(0))
13262            .unwrap();
13263        request_value_reader
13264            .seek(std::io::SeekFrom::Start(0))
13265            .unwrap();
13266
13267        loop {
13268            let token = match self
13269                .hub
13270                .auth
13271                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
13272                .await
13273            {
13274                Ok(token) => token,
13275                Err(e) => match dlg.token(e) {
13276                    Ok(token) => token,
13277                    Err(e) => {
13278                        dlg.finished(false);
13279                        return Err(common::Error::MissingToken(e));
13280                    }
13281                },
13282            };
13283            request_value_reader
13284                .seek(std::io::SeekFrom::Start(0))
13285                .unwrap();
13286            let mut req_result = {
13287                let client = &self.hub.client;
13288                dlg.pre_request();
13289                let mut req_builder = hyper::Request::builder()
13290                    .method(hyper::Method::POST)
13291                    .uri(url.as_str())
13292                    .header(USER_AGENT, self.hub._user_agent.clone());
13293
13294                if let Some(token) = token.as_ref() {
13295                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
13296                }
13297
13298                let request = req_builder
13299                    .header(CONTENT_TYPE, json_mime_type.to_string())
13300                    .header(CONTENT_LENGTH, request_size as u64)
13301                    .body(common::to_body(
13302                        request_value_reader.get_ref().clone().into(),
13303                    ));
13304
13305                client.request(request.unwrap()).await
13306            };
13307
13308            match req_result {
13309                Err(err) => {
13310                    if let common::Retry::After(d) = dlg.http_error(&err) {
13311                        sleep(d).await;
13312                        continue;
13313                    }
13314                    dlg.finished(false);
13315                    return Err(common::Error::HttpError(err));
13316                }
13317                Ok(res) => {
13318                    let (mut parts, body) = res.into_parts();
13319                    let mut body = common::Body::new(body);
13320                    if !parts.status.is_success() {
13321                        let bytes = common::to_bytes(body).await.unwrap_or_default();
13322                        let error = serde_json::from_str(&common::to_string(&bytes));
13323                        let response = common::to_response(parts, bytes.into());
13324
13325                        if let common::Retry::After(d) =
13326                            dlg.http_failure(&response, error.as_ref().ok())
13327                        {
13328                            sleep(d).await;
13329                            continue;
13330                        }
13331
13332                        dlg.finished(false);
13333
13334                        return Err(match error {
13335                            Ok(value) => common::Error::BadRequest(value),
13336                            _ => common::Error::Failure(response),
13337                        });
13338                    }
13339                    let response = {
13340                        let bytes = common::to_bytes(body).await.unwrap_or_default();
13341                        let encoded = common::to_string(&bytes);
13342                        match serde_json::from_str(&encoded) {
13343                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
13344                            Err(error) => {
13345                                dlg.response_json_decode_error(&encoded, &error);
13346                                return Err(common::Error::JsonDecodeError(
13347                                    encoded.to_string(),
13348                                    error,
13349                                ));
13350                            }
13351                        }
13352                    };
13353
13354                    dlg.finished(true);
13355                    return Ok(response);
13356                }
13357            }
13358        }
13359    }
13360
13361    ///
13362    /// Sets the *request* property to the given value.
13363    ///
13364    /// Even though the property as already been set when instantiating this call,
13365    /// we provide this method for API completeness.
13366    pub fn request(
13367        mut self,
13368        new_value: ModifyMembershipRolesRequest,
13369    ) -> GroupMembershipModifyMembershipRoleCall<'a, C> {
13370        self._request = new_value;
13371        self
13372    }
13373    /// Required. The [resource name](https://cloud.google.com/apis/design/resource_names) of the `Membership` whose roles are to be modified. Must be of the form `groups/{group}/memberships/{membership}`.
13374    ///
13375    /// Sets the *name* path property to the given value.
13376    ///
13377    /// Even though the property as already been set when instantiating this call,
13378    /// we provide this method for API completeness.
13379    pub fn name(mut self, new_value: &str) -> GroupMembershipModifyMembershipRoleCall<'a, C> {
13380        self._name = new_value.to_string();
13381        self
13382    }
13383    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
13384    /// while executing the actual API request.
13385    ///
13386    /// ````text
13387    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
13388    /// ````
13389    ///
13390    /// Sets the *delegate* property to the given value.
13391    pub fn delegate(
13392        mut self,
13393        new_value: &'a mut dyn common::Delegate,
13394    ) -> GroupMembershipModifyMembershipRoleCall<'a, C> {
13395        self._delegate = Some(new_value);
13396        self
13397    }
13398
13399    /// Set any additional parameter of the query string used in the request.
13400    /// It should be used to set parameters which are not yet available through their own
13401    /// setters.
13402    ///
13403    /// Please note that this method must not be used to set any of the known parameters
13404    /// which have their own setter method. If done anyway, the request will fail.
13405    ///
13406    /// # Additional Parameters
13407    ///
13408    /// * *$.xgafv* (query-string) - V1 error format.
13409    /// * *access_token* (query-string) - OAuth access token.
13410    /// * *alt* (query-string) - Data format for response.
13411    /// * *callback* (query-string) - JSONP
13412    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
13413    /// * *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.
13414    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
13415    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
13416    /// * *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.
13417    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
13418    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
13419    pub fn param<T>(mut self, name: T, value: T) -> GroupMembershipModifyMembershipRoleCall<'a, C>
13420    where
13421        T: AsRef<str>,
13422    {
13423        self._additional_params
13424            .insert(name.as_ref().to_string(), value.as_ref().to_string());
13425        self
13426    }
13427
13428    /// Identifies the authorization scope for the method you are building.
13429    ///
13430    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
13431    /// [`Scope::CloudPlatform`].
13432    ///
13433    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
13434    /// tokens for more than one scope.
13435    ///
13436    /// Usually there is more than one suitable scope to authorize an operation, some of which may
13437    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
13438    /// sufficient, a read-write scope will do as well.
13439    pub fn add_scope<St>(mut self, scope: St) -> GroupMembershipModifyMembershipRoleCall<'a, C>
13440    where
13441        St: AsRef<str>,
13442    {
13443        self._scopes.insert(String::from(scope.as_ref()));
13444        self
13445    }
13446    /// Identifies the authorization scope(s) for the method you are building.
13447    ///
13448    /// See [`Self::add_scope()`] for details.
13449    pub fn add_scopes<I, St>(mut self, scopes: I) -> GroupMembershipModifyMembershipRoleCall<'a, C>
13450    where
13451        I: IntoIterator<Item = St>,
13452        St: AsRef<str>,
13453    {
13454        self._scopes
13455            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
13456        self
13457    }
13458
13459    /// Removes all scopes, and no default scope will be used either.
13460    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
13461    /// for details).
13462    pub fn clear_scopes(mut self) -> GroupMembershipModifyMembershipRoleCall<'a, C> {
13463        self._scopes.clear();
13464        self
13465    }
13466}
13467
13468/// Searches direct groups of a member.
13469///
13470/// A builder for the *memberships.searchDirectGroups* method supported by a *group* resource.
13471/// It is not used directly, but through a [`GroupMethods`] instance.
13472///
13473/// # Example
13474///
13475/// Instantiate a resource method builder
13476///
13477/// ```test_harness,no_run
13478/// # extern crate hyper;
13479/// # extern crate hyper_rustls;
13480/// # extern crate google_cloudidentity1 as cloudidentity1;
13481/// # async fn dox() {
13482/// # use cloudidentity1::{CloudIdentity, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
13483///
13484/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
13485/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
13486/// #     .with_native_roots()
13487/// #     .unwrap()
13488/// #     .https_only()
13489/// #     .enable_http2()
13490/// #     .build();
13491///
13492/// # let executor = hyper_util::rt::TokioExecutor::new();
13493/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
13494/// #     secret,
13495/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
13496/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
13497/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
13498/// #     ),
13499/// # ).build().await.unwrap();
13500///
13501/// # let client = hyper_util::client::legacy::Client::builder(
13502/// #     hyper_util::rt::TokioExecutor::new()
13503/// # )
13504/// # .build(
13505/// #     hyper_rustls::HttpsConnectorBuilder::new()
13506/// #         .with_native_roots()
13507/// #         .unwrap()
13508/// #         .https_or_http()
13509/// #         .enable_http2()
13510/// #         .build()
13511/// # );
13512/// # let mut hub = CloudIdentity::new(client, auth);
13513/// // You can configure optional parameters by calling the respective setters at will, and
13514/// // execute the final call using `doit()`.
13515/// // Values shown here are possibly random and not representative !
13516/// let result = hub.groups().memberships_search_direct_groups("parent")
13517///              .query("accusam")
13518///              .page_token("takimata")
13519///              .page_size(-46)
13520///              .order_by("voluptua.")
13521///              .doit().await;
13522/// # }
13523/// ```
13524pub struct GroupMembershipSearchDirectGroupCall<'a, C>
13525where
13526    C: 'a,
13527{
13528    hub: &'a CloudIdentity<C>,
13529    _parent: String,
13530    _query: Option<String>,
13531    _page_token: Option<String>,
13532    _page_size: Option<i32>,
13533    _order_by: Option<String>,
13534    _delegate: Option<&'a mut dyn common::Delegate>,
13535    _additional_params: HashMap<String, String>,
13536    _scopes: BTreeSet<String>,
13537}
13538
13539impl<'a, C> common::CallBuilder for GroupMembershipSearchDirectGroupCall<'a, C> {}
13540
13541impl<'a, C> GroupMembershipSearchDirectGroupCall<'a, C>
13542where
13543    C: common::Connector,
13544{
13545    /// Perform the operation you have build so far.
13546    pub async fn doit(mut self) -> common::Result<(common::Response, SearchDirectGroupsResponse)> {
13547        use std::borrow::Cow;
13548        use std::io::{Read, Seek};
13549
13550        use common::{url::Params, ToParts};
13551        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
13552
13553        let mut dd = common::DefaultDelegate;
13554        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
13555        dlg.begin(common::MethodInfo {
13556            id: "cloudidentity.groups.memberships.searchDirectGroups",
13557            http_method: hyper::Method::GET,
13558        });
13559
13560        for &field in ["alt", "parent", "query", "pageToken", "pageSize", "orderBy"].iter() {
13561            if self._additional_params.contains_key(field) {
13562                dlg.finished(false);
13563                return Err(common::Error::FieldClash(field));
13564            }
13565        }
13566
13567        let mut params = Params::with_capacity(7 + self._additional_params.len());
13568        params.push("parent", self._parent);
13569        if let Some(value) = self._query.as_ref() {
13570            params.push("query", value);
13571        }
13572        if let Some(value) = self._page_token.as_ref() {
13573            params.push("pageToken", value);
13574        }
13575        if let Some(value) = self._page_size.as_ref() {
13576            params.push("pageSize", value.to_string());
13577        }
13578        if let Some(value) = self._order_by.as_ref() {
13579            params.push("orderBy", value);
13580        }
13581
13582        params.extend(self._additional_params.iter());
13583
13584        params.push("alt", "json");
13585        let mut url = self.hub._base_url.clone() + "v1/{+parent}/memberships:searchDirectGroups";
13586        if self._scopes.is_empty() {
13587            self._scopes
13588                .insert(Scope::CloudIdentityGroupReadonly.as_ref().to_string());
13589        }
13590
13591        #[allow(clippy::single_element_loop)]
13592        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
13593            url = params.uri_replacement(url, param_name, find_this, true);
13594        }
13595        {
13596            let to_remove = ["parent"];
13597            params.remove_params(&to_remove);
13598        }
13599
13600        let url = params.parse_with_url(&url);
13601
13602        loop {
13603            let token = match self
13604                .hub
13605                .auth
13606                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
13607                .await
13608            {
13609                Ok(token) => token,
13610                Err(e) => match dlg.token(e) {
13611                    Ok(token) => token,
13612                    Err(e) => {
13613                        dlg.finished(false);
13614                        return Err(common::Error::MissingToken(e));
13615                    }
13616                },
13617            };
13618            let mut req_result = {
13619                let client = &self.hub.client;
13620                dlg.pre_request();
13621                let mut req_builder = hyper::Request::builder()
13622                    .method(hyper::Method::GET)
13623                    .uri(url.as_str())
13624                    .header(USER_AGENT, self.hub._user_agent.clone());
13625
13626                if let Some(token) = token.as_ref() {
13627                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
13628                }
13629
13630                let request = req_builder
13631                    .header(CONTENT_LENGTH, 0_u64)
13632                    .body(common::to_body::<String>(None));
13633
13634                client.request(request.unwrap()).await
13635            };
13636
13637            match req_result {
13638                Err(err) => {
13639                    if let common::Retry::After(d) = dlg.http_error(&err) {
13640                        sleep(d).await;
13641                        continue;
13642                    }
13643                    dlg.finished(false);
13644                    return Err(common::Error::HttpError(err));
13645                }
13646                Ok(res) => {
13647                    let (mut parts, body) = res.into_parts();
13648                    let mut body = common::Body::new(body);
13649                    if !parts.status.is_success() {
13650                        let bytes = common::to_bytes(body).await.unwrap_or_default();
13651                        let error = serde_json::from_str(&common::to_string(&bytes));
13652                        let response = common::to_response(parts, bytes.into());
13653
13654                        if let common::Retry::After(d) =
13655                            dlg.http_failure(&response, error.as_ref().ok())
13656                        {
13657                            sleep(d).await;
13658                            continue;
13659                        }
13660
13661                        dlg.finished(false);
13662
13663                        return Err(match error {
13664                            Ok(value) => common::Error::BadRequest(value),
13665                            _ => common::Error::Failure(response),
13666                        });
13667                    }
13668                    let response = {
13669                        let bytes = common::to_bytes(body).await.unwrap_or_default();
13670                        let encoded = common::to_string(&bytes);
13671                        match serde_json::from_str(&encoded) {
13672                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
13673                            Err(error) => {
13674                                dlg.response_json_decode_error(&encoded, &error);
13675                                return Err(common::Error::JsonDecodeError(
13676                                    encoded.to_string(),
13677                                    error,
13678                                ));
13679                            }
13680                        }
13681                    };
13682
13683                    dlg.finished(true);
13684                    return Ok(response);
13685                }
13686            }
13687        }
13688    }
13689
13690    /// [Resource name](https://cloud.google.com/apis/design/resource_names) of the group to search transitive memberships in. Format: groups/{group_id}, where group_id is always '-' as this API will search across all groups for a given member.
13691    ///
13692    /// Sets the *parent* path property to the given value.
13693    ///
13694    /// Even though the property as already been set when instantiating this call,
13695    /// we provide this method for API completeness.
13696    pub fn parent(mut self, new_value: &str) -> GroupMembershipSearchDirectGroupCall<'a, C> {
13697        self._parent = new_value.to_string();
13698        self
13699    }
13700    /// Required. A CEL expression that MUST include member specification AND label(s). Users can search on label attributes of groups. CONTAINS match ('in') is supported on labels. Identity-mapped groups are uniquely identified by both a `member_key_id` and a `member_key_namespace`, which requires an additional query input: `member_key_namespace`. Example query: `member_key_id == 'member_key_id_value' && 'label_value' in labels`
13701    ///
13702    /// Sets the *query* query property to the given value.
13703    pub fn query(mut self, new_value: &str) -> GroupMembershipSearchDirectGroupCall<'a, C> {
13704        self._query = Some(new_value.to_string());
13705        self
13706    }
13707    /// The `next_page_token` value returned from a previous list request, if any
13708    ///
13709    /// Sets the *page token* query property to the given value.
13710    pub fn page_token(mut self, new_value: &str) -> GroupMembershipSearchDirectGroupCall<'a, C> {
13711        self._page_token = Some(new_value.to_string());
13712        self
13713    }
13714    /// The default page size is 200 (max 1000).
13715    ///
13716    /// Sets the *page size* query property to the given value.
13717    pub fn page_size(mut self, new_value: i32) -> GroupMembershipSearchDirectGroupCall<'a, C> {
13718        self._page_size = Some(new_value);
13719        self
13720    }
13721    /// The ordering of membership relation for the display name or email in the response. The syntax for this field can be found at https://cloud.google.com/apis/design/design_patterns#sorting_order. Example: Sort by the ascending display name: order_by="group_name" or order_by="group_name asc". Sort by the descending display name: order_by="group_name desc". Sort by the ascending group key: order_by="group_key" or order_by="group_key asc". Sort by the descending group key: order_by="group_key desc".
13722    ///
13723    /// Sets the *order by* query property to the given value.
13724    pub fn order_by(mut self, new_value: &str) -> GroupMembershipSearchDirectGroupCall<'a, C> {
13725        self._order_by = Some(new_value.to_string());
13726        self
13727    }
13728    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
13729    /// while executing the actual API request.
13730    ///
13731    /// ````text
13732    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
13733    /// ````
13734    ///
13735    /// Sets the *delegate* property to the given value.
13736    pub fn delegate(
13737        mut self,
13738        new_value: &'a mut dyn common::Delegate,
13739    ) -> GroupMembershipSearchDirectGroupCall<'a, C> {
13740        self._delegate = Some(new_value);
13741        self
13742    }
13743
13744    /// Set any additional parameter of the query string used in the request.
13745    /// It should be used to set parameters which are not yet available through their own
13746    /// setters.
13747    ///
13748    /// Please note that this method must not be used to set any of the known parameters
13749    /// which have their own setter method. If done anyway, the request will fail.
13750    ///
13751    /// # Additional Parameters
13752    ///
13753    /// * *$.xgafv* (query-string) - V1 error format.
13754    /// * *access_token* (query-string) - OAuth access token.
13755    /// * *alt* (query-string) - Data format for response.
13756    /// * *callback* (query-string) - JSONP
13757    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
13758    /// * *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.
13759    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
13760    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
13761    /// * *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.
13762    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
13763    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
13764    pub fn param<T>(mut self, name: T, value: T) -> GroupMembershipSearchDirectGroupCall<'a, C>
13765    where
13766        T: AsRef<str>,
13767    {
13768        self._additional_params
13769            .insert(name.as_ref().to_string(), value.as_ref().to_string());
13770        self
13771    }
13772
13773    /// Identifies the authorization scope for the method you are building.
13774    ///
13775    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
13776    /// [`Scope::CloudIdentityGroupReadonly`].
13777    ///
13778    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
13779    /// tokens for more than one scope.
13780    ///
13781    /// Usually there is more than one suitable scope to authorize an operation, some of which may
13782    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
13783    /// sufficient, a read-write scope will do as well.
13784    pub fn add_scope<St>(mut self, scope: St) -> GroupMembershipSearchDirectGroupCall<'a, C>
13785    where
13786        St: AsRef<str>,
13787    {
13788        self._scopes.insert(String::from(scope.as_ref()));
13789        self
13790    }
13791    /// Identifies the authorization scope(s) for the method you are building.
13792    ///
13793    /// See [`Self::add_scope()`] for details.
13794    pub fn add_scopes<I, St>(mut self, scopes: I) -> GroupMembershipSearchDirectGroupCall<'a, C>
13795    where
13796        I: IntoIterator<Item = St>,
13797        St: AsRef<str>,
13798    {
13799        self._scopes
13800            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
13801        self
13802    }
13803
13804    /// Removes all scopes, and no default scope will be used either.
13805    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
13806    /// for details).
13807    pub fn clear_scopes(mut self) -> GroupMembershipSearchDirectGroupCall<'a, C> {
13808        self._scopes.clear();
13809        self
13810    }
13811}
13812
13813/// Search transitive groups of a member. **Note:** This feature is only available to Google Workspace Enterprise Standard, Enterprise Plus, and Enterprise for Education; and Cloud Identity Premium accounts. If the account of the member is not one of these, a 403 (PERMISSION_DENIED) HTTP status code will be returned. A transitive group is any group that has a direct or indirect membership to the member. Actor must have view permissions all transitive groups.
13814///
13815/// A builder for the *memberships.searchTransitiveGroups* method supported by a *group* resource.
13816/// It is not used directly, but through a [`GroupMethods`] instance.
13817///
13818/// # Example
13819///
13820/// Instantiate a resource method builder
13821///
13822/// ```test_harness,no_run
13823/// # extern crate hyper;
13824/// # extern crate hyper_rustls;
13825/// # extern crate google_cloudidentity1 as cloudidentity1;
13826/// # async fn dox() {
13827/// # use cloudidentity1::{CloudIdentity, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
13828///
13829/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
13830/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
13831/// #     .with_native_roots()
13832/// #     .unwrap()
13833/// #     .https_only()
13834/// #     .enable_http2()
13835/// #     .build();
13836///
13837/// # let executor = hyper_util::rt::TokioExecutor::new();
13838/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
13839/// #     secret,
13840/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
13841/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
13842/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
13843/// #     ),
13844/// # ).build().await.unwrap();
13845///
13846/// # let client = hyper_util::client::legacy::Client::builder(
13847/// #     hyper_util::rt::TokioExecutor::new()
13848/// # )
13849/// # .build(
13850/// #     hyper_rustls::HttpsConnectorBuilder::new()
13851/// #         .with_native_roots()
13852/// #         .unwrap()
13853/// #         .https_or_http()
13854/// #         .enable_http2()
13855/// #         .build()
13856/// # );
13857/// # let mut hub = CloudIdentity::new(client, auth);
13858/// // You can configure optional parameters by calling the respective setters at will, and
13859/// // execute the final call using `doit()`.
13860/// // Values shown here are possibly random and not representative !
13861/// let result = hub.groups().memberships_search_transitive_groups("parent")
13862///              .query("erat")
13863///              .page_token("consetetur")
13864///              .page_size(-2)
13865///              .doit().await;
13866/// # }
13867/// ```
13868pub struct GroupMembershipSearchTransitiveGroupCall<'a, C>
13869where
13870    C: 'a,
13871{
13872    hub: &'a CloudIdentity<C>,
13873    _parent: String,
13874    _query: Option<String>,
13875    _page_token: Option<String>,
13876    _page_size: Option<i32>,
13877    _delegate: Option<&'a mut dyn common::Delegate>,
13878    _additional_params: HashMap<String, String>,
13879    _scopes: BTreeSet<String>,
13880}
13881
13882impl<'a, C> common::CallBuilder for GroupMembershipSearchTransitiveGroupCall<'a, C> {}
13883
13884impl<'a, C> GroupMembershipSearchTransitiveGroupCall<'a, C>
13885where
13886    C: common::Connector,
13887{
13888    /// Perform the operation you have build so far.
13889    pub async fn doit(
13890        mut self,
13891    ) -> common::Result<(common::Response, SearchTransitiveGroupsResponse)> {
13892        use std::borrow::Cow;
13893        use std::io::{Read, Seek};
13894
13895        use common::{url::Params, ToParts};
13896        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
13897
13898        let mut dd = common::DefaultDelegate;
13899        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
13900        dlg.begin(common::MethodInfo {
13901            id: "cloudidentity.groups.memberships.searchTransitiveGroups",
13902            http_method: hyper::Method::GET,
13903        });
13904
13905        for &field in ["alt", "parent", "query", "pageToken", "pageSize"].iter() {
13906            if self._additional_params.contains_key(field) {
13907                dlg.finished(false);
13908                return Err(common::Error::FieldClash(field));
13909            }
13910        }
13911
13912        let mut params = Params::with_capacity(6 + self._additional_params.len());
13913        params.push("parent", self._parent);
13914        if let Some(value) = self._query.as_ref() {
13915            params.push("query", value);
13916        }
13917        if let Some(value) = self._page_token.as_ref() {
13918            params.push("pageToken", value);
13919        }
13920        if let Some(value) = self._page_size.as_ref() {
13921            params.push("pageSize", value.to_string());
13922        }
13923
13924        params.extend(self._additional_params.iter());
13925
13926        params.push("alt", "json");
13927        let mut url =
13928            self.hub._base_url.clone() + "v1/{+parent}/memberships:searchTransitiveGroups";
13929        if self._scopes.is_empty() {
13930            self._scopes
13931                .insert(Scope::CloudIdentityGroupReadonly.as_ref().to_string());
13932        }
13933
13934        #[allow(clippy::single_element_loop)]
13935        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
13936            url = params.uri_replacement(url, param_name, find_this, true);
13937        }
13938        {
13939            let to_remove = ["parent"];
13940            params.remove_params(&to_remove);
13941        }
13942
13943        let url = params.parse_with_url(&url);
13944
13945        loop {
13946            let token = match self
13947                .hub
13948                .auth
13949                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
13950                .await
13951            {
13952                Ok(token) => token,
13953                Err(e) => match dlg.token(e) {
13954                    Ok(token) => token,
13955                    Err(e) => {
13956                        dlg.finished(false);
13957                        return Err(common::Error::MissingToken(e));
13958                    }
13959                },
13960            };
13961            let mut req_result = {
13962                let client = &self.hub.client;
13963                dlg.pre_request();
13964                let mut req_builder = hyper::Request::builder()
13965                    .method(hyper::Method::GET)
13966                    .uri(url.as_str())
13967                    .header(USER_AGENT, self.hub._user_agent.clone());
13968
13969                if let Some(token) = token.as_ref() {
13970                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
13971                }
13972
13973                let request = req_builder
13974                    .header(CONTENT_LENGTH, 0_u64)
13975                    .body(common::to_body::<String>(None));
13976
13977                client.request(request.unwrap()).await
13978            };
13979
13980            match req_result {
13981                Err(err) => {
13982                    if let common::Retry::After(d) = dlg.http_error(&err) {
13983                        sleep(d).await;
13984                        continue;
13985                    }
13986                    dlg.finished(false);
13987                    return Err(common::Error::HttpError(err));
13988                }
13989                Ok(res) => {
13990                    let (mut parts, body) = res.into_parts();
13991                    let mut body = common::Body::new(body);
13992                    if !parts.status.is_success() {
13993                        let bytes = common::to_bytes(body).await.unwrap_or_default();
13994                        let error = serde_json::from_str(&common::to_string(&bytes));
13995                        let response = common::to_response(parts, bytes.into());
13996
13997                        if let common::Retry::After(d) =
13998                            dlg.http_failure(&response, error.as_ref().ok())
13999                        {
14000                            sleep(d).await;
14001                            continue;
14002                        }
14003
14004                        dlg.finished(false);
14005
14006                        return Err(match error {
14007                            Ok(value) => common::Error::BadRequest(value),
14008                            _ => common::Error::Failure(response),
14009                        });
14010                    }
14011                    let response = {
14012                        let bytes = common::to_bytes(body).await.unwrap_or_default();
14013                        let encoded = common::to_string(&bytes);
14014                        match serde_json::from_str(&encoded) {
14015                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
14016                            Err(error) => {
14017                                dlg.response_json_decode_error(&encoded, &error);
14018                                return Err(common::Error::JsonDecodeError(
14019                                    encoded.to_string(),
14020                                    error,
14021                                ));
14022                            }
14023                        }
14024                    };
14025
14026                    dlg.finished(true);
14027                    return Ok(response);
14028                }
14029            }
14030        }
14031    }
14032
14033    /// [Resource name](https://cloud.google.com/apis/design/resource_names) of the group to search transitive memberships in. Format: `groups/{group}`, where `group` is always '-' as this API will search across all groups for a given member.
14034    ///
14035    /// Sets the *parent* path property to the given value.
14036    ///
14037    /// Even though the property as already been set when instantiating this call,
14038    /// we provide this method for API completeness.
14039    pub fn parent(mut self, new_value: &str) -> GroupMembershipSearchTransitiveGroupCall<'a, C> {
14040        self._parent = new_value.to_string();
14041        self
14042    }
14043    /// Required. A CEL expression that MUST include member specification AND label(s). This is a `required` field. Users can search on label attributes of groups. CONTAINS match ('in') is supported on labels. Identity-mapped groups are uniquely identified by both a `member_key_id` and a `member_key_namespace`, which requires an additional query input: `member_key_namespace`. Example query: `member_key_id == 'member_key_id_value' && in labels` Query may optionally contain equality operators on the parent of the group restricting the search within a particular customer, e.g. `parent == 'customers/{customer_id}'`. The `customer_id` must begin with "C" (for example, 'C046psxkn'). This filtering is only supported for Admins with groups read permissions on the input customer. Example query: `member_key_id == 'member_key_id_value' && in labels && parent == 'customers/C046psxkn'`
14044    ///
14045    /// Sets the *query* query property to the given value.
14046    pub fn query(mut self, new_value: &str) -> GroupMembershipSearchTransitiveGroupCall<'a, C> {
14047        self._query = Some(new_value.to_string());
14048        self
14049    }
14050    /// The `next_page_token` value returned from a previous list request, if any.
14051    ///
14052    /// Sets the *page token* query property to the given value.
14053    pub fn page_token(
14054        mut self,
14055        new_value: &str,
14056    ) -> GroupMembershipSearchTransitiveGroupCall<'a, C> {
14057        self._page_token = Some(new_value.to_string());
14058        self
14059    }
14060    /// The default page size is 200 (max 1000).
14061    ///
14062    /// Sets the *page size* query property to the given value.
14063    pub fn page_size(mut self, new_value: i32) -> GroupMembershipSearchTransitiveGroupCall<'a, C> {
14064        self._page_size = Some(new_value);
14065        self
14066    }
14067    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
14068    /// while executing the actual API request.
14069    ///
14070    /// ````text
14071    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
14072    /// ````
14073    ///
14074    /// Sets the *delegate* property to the given value.
14075    pub fn delegate(
14076        mut self,
14077        new_value: &'a mut dyn common::Delegate,
14078    ) -> GroupMembershipSearchTransitiveGroupCall<'a, C> {
14079        self._delegate = Some(new_value);
14080        self
14081    }
14082
14083    /// Set any additional parameter of the query string used in the request.
14084    /// It should be used to set parameters which are not yet available through their own
14085    /// setters.
14086    ///
14087    /// Please note that this method must not be used to set any of the known parameters
14088    /// which have their own setter method. If done anyway, the request will fail.
14089    ///
14090    /// # Additional Parameters
14091    ///
14092    /// * *$.xgafv* (query-string) - V1 error format.
14093    /// * *access_token* (query-string) - OAuth access token.
14094    /// * *alt* (query-string) - Data format for response.
14095    /// * *callback* (query-string) - JSONP
14096    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
14097    /// * *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.
14098    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
14099    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
14100    /// * *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.
14101    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
14102    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
14103    pub fn param<T>(mut self, name: T, value: T) -> GroupMembershipSearchTransitiveGroupCall<'a, C>
14104    where
14105        T: AsRef<str>,
14106    {
14107        self._additional_params
14108            .insert(name.as_ref().to_string(), value.as_ref().to_string());
14109        self
14110    }
14111
14112    /// Identifies the authorization scope for the method you are building.
14113    ///
14114    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
14115    /// [`Scope::CloudIdentityGroupReadonly`].
14116    ///
14117    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
14118    /// tokens for more than one scope.
14119    ///
14120    /// Usually there is more than one suitable scope to authorize an operation, some of which may
14121    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
14122    /// sufficient, a read-write scope will do as well.
14123    pub fn add_scope<St>(mut self, scope: St) -> GroupMembershipSearchTransitiveGroupCall<'a, C>
14124    where
14125        St: AsRef<str>,
14126    {
14127        self._scopes.insert(String::from(scope.as_ref()));
14128        self
14129    }
14130    /// Identifies the authorization scope(s) for the method you are building.
14131    ///
14132    /// See [`Self::add_scope()`] for details.
14133    pub fn add_scopes<I, St>(mut self, scopes: I) -> GroupMembershipSearchTransitiveGroupCall<'a, C>
14134    where
14135        I: IntoIterator<Item = St>,
14136        St: AsRef<str>,
14137    {
14138        self._scopes
14139            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
14140        self
14141    }
14142
14143    /// Removes all scopes, and no default scope will be used either.
14144    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
14145    /// for details).
14146    pub fn clear_scopes(mut self) -> GroupMembershipSearchTransitiveGroupCall<'a, C> {
14147        self._scopes.clear();
14148        self
14149    }
14150}
14151
14152/// Search transitive memberships of a group. **Note:** This feature is only available to Google Workspace Enterprise Standard, Enterprise Plus, and Enterprise for Education; and Cloud Identity Premium accounts. If the account of the group is not one of these, a 403 (PERMISSION_DENIED) HTTP status code will be returned. A transitive membership is any direct or indirect membership of a group. Actor must have view permissions to all transitive memberships.
14153///
14154/// A builder for the *memberships.searchTransitiveMemberships* method supported by a *group* resource.
14155/// It is not used directly, but through a [`GroupMethods`] instance.
14156///
14157/// # Example
14158///
14159/// Instantiate a resource method builder
14160///
14161/// ```test_harness,no_run
14162/// # extern crate hyper;
14163/// # extern crate hyper_rustls;
14164/// # extern crate google_cloudidentity1 as cloudidentity1;
14165/// # async fn dox() {
14166/// # use cloudidentity1::{CloudIdentity, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
14167///
14168/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
14169/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
14170/// #     .with_native_roots()
14171/// #     .unwrap()
14172/// #     .https_only()
14173/// #     .enable_http2()
14174/// #     .build();
14175///
14176/// # let executor = hyper_util::rt::TokioExecutor::new();
14177/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
14178/// #     secret,
14179/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
14180/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
14181/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
14182/// #     ),
14183/// # ).build().await.unwrap();
14184///
14185/// # let client = hyper_util::client::legacy::Client::builder(
14186/// #     hyper_util::rt::TokioExecutor::new()
14187/// # )
14188/// # .build(
14189/// #     hyper_rustls::HttpsConnectorBuilder::new()
14190/// #         .with_native_roots()
14191/// #         .unwrap()
14192/// #         .https_or_http()
14193/// #         .enable_http2()
14194/// #         .build()
14195/// # );
14196/// # let mut hub = CloudIdentity::new(client, auth);
14197/// // You can configure optional parameters by calling the respective setters at will, and
14198/// // execute the final call using `doit()`.
14199/// // Values shown here are possibly random and not representative !
14200/// let result = hub.groups().memberships_search_transitive_memberships("parent")
14201///              .page_token("takimata")
14202///              .page_size(-19)
14203///              .doit().await;
14204/// # }
14205/// ```
14206pub struct GroupMembershipSearchTransitiveMembershipCall<'a, C>
14207where
14208    C: 'a,
14209{
14210    hub: &'a CloudIdentity<C>,
14211    _parent: String,
14212    _page_token: Option<String>,
14213    _page_size: Option<i32>,
14214    _delegate: Option<&'a mut dyn common::Delegate>,
14215    _additional_params: HashMap<String, String>,
14216    _scopes: BTreeSet<String>,
14217}
14218
14219impl<'a, C> common::CallBuilder for GroupMembershipSearchTransitiveMembershipCall<'a, C> {}
14220
14221impl<'a, C> GroupMembershipSearchTransitiveMembershipCall<'a, C>
14222where
14223    C: common::Connector,
14224{
14225    /// Perform the operation you have build so far.
14226    pub async fn doit(
14227        mut self,
14228    ) -> common::Result<(common::Response, SearchTransitiveMembershipsResponse)> {
14229        use std::borrow::Cow;
14230        use std::io::{Read, Seek};
14231
14232        use common::{url::Params, ToParts};
14233        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
14234
14235        let mut dd = common::DefaultDelegate;
14236        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
14237        dlg.begin(common::MethodInfo {
14238            id: "cloudidentity.groups.memberships.searchTransitiveMemberships",
14239            http_method: hyper::Method::GET,
14240        });
14241
14242        for &field in ["alt", "parent", "pageToken", "pageSize"].iter() {
14243            if self._additional_params.contains_key(field) {
14244                dlg.finished(false);
14245                return Err(common::Error::FieldClash(field));
14246            }
14247        }
14248
14249        let mut params = Params::with_capacity(5 + self._additional_params.len());
14250        params.push("parent", self._parent);
14251        if let Some(value) = self._page_token.as_ref() {
14252            params.push("pageToken", value);
14253        }
14254        if let Some(value) = self._page_size.as_ref() {
14255            params.push("pageSize", value.to_string());
14256        }
14257
14258        params.extend(self._additional_params.iter());
14259
14260        params.push("alt", "json");
14261        let mut url =
14262            self.hub._base_url.clone() + "v1/{+parent}/memberships:searchTransitiveMemberships";
14263        if self._scopes.is_empty() {
14264            self._scopes
14265                .insert(Scope::CloudIdentityGroupReadonly.as_ref().to_string());
14266        }
14267
14268        #[allow(clippy::single_element_loop)]
14269        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
14270            url = params.uri_replacement(url, param_name, find_this, true);
14271        }
14272        {
14273            let to_remove = ["parent"];
14274            params.remove_params(&to_remove);
14275        }
14276
14277        let url = params.parse_with_url(&url);
14278
14279        loop {
14280            let token = match self
14281                .hub
14282                .auth
14283                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
14284                .await
14285            {
14286                Ok(token) => token,
14287                Err(e) => match dlg.token(e) {
14288                    Ok(token) => token,
14289                    Err(e) => {
14290                        dlg.finished(false);
14291                        return Err(common::Error::MissingToken(e));
14292                    }
14293                },
14294            };
14295            let mut req_result = {
14296                let client = &self.hub.client;
14297                dlg.pre_request();
14298                let mut req_builder = hyper::Request::builder()
14299                    .method(hyper::Method::GET)
14300                    .uri(url.as_str())
14301                    .header(USER_AGENT, self.hub._user_agent.clone());
14302
14303                if let Some(token) = token.as_ref() {
14304                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
14305                }
14306
14307                let request = req_builder
14308                    .header(CONTENT_LENGTH, 0_u64)
14309                    .body(common::to_body::<String>(None));
14310
14311                client.request(request.unwrap()).await
14312            };
14313
14314            match req_result {
14315                Err(err) => {
14316                    if let common::Retry::After(d) = dlg.http_error(&err) {
14317                        sleep(d).await;
14318                        continue;
14319                    }
14320                    dlg.finished(false);
14321                    return Err(common::Error::HttpError(err));
14322                }
14323                Ok(res) => {
14324                    let (mut parts, body) = res.into_parts();
14325                    let mut body = common::Body::new(body);
14326                    if !parts.status.is_success() {
14327                        let bytes = common::to_bytes(body).await.unwrap_or_default();
14328                        let error = serde_json::from_str(&common::to_string(&bytes));
14329                        let response = common::to_response(parts, bytes.into());
14330
14331                        if let common::Retry::After(d) =
14332                            dlg.http_failure(&response, error.as_ref().ok())
14333                        {
14334                            sleep(d).await;
14335                            continue;
14336                        }
14337
14338                        dlg.finished(false);
14339
14340                        return Err(match error {
14341                            Ok(value) => common::Error::BadRequest(value),
14342                            _ => common::Error::Failure(response),
14343                        });
14344                    }
14345                    let response = {
14346                        let bytes = common::to_bytes(body).await.unwrap_or_default();
14347                        let encoded = common::to_string(&bytes);
14348                        match serde_json::from_str(&encoded) {
14349                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
14350                            Err(error) => {
14351                                dlg.response_json_decode_error(&encoded, &error);
14352                                return Err(common::Error::JsonDecodeError(
14353                                    encoded.to_string(),
14354                                    error,
14355                                ));
14356                            }
14357                        }
14358                    };
14359
14360                    dlg.finished(true);
14361                    return Ok(response);
14362                }
14363            }
14364        }
14365    }
14366
14367    /// [Resource name](https://cloud.google.com/apis/design/resource_names) of the group to search transitive memberships in. Format: `groups/{group}`, where `group` is the unique ID assigned to the Group.
14368    ///
14369    /// Sets the *parent* path property to the given value.
14370    ///
14371    /// Even though the property as already been set when instantiating this call,
14372    /// we provide this method for API completeness.
14373    pub fn parent(
14374        mut self,
14375        new_value: &str,
14376    ) -> GroupMembershipSearchTransitiveMembershipCall<'a, C> {
14377        self._parent = new_value.to_string();
14378        self
14379    }
14380    /// The `next_page_token` value returned from a previous list request, if any.
14381    ///
14382    /// Sets the *page token* query property to the given value.
14383    pub fn page_token(
14384        mut self,
14385        new_value: &str,
14386    ) -> GroupMembershipSearchTransitiveMembershipCall<'a, C> {
14387        self._page_token = Some(new_value.to_string());
14388        self
14389    }
14390    /// The default page size is 200 (max 1000).
14391    ///
14392    /// Sets the *page size* query property to the given value.
14393    pub fn page_size(
14394        mut self,
14395        new_value: i32,
14396    ) -> GroupMembershipSearchTransitiveMembershipCall<'a, C> {
14397        self._page_size = Some(new_value);
14398        self
14399    }
14400    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
14401    /// while executing the actual API request.
14402    ///
14403    /// ````text
14404    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
14405    /// ````
14406    ///
14407    /// Sets the *delegate* property to the given value.
14408    pub fn delegate(
14409        mut self,
14410        new_value: &'a mut dyn common::Delegate,
14411    ) -> GroupMembershipSearchTransitiveMembershipCall<'a, C> {
14412        self._delegate = Some(new_value);
14413        self
14414    }
14415
14416    /// Set any additional parameter of the query string used in the request.
14417    /// It should be used to set parameters which are not yet available through their own
14418    /// setters.
14419    ///
14420    /// Please note that this method must not be used to set any of the known parameters
14421    /// which have their own setter method. If done anyway, the request will fail.
14422    ///
14423    /// # Additional Parameters
14424    ///
14425    /// * *$.xgafv* (query-string) - V1 error format.
14426    /// * *access_token* (query-string) - OAuth access token.
14427    /// * *alt* (query-string) - Data format for response.
14428    /// * *callback* (query-string) - JSONP
14429    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
14430    /// * *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.
14431    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
14432    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
14433    /// * *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.
14434    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
14435    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
14436    pub fn param<T>(
14437        mut self,
14438        name: T,
14439        value: T,
14440    ) -> GroupMembershipSearchTransitiveMembershipCall<'a, C>
14441    where
14442        T: AsRef<str>,
14443    {
14444        self._additional_params
14445            .insert(name.as_ref().to_string(), value.as_ref().to_string());
14446        self
14447    }
14448
14449    /// Identifies the authorization scope for the method you are building.
14450    ///
14451    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
14452    /// [`Scope::CloudIdentityGroupReadonly`].
14453    ///
14454    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
14455    /// tokens for more than one scope.
14456    ///
14457    /// Usually there is more than one suitable scope to authorize an operation, some of which may
14458    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
14459    /// sufficient, a read-write scope will do as well.
14460    pub fn add_scope<St>(
14461        mut self,
14462        scope: St,
14463    ) -> GroupMembershipSearchTransitiveMembershipCall<'a, C>
14464    where
14465        St: AsRef<str>,
14466    {
14467        self._scopes.insert(String::from(scope.as_ref()));
14468        self
14469    }
14470    /// Identifies the authorization scope(s) for the method you are building.
14471    ///
14472    /// See [`Self::add_scope()`] for details.
14473    pub fn add_scopes<I, St>(
14474        mut self,
14475        scopes: I,
14476    ) -> GroupMembershipSearchTransitiveMembershipCall<'a, C>
14477    where
14478        I: IntoIterator<Item = St>,
14479        St: AsRef<str>,
14480    {
14481        self._scopes
14482            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
14483        self
14484    }
14485
14486    /// Removes all scopes, and no default scope will be used either.
14487    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
14488    /// for details).
14489    pub fn clear_scopes(mut self) -> GroupMembershipSearchTransitiveMembershipCall<'a, C> {
14490        self._scopes.clear();
14491        self
14492    }
14493}
14494
14495/// Creates a Group.
14496///
14497/// A builder for the *create* method supported by a *group* resource.
14498/// It is not used directly, but through a [`GroupMethods`] instance.
14499///
14500/// # Example
14501///
14502/// Instantiate a resource method builder
14503///
14504/// ```test_harness,no_run
14505/// # extern crate hyper;
14506/// # extern crate hyper_rustls;
14507/// # extern crate google_cloudidentity1 as cloudidentity1;
14508/// use cloudidentity1::api::Group;
14509/// # async fn dox() {
14510/// # use cloudidentity1::{CloudIdentity, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
14511///
14512/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
14513/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
14514/// #     .with_native_roots()
14515/// #     .unwrap()
14516/// #     .https_only()
14517/// #     .enable_http2()
14518/// #     .build();
14519///
14520/// # let executor = hyper_util::rt::TokioExecutor::new();
14521/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
14522/// #     secret,
14523/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
14524/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
14525/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
14526/// #     ),
14527/// # ).build().await.unwrap();
14528///
14529/// # let client = hyper_util::client::legacy::Client::builder(
14530/// #     hyper_util::rt::TokioExecutor::new()
14531/// # )
14532/// # .build(
14533/// #     hyper_rustls::HttpsConnectorBuilder::new()
14534/// #         .with_native_roots()
14535/// #         .unwrap()
14536/// #         .https_or_http()
14537/// #         .enable_http2()
14538/// #         .build()
14539/// # );
14540/// # let mut hub = CloudIdentity::new(client, auth);
14541/// // As the method needs a request, you would usually fill it with the desired information
14542/// // into the respective structure. Some of the parts shown here might not be applicable !
14543/// // Values shown here are possibly random and not representative !
14544/// let mut req = Group::default();
14545///
14546/// // You can configure optional parameters by calling the respective setters at will, and
14547/// // execute the final call using `doit()`.
14548/// // Values shown here are possibly random and not representative !
14549/// let result = hub.groups().create(req)
14550///              .initial_group_config("gubergren")
14551///              .doit().await;
14552/// # }
14553/// ```
14554pub struct GroupCreateCall<'a, C>
14555where
14556    C: 'a,
14557{
14558    hub: &'a CloudIdentity<C>,
14559    _request: Group,
14560    _initial_group_config: Option<String>,
14561    _delegate: Option<&'a mut dyn common::Delegate>,
14562    _additional_params: HashMap<String, String>,
14563    _scopes: BTreeSet<String>,
14564}
14565
14566impl<'a, C> common::CallBuilder for GroupCreateCall<'a, C> {}
14567
14568impl<'a, C> GroupCreateCall<'a, C>
14569where
14570    C: common::Connector,
14571{
14572    /// Perform the operation you have build so far.
14573    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
14574        use std::borrow::Cow;
14575        use std::io::{Read, Seek};
14576
14577        use common::{url::Params, ToParts};
14578        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
14579
14580        let mut dd = common::DefaultDelegate;
14581        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
14582        dlg.begin(common::MethodInfo {
14583            id: "cloudidentity.groups.create",
14584            http_method: hyper::Method::POST,
14585        });
14586
14587        for &field in ["alt", "initialGroupConfig"].iter() {
14588            if self._additional_params.contains_key(field) {
14589                dlg.finished(false);
14590                return Err(common::Error::FieldClash(field));
14591            }
14592        }
14593
14594        let mut params = Params::with_capacity(4 + self._additional_params.len());
14595        if let Some(value) = self._initial_group_config.as_ref() {
14596            params.push("initialGroupConfig", value);
14597        }
14598
14599        params.extend(self._additional_params.iter());
14600
14601        params.push("alt", "json");
14602        let mut url = self.hub._base_url.clone() + "v1/groups";
14603        if self._scopes.is_empty() {
14604            self._scopes
14605                .insert(Scope::CloudPlatform.as_ref().to_string());
14606        }
14607
14608        let url = params.parse_with_url(&url);
14609
14610        let mut json_mime_type = mime::APPLICATION_JSON;
14611        let mut request_value_reader = {
14612            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
14613            common::remove_json_null_values(&mut value);
14614            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
14615            serde_json::to_writer(&mut dst, &value).unwrap();
14616            dst
14617        };
14618        let request_size = request_value_reader
14619            .seek(std::io::SeekFrom::End(0))
14620            .unwrap();
14621        request_value_reader
14622            .seek(std::io::SeekFrom::Start(0))
14623            .unwrap();
14624
14625        loop {
14626            let token = match self
14627                .hub
14628                .auth
14629                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
14630                .await
14631            {
14632                Ok(token) => token,
14633                Err(e) => match dlg.token(e) {
14634                    Ok(token) => token,
14635                    Err(e) => {
14636                        dlg.finished(false);
14637                        return Err(common::Error::MissingToken(e));
14638                    }
14639                },
14640            };
14641            request_value_reader
14642                .seek(std::io::SeekFrom::Start(0))
14643                .unwrap();
14644            let mut req_result = {
14645                let client = &self.hub.client;
14646                dlg.pre_request();
14647                let mut req_builder = hyper::Request::builder()
14648                    .method(hyper::Method::POST)
14649                    .uri(url.as_str())
14650                    .header(USER_AGENT, self.hub._user_agent.clone());
14651
14652                if let Some(token) = token.as_ref() {
14653                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
14654                }
14655
14656                let request = req_builder
14657                    .header(CONTENT_TYPE, json_mime_type.to_string())
14658                    .header(CONTENT_LENGTH, request_size as u64)
14659                    .body(common::to_body(
14660                        request_value_reader.get_ref().clone().into(),
14661                    ));
14662
14663                client.request(request.unwrap()).await
14664            };
14665
14666            match req_result {
14667                Err(err) => {
14668                    if let common::Retry::After(d) = dlg.http_error(&err) {
14669                        sleep(d).await;
14670                        continue;
14671                    }
14672                    dlg.finished(false);
14673                    return Err(common::Error::HttpError(err));
14674                }
14675                Ok(res) => {
14676                    let (mut parts, body) = res.into_parts();
14677                    let mut body = common::Body::new(body);
14678                    if !parts.status.is_success() {
14679                        let bytes = common::to_bytes(body).await.unwrap_or_default();
14680                        let error = serde_json::from_str(&common::to_string(&bytes));
14681                        let response = common::to_response(parts, bytes.into());
14682
14683                        if let common::Retry::After(d) =
14684                            dlg.http_failure(&response, error.as_ref().ok())
14685                        {
14686                            sleep(d).await;
14687                            continue;
14688                        }
14689
14690                        dlg.finished(false);
14691
14692                        return Err(match error {
14693                            Ok(value) => common::Error::BadRequest(value),
14694                            _ => common::Error::Failure(response),
14695                        });
14696                    }
14697                    let response = {
14698                        let bytes = common::to_bytes(body).await.unwrap_or_default();
14699                        let encoded = common::to_string(&bytes);
14700                        match serde_json::from_str(&encoded) {
14701                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
14702                            Err(error) => {
14703                                dlg.response_json_decode_error(&encoded, &error);
14704                                return Err(common::Error::JsonDecodeError(
14705                                    encoded.to_string(),
14706                                    error,
14707                                ));
14708                            }
14709                        }
14710                    };
14711
14712                    dlg.finished(true);
14713                    return Ok(response);
14714                }
14715            }
14716        }
14717    }
14718
14719    ///
14720    /// Sets the *request* property to the given value.
14721    ///
14722    /// Even though the property as already been set when instantiating this call,
14723    /// we provide this method for API completeness.
14724    pub fn request(mut self, new_value: Group) -> GroupCreateCall<'a, C> {
14725        self._request = new_value;
14726        self
14727    }
14728    /// Optional. The initial configuration option for the `Group`.
14729    ///
14730    /// Sets the *initial group config* query property to the given value.
14731    pub fn initial_group_config(mut self, new_value: &str) -> GroupCreateCall<'a, C> {
14732        self._initial_group_config = Some(new_value.to_string());
14733        self
14734    }
14735    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
14736    /// while executing the actual API request.
14737    ///
14738    /// ````text
14739    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
14740    /// ````
14741    ///
14742    /// Sets the *delegate* property to the given value.
14743    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> GroupCreateCall<'a, C> {
14744        self._delegate = Some(new_value);
14745        self
14746    }
14747
14748    /// Set any additional parameter of the query string used in the request.
14749    /// It should be used to set parameters which are not yet available through their own
14750    /// setters.
14751    ///
14752    /// Please note that this method must not be used to set any of the known parameters
14753    /// which have their own setter method. If done anyway, the request will fail.
14754    ///
14755    /// # Additional Parameters
14756    ///
14757    /// * *$.xgafv* (query-string) - V1 error format.
14758    /// * *access_token* (query-string) - OAuth access token.
14759    /// * *alt* (query-string) - Data format for response.
14760    /// * *callback* (query-string) - JSONP
14761    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
14762    /// * *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.
14763    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
14764    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
14765    /// * *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.
14766    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
14767    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
14768    pub fn param<T>(mut self, name: T, value: T) -> GroupCreateCall<'a, C>
14769    where
14770        T: AsRef<str>,
14771    {
14772        self._additional_params
14773            .insert(name.as_ref().to_string(), value.as_ref().to_string());
14774        self
14775    }
14776
14777    /// Identifies the authorization scope for the method you are building.
14778    ///
14779    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
14780    /// [`Scope::CloudPlatform`].
14781    ///
14782    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
14783    /// tokens for more than one scope.
14784    ///
14785    /// Usually there is more than one suitable scope to authorize an operation, some of which may
14786    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
14787    /// sufficient, a read-write scope will do as well.
14788    pub fn add_scope<St>(mut self, scope: St) -> GroupCreateCall<'a, C>
14789    where
14790        St: AsRef<str>,
14791    {
14792        self._scopes.insert(String::from(scope.as_ref()));
14793        self
14794    }
14795    /// Identifies the authorization scope(s) for the method you are building.
14796    ///
14797    /// See [`Self::add_scope()`] for details.
14798    pub fn add_scopes<I, St>(mut self, scopes: I) -> GroupCreateCall<'a, C>
14799    where
14800        I: IntoIterator<Item = St>,
14801        St: AsRef<str>,
14802    {
14803        self._scopes
14804            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
14805        self
14806    }
14807
14808    /// Removes all scopes, and no default scope will be used either.
14809    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
14810    /// for details).
14811    pub fn clear_scopes(mut self) -> GroupCreateCall<'a, C> {
14812        self._scopes.clear();
14813        self
14814    }
14815}
14816
14817/// Deletes a `Group`.
14818///
14819/// A builder for the *delete* method supported by a *group* resource.
14820/// It is not used directly, but through a [`GroupMethods`] instance.
14821///
14822/// # Example
14823///
14824/// Instantiate a resource method builder
14825///
14826/// ```test_harness,no_run
14827/// # extern crate hyper;
14828/// # extern crate hyper_rustls;
14829/// # extern crate google_cloudidentity1 as cloudidentity1;
14830/// # async fn dox() {
14831/// # use cloudidentity1::{CloudIdentity, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
14832///
14833/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
14834/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
14835/// #     .with_native_roots()
14836/// #     .unwrap()
14837/// #     .https_only()
14838/// #     .enable_http2()
14839/// #     .build();
14840///
14841/// # let executor = hyper_util::rt::TokioExecutor::new();
14842/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
14843/// #     secret,
14844/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
14845/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
14846/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
14847/// #     ),
14848/// # ).build().await.unwrap();
14849///
14850/// # let client = hyper_util::client::legacy::Client::builder(
14851/// #     hyper_util::rt::TokioExecutor::new()
14852/// # )
14853/// # .build(
14854/// #     hyper_rustls::HttpsConnectorBuilder::new()
14855/// #         .with_native_roots()
14856/// #         .unwrap()
14857/// #         .https_or_http()
14858/// #         .enable_http2()
14859/// #         .build()
14860/// # );
14861/// # let mut hub = CloudIdentity::new(client, auth);
14862/// // You can configure optional parameters by calling the respective setters at will, and
14863/// // execute the final call using `doit()`.
14864/// // Values shown here are possibly random and not representative !
14865/// let result = hub.groups().delete("name")
14866///              .doit().await;
14867/// # }
14868/// ```
14869pub struct GroupDeleteCall<'a, C>
14870where
14871    C: 'a,
14872{
14873    hub: &'a CloudIdentity<C>,
14874    _name: String,
14875    _delegate: Option<&'a mut dyn common::Delegate>,
14876    _additional_params: HashMap<String, String>,
14877    _scopes: BTreeSet<String>,
14878}
14879
14880impl<'a, C> common::CallBuilder for GroupDeleteCall<'a, C> {}
14881
14882impl<'a, C> GroupDeleteCall<'a, C>
14883where
14884    C: common::Connector,
14885{
14886    /// Perform the operation you have build so far.
14887    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
14888        use std::borrow::Cow;
14889        use std::io::{Read, Seek};
14890
14891        use common::{url::Params, ToParts};
14892        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
14893
14894        let mut dd = common::DefaultDelegate;
14895        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
14896        dlg.begin(common::MethodInfo {
14897            id: "cloudidentity.groups.delete",
14898            http_method: hyper::Method::DELETE,
14899        });
14900
14901        for &field in ["alt", "name"].iter() {
14902            if self._additional_params.contains_key(field) {
14903                dlg.finished(false);
14904                return Err(common::Error::FieldClash(field));
14905            }
14906        }
14907
14908        let mut params = Params::with_capacity(3 + self._additional_params.len());
14909        params.push("name", self._name);
14910
14911        params.extend(self._additional_params.iter());
14912
14913        params.push("alt", "json");
14914        let mut url = self.hub._base_url.clone() + "v1/{+name}";
14915        if self._scopes.is_empty() {
14916            self._scopes
14917                .insert(Scope::CloudPlatform.as_ref().to_string());
14918        }
14919
14920        #[allow(clippy::single_element_loop)]
14921        for &(find_this, param_name) in [("{+name}", "name")].iter() {
14922            url = params.uri_replacement(url, param_name, find_this, true);
14923        }
14924        {
14925            let to_remove = ["name"];
14926            params.remove_params(&to_remove);
14927        }
14928
14929        let url = params.parse_with_url(&url);
14930
14931        loop {
14932            let token = match self
14933                .hub
14934                .auth
14935                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
14936                .await
14937            {
14938                Ok(token) => token,
14939                Err(e) => match dlg.token(e) {
14940                    Ok(token) => token,
14941                    Err(e) => {
14942                        dlg.finished(false);
14943                        return Err(common::Error::MissingToken(e));
14944                    }
14945                },
14946            };
14947            let mut req_result = {
14948                let client = &self.hub.client;
14949                dlg.pre_request();
14950                let mut req_builder = hyper::Request::builder()
14951                    .method(hyper::Method::DELETE)
14952                    .uri(url.as_str())
14953                    .header(USER_AGENT, self.hub._user_agent.clone());
14954
14955                if let Some(token) = token.as_ref() {
14956                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
14957                }
14958
14959                let request = req_builder
14960                    .header(CONTENT_LENGTH, 0_u64)
14961                    .body(common::to_body::<String>(None));
14962
14963                client.request(request.unwrap()).await
14964            };
14965
14966            match req_result {
14967                Err(err) => {
14968                    if let common::Retry::After(d) = dlg.http_error(&err) {
14969                        sleep(d).await;
14970                        continue;
14971                    }
14972                    dlg.finished(false);
14973                    return Err(common::Error::HttpError(err));
14974                }
14975                Ok(res) => {
14976                    let (mut parts, body) = res.into_parts();
14977                    let mut body = common::Body::new(body);
14978                    if !parts.status.is_success() {
14979                        let bytes = common::to_bytes(body).await.unwrap_or_default();
14980                        let error = serde_json::from_str(&common::to_string(&bytes));
14981                        let response = common::to_response(parts, bytes.into());
14982
14983                        if let common::Retry::After(d) =
14984                            dlg.http_failure(&response, error.as_ref().ok())
14985                        {
14986                            sleep(d).await;
14987                            continue;
14988                        }
14989
14990                        dlg.finished(false);
14991
14992                        return Err(match error {
14993                            Ok(value) => common::Error::BadRequest(value),
14994                            _ => common::Error::Failure(response),
14995                        });
14996                    }
14997                    let response = {
14998                        let bytes = common::to_bytes(body).await.unwrap_or_default();
14999                        let encoded = common::to_string(&bytes);
15000                        match serde_json::from_str(&encoded) {
15001                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
15002                            Err(error) => {
15003                                dlg.response_json_decode_error(&encoded, &error);
15004                                return Err(common::Error::JsonDecodeError(
15005                                    encoded.to_string(),
15006                                    error,
15007                                ));
15008                            }
15009                        }
15010                    };
15011
15012                    dlg.finished(true);
15013                    return Ok(response);
15014                }
15015            }
15016        }
15017    }
15018
15019    /// Required. The [resource name](https://cloud.google.com/apis/design/resource_names) of the `Group` to retrieve. Must be of the form `groups/{group}`.
15020    ///
15021    /// Sets the *name* path property to the given value.
15022    ///
15023    /// Even though the property as already been set when instantiating this call,
15024    /// we provide this method for API completeness.
15025    pub fn name(mut self, new_value: &str) -> GroupDeleteCall<'a, C> {
15026        self._name = new_value.to_string();
15027        self
15028    }
15029    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
15030    /// while executing the actual API request.
15031    ///
15032    /// ````text
15033    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
15034    /// ````
15035    ///
15036    /// Sets the *delegate* property to the given value.
15037    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> GroupDeleteCall<'a, C> {
15038        self._delegate = Some(new_value);
15039        self
15040    }
15041
15042    /// Set any additional parameter of the query string used in the request.
15043    /// It should be used to set parameters which are not yet available through their own
15044    /// setters.
15045    ///
15046    /// Please note that this method must not be used to set any of the known parameters
15047    /// which have their own setter method. If done anyway, the request will fail.
15048    ///
15049    /// # Additional Parameters
15050    ///
15051    /// * *$.xgafv* (query-string) - V1 error format.
15052    /// * *access_token* (query-string) - OAuth access token.
15053    /// * *alt* (query-string) - Data format for response.
15054    /// * *callback* (query-string) - JSONP
15055    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
15056    /// * *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.
15057    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
15058    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
15059    /// * *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.
15060    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
15061    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
15062    pub fn param<T>(mut self, name: T, value: T) -> GroupDeleteCall<'a, C>
15063    where
15064        T: AsRef<str>,
15065    {
15066        self._additional_params
15067            .insert(name.as_ref().to_string(), value.as_ref().to_string());
15068        self
15069    }
15070
15071    /// Identifies the authorization scope for the method you are building.
15072    ///
15073    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
15074    /// [`Scope::CloudPlatform`].
15075    ///
15076    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
15077    /// tokens for more than one scope.
15078    ///
15079    /// Usually there is more than one suitable scope to authorize an operation, some of which may
15080    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
15081    /// sufficient, a read-write scope will do as well.
15082    pub fn add_scope<St>(mut self, scope: St) -> GroupDeleteCall<'a, C>
15083    where
15084        St: AsRef<str>,
15085    {
15086        self._scopes.insert(String::from(scope.as_ref()));
15087        self
15088    }
15089    /// Identifies the authorization scope(s) for the method you are building.
15090    ///
15091    /// See [`Self::add_scope()`] for details.
15092    pub fn add_scopes<I, St>(mut self, scopes: I) -> GroupDeleteCall<'a, C>
15093    where
15094        I: IntoIterator<Item = St>,
15095        St: AsRef<str>,
15096    {
15097        self._scopes
15098            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
15099        self
15100    }
15101
15102    /// Removes all scopes, and no default scope will be used either.
15103    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
15104    /// for details).
15105    pub fn clear_scopes(mut self) -> GroupDeleteCall<'a, C> {
15106        self._scopes.clear();
15107        self
15108    }
15109}
15110
15111/// Retrieves a `Group`.
15112///
15113/// A builder for the *get* method supported by a *group* resource.
15114/// It is not used directly, but through a [`GroupMethods`] instance.
15115///
15116/// # Example
15117///
15118/// Instantiate a resource method builder
15119///
15120/// ```test_harness,no_run
15121/// # extern crate hyper;
15122/// # extern crate hyper_rustls;
15123/// # extern crate google_cloudidentity1 as cloudidentity1;
15124/// # async fn dox() {
15125/// # use cloudidentity1::{CloudIdentity, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
15126///
15127/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
15128/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
15129/// #     .with_native_roots()
15130/// #     .unwrap()
15131/// #     .https_only()
15132/// #     .enable_http2()
15133/// #     .build();
15134///
15135/// # let executor = hyper_util::rt::TokioExecutor::new();
15136/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
15137/// #     secret,
15138/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
15139/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
15140/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
15141/// #     ),
15142/// # ).build().await.unwrap();
15143///
15144/// # let client = hyper_util::client::legacy::Client::builder(
15145/// #     hyper_util::rt::TokioExecutor::new()
15146/// # )
15147/// # .build(
15148/// #     hyper_rustls::HttpsConnectorBuilder::new()
15149/// #         .with_native_roots()
15150/// #         .unwrap()
15151/// #         .https_or_http()
15152/// #         .enable_http2()
15153/// #         .build()
15154/// # );
15155/// # let mut hub = CloudIdentity::new(client, auth);
15156/// // You can configure optional parameters by calling the respective setters at will, and
15157/// // execute the final call using `doit()`.
15158/// // Values shown here are possibly random and not representative !
15159/// let result = hub.groups().get("name")
15160///              .doit().await;
15161/// # }
15162/// ```
15163pub struct GroupGetCall<'a, C>
15164where
15165    C: 'a,
15166{
15167    hub: &'a CloudIdentity<C>,
15168    _name: String,
15169    _delegate: Option<&'a mut dyn common::Delegate>,
15170    _additional_params: HashMap<String, String>,
15171    _scopes: BTreeSet<String>,
15172}
15173
15174impl<'a, C> common::CallBuilder for GroupGetCall<'a, C> {}
15175
15176impl<'a, C> GroupGetCall<'a, C>
15177where
15178    C: common::Connector,
15179{
15180    /// Perform the operation you have build so far.
15181    pub async fn doit(mut self) -> common::Result<(common::Response, Group)> {
15182        use std::borrow::Cow;
15183        use std::io::{Read, Seek};
15184
15185        use common::{url::Params, ToParts};
15186        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
15187
15188        let mut dd = common::DefaultDelegate;
15189        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
15190        dlg.begin(common::MethodInfo {
15191            id: "cloudidentity.groups.get",
15192            http_method: hyper::Method::GET,
15193        });
15194
15195        for &field in ["alt", "name"].iter() {
15196            if self._additional_params.contains_key(field) {
15197                dlg.finished(false);
15198                return Err(common::Error::FieldClash(field));
15199            }
15200        }
15201
15202        let mut params = Params::with_capacity(3 + self._additional_params.len());
15203        params.push("name", self._name);
15204
15205        params.extend(self._additional_params.iter());
15206
15207        params.push("alt", "json");
15208        let mut url = self.hub._base_url.clone() + "v1/{+name}";
15209        if self._scopes.is_empty() {
15210            self._scopes
15211                .insert(Scope::CloudIdentityGroupReadonly.as_ref().to_string());
15212        }
15213
15214        #[allow(clippy::single_element_loop)]
15215        for &(find_this, param_name) in [("{+name}", "name")].iter() {
15216            url = params.uri_replacement(url, param_name, find_this, true);
15217        }
15218        {
15219            let to_remove = ["name"];
15220            params.remove_params(&to_remove);
15221        }
15222
15223        let url = params.parse_with_url(&url);
15224
15225        loop {
15226            let token = match self
15227                .hub
15228                .auth
15229                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
15230                .await
15231            {
15232                Ok(token) => token,
15233                Err(e) => match dlg.token(e) {
15234                    Ok(token) => token,
15235                    Err(e) => {
15236                        dlg.finished(false);
15237                        return Err(common::Error::MissingToken(e));
15238                    }
15239                },
15240            };
15241            let mut req_result = {
15242                let client = &self.hub.client;
15243                dlg.pre_request();
15244                let mut req_builder = hyper::Request::builder()
15245                    .method(hyper::Method::GET)
15246                    .uri(url.as_str())
15247                    .header(USER_AGENT, self.hub._user_agent.clone());
15248
15249                if let Some(token) = token.as_ref() {
15250                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
15251                }
15252
15253                let request = req_builder
15254                    .header(CONTENT_LENGTH, 0_u64)
15255                    .body(common::to_body::<String>(None));
15256
15257                client.request(request.unwrap()).await
15258            };
15259
15260            match req_result {
15261                Err(err) => {
15262                    if let common::Retry::After(d) = dlg.http_error(&err) {
15263                        sleep(d).await;
15264                        continue;
15265                    }
15266                    dlg.finished(false);
15267                    return Err(common::Error::HttpError(err));
15268                }
15269                Ok(res) => {
15270                    let (mut parts, body) = res.into_parts();
15271                    let mut body = common::Body::new(body);
15272                    if !parts.status.is_success() {
15273                        let bytes = common::to_bytes(body).await.unwrap_or_default();
15274                        let error = serde_json::from_str(&common::to_string(&bytes));
15275                        let response = common::to_response(parts, bytes.into());
15276
15277                        if let common::Retry::After(d) =
15278                            dlg.http_failure(&response, error.as_ref().ok())
15279                        {
15280                            sleep(d).await;
15281                            continue;
15282                        }
15283
15284                        dlg.finished(false);
15285
15286                        return Err(match error {
15287                            Ok(value) => common::Error::BadRequest(value),
15288                            _ => common::Error::Failure(response),
15289                        });
15290                    }
15291                    let response = {
15292                        let bytes = common::to_bytes(body).await.unwrap_or_default();
15293                        let encoded = common::to_string(&bytes);
15294                        match serde_json::from_str(&encoded) {
15295                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
15296                            Err(error) => {
15297                                dlg.response_json_decode_error(&encoded, &error);
15298                                return Err(common::Error::JsonDecodeError(
15299                                    encoded.to_string(),
15300                                    error,
15301                                ));
15302                            }
15303                        }
15304                    };
15305
15306                    dlg.finished(true);
15307                    return Ok(response);
15308                }
15309            }
15310        }
15311    }
15312
15313    /// Required. The [resource name](https://cloud.google.com/apis/design/resource_names) of the `Group` to retrieve. Must be of the form `groups/{group}`.
15314    ///
15315    /// Sets the *name* path property to the given value.
15316    ///
15317    /// Even though the property as already been set when instantiating this call,
15318    /// we provide this method for API completeness.
15319    pub fn name(mut self, new_value: &str) -> GroupGetCall<'a, C> {
15320        self._name = new_value.to_string();
15321        self
15322    }
15323    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
15324    /// while executing the actual API request.
15325    ///
15326    /// ````text
15327    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
15328    /// ````
15329    ///
15330    /// Sets the *delegate* property to the given value.
15331    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> GroupGetCall<'a, C> {
15332        self._delegate = Some(new_value);
15333        self
15334    }
15335
15336    /// Set any additional parameter of the query string used in the request.
15337    /// It should be used to set parameters which are not yet available through their own
15338    /// setters.
15339    ///
15340    /// Please note that this method must not be used to set any of the known parameters
15341    /// which have their own setter method. If done anyway, the request will fail.
15342    ///
15343    /// # Additional Parameters
15344    ///
15345    /// * *$.xgafv* (query-string) - V1 error format.
15346    /// * *access_token* (query-string) - OAuth access token.
15347    /// * *alt* (query-string) - Data format for response.
15348    /// * *callback* (query-string) - JSONP
15349    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
15350    /// * *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.
15351    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
15352    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
15353    /// * *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.
15354    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
15355    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
15356    pub fn param<T>(mut self, name: T, value: T) -> GroupGetCall<'a, C>
15357    where
15358        T: AsRef<str>,
15359    {
15360        self._additional_params
15361            .insert(name.as_ref().to_string(), value.as_ref().to_string());
15362        self
15363    }
15364
15365    /// Identifies the authorization scope for the method you are building.
15366    ///
15367    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
15368    /// [`Scope::CloudIdentityGroupReadonly`].
15369    ///
15370    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
15371    /// tokens for more than one scope.
15372    ///
15373    /// Usually there is more than one suitable scope to authorize an operation, some of which may
15374    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
15375    /// sufficient, a read-write scope will do as well.
15376    pub fn add_scope<St>(mut self, scope: St) -> GroupGetCall<'a, C>
15377    where
15378        St: AsRef<str>,
15379    {
15380        self._scopes.insert(String::from(scope.as_ref()));
15381        self
15382    }
15383    /// Identifies the authorization scope(s) for the method you are building.
15384    ///
15385    /// See [`Self::add_scope()`] for details.
15386    pub fn add_scopes<I, St>(mut self, scopes: I) -> GroupGetCall<'a, C>
15387    where
15388        I: IntoIterator<Item = St>,
15389        St: AsRef<str>,
15390    {
15391        self._scopes
15392            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
15393        self
15394    }
15395
15396    /// Removes all scopes, and no default scope will be used either.
15397    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
15398    /// for details).
15399    pub fn clear_scopes(mut self) -> GroupGetCall<'a, C> {
15400        self._scopes.clear();
15401        self
15402    }
15403}
15404
15405/// Get Security Settings
15406///
15407/// A builder for the *getSecuritySettings* method supported by a *group* resource.
15408/// It is not used directly, but through a [`GroupMethods`] instance.
15409///
15410/// # Example
15411///
15412/// Instantiate a resource method builder
15413///
15414/// ```test_harness,no_run
15415/// # extern crate hyper;
15416/// # extern crate hyper_rustls;
15417/// # extern crate google_cloudidentity1 as cloudidentity1;
15418/// # async fn dox() {
15419/// # use cloudidentity1::{CloudIdentity, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
15420///
15421/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
15422/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
15423/// #     .with_native_roots()
15424/// #     .unwrap()
15425/// #     .https_only()
15426/// #     .enable_http2()
15427/// #     .build();
15428///
15429/// # let executor = hyper_util::rt::TokioExecutor::new();
15430/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
15431/// #     secret,
15432/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
15433/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
15434/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
15435/// #     ),
15436/// # ).build().await.unwrap();
15437///
15438/// # let client = hyper_util::client::legacy::Client::builder(
15439/// #     hyper_util::rt::TokioExecutor::new()
15440/// # )
15441/// # .build(
15442/// #     hyper_rustls::HttpsConnectorBuilder::new()
15443/// #         .with_native_roots()
15444/// #         .unwrap()
15445/// #         .https_or_http()
15446/// #         .enable_http2()
15447/// #         .build()
15448/// # );
15449/// # let mut hub = CloudIdentity::new(client, auth);
15450/// // You can configure optional parameters by calling the respective setters at will, and
15451/// // execute the final call using `doit()`.
15452/// // Values shown here are possibly random and not representative !
15453/// let result = hub.groups().get_security_settings("name")
15454///              .read_mask(FieldMask::new::<&str>(&[]))
15455///              .doit().await;
15456/// # }
15457/// ```
15458pub struct GroupGetSecuritySettingCall<'a, C>
15459where
15460    C: 'a,
15461{
15462    hub: &'a CloudIdentity<C>,
15463    _name: String,
15464    _read_mask: Option<common::FieldMask>,
15465    _delegate: Option<&'a mut dyn common::Delegate>,
15466    _additional_params: HashMap<String, String>,
15467    _scopes: BTreeSet<String>,
15468}
15469
15470impl<'a, C> common::CallBuilder for GroupGetSecuritySettingCall<'a, C> {}
15471
15472impl<'a, C> GroupGetSecuritySettingCall<'a, C>
15473where
15474    C: common::Connector,
15475{
15476    /// Perform the operation you have build so far.
15477    pub async fn doit(mut self) -> common::Result<(common::Response, SecuritySettings)> {
15478        use std::borrow::Cow;
15479        use std::io::{Read, Seek};
15480
15481        use common::{url::Params, ToParts};
15482        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
15483
15484        let mut dd = common::DefaultDelegate;
15485        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
15486        dlg.begin(common::MethodInfo {
15487            id: "cloudidentity.groups.getSecuritySettings",
15488            http_method: hyper::Method::GET,
15489        });
15490
15491        for &field in ["alt", "name", "readMask"].iter() {
15492            if self._additional_params.contains_key(field) {
15493                dlg.finished(false);
15494                return Err(common::Error::FieldClash(field));
15495            }
15496        }
15497
15498        let mut params = Params::with_capacity(4 + self._additional_params.len());
15499        params.push("name", self._name);
15500        if let Some(value) = self._read_mask.as_ref() {
15501            params.push("readMask", value.to_string());
15502        }
15503
15504        params.extend(self._additional_params.iter());
15505
15506        params.push("alt", "json");
15507        let mut url = self.hub._base_url.clone() + "v1/{+name}";
15508        if self._scopes.is_empty() {
15509            self._scopes
15510                .insert(Scope::CloudIdentityGroupReadonly.as_ref().to_string());
15511        }
15512
15513        #[allow(clippy::single_element_loop)]
15514        for &(find_this, param_name) in [("{+name}", "name")].iter() {
15515            url = params.uri_replacement(url, param_name, find_this, true);
15516        }
15517        {
15518            let to_remove = ["name"];
15519            params.remove_params(&to_remove);
15520        }
15521
15522        let url = params.parse_with_url(&url);
15523
15524        loop {
15525            let token = match self
15526                .hub
15527                .auth
15528                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
15529                .await
15530            {
15531                Ok(token) => token,
15532                Err(e) => match dlg.token(e) {
15533                    Ok(token) => token,
15534                    Err(e) => {
15535                        dlg.finished(false);
15536                        return Err(common::Error::MissingToken(e));
15537                    }
15538                },
15539            };
15540            let mut req_result = {
15541                let client = &self.hub.client;
15542                dlg.pre_request();
15543                let mut req_builder = hyper::Request::builder()
15544                    .method(hyper::Method::GET)
15545                    .uri(url.as_str())
15546                    .header(USER_AGENT, self.hub._user_agent.clone());
15547
15548                if let Some(token) = token.as_ref() {
15549                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
15550                }
15551
15552                let request = req_builder
15553                    .header(CONTENT_LENGTH, 0_u64)
15554                    .body(common::to_body::<String>(None));
15555
15556                client.request(request.unwrap()).await
15557            };
15558
15559            match req_result {
15560                Err(err) => {
15561                    if let common::Retry::After(d) = dlg.http_error(&err) {
15562                        sleep(d).await;
15563                        continue;
15564                    }
15565                    dlg.finished(false);
15566                    return Err(common::Error::HttpError(err));
15567                }
15568                Ok(res) => {
15569                    let (mut parts, body) = res.into_parts();
15570                    let mut body = common::Body::new(body);
15571                    if !parts.status.is_success() {
15572                        let bytes = common::to_bytes(body).await.unwrap_or_default();
15573                        let error = serde_json::from_str(&common::to_string(&bytes));
15574                        let response = common::to_response(parts, bytes.into());
15575
15576                        if let common::Retry::After(d) =
15577                            dlg.http_failure(&response, error.as_ref().ok())
15578                        {
15579                            sleep(d).await;
15580                            continue;
15581                        }
15582
15583                        dlg.finished(false);
15584
15585                        return Err(match error {
15586                            Ok(value) => common::Error::BadRequest(value),
15587                            _ => common::Error::Failure(response),
15588                        });
15589                    }
15590                    let response = {
15591                        let bytes = common::to_bytes(body).await.unwrap_or_default();
15592                        let encoded = common::to_string(&bytes);
15593                        match serde_json::from_str(&encoded) {
15594                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
15595                            Err(error) => {
15596                                dlg.response_json_decode_error(&encoded, &error);
15597                                return Err(common::Error::JsonDecodeError(
15598                                    encoded.to_string(),
15599                                    error,
15600                                ));
15601                            }
15602                        }
15603                    };
15604
15605                    dlg.finished(true);
15606                    return Ok(response);
15607                }
15608            }
15609        }
15610    }
15611
15612    /// Required. The security settings to retrieve. Format: `groups/{group_id}/securitySettings`
15613    ///
15614    /// Sets the *name* path property to the given value.
15615    ///
15616    /// Even though the property as already been set when instantiating this call,
15617    /// we provide this method for API completeness.
15618    pub fn name(mut self, new_value: &str) -> GroupGetSecuritySettingCall<'a, C> {
15619        self._name = new_value.to_string();
15620        self
15621    }
15622    /// Field-level read mask of which fields to return. "*" returns all fields. If not specified, all fields will be returned. May only contain the following field: `member_restriction`.
15623    ///
15624    /// Sets the *read mask* query property to the given value.
15625    pub fn read_mask(mut self, new_value: common::FieldMask) -> GroupGetSecuritySettingCall<'a, C> {
15626        self._read_mask = Some(new_value);
15627        self
15628    }
15629    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
15630    /// while executing the actual API request.
15631    ///
15632    /// ````text
15633    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
15634    /// ````
15635    ///
15636    /// Sets the *delegate* property to the given value.
15637    pub fn delegate(
15638        mut self,
15639        new_value: &'a mut dyn common::Delegate,
15640    ) -> GroupGetSecuritySettingCall<'a, C> {
15641        self._delegate = Some(new_value);
15642        self
15643    }
15644
15645    /// Set any additional parameter of the query string used in the request.
15646    /// It should be used to set parameters which are not yet available through their own
15647    /// setters.
15648    ///
15649    /// Please note that this method must not be used to set any of the known parameters
15650    /// which have their own setter method. If done anyway, the request will fail.
15651    ///
15652    /// # Additional Parameters
15653    ///
15654    /// * *$.xgafv* (query-string) - V1 error format.
15655    /// * *access_token* (query-string) - OAuth access token.
15656    /// * *alt* (query-string) - Data format for response.
15657    /// * *callback* (query-string) - JSONP
15658    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
15659    /// * *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.
15660    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
15661    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
15662    /// * *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.
15663    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
15664    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
15665    pub fn param<T>(mut self, name: T, value: T) -> GroupGetSecuritySettingCall<'a, C>
15666    where
15667        T: AsRef<str>,
15668    {
15669        self._additional_params
15670            .insert(name.as_ref().to_string(), value.as_ref().to_string());
15671        self
15672    }
15673
15674    /// Identifies the authorization scope for the method you are building.
15675    ///
15676    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
15677    /// [`Scope::CloudIdentityGroupReadonly`].
15678    ///
15679    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
15680    /// tokens for more than one scope.
15681    ///
15682    /// Usually there is more than one suitable scope to authorize an operation, some of which may
15683    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
15684    /// sufficient, a read-write scope will do as well.
15685    pub fn add_scope<St>(mut self, scope: St) -> GroupGetSecuritySettingCall<'a, C>
15686    where
15687        St: AsRef<str>,
15688    {
15689        self._scopes.insert(String::from(scope.as_ref()));
15690        self
15691    }
15692    /// Identifies the authorization scope(s) for the method you are building.
15693    ///
15694    /// See [`Self::add_scope()`] for details.
15695    pub fn add_scopes<I, St>(mut self, scopes: I) -> GroupGetSecuritySettingCall<'a, C>
15696    where
15697        I: IntoIterator<Item = St>,
15698        St: AsRef<str>,
15699    {
15700        self._scopes
15701            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
15702        self
15703    }
15704
15705    /// Removes all scopes, and no default scope will be used either.
15706    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
15707    /// for details).
15708    pub fn clear_scopes(mut self) -> GroupGetSecuritySettingCall<'a, C> {
15709        self._scopes.clear();
15710        self
15711    }
15712}
15713
15714/// Lists the `Group` resources under a customer or namespace.
15715///
15716/// A builder for the *list* method supported by a *group* resource.
15717/// It is not used directly, but through a [`GroupMethods`] instance.
15718///
15719/// # Example
15720///
15721/// Instantiate a resource method builder
15722///
15723/// ```test_harness,no_run
15724/// # extern crate hyper;
15725/// # extern crate hyper_rustls;
15726/// # extern crate google_cloudidentity1 as cloudidentity1;
15727/// # async fn dox() {
15728/// # use cloudidentity1::{CloudIdentity, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
15729///
15730/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
15731/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
15732/// #     .with_native_roots()
15733/// #     .unwrap()
15734/// #     .https_only()
15735/// #     .enable_http2()
15736/// #     .build();
15737///
15738/// # let executor = hyper_util::rt::TokioExecutor::new();
15739/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
15740/// #     secret,
15741/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
15742/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
15743/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
15744/// #     ),
15745/// # ).build().await.unwrap();
15746///
15747/// # let client = hyper_util::client::legacy::Client::builder(
15748/// #     hyper_util::rt::TokioExecutor::new()
15749/// # )
15750/// # .build(
15751/// #     hyper_rustls::HttpsConnectorBuilder::new()
15752/// #         .with_native_roots()
15753/// #         .unwrap()
15754/// #         .https_or_http()
15755/// #         .enable_http2()
15756/// #         .build()
15757/// # );
15758/// # let mut hub = CloudIdentity::new(client, auth);
15759/// // You can configure optional parameters by calling the respective setters at will, and
15760/// // execute the final call using `doit()`.
15761/// // Values shown here are possibly random and not representative !
15762/// let result = hub.groups().list()
15763///              .view("dolore")
15764///              .parent("dolore")
15765///              .page_token("dolore")
15766///              .page_size(-78)
15767///              .doit().await;
15768/// # }
15769/// ```
15770pub struct GroupListCall<'a, C>
15771where
15772    C: 'a,
15773{
15774    hub: &'a CloudIdentity<C>,
15775    _view: Option<String>,
15776    _parent: Option<String>,
15777    _page_token: Option<String>,
15778    _page_size: Option<i32>,
15779    _delegate: Option<&'a mut dyn common::Delegate>,
15780    _additional_params: HashMap<String, String>,
15781    _scopes: BTreeSet<String>,
15782}
15783
15784impl<'a, C> common::CallBuilder for GroupListCall<'a, C> {}
15785
15786impl<'a, C> GroupListCall<'a, C>
15787where
15788    C: common::Connector,
15789{
15790    /// Perform the operation you have build so far.
15791    pub async fn doit(mut self) -> common::Result<(common::Response, ListGroupsResponse)> {
15792        use std::borrow::Cow;
15793        use std::io::{Read, Seek};
15794
15795        use common::{url::Params, ToParts};
15796        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
15797
15798        let mut dd = common::DefaultDelegate;
15799        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
15800        dlg.begin(common::MethodInfo {
15801            id: "cloudidentity.groups.list",
15802            http_method: hyper::Method::GET,
15803        });
15804
15805        for &field in ["alt", "view", "parent", "pageToken", "pageSize"].iter() {
15806            if self._additional_params.contains_key(field) {
15807                dlg.finished(false);
15808                return Err(common::Error::FieldClash(field));
15809            }
15810        }
15811
15812        let mut params = Params::with_capacity(6 + self._additional_params.len());
15813        if let Some(value) = self._view.as_ref() {
15814            params.push("view", value);
15815        }
15816        if let Some(value) = self._parent.as_ref() {
15817            params.push("parent", value);
15818        }
15819        if let Some(value) = self._page_token.as_ref() {
15820            params.push("pageToken", value);
15821        }
15822        if let Some(value) = self._page_size.as_ref() {
15823            params.push("pageSize", value.to_string());
15824        }
15825
15826        params.extend(self._additional_params.iter());
15827
15828        params.push("alt", "json");
15829        let mut url = self.hub._base_url.clone() + "v1/groups";
15830        if self._scopes.is_empty() {
15831            self._scopes
15832                .insert(Scope::CloudIdentityGroupReadonly.as_ref().to_string());
15833        }
15834
15835        let url = params.parse_with_url(&url);
15836
15837        loop {
15838            let token = match self
15839                .hub
15840                .auth
15841                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
15842                .await
15843            {
15844                Ok(token) => token,
15845                Err(e) => match dlg.token(e) {
15846                    Ok(token) => token,
15847                    Err(e) => {
15848                        dlg.finished(false);
15849                        return Err(common::Error::MissingToken(e));
15850                    }
15851                },
15852            };
15853            let mut req_result = {
15854                let client = &self.hub.client;
15855                dlg.pre_request();
15856                let mut req_builder = hyper::Request::builder()
15857                    .method(hyper::Method::GET)
15858                    .uri(url.as_str())
15859                    .header(USER_AGENT, self.hub._user_agent.clone());
15860
15861                if let Some(token) = token.as_ref() {
15862                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
15863                }
15864
15865                let request = req_builder
15866                    .header(CONTENT_LENGTH, 0_u64)
15867                    .body(common::to_body::<String>(None));
15868
15869                client.request(request.unwrap()).await
15870            };
15871
15872            match req_result {
15873                Err(err) => {
15874                    if let common::Retry::After(d) = dlg.http_error(&err) {
15875                        sleep(d).await;
15876                        continue;
15877                    }
15878                    dlg.finished(false);
15879                    return Err(common::Error::HttpError(err));
15880                }
15881                Ok(res) => {
15882                    let (mut parts, body) = res.into_parts();
15883                    let mut body = common::Body::new(body);
15884                    if !parts.status.is_success() {
15885                        let bytes = common::to_bytes(body).await.unwrap_or_default();
15886                        let error = serde_json::from_str(&common::to_string(&bytes));
15887                        let response = common::to_response(parts, bytes.into());
15888
15889                        if let common::Retry::After(d) =
15890                            dlg.http_failure(&response, error.as_ref().ok())
15891                        {
15892                            sleep(d).await;
15893                            continue;
15894                        }
15895
15896                        dlg.finished(false);
15897
15898                        return Err(match error {
15899                            Ok(value) => common::Error::BadRequest(value),
15900                            _ => common::Error::Failure(response),
15901                        });
15902                    }
15903                    let response = {
15904                        let bytes = common::to_bytes(body).await.unwrap_or_default();
15905                        let encoded = common::to_string(&bytes);
15906                        match serde_json::from_str(&encoded) {
15907                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
15908                            Err(error) => {
15909                                dlg.response_json_decode_error(&encoded, &error);
15910                                return Err(common::Error::JsonDecodeError(
15911                                    encoded.to_string(),
15912                                    error,
15913                                ));
15914                            }
15915                        }
15916                    };
15917
15918                    dlg.finished(true);
15919                    return Ok(response);
15920                }
15921            }
15922        }
15923    }
15924
15925    /// The level of detail to be returned. If unspecified, defaults to `View.BASIC`.
15926    ///
15927    /// Sets the *view* query property to the given value.
15928    pub fn view(mut self, new_value: &str) -> GroupListCall<'a, C> {
15929        self._view = Some(new_value.to_string());
15930        self
15931    }
15932    /// Required. The parent resource under which to list all `Group` resources. Must be of the form `identitysources/{identity_source}` for external- identity-mapped groups or `customers/{customer_id}` for Google Groups. The `customer_id` must begin with "C" (for example, 'C046psxkn'). [Find your customer ID.] (https://support.google.com/cloudidentity/answer/10070793)
15933    ///
15934    /// Sets the *parent* query property to the given value.
15935    pub fn parent(mut self, new_value: &str) -> GroupListCall<'a, C> {
15936        self._parent = Some(new_value.to_string());
15937        self
15938    }
15939    /// The `next_page_token` value returned from a previous list request, if any.
15940    ///
15941    /// Sets the *page token* query property to the given value.
15942    pub fn page_token(mut self, new_value: &str) -> GroupListCall<'a, C> {
15943        self._page_token = Some(new_value.to_string());
15944        self
15945    }
15946    /// The maximum number of results to return. Note that the number of results returned may be less than this value even if there are more available results. To fetch all results, clients must continue calling this method repeatedly until the response no longer contains a `next_page_token`. If unspecified, defaults to 200 for `View.BASIC` and to 50 for `View.FULL`. Must not be greater than 1000 for `View.BASIC` or 500 for `View.FULL`.
15947    ///
15948    /// Sets the *page size* query property to the given value.
15949    pub fn page_size(mut self, new_value: i32) -> GroupListCall<'a, C> {
15950        self._page_size = Some(new_value);
15951        self
15952    }
15953    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
15954    /// while executing the actual API request.
15955    ///
15956    /// ````text
15957    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
15958    /// ````
15959    ///
15960    /// Sets the *delegate* property to the given value.
15961    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> GroupListCall<'a, C> {
15962        self._delegate = Some(new_value);
15963        self
15964    }
15965
15966    /// Set any additional parameter of the query string used in the request.
15967    /// It should be used to set parameters which are not yet available through their own
15968    /// setters.
15969    ///
15970    /// Please note that this method must not be used to set any of the known parameters
15971    /// which have their own setter method. If done anyway, the request will fail.
15972    ///
15973    /// # Additional Parameters
15974    ///
15975    /// * *$.xgafv* (query-string) - V1 error format.
15976    /// * *access_token* (query-string) - OAuth access token.
15977    /// * *alt* (query-string) - Data format for response.
15978    /// * *callback* (query-string) - JSONP
15979    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
15980    /// * *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.
15981    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
15982    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
15983    /// * *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.
15984    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
15985    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
15986    pub fn param<T>(mut self, name: T, value: T) -> GroupListCall<'a, C>
15987    where
15988        T: AsRef<str>,
15989    {
15990        self._additional_params
15991            .insert(name.as_ref().to_string(), value.as_ref().to_string());
15992        self
15993    }
15994
15995    /// Identifies the authorization scope for the method you are building.
15996    ///
15997    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
15998    /// [`Scope::CloudIdentityGroupReadonly`].
15999    ///
16000    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
16001    /// tokens for more than one scope.
16002    ///
16003    /// Usually there is more than one suitable scope to authorize an operation, some of which may
16004    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
16005    /// sufficient, a read-write scope will do as well.
16006    pub fn add_scope<St>(mut self, scope: St) -> GroupListCall<'a, C>
16007    where
16008        St: AsRef<str>,
16009    {
16010        self._scopes.insert(String::from(scope.as_ref()));
16011        self
16012    }
16013    /// Identifies the authorization scope(s) for the method you are building.
16014    ///
16015    /// See [`Self::add_scope()`] for details.
16016    pub fn add_scopes<I, St>(mut self, scopes: I) -> GroupListCall<'a, C>
16017    where
16018        I: IntoIterator<Item = St>,
16019        St: AsRef<str>,
16020    {
16021        self._scopes
16022            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
16023        self
16024    }
16025
16026    /// Removes all scopes, and no default scope will be used either.
16027    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
16028    /// for details).
16029    pub fn clear_scopes(mut self) -> GroupListCall<'a, C> {
16030        self._scopes.clear();
16031        self
16032    }
16033}
16034
16035/// Looks up the [resource name](https://cloud.google.com/apis/design/resource_names) of a `Group` by its `EntityKey`.
16036///
16037/// A builder for the *lookup* method supported by a *group* resource.
16038/// It is not used directly, but through a [`GroupMethods`] instance.
16039///
16040/// # Example
16041///
16042/// Instantiate a resource method builder
16043///
16044/// ```test_harness,no_run
16045/// # extern crate hyper;
16046/// # extern crate hyper_rustls;
16047/// # extern crate google_cloudidentity1 as cloudidentity1;
16048/// # async fn dox() {
16049/// # use cloudidentity1::{CloudIdentity, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
16050///
16051/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
16052/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
16053/// #     .with_native_roots()
16054/// #     .unwrap()
16055/// #     .https_only()
16056/// #     .enable_http2()
16057/// #     .build();
16058///
16059/// # let executor = hyper_util::rt::TokioExecutor::new();
16060/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
16061/// #     secret,
16062/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
16063/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
16064/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
16065/// #     ),
16066/// # ).build().await.unwrap();
16067///
16068/// # let client = hyper_util::client::legacy::Client::builder(
16069/// #     hyper_util::rt::TokioExecutor::new()
16070/// # )
16071/// # .build(
16072/// #     hyper_rustls::HttpsConnectorBuilder::new()
16073/// #         .with_native_roots()
16074/// #         .unwrap()
16075/// #         .https_or_http()
16076/// #         .enable_http2()
16077/// #         .build()
16078/// # );
16079/// # let mut hub = CloudIdentity::new(client, auth);
16080/// // You can configure optional parameters by calling the respective setters at will, and
16081/// // execute the final call using `doit()`.
16082/// // Values shown here are possibly random and not representative !
16083/// let result = hub.groups().lookup()
16084///              .group_key_namespace("amet.")
16085///              .group_key_id("ea")
16086///              .doit().await;
16087/// # }
16088/// ```
16089pub struct GroupLookupCall<'a, C>
16090where
16091    C: 'a,
16092{
16093    hub: &'a CloudIdentity<C>,
16094    _group_key_namespace: Option<String>,
16095    _group_key_id: Option<String>,
16096    _delegate: Option<&'a mut dyn common::Delegate>,
16097    _additional_params: HashMap<String, String>,
16098    _scopes: BTreeSet<String>,
16099}
16100
16101impl<'a, C> common::CallBuilder for GroupLookupCall<'a, C> {}
16102
16103impl<'a, C> GroupLookupCall<'a, C>
16104where
16105    C: common::Connector,
16106{
16107    /// Perform the operation you have build so far.
16108    pub async fn doit(mut self) -> common::Result<(common::Response, LookupGroupNameResponse)> {
16109        use std::borrow::Cow;
16110        use std::io::{Read, Seek};
16111
16112        use common::{url::Params, ToParts};
16113        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
16114
16115        let mut dd = common::DefaultDelegate;
16116        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
16117        dlg.begin(common::MethodInfo {
16118            id: "cloudidentity.groups.lookup",
16119            http_method: hyper::Method::GET,
16120        });
16121
16122        for &field in ["alt", "groupKey.namespace", "groupKey.id"].iter() {
16123            if self._additional_params.contains_key(field) {
16124                dlg.finished(false);
16125                return Err(common::Error::FieldClash(field));
16126            }
16127        }
16128
16129        let mut params = Params::with_capacity(4 + self._additional_params.len());
16130        if let Some(value) = self._group_key_namespace.as_ref() {
16131            params.push("groupKey.namespace", value);
16132        }
16133        if let Some(value) = self._group_key_id.as_ref() {
16134            params.push("groupKey.id", value);
16135        }
16136
16137        params.extend(self._additional_params.iter());
16138
16139        params.push("alt", "json");
16140        let mut url = self.hub._base_url.clone() + "v1/groups:lookup";
16141        if self._scopes.is_empty() {
16142            self._scopes
16143                .insert(Scope::CloudIdentityGroupReadonly.as_ref().to_string());
16144        }
16145
16146        let url = params.parse_with_url(&url);
16147
16148        loop {
16149            let token = match self
16150                .hub
16151                .auth
16152                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
16153                .await
16154            {
16155                Ok(token) => token,
16156                Err(e) => match dlg.token(e) {
16157                    Ok(token) => token,
16158                    Err(e) => {
16159                        dlg.finished(false);
16160                        return Err(common::Error::MissingToken(e));
16161                    }
16162                },
16163            };
16164            let mut req_result = {
16165                let client = &self.hub.client;
16166                dlg.pre_request();
16167                let mut req_builder = hyper::Request::builder()
16168                    .method(hyper::Method::GET)
16169                    .uri(url.as_str())
16170                    .header(USER_AGENT, self.hub._user_agent.clone());
16171
16172                if let Some(token) = token.as_ref() {
16173                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
16174                }
16175
16176                let request = req_builder
16177                    .header(CONTENT_LENGTH, 0_u64)
16178                    .body(common::to_body::<String>(None));
16179
16180                client.request(request.unwrap()).await
16181            };
16182
16183            match req_result {
16184                Err(err) => {
16185                    if let common::Retry::After(d) = dlg.http_error(&err) {
16186                        sleep(d).await;
16187                        continue;
16188                    }
16189                    dlg.finished(false);
16190                    return Err(common::Error::HttpError(err));
16191                }
16192                Ok(res) => {
16193                    let (mut parts, body) = res.into_parts();
16194                    let mut body = common::Body::new(body);
16195                    if !parts.status.is_success() {
16196                        let bytes = common::to_bytes(body).await.unwrap_or_default();
16197                        let error = serde_json::from_str(&common::to_string(&bytes));
16198                        let response = common::to_response(parts, bytes.into());
16199
16200                        if let common::Retry::After(d) =
16201                            dlg.http_failure(&response, error.as_ref().ok())
16202                        {
16203                            sleep(d).await;
16204                            continue;
16205                        }
16206
16207                        dlg.finished(false);
16208
16209                        return Err(match error {
16210                            Ok(value) => common::Error::BadRequest(value),
16211                            _ => common::Error::Failure(response),
16212                        });
16213                    }
16214                    let response = {
16215                        let bytes = common::to_bytes(body).await.unwrap_or_default();
16216                        let encoded = common::to_string(&bytes);
16217                        match serde_json::from_str(&encoded) {
16218                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
16219                            Err(error) => {
16220                                dlg.response_json_decode_error(&encoded, &error);
16221                                return Err(common::Error::JsonDecodeError(
16222                                    encoded.to_string(),
16223                                    error,
16224                                ));
16225                            }
16226                        }
16227                    };
16228
16229                    dlg.finished(true);
16230                    return Ok(response);
16231                }
16232            }
16233        }
16234    }
16235
16236    /// The namespace in which the entity exists. If not specified, the `EntityKey` represents a Google-managed entity such as a Google user or a Google Group. If specified, the `EntityKey` represents an external-identity-mapped group. The namespace must correspond to an identity source created in Admin Console and must be in the form of `identitysources/{identity_source}`.
16237    ///
16238    /// Sets the *group key.namespace* query property to the given value.
16239    pub fn group_key_namespace(mut self, new_value: &str) -> GroupLookupCall<'a, C> {
16240        self._group_key_namespace = Some(new_value.to_string());
16241        self
16242    }
16243    /// The ID of the entity. For Google-managed entities, the `id` should be the email address of an existing group or user. Email addresses need to adhere to [name guidelines for users and groups](https://support.google.com/a/answer/9193374). For external-identity-mapped entities, the `id` must be a string conforming to the Identity Source's requirements. Must be unique within a `namespace`.
16244    ///
16245    /// Sets the *group key.id* query property to the given value.
16246    pub fn group_key_id(mut self, new_value: &str) -> GroupLookupCall<'a, C> {
16247        self._group_key_id = Some(new_value.to_string());
16248        self
16249    }
16250    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
16251    /// while executing the actual API request.
16252    ///
16253    /// ````text
16254    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
16255    /// ````
16256    ///
16257    /// Sets the *delegate* property to the given value.
16258    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> GroupLookupCall<'a, C> {
16259        self._delegate = Some(new_value);
16260        self
16261    }
16262
16263    /// Set any additional parameter of the query string used in the request.
16264    /// It should be used to set parameters which are not yet available through their own
16265    /// setters.
16266    ///
16267    /// Please note that this method must not be used to set any of the known parameters
16268    /// which have their own setter method. If done anyway, the request will fail.
16269    ///
16270    /// # Additional Parameters
16271    ///
16272    /// * *$.xgafv* (query-string) - V1 error format.
16273    /// * *access_token* (query-string) - OAuth access token.
16274    /// * *alt* (query-string) - Data format for response.
16275    /// * *callback* (query-string) - JSONP
16276    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
16277    /// * *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.
16278    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
16279    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
16280    /// * *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.
16281    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
16282    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
16283    pub fn param<T>(mut self, name: T, value: T) -> GroupLookupCall<'a, C>
16284    where
16285        T: AsRef<str>,
16286    {
16287        self._additional_params
16288            .insert(name.as_ref().to_string(), value.as_ref().to_string());
16289        self
16290    }
16291
16292    /// Identifies the authorization scope for the method you are building.
16293    ///
16294    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
16295    /// [`Scope::CloudIdentityGroupReadonly`].
16296    ///
16297    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
16298    /// tokens for more than one scope.
16299    ///
16300    /// Usually there is more than one suitable scope to authorize an operation, some of which may
16301    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
16302    /// sufficient, a read-write scope will do as well.
16303    pub fn add_scope<St>(mut self, scope: St) -> GroupLookupCall<'a, C>
16304    where
16305        St: AsRef<str>,
16306    {
16307        self._scopes.insert(String::from(scope.as_ref()));
16308        self
16309    }
16310    /// Identifies the authorization scope(s) for the method you are building.
16311    ///
16312    /// See [`Self::add_scope()`] for details.
16313    pub fn add_scopes<I, St>(mut self, scopes: I) -> GroupLookupCall<'a, C>
16314    where
16315        I: IntoIterator<Item = St>,
16316        St: AsRef<str>,
16317    {
16318        self._scopes
16319            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
16320        self
16321    }
16322
16323    /// Removes all scopes, and no default scope will be used either.
16324    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
16325    /// for details).
16326    pub fn clear_scopes(mut self) -> GroupLookupCall<'a, C> {
16327        self._scopes.clear();
16328        self
16329    }
16330}
16331
16332/// Updates a `Group`.
16333///
16334/// A builder for the *patch* method supported by a *group* resource.
16335/// It is not used directly, but through a [`GroupMethods`] instance.
16336///
16337/// # Example
16338///
16339/// Instantiate a resource method builder
16340///
16341/// ```test_harness,no_run
16342/// # extern crate hyper;
16343/// # extern crate hyper_rustls;
16344/// # extern crate google_cloudidentity1 as cloudidentity1;
16345/// use cloudidentity1::api::Group;
16346/// # async fn dox() {
16347/// # use cloudidentity1::{CloudIdentity, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
16348///
16349/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
16350/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
16351/// #     .with_native_roots()
16352/// #     .unwrap()
16353/// #     .https_only()
16354/// #     .enable_http2()
16355/// #     .build();
16356///
16357/// # let executor = hyper_util::rt::TokioExecutor::new();
16358/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
16359/// #     secret,
16360/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
16361/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
16362/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
16363/// #     ),
16364/// # ).build().await.unwrap();
16365///
16366/// # let client = hyper_util::client::legacy::Client::builder(
16367/// #     hyper_util::rt::TokioExecutor::new()
16368/// # )
16369/// # .build(
16370/// #     hyper_rustls::HttpsConnectorBuilder::new()
16371/// #         .with_native_roots()
16372/// #         .unwrap()
16373/// #         .https_or_http()
16374/// #         .enable_http2()
16375/// #         .build()
16376/// # );
16377/// # let mut hub = CloudIdentity::new(client, auth);
16378/// // As the method needs a request, you would usually fill it with the desired information
16379/// // into the respective structure. Some of the parts shown here might not be applicable !
16380/// // Values shown here are possibly random and not representative !
16381/// let mut req = Group::default();
16382///
16383/// // You can configure optional parameters by calling the respective setters at will, and
16384/// // execute the final call using `doit()`.
16385/// // Values shown here are possibly random and not representative !
16386/// let result = hub.groups().patch(req, "name")
16387///              .update_mask(FieldMask::new::<&str>(&[]))
16388///              .doit().await;
16389/// # }
16390/// ```
16391pub struct GroupPatchCall<'a, C>
16392where
16393    C: 'a,
16394{
16395    hub: &'a CloudIdentity<C>,
16396    _request: Group,
16397    _name: String,
16398    _update_mask: Option<common::FieldMask>,
16399    _delegate: Option<&'a mut dyn common::Delegate>,
16400    _additional_params: HashMap<String, String>,
16401    _scopes: BTreeSet<String>,
16402}
16403
16404impl<'a, C> common::CallBuilder for GroupPatchCall<'a, C> {}
16405
16406impl<'a, C> GroupPatchCall<'a, C>
16407where
16408    C: common::Connector,
16409{
16410    /// Perform the operation you have build so far.
16411    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
16412        use std::borrow::Cow;
16413        use std::io::{Read, Seek};
16414
16415        use common::{url::Params, ToParts};
16416        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
16417
16418        let mut dd = common::DefaultDelegate;
16419        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
16420        dlg.begin(common::MethodInfo {
16421            id: "cloudidentity.groups.patch",
16422            http_method: hyper::Method::PATCH,
16423        });
16424
16425        for &field in ["alt", "name", "updateMask"].iter() {
16426            if self._additional_params.contains_key(field) {
16427                dlg.finished(false);
16428                return Err(common::Error::FieldClash(field));
16429            }
16430        }
16431
16432        let mut params = Params::with_capacity(5 + self._additional_params.len());
16433        params.push("name", self._name);
16434        if let Some(value) = self._update_mask.as_ref() {
16435            params.push("updateMask", value.to_string());
16436        }
16437
16438        params.extend(self._additional_params.iter());
16439
16440        params.push("alt", "json");
16441        let mut url = self.hub._base_url.clone() + "v1/{+name}";
16442        if self._scopes.is_empty() {
16443            self._scopes
16444                .insert(Scope::CloudPlatform.as_ref().to_string());
16445        }
16446
16447        #[allow(clippy::single_element_loop)]
16448        for &(find_this, param_name) in [("{+name}", "name")].iter() {
16449            url = params.uri_replacement(url, param_name, find_this, true);
16450        }
16451        {
16452            let to_remove = ["name"];
16453            params.remove_params(&to_remove);
16454        }
16455
16456        let url = params.parse_with_url(&url);
16457
16458        let mut json_mime_type = mime::APPLICATION_JSON;
16459        let mut request_value_reader = {
16460            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
16461            common::remove_json_null_values(&mut value);
16462            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
16463            serde_json::to_writer(&mut dst, &value).unwrap();
16464            dst
16465        };
16466        let request_size = request_value_reader
16467            .seek(std::io::SeekFrom::End(0))
16468            .unwrap();
16469        request_value_reader
16470            .seek(std::io::SeekFrom::Start(0))
16471            .unwrap();
16472
16473        loop {
16474            let token = match self
16475                .hub
16476                .auth
16477                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
16478                .await
16479            {
16480                Ok(token) => token,
16481                Err(e) => match dlg.token(e) {
16482                    Ok(token) => token,
16483                    Err(e) => {
16484                        dlg.finished(false);
16485                        return Err(common::Error::MissingToken(e));
16486                    }
16487                },
16488            };
16489            request_value_reader
16490                .seek(std::io::SeekFrom::Start(0))
16491                .unwrap();
16492            let mut req_result = {
16493                let client = &self.hub.client;
16494                dlg.pre_request();
16495                let mut req_builder = hyper::Request::builder()
16496                    .method(hyper::Method::PATCH)
16497                    .uri(url.as_str())
16498                    .header(USER_AGENT, self.hub._user_agent.clone());
16499
16500                if let Some(token) = token.as_ref() {
16501                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
16502                }
16503
16504                let request = req_builder
16505                    .header(CONTENT_TYPE, json_mime_type.to_string())
16506                    .header(CONTENT_LENGTH, request_size as u64)
16507                    .body(common::to_body(
16508                        request_value_reader.get_ref().clone().into(),
16509                    ));
16510
16511                client.request(request.unwrap()).await
16512            };
16513
16514            match req_result {
16515                Err(err) => {
16516                    if let common::Retry::After(d) = dlg.http_error(&err) {
16517                        sleep(d).await;
16518                        continue;
16519                    }
16520                    dlg.finished(false);
16521                    return Err(common::Error::HttpError(err));
16522                }
16523                Ok(res) => {
16524                    let (mut parts, body) = res.into_parts();
16525                    let mut body = common::Body::new(body);
16526                    if !parts.status.is_success() {
16527                        let bytes = common::to_bytes(body).await.unwrap_or_default();
16528                        let error = serde_json::from_str(&common::to_string(&bytes));
16529                        let response = common::to_response(parts, bytes.into());
16530
16531                        if let common::Retry::After(d) =
16532                            dlg.http_failure(&response, error.as_ref().ok())
16533                        {
16534                            sleep(d).await;
16535                            continue;
16536                        }
16537
16538                        dlg.finished(false);
16539
16540                        return Err(match error {
16541                            Ok(value) => common::Error::BadRequest(value),
16542                            _ => common::Error::Failure(response),
16543                        });
16544                    }
16545                    let response = {
16546                        let bytes = common::to_bytes(body).await.unwrap_or_default();
16547                        let encoded = common::to_string(&bytes);
16548                        match serde_json::from_str(&encoded) {
16549                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
16550                            Err(error) => {
16551                                dlg.response_json_decode_error(&encoded, &error);
16552                                return Err(common::Error::JsonDecodeError(
16553                                    encoded.to_string(),
16554                                    error,
16555                                ));
16556                            }
16557                        }
16558                    };
16559
16560                    dlg.finished(true);
16561                    return Ok(response);
16562                }
16563            }
16564        }
16565    }
16566
16567    ///
16568    /// Sets the *request* 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 request(mut self, new_value: Group) -> GroupPatchCall<'a, C> {
16573        self._request = new_value;
16574        self
16575    }
16576    /// Output only. The [resource name](https://cloud.google.com/apis/design/resource_names) of the `Group`. Shall be of the form `groups/{group}`.
16577    ///
16578    /// Sets the *name* path property to the given value.
16579    ///
16580    /// Even though the property as already been set when instantiating this call,
16581    /// we provide this method for API completeness.
16582    pub fn name(mut self, new_value: &str) -> GroupPatchCall<'a, C> {
16583        self._name = new_value.to_string();
16584        self
16585    }
16586    /// Required. The names of fields to update. May only contain the following field names: `display_name`, `description`, `labels`.
16587    ///
16588    /// Sets the *update mask* query property to the given value.
16589    pub fn update_mask(mut self, new_value: common::FieldMask) -> GroupPatchCall<'a, C> {
16590        self._update_mask = Some(new_value);
16591        self
16592    }
16593    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
16594    /// while executing the actual API request.
16595    ///
16596    /// ````text
16597    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
16598    /// ````
16599    ///
16600    /// Sets the *delegate* property to the given value.
16601    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> GroupPatchCall<'a, C> {
16602        self._delegate = Some(new_value);
16603        self
16604    }
16605
16606    /// Set any additional parameter of the query string used in the request.
16607    /// It should be used to set parameters which are not yet available through their own
16608    /// setters.
16609    ///
16610    /// Please note that this method must not be used to set any of the known parameters
16611    /// which have their own setter method. If done anyway, the request will fail.
16612    ///
16613    /// # Additional Parameters
16614    ///
16615    /// * *$.xgafv* (query-string) - V1 error format.
16616    /// * *access_token* (query-string) - OAuth access token.
16617    /// * *alt* (query-string) - Data format for response.
16618    /// * *callback* (query-string) - JSONP
16619    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
16620    /// * *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.
16621    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
16622    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
16623    /// * *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.
16624    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
16625    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
16626    pub fn param<T>(mut self, name: T, value: T) -> GroupPatchCall<'a, C>
16627    where
16628        T: AsRef<str>,
16629    {
16630        self._additional_params
16631            .insert(name.as_ref().to_string(), value.as_ref().to_string());
16632        self
16633    }
16634
16635    /// Identifies the authorization scope for the method you are building.
16636    ///
16637    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
16638    /// [`Scope::CloudPlatform`].
16639    ///
16640    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
16641    /// tokens for more than one scope.
16642    ///
16643    /// Usually there is more than one suitable scope to authorize an operation, some of which may
16644    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
16645    /// sufficient, a read-write scope will do as well.
16646    pub fn add_scope<St>(mut self, scope: St) -> GroupPatchCall<'a, C>
16647    where
16648        St: AsRef<str>,
16649    {
16650        self._scopes.insert(String::from(scope.as_ref()));
16651        self
16652    }
16653    /// Identifies the authorization scope(s) for the method you are building.
16654    ///
16655    /// See [`Self::add_scope()`] for details.
16656    pub fn add_scopes<I, St>(mut self, scopes: I) -> GroupPatchCall<'a, C>
16657    where
16658        I: IntoIterator<Item = St>,
16659        St: AsRef<str>,
16660    {
16661        self._scopes
16662            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
16663        self
16664    }
16665
16666    /// Removes all scopes, and no default scope will be used either.
16667    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
16668    /// for details).
16669    pub fn clear_scopes(mut self) -> GroupPatchCall<'a, C> {
16670        self._scopes.clear();
16671        self
16672    }
16673}
16674
16675/// Searches for `Group` resources matching a specified query.
16676///
16677/// A builder for the *search* method supported by a *group* resource.
16678/// It is not used directly, but through a [`GroupMethods`] instance.
16679///
16680/// # Example
16681///
16682/// Instantiate a resource method builder
16683///
16684/// ```test_harness,no_run
16685/// # extern crate hyper;
16686/// # extern crate hyper_rustls;
16687/// # extern crate google_cloudidentity1 as cloudidentity1;
16688/// # async fn dox() {
16689/// # use cloudidentity1::{CloudIdentity, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
16690///
16691/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
16692/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
16693/// #     .with_native_roots()
16694/// #     .unwrap()
16695/// #     .https_only()
16696/// #     .enable_http2()
16697/// #     .build();
16698///
16699/// # let executor = hyper_util::rt::TokioExecutor::new();
16700/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
16701/// #     secret,
16702/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
16703/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
16704/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
16705/// #     ),
16706/// # ).build().await.unwrap();
16707///
16708/// # let client = hyper_util::client::legacy::Client::builder(
16709/// #     hyper_util::rt::TokioExecutor::new()
16710/// # )
16711/// # .build(
16712/// #     hyper_rustls::HttpsConnectorBuilder::new()
16713/// #         .with_native_roots()
16714/// #         .unwrap()
16715/// #         .https_or_http()
16716/// #         .enable_http2()
16717/// #         .build()
16718/// # );
16719/// # let mut hub = CloudIdentity::new(client, auth);
16720/// // You can configure optional parameters by calling the respective setters at will, and
16721/// // execute the final call using `doit()`.
16722/// // Values shown here are possibly random and not representative !
16723/// let result = hub.groups().search()
16724///              .view("Lorem")
16725///              .query("invidunt")
16726///              .page_token("no")
16727///              .page_size(-7)
16728///              .doit().await;
16729/// # }
16730/// ```
16731pub struct GroupSearchCall<'a, C>
16732where
16733    C: 'a,
16734{
16735    hub: &'a CloudIdentity<C>,
16736    _view: Option<String>,
16737    _query: Option<String>,
16738    _page_token: Option<String>,
16739    _page_size: Option<i32>,
16740    _delegate: Option<&'a mut dyn common::Delegate>,
16741    _additional_params: HashMap<String, String>,
16742    _scopes: BTreeSet<String>,
16743}
16744
16745impl<'a, C> common::CallBuilder for GroupSearchCall<'a, C> {}
16746
16747impl<'a, C> GroupSearchCall<'a, C>
16748where
16749    C: common::Connector,
16750{
16751    /// Perform the operation you have build so far.
16752    pub async fn doit(mut self) -> common::Result<(common::Response, SearchGroupsResponse)> {
16753        use std::borrow::Cow;
16754        use std::io::{Read, Seek};
16755
16756        use common::{url::Params, ToParts};
16757        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
16758
16759        let mut dd = common::DefaultDelegate;
16760        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
16761        dlg.begin(common::MethodInfo {
16762            id: "cloudidentity.groups.search",
16763            http_method: hyper::Method::GET,
16764        });
16765
16766        for &field in ["alt", "view", "query", "pageToken", "pageSize"].iter() {
16767            if self._additional_params.contains_key(field) {
16768                dlg.finished(false);
16769                return Err(common::Error::FieldClash(field));
16770            }
16771        }
16772
16773        let mut params = Params::with_capacity(6 + self._additional_params.len());
16774        if let Some(value) = self._view.as_ref() {
16775            params.push("view", value);
16776        }
16777        if let Some(value) = self._query.as_ref() {
16778            params.push("query", value);
16779        }
16780        if let Some(value) = self._page_token.as_ref() {
16781            params.push("pageToken", value);
16782        }
16783        if let Some(value) = self._page_size.as_ref() {
16784            params.push("pageSize", value.to_string());
16785        }
16786
16787        params.extend(self._additional_params.iter());
16788
16789        params.push("alt", "json");
16790        let mut url = self.hub._base_url.clone() + "v1/groups:search";
16791        if self._scopes.is_empty() {
16792            self._scopes
16793                .insert(Scope::CloudIdentityGroupReadonly.as_ref().to_string());
16794        }
16795
16796        let url = params.parse_with_url(&url);
16797
16798        loop {
16799            let token = match self
16800                .hub
16801                .auth
16802                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
16803                .await
16804            {
16805                Ok(token) => token,
16806                Err(e) => match dlg.token(e) {
16807                    Ok(token) => token,
16808                    Err(e) => {
16809                        dlg.finished(false);
16810                        return Err(common::Error::MissingToken(e));
16811                    }
16812                },
16813            };
16814            let mut req_result = {
16815                let client = &self.hub.client;
16816                dlg.pre_request();
16817                let mut req_builder = hyper::Request::builder()
16818                    .method(hyper::Method::GET)
16819                    .uri(url.as_str())
16820                    .header(USER_AGENT, self.hub._user_agent.clone());
16821
16822                if let Some(token) = token.as_ref() {
16823                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
16824                }
16825
16826                let request = req_builder
16827                    .header(CONTENT_LENGTH, 0_u64)
16828                    .body(common::to_body::<String>(None));
16829
16830                client.request(request.unwrap()).await
16831            };
16832
16833            match req_result {
16834                Err(err) => {
16835                    if let common::Retry::After(d) = dlg.http_error(&err) {
16836                        sleep(d).await;
16837                        continue;
16838                    }
16839                    dlg.finished(false);
16840                    return Err(common::Error::HttpError(err));
16841                }
16842                Ok(res) => {
16843                    let (mut parts, body) = res.into_parts();
16844                    let mut body = common::Body::new(body);
16845                    if !parts.status.is_success() {
16846                        let bytes = common::to_bytes(body).await.unwrap_or_default();
16847                        let error = serde_json::from_str(&common::to_string(&bytes));
16848                        let response = common::to_response(parts, bytes.into());
16849
16850                        if let common::Retry::After(d) =
16851                            dlg.http_failure(&response, error.as_ref().ok())
16852                        {
16853                            sleep(d).await;
16854                            continue;
16855                        }
16856
16857                        dlg.finished(false);
16858
16859                        return Err(match error {
16860                            Ok(value) => common::Error::BadRequest(value),
16861                            _ => common::Error::Failure(response),
16862                        });
16863                    }
16864                    let response = {
16865                        let bytes = common::to_bytes(body).await.unwrap_or_default();
16866                        let encoded = common::to_string(&bytes);
16867                        match serde_json::from_str(&encoded) {
16868                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
16869                            Err(error) => {
16870                                dlg.response_json_decode_error(&encoded, &error);
16871                                return Err(common::Error::JsonDecodeError(
16872                                    encoded.to_string(),
16873                                    error,
16874                                ));
16875                            }
16876                        }
16877                    };
16878
16879                    dlg.finished(true);
16880                    return Ok(response);
16881                }
16882            }
16883        }
16884    }
16885
16886    /// The level of detail to be returned. If unspecified, defaults to `View.BASIC`.
16887    ///
16888    /// Sets the *view* query property to the given value.
16889    pub fn view(mut self, new_value: &str) -> GroupSearchCall<'a, C> {
16890        self._view = Some(new_value.to_string());
16891        self
16892    }
16893    /// Required. The search query. * Must be specified in [Common Expression Language](https://opensource.google/projects/cel). * Must contain equality operators on the parent, e.g. `parent == 'customers/{customer_id}'`. The `customer_id` must begin with "C" (for example, 'C046psxkn'). [Find your customer ID.] (https://support.google.com/cloudidentity/answer/10070793) * Can contain optional inclusion operators on `labels` such as `'cloudidentity.googleapis.com/groups.discussion_forum' in labels`). * Can contain an optional equality operator on `domain_name`. e.g. `domain_name == 'examplepetstore.com'` * Can contain optional `startsWith/contains/equality` operators on `group_key`, e.g. `group_key.startsWith('dev')`, `group_key.contains('dev'), group_key == 'dev@examplepetstore.com'` * Can contain optional `startsWith/contains/equality` operators on `display_name`, such as `display_name.startsWith('dev')` , `display_name.contains('dev')`, `display_name == 'dev'`
16894    ///
16895    /// Sets the *query* query property to the given value.
16896    pub fn query(mut self, new_value: &str) -> GroupSearchCall<'a, C> {
16897        self._query = Some(new_value.to_string());
16898        self
16899    }
16900    /// The `next_page_token` value returned from a previous search request, if any.
16901    ///
16902    /// Sets the *page token* query property to the given value.
16903    pub fn page_token(mut self, new_value: &str) -> GroupSearchCall<'a, C> {
16904        self._page_token = Some(new_value.to_string());
16905        self
16906    }
16907    /// The maximum number of results to return. Note that the number of results returned may be less than this value even if there are more available results. To fetch all results, clients must continue calling this method repeatedly until the response no longer contains a `next_page_token`. If unspecified, defaults to 200 for `GroupView.BASIC` and 50 for `GroupView.FULL`. Must not be greater than 1000 for `GroupView.BASIC` or 500 for `GroupView.FULL`.
16908    ///
16909    /// Sets the *page size* query property to the given value.
16910    pub fn page_size(mut self, new_value: i32) -> GroupSearchCall<'a, C> {
16911        self._page_size = Some(new_value);
16912        self
16913    }
16914    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
16915    /// while executing the actual API request.
16916    ///
16917    /// ````text
16918    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
16919    /// ````
16920    ///
16921    /// Sets the *delegate* property to the given value.
16922    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> GroupSearchCall<'a, C> {
16923        self._delegate = Some(new_value);
16924        self
16925    }
16926
16927    /// Set any additional parameter of the query string used in the request.
16928    /// It should be used to set parameters which are not yet available through their own
16929    /// setters.
16930    ///
16931    /// Please note that this method must not be used to set any of the known parameters
16932    /// which have their own setter method. If done anyway, the request will fail.
16933    ///
16934    /// # Additional Parameters
16935    ///
16936    /// * *$.xgafv* (query-string) - V1 error format.
16937    /// * *access_token* (query-string) - OAuth access token.
16938    /// * *alt* (query-string) - Data format for response.
16939    /// * *callback* (query-string) - JSONP
16940    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
16941    /// * *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.
16942    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
16943    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
16944    /// * *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.
16945    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
16946    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
16947    pub fn param<T>(mut self, name: T, value: T) -> GroupSearchCall<'a, C>
16948    where
16949        T: AsRef<str>,
16950    {
16951        self._additional_params
16952            .insert(name.as_ref().to_string(), value.as_ref().to_string());
16953        self
16954    }
16955
16956    /// Identifies the authorization scope for the method you are building.
16957    ///
16958    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
16959    /// [`Scope::CloudIdentityGroupReadonly`].
16960    ///
16961    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
16962    /// tokens for more than one scope.
16963    ///
16964    /// Usually there is more than one suitable scope to authorize an operation, some of which may
16965    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
16966    /// sufficient, a read-write scope will do as well.
16967    pub fn add_scope<St>(mut self, scope: St) -> GroupSearchCall<'a, C>
16968    where
16969        St: AsRef<str>,
16970    {
16971        self._scopes.insert(String::from(scope.as_ref()));
16972        self
16973    }
16974    /// Identifies the authorization scope(s) for the method you are building.
16975    ///
16976    /// See [`Self::add_scope()`] for details.
16977    pub fn add_scopes<I, St>(mut self, scopes: I) -> GroupSearchCall<'a, C>
16978    where
16979        I: IntoIterator<Item = St>,
16980        St: AsRef<str>,
16981    {
16982        self._scopes
16983            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
16984        self
16985    }
16986
16987    /// Removes all scopes, and no default scope will be used either.
16988    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
16989    /// for details).
16990    pub fn clear_scopes(mut self) -> GroupSearchCall<'a, C> {
16991        self._scopes.clear();
16992        self
16993    }
16994}
16995
16996/// Update Security Settings
16997///
16998/// A builder for the *updateSecuritySettings* method supported by a *group* resource.
16999/// It is not used directly, but through a [`GroupMethods`] instance.
17000///
17001/// # Example
17002///
17003/// Instantiate a resource method builder
17004///
17005/// ```test_harness,no_run
17006/// # extern crate hyper;
17007/// # extern crate hyper_rustls;
17008/// # extern crate google_cloudidentity1 as cloudidentity1;
17009/// use cloudidentity1::api::SecuritySettings;
17010/// # async fn dox() {
17011/// # use cloudidentity1::{CloudIdentity, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
17012///
17013/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
17014/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
17015/// #     .with_native_roots()
17016/// #     .unwrap()
17017/// #     .https_only()
17018/// #     .enable_http2()
17019/// #     .build();
17020///
17021/// # let executor = hyper_util::rt::TokioExecutor::new();
17022/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
17023/// #     secret,
17024/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
17025/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
17026/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
17027/// #     ),
17028/// # ).build().await.unwrap();
17029///
17030/// # let client = hyper_util::client::legacy::Client::builder(
17031/// #     hyper_util::rt::TokioExecutor::new()
17032/// # )
17033/// # .build(
17034/// #     hyper_rustls::HttpsConnectorBuilder::new()
17035/// #         .with_native_roots()
17036/// #         .unwrap()
17037/// #         .https_or_http()
17038/// #         .enable_http2()
17039/// #         .build()
17040/// # );
17041/// # let mut hub = CloudIdentity::new(client, auth);
17042/// // As the method needs a request, you would usually fill it with the desired information
17043/// // into the respective structure. Some of the parts shown here might not be applicable !
17044/// // Values shown here are possibly random and not representative !
17045/// let mut req = SecuritySettings::default();
17046///
17047/// // You can configure optional parameters by calling the respective setters at will, and
17048/// // execute the final call using `doit()`.
17049/// // Values shown here are possibly random and not representative !
17050/// let result = hub.groups().update_security_settings(req, "name")
17051///              .update_mask(FieldMask::new::<&str>(&[]))
17052///              .doit().await;
17053/// # }
17054/// ```
17055pub struct GroupUpdateSecuritySettingCall<'a, C>
17056where
17057    C: 'a,
17058{
17059    hub: &'a CloudIdentity<C>,
17060    _request: SecuritySettings,
17061    _name: String,
17062    _update_mask: Option<common::FieldMask>,
17063    _delegate: Option<&'a mut dyn common::Delegate>,
17064    _additional_params: HashMap<String, String>,
17065    _scopes: BTreeSet<String>,
17066}
17067
17068impl<'a, C> common::CallBuilder for GroupUpdateSecuritySettingCall<'a, C> {}
17069
17070impl<'a, C> GroupUpdateSecuritySettingCall<'a, C>
17071where
17072    C: common::Connector,
17073{
17074    /// Perform the operation you have build so far.
17075    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
17076        use std::borrow::Cow;
17077        use std::io::{Read, Seek};
17078
17079        use common::{url::Params, ToParts};
17080        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
17081
17082        let mut dd = common::DefaultDelegate;
17083        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
17084        dlg.begin(common::MethodInfo {
17085            id: "cloudidentity.groups.updateSecuritySettings",
17086            http_method: hyper::Method::PATCH,
17087        });
17088
17089        for &field in ["alt", "name", "updateMask"].iter() {
17090            if self._additional_params.contains_key(field) {
17091                dlg.finished(false);
17092                return Err(common::Error::FieldClash(field));
17093            }
17094        }
17095
17096        let mut params = Params::with_capacity(5 + self._additional_params.len());
17097        params.push("name", self._name);
17098        if let Some(value) = self._update_mask.as_ref() {
17099            params.push("updateMask", value.to_string());
17100        }
17101
17102        params.extend(self._additional_params.iter());
17103
17104        params.push("alt", "json");
17105        let mut url = self.hub._base_url.clone() + "v1/{+name}";
17106        if self._scopes.is_empty() {
17107            self._scopes
17108                .insert(Scope::CloudPlatform.as_ref().to_string());
17109        }
17110
17111        #[allow(clippy::single_element_loop)]
17112        for &(find_this, param_name) in [("{+name}", "name")].iter() {
17113            url = params.uri_replacement(url, param_name, find_this, true);
17114        }
17115        {
17116            let to_remove = ["name"];
17117            params.remove_params(&to_remove);
17118        }
17119
17120        let url = params.parse_with_url(&url);
17121
17122        let mut json_mime_type = mime::APPLICATION_JSON;
17123        let mut request_value_reader = {
17124            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
17125            common::remove_json_null_values(&mut value);
17126            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
17127            serde_json::to_writer(&mut dst, &value).unwrap();
17128            dst
17129        };
17130        let request_size = request_value_reader
17131            .seek(std::io::SeekFrom::End(0))
17132            .unwrap();
17133        request_value_reader
17134            .seek(std::io::SeekFrom::Start(0))
17135            .unwrap();
17136
17137        loop {
17138            let token = match self
17139                .hub
17140                .auth
17141                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
17142                .await
17143            {
17144                Ok(token) => token,
17145                Err(e) => match dlg.token(e) {
17146                    Ok(token) => token,
17147                    Err(e) => {
17148                        dlg.finished(false);
17149                        return Err(common::Error::MissingToken(e));
17150                    }
17151                },
17152            };
17153            request_value_reader
17154                .seek(std::io::SeekFrom::Start(0))
17155                .unwrap();
17156            let mut req_result = {
17157                let client = &self.hub.client;
17158                dlg.pre_request();
17159                let mut req_builder = hyper::Request::builder()
17160                    .method(hyper::Method::PATCH)
17161                    .uri(url.as_str())
17162                    .header(USER_AGENT, self.hub._user_agent.clone());
17163
17164                if let Some(token) = token.as_ref() {
17165                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
17166                }
17167
17168                let request = req_builder
17169                    .header(CONTENT_TYPE, json_mime_type.to_string())
17170                    .header(CONTENT_LENGTH, request_size as u64)
17171                    .body(common::to_body(
17172                        request_value_reader.get_ref().clone().into(),
17173                    ));
17174
17175                client.request(request.unwrap()).await
17176            };
17177
17178            match req_result {
17179                Err(err) => {
17180                    if let common::Retry::After(d) = dlg.http_error(&err) {
17181                        sleep(d).await;
17182                        continue;
17183                    }
17184                    dlg.finished(false);
17185                    return Err(common::Error::HttpError(err));
17186                }
17187                Ok(res) => {
17188                    let (mut parts, body) = res.into_parts();
17189                    let mut body = common::Body::new(body);
17190                    if !parts.status.is_success() {
17191                        let bytes = common::to_bytes(body).await.unwrap_or_default();
17192                        let error = serde_json::from_str(&common::to_string(&bytes));
17193                        let response = common::to_response(parts, bytes.into());
17194
17195                        if let common::Retry::After(d) =
17196                            dlg.http_failure(&response, error.as_ref().ok())
17197                        {
17198                            sleep(d).await;
17199                            continue;
17200                        }
17201
17202                        dlg.finished(false);
17203
17204                        return Err(match error {
17205                            Ok(value) => common::Error::BadRequest(value),
17206                            _ => common::Error::Failure(response),
17207                        });
17208                    }
17209                    let response = {
17210                        let bytes = common::to_bytes(body).await.unwrap_or_default();
17211                        let encoded = common::to_string(&bytes);
17212                        match serde_json::from_str(&encoded) {
17213                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
17214                            Err(error) => {
17215                                dlg.response_json_decode_error(&encoded, &error);
17216                                return Err(common::Error::JsonDecodeError(
17217                                    encoded.to_string(),
17218                                    error,
17219                                ));
17220                            }
17221                        }
17222                    };
17223
17224                    dlg.finished(true);
17225                    return Ok(response);
17226                }
17227            }
17228        }
17229    }
17230
17231    ///
17232    /// Sets the *request* property to the given value.
17233    ///
17234    /// Even though the property as already been set when instantiating this call,
17235    /// we provide this method for API completeness.
17236    pub fn request(mut self, new_value: SecuritySettings) -> GroupUpdateSecuritySettingCall<'a, C> {
17237        self._request = new_value;
17238        self
17239    }
17240    /// Output only. The resource name of the security settings. Shall be of the form `groups/{group_id}/securitySettings`.
17241    ///
17242    /// Sets the *name* path property to the given value.
17243    ///
17244    /// Even though the property as already been set when instantiating this call,
17245    /// we provide this method for API completeness.
17246    pub fn name(mut self, new_value: &str) -> GroupUpdateSecuritySettingCall<'a, C> {
17247        self._name = new_value.to_string();
17248        self
17249    }
17250    /// Required. The fully-qualified names of fields to update. May only contain the following field: `member_restriction.query`.
17251    ///
17252    /// Sets the *update mask* query property to the given value.
17253    pub fn update_mask(
17254        mut self,
17255        new_value: common::FieldMask,
17256    ) -> GroupUpdateSecuritySettingCall<'a, C> {
17257        self._update_mask = Some(new_value);
17258        self
17259    }
17260    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
17261    /// while executing the actual API request.
17262    ///
17263    /// ````text
17264    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
17265    /// ````
17266    ///
17267    /// Sets the *delegate* property to the given value.
17268    pub fn delegate(
17269        mut self,
17270        new_value: &'a mut dyn common::Delegate,
17271    ) -> GroupUpdateSecuritySettingCall<'a, C> {
17272        self._delegate = Some(new_value);
17273        self
17274    }
17275
17276    /// Set any additional parameter of the query string used in the request.
17277    /// It should be used to set parameters which are not yet available through their own
17278    /// setters.
17279    ///
17280    /// Please note that this method must not be used to set any of the known parameters
17281    /// which have their own setter method. If done anyway, the request will fail.
17282    ///
17283    /// # Additional Parameters
17284    ///
17285    /// * *$.xgafv* (query-string) - V1 error format.
17286    /// * *access_token* (query-string) - OAuth access token.
17287    /// * *alt* (query-string) - Data format for response.
17288    /// * *callback* (query-string) - JSONP
17289    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
17290    /// * *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.
17291    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
17292    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
17293    /// * *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.
17294    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
17295    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
17296    pub fn param<T>(mut self, name: T, value: T) -> GroupUpdateSecuritySettingCall<'a, C>
17297    where
17298        T: AsRef<str>,
17299    {
17300        self._additional_params
17301            .insert(name.as_ref().to_string(), value.as_ref().to_string());
17302        self
17303    }
17304
17305    /// Identifies the authorization scope for the method you are building.
17306    ///
17307    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
17308    /// [`Scope::CloudPlatform`].
17309    ///
17310    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
17311    /// tokens for more than one scope.
17312    ///
17313    /// Usually there is more than one suitable scope to authorize an operation, some of which may
17314    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
17315    /// sufficient, a read-write scope will do as well.
17316    pub fn add_scope<St>(mut self, scope: St) -> GroupUpdateSecuritySettingCall<'a, C>
17317    where
17318        St: AsRef<str>,
17319    {
17320        self._scopes.insert(String::from(scope.as_ref()));
17321        self
17322    }
17323    /// Identifies the authorization scope(s) for the method you are building.
17324    ///
17325    /// See [`Self::add_scope()`] for details.
17326    pub fn add_scopes<I, St>(mut self, scopes: I) -> GroupUpdateSecuritySettingCall<'a, C>
17327    where
17328        I: IntoIterator<Item = St>,
17329        St: AsRef<str>,
17330    {
17331        self._scopes
17332            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
17333        self
17334    }
17335
17336    /// Removes all scopes, and no default scope will be used either.
17337    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
17338    /// for details).
17339    pub fn clear_scopes(mut self) -> GroupUpdateSecuritySettingCall<'a, C> {
17340        self._scopes.clear();
17341        self
17342    }
17343}
17344
17345/// Creates an InboundOidcSsoProfile for a customer. When the target customer has enabled [Multi-party approval for sensitive actions](https://support.google.com/a/answer/13790448), the `Operation` in the response will have `"done": false`, it will not have a response, and the metadata will have `"state": "awaiting-multi-party-approval"`.
17346///
17347/// A builder for the *create* method supported by a *inboundOidcSsoProfile* resource.
17348/// It is not used directly, but through a [`InboundOidcSsoProfileMethods`] instance.
17349///
17350/// # Example
17351///
17352/// Instantiate a resource method builder
17353///
17354/// ```test_harness,no_run
17355/// # extern crate hyper;
17356/// # extern crate hyper_rustls;
17357/// # extern crate google_cloudidentity1 as cloudidentity1;
17358/// use cloudidentity1::api::InboundOidcSsoProfile;
17359/// # async fn dox() {
17360/// # use cloudidentity1::{CloudIdentity, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
17361///
17362/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
17363/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
17364/// #     .with_native_roots()
17365/// #     .unwrap()
17366/// #     .https_only()
17367/// #     .enable_http2()
17368/// #     .build();
17369///
17370/// # let executor = hyper_util::rt::TokioExecutor::new();
17371/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
17372/// #     secret,
17373/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
17374/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
17375/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
17376/// #     ),
17377/// # ).build().await.unwrap();
17378///
17379/// # let client = hyper_util::client::legacy::Client::builder(
17380/// #     hyper_util::rt::TokioExecutor::new()
17381/// # )
17382/// # .build(
17383/// #     hyper_rustls::HttpsConnectorBuilder::new()
17384/// #         .with_native_roots()
17385/// #         .unwrap()
17386/// #         .https_or_http()
17387/// #         .enable_http2()
17388/// #         .build()
17389/// # );
17390/// # let mut hub = CloudIdentity::new(client, auth);
17391/// // As the method needs a request, you would usually fill it with the desired information
17392/// // into the respective structure. Some of the parts shown here might not be applicable !
17393/// // Values shown here are possibly random and not representative !
17394/// let mut req = InboundOidcSsoProfile::default();
17395///
17396/// // You can configure optional parameters by calling the respective setters at will, and
17397/// // execute the final call using `doit()`.
17398/// // Values shown here are possibly random and not representative !
17399/// let result = hub.inbound_oidc_sso_profiles().create(req)
17400///              .doit().await;
17401/// # }
17402/// ```
17403pub struct InboundOidcSsoProfileCreateCall<'a, C>
17404where
17405    C: 'a,
17406{
17407    hub: &'a CloudIdentity<C>,
17408    _request: InboundOidcSsoProfile,
17409    _delegate: Option<&'a mut dyn common::Delegate>,
17410    _additional_params: HashMap<String, String>,
17411    _scopes: BTreeSet<String>,
17412}
17413
17414impl<'a, C> common::CallBuilder for InboundOidcSsoProfileCreateCall<'a, C> {}
17415
17416impl<'a, C> InboundOidcSsoProfileCreateCall<'a, C>
17417where
17418    C: common::Connector,
17419{
17420    /// Perform the operation you have build so far.
17421    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
17422        use std::borrow::Cow;
17423        use std::io::{Read, Seek};
17424
17425        use common::{url::Params, ToParts};
17426        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
17427
17428        let mut dd = common::DefaultDelegate;
17429        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
17430        dlg.begin(common::MethodInfo {
17431            id: "cloudidentity.inboundOidcSsoProfiles.create",
17432            http_method: hyper::Method::POST,
17433        });
17434
17435        for &field in ["alt"].iter() {
17436            if self._additional_params.contains_key(field) {
17437                dlg.finished(false);
17438                return Err(common::Error::FieldClash(field));
17439            }
17440        }
17441
17442        let mut params = Params::with_capacity(3 + self._additional_params.len());
17443
17444        params.extend(self._additional_params.iter());
17445
17446        params.push("alt", "json");
17447        let mut url = self.hub._base_url.clone() + "v1/inboundOidcSsoProfiles";
17448        if self._scopes.is_empty() {
17449            self._scopes
17450                .insert(Scope::CloudPlatform.as_ref().to_string());
17451        }
17452
17453        let url = params.parse_with_url(&url);
17454
17455        let mut json_mime_type = mime::APPLICATION_JSON;
17456        let mut request_value_reader = {
17457            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
17458            common::remove_json_null_values(&mut value);
17459            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
17460            serde_json::to_writer(&mut dst, &value).unwrap();
17461            dst
17462        };
17463        let request_size = request_value_reader
17464            .seek(std::io::SeekFrom::End(0))
17465            .unwrap();
17466        request_value_reader
17467            .seek(std::io::SeekFrom::Start(0))
17468            .unwrap();
17469
17470        loop {
17471            let token = match self
17472                .hub
17473                .auth
17474                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
17475                .await
17476            {
17477                Ok(token) => token,
17478                Err(e) => match dlg.token(e) {
17479                    Ok(token) => token,
17480                    Err(e) => {
17481                        dlg.finished(false);
17482                        return Err(common::Error::MissingToken(e));
17483                    }
17484                },
17485            };
17486            request_value_reader
17487                .seek(std::io::SeekFrom::Start(0))
17488                .unwrap();
17489            let mut req_result = {
17490                let client = &self.hub.client;
17491                dlg.pre_request();
17492                let mut req_builder = hyper::Request::builder()
17493                    .method(hyper::Method::POST)
17494                    .uri(url.as_str())
17495                    .header(USER_AGENT, self.hub._user_agent.clone());
17496
17497                if let Some(token) = token.as_ref() {
17498                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
17499                }
17500
17501                let request = req_builder
17502                    .header(CONTENT_TYPE, json_mime_type.to_string())
17503                    .header(CONTENT_LENGTH, request_size as u64)
17504                    .body(common::to_body(
17505                        request_value_reader.get_ref().clone().into(),
17506                    ));
17507
17508                client.request(request.unwrap()).await
17509            };
17510
17511            match req_result {
17512                Err(err) => {
17513                    if let common::Retry::After(d) = dlg.http_error(&err) {
17514                        sleep(d).await;
17515                        continue;
17516                    }
17517                    dlg.finished(false);
17518                    return Err(common::Error::HttpError(err));
17519                }
17520                Ok(res) => {
17521                    let (mut parts, body) = res.into_parts();
17522                    let mut body = common::Body::new(body);
17523                    if !parts.status.is_success() {
17524                        let bytes = common::to_bytes(body).await.unwrap_or_default();
17525                        let error = serde_json::from_str(&common::to_string(&bytes));
17526                        let response = common::to_response(parts, bytes.into());
17527
17528                        if let common::Retry::After(d) =
17529                            dlg.http_failure(&response, error.as_ref().ok())
17530                        {
17531                            sleep(d).await;
17532                            continue;
17533                        }
17534
17535                        dlg.finished(false);
17536
17537                        return Err(match error {
17538                            Ok(value) => common::Error::BadRequest(value),
17539                            _ => common::Error::Failure(response),
17540                        });
17541                    }
17542                    let response = {
17543                        let bytes = common::to_bytes(body).await.unwrap_or_default();
17544                        let encoded = common::to_string(&bytes);
17545                        match serde_json::from_str(&encoded) {
17546                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
17547                            Err(error) => {
17548                                dlg.response_json_decode_error(&encoded, &error);
17549                                return Err(common::Error::JsonDecodeError(
17550                                    encoded.to_string(),
17551                                    error,
17552                                ));
17553                            }
17554                        }
17555                    };
17556
17557                    dlg.finished(true);
17558                    return Ok(response);
17559                }
17560            }
17561        }
17562    }
17563
17564    ///
17565    /// Sets the *request* property to the given value.
17566    ///
17567    /// Even though the property as already been set when instantiating this call,
17568    /// we provide this method for API completeness.
17569    pub fn request(
17570        mut self,
17571        new_value: InboundOidcSsoProfile,
17572    ) -> InboundOidcSsoProfileCreateCall<'a, C> {
17573        self._request = new_value;
17574        self
17575    }
17576    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
17577    /// while executing the actual API request.
17578    ///
17579    /// ````text
17580    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
17581    /// ````
17582    ///
17583    /// Sets the *delegate* property to the given value.
17584    pub fn delegate(
17585        mut self,
17586        new_value: &'a mut dyn common::Delegate,
17587    ) -> InboundOidcSsoProfileCreateCall<'a, C> {
17588        self._delegate = Some(new_value);
17589        self
17590    }
17591
17592    /// Set any additional parameter of the query string used in the request.
17593    /// It should be used to set parameters which are not yet available through their own
17594    /// setters.
17595    ///
17596    /// Please note that this method must not be used to set any of the known parameters
17597    /// which have their own setter method. If done anyway, the request will fail.
17598    ///
17599    /// # Additional Parameters
17600    ///
17601    /// * *$.xgafv* (query-string) - V1 error format.
17602    /// * *access_token* (query-string) - OAuth access token.
17603    /// * *alt* (query-string) - Data format for response.
17604    /// * *callback* (query-string) - JSONP
17605    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
17606    /// * *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.
17607    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
17608    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
17609    /// * *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.
17610    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
17611    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
17612    pub fn param<T>(mut self, name: T, value: T) -> InboundOidcSsoProfileCreateCall<'a, C>
17613    where
17614        T: AsRef<str>,
17615    {
17616        self._additional_params
17617            .insert(name.as_ref().to_string(), value.as_ref().to_string());
17618        self
17619    }
17620
17621    /// Identifies the authorization scope for the method you are building.
17622    ///
17623    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
17624    /// [`Scope::CloudPlatform`].
17625    ///
17626    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
17627    /// tokens for more than one scope.
17628    ///
17629    /// Usually there is more than one suitable scope to authorize an operation, some of which may
17630    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
17631    /// sufficient, a read-write scope will do as well.
17632    pub fn add_scope<St>(mut self, scope: St) -> InboundOidcSsoProfileCreateCall<'a, C>
17633    where
17634        St: AsRef<str>,
17635    {
17636        self._scopes.insert(String::from(scope.as_ref()));
17637        self
17638    }
17639    /// Identifies the authorization scope(s) for the method you are building.
17640    ///
17641    /// See [`Self::add_scope()`] for details.
17642    pub fn add_scopes<I, St>(mut self, scopes: I) -> InboundOidcSsoProfileCreateCall<'a, C>
17643    where
17644        I: IntoIterator<Item = St>,
17645        St: AsRef<str>,
17646    {
17647        self._scopes
17648            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
17649        self
17650    }
17651
17652    /// Removes all scopes, and no default scope will be used either.
17653    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
17654    /// for details).
17655    pub fn clear_scopes(mut self) -> InboundOidcSsoProfileCreateCall<'a, C> {
17656        self._scopes.clear();
17657        self
17658    }
17659}
17660
17661/// Deletes an InboundOidcSsoProfile.
17662///
17663/// A builder for the *delete* method supported by a *inboundOidcSsoProfile* resource.
17664/// It is not used directly, but through a [`InboundOidcSsoProfileMethods`] instance.
17665///
17666/// # Example
17667///
17668/// Instantiate a resource method builder
17669///
17670/// ```test_harness,no_run
17671/// # extern crate hyper;
17672/// # extern crate hyper_rustls;
17673/// # extern crate google_cloudidentity1 as cloudidentity1;
17674/// # async fn dox() {
17675/// # use cloudidentity1::{CloudIdentity, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
17676///
17677/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
17678/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
17679/// #     .with_native_roots()
17680/// #     .unwrap()
17681/// #     .https_only()
17682/// #     .enable_http2()
17683/// #     .build();
17684///
17685/// # let executor = hyper_util::rt::TokioExecutor::new();
17686/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
17687/// #     secret,
17688/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
17689/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
17690/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
17691/// #     ),
17692/// # ).build().await.unwrap();
17693///
17694/// # let client = hyper_util::client::legacy::Client::builder(
17695/// #     hyper_util::rt::TokioExecutor::new()
17696/// # )
17697/// # .build(
17698/// #     hyper_rustls::HttpsConnectorBuilder::new()
17699/// #         .with_native_roots()
17700/// #         .unwrap()
17701/// #         .https_or_http()
17702/// #         .enable_http2()
17703/// #         .build()
17704/// # );
17705/// # let mut hub = CloudIdentity::new(client, auth);
17706/// // You can configure optional parameters by calling the respective setters at will, and
17707/// // execute the final call using `doit()`.
17708/// // Values shown here are possibly random and not representative !
17709/// let result = hub.inbound_oidc_sso_profiles().delete("name")
17710///              .doit().await;
17711/// # }
17712/// ```
17713pub struct InboundOidcSsoProfileDeleteCall<'a, C>
17714where
17715    C: 'a,
17716{
17717    hub: &'a CloudIdentity<C>,
17718    _name: String,
17719    _delegate: Option<&'a mut dyn common::Delegate>,
17720    _additional_params: HashMap<String, String>,
17721    _scopes: BTreeSet<String>,
17722}
17723
17724impl<'a, C> common::CallBuilder for InboundOidcSsoProfileDeleteCall<'a, C> {}
17725
17726impl<'a, C> InboundOidcSsoProfileDeleteCall<'a, C>
17727where
17728    C: common::Connector,
17729{
17730    /// Perform the operation you have build so far.
17731    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
17732        use std::borrow::Cow;
17733        use std::io::{Read, Seek};
17734
17735        use common::{url::Params, ToParts};
17736        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
17737
17738        let mut dd = common::DefaultDelegate;
17739        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
17740        dlg.begin(common::MethodInfo {
17741            id: "cloudidentity.inboundOidcSsoProfiles.delete",
17742            http_method: hyper::Method::DELETE,
17743        });
17744
17745        for &field in ["alt", "name"].iter() {
17746            if self._additional_params.contains_key(field) {
17747                dlg.finished(false);
17748                return Err(common::Error::FieldClash(field));
17749            }
17750        }
17751
17752        let mut params = Params::with_capacity(3 + self._additional_params.len());
17753        params.push("name", self._name);
17754
17755        params.extend(self._additional_params.iter());
17756
17757        params.push("alt", "json");
17758        let mut url = self.hub._base_url.clone() + "v1/{+name}";
17759        if self._scopes.is_empty() {
17760            self._scopes
17761                .insert(Scope::CloudPlatform.as_ref().to_string());
17762        }
17763
17764        #[allow(clippy::single_element_loop)]
17765        for &(find_this, param_name) in [("{+name}", "name")].iter() {
17766            url = params.uri_replacement(url, param_name, find_this, true);
17767        }
17768        {
17769            let to_remove = ["name"];
17770            params.remove_params(&to_remove);
17771        }
17772
17773        let url = params.parse_with_url(&url);
17774
17775        loop {
17776            let token = match self
17777                .hub
17778                .auth
17779                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
17780                .await
17781            {
17782                Ok(token) => token,
17783                Err(e) => match dlg.token(e) {
17784                    Ok(token) => token,
17785                    Err(e) => {
17786                        dlg.finished(false);
17787                        return Err(common::Error::MissingToken(e));
17788                    }
17789                },
17790            };
17791            let mut req_result = {
17792                let client = &self.hub.client;
17793                dlg.pre_request();
17794                let mut req_builder = hyper::Request::builder()
17795                    .method(hyper::Method::DELETE)
17796                    .uri(url.as_str())
17797                    .header(USER_AGENT, self.hub._user_agent.clone());
17798
17799                if let Some(token) = token.as_ref() {
17800                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
17801                }
17802
17803                let request = req_builder
17804                    .header(CONTENT_LENGTH, 0_u64)
17805                    .body(common::to_body::<String>(None));
17806
17807                client.request(request.unwrap()).await
17808            };
17809
17810            match req_result {
17811                Err(err) => {
17812                    if let common::Retry::After(d) = dlg.http_error(&err) {
17813                        sleep(d).await;
17814                        continue;
17815                    }
17816                    dlg.finished(false);
17817                    return Err(common::Error::HttpError(err));
17818                }
17819                Ok(res) => {
17820                    let (mut parts, body) = res.into_parts();
17821                    let mut body = common::Body::new(body);
17822                    if !parts.status.is_success() {
17823                        let bytes = common::to_bytes(body).await.unwrap_or_default();
17824                        let error = serde_json::from_str(&common::to_string(&bytes));
17825                        let response = common::to_response(parts, bytes.into());
17826
17827                        if let common::Retry::After(d) =
17828                            dlg.http_failure(&response, error.as_ref().ok())
17829                        {
17830                            sleep(d).await;
17831                            continue;
17832                        }
17833
17834                        dlg.finished(false);
17835
17836                        return Err(match error {
17837                            Ok(value) => common::Error::BadRequest(value),
17838                            _ => common::Error::Failure(response),
17839                        });
17840                    }
17841                    let response = {
17842                        let bytes = common::to_bytes(body).await.unwrap_or_default();
17843                        let encoded = common::to_string(&bytes);
17844                        match serde_json::from_str(&encoded) {
17845                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
17846                            Err(error) => {
17847                                dlg.response_json_decode_error(&encoded, &error);
17848                                return Err(common::Error::JsonDecodeError(
17849                                    encoded.to_string(),
17850                                    error,
17851                                ));
17852                            }
17853                        }
17854                    };
17855
17856                    dlg.finished(true);
17857                    return Ok(response);
17858                }
17859            }
17860        }
17861    }
17862
17863    /// Required. The [resource name](https://cloud.google.com/apis/design/resource_names) of the InboundOidcSsoProfile to delete. Format: `inboundOidcSsoProfiles/{sso_profile_id}`
17864    ///
17865    /// Sets the *name* path property to the given value.
17866    ///
17867    /// Even though the property as already been set when instantiating this call,
17868    /// we provide this method for API completeness.
17869    pub fn name(mut self, new_value: &str) -> InboundOidcSsoProfileDeleteCall<'a, C> {
17870        self._name = new_value.to_string();
17871        self
17872    }
17873    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
17874    /// while executing the actual API request.
17875    ///
17876    /// ````text
17877    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
17878    /// ````
17879    ///
17880    /// Sets the *delegate* property to the given value.
17881    pub fn delegate(
17882        mut self,
17883        new_value: &'a mut dyn common::Delegate,
17884    ) -> InboundOidcSsoProfileDeleteCall<'a, C> {
17885        self._delegate = Some(new_value);
17886        self
17887    }
17888
17889    /// Set any additional parameter of the query string used in the request.
17890    /// It should be used to set parameters which are not yet available through their own
17891    /// setters.
17892    ///
17893    /// Please note that this method must not be used to set any of the known parameters
17894    /// which have their own setter method. If done anyway, the request will fail.
17895    ///
17896    /// # Additional Parameters
17897    ///
17898    /// * *$.xgafv* (query-string) - V1 error format.
17899    /// * *access_token* (query-string) - OAuth access token.
17900    /// * *alt* (query-string) - Data format for response.
17901    /// * *callback* (query-string) - JSONP
17902    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
17903    /// * *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.
17904    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
17905    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
17906    /// * *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.
17907    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
17908    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
17909    pub fn param<T>(mut self, name: T, value: T) -> InboundOidcSsoProfileDeleteCall<'a, C>
17910    where
17911        T: AsRef<str>,
17912    {
17913        self._additional_params
17914            .insert(name.as_ref().to_string(), value.as_ref().to_string());
17915        self
17916    }
17917
17918    /// Identifies the authorization scope for the method you are building.
17919    ///
17920    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
17921    /// [`Scope::CloudPlatform`].
17922    ///
17923    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
17924    /// tokens for more than one scope.
17925    ///
17926    /// Usually there is more than one suitable scope to authorize an operation, some of which may
17927    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
17928    /// sufficient, a read-write scope will do as well.
17929    pub fn add_scope<St>(mut self, scope: St) -> InboundOidcSsoProfileDeleteCall<'a, C>
17930    where
17931        St: AsRef<str>,
17932    {
17933        self._scopes.insert(String::from(scope.as_ref()));
17934        self
17935    }
17936    /// Identifies the authorization scope(s) for the method you are building.
17937    ///
17938    /// See [`Self::add_scope()`] for details.
17939    pub fn add_scopes<I, St>(mut self, scopes: I) -> InboundOidcSsoProfileDeleteCall<'a, C>
17940    where
17941        I: IntoIterator<Item = St>,
17942        St: AsRef<str>,
17943    {
17944        self._scopes
17945            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
17946        self
17947    }
17948
17949    /// Removes all scopes, and no default scope will be used either.
17950    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
17951    /// for details).
17952    pub fn clear_scopes(mut self) -> InboundOidcSsoProfileDeleteCall<'a, C> {
17953        self._scopes.clear();
17954        self
17955    }
17956}
17957
17958/// Gets an InboundOidcSsoProfile.
17959///
17960/// A builder for the *get* method supported by a *inboundOidcSsoProfile* resource.
17961/// It is not used directly, but through a [`InboundOidcSsoProfileMethods`] instance.
17962///
17963/// # Example
17964///
17965/// Instantiate a resource method builder
17966///
17967/// ```test_harness,no_run
17968/// # extern crate hyper;
17969/// # extern crate hyper_rustls;
17970/// # extern crate google_cloudidentity1 as cloudidentity1;
17971/// # async fn dox() {
17972/// # use cloudidentity1::{CloudIdentity, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
17973///
17974/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
17975/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
17976/// #     .with_native_roots()
17977/// #     .unwrap()
17978/// #     .https_only()
17979/// #     .enable_http2()
17980/// #     .build();
17981///
17982/// # let executor = hyper_util::rt::TokioExecutor::new();
17983/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
17984/// #     secret,
17985/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
17986/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
17987/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
17988/// #     ),
17989/// # ).build().await.unwrap();
17990///
17991/// # let client = hyper_util::client::legacy::Client::builder(
17992/// #     hyper_util::rt::TokioExecutor::new()
17993/// # )
17994/// # .build(
17995/// #     hyper_rustls::HttpsConnectorBuilder::new()
17996/// #         .with_native_roots()
17997/// #         .unwrap()
17998/// #         .https_or_http()
17999/// #         .enable_http2()
18000/// #         .build()
18001/// # );
18002/// # let mut hub = CloudIdentity::new(client, auth);
18003/// // You can configure optional parameters by calling the respective setters at will, and
18004/// // execute the final call using `doit()`.
18005/// // Values shown here are possibly random and not representative !
18006/// let result = hub.inbound_oidc_sso_profiles().get("name")
18007///              .doit().await;
18008/// # }
18009/// ```
18010pub struct InboundOidcSsoProfileGetCall<'a, C>
18011where
18012    C: 'a,
18013{
18014    hub: &'a CloudIdentity<C>,
18015    _name: String,
18016    _delegate: Option<&'a mut dyn common::Delegate>,
18017    _additional_params: HashMap<String, String>,
18018    _scopes: BTreeSet<String>,
18019}
18020
18021impl<'a, C> common::CallBuilder for InboundOidcSsoProfileGetCall<'a, C> {}
18022
18023impl<'a, C> InboundOidcSsoProfileGetCall<'a, C>
18024where
18025    C: common::Connector,
18026{
18027    /// Perform the operation you have build so far.
18028    pub async fn doit(mut self) -> common::Result<(common::Response, InboundOidcSsoProfile)> {
18029        use std::borrow::Cow;
18030        use std::io::{Read, Seek};
18031
18032        use common::{url::Params, ToParts};
18033        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
18034
18035        let mut dd = common::DefaultDelegate;
18036        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
18037        dlg.begin(common::MethodInfo {
18038            id: "cloudidentity.inboundOidcSsoProfiles.get",
18039            http_method: hyper::Method::GET,
18040        });
18041
18042        for &field in ["alt", "name"].iter() {
18043            if self._additional_params.contains_key(field) {
18044                dlg.finished(false);
18045                return Err(common::Error::FieldClash(field));
18046            }
18047        }
18048
18049        let mut params = Params::with_capacity(3 + self._additional_params.len());
18050        params.push("name", self._name);
18051
18052        params.extend(self._additional_params.iter());
18053
18054        params.push("alt", "json");
18055        let mut url = self.hub._base_url.clone() + "v1/{+name}";
18056        if self._scopes.is_empty() {
18057            self._scopes
18058                .insert(Scope::CloudIdentityInboundssoReadonly.as_ref().to_string());
18059        }
18060
18061        #[allow(clippy::single_element_loop)]
18062        for &(find_this, param_name) in [("{+name}", "name")].iter() {
18063            url = params.uri_replacement(url, param_name, find_this, true);
18064        }
18065        {
18066            let to_remove = ["name"];
18067            params.remove_params(&to_remove);
18068        }
18069
18070        let url = params.parse_with_url(&url);
18071
18072        loop {
18073            let token = match self
18074                .hub
18075                .auth
18076                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
18077                .await
18078            {
18079                Ok(token) => token,
18080                Err(e) => match dlg.token(e) {
18081                    Ok(token) => token,
18082                    Err(e) => {
18083                        dlg.finished(false);
18084                        return Err(common::Error::MissingToken(e));
18085                    }
18086                },
18087            };
18088            let mut req_result = {
18089                let client = &self.hub.client;
18090                dlg.pre_request();
18091                let mut req_builder = hyper::Request::builder()
18092                    .method(hyper::Method::GET)
18093                    .uri(url.as_str())
18094                    .header(USER_AGENT, self.hub._user_agent.clone());
18095
18096                if let Some(token) = token.as_ref() {
18097                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
18098                }
18099
18100                let request = req_builder
18101                    .header(CONTENT_LENGTH, 0_u64)
18102                    .body(common::to_body::<String>(None));
18103
18104                client.request(request.unwrap()).await
18105            };
18106
18107            match req_result {
18108                Err(err) => {
18109                    if let common::Retry::After(d) = dlg.http_error(&err) {
18110                        sleep(d).await;
18111                        continue;
18112                    }
18113                    dlg.finished(false);
18114                    return Err(common::Error::HttpError(err));
18115                }
18116                Ok(res) => {
18117                    let (mut parts, body) = res.into_parts();
18118                    let mut body = common::Body::new(body);
18119                    if !parts.status.is_success() {
18120                        let bytes = common::to_bytes(body).await.unwrap_or_default();
18121                        let error = serde_json::from_str(&common::to_string(&bytes));
18122                        let response = common::to_response(parts, bytes.into());
18123
18124                        if let common::Retry::After(d) =
18125                            dlg.http_failure(&response, error.as_ref().ok())
18126                        {
18127                            sleep(d).await;
18128                            continue;
18129                        }
18130
18131                        dlg.finished(false);
18132
18133                        return Err(match error {
18134                            Ok(value) => common::Error::BadRequest(value),
18135                            _ => common::Error::Failure(response),
18136                        });
18137                    }
18138                    let response = {
18139                        let bytes = common::to_bytes(body).await.unwrap_or_default();
18140                        let encoded = common::to_string(&bytes);
18141                        match serde_json::from_str(&encoded) {
18142                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
18143                            Err(error) => {
18144                                dlg.response_json_decode_error(&encoded, &error);
18145                                return Err(common::Error::JsonDecodeError(
18146                                    encoded.to_string(),
18147                                    error,
18148                                ));
18149                            }
18150                        }
18151                    };
18152
18153                    dlg.finished(true);
18154                    return Ok(response);
18155                }
18156            }
18157        }
18158    }
18159
18160    /// Required. The [resource name](https://cloud.google.com/apis/design/resource_names) of the InboundOidcSsoProfile to get. Format: `inboundOidcSsoProfiles/{sso_profile_id}`
18161    ///
18162    /// Sets the *name* path property to the given value.
18163    ///
18164    /// Even though the property as already been set when instantiating this call,
18165    /// we provide this method for API completeness.
18166    pub fn name(mut self, new_value: &str) -> InboundOidcSsoProfileGetCall<'a, C> {
18167        self._name = new_value.to_string();
18168        self
18169    }
18170    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
18171    /// while executing the actual API request.
18172    ///
18173    /// ````text
18174    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
18175    /// ````
18176    ///
18177    /// Sets the *delegate* property to the given value.
18178    pub fn delegate(
18179        mut self,
18180        new_value: &'a mut dyn common::Delegate,
18181    ) -> InboundOidcSsoProfileGetCall<'a, C> {
18182        self._delegate = Some(new_value);
18183        self
18184    }
18185
18186    /// Set any additional parameter of the query string used in the request.
18187    /// It should be used to set parameters which are not yet available through their own
18188    /// setters.
18189    ///
18190    /// Please note that this method must not be used to set any of the known parameters
18191    /// which have their own setter method. If done anyway, the request will fail.
18192    ///
18193    /// # Additional Parameters
18194    ///
18195    /// * *$.xgafv* (query-string) - V1 error format.
18196    /// * *access_token* (query-string) - OAuth access token.
18197    /// * *alt* (query-string) - Data format for response.
18198    /// * *callback* (query-string) - JSONP
18199    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
18200    /// * *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.
18201    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
18202    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
18203    /// * *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.
18204    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
18205    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
18206    pub fn param<T>(mut self, name: T, value: T) -> InboundOidcSsoProfileGetCall<'a, C>
18207    where
18208        T: AsRef<str>,
18209    {
18210        self._additional_params
18211            .insert(name.as_ref().to_string(), value.as_ref().to_string());
18212        self
18213    }
18214
18215    /// Identifies the authorization scope for the method you are building.
18216    ///
18217    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
18218    /// [`Scope::CloudIdentityInboundssoReadonly`].
18219    ///
18220    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
18221    /// tokens for more than one scope.
18222    ///
18223    /// Usually there is more than one suitable scope to authorize an operation, some of which may
18224    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
18225    /// sufficient, a read-write scope will do as well.
18226    pub fn add_scope<St>(mut self, scope: St) -> InboundOidcSsoProfileGetCall<'a, C>
18227    where
18228        St: AsRef<str>,
18229    {
18230        self._scopes.insert(String::from(scope.as_ref()));
18231        self
18232    }
18233    /// Identifies the authorization scope(s) for the method you are building.
18234    ///
18235    /// See [`Self::add_scope()`] for details.
18236    pub fn add_scopes<I, St>(mut self, scopes: I) -> InboundOidcSsoProfileGetCall<'a, C>
18237    where
18238        I: IntoIterator<Item = St>,
18239        St: AsRef<str>,
18240    {
18241        self._scopes
18242            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
18243        self
18244    }
18245
18246    /// Removes all scopes, and no default scope will be used either.
18247    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
18248    /// for details).
18249    pub fn clear_scopes(mut self) -> InboundOidcSsoProfileGetCall<'a, C> {
18250        self._scopes.clear();
18251        self
18252    }
18253}
18254
18255/// Lists InboundOidcSsoProfile objects for a Google enterprise customer.
18256///
18257/// A builder for the *list* method supported by a *inboundOidcSsoProfile* resource.
18258/// It is not used directly, but through a [`InboundOidcSsoProfileMethods`] instance.
18259///
18260/// # Example
18261///
18262/// Instantiate a resource method builder
18263///
18264/// ```test_harness,no_run
18265/// # extern crate hyper;
18266/// # extern crate hyper_rustls;
18267/// # extern crate google_cloudidentity1 as cloudidentity1;
18268/// # async fn dox() {
18269/// # use cloudidentity1::{CloudIdentity, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
18270///
18271/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
18272/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
18273/// #     .with_native_roots()
18274/// #     .unwrap()
18275/// #     .https_only()
18276/// #     .enable_http2()
18277/// #     .build();
18278///
18279/// # let executor = hyper_util::rt::TokioExecutor::new();
18280/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
18281/// #     secret,
18282/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
18283/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
18284/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
18285/// #     ),
18286/// # ).build().await.unwrap();
18287///
18288/// # let client = hyper_util::client::legacy::Client::builder(
18289/// #     hyper_util::rt::TokioExecutor::new()
18290/// # )
18291/// # .build(
18292/// #     hyper_rustls::HttpsConnectorBuilder::new()
18293/// #         .with_native_roots()
18294/// #         .unwrap()
18295/// #         .https_or_http()
18296/// #         .enable_http2()
18297/// #         .build()
18298/// # );
18299/// # let mut hub = CloudIdentity::new(client, auth);
18300/// // You can configure optional parameters by calling the respective setters at will, and
18301/// // execute the final call using `doit()`.
18302/// // Values shown here are possibly random and not representative !
18303/// let result = hub.inbound_oidc_sso_profiles().list()
18304///              .page_token("et")
18305///              .page_size(-39)
18306///              .filter("aliquyam")
18307///              .doit().await;
18308/// # }
18309/// ```
18310pub struct InboundOidcSsoProfileListCall<'a, C>
18311where
18312    C: 'a,
18313{
18314    hub: &'a CloudIdentity<C>,
18315    _page_token: Option<String>,
18316    _page_size: Option<i32>,
18317    _filter: Option<String>,
18318    _delegate: Option<&'a mut dyn common::Delegate>,
18319    _additional_params: HashMap<String, String>,
18320    _scopes: BTreeSet<String>,
18321}
18322
18323impl<'a, C> common::CallBuilder for InboundOidcSsoProfileListCall<'a, C> {}
18324
18325impl<'a, C> InboundOidcSsoProfileListCall<'a, C>
18326where
18327    C: common::Connector,
18328{
18329    /// Perform the operation you have build so far.
18330    pub async fn doit(
18331        mut self,
18332    ) -> common::Result<(common::Response, ListInboundOidcSsoProfilesResponse)> {
18333        use std::borrow::Cow;
18334        use std::io::{Read, Seek};
18335
18336        use common::{url::Params, ToParts};
18337        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
18338
18339        let mut dd = common::DefaultDelegate;
18340        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
18341        dlg.begin(common::MethodInfo {
18342            id: "cloudidentity.inboundOidcSsoProfiles.list",
18343            http_method: hyper::Method::GET,
18344        });
18345
18346        for &field in ["alt", "pageToken", "pageSize", "filter"].iter() {
18347            if self._additional_params.contains_key(field) {
18348                dlg.finished(false);
18349                return Err(common::Error::FieldClash(field));
18350            }
18351        }
18352
18353        let mut params = Params::with_capacity(5 + self._additional_params.len());
18354        if let Some(value) = self._page_token.as_ref() {
18355            params.push("pageToken", value);
18356        }
18357        if let Some(value) = self._page_size.as_ref() {
18358            params.push("pageSize", value.to_string());
18359        }
18360        if let Some(value) = self._filter.as_ref() {
18361            params.push("filter", value);
18362        }
18363
18364        params.extend(self._additional_params.iter());
18365
18366        params.push("alt", "json");
18367        let mut url = self.hub._base_url.clone() + "v1/inboundOidcSsoProfiles";
18368        if self._scopes.is_empty() {
18369            self._scopes
18370                .insert(Scope::CloudIdentityInboundssoReadonly.as_ref().to_string());
18371        }
18372
18373        let url = params.parse_with_url(&url);
18374
18375        loop {
18376            let token = match self
18377                .hub
18378                .auth
18379                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
18380                .await
18381            {
18382                Ok(token) => token,
18383                Err(e) => match dlg.token(e) {
18384                    Ok(token) => token,
18385                    Err(e) => {
18386                        dlg.finished(false);
18387                        return Err(common::Error::MissingToken(e));
18388                    }
18389                },
18390            };
18391            let mut req_result = {
18392                let client = &self.hub.client;
18393                dlg.pre_request();
18394                let mut req_builder = hyper::Request::builder()
18395                    .method(hyper::Method::GET)
18396                    .uri(url.as_str())
18397                    .header(USER_AGENT, self.hub._user_agent.clone());
18398
18399                if let Some(token) = token.as_ref() {
18400                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
18401                }
18402
18403                let request = req_builder
18404                    .header(CONTENT_LENGTH, 0_u64)
18405                    .body(common::to_body::<String>(None));
18406
18407                client.request(request.unwrap()).await
18408            };
18409
18410            match req_result {
18411                Err(err) => {
18412                    if let common::Retry::After(d) = dlg.http_error(&err) {
18413                        sleep(d).await;
18414                        continue;
18415                    }
18416                    dlg.finished(false);
18417                    return Err(common::Error::HttpError(err));
18418                }
18419                Ok(res) => {
18420                    let (mut parts, body) = res.into_parts();
18421                    let mut body = common::Body::new(body);
18422                    if !parts.status.is_success() {
18423                        let bytes = common::to_bytes(body).await.unwrap_or_default();
18424                        let error = serde_json::from_str(&common::to_string(&bytes));
18425                        let response = common::to_response(parts, bytes.into());
18426
18427                        if let common::Retry::After(d) =
18428                            dlg.http_failure(&response, error.as_ref().ok())
18429                        {
18430                            sleep(d).await;
18431                            continue;
18432                        }
18433
18434                        dlg.finished(false);
18435
18436                        return Err(match error {
18437                            Ok(value) => common::Error::BadRequest(value),
18438                            _ => common::Error::Failure(response),
18439                        });
18440                    }
18441                    let response = {
18442                        let bytes = common::to_bytes(body).await.unwrap_or_default();
18443                        let encoded = common::to_string(&bytes);
18444                        match serde_json::from_str(&encoded) {
18445                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
18446                            Err(error) => {
18447                                dlg.response_json_decode_error(&encoded, &error);
18448                                return Err(common::Error::JsonDecodeError(
18449                                    encoded.to_string(),
18450                                    error,
18451                                ));
18452                            }
18453                        }
18454                    };
18455
18456                    dlg.finished(true);
18457                    return Ok(response);
18458                }
18459            }
18460        }
18461    }
18462
18463    /// A page token, received from a previous `ListInboundOidcSsoProfiles` call. Provide this to retrieve the subsequent page. When paginating, all other parameters provided to `ListInboundOidcSsoProfiles` must match the call that provided the page token.
18464    ///
18465    /// Sets the *page token* query property to the given value.
18466    pub fn page_token(mut self, new_value: &str) -> InboundOidcSsoProfileListCall<'a, C> {
18467        self._page_token = Some(new_value.to_string());
18468        self
18469    }
18470    /// The maximum number of InboundOidcSsoProfiles to return. The service may return fewer than this value. If omitted (or defaulted to zero) the server will use a sensible default. This default may change over time. The maximum allowed value is 100. Requests with page_size greater than that will be silently interpreted as having this maximum value.
18471    ///
18472    /// Sets the *page size* query property to the given value.
18473    pub fn page_size(mut self, new_value: i32) -> InboundOidcSsoProfileListCall<'a, C> {
18474        self._page_size = Some(new_value);
18475        self
18476    }
18477    /// A [Common Expression Language](https://github.com/google/cel-spec) expression to filter the results. The only supported filter is filtering by customer. For example: `customer=="customers/C0123abc"`. Omitting the filter or specifying a filter of `customer=="customers/my_customer"` will return the profiles for the customer that the caller (authenticated user) belongs to. Specifying a filter of `customer==""` will return the global shared OIDC profiles.
18478    ///
18479    /// Sets the *filter* query property to the given value.
18480    pub fn filter(mut self, new_value: &str) -> InboundOidcSsoProfileListCall<'a, C> {
18481        self._filter = Some(new_value.to_string());
18482        self
18483    }
18484    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
18485    /// while executing the actual API request.
18486    ///
18487    /// ````text
18488    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
18489    /// ````
18490    ///
18491    /// Sets the *delegate* property to the given value.
18492    pub fn delegate(
18493        mut self,
18494        new_value: &'a mut dyn common::Delegate,
18495    ) -> InboundOidcSsoProfileListCall<'a, C> {
18496        self._delegate = Some(new_value);
18497        self
18498    }
18499
18500    /// Set any additional parameter of the query string used in the request.
18501    /// It should be used to set parameters which are not yet available through their own
18502    /// setters.
18503    ///
18504    /// Please note that this method must not be used to set any of the known parameters
18505    /// which have their own setter method. If done anyway, the request will fail.
18506    ///
18507    /// # Additional Parameters
18508    ///
18509    /// * *$.xgafv* (query-string) - V1 error format.
18510    /// * *access_token* (query-string) - OAuth access token.
18511    /// * *alt* (query-string) - Data format for response.
18512    /// * *callback* (query-string) - JSONP
18513    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
18514    /// * *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.
18515    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
18516    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
18517    /// * *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.
18518    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
18519    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
18520    pub fn param<T>(mut self, name: T, value: T) -> InboundOidcSsoProfileListCall<'a, C>
18521    where
18522        T: AsRef<str>,
18523    {
18524        self._additional_params
18525            .insert(name.as_ref().to_string(), value.as_ref().to_string());
18526        self
18527    }
18528
18529    /// Identifies the authorization scope for the method you are building.
18530    ///
18531    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
18532    /// [`Scope::CloudIdentityInboundssoReadonly`].
18533    ///
18534    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
18535    /// tokens for more than one scope.
18536    ///
18537    /// Usually there is more than one suitable scope to authorize an operation, some of which may
18538    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
18539    /// sufficient, a read-write scope will do as well.
18540    pub fn add_scope<St>(mut self, scope: St) -> InboundOidcSsoProfileListCall<'a, C>
18541    where
18542        St: AsRef<str>,
18543    {
18544        self._scopes.insert(String::from(scope.as_ref()));
18545        self
18546    }
18547    /// Identifies the authorization scope(s) for the method you are building.
18548    ///
18549    /// See [`Self::add_scope()`] for details.
18550    pub fn add_scopes<I, St>(mut self, scopes: I) -> InboundOidcSsoProfileListCall<'a, C>
18551    where
18552        I: IntoIterator<Item = St>,
18553        St: AsRef<str>,
18554    {
18555        self._scopes
18556            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
18557        self
18558    }
18559
18560    /// Removes all scopes, and no default scope will be used either.
18561    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
18562    /// for details).
18563    pub fn clear_scopes(mut self) -> InboundOidcSsoProfileListCall<'a, C> {
18564        self._scopes.clear();
18565        self
18566    }
18567}
18568
18569/// Updates an InboundOidcSsoProfile. When the target customer has enabled [Multi-party approval for sensitive actions](https://support.google.com/a/answer/13790448), the `Operation` in the response will have `"done": false`, it will not have a response, and the metadata will have `"state": "awaiting-multi-party-approval"`.
18570///
18571/// A builder for the *patch* method supported by a *inboundOidcSsoProfile* resource.
18572/// It is not used directly, but through a [`InboundOidcSsoProfileMethods`] instance.
18573///
18574/// # Example
18575///
18576/// Instantiate a resource method builder
18577///
18578/// ```test_harness,no_run
18579/// # extern crate hyper;
18580/// # extern crate hyper_rustls;
18581/// # extern crate google_cloudidentity1 as cloudidentity1;
18582/// use cloudidentity1::api::InboundOidcSsoProfile;
18583/// # async fn dox() {
18584/// # use cloudidentity1::{CloudIdentity, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
18585///
18586/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
18587/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
18588/// #     .with_native_roots()
18589/// #     .unwrap()
18590/// #     .https_only()
18591/// #     .enable_http2()
18592/// #     .build();
18593///
18594/// # let executor = hyper_util::rt::TokioExecutor::new();
18595/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
18596/// #     secret,
18597/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
18598/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
18599/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
18600/// #     ),
18601/// # ).build().await.unwrap();
18602///
18603/// # let client = hyper_util::client::legacy::Client::builder(
18604/// #     hyper_util::rt::TokioExecutor::new()
18605/// # )
18606/// # .build(
18607/// #     hyper_rustls::HttpsConnectorBuilder::new()
18608/// #         .with_native_roots()
18609/// #         .unwrap()
18610/// #         .https_or_http()
18611/// #         .enable_http2()
18612/// #         .build()
18613/// # );
18614/// # let mut hub = CloudIdentity::new(client, auth);
18615/// // As the method needs a request, you would usually fill it with the desired information
18616/// // into the respective structure. Some of the parts shown here might not be applicable !
18617/// // Values shown here are possibly random and not representative !
18618/// let mut req = InboundOidcSsoProfile::default();
18619///
18620/// // You can configure optional parameters by calling the respective setters at will, and
18621/// // execute the final call using `doit()`.
18622/// // Values shown here are possibly random and not representative !
18623/// let result = hub.inbound_oidc_sso_profiles().patch(req, "name")
18624///              .update_mask(FieldMask::new::<&str>(&[]))
18625///              .doit().await;
18626/// # }
18627/// ```
18628pub struct InboundOidcSsoProfilePatchCall<'a, C>
18629where
18630    C: 'a,
18631{
18632    hub: &'a CloudIdentity<C>,
18633    _request: InboundOidcSsoProfile,
18634    _name: String,
18635    _update_mask: Option<common::FieldMask>,
18636    _delegate: Option<&'a mut dyn common::Delegate>,
18637    _additional_params: HashMap<String, String>,
18638    _scopes: BTreeSet<String>,
18639}
18640
18641impl<'a, C> common::CallBuilder for InboundOidcSsoProfilePatchCall<'a, C> {}
18642
18643impl<'a, C> InboundOidcSsoProfilePatchCall<'a, C>
18644where
18645    C: common::Connector,
18646{
18647    /// Perform the operation you have build so far.
18648    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
18649        use std::borrow::Cow;
18650        use std::io::{Read, Seek};
18651
18652        use common::{url::Params, ToParts};
18653        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
18654
18655        let mut dd = common::DefaultDelegate;
18656        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
18657        dlg.begin(common::MethodInfo {
18658            id: "cloudidentity.inboundOidcSsoProfiles.patch",
18659            http_method: hyper::Method::PATCH,
18660        });
18661
18662        for &field in ["alt", "name", "updateMask"].iter() {
18663            if self._additional_params.contains_key(field) {
18664                dlg.finished(false);
18665                return Err(common::Error::FieldClash(field));
18666            }
18667        }
18668
18669        let mut params = Params::with_capacity(5 + self._additional_params.len());
18670        params.push("name", self._name);
18671        if let Some(value) = self._update_mask.as_ref() {
18672            params.push("updateMask", value.to_string());
18673        }
18674
18675        params.extend(self._additional_params.iter());
18676
18677        params.push("alt", "json");
18678        let mut url = self.hub._base_url.clone() + "v1/{+name}";
18679        if self._scopes.is_empty() {
18680            self._scopes
18681                .insert(Scope::CloudPlatform.as_ref().to_string());
18682        }
18683
18684        #[allow(clippy::single_element_loop)]
18685        for &(find_this, param_name) in [("{+name}", "name")].iter() {
18686            url = params.uri_replacement(url, param_name, find_this, true);
18687        }
18688        {
18689            let to_remove = ["name"];
18690            params.remove_params(&to_remove);
18691        }
18692
18693        let url = params.parse_with_url(&url);
18694
18695        let mut json_mime_type = mime::APPLICATION_JSON;
18696        let mut request_value_reader = {
18697            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
18698            common::remove_json_null_values(&mut value);
18699            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
18700            serde_json::to_writer(&mut dst, &value).unwrap();
18701            dst
18702        };
18703        let request_size = request_value_reader
18704            .seek(std::io::SeekFrom::End(0))
18705            .unwrap();
18706        request_value_reader
18707            .seek(std::io::SeekFrom::Start(0))
18708            .unwrap();
18709
18710        loop {
18711            let token = match self
18712                .hub
18713                .auth
18714                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
18715                .await
18716            {
18717                Ok(token) => token,
18718                Err(e) => match dlg.token(e) {
18719                    Ok(token) => token,
18720                    Err(e) => {
18721                        dlg.finished(false);
18722                        return Err(common::Error::MissingToken(e));
18723                    }
18724                },
18725            };
18726            request_value_reader
18727                .seek(std::io::SeekFrom::Start(0))
18728                .unwrap();
18729            let mut req_result = {
18730                let client = &self.hub.client;
18731                dlg.pre_request();
18732                let mut req_builder = hyper::Request::builder()
18733                    .method(hyper::Method::PATCH)
18734                    .uri(url.as_str())
18735                    .header(USER_AGENT, self.hub._user_agent.clone());
18736
18737                if let Some(token) = token.as_ref() {
18738                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
18739                }
18740
18741                let request = req_builder
18742                    .header(CONTENT_TYPE, json_mime_type.to_string())
18743                    .header(CONTENT_LENGTH, request_size as u64)
18744                    .body(common::to_body(
18745                        request_value_reader.get_ref().clone().into(),
18746                    ));
18747
18748                client.request(request.unwrap()).await
18749            };
18750
18751            match req_result {
18752                Err(err) => {
18753                    if let common::Retry::After(d) = dlg.http_error(&err) {
18754                        sleep(d).await;
18755                        continue;
18756                    }
18757                    dlg.finished(false);
18758                    return Err(common::Error::HttpError(err));
18759                }
18760                Ok(res) => {
18761                    let (mut parts, body) = res.into_parts();
18762                    let mut body = common::Body::new(body);
18763                    if !parts.status.is_success() {
18764                        let bytes = common::to_bytes(body).await.unwrap_or_default();
18765                        let error = serde_json::from_str(&common::to_string(&bytes));
18766                        let response = common::to_response(parts, bytes.into());
18767
18768                        if let common::Retry::After(d) =
18769                            dlg.http_failure(&response, error.as_ref().ok())
18770                        {
18771                            sleep(d).await;
18772                            continue;
18773                        }
18774
18775                        dlg.finished(false);
18776
18777                        return Err(match error {
18778                            Ok(value) => common::Error::BadRequest(value),
18779                            _ => common::Error::Failure(response),
18780                        });
18781                    }
18782                    let response = {
18783                        let bytes = common::to_bytes(body).await.unwrap_or_default();
18784                        let encoded = common::to_string(&bytes);
18785                        match serde_json::from_str(&encoded) {
18786                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
18787                            Err(error) => {
18788                                dlg.response_json_decode_error(&encoded, &error);
18789                                return Err(common::Error::JsonDecodeError(
18790                                    encoded.to_string(),
18791                                    error,
18792                                ));
18793                            }
18794                        }
18795                    };
18796
18797                    dlg.finished(true);
18798                    return Ok(response);
18799                }
18800            }
18801        }
18802    }
18803
18804    ///
18805    /// Sets the *request* property to the given value.
18806    ///
18807    /// Even though the property as already been set when instantiating this call,
18808    /// we provide this method for API completeness.
18809    pub fn request(
18810        mut self,
18811        new_value: InboundOidcSsoProfile,
18812    ) -> InboundOidcSsoProfilePatchCall<'a, C> {
18813        self._request = new_value;
18814        self
18815    }
18816    /// Output only. [Resource name](https://cloud.google.com/apis/design/resource_names) of the OIDC SSO profile.
18817    ///
18818    /// Sets the *name* path property to the given value.
18819    ///
18820    /// Even though the property as already been set when instantiating this call,
18821    /// we provide this method for API completeness.
18822    pub fn name(mut self, new_value: &str) -> InboundOidcSsoProfilePatchCall<'a, C> {
18823        self._name = new_value.to_string();
18824        self
18825    }
18826    /// Required. The list of fields to be updated.
18827    ///
18828    /// Sets the *update mask* query property to the given value.
18829    pub fn update_mask(
18830        mut self,
18831        new_value: common::FieldMask,
18832    ) -> InboundOidcSsoProfilePatchCall<'a, C> {
18833        self._update_mask = Some(new_value);
18834        self
18835    }
18836    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
18837    /// while executing the actual API request.
18838    ///
18839    /// ````text
18840    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
18841    /// ````
18842    ///
18843    /// Sets the *delegate* property to the given value.
18844    pub fn delegate(
18845        mut self,
18846        new_value: &'a mut dyn common::Delegate,
18847    ) -> InboundOidcSsoProfilePatchCall<'a, C> {
18848        self._delegate = Some(new_value);
18849        self
18850    }
18851
18852    /// Set any additional parameter of the query string used in the request.
18853    /// It should be used to set parameters which are not yet available through their own
18854    /// setters.
18855    ///
18856    /// Please note that this method must not be used to set any of the known parameters
18857    /// which have their own setter method. If done anyway, the request will fail.
18858    ///
18859    /// # Additional Parameters
18860    ///
18861    /// * *$.xgafv* (query-string) - V1 error format.
18862    /// * *access_token* (query-string) - OAuth access token.
18863    /// * *alt* (query-string) - Data format for response.
18864    /// * *callback* (query-string) - JSONP
18865    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
18866    /// * *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.
18867    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
18868    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
18869    /// * *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.
18870    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
18871    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
18872    pub fn param<T>(mut self, name: T, value: T) -> InboundOidcSsoProfilePatchCall<'a, C>
18873    where
18874        T: AsRef<str>,
18875    {
18876        self._additional_params
18877            .insert(name.as_ref().to_string(), value.as_ref().to_string());
18878        self
18879    }
18880
18881    /// Identifies the authorization scope for the method you are building.
18882    ///
18883    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
18884    /// [`Scope::CloudPlatform`].
18885    ///
18886    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
18887    /// tokens for more than one scope.
18888    ///
18889    /// Usually there is more than one suitable scope to authorize an operation, some of which may
18890    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
18891    /// sufficient, a read-write scope will do as well.
18892    pub fn add_scope<St>(mut self, scope: St) -> InboundOidcSsoProfilePatchCall<'a, C>
18893    where
18894        St: AsRef<str>,
18895    {
18896        self._scopes.insert(String::from(scope.as_ref()));
18897        self
18898    }
18899    /// Identifies the authorization scope(s) for the method you are building.
18900    ///
18901    /// See [`Self::add_scope()`] for details.
18902    pub fn add_scopes<I, St>(mut self, scopes: I) -> InboundOidcSsoProfilePatchCall<'a, C>
18903    where
18904        I: IntoIterator<Item = St>,
18905        St: AsRef<str>,
18906    {
18907        self._scopes
18908            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
18909        self
18910    }
18911
18912    /// Removes all scopes, and no default scope will be used either.
18913    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
18914    /// for details).
18915    pub fn clear_scopes(mut self) -> InboundOidcSsoProfilePatchCall<'a, C> {
18916        self._scopes.clear();
18917        self
18918    }
18919}
18920
18921/// Adds an IdpCredential. Up to 2 credentials are allowed. When the target customer has enabled [Multi-party approval for sensitive actions](https://support.google.com/a/answer/13790448), the `Operation` in the response will have `"done": false`, it will not have a response, and the metadata will have `"state": "awaiting-multi-party-approval"`.
18922///
18923/// A builder for the *idpCredentials.add* method supported by a *inboundSamlSsoProfile* resource.
18924/// It is not used directly, but through a [`InboundSamlSsoProfileMethods`] instance.
18925///
18926/// # Example
18927///
18928/// Instantiate a resource method builder
18929///
18930/// ```test_harness,no_run
18931/// # extern crate hyper;
18932/// # extern crate hyper_rustls;
18933/// # extern crate google_cloudidentity1 as cloudidentity1;
18934/// use cloudidentity1::api::AddIdpCredentialRequest;
18935/// # async fn dox() {
18936/// # use cloudidentity1::{CloudIdentity, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
18937///
18938/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
18939/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
18940/// #     .with_native_roots()
18941/// #     .unwrap()
18942/// #     .https_only()
18943/// #     .enable_http2()
18944/// #     .build();
18945///
18946/// # let executor = hyper_util::rt::TokioExecutor::new();
18947/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
18948/// #     secret,
18949/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
18950/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
18951/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
18952/// #     ),
18953/// # ).build().await.unwrap();
18954///
18955/// # let client = hyper_util::client::legacy::Client::builder(
18956/// #     hyper_util::rt::TokioExecutor::new()
18957/// # )
18958/// # .build(
18959/// #     hyper_rustls::HttpsConnectorBuilder::new()
18960/// #         .with_native_roots()
18961/// #         .unwrap()
18962/// #         .https_or_http()
18963/// #         .enable_http2()
18964/// #         .build()
18965/// # );
18966/// # let mut hub = CloudIdentity::new(client, auth);
18967/// // As the method needs a request, you would usually fill it with the desired information
18968/// // into the respective structure. Some of the parts shown here might not be applicable !
18969/// // Values shown here are possibly random and not representative !
18970/// let mut req = AddIdpCredentialRequest::default();
18971///
18972/// // You can configure optional parameters by calling the respective setters at will, and
18973/// // execute the final call using `doit()`.
18974/// // Values shown here are possibly random and not representative !
18975/// let result = hub.inbound_saml_sso_profiles().idp_credentials_add(req, "parent")
18976///              .doit().await;
18977/// # }
18978/// ```
18979pub struct InboundSamlSsoProfileIdpCredentialAddCall<'a, C>
18980where
18981    C: 'a,
18982{
18983    hub: &'a CloudIdentity<C>,
18984    _request: AddIdpCredentialRequest,
18985    _parent: String,
18986    _delegate: Option<&'a mut dyn common::Delegate>,
18987    _additional_params: HashMap<String, String>,
18988    _scopes: BTreeSet<String>,
18989}
18990
18991impl<'a, C> common::CallBuilder for InboundSamlSsoProfileIdpCredentialAddCall<'a, C> {}
18992
18993impl<'a, C> InboundSamlSsoProfileIdpCredentialAddCall<'a, C>
18994where
18995    C: common::Connector,
18996{
18997    /// Perform the operation you have build so far.
18998    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
18999        use std::borrow::Cow;
19000        use std::io::{Read, Seek};
19001
19002        use common::{url::Params, ToParts};
19003        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
19004
19005        let mut dd = common::DefaultDelegate;
19006        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
19007        dlg.begin(common::MethodInfo {
19008            id: "cloudidentity.inboundSamlSsoProfiles.idpCredentials.add",
19009            http_method: hyper::Method::POST,
19010        });
19011
19012        for &field in ["alt", "parent"].iter() {
19013            if self._additional_params.contains_key(field) {
19014                dlg.finished(false);
19015                return Err(common::Error::FieldClash(field));
19016            }
19017        }
19018
19019        let mut params = Params::with_capacity(4 + self._additional_params.len());
19020        params.push("parent", self._parent);
19021
19022        params.extend(self._additional_params.iter());
19023
19024        params.push("alt", "json");
19025        let mut url = self.hub._base_url.clone() + "v1/{+parent}/idpCredentials:add";
19026        if self._scopes.is_empty() {
19027            self._scopes
19028                .insert(Scope::CloudPlatform.as_ref().to_string());
19029        }
19030
19031        #[allow(clippy::single_element_loop)]
19032        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
19033            url = params.uri_replacement(url, param_name, find_this, true);
19034        }
19035        {
19036            let to_remove = ["parent"];
19037            params.remove_params(&to_remove);
19038        }
19039
19040        let url = params.parse_with_url(&url);
19041
19042        let mut json_mime_type = mime::APPLICATION_JSON;
19043        let mut request_value_reader = {
19044            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
19045            common::remove_json_null_values(&mut value);
19046            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
19047            serde_json::to_writer(&mut dst, &value).unwrap();
19048            dst
19049        };
19050        let request_size = request_value_reader
19051            .seek(std::io::SeekFrom::End(0))
19052            .unwrap();
19053        request_value_reader
19054            .seek(std::io::SeekFrom::Start(0))
19055            .unwrap();
19056
19057        loop {
19058            let token = match self
19059                .hub
19060                .auth
19061                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
19062                .await
19063            {
19064                Ok(token) => token,
19065                Err(e) => match dlg.token(e) {
19066                    Ok(token) => token,
19067                    Err(e) => {
19068                        dlg.finished(false);
19069                        return Err(common::Error::MissingToken(e));
19070                    }
19071                },
19072            };
19073            request_value_reader
19074                .seek(std::io::SeekFrom::Start(0))
19075                .unwrap();
19076            let mut req_result = {
19077                let client = &self.hub.client;
19078                dlg.pre_request();
19079                let mut req_builder = hyper::Request::builder()
19080                    .method(hyper::Method::POST)
19081                    .uri(url.as_str())
19082                    .header(USER_AGENT, self.hub._user_agent.clone());
19083
19084                if let Some(token) = token.as_ref() {
19085                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
19086                }
19087
19088                let request = req_builder
19089                    .header(CONTENT_TYPE, json_mime_type.to_string())
19090                    .header(CONTENT_LENGTH, request_size as u64)
19091                    .body(common::to_body(
19092                        request_value_reader.get_ref().clone().into(),
19093                    ));
19094
19095                client.request(request.unwrap()).await
19096            };
19097
19098            match req_result {
19099                Err(err) => {
19100                    if let common::Retry::After(d) = dlg.http_error(&err) {
19101                        sleep(d).await;
19102                        continue;
19103                    }
19104                    dlg.finished(false);
19105                    return Err(common::Error::HttpError(err));
19106                }
19107                Ok(res) => {
19108                    let (mut parts, body) = res.into_parts();
19109                    let mut body = common::Body::new(body);
19110                    if !parts.status.is_success() {
19111                        let bytes = common::to_bytes(body).await.unwrap_or_default();
19112                        let error = serde_json::from_str(&common::to_string(&bytes));
19113                        let response = common::to_response(parts, bytes.into());
19114
19115                        if let common::Retry::After(d) =
19116                            dlg.http_failure(&response, error.as_ref().ok())
19117                        {
19118                            sleep(d).await;
19119                            continue;
19120                        }
19121
19122                        dlg.finished(false);
19123
19124                        return Err(match error {
19125                            Ok(value) => common::Error::BadRequest(value),
19126                            _ => common::Error::Failure(response),
19127                        });
19128                    }
19129                    let response = {
19130                        let bytes = common::to_bytes(body).await.unwrap_or_default();
19131                        let encoded = common::to_string(&bytes);
19132                        match serde_json::from_str(&encoded) {
19133                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
19134                            Err(error) => {
19135                                dlg.response_json_decode_error(&encoded, &error);
19136                                return Err(common::Error::JsonDecodeError(
19137                                    encoded.to_string(),
19138                                    error,
19139                                ));
19140                            }
19141                        }
19142                    };
19143
19144                    dlg.finished(true);
19145                    return Ok(response);
19146                }
19147            }
19148        }
19149    }
19150
19151    ///
19152    /// Sets the *request* property to the given value.
19153    ///
19154    /// Even though the property as already been set when instantiating this call,
19155    /// we provide this method for API completeness.
19156    pub fn request(
19157        mut self,
19158        new_value: AddIdpCredentialRequest,
19159    ) -> InboundSamlSsoProfileIdpCredentialAddCall<'a, C> {
19160        self._request = new_value;
19161        self
19162    }
19163    /// Required. The InboundSamlSsoProfile that owns the IdpCredential. Format: `inboundSamlSsoProfiles/{sso_profile_id}`
19164    ///
19165    /// Sets the *parent* path property to the given value.
19166    ///
19167    /// Even though the property as already been set when instantiating this call,
19168    /// we provide this method for API completeness.
19169    pub fn parent(mut self, new_value: &str) -> InboundSamlSsoProfileIdpCredentialAddCall<'a, C> {
19170        self._parent = new_value.to_string();
19171        self
19172    }
19173    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
19174    /// while executing the actual API request.
19175    ///
19176    /// ````text
19177    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
19178    /// ````
19179    ///
19180    /// Sets the *delegate* property to the given value.
19181    pub fn delegate(
19182        mut self,
19183        new_value: &'a mut dyn common::Delegate,
19184    ) -> InboundSamlSsoProfileIdpCredentialAddCall<'a, C> {
19185        self._delegate = Some(new_value);
19186        self
19187    }
19188
19189    /// Set any additional parameter of the query string used in the request.
19190    /// It should be used to set parameters which are not yet available through their own
19191    /// setters.
19192    ///
19193    /// Please note that this method must not be used to set any of the known parameters
19194    /// which have their own setter method. If done anyway, the request will fail.
19195    ///
19196    /// # Additional Parameters
19197    ///
19198    /// * *$.xgafv* (query-string) - V1 error format.
19199    /// * *access_token* (query-string) - OAuth access token.
19200    /// * *alt* (query-string) - Data format for response.
19201    /// * *callback* (query-string) - JSONP
19202    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
19203    /// * *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.
19204    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
19205    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
19206    /// * *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.
19207    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
19208    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
19209    pub fn param<T>(mut self, name: T, value: T) -> InboundSamlSsoProfileIdpCredentialAddCall<'a, C>
19210    where
19211        T: AsRef<str>,
19212    {
19213        self._additional_params
19214            .insert(name.as_ref().to_string(), value.as_ref().to_string());
19215        self
19216    }
19217
19218    /// Identifies the authorization scope for the method you are building.
19219    ///
19220    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
19221    /// [`Scope::CloudPlatform`].
19222    ///
19223    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
19224    /// tokens for more than one scope.
19225    ///
19226    /// Usually there is more than one suitable scope to authorize an operation, some of which may
19227    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
19228    /// sufficient, a read-write scope will do as well.
19229    pub fn add_scope<St>(mut self, scope: St) -> InboundSamlSsoProfileIdpCredentialAddCall<'a, C>
19230    where
19231        St: AsRef<str>,
19232    {
19233        self._scopes.insert(String::from(scope.as_ref()));
19234        self
19235    }
19236    /// Identifies the authorization scope(s) for the method you are building.
19237    ///
19238    /// See [`Self::add_scope()`] for details.
19239    pub fn add_scopes<I, St>(
19240        mut self,
19241        scopes: I,
19242    ) -> InboundSamlSsoProfileIdpCredentialAddCall<'a, C>
19243    where
19244        I: IntoIterator<Item = St>,
19245        St: AsRef<str>,
19246    {
19247        self._scopes
19248            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
19249        self
19250    }
19251
19252    /// Removes all scopes, and no default scope will be used either.
19253    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
19254    /// for details).
19255    pub fn clear_scopes(mut self) -> InboundSamlSsoProfileIdpCredentialAddCall<'a, C> {
19256        self._scopes.clear();
19257        self
19258    }
19259}
19260
19261/// Deletes an IdpCredential.
19262///
19263/// A builder for the *idpCredentials.delete* method supported by a *inboundSamlSsoProfile* resource.
19264/// It is not used directly, but through a [`InboundSamlSsoProfileMethods`] instance.
19265///
19266/// # Example
19267///
19268/// Instantiate a resource method builder
19269///
19270/// ```test_harness,no_run
19271/// # extern crate hyper;
19272/// # extern crate hyper_rustls;
19273/// # extern crate google_cloudidentity1 as cloudidentity1;
19274/// # async fn dox() {
19275/// # use cloudidentity1::{CloudIdentity, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
19276///
19277/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
19278/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
19279/// #     .with_native_roots()
19280/// #     .unwrap()
19281/// #     .https_only()
19282/// #     .enable_http2()
19283/// #     .build();
19284///
19285/// # let executor = hyper_util::rt::TokioExecutor::new();
19286/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
19287/// #     secret,
19288/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
19289/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
19290/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
19291/// #     ),
19292/// # ).build().await.unwrap();
19293///
19294/// # let client = hyper_util::client::legacy::Client::builder(
19295/// #     hyper_util::rt::TokioExecutor::new()
19296/// # )
19297/// # .build(
19298/// #     hyper_rustls::HttpsConnectorBuilder::new()
19299/// #         .with_native_roots()
19300/// #         .unwrap()
19301/// #         .https_or_http()
19302/// #         .enable_http2()
19303/// #         .build()
19304/// # );
19305/// # let mut hub = CloudIdentity::new(client, auth);
19306/// // You can configure optional parameters by calling the respective setters at will, and
19307/// // execute the final call using `doit()`.
19308/// // Values shown here are possibly random and not representative !
19309/// let result = hub.inbound_saml_sso_profiles().idp_credentials_delete("name")
19310///              .doit().await;
19311/// # }
19312/// ```
19313pub struct InboundSamlSsoProfileIdpCredentialDeleteCall<'a, C>
19314where
19315    C: 'a,
19316{
19317    hub: &'a CloudIdentity<C>,
19318    _name: String,
19319    _delegate: Option<&'a mut dyn common::Delegate>,
19320    _additional_params: HashMap<String, String>,
19321    _scopes: BTreeSet<String>,
19322}
19323
19324impl<'a, C> common::CallBuilder for InboundSamlSsoProfileIdpCredentialDeleteCall<'a, C> {}
19325
19326impl<'a, C> InboundSamlSsoProfileIdpCredentialDeleteCall<'a, C>
19327where
19328    C: common::Connector,
19329{
19330    /// Perform the operation you have build so far.
19331    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
19332        use std::borrow::Cow;
19333        use std::io::{Read, Seek};
19334
19335        use common::{url::Params, ToParts};
19336        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
19337
19338        let mut dd = common::DefaultDelegate;
19339        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
19340        dlg.begin(common::MethodInfo {
19341            id: "cloudidentity.inboundSamlSsoProfiles.idpCredentials.delete",
19342            http_method: hyper::Method::DELETE,
19343        });
19344
19345        for &field in ["alt", "name"].iter() {
19346            if self._additional_params.contains_key(field) {
19347                dlg.finished(false);
19348                return Err(common::Error::FieldClash(field));
19349            }
19350        }
19351
19352        let mut params = Params::with_capacity(3 + self._additional_params.len());
19353        params.push("name", self._name);
19354
19355        params.extend(self._additional_params.iter());
19356
19357        params.push("alt", "json");
19358        let mut url = self.hub._base_url.clone() + "v1/{+name}";
19359        if self._scopes.is_empty() {
19360            self._scopes
19361                .insert(Scope::CloudPlatform.as_ref().to_string());
19362        }
19363
19364        #[allow(clippy::single_element_loop)]
19365        for &(find_this, param_name) in [("{+name}", "name")].iter() {
19366            url = params.uri_replacement(url, param_name, find_this, true);
19367        }
19368        {
19369            let to_remove = ["name"];
19370            params.remove_params(&to_remove);
19371        }
19372
19373        let url = params.parse_with_url(&url);
19374
19375        loop {
19376            let token = match self
19377                .hub
19378                .auth
19379                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
19380                .await
19381            {
19382                Ok(token) => token,
19383                Err(e) => match dlg.token(e) {
19384                    Ok(token) => token,
19385                    Err(e) => {
19386                        dlg.finished(false);
19387                        return Err(common::Error::MissingToken(e));
19388                    }
19389                },
19390            };
19391            let mut req_result = {
19392                let client = &self.hub.client;
19393                dlg.pre_request();
19394                let mut req_builder = hyper::Request::builder()
19395                    .method(hyper::Method::DELETE)
19396                    .uri(url.as_str())
19397                    .header(USER_AGENT, self.hub._user_agent.clone());
19398
19399                if let Some(token) = token.as_ref() {
19400                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
19401                }
19402
19403                let request = req_builder
19404                    .header(CONTENT_LENGTH, 0_u64)
19405                    .body(common::to_body::<String>(None));
19406
19407                client.request(request.unwrap()).await
19408            };
19409
19410            match req_result {
19411                Err(err) => {
19412                    if let common::Retry::After(d) = dlg.http_error(&err) {
19413                        sleep(d).await;
19414                        continue;
19415                    }
19416                    dlg.finished(false);
19417                    return Err(common::Error::HttpError(err));
19418                }
19419                Ok(res) => {
19420                    let (mut parts, body) = res.into_parts();
19421                    let mut body = common::Body::new(body);
19422                    if !parts.status.is_success() {
19423                        let bytes = common::to_bytes(body).await.unwrap_or_default();
19424                        let error = serde_json::from_str(&common::to_string(&bytes));
19425                        let response = common::to_response(parts, bytes.into());
19426
19427                        if let common::Retry::After(d) =
19428                            dlg.http_failure(&response, error.as_ref().ok())
19429                        {
19430                            sleep(d).await;
19431                            continue;
19432                        }
19433
19434                        dlg.finished(false);
19435
19436                        return Err(match error {
19437                            Ok(value) => common::Error::BadRequest(value),
19438                            _ => common::Error::Failure(response),
19439                        });
19440                    }
19441                    let response = {
19442                        let bytes = common::to_bytes(body).await.unwrap_or_default();
19443                        let encoded = common::to_string(&bytes);
19444                        match serde_json::from_str(&encoded) {
19445                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
19446                            Err(error) => {
19447                                dlg.response_json_decode_error(&encoded, &error);
19448                                return Err(common::Error::JsonDecodeError(
19449                                    encoded.to_string(),
19450                                    error,
19451                                ));
19452                            }
19453                        }
19454                    };
19455
19456                    dlg.finished(true);
19457                    return Ok(response);
19458                }
19459            }
19460        }
19461    }
19462
19463    /// Required. The [resource name](https://cloud.google.com/apis/design/resource_names) of the IdpCredential to delete. Format: `inboundSamlSsoProfiles/{sso_profile_id}/idpCredentials/{idp_credential_id}`
19464    ///
19465    /// Sets the *name* path property to the given value.
19466    ///
19467    /// Even though the property as already been set when instantiating this call,
19468    /// we provide this method for API completeness.
19469    pub fn name(mut self, new_value: &str) -> InboundSamlSsoProfileIdpCredentialDeleteCall<'a, C> {
19470        self._name = new_value.to_string();
19471        self
19472    }
19473    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
19474    /// while executing the actual API request.
19475    ///
19476    /// ````text
19477    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
19478    /// ````
19479    ///
19480    /// Sets the *delegate* property to the given value.
19481    pub fn delegate(
19482        mut self,
19483        new_value: &'a mut dyn common::Delegate,
19484    ) -> InboundSamlSsoProfileIdpCredentialDeleteCall<'a, C> {
19485        self._delegate = Some(new_value);
19486        self
19487    }
19488
19489    /// Set any additional parameter of the query string used in the request.
19490    /// It should be used to set parameters which are not yet available through their own
19491    /// setters.
19492    ///
19493    /// Please note that this method must not be used to set any of the known parameters
19494    /// which have their own setter method. If done anyway, the request will fail.
19495    ///
19496    /// # Additional Parameters
19497    ///
19498    /// * *$.xgafv* (query-string) - V1 error format.
19499    /// * *access_token* (query-string) - OAuth access token.
19500    /// * *alt* (query-string) - Data format for response.
19501    /// * *callback* (query-string) - JSONP
19502    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
19503    /// * *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.
19504    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
19505    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
19506    /// * *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.
19507    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
19508    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
19509    pub fn param<T>(
19510        mut self,
19511        name: T,
19512        value: T,
19513    ) -> InboundSamlSsoProfileIdpCredentialDeleteCall<'a, C>
19514    where
19515        T: AsRef<str>,
19516    {
19517        self._additional_params
19518            .insert(name.as_ref().to_string(), value.as_ref().to_string());
19519        self
19520    }
19521
19522    /// Identifies the authorization scope for the method you are building.
19523    ///
19524    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
19525    /// [`Scope::CloudPlatform`].
19526    ///
19527    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
19528    /// tokens for more than one scope.
19529    ///
19530    /// Usually there is more than one suitable scope to authorize an operation, some of which may
19531    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
19532    /// sufficient, a read-write scope will do as well.
19533    pub fn add_scope<St>(mut self, scope: St) -> InboundSamlSsoProfileIdpCredentialDeleteCall<'a, C>
19534    where
19535        St: AsRef<str>,
19536    {
19537        self._scopes.insert(String::from(scope.as_ref()));
19538        self
19539    }
19540    /// Identifies the authorization scope(s) for the method you are building.
19541    ///
19542    /// See [`Self::add_scope()`] for details.
19543    pub fn add_scopes<I, St>(
19544        mut self,
19545        scopes: I,
19546    ) -> InboundSamlSsoProfileIdpCredentialDeleteCall<'a, C>
19547    where
19548        I: IntoIterator<Item = St>,
19549        St: AsRef<str>,
19550    {
19551        self._scopes
19552            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
19553        self
19554    }
19555
19556    /// Removes all scopes, and no default scope will be used either.
19557    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
19558    /// for details).
19559    pub fn clear_scopes(mut self) -> InboundSamlSsoProfileIdpCredentialDeleteCall<'a, C> {
19560        self._scopes.clear();
19561        self
19562    }
19563}
19564
19565/// Gets an IdpCredential.
19566///
19567/// A builder for the *idpCredentials.get* method supported by a *inboundSamlSsoProfile* resource.
19568/// It is not used directly, but through a [`InboundSamlSsoProfileMethods`] instance.
19569///
19570/// # Example
19571///
19572/// Instantiate a resource method builder
19573///
19574/// ```test_harness,no_run
19575/// # extern crate hyper;
19576/// # extern crate hyper_rustls;
19577/// # extern crate google_cloudidentity1 as cloudidentity1;
19578/// # async fn dox() {
19579/// # use cloudidentity1::{CloudIdentity, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
19580///
19581/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
19582/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
19583/// #     .with_native_roots()
19584/// #     .unwrap()
19585/// #     .https_only()
19586/// #     .enable_http2()
19587/// #     .build();
19588///
19589/// # let executor = hyper_util::rt::TokioExecutor::new();
19590/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
19591/// #     secret,
19592/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
19593/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
19594/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
19595/// #     ),
19596/// # ).build().await.unwrap();
19597///
19598/// # let client = hyper_util::client::legacy::Client::builder(
19599/// #     hyper_util::rt::TokioExecutor::new()
19600/// # )
19601/// # .build(
19602/// #     hyper_rustls::HttpsConnectorBuilder::new()
19603/// #         .with_native_roots()
19604/// #         .unwrap()
19605/// #         .https_or_http()
19606/// #         .enable_http2()
19607/// #         .build()
19608/// # );
19609/// # let mut hub = CloudIdentity::new(client, auth);
19610/// // You can configure optional parameters by calling the respective setters at will, and
19611/// // execute the final call using `doit()`.
19612/// // Values shown here are possibly random and not representative !
19613/// let result = hub.inbound_saml_sso_profiles().idp_credentials_get("name")
19614///              .doit().await;
19615/// # }
19616/// ```
19617pub struct InboundSamlSsoProfileIdpCredentialGetCall<'a, C>
19618where
19619    C: 'a,
19620{
19621    hub: &'a CloudIdentity<C>,
19622    _name: String,
19623    _delegate: Option<&'a mut dyn common::Delegate>,
19624    _additional_params: HashMap<String, String>,
19625    _scopes: BTreeSet<String>,
19626}
19627
19628impl<'a, C> common::CallBuilder for InboundSamlSsoProfileIdpCredentialGetCall<'a, C> {}
19629
19630impl<'a, C> InboundSamlSsoProfileIdpCredentialGetCall<'a, C>
19631where
19632    C: common::Connector,
19633{
19634    /// Perform the operation you have build so far.
19635    pub async fn doit(mut self) -> common::Result<(common::Response, IdpCredential)> {
19636        use std::borrow::Cow;
19637        use std::io::{Read, Seek};
19638
19639        use common::{url::Params, ToParts};
19640        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
19641
19642        let mut dd = common::DefaultDelegate;
19643        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
19644        dlg.begin(common::MethodInfo {
19645            id: "cloudidentity.inboundSamlSsoProfiles.idpCredentials.get",
19646            http_method: hyper::Method::GET,
19647        });
19648
19649        for &field in ["alt", "name"].iter() {
19650            if self._additional_params.contains_key(field) {
19651                dlg.finished(false);
19652                return Err(common::Error::FieldClash(field));
19653            }
19654        }
19655
19656        let mut params = Params::with_capacity(3 + self._additional_params.len());
19657        params.push("name", self._name);
19658
19659        params.extend(self._additional_params.iter());
19660
19661        params.push("alt", "json");
19662        let mut url = self.hub._base_url.clone() + "v1/{+name}";
19663        if self._scopes.is_empty() {
19664            self._scopes
19665                .insert(Scope::CloudIdentityInboundssoReadonly.as_ref().to_string());
19666        }
19667
19668        #[allow(clippy::single_element_loop)]
19669        for &(find_this, param_name) in [("{+name}", "name")].iter() {
19670            url = params.uri_replacement(url, param_name, find_this, true);
19671        }
19672        {
19673            let to_remove = ["name"];
19674            params.remove_params(&to_remove);
19675        }
19676
19677        let url = params.parse_with_url(&url);
19678
19679        loop {
19680            let token = match self
19681                .hub
19682                .auth
19683                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
19684                .await
19685            {
19686                Ok(token) => token,
19687                Err(e) => match dlg.token(e) {
19688                    Ok(token) => token,
19689                    Err(e) => {
19690                        dlg.finished(false);
19691                        return Err(common::Error::MissingToken(e));
19692                    }
19693                },
19694            };
19695            let mut req_result = {
19696                let client = &self.hub.client;
19697                dlg.pre_request();
19698                let mut req_builder = hyper::Request::builder()
19699                    .method(hyper::Method::GET)
19700                    .uri(url.as_str())
19701                    .header(USER_AGENT, self.hub._user_agent.clone());
19702
19703                if let Some(token) = token.as_ref() {
19704                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
19705                }
19706
19707                let request = req_builder
19708                    .header(CONTENT_LENGTH, 0_u64)
19709                    .body(common::to_body::<String>(None));
19710
19711                client.request(request.unwrap()).await
19712            };
19713
19714            match req_result {
19715                Err(err) => {
19716                    if let common::Retry::After(d) = dlg.http_error(&err) {
19717                        sleep(d).await;
19718                        continue;
19719                    }
19720                    dlg.finished(false);
19721                    return Err(common::Error::HttpError(err));
19722                }
19723                Ok(res) => {
19724                    let (mut parts, body) = res.into_parts();
19725                    let mut body = common::Body::new(body);
19726                    if !parts.status.is_success() {
19727                        let bytes = common::to_bytes(body).await.unwrap_or_default();
19728                        let error = serde_json::from_str(&common::to_string(&bytes));
19729                        let response = common::to_response(parts, bytes.into());
19730
19731                        if let common::Retry::After(d) =
19732                            dlg.http_failure(&response, error.as_ref().ok())
19733                        {
19734                            sleep(d).await;
19735                            continue;
19736                        }
19737
19738                        dlg.finished(false);
19739
19740                        return Err(match error {
19741                            Ok(value) => common::Error::BadRequest(value),
19742                            _ => common::Error::Failure(response),
19743                        });
19744                    }
19745                    let response = {
19746                        let bytes = common::to_bytes(body).await.unwrap_or_default();
19747                        let encoded = common::to_string(&bytes);
19748                        match serde_json::from_str(&encoded) {
19749                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
19750                            Err(error) => {
19751                                dlg.response_json_decode_error(&encoded, &error);
19752                                return Err(common::Error::JsonDecodeError(
19753                                    encoded.to_string(),
19754                                    error,
19755                                ));
19756                            }
19757                        }
19758                    };
19759
19760                    dlg.finished(true);
19761                    return Ok(response);
19762                }
19763            }
19764        }
19765    }
19766
19767    /// Required. The [resource name](https://cloud.google.com/apis/design/resource_names) of the IdpCredential to retrieve. Format: `inboundSamlSsoProfiles/{sso_profile_id}/idpCredentials/{idp_credential_id}`
19768    ///
19769    /// Sets the *name* path property to the given value.
19770    ///
19771    /// Even though the property as already been set when instantiating this call,
19772    /// we provide this method for API completeness.
19773    pub fn name(mut self, new_value: &str) -> InboundSamlSsoProfileIdpCredentialGetCall<'a, C> {
19774        self._name = new_value.to_string();
19775        self
19776    }
19777    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
19778    /// while executing the actual API request.
19779    ///
19780    /// ````text
19781    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
19782    /// ````
19783    ///
19784    /// Sets the *delegate* property to the given value.
19785    pub fn delegate(
19786        mut self,
19787        new_value: &'a mut dyn common::Delegate,
19788    ) -> InboundSamlSsoProfileIdpCredentialGetCall<'a, C> {
19789        self._delegate = Some(new_value);
19790        self
19791    }
19792
19793    /// Set any additional parameter of the query string used in the request.
19794    /// It should be used to set parameters which are not yet available through their own
19795    /// setters.
19796    ///
19797    /// Please note that this method must not be used to set any of the known parameters
19798    /// which have their own setter method. If done anyway, the request will fail.
19799    ///
19800    /// # Additional Parameters
19801    ///
19802    /// * *$.xgafv* (query-string) - V1 error format.
19803    /// * *access_token* (query-string) - OAuth access token.
19804    /// * *alt* (query-string) - Data format for response.
19805    /// * *callback* (query-string) - JSONP
19806    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
19807    /// * *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.
19808    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
19809    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
19810    /// * *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.
19811    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
19812    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
19813    pub fn param<T>(mut self, name: T, value: T) -> InboundSamlSsoProfileIdpCredentialGetCall<'a, C>
19814    where
19815        T: AsRef<str>,
19816    {
19817        self._additional_params
19818            .insert(name.as_ref().to_string(), value.as_ref().to_string());
19819        self
19820    }
19821
19822    /// Identifies the authorization scope for the method you are building.
19823    ///
19824    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
19825    /// [`Scope::CloudIdentityInboundssoReadonly`].
19826    ///
19827    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
19828    /// tokens for more than one scope.
19829    ///
19830    /// Usually there is more than one suitable scope to authorize an operation, some of which may
19831    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
19832    /// sufficient, a read-write scope will do as well.
19833    pub fn add_scope<St>(mut self, scope: St) -> InboundSamlSsoProfileIdpCredentialGetCall<'a, C>
19834    where
19835        St: AsRef<str>,
19836    {
19837        self._scopes.insert(String::from(scope.as_ref()));
19838        self
19839    }
19840    /// Identifies the authorization scope(s) for the method you are building.
19841    ///
19842    /// See [`Self::add_scope()`] for details.
19843    pub fn add_scopes<I, St>(
19844        mut self,
19845        scopes: I,
19846    ) -> InboundSamlSsoProfileIdpCredentialGetCall<'a, C>
19847    where
19848        I: IntoIterator<Item = St>,
19849        St: AsRef<str>,
19850    {
19851        self._scopes
19852            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
19853        self
19854    }
19855
19856    /// Removes all scopes, and no default scope will be used either.
19857    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
19858    /// for details).
19859    pub fn clear_scopes(mut self) -> InboundSamlSsoProfileIdpCredentialGetCall<'a, C> {
19860        self._scopes.clear();
19861        self
19862    }
19863}
19864
19865/// Returns a list of IdpCredentials in an InboundSamlSsoProfile.
19866///
19867/// A builder for the *idpCredentials.list* method supported by a *inboundSamlSsoProfile* resource.
19868/// It is not used directly, but through a [`InboundSamlSsoProfileMethods`] instance.
19869///
19870/// # Example
19871///
19872/// Instantiate a resource method builder
19873///
19874/// ```test_harness,no_run
19875/// # extern crate hyper;
19876/// # extern crate hyper_rustls;
19877/// # extern crate google_cloudidentity1 as cloudidentity1;
19878/// # async fn dox() {
19879/// # use cloudidentity1::{CloudIdentity, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
19880///
19881/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
19882/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
19883/// #     .with_native_roots()
19884/// #     .unwrap()
19885/// #     .https_only()
19886/// #     .enable_http2()
19887/// #     .build();
19888///
19889/// # let executor = hyper_util::rt::TokioExecutor::new();
19890/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
19891/// #     secret,
19892/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
19893/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
19894/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
19895/// #     ),
19896/// # ).build().await.unwrap();
19897///
19898/// # let client = hyper_util::client::legacy::Client::builder(
19899/// #     hyper_util::rt::TokioExecutor::new()
19900/// # )
19901/// # .build(
19902/// #     hyper_rustls::HttpsConnectorBuilder::new()
19903/// #         .with_native_roots()
19904/// #         .unwrap()
19905/// #         .https_or_http()
19906/// #         .enable_http2()
19907/// #         .build()
19908/// # );
19909/// # let mut hub = CloudIdentity::new(client, auth);
19910/// // You can configure optional parameters by calling the respective setters at will, and
19911/// // execute the final call using `doit()`.
19912/// // Values shown here are possibly random and not representative !
19913/// let result = hub.inbound_saml_sso_profiles().idp_credentials_list("parent")
19914///              .page_token("sed")
19915///              .page_size(-29)
19916///              .doit().await;
19917/// # }
19918/// ```
19919pub struct InboundSamlSsoProfileIdpCredentialListCall<'a, C>
19920where
19921    C: 'a,
19922{
19923    hub: &'a CloudIdentity<C>,
19924    _parent: String,
19925    _page_token: Option<String>,
19926    _page_size: Option<i32>,
19927    _delegate: Option<&'a mut dyn common::Delegate>,
19928    _additional_params: HashMap<String, String>,
19929    _scopes: BTreeSet<String>,
19930}
19931
19932impl<'a, C> common::CallBuilder for InboundSamlSsoProfileIdpCredentialListCall<'a, C> {}
19933
19934impl<'a, C> InboundSamlSsoProfileIdpCredentialListCall<'a, C>
19935where
19936    C: common::Connector,
19937{
19938    /// Perform the operation you have build so far.
19939    pub async fn doit(mut self) -> common::Result<(common::Response, ListIdpCredentialsResponse)> {
19940        use std::borrow::Cow;
19941        use std::io::{Read, Seek};
19942
19943        use common::{url::Params, ToParts};
19944        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
19945
19946        let mut dd = common::DefaultDelegate;
19947        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
19948        dlg.begin(common::MethodInfo {
19949            id: "cloudidentity.inboundSamlSsoProfiles.idpCredentials.list",
19950            http_method: hyper::Method::GET,
19951        });
19952
19953        for &field in ["alt", "parent", "pageToken", "pageSize"].iter() {
19954            if self._additional_params.contains_key(field) {
19955                dlg.finished(false);
19956                return Err(common::Error::FieldClash(field));
19957            }
19958        }
19959
19960        let mut params = Params::with_capacity(5 + self._additional_params.len());
19961        params.push("parent", self._parent);
19962        if let Some(value) = self._page_token.as_ref() {
19963            params.push("pageToken", value);
19964        }
19965        if let Some(value) = self._page_size.as_ref() {
19966            params.push("pageSize", value.to_string());
19967        }
19968
19969        params.extend(self._additional_params.iter());
19970
19971        params.push("alt", "json");
19972        let mut url = self.hub._base_url.clone() + "v1/{+parent}/idpCredentials";
19973        if self._scopes.is_empty() {
19974            self._scopes
19975                .insert(Scope::CloudIdentityInboundssoReadonly.as_ref().to_string());
19976        }
19977
19978        #[allow(clippy::single_element_loop)]
19979        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
19980            url = params.uri_replacement(url, param_name, find_this, true);
19981        }
19982        {
19983            let to_remove = ["parent"];
19984            params.remove_params(&to_remove);
19985        }
19986
19987        let url = params.parse_with_url(&url);
19988
19989        loop {
19990            let token = match self
19991                .hub
19992                .auth
19993                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
19994                .await
19995            {
19996                Ok(token) => token,
19997                Err(e) => match dlg.token(e) {
19998                    Ok(token) => token,
19999                    Err(e) => {
20000                        dlg.finished(false);
20001                        return Err(common::Error::MissingToken(e));
20002                    }
20003                },
20004            };
20005            let mut req_result = {
20006                let client = &self.hub.client;
20007                dlg.pre_request();
20008                let mut req_builder = hyper::Request::builder()
20009                    .method(hyper::Method::GET)
20010                    .uri(url.as_str())
20011                    .header(USER_AGENT, self.hub._user_agent.clone());
20012
20013                if let Some(token) = token.as_ref() {
20014                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
20015                }
20016
20017                let request = req_builder
20018                    .header(CONTENT_LENGTH, 0_u64)
20019                    .body(common::to_body::<String>(None));
20020
20021                client.request(request.unwrap()).await
20022            };
20023
20024            match req_result {
20025                Err(err) => {
20026                    if let common::Retry::After(d) = dlg.http_error(&err) {
20027                        sleep(d).await;
20028                        continue;
20029                    }
20030                    dlg.finished(false);
20031                    return Err(common::Error::HttpError(err));
20032                }
20033                Ok(res) => {
20034                    let (mut parts, body) = res.into_parts();
20035                    let mut body = common::Body::new(body);
20036                    if !parts.status.is_success() {
20037                        let bytes = common::to_bytes(body).await.unwrap_or_default();
20038                        let error = serde_json::from_str(&common::to_string(&bytes));
20039                        let response = common::to_response(parts, bytes.into());
20040
20041                        if let common::Retry::After(d) =
20042                            dlg.http_failure(&response, error.as_ref().ok())
20043                        {
20044                            sleep(d).await;
20045                            continue;
20046                        }
20047
20048                        dlg.finished(false);
20049
20050                        return Err(match error {
20051                            Ok(value) => common::Error::BadRequest(value),
20052                            _ => common::Error::Failure(response),
20053                        });
20054                    }
20055                    let response = {
20056                        let bytes = common::to_bytes(body).await.unwrap_or_default();
20057                        let encoded = common::to_string(&bytes);
20058                        match serde_json::from_str(&encoded) {
20059                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
20060                            Err(error) => {
20061                                dlg.response_json_decode_error(&encoded, &error);
20062                                return Err(common::Error::JsonDecodeError(
20063                                    encoded.to_string(),
20064                                    error,
20065                                ));
20066                            }
20067                        }
20068                    };
20069
20070                    dlg.finished(true);
20071                    return Ok(response);
20072                }
20073            }
20074        }
20075    }
20076
20077    /// Required. The parent, which owns this collection of `IdpCredential`s. Format: `inboundSamlSsoProfiles/{sso_profile_id}`
20078    ///
20079    /// Sets the *parent* path property to the given value.
20080    ///
20081    /// Even though the property as already been set when instantiating this call,
20082    /// we provide this method for API completeness.
20083    pub fn parent(mut self, new_value: &str) -> InboundSamlSsoProfileIdpCredentialListCall<'a, C> {
20084        self._parent = new_value.to_string();
20085        self
20086    }
20087    /// A page token, received from a previous `ListIdpCredentials` call. Provide this to retrieve the subsequent page. When paginating, all other parameters provided to `ListIdpCredentials` must match the call that provided the page token.
20088    ///
20089    /// Sets the *page token* query property to the given value.
20090    pub fn page_token(
20091        mut self,
20092        new_value: &str,
20093    ) -> InboundSamlSsoProfileIdpCredentialListCall<'a, C> {
20094        self._page_token = Some(new_value.to_string());
20095        self
20096    }
20097    /// The maximum number of `IdpCredential`s to return. The service may return fewer than this value.
20098    ///
20099    /// Sets the *page size* query property to the given value.
20100    pub fn page_size(
20101        mut self,
20102        new_value: i32,
20103    ) -> InboundSamlSsoProfileIdpCredentialListCall<'a, C> {
20104        self._page_size = Some(new_value);
20105        self
20106    }
20107    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
20108    /// while executing the actual API request.
20109    ///
20110    /// ````text
20111    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
20112    /// ````
20113    ///
20114    /// Sets the *delegate* property to the given value.
20115    pub fn delegate(
20116        mut self,
20117        new_value: &'a mut dyn common::Delegate,
20118    ) -> InboundSamlSsoProfileIdpCredentialListCall<'a, C> {
20119        self._delegate = Some(new_value);
20120        self
20121    }
20122
20123    /// Set any additional parameter of the query string used in the request.
20124    /// It should be used to set parameters which are not yet available through their own
20125    /// setters.
20126    ///
20127    /// Please note that this method must not be used to set any of the known parameters
20128    /// which have their own setter method. If done anyway, the request will fail.
20129    ///
20130    /// # Additional Parameters
20131    ///
20132    /// * *$.xgafv* (query-string) - V1 error format.
20133    /// * *access_token* (query-string) - OAuth access token.
20134    /// * *alt* (query-string) - Data format for response.
20135    /// * *callback* (query-string) - JSONP
20136    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
20137    /// * *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.
20138    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
20139    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
20140    /// * *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.
20141    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
20142    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
20143    pub fn param<T>(
20144        mut self,
20145        name: T,
20146        value: T,
20147    ) -> InboundSamlSsoProfileIdpCredentialListCall<'a, C>
20148    where
20149        T: AsRef<str>,
20150    {
20151        self._additional_params
20152            .insert(name.as_ref().to_string(), value.as_ref().to_string());
20153        self
20154    }
20155
20156    /// Identifies the authorization scope for the method you are building.
20157    ///
20158    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
20159    /// [`Scope::CloudIdentityInboundssoReadonly`].
20160    ///
20161    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
20162    /// tokens for more than one scope.
20163    ///
20164    /// Usually there is more than one suitable scope to authorize an operation, some of which may
20165    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
20166    /// sufficient, a read-write scope will do as well.
20167    pub fn add_scope<St>(mut self, scope: St) -> InboundSamlSsoProfileIdpCredentialListCall<'a, C>
20168    where
20169        St: AsRef<str>,
20170    {
20171        self._scopes.insert(String::from(scope.as_ref()));
20172        self
20173    }
20174    /// Identifies the authorization scope(s) for the method you are building.
20175    ///
20176    /// See [`Self::add_scope()`] for details.
20177    pub fn add_scopes<I, St>(
20178        mut self,
20179        scopes: I,
20180    ) -> InboundSamlSsoProfileIdpCredentialListCall<'a, C>
20181    where
20182        I: IntoIterator<Item = St>,
20183        St: AsRef<str>,
20184    {
20185        self._scopes
20186            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
20187        self
20188    }
20189
20190    /// Removes all scopes, and no default scope will be used either.
20191    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
20192    /// for details).
20193    pub fn clear_scopes(mut self) -> InboundSamlSsoProfileIdpCredentialListCall<'a, C> {
20194        self._scopes.clear();
20195        self
20196    }
20197}
20198
20199/// Creates an InboundSamlSsoProfile for a customer. When the target customer has enabled [Multi-party approval for sensitive actions](https://support.google.com/a/answer/13790448), the `Operation` in the response will have `"done": false`, it will not have a response, and the metadata will have `"state": "awaiting-multi-party-approval"`.
20200///
20201/// A builder for the *create* method supported by a *inboundSamlSsoProfile* resource.
20202/// It is not used directly, but through a [`InboundSamlSsoProfileMethods`] instance.
20203///
20204/// # Example
20205///
20206/// Instantiate a resource method builder
20207///
20208/// ```test_harness,no_run
20209/// # extern crate hyper;
20210/// # extern crate hyper_rustls;
20211/// # extern crate google_cloudidentity1 as cloudidentity1;
20212/// use cloudidentity1::api::InboundSamlSsoProfile;
20213/// # async fn dox() {
20214/// # use cloudidentity1::{CloudIdentity, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
20215///
20216/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
20217/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
20218/// #     .with_native_roots()
20219/// #     .unwrap()
20220/// #     .https_only()
20221/// #     .enable_http2()
20222/// #     .build();
20223///
20224/// # let executor = hyper_util::rt::TokioExecutor::new();
20225/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
20226/// #     secret,
20227/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
20228/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
20229/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
20230/// #     ),
20231/// # ).build().await.unwrap();
20232///
20233/// # let client = hyper_util::client::legacy::Client::builder(
20234/// #     hyper_util::rt::TokioExecutor::new()
20235/// # )
20236/// # .build(
20237/// #     hyper_rustls::HttpsConnectorBuilder::new()
20238/// #         .with_native_roots()
20239/// #         .unwrap()
20240/// #         .https_or_http()
20241/// #         .enable_http2()
20242/// #         .build()
20243/// # );
20244/// # let mut hub = CloudIdentity::new(client, auth);
20245/// // As the method needs a request, you would usually fill it with the desired information
20246/// // into the respective structure. Some of the parts shown here might not be applicable !
20247/// // Values shown here are possibly random and not representative !
20248/// let mut req = InboundSamlSsoProfile::default();
20249///
20250/// // You can configure optional parameters by calling the respective setters at will, and
20251/// // execute the final call using `doit()`.
20252/// // Values shown here are possibly random and not representative !
20253/// let result = hub.inbound_saml_sso_profiles().create(req)
20254///              .doit().await;
20255/// # }
20256/// ```
20257pub struct InboundSamlSsoProfileCreateCall<'a, C>
20258where
20259    C: 'a,
20260{
20261    hub: &'a CloudIdentity<C>,
20262    _request: InboundSamlSsoProfile,
20263    _delegate: Option<&'a mut dyn common::Delegate>,
20264    _additional_params: HashMap<String, String>,
20265    _scopes: BTreeSet<String>,
20266}
20267
20268impl<'a, C> common::CallBuilder for InboundSamlSsoProfileCreateCall<'a, C> {}
20269
20270impl<'a, C> InboundSamlSsoProfileCreateCall<'a, C>
20271where
20272    C: common::Connector,
20273{
20274    /// Perform the operation you have build so far.
20275    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
20276        use std::borrow::Cow;
20277        use std::io::{Read, Seek};
20278
20279        use common::{url::Params, ToParts};
20280        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
20281
20282        let mut dd = common::DefaultDelegate;
20283        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
20284        dlg.begin(common::MethodInfo {
20285            id: "cloudidentity.inboundSamlSsoProfiles.create",
20286            http_method: hyper::Method::POST,
20287        });
20288
20289        for &field in ["alt"].iter() {
20290            if self._additional_params.contains_key(field) {
20291                dlg.finished(false);
20292                return Err(common::Error::FieldClash(field));
20293            }
20294        }
20295
20296        let mut params = Params::with_capacity(3 + self._additional_params.len());
20297
20298        params.extend(self._additional_params.iter());
20299
20300        params.push("alt", "json");
20301        let mut url = self.hub._base_url.clone() + "v1/inboundSamlSsoProfiles";
20302        if self._scopes.is_empty() {
20303            self._scopes
20304                .insert(Scope::CloudPlatform.as_ref().to_string());
20305        }
20306
20307        let url = params.parse_with_url(&url);
20308
20309        let mut json_mime_type = mime::APPLICATION_JSON;
20310        let mut request_value_reader = {
20311            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
20312            common::remove_json_null_values(&mut value);
20313            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
20314            serde_json::to_writer(&mut dst, &value).unwrap();
20315            dst
20316        };
20317        let request_size = request_value_reader
20318            .seek(std::io::SeekFrom::End(0))
20319            .unwrap();
20320        request_value_reader
20321            .seek(std::io::SeekFrom::Start(0))
20322            .unwrap();
20323
20324        loop {
20325            let token = match self
20326                .hub
20327                .auth
20328                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
20329                .await
20330            {
20331                Ok(token) => token,
20332                Err(e) => match dlg.token(e) {
20333                    Ok(token) => token,
20334                    Err(e) => {
20335                        dlg.finished(false);
20336                        return Err(common::Error::MissingToken(e));
20337                    }
20338                },
20339            };
20340            request_value_reader
20341                .seek(std::io::SeekFrom::Start(0))
20342                .unwrap();
20343            let mut req_result = {
20344                let client = &self.hub.client;
20345                dlg.pre_request();
20346                let mut req_builder = hyper::Request::builder()
20347                    .method(hyper::Method::POST)
20348                    .uri(url.as_str())
20349                    .header(USER_AGENT, self.hub._user_agent.clone());
20350
20351                if let Some(token) = token.as_ref() {
20352                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
20353                }
20354
20355                let request = req_builder
20356                    .header(CONTENT_TYPE, json_mime_type.to_string())
20357                    .header(CONTENT_LENGTH, request_size as u64)
20358                    .body(common::to_body(
20359                        request_value_reader.get_ref().clone().into(),
20360                    ));
20361
20362                client.request(request.unwrap()).await
20363            };
20364
20365            match req_result {
20366                Err(err) => {
20367                    if let common::Retry::After(d) = dlg.http_error(&err) {
20368                        sleep(d).await;
20369                        continue;
20370                    }
20371                    dlg.finished(false);
20372                    return Err(common::Error::HttpError(err));
20373                }
20374                Ok(res) => {
20375                    let (mut parts, body) = res.into_parts();
20376                    let mut body = common::Body::new(body);
20377                    if !parts.status.is_success() {
20378                        let bytes = common::to_bytes(body).await.unwrap_or_default();
20379                        let error = serde_json::from_str(&common::to_string(&bytes));
20380                        let response = common::to_response(parts, bytes.into());
20381
20382                        if let common::Retry::After(d) =
20383                            dlg.http_failure(&response, error.as_ref().ok())
20384                        {
20385                            sleep(d).await;
20386                            continue;
20387                        }
20388
20389                        dlg.finished(false);
20390
20391                        return Err(match error {
20392                            Ok(value) => common::Error::BadRequest(value),
20393                            _ => common::Error::Failure(response),
20394                        });
20395                    }
20396                    let response = {
20397                        let bytes = common::to_bytes(body).await.unwrap_or_default();
20398                        let encoded = common::to_string(&bytes);
20399                        match serde_json::from_str(&encoded) {
20400                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
20401                            Err(error) => {
20402                                dlg.response_json_decode_error(&encoded, &error);
20403                                return Err(common::Error::JsonDecodeError(
20404                                    encoded.to_string(),
20405                                    error,
20406                                ));
20407                            }
20408                        }
20409                    };
20410
20411                    dlg.finished(true);
20412                    return Ok(response);
20413                }
20414            }
20415        }
20416    }
20417
20418    ///
20419    /// Sets the *request* property to the given value.
20420    ///
20421    /// Even though the property as already been set when instantiating this call,
20422    /// we provide this method for API completeness.
20423    pub fn request(
20424        mut self,
20425        new_value: InboundSamlSsoProfile,
20426    ) -> InboundSamlSsoProfileCreateCall<'a, C> {
20427        self._request = new_value;
20428        self
20429    }
20430    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
20431    /// while executing the actual API request.
20432    ///
20433    /// ````text
20434    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
20435    /// ````
20436    ///
20437    /// Sets the *delegate* property to the given value.
20438    pub fn delegate(
20439        mut self,
20440        new_value: &'a mut dyn common::Delegate,
20441    ) -> InboundSamlSsoProfileCreateCall<'a, C> {
20442        self._delegate = Some(new_value);
20443        self
20444    }
20445
20446    /// Set any additional parameter of the query string used in the request.
20447    /// It should be used to set parameters which are not yet available through their own
20448    /// setters.
20449    ///
20450    /// Please note that this method must not be used to set any of the known parameters
20451    /// which have their own setter method. If done anyway, the request will fail.
20452    ///
20453    /// # Additional Parameters
20454    ///
20455    /// * *$.xgafv* (query-string) - V1 error format.
20456    /// * *access_token* (query-string) - OAuth access token.
20457    /// * *alt* (query-string) - Data format for response.
20458    /// * *callback* (query-string) - JSONP
20459    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
20460    /// * *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.
20461    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
20462    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
20463    /// * *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.
20464    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
20465    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
20466    pub fn param<T>(mut self, name: T, value: T) -> InboundSamlSsoProfileCreateCall<'a, C>
20467    where
20468        T: AsRef<str>,
20469    {
20470        self._additional_params
20471            .insert(name.as_ref().to_string(), value.as_ref().to_string());
20472        self
20473    }
20474
20475    /// Identifies the authorization scope for the method you are building.
20476    ///
20477    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
20478    /// [`Scope::CloudPlatform`].
20479    ///
20480    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
20481    /// tokens for more than one scope.
20482    ///
20483    /// Usually there is more than one suitable scope to authorize an operation, some of which may
20484    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
20485    /// sufficient, a read-write scope will do as well.
20486    pub fn add_scope<St>(mut self, scope: St) -> InboundSamlSsoProfileCreateCall<'a, C>
20487    where
20488        St: AsRef<str>,
20489    {
20490        self._scopes.insert(String::from(scope.as_ref()));
20491        self
20492    }
20493    /// Identifies the authorization scope(s) for the method you are building.
20494    ///
20495    /// See [`Self::add_scope()`] for details.
20496    pub fn add_scopes<I, St>(mut self, scopes: I) -> InboundSamlSsoProfileCreateCall<'a, C>
20497    where
20498        I: IntoIterator<Item = St>,
20499        St: AsRef<str>,
20500    {
20501        self._scopes
20502            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
20503        self
20504    }
20505
20506    /// Removes all scopes, and no default scope will be used either.
20507    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
20508    /// for details).
20509    pub fn clear_scopes(mut self) -> InboundSamlSsoProfileCreateCall<'a, C> {
20510        self._scopes.clear();
20511        self
20512    }
20513}
20514
20515/// Deletes an InboundSamlSsoProfile.
20516///
20517/// A builder for the *delete* method supported by a *inboundSamlSsoProfile* resource.
20518/// It is not used directly, but through a [`InboundSamlSsoProfileMethods`] instance.
20519///
20520/// # Example
20521///
20522/// Instantiate a resource method builder
20523///
20524/// ```test_harness,no_run
20525/// # extern crate hyper;
20526/// # extern crate hyper_rustls;
20527/// # extern crate google_cloudidentity1 as cloudidentity1;
20528/// # async fn dox() {
20529/// # use cloudidentity1::{CloudIdentity, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
20530///
20531/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
20532/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
20533/// #     .with_native_roots()
20534/// #     .unwrap()
20535/// #     .https_only()
20536/// #     .enable_http2()
20537/// #     .build();
20538///
20539/// # let executor = hyper_util::rt::TokioExecutor::new();
20540/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
20541/// #     secret,
20542/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
20543/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
20544/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
20545/// #     ),
20546/// # ).build().await.unwrap();
20547///
20548/// # let client = hyper_util::client::legacy::Client::builder(
20549/// #     hyper_util::rt::TokioExecutor::new()
20550/// # )
20551/// # .build(
20552/// #     hyper_rustls::HttpsConnectorBuilder::new()
20553/// #         .with_native_roots()
20554/// #         .unwrap()
20555/// #         .https_or_http()
20556/// #         .enable_http2()
20557/// #         .build()
20558/// # );
20559/// # let mut hub = CloudIdentity::new(client, auth);
20560/// // You can configure optional parameters by calling the respective setters at will, and
20561/// // execute the final call using `doit()`.
20562/// // Values shown here are possibly random and not representative !
20563/// let result = hub.inbound_saml_sso_profiles().delete("name")
20564///              .doit().await;
20565/// # }
20566/// ```
20567pub struct InboundSamlSsoProfileDeleteCall<'a, C>
20568where
20569    C: 'a,
20570{
20571    hub: &'a CloudIdentity<C>,
20572    _name: String,
20573    _delegate: Option<&'a mut dyn common::Delegate>,
20574    _additional_params: HashMap<String, String>,
20575    _scopes: BTreeSet<String>,
20576}
20577
20578impl<'a, C> common::CallBuilder for InboundSamlSsoProfileDeleteCall<'a, C> {}
20579
20580impl<'a, C> InboundSamlSsoProfileDeleteCall<'a, C>
20581where
20582    C: common::Connector,
20583{
20584    /// Perform the operation you have build so far.
20585    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
20586        use std::borrow::Cow;
20587        use std::io::{Read, Seek};
20588
20589        use common::{url::Params, ToParts};
20590        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
20591
20592        let mut dd = common::DefaultDelegate;
20593        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
20594        dlg.begin(common::MethodInfo {
20595            id: "cloudidentity.inboundSamlSsoProfiles.delete",
20596            http_method: hyper::Method::DELETE,
20597        });
20598
20599        for &field in ["alt", "name"].iter() {
20600            if self._additional_params.contains_key(field) {
20601                dlg.finished(false);
20602                return Err(common::Error::FieldClash(field));
20603            }
20604        }
20605
20606        let mut params = Params::with_capacity(3 + self._additional_params.len());
20607        params.push("name", self._name);
20608
20609        params.extend(self._additional_params.iter());
20610
20611        params.push("alt", "json");
20612        let mut url = self.hub._base_url.clone() + "v1/{+name}";
20613        if self._scopes.is_empty() {
20614            self._scopes
20615                .insert(Scope::CloudPlatform.as_ref().to_string());
20616        }
20617
20618        #[allow(clippy::single_element_loop)]
20619        for &(find_this, param_name) in [("{+name}", "name")].iter() {
20620            url = params.uri_replacement(url, param_name, find_this, true);
20621        }
20622        {
20623            let to_remove = ["name"];
20624            params.remove_params(&to_remove);
20625        }
20626
20627        let url = params.parse_with_url(&url);
20628
20629        loop {
20630            let token = match self
20631                .hub
20632                .auth
20633                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
20634                .await
20635            {
20636                Ok(token) => token,
20637                Err(e) => match dlg.token(e) {
20638                    Ok(token) => token,
20639                    Err(e) => {
20640                        dlg.finished(false);
20641                        return Err(common::Error::MissingToken(e));
20642                    }
20643                },
20644            };
20645            let mut req_result = {
20646                let client = &self.hub.client;
20647                dlg.pre_request();
20648                let mut req_builder = hyper::Request::builder()
20649                    .method(hyper::Method::DELETE)
20650                    .uri(url.as_str())
20651                    .header(USER_AGENT, self.hub._user_agent.clone());
20652
20653                if let Some(token) = token.as_ref() {
20654                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
20655                }
20656
20657                let request = req_builder
20658                    .header(CONTENT_LENGTH, 0_u64)
20659                    .body(common::to_body::<String>(None));
20660
20661                client.request(request.unwrap()).await
20662            };
20663
20664            match req_result {
20665                Err(err) => {
20666                    if let common::Retry::After(d) = dlg.http_error(&err) {
20667                        sleep(d).await;
20668                        continue;
20669                    }
20670                    dlg.finished(false);
20671                    return Err(common::Error::HttpError(err));
20672                }
20673                Ok(res) => {
20674                    let (mut parts, body) = res.into_parts();
20675                    let mut body = common::Body::new(body);
20676                    if !parts.status.is_success() {
20677                        let bytes = common::to_bytes(body).await.unwrap_or_default();
20678                        let error = serde_json::from_str(&common::to_string(&bytes));
20679                        let response = common::to_response(parts, bytes.into());
20680
20681                        if let common::Retry::After(d) =
20682                            dlg.http_failure(&response, error.as_ref().ok())
20683                        {
20684                            sleep(d).await;
20685                            continue;
20686                        }
20687
20688                        dlg.finished(false);
20689
20690                        return Err(match error {
20691                            Ok(value) => common::Error::BadRequest(value),
20692                            _ => common::Error::Failure(response),
20693                        });
20694                    }
20695                    let response = {
20696                        let bytes = common::to_bytes(body).await.unwrap_or_default();
20697                        let encoded = common::to_string(&bytes);
20698                        match serde_json::from_str(&encoded) {
20699                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
20700                            Err(error) => {
20701                                dlg.response_json_decode_error(&encoded, &error);
20702                                return Err(common::Error::JsonDecodeError(
20703                                    encoded.to_string(),
20704                                    error,
20705                                ));
20706                            }
20707                        }
20708                    };
20709
20710                    dlg.finished(true);
20711                    return Ok(response);
20712                }
20713            }
20714        }
20715    }
20716
20717    /// Required. The [resource name](https://cloud.google.com/apis/design/resource_names) of the InboundSamlSsoProfile to delete. Format: `inboundSamlSsoProfiles/{sso_profile_id}`
20718    ///
20719    /// Sets the *name* path property to the given value.
20720    ///
20721    /// Even though the property as already been set when instantiating this call,
20722    /// we provide this method for API completeness.
20723    pub fn name(mut self, new_value: &str) -> InboundSamlSsoProfileDeleteCall<'a, C> {
20724        self._name = new_value.to_string();
20725        self
20726    }
20727    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
20728    /// while executing the actual API request.
20729    ///
20730    /// ````text
20731    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
20732    /// ````
20733    ///
20734    /// Sets the *delegate* property to the given value.
20735    pub fn delegate(
20736        mut self,
20737        new_value: &'a mut dyn common::Delegate,
20738    ) -> InboundSamlSsoProfileDeleteCall<'a, C> {
20739        self._delegate = Some(new_value);
20740        self
20741    }
20742
20743    /// Set any additional parameter of the query string used in the request.
20744    /// It should be used to set parameters which are not yet available through their own
20745    /// setters.
20746    ///
20747    /// Please note that this method must not be used to set any of the known parameters
20748    /// which have their own setter method. If done anyway, the request will fail.
20749    ///
20750    /// # Additional Parameters
20751    ///
20752    /// * *$.xgafv* (query-string) - V1 error format.
20753    /// * *access_token* (query-string) - OAuth access token.
20754    /// * *alt* (query-string) - Data format for response.
20755    /// * *callback* (query-string) - JSONP
20756    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
20757    /// * *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.
20758    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
20759    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
20760    /// * *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.
20761    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
20762    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
20763    pub fn param<T>(mut self, name: T, value: T) -> InboundSamlSsoProfileDeleteCall<'a, C>
20764    where
20765        T: AsRef<str>,
20766    {
20767        self._additional_params
20768            .insert(name.as_ref().to_string(), value.as_ref().to_string());
20769        self
20770    }
20771
20772    /// Identifies the authorization scope for the method you are building.
20773    ///
20774    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
20775    /// [`Scope::CloudPlatform`].
20776    ///
20777    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
20778    /// tokens for more than one scope.
20779    ///
20780    /// Usually there is more than one suitable scope to authorize an operation, some of which may
20781    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
20782    /// sufficient, a read-write scope will do as well.
20783    pub fn add_scope<St>(mut self, scope: St) -> InboundSamlSsoProfileDeleteCall<'a, C>
20784    where
20785        St: AsRef<str>,
20786    {
20787        self._scopes.insert(String::from(scope.as_ref()));
20788        self
20789    }
20790    /// Identifies the authorization scope(s) for the method you are building.
20791    ///
20792    /// See [`Self::add_scope()`] for details.
20793    pub fn add_scopes<I, St>(mut self, scopes: I) -> InboundSamlSsoProfileDeleteCall<'a, C>
20794    where
20795        I: IntoIterator<Item = St>,
20796        St: AsRef<str>,
20797    {
20798        self._scopes
20799            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
20800        self
20801    }
20802
20803    /// Removes all scopes, and no default scope will be used either.
20804    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
20805    /// for details).
20806    pub fn clear_scopes(mut self) -> InboundSamlSsoProfileDeleteCall<'a, C> {
20807        self._scopes.clear();
20808        self
20809    }
20810}
20811
20812/// Gets an InboundSamlSsoProfile.
20813///
20814/// A builder for the *get* method supported by a *inboundSamlSsoProfile* resource.
20815/// It is not used directly, but through a [`InboundSamlSsoProfileMethods`] instance.
20816///
20817/// # Example
20818///
20819/// Instantiate a resource method builder
20820///
20821/// ```test_harness,no_run
20822/// # extern crate hyper;
20823/// # extern crate hyper_rustls;
20824/// # extern crate google_cloudidentity1 as cloudidentity1;
20825/// # async fn dox() {
20826/// # use cloudidentity1::{CloudIdentity, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
20827///
20828/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
20829/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
20830/// #     .with_native_roots()
20831/// #     .unwrap()
20832/// #     .https_only()
20833/// #     .enable_http2()
20834/// #     .build();
20835///
20836/// # let executor = hyper_util::rt::TokioExecutor::new();
20837/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
20838/// #     secret,
20839/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
20840/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
20841/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
20842/// #     ),
20843/// # ).build().await.unwrap();
20844///
20845/// # let client = hyper_util::client::legacy::Client::builder(
20846/// #     hyper_util::rt::TokioExecutor::new()
20847/// # )
20848/// # .build(
20849/// #     hyper_rustls::HttpsConnectorBuilder::new()
20850/// #         .with_native_roots()
20851/// #         .unwrap()
20852/// #         .https_or_http()
20853/// #         .enable_http2()
20854/// #         .build()
20855/// # );
20856/// # let mut hub = CloudIdentity::new(client, auth);
20857/// // You can configure optional parameters by calling the respective setters at will, and
20858/// // execute the final call using `doit()`.
20859/// // Values shown here are possibly random and not representative !
20860/// let result = hub.inbound_saml_sso_profiles().get("name")
20861///              .doit().await;
20862/// # }
20863/// ```
20864pub struct InboundSamlSsoProfileGetCall<'a, C>
20865where
20866    C: 'a,
20867{
20868    hub: &'a CloudIdentity<C>,
20869    _name: String,
20870    _delegate: Option<&'a mut dyn common::Delegate>,
20871    _additional_params: HashMap<String, String>,
20872    _scopes: BTreeSet<String>,
20873}
20874
20875impl<'a, C> common::CallBuilder for InboundSamlSsoProfileGetCall<'a, C> {}
20876
20877impl<'a, C> InboundSamlSsoProfileGetCall<'a, C>
20878where
20879    C: common::Connector,
20880{
20881    /// Perform the operation you have build so far.
20882    pub async fn doit(mut self) -> common::Result<(common::Response, InboundSamlSsoProfile)> {
20883        use std::borrow::Cow;
20884        use std::io::{Read, Seek};
20885
20886        use common::{url::Params, ToParts};
20887        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
20888
20889        let mut dd = common::DefaultDelegate;
20890        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
20891        dlg.begin(common::MethodInfo {
20892            id: "cloudidentity.inboundSamlSsoProfiles.get",
20893            http_method: hyper::Method::GET,
20894        });
20895
20896        for &field in ["alt", "name"].iter() {
20897            if self._additional_params.contains_key(field) {
20898                dlg.finished(false);
20899                return Err(common::Error::FieldClash(field));
20900            }
20901        }
20902
20903        let mut params = Params::with_capacity(3 + self._additional_params.len());
20904        params.push("name", self._name);
20905
20906        params.extend(self._additional_params.iter());
20907
20908        params.push("alt", "json");
20909        let mut url = self.hub._base_url.clone() + "v1/{+name}";
20910        if self._scopes.is_empty() {
20911            self._scopes
20912                .insert(Scope::CloudIdentityInboundssoReadonly.as_ref().to_string());
20913        }
20914
20915        #[allow(clippy::single_element_loop)]
20916        for &(find_this, param_name) in [("{+name}", "name")].iter() {
20917            url = params.uri_replacement(url, param_name, find_this, true);
20918        }
20919        {
20920            let to_remove = ["name"];
20921            params.remove_params(&to_remove);
20922        }
20923
20924        let url = params.parse_with_url(&url);
20925
20926        loop {
20927            let token = match self
20928                .hub
20929                .auth
20930                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
20931                .await
20932            {
20933                Ok(token) => token,
20934                Err(e) => match dlg.token(e) {
20935                    Ok(token) => token,
20936                    Err(e) => {
20937                        dlg.finished(false);
20938                        return Err(common::Error::MissingToken(e));
20939                    }
20940                },
20941            };
20942            let mut req_result = {
20943                let client = &self.hub.client;
20944                dlg.pre_request();
20945                let mut req_builder = hyper::Request::builder()
20946                    .method(hyper::Method::GET)
20947                    .uri(url.as_str())
20948                    .header(USER_AGENT, self.hub._user_agent.clone());
20949
20950                if let Some(token) = token.as_ref() {
20951                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
20952                }
20953
20954                let request = req_builder
20955                    .header(CONTENT_LENGTH, 0_u64)
20956                    .body(common::to_body::<String>(None));
20957
20958                client.request(request.unwrap()).await
20959            };
20960
20961            match req_result {
20962                Err(err) => {
20963                    if let common::Retry::After(d) = dlg.http_error(&err) {
20964                        sleep(d).await;
20965                        continue;
20966                    }
20967                    dlg.finished(false);
20968                    return Err(common::Error::HttpError(err));
20969                }
20970                Ok(res) => {
20971                    let (mut parts, body) = res.into_parts();
20972                    let mut body = common::Body::new(body);
20973                    if !parts.status.is_success() {
20974                        let bytes = common::to_bytes(body).await.unwrap_or_default();
20975                        let error = serde_json::from_str(&common::to_string(&bytes));
20976                        let response = common::to_response(parts, bytes.into());
20977
20978                        if let common::Retry::After(d) =
20979                            dlg.http_failure(&response, error.as_ref().ok())
20980                        {
20981                            sleep(d).await;
20982                            continue;
20983                        }
20984
20985                        dlg.finished(false);
20986
20987                        return Err(match error {
20988                            Ok(value) => common::Error::BadRequest(value),
20989                            _ => common::Error::Failure(response),
20990                        });
20991                    }
20992                    let response = {
20993                        let bytes = common::to_bytes(body).await.unwrap_or_default();
20994                        let encoded = common::to_string(&bytes);
20995                        match serde_json::from_str(&encoded) {
20996                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
20997                            Err(error) => {
20998                                dlg.response_json_decode_error(&encoded, &error);
20999                                return Err(common::Error::JsonDecodeError(
21000                                    encoded.to_string(),
21001                                    error,
21002                                ));
21003                            }
21004                        }
21005                    };
21006
21007                    dlg.finished(true);
21008                    return Ok(response);
21009                }
21010            }
21011        }
21012    }
21013
21014    /// Required. The [resource name](https://cloud.google.com/apis/design/resource_names) of the InboundSamlSsoProfile to get. Format: `inboundSamlSsoProfiles/{sso_profile_id}`
21015    ///
21016    /// Sets the *name* path property to the given value.
21017    ///
21018    /// Even though the property as already been set when instantiating this call,
21019    /// we provide this method for API completeness.
21020    pub fn name(mut self, new_value: &str) -> InboundSamlSsoProfileGetCall<'a, C> {
21021        self._name = new_value.to_string();
21022        self
21023    }
21024    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
21025    /// while executing the actual API request.
21026    ///
21027    /// ````text
21028    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
21029    /// ````
21030    ///
21031    /// Sets the *delegate* property to the given value.
21032    pub fn delegate(
21033        mut self,
21034        new_value: &'a mut dyn common::Delegate,
21035    ) -> InboundSamlSsoProfileGetCall<'a, C> {
21036        self._delegate = Some(new_value);
21037        self
21038    }
21039
21040    /// Set any additional parameter of the query string used in the request.
21041    /// It should be used to set parameters which are not yet available through their own
21042    /// setters.
21043    ///
21044    /// Please note that this method must not be used to set any of the known parameters
21045    /// which have their own setter method. If done anyway, the request will fail.
21046    ///
21047    /// # Additional Parameters
21048    ///
21049    /// * *$.xgafv* (query-string) - V1 error format.
21050    /// * *access_token* (query-string) - OAuth access token.
21051    /// * *alt* (query-string) - Data format for response.
21052    /// * *callback* (query-string) - JSONP
21053    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
21054    /// * *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.
21055    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
21056    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
21057    /// * *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.
21058    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
21059    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
21060    pub fn param<T>(mut self, name: T, value: T) -> InboundSamlSsoProfileGetCall<'a, C>
21061    where
21062        T: AsRef<str>,
21063    {
21064        self._additional_params
21065            .insert(name.as_ref().to_string(), value.as_ref().to_string());
21066        self
21067    }
21068
21069    /// Identifies the authorization scope for the method you are building.
21070    ///
21071    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
21072    /// [`Scope::CloudIdentityInboundssoReadonly`].
21073    ///
21074    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
21075    /// tokens for more than one scope.
21076    ///
21077    /// Usually there is more than one suitable scope to authorize an operation, some of which may
21078    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
21079    /// sufficient, a read-write scope will do as well.
21080    pub fn add_scope<St>(mut self, scope: St) -> InboundSamlSsoProfileGetCall<'a, C>
21081    where
21082        St: AsRef<str>,
21083    {
21084        self._scopes.insert(String::from(scope.as_ref()));
21085        self
21086    }
21087    /// Identifies the authorization scope(s) for the method you are building.
21088    ///
21089    /// See [`Self::add_scope()`] for details.
21090    pub fn add_scopes<I, St>(mut self, scopes: I) -> InboundSamlSsoProfileGetCall<'a, C>
21091    where
21092        I: IntoIterator<Item = St>,
21093        St: AsRef<str>,
21094    {
21095        self._scopes
21096            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
21097        self
21098    }
21099
21100    /// Removes all scopes, and no default scope will be used either.
21101    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
21102    /// for details).
21103    pub fn clear_scopes(mut self) -> InboundSamlSsoProfileGetCall<'a, C> {
21104        self._scopes.clear();
21105        self
21106    }
21107}
21108
21109/// Lists InboundSamlSsoProfiles for a customer.
21110///
21111/// A builder for the *list* method supported by a *inboundSamlSsoProfile* resource.
21112/// It is not used directly, but through a [`InboundSamlSsoProfileMethods`] instance.
21113///
21114/// # Example
21115///
21116/// Instantiate a resource method builder
21117///
21118/// ```test_harness,no_run
21119/// # extern crate hyper;
21120/// # extern crate hyper_rustls;
21121/// # extern crate google_cloudidentity1 as cloudidentity1;
21122/// # async fn dox() {
21123/// # use cloudidentity1::{CloudIdentity, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
21124///
21125/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
21126/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
21127/// #     .with_native_roots()
21128/// #     .unwrap()
21129/// #     .https_only()
21130/// #     .enable_http2()
21131/// #     .build();
21132///
21133/// # let executor = hyper_util::rt::TokioExecutor::new();
21134/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
21135/// #     secret,
21136/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
21137/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
21138/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
21139/// #     ),
21140/// # ).build().await.unwrap();
21141///
21142/// # let client = hyper_util::client::legacy::Client::builder(
21143/// #     hyper_util::rt::TokioExecutor::new()
21144/// # )
21145/// # .build(
21146/// #     hyper_rustls::HttpsConnectorBuilder::new()
21147/// #         .with_native_roots()
21148/// #         .unwrap()
21149/// #         .https_or_http()
21150/// #         .enable_http2()
21151/// #         .build()
21152/// # );
21153/// # let mut hub = CloudIdentity::new(client, auth);
21154/// // You can configure optional parameters by calling the respective setters at will, and
21155/// // execute the final call using `doit()`.
21156/// // Values shown here are possibly random and not representative !
21157/// let result = hub.inbound_saml_sso_profiles().list()
21158///              .page_token("et")
21159///              .page_size(-93)
21160///              .filter("no")
21161///              .doit().await;
21162/// # }
21163/// ```
21164pub struct InboundSamlSsoProfileListCall<'a, C>
21165where
21166    C: 'a,
21167{
21168    hub: &'a CloudIdentity<C>,
21169    _page_token: Option<String>,
21170    _page_size: Option<i32>,
21171    _filter: Option<String>,
21172    _delegate: Option<&'a mut dyn common::Delegate>,
21173    _additional_params: HashMap<String, String>,
21174    _scopes: BTreeSet<String>,
21175}
21176
21177impl<'a, C> common::CallBuilder for InboundSamlSsoProfileListCall<'a, C> {}
21178
21179impl<'a, C> InboundSamlSsoProfileListCall<'a, C>
21180where
21181    C: common::Connector,
21182{
21183    /// Perform the operation you have build so far.
21184    pub async fn doit(
21185        mut self,
21186    ) -> common::Result<(common::Response, ListInboundSamlSsoProfilesResponse)> {
21187        use std::borrow::Cow;
21188        use std::io::{Read, Seek};
21189
21190        use common::{url::Params, ToParts};
21191        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
21192
21193        let mut dd = common::DefaultDelegate;
21194        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
21195        dlg.begin(common::MethodInfo {
21196            id: "cloudidentity.inboundSamlSsoProfiles.list",
21197            http_method: hyper::Method::GET,
21198        });
21199
21200        for &field in ["alt", "pageToken", "pageSize", "filter"].iter() {
21201            if self._additional_params.contains_key(field) {
21202                dlg.finished(false);
21203                return Err(common::Error::FieldClash(field));
21204            }
21205        }
21206
21207        let mut params = Params::with_capacity(5 + self._additional_params.len());
21208        if let Some(value) = self._page_token.as_ref() {
21209            params.push("pageToken", value);
21210        }
21211        if let Some(value) = self._page_size.as_ref() {
21212            params.push("pageSize", value.to_string());
21213        }
21214        if let Some(value) = self._filter.as_ref() {
21215            params.push("filter", value);
21216        }
21217
21218        params.extend(self._additional_params.iter());
21219
21220        params.push("alt", "json");
21221        let mut url = self.hub._base_url.clone() + "v1/inboundSamlSsoProfiles";
21222        if self._scopes.is_empty() {
21223            self._scopes
21224                .insert(Scope::CloudIdentityInboundssoReadonly.as_ref().to_string());
21225        }
21226
21227        let url = params.parse_with_url(&url);
21228
21229        loop {
21230            let token = match self
21231                .hub
21232                .auth
21233                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
21234                .await
21235            {
21236                Ok(token) => token,
21237                Err(e) => match dlg.token(e) {
21238                    Ok(token) => token,
21239                    Err(e) => {
21240                        dlg.finished(false);
21241                        return Err(common::Error::MissingToken(e));
21242                    }
21243                },
21244            };
21245            let mut req_result = {
21246                let client = &self.hub.client;
21247                dlg.pre_request();
21248                let mut req_builder = hyper::Request::builder()
21249                    .method(hyper::Method::GET)
21250                    .uri(url.as_str())
21251                    .header(USER_AGENT, self.hub._user_agent.clone());
21252
21253                if let Some(token) = token.as_ref() {
21254                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
21255                }
21256
21257                let request = req_builder
21258                    .header(CONTENT_LENGTH, 0_u64)
21259                    .body(common::to_body::<String>(None));
21260
21261                client.request(request.unwrap()).await
21262            };
21263
21264            match req_result {
21265                Err(err) => {
21266                    if let common::Retry::After(d) = dlg.http_error(&err) {
21267                        sleep(d).await;
21268                        continue;
21269                    }
21270                    dlg.finished(false);
21271                    return Err(common::Error::HttpError(err));
21272                }
21273                Ok(res) => {
21274                    let (mut parts, body) = res.into_parts();
21275                    let mut body = common::Body::new(body);
21276                    if !parts.status.is_success() {
21277                        let bytes = common::to_bytes(body).await.unwrap_or_default();
21278                        let error = serde_json::from_str(&common::to_string(&bytes));
21279                        let response = common::to_response(parts, bytes.into());
21280
21281                        if let common::Retry::After(d) =
21282                            dlg.http_failure(&response, error.as_ref().ok())
21283                        {
21284                            sleep(d).await;
21285                            continue;
21286                        }
21287
21288                        dlg.finished(false);
21289
21290                        return Err(match error {
21291                            Ok(value) => common::Error::BadRequest(value),
21292                            _ => common::Error::Failure(response),
21293                        });
21294                    }
21295                    let response = {
21296                        let bytes = common::to_bytes(body).await.unwrap_or_default();
21297                        let encoded = common::to_string(&bytes);
21298                        match serde_json::from_str(&encoded) {
21299                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
21300                            Err(error) => {
21301                                dlg.response_json_decode_error(&encoded, &error);
21302                                return Err(common::Error::JsonDecodeError(
21303                                    encoded.to_string(),
21304                                    error,
21305                                ));
21306                            }
21307                        }
21308                    };
21309
21310                    dlg.finished(true);
21311                    return Ok(response);
21312                }
21313            }
21314        }
21315    }
21316
21317    /// A page token, received from a previous `ListInboundSamlSsoProfiles` call. Provide this to retrieve the subsequent page. When paginating, all other parameters provided to `ListInboundSamlSsoProfiles` must match the call that provided the page token.
21318    ///
21319    /// Sets the *page token* query property to the given value.
21320    pub fn page_token(mut self, new_value: &str) -> InboundSamlSsoProfileListCall<'a, C> {
21321        self._page_token = Some(new_value.to_string());
21322        self
21323    }
21324    /// The maximum number of InboundSamlSsoProfiles to return. The service may return fewer than this value. If omitted (or defaulted to zero) the server will use a sensible default. This default may change over time. The maximum allowed value is 100. Requests with page_size greater than that will be silently interpreted as having this maximum value.
21325    ///
21326    /// Sets the *page size* query property to the given value.
21327    pub fn page_size(mut self, new_value: i32) -> InboundSamlSsoProfileListCall<'a, C> {
21328        self._page_size = Some(new_value);
21329        self
21330    }
21331    /// A [Common Expression Language](https://github.com/google/cel-spec) expression to filter the results. The only supported filter is filtering by customer. For example: `customer=="customers/C0123abc"`. Omitting the filter or specifying a filter of `customer=="customers/my_customer"` will return the profiles for the customer that the caller (authenticated user) belongs to.
21332    ///
21333    /// Sets the *filter* query property to the given value.
21334    pub fn filter(mut self, new_value: &str) -> InboundSamlSsoProfileListCall<'a, C> {
21335        self._filter = Some(new_value.to_string());
21336        self
21337    }
21338    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
21339    /// while executing the actual API request.
21340    ///
21341    /// ````text
21342    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
21343    /// ````
21344    ///
21345    /// Sets the *delegate* property to the given value.
21346    pub fn delegate(
21347        mut self,
21348        new_value: &'a mut dyn common::Delegate,
21349    ) -> InboundSamlSsoProfileListCall<'a, C> {
21350        self._delegate = Some(new_value);
21351        self
21352    }
21353
21354    /// Set any additional parameter of the query string used in the request.
21355    /// It should be used to set parameters which are not yet available through their own
21356    /// setters.
21357    ///
21358    /// Please note that this method must not be used to set any of the known parameters
21359    /// which have their own setter method. If done anyway, the request will fail.
21360    ///
21361    /// # Additional Parameters
21362    ///
21363    /// * *$.xgafv* (query-string) - V1 error format.
21364    /// * *access_token* (query-string) - OAuth access token.
21365    /// * *alt* (query-string) - Data format for response.
21366    /// * *callback* (query-string) - JSONP
21367    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
21368    /// * *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.
21369    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
21370    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
21371    /// * *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.
21372    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
21373    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
21374    pub fn param<T>(mut self, name: T, value: T) -> InboundSamlSsoProfileListCall<'a, C>
21375    where
21376        T: AsRef<str>,
21377    {
21378        self._additional_params
21379            .insert(name.as_ref().to_string(), value.as_ref().to_string());
21380        self
21381    }
21382
21383    /// Identifies the authorization scope for the method you are building.
21384    ///
21385    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
21386    /// [`Scope::CloudIdentityInboundssoReadonly`].
21387    ///
21388    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
21389    /// tokens for more than one scope.
21390    ///
21391    /// Usually there is more than one suitable scope to authorize an operation, some of which may
21392    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
21393    /// sufficient, a read-write scope will do as well.
21394    pub fn add_scope<St>(mut self, scope: St) -> InboundSamlSsoProfileListCall<'a, C>
21395    where
21396        St: AsRef<str>,
21397    {
21398        self._scopes.insert(String::from(scope.as_ref()));
21399        self
21400    }
21401    /// Identifies the authorization scope(s) for the method you are building.
21402    ///
21403    /// See [`Self::add_scope()`] for details.
21404    pub fn add_scopes<I, St>(mut self, scopes: I) -> InboundSamlSsoProfileListCall<'a, C>
21405    where
21406        I: IntoIterator<Item = St>,
21407        St: AsRef<str>,
21408    {
21409        self._scopes
21410            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
21411        self
21412    }
21413
21414    /// Removes all scopes, and no default scope will be used either.
21415    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
21416    /// for details).
21417    pub fn clear_scopes(mut self) -> InboundSamlSsoProfileListCall<'a, C> {
21418        self._scopes.clear();
21419        self
21420    }
21421}
21422
21423/// Updates an InboundSamlSsoProfile. When the target customer has enabled [Multi-party approval for sensitive actions](https://support.google.com/a/answer/13790448), the `Operation` in the response will have `"done": false`, it will not have a response, and the metadata will have `"state": "awaiting-multi-party-approval"`.
21424///
21425/// A builder for the *patch* method supported by a *inboundSamlSsoProfile* resource.
21426/// It is not used directly, but through a [`InboundSamlSsoProfileMethods`] instance.
21427///
21428/// # Example
21429///
21430/// Instantiate a resource method builder
21431///
21432/// ```test_harness,no_run
21433/// # extern crate hyper;
21434/// # extern crate hyper_rustls;
21435/// # extern crate google_cloudidentity1 as cloudidentity1;
21436/// use cloudidentity1::api::InboundSamlSsoProfile;
21437/// # async fn dox() {
21438/// # use cloudidentity1::{CloudIdentity, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
21439///
21440/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
21441/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
21442/// #     .with_native_roots()
21443/// #     .unwrap()
21444/// #     .https_only()
21445/// #     .enable_http2()
21446/// #     .build();
21447///
21448/// # let executor = hyper_util::rt::TokioExecutor::new();
21449/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
21450/// #     secret,
21451/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
21452/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
21453/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
21454/// #     ),
21455/// # ).build().await.unwrap();
21456///
21457/// # let client = hyper_util::client::legacy::Client::builder(
21458/// #     hyper_util::rt::TokioExecutor::new()
21459/// # )
21460/// # .build(
21461/// #     hyper_rustls::HttpsConnectorBuilder::new()
21462/// #         .with_native_roots()
21463/// #         .unwrap()
21464/// #         .https_or_http()
21465/// #         .enable_http2()
21466/// #         .build()
21467/// # );
21468/// # let mut hub = CloudIdentity::new(client, auth);
21469/// // As the method needs a request, you would usually fill it with the desired information
21470/// // into the respective structure. Some of the parts shown here might not be applicable !
21471/// // Values shown here are possibly random and not representative !
21472/// let mut req = InboundSamlSsoProfile::default();
21473///
21474/// // You can configure optional parameters by calling the respective setters at will, and
21475/// // execute the final call using `doit()`.
21476/// // Values shown here are possibly random and not representative !
21477/// let result = hub.inbound_saml_sso_profiles().patch(req, "name")
21478///              .update_mask(FieldMask::new::<&str>(&[]))
21479///              .doit().await;
21480/// # }
21481/// ```
21482pub struct InboundSamlSsoProfilePatchCall<'a, C>
21483where
21484    C: 'a,
21485{
21486    hub: &'a CloudIdentity<C>,
21487    _request: InboundSamlSsoProfile,
21488    _name: String,
21489    _update_mask: Option<common::FieldMask>,
21490    _delegate: Option<&'a mut dyn common::Delegate>,
21491    _additional_params: HashMap<String, String>,
21492    _scopes: BTreeSet<String>,
21493}
21494
21495impl<'a, C> common::CallBuilder for InboundSamlSsoProfilePatchCall<'a, C> {}
21496
21497impl<'a, C> InboundSamlSsoProfilePatchCall<'a, C>
21498where
21499    C: common::Connector,
21500{
21501    /// Perform the operation you have build so far.
21502    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
21503        use std::borrow::Cow;
21504        use std::io::{Read, Seek};
21505
21506        use common::{url::Params, ToParts};
21507        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
21508
21509        let mut dd = common::DefaultDelegate;
21510        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
21511        dlg.begin(common::MethodInfo {
21512            id: "cloudidentity.inboundSamlSsoProfiles.patch",
21513            http_method: hyper::Method::PATCH,
21514        });
21515
21516        for &field in ["alt", "name", "updateMask"].iter() {
21517            if self._additional_params.contains_key(field) {
21518                dlg.finished(false);
21519                return Err(common::Error::FieldClash(field));
21520            }
21521        }
21522
21523        let mut params = Params::with_capacity(5 + self._additional_params.len());
21524        params.push("name", self._name);
21525        if let Some(value) = self._update_mask.as_ref() {
21526            params.push("updateMask", value.to_string());
21527        }
21528
21529        params.extend(self._additional_params.iter());
21530
21531        params.push("alt", "json");
21532        let mut url = self.hub._base_url.clone() + "v1/{+name}";
21533        if self._scopes.is_empty() {
21534            self._scopes
21535                .insert(Scope::CloudPlatform.as_ref().to_string());
21536        }
21537
21538        #[allow(clippy::single_element_loop)]
21539        for &(find_this, param_name) in [("{+name}", "name")].iter() {
21540            url = params.uri_replacement(url, param_name, find_this, true);
21541        }
21542        {
21543            let to_remove = ["name"];
21544            params.remove_params(&to_remove);
21545        }
21546
21547        let url = params.parse_with_url(&url);
21548
21549        let mut json_mime_type = mime::APPLICATION_JSON;
21550        let mut request_value_reader = {
21551            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
21552            common::remove_json_null_values(&mut value);
21553            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
21554            serde_json::to_writer(&mut dst, &value).unwrap();
21555            dst
21556        };
21557        let request_size = request_value_reader
21558            .seek(std::io::SeekFrom::End(0))
21559            .unwrap();
21560        request_value_reader
21561            .seek(std::io::SeekFrom::Start(0))
21562            .unwrap();
21563
21564        loop {
21565            let token = match self
21566                .hub
21567                .auth
21568                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
21569                .await
21570            {
21571                Ok(token) => token,
21572                Err(e) => match dlg.token(e) {
21573                    Ok(token) => token,
21574                    Err(e) => {
21575                        dlg.finished(false);
21576                        return Err(common::Error::MissingToken(e));
21577                    }
21578                },
21579            };
21580            request_value_reader
21581                .seek(std::io::SeekFrom::Start(0))
21582                .unwrap();
21583            let mut req_result = {
21584                let client = &self.hub.client;
21585                dlg.pre_request();
21586                let mut req_builder = hyper::Request::builder()
21587                    .method(hyper::Method::PATCH)
21588                    .uri(url.as_str())
21589                    .header(USER_AGENT, self.hub._user_agent.clone());
21590
21591                if let Some(token) = token.as_ref() {
21592                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
21593                }
21594
21595                let request = req_builder
21596                    .header(CONTENT_TYPE, json_mime_type.to_string())
21597                    .header(CONTENT_LENGTH, request_size as u64)
21598                    .body(common::to_body(
21599                        request_value_reader.get_ref().clone().into(),
21600                    ));
21601
21602                client.request(request.unwrap()).await
21603            };
21604
21605            match req_result {
21606                Err(err) => {
21607                    if let common::Retry::After(d) = dlg.http_error(&err) {
21608                        sleep(d).await;
21609                        continue;
21610                    }
21611                    dlg.finished(false);
21612                    return Err(common::Error::HttpError(err));
21613                }
21614                Ok(res) => {
21615                    let (mut parts, body) = res.into_parts();
21616                    let mut body = common::Body::new(body);
21617                    if !parts.status.is_success() {
21618                        let bytes = common::to_bytes(body).await.unwrap_or_default();
21619                        let error = serde_json::from_str(&common::to_string(&bytes));
21620                        let response = common::to_response(parts, bytes.into());
21621
21622                        if let common::Retry::After(d) =
21623                            dlg.http_failure(&response, error.as_ref().ok())
21624                        {
21625                            sleep(d).await;
21626                            continue;
21627                        }
21628
21629                        dlg.finished(false);
21630
21631                        return Err(match error {
21632                            Ok(value) => common::Error::BadRequest(value),
21633                            _ => common::Error::Failure(response),
21634                        });
21635                    }
21636                    let response = {
21637                        let bytes = common::to_bytes(body).await.unwrap_or_default();
21638                        let encoded = common::to_string(&bytes);
21639                        match serde_json::from_str(&encoded) {
21640                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
21641                            Err(error) => {
21642                                dlg.response_json_decode_error(&encoded, &error);
21643                                return Err(common::Error::JsonDecodeError(
21644                                    encoded.to_string(),
21645                                    error,
21646                                ));
21647                            }
21648                        }
21649                    };
21650
21651                    dlg.finished(true);
21652                    return Ok(response);
21653                }
21654            }
21655        }
21656    }
21657
21658    ///
21659    /// Sets the *request* property to the given value.
21660    ///
21661    /// Even though the property as already been set when instantiating this call,
21662    /// we provide this method for API completeness.
21663    pub fn request(
21664        mut self,
21665        new_value: InboundSamlSsoProfile,
21666    ) -> InboundSamlSsoProfilePatchCall<'a, C> {
21667        self._request = new_value;
21668        self
21669    }
21670    /// Output only. [Resource name](https://cloud.google.com/apis/design/resource_names) of the SAML SSO profile.
21671    ///
21672    /// Sets the *name* path property to the given value.
21673    ///
21674    /// Even though the property as already been set when instantiating this call,
21675    /// we provide this method for API completeness.
21676    pub fn name(mut self, new_value: &str) -> InboundSamlSsoProfilePatchCall<'a, C> {
21677        self._name = new_value.to_string();
21678        self
21679    }
21680    /// Required. The list of fields to be updated.
21681    ///
21682    /// Sets the *update mask* query property to the given value.
21683    pub fn update_mask(
21684        mut self,
21685        new_value: common::FieldMask,
21686    ) -> InboundSamlSsoProfilePatchCall<'a, C> {
21687        self._update_mask = Some(new_value);
21688        self
21689    }
21690    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
21691    /// while executing the actual API request.
21692    ///
21693    /// ````text
21694    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
21695    /// ````
21696    ///
21697    /// Sets the *delegate* property to the given value.
21698    pub fn delegate(
21699        mut self,
21700        new_value: &'a mut dyn common::Delegate,
21701    ) -> InboundSamlSsoProfilePatchCall<'a, C> {
21702        self._delegate = Some(new_value);
21703        self
21704    }
21705
21706    /// Set any additional parameter of the query string used in the request.
21707    /// It should be used to set parameters which are not yet available through their own
21708    /// setters.
21709    ///
21710    /// Please note that this method must not be used to set any of the known parameters
21711    /// which have their own setter method. If done anyway, the request will fail.
21712    ///
21713    /// # Additional Parameters
21714    ///
21715    /// * *$.xgafv* (query-string) - V1 error format.
21716    /// * *access_token* (query-string) - OAuth access token.
21717    /// * *alt* (query-string) - Data format for response.
21718    /// * *callback* (query-string) - JSONP
21719    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
21720    /// * *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.
21721    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
21722    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
21723    /// * *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.
21724    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
21725    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
21726    pub fn param<T>(mut self, name: T, value: T) -> InboundSamlSsoProfilePatchCall<'a, C>
21727    where
21728        T: AsRef<str>,
21729    {
21730        self._additional_params
21731            .insert(name.as_ref().to_string(), value.as_ref().to_string());
21732        self
21733    }
21734
21735    /// Identifies the authorization scope for the method you are building.
21736    ///
21737    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
21738    /// [`Scope::CloudPlatform`].
21739    ///
21740    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
21741    /// tokens for more than one scope.
21742    ///
21743    /// Usually there is more than one suitable scope to authorize an operation, some of which may
21744    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
21745    /// sufficient, a read-write scope will do as well.
21746    pub fn add_scope<St>(mut self, scope: St) -> InboundSamlSsoProfilePatchCall<'a, C>
21747    where
21748        St: AsRef<str>,
21749    {
21750        self._scopes.insert(String::from(scope.as_ref()));
21751        self
21752    }
21753    /// Identifies the authorization scope(s) for the method you are building.
21754    ///
21755    /// See [`Self::add_scope()`] for details.
21756    pub fn add_scopes<I, St>(mut self, scopes: I) -> InboundSamlSsoProfilePatchCall<'a, C>
21757    where
21758        I: IntoIterator<Item = St>,
21759        St: AsRef<str>,
21760    {
21761        self._scopes
21762            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
21763        self
21764    }
21765
21766    /// Removes all scopes, and no default scope will be used either.
21767    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
21768    /// for details).
21769    pub fn clear_scopes(mut self) -> InboundSamlSsoProfilePatchCall<'a, C> {
21770        self._scopes.clear();
21771        self
21772    }
21773}
21774
21775/// Creates an InboundSsoAssignment for users and devices in a `Customer` under a given `Group` or `OrgUnit`.
21776///
21777/// A builder for the *create* method supported by a *inboundSsoAssignment* resource.
21778/// It is not used directly, but through a [`InboundSsoAssignmentMethods`] instance.
21779///
21780/// # Example
21781///
21782/// Instantiate a resource method builder
21783///
21784/// ```test_harness,no_run
21785/// # extern crate hyper;
21786/// # extern crate hyper_rustls;
21787/// # extern crate google_cloudidentity1 as cloudidentity1;
21788/// use cloudidentity1::api::InboundSsoAssignment;
21789/// # async fn dox() {
21790/// # use cloudidentity1::{CloudIdentity, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
21791///
21792/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
21793/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
21794/// #     .with_native_roots()
21795/// #     .unwrap()
21796/// #     .https_only()
21797/// #     .enable_http2()
21798/// #     .build();
21799///
21800/// # let executor = hyper_util::rt::TokioExecutor::new();
21801/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
21802/// #     secret,
21803/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
21804/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
21805/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
21806/// #     ),
21807/// # ).build().await.unwrap();
21808///
21809/// # let client = hyper_util::client::legacy::Client::builder(
21810/// #     hyper_util::rt::TokioExecutor::new()
21811/// # )
21812/// # .build(
21813/// #     hyper_rustls::HttpsConnectorBuilder::new()
21814/// #         .with_native_roots()
21815/// #         .unwrap()
21816/// #         .https_or_http()
21817/// #         .enable_http2()
21818/// #         .build()
21819/// # );
21820/// # let mut hub = CloudIdentity::new(client, auth);
21821/// // As the method needs a request, you would usually fill it with the desired information
21822/// // into the respective structure. Some of the parts shown here might not be applicable !
21823/// // Values shown here are possibly random and not representative !
21824/// let mut req = InboundSsoAssignment::default();
21825///
21826/// // You can configure optional parameters by calling the respective setters at will, and
21827/// // execute the final call using `doit()`.
21828/// // Values shown here are possibly random and not representative !
21829/// let result = hub.inbound_sso_assignments().create(req)
21830///              .doit().await;
21831/// # }
21832/// ```
21833pub struct InboundSsoAssignmentCreateCall<'a, C>
21834where
21835    C: 'a,
21836{
21837    hub: &'a CloudIdentity<C>,
21838    _request: InboundSsoAssignment,
21839    _delegate: Option<&'a mut dyn common::Delegate>,
21840    _additional_params: HashMap<String, String>,
21841    _scopes: BTreeSet<String>,
21842}
21843
21844impl<'a, C> common::CallBuilder for InboundSsoAssignmentCreateCall<'a, C> {}
21845
21846impl<'a, C> InboundSsoAssignmentCreateCall<'a, C>
21847where
21848    C: common::Connector,
21849{
21850    /// Perform the operation you have build so far.
21851    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
21852        use std::borrow::Cow;
21853        use std::io::{Read, Seek};
21854
21855        use common::{url::Params, ToParts};
21856        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
21857
21858        let mut dd = common::DefaultDelegate;
21859        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
21860        dlg.begin(common::MethodInfo {
21861            id: "cloudidentity.inboundSsoAssignments.create",
21862            http_method: hyper::Method::POST,
21863        });
21864
21865        for &field in ["alt"].iter() {
21866            if self._additional_params.contains_key(field) {
21867                dlg.finished(false);
21868                return Err(common::Error::FieldClash(field));
21869            }
21870        }
21871
21872        let mut params = Params::with_capacity(3 + self._additional_params.len());
21873
21874        params.extend(self._additional_params.iter());
21875
21876        params.push("alt", "json");
21877        let mut url = self.hub._base_url.clone() + "v1/inboundSsoAssignments";
21878        if self._scopes.is_empty() {
21879            self._scopes
21880                .insert(Scope::CloudPlatform.as_ref().to_string());
21881        }
21882
21883        let url = params.parse_with_url(&url);
21884
21885        let mut json_mime_type = mime::APPLICATION_JSON;
21886        let mut request_value_reader = {
21887            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
21888            common::remove_json_null_values(&mut value);
21889            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
21890            serde_json::to_writer(&mut dst, &value).unwrap();
21891            dst
21892        };
21893        let request_size = request_value_reader
21894            .seek(std::io::SeekFrom::End(0))
21895            .unwrap();
21896        request_value_reader
21897            .seek(std::io::SeekFrom::Start(0))
21898            .unwrap();
21899
21900        loop {
21901            let token = match self
21902                .hub
21903                .auth
21904                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
21905                .await
21906            {
21907                Ok(token) => token,
21908                Err(e) => match dlg.token(e) {
21909                    Ok(token) => token,
21910                    Err(e) => {
21911                        dlg.finished(false);
21912                        return Err(common::Error::MissingToken(e));
21913                    }
21914                },
21915            };
21916            request_value_reader
21917                .seek(std::io::SeekFrom::Start(0))
21918                .unwrap();
21919            let mut req_result = {
21920                let client = &self.hub.client;
21921                dlg.pre_request();
21922                let mut req_builder = hyper::Request::builder()
21923                    .method(hyper::Method::POST)
21924                    .uri(url.as_str())
21925                    .header(USER_AGENT, self.hub._user_agent.clone());
21926
21927                if let Some(token) = token.as_ref() {
21928                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
21929                }
21930
21931                let request = req_builder
21932                    .header(CONTENT_TYPE, json_mime_type.to_string())
21933                    .header(CONTENT_LENGTH, request_size as u64)
21934                    .body(common::to_body(
21935                        request_value_reader.get_ref().clone().into(),
21936                    ));
21937
21938                client.request(request.unwrap()).await
21939            };
21940
21941            match req_result {
21942                Err(err) => {
21943                    if let common::Retry::After(d) = dlg.http_error(&err) {
21944                        sleep(d).await;
21945                        continue;
21946                    }
21947                    dlg.finished(false);
21948                    return Err(common::Error::HttpError(err));
21949                }
21950                Ok(res) => {
21951                    let (mut parts, body) = res.into_parts();
21952                    let mut body = common::Body::new(body);
21953                    if !parts.status.is_success() {
21954                        let bytes = common::to_bytes(body).await.unwrap_or_default();
21955                        let error = serde_json::from_str(&common::to_string(&bytes));
21956                        let response = common::to_response(parts, bytes.into());
21957
21958                        if let common::Retry::After(d) =
21959                            dlg.http_failure(&response, error.as_ref().ok())
21960                        {
21961                            sleep(d).await;
21962                            continue;
21963                        }
21964
21965                        dlg.finished(false);
21966
21967                        return Err(match error {
21968                            Ok(value) => common::Error::BadRequest(value),
21969                            _ => common::Error::Failure(response),
21970                        });
21971                    }
21972                    let response = {
21973                        let bytes = common::to_bytes(body).await.unwrap_or_default();
21974                        let encoded = common::to_string(&bytes);
21975                        match serde_json::from_str(&encoded) {
21976                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
21977                            Err(error) => {
21978                                dlg.response_json_decode_error(&encoded, &error);
21979                                return Err(common::Error::JsonDecodeError(
21980                                    encoded.to_string(),
21981                                    error,
21982                                ));
21983                            }
21984                        }
21985                    };
21986
21987                    dlg.finished(true);
21988                    return Ok(response);
21989                }
21990            }
21991        }
21992    }
21993
21994    ///
21995    /// Sets the *request* property to the given value.
21996    ///
21997    /// Even though the property as already been set when instantiating this call,
21998    /// we provide this method for API completeness.
21999    pub fn request(
22000        mut self,
22001        new_value: InboundSsoAssignment,
22002    ) -> InboundSsoAssignmentCreateCall<'a, C> {
22003        self._request = new_value;
22004        self
22005    }
22006    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
22007    /// while executing the actual API request.
22008    ///
22009    /// ````text
22010    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
22011    /// ````
22012    ///
22013    /// Sets the *delegate* property to the given value.
22014    pub fn delegate(
22015        mut self,
22016        new_value: &'a mut dyn common::Delegate,
22017    ) -> InboundSsoAssignmentCreateCall<'a, C> {
22018        self._delegate = Some(new_value);
22019        self
22020    }
22021
22022    /// Set any additional parameter of the query string used in the request.
22023    /// It should be used to set parameters which are not yet available through their own
22024    /// setters.
22025    ///
22026    /// Please note that this method must not be used to set any of the known parameters
22027    /// which have their own setter method. If done anyway, the request will fail.
22028    ///
22029    /// # Additional Parameters
22030    ///
22031    /// * *$.xgafv* (query-string) - V1 error format.
22032    /// * *access_token* (query-string) - OAuth access token.
22033    /// * *alt* (query-string) - Data format for response.
22034    /// * *callback* (query-string) - JSONP
22035    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
22036    /// * *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.
22037    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
22038    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
22039    /// * *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.
22040    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
22041    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
22042    pub fn param<T>(mut self, name: T, value: T) -> InboundSsoAssignmentCreateCall<'a, C>
22043    where
22044        T: AsRef<str>,
22045    {
22046        self._additional_params
22047            .insert(name.as_ref().to_string(), value.as_ref().to_string());
22048        self
22049    }
22050
22051    /// Identifies the authorization scope for the method you are building.
22052    ///
22053    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
22054    /// [`Scope::CloudPlatform`].
22055    ///
22056    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
22057    /// tokens for more than one scope.
22058    ///
22059    /// Usually there is more than one suitable scope to authorize an operation, some of which may
22060    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
22061    /// sufficient, a read-write scope will do as well.
22062    pub fn add_scope<St>(mut self, scope: St) -> InboundSsoAssignmentCreateCall<'a, C>
22063    where
22064        St: AsRef<str>,
22065    {
22066        self._scopes.insert(String::from(scope.as_ref()));
22067        self
22068    }
22069    /// Identifies the authorization scope(s) for the method you are building.
22070    ///
22071    /// See [`Self::add_scope()`] for details.
22072    pub fn add_scopes<I, St>(mut self, scopes: I) -> InboundSsoAssignmentCreateCall<'a, C>
22073    where
22074        I: IntoIterator<Item = St>,
22075        St: AsRef<str>,
22076    {
22077        self._scopes
22078            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
22079        self
22080    }
22081
22082    /// Removes all scopes, and no default scope will be used either.
22083    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
22084    /// for details).
22085    pub fn clear_scopes(mut self) -> InboundSsoAssignmentCreateCall<'a, C> {
22086        self._scopes.clear();
22087        self
22088    }
22089}
22090
22091/// Deletes an InboundSsoAssignment. To disable SSO, Create (or Update) an assignment that has `sso_mode` == `SSO_OFF`.
22092///
22093/// A builder for the *delete* method supported by a *inboundSsoAssignment* resource.
22094/// It is not used directly, but through a [`InboundSsoAssignmentMethods`] instance.
22095///
22096/// # Example
22097///
22098/// Instantiate a resource method builder
22099///
22100/// ```test_harness,no_run
22101/// # extern crate hyper;
22102/// # extern crate hyper_rustls;
22103/// # extern crate google_cloudidentity1 as cloudidentity1;
22104/// # async fn dox() {
22105/// # use cloudidentity1::{CloudIdentity, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
22106///
22107/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
22108/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
22109/// #     .with_native_roots()
22110/// #     .unwrap()
22111/// #     .https_only()
22112/// #     .enable_http2()
22113/// #     .build();
22114///
22115/// # let executor = hyper_util::rt::TokioExecutor::new();
22116/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
22117/// #     secret,
22118/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
22119/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
22120/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
22121/// #     ),
22122/// # ).build().await.unwrap();
22123///
22124/// # let client = hyper_util::client::legacy::Client::builder(
22125/// #     hyper_util::rt::TokioExecutor::new()
22126/// # )
22127/// # .build(
22128/// #     hyper_rustls::HttpsConnectorBuilder::new()
22129/// #         .with_native_roots()
22130/// #         .unwrap()
22131/// #         .https_or_http()
22132/// #         .enable_http2()
22133/// #         .build()
22134/// # );
22135/// # let mut hub = CloudIdentity::new(client, auth);
22136/// // You can configure optional parameters by calling the respective setters at will, and
22137/// // execute the final call using `doit()`.
22138/// // Values shown here are possibly random and not representative !
22139/// let result = hub.inbound_sso_assignments().delete("name")
22140///              .doit().await;
22141/// # }
22142/// ```
22143pub struct InboundSsoAssignmentDeleteCall<'a, C>
22144where
22145    C: 'a,
22146{
22147    hub: &'a CloudIdentity<C>,
22148    _name: String,
22149    _delegate: Option<&'a mut dyn common::Delegate>,
22150    _additional_params: HashMap<String, String>,
22151    _scopes: BTreeSet<String>,
22152}
22153
22154impl<'a, C> common::CallBuilder for InboundSsoAssignmentDeleteCall<'a, C> {}
22155
22156impl<'a, C> InboundSsoAssignmentDeleteCall<'a, C>
22157where
22158    C: common::Connector,
22159{
22160    /// Perform the operation you have build so far.
22161    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
22162        use std::borrow::Cow;
22163        use std::io::{Read, Seek};
22164
22165        use common::{url::Params, ToParts};
22166        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
22167
22168        let mut dd = common::DefaultDelegate;
22169        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
22170        dlg.begin(common::MethodInfo {
22171            id: "cloudidentity.inboundSsoAssignments.delete",
22172            http_method: hyper::Method::DELETE,
22173        });
22174
22175        for &field in ["alt", "name"].iter() {
22176            if self._additional_params.contains_key(field) {
22177                dlg.finished(false);
22178                return Err(common::Error::FieldClash(field));
22179            }
22180        }
22181
22182        let mut params = Params::with_capacity(3 + self._additional_params.len());
22183        params.push("name", self._name);
22184
22185        params.extend(self._additional_params.iter());
22186
22187        params.push("alt", "json");
22188        let mut url = self.hub._base_url.clone() + "v1/{+name}";
22189        if self._scopes.is_empty() {
22190            self._scopes
22191                .insert(Scope::CloudPlatform.as_ref().to_string());
22192        }
22193
22194        #[allow(clippy::single_element_loop)]
22195        for &(find_this, param_name) in [("{+name}", "name")].iter() {
22196            url = params.uri_replacement(url, param_name, find_this, true);
22197        }
22198        {
22199            let to_remove = ["name"];
22200            params.remove_params(&to_remove);
22201        }
22202
22203        let url = params.parse_with_url(&url);
22204
22205        loop {
22206            let token = match self
22207                .hub
22208                .auth
22209                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
22210                .await
22211            {
22212                Ok(token) => token,
22213                Err(e) => match dlg.token(e) {
22214                    Ok(token) => token,
22215                    Err(e) => {
22216                        dlg.finished(false);
22217                        return Err(common::Error::MissingToken(e));
22218                    }
22219                },
22220            };
22221            let mut req_result = {
22222                let client = &self.hub.client;
22223                dlg.pre_request();
22224                let mut req_builder = hyper::Request::builder()
22225                    .method(hyper::Method::DELETE)
22226                    .uri(url.as_str())
22227                    .header(USER_AGENT, self.hub._user_agent.clone());
22228
22229                if let Some(token) = token.as_ref() {
22230                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
22231                }
22232
22233                let request = req_builder
22234                    .header(CONTENT_LENGTH, 0_u64)
22235                    .body(common::to_body::<String>(None));
22236
22237                client.request(request.unwrap()).await
22238            };
22239
22240            match req_result {
22241                Err(err) => {
22242                    if let common::Retry::After(d) = dlg.http_error(&err) {
22243                        sleep(d).await;
22244                        continue;
22245                    }
22246                    dlg.finished(false);
22247                    return Err(common::Error::HttpError(err));
22248                }
22249                Ok(res) => {
22250                    let (mut parts, body) = res.into_parts();
22251                    let mut body = common::Body::new(body);
22252                    if !parts.status.is_success() {
22253                        let bytes = common::to_bytes(body).await.unwrap_or_default();
22254                        let error = serde_json::from_str(&common::to_string(&bytes));
22255                        let response = common::to_response(parts, bytes.into());
22256
22257                        if let common::Retry::After(d) =
22258                            dlg.http_failure(&response, error.as_ref().ok())
22259                        {
22260                            sleep(d).await;
22261                            continue;
22262                        }
22263
22264                        dlg.finished(false);
22265
22266                        return Err(match error {
22267                            Ok(value) => common::Error::BadRequest(value),
22268                            _ => common::Error::Failure(response),
22269                        });
22270                    }
22271                    let response = {
22272                        let bytes = common::to_bytes(body).await.unwrap_or_default();
22273                        let encoded = common::to_string(&bytes);
22274                        match serde_json::from_str(&encoded) {
22275                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
22276                            Err(error) => {
22277                                dlg.response_json_decode_error(&encoded, &error);
22278                                return Err(common::Error::JsonDecodeError(
22279                                    encoded.to_string(),
22280                                    error,
22281                                ));
22282                            }
22283                        }
22284                    };
22285
22286                    dlg.finished(true);
22287                    return Ok(response);
22288                }
22289            }
22290        }
22291    }
22292
22293    /// Required. The [resource name](https://cloud.google.com/apis/design/resource_names) of the InboundSsoAssignment to delete. Format: `inboundSsoAssignments/{assignment}`
22294    ///
22295    /// Sets the *name* path property to the given value.
22296    ///
22297    /// Even though the property as already been set when instantiating this call,
22298    /// we provide this method for API completeness.
22299    pub fn name(mut self, new_value: &str) -> InboundSsoAssignmentDeleteCall<'a, C> {
22300        self._name = new_value.to_string();
22301        self
22302    }
22303    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
22304    /// while executing the actual API request.
22305    ///
22306    /// ````text
22307    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
22308    /// ````
22309    ///
22310    /// Sets the *delegate* property to the given value.
22311    pub fn delegate(
22312        mut self,
22313        new_value: &'a mut dyn common::Delegate,
22314    ) -> InboundSsoAssignmentDeleteCall<'a, C> {
22315        self._delegate = Some(new_value);
22316        self
22317    }
22318
22319    /// Set any additional parameter of the query string used in the request.
22320    /// It should be used to set parameters which are not yet available through their own
22321    /// setters.
22322    ///
22323    /// Please note that this method must not be used to set any of the known parameters
22324    /// which have their own setter method. If done anyway, the request will fail.
22325    ///
22326    /// # Additional Parameters
22327    ///
22328    /// * *$.xgafv* (query-string) - V1 error format.
22329    /// * *access_token* (query-string) - OAuth access token.
22330    /// * *alt* (query-string) - Data format for response.
22331    /// * *callback* (query-string) - JSONP
22332    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
22333    /// * *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.
22334    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
22335    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
22336    /// * *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.
22337    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
22338    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
22339    pub fn param<T>(mut self, name: T, value: T) -> InboundSsoAssignmentDeleteCall<'a, C>
22340    where
22341        T: AsRef<str>,
22342    {
22343        self._additional_params
22344            .insert(name.as_ref().to_string(), value.as_ref().to_string());
22345        self
22346    }
22347
22348    /// Identifies the authorization scope for the method you are building.
22349    ///
22350    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
22351    /// [`Scope::CloudPlatform`].
22352    ///
22353    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
22354    /// tokens for more than one scope.
22355    ///
22356    /// Usually there is more than one suitable scope to authorize an operation, some of which may
22357    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
22358    /// sufficient, a read-write scope will do as well.
22359    pub fn add_scope<St>(mut self, scope: St) -> InboundSsoAssignmentDeleteCall<'a, C>
22360    where
22361        St: AsRef<str>,
22362    {
22363        self._scopes.insert(String::from(scope.as_ref()));
22364        self
22365    }
22366    /// Identifies the authorization scope(s) for the method you are building.
22367    ///
22368    /// See [`Self::add_scope()`] for details.
22369    pub fn add_scopes<I, St>(mut self, scopes: I) -> InboundSsoAssignmentDeleteCall<'a, C>
22370    where
22371        I: IntoIterator<Item = St>,
22372        St: AsRef<str>,
22373    {
22374        self._scopes
22375            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
22376        self
22377    }
22378
22379    /// Removes all scopes, and no default scope will be used either.
22380    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
22381    /// for details).
22382    pub fn clear_scopes(mut self) -> InboundSsoAssignmentDeleteCall<'a, C> {
22383        self._scopes.clear();
22384        self
22385    }
22386}
22387
22388/// Gets an InboundSsoAssignment.
22389///
22390/// A builder for the *get* method supported by a *inboundSsoAssignment* resource.
22391/// It is not used directly, but through a [`InboundSsoAssignmentMethods`] instance.
22392///
22393/// # Example
22394///
22395/// Instantiate a resource method builder
22396///
22397/// ```test_harness,no_run
22398/// # extern crate hyper;
22399/// # extern crate hyper_rustls;
22400/// # extern crate google_cloudidentity1 as cloudidentity1;
22401/// # async fn dox() {
22402/// # use cloudidentity1::{CloudIdentity, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
22403///
22404/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
22405/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
22406/// #     .with_native_roots()
22407/// #     .unwrap()
22408/// #     .https_only()
22409/// #     .enable_http2()
22410/// #     .build();
22411///
22412/// # let executor = hyper_util::rt::TokioExecutor::new();
22413/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
22414/// #     secret,
22415/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
22416/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
22417/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
22418/// #     ),
22419/// # ).build().await.unwrap();
22420///
22421/// # let client = hyper_util::client::legacy::Client::builder(
22422/// #     hyper_util::rt::TokioExecutor::new()
22423/// # )
22424/// # .build(
22425/// #     hyper_rustls::HttpsConnectorBuilder::new()
22426/// #         .with_native_roots()
22427/// #         .unwrap()
22428/// #         .https_or_http()
22429/// #         .enable_http2()
22430/// #         .build()
22431/// # );
22432/// # let mut hub = CloudIdentity::new(client, auth);
22433/// // You can configure optional parameters by calling the respective setters at will, and
22434/// // execute the final call using `doit()`.
22435/// // Values shown here are possibly random and not representative !
22436/// let result = hub.inbound_sso_assignments().get("name")
22437///              .doit().await;
22438/// # }
22439/// ```
22440pub struct InboundSsoAssignmentGetCall<'a, C>
22441where
22442    C: 'a,
22443{
22444    hub: &'a CloudIdentity<C>,
22445    _name: String,
22446    _delegate: Option<&'a mut dyn common::Delegate>,
22447    _additional_params: HashMap<String, String>,
22448    _scopes: BTreeSet<String>,
22449}
22450
22451impl<'a, C> common::CallBuilder for InboundSsoAssignmentGetCall<'a, C> {}
22452
22453impl<'a, C> InboundSsoAssignmentGetCall<'a, C>
22454where
22455    C: common::Connector,
22456{
22457    /// Perform the operation you have build so far.
22458    pub async fn doit(mut self) -> common::Result<(common::Response, InboundSsoAssignment)> {
22459        use std::borrow::Cow;
22460        use std::io::{Read, Seek};
22461
22462        use common::{url::Params, ToParts};
22463        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
22464
22465        let mut dd = common::DefaultDelegate;
22466        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
22467        dlg.begin(common::MethodInfo {
22468            id: "cloudidentity.inboundSsoAssignments.get",
22469            http_method: hyper::Method::GET,
22470        });
22471
22472        for &field in ["alt", "name"].iter() {
22473            if self._additional_params.contains_key(field) {
22474                dlg.finished(false);
22475                return Err(common::Error::FieldClash(field));
22476            }
22477        }
22478
22479        let mut params = Params::with_capacity(3 + self._additional_params.len());
22480        params.push("name", self._name);
22481
22482        params.extend(self._additional_params.iter());
22483
22484        params.push("alt", "json");
22485        let mut url = self.hub._base_url.clone() + "v1/{+name}";
22486        if self._scopes.is_empty() {
22487            self._scopes
22488                .insert(Scope::CloudIdentityInboundssoReadonly.as_ref().to_string());
22489        }
22490
22491        #[allow(clippy::single_element_loop)]
22492        for &(find_this, param_name) in [("{+name}", "name")].iter() {
22493            url = params.uri_replacement(url, param_name, find_this, true);
22494        }
22495        {
22496            let to_remove = ["name"];
22497            params.remove_params(&to_remove);
22498        }
22499
22500        let url = params.parse_with_url(&url);
22501
22502        loop {
22503            let token = match self
22504                .hub
22505                .auth
22506                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
22507                .await
22508            {
22509                Ok(token) => token,
22510                Err(e) => match dlg.token(e) {
22511                    Ok(token) => token,
22512                    Err(e) => {
22513                        dlg.finished(false);
22514                        return Err(common::Error::MissingToken(e));
22515                    }
22516                },
22517            };
22518            let mut req_result = {
22519                let client = &self.hub.client;
22520                dlg.pre_request();
22521                let mut req_builder = hyper::Request::builder()
22522                    .method(hyper::Method::GET)
22523                    .uri(url.as_str())
22524                    .header(USER_AGENT, self.hub._user_agent.clone());
22525
22526                if let Some(token) = token.as_ref() {
22527                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
22528                }
22529
22530                let request = req_builder
22531                    .header(CONTENT_LENGTH, 0_u64)
22532                    .body(common::to_body::<String>(None));
22533
22534                client.request(request.unwrap()).await
22535            };
22536
22537            match req_result {
22538                Err(err) => {
22539                    if let common::Retry::After(d) = dlg.http_error(&err) {
22540                        sleep(d).await;
22541                        continue;
22542                    }
22543                    dlg.finished(false);
22544                    return Err(common::Error::HttpError(err));
22545                }
22546                Ok(res) => {
22547                    let (mut parts, body) = res.into_parts();
22548                    let mut body = common::Body::new(body);
22549                    if !parts.status.is_success() {
22550                        let bytes = common::to_bytes(body).await.unwrap_or_default();
22551                        let error = serde_json::from_str(&common::to_string(&bytes));
22552                        let response = common::to_response(parts, bytes.into());
22553
22554                        if let common::Retry::After(d) =
22555                            dlg.http_failure(&response, error.as_ref().ok())
22556                        {
22557                            sleep(d).await;
22558                            continue;
22559                        }
22560
22561                        dlg.finished(false);
22562
22563                        return Err(match error {
22564                            Ok(value) => common::Error::BadRequest(value),
22565                            _ => common::Error::Failure(response),
22566                        });
22567                    }
22568                    let response = {
22569                        let bytes = common::to_bytes(body).await.unwrap_or_default();
22570                        let encoded = common::to_string(&bytes);
22571                        match serde_json::from_str(&encoded) {
22572                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
22573                            Err(error) => {
22574                                dlg.response_json_decode_error(&encoded, &error);
22575                                return Err(common::Error::JsonDecodeError(
22576                                    encoded.to_string(),
22577                                    error,
22578                                ));
22579                            }
22580                        }
22581                    };
22582
22583                    dlg.finished(true);
22584                    return Ok(response);
22585                }
22586            }
22587        }
22588    }
22589
22590    /// Required. The [resource name](https://cloud.google.com/apis/design/resource_names) of the InboundSsoAssignment to fetch. Format: `inboundSsoAssignments/{assignment}`
22591    ///
22592    /// Sets the *name* path property to the given value.
22593    ///
22594    /// Even though the property as already been set when instantiating this call,
22595    /// we provide this method for API completeness.
22596    pub fn name(mut self, new_value: &str) -> InboundSsoAssignmentGetCall<'a, C> {
22597        self._name = new_value.to_string();
22598        self
22599    }
22600    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
22601    /// while executing the actual API request.
22602    ///
22603    /// ````text
22604    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
22605    /// ````
22606    ///
22607    /// Sets the *delegate* property to the given value.
22608    pub fn delegate(
22609        mut self,
22610        new_value: &'a mut dyn common::Delegate,
22611    ) -> InboundSsoAssignmentGetCall<'a, C> {
22612        self._delegate = Some(new_value);
22613        self
22614    }
22615
22616    /// Set any additional parameter of the query string used in the request.
22617    /// It should be used to set parameters which are not yet available through their own
22618    /// setters.
22619    ///
22620    /// Please note that this method must not be used to set any of the known parameters
22621    /// which have their own setter method. If done anyway, the request will fail.
22622    ///
22623    /// # Additional Parameters
22624    ///
22625    /// * *$.xgafv* (query-string) - V1 error format.
22626    /// * *access_token* (query-string) - OAuth access token.
22627    /// * *alt* (query-string) - Data format for response.
22628    /// * *callback* (query-string) - JSONP
22629    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
22630    /// * *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.
22631    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
22632    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
22633    /// * *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.
22634    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
22635    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
22636    pub fn param<T>(mut self, name: T, value: T) -> InboundSsoAssignmentGetCall<'a, C>
22637    where
22638        T: AsRef<str>,
22639    {
22640        self._additional_params
22641            .insert(name.as_ref().to_string(), value.as_ref().to_string());
22642        self
22643    }
22644
22645    /// Identifies the authorization scope for the method you are building.
22646    ///
22647    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
22648    /// [`Scope::CloudIdentityInboundssoReadonly`].
22649    ///
22650    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
22651    /// tokens for more than one scope.
22652    ///
22653    /// Usually there is more than one suitable scope to authorize an operation, some of which may
22654    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
22655    /// sufficient, a read-write scope will do as well.
22656    pub fn add_scope<St>(mut self, scope: St) -> InboundSsoAssignmentGetCall<'a, C>
22657    where
22658        St: AsRef<str>,
22659    {
22660        self._scopes.insert(String::from(scope.as_ref()));
22661        self
22662    }
22663    /// Identifies the authorization scope(s) for the method you are building.
22664    ///
22665    /// See [`Self::add_scope()`] for details.
22666    pub fn add_scopes<I, St>(mut self, scopes: I) -> InboundSsoAssignmentGetCall<'a, C>
22667    where
22668        I: IntoIterator<Item = St>,
22669        St: AsRef<str>,
22670    {
22671        self._scopes
22672            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
22673        self
22674    }
22675
22676    /// Removes all scopes, and no default scope will be used either.
22677    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
22678    /// for details).
22679    pub fn clear_scopes(mut self) -> InboundSsoAssignmentGetCall<'a, C> {
22680        self._scopes.clear();
22681        self
22682    }
22683}
22684
22685/// Lists the InboundSsoAssignments for a `Customer`.
22686///
22687/// A builder for the *list* method supported by a *inboundSsoAssignment* resource.
22688/// It is not used directly, but through a [`InboundSsoAssignmentMethods`] instance.
22689///
22690/// # Example
22691///
22692/// Instantiate a resource method builder
22693///
22694/// ```test_harness,no_run
22695/// # extern crate hyper;
22696/// # extern crate hyper_rustls;
22697/// # extern crate google_cloudidentity1 as cloudidentity1;
22698/// # async fn dox() {
22699/// # use cloudidentity1::{CloudIdentity, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
22700///
22701/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
22702/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
22703/// #     .with_native_roots()
22704/// #     .unwrap()
22705/// #     .https_only()
22706/// #     .enable_http2()
22707/// #     .build();
22708///
22709/// # let executor = hyper_util::rt::TokioExecutor::new();
22710/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
22711/// #     secret,
22712/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
22713/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
22714/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
22715/// #     ),
22716/// # ).build().await.unwrap();
22717///
22718/// # let client = hyper_util::client::legacy::Client::builder(
22719/// #     hyper_util::rt::TokioExecutor::new()
22720/// # )
22721/// # .build(
22722/// #     hyper_rustls::HttpsConnectorBuilder::new()
22723/// #         .with_native_roots()
22724/// #         .unwrap()
22725/// #         .https_or_http()
22726/// #         .enable_http2()
22727/// #         .build()
22728/// # );
22729/// # let mut hub = CloudIdentity::new(client, auth);
22730/// // You can configure optional parameters by calling the respective setters at will, and
22731/// // execute the final call using `doit()`.
22732/// // Values shown here are possibly random and not representative !
22733/// let result = hub.inbound_sso_assignments().list()
22734///              .page_token("no")
22735///              .page_size(-91)
22736///              .filter("At")
22737///              .doit().await;
22738/// # }
22739/// ```
22740pub struct InboundSsoAssignmentListCall<'a, C>
22741where
22742    C: 'a,
22743{
22744    hub: &'a CloudIdentity<C>,
22745    _page_token: Option<String>,
22746    _page_size: Option<i32>,
22747    _filter: Option<String>,
22748    _delegate: Option<&'a mut dyn common::Delegate>,
22749    _additional_params: HashMap<String, String>,
22750    _scopes: BTreeSet<String>,
22751}
22752
22753impl<'a, C> common::CallBuilder for InboundSsoAssignmentListCall<'a, C> {}
22754
22755impl<'a, C> InboundSsoAssignmentListCall<'a, C>
22756where
22757    C: common::Connector,
22758{
22759    /// Perform the operation you have build so far.
22760    pub async fn doit(
22761        mut self,
22762    ) -> common::Result<(common::Response, ListInboundSsoAssignmentsResponse)> {
22763        use std::borrow::Cow;
22764        use std::io::{Read, Seek};
22765
22766        use common::{url::Params, ToParts};
22767        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
22768
22769        let mut dd = common::DefaultDelegate;
22770        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
22771        dlg.begin(common::MethodInfo {
22772            id: "cloudidentity.inboundSsoAssignments.list",
22773            http_method: hyper::Method::GET,
22774        });
22775
22776        for &field in ["alt", "pageToken", "pageSize", "filter"].iter() {
22777            if self._additional_params.contains_key(field) {
22778                dlg.finished(false);
22779                return Err(common::Error::FieldClash(field));
22780            }
22781        }
22782
22783        let mut params = Params::with_capacity(5 + self._additional_params.len());
22784        if let Some(value) = self._page_token.as_ref() {
22785            params.push("pageToken", value);
22786        }
22787        if let Some(value) = self._page_size.as_ref() {
22788            params.push("pageSize", value.to_string());
22789        }
22790        if let Some(value) = self._filter.as_ref() {
22791            params.push("filter", value);
22792        }
22793
22794        params.extend(self._additional_params.iter());
22795
22796        params.push("alt", "json");
22797        let mut url = self.hub._base_url.clone() + "v1/inboundSsoAssignments";
22798        if self._scopes.is_empty() {
22799            self._scopes
22800                .insert(Scope::CloudIdentityInboundssoReadonly.as_ref().to_string());
22801        }
22802
22803        let url = params.parse_with_url(&url);
22804
22805        loop {
22806            let token = match self
22807                .hub
22808                .auth
22809                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
22810                .await
22811            {
22812                Ok(token) => token,
22813                Err(e) => match dlg.token(e) {
22814                    Ok(token) => token,
22815                    Err(e) => {
22816                        dlg.finished(false);
22817                        return Err(common::Error::MissingToken(e));
22818                    }
22819                },
22820            };
22821            let mut req_result = {
22822                let client = &self.hub.client;
22823                dlg.pre_request();
22824                let mut req_builder = hyper::Request::builder()
22825                    .method(hyper::Method::GET)
22826                    .uri(url.as_str())
22827                    .header(USER_AGENT, self.hub._user_agent.clone());
22828
22829                if let Some(token) = token.as_ref() {
22830                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
22831                }
22832
22833                let request = req_builder
22834                    .header(CONTENT_LENGTH, 0_u64)
22835                    .body(common::to_body::<String>(None));
22836
22837                client.request(request.unwrap()).await
22838            };
22839
22840            match req_result {
22841                Err(err) => {
22842                    if let common::Retry::After(d) = dlg.http_error(&err) {
22843                        sleep(d).await;
22844                        continue;
22845                    }
22846                    dlg.finished(false);
22847                    return Err(common::Error::HttpError(err));
22848                }
22849                Ok(res) => {
22850                    let (mut parts, body) = res.into_parts();
22851                    let mut body = common::Body::new(body);
22852                    if !parts.status.is_success() {
22853                        let bytes = common::to_bytes(body).await.unwrap_or_default();
22854                        let error = serde_json::from_str(&common::to_string(&bytes));
22855                        let response = common::to_response(parts, bytes.into());
22856
22857                        if let common::Retry::After(d) =
22858                            dlg.http_failure(&response, error.as_ref().ok())
22859                        {
22860                            sleep(d).await;
22861                            continue;
22862                        }
22863
22864                        dlg.finished(false);
22865
22866                        return Err(match error {
22867                            Ok(value) => common::Error::BadRequest(value),
22868                            _ => common::Error::Failure(response),
22869                        });
22870                    }
22871                    let response = {
22872                        let bytes = common::to_bytes(body).await.unwrap_or_default();
22873                        let encoded = common::to_string(&bytes);
22874                        match serde_json::from_str(&encoded) {
22875                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
22876                            Err(error) => {
22877                                dlg.response_json_decode_error(&encoded, &error);
22878                                return Err(common::Error::JsonDecodeError(
22879                                    encoded.to_string(),
22880                                    error,
22881                                ));
22882                            }
22883                        }
22884                    };
22885
22886                    dlg.finished(true);
22887                    return Ok(response);
22888                }
22889            }
22890        }
22891    }
22892
22893    /// A page token, received from a previous `ListInboundSsoAssignments` call. Provide this to retrieve the subsequent page. When paginating, all other parameters provided to `ListInboundSsoAssignments` must match the call that provided the page token.
22894    ///
22895    /// Sets the *page token* query property to the given value.
22896    pub fn page_token(mut self, new_value: &str) -> InboundSsoAssignmentListCall<'a, C> {
22897        self._page_token = Some(new_value.to_string());
22898        self
22899    }
22900    /// The maximum number of assignments to return. The service may return fewer than this value. If omitted (or defaulted to zero) the server will use a sensible default. This default may change over time. The maximum allowed value is 100, though requests with page_size greater than that will be silently interpreted as having this maximum value. This may increase in the futue.
22901    ///
22902    /// Sets the *page size* query property to the given value.
22903    pub fn page_size(mut self, new_value: i32) -> InboundSsoAssignmentListCall<'a, C> {
22904        self._page_size = Some(new_value);
22905        self
22906    }
22907    /// A CEL expression to filter the results. The only supported filter is filtering by customer. For example: `customer==customers/C0123abc`. Omitting the filter or specifying a filter of `customer==customers/my_customer` will return the assignments for the customer that the caller (authenticated user) belongs to.
22908    ///
22909    /// Sets the *filter* query property to the given value.
22910    pub fn filter(mut self, new_value: &str) -> InboundSsoAssignmentListCall<'a, C> {
22911        self._filter = Some(new_value.to_string());
22912        self
22913    }
22914    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
22915    /// while executing the actual API request.
22916    ///
22917    /// ````text
22918    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
22919    /// ````
22920    ///
22921    /// Sets the *delegate* property to the given value.
22922    pub fn delegate(
22923        mut self,
22924        new_value: &'a mut dyn common::Delegate,
22925    ) -> InboundSsoAssignmentListCall<'a, C> {
22926        self._delegate = Some(new_value);
22927        self
22928    }
22929
22930    /// Set any additional parameter of the query string used in the request.
22931    /// It should be used to set parameters which are not yet available through their own
22932    /// setters.
22933    ///
22934    /// Please note that this method must not be used to set any of the known parameters
22935    /// which have their own setter method. If done anyway, the request will fail.
22936    ///
22937    /// # Additional Parameters
22938    ///
22939    /// * *$.xgafv* (query-string) - V1 error format.
22940    /// * *access_token* (query-string) - OAuth access token.
22941    /// * *alt* (query-string) - Data format for response.
22942    /// * *callback* (query-string) - JSONP
22943    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
22944    /// * *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.
22945    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
22946    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
22947    /// * *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.
22948    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
22949    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
22950    pub fn param<T>(mut self, name: T, value: T) -> InboundSsoAssignmentListCall<'a, C>
22951    where
22952        T: AsRef<str>,
22953    {
22954        self._additional_params
22955            .insert(name.as_ref().to_string(), value.as_ref().to_string());
22956        self
22957    }
22958
22959    /// Identifies the authorization scope for the method you are building.
22960    ///
22961    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
22962    /// [`Scope::CloudIdentityInboundssoReadonly`].
22963    ///
22964    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
22965    /// tokens for more than one scope.
22966    ///
22967    /// Usually there is more than one suitable scope to authorize an operation, some of which may
22968    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
22969    /// sufficient, a read-write scope will do as well.
22970    pub fn add_scope<St>(mut self, scope: St) -> InboundSsoAssignmentListCall<'a, C>
22971    where
22972        St: AsRef<str>,
22973    {
22974        self._scopes.insert(String::from(scope.as_ref()));
22975        self
22976    }
22977    /// Identifies the authorization scope(s) for the method you are building.
22978    ///
22979    /// See [`Self::add_scope()`] for details.
22980    pub fn add_scopes<I, St>(mut self, scopes: I) -> InboundSsoAssignmentListCall<'a, C>
22981    where
22982        I: IntoIterator<Item = St>,
22983        St: AsRef<str>,
22984    {
22985        self._scopes
22986            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
22987        self
22988    }
22989
22990    /// Removes all scopes, and no default scope will be used either.
22991    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
22992    /// for details).
22993    pub fn clear_scopes(mut self) -> InboundSsoAssignmentListCall<'a, C> {
22994        self._scopes.clear();
22995        self
22996    }
22997}
22998
22999/// Updates an InboundSsoAssignment. The body of this request is the `inbound_sso_assignment` field and the `update_mask` is relative to that. For example: a PATCH to `/v1/inboundSsoAssignments/0abcdefg1234567&update_mask=rank` with a body of `{ "rank": 1 }` moves that (presumably group-targeted) SSO assignment to the highest priority and shifts any other group-targeted assignments down in priority.
23000///
23001/// A builder for the *patch* method supported by a *inboundSsoAssignment* resource.
23002/// It is not used directly, but through a [`InboundSsoAssignmentMethods`] instance.
23003///
23004/// # Example
23005///
23006/// Instantiate a resource method builder
23007///
23008/// ```test_harness,no_run
23009/// # extern crate hyper;
23010/// # extern crate hyper_rustls;
23011/// # extern crate google_cloudidentity1 as cloudidentity1;
23012/// use cloudidentity1::api::InboundSsoAssignment;
23013/// # async fn dox() {
23014/// # use cloudidentity1::{CloudIdentity, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
23015///
23016/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
23017/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
23018/// #     .with_native_roots()
23019/// #     .unwrap()
23020/// #     .https_only()
23021/// #     .enable_http2()
23022/// #     .build();
23023///
23024/// # let executor = hyper_util::rt::TokioExecutor::new();
23025/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
23026/// #     secret,
23027/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
23028/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
23029/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
23030/// #     ),
23031/// # ).build().await.unwrap();
23032///
23033/// # let client = hyper_util::client::legacy::Client::builder(
23034/// #     hyper_util::rt::TokioExecutor::new()
23035/// # )
23036/// # .build(
23037/// #     hyper_rustls::HttpsConnectorBuilder::new()
23038/// #         .with_native_roots()
23039/// #         .unwrap()
23040/// #         .https_or_http()
23041/// #         .enable_http2()
23042/// #         .build()
23043/// # );
23044/// # let mut hub = CloudIdentity::new(client, auth);
23045/// // As the method needs a request, you would usually fill it with the desired information
23046/// // into the respective structure. Some of the parts shown here might not be applicable !
23047/// // Values shown here are possibly random and not representative !
23048/// let mut req = InboundSsoAssignment::default();
23049///
23050/// // You can configure optional parameters by calling the respective setters at will, and
23051/// // execute the final call using `doit()`.
23052/// // Values shown here are possibly random and not representative !
23053/// let result = hub.inbound_sso_assignments().patch(req, "name")
23054///              .update_mask(FieldMask::new::<&str>(&[]))
23055///              .doit().await;
23056/// # }
23057/// ```
23058pub struct InboundSsoAssignmentPatchCall<'a, C>
23059where
23060    C: 'a,
23061{
23062    hub: &'a CloudIdentity<C>,
23063    _request: InboundSsoAssignment,
23064    _name: String,
23065    _update_mask: Option<common::FieldMask>,
23066    _delegate: Option<&'a mut dyn common::Delegate>,
23067    _additional_params: HashMap<String, String>,
23068    _scopes: BTreeSet<String>,
23069}
23070
23071impl<'a, C> common::CallBuilder for InboundSsoAssignmentPatchCall<'a, C> {}
23072
23073impl<'a, C> InboundSsoAssignmentPatchCall<'a, C>
23074where
23075    C: common::Connector,
23076{
23077    /// Perform the operation you have build so far.
23078    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
23079        use std::borrow::Cow;
23080        use std::io::{Read, Seek};
23081
23082        use common::{url::Params, ToParts};
23083        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
23084
23085        let mut dd = common::DefaultDelegate;
23086        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
23087        dlg.begin(common::MethodInfo {
23088            id: "cloudidentity.inboundSsoAssignments.patch",
23089            http_method: hyper::Method::PATCH,
23090        });
23091
23092        for &field in ["alt", "name", "updateMask"].iter() {
23093            if self._additional_params.contains_key(field) {
23094                dlg.finished(false);
23095                return Err(common::Error::FieldClash(field));
23096            }
23097        }
23098
23099        let mut params = Params::with_capacity(5 + self._additional_params.len());
23100        params.push("name", self._name);
23101        if let Some(value) = self._update_mask.as_ref() {
23102            params.push("updateMask", value.to_string());
23103        }
23104
23105        params.extend(self._additional_params.iter());
23106
23107        params.push("alt", "json");
23108        let mut url = self.hub._base_url.clone() + "v1/{+name}";
23109        if self._scopes.is_empty() {
23110            self._scopes
23111                .insert(Scope::CloudPlatform.as_ref().to_string());
23112        }
23113
23114        #[allow(clippy::single_element_loop)]
23115        for &(find_this, param_name) in [("{+name}", "name")].iter() {
23116            url = params.uri_replacement(url, param_name, find_this, true);
23117        }
23118        {
23119            let to_remove = ["name"];
23120            params.remove_params(&to_remove);
23121        }
23122
23123        let url = params.parse_with_url(&url);
23124
23125        let mut json_mime_type = mime::APPLICATION_JSON;
23126        let mut request_value_reader = {
23127            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
23128            common::remove_json_null_values(&mut value);
23129            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
23130            serde_json::to_writer(&mut dst, &value).unwrap();
23131            dst
23132        };
23133        let request_size = request_value_reader
23134            .seek(std::io::SeekFrom::End(0))
23135            .unwrap();
23136        request_value_reader
23137            .seek(std::io::SeekFrom::Start(0))
23138            .unwrap();
23139
23140        loop {
23141            let token = match self
23142                .hub
23143                .auth
23144                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
23145                .await
23146            {
23147                Ok(token) => token,
23148                Err(e) => match dlg.token(e) {
23149                    Ok(token) => token,
23150                    Err(e) => {
23151                        dlg.finished(false);
23152                        return Err(common::Error::MissingToken(e));
23153                    }
23154                },
23155            };
23156            request_value_reader
23157                .seek(std::io::SeekFrom::Start(0))
23158                .unwrap();
23159            let mut req_result = {
23160                let client = &self.hub.client;
23161                dlg.pre_request();
23162                let mut req_builder = hyper::Request::builder()
23163                    .method(hyper::Method::PATCH)
23164                    .uri(url.as_str())
23165                    .header(USER_AGENT, self.hub._user_agent.clone());
23166
23167                if let Some(token) = token.as_ref() {
23168                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
23169                }
23170
23171                let request = req_builder
23172                    .header(CONTENT_TYPE, json_mime_type.to_string())
23173                    .header(CONTENT_LENGTH, request_size as u64)
23174                    .body(common::to_body(
23175                        request_value_reader.get_ref().clone().into(),
23176                    ));
23177
23178                client.request(request.unwrap()).await
23179            };
23180
23181            match req_result {
23182                Err(err) => {
23183                    if let common::Retry::After(d) = dlg.http_error(&err) {
23184                        sleep(d).await;
23185                        continue;
23186                    }
23187                    dlg.finished(false);
23188                    return Err(common::Error::HttpError(err));
23189                }
23190                Ok(res) => {
23191                    let (mut parts, body) = res.into_parts();
23192                    let mut body = common::Body::new(body);
23193                    if !parts.status.is_success() {
23194                        let bytes = common::to_bytes(body).await.unwrap_or_default();
23195                        let error = serde_json::from_str(&common::to_string(&bytes));
23196                        let response = common::to_response(parts, bytes.into());
23197
23198                        if let common::Retry::After(d) =
23199                            dlg.http_failure(&response, error.as_ref().ok())
23200                        {
23201                            sleep(d).await;
23202                            continue;
23203                        }
23204
23205                        dlg.finished(false);
23206
23207                        return Err(match error {
23208                            Ok(value) => common::Error::BadRequest(value),
23209                            _ => common::Error::Failure(response),
23210                        });
23211                    }
23212                    let response = {
23213                        let bytes = common::to_bytes(body).await.unwrap_or_default();
23214                        let encoded = common::to_string(&bytes);
23215                        match serde_json::from_str(&encoded) {
23216                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
23217                            Err(error) => {
23218                                dlg.response_json_decode_error(&encoded, &error);
23219                                return Err(common::Error::JsonDecodeError(
23220                                    encoded.to_string(),
23221                                    error,
23222                                ));
23223                            }
23224                        }
23225                    };
23226
23227                    dlg.finished(true);
23228                    return Ok(response);
23229                }
23230            }
23231        }
23232    }
23233
23234    ///
23235    /// Sets the *request* property to the given value.
23236    ///
23237    /// Even though the property as already been set when instantiating this call,
23238    /// we provide this method for API completeness.
23239    pub fn request(
23240        mut self,
23241        new_value: InboundSsoAssignment,
23242    ) -> InboundSsoAssignmentPatchCall<'a, C> {
23243        self._request = new_value;
23244        self
23245    }
23246    /// Output only. [Resource name](https://cloud.google.com/apis/design/resource_names) of the Inbound SSO Assignment.
23247    ///
23248    /// Sets the *name* path property to the given value.
23249    ///
23250    /// Even though the property as already been set when instantiating this call,
23251    /// we provide this method for API completeness.
23252    pub fn name(mut self, new_value: &str) -> InboundSsoAssignmentPatchCall<'a, C> {
23253        self._name = new_value.to_string();
23254        self
23255    }
23256    /// Required. The list of fields to be updated.
23257    ///
23258    /// Sets the *update mask* query property to the given value.
23259    pub fn update_mask(
23260        mut self,
23261        new_value: common::FieldMask,
23262    ) -> InboundSsoAssignmentPatchCall<'a, C> {
23263        self._update_mask = Some(new_value);
23264        self
23265    }
23266    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
23267    /// while executing the actual API request.
23268    ///
23269    /// ````text
23270    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
23271    /// ````
23272    ///
23273    /// Sets the *delegate* property to the given value.
23274    pub fn delegate(
23275        mut self,
23276        new_value: &'a mut dyn common::Delegate,
23277    ) -> InboundSsoAssignmentPatchCall<'a, C> {
23278        self._delegate = Some(new_value);
23279        self
23280    }
23281
23282    /// Set any additional parameter of the query string used in the request.
23283    /// It should be used to set parameters which are not yet available through their own
23284    /// setters.
23285    ///
23286    /// Please note that this method must not be used to set any of the known parameters
23287    /// which have their own setter method. If done anyway, the request will fail.
23288    ///
23289    /// # Additional Parameters
23290    ///
23291    /// * *$.xgafv* (query-string) - V1 error format.
23292    /// * *access_token* (query-string) - OAuth access token.
23293    /// * *alt* (query-string) - Data format for response.
23294    /// * *callback* (query-string) - JSONP
23295    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
23296    /// * *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.
23297    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
23298    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
23299    /// * *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.
23300    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
23301    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
23302    pub fn param<T>(mut self, name: T, value: T) -> InboundSsoAssignmentPatchCall<'a, C>
23303    where
23304        T: AsRef<str>,
23305    {
23306        self._additional_params
23307            .insert(name.as_ref().to_string(), value.as_ref().to_string());
23308        self
23309    }
23310
23311    /// Identifies the authorization scope for the method you are building.
23312    ///
23313    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
23314    /// [`Scope::CloudPlatform`].
23315    ///
23316    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
23317    /// tokens for more than one scope.
23318    ///
23319    /// Usually there is more than one suitable scope to authorize an operation, some of which may
23320    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
23321    /// sufficient, a read-write scope will do as well.
23322    pub fn add_scope<St>(mut self, scope: St) -> InboundSsoAssignmentPatchCall<'a, C>
23323    where
23324        St: AsRef<str>,
23325    {
23326        self._scopes.insert(String::from(scope.as_ref()));
23327        self
23328    }
23329    /// Identifies the authorization scope(s) for the method you are building.
23330    ///
23331    /// See [`Self::add_scope()`] for details.
23332    pub fn add_scopes<I, St>(mut self, scopes: I) -> InboundSsoAssignmentPatchCall<'a, C>
23333    where
23334        I: IntoIterator<Item = St>,
23335        St: AsRef<str>,
23336    {
23337        self._scopes
23338            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
23339        self
23340    }
23341
23342    /// Removes all scopes, and no default scope will be used either.
23343    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
23344    /// for details).
23345    pub fn clear_scopes(mut self) -> InboundSsoAssignmentPatchCall<'a, C> {
23346        self._scopes.clear();
23347        self
23348    }
23349}
23350
23351/// Get a policy.
23352///
23353/// A builder for the *get* method supported by a *policy* resource.
23354/// It is not used directly, but through a [`PolicyMethods`] instance.
23355///
23356/// # Example
23357///
23358/// Instantiate a resource method builder
23359///
23360/// ```test_harness,no_run
23361/// # extern crate hyper;
23362/// # extern crate hyper_rustls;
23363/// # extern crate google_cloudidentity1 as cloudidentity1;
23364/// # async fn dox() {
23365/// # use cloudidentity1::{CloudIdentity, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
23366///
23367/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
23368/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
23369/// #     .with_native_roots()
23370/// #     .unwrap()
23371/// #     .https_only()
23372/// #     .enable_http2()
23373/// #     .build();
23374///
23375/// # let executor = hyper_util::rt::TokioExecutor::new();
23376/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
23377/// #     secret,
23378/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
23379/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
23380/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
23381/// #     ),
23382/// # ).build().await.unwrap();
23383///
23384/// # let client = hyper_util::client::legacy::Client::builder(
23385/// #     hyper_util::rt::TokioExecutor::new()
23386/// # )
23387/// # .build(
23388/// #     hyper_rustls::HttpsConnectorBuilder::new()
23389/// #         .with_native_roots()
23390/// #         .unwrap()
23391/// #         .https_or_http()
23392/// #         .enable_http2()
23393/// #         .build()
23394/// # );
23395/// # let mut hub = CloudIdentity::new(client, auth);
23396/// // You can configure optional parameters by calling the respective setters at will, and
23397/// // execute the final call using `doit()`.
23398/// // Values shown here are possibly random and not representative !
23399/// let result = hub.policies().get("name")
23400///              .doit().await;
23401/// # }
23402/// ```
23403pub struct PolicyGetCall<'a, C>
23404where
23405    C: 'a,
23406{
23407    hub: &'a CloudIdentity<C>,
23408    _name: String,
23409    _delegate: Option<&'a mut dyn common::Delegate>,
23410    _additional_params: HashMap<String, String>,
23411    _scopes: BTreeSet<String>,
23412}
23413
23414impl<'a, C> common::CallBuilder for PolicyGetCall<'a, C> {}
23415
23416impl<'a, C> PolicyGetCall<'a, C>
23417where
23418    C: common::Connector,
23419{
23420    /// Perform the operation you have build so far.
23421    pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
23422        use std::borrow::Cow;
23423        use std::io::{Read, Seek};
23424
23425        use common::{url::Params, ToParts};
23426        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
23427
23428        let mut dd = common::DefaultDelegate;
23429        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
23430        dlg.begin(common::MethodInfo {
23431            id: "cloudidentity.policies.get",
23432            http_method: hyper::Method::GET,
23433        });
23434
23435        for &field in ["alt", "name"].iter() {
23436            if self._additional_params.contains_key(field) {
23437                dlg.finished(false);
23438                return Err(common::Error::FieldClash(field));
23439            }
23440        }
23441
23442        let mut params = Params::with_capacity(3 + self._additional_params.len());
23443        params.push("name", self._name);
23444
23445        params.extend(self._additional_params.iter());
23446
23447        params.push("alt", "json");
23448        let mut url = self.hub._base_url.clone() + "v1/{+name}";
23449        if self._scopes.is_empty() {
23450            self._scopes
23451                .insert(Scope::CloudIdentityPolicyReadonly.as_ref().to_string());
23452        }
23453
23454        #[allow(clippy::single_element_loop)]
23455        for &(find_this, param_name) in [("{+name}", "name")].iter() {
23456            url = params.uri_replacement(url, param_name, find_this, true);
23457        }
23458        {
23459            let to_remove = ["name"];
23460            params.remove_params(&to_remove);
23461        }
23462
23463        let url = params.parse_with_url(&url);
23464
23465        loop {
23466            let token = match self
23467                .hub
23468                .auth
23469                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
23470                .await
23471            {
23472                Ok(token) => token,
23473                Err(e) => match dlg.token(e) {
23474                    Ok(token) => token,
23475                    Err(e) => {
23476                        dlg.finished(false);
23477                        return Err(common::Error::MissingToken(e));
23478                    }
23479                },
23480            };
23481            let mut req_result = {
23482                let client = &self.hub.client;
23483                dlg.pre_request();
23484                let mut req_builder = hyper::Request::builder()
23485                    .method(hyper::Method::GET)
23486                    .uri(url.as_str())
23487                    .header(USER_AGENT, self.hub._user_agent.clone());
23488
23489                if let Some(token) = token.as_ref() {
23490                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
23491                }
23492
23493                let request = req_builder
23494                    .header(CONTENT_LENGTH, 0_u64)
23495                    .body(common::to_body::<String>(None));
23496
23497                client.request(request.unwrap()).await
23498            };
23499
23500            match req_result {
23501                Err(err) => {
23502                    if let common::Retry::After(d) = dlg.http_error(&err) {
23503                        sleep(d).await;
23504                        continue;
23505                    }
23506                    dlg.finished(false);
23507                    return Err(common::Error::HttpError(err));
23508                }
23509                Ok(res) => {
23510                    let (mut parts, body) = res.into_parts();
23511                    let mut body = common::Body::new(body);
23512                    if !parts.status.is_success() {
23513                        let bytes = common::to_bytes(body).await.unwrap_or_default();
23514                        let error = serde_json::from_str(&common::to_string(&bytes));
23515                        let response = common::to_response(parts, bytes.into());
23516
23517                        if let common::Retry::After(d) =
23518                            dlg.http_failure(&response, error.as_ref().ok())
23519                        {
23520                            sleep(d).await;
23521                            continue;
23522                        }
23523
23524                        dlg.finished(false);
23525
23526                        return Err(match error {
23527                            Ok(value) => common::Error::BadRequest(value),
23528                            _ => common::Error::Failure(response),
23529                        });
23530                    }
23531                    let response = {
23532                        let bytes = common::to_bytes(body).await.unwrap_or_default();
23533                        let encoded = common::to_string(&bytes);
23534                        match serde_json::from_str(&encoded) {
23535                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
23536                            Err(error) => {
23537                                dlg.response_json_decode_error(&encoded, &error);
23538                                return Err(common::Error::JsonDecodeError(
23539                                    encoded.to_string(),
23540                                    error,
23541                                ));
23542                            }
23543                        }
23544                    };
23545
23546                    dlg.finished(true);
23547                    return Ok(response);
23548                }
23549            }
23550        }
23551    }
23552
23553    /// Required. The name of the policy to retrieve. Format: `policies/{policy}`.
23554    ///
23555    /// Sets the *name* path property to the given value.
23556    ///
23557    /// Even though the property as already been set when instantiating this call,
23558    /// we provide this method for API completeness.
23559    pub fn name(mut self, new_value: &str) -> PolicyGetCall<'a, C> {
23560        self._name = new_value.to_string();
23561        self
23562    }
23563    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
23564    /// while executing the actual API request.
23565    ///
23566    /// ````text
23567    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
23568    /// ````
23569    ///
23570    /// Sets the *delegate* property to the given value.
23571    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> PolicyGetCall<'a, C> {
23572        self._delegate = Some(new_value);
23573        self
23574    }
23575
23576    /// Set any additional parameter of the query string used in the request.
23577    /// It should be used to set parameters which are not yet available through their own
23578    /// setters.
23579    ///
23580    /// Please note that this method must not be used to set any of the known parameters
23581    /// which have their own setter method. If done anyway, the request will fail.
23582    ///
23583    /// # Additional Parameters
23584    ///
23585    /// * *$.xgafv* (query-string) - V1 error format.
23586    /// * *access_token* (query-string) - OAuth access token.
23587    /// * *alt* (query-string) - Data format for response.
23588    /// * *callback* (query-string) - JSONP
23589    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
23590    /// * *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.
23591    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
23592    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
23593    /// * *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.
23594    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
23595    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
23596    pub fn param<T>(mut self, name: T, value: T) -> PolicyGetCall<'a, C>
23597    where
23598        T: AsRef<str>,
23599    {
23600        self._additional_params
23601            .insert(name.as_ref().to_string(), value.as_ref().to_string());
23602        self
23603    }
23604
23605    /// Identifies the authorization scope for the method you are building.
23606    ///
23607    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
23608    /// [`Scope::CloudIdentityPolicyReadonly`].
23609    ///
23610    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
23611    /// tokens for more than one scope.
23612    ///
23613    /// Usually there is more than one suitable scope to authorize an operation, some of which may
23614    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
23615    /// sufficient, a read-write scope will do as well.
23616    pub fn add_scope<St>(mut self, scope: St) -> PolicyGetCall<'a, C>
23617    where
23618        St: AsRef<str>,
23619    {
23620        self._scopes.insert(String::from(scope.as_ref()));
23621        self
23622    }
23623    /// Identifies the authorization scope(s) for the method you are building.
23624    ///
23625    /// See [`Self::add_scope()`] for details.
23626    pub fn add_scopes<I, St>(mut self, scopes: I) -> PolicyGetCall<'a, C>
23627    where
23628        I: IntoIterator<Item = St>,
23629        St: AsRef<str>,
23630    {
23631        self._scopes
23632            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
23633        self
23634    }
23635
23636    /// Removes all scopes, and no default scope will be used either.
23637    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
23638    /// for details).
23639    pub fn clear_scopes(mut self) -> PolicyGetCall<'a, C> {
23640        self._scopes.clear();
23641        self
23642    }
23643}
23644
23645/// List policies.
23646///
23647/// A builder for the *list* method supported by a *policy* resource.
23648/// It is not used directly, but through a [`PolicyMethods`] instance.
23649///
23650/// # Example
23651///
23652/// Instantiate a resource method builder
23653///
23654/// ```test_harness,no_run
23655/// # extern crate hyper;
23656/// # extern crate hyper_rustls;
23657/// # extern crate google_cloudidentity1 as cloudidentity1;
23658/// # async fn dox() {
23659/// # use cloudidentity1::{CloudIdentity, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
23660///
23661/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
23662/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
23663/// #     .with_native_roots()
23664/// #     .unwrap()
23665/// #     .https_only()
23666/// #     .enable_http2()
23667/// #     .build();
23668///
23669/// # let executor = hyper_util::rt::TokioExecutor::new();
23670/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
23671/// #     secret,
23672/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
23673/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
23674/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
23675/// #     ),
23676/// # ).build().await.unwrap();
23677///
23678/// # let client = hyper_util::client::legacy::Client::builder(
23679/// #     hyper_util::rt::TokioExecutor::new()
23680/// # )
23681/// # .build(
23682/// #     hyper_rustls::HttpsConnectorBuilder::new()
23683/// #         .with_native_roots()
23684/// #         .unwrap()
23685/// #         .https_or_http()
23686/// #         .enable_http2()
23687/// #         .build()
23688/// # );
23689/// # let mut hub = CloudIdentity::new(client, auth);
23690/// // You can configure optional parameters by calling the respective setters at will, and
23691/// // execute the final call using `doit()`.
23692/// // Values shown here are possibly random and not representative !
23693/// let result = hub.policies().list()
23694///              .page_token("dolores")
23695///              .page_size(-95)
23696///              .filter("erat")
23697///              .doit().await;
23698/// # }
23699/// ```
23700pub struct PolicyListCall<'a, C>
23701where
23702    C: 'a,
23703{
23704    hub: &'a CloudIdentity<C>,
23705    _page_token: Option<String>,
23706    _page_size: Option<i32>,
23707    _filter: Option<String>,
23708    _delegate: Option<&'a mut dyn common::Delegate>,
23709    _additional_params: HashMap<String, String>,
23710    _scopes: BTreeSet<String>,
23711}
23712
23713impl<'a, C> common::CallBuilder for PolicyListCall<'a, C> {}
23714
23715impl<'a, C> PolicyListCall<'a, C>
23716where
23717    C: common::Connector,
23718{
23719    /// Perform the operation you have build so far.
23720    pub async fn doit(mut self) -> common::Result<(common::Response, ListPoliciesResponse)> {
23721        use std::borrow::Cow;
23722        use std::io::{Read, Seek};
23723
23724        use common::{url::Params, ToParts};
23725        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
23726
23727        let mut dd = common::DefaultDelegate;
23728        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
23729        dlg.begin(common::MethodInfo {
23730            id: "cloudidentity.policies.list",
23731            http_method: hyper::Method::GET,
23732        });
23733
23734        for &field in ["alt", "pageToken", "pageSize", "filter"].iter() {
23735            if self._additional_params.contains_key(field) {
23736                dlg.finished(false);
23737                return Err(common::Error::FieldClash(field));
23738            }
23739        }
23740
23741        let mut params = Params::with_capacity(5 + self._additional_params.len());
23742        if let Some(value) = self._page_token.as_ref() {
23743            params.push("pageToken", value);
23744        }
23745        if let Some(value) = self._page_size.as_ref() {
23746            params.push("pageSize", value.to_string());
23747        }
23748        if let Some(value) = self._filter.as_ref() {
23749            params.push("filter", value);
23750        }
23751
23752        params.extend(self._additional_params.iter());
23753
23754        params.push("alt", "json");
23755        let mut url = self.hub._base_url.clone() + "v1/policies";
23756        if self._scopes.is_empty() {
23757            self._scopes
23758                .insert(Scope::CloudIdentityPolicyReadonly.as_ref().to_string());
23759        }
23760
23761        let url = params.parse_with_url(&url);
23762
23763        loop {
23764            let token = match self
23765                .hub
23766                .auth
23767                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
23768                .await
23769            {
23770                Ok(token) => token,
23771                Err(e) => match dlg.token(e) {
23772                    Ok(token) => token,
23773                    Err(e) => {
23774                        dlg.finished(false);
23775                        return Err(common::Error::MissingToken(e));
23776                    }
23777                },
23778            };
23779            let mut req_result = {
23780                let client = &self.hub.client;
23781                dlg.pre_request();
23782                let mut req_builder = hyper::Request::builder()
23783                    .method(hyper::Method::GET)
23784                    .uri(url.as_str())
23785                    .header(USER_AGENT, self.hub._user_agent.clone());
23786
23787                if let Some(token) = token.as_ref() {
23788                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
23789                }
23790
23791                let request = req_builder
23792                    .header(CONTENT_LENGTH, 0_u64)
23793                    .body(common::to_body::<String>(None));
23794
23795                client.request(request.unwrap()).await
23796            };
23797
23798            match req_result {
23799                Err(err) => {
23800                    if let common::Retry::After(d) = dlg.http_error(&err) {
23801                        sleep(d).await;
23802                        continue;
23803                    }
23804                    dlg.finished(false);
23805                    return Err(common::Error::HttpError(err));
23806                }
23807                Ok(res) => {
23808                    let (mut parts, body) = res.into_parts();
23809                    let mut body = common::Body::new(body);
23810                    if !parts.status.is_success() {
23811                        let bytes = common::to_bytes(body).await.unwrap_or_default();
23812                        let error = serde_json::from_str(&common::to_string(&bytes));
23813                        let response = common::to_response(parts, bytes.into());
23814
23815                        if let common::Retry::After(d) =
23816                            dlg.http_failure(&response, error.as_ref().ok())
23817                        {
23818                            sleep(d).await;
23819                            continue;
23820                        }
23821
23822                        dlg.finished(false);
23823
23824                        return Err(match error {
23825                            Ok(value) => common::Error::BadRequest(value),
23826                            _ => common::Error::Failure(response),
23827                        });
23828                    }
23829                    let response = {
23830                        let bytes = common::to_bytes(body).await.unwrap_or_default();
23831                        let encoded = common::to_string(&bytes);
23832                        match serde_json::from_str(&encoded) {
23833                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
23834                            Err(error) => {
23835                                dlg.response_json_decode_error(&encoded, &error);
23836                                return Err(common::Error::JsonDecodeError(
23837                                    encoded.to_string(),
23838                                    error,
23839                                ));
23840                            }
23841                        }
23842                    };
23843
23844                    dlg.finished(true);
23845                    return Ok(response);
23846                }
23847            }
23848        }
23849    }
23850
23851    /// Optional. The pagination token received from a prior call to PoliciesService.ListPolicies to retrieve the next page of results. When paginating, all other parameters provided to `ListPoliciesRequest` must match the call that provided the page token.
23852    ///
23853    /// Sets the *page token* query property to the given value.
23854    pub fn page_token(mut self, new_value: &str) -> PolicyListCall<'a, C> {
23855        self._page_token = Some(new_value.to_string());
23856        self
23857    }
23858    /// Optional. The maximum number of results to return. The service can return fewer than this number. If omitted or set to 0, the default is 50 results per page. The maximum allowed value is 100. `page_size` values greater than 100 default to 100.
23859    ///
23860    /// Sets the *page size* query property to the given value.
23861    pub fn page_size(mut self, new_value: i32) -> PolicyListCall<'a, C> {
23862        self._page_size = Some(new_value);
23863        self
23864    }
23865    /// Optional. A CEL expression for filtering the results. Policies can be filtered by application with this expression: setting.type.matches('^settings/gmail\\..*$') Policies can be filtered by setting type with this expression: setting.type.matches('^.*\\.service_status$') A maximum of one of the above setting.type clauses can be used. Policies can be filtered by customer with this expression: customer == "customers/{customer}" Where `customer` is the `id` from the [Admin SDK `Customer` resource](https://developers.google.com/admin-sdk/directory/reference/rest/v1/customers). You may use `customers/my_customer` to specify your own organization. When no customer is mentioned it will be default to customers/my_customer. A maximum of one customer clause can be used. The above clauses can only be combined together in a single filter expression with the `&&` operator.
23866    ///
23867    /// Sets the *filter* query property to the given value.
23868    pub fn filter(mut self, new_value: &str) -> PolicyListCall<'a, C> {
23869        self._filter = Some(new_value.to_string());
23870        self
23871    }
23872    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
23873    /// while executing the actual API request.
23874    ///
23875    /// ````text
23876    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
23877    /// ````
23878    ///
23879    /// Sets the *delegate* property to the given value.
23880    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> PolicyListCall<'a, C> {
23881        self._delegate = Some(new_value);
23882        self
23883    }
23884
23885    /// Set any additional parameter of the query string used in the request.
23886    /// It should be used to set parameters which are not yet available through their own
23887    /// setters.
23888    ///
23889    /// Please note that this method must not be used to set any of the known parameters
23890    /// which have their own setter method. If done anyway, the request will fail.
23891    ///
23892    /// # Additional Parameters
23893    ///
23894    /// * *$.xgafv* (query-string) - V1 error format.
23895    /// * *access_token* (query-string) - OAuth access token.
23896    /// * *alt* (query-string) - Data format for response.
23897    /// * *callback* (query-string) - JSONP
23898    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
23899    /// * *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.
23900    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
23901    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
23902    /// * *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.
23903    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
23904    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
23905    pub fn param<T>(mut self, name: T, value: T) -> PolicyListCall<'a, C>
23906    where
23907        T: AsRef<str>,
23908    {
23909        self._additional_params
23910            .insert(name.as_ref().to_string(), value.as_ref().to_string());
23911        self
23912    }
23913
23914    /// Identifies the authorization scope for the method you are building.
23915    ///
23916    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
23917    /// [`Scope::CloudIdentityPolicyReadonly`].
23918    ///
23919    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
23920    /// tokens for more than one scope.
23921    ///
23922    /// Usually there is more than one suitable scope to authorize an operation, some of which may
23923    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
23924    /// sufficient, a read-write scope will do as well.
23925    pub fn add_scope<St>(mut self, scope: St) -> PolicyListCall<'a, C>
23926    where
23927        St: AsRef<str>,
23928    {
23929        self._scopes.insert(String::from(scope.as_ref()));
23930        self
23931    }
23932    /// Identifies the authorization scope(s) for the method you are building.
23933    ///
23934    /// See [`Self::add_scope()`] for details.
23935    pub fn add_scopes<I, St>(mut self, scopes: I) -> PolicyListCall<'a, C>
23936    where
23937        I: IntoIterator<Item = St>,
23938        St: AsRef<str>,
23939    {
23940        self._scopes
23941            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
23942        self
23943    }
23944
23945    /// Removes all scopes, and no default scope will be used either.
23946    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
23947    /// for details).
23948    pub fn clear_scopes(mut self) -> PolicyListCall<'a, C> {
23949        self._scopes.clear();
23950        self
23951    }
23952}