google_iam1/
api.rs

1#![allow(clippy::ptr_arg)]
2
3use std::collections::{BTreeSet, HashMap};
4
5use tokio::time::sleep;
6
7// ##############
8// UTILITIES ###
9// ############
10
11/// Identifies the an OAuth2 authorization scope.
12/// A scope is needed when requesting an
13/// [authorization token](https://developers.google.com/youtube/v3/guides/authentication).
14#[derive(PartialEq, Eq, Ord, PartialOrd, Hash, Debug, Clone, Copy)]
15pub enum Scope {
16    /// See, edit, configure, and delete your Google Cloud data and see the email address for your Google Account.
17    CloudPlatform,
18}
19
20impl AsRef<str> for Scope {
21    fn as_ref(&self) -> &str {
22        match *self {
23            Scope::CloudPlatform => "https://www.googleapis.com/auth/cloud-platform",
24        }
25    }
26}
27
28#[allow(clippy::derivable_impls)]
29impl Default for Scope {
30    fn default() -> Scope {
31        Scope::CloudPlatform
32    }
33}
34
35// ########
36// HUB ###
37// ######
38
39/// Central instance to access all Iam related resource activities
40///
41/// # Examples
42///
43/// Instantiate a new hub
44///
45/// ```test_harness,no_run
46/// extern crate hyper;
47/// extern crate hyper_rustls;
48/// extern crate google_iam1 as iam1;
49/// use iam1::api::WorkforcePoolProviderKey;
50/// use iam1::{Result, Error};
51/// # async fn dox() {
52/// use iam1::{Iam, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
53///
54/// // Get an ApplicationSecret instance by some means. It contains the `client_id` and
55/// // `client_secret`, among other things.
56/// let secret: yup_oauth2::ApplicationSecret = Default::default();
57/// // Instantiate the authenticator. It will choose a suitable authentication flow for you,
58/// // unless you replace  `None` with the desired Flow.
59/// // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about
60/// // what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and
61/// // retrieve them from storage.
62/// let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
63///     secret,
64///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
65/// ).build().await.unwrap();
66///
67/// let client = hyper_util::client::legacy::Client::builder(
68///     hyper_util::rt::TokioExecutor::new()
69/// )
70/// .build(
71///     hyper_rustls::HttpsConnectorBuilder::new()
72///         .with_native_roots()
73///         .unwrap()
74///         .https_or_http()
75///         .enable_http1()
76///         .build()
77/// );
78/// let mut hub = Iam::new(client, auth);
79/// // As the method needs a request, you would usually fill it with the desired information
80/// // into the respective structure. Some of the parts shown here might not be applicable !
81/// // Values shown here are possibly random and not representative !
82/// let mut req = WorkforcePoolProviderKey::default();
83///
84/// // You can configure optional parameters by calling the respective setters at will, and
85/// // execute the final call using `doit()`.
86/// // Values shown here are possibly random and not representative !
87/// let result = hub.locations().workforce_pools_providers_keys_create(req, "parent")
88///              .workforce_pool_provider_key_id("At")
89///              .doit().await;
90///
91/// match result {
92///     Err(e) => match e {
93///         // The Error enum provides details about what exactly happened.
94///         // You can also just use its `Debug`, `Display` or `Error` traits
95///          Error::HttpError(_)
96///         |Error::Io(_)
97///         |Error::MissingAPIKey
98///         |Error::MissingToken(_)
99///         |Error::Cancelled
100///         |Error::UploadSizeLimitExceeded(_, _)
101///         |Error::Failure(_)
102///         |Error::BadRequest(_)
103///         |Error::FieldClash(_)
104///         |Error::JsonDecodeError(_, _) => println!("{}", e),
105///     },
106///     Ok(res) => println!("Success: {:?}", res),
107/// }
108/// # }
109/// ```
110#[derive(Clone)]
111pub struct Iam<C> {
112    pub client: common::Client<C>,
113    pub auth: Box<dyn common::GetToken>,
114    _user_agent: String,
115    _base_url: String,
116    _root_url: String,
117}
118
119impl<C> common::Hub for Iam<C> {}
120
121impl<'a, C> Iam<C> {
122    pub fn new<A: 'static + common::GetToken>(client: common::Client<C>, auth: A) -> Iam<C> {
123        Iam {
124            client,
125            auth: Box::new(auth),
126            _user_agent: "google-api-rust-client/6.0.0".to_string(),
127            _base_url: "https://iam.googleapis.com/".to_string(),
128            _root_url: "https://iam.googleapis.com/".to_string(),
129        }
130    }
131
132    pub fn iam_policies(&'a self) -> IamPolicyMethods<'a, C> {
133        IamPolicyMethods { hub: self }
134    }
135    pub fn locations(&'a self) -> LocationMethods<'a, C> {
136        LocationMethods { hub: self }
137    }
138    pub fn organizations(&'a self) -> OrganizationMethods<'a, C> {
139        OrganizationMethods { hub: self }
140    }
141    pub fn permissions(&'a self) -> PermissionMethods<'a, C> {
142        PermissionMethods { hub: self }
143    }
144    pub fn projects(&'a self) -> ProjectMethods<'a, C> {
145        ProjectMethods { hub: self }
146    }
147    pub fn roles(&'a self) -> RoleMethods<'a, C> {
148        RoleMethods { hub: self }
149    }
150
151    /// Set the user-agent header field to use in all requests to the server.
152    /// It defaults to `google-api-rust-client/6.0.0`.
153    ///
154    /// Returns the previously set user-agent.
155    pub fn user_agent(&mut self, agent_name: String) -> String {
156        std::mem::replace(&mut self._user_agent, agent_name)
157    }
158
159    /// Set the base url to use in all requests to the server.
160    /// It defaults to `https://iam.googleapis.com/`.
161    ///
162    /// Returns the previously set base url.
163    pub fn base_url(&mut self, new_base_url: String) -> String {
164        std::mem::replace(&mut self._base_url, new_base_url)
165    }
166
167    /// Set the root url to use in all requests to the server.
168    /// It defaults to `https://iam.googleapis.com/`.
169    ///
170    /// Returns the previously set root url.
171    pub fn root_url(&mut self, new_root_url: String) -> String {
172        std::mem::replace(&mut self._root_url, new_root_url)
173    }
174}
175
176// ############
177// SCHEMAS ###
178// ##########
179/// Access related restrictions on the workforce pool.
180///
181/// This type is not used in any activity, and only used as *part* of another schema.
182///
183#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
184#[serde_with::serde_as]
185#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
186pub struct AccessRestrictions {
187    /// Optional. Immutable. Services allowed for web sign-in with the workforce pool. If not set by default there are no restrictions.
188    #[serde(rename = "allowedServices")]
189    pub allowed_services: Option<Vec<ServiceConfig>>,
190    /// Optional. Disable programmatic sign-in by disabling token issue via the Security Token API endpoint. See [Security Token Service API] (https://cloud.google.com/iam/docs/reference/sts/rest).
191    #[serde(rename = "disableProgrammaticSignin")]
192    pub disable_programmatic_signin: Option<bool>,
193}
194
195impl common::Part for AccessRestrictions {}
196
197/// Specifies the audit configuration for a service. The configuration determines which permission types are logged, and what identities, if any, are exempted from logging. An AuditConfig must have one or more AuditLogConfigs. If there are AuditConfigs for both `allServices` and a specific service, the union of the two AuditConfigs is used for that service: the log_types specified in each AuditConfig are enabled, and the exempted_members in each AuditLogConfig are exempted. Example Policy with multiple AuditConfigs: { "audit_configs": [ { "service": "allServices", "audit_log_configs": [ { "log_type": "DATA_READ", "exempted_members": [ "user:jose@example.com" ] }, { "log_type": "DATA_WRITE" }, { "log_type": "ADMIN_READ" } ] }, { "service": "sampleservice.googleapis.com", "audit_log_configs": [ { "log_type": "DATA_READ" }, { "log_type": "DATA_WRITE", "exempted_members": [ "user:aliya@example.com" ] } ] } ] } For sampleservice, this policy enables DATA_READ, DATA_WRITE and ADMIN_READ logging. It also exempts `jose@example.com` from DATA_READ logging, and `aliya@example.com` from DATA_WRITE logging.
198///
199/// This type is not used in any activity, and only used as *part* of another schema.
200///
201#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
202#[serde_with::serde_as]
203#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
204pub struct AuditConfig {
205    /// The configuration for logging of each type of permission.
206    #[serde(rename = "auditLogConfigs")]
207    pub audit_log_configs: Option<Vec<AuditLogConfig>>,
208    /// Specifies a service that will be enabled for audit logging. For example, `storage.googleapis.com`, `cloudsql.googleapis.com`. `allServices` is a special value that covers all services.
209    pub service: Option<String>,
210}
211
212impl common::Part for AuditConfig {}
213
214/// Provides the configuration for logging a type of permissions. Example: { "audit_log_configs": [ { "log_type": "DATA_READ", "exempted_members": [ "user:jose@example.com" ] }, { "log_type": "DATA_WRITE" } ] } This enables 'DATA_READ' and 'DATA_WRITE' logging, while exempting jose@example.com from DATA_READ logging.
215///
216/// This type is not used in any activity, and only used as *part* of another schema.
217///
218#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
219#[serde_with::serde_as]
220#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
221pub struct AuditLogConfig {
222    /// Specifies the identities that do not cause logging for this type of permission. Follows the same format of Binding.members.
223    #[serde(rename = "exemptedMembers")]
224    pub exempted_members: Option<Vec<String>>,
225    /// The log type that this config enables.
226    #[serde(rename = "logType")]
227    pub log_type: Option<String>,
228}
229
230impl common::Part for AuditLogConfig {}
231
232/// Contains information about an auditable service.
233///
234/// This type is not used in any activity, and only used as *part* of another schema.
235///
236#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
237#[serde_with::serde_as]
238#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
239pub struct AuditableService {
240    /// Public name of the service. For example, the service name for IAM is 'iam.googleapis.com'.
241    pub name: Option<String>,
242}
243
244impl common::Part for AuditableService {}
245
246/// Represents an Amazon Web Services identity provider.
247///
248/// This type is not used in any activity, and only used as *part* of another schema.
249///
250#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
251#[serde_with::serde_as]
252#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
253pub struct Aws {
254    /// Required. The AWS account ID.
255    #[serde(rename = "accountId")]
256    pub account_id: Option<String>,
257}
258
259impl common::Part for Aws {}
260
261/// Associates `members`, or principals, with a `role`.
262///
263/// This type is not used in any activity, and only used as *part* of another schema.
264///
265#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
266#[serde_with::serde_as]
267#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
268pub struct Binding {
269    /// The condition that is associated with this binding. If the condition evaluates to `true`, then this binding applies to the current request. If the condition evaluates to `false`, then this binding does not apply to the current request. However, a different role binding might grant the same role to one or more of the principals in this binding. To learn which resources support conditions in their IAM policies, see the [IAM documentation](https://cloud.google.com/iam/help/conditions/resource-policies).
270    pub condition: Option<Expr>,
271    /// Specifies the principals requesting access for a Google Cloud resource. `members` can have the following values: * `allUsers`: A special identifier that represents anyone who is on the internet; with or without a Google account. * `allAuthenticatedUsers`: A special identifier that represents anyone who is authenticated with a Google account or a service account. Does not include identities that come from external identity providers (IdPs) through identity federation. * `user:{emailid}`: An email address that represents a specific Google account. For example, `alice@example.com` . * `serviceAccount:{emailid}`: An email address that represents a Google service account. For example, `my-other-app@appspot.gserviceaccount.com`. * `serviceAccount:{projectid}.svc.id.goog[{namespace}/{kubernetes-sa}]`: An identifier for a [Kubernetes service account](https://cloud.google.com/kubernetes-engine/docs/how-to/kubernetes-service-accounts). For example, `my-project.svc.id.goog[my-namespace/my-kubernetes-sa]`. * `group:{emailid}`: An email address that represents a Google group. For example, `admins@example.com`. * `domain:{domain}`: The G Suite domain (primary) that represents all the users of that domain. For example, `google.com` or `example.com`. * `principal://iam.googleapis.com/locations/global/workforcePools/{pool_id}/subject/{subject_attribute_value}`: A single identity in a workforce identity pool. * `principalSet://iam.googleapis.com/locations/global/workforcePools/{pool_id}/group/{group_id}`: All workforce identities in a group. * `principalSet://iam.googleapis.com/locations/global/workforcePools/{pool_id}/attribute.{attribute_name}/{attribute_value}`: All workforce identities with a specific attribute value. * `principalSet://iam.googleapis.com/locations/global/workforcePools/{pool_id}/*`: All identities in a workforce identity pool. * `principal://iam.googleapis.com/projects/{project_number}/locations/global/workloadIdentityPools/{pool_id}/subject/{subject_attribute_value}`: A single identity in a workload identity pool. * `principalSet://iam.googleapis.com/projects/{project_number}/locations/global/workloadIdentityPools/{pool_id}/group/{group_id}`: A workload identity pool group. * `principalSet://iam.googleapis.com/projects/{project_number}/locations/global/workloadIdentityPools/{pool_id}/attribute.{attribute_name}/{attribute_value}`: All identities in a workload identity pool with a certain attribute. * `principalSet://iam.googleapis.com/projects/{project_number}/locations/global/workloadIdentityPools/{pool_id}/*`: All identities in a workload identity pool. * `deleted:user:{emailid}?uid={uniqueid}`: An email address (plus unique identifier) representing a user that has been recently deleted. For example, `alice@example.com?uid=123456789012345678901`. If the user is recovered, this value reverts to `user:{emailid}` and the recovered user retains the role in the binding. * `deleted:serviceAccount:{emailid}?uid={uniqueid}`: An email address (plus unique identifier) representing a service account that has been recently deleted. For example, `my-other-app@appspot.gserviceaccount.com?uid=123456789012345678901`. If the service account is undeleted, this value reverts to `serviceAccount:{emailid}` and the undeleted service account retains the role in the binding. * `deleted:group:{emailid}?uid={uniqueid}`: An email address (plus unique identifier) representing a Google group that has been recently deleted. For example, `admins@example.com?uid=123456789012345678901`. If the group is recovered, this value reverts to `group:{emailid}` and the recovered group retains the role in the binding. * `deleted:principal://iam.googleapis.com/locations/global/workforcePools/{pool_id}/subject/{subject_attribute_value}`: Deleted single identity in a workforce identity pool. For example, `deleted:principal://iam.googleapis.com/locations/global/workforcePools/my-pool-id/subject/my-subject-attribute-value`.
272    pub members: Option<Vec<String>>,
273    /// Role that is assigned to the list of `members`, or principals. For example, `roles/viewer`, `roles/editor`, or `roles/owner`. For an overview of the IAM roles and permissions, see the [IAM documentation](https://cloud.google.com/iam/docs/roles-overview). For a list of the available pre-defined roles, see [here](https://cloud.google.com/iam/docs/understanding-roles).
274    pub role: Option<String>,
275}
276
277impl common::Part for Binding {}
278
279/// The request to create a new role.
280///
281/// # Activities
282///
283/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
284/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
285///
286/// * [roles create organizations](OrganizationRoleCreateCall) (request)
287/// * [roles create projects](ProjectRoleCreateCall) (request)
288#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
289#[serde_with::serde_as]
290#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
291pub struct CreateRoleRequest {
292    /// The Role resource to create.
293    pub role: Option<Role>,
294    /// The role ID to use for this role. A role ID may contain alphanumeric characters, underscores (`_`), and periods (`.`). It must contain a minimum of 3 characters and a maximum of 64 characters.
295    #[serde(rename = "roleId")]
296    pub role_id: Option<String>,
297}
298
299impl common::RequestValue for CreateRoleRequest {}
300
301/// The service account key create request.
302///
303/// # Activities
304///
305/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
306/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
307///
308/// * [service accounts keys create projects](ProjectServiceAccountKeyCreateCall) (request)
309#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
310#[serde_with::serde_as]
311#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
312pub struct CreateServiceAccountKeyRequest {
313    /// Which type of key and algorithm to use for the key. The default is currently a 2K RSA key. However this may change in the future.
314    #[serde(rename = "keyAlgorithm")]
315    pub key_algorithm: Option<String>,
316    /// The output format of the private key. The default value is `TYPE_GOOGLE_CREDENTIALS_FILE`, which is the Google Credentials File format.
317    #[serde(rename = "privateKeyType")]
318    pub private_key_type: Option<String>,
319}
320
321impl common::RequestValue for CreateServiceAccountKeyRequest {}
322
323/// The service account create request.
324///
325/// # Activities
326///
327/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
328/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
329///
330/// * [service accounts create projects](ProjectServiceAccountCreateCall) (request)
331#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
332#[serde_with::serde_as]
333#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
334pub struct CreateServiceAccountRequest {
335    /// Required. The account id that is used to generate the service account email address and a stable unique id. It is unique within a project, must be 6-30 characters long, and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])` to comply with RFC1035.
336    #[serde(rename = "accountId")]
337    pub account_id: Option<String>,
338    /// The ServiceAccount resource to create. Currently, only the following values are user assignable: `display_name` and `description`.
339    #[serde(rename = "serviceAccount")]
340    pub service_account: Option<ServiceAccount>,
341}
342
343impl common::RequestValue for CreateServiceAccountRequest {}
344
345/// The service account key disable request.
346///
347/// # Activities
348///
349/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
350/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
351///
352/// * [service accounts keys disable projects](ProjectServiceAccountKeyDisableCall) (request)
353#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
354#[serde_with::serde_as]
355#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
356pub struct DisableServiceAccountKeyRequest {
357    /// Optional. Usable by internal google services only. An extended_status_message can be used to include additional information about the key, such as its private key data being exposed on a public repository like GitHub.
358    #[serde(rename = "extendedStatusMessage")]
359    pub extended_status_message: Option<String>,
360    /// Optional. Describes the reason this key is being disabled. If unspecified, the default value of SERVICE_ACCOUNT_KEY_DISABLE_REASON_USER_INITIATED will be used.
361    #[serde(rename = "serviceAccountKeyDisableReason")]
362    pub service_account_key_disable_reason: Option<String>,
363}
364
365impl common::RequestValue for DisableServiceAccountKeyRequest {}
366
367/// The service account disable request.
368///
369/// # Activities
370///
371/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
372/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
373///
374/// * [service accounts disable projects](ProjectServiceAccountDisableCall) (request)
375#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
376#[serde_with::serde_as]
377#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
378pub struct DisableServiceAccountRequest {
379    _never_set: Option<bool>,
380}
381
382impl common::RequestValue for DisableServiceAccountRequest {}
383
384/// A generic empty message that you can re-use to avoid defining duplicated empty messages in your APIs. A typical example is to use it as the request or the response type of an API method. For instance: service Foo { rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); }
385///
386/// # Activities
387///
388/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
389/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
390///
391/// * [locations oauth clients credentials delete projects](ProjectLocationOauthClientCredentialDeleteCall) (response)
392/// * [service accounts keys delete projects](ProjectServiceAccountKeyDeleteCall) (response)
393/// * [service accounts keys disable projects](ProjectServiceAccountKeyDisableCall) (response)
394/// * [service accounts keys enable projects](ProjectServiceAccountKeyEnableCall) (response)
395/// * [service accounts delete projects](ProjectServiceAccountDeleteCall) (response)
396/// * [service accounts disable projects](ProjectServiceAccountDisableCall) (response)
397/// * [service accounts enable projects](ProjectServiceAccountEnableCall) (response)
398#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
399#[serde_with::serde_as]
400#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
401pub struct Empty {
402    _never_set: Option<bool>,
403}
404
405impl common::ResponseResult for Empty {}
406
407/// The service account key enable request.
408///
409/// # Activities
410///
411/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
412/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
413///
414/// * [service accounts keys enable projects](ProjectServiceAccountKeyEnableCall) (request)
415#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
416#[serde_with::serde_as]
417#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
418pub struct EnableServiceAccountKeyRequest {
419    _never_set: Option<bool>,
420}
421
422impl common::RequestValue for EnableServiceAccountKeyRequest {}
423
424/// The service account enable request.
425///
426/// # Activities
427///
428/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
429/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
430///
431/// * [service accounts enable projects](ProjectServiceAccountEnableCall) (request)
432#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
433#[serde_with::serde_as]
434#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
435pub struct EnableServiceAccountRequest {
436    _never_set: Option<bool>,
437}
438
439impl common::RequestValue for EnableServiceAccountRequest {}
440
441/// Represents a textual expression in the Common Expression Language (CEL) syntax. CEL is a C-like expression language. The syntax and semantics of CEL are documented at https://github.com/google/cel-spec. Example (Comparison): title: "Summary size limit" description: "Determines if a summary is less than 100 chars" expression: "document.summary.size() < 100" Example (Equality): title: "Requestor is owner" description: "Determines if requestor is the document owner" expression: "document.owner == request.auth.claims.email" Example (Logic): title: "Public documents" description: "Determine whether the document should be publicly visible" expression: "document.type != 'private' && document.type != 'internal'" Example (Data Manipulation): title: "Notification string" description: "Create a notification string with a timestamp." expression: "'New message received at ' + string(document.create_time)" The exact variables and functions that may be referenced within an expression are determined by the service that evaluates it. See the service documentation for additional information.
442///
443/// This type is not used in any activity, and only used as *part* of another schema.
444///
445#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
446#[serde_with::serde_as]
447#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
448pub struct Expr {
449    /// Optional. Description of the expression. This is a longer text which describes the expression, e.g. when hovered over it in a UI.
450    pub description: Option<String>,
451    /// Textual representation of an expression in Common Expression Language syntax.
452    pub expression: Option<String>,
453    /// Optional. String indicating the location of the expression for error reporting, e.g. a file name and a position in the file.
454    pub location: Option<String>,
455    /// Optional. Title for the expression, i.e. a short string describing its purpose. This can be used e.g. in UIs which allow to enter the expression.
456    pub title: Option<String>,
457}
458
459impl common::Part for Expr {}
460
461/// Extended status can store additional metadata. For example, for keys disabled due to their private key data being expoesed we may include a message with more information about the exposure.
462///
463/// This type is not used in any activity, and only used as *part* of another schema.
464///
465#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
466#[serde_with::serde_as]
467#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
468pub struct ExtendedStatus {
469    /// The key for this extended status.
470    pub key: Option<String>,
471    /// The value for the extended status.
472    pub value: Option<String>,
473}
474
475impl common::Part for ExtendedStatus {}
476
477/// Request message for `GetIamPolicy` method.
478///
479/// # Activities
480///
481/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
482/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
483///
484/// * [workforce pools get iam policy locations](LocationWorkforcePoolGetIamPolicyCall) (request)
485#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
486#[serde_with::serde_as]
487#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
488pub struct GetIamPolicyRequest {
489    /// OPTIONAL: A `GetPolicyOptions` object for specifying options to `GetIamPolicy`.
490    pub options: Option<GetPolicyOptions>,
491}
492
493impl common::RequestValue for GetIamPolicyRequest {}
494
495/// Encapsulates settings provided to GetIamPolicy.
496///
497/// This type is not used in any activity, and only used as *part* of another schema.
498///
499#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
500#[serde_with::serde_as]
501#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
502pub struct GetPolicyOptions {
503    /// Optional. The maximum policy version that will be used to format the policy. Valid values are 0, 1, and 3. Requests specifying an invalid value will be rejected. Requests for policies with any conditional role bindings must specify version 3. Policies with no conditional role bindings may specify any valid value or leave the field unset. The policy in the response might use the policy version that you specified, or it might use a lower policy version. For example, if you specify version 3, but the policy has no conditional role bindings, the response uses version 1. To learn which resources support conditions in their IAM policies, see the [IAM documentation](https://cloud.google.com/iam/help/conditions/resource-policies).
504    #[serde(rename = "requestedPolicyVersion")]
505    pub requested_policy_version: Option<i32>,
506}
507
508impl common::Part for GetPolicyOptions {}
509
510/// Represents the OAuth 2.0 client credential configuration for retrieving additional user attributes that are not present in the initial authentication credentials from the identity provider, e.g. groups. See https://datatracker.ietf.org/doc/html/rfc6749#section-4.4 for more details on client credentials grant flow.
511///
512/// This type is not used in any activity, and only used as *part* of another schema.
513///
514#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
515#[serde_with::serde_as]
516#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
517pub struct GoogleIamAdminV1WorkforcePoolProviderExtraAttributesOAuth2Client {
518    /// Required. Represents the IdP and type of claims that should be fetched.
519    #[serde(rename = "attributesType")]
520    pub attributes_type: Option<String>,
521    /// Required. The OAuth 2.0 client ID for retrieving extra attributes from the identity provider. Required to get the Access Token using client credentials grant flow.
522    #[serde(rename = "clientId")]
523    pub client_id: Option<String>,
524    /// Required. The OAuth 2.0 client secret for retrieving extra attributes from the identity provider. Required to get the Access Token using client credentials grant flow.
525    #[serde(rename = "clientSecret")]
526    pub client_secret: Option<GoogleIamAdminV1WorkforcePoolProviderOidcClientSecret>,
527    /// Required. The OIDC identity provider's issuer URI. Must be a valid URI using the `https` scheme. Required to get the OIDC discovery document.
528    #[serde(rename = "issuerUri")]
529    pub issuer_uri: Option<String>,
530    /// Optional. Represents the parameters to control which claims are fetched from an IdP.
531    #[serde(rename = "queryParameters")]
532    pub query_parameters:
533        Option<GoogleIamAdminV1WorkforcePoolProviderExtraAttributesOAuth2ClientQueryParameters>,
534}
535
536impl common::Part for GoogleIamAdminV1WorkforcePoolProviderExtraAttributesOAuth2Client {}
537
538/// Represents the parameters to control which claims are fetched from an IdP.
539///
540/// This type is not used in any activity, and only used as *part* of another schema.
541///
542#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
543#[serde_with::serde_as]
544#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
545pub struct GoogleIamAdminV1WorkforcePoolProviderExtraAttributesOAuth2ClientQueryParameters {
546    /// Optional. The filter used to request specific records from IdP. In case of attributes type as AZURE_AD_GROUPS_MAIL, it represents the filter used to request specific groups for users from IdP. By default, all of the groups associated with the user are fetched. The groups should be mail enabled and security enabled. See https://learn.microsoft.com/en-us/graph/search-query-parameter for more details.
547    pub filter: Option<String>,
548}
549
550impl common::Part
551    for GoogleIamAdminV1WorkforcePoolProviderExtraAttributesOAuth2ClientQueryParameters
552{
553}
554
555/// Represents an OpenId Connect 1.0 identity provider.
556///
557/// This type is not used in any activity, and only used as *part* of another schema.
558///
559#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
560#[serde_with::serde_as]
561#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
562pub struct GoogleIamAdminV1WorkforcePoolProviderOidc {
563    /// Required. The client ID. Must match the audience claim of the JWT issued by the identity provider.
564    #[serde(rename = "clientId")]
565    pub client_id: Option<String>,
566    /// The optional client secret. Required to enable Authorization Code flow for web sign-in.
567    #[serde(rename = "clientSecret")]
568    pub client_secret: Option<GoogleIamAdminV1WorkforcePoolProviderOidcClientSecret>,
569    /// Required. The OIDC issuer URI. Must be a valid URI using the `https` scheme.
570    #[serde(rename = "issuerUri")]
571    pub issuer_uri: Option<String>,
572    /// OIDC JWKs in JSON String format. For details on the definition of a JWK, see https://tools.ietf.org/html/rfc7517. If not set, the `jwks_uri` from the discovery document(fetched from the .well-known path of the `issuer_uri`) will be used. Currently, RSA and EC asymmetric keys are supported. The JWK must use following format and include only the following fields: { "keys": [ { "kty": "RSA/EC", "alg": "", "use": "sig", "kid": "", "n": "", "e": "", "x": "", "y": "", "crv": "" } ] }
573    #[serde(rename = "jwksJson")]
574    pub jwks_json: Option<String>,
575    /// Required. Configuration for web single sign-on for the OIDC provider. Here, web sign-in refers to console sign-in and gcloud sign-in through the browser.
576    #[serde(rename = "webSsoConfig")]
577    pub web_sso_config: Option<GoogleIamAdminV1WorkforcePoolProviderOidcWebSsoConfig>,
578}
579
580impl common::Part for GoogleIamAdminV1WorkforcePoolProviderOidc {}
581
582/// Representation of a client secret configured for the OIDC provider.
583///
584/// This type is not used in any activity, and only used as *part* of another schema.
585///
586#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
587#[serde_with::serde_as]
588#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
589pub struct GoogleIamAdminV1WorkforcePoolProviderOidcClientSecret {
590    /// The value of the client secret.
591    pub value: Option<GoogleIamAdminV1WorkforcePoolProviderOidcClientSecretValue>,
592}
593
594impl common::Part for GoogleIamAdminV1WorkforcePoolProviderOidcClientSecret {}
595
596/// Representation of the value of the client secret.
597///
598/// This type is not used in any activity, and only used as *part* of another schema.
599///
600#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
601#[serde_with::serde_as]
602#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
603pub struct GoogleIamAdminV1WorkforcePoolProviderOidcClientSecretValue {
604    /// Input only. The plain text of the client secret value. For security reasons, this field is only used for input and will never be populated in any response.
605    #[serde(rename = "plainText")]
606    pub plain_text: Option<String>,
607    /// Output only. A thumbprint to represent the current client secret value.
608    pub thumbprint: Option<String>,
609}
610
611impl common::Part for GoogleIamAdminV1WorkforcePoolProviderOidcClientSecretValue {}
612
613/// Configuration for web single sign-on for the OIDC provider.
614///
615/// This type is not used in any activity, and only used as *part* of another schema.
616///
617#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
618#[serde_with::serde_as]
619#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
620pub struct GoogleIamAdminV1WorkforcePoolProviderOidcWebSsoConfig {
621    /// Additional scopes to request for in the OIDC authentication request on top of scopes requested by default. By default, the `openid`, `profile` and `email` scopes that are supported by the identity provider are requested. Each additional scope may be at most 256 characters. A maximum of 10 additional scopes may be configured.
622    #[serde(rename = "additionalScopes")]
623    pub additional_scopes: Option<Vec<String>>,
624    /// Required. The behavior for how OIDC Claims are included in the `assertion` object used for attribute mapping and attribute condition.
625    #[serde(rename = "assertionClaimsBehavior")]
626    pub assertion_claims_behavior: Option<String>,
627    /// Required. The Response Type to request for in the OIDC Authorization Request for web sign-in. The `CODE` Response Type is recommended to avoid the Implicit Flow, for security reasons.
628    #[serde(rename = "responseType")]
629    pub response_type: Option<String>,
630}
631
632impl common::Part for GoogleIamAdminV1WorkforcePoolProviderOidcWebSsoConfig {}
633
634/// Represents a SAML identity provider.
635///
636/// This type is not used in any activity, and only used as *part* of another schema.
637///
638#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
639#[serde_with::serde_as]
640#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
641pub struct GoogleIamAdminV1WorkforcePoolProviderSaml {
642    /// Required. SAML Identity provider configuration metadata xml doc. The xml document should comply with [SAML 2.0 specification](https://docs.oasis-open.org/security/saml/v2.0/saml-metadata-2.0-os.pdf). The max size of the acceptable xml document will be bounded to 128k characters. The metadata xml document should satisfy the following constraints: 1) Must contain an Identity Provider Entity ID. 2) Must contain at least one non-expired signing key certificate. 3) For each signing key: a) Valid from should be no more than 7 days from now. b) Valid to should be no more than 20 years in the future. 4) Up to 3 IdP signing keys are allowed in the metadata xml. When updating the provider's metadata xml, at least one non-expired signing key must overlap with the existing metadata. This requirement is skipped if there are no non-expired signing keys present in the existing metadata.
643    #[serde(rename = "idpMetadataXml")]
644    pub idp_metadata_xml: Option<String>,
645}
646
647impl common::Part for GoogleIamAdminV1WorkforcePoolProviderSaml {}
648
649/// Represents a public key data along with its format.
650///
651/// This type is not used in any activity, and only used as *part* of another schema.
652///
653#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
654#[serde_with::serde_as]
655#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
656pub struct KeyData {
657    /// Output only. The format of the key.
658    pub format: Option<String>,
659    /// Output only. The key data. The format of the key is represented by the format field.
660    pub key: Option<String>,
661    /// Required. The specifications for the key.
662    #[serde(rename = "keySpec")]
663    pub key_spec: Option<String>,
664    /// Output only. Latest timestamp when this key is valid. Attempts to use this key after this time will fail. Only present if the key data represents a X.509 certificate.
665    #[serde(rename = "notAfterTime")]
666    pub not_after_time: Option<chrono::DateTime<chrono::offset::Utc>>,
667    /// Output only. Earliest timestamp when this key is valid. Attempts to use this key before this time will fail. Only present if the key data represents a X.509 certificate.
668    #[serde(rename = "notBeforeTime")]
669    pub not_before_time: Option<chrono::DateTime<chrono::offset::Utc>>,
670}
671
672impl common::Part for KeyData {}
673
674/// The request to lint an IAM policy object.
675///
676/// # Activities
677///
678/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
679/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
680///
681/// * [lint policy iam policies](IamPolicyLintPolicyCall) (request)
682#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
683#[serde_with::serde_as]
684#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
685pub struct LintPolicyRequest {
686    /// google.iam.v1.Binding.condition object to be linted.
687    pub condition: Option<Expr>,
688    /// The full resource name of the policy this lint request is about. The name follows the Google Cloud format for full resource names. For example, a Google Cloud project with ID `my-project` will be named `//cloudresourcemanager.googleapis.com/projects/my-project`. The resource name is not used to read a policy from IAM. Only the data in the request object is linted.
689    #[serde(rename = "fullResourceName")]
690    pub full_resource_name: Option<String>,
691}
692
693impl common::RequestValue for LintPolicyRequest {}
694
695/// The response of a lint operation. An empty response indicates the operation was able to fully execute and no lint issue was found.
696///
697/// # Activities
698///
699/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
700/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
701///
702/// * [lint policy iam policies](IamPolicyLintPolicyCall) (response)
703#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
704#[serde_with::serde_as]
705#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
706pub struct LintPolicyResponse {
707    /// List of lint results sorted by `severity` in descending order.
708    #[serde(rename = "lintResults")]
709    pub lint_results: Option<Vec<LintResult>>,
710}
711
712impl common::ResponseResult for LintPolicyResponse {}
713
714/// Structured response of a single validation unit.
715///
716/// This type is not used in any activity, and only used as *part* of another schema.
717///
718#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
719#[serde_with::serde_as]
720#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
721pub struct LintResult {
722    /// Human readable debug message associated with the issue.
723    #[serde(rename = "debugMessage")]
724    pub debug_message: Option<String>,
725    /// The name of the field for which this lint result is about. For nested messages `field_name` consists of names of the embedded fields separated by period character. The top-level qualifier is the input object to lint in the request. For example, the `field_name` value `condition.expression` identifies a lint result for the `expression` field of the provided condition.
726    #[serde(rename = "fieldName")]
727    pub field_name: Option<String>,
728    /// The validation unit level.
729    pub level: Option<String>,
730    /// 0-based character position of problematic construct within the object identified by `field_name`. Currently, this is populated only for condition expression.
731    #[serde(rename = "locationOffset")]
732    pub location_offset: Option<i32>,
733    /// The validation unit severity.
734    pub severity: Option<String>,
735    /// The validation unit name, for instance "lintValidationUnits/ConditionComplexityCheck".
736    #[serde(rename = "validationUnitName")]
737    pub validation_unit_name: Option<String>,
738}
739
740impl common::Part for LintResult {}
741
742/// Response message for ListOauthClientCredentials.
743///
744/// # Activities
745///
746/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
747/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
748///
749/// * [locations oauth clients credentials list projects](ProjectLocationOauthClientCredentialListCall) (response)
750#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
751#[serde_with::serde_as]
752#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
753pub struct ListOauthClientCredentialsResponse {
754    /// A list of OauthClientCredentials.
755    #[serde(rename = "oauthClientCredentials")]
756    pub oauth_client_credentials: Option<Vec<OauthClientCredential>>,
757}
758
759impl common::ResponseResult for ListOauthClientCredentialsResponse {}
760
761/// Response message for ListOauthClients.
762///
763/// # Activities
764///
765/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
766/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
767///
768/// * [locations oauth clients list projects](ProjectLocationOauthClientListCall) (response)
769#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
770#[serde_with::serde_as]
771#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
772pub struct ListOauthClientsResponse {
773    /// Optional. A token, which can be sent as `page_token` to retrieve the next page. If this field is omitted, there are no subsequent pages.
774    #[serde(rename = "nextPageToken")]
775    pub next_page_token: Option<String>,
776    /// A list of OauthClients.
777    #[serde(rename = "oauthClients")]
778    pub oauth_clients: Option<Vec<OauthClient>>,
779}
780
781impl common::ResponseResult for ListOauthClientsResponse {}
782
783/// The response containing the roles defined under a resource.
784///
785/// # Activities
786///
787/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
788/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
789///
790/// * [roles list organizations](OrganizationRoleListCall) (response)
791/// * [roles list projects](ProjectRoleListCall) (response)
792/// * [list roles](RoleListCall) (response)
793#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
794#[serde_with::serde_as]
795#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
796pub struct ListRolesResponse {
797    /// To retrieve the next page of results, set `ListRolesRequest.page_token` to this value.
798    #[serde(rename = "nextPageToken")]
799    pub next_page_token: Option<String>,
800    /// The Roles defined on this resource.
801    pub roles: Option<Vec<Role>>,
802}
803
804impl common::ResponseResult for ListRolesResponse {}
805
806/// The service account keys list response.
807///
808/// # Activities
809///
810/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
811/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
812///
813/// * [service accounts keys list projects](ProjectServiceAccountKeyListCall) (response)
814#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
815#[serde_with::serde_as]
816#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
817pub struct ListServiceAccountKeysResponse {
818    /// The public keys for the service account.
819    pub keys: Option<Vec<ServiceAccountKey>>,
820}
821
822impl common::ResponseResult for ListServiceAccountKeysResponse {}
823
824/// The service account list response.
825///
826/// # Activities
827///
828/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
829/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
830///
831/// * [service accounts list projects](ProjectServiceAccountListCall) (response)
832#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
833#[serde_with::serde_as]
834#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
835pub struct ListServiceAccountsResponse {
836    /// The list of matching service accounts.
837    pub accounts: Option<Vec<ServiceAccount>>,
838    /// To retrieve the next page of results, set ListServiceAccountsRequest.page_token to this value.
839    #[serde(rename = "nextPageToken")]
840    pub next_page_token: Option<String>,
841}
842
843impl common::ResponseResult for ListServiceAccountsResponse {}
844
845/// Response message for ListWorkforcePoolProviderKeys.
846///
847/// # Activities
848///
849/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
850/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
851///
852/// * [workforce pools providers keys list locations](LocationWorkforcePoolProviderKeyListCall) (response)
853#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
854#[serde_with::serde_as]
855#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
856pub struct ListWorkforcePoolProviderKeysResponse {
857    /// A token, which can be sent as `page_token` to retrieve the next page. If this field is omitted, there are no subsequent pages.
858    #[serde(rename = "nextPageToken")]
859    pub next_page_token: Option<String>,
860    /// A list of WorkforcePoolProviderKeys.
861    #[serde(rename = "workforcePoolProviderKeys")]
862    pub workforce_pool_provider_keys: Option<Vec<WorkforcePoolProviderKey>>,
863}
864
865impl common::ResponseResult for ListWorkforcePoolProviderKeysResponse {}
866
867/// Response message for ListWorkforcePoolProviders.
868///
869/// # Activities
870///
871/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
872/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
873///
874/// * [workforce pools providers list locations](LocationWorkforcePoolProviderListCall) (response)
875#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
876#[serde_with::serde_as]
877#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
878pub struct ListWorkforcePoolProvidersResponse {
879    /// A token, which can be sent as `page_token` to retrieve the next page. If this field is omitted, there are no subsequent pages.
880    #[serde(rename = "nextPageToken")]
881    pub next_page_token: Option<String>,
882    /// A list of providers.
883    #[serde(rename = "workforcePoolProviders")]
884    pub workforce_pool_providers: Option<Vec<WorkforcePoolProvider>>,
885}
886
887impl common::ResponseResult for ListWorkforcePoolProvidersResponse {}
888
889/// Response message for ListWorkforcePools.
890///
891/// # Activities
892///
893/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
894/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
895///
896/// * [workforce pools list locations](LocationWorkforcePoolListCall) (response)
897#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
898#[serde_with::serde_as]
899#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
900pub struct ListWorkforcePoolsResponse {
901    /// A token, which can be sent as `page_token` to retrieve the next page. If this field is omitted, there are no subsequent pages.
902    #[serde(rename = "nextPageToken")]
903    pub next_page_token: Option<String>,
904    /// A list of pools.
905    #[serde(rename = "workforcePools")]
906    pub workforce_pools: Option<Vec<WorkforcePool>>,
907}
908
909impl common::ResponseResult for ListWorkforcePoolsResponse {}
910
911/// Response message for ListWorkloadIdentityPoolProviderKeys.
912///
913/// # Activities
914///
915/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
916/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
917///
918/// * [locations workload identity pools providers keys list projects](ProjectLocationWorkloadIdentityPoolProviderKeyListCall) (response)
919#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
920#[serde_with::serde_as]
921#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
922pub struct ListWorkloadIdentityPoolProviderKeysResponse {
923    /// A token, which can be sent as `page_token` to retrieve the next page. If this field is omitted, there are no subsequent pages.
924    #[serde(rename = "nextPageToken")]
925    pub next_page_token: Option<String>,
926    /// A list of WorkloadIdentityPoolProviderKey
927    #[serde(rename = "workloadIdentityPoolProviderKeys")]
928    pub workload_identity_pool_provider_keys: Option<Vec<WorkloadIdentityPoolProviderKey>>,
929}
930
931impl common::ResponseResult for ListWorkloadIdentityPoolProviderKeysResponse {}
932
933/// Response message for ListWorkloadIdentityPoolProviders.
934///
935/// # Activities
936///
937/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
938/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
939///
940/// * [locations workload identity pools providers list projects](ProjectLocationWorkloadIdentityPoolProviderListCall) (response)
941#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
942#[serde_with::serde_as]
943#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
944pub struct ListWorkloadIdentityPoolProvidersResponse {
945    /// A token, which can be sent as `page_token` to retrieve the next page. If this field is omitted, there are no subsequent pages.
946    #[serde(rename = "nextPageToken")]
947    pub next_page_token: Option<String>,
948    /// A list of providers.
949    #[serde(rename = "workloadIdentityPoolProviders")]
950    pub workload_identity_pool_providers: Option<Vec<WorkloadIdentityPoolProvider>>,
951}
952
953impl common::ResponseResult for ListWorkloadIdentityPoolProvidersResponse {}
954
955/// Response message for ListWorkloadIdentityPools.
956///
957/// # Activities
958///
959/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
960/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
961///
962/// * [locations workload identity pools list projects](ProjectLocationWorkloadIdentityPoolListCall) (response)
963#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
964#[serde_with::serde_as]
965#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
966pub struct ListWorkloadIdentityPoolsResponse {
967    /// A token, which can be sent as `page_token` to retrieve the next page. If this field is omitted, there are no subsequent pages.
968    #[serde(rename = "nextPageToken")]
969    pub next_page_token: Option<String>,
970    /// A list of pools.
971    #[serde(rename = "workloadIdentityPools")]
972    pub workload_identity_pools: Option<Vec<WorkloadIdentityPool>>,
973}
974
975impl common::ResponseResult for ListWorkloadIdentityPoolsResponse {}
976
977/// Represents an OauthClient. Used to access Google Cloud resources on behalf of a Workforce Identity Federation user by using OAuth 2.0 Protocol to obtain an access token from Google Cloud.
978///
979/// # Activities
980///
981/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
982/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
983///
984/// * [locations oauth clients create projects](ProjectLocationOauthClientCreateCall) (request|response)
985/// * [locations oauth clients delete projects](ProjectLocationOauthClientDeleteCall) (response)
986/// * [locations oauth clients get projects](ProjectLocationOauthClientGetCall) (response)
987/// * [locations oauth clients patch projects](ProjectLocationOauthClientPatchCall) (request|response)
988/// * [locations oauth clients undelete projects](ProjectLocationOauthClientUndeleteCall) (response)
989#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
990#[serde_with::serde_as]
991#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
992pub struct OauthClient {
993    /// Required. The list of OAuth grant types is allowed for the OauthClient.
994    #[serde(rename = "allowedGrantTypes")]
995    pub allowed_grant_types: Option<Vec<String>>,
996    /// Required. The list of redirect uris that is allowed to redirect back when authorization process is completed.
997    #[serde(rename = "allowedRedirectUris")]
998    pub allowed_redirect_uris: Option<Vec<String>>,
999    /// Required. The list of scopes that the OauthClient is allowed to request during OAuth flows. The following scopes are supported: * `https://www.googleapis.com/auth/cloud-platform`: See, edit, configure, and delete your Google Cloud data and see the email address for your Google Account.
1000    #[serde(rename = "allowedScopes")]
1001    pub allowed_scopes: Option<Vec<String>>,
1002    /// Output only. The system-generated OauthClient id.
1003    #[serde(rename = "clientId")]
1004    pub client_id: Option<String>,
1005    /// Immutable. The type of OauthClient. Either public or private. For private clients, the client secret can be managed using the dedicated OauthClientCredential resource.
1006    #[serde(rename = "clientType")]
1007    pub client_type: Option<String>,
1008    /// Optional. A user-specified description of the OauthClient. Cannot exceed 256 characters.
1009    pub description: Option<String>,
1010    /// Optional. Whether the OauthClient is disabled. You cannot use a disabled OAuth client.
1011    pub disabled: Option<bool>,
1012    /// Optional. A user-specified display name of the OauthClient. Cannot exceed 32 characters.
1013    #[serde(rename = "displayName")]
1014    pub display_name: Option<String>,
1015    /// Output only. Time after which the OauthClient will be permanently purged and cannot be recovered.
1016    #[serde(rename = "expireTime")]
1017    pub expire_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1018    /// Immutable. The resource name of the OauthClient. Format:`projects/{project}/locations/{location}/oauthClients/{oauth_client}`.
1019    pub name: Option<String>,
1020    /// Output only. The state of the OauthClient.
1021    pub state: Option<String>,
1022}
1023
1024impl common::RequestValue for OauthClient {}
1025impl common::ResponseResult for OauthClient {}
1026
1027/// Represents an OauthClientCredential. Used to authenticate an OauthClient while accessing Google Cloud resources on behalf of a user by using OAuth 2.0 Protocol.
1028///
1029/// # Activities
1030///
1031/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1032/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1033///
1034/// * [locations oauth clients credentials create projects](ProjectLocationOauthClientCredentialCreateCall) (request|response)
1035/// * [locations oauth clients credentials get projects](ProjectLocationOauthClientCredentialGetCall) (response)
1036/// * [locations oauth clients credentials patch projects](ProjectLocationOauthClientCredentialPatchCall) (request|response)
1037#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1038#[serde_with::serde_as]
1039#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1040pub struct OauthClientCredential {
1041    /// Output only. The system-generated OAuth client secret. The client secret must be stored securely. If the client secret is leaked, you must delete and re-create the client credential. To learn more, see [OAuth client and credential security risks and mitigations](https://cloud.google.com/iam/docs/workforce-oauth-app#security)
1042    #[serde(rename = "clientSecret")]
1043    pub client_secret: Option<String>,
1044    /// Optional. Whether the OauthClientCredential is disabled. You cannot use a disabled OauthClientCredential.
1045    pub disabled: Option<bool>,
1046    /// Optional. A user-specified display name of the OauthClientCredential. Cannot exceed 32 characters.
1047    #[serde(rename = "displayName")]
1048    pub display_name: Option<String>,
1049    /// Immutable. The resource name of the OauthClientCredential. Format: `projects/{project}/locations/{location}/oauthClients/{oauth_client}/credentials/{credential}`
1050    pub name: Option<String>,
1051}
1052
1053impl common::RequestValue for OauthClientCredential {}
1054impl common::ResponseResult for OauthClientCredential {}
1055
1056/// Represents an OpenId Connect 1.0 identity provider.
1057///
1058/// This type is not used in any activity, and only used as *part* of another schema.
1059///
1060#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1061#[serde_with::serde_as]
1062#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1063pub struct Oidc {
1064    /// Acceptable values for the `aud` field (audience) in the OIDC token. Token exchange requests are rejected if the token audience does not match one of the configured values. Each audience may be at most 256 characters. A maximum of 10 audiences may be configured. If this list is empty, the OIDC token audience must be equal to the full canonical resource name of the WorkloadIdentityPoolProvider, with or without the HTTPS prefix. For example: ``` //iam.googleapis.com/projects//locations//workloadIdentityPools//providers/ https://iam.googleapis.com/projects//locations//workloadIdentityPools//providers/ ```
1065    #[serde(rename = "allowedAudiences")]
1066    pub allowed_audiences: Option<Vec<String>>,
1067    /// Required. The OIDC issuer URL. Must be an HTTPS endpoint.
1068    #[serde(rename = "issuerUri")]
1069    pub issuer_uri: Option<String>,
1070    /// Optional. OIDC JWKs in JSON String format. For details on the definition of a JWK, see https://tools.ietf.org/html/rfc7517. If not set, the `jwks_uri` from the discovery document(fetched from the .well-known path of the `issuer_uri`) will be used. Currently, RSA and EC asymmetric keys are supported. The JWK must use following format and include only the following fields: { "keys": [ { "kty": "RSA/EC", "alg": "", "use": "sig", "kid": "", "n": "", "e": "", "x": "", "y": "", "crv": "" } ] }
1071    #[serde(rename = "jwksJson")]
1072    pub jwks_json: Option<String>,
1073}
1074
1075impl common::Part for Oidc {}
1076
1077/// This resource represents a long-running operation that is the result of a network API call.
1078///
1079/// # Activities
1080///
1081/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1082/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1083///
1084/// * [workforce pools operations get locations](LocationWorkforcePoolOperationGetCall) (response)
1085/// * [workforce pools providers keys operations get locations](LocationWorkforcePoolProviderKeyOperationGetCall) (response)
1086/// * [workforce pools providers keys create locations](LocationWorkforcePoolProviderKeyCreateCall) (response)
1087/// * [workforce pools providers keys delete locations](LocationWorkforcePoolProviderKeyDeleteCall) (response)
1088/// * [workforce pools providers keys undelete locations](LocationWorkforcePoolProviderKeyUndeleteCall) (response)
1089/// * [workforce pools providers operations get locations](LocationWorkforcePoolProviderOperationGetCall) (response)
1090/// * [workforce pools providers create locations](LocationWorkforcePoolProviderCreateCall) (response)
1091/// * [workforce pools providers delete locations](LocationWorkforcePoolProviderDeleteCall) (response)
1092/// * [workforce pools providers patch locations](LocationWorkforcePoolProviderPatchCall) (response)
1093/// * [workforce pools providers undelete locations](LocationWorkforcePoolProviderUndeleteCall) (response)
1094/// * [workforce pools subjects operations get locations](LocationWorkforcePoolSubjectOperationGetCall) (response)
1095/// * [workforce pools subjects delete locations](LocationWorkforcePoolSubjectDeleteCall) (response)
1096/// * [workforce pools subjects undelete locations](LocationWorkforcePoolSubjectUndeleteCall) (response)
1097/// * [workforce pools create locations](LocationWorkforcePoolCreateCall) (response)
1098/// * [workforce pools delete locations](LocationWorkforcePoolDeleteCall) (response)
1099/// * [workforce pools patch locations](LocationWorkforcePoolPatchCall) (response)
1100/// * [workforce pools undelete locations](LocationWorkforcePoolUndeleteCall) (response)
1101/// * [locations workload identity pools namespaces managed identities operations get projects](ProjectLocationWorkloadIdentityPoolNamespaceManagedIdentityOperationGetCall) (response)
1102/// * [locations workload identity pools namespaces managed identities workload sources operations get projects](ProjectLocationWorkloadIdentityPoolNamespaceManagedIdentityWorkloadSourceOperationGetCall) (response)
1103/// * [locations workload identity pools namespaces operations get projects](ProjectLocationWorkloadIdentityPoolNamespaceOperationGetCall) (response)
1104/// * [locations workload identity pools operations get projects](ProjectLocationWorkloadIdentityPoolOperationGetCall) (response)
1105/// * [locations workload identity pools providers keys operations get projects](ProjectLocationWorkloadIdentityPoolProviderKeyOperationGetCall) (response)
1106/// * [locations workload identity pools providers keys create projects](ProjectLocationWorkloadIdentityPoolProviderKeyCreateCall) (response)
1107/// * [locations workload identity pools providers keys delete projects](ProjectLocationWorkloadIdentityPoolProviderKeyDeleteCall) (response)
1108/// * [locations workload identity pools providers keys undelete projects](ProjectLocationWorkloadIdentityPoolProviderKeyUndeleteCall) (response)
1109/// * [locations workload identity pools providers operations get projects](ProjectLocationWorkloadIdentityPoolProviderOperationGetCall) (response)
1110/// * [locations workload identity pools providers create projects](ProjectLocationWorkloadIdentityPoolProviderCreateCall) (response)
1111/// * [locations workload identity pools providers delete projects](ProjectLocationWorkloadIdentityPoolProviderDeleteCall) (response)
1112/// * [locations workload identity pools providers patch projects](ProjectLocationWorkloadIdentityPoolProviderPatchCall) (response)
1113/// * [locations workload identity pools providers undelete projects](ProjectLocationWorkloadIdentityPoolProviderUndeleteCall) (response)
1114/// * [locations workload identity pools create projects](ProjectLocationWorkloadIdentityPoolCreateCall) (response)
1115/// * [locations workload identity pools delete projects](ProjectLocationWorkloadIdentityPoolDeleteCall) (response)
1116/// * [locations workload identity pools patch projects](ProjectLocationWorkloadIdentityPoolPatchCall) (response)
1117/// * [locations workload identity pools undelete projects](ProjectLocationWorkloadIdentityPoolUndeleteCall) (response)
1118#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1119#[serde_with::serde_as]
1120#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1121pub struct Operation {
1122    /// 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.
1123    pub done: Option<bool>,
1124    /// The error result of the operation in case of failure or cancellation.
1125    pub error: Option<Status>,
1126    /// 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.
1127    pub metadata: Option<HashMap<String, serde_json::Value>>,
1128    /// 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}`.
1129    pub name: Option<String>,
1130    /// 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`.
1131    pub response: Option<HashMap<String, serde_json::Value>>,
1132}
1133
1134impl common::ResponseResult for Operation {}
1135
1136/// The service account key patch request.
1137///
1138/// # Activities
1139///
1140/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1141/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1142///
1143/// * [service accounts keys patch projects](ProjectServiceAccountKeyPatchCall) (request)
1144#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1145#[serde_with::serde_as]
1146#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1147pub struct PatchServiceAccountKeyRequest {
1148    /// Required. The service account key to update.
1149    #[serde(rename = "serviceAccountKey")]
1150    pub service_account_key: Option<ServiceAccountKey>,
1151    /// Required. The update mask to apply to the service account key. Only the following fields are eligible for patching: - contact - description
1152    #[serde(rename = "updateMask")]
1153    pub update_mask: Option<common::FieldMask>,
1154}
1155
1156impl common::RequestValue for PatchServiceAccountKeyRequest {}
1157
1158/// The service account patch request. You can patch only the `display_name` and `description` fields. You must use the `update_mask` field to specify which of these fields you want to patch. Only the fields specified in the request are guaranteed to be returned in the response. Other fields may be empty in the response.
1159///
1160/// # Activities
1161///
1162/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1163/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1164///
1165/// * [service accounts patch projects](ProjectServiceAccountPatchCall) (request)
1166#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1167#[serde_with::serde_as]
1168#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1169pub struct PatchServiceAccountRequest {
1170    /// no description provided
1171    #[serde(rename = "serviceAccount")]
1172    pub service_account: Option<ServiceAccount>,
1173    /// no description provided
1174    #[serde(rename = "updateMask")]
1175    pub update_mask: Option<common::FieldMask>,
1176}
1177
1178impl common::RequestValue for PatchServiceAccountRequest {}
1179
1180/// A permission which can be included by a role.
1181///
1182/// # Activities
1183///
1184/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1185/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1186///
1187/// * [query testable permissions permissions](PermissionQueryTestablePermissionCall) (none)
1188#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1189#[serde_with::serde_as]
1190#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1191pub struct Permission {
1192    /// The service API associated with the permission is not enabled.
1193    #[serde(rename = "apiDisabled")]
1194    pub api_disabled: Option<bool>,
1195    /// The current custom role support level.
1196    #[serde(rename = "customRolesSupportLevel")]
1197    pub custom_roles_support_level: Option<String>,
1198    /// A brief description of what this Permission is used for. This permission can ONLY be used in predefined roles.
1199    pub description: Option<String>,
1200    /// The name of this Permission.
1201    pub name: Option<String>,
1202    /// no description provided
1203    #[serde(rename = "onlyInPredefinedRoles")]
1204    pub only_in_predefined_roles: Option<bool>,
1205    /// The preferred name for this permission. If present, then this permission is an alias of, and equivalent to, the listed primary_permission.
1206    #[serde(rename = "primaryPermission")]
1207    pub primary_permission: Option<String>,
1208    /// The current launch stage of the permission.
1209    pub stage: Option<String>,
1210    /// The title of this Permission.
1211    pub title: Option<String>,
1212}
1213
1214impl common::Resource for Permission {}
1215
1216/// An Identity and Access Management (IAM) policy, which specifies access controls for Google Cloud resources. A `Policy` is a collection of `bindings`. A `binding` binds one or more `members`, or principals, to a single `role`. Principals can be user accounts, service accounts, Google groups, and domains (such as G Suite). A `role` is a named list of permissions; each `role` can be an IAM predefined role or a user-created custom role. For some types of Google Cloud resources, a `binding` can also specify a `condition`, which is a logical expression that allows access to a resource only if the expression evaluates to `true`. A condition can add constraints based on attributes of the request, the resource, or both. To learn which resources support conditions in their IAM policies, see the [IAM documentation](https://cloud.google.com/iam/help/conditions/resource-policies). **JSON example:** `{ "bindings": [ { "role": "roles/resourcemanager.organizationAdmin", "members": [ "user:mike@example.com", "group:admins@example.com", "domain:google.com", "serviceAccount:my-project-id@appspot.gserviceaccount.com" ] }, { "role": "roles/resourcemanager.organizationViewer", "members": [ "user:eve@example.com" ], "condition": { "title": "expirable access", "description": "Does not grant access after Sep 2020", "expression": "request.time < timestamp('2020-10-01T00:00:00.000Z')", } } ], "etag": "BwWWja0YfJA=", "version": 3 }` **YAML example:** `bindings: - members: - user:mike@example.com - group:admins@example.com - domain:google.com - serviceAccount:my-project-id@appspot.gserviceaccount.com role: roles/resourcemanager.organizationAdmin - members: - user:eve@example.com role: roles/resourcemanager.organizationViewer condition: title: expirable access description: Does not grant access after Sep 2020 expression: request.time < timestamp('2020-10-01T00:00:00.000Z') etag: BwWWja0YfJA= version: 3` For a description of IAM and its features, see the [IAM documentation](https://cloud.google.com/iam/docs/).
1217///
1218/// # Activities
1219///
1220/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1221/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1222///
1223/// * [workforce pools get iam policy locations](LocationWorkforcePoolGetIamPolicyCall) (response)
1224/// * [workforce pools set iam policy locations](LocationWorkforcePoolSetIamPolicyCall) (response)
1225/// * [service accounts get iam policy projects](ProjectServiceAccountGetIamPolicyCall) (response)
1226/// * [service accounts set iam policy projects](ProjectServiceAccountSetIamPolicyCall) (response)
1227#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1228#[serde_with::serde_as]
1229#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1230pub struct Policy {
1231    /// Specifies cloud audit logging configuration for this policy.
1232    #[serde(rename = "auditConfigs")]
1233    pub audit_configs: Option<Vec<AuditConfig>>,
1234    /// Associates a list of `members`, or principals, with a `role`. Optionally, may specify a `condition` that determines how and when the `bindings` are applied. Each of the `bindings` must contain at least one principal. The `bindings` in a `Policy` can refer to up to 1,500 principals; up to 250 of these principals can be Google groups. Each occurrence of a principal counts towards these limits. For example, if the `bindings` grant 50 different roles to `user:alice@example.com`, and not to any other principal, then you can add another 1,450 principals to the `bindings` in the `Policy`.
1235    pub bindings: Option<Vec<Binding>>,
1236    /// `etag` is used for optimistic concurrency control as a way to help prevent simultaneous updates of a policy from overwriting each other. It is strongly suggested that systems make use of the `etag` in the read-modify-write cycle to perform policy updates in order to avoid race conditions: An `etag` is returned in the response to `getIamPolicy`, and systems are expected to put that etag in the request to `setIamPolicy` to ensure that their change will be applied to the same version of the policy. **Important:** If you use IAM Conditions, you must include the `etag` field whenever you call `setIamPolicy`. If you omit this field, then IAM allows you to overwrite a version `3` policy with a version `1` policy, and all of the conditions in the version `3` policy are lost.
1237    #[serde_as(as = "Option<common::serde::standard_base64::Wrapper>")]
1238    pub etag: Option<Vec<u8>>,
1239    /// Specifies the format of the policy. Valid values are `0`, `1`, and `3`. Requests that specify an invalid value are rejected. Any operation that affects conditional role bindings must specify version `3`. This requirement applies to the following operations: * Getting a policy that includes a conditional role binding * Adding a conditional role binding to a policy * Changing a conditional role binding in a policy * Removing any role binding, with or without a condition, from a policy that includes conditions **Important:** If you use IAM Conditions, you must include the `etag` field whenever you call `setIamPolicy`. If you omit this field, then IAM allows you to overwrite a version `3` policy with a version `1` policy, and all of the conditions in the version `3` policy are lost. If a policy does not include any conditions, operations on that policy may specify any valid version or leave the field unset. To learn which resources support conditions in their IAM policies, see the [IAM documentation](https://cloud.google.com/iam/help/conditions/resource-policies).
1240    pub version: Option<i32>,
1241}
1242
1243impl common::ResponseResult for Policy {}
1244
1245/// A request to get the list of auditable services for a resource.
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/// * [query auditable services iam policies](IamPolicyQueryAuditableServiceCall) (request)
1253#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1254#[serde_with::serde_as]
1255#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1256pub struct QueryAuditableServicesRequest {
1257    /// Required. The full resource name to query from the list of auditable services. The name follows the Google Cloud Platform resource format. For example, a Cloud Platform project with id `my-project` will be named `//cloudresourcemanager.googleapis.com/projects/my-project`.
1258    #[serde(rename = "fullResourceName")]
1259    pub full_resource_name: Option<String>,
1260}
1261
1262impl common::RequestValue for QueryAuditableServicesRequest {}
1263
1264/// A response containing a list of auditable services for a resource.
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/// * [query auditable services iam policies](IamPolicyQueryAuditableServiceCall) (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 QueryAuditableServicesResponse {
1276    /// The auditable services for a resource.
1277    pub services: Option<Vec<AuditableService>>,
1278}
1279
1280impl common::ResponseResult for QueryAuditableServicesResponse {}
1281
1282/// The grantable role query request.
1283///
1284/// # Activities
1285///
1286/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1287/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1288///
1289/// * [query grantable roles roles](RoleQueryGrantableRoleCall) (request)
1290#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1291#[serde_with::serde_as]
1292#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1293pub struct QueryGrantableRolesRequest {
1294    /// Required. The full resource name to query from the list of grantable roles. The name follows the Google Cloud Platform resource format. For example, a Cloud Platform project with id `my-project` will be named `//cloudresourcemanager.googleapis.com/projects/my-project`.
1295    #[serde(rename = "fullResourceName")]
1296    pub full_resource_name: Option<String>,
1297    /// Optional limit on the number of roles to include in the response. The default is 300, and the maximum is 1,000.
1298    #[serde(rename = "pageSize")]
1299    pub page_size: Option<i32>,
1300    /// Optional pagination token returned in an earlier QueryGrantableRolesResponse.
1301    #[serde(rename = "pageToken")]
1302    pub page_token: Option<String>,
1303    /// no description provided
1304    pub view: Option<String>,
1305}
1306
1307impl common::RequestValue for QueryGrantableRolesRequest {}
1308
1309/// The grantable role query response.
1310///
1311/// # Activities
1312///
1313/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1314/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1315///
1316/// * [query grantable roles roles](RoleQueryGrantableRoleCall) (response)
1317#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1318#[serde_with::serde_as]
1319#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1320pub struct QueryGrantableRolesResponse {
1321    /// To retrieve the next page of results, set `QueryGrantableRolesRequest.page_token` to this value.
1322    #[serde(rename = "nextPageToken")]
1323    pub next_page_token: Option<String>,
1324    /// The list of matching roles.
1325    pub roles: Option<Vec<Role>>,
1326}
1327
1328impl common::ResponseResult for QueryGrantableRolesResponse {}
1329
1330/// A request to get permissions which can be tested on a resource.
1331///
1332/// # Activities
1333///
1334/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1335/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1336///
1337/// * [query testable permissions permissions](PermissionQueryTestablePermissionCall) (request)
1338#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1339#[serde_with::serde_as]
1340#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1341pub struct QueryTestablePermissionsRequest {
1342    /// Required. The full resource name to query from the list of testable permissions. The name follows the Google Cloud Platform resource format. For example, a Cloud Platform project with id `my-project` will be named `//cloudresourcemanager.googleapis.com/projects/my-project`.
1343    #[serde(rename = "fullResourceName")]
1344    pub full_resource_name: Option<String>,
1345    /// Optional limit on the number of permissions to include in the response. The default is 100, and the maximum is 1,000.
1346    #[serde(rename = "pageSize")]
1347    pub page_size: Option<i32>,
1348    /// Optional pagination token returned in an earlier QueryTestablePermissionsRequest.
1349    #[serde(rename = "pageToken")]
1350    pub page_token: Option<String>,
1351}
1352
1353impl common::RequestValue for QueryTestablePermissionsRequest {}
1354
1355/// The response containing permissions which can be tested on a resource.
1356///
1357/// # Activities
1358///
1359/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1360/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1361///
1362/// * [query testable permissions permissions](PermissionQueryTestablePermissionCall) (response)
1363#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1364#[serde_with::serde_as]
1365#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1366pub struct QueryTestablePermissionsResponse {
1367    /// To retrieve the next page of results, set `QueryTestableRolesRequest.page_token` to this value.
1368    #[serde(rename = "nextPageToken")]
1369    pub next_page_token: Option<String>,
1370    /// The Permissions testable on the requested resource.
1371    pub permissions: Option<Vec<Permission>>,
1372}
1373
1374impl common::ResponseResult for QueryTestablePermissionsResponse {}
1375
1376/// A role in the Identity and Access Management API.
1377///
1378/// # Activities
1379///
1380/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1381/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1382///
1383/// * [roles create organizations](OrganizationRoleCreateCall) (response)
1384/// * [roles delete organizations](OrganizationRoleDeleteCall) (response)
1385/// * [roles get organizations](OrganizationRoleGetCall) (response)
1386/// * [roles patch organizations](OrganizationRolePatchCall) (request|response)
1387/// * [roles undelete organizations](OrganizationRoleUndeleteCall) (response)
1388/// * [roles create projects](ProjectRoleCreateCall) (response)
1389/// * [roles delete projects](ProjectRoleDeleteCall) (response)
1390/// * [roles get projects](ProjectRoleGetCall) (response)
1391/// * [roles patch projects](ProjectRolePatchCall) (request|response)
1392/// * [roles undelete projects](ProjectRoleUndeleteCall) (response)
1393/// * [get roles](RoleGetCall) (response)
1394/// * [list roles](RoleListCall) (none)
1395/// * [query grantable roles roles](RoleQueryGrantableRoleCall) (none)
1396#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1397#[serde_with::serde_as]
1398#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1399pub struct Role {
1400    /// The current deleted state of the role. This field is read only. It will be ignored in calls to CreateRole and UpdateRole.
1401    pub deleted: Option<bool>,
1402    /// Optional. A human-readable description for the role.
1403    pub description: Option<String>,
1404    /// Used to perform a consistent read-modify-write.
1405    #[serde_as(as = "Option<common::serde::standard_base64::Wrapper>")]
1406    pub etag: Option<Vec<u8>>,
1407    /// The names of the permissions this role grants when bound in an IAM policy.
1408    #[serde(rename = "includedPermissions")]
1409    pub included_permissions: Option<Vec<String>>,
1410    /// The name of the role. When `Role` is used in `CreateRole`, the role name must not be set. When `Role` is used in output and other input such as `UpdateRole`, the role name is the complete path. For example, `roles/logging.viewer` for predefined roles, `organizations/{ORGANIZATION_ID}/roles/myRole` for organization-level custom roles, and `projects/{PROJECT_ID}/roles/myRole` for project-level custom roles.
1411    pub name: Option<String>,
1412    /// The current launch stage of the role. If the `ALPHA` launch stage has been selected for a role, the `stage` field will not be included in the returned definition for the role.
1413    pub stage: Option<String>,
1414    /// Optional. A human-readable title for the role. Typically this is limited to 100 UTF-8 bytes.
1415    pub title: Option<String>,
1416}
1417
1418impl common::RequestValue for Role {}
1419impl common::Resource for Role {}
1420impl common::ResponseResult for Role {}
1421
1422/// Represents an SAML 2.0 identity provider.
1423///
1424/// This type is not used in any activity, and only used as *part* of another schema.
1425///
1426#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1427#[serde_with::serde_as]
1428#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1429pub struct Saml {
1430    /// Required. SAML identity provider (IdP) configuration metadata XML doc. The XML document must comply with the [SAML 2.0 specification](https://docs.oasis-open.org/security/saml/v2.0/saml-metadata-2.0-os.pdf). The maximum size of an acceptable XML document is 128K characters. The SAML metadata XML document must satisfy the following constraints: * Must contain an IdP Entity ID. * Must contain at least one non-expired signing certificate. * For each signing certificate, the expiration must be: * From no more than 7 days in the future. * To no more than 20 years in the future. * Up to three IdP signing keys are allowed. When updating the provider's metadata XML, at least one non-expired signing key must overlap with the existing metadata. This requirement is skipped if there are no non-expired signing keys present in the existing metadata.
1431    #[serde(rename = "idpMetadataXml")]
1432    pub idp_metadata_xml: Option<String>,
1433}
1434
1435impl common::Part for Saml {}
1436
1437/// An IAM service account. A service account is an account for an application or a virtual machine (VM) instance, not a person. You can use a service account to call Google APIs. To learn more, read the [overview of service accounts](https://cloud.google.com/iam/help/service-accounts/overview). When you create a service account, you specify the project ID that owns the service account, as well as a name that must be unique within the project. IAM uses these values to create an email address that identifies the service account. //
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/// * [service accounts create projects](ProjectServiceAccountCreateCall) (response)
1445/// * [service accounts get projects](ProjectServiceAccountGetCall) (response)
1446/// * [service accounts patch projects](ProjectServiceAccountPatchCall) (response)
1447/// * [service accounts update projects](ProjectServiceAccountUpdateCall) (request|response)
1448#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1449#[serde_with::serde_as]
1450#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1451pub struct ServiceAccount {
1452    /// Optional. A user-specified, human-readable description of the service account. The maximum length is 256 UTF-8 bytes.
1453    pub description: Option<String>,
1454    /// Output only. Whether the service account is disabled.
1455    pub disabled: Option<bool>,
1456    /// Optional. A user-specified, human-readable name for the service account. The maximum length is 100 UTF-8 bytes.
1457    #[serde(rename = "displayName")]
1458    pub display_name: Option<String>,
1459    /// Output only. The email address of the service account.
1460    pub email: Option<String>,
1461    /// Deprecated. Do not use.
1462    #[serde_as(as = "Option<common::serde::standard_base64::Wrapper>")]
1463    pub etag: Option<Vec<u8>>,
1464    /// The resource name of the service account. Use one of the following formats: * `projects/{PROJECT_ID}/serviceAccounts/{EMAIL_ADDRESS}` * `projects/{PROJECT_ID}/serviceAccounts/{UNIQUE_ID}` As an alternative, you can use the `-` wildcard character instead of the project ID: * `projects/-/serviceAccounts/{EMAIL_ADDRESS}` * `projects/-/serviceAccounts/{UNIQUE_ID}` When possible, avoid using the `-` wildcard character, because it can cause response messages to contain misleading error codes. For example, if you try to access the service account `projects/-/serviceAccounts/fake@example.com`, which does not exist, the response contains an HTTP `403 Forbidden` error instead of a `404 Not Found` error.
1465    pub name: Option<String>,
1466    /// Output only. The OAuth 2.0 client ID for the service account.
1467    #[serde(rename = "oauth2ClientId")]
1468    pub oauth2_client_id: Option<String>,
1469    /// Output only. The ID of the project that owns the service account.
1470    #[serde(rename = "projectId")]
1471    pub project_id: Option<String>,
1472    /// Output only. The unique, stable numeric ID for the service account. Each service account retains its unique ID even if you delete the service account. For example, if you delete a service account, then create a new service account with the same name, the new service account has a different unique ID than the deleted service account.
1473    #[serde(rename = "uniqueId")]
1474    pub unique_id: Option<String>,
1475}
1476
1477impl common::RequestValue for ServiceAccount {}
1478impl common::ResponseResult for ServiceAccount {}
1479
1480/// Represents a service account key. A service account has two sets of key-pairs: user-managed, and system-managed. User-managed key-pairs can be created and deleted by users. Users are responsible for rotating these keys periodically to ensure security of their service accounts. Users retain the private key of these key-pairs, and Google retains ONLY the public key. System-managed keys are automatically rotated by Google, and are used for signing for a maximum of two weeks. The rotation process is probabilistic, and usage of the new key will gradually ramp up and down over the key’s lifetime. If you cache the public key set for a service account, we recommend that you update the cache every 15 minutes. User-managed keys can be added and removed at any time, so it is important to update the cache frequently. For Google-managed keys, Google will publish a key at least 6 hours before it is first used for signing and will keep publishing it for at least 6 hours after it was last used for signing. Public keys for all service accounts are also published at the OAuth2 Service Account API.
1481///
1482/// # Activities
1483///
1484/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1485/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1486///
1487/// * [service accounts keys create projects](ProjectServiceAccountKeyCreateCall) (response)
1488/// * [service accounts keys get projects](ProjectServiceAccountKeyGetCall) (response)
1489/// * [service accounts keys patch projects](ProjectServiceAccountKeyPatchCall) (response)
1490/// * [service accounts keys upload projects](ProjectServiceAccountKeyUploadCall) (response)
1491#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1492#[serde_with::serde_as]
1493#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1494pub struct ServiceAccountKey {
1495    /// Optional. A user provided email address as the point of contact for this service account key. Must be an email address. Limit 64 characters.
1496    pub contact: Option<String>,
1497    /// Output only. The cloud identity that created this service account key. Populated automatically when the key is created and not editable by the user.
1498    pub creator: Option<String>,
1499    /// Optional. A user provided description of this service account key.
1500    pub description: Option<String>,
1501    /// Output only. optional. If the key is disabled, it may have a DisableReason describing why it was disabled.
1502    #[serde(rename = "disableReason")]
1503    pub disable_reason: Option<String>,
1504    /// The key status.
1505    pub disabled: Option<bool>,
1506    /// Output only. Extended Status provides permanent information about a service account key. For example, if this key was detected as exposed or compromised, that information will remain for the lifetime of the key in the extended_status.
1507    #[serde(rename = "extendedStatus")]
1508    pub extended_status: Option<Vec<ExtendedStatus>>,
1509    /// Specifies the algorithm (and possibly key size) for the key.
1510    #[serde(rename = "keyAlgorithm")]
1511    pub key_algorithm: Option<String>,
1512    /// The key origin.
1513    #[serde(rename = "keyOrigin")]
1514    pub key_origin: Option<String>,
1515    /// The key type.
1516    #[serde(rename = "keyType")]
1517    pub key_type: Option<String>,
1518    /// The resource name of the service account key in the following format `projects/{PROJECT_ID}/serviceAccounts/{ACCOUNT}/keys/{key}`.
1519    pub name: Option<String>,
1520    /// The private key data. Only provided in `CreateServiceAccountKey` responses. Make sure to keep the private key data secure because it allows for the assertion of the service account identity. When base64 decoded, the private key data can be used to authenticate with Google API client libraries and with gcloud auth activate-service-account.
1521    #[serde(rename = "privateKeyData")]
1522    #[serde_as(as = "Option<common::serde::standard_base64::Wrapper>")]
1523    pub private_key_data: Option<Vec<u8>>,
1524    /// The output format for the private key. Only provided in `CreateServiceAccountKey` responses, not in `GetServiceAccountKey` or `ListServiceAccountKey` responses. Google never exposes system-managed private keys, and never retains user-managed private keys.
1525    #[serde(rename = "privateKeyType")]
1526    pub private_key_type: Option<String>,
1527    /// The public key data. Only provided in `GetServiceAccountKey` responses.
1528    #[serde(rename = "publicKeyData")]
1529    #[serde_as(as = "Option<common::serde::standard_base64::Wrapper>")]
1530    pub public_key_data: Option<Vec<u8>>,
1531    /// The key can be used after this timestamp.
1532    #[serde(rename = "validAfterTime")]
1533    pub valid_after_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1534    /// The key can be used before this timestamp. For system-managed key pairs, this timestamp is the end time for the private key signing operation. The public key could still be used for verification for a few hours after this time.
1535    #[serde(rename = "validBeforeTime")]
1536    pub valid_before_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1537}
1538
1539impl common::ResponseResult for ServiceAccountKey {}
1540
1541/// Configuration for a service.
1542///
1543/// This type is not used in any activity, and only used as *part* of another schema.
1544///
1545#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1546#[serde_with::serde_as]
1547#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1548pub struct ServiceConfig {
1549    /// Optional. Domain name of the service. Example: console.cloud.google
1550    pub domain: Option<String>,
1551}
1552
1553impl common::Part for ServiceConfig {}
1554
1555/// Request message for `SetIamPolicy` method.
1556///
1557/// # Activities
1558///
1559/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1560/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1561///
1562/// * [workforce pools set iam policy locations](LocationWorkforcePoolSetIamPolicyCall) (request)
1563/// * [service accounts set iam policy projects](ProjectServiceAccountSetIamPolicyCall) (request)
1564#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1565#[serde_with::serde_as]
1566#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1567pub struct SetIamPolicyRequest {
1568    /// REQUIRED: The complete policy to be applied to the `resource`. The size of the policy is limited to a few 10s of KB. An empty policy is a valid policy but certain Google Cloud services (such as Projects) might reject them.
1569    pub policy: Option<Policy>,
1570    /// OPTIONAL: A FieldMask specifying which fields of the policy to modify. Only the fields in the mask will be modified. If no mask is provided, the following default mask is used: `paths: "bindings, etag"`
1571    #[serde(rename = "updateMask")]
1572    pub update_mask: Option<common::FieldMask>,
1573}
1574
1575impl common::RequestValue for SetIamPolicyRequest {}
1576
1577/// Deprecated. [Migrate to Service Account Credentials API](https://cloud.google.com/iam/help/credentials/migrate-api). The service account sign blob request.
1578///
1579/// # Activities
1580///
1581/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1582/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1583///
1584/// * [service accounts sign blob projects](ProjectServiceAccountSignBlobCall) (request)
1585#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1586#[serde_with::serde_as]
1587#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1588pub struct SignBlobRequest {
1589    /// Required. Deprecated. [Migrate to Service Account Credentials API](https://cloud.google.com/iam/help/credentials/migrate-api). The bytes to sign.
1590    #[serde(rename = "bytesToSign")]
1591    #[serde_as(as = "Option<common::serde::standard_base64::Wrapper>")]
1592    pub bytes_to_sign: Option<Vec<u8>>,
1593}
1594
1595impl common::RequestValue for SignBlobRequest {}
1596
1597/// Deprecated. [Migrate to Service Account Credentials API](https://cloud.google.com/iam/help/credentials/migrate-api). The service account sign blob response.
1598///
1599/// # Activities
1600///
1601/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1602/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1603///
1604/// * [service accounts sign blob projects](ProjectServiceAccountSignBlobCall) (response)
1605#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1606#[serde_with::serde_as]
1607#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1608pub struct SignBlobResponse {
1609    /// Deprecated. [Migrate to Service Account Credentials API](https://cloud.google.com/iam/help/credentials/migrate-api). The id of the key used to sign the blob.
1610    #[serde(rename = "keyId")]
1611    pub key_id: Option<String>,
1612    /// Deprecated. [Migrate to Service Account Credentials API](https://cloud.google.com/iam/help/credentials/migrate-api). The signed blob.
1613    #[serde_as(as = "Option<common::serde::standard_base64::Wrapper>")]
1614    pub signature: Option<Vec<u8>>,
1615}
1616
1617impl common::ResponseResult for SignBlobResponse {}
1618
1619/// Deprecated. [Migrate to Service Account Credentials API](https://cloud.google.com/iam/help/credentials/migrate-api). The service account sign JWT request.
1620///
1621/// # Activities
1622///
1623/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1624/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1625///
1626/// * [service accounts sign jwt projects](ProjectServiceAccountSignJwtCall) (request)
1627#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1628#[serde_with::serde_as]
1629#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1630pub struct SignJwtRequest {
1631    /// Required. Deprecated. [Migrate to Service Account Credentials API](https://cloud.google.com/iam/help/credentials/migrate-api). The JWT payload to sign. Must be a serialized JSON object that contains a JWT Claims Set. For example: `{"sub": "user@example.com", "iat": 313435}` If the JWT Claims Set contains an expiration time (`exp`) claim, it must be an integer timestamp that is not in the past and no more than 12 hours in the future. If the JWT Claims Set does not contain an expiration time (`exp`) claim, this claim is added automatically, with a timestamp that is 1 hour in the future.
1632    pub payload: Option<String>,
1633}
1634
1635impl common::RequestValue for SignJwtRequest {}
1636
1637/// Deprecated. [Migrate to Service Account Credentials API](https://cloud.google.com/iam/help/credentials/migrate-api). The service account sign JWT response.
1638///
1639/// # Activities
1640///
1641/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1642/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1643///
1644/// * [service accounts sign jwt projects](ProjectServiceAccountSignJwtCall) (response)
1645#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1646#[serde_with::serde_as]
1647#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1648pub struct SignJwtResponse {
1649    /// Deprecated. [Migrate to Service Account Credentials API](https://cloud.google.com/iam/help/credentials/migrate-api). The id of the key used to sign the JWT.
1650    #[serde(rename = "keyId")]
1651    pub key_id: Option<String>,
1652    /// Deprecated. [Migrate to Service Account Credentials API](https://cloud.google.com/iam/help/credentials/migrate-api). The signed JWT.
1653    #[serde(rename = "signedJwt")]
1654    pub signed_jwt: Option<String>,
1655}
1656
1657impl common::ResponseResult for SignJwtResponse {}
1658
1659/// 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).
1660///
1661/// This type is not used in any activity, and only used as *part* of another schema.
1662///
1663#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1664#[serde_with::serde_as]
1665#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1666pub struct Status {
1667    /// The status code, which should be an enum value of google.rpc.Code.
1668    pub code: Option<i32>,
1669    /// A list of messages that carry the error details. There is a common set of message types for APIs to use.
1670    pub details: Option<Vec<HashMap<String, serde_json::Value>>>,
1671    /// 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.
1672    pub message: Option<String>,
1673}
1674
1675impl common::Part for Status {}
1676
1677/// Request message for `TestIamPermissions` method.
1678///
1679/// # Activities
1680///
1681/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1682/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1683///
1684/// * [workforce pools test iam permissions locations](LocationWorkforcePoolTestIamPermissionCall) (request)
1685/// * [service accounts test iam permissions projects](ProjectServiceAccountTestIamPermissionCall) (request)
1686#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1687#[serde_with::serde_as]
1688#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1689pub struct TestIamPermissionsRequest {
1690    /// The set of permissions to check for the `resource`. Permissions with wildcards (such as `*` or `storage.*`) are not allowed. For more information see [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions).
1691    pub permissions: Option<Vec<String>>,
1692}
1693
1694impl common::RequestValue for TestIamPermissionsRequest {}
1695
1696/// Response message for `TestIamPermissions` method.
1697///
1698/// # Activities
1699///
1700/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1701/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1702///
1703/// * [workforce pools test iam permissions locations](LocationWorkforcePoolTestIamPermissionCall) (response)
1704/// * [service accounts test iam permissions projects](ProjectServiceAccountTestIamPermissionCall) (response)
1705#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1706#[serde_with::serde_as]
1707#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1708pub struct TestIamPermissionsResponse {
1709    /// A subset of `TestPermissionsRequest.permissions` that the caller is allowed.
1710    pub permissions: Option<Vec<String>>,
1711}
1712
1713impl common::ResponseResult for TestIamPermissionsResponse {}
1714
1715/// Request message for UndeleteOauthClient.
1716///
1717/// # Activities
1718///
1719/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1720/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1721///
1722/// * [locations oauth clients undelete projects](ProjectLocationOauthClientUndeleteCall) (request)
1723#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1724#[serde_with::serde_as]
1725#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1726pub struct UndeleteOauthClientRequest {
1727    _never_set: Option<bool>,
1728}
1729
1730impl common::RequestValue for UndeleteOauthClientRequest {}
1731
1732/// The request to undelete an existing role.
1733///
1734/// # Activities
1735///
1736/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1737/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1738///
1739/// * [roles undelete organizations](OrganizationRoleUndeleteCall) (request)
1740/// * [roles undelete projects](ProjectRoleUndeleteCall) (request)
1741#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1742#[serde_with::serde_as]
1743#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1744pub struct UndeleteRoleRequest {
1745    /// Used to perform a consistent read-modify-write.
1746    #[serde_as(as = "Option<common::serde::standard_base64::Wrapper>")]
1747    pub etag: Option<Vec<u8>>,
1748}
1749
1750impl common::RequestValue for UndeleteRoleRequest {}
1751
1752/// The service account undelete request.
1753///
1754/// # Activities
1755///
1756/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1757/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1758///
1759/// * [service accounts undelete projects](ProjectServiceAccountUndeleteCall) (request)
1760#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1761#[serde_with::serde_as]
1762#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1763pub struct UndeleteServiceAccountRequest {
1764    _never_set: Option<bool>,
1765}
1766
1767impl common::RequestValue for UndeleteServiceAccountRequest {}
1768
1769/// There is no detailed description.
1770///
1771/// # Activities
1772///
1773/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1774/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1775///
1776/// * [service accounts undelete projects](ProjectServiceAccountUndeleteCall) (response)
1777#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1778#[serde_with::serde_as]
1779#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1780pub struct UndeleteServiceAccountResponse {
1781    /// Metadata for the restored service account.
1782    #[serde(rename = "restoredAccount")]
1783    pub restored_account: Option<ServiceAccount>,
1784}
1785
1786impl common::ResponseResult for UndeleteServiceAccountResponse {}
1787
1788/// Request message for UndeleteWorkforcePoolProviderKey.
1789///
1790/// # Activities
1791///
1792/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1793/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1794///
1795/// * [workforce pools providers keys undelete locations](LocationWorkforcePoolProviderKeyUndeleteCall) (request)
1796#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1797#[serde_with::serde_as]
1798#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1799pub struct UndeleteWorkforcePoolProviderKeyRequest {
1800    _never_set: Option<bool>,
1801}
1802
1803impl common::RequestValue for UndeleteWorkforcePoolProviderKeyRequest {}
1804
1805/// Request message for UndeleteWorkforcePoolProvider.
1806///
1807/// # Activities
1808///
1809/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1810/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1811///
1812/// * [workforce pools providers undelete locations](LocationWorkforcePoolProviderUndeleteCall) (request)
1813#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1814#[serde_with::serde_as]
1815#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1816pub struct UndeleteWorkforcePoolProviderRequest {
1817    _never_set: Option<bool>,
1818}
1819
1820impl common::RequestValue for UndeleteWorkforcePoolProviderRequest {}
1821
1822/// Request message for UndeleteWorkforcePool.
1823///
1824/// # Activities
1825///
1826/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1827/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1828///
1829/// * [workforce pools undelete locations](LocationWorkforcePoolUndeleteCall) (request)
1830#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1831#[serde_with::serde_as]
1832#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1833pub struct UndeleteWorkforcePoolRequest {
1834    _never_set: Option<bool>,
1835}
1836
1837impl common::RequestValue for UndeleteWorkforcePoolRequest {}
1838
1839/// Request message for UndeleteWorkforcePoolSubject.
1840///
1841/// # Activities
1842///
1843/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1844/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1845///
1846/// * [workforce pools subjects undelete locations](LocationWorkforcePoolSubjectUndeleteCall) (request)
1847#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1848#[serde_with::serde_as]
1849#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1850pub struct UndeleteWorkforcePoolSubjectRequest {
1851    _never_set: Option<bool>,
1852}
1853
1854impl common::RequestValue for UndeleteWorkforcePoolSubjectRequest {}
1855
1856/// Request message for UndeleteWorkloadIdentityPoolProviderKey.
1857///
1858/// # Activities
1859///
1860/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1861/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1862///
1863/// * [locations workload identity pools providers keys undelete projects](ProjectLocationWorkloadIdentityPoolProviderKeyUndeleteCall) (request)
1864#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1865#[serde_with::serde_as]
1866#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1867pub struct UndeleteWorkloadIdentityPoolProviderKeyRequest {
1868    _never_set: Option<bool>,
1869}
1870
1871impl common::RequestValue for UndeleteWorkloadIdentityPoolProviderKeyRequest {}
1872
1873/// Request message for UndeleteWorkloadIdentityPoolProvider.
1874///
1875/// # Activities
1876///
1877/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1878/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1879///
1880/// * [locations workload identity pools providers undelete projects](ProjectLocationWorkloadIdentityPoolProviderUndeleteCall) (request)
1881#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1882#[serde_with::serde_as]
1883#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1884pub struct UndeleteWorkloadIdentityPoolProviderRequest {
1885    _never_set: Option<bool>,
1886}
1887
1888impl common::RequestValue for UndeleteWorkloadIdentityPoolProviderRequest {}
1889
1890/// Request message for UndeleteWorkloadIdentityPool.
1891///
1892/// # Activities
1893///
1894/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1895/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1896///
1897/// * [locations workload identity pools undelete projects](ProjectLocationWorkloadIdentityPoolUndeleteCall) (request)
1898#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1899#[serde_with::serde_as]
1900#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1901pub struct UndeleteWorkloadIdentityPoolRequest {
1902    _never_set: Option<bool>,
1903}
1904
1905impl common::RequestValue for UndeleteWorkloadIdentityPoolRequest {}
1906
1907/// The service account key upload request.
1908///
1909/// # Activities
1910///
1911/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1912/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1913///
1914/// * [service accounts keys upload projects](ProjectServiceAccountKeyUploadCall) (request)
1915#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1916#[serde_with::serde_as]
1917#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1918pub struct UploadServiceAccountKeyRequest {
1919    /// The public key to associate with the service account. Must be an RSA public key that is wrapped in an X.509 v3 certificate. Include the first line, `-----BEGIN CERTIFICATE-----`, and the last line, `-----END CERTIFICATE-----`.
1920    #[serde(rename = "publicKeyData")]
1921    #[serde_as(as = "Option<common::serde::standard_base64::Wrapper>")]
1922    pub public_key_data: Option<Vec<u8>>,
1923}
1924
1925impl common::RequestValue for UploadServiceAccountKeyRequest {}
1926
1927/// Represents a collection of external workforces. Provides namespaces for federated users that can be referenced in IAM policies.
1928///
1929/// # Activities
1930///
1931/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1932/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1933///
1934/// * [workforce pools create locations](LocationWorkforcePoolCreateCall) (request)
1935/// * [workforce pools get locations](LocationWorkforcePoolGetCall) (response)
1936/// * [workforce pools patch locations](LocationWorkforcePoolPatchCall) (request)
1937#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1938#[serde_with::serde_as]
1939#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1940pub struct WorkforcePool {
1941    /// Optional. Configure access restrictions on the workforce pool users. This is an optional field. If specified web sign-in can be restricted to given set of services or programmatic sign-in can be disabled for pool users.
1942    #[serde(rename = "accessRestrictions")]
1943    pub access_restrictions: Option<AccessRestrictions>,
1944    /// A user-specified description of the pool. Cannot exceed 256 characters.
1945    pub description: Option<String>,
1946    /// Disables the workforce pool. You cannot use a disabled pool to exchange tokens, or use existing tokens to access resources. If the pool is re-enabled, existing tokens grant access again.
1947    pub disabled: Option<bool>,
1948    /// A user-specified display name of the pool in Google Cloud Console. Cannot exceed 32 characters.
1949    #[serde(rename = "displayName")]
1950    pub display_name: Option<String>,
1951    /// Output only. Time after which the workforce pool will be permanently purged and cannot be recovered.
1952    #[serde(rename = "expireTime")]
1953    pub expire_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1954    /// Output only. The resource name of the pool. Format: `locations/{location}/workforcePools/{workforce_pool_id}`
1955    pub name: Option<String>,
1956    /// Immutable. The resource name of the parent. Format: `organizations/{org-id}`.
1957    pub parent: Option<String>,
1958    /// Duration that the Google Cloud access tokens, console sign-in sessions, and `gcloud` sign-in sessions from this pool are valid. Must be greater than 15 minutes (900s) and less than 12 hours (43200s). If `session_duration` is not configured, minted credentials have a default duration of one hour (3600s). For SAML providers, the lifetime of the token is the minimum of the `session_duration` and the `SessionNotOnOrAfter` claim in the SAML assertion.
1959    #[serde(rename = "sessionDuration")]
1960    #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
1961    pub session_duration: Option<chrono::Duration>,
1962    /// Output only. The state of the pool.
1963    pub state: Option<String>,
1964}
1965
1966impl common::RequestValue for WorkforcePool {}
1967impl common::ResponseResult for WorkforcePool {}
1968
1969/// A configuration for an external identity provider.
1970///
1971/// # Activities
1972///
1973/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1974/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1975///
1976/// * [workforce pools providers create locations](LocationWorkforcePoolProviderCreateCall) (request)
1977/// * [workforce pools providers get locations](LocationWorkforcePoolProviderGetCall) (response)
1978/// * [workforce pools providers patch locations](LocationWorkforcePoolProviderPatchCall) (request)
1979#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1980#[serde_with::serde_as]
1981#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1982pub struct WorkforcePoolProvider {
1983    /// A [Common Expression Language](https://opensource.google/projects/cel) expression, in plain text, to restrict what otherwise valid authentication credentials issued by the provider should not be accepted. The expression must output a boolean representing whether to allow the federation. The following keywords may be referenced in the expressions: * `assertion`: JSON representing the authentication credential issued by the provider. * `google`: The Google attributes mapped from the assertion in the `attribute_mappings`. `google.profile_photo`, `google.display_name` and `google.posix_username` are not supported. * `attribute`: The custom attributes mapped from the assertion in the `attribute_mappings`. The maximum length of the attribute condition expression is 4096 characters. If unspecified, all valid authentication credentials will be accepted. The following example shows how to only allow credentials with a mapped `google.groups` value of `admins`: ``` "'admins' in google.groups" ```
1984    #[serde(rename = "attributeCondition")]
1985    pub attribute_condition: Option<String>,
1986    /// Required. Maps attributes from the authentication credentials issued by an external identity provider to Google Cloud attributes, such as `subject` and `segment`. Each key must be a string specifying the Google Cloud IAM attribute to map to. The following keys are supported: * `google.subject`: The principal IAM is authenticating. You can reference this value in IAM bindings. This is also the subject that appears in Cloud Logging logs. This is a required field and the mapped subject cannot exceed 127 bytes. * `google.groups`: Groups the authenticating user belongs to. You can grant groups access to resources using an IAM `principalSet` binding; access applies to all members of the group. * `google.display_name`: The name of the authenticated user. This is an optional field and the mapped display name cannot exceed 100 bytes. If not set, `google.subject` will be displayed instead. This attribute cannot be referenced in IAM bindings. * `google.profile_photo`: The URL that specifies the authenticated user's thumbnail photo. This is an optional field. When set, the image will be visible as the user's profile picture. If not set, a generic user icon will be displayed instead. This attribute cannot be referenced in IAM bindings. * `google.posix_username`: The Linux username used by OS Login. This is an optional field and the mapped POSIX username cannot exceed 32 characters, The key must match the regex "^a-zA-Z0-9._{0,31}$". This attribute cannot be referenced in IAM bindings. You can also provide custom attributes by specifying `attribute.{custom_attribute}`, where {custom_attribute} is the name of the custom attribute to be mapped. You can define a maximum of 50 custom attributes. The maximum length of a mapped attribute key is 100 characters, and the key may only contain the characters [a-z0-9_]. You can reference these attributes in IAM policies to define fine-grained access for a workforce pool to Google Cloud resources. For example: * `google.subject`: `principal://iam.googleapis.com/locations/global/workforcePools/{pool}/subject/{value}` * `google.groups`: `principalSet://iam.googleapis.com/locations/global/workforcePools/{pool}/group/{value}` * `attribute.{custom_attribute}`: `principalSet://iam.googleapis.com/locations/global/workforcePools/{pool}/attribute.{custom_attribute}/{value}` Each value must be a [Common Expression Language] (https://opensource.google/projects/cel) function that maps an identity provider credential to the normalized attribute specified by the corresponding map key. You can use the `assertion` keyword in the expression to access a JSON representation of the authentication credential issued by the provider. The maximum length of an attribute mapping expression is 2048 characters. When evaluated, the total size of all mapped attributes must not exceed 4KB. For OIDC providers, you must supply a custom mapping that includes the `google.subject` attribute. For example, the following maps the `sub` claim of the incoming credential to the `subject` attribute on a Google token: ``` {"google.subject": "assertion.sub"} ```
1987    #[serde(rename = "attributeMapping")]
1988    pub attribute_mapping: Option<HashMap<String, String>>,
1989    /// A user-specified description of the provider. Cannot exceed 256 characters.
1990    pub description: Option<String>,
1991    /// Disables the workforce pool provider. You cannot use a disabled provider to exchange tokens. However, existing tokens still grant access.
1992    pub disabled: Option<bool>,
1993    /// A user-specified display name for the provider. Cannot exceed 32 characters.
1994    #[serde(rename = "displayName")]
1995    pub display_name: Option<String>,
1996    /// Output only. Time after which the workload pool provider will be permanently purged and cannot be recovered.
1997    #[serde(rename = "expireTime")]
1998    pub expire_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1999    /// Optional. The configuration for OAuth 2.0 client used to get the additional user attributes. This should be used when users can't get the desired claims in authentication credentials. Currently this configuration is only supported with OIDC protocol.
2000    #[serde(rename = "extraAttributesOauth2Client")]
2001    pub extra_attributes_oauth2_client:
2002        Option<GoogleIamAdminV1WorkforcePoolProviderExtraAttributesOAuth2Client>,
2003    /// Output only. The resource name of the provider. Format: `locations/{location}/workforcePools/{workforce_pool_id}/providers/{provider_id}`
2004    pub name: Option<String>,
2005    /// An OpenId Connect 1.0 identity provider configuration.
2006    pub oidc: Option<GoogleIamAdminV1WorkforcePoolProviderOidc>,
2007    /// A SAML identity provider configuration.
2008    pub saml: Option<GoogleIamAdminV1WorkforcePoolProviderSaml>,
2009    /// Output only. The state of the provider.
2010    pub state: Option<String>,
2011}
2012
2013impl common::RequestValue for WorkforcePoolProvider {}
2014impl common::ResponseResult for WorkforcePoolProvider {}
2015
2016/// Represents a public key configuration for a Workforce Pool Provider. The key can be configured in your identity provider to encrypt SAML assertions. Google holds the corresponding private key, which it uses to decrypt encrypted tokens.
2017///
2018/// # Activities
2019///
2020/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2021/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2022///
2023/// * [workforce pools providers keys create locations](LocationWorkforcePoolProviderKeyCreateCall) (request)
2024/// * [workforce pools providers keys get locations](LocationWorkforcePoolProviderKeyGetCall) (response)
2025#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2026#[serde_with::serde_as]
2027#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2028pub struct WorkforcePoolProviderKey {
2029    /// Output only. The time after which the key will be permanently deleted and cannot be recovered. Note that the key may get purged before this time if the total limit of keys per provider is exceeded.
2030    #[serde(rename = "expireTime")]
2031    pub expire_time: Option<chrono::DateTime<chrono::offset::Utc>>,
2032    /// Immutable. Public half of the asymmetric key.
2033    #[serde(rename = "keyData")]
2034    pub key_data: Option<KeyData>,
2035    /// Output only. The resource name of the key.
2036    pub name: Option<String>,
2037    /// Output only. The state of the key.
2038    pub state: Option<String>,
2039    /// Required. The purpose of the key.
2040    #[serde(rename = "use")]
2041    pub use_: Option<String>,
2042}
2043
2044impl common::RequestValue for WorkforcePoolProviderKey {}
2045impl common::ResponseResult for WorkforcePoolProviderKey {}
2046
2047/// Represents a collection of workload identities. You can define IAM policies to grant these identities access to Google Cloud resources.
2048///
2049/// # Activities
2050///
2051/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2052/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2053///
2054/// * [locations workload identity pools create projects](ProjectLocationWorkloadIdentityPoolCreateCall) (request)
2055/// * [locations workload identity pools get projects](ProjectLocationWorkloadIdentityPoolGetCall) (response)
2056/// * [locations workload identity pools patch projects](ProjectLocationWorkloadIdentityPoolPatchCall) (request)
2057#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2058#[serde_with::serde_as]
2059#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2060pub struct WorkloadIdentityPool {
2061    /// A description of the pool. Cannot exceed 256 characters.
2062    pub description: Option<String>,
2063    /// Whether the pool is disabled. You cannot use a disabled pool to exchange tokens, or use existing tokens to access resources. If the pool is re-enabled, existing tokens grant access again.
2064    pub disabled: Option<bool>,
2065    /// A display name for the pool. Cannot exceed 32 characters.
2066    #[serde(rename = "displayName")]
2067    pub display_name: Option<String>,
2068    /// Output only. Time after which the workload identity pool will be permanently purged and cannot be recovered.
2069    #[serde(rename = "expireTime")]
2070    pub expire_time: Option<chrono::DateTime<chrono::offset::Utc>>,
2071    /// Output only. The resource name of the pool.
2072    pub name: Option<String>,
2073    /// Output only. The state of the pool.
2074    pub state: Option<String>,
2075}
2076
2077impl common::RequestValue for WorkloadIdentityPool {}
2078impl common::ResponseResult for WorkloadIdentityPool {}
2079
2080/// A configuration for an external identity provider.
2081///
2082/// # Activities
2083///
2084/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2085/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2086///
2087/// * [locations workload identity pools providers create projects](ProjectLocationWorkloadIdentityPoolProviderCreateCall) (request)
2088/// * [locations workload identity pools providers get projects](ProjectLocationWorkloadIdentityPoolProviderGetCall) (response)
2089/// * [locations workload identity pools providers patch projects](ProjectLocationWorkloadIdentityPoolProviderPatchCall) (request)
2090#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2091#[serde_with::serde_as]
2092#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2093pub struct WorkloadIdentityPoolProvider {
2094    /// [A Common Expression Language](https://opensource.google/projects/cel) expression, in plain text, to restrict what otherwise valid authentication credentials issued by the provider should not be accepted. The expression must output a boolean representing whether to allow the federation. The following keywords may be referenced in the expressions: * `assertion`: JSON representing the authentication credential issued by the provider. * `google`: The Google attributes mapped from the assertion in the `attribute_mappings`. * `attribute`: The custom attributes mapped from the assertion in the `attribute_mappings`. The maximum length of the attribute condition expression is 4096 characters. If unspecified, all valid authentication credential are accepted. The following example shows how to only allow credentials with a mapped `google.groups` value of `admins`: ``` "'admins' in google.groups" ```
2095    #[serde(rename = "attributeCondition")]
2096    pub attribute_condition: Option<String>,
2097    ///  Maps attributes from authentication credentials issued by an external identity provider to Google Cloud attributes, such as `subject` and `segment`. Each key must be a string specifying the Google Cloud IAM attribute to map to. The following keys are supported: * `google.subject`: The principal IAM is authenticating. You can reference this value in IAM bindings. This is also the subject that appears in Cloud Logging logs. Cannot exceed 127 bytes. * `google.groups`: Groups the external identity belongs to. You can grant groups access to resources using an IAM `principalSet` binding; access applies to all members of the group. You can also provide custom attributes by specifying `attribute.{custom_attribute}`, where `{custom_attribute}` is the name of the custom attribute to be mapped. You can define a maximum of 50 custom attributes. The maximum length of a mapped attribute key is 100 characters, and the key may only contain the characters [a-z0-9_]. You can reference these attributes in IAM policies to define fine-grained access for a workload to Google Cloud resources. For example: * `google.subject`: `principal://iam.googleapis.com/projects/{project}/locations/{location}/workloadIdentityPools/{pool}/subject/{value}` * `google.groups`: `principalSet://iam.googleapis.com/projects/{project}/locations/{location}/workloadIdentityPools/{pool}/group/{value}` * `attribute.{custom_attribute}`: `principalSet://iam.googleapis.com/projects/{project}/locations/{location}/workloadIdentityPools/{pool}/attribute.{custom_attribute}/{value}` Each value must be a [Common Expression Language] (https://opensource.google/projects/cel) function that maps an identity provider credential to the normalized attribute specified by the corresponding map key. You can use the `assertion` keyword in the expression to access a JSON representation of the authentication credential issued by the provider. The maximum length of an attribute mapping expression is 2048 characters. When evaluated, the total size of all mapped attributes must not exceed 8KB. For AWS providers, if no attribute mapping is defined, the following default mapping applies: ``` { "google.subject":"assertion.arn", "attribute.aws_role": "assertion.arn.contains('assumed-role')" " ? assertion.arn.extract('{account_arn}assumed-role/')" " + 'assumed-role/'" " + assertion.arn.extract('assumed-role/{role_name}/')" " : assertion.arn", } ``` If any custom attribute mappings are defined, they must include a mapping to the `google.subject` attribute. For OIDC providers, you must supply a custom mapping, which must include the `google.subject` attribute. For example, the following maps the `sub` claim of the incoming credential to the `subject` attribute on a Google token: ``` {"google.subject": "assertion.sub"} ```
2098    #[serde(rename = "attributeMapping")]
2099    pub attribute_mapping: Option<HashMap<String, String>>,
2100    /// An Amazon Web Services identity provider.
2101    pub aws: Option<Aws>,
2102    /// A description for the provider. Cannot exceed 256 characters.
2103    pub description: Option<String>,
2104    /// Whether the provider is disabled. You cannot use a disabled provider to exchange tokens. However, existing tokens still grant access.
2105    pub disabled: Option<bool>,
2106    /// A display name for the provider. Cannot exceed 32 characters.
2107    #[serde(rename = "displayName")]
2108    pub display_name: Option<String>,
2109    /// Output only. Time after which the workload identity pool provider will be permanently purged and cannot be recovered.
2110    #[serde(rename = "expireTime")]
2111    pub expire_time: Option<chrono::DateTime<chrono::offset::Utc>>,
2112    /// Output only. The resource name of the provider.
2113    pub name: Option<String>,
2114    /// An OpenId Connect 1.0 identity provider.
2115    pub oidc: Option<Oidc>,
2116    /// An SAML 2.0 identity provider.
2117    pub saml: Option<Saml>,
2118    /// Output only. The state of the provider.
2119    pub state: Option<String>,
2120}
2121
2122impl common::RequestValue for WorkloadIdentityPoolProvider {}
2123impl common::ResponseResult for WorkloadIdentityPoolProvider {}
2124
2125/// Represents a public key configuration for your workload identity pool provider. The key can be configured in your identity provider to encrypt the SAML assertions. Google holds the corresponding private key which it uses to decrypt encrypted tokens.
2126///
2127/// # Activities
2128///
2129/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2130/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2131///
2132/// * [locations workload identity pools providers keys create projects](ProjectLocationWorkloadIdentityPoolProviderKeyCreateCall) (request)
2133/// * [locations workload identity pools providers keys get projects](ProjectLocationWorkloadIdentityPoolProviderKeyGetCall) (response)
2134#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2135#[serde_with::serde_as]
2136#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2137pub struct WorkloadIdentityPoolProviderKey {
2138    /// Output only. Time after which the key will be permanently purged and cannot be recovered. Note that the key may get purged before this timestamp if the total limit of keys per provider is crossed.
2139    #[serde(rename = "expireTime")]
2140    pub expire_time: Option<chrono::DateTime<chrono::offset::Utc>>,
2141    /// Immutable. Public half of the asymmetric key.
2142    #[serde(rename = "keyData")]
2143    pub key_data: Option<KeyData>,
2144    /// Output only. The resource name of the key.
2145    pub name: Option<String>,
2146    /// Output only. The state of the key.
2147    pub state: Option<String>,
2148    /// Required. The purpose of the key.
2149    #[serde(rename = "use")]
2150    pub use_: Option<String>,
2151}
2152
2153impl common::RequestValue for WorkloadIdentityPoolProviderKey {}
2154impl common::ResponseResult for WorkloadIdentityPoolProviderKey {}
2155
2156// ###################
2157// MethodBuilders ###
2158// #################
2159
2160/// A builder providing access to all methods supported on *iamPolicy* resources.
2161/// It is not used directly, but through the [`Iam`] hub.
2162///
2163/// # Example
2164///
2165/// Instantiate a resource builder
2166///
2167/// ```test_harness,no_run
2168/// extern crate hyper;
2169/// extern crate hyper_rustls;
2170/// extern crate google_iam1 as iam1;
2171///
2172/// # async fn dox() {
2173/// use iam1::{Iam, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2174///
2175/// let secret: yup_oauth2::ApplicationSecret = Default::default();
2176/// let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
2177///     secret,
2178///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2179/// ).build().await.unwrap();
2180///
2181/// let client = hyper_util::client::legacy::Client::builder(
2182///     hyper_util::rt::TokioExecutor::new()
2183/// )
2184/// .build(
2185///     hyper_rustls::HttpsConnectorBuilder::new()
2186///         .with_native_roots()
2187///         .unwrap()
2188///         .https_or_http()
2189///         .enable_http1()
2190///         .build()
2191/// );
2192/// let mut hub = Iam::new(client, auth);
2193/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
2194/// // like `lint_policy(...)` and `query_auditable_services(...)`
2195/// // to build up your call.
2196/// let rb = hub.iam_policies();
2197/// # }
2198/// ```
2199pub struct IamPolicyMethods<'a, C>
2200where
2201    C: 'a,
2202{
2203    hub: &'a Iam<C>,
2204}
2205
2206impl<'a, C> common::MethodsBuilder for IamPolicyMethods<'a, C> {}
2207
2208impl<'a, C> IamPolicyMethods<'a, C> {
2209    /// Create a builder to help you perform the following task:
2210    ///
2211    /// Lints, or validates, an IAM policy. Currently checks the google.iam.v1.Binding.condition field, which contains a condition expression for a role binding. Successful calls to this method always return an HTTP `200 OK` status code, even if the linter detects an issue in the IAM policy.
2212    ///
2213    /// # Arguments
2214    ///
2215    /// * `request` - No description provided.
2216    pub fn lint_policy(&self, request: LintPolicyRequest) -> IamPolicyLintPolicyCall<'a, C> {
2217        IamPolicyLintPolicyCall {
2218            hub: self.hub,
2219            _request: request,
2220            _delegate: Default::default(),
2221            _additional_params: Default::default(),
2222            _scopes: Default::default(),
2223        }
2224    }
2225
2226    /// Create a builder to help you perform the following task:
2227    ///
2228    /// Returns a list of services that allow you to opt into audit logs that are not generated by default. To learn more about audit logs, see the [Logging documentation](https://cloud.google.com/logging/docs/audit).
2229    ///
2230    /// # Arguments
2231    ///
2232    /// * `request` - No description provided.
2233    pub fn query_auditable_services(
2234        &self,
2235        request: QueryAuditableServicesRequest,
2236    ) -> IamPolicyQueryAuditableServiceCall<'a, C> {
2237        IamPolicyQueryAuditableServiceCall {
2238            hub: self.hub,
2239            _request: request,
2240            _delegate: Default::default(),
2241            _additional_params: Default::default(),
2242            _scopes: Default::default(),
2243        }
2244    }
2245}
2246
2247/// A builder providing access to all methods supported on *location* resources.
2248/// It is not used directly, but through the [`Iam`] hub.
2249///
2250/// # Example
2251///
2252/// Instantiate a resource builder
2253///
2254/// ```test_harness,no_run
2255/// extern crate hyper;
2256/// extern crate hyper_rustls;
2257/// extern crate google_iam1 as iam1;
2258///
2259/// # async fn dox() {
2260/// use iam1::{Iam, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2261///
2262/// let secret: yup_oauth2::ApplicationSecret = Default::default();
2263/// let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
2264///     secret,
2265///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2266/// ).build().await.unwrap();
2267///
2268/// let client = hyper_util::client::legacy::Client::builder(
2269///     hyper_util::rt::TokioExecutor::new()
2270/// )
2271/// .build(
2272///     hyper_rustls::HttpsConnectorBuilder::new()
2273///         .with_native_roots()
2274///         .unwrap()
2275///         .https_or_http()
2276///         .enable_http1()
2277///         .build()
2278/// );
2279/// let mut hub = Iam::new(client, auth);
2280/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
2281/// // like `workforce_pools_create(...)`, `workforce_pools_delete(...)`, `workforce_pools_get(...)`, `workforce_pools_get_iam_policy(...)`, `workforce_pools_list(...)`, `workforce_pools_operations_get(...)`, `workforce_pools_patch(...)`, `workforce_pools_providers_create(...)`, `workforce_pools_providers_delete(...)`, `workforce_pools_providers_get(...)`, `workforce_pools_providers_keys_create(...)`, `workforce_pools_providers_keys_delete(...)`, `workforce_pools_providers_keys_get(...)`, `workforce_pools_providers_keys_list(...)`, `workforce_pools_providers_keys_operations_get(...)`, `workforce_pools_providers_keys_undelete(...)`, `workforce_pools_providers_list(...)`, `workforce_pools_providers_operations_get(...)`, `workforce_pools_providers_patch(...)`, `workforce_pools_providers_undelete(...)`, `workforce_pools_set_iam_policy(...)`, `workforce_pools_subjects_delete(...)`, `workforce_pools_subjects_operations_get(...)`, `workforce_pools_subjects_undelete(...)`, `workforce_pools_test_iam_permissions(...)` and `workforce_pools_undelete(...)`
2282/// // to build up your call.
2283/// let rb = hub.locations();
2284/// # }
2285/// ```
2286pub struct LocationMethods<'a, C>
2287where
2288    C: 'a,
2289{
2290    hub: &'a Iam<C>,
2291}
2292
2293impl<'a, C> common::MethodsBuilder for LocationMethods<'a, C> {}
2294
2295impl<'a, C> LocationMethods<'a, C> {
2296    /// Create a builder to help you perform the following task:
2297    ///
2298    /// Gets the latest state of a long-running operation. Clients can use this method to poll the operation result at intervals as recommended by the API service.
2299    ///
2300    /// # Arguments
2301    ///
2302    /// * `name` - The name of the operation resource.
2303    pub fn workforce_pools_operations_get(
2304        &self,
2305        name: &str,
2306    ) -> LocationWorkforcePoolOperationGetCall<'a, C> {
2307        LocationWorkforcePoolOperationGetCall {
2308            hub: self.hub,
2309            _name: name.to_string(),
2310            _delegate: Default::default(),
2311            _additional_params: Default::default(),
2312            _scopes: Default::default(),
2313        }
2314    }
2315
2316    /// Create a builder to help you perform the following task:
2317    ///
2318    /// Gets the latest state of a long-running operation. Clients can use this method to poll the operation result at intervals as recommended by the API service.
2319    ///
2320    /// # Arguments
2321    ///
2322    /// * `name` - The name of the operation resource.
2323    pub fn workforce_pools_providers_keys_operations_get(
2324        &self,
2325        name: &str,
2326    ) -> LocationWorkforcePoolProviderKeyOperationGetCall<'a, C> {
2327        LocationWorkforcePoolProviderKeyOperationGetCall {
2328            hub: self.hub,
2329            _name: name.to_string(),
2330            _delegate: Default::default(),
2331            _additional_params: Default::default(),
2332            _scopes: Default::default(),
2333        }
2334    }
2335
2336    /// Create a builder to help you perform the following task:
2337    ///
2338    /// Creates a new WorkforcePoolProviderKey in a WorkforcePoolProvider.
2339    ///
2340    /// # Arguments
2341    ///
2342    /// * `request` - No description provided.
2343    /// * `parent` - Required. The provider to create this key in.
2344    pub fn workforce_pools_providers_keys_create(
2345        &self,
2346        request: WorkforcePoolProviderKey,
2347        parent: &str,
2348    ) -> LocationWorkforcePoolProviderKeyCreateCall<'a, C> {
2349        LocationWorkforcePoolProviderKeyCreateCall {
2350            hub: self.hub,
2351            _request: request,
2352            _parent: parent.to_string(),
2353            _workforce_pool_provider_key_id: Default::default(),
2354            _delegate: Default::default(),
2355            _additional_params: Default::default(),
2356            _scopes: Default::default(),
2357        }
2358    }
2359
2360    /// Create a builder to help you perform the following task:
2361    ///
2362    /// Deletes a WorkforcePoolProviderKey. You can undelete a key for 30 days. After 30 days, deletion is permanent.
2363    ///
2364    /// # Arguments
2365    ///
2366    /// * `name` - Required. The name of the key to delete.
2367    pub fn workforce_pools_providers_keys_delete(
2368        &self,
2369        name: &str,
2370    ) -> LocationWorkforcePoolProviderKeyDeleteCall<'a, C> {
2371        LocationWorkforcePoolProviderKeyDeleteCall {
2372            hub: self.hub,
2373            _name: name.to_string(),
2374            _delegate: Default::default(),
2375            _additional_params: Default::default(),
2376            _scopes: Default::default(),
2377        }
2378    }
2379
2380    /// Create a builder to help you perform the following task:
2381    ///
2382    /// Gets a WorkforcePoolProviderKey.
2383    ///
2384    /// # Arguments
2385    ///
2386    /// * `name` - Required. The name of the key to retrieve.
2387    pub fn workforce_pools_providers_keys_get(
2388        &self,
2389        name: &str,
2390    ) -> LocationWorkforcePoolProviderKeyGetCall<'a, C> {
2391        LocationWorkforcePoolProviderKeyGetCall {
2392            hub: self.hub,
2393            _name: name.to_string(),
2394            _delegate: Default::default(),
2395            _additional_params: Default::default(),
2396            _scopes: Default::default(),
2397        }
2398    }
2399
2400    /// Create a builder to help you perform the following task:
2401    ///
2402    /// Lists all non-deleted WorkforcePoolProviderKeys in a WorkforcePoolProvider. If `show_deleted` is set to `true`, then deleted keys are also listed.
2403    ///
2404    /// # Arguments
2405    ///
2406    /// * `parent` - Required. The provider resource to list encryption keys for. Format: `locations/{location}/workforcePools/{workforce_pool_id}/providers/{provider_id}`
2407    pub fn workforce_pools_providers_keys_list(
2408        &self,
2409        parent: &str,
2410    ) -> LocationWorkforcePoolProviderKeyListCall<'a, C> {
2411        LocationWorkforcePoolProviderKeyListCall {
2412            hub: self.hub,
2413            _parent: parent.to_string(),
2414            _show_deleted: Default::default(),
2415            _page_token: Default::default(),
2416            _page_size: Default::default(),
2417            _delegate: Default::default(),
2418            _additional_params: Default::default(),
2419            _scopes: Default::default(),
2420        }
2421    }
2422
2423    /// Create a builder to help you perform the following task:
2424    ///
2425    /// Undeletes a WorkforcePoolProviderKey, as long as it was deleted fewer than 30 days ago.
2426    ///
2427    /// # Arguments
2428    ///
2429    /// * `request` - No description provided.
2430    /// * `name` - Required. The name of the key to undelete.
2431    pub fn workforce_pools_providers_keys_undelete(
2432        &self,
2433        request: UndeleteWorkforcePoolProviderKeyRequest,
2434        name: &str,
2435    ) -> LocationWorkforcePoolProviderKeyUndeleteCall<'a, C> {
2436        LocationWorkforcePoolProviderKeyUndeleteCall {
2437            hub: self.hub,
2438            _request: request,
2439            _name: name.to_string(),
2440            _delegate: Default::default(),
2441            _additional_params: Default::default(),
2442            _scopes: Default::default(),
2443        }
2444    }
2445
2446    /// Create a builder to help you perform the following task:
2447    ///
2448    /// Gets the latest state of a long-running operation. Clients can use this method to poll the operation result at intervals as recommended by the API service.
2449    ///
2450    /// # Arguments
2451    ///
2452    /// * `name` - The name of the operation resource.
2453    pub fn workforce_pools_providers_operations_get(
2454        &self,
2455        name: &str,
2456    ) -> LocationWorkforcePoolProviderOperationGetCall<'a, C> {
2457        LocationWorkforcePoolProviderOperationGetCall {
2458            hub: self.hub,
2459            _name: name.to_string(),
2460            _delegate: Default::default(),
2461            _additional_params: Default::default(),
2462            _scopes: Default::default(),
2463        }
2464    }
2465
2466    /// Create a builder to help you perform the following task:
2467    ///
2468    /// Creates a new WorkforcePoolProvider in a WorkforcePool. You cannot reuse the name of a deleted provider until 30 days after deletion.
2469    ///
2470    /// # Arguments
2471    ///
2472    /// * `request` - No description provided.
2473    /// * `parent` - Required. The pool to create this provider in. Format: `locations/{location}/workforcePools/{workforce_pool_id}`
2474    pub fn workforce_pools_providers_create(
2475        &self,
2476        request: WorkforcePoolProvider,
2477        parent: &str,
2478    ) -> LocationWorkforcePoolProviderCreateCall<'a, C> {
2479        LocationWorkforcePoolProviderCreateCall {
2480            hub: self.hub,
2481            _request: request,
2482            _parent: parent.to_string(),
2483            _workforce_pool_provider_id: Default::default(),
2484            _delegate: Default::default(),
2485            _additional_params: Default::default(),
2486            _scopes: Default::default(),
2487        }
2488    }
2489
2490    /// Create a builder to help you perform the following task:
2491    ///
2492    /// Deletes a WorkforcePoolProvider. Deleting a provider does not revoke credentials that have already been issued; they continue to grant access. You can undelete a provider for 30 days. After 30 days, deletion is permanent. You cannot update deleted providers. However, you can view and list them.
2493    ///
2494    /// # Arguments
2495    ///
2496    /// * `name` - Required. The name of the provider to delete. Format: `locations/{location}/workforcePools/{workforce_pool_id}/providers/{provider_id}`
2497    pub fn workforce_pools_providers_delete(
2498        &self,
2499        name: &str,
2500    ) -> LocationWorkforcePoolProviderDeleteCall<'a, C> {
2501        LocationWorkforcePoolProviderDeleteCall {
2502            hub: self.hub,
2503            _name: name.to_string(),
2504            _delegate: Default::default(),
2505            _additional_params: Default::default(),
2506            _scopes: Default::default(),
2507        }
2508    }
2509
2510    /// Create a builder to help you perform the following task:
2511    ///
2512    /// Gets an individual WorkforcePoolProvider.
2513    ///
2514    /// # Arguments
2515    ///
2516    /// * `name` - Required. The name of the provider to retrieve. Format: `locations/{location}/workforcePools/{workforce_pool_id}/providers/{provider_id}`
2517    pub fn workforce_pools_providers_get(
2518        &self,
2519        name: &str,
2520    ) -> LocationWorkforcePoolProviderGetCall<'a, C> {
2521        LocationWorkforcePoolProviderGetCall {
2522            hub: self.hub,
2523            _name: name.to_string(),
2524            _delegate: Default::default(),
2525            _additional_params: Default::default(),
2526            _scopes: Default::default(),
2527        }
2528    }
2529
2530    /// Create a builder to help you perform the following task:
2531    ///
2532    /// Lists all non-deleted WorkforcePoolProviders in a WorkforcePool. If `show_deleted` is set to `true`, then deleted providers are also listed.
2533    ///
2534    /// # Arguments
2535    ///
2536    /// * `parent` - Required. The pool to list providers for. Format: `locations/{location}/workforcePools/{workforce_pool_id}`
2537    pub fn workforce_pools_providers_list(
2538        &self,
2539        parent: &str,
2540    ) -> LocationWorkforcePoolProviderListCall<'a, C> {
2541        LocationWorkforcePoolProviderListCall {
2542            hub: self.hub,
2543            _parent: parent.to_string(),
2544            _show_deleted: Default::default(),
2545            _page_token: Default::default(),
2546            _page_size: Default::default(),
2547            _delegate: Default::default(),
2548            _additional_params: Default::default(),
2549            _scopes: Default::default(),
2550        }
2551    }
2552
2553    /// Create a builder to help you perform the following task:
2554    ///
2555    /// Updates an existing WorkforcePoolProvider.
2556    ///
2557    /// # Arguments
2558    ///
2559    /// * `request` - No description provided.
2560    /// * `name` - Output only. The resource name of the provider. Format: `locations/{location}/workforcePools/{workforce_pool_id}/providers/{provider_id}`
2561    pub fn workforce_pools_providers_patch(
2562        &self,
2563        request: WorkforcePoolProvider,
2564        name: &str,
2565    ) -> LocationWorkforcePoolProviderPatchCall<'a, C> {
2566        LocationWorkforcePoolProviderPatchCall {
2567            hub: self.hub,
2568            _request: request,
2569            _name: name.to_string(),
2570            _update_mask: Default::default(),
2571            _delegate: Default::default(),
2572            _additional_params: Default::default(),
2573            _scopes: Default::default(),
2574        }
2575    }
2576
2577    /// Create a builder to help you perform the following task:
2578    ///
2579    /// Undeletes a WorkforcePoolProvider, as long as it was deleted fewer than 30 days ago.
2580    ///
2581    /// # Arguments
2582    ///
2583    /// * `request` - No description provided.
2584    /// * `name` - Required. The name of the provider to undelete. Format: `locations/{location}/workforcePools/{workforce_pool_id}/providers/{provider_id}`
2585    pub fn workforce_pools_providers_undelete(
2586        &self,
2587        request: UndeleteWorkforcePoolProviderRequest,
2588        name: &str,
2589    ) -> LocationWorkforcePoolProviderUndeleteCall<'a, C> {
2590        LocationWorkforcePoolProviderUndeleteCall {
2591            hub: self.hub,
2592            _request: request,
2593            _name: name.to_string(),
2594            _delegate: Default::default(),
2595            _additional_params: Default::default(),
2596            _scopes: Default::default(),
2597        }
2598    }
2599
2600    /// Create a builder to help you perform the following task:
2601    ///
2602    /// Gets the latest state of a long-running operation. Clients can use this method to poll the operation result at intervals as recommended by the API service.
2603    ///
2604    /// # Arguments
2605    ///
2606    /// * `name` - The name of the operation resource.
2607    pub fn workforce_pools_subjects_operations_get(
2608        &self,
2609        name: &str,
2610    ) -> LocationWorkforcePoolSubjectOperationGetCall<'a, C> {
2611        LocationWorkforcePoolSubjectOperationGetCall {
2612            hub: self.hub,
2613            _name: name.to_string(),
2614            _delegate: Default::default(),
2615            _additional_params: Default::default(),
2616            _scopes: Default::default(),
2617        }
2618    }
2619
2620    /// Create a builder to help you perform the following task:
2621    ///
2622    /// Deletes a WorkforcePoolSubject. Subject must not already be in a deleted state. A WorkforcePoolSubject is automatically created the first time an external credential is exchanged for a Google Cloud credential using a mapped `google.subject` attribute. There is no endpoint to manually create a WorkforcePoolSubject. For 30 days after a WorkforcePoolSubject is deleted, using the same `google.subject` attribute in token exchanges with Google Cloud STS fails. Call UndeleteWorkforcePoolSubject to undelete a WorkforcePoolSubject that has been deleted, within within 30 days of deleting it. After 30 days, the WorkforcePoolSubject is permanently deleted. At this point, a token exchange with Google Cloud STS that uses the same mapped `google.subject` attribute automatically creates a new WorkforcePoolSubject that is unrelated to the previously deleted WorkforcePoolSubject but has the same `google.subject` value.
2623    ///
2624    /// # Arguments
2625    ///
2626    /// * `name` - Required. The resource name of the WorkforcePoolSubject. Special characters, like `/` and `:`, must be escaped, because all URLs need to conform to the "When to Escape and Unescape" section of [RFC3986](https://www.ietf.org/rfc/rfc2396.txt). Format: `locations/{location}/workforcePools/{workforce_pool_id}/subjects/{subject_id}`
2627    pub fn workforce_pools_subjects_delete(
2628        &self,
2629        name: &str,
2630    ) -> LocationWorkforcePoolSubjectDeleteCall<'a, C> {
2631        LocationWorkforcePoolSubjectDeleteCall {
2632            hub: self.hub,
2633            _name: name.to_string(),
2634            _delegate: Default::default(),
2635            _additional_params: Default::default(),
2636            _scopes: Default::default(),
2637        }
2638    }
2639
2640    /// Create a builder to help you perform the following task:
2641    ///
2642    /// Undeletes a WorkforcePoolSubject, as long as it was deleted fewer than 30 days ago.
2643    ///
2644    /// # Arguments
2645    ///
2646    /// * `request` - No description provided.
2647    /// * `name` - Required. The resource name of the WorkforcePoolSubject. Special characters, like `/` and `:`, must be escaped, because all URLs need to conform to the "When to Escape and Unescape" section of [RFC3986](https://www.ietf.org/rfc/rfc2396.txt). Format: `locations/{location}/workforcePools/{workforce_pool_id}/subjects/{subject_id}`
2648    pub fn workforce_pools_subjects_undelete(
2649        &self,
2650        request: UndeleteWorkforcePoolSubjectRequest,
2651        name: &str,
2652    ) -> LocationWorkforcePoolSubjectUndeleteCall<'a, C> {
2653        LocationWorkforcePoolSubjectUndeleteCall {
2654            hub: self.hub,
2655            _request: request,
2656            _name: name.to_string(),
2657            _delegate: Default::default(),
2658            _additional_params: Default::default(),
2659            _scopes: Default::default(),
2660        }
2661    }
2662
2663    /// Create a builder to help you perform the following task:
2664    ///
2665    /// Creates a new WorkforcePool. You cannot reuse the name of a deleted pool until 30 days after deletion.
2666    ///
2667    /// # Arguments
2668    ///
2669    /// * `request` - No description provided.
2670    /// * `location` - The location of the pool to create. Format: `locations/{location}`.
2671    pub fn workforce_pools_create(
2672        &self,
2673        request: WorkforcePool,
2674        location: &str,
2675    ) -> LocationWorkforcePoolCreateCall<'a, C> {
2676        LocationWorkforcePoolCreateCall {
2677            hub: self.hub,
2678            _request: request,
2679            _location: location.to_string(),
2680            _workforce_pool_id: Default::default(),
2681            _delegate: Default::default(),
2682            _additional_params: Default::default(),
2683            _scopes: Default::default(),
2684        }
2685    }
2686
2687    /// Create a builder to help you perform the following task:
2688    ///
2689    /// Deletes a WorkforcePool. You cannot use a deleted WorkforcePool to exchange external credentials for Google Cloud credentials. However, deletion does not revoke credentials that have already been issued. Credentials issued for a deleted pool do not grant access to resources. If the pool is undeleted, and the credentials are not expired, they grant access again. You can undelete a pool for 30 days. After 30 days, deletion is permanent. You cannot update deleted pools. However, you can view and list them.
2690    ///
2691    /// # Arguments
2692    ///
2693    /// * `name` - Required. The name of the pool to delete. Format: `locations/{location}/workforcePools/{workforce_pool_id}`
2694    pub fn workforce_pools_delete(&self, name: &str) -> LocationWorkforcePoolDeleteCall<'a, C> {
2695        LocationWorkforcePoolDeleteCall {
2696            hub: self.hub,
2697            _name: name.to_string(),
2698            _delegate: Default::default(),
2699            _additional_params: Default::default(),
2700            _scopes: Default::default(),
2701        }
2702    }
2703
2704    /// Create a builder to help you perform the following task:
2705    ///
2706    /// Gets an individual WorkforcePool.
2707    ///
2708    /// # Arguments
2709    ///
2710    /// * `name` - Required. The name of the pool to retrieve. Format: `locations/{location}/workforcePools/{workforce_pool_id}`
2711    pub fn workforce_pools_get(&self, name: &str) -> LocationWorkforcePoolGetCall<'a, C> {
2712        LocationWorkforcePoolGetCall {
2713            hub: self.hub,
2714            _name: name.to_string(),
2715            _delegate: Default::default(),
2716            _additional_params: Default::default(),
2717            _scopes: Default::default(),
2718        }
2719    }
2720
2721    /// Create a builder to help you perform the following task:
2722    ///
2723    /// Gets IAM policies on a WorkforcePool.
2724    ///
2725    /// # Arguments
2726    ///
2727    /// * `request` - No description provided.
2728    /// * `resource` - REQUIRED: The resource for which the policy is being requested. See [Resource names](https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
2729    pub fn workforce_pools_get_iam_policy(
2730        &self,
2731        request: GetIamPolicyRequest,
2732        resource: &str,
2733    ) -> LocationWorkforcePoolGetIamPolicyCall<'a, C> {
2734        LocationWorkforcePoolGetIamPolicyCall {
2735            hub: self.hub,
2736            _request: request,
2737            _resource: resource.to_string(),
2738            _delegate: Default::default(),
2739            _additional_params: Default::default(),
2740            _scopes: Default::default(),
2741        }
2742    }
2743
2744    /// Create a builder to help you perform the following task:
2745    ///
2746    /// Lists all non-deleted WorkforcePools under the specified parent. If `show_deleted` is set to `true`, then deleted pools are also listed.
2747    ///
2748    /// # Arguments
2749    ///
2750    /// * `location` - The location of the pool. Format: `locations/{location}`.
2751    pub fn workforce_pools_list(&self, location: &str) -> LocationWorkforcePoolListCall<'a, C> {
2752        LocationWorkforcePoolListCall {
2753            hub: self.hub,
2754            _location: location.to_string(),
2755            _show_deleted: Default::default(),
2756            _parent: Default::default(),
2757            _page_token: Default::default(),
2758            _page_size: Default::default(),
2759            _delegate: Default::default(),
2760            _additional_params: Default::default(),
2761            _scopes: Default::default(),
2762        }
2763    }
2764
2765    /// Create a builder to help you perform the following task:
2766    ///
2767    /// Updates an existing WorkforcePool.
2768    ///
2769    /// # Arguments
2770    ///
2771    /// * `request` - No description provided.
2772    /// * `name` - Output only. The resource name of the pool. Format: `locations/{location}/workforcePools/{workforce_pool_id}`
2773    pub fn workforce_pools_patch(
2774        &self,
2775        request: WorkforcePool,
2776        name: &str,
2777    ) -> LocationWorkforcePoolPatchCall<'a, C> {
2778        LocationWorkforcePoolPatchCall {
2779            hub: self.hub,
2780            _request: request,
2781            _name: name.to_string(),
2782            _update_mask: Default::default(),
2783            _delegate: Default::default(),
2784            _additional_params: Default::default(),
2785            _scopes: Default::default(),
2786        }
2787    }
2788
2789    /// Create a builder to help you perform the following task:
2790    ///
2791    /// Sets IAM policies on a WorkforcePool.
2792    ///
2793    /// # Arguments
2794    ///
2795    /// * `request` - No description provided.
2796    /// * `resource` - REQUIRED: The resource for which the policy is being specified. See [Resource names](https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
2797    pub fn workforce_pools_set_iam_policy(
2798        &self,
2799        request: SetIamPolicyRequest,
2800        resource: &str,
2801    ) -> LocationWorkforcePoolSetIamPolicyCall<'a, C> {
2802        LocationWorkforcePoolSetIamPolicyCall {
2803            hub: self.hub,
2804            _request: request,
2805            _resource: resource.to_string(),
2806            _delegate: Default::default(),
2807            _additional_params: Default::default(),
2808            _scopes: Default::default(),
2809        }
2810    }
2811
2812    /// Create a builder to help you perform the following task:
2813    ///
2814    /// Returns the caller's permissions on the WorkforcePool. If the pool doesn't exist, this call returns an empty set of permissions. It doesn't return a `NOT_FOUND` error.
2815    ///
2816    /// # Arguments
2817    ///
2818    /// * `request` - No description provided.
2819    /// * `resource` - REQUIRED: The resource for which the policy detail is being requested. See [Resource names](https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
2820    pub fn workforce_pools_test_iam_permissions(
2821        &self,
2822        request: TestIamPermissionsRequest,
2823        resource: &str,
2824    ) -> LocationWorkforcePoolTestIamPermissionCall<'a, C> {
2825        LocationWorkforcePoolTestIamPermissionCall {
2826            hub: self.hub,
2827            _request: request,
2828            _resource: resource.to_string(),
2829            _delegate: Default::default(),
2830            _additional_params: Default::default(),
2831            _scopes: Default::default(),
2832        }
2833    }
2834
2835    /// Create a builder to help you perform the following task:
2836    ///
2837    /// Undeletes a WorkforcePool, as long as it was deleted fewer than 30 days ago.
2838    ///
2839    /// # Arguments
2840    ///
2841    /// * `request` - No description provided.
2842    /// * `name` - Required. The name of the pool to undelete. Format: `locations/{location}/workforcePools/{workforce_pool_id}`
2843    pub fn workforce_pools_undelete(
2844        &self,
2845        request: UndeleteWorkforcePoolRequest,
2846        name: &str,
2847    ) -> LocationWorkforcePoolUndeleteCall<'a, C> {
2848        LocationWorkforcePoolUndeleteCall {
2849            hub: self.hub,
2850            _request: request,
2851            _name: name.to_string(),
2852            _delegate: Default::default(),
2853            _additional_params: Default::default(),
2854            _scopes: Default::default(),
2855        }
2856    }
2857}
2858
2859/// A builder providing access to all methods supported on *organization* resources.
2860/// It is not used directly, but through the [`Iam`] hub.
2861///
2862/// # Example
2863///
2864/// Instantiate a resource builder
2865///
2866/// ```test_harness,no_run
2867/// extern crate hyper;
2868/// extern crate hyper_rustls;
2869/// extern crate google_iam1 as iam1;
2870///
2871/// # async fn dox() {
2872/// use iam1::{Iam, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2873///
2874/// let secret: yup_oauth2::ApplicationSecret = Default::default();
2875/// let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
2876///     secret,
2877///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2878/// ).build().await.unwrap();
2879///
2880/// let client = hyper_util::client::legacy::Client::builder(
2881///     hyper_util::rt::TokioExecutor::new()
2882/// )
2883/// .build(
2884///     hyper_rustls::HttpsConnectorBuilder::new()
2885///         .with_native_roots()
2886///         .unwrap()
2887///         .https_or_http()
2888///         .enable_http1()
2889///         .build()
2890/// );
2891/// let mut hub = Iam::new(client, auth);
2892/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
2893/// // like `roles_create(...)`, `roles_delete(...)`, `roles_get(...)`, `roles_list(...)`, `roles_patch(...)` and `roles_undelete(...)`
2894/// // to build up your call.
2895/// let rb = hub.organizations();
2896/// # }
2897/// ```
2898pub struct OrganizationMethods<'a, C>
2899where
2900    C: 'a,
2901{
2902    hub: &'a Iam<C>,
2903}
2904
2905impl<'a, C> common::MethodsBuilder for OrganizationMethods<'a, C> {}
2906
2907impl<'a, C> OrganizationMethods<'a, C> {
2908    /// Create a builder to help you perform the following task:
2909    ///
2910    /// Creates a new custom Role.
2911    ///
2912    /// # Arguments
2913    ///
2914    /// * `request` - No description provided.
2915    /// * `parent` - The `parent` parameter's value depends on the target resource for the request, namely [projects](https://cloud.google.com/iam/docs/reference/rest/v1/projects.roles) or [organizations](https://cloud.google.com/iam/docs/reference/rest/v1/organizations.roles). Each resource type's `parent` value format is described below: * [projects.roles.create](https://cloud.google.com/iam/docs/reference/rest/v1/projects.roles/create): `projects/{PROJECT_ID}`. This method creates project-level [custom roles](https://cloud.google.com/iam/docs/understanding-custom-roles). Example request URL: `https://iam.googleapis.com/v1/projects/{PROJECT_ID}/roles` * [organizations.roles.create](https://cloud.google.com/iam/docs/reference/rest/v1/organizations.roles/create): `organizations/{ORGANIZATION_ID}`. This method creates organization-level [custom roles](https://cloud.google.com/iam/docs/understanding-custom-roles). Example request URL: `https://iam.googleapis.com/v1/organizations/{ORGANIZATION_ID}/roles` Note: Wildcard (*) values are invalid; you must specify a complete project ID or organization ID.
2916    pub fn roles_create(
2917        &self,
2918        request: CreateRoleRequest,
2919        parent: &str,
2920    ) -> OrganizationRoleCreateCall<'a, C> {
2921        OrganizationRoleCreateCall {
2922            hub: self.hub,
2923            _request: request,
2924            _parent: parent.to_string(),
2925            _delegate: Default::default(),
2926            _additional_params: Default::default(),
2927            _scopes: Default::default(),
2928        }
2929    }
2930
2931    /// Create a builder to help you perform the following task:
2932    ///
2933    /// Deletes a custom Role. When you delete a custom role, the following changes occur immediately: * You cannot bind a principal to the custom role in an IAM Policy. * Existing bindings to the custom role are not changed, but they have no effect. * By default, the response from ListRoles does not include the custom role. You have 7 days to undelete the custom role. After 7 days, the following changes occur: * The custom role is permanently deleted and cannot be recovered. * If an IAM policy contains a binding to the custom role, the binding is permanently removed.
2934    ///
2935    /// # Arguments
2936    ///
2937    /// * `name` - The `name` parameter's value depends on the target resource for the request, namely [projects](https://cloud.google.com/iam/docs/reference/rest/v1/projects.roles) or [organizations](https://cloud.google.com/iam/docs/reference/rest/v1/organizations.roles). Each resource type's `name` value format is described below: * [projects.roles.delete](https://cloud.google.com/iam/docs/reference/rest/v1/projects.roles/delete): `projects/{PROJECT_ID}/roles/{CUSTOM_ROLE_ID}`. This method deletes only [custom roles](https://cloud.google.com/iam/docs/understanding-custom-roles) that have been created at the project level. Example request URL: `https://iam.googleapis.com/v1/projects/{PROJECT_ID}/roles/{CUSTOM_ROLE_ID}` * [organizations.roles.delete](https://cloud.google.com/iam/docs/reference/rest/v1/organizations.roles/delete): `organizations/{ORGANIZATION_ID}/roles/{CUSTOM_ROLE_ID}`. This method deletes only [custom roles](https://cloud.google.com/iam/docs/understanding-custom-roles) that have been created at the organization level. Example request URL: `https://iam.googleapis.com/v1/organizations/{ORGANIZATION_ID}/roles/{CUSTOM_ROLE_ID}` Note: Wildcard (*) values are invalid; you must specify a complete project ID or organization ID.
2938    pub fn roles_delete(&self, name: &str) -> OrganizationRoleDeleteCall<'a, C> {
2939        OrganizationRoleDeleteCall {
2940            hub: self.hub,
2941            _name: name.to_string(),
2942            _etag: Default::default(),
2943            _delegate: Default::default(),
2944            _additional_params: Default::default(),
2945            _scopes: Default::default(),
2946        }
2947    }
2948
2949    /// Create a builder to help you perform the following task:
2950    ///
2951    /// Gets the definition of a Role.
2952    ///
2953    /// # Arguments
2954    ///
2955    /// * `name` - The `name` parameter's value depends on the target resource for the request, namely [roles](https://cloud.google.com/iam/docs/reference/rest/v1/roles), [projects](https://cloud.google.com/iam/docs/reference/rest/v1/projects.roles), or [organizations](https://cloud.google.com/iam/docs/reference/rest/v1/organizations.roles). Each resource type's `name` value format is described below: * [roles.get](https://cloud.google.com/iam/docs/reference/rest/v1/roles/get): `roles/{ROLE_NAME}`. This method returns results from all [predefined roles](https://cloud.google.com/iam/docs/understanding-roles#predefined_roles) in IAM. Example request URL: `https://iam.googleapis.com/v1/roles/{ROLE_NAME}` * [projects.roles.get](https://cloud.google.com/iam/docs/reference/rest/v1/projects.roles/get): `projects/{PROJECT_ID}/roles/{CUSTOM_ROLE_ID}`. This method returns only [custom roles](https://cloud.google.com/iam/docs/understanding-custom-roles) that have been created at the project level. Example request URL: `https://iam.googleapis.com/v1/projects/{PROJECT_ID}/roles/{CUSTOM_ROLE_ID}` * [organizations.roles.get](https://cloud.google.com/iam/docs/reference/rest/v1/organizations.roles/get): `organizations/{ORGANIZATION_ID}/roles/{CUSTOM_ROLE_ID}`. This method returns only [custom roles](https://cloud.google.com/iam/docs/understanding-custom-roles) that have been created at the organization level. Example request URL: `https://iam.googleapis.com/v1/organizations/{ORGANIZATION_ID}/roles/{CUSTOM_ROLE_ID}` Note: Wildcard (*) values are invalid; you must specify a complete project ID or organization ID.
2956    pub fn roles_get(&self, name: &str) -> OrganizationRoleGetCall<'a, C> {
2957        OrganizationRoleGetCall {
2958            hub: self.hub,
2959            _name: name.to_string(),
2960            _delegate: Default::default(),
2961            _additional_params: Default::default(),
2962            _scopes: Default::default(),
2963        }
2964    }
2965
2966    /// Create a builder to help you perform the following task:
2967    ///
2968    /// Lists every predefined Role that IAM supports, or every custom role that is defined for an organization or project.
2969    ///
2970    /// # Arguments
2971    ///
2972    /// * `parent` - The `parent` parameter's value depends on the target resource for the request, namely [roles](https://cloud.google.com/iam/docs/reference/rest/v1/roles), [projects](https://cloud.google.com/iam/docs/reference/rest/v1/projects.roles), or [organizations](https://cloud.google.com/iam/docs/reference/rest/v1/organizations.roles). Each resource type's `parent` value format is described below: * [roles.list](https://cloud.google.com/iam/docs/reference/rest/v1/roles/list): An empty string. This method doesn't require a resource; it simply returns all [predefined roles](https://cloud.google.com/iam/docs/understanding-roles#predefined_roles) in IAM. Example request URL: `https://iam.googleapis.com/v1/roles` * [projects.roles.list](https://cloud.google.com/iam/docs/reference/rest/v1/projects.roles/list): `projects/{PROJECT_ID}`. This method lists all project-level [custom roles](https://cloud.google.com/iam/docs/understanding-custom-roles). Example request URL: `https://iam.googleapis.com/v1/projects/{PROJECT_ID}/roles` * [organizations.roles.list](https://cloud.google.com/iam/docs/reference/rest/v1/organizations.roles/list): `organizations/{ORGANIZATION_ID}`. This method lists all organization-level [custom roles](https://cloud.google.com/iam/docs/understanding-custom-roles). Example request URL: `https://iam.googleapis.com/v1/organizations/{ORGANIZATION_ID}/roles` Note: Wildcard (*) values are invalid; you must specify a complete project ID or organization ID.
2973    pub fn roles_list(&self, parent: &str) -> OrganizationRoleListCall<'a, C> {
2974        OrganizationRoleListCall {
2975            hub: self.hub,
2976            _parent: parent.to_string(),
2977            _view: Default::default(),
2978            _show_deleted: Default::default(),
2979            _page_token: Default::default(),
2980            _page_size: Default::default(),
2981            _delegate: Default::default(),
2982            _additional_params: Default::default(),
2983            _scopes: Default::default(),
2984        }
2985    }
2986
2987    /// Create a builder to help you perform the following task:
2988    ///
2989    /// Updates the definition of a custom Role.
2990    ///
2991    /// # Arguments
2992    ///
2993    /// * `request` - No description provided.
2994    /// * `name` - The `name` parameter's value depends on the target resource for the request, namely [projects](https://cloud.google.com/iam/docs/reference/rest/v1/projects.roles) or [organizations](https://cloud.google.com/iam/docs/reference/rest/v1/organizations.roles). Each resource type's `name` value format is described below: * [projects.roles.patch](https://cloud.google.com/iam/docs/reference/rest/v1/projects.roles/patch): `projects/{PROJECT_ID}/roles/{CUSTOM_ROLE_ID}`. This method updates only [custom roles](https://cloud.google.com/iam/docs/understanding-custom-roles) that have been created at the project level. Example request URL: `https://iam.googleapis.com/v1/projects/{PROJECT_ID}/roles/{CUSTOM_ROLE_ID}` * [organizations.roles.patch](https://cloud.google.com/iam/docs/reference/rest/v1/organizations.roles/patch): `organizations/{ORGANIZATION_ID}/roles/{CUSTOM_ROLE_ID}`. This method updates only [custom roles](https://cloud.google.com/iam/docs/understanding-custom-roles) that have been created at the organization level. Example request URL: `https://iam.googleapis.com/v1/organizations/{ORGANIZATION_ID}/roles/{CUSTOM_ROLE_ID}` Note: Wildcard (*) values are invalid; you must specify a complete project ID or organization ID.
2995    pub fn roles_patch(&self, request: Role, name: &str) -> OrganizationRolePatchCall<'a, C> {
2996        OrganizationRolePatchCall {
2997            hub: self.hub,
2998            _request: request,
2999            _name: name.to_string(),
3000            _update_mask: Default::default(),
3001            _delegate: Default::default(),
3002            _additional_params: Default::default(),
3003            _scopes: Default::default(),
3004        }
3005    }
3006
3007    /// Create a builder to help you perform the following task:
3008    ///
3009    /// Undeletes a custom Role.
3010    ///
3011    /// # Arguments
3012    ///
3013    /// * `request` - No description provided.
3014    /// * `name` - The `name` parameter's value depends on the target resource for the request, namely [projects](https://cloud.google.com/iam/docs/reference/rest/v1/projects.roles) or [organizations](https://cloud.google.com/iam/docs/reference/rest/v1/organizations.roles). Each resource type's `name` value format is described below: * [projects.roles.undelete](https://cloud.google.com/iam/docs/reference/rest/v1/projects.roles/undelete): `projects/{PROJECT_ID}/roles/{CUSTOM_ROLE_ID}`. This method undeletes only [custom roles](https://cloud.google.com/iam/docs/understanding-custom-roles) that have been created at the project level. Example request URL: `https://iam.googleapis.com/v1/projects/{PROJECT_ID}/roles/{CUSTOM_ROLE_ID}` * [organizations.roles.undelete](https://cloud.google.com/iam/docs/reference/rest/v1/organizations.roles/undelete): `organizations/{ORGANIZATION_ID}/roles/{CUSTOM_ROLE_ID}`. This method undeletes only [custom roles](https://cloud.google.com/iam/docs/understanding-custom-roles) that have been created at the organization level. Example request URL: `https://iam.googleapis.com/v1/organizations/{ORGANIZATION_ID}/roles/{CUSTOM_ROLE_ID}` Note: Wildcard (*) values are invalid; you must specify a complete project ID or organization ID.
3015    pub fn roles_undelete(
3016        &self,
3017        request: UndeleteRoleRequest,
3018        name: &str,
3019    ) -> OrganizationRoleUndeleteCall<'a, C> {
3020        OrganizationRoleUndeleteCall {
3021            hub: self.hub,
3022            _request: request,
3023            _name: name.to_string(),
3024            _delegate: Default::default(),
3025            _additional_params: Default::default(),
3026            _scopes: Default::default(),
3027        }
3028    }
3029}
3030
3031/// A builder providing access to all methods supported on *permission* resources.
3032/// It is not used directly, but through the [`Iam`] hub.
3033///
3034/// # Example
3035///
3036/// Instantiate a resource builder
3037///
3038/// ```test_harness,no_run
3039/// extern crate hyper;
3040/// extern crate hyper_rustls;
3041/// extern crate google_iam1 as iam1;
3042///
3043/// # async fn dox() {
3044/// use iam1::{Iam, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3045///
3046/// let secret: yup_oauth2::ApplicationSecret = Default::default();
3047/// let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
3048///     secret,
3049///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3050/// ).build().await.unwrap();
3051///
3052/// let client = hyper_util::client::legacy::Client::builder(
3053///     hyper_util::rt::TokioExecutor::new()
3054/// )
3055/// .build(
3056///     hyper_rustls::HttpsConnectorBuilder::new()
3057///         .with_native_roots()
3058///         .unwrap()
3059///         .https_or_http()
3060///         .enable_http1()
3061///         .build()
3062/// );
3063/// let mut hub = Iam::new(client, auth);
3064/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
3065/// // like `query_testable_permissions(...)`
3066/// // to build up your call.
3067/// let rb = hub.permissions();
3068/// # }
3069/// ```
3070pub struct PermissionMethods<'a, C>
3071where
3072    C: 'a,
3073{
3074    hub: &'a Iam<C>,
3075}
3076
3077impl<'a, C> common::MethodsBuilder for PermissionMethods<'a, C> {}
3078
3079impl<'a, C> PermissionMethods<'a, C> {
3080    /// Create a builder to help you perform the following task:
3081    ///
3082    /// Lists every permission that you can test on a resource. A permission is testable if you can check whether a principal has that permission on the resource.
3083    ///
3084    /// # Arguments
3085    ///
3086    /// * `request` - No description provided.
3087    pub fn query_testable_permissions(
3088        &self,
3089        request: QueryTestablePermissionsRequest,
3090    ) -> PermissionQueryTestablePermissionCall<'a, C> {
3091        PermissionQueryTestablePermissionCall {
3092            hub: self.hub,
3093            _request: request,
3094            _delegate: Default::default(),
3095            _additional_params: Default::default(),
3096            _scopes: Default::default(),
3097        }
3098    }
3099}
3100
3101/// A builder providing access to all methods supported on *project* resources.
3102/// It is not used directly, but through the [`Iam`] hub.
3103///
3104/// # Example
3105///
3106/// Instantiate a resource builder
3107///
3108/// ```test_harness,no_run
3109/// extern crate hyper;
3110/// extern crate hyper_rustls;
3111/// extern crate google_iam1 as iam1;
3112///
3113/// # async fn dox() {
3114/// use iam1::{Iam, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3115///
3116/// let secret: yup_oauth2::ApplicationSecret = Default::default();
3117/// let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
3118///     secret,
3119///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3120/// ).build().await.unwrap();
3121///
3122/// let client = hyper_util::client::legacy::Client::builder(
3123///     hyper_util::rt::TokioExecutor::new()
3124/// )
3125/// .build(
3126///     hyper_rustls::HttpsConnectorBuilder::new()
3127///         .with_native_roots()
3128///         .unwrap()
3129///         .https_or_http()
3130///         .enable_http1()
3131///         .build()
3132/// );
3133/// let mut hub = Iam::new(client, auth);
3134/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
3135/// // like `locations_oauth_clients_create(...)`, `locations_oauth_clients_credentials_create(...)`, `locations_oauth_clients_credentials_delete(...)`, `locations_oauth_clients_credentials_get(...)`, `locations_oauth_clients_credentials_list(...)`, `locations_oauth_clients_credentials_patch(...)`, `locations_oauth_clients_delete(...)`, `locations_oauth_clients_get(...)`, `locations_oauth_clients_list(...)`, `locations_oauth_clients_patch(...)`, `locations_oauth_clients_undelete(...)`, `locations_workload_identity_pools_create(...)`, `locations_workload_identity_pools_delete(...)`, `locations_workload_identity_pools_get(...)`, `locations_workload_identity_pools_list(...)`, `locations_workload_identity_pools_namespaces_managed_identities_operations_get(...)`, `locations_workload_identity_pools_namespaces_managed_identities_workload_sources_operations_get(...)`, `locations_workload_identity_pools_namespaces_operations_get(...)`, `locations_workload_identity_pools_operations_get(...)`, `locations_workload_identity_pools_patch(...)`, `locations_workload_identity_pools_providers_create(...)`, `locations_workload_identity_pools_providers_delete(...)`, `locations_workload_identity_pools_providers_get(...)`, `locations_workload_identity_pools_providers_keys_create(...)`, `locations_workload_identity_pools_providers_keys_delete(...)`, `locations_workload_identity_pools_providers_keys_get(...)`, `locations_workload_identity_pools_providers_keys_list(...)`, `locations_workload_identity_pools_providers_keys_operations_get(...)`, `locations_workload_identity_pools_providers_keys_undelete(...)`, `locations_workload_identity_pools_providers_list(...)`, `locations_workload_identity_pools_providers_operations_get(...)`, `locations_workload_identity_pools_providers_patch(...)`, `locations_workload_identity_pools_providers_undelete(...)`, `locations_workload_identity_pools_undelete(...)`, `roles_create(...)`, `roles_delete(...)`, `roles_get(...)`, `roles_list(...)`, `roles_patch(...)`, `roles_undelete(...)`, `service_accounts_create(...)`, `service_accounts_delete(...)`, `service_accounts_disable(...)`, `service_accounts_enable(...)`, `service_accounts_get(...)`, `service_accounts_get_iam_policy(...)`, `service_accounts_keys_create(...)`, `service_accounts_keys_delete(...)`, `service_accounts_keys_disable(...)`, `service_accounts_keys_enable(...)`, `service_accounts_keys_get(...)`, `service_accounts_keys_list(...)`, `service_accounts_keys_patch(...)`, `service_accounts_keys_upload(...)`, `service_accounts_list(...)`, `service_accounts_patch(...)`, `service_accounts_set_iam_policy(...)`, `service_accounts_sign_blob(...)`, `service_accounts_sign_jwt(...)`, `service_accounts_test_iam_permissions(...)`, `service_accounts_undelete(...)` and `service_accounts_update(...)`
3136/// // to build up your call.
3137/// let rb = hub.projects();
3138/// # }
3139/// ```
3140pub struct ProjectMethods<'a, C>
3141where
3142    C: 'a,
3143{
3144    hub: &'a Iam<C>,
3145}
3146
3147impl<'a, C> common::MethodsBuilder for ProjectMethods<'a, C> {}
3148
3149impl<'a, C> ProjectMethods<'a, C> {
3150    /// Create a builder to help you perform the following task:
3151    ///
3152    /// Creates a new OauthClientCredential.
3153    ///
3154    /// # Arguments
3155    ///
3156    /// * `request` - No description provided.
3157    /// * `parent` - Required. The parent resource to create the OauthClientCredential in.
3158    pub fn locations_oauth_clients_credentials_create(
3159        &self,
3160        request: OauthClientCredential,
3161        parent: &str,
3162    ) -> ProjectLocationOauthClientCredentialCreateCall<'a, C> {
3163        ProjectLocationOauthClientCredentialCreateCall {
3164            hub: self.hub,
3165            _request: request,
3166            _parent: parent.to_string(),
3167            _oauth_client_credential_id: Default::default(),
3168            _delegate: Default::default(),
3169            _additional_params: Default::default(),
3170            _scopes: Default::default(),
3171        }
3172    }
3173
3174    /// Create a builder to help you perform the following task:
3175    ///
3176    /// Deletes an OauthClientCredential. Before deleting an OauthClientCredential, it should first be disabled.
3177    ///
3178    /// # Arguments
3179    ///
3180    /// * `name` - Required. The name of the OauthClientCredential to delete. Format: `projects/{project}/locations/{location}/oauthClients/{oauth_client}/credentials/{credential}`.
3181    pub fn locations_oauth_clients_credentials_delete(
3182        &self,
3183        name: &str,
3184    ) -> ProjectLocationOauthClientCredentialDeleteCall<'a, C> {
3185        ProjectLocationOauthClientCredentialDeleteCall {
3186            hub: self.hub,
3187            _name: name.to_string(),
3188            _delegate: Default::default(),
3189            _additional_params: Default::default(),
3190            _scopes: Default::default(),
3191        }
3192    }
3193
3194    /// Create a builder to help you perform the following task:
3195    ///
3196    /// Gets an individual OauthClientCredential.
3197    ///
3198    /// # Arguments
3199    ///
3200    /// * `name` - Required. The name of the OauthClientCredential to retrieve. Format: `projects/{project}/locations/{location}/oauthClients/{oauth_client}/credentials/{credential}`.
3201    pub fn locations_oauth_clients_credentials_get(
3202        &self,
3203        name: &str,
3204    ) -> ProjectLocationOauthClientCredentialGetCall<'a, C> {
3205        ProjectLocationOauthClientCredentialGetCall {
3206            hub: self.hub,
3207            _name: name.to_string(),
3208            _delegate: Default::default(),
3209            _additional_params: Default::default(),
3210            _scopes: Default::default(),
3211        }
3212    }
3213
3214    /// Create a builder to help you perform the following task:
3215    ///
3216    /// Lists all OauthClientCredentials in an OauthClient.
3217    ///
3218    /// # Arguments
3219    ///
3220    /// * `parent` - Required. The parent to list OauthClientCredentials for.
3221    pub fn locations_oauth_clients_credentials_list(
3222        &self,
3223        parent: &str,
3224    ) -> ProjectLocationOauthClientCredentialListCall<'a, C> {
3225        ProjectLocationOauthClientCredentialListCall {
3226            hub: self.hub,
3227            _parent: parent.to_string(),
3228            _delegate: Default::default(),
3229            _additional_params: Default::default(),
3230            _scopes: Default::default(),
3231        }
3232    }
3233
3234    /// Create a builder to help you perform the following task:
3235    ///
3236    /// Updates an existing OauthClientCredential.
3237    ///
3238    /// # Arguments
3239    ///
3240    /// * `request` - No description provided.
3241    /// * `name` - Immutable. The resource name of the OauthClientCredential. Format: `projects/{project}/locations/{location}/oauthClients/{oauth_client}/credentials/{credential}`
3242    pub fn locations_oauth_clients_credentials_patch(
3243        &self,
3244        request: OauthClientCredential,
3245        name: &str,
3246    ) -> ProjectLocationOauthClientCredentialPatchCall<'a, C> {
3247        ProjectLocationOauthClientCredentialPatchCall {
3248            hub: self.hub,
3249            _request: request,
3250            _name: name.to_string(),
3251            _update_mask: Default::default(),
3252            _delegate: Default::default(),
3253            _additional_params: Default::default(),
3254            _scopes: Default::default(),
3255        }
3256    }
3257
3258    /// Create a builder to help you perform the following task:
3259    ///
3260    /// Creates a new OauthClient. You cannot reuse the name of a deleted OauthClient until 30 days after deletion.
3261    ///
3262    /// # Arguments
3263    ///
3264    /// * `request` - No description provided.
3265    /// * `parent` - Required. The parent resource to create the OauthClient in. The only supported location is `global`.
3266    pub fn locations_oauth_clients_create(
3267        &self,
3268        request: OauthClient,
3269        parent: &str,
3270    ) -> ProjectLocationOauthClientCreateCall<'a, C> {
3271        ProjectLocationOauthClientCreateCall {
3272            hub: self.hub,
3273            _request: request,
3274            _parent: parent.to_string(),
3275            _oauth_client_id: Default::default(),
3276            _delegate: Default::default(),
3277            _additional_params: Default::default(),
3278            _scopes: Default::default(),
3279        }
3280    }
3281
3282    /// Create a builder to help you perform the following task:
3283    ///
3284    /// Deletes an OauthClient. You cannot use a deleted OauthClient. However, deletion does not revoke access tokens that have already been issued. They continue to grant access. Deletion does revoke refresh tokens that have already been issued. They cannot be used to renew an access token. If the OauthClient is undeleted, and the refresh tokens are not expired, they are valid for token exchange again. You can undelete an OauthClient for 30 days. After 30 days, deletion is permanent. You cannot update deleted OauthClients. However, you can view and list them.
3285    ///
3286    /// # Arguments
3287    ///
3288    /// * `name` - Required. The name of the OauthClient to delete. Format: `projects/{project}/locations/{location}/oauthClients/{oauth_client}`.
3289    pub fn locations_oauth_clients_delete(
3290        &self,
3291        name: &str,
3292    ) -> ProjectLocationOauthClientDeleteCall<'a, C> {
3293        ProjectLocationOauthClientDeleteCall {
3294            hub: self.hub,
3295            _name: name.to_string(),
3296            _delegate: Default::default(),
3297            _additional_params: Default::default(),
3298            _scopes: Default::default(),
3299        }
3300    }
3301
3302    /// Create a builder to help you perform the following task:
3303    ///
3304    /// Gets an individual OauthClient.
3305    ///
3306    /// # Arguments
3307    ///
3308    /// * `name` - Required. The name of the OauthClient to retrieve. Format: `projects/{project}/locations/{location}/oauthClients/{oauth_client}`.
3309    pub fn locations_oauth_clients_get(
3310        &self,
3311        name: &str,
3312    ) -> ProjectLocationOauthClientGetCall<'a, C> {
3313        ProjectLocationOauthClientGetCall {
3314            hub: self.hub,
3315            _name: name.to_string(),
3316            _delegate: Default::default(),
3317            _additional_params: Default::default(),
3318            _scopes: Default::default(),
3319        }
3320    }
3321
3322    /// Create a builder to help you perform the following task:
3323    ///
3324    /// Lists all non-deleted OauthClients in a project. If `show_deleted` is set to `true`, then deleted OauthClients are also listed.
3325    ///
3326    /// # Arguments
3327    ///
3328    /// * `parent` - Required. The parent to list OauthClients for.
3329    pub fn locations_oauth_clients_list(
3330        &self,
3331        parent: &str,
3332    ) -> ProjectLocationOauthClientListCall<'a, C> {
3333        ProjectLocationOauthClientListCall {
3334            hub: self.hub,
3335            _parent: parent.to_string(),
3336            _show_deleted: Default::default(),
3337            _page_token: Default::default(),
3338            _page_size: Default::default(),
3339            _delegate: Default::default(),
3340            _additional_params: Default::default(),
3341            _scopes: Default::default(),
3342        }
3343    }
3344
3345    /// Create a builder to help you perform the following task:
3346    ///
3347    /// Updates an existing OauthClient.
3348    ///
3349    /// # Arguments
3350    ///
3351    /// * `request` - No description provided.
3352    /// * `name` - Immutable. The resource name of the OauthClient. Format:`projects/{project}/locations/{location}/oauthClients/{oauth_client}`.
3353    pub fn locations_oauth_clients_patch(
3354        &self,
3355        request: OauthClient,
3356        name: &str,
3357    ) -> ProjectLocationOauthClientPatchCall<'a, C> {
3358        ProjectLocationOauthClientPatchCall {
3359            hub: self.hub,
3360            _request: request,
3361            _name: name.to_string(),
3362            _update_mask: Default::default(),
3363            _delegate: Default::default(),
3364            _additional_params: Default::default(),
3365            _scopes: Default::default(),
3366        }
3367    }
3368
3369    /// Create a builder to help you perform the following task:
3370    ///
3371    /// Undeletes an OauthClient, as long as it was deleted fewer than 30 days ago.
3372    ///
3373    /// # Arguments
3374    ///
3375    /// * `request` - No description provided.
3376    /// * `name` - Required. The name of the OauthClient to undelete. Format: `projects/{project}/locations/{location}/oauthClients/{oauth_client}`.
3377    pub fn locations_oauth_clients_undelete(
3378        &self,
3379        request: UndeleteOauthClientRequest,
3380        name: &str,
3381    ) -> ProjectLocationOauthClientUndeleteCall<'a, C> {
3382        ProjectLocationOauthClientUndeleteCall {
3383            hub: self.hub,
3384            _request: request,
3385            _name: name.to_string(),
3386            _delegate: Default::default(),
3387            _additional_params: Default::default(),
3388            _scopes: Default::default(),
3389        }
3390    }
3391
3392    /// Create a builder to help you perform the following task:
3393    ///
3394    /// Gets the latest state of a long-running operation. Clients can use this method to poll the operation result at intervals as recommended by the API service.
3395    ///
3396    /// # Arguments
3397    ///
3398    /// * `name` - The name of the operation resource.
3399    pub fn locations_workload_identity_pools_namespaces_managed_identities_operations_get(
3400        &self,
3401        name: &str,
3402    ) -> ProjectLocationWorkloadIdentityPoolNamespaceManagedIdentityOperationGetCall<'a, C> {
3403        ProjectLocationWorkloadIdentityPoolNamespaceManagedIdentityOperationGetCall {
3404            hub: self.hub,
3405            _name: name.to_string(),
3406            _delegate: Default::default(),
3407            _additional_params: Default::default(),
3408            _scopes: Default::default(),
3409        }
3410    }
3411
3412    /// Create a builder to help you perform the following task:
3413    ///
3414    /// Gets the latest state of a long-running operation. Clients can use this method to poll the operation result at intervals as recommended by the API service.
3415    ///
3416    /// # Arguments
3417    ///
3418    /// * `name` - The name of the operation resource.
3419    pub fn locations_workload_identity_pools_namespaces_managed_identities_workload_sources_operations_get(&self, name: &str) -> ProjectLocationWorkloadIdentityPoolNamespaceManagedIdentityWorkloadSourceOperationGetCall<'a, C>{
3420        ProjectLocationWorkloadIdentityPoolNamespaceManagedIdentityWorkloadSourceOperationGetCall {
3421            hub: self.hub,
3422            _name: name.to_string(),
3423            _delegate: Default::default(),
3424            _additional_params: Default::default(),
3425            _scopes: Default::default(),
3426        }
3427    }
3428
3429    /// Create a builder to help you perform the following task:
3430    ///
3431    /// Gets the latest state of a long-running operation. Clients can use this method to poll the operation result at intervals as recommended by the API service.
3432    ///
3433    /// # Arguments
3434    ///
3435    /// * `name` - The name of the operation resource.
3436    pub fn locations_workload_identity_pools_namespaces_operations_get(
3437        &self,
3438        name: &str,
3439    ) -> ProjectLocationWorkloadIdentityPoolNamespaceOperationGetCall<'a, C> {
3440        ProjectLocationWorkloadIdentityPoolNamespaceOperationGetCall {
3441            hub: self.hub,
3442            _name: name.to_string(),
3443            _delegate: Default::default(),
3444            _additional_params: Default::default(),
3445            _scopes: Default::default(),
3446        }
3447    }
3448
3449    /// Create a builder to help you perform the following task:
3450    ///
3451    /// Gets the latest state of a long-running operation. Clients can use this method to poll the operation result at intervals as recommended by the API service.
3452    ///
3453    /// # Arguments
3454    ///
3455    /// * `name` - The name of the operation resource.
3456    pub fn locations_workload_identity_pools_operations_get(
3457        &self,
3458        name: &str,
3459    ) -> ProjectLocationWorkloadIdentityPoolOperationGetCall<'a, C> {
3460        ProjectLocationWorkloadIdentityPoolOperationGetCall {
3461            hub: self.hub,
3462            _name: name.to_string(),
3463            _delegate: Default::default(),
3464            _additional_params: Default::default(),
3465            _scopes: Default::default(),
3466        }
3467    }
3468
3469    /// Create a builder to help you perform the following task:
3470    ///
3471    /// Gets the latest state of a long-running operation. Clients can use this method to poll the operation result at intervals as recommended by the API service.
3472    ///
3473    /// # Arguments
3474    ///
3475    /// * `name` - The name of the operation resource.
3476    pub fn locations_workload_identity_pools_providers_keys_operations_get(
3477        &self,
3478        name: &str,
3479    ) -> ProjectLocationWorkloadIdentityPoolProviderKeyOperationGetCall<'a, C> {
3480        ProjectLocationWorkloadIdentityPoolProviderKeyOperationGetCall {
3481            hub: self.hub,
3482            _name: name.to_string(),
3483            _delegate: Default::default(),
3484            _additional_params: Default::default(),
3485            _scopes: Default::default(),
3486        }
3487    }
3488
3489    /// Create a builder to help you perform the following task:
3490    ///
3491    /// Create a new WorkloadIdentityPoolProviderKey in a WorkloadIdentityPoolProvider.
3492    ///
3493    /// # Arguments
3494    ///
3495    /// * `request` - No description provided.
3496    /// * `parent` - Required. The parent provider resource to create the key in.
3497    pub fn locations_workload_identity_pools_providers_keys_create(
3498        &self,
3499        request: WorkloadIdentityPoolProviderKey,
3500        parent: &str,
3501    ) -> ProjectLocationWorkloadIdentityPoolProviderKeyCreateCall<'a, C> {
3502        ProjectLocationWorkloadIdentityPoolProviderKeyCreateCall {
3503            hub: self.hub,
3504            _request: request,
3505            _parent: parent.to_string(),
3506            _workload_identity_pool_provider_key_id: Default::default(),
3507            _delegate: Default::default(),
3508            _additional_params: Default::default(),
3509            _scopes: Default::default(),
3510        }
3511    }
3512
3513    /// Create a builder to help you perform the following task:
3514    ///
3515    /// Deletes an WorkloadIdentityPoolProviderKey. You can undelete a key for 30 days. After 30 days, deletion is permanent.
3516    ///
3517    /// # Arguments
3518    ///
3519    /// * `name` - Required. The name of the encryption key to delete.
3520    pub fn locations_workload_identity_pools_providers_keys_delete(
3521        &self,
3522        name: &str,
3523    ) -> ProjectLocationWorkloadIdentityPoolProviderKeyDeleteCall<'a, C> {
3524        ProjectLocationWorkloadIdentityPoolProviderKeyDeleteCall {
3525            hub: self.hub,
3526            _name: name.to_string(),
3527            _delegate: Default::default(),
3528            _additional_params: Default::default(),
3529            _scopes: Default::default(),
3530        }
3531    }
3532
3533    /// Create a builder to help you perform the following task:
3534    ///
3535    /// Gets an individual WorkloadIdentityPoolProviderKey.
3536    ///
3537    /// # Arguments
3538    ///
3539    /// * `name` - Required. The name of the key to retrieve.
3540    pub fn locations_workload_identity_pools_providers_keys_get(
3541        &self,
3542        name: &str,
3543    ) -> ProjectLocationWorkloadIdentityPoolProviderKeyGetCall<'a, C> {
3544        ProjectLocationWorkloadIdentityPoolProviderKeyGetCall {
3545            hub: self.hub,
3546            _name: name.to_string(),
3547            _delegate: Default::default(),
3548            _additional_params: Default::default(),
3549            _scopes: Default::default(),
3550        }
3551    }
3552
3553    /// Create a builder to help you perform the following task:
3554    ///
3555    /// Lists all non-deleted WorkloadIdentityPoolProviderKeys in a project. If show_deleted is set to `true`, then deleted pools are also listed.
3556    ///
3557    /// # Arguments
3558    ///
3559    /// * `parent` - Required. The parent provider resource to list encryption keys for.
3560    pub fn locations_workload_identity_pools_providers_keys_list(
3561        &self,
3562        parent: &str,
3563    ) -> ProjectLocationWorkloadIdentityPoolProviderKeyListCall<'a, C> {
3564        ProjectLocationWorkloadIdentityPoolProviderKeyListCall {
3565            hub: self.hub,
3566            _parent: parent.to_string(),
3567            _show_deleted: Default::default(),
3568            _page_token: Default::default(),
3569            _page_size: Default::default(),
3570            _delegate: Default::default(),
3571            _additional_params: Default::default(),
3572            _scopes: Default::default(),
3573        }
3574    }
3575
3576    /// Create a builder to help you perform the following task:
3577    ///
3578    /// Undeletes an WorkloadIdentityPoolProviderKey, as long as it was deleted fewer than 30 days ago.
3579    ///
3580    /// # Arguments
3581    ///
3582    /// * `request` - No description provided.
3583    /// * `name` - Required. The name of the encryption key to undelete.
3584    pub fn locations_workload_identity_pools_providers_keys_undelete(
3585        &self,
3586        request: UndeleteWorkloadIdentityPoolProviderKeyRequest,
3587        name: &str,
3588    ) -> ProjectLocationWorkloadIdentityPoolProviderKeyUndeleteCall<'a, C> {
3589        ProjectLocationWorkloadIdentityPoolProviderKeyUndeleteCall {
3590            hub: self.hub,
3591            _request: request,
3592            _name: name.to_string(),
3593            _delegate: Default::default(),
3594            _additional_params: Default::default(),
3595            _scopes: Default::default(),
3596        }
3597    }
3598
3599    /// Create a builder to help you perform the following task:
3600    ///
3601    /// Gets the latest state of a long-running operation. Clients can use this method to poll the operation result at intervals as recommended by the API service.
3602    ///
3603    /// # Arguments
3604    ///
3605    /// * `name` - The name of the operation resource.
3606    pub fn locations_workload_identity_pools_providers_operations_get(
3607        &self,
3608        name: &str,
3609    ) -> ProjectLocationWorkloadIdentityPoolProviderOperationGetCall<'a, C> {
3610        ProjectLocationWorkloadIdentityPoolProviderOperationGetCall {
3611            hub: self.hub,
3612            _name: name.to_string(),
3613            _delegate: Default::default(),
3614            _additional_params: Default::default(),
3615            _scopes: Default::default(),
3616        }
3617    }
3618
3619    /// Create a builder to help you perform the following task:
3620    ///
3621    /// Creates a new WorkloadIdentityPoolProvider in a WorkloadIdentityPool. You cannot reuse the name of a deleted provider until 30 days after deletion.
3622    ///
3623    /// # Arguments
3624    ///
3625    /// * `request` - No description provided.
3626    /// * `parent` - Required. The pool to create this provider in.
3627    pub fn locations_workload_identity_pools_providers_create(
3628        &self,
3629        request: WorkloadIdentityPoolProvider,
3630        parent: &str,
3631    ) -> ProjectLocationWorkloadIdentityPoolProviderCreateCall<'a, C> {
3632        ProjectLocationWorkloadIdentityPoolProviderCreateCall {
3633            hub: self.hub,
3634            _request: request,
3635            _parent: parent.to_string(),
3636            _workload_identity_pool_provider_id: Default::default(),
3637            _delegate: Default::default(),
3638            _additional_params: Default::default(),
3639            _scopes: Default::default(),
3640        }
3641    }
3642
3643    /// Create a builder to help you perform the following task:
3644    ///
3645    /// Deletes a WorkloadIdentityPoolProvider. Deleting a provider does not revoke credentials that have already been issued; they continue to grant access. You can undelete a provider for 30 days. After 30 days, deletion is permanent. You cannot update deleted providers. However, you can view and list them.
3646    ///
3647    /// # Arguments
3648    ///
3649    /// * `name` - Required. The name of the provider to delete.
3650    pub fn locations_workload_identity_pools_providers_delete(
3651        &self,
3652        name: &str,
3653    ) -> ProjectLocationWorkloadIdentityPoolProviderDeleteCall<'a, C> {
3654        ProjectLocationWorkloadIdentityPoolProviderDeleteCall {
3655            hub: self.hub,
3656            _name: name.to_string(),
3657            _delegate: Default::default(),
3658            _additional_params: Default::default(),
3659            _scopes: Default::default(),
3660        }
3661    }
3662
3663    /// Create a builder to help you perform the following task:
3664    ///
3665    /// Gets an individual WorkloadIdentityPoolProvider.
3666    ///
3667    /// # Arguments
3668    ///
3669    /// * `name` - Required. The name of the provider to retrieve.
3670    pub fn locations_workload_identity_pools_providers_get(
3671        &self,
3672        name: &str,
3673    ) -> ProjectLocationWorkloadIdentityPoolProviderGetCall<'a, C> {
3674        ProjectLocationWorkloadIdentityPoolProviderGetCall {
3675            hub: self.hub,
3676            _name: name.to_string(),
3677            _delegate: Default::default(),
3678            _additional_params: Default::default(),
3679            _scopes: Default::default(),
3680        }
3681    }
3682
3683    /// Create a builder to help you perform the following task:
3684    ///
3685    /// Lists all non-deleted WorkloadIdentityPoolProviders in a WorkloadIdentityPool. If `show_deleted` is set to `true`, then deleted providers are also listed.
3686    ///
3687    /// # Arguments
3688    ///
3689    /// * `parent` - Required. The pool to list providers for.
3690    pub fn locations_workload_identity_pools_providers_list(
3691        &self,
3692        parent: &str,
3693    ) -> ProjectLocationWorkloadIdentityPoolProviderListCall<'a, C> {
3694        ProjectLocationWorkloadIdentityPoolProviderListCall {
3695            hub: self.hub,
3696            _parent: parent.to_string(),
3697            _show_deleted: Default::default(),
3698            _page_token: Default::default(),
3699            _page_size: Default::default(),
3700            _delegate: Default::default(),
3701            _additional_params: Default::default(),
3702            _scopes: Default::default(),
3703        }
3704    }
3705
3706    /// Create a builder to help you perform the following task:
3707    ///
3708    /// Updates an existing WorkloadIdentityPoolProvider.
3709    ///
3710    /// # Arguments
3711    ///
3712    /// * `request` - No description provided.
3713    /// * `name` - Output only. The resource name of the provider.
3714    pub fn locations_workload_identity_pools_providers_patch(
3715        &self,
3716        request: WorkloadIdentityPoolProvider,
3717        name: &str,
3718    ) -> ProjectLocationWorkloadIdentityPoolProviderPatchCall<'a, C> {
3719        ProjectLocationWorkloadIdentityPoolProviderPatchCall {
3720            hub: self.hub,
3721            _request: request,
3722            _name: name.to_string(),
3723            _update_mask: Default::default(),
3724            _delegate: Default::default(),
3725            _additional_params: Default::default(),
3726            _scopes: Default::default(),
3727        }
3728    }
3729
3730    /// Create a builder to help you perform the following task:
3731    ///
3732    /// Undeletes a WorkloadIdentityPoolProvider, as long as it was deleted fewer than 30 days ago.
3733    ///
3734    /// # Arguments
3735    ///
3736    /// * `request` - No description provided.
3737    /// * `name` - Required. The name of the provider to undelete.
3738    pub fn locations_workload_identity_pools_providers_undelete(
3739        &self,
3740        request: UndeleteWorkloadIdentityPoolProviderRequest,
3741        name: &str,
3742    ) -> ProjectLocationWorkloadIdentityPoolProviderUndeleteCall<'a, C> {
3743        ProjectLocationWorkloadIdentityPoolProviderUndeleteCall {
3744            hub: self.hub,
3745            _request: request,
3746            _name: name.to_string(),
3747            _delegate: Default::default(),
3748            _additional_params: Default::default(),
3749            _scopes: Default::default(),
3750        }
3751    }
3752
3753    /// Create a builder to help you perform the following task:
3754    ///
3755    /// Creates a new WorkloadIdentityPool. You cannot reuse the name of a deleted pool until 30 days after deletion.
3756    ///
3757    /// # Arguments
3758    ///
3759    /// * `request` - No description provided.
3760    /// * `parent` - Required. The parent resource to create the pool in. The only supported location is `global`.
3761    pub fn locations_workload_identity_pools_create(
3762        &self,
3763        request: WorkloadIdentityPool,
3764        parent: &str,
3765    ) -> ProjectLocationWorkloadIdentityPoolCreateCall<'a, C> {
3766        ProjectLocationWorkloadIdentityPoolCreateCall {
3767            hub: self.hub,
3768            _request: request,
3769            _parent: parent.to_string(),
3770            _workload_identity_pool_id: Default::default(),
3771            _delegate: Default::default(),
3772            _additional_params: Default::default(),
3773            _scopes: Default::default(),
3774        }
3775    }
3776
3777    /// Create a builder to help you perform the following task:
3778    ///
3779    /// Deletes a WorkloadIdentityPool. You cannot use a deleted pool to exchange external credentials for Google Cloud credentials. However, deletion does not revoke credentials that have already been issued. Credentials issued for a deleted pool do not grant access to resources. If the pool is undeleted, and the credentials are not expired, they grant access again. You can undelete a pool for 30 days. After 30 days, deletion is permanent. You cannot update deleted pools. However, you can view and list them.
3780    ///
3781    /// # Arguments
3782    ///
3783    /// * `name` - Required. The name of the pool to delete.
3784    pub fn locations_workload_identity_pools_delete(
3785        &self,
3786        name: &str,
3787    ) -> ProjectLocationWorkloadIdentityPoolDeleteCall<'a, C> {
3788        ProjectLocationWorkloadIdentityPoolDeleteCall {
3789            hub: self.hub,
3790            _name: name.to_string(),
3791            _delegate: Default::default(),
3792            _additional_params: Default::default(),
3793            _scopes: Default::default(),
3794        }
3795    }
3796
3797    /// Create a builder to help you perform the following task:
3798    ///
3799    /// Gets an individual WorkloadIdentityPool.
3800    ///
3801    /// # Arguments
3802    ///
3803    /// * `name` - Required. The name of the pool to retrieve.
3804    pub fn locations_workload_identity_pools_get(
3805        &self,
3806        name: &str,
3807    ) -> ProjectLocationWorkloadIdentityPoolGetCall<'a, C> {
3808        ProjectLocationWorkloadIdentityPoolGetCall {
3809            hub: self.hub,
3810            _name: name.to_string(),
3811            _delegate: Default::default(),
3812            _additional_params: Default::default(),
3813            _scopes: Default::default(),
3814        }
3815    }
3816
3817    /// Create a builder to help you perform the following task:
3818    ///
3819    /// Lists all non-deleted WorkloadIdentityPools in a project. If `show_deleted` is set to `true`, then deleted pools are also listed.
3820    ///
3821    /// # Arguments
3822    ///
3823    /// * `parent` - Required. The parent resource to list pools for.
3824    pub fn locations_workload_identity_pools_list(
3825        &self,
3826        parent: &str,
3827    ) -> ProjectLocationWorkloadIdentityPoolListCall<'a, C> {
3828        ProjectLocationWorkloadIdentityPoolListCall {
3829            hub: self.hub,
3830            _parent: parent.to_string(),
3831            _show_deleted: Default::default(),
3832            _page_token: Default::default(),
3833            _page_size: Default::default(),
3834            _delegate: Default::default(),
3835            _additional_params: Default::default(),
3836            _scopes: Default::default(),
3837        }
3838    }
3839
3840    /// Create a builder to help you perform the following task:
3841    ///
3842    /// Updates an existing WorkloadIdentityPool.
3843    ///
3844    /// # Arguments
3845    ///
3846    /// * `request` - No description provided.
3847    /// * `name` - Output only. The resource name of the pool.
3848    pub fn locations_workload_identity_pools_patch(
3849        &self,
3850        request: WorkloadIdentityPool,
3851        name: &str,
3852    ) -> ProjectLocationWorkloadIdentityPoolPatchCall<'a, C> {
3853        ProjectLocationWorkloadIdentityPoolPatchCall {
3854            hub: self.hub,
3855            _request: request,
3856            _name: name.to_string(),
3857            _update_mask: Default::default(),
3858            _delegate: Default::default(),
3859            _additional_params: Default::default(),
3860            _scopes: Default::default(),
3861        }
3862    }
3863
3864    /// Create a builder to help you perform the following task:
3865    ///
3866    /// Undeletes a WorkloadIdentityPool, as long as it was deleted fewer than 30 days ago.
3867    ///
3868    /// # Arguments
3869    ///
3870    /// * `request` - No description provided.
3871    /// * `name` - Required. The name of the pool to undelete.
3872    pub fn locations_workload_identity_pools_undelete(
3873        &self,
3874        request: UndeleteWorkloadIdentityPoolRequest,
3875        name: &str,
3876    ) -> ProjectLocationWorkloadIdentityPoolUndeleteCall<'a, C> {
3877        ProjectLocationWorkloadIdentityPoolUndeleteCall {
3878            hub: self.hub,
3879            _request: request,
3880            _name: name.to_string(),
3881            _delegate: Default::default(),
3882            _additional_params: Default::default(),
3883            _scopes: Default::default(),
3884        }
3885    }
3886
3887    /// Create a builder to help you perform the following task:
3888    ///
3889    /// Creates a new custom Role.
3890    ///
3891    /// # Arguments
3892    ///
3893    /// * `request` - No description provided.
3894    /// * `parent` - The `parent` parameter's value depends on the target resource for the request, namely [projects](https://cloud.google.com/iam/docs/reference/rest/v1/projects.roles) or [organizations](https://cloud.google.com/iam/docs/reference/rest/v1/organizations.roles). Each resource type's `parent` value format is described below: * [projects.roles.create](https://cloud.google.com/iam/docs/reference/rest/v1/projects.roles/create): `projects/{PROJECT_ID}`. This method creates project-level [custom roles](https://cloud.google.com/iam/docs/understanding-custom-roles). Example request URL: `https://iam.googleapis.com/v1/projects/{PROJECT_ID}/roles` * [organizations.roles.create](https://cloud.google.com/iam/docs/reference/rest/v1/organizations.roles/create): `organizations/{ORGANIZATION_ID}`. This method creates organization-level [custom roles](https://cloud.google.com/iam/docs/understanding-custom-roles). Example request URL: `https://iam.googleapis.com/v1/organizations/{ORGANIZATION_ID}/roles` Note: Wildcard (*) values are invalid; you must specify a complete project ID or organization ID.
3895    pub fn roles_create(
3896        &self,
3897        request: CreateRoleRequest,
3898        parent: &str,
3899    ) -> ProjectRoleCreateCall<'a, C> {
3900        ProjectRoleCreateCall {
3901            hub: self.hub,
3902            _request: request,
3903            _parent: parent.to_string(),
3904            _delegate: Default::default(),
3905            _additional_params: Default::default(),
3906            _scopes: Default::default(),
3907        }
3908    }
3909
3910    /// Create a builder to help you perform the following task:
3911    ///
3912    /// Deletes a custom Role. When you delete a custom role, the following changes occur immediately: * You cannot bind a principal to the custom role in an IAM Policy. * Existing bindings to the custom role are not changed, but they have no effect. * By default, the response from ListRoles does not include the custom role. You have 7 days to undelete the custom role. After 7 days, the following changes occur: * The custom role is permanently deleted and cannot be recovered. * If an IAM policy contains a binding to the custom role, the binding is permanently removed.
3913    ///
3914    /// # Arguments
3915    ///
3916    /// * `name` - The `name` parameter's value depends on the target resource for the request, namely [projects](https://cloud.google.com/iam/docs/reference/rest/v1/projects.roles) or [organizations](https://cloud.google.com/iam/docs/reference/rest/v1/organizations.roles). Each resource type's `name` value format is described below: * [projects.roles.delete](https://cloud.google.com/iam/docs/reference/rest/v1/projects.roles/delete): `projects/{PROJECT_ID}/roles/{CUSTOM_ROLE_ID}`. This method deletes only [custom roles](https://cloud.google.com/iam/docs/understanding-custom-roles) that have been created at the project level. Example request URL: `https://iam.googleapis.com/v1/projects/{PROJECT_ID}/roles/{CUSTOM_ROLE_ID}` * [organizations.roles.delete](https://cloud.google.com/iam/docs/reference/rest/v1/organizations.roles/delete): `organizations/{ORGANIZATION_ID}/roles/{CUSTOM_ROLE_ID}`. This method deletes only [custom roles](https://cloud.google.com/iam/docs/understanding-custom-roles) that have been created at the organization level. Example request URL: `https://iam.googleapis.com/v1/organizations/{ORGANIZATION_ID}/roles/{CUSTOM_ROLE_ID}` Note: Wildcard (*) values are invalid; you must specify a complete project ID or organization ID.
3917    pub fn roles_delete(&self, name: &str) -> ProjectRoleDeleteCall<'a, C> {
3918        ProjectRoleDeleteCall {
3919            hub: self.hub,
3920            _name: name.to_string(),
3921            _etag: Default::default(),
3922            _delegate: Default::default(),
3923            _additional_params: Default::default(),
3924            _scopes: Default::default(),
3925        }
3926    }
3927
3928    /// Create a builder to help you perform the following task:
3929    ///
3930    /// Gets the definition of a Role.
3931    ///
3932    /// # Arguments
3933    ///
3934    /// * `name` - The `name` parameter's value depends on the target resource for the request, namely [roles](https://cloud.google.com/iam/docs/reference/rest/v1/roles), [projects](https://cloud.google.com/iam/docs/reference/rest/v1/projects.roles), or [organizations](https://cloud.google.com/iam/docs/reference/rest/v1/organizations.roles). Each resource type's `name` value format is described below: * [roles.get](https://cloud.google.com/iam/docs/reference/rest/v1/roles/get): `roles/{ROLE_NAME}`. This method returns results from all [predefined roles](https://cloud.google.com/iam/docs/understanding-roles#predefined_roles) in IAM. Example request URL: `https://iam.googleapis.com/v1/roles/{ROLE_NAME}` * [projects.roles.get](https://cloud.google.com/iam/docs/reference/rest/v1/projects.roles/get): `projects/{PROJECT_ID}/roles/{CUSTOM_ROLE_ID}`. This method returns only [custom roles](https://cloud.google.com/iam/docs/understanding-custom-roles) that have been created at the project level. Example request URL: `https://iam.googleapis.com/v1/projects/{PROJECT_ID}/roles/{CUSTOM_ROLE_ID}` * [organizations.roles.get](https://cloud.google.com/iam/docs/reference/rest/v1/organizations.roles/get): `organizations/{ORGANIZATION_ID}/roles/{CUSTOM_ROLE_ID}`. This method returns only [custom roles](https://cloud.google.com/iam/docs/understanding-custom-roles) that have been created at the organization level. Example request URL: `https://iam.googleapis.com/v1/organizations/{ORGANIZATION_ID}/roles/{CUSTOM_ROLE_ID}` Note: Wildcard (*) values are invalid; you must specify a complete project ID or organization ID.
3935    pub fn roles_get(&self, name: &str) -> ProjectRoleGetCall<'a, C> {
3936        ProjectRoleGetCall {
3937            hub: self.hub,
3938            _name: name.to_string(),
3939            _delegate: Default::default(),
3940            _additional_params: Default::default(),
3941            _scopes: Default::default(),
3942        }
3943    }
3944
3945    /// Create a builder to help you perform the following task:
3946    ///
3947    /// Lists every predefined Role that IAM supports, or every custom role that is defined for an organization or project.
3948    ///
3949    /// # Arguments
3950    ///
3951    /// * `parent` - The `parent` parameter's value depends on the target resource for the request, namely [roles](https://cloud.google.com/iam/docs/reference/rest/v1/roles), [projects](https://cloud.google.com/iam/docs/reference/rest/v1/projects.roles), or [organizations](https://cloud.google.com/iam/docs/reference/rest/v1/organizations.roles). Each resource type's `parent` value format is described below: * [roles.list](https://cloud.google.com/iam/docs/reference/rest/v1/roles/list): An empty string. This method doesn't require a resource; it simply returns all [predefined roles](https://cloud.google.com/iam/docs/understanding-roles#predefined_roles) in IAM. Example request URL: `https://iam.googleapis.com/v1/roles` * [projects.roles.list](https://cloud.google.com/iam/docs/reference/rest/v1/projects.roles/list): `projects/{PROJECT_ID}`. This method lists all project-level [custom roles](https://cloud.google.com/iam/docs/understanding-custom-roles). Example request URL: `https://iam.googleapis.com/v1/projects/{PROJECT_ID}/roles` * [organizations.roles.list](https://cloud.google.com/iam/docs/reference/rest/v1/organizations.roles/list): `organizations/{ORGANIZATION_ID}`. This method lists all organization-level [custom roles](https://cloud.google.com/iam/docs/understanding-custom-roles). Example request URL: `https://iam.googleapis.com/v1/organizations/{ORGANIZATION_ID}/roles` Note: Wildcard (*) values are invalid; you must specify a complete project ID or organization ID.
3952    pub fn roles_list(&self, parent: &str) -> ProjectRoleListCall<'a, C> {
3953        ProjectRoleListCall {
3954            hub: self.hub,
3955            _parent: parent.to_string(),
3956            _view: Default::default(),
3957            _show_deleted: Default::default(),
3958            _page_token: Default::default(),
3959            _page_size: Default::default(),
3960            _delegate: Default::default(),
3961            _additional_params: Default::default(),
3962            _scopes: Default::default(),
3963        }
3964    }
3965
3966    /// Create a builder to help you perform the following task:
3967    ///
3968    /// Updates the definition of a custom Role.
3969    ///
3970    /// # Arguments
3971    ///
3972    /// * `request` - No description provided.
3973    /// * `name` - The `name` parameter's value depends on the target resource for the request, namely [projects](https://cloud.google.com/iam/docs/reference/rest/v1/projects.roles) or [organizations](https://cloud.google.com/iam/docs/reference/rest/v1/organizations.roles). Each resource type's `name` value format is described below: * [projects.roles.patch](https://cloud.google.com/iam/docs/reference/rest/v1/projects.roles/patch): `projects/{PROJECT_ID}/roles/{CUSTOM_ROLE_ID}`. This method updates only [custom roles](https://cloud.google.com/iam/docs/understanding-custom-roles) that have been created at the project level. Example request URL: `https://iam.googleapis.com/v1/projects/{PROJECT_ID}/roles/{CUSTOM_ROLE_ID}` * [organizations.roles.patch](https://cloud.google.com/iam/docs/reference/rest/v1/organizations.roles/patch): `organizations/{ORGANIZATION_ID}/roles/{CUSTOM_ROLE_ID}`. This method updates only [custom roles](https://cloud.google.com/iam/docs/understanding-custom-roles) that have been created at the organization level. Example request URL: `https://iam.googleapis.com/v1/organizations/{ORGANIZATION_ID}/roles/{CUSTOM_ROLE_ID}` Note: Wildcard (*) values are invalid; you must specify a complete project ID or organization ID.
3974    pub fn roles_patch(&self, request: Role, name: &str) -> ProjectRolePatchCall<'a, C> {
3975        ProjectRolePatchCall {
3976            hub: self.hub,
3977            _request: request,
3978            _name: name.to_string(),
3979            _update_mask: Default::default(),
3980            _delegate: Default::default(),
3981            _additional_params: Default::default(),
3982            _scopes: Default::default(),
3983        }
3984    }
3985
3986    /// Create a builder to help you perform the following task:
3987    ///
3988    /// Undeletes a custom Role.
3989    ///
3990    /// # Arguments
3991    ///
3992    /// * `request` - No description provided.
3993    /// * `name` - The `name` parameter's value depends on the target resource for the request, namely [projects](https://cloud.google.com/iam/docs/reference/rest/v1/projects.roles) or [organizations](https://cloud.google.com/iam/docs/reference/rest/v1/organizations.roles). Each resource type's `name` value format is described below: * [projects.roles.undelete](https://cloud.google.com/iam/docs/reference/rest/v1/projects.roles/undelete): `projects/{PROJECT_ID}/roles/{CUSTOM_ROLE_ID}`. This method undeletes only [custom roles](https://cloud.google.com/iam/docs/understanding-custom-roles) that have been created at the project level. Example request URL: `https://iam.googleapis.com/v1/projects/{PROJECT_ID}/roles/{CUSTOM_ROLE_ID}` * [organizations.roles.undelete](https://cloud.google.com/iam/docs/reference/rest/v1/organizations.roles/undelete): `organizations/{ORGANIZATION_ID}/roles/{CUSTOM_ROLE_ID}`. This method undeletes only [custom roles](https://cloud.google.com/iam/docs/understanding-custom-roles) that have been created at the organization level. Example request URL: `https://iam.googleapis.com/v1/organizations/{ORGANIZATION_ID}/roles/{CUSTOM_ROLE_ID}` Note: Wildcard (*) values are invalid; you must specify a complete project ID or organization ID.
3994    pub fn roles_undelete(
3995        &self,
3996        request: UndeleteRoleRequest,
3997        name: &str,
3998    ) -> ProjectRoleUndeleteCall<'a, C> {
3999        ProjectRoleUndeleteCall {
4000            hub: self.hub,
4001            _request: request,
4002            _name: name.to_string(),
4003            _delegate: Default::default(),
4004            _additional_params: Default::default(),
4005            _scopes: Default::default(),
4006        }
4007    }
4008
4009    /// Create a builder to help you perform the following task:
4010    ///
4011    /// Creates a ServiceAccountKey.
4012    ///
4013    /// # Arguments
4014    ///
4015    /// * `request` - No description provided.
4016    /// * `name` - Required. The resource name of the service account. Use one of the following formats: * `projects/{PROJECT_ID}/serviceAccounts/{EMAIL_ADDRESS}` * `projects/{PROJECT_ID}/serviceAccounts/{UNIQUE_ID}` As an alternative, you can use the `-` wildcard character instead of the project ID: * `projects/-/serviceAccounts/{EMAIL_ADDRESS}` * `projects/-/serviceAccounts/{UNIQUE_ID}` When possible, avoid using the `-` wildcard character, because it can cause response messages to contain misleading error codes. For example, if you try to access the service account `projects/-/serviceAccounts/fake@example.com`, which does not exist, the response contains an HTTP `403 Forbidden` error instead of a `404 Not Found` error.
4017    pub fn service_accounts_keys_create(
4018        &self,
4019        request: CreateServiceAccountKeyRequest,
4020        name: &str,
4021    ) -> ProjectServiceAccountKeyCreateCall<'a, C> {
4022        ProjectServiceAccountKeyCreateCall {
4023            hub: self.hub,
4024            _request: request,
4025            _name: name.to_string(),
4026            _delegate: Default::default(),
4027            _additional_params: Default::default(),
4028            _scopes: Default::default(),
4029        }
4030    }
4031
4032    /// Create a builder to help you perform the following task:
4033    ///
4034    /// Deletes a ServiceAccountKey. Deleting a service account key does not revoke short-lived credentials that have been issued based on the service account key.
4035    ///
4036    /// # Arguments
4037    ///
4038    /// * `name` - Required. The resource name of the service account key. Use one of the following formats: * `projects/{PROJECT_ID}/serviceAccounts/{EMAIL_ADDRESS}/keys/{KEY_ID}` * `projects/{PROJECT_ID}/serviceAccounts/{UNIQUE_ID}/keys/{KEY_ID}` As an alternative, you can use the `-` wildcard character instead of the project ID: * `projects/-/serviceAccounts/{EMAIL_ADDRESS}/keys/{KEY_ID}` * `projects/-/serviceAccounts/{UNIQUE_ID}/keys/{KEY_ID}` When possible, avoid using the `-` wildcard character, because it can cause response messages to contain misleading error codes. For example, if you try to access the service account key `projects/-/serviceAccounts/fake@example.com/keys/fake-key`, which does not exist, the response contains an HTTP `403 Forbidden` error instead of a `404 Not Found` error.
4039    pub fn service_accounts_keys_delete(
4040        &self,
4041        name: &str,
4042    ) -> ProjectServiceAccountKeyDeleteCall<'a, C> {
4043        ProjectServiceAccountKeyDeleteCall {
4044            hub: self.hub,
4045            _name: name.to_string(),
4046            _delegate: Default::default(),
4047            _additional_params: Default::default(),
4048            _scopes: Default::default(),
4049        }
4050    }
4051
4052    /// Create a builder to help you perform the following task:
4053    ///
4054    /// Disable a ServiceAccountKey. A disabled service account key can be re-enabled with EnableServiceAccountKey.
4055    ///
4056    /// # Arguments
4057    ///
4058    /// * `request` - No description provided.
4059    /// * `name` - Required. The resource name of the service account key. Use one of the following formats: * `projects/{PROJECT_ID}/serviceAccounts/{EMAIL_ADDRESS}/keys/{KEY_ID}` * `projects/{PROJECT_ID}/serviceAccounts/{UNIQUE_ID}/keys/{KEY_ID}` As an alternative, you can use the `-` wildcard character instead of the project ID: * `projects/-/serviceAccounts/{EMAIL_ADDRESS}/keys/{KEY_ID}` * `projects/-/serviceAccounts/{UNIQUE_ID}/keys/{KEY_ID}` When possible, avoid using the `-` wildcard character, because it can cause response messages to contain misleading error codes. For example, if you try to access the service account key `projects/-/serviceAccounts/fake@example.com/keys/fake-key`, which does not exist, the response contains an HTTP `403 Forbidden` error instead of a `404 Not Found` error.
4060    pub fn service_accounts_keys_disable(
4061        &self,
4062        request: DisableServiceAccountKeyRequest,
4063        name: &str,
4064    ) -> ProjectServiceAccountKeyDisableCall<'a, C> {
4065        ProjectServiceAccountKeyDisableCall {
4066            hub: self.hub,
4067            _request: request,
4068            _name: name.to_string(),
4069            _delegate: Default::default(),
4070            _additional_params: Default::default(),
4071            _scopes: Default::default(),
4072        }
4073    }
4074
4075    /// Create a builder to help you perform the following task:
4076    ///
4077    /// Enable a ServiceAccountKey.
4078    ///
4079    /// # Arguments
4080    ///
4081    /// * `request` - No description provided.
4082    /// * `name` - Required. The resource name of the service account key. Use one of the following formats: * `projects/{PROJECT_ID}/serviceAccounts/{EMAIL_ADDRESS}/keys/{KEY_ID}` * `projects/{PROJECT_ID}/serviceAccounts/{UNIQUE_ID}/keys/{KEY_ID}` As an alternative, you can use the `-` wildcard character instead of the project ID: * `projects/-/serviceAccounts/{EMAIL_ADDRESS}/keys/{KEY_ID}` * `projects/-/serviceAccounts/{UNIQUE_ID}/keys/{KEY_ID}` When possible, avoid using the `-` wildcard character, because it can cause response messages to contain misleading error codes. For example, if you try to access the service account key `projects/-/serviceAccounts/fake@example.com/keys/fake-key`, which does not exist, the response contains an HTTP `403 Forbidden` error instead of a `404 Not Found` error.
4083    pub fn service_accounts_keys_enable(
4084        &self,
4085        request: EnableServiceAccountKeyRequest,
4086        name: &str,
4087    ) -> ProjectServiceAccountKeyEnableCall<'a, C> {
4088        ProjectServiceAccountKeyEnableCall {
4089            hub: self.hub,
4090            _request: request,
4091            _name: name.to_string(),
4092            _delegate: Default::default(),
4093            _additional_params: Default::default(),
4094            _scopes: Default::default(),
4095        }
4096    }
4097
4098    /// Create a builder to help you perform the following task:
4099    ///
4100    /// Gets a ServiceAccountKey.
4101    ///
4102    /// # Arguments
4103    ///
4104    /// * `name` - Required. The resource name of the service account key. Use one of the following formats: * `projects/{PROJECT_ID}/serviceAccounts/{EMAIL_ADDRESS}/keys/{KEY_ID}` * `projects/{PROJECT_ID}/serviceAccounts/{UNIQUE_ID}/keys/{KEY_ID}` As an alternative, you can use the `-` wildcard character instead of the project ID: * `projects/-/serviceAccounts/{EMAIL_ADDRESS}/keys/{KEY_ID}` * `projects/-/serviceAccounts/{UNIQUE_ID}/keys/{KEY_ID}` When possible, avoid using the `-` wildcard character, because it can cause response messages to contain misleading error codes. For example, if you try to access the service account key `projects/-/serviceAccounts/fake@example.com/keys/fake-key`, which does not exist, the response contains an HTTP `403 Forbidden` error instead of a `404 Not Found` error.
4105    pub fn service_accounts_keys_get(&self, name: &str) -> ProjectServiceAccountKeyGetCall<'a, C> {
4106        ProjectServiceAccountKeyGetCall {
4107            hub: self.hub,
4108            _name: name.to_string(),
4109            _public_key_type: Default::default(),
4110            _delegate: Default::default(),
4111            _additional_params: Default::default(),
4112            _scopes: Default::default(),
4113        }
4114    }
4115
4116    /// Create a builder to help you perform the following task:
4117    ///
4118    /// Lists every ServiceAccountKey for a service account.
4119    ///
4120    /// # Arguments
4121    ///
4122    /// * `name` - Required. The resource name of the service account. Use one of the following formats: * `projects/{PROJECT_ID}/serviceAccounts/{EMAIL_ADDRESS}` * `projects/{PROJECT_ID}/serviceAccounts/{UNIQUE_ID}` As an alternative, you can use the `-` wildcard character instead of the project ID: * `projects/-/serviceAccounts/{EMAIL_ADDRESS}` * `projects/-/serviceAccounts/{UNIQUE_ID}` When possible, avoid using the `-` wildcard character, because it can cause response messages to contain misleading error codes. For example, if you try to access the service account `projects/-/serviceAccounts/fake@example.com`, which does not exist, the response contains an HTTP `403 Forbidden` error instead of a `404 Not Found` error.
4123    pub fn service_accounts_keys_list(
4124        &self,
4125        name: &str,
4126    ) -> ProjectServiceAccountKeyListCall<'a, C> {
4127        ProjectServiceAccountKeyListCall {
4128            hub: self.hub,
4129            _name: name.to_string(),
4130            _key_types: Default::default(),
4131            _delegate: Default::default(),
4132            _additional_params: Default::default(),
4133            _scopes: Default::default(),
4134        }
4135    }
4136
4137    /// Create a builder to help you perform the following task:
4138    ///
4139    /// Patches a ServiceAccountKey.
4140    ///
4141    /// # Arguments
4142    ///
4143    /// * `request` - No description provided.
4144    /// * `name` - The resource name of the service account key in the following format `projects/{PROJECT_ID}/serviceAccounts/{ACCOUNT}/keys/{key}`.
4145    pub fn service_accounts_keys_patch(
4146        &self,
4147        request: PatchServiceAccountKeyRequest,
4148        name: &str,
4149    ) -> ProjectServiceAccountKeyPatchCall<'a, C> {
4150        ProjectServiceAccountKeyPatchCall {
4151            hub: self.hub,
4152            _request: request,
4153            _name: name.to_string(),
4154            _delegate: Default::default(),
4155            _additional_params: Default::default(),
4156            _scopes: Default::default(),
4157        }
4158    }
4159
4160    /// Create a builder to help you perform the following task:
4161    ///
4162    /// Uploads the public key portion of a key pair that you manage, and associates the public key with a ServiceAccount. After you upload the public key, you can use the private key from the key pair as a service account key.
4163    ///
4164    /// # Arguments
4165    ///
4166    /// * `request` - No description provided.
4167    /// * `name` - The resource name of the service account key. Use one of the following formats: * `projects/{PROJECT_ID}/serviceAccounts/{EMAIL_ADDRESS}` * `projects/{PROJECT_ID}/serviceAccounts/{UNIQUE_ID}` As an alternative, you can use the `-` wildcard character instead of the project ID: * `projects/-/serviceAccounts/{EMAIL_ADDRESS}` * `projects/-/serviceAccounts/{UNIQUE_ID}` When possible, avoid using the `-` wildcard character, because it can cause response messages to contain misleading error codes. For example, if you try to access the service account `projects/-/serviceAccounts/fake@example.com`, which does not exist, the response contains an HTTP `403 Forbidden` error instead of a `404 Not Found` error.
4168    pub fn service_accounts_keys_upload(
4169        &self,
4170        request: UploadServiceAccountKeyRequest,
4171        name: &str,
4172    ) -> ProjectServiceAccountKeyUploadCall<'a, C> {
4173        ProjectServiceAccountKeyUploadCall {
4174            hub: self.hub,
4175            _request: request,
4176            _name: name.to_string(),
4177            _delegate: Default::default(),
4178            _additional_params: Default::default(),
4179            _scopes: Default::default(),
4180        }
4181    }
4182
4183    /// Create a builder to help you perform the following task:
4184    ///
4185    /// Creates a ServiceAccount.
4186    ///
4187    /// # Arguments
4188    ///
4189    /// * `request` - No description provided.
4190    /// * `name` - Required. The resource name of the project associated with the service accounts, such as `projects/my-project-123`.
4191    pub fn service_accounts_create(
4192        &self,
4193        request: CreateServiceAccountRequest,
4194        name: &str,
4195    ) -> ProjectServiceAccountCreateCall<'a, C> {
4196        ProjectServiceAccountCreateCall {
4197            hub: self.hub,
4198            _request: request,
4199            _name: name.to_string(),
4200            _delegate: Default::default(),
4201            _additional_params: Default::default(),
4202            _scopes: Default::default(),
4203        }
4204    }
4205
4206    /// Create a builder to help you perform the following task:
4207    ///
4208    /// Deletes a ServiceAccount. **Warning:** After you delete a service account, you might not be able to undelete it. If you know that you need to re-enable the service account in the future, use DisableServiceAccount instead. If you delete a service account, IAM permanently removes the service account 30 days later. Google Cloud cannot recover the service account after it is permanently removed, even if you file a support request. To help avoid unplanned outages, we recommend that you disable the service account before you delete it. Use DisableServiceAccount to disable the service account, then wait at least 24 hours and watch for unintended consequences. If there are no unintended consequences, you can delete the service account.
4209    ///
4210    /// # Arguments
4211    ///
4212    /// * `name` - Required. The resource name of the service account. Use one of the following formats: * `projects/{PROJECT_ID}/serviceAccounts/{EMAIL_ADDRESS}` * `projects/{PROJECT_ID}/serviceAccounts/{UNIQUE_ID}` As an alternative, you can use the `-` wildcard character instead of the project ID: * `projects/-/serviceAccounts/{EMAIL_ADDRESS}` * `projects/-/serviceAccounts/{UNIQUE_ID}` When possible, avoid using the `-` wildcard character, because it can cause response messages to contain misleading error codes. For example, if you try to access the service account `projects/-/serviceAccounts/fake@example.com`, which does not exist, the response contains an HTTP `403 Forbidden` error instead of a `404 Not Found` error.
4213    pub fn service_accounts_delete(&self, name: &str) -> ProjectServiceAccountDeleteCall<'a, C> {
4214        ProjectServiceAccountDeleteCall {
4215            hub: self.hub,
4216            _name: name.to_string(),
4217            _delegate: Default::default(),
4218            _additional_params: Default::default(),
4219            _scopes: Default::default(),
4220        }
4221    }
4222
4223    /// Create a builder to help you perform the following task:
4224    ///
4225    /// Disables a ServiceAccount immediately. If an application uses the service account to authenticate, that application can no longer call Google APIs or access Google Cloud resources. Existing access tokens for the service account are rejected, and requests for new access tokens will fail. To re-enable the service account, use EnableServiceAccount. After you re-enable the service account, its existing access tokens will be accepted, and you can request new access tokens. To help avoid unplanned outages, we recommend that you disable the service account before you delete it. Use this method to disable the service account, then wait at least 24 hours and watch for unintended consequences. If there are no unintended consequences, you can delete the service account with DeleteServiceAccount.
4226    ///
4227    /// # Arguments
4228    ///
4229    /// * `request` - No description provided.
4230    /// * `name` - The resource name of the service account. Use one of the following formats: * `projects/{PROJECT_ID}/serviceAccounts/{EMAIL_ADDRESS}` * `projects/{PROJECT_ID}/serviceAccounts/{UNIQUE_ID}` As an alternative, you can use the `-` wildcard character instead of the project ID: * `projects/-/serviceAccounts/{EMAIL_ADDRESS}` * `projects/-/serviceAccounts/{UNIQUE_ID}` When possible, avoid using the `-` wildcard character, because it can cause response messages to contain misleading error codes. For example, if you try to access the service account `projects/-/serviceAccounts/fake@example.com`, which does not exist, the response contains an HTTP `403 Forbidden` error instead of a `404 Not Found` error.
4231    pub fn service_accounts_disable(
4232        &self,
4233        request: DisableServiceAccountRequest,
4234        name: &str,
4235    ) -> ProjectServiceAccountDisableCall<'a, C> {
4236        ProjectServiceAccountDisableCall {
4237            hub: self.hub,
4238            _request: request,
4239            _name: name.to_string(),
4240            _delegate: Default::default(),
4241            _additional_params: Default::default(),
4242            _scopes: Default::default(),
4243        }
4244    }
4245
4246    /// Create a builder to help you perform the following task:
4247    ///
4248    /// Enables a ServiceAccount that was disabled by DisableServiceAccount. If the service account is already enabled, then this method has no effect. If the service account was disabled by other means—for example, if Google disabled the service account because it was compromised—you cannot use this method to enable the service account.
4249    ///
4250    /// # Arguments
4251    ///
4252    /// * `request` - No description provided.
4253    /// * `name` - The resource name of the service account. Use one of the following formats: * `projects/{PROJECT_ID}/serviceAccounts/{EMAIL_ADDRESS}` * `projects/{PROJECT_ID}/serviceAccounts/{UNIQUE_ID}` As an alternative, you can use the `-` wildcard character instead of the project ID: * `projects/-/serviceAccounts/{EMAIL_ADDRESS}` * `projects/-/serviceAccounts/{UNIQUE_ID}` When possible, avoid using the `-` wildcard character, because it can cause response messages to contain misleading error codes. For example, if you try to access the service account `projects/-/serviceAccounts/fake@example.com`, which does not exist, the response contains an HTTP `403 Forbidden` error instead of a `404 Not Found` error.
4254    pub fn service_accounts_enable(
4255        &self,
4256        request: EnableServiceAccountRequest,
4257        name: &str,
4258    ) -> ProjectServiceAccountEnableCall<'a, C> {
4259        ProjectServiceAccountEnableCall {
4260            hub: self.hub,
4261            _request: request,
4262            _name: name.to_string(),
4263            _delegate: Default::default(),
4264            _additional_params: Default::default(),
4265            _scopes: Default::default(),
4266        }
4267    }
4268
4269    /// Create a builder to help you perform the following task:
4270    ///
4271    /// Gets a ServiceAccount.
4272    ///
4273    /// # Arguments
4274    ///
4275    /// * `name` - Required. The resource name of the service account. Use one of the following formats: * `projects/{PROJECT_ID}/serviceAccounts/{EMAIL_ADDRESS}` * `projects/{PROJECT_ID}/serviceAccounts/{UNIQUE_ID}` As an alternative, you can use the `-` wildcard character instead of the project ID: * `projects/-/serviceAccounts/{EMAIL_ADDRESS}` * `projects/-/serviceAccounts/{UNIQUE_ID}` When possible, avoid using the `-` wildcard character, because it can cause response messages to contain misleading error codes. For example, if you try to access the service account `projects/-/serviceAccounts/fake@example.com`, which does not exist, the response contains an HTTP `403 Forbidden` error instead of a `404 Not Found` error.
4276    pub fn service_accounts_get(&self, name: &str) -> ProjectServiceAccountGetCall<'a, C> {
4277        ProjectServiceAccountGetCall {
4278            hub: self.hub,
4279            _name: name.to_string(),
4280            _delegate: Default::default(),
4281            _additional_params: Default::default(),
4282            _scopes: Default::default(),
4283        }
4284    }
4285
4286    /// Create a builder to help you perform the following task:
4287    ///
4288    /// Gets the IAM policy that is attached to a ServiceAccount. This IAM policy specifies which principals have access to the service account. This method does not tell you whether the service account has been granted any roles on other resources. To check whether a service account has role grants on a resource, use the `getIamPolicy` method for that resource. For example, to view the role grants for a project, call the Resource Manager API's [projects.getIamPolicy](https://cloud.google.com/resource-manager/reference/rest/v1/projects/getIamPolicy) method.
4289    ///
4290    /// # Arguments
4291    ///
4292    /// * `resource` - REQUIRED: The resource for which the policy is being requested. See [Resource names](https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
4293    pub fn service_accounts_get_iam_policy(
4294        &self,
4295        resource: &str,
4296    ) -> ProjectServiceAccountGetIamPolicyCall<'a, C> {
4297        ProjectServiceAccountGetIamPolicyCall {
4298            hub: self.hub,
4299            _resource: resource.to_string(),
4300            _options_requested_policy_version: Default::default(),
4301            _delegate: Default::default(),
4302            _additional_params: Default::default(),
4303            _scopes: Default::default(),
4304        }
4305    }
4306
4307    /// Create a builder to help you perform the following task:
4308    ///
4309    /// Lists every ServiceAccount that belongs to a specific project.
4310    ///
4311    /// # Arguments
4312    ///
4313    /// * `name` - Required. The resource name of the project associated with the service accounts, such as `projects/my-project-123`.
4314    pub fn service_accounts_list(&self, name: &str) -> ProjectServiceAccountListCall<'a, C> {
4315        ProjectServiceAccountListCall {
4316            hub: self.hub,
4317            _name: name.to_string(),
4318            _page_token: Default::default(),
4319            _page_size: Default::default(),
4320            _delegate: Default::default(),
4321            _additional_params: Default::default(),
4322            _scopes: Default::default(),
4323        }
4324    }
4325
4326    /// Create a builder to help you perform the following task:
4327    ///
4328    /// Patches a ServiceAccount.
4329    ///
4330    /// # Arguments
4331    ///
4332    /// * `request` - No description provided.
4333    /// * `name` - The resource name of the service account. Use one of the following formats: * `projects/{PROJECT_ID}/serviceAccounts/{EMAIL_ADDRESS}` * `projects/{PROJECT_ID}/serviceAccounts/{UNIQUE_ID}` As an alternative, you can use the `-` wildcard character instead of the project ID: * `projects/-/serviceAccounts/{EMAIL_ADDRESS}` * `projects/-/serviceAccounts/{UNIQUE_ID}` When possible, avoid using the `-` wildcard character, because it can cause response messages to contain misleading error codes. For example, if you try to access the service account `projects/-/serviceAccounts/fake@example.com`, which does not exist, the response contains an HTTP `403 Forbidden` error instead of a `404 Not Found` error.
4334    pub fn service_accounts_patch(
4335        &self,
4336        request: PatchServiceAccountRequest,
4337        name: &str,
4338    ) -> ProjectServiceAccountPatchCall<'a, C> {
4339        ProjectServiceAccountPatchCall {
4340            hub: self.hub,
4341            _request: request,
4342            _name: name.to_string(),
4343            _delegate: Default::default(),
4344            _additional_params: Default::default(),
4345            _scopes: Default::default(),
4346        }
4347    }
4348
4349    /// Create a builder to help you perform the following task:
4350    ///
4351    /// Sets the IAM policy that is attached to a ServiceAccount. Use this method to grant or revoke access to the service account. For example, you could grant a principal the ability to impersonate the service account. This method does not enable the service account to access other resources. To grant roles to a service account on a resource, follow these steps: 1. Call the resource's `getIamPolicy` method to get its current IAM policy. 2. Edit the policy so that it binds the service account to an IAM role for the resource. 3. Call the resource's `setIamPolicy` method to update its IAM policy. For detailed instructions, see [Manage access to project, folders, and organizations](https://cloud.google.com/iam/help/service-accounts/granting-access-to-service-accounts) or [Manage access to other resources](https://cloud.google.com/iam/help/access/manage-other-resources).
4352    ///
4353    /// # Arguments
4354    ///
4355    /// * `request` - No description provided.
4356    /// * `resource` - REQUIRED: The resource for which the policy is being specified. See [Resource names](https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
4357    pub fn service_accounts_set_iam_policy(
4358        &self,
4359        request: SetIamPolicyRequest,
4360        resource: &str,
4361    ) -> ProjectServiceAccountSetIamPolicyCall<'a, C> {
4362        ProjectServiceAccountSetIamPolicyCall {
4363            hub: self.hub,
4364            _request: request,
4365            _resource: resource.to_string(),
4366            _delegate: Default::default(),
4367            _additional_params: Default::default(),
4368            _scopes: Default::default(),
4369        }
4370    }
4371
4372    /// Create a builder to help you perform the following task:
4373    ///
4374    /// **Note:** This method is deprecated. Use the [signBlob](https://cloud.google.com/iam/help/rest-credentials/v1/projects.serviceAccounts/signBlob) method in the IAM Service Account Credentials API instead. If you currently use this method, see the [migration guide](https://cloud.google.com/iam/help/credentials/migrate-api) for instructions. Signs a blob using the system-managed private key for a ServiceAccount.
4375    ///
4376    /// # Arguments
4377    ///
4378    /// * `request` - No description provided.
4379    /// * `name` - Required. Deprecated. [Migrate to Service Account Credentials API](https://cloud.google.com/iam/help/credentials/migrate-api). The resource name of the service account. Use one of the following formats: * `projects/{PROJECT_ID}/serviceAccounts/{EMAIL_ADDRESS}` * `projects/{PROJECT_ID}/serviceAccounts/{UNIQUE_ID}` As an alternative, you can use the `-` wildcard character instead of the project ID: * `projects/-/serviceAccounts/{EMAIL_ADDRESS}` * `projects/-/serviceAccounts/{UNIQUE_ID}` When possible, avoid using the `-` wildcard character, because it can cause response messages to contain misleading error codes. For example, if you try to access the service account `projects/-/serviceAccounts/fake@example.com`, which does not exist, the response contains an HTTP `403 Forbidden` error instead of a `404 Not Found` error.
4380    pub fn service_accounts_sign_blob(
4381        &self,
4382        request: SignBlobRequest,
4383        name: &str,
4384    ) -> ProjectServiceAccountSignBlobCall<'a, C> {
4385        ProjectServiceAccountSignBlobCall {
4386            hub: self.hub,
4387            _request: request,
4388            _name: name.to_string(),
4389            _delegate: Default::default(),
4390            _additional_params: Default::default(),
4391            _scopes: Default::default(),
4392        }
4393    }
4394
4395    /// Create a builder to help you perform the following task:
4396    ///
4397    /// **Note:** This method is deprecated. Use the [signJwt](https://cloud.google.com/iam/help/rest-credentials/v1/projects.serviceAccounts/signJwt) method in the IAM Service Account Credentials API instead. If you currently use this method, see the [migration guide](https://cloud.google.com/iam/help/credentials/migrate-api) for instructions. Signs a JSON Web Token (JWT) using the system-managed private key for a ServiceAccount.
4398    ///
4399    /// # Arguments
4400    ///
4401    /// * `request` - No description provided.
4402    /// * `name` - Required. Deprecated. [Migrate to Service Account Credentials API](https://cloud.google.com/iam/help/credentials/migrate-api). The resource name of the service account. Use one of the following formats: * `projects/{PROJECT_ID}/serviceAccounts/{EMAIL_ADDRESS}` * `projects/{PROJECT_ID}/serviceAccounts/{UNIQUE_ID}` As an alternative, you can use the `-` wildcard character instead of the project ID: * `projects/-/serviceAccounts/{EMAIL_ADDRESS}` * `projects/-/serviceAccounts/{UNIQUE_ID}` When possible, avoid using the `-` wildcard character, because it can cause response messages to contain misleading error codes. For example, if you try to access the service account `projects/-/serviceAccounts/fake@example.com`, which does not exist, the response contains an HTTP `403 Forbidden` error instead of a `404 Not Found` error.
4403    pub fn service_accounts_sign_jwt(
4404        &self,
4405        request: SignJwtRequest,
4406        name: &str,
4407    ) -> ProjectServiceAccountSignJwtCall<'a, C> {
4408        ProjectServiceAccountSignJwtCall {
4409            hub: self.hub,
4410            _request: request,
4411            _name: name.to_string(),
4412            _delegate: Default::default(),
4413            _additional_params: Default::default(),
4414            _scopes: Default::default(),
4415        }
4416    }
4417
4418    /// Create a builder to help you perform the following task:
4419    ///
4420    /// Tests whether the caller has the specified permissions on a ServiceAccount.
4421    ///
4422    /// # Arguments
4423    ///
4424    /// * `request` - No description provided.
4425    /// * `resource` - REQUIRED: The resource for which the policy detail is being requested. See [Resource names](https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
4426    pub fn service_accounts_test_iam_permissions(
4427        &self,
4428        request: TestIamPermissionsRequest,
4429        resource: &str,
4430    ) -> ProjectServiceAccountTestIamPermissionCall<'a, C> {
4431        ProjectServiceAccountTestIamPermissionCall {
4432            hub: self.hub,
4433            _request: request,
4434            _resource: resource.to_string(),
4435            _delegate: Default::default(),
4436            _additional_params: Default::default(),
4437            _scopes: Default::default(),
4438        }
4439    }
4440
4441    /// Create a builder to help you perform the following task:
4442    ///
4443    /// Restores a deleted ServiceAccount. **Important:** It is not always possible to restore a deleted service account. Use this method only as a last resort. After you delete a service account, IAM permanently removes the service account 30 days later. There is no way to restore a deleted service account that has been permanently removed.
4444    ///
4445    /// # Arguments
4446    ///
4447    /// * `request` - No description provided.
4448    /// * `name` - The resource name of the service account. Use one of the following formats: * `projects/{PROJECT_ID}/serviceAccounts/{EMAIL_ADDRESS}` * `projects/{PROJECT_ID}/serviceAccounts/{UNIQUE_ID}` As an alternative, you can use the `-` wildcard character instead of the project ID: * `projects/-/serviceAccounts/{EMAIL_ADDRESS}` * `projects/-/serviceAccounts/{UNIQUE_ID}` When possible, avoid using the `-` wildcard character, because it can cause response messages to contain misleading error codes. For example, if you try to access the service account `projects/-/serviceAccounts/fake@example.com`, which does not exist, the response contains an HTTP `403 Forbidden` error instead of a `404 Not Found` error.
4449    pub fn service_accounts_undelete(
4450        &self,
4451        request: UndeleteServiceAccountRequest,
4452        name: &str,
4453    ) -> ProjectServiceAccountUndeleteCall<'a, C> {
4454        ProjectServiceAccountUndeleteCall {
4455            hub: self.hub,
4456            _request: request,
4457            _name: name.to_string(),
4458            _delegate: Default::default(),
4459            _additional_params: Default::default(),
4460            _scopes: Default::default(),
4461        }
4462    }
4463
4464    /// Create a builder to help you perform the following task:
4465    ///
4466    /// **Note:** We are in the process of deprecating this method. Use PatchServiceAccount instead. Updates a ServiceAccount. You can update only the `display_name` field.
4467    ///
4468    /// # Arguments
4469    ///
4470    /// * `request` - No description provided.
4471    /// * `name` - The resource name of the service account. Use one of the following formats: * `projects/{PROJECT_ID}/serviceAccounts/{EMAIL_ADDRESS}` * `projects/{PROJECT_ID}/serviceAccounts/{UNIQUE_ID}` As an alternative, you can use the `-` wildcard character instead of the project ID: * `projects/-/serviceAccounts/{EMAIL_ADDRESS}` * `projects/-/serviceAccounts/{UNIQUE_ID}` When possible, avoid using the `-` wildcard character, because it can cause response messages to contain misleading error codes. For example, if you try to access the service account `projects/-/serviceAccounts/fake@example.com`, which does not exist, the response contains an HTTP `403 Forbidden` error instead of a `404 Not Found` error.
4472    pub fn service_accounts_update(
4473        &self,
4474        request: ServiceAccount,
4475        name: &str,
4476    ) -> ProjectServiceAccountUpdateCall<'a, C> {
4477        ProjectServiceAccountUpdateCall {
4478            hub: self.hub,
4479            _request: request,
4480            _name: name.to_string(),
4481            _delegate: Default::default(),
4482            _additional_params: Default::default(),
4483            _scopes: Default::default(),
4484        }
4485    }
4486}
4487
4488/// A builder providing access to all methods supported on *role* resources.
4489/// It is not used directly, but through the [`Iam`] hub.
4490///
4491/// # Example
4492///
4493/// Instantiate a resource builder
4494///
4495/// ```test_harness,no_run
4496/// extern crate hyper;
4497/// extern crate hyper_rustls;
4498/// extern crate google_iam1 as iam1;
4499///
4500/// # async fn dox() {
4501/// use iam1::{Iam, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4502///
4503/// let secret: yup_oauth2::ApplicationSecret = Default::default();
4504/// let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
4505///     secret,
4506///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4507/// ).build().await.unwrap();
4508///
4509/// let client = hyper_util::client::legacy::Client::builder(
4510///     hyper_util::rt::TokioExecutor::new()
4511/// )
4512/// .build(
4513///     hyper_rustls::HttpsConnectorBuilder::new()
4514///         .with_native_roots()
4515///         .unwrap()
4516///         .https_or_http()
4517///         .enable_http1()
4518///         .build()
4519/// );
4520/// let mut hub = Iam::new(client, auth);
4521/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
4522/// // like `get(...)`, `list(...)` and `query_grantable_roles(...)`
4523/// // to build up your call.
4524/// let rb = hub.roles();
4525/// # }
4526/// ```
4527pub struct RoleMethods<'a, C>
4528where
4529    C: 'a,
4530{
4531    hub: &'a Iam<C>,
4532}
4533
4534impl<'a, C> common::MethodsBuilder for RoleMethods<'a, C> {}
4535
4536impl<'a, C> RoleMethods<'a, C> {
4537    /// Create a builder to help you perform the following task:
4538    ///
4539    /// Gets the definition of a Role.
4540    ///
4541    /// # Arguments
4542    ///
4543    /// * `name` - The `name` parameter's value depends on the target resource for the request, namely [roles](https://cloud.google.com/iam/docs/reference/rest/v1/roles), [projects](https://cloud.google.com/iam/docs/reference/rest/v1/projects.roles), or [organizations](https://cloud.google.com/iam/docs/reference/rest/v1/organizations.roles). Each resource type's `name` value format is described below: * [roles.get](https://cloud.google.com/iam/docs/reference/rest/v1/roles/get): `roles/{ROLE_NAME}`. This method returns results from all [predefined roles](https://cloud.google.com/iam/docs/understanding-roles#predefined_roles) in IAM. Example request URL: `https://iam.googleapis.com/v1/roles/{ROLE_NAME}` * [projects.roles.get](https://cloud.google.com/iam/docs/reference/rest/v1/projects.roles/get): `projects/{PROJECT_ID}/roles/{CUSTOM_ROLE_ID}`. This method returns only [custom roles](https://cloud.google.com/iam/docs/understanding-custom-roles) that have been created at the project level. Example request URL: `https://iam.googleapis.com/v1/projects/{PROJECT_ID}/roles/{CUSTOM_ROLE_ID}` * [organizations.roles.get](https://cloud.google.com/iam/docs/reference/rest/v1/organizations.roles/get): `organizations/{ORGANIZATION_ID}/roles/{CUSTOM_ROLE_ID}`. This method returns only [custom roles](https://cloud.google.com/iam/docs/understanding-custom-roles) that have been created at the organization level. Example request URL: `https://iam.googleapis.com/v1/organizations/{ORGANIZATION_ID}/roles/{CUSTOM_ROLE_ID}` Note: Wildcard (*) values are invalid; you must specify a complete project ID or organization ID.
4544    pub fn get(&self, name: &str) -> RoleGetCall<'a, C> {
4545        RoleGetCall {
4546            hub: self.hub,
4547            _name: name.to_string(),
4548            _delegate: Default::default(),
4549            _additional_params: Default::default(),
4550            _scopes: Default::default(),
4551        }
4552    }
4553
4554    /// Create a builder to help you perform the following task:
4555    ///
4556    /// Lists every predefined Role that IAM supports, or every custom role that is defined for an organization or project.
4557    pub fn list(&self) -> RoleListCall<'a, C> {
4558        RoleListCall {
4559            hub: self.hub,
4560            _view: Default::default(),
4561            _show_deleted: Default::default(),
4562            _parent: Default::default(),
4563            _page_token: Default::default(),
4564            _page_size: Default::default(),
4565            _delegate: Default::default(),
4566            _additional_params: Default::default(),
4567            _scopes: Default::default(),
4568        }
4569    }
4570
4571    /// Create a builder to help you perform the following task:
4572    ///
4573    /// Lists roles that can be granted on a Google Cloud resource. A role is grantable if the IAM policy for the resource can contain bindings to the role.
4574    ///
4575    /// # Arguments
4576    ///
4577    /// * `request` - No description provided.
4578    pub fn query_grantable_roles(
4579        &self,
4580        request: QueryGrantableRolesRequest,
4581    ) -> RoleQueryGrantableRoleCall<'a, C> {
4582        RoleQueryGrantableRoleCall {
4583            hub: self.hub,
4584            _request: request,
4585            _delegate: Default::default(),
4586            _additional_params: Default::default(),
4587            _scopes: Default::default(),
4588        }
4589    }
4590}
4591
4592// ###################
4593// CallBuilders   ###
4594// #################
4595
4596/// Lints, or validates, an IAM policy. Currently checks the google.iam.v1.Binding.condition field, which contains a condition expression for a role binding. Successful calls to this method always return an HTTP `200 OK` status code, even if the linter detects an issue in the IAM policy.
4597///
4598/// A builder for the *lintPolicy* method supported by a *iamPolicy* resource.
4599/// It is not used directly, but through a [`IamPolicyMethods`] instance.
4600///
4601/// # Example
4602///
4603/// Instantiate a resource method builder
4604///
4605/// ```test_harness,no_run
4606/// # extern crate hyper;
4607/// # extern crate hyper_rustls;
4608/// # extern crate google_iam1 as iam1;
4609/// use iam1::api::LintPolicyRequest;
4610/// # async fn dox() {
4611/// # use iam1::{Iam, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4612///
4613/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4614/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
4615/// #     secret,
4616/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4617/// # ).build().await.unwrap();
4618///
4619/// # let client = hyper_util::client::legacy::Client::builder(
4620/// #     hyper_util::rt::TokioExecutor::new()
4621/// # )
4622/// # .build(
4623/// #     hyper_rustls::HttpsConnectorBuilder::new()
4624/// #         .with_native_roots()
4625/// #         .unwrap()
4626/// #         .https_or_http()
4627/// #         .enable_http1()
4628/// #         .build()
4629/// # );
4630/// # let mut hub = Iam::new(client, auth);
4631/// // As the method needs a request, you would usually fill it with the desired information
4632/// // into the respective structure. Some of the parts shown here might not be applicable !
4633/// // Values shown here are possibly random and not representative !
4634/// let mut req = LintPolicyRequest::default();
4635///
4636/// // You can configure optional parameters by calling the respective setters at will, and
4637/// // execute the final call using `doit()`.
4638/// // Values shown here are possibly random and not representative !
4639/// let result = hub.iam_policies().lint_policy(req)
4640///              .doit().await;
4641/// # }
4642/// ```
4643pub struct IamPolicyLintPolicyCall<'a, C>
4644where
4645    C: 'a,
4646{
4647    hub: &'a Iam<C>,
4648    _request: LintPolicyRequest,
4649    _delegate: Option<&'a mut dyn common::Delegate>,
4650    _additional_params: HashMap<String, String>,
4651    _scopes: BTreeSet<String>,
4652}
4653
4654impl<'a, C> common::CallBuilder for IamPolicyLintPolicyCall<'a, C> {}
4655
4656impl<'a, C> IamPolicyLintPolicyCall<'a, C>
4657where
4658    C: common::Connector,
4659{
4660    /// Perform the operation you have build so far.
4661    pub async fn doit(mut self) -> common::Result<(common::Response, LintPolicyResponse)> {
4662        use std::borrow::Cow;
4663        use std::io::{Read, Seek};
4664
4665        use common::{url::Params, ToParts};
4666        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
4667
4668        let mut dd = common::DefaultDelegate;
4669        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
4670        dlg.begin(common::MethodInfo {
4671            id: "iam.iamPolicies.lintPolicy",
4672            http_method: hyper::Method::POST,
4673        });
4674
4675        for &field in ["alt"].iter() {
4676            if self._additional_params.contains_key(field) {
4677                dlg.finished(false);
4678                return Err(common::Error::FieldClash(field));
4679            }
4680        }
4681
4682        let mut params = Params::with_capacity(3 + self._additional_params.len());
4683
4684        params.extend(self._additional_params.iter());
4685
4686        params.push("alt", "json");
4687        let mut url = self.hub._base_url.clone() + "v1/iamPolicies:lintPolicy";
4688        if self._scopes.is_empty() {
4689            self._scopes
4690                .insert(Scope::CloudPlatform.as_ref().to_string());
4691        }
4692
4693        let url = params.parse_with_url(&url);
4694
4695        let mut json_mime_type = mime::APPLICATION_JSON;
4696        let mut request_value_reader = {
4697            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
4698            common::remove_json_null_values(&mut value);
4699            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
4700            serde_json::to_writer(&mut dst, &value).unwrap();
4701            dst
4702        };
4703        let request_size = request_value_reader
4704            .seek(std::io::SeekFrom::End(0))
4705            .unwrap();
4706        request_value_reader
4707            .seek(std::io::SeekFrom::Start(0))
4708            .unwrap();
4709
4710        loop {
4711            let token = match self
4712                .hub
4713                .auth
4714                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
4715                .await
4716            {
4717                Ok(token) => token,
4718                Err(e) => match dlg.token(e) {
4719                    Ok(token) => token,
4720                    Err(e) => {
4721                        dlg.finished(false);
4722                        return Err(common::Error::MissingToken(e));
4723                    }
4724                },
4725            };
4726            request_value_reader
4727                .seek(std::io::SeekFrom::Start(0))
4728                .unwrap();
4729            let mut req_result = {
4730                let client = &self.hub.client;
4731                dlg.pre_request();
4732                let mut req_builder = hyper::Request::builder()
4733                    .method(hyper::Method::POST)
4734                    .uri(url.as_str())
4735                    .header(USER_AGENT, self.hub._user_agent.clone());
4736
4737                if let Some(token) = token.as_ref() {
4738                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
4739                }
4740
4741                let request = req_builder
4742                    .header(CONTENT_TYPE, json_mime_type.to_string())
4743                    .header(CONTENT_LENGTH, request_size as u64)
4744                    .body(common::to_body(
4745                        request_value_reader.get_ref().clone().into(),
4746                    ));
4747
4748                client.request(request.unwrap()).await
4749            };
4750
4751            match req_result {
4752                Err(err) => {
4753                    if let common::Retry::After(d) = dlg.http_error(&err) {
4754                        sleep(d).await;
4755                        continue;
4756                    }
4757                    dlg.finished(false);
4758                    return Err(common::Error::HttpError(err));
4759                }
4760                Ok(res) => {
4761                    let (mut parts, body) = res.into_parts();
4762                    let mut body = common::Body::new(body);
4763                    if !parts.status.is_success() {
4764                        let bytes = common::to_bytes(body).await.unwrap_or_default();
4765                        let error = serde_json::from_str(&common::to_string(&bytes));
4766                        let response = common::to_response(parts, bytes.into());
4767
4768                        if let common::Retry::After(d) =
4769                            dlg.http_failure(&response, error.as_ref().ok())
4770                        {
4771                            sleep(d).await;
4772                            continue;
4773                        }
4774
4775                        dlg.finished(false);
4776
4777                        return Err(match error {
4778                            Ok(value) => common::Error::BadRequest(value),
4779                            _ => common::Error::Failure(response),
4780                        });
4781                    }
4782                    let response = {
4783                        let bytes = common::to_bytes(body).await.unwrap_or_default();
4784                        let encoded = common::to_string(&bytes);
4785                        match serde_json::from_str(&encoded) {
4786                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4787                            Err(error) => {
4788                                dlg.response_json_decode_error(&encoded, &error);
4789                                return Err(common::Error::JsonDecodeError(
4790                                    encoded.to_string(),
4791                                    error,
4792                                ));
4793                            }
4794                        }
4795                    };
4796
4797                    dlg.finished(true);
4798                    return Ok(response);
4799                }
4800            }
4801        }
4802    }
4803
4804    ///
4805    /// Sets the *request* 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 request(mut self, new_value: LintPolicyRequest) -> IamPolicyLintPolicyCall<'a, C> {
4810        self._request = new_value;
4811        self
4812    }
4813    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4814    /// while executing the actual API request.
4815    ///
4816    /// ````text
4817    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
4818    /// ````
4819    ///
4820    /// Sets the *delegate* property to the given value.
4821    pub fn delegate(
4822        mut self,
4823        new_value: &'a mut dyn common::Delegate,
4824    ) -> IamPolicyLintPolicyCall<'a, C> {
4825        self._delegate = Some(new_value);
4826        self
4827    }
4828
4829    /// Set any additional parameter of the query string used in the request.
4830    /// It should be used to set parameters which are not yet available through their own
4831    /// setters.
4832    ///
4833    /// Please note that this method must not be used to set any of the known parameters
4834    /// which have their own setter method. If done anyway, the request will fail.
4835    ///
4836    /// # Additional Parameters
4837    ///
4838    /// * *$.xgafv* (query-string) - V1 error format.
4839    /// * *access_token* (query-string) - OAuth access token.
4840    /// * *alt* (query-string) - Data format for response.
4841    /// * *callback* (query-string) - JSONP
4842    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4843    /// * *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.
4844    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4845    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4846    /// * *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.
4847    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4848    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4849    pub fn param<T>(mut self, name: T, value: T) -> IamPolicyLintPolicyCall<'a, C>
4850    where
4851        T: AsRef<str>,
4852    {
4853        self._additional_params
4854            .insert(name.as_ref().to_string(), value.as_ref().to_string());
4855        self
4856    }
4857
4858    /// Identifies the authorization scope for the method you are building.
4859    ///
4860    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
4861    /// [`Scope::CloudPlatform`].
4862    ///
4863    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4864    /// tokens for more than one scope.
4865    ///
4866    /// Usually there is more than one suitable scope to authorize an operation, some of which may
4867    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
4868    /// sufficient, a read-write scope will do as well.
4869    pub fn add_scope<St>(mut self, scope: St) -> IamPolicyLintPolicyCall<'a, C>
4870    where
4871        St: AsRef<str>,
4872    {
4873        self._scopes.insert(String::from(scope.as_ref()));
4874        self
4875    }
4876    /// Identifies the authorization scope(s) for the method you are building.
4877    ///
4878    /// See [`Self::add_scope()`] for details.
4879    pub fn add_scopes<I, St>(mut self, scopes: I) -> IamPolicyLintPolicyCall<'a, C>
4880    where
4881        I: IntoIterator<Item = St>,
4882        St: AsRef<str>,
4883    {
4884        self._scopes
4885            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
4886        self
4887    }
4888
4889    /// Removes all scopes, and no default scope will be used either.
4890    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
4891    /// for details).
4892    pub fn clear_scopes(mut self) -> IamPolicyLintPolicyCall<'a, C> {
4893        self._scopes.clear();
4894        self
4895    }
4896}
4897
4898/// Returns a list of services that allow you to opt into audit logs that are not generated by default. To learn more about audit logs, see the [Logging documentation](https://cloud.google.com/logging/docs/audit).
4899///
4900/// A builder for the *queryAuditableServices* method supported by a *iamPolicy* resource.
4901/// It is not used directly, but through a [`IamPolicyMethods`] instance.
4902///
4903/// # Example
4904///
4905/// Instantiate a resource method builder
4906///
4907/// ```test_harness,no_run
4908/// # extern crate hyper;
4909/// # extern crate hyper_rustls;
4910/// # extern crate google_iam1 as iam1;
4911/// use iam1::api::QueryAuditableServicesRequest;
4912/// # async fn dox() {
4913/// # use iam1::{Iam, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4914///
4915/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4916/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
4917/// #     secret,
4918/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
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_http1()
4930/// #         .build()
4931/// # );
4932/// # let mut hub = Iam::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 = QueryAuditableServicesRequest::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.iam_policies().query_auditable_services(req)
4942///              .doit().await;
4943/// # }
4944/// ```
4945pub struct IamPolicyQueryAuditableServiceCall<'a, C>
4946where
4947    C: 'a,
4948{
4949    hub: &'a Iam<C>,
4950    _request: QueryAuditableServicesRequest,
4951    _delegate: Option<&'a mut dyn common::Delegate>,
4952    _additional_params: HashMap<String, String>,
4953    _scopes: BTreeSet<String>,
4954}
4955
4956impl<'a, C> common::CallBuilder for IamPolicyQueryAuditableServiceCall<'a, C> {}
4957
4958impl<'a, C> IamPolicyQueryAuditableServiceCall<'a, C>
4959where
4960    C: common::Connector,
4961{
4962    /// Perform the operation you have build so far.
4963    pub async fn doit(
4964        mut self,
4965    ) -> common::Result<(common::Response, QueryAuditableServicesResponse)> {
4966        use std::borrow::Cow;
4967        use std::io::{Read, Seek};
4968
4969        use common::{url::Params, ToParts};
4970        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
4971
4972        let mut dd = common::DefaultDelegate;
4973        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
4974        dlg.begin(common::MethodInfo {
4975            id: "iam.iamPolicies.queryAuditableServices",
4976            http_method: hyper::Method::POST,
4977        });
4978
4979        for &field in ["alt"].iter() {
4980            if self._additional_params.contains_key(field) {
4981                dlg.finished(false);
4982                return Err(common::Error::FieldClash(field));
4983            }
4984        }
4985
4986        let mut params = Params::with_capacity(3 + self._additional_params.len());
4987
4988        params.extend(self._additional_params.iter());
4989
4990        params.push("alt", "json");
4991        let mut url = self.hub._base_url.clone() + "v1/iamPolicies:queryAuditableServices";
4992        if self._scopes.is_empty() {
4993            self._scopes
4994                .insert(Scope::CloudPlatform.as_ref().to_string());
4995        }
4996
4997        let url = params.parse_with_url(&url);
4998
4999        let mut json_mime_type = mime::APPLICATION_JSON;
5000        let mut request_value_reader = {
5001            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
5002            common::remove_json_null_values(&mut value);
5003            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
5004            serde_json::to_writer(&mut dst, &value).unwrap();
5005            dst
5006        };
5007        let request_size = request_value_reader
5008            .seek(std::io::SeekFrom::End(0))
5009            .unwrap();
5010        request_value_reader
5011            .seek(std::io::SeekFrom::Start(0))
5012            .unwrap();
5013
5014        loop {
5015            let token = match self
5016                .hub
5017                .auth
5018                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5019                .await
5020            {
5021                Ok(token) => token,
5022                Err(e) => match dlg.token(e) {
5023                    Ok(token) => token,
5024                    Err(e) => {
5025                        dlg.finished(false);
5026                        return Err(common::Error::MissingToken(e));
5027                    }
5028                },
5029            };
5030            request_value_reader
5031                .seek(std::io::SeekFrom::Start(0))
5032                .unwrap();
5033            let mut req_result = {
5034                let client = &self.hub.client;
5035                dlg.pre_request();
5036                let mut req_builder = hyper::Request::builder()
5037                    .method(hyper::Method::POST)
5038                    .uri(url.as_str())
5039                    .header(USER_AGENT, self.hub._user_agent.clone());
5040
5041                if let Some(token) = token.as_ref() {
5042                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5043                }
5044
5045                let request = req_builder
5046                    .header(CONTENT_TYPE, json_mime_type.to_string())
5047                    .header(CONTENT_LENGTH, request_size as u64)
5048                    .body(common::to_body(
5049                        request_value_reader.get_ref().clone().into(),
5050                    ));
5051
5052                client.request(request.unwrap()).await
5053            };
5054
5055            match req_result {
5056                Err(err) => {
5057                    if let common::Retry::After(d) = dlg.http_error(&err) {
5058                        sleep(d).await;
5059                        continue;
5060                    }
5061                    dlg.finished(false);
5062                    return Err(common::Error::HttpError(err));
5063                }
5064                Ok(res) => {
5065                    let (mut parts, body) = res.into_parts();
5066                    let mut body = common::Body::new(body);
5067                    if !parts.status.is_success() {
5068                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5069                        let error = serde_json::from_str(&common::to_string(&bytes));
5070                        let response = common::to_response(parts, bytes.into());
5071
5072                        if let common::Retry::After(d) =
5073                            dlg.http_failure(&response, error.as_ref().ok())
5074                        {
5075                            sleep(d).await;
5076                            continue;
5077                        }
5078
5079                        dlg.finished(false);
5080
5081                        return Err(match error {
5082                            Ok(value) => common::Error::BadRequest(value),
5083                            _ => common::Error::Failure(response),
5084                        });
5085                    }
5086                    let response = {
5087                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5088                        let encoded = common::to_string(&bytes);
5089                        match serde_json::from_str(&encoded) {
5090                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5091                            Err(error) => {
5092                                dlg.response_json_decode_error(&encoded, &error);
5093                                return Err(common::Error::JsonDecodeError(
5094                                    encoded.to_string(),
5095                                    error,
5096                                ));
5097                            }
5098                        }
5099                    };
5100
5101                    dlg.finished(true);
5102                    return Ok(response);
5103                }
5104            }
5105        }
5106    }
5107
5108    ///
5109    /// Sets the *request* property to the given value.
5110    ///
5111    /// Even though the property as already been set when instantiating this call,
5112    /// we provide this method for API completeness.
5113    pub fn request(
5114        mut self,
5115        new_value: QueryAuditableServicesRequest,
5116    ) -> IamPolicyQueryAuditableServiceCall<'a, C> {
5117        self._request = new_value;
5118        self
5119    }
5120    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5121    /// while executing the actual API request.
5122    ///
5123    /// ````text
5124    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
5125    /// ````
5126    ///
5127    /// Sets the *delegate* property to the given value.
5128    pub fn delegate(
5129        mut self,
5130        new_value: &'a mut dyn common::Delegate,
5131    ) -> IamPolicyQueryAuditableServiceCall<'a, C> {
5132        self._delegate = Some(new_value);
5133        self
5134    }
5135
5136    /// Set any additional parameter of the query string used in the request.
5137    /// It should be used to set parameters which are not yet available through their own
5138    /// setters.
5139    ///
5140    /// Please note that this method must not be used to set any of the known parameters
5141    /// which have their own setter method. If done anyway, the request will fail.
5142    ///
5143    /// # Additional Parameters
5144    ///
5145    /// * *$.xgafv* (query-string) - V1 error format.
5146    /// * *access_token* (query-string) - OAuth access token.
5147    /// * *alt* (query-string) - Data format for response.
5148    /// * *callback* (query-string) - JSONP
5149    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5150    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
5151    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5152    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5153    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
5154    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5155    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5156    pub fn param<T>(mut self, name: T, value: T) -> IamPolicyQueryAuditableServiceCall<'a, C>
5157    where
5158        T: AsRef<str>,
5159    {
5160        self._additional_params
5161            .insert(name.as_ref().to_string(), value.as_ref().to_string());
5162        self
5163    }
5164
5165    /// Identifies the authorization scope for the method you are building.
5166    ///
5167    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5168    /// [`Scope::CloudPlatform`].
5169    ///
5170    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5171    /// tokens for more than one scope.
5172    ///
5173    /// Usually there is more than one suitable scope to authorize an operation, some of which may
5174    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5175    /// sufficient, a read-write scope will do as well.
5176    pub fn add_scope<St>(mut self, scope: St) -> IamPolicyQueryAuditableServiceCall<'a, C>
5177    where
5178        St: AsRef<str>,
5179    {
5180        self._scopes.insert(String::from(scope.as_ref()));
5181        self
5182    }
5183    /// Identifies the authorization scope(s) for the method you are building.
5184    ///
5185    /// See [`Self::add_scope()`] for details.
5186    pub fn add_scopes<I, St>(mut self, scopes: I) -> IamPolicyQueryAuditableServiceCall<'a, C>
5187    where
5188        I: IntoIterator<Item = St>,
5189        St: AsRef<str>,
5190    {
5191        self._scopes
5192            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5193        self
5194    }
5195
5196    /// Removes all scopes, and no default scope will be used either.
5197    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5198    /// for details).
5199    pub fn clear_scopes(mut self) -> IamPolicyQueryAuditableServiceCall<'a, C> {
5200        self._scopes.clear();
5201        self
5202    }
5203}
5204
5205/// Gets the latest state of a long-running operation. Clients can use this method to poll the operation result at intervals as recommended by the API service.
5206///
5207/// A builder for the *workforcePools.operations.get* method supported by a *location* resource.
5208/// It is not used directly, but through a [`LocationMethods`] instance.
5209///
5210/// # Example
5211///
5212/// Instantiate a resource method builder
5213///
5214/// ```test_harness,no_run
5215/// # extern crate hyper;
5216/// # extern crate hyper_rustls;
5217/// # extern crate google_iam1 as iam1;
5218/// # async fn dox() {
5219/// # use iam1::{Iam, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5220///
5221/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5222/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
5223/// #     secret,
5224/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5225/// # ).build().await.unwrap();
5226///
5227/// # let client = hyper_util::client::legacy::Client::builder(
5228/// #     hyper_util::rt::TokioExecutor::new()
5229/// # )
5230/// # .build(
5231/// #     hyper_rustls::HttpsConnectorBuilder::new()
5232/// #         .with_native_roots()
5233/// #         .unwrap()
5234/// #         .https_or_http()
5235/// #         .enable_http1()
5236/// #         .build()
5237/// # );
5238/// # let mut hub = Iam::new(client, auth);
5239/// // You can configure optional parameters by calling the respective setters at will, and
5240/// // execute the final call using `doit()`.
5241/// // Values shown here are possibly random and not representative !
5242/// let result = hub.locations().workforce_pools_operations_get("name")
5243///              .doit().await;
5244/// # }
5245/// ```
5246pub struct LocationWorkforcePoolOperationGetCall<'a, C>
5247where
5248    C: 'a,
5249{
5250    hub: &'a Iam<C>,
5251    _name: String,
5252    _delegate: Option<&'a mut dyn common::Delegate>,
5253    _additional_params: HashMap<String, String>,
5254    _scopes: BTreeSet<String>,
5255}
5256
5257impl<'a, C> common::CallBuilder for LocationWorkforcePoolOperationGetCall<'a, C> {}
5258
5259impl<'a, C> LocationWorkforcePoolOperationGetCall<'a, C>
5260where
5261    C: common::Connector,
5262{
5263    /// Perform the operation you have build so far.
5264    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
5265        use std::borrow::Cow;
5266        use std::io::{Read, Seek};
5267
5268        use common::{url::Params, ToParts};
5269        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5270
5271        let mut dd = common::DefaultDelegate;
5272        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5273        dlg.begin(common::MethodInfo {
5274            id: "iam.locations.workforcePools.operations.get",
5275            http_method: hyper::Method::GET,
5276        });
5277
5278        for &field in ["alt", "name"].iter() {
5279            if self._additional_params.contains_key(field) {
5280                dlg.finished(false);
5281                return Err(common::Error::FieldClash(field));
5282            }
5283        }
5284
5285        let mut params = Params::with_capacity(3 + self._additional_params.len());
5286        params.push("name", self._name);
5287
5288        params.extend(self._additional_params.iter());
5289
5290        params.push("alt", "json");
5291        let mut url = self.hub._base_url.clone() + "v1/{+name}";
5292        if self._scopes.is_empty() {
5293            self._scopes
5294                .insert(Scope::CloudPlatform.as_ref().to_string());
5295        }
5296
5297        #[allow(clippy::single_element_loop)]
5298        for &(find_this, param_name) in [("{+name}", "name")].iter() {
5299            url = params.uri_replacement(url, param_name, find_this, true);
5300        }
5301        {
5302            let to_remove = ["name"];
5303            params.remove_params(&to_remove);
5304        }
5305
5306        let url = params.parse_with_url(&url);
5307
5308        loop {
5309            let token = match self
5310                .hub
5311                .auth
5312                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5313                .await
5314            {
5315                Ok(token) => token,
5316                Err(e) => match dlg.token(e) {
5317                    Ok(token) => token,
5318                    Err(e) => {
5319                        dlg.finished(false);
5320                        return Err(common::Error::MissingToken(e));
5321                    }
5322                },
5323            };
5324            let mut req_result = {
5325                let client = &self.hub.client;
5326                dlg.pre_request();
5327                let mut req_builder = hyper::Request::builder()
5328                    .method(hyper::Method::GET)
5329                    .uri(url.as_str())
5330                    .header(USER_AGENT, self.hub._user_agent.clone());
5331
5332                if let Some(token) = token.as_ref() {
5333                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5334                }
5335
5336                let request = req_builder
5337                    .header(CONTENT_LENGTH, 0_u64)
5338                    .body(common::to_body::<String>(None));
5339
5340                client.request(request.unwrap()).await
5341            };
5342
5343            match req_result {
5344                Err(err) => {
5345                    if let common::Retry::After(d) = dlg.http_error(&err) {
5346                        sleep(d).await;
5347                        continue;
5348                    }
5349                    dlg.finished(false);
5350                    return Err(common::Error::HttpError(err));
5351                }
5352                Ok(res) => {
5353                    let (mut parts, body) = res.into_parts();
5354                    let mut body = common::Body::new(body);
5355                    if !parts.status.is_success() {
5356                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5357                        let error = serde_json::from_str(&common::to_string(&bytes));
5358                        let response = common::to_response(parts, bytes.into());
5359
5360                        if let common::Retry::After(d) =
5361                            dlg.http_failure(&response, error.as_ref().ok())
5362                        {
5363                            sleep(d).await;
5364                            continue;
5365                        }
5366
5367                        dlg.finished(false);
5368
5369                        return Err(match error {
5370                            Ok(value) => common::Error::BadRequest(value),
5371                            _ => common::Error::Failure(response),
5372                        });
5373                    }
5374                    let response = {
5375                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5376                        let encoded = common::to_string(&bytes);
5377                        match serde_json::from_str(&encoded) {
5378                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5379                            Err(error) => {
5380                                dlg.response_json_decode_error(&encoded, &error);
5381                                return Err(common::Error::JsonDecodeError(
5382                                    encoded.to_string(),
5383                                    error,
5384                                ));
5385                            }
5386                        }
5387                    };
5388
5389                    dlg.finished(true);
5390                    return Ok(response);
5391                }
5392            }
5393        }
5394    }
5395
5396    /// The name of the operation resource.
5397    ///
5398    /// Sets the *name* path property to the given value.
5399    ///
5400    /// Even though the property as already been set when instantiating this call,
5401    /// we provide this method for API completeness.
5402    pub fn name(mut self, new_value: &str) -> LocationWorkforcePoolOperationGetCall<'a, C> {
5403        self._name = new_value.to_string();
5404        self
5405    }
5406    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5407    /// while executing the actual API request.
5408    ///
5409    /// ````text
5410    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
5411    /// ````
5412    ///
5413    /// Sets the *delegate* property to the given value.
5414    pub fn delegate(
5415        mut self,
5416        new_value: &'a mut dyn common::Delegate,
5417    ) -> LocationWorkforcePoolOperationGetCall<'a, C> {
5418        self._delegate = Some(new_value);
5419        self
5420    }
5421
5422    /// Set any additional parameter of the query string used in the request.
5423    /// It should be used to set parameters which are not yet available through their own
5424    /// setters.
5425    ///
5426    /// Please note that this method must not be used to set any of the known parameters
5427    /// which have their own setter method. If done anyway, the request will fail.
5428    ///
5429    /// # Additional Parameters
5430    ///
5431    /// * *$.xgafv* (query-string) - V1 error format.
5432    /// * *access_token* (query-string) - OAuth access token.
5433    /// * *alt* (query-string) - Data format for response.
5434    /// * *callback* (query-string) - JSONP
5435    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5436    /// * *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.
5437    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5438    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5439    /// * *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.
5440    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5441    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5442    pub fn param<T>(mut self, name: T, value: T) -> LocationWorkforcePoolOperationGetCall<'a, C>
5443    where
5444        T: AsRef<str>,
5445    {
5446        self._additional_params
5447            .insert(name.as_ref().to_string(), value.as_ref().to_string());
5448        self
5449    }
5450
5451    /// Identifies the authorization scope for the method you are building.
5452    ///
5453    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5454    /// [`Scope::CloudPlatform`].
5455    ///
5456    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5457    /// tokens for more than one scope.
5458    ///
5459    /// Usually there is more than one suitable scope to authorize an operation, some of which may
5460    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5461    /// sufficient, a read-write scope will do as well.
5462    pub fn add_scope<St>(mut self, scope: St) -> LocationWorkforcePoolOperationGetCall<'a, C>
5463    where
5464        St: AsRef<str>,
5465    {
5466        self._scopes.insert(String::from(scope.as_ref()));
5467        self
5468    }
5469    /// Identifies the authorization scope(s) for the method you are building.
5470    ///
5471    /// See [`Self::add_scope()`] for details.
5472    pub fn add_scopes<I, St>(mut self, scopes: I) -> LocationWorkforcePoolOperationGetCall<'a, C>
5473    where
5474        I: IntoIterator<Item = St>,
5475        St: AsRef<str>,
5476    {
5477        self._scopes
5478            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5479        self
5480    }
5481
5482    /// Removes all scopes, and no default scope will be used either.
5483    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5484    /// for details).
5485    pub fn clear_scopes(mut self) -> LocationWorkforcePoolOperationGetCall<'a, C> {
5486        self._scopes.clear();
5487        self
5488    }
5489}
5490
5491/// Gets the latest state of a long-running operation. Clients can use this method to poll the operation result at intervals as recommended by the API service.
5492///
5493/// A builder for the *workforcePools.providers.keys.operations.get* method supported by a *location* resource.
5494/// It is not used directly, but through a [`LocationMethods`] instance.
5495///
5496/// # Example
5497///
5498/// Instantiate a resource method builder
5499///
5500/// ```test_harness,no_run
5501/// # extern crate hyper;
5502/// # extern crate hyper_rustls;
5503/// # extern crate google_iam1 as iam1;
5504/// # async fn dox() {
5505/// # use iam1::{Iam, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5506///
5507/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5508/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
5509/// #     secret,
5510/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5511/// # ).build().await.unwrap();
5512///
5513/// # let client = hyper_util::client::legacy::Client::builder(
5514/// #     hyper_util::rt::TokioExecutor::new()
5515/// # )
5516/// # .build(
5517/// #     hyper_rustls::HttpsConnectorBuilder::new()
5518/// #         .with_native_roots()
5519/// #         .unwrap()
5520/// #         .https_or_http()
5521/// #         .enable_http1()
5522/// #         .build()
5523/// # );
5524/// # let mut hub = Iam::new(client, auth);
5525/// // You can configure optional parameters by calling the respective setters at will, and
5526/// // execute the final call using `doit()`.
5527/// // Values shown here are possibly random and not representative !
5528/// let result = hub.locations().workforce_pools_providers_keys_operations_get("name")
5529///              .doit().await;
5530/// # }
5531/// ```
5532pub struct LocationWorkforcePoolProviderKeyOperationGetCall<'a, C>
5533where
5534    C: 'a,
5535{
5536    hub: &'a Iam<C>,
5537    _name: String,
5538    _delegate: Option<&'a mut dyn common::Delegate>,
5539    _additional_params: HashMap<String, String>,
5540    _scopes: BTreeSet<String>,
5541}
5542
5543impl<'a, C> common::CallBuilder for LocationWorkforcePoolProviderKeyOperationGetCall<'a, C> {}
5544
5545impl<'a, C> LocationWorkforcePoolProviderKeyOperationGetCall<'a, C>
5546where
5547    C: common::Connector,
5548{
5549    /// Perform the operation you have build so far.
5550    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
5551        use std::borrow::Cow;
5552        use std::io::{Read, Seek};
5553
5554        use common::{url::Params, ToParts};
5555        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5556
5557        let mut dd = common::DefaultDelegate;
5558        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5559        dlg.begin(common::MethodInfo {
5560            id: "iam.locations.workforcePools.providers.keys.operations.get",
5561            http_method: hyper::Method::GET,
5562        });
5563
5564        for &field in ["alt", "name"].iter() {
5565            if self._additional_params.contains_key(field) {
5566                dlg.finished(false);
5567                return Err(common::Error::FieldClash(field));
5568            }
5569        }
5570
5571        let mut params = Params::with_capacity(3 + self._additional_params.len());
5572        params.push("name", self._name);
5573
5574        params.extend(self._additional_params.iter());
5575
5576        params.push("alt", "json");
5577        let mut url = self.hub._base_url.clone() + "v1/{+name}";
5578        if self._scopes.is_empty() {
5579            self._scopes
5580                .insert(Scope::CloudPlatform.as_ref().to_string());
5581        }
5582
5583        #[allow(clippy::single_element_loop)]
5584        for &(find_this, param_name) in [("{+name}", "name")].iter() {
5585            url = params.uri_replacement(url, param_name, find_this, true);
5586        }
5587        {
5588            let to_remove = ["name"];
5589            params.remove_params(&to_remove);
5590        }
5591
5592        let url = params.parse_with_url(&url);
5593
5594        loop {
5595            let token = match self
5596                .hub
5597                .auth
5598                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5599                .await
5600            {
5601                Ok(token) => token,
5602                Err(e) => match dlg.token(e) {
5603                    Ok(token) => token,
5604                    Err(e) => {
5605                        dlg.finished(false);
5606                        return Err(common::Error::MissingToken(e));
5607                    }
5608                },
5609            };
5610            let mut req_result = {
5611                let client = &self.hub.client;
5612                dlg.pre_request();
5613                let mut req_builder = hyper::Request::builder()
5614                    .method(hyper::Method::GET)
5615                    .uri(url.as_str())
5616                    .header(USER_AGENT, self.hub._user_agent.clone());
5617
5618                if let Some(token) = token.as_ref() {
5619                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5620                }
5621
5622                let request = req_builder
5623                    .header(CONTENT_LENGTH, 0_u64)
5624                    .body(common::to_body::<String>(None));
5625
5626                client.request(request.unwrap()).await
5627            };
5628
5629            match req_result {
5630                Err(err) => {
5631                    if let common::Retry::After(d) = dlg.http_error(&err) {
5632                        sleep(d).await;
5633                        continue;
5634                    }
5635                    dlg.finished(false);
5636                    return Err(common::Error::HttpError(err));
5637                }
5638                Ok(res) => {
5639                    let (mut parts, body) = res.into_parts();
5640                    let mut body = common::Body::new(body);
5641                    if !parts.status.is_success() {
5642                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5643                        let error = serde_json::from_str(&common::to_string(&bytes));
5644                        let response = common::to_response(parts, bytes.into());
5645
5646                        if let common::Retry::After(d) =
5647                            dlg.http_failure(&response, error.as_ref().ok())
5648                        {
5649                            sleep(d).await;
5650                            continue;
5651                        }
5652
5653                        dlg.finished(false);
5654
5655                        return Err(match error {
5656                            Ok(value) => common::Error::BadRequest(value),
5657                            _ => common::Error::Failure(response),
5658                        });
5659                    }
5660                    let response = {
5661                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5662                        let encoded = common::to_string(&bytes);
5663                        match serde_json::from_str(&encoded) {
5664                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5665                            Err(error) => {
5666                                dlg.response_json_decode_error(&encoded, &error);
5667                                return Err(common::Error::JsonDecodeError(
5668                                    encoded.to_string(),
5669                                    error,
5670                                ));
5671                            }
5672                        }
5673                    };
5674
5675                    dlg.finished(true);
5676                    return Ok(response);
5677                }
5678            }
5679        }
5680    }
5681
5682    /// The name of the operation resource.
5683    ///
5684    /// Sets the *name* path property to the given value.
5685    ///
5686    /// Even though the property as already been set when instantiating this call,
5687    /// we provide this method for API completeness.
5688    pub fn name(
5689        mut self,
5690        new_value: &str,
5691    ) -> LocationWorkforcePoolProviderKeyOperationGetCall<'a, C> {
5692        self._name = new_value.to_string();
5693        self
5694    }
5695    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5696    /// while executing the actual API request.
5697    ///
5698    /// ````text
5699    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
5700    /// ````
5701    ///
5702    /// Sets the *delegate* property to the given value.
5703    pub fn delegate(
5704        mut self,
5705        new_value: &'a mut dyn common::Delegate,
5706    ) -> LocationWorkforcePoolProviderKeyOperationGetCall<'a, C> {
5707        self._delegate = Some(new_value);
5708        self
5709    }
5710
5711    /// Set any additional parameter of the query string used in the request.
5712    /// It should be used to set parameters which are not yet available through their own
5713    /// setters.
5714    ///
5715    /// Please note that this method must not be used to set any of the known parameters
5716    /// which have their own setter method. If done anyway, the request will fail.
5717    ///
5718    /// # Additional Parameters
5719    ///
5720    /// * *$.xgafv* (query-string) - V1 error format.
5721    /// * *access_token* (query-string) - OAuth access token.
5722    /// * *alt* (query-string) - Data format for response.
5723    /// * *callback* (query-string) - JSONP
5724    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5725    /// * *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.
5726    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5727    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5728    /// * *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.
5729    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5730    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5731    pub fn param<T>(
5732        mut self,
5733        name: T,
5734        value: T,
5735    ) -> LocationWorkforcePoolProviderKeyOperationGetCall<'a, C>
5736    where
5737        T: AsRef<str>,
5738    {
5739        self._additional_params
5740            .insert(name.as_ref().to_string(), value.as_ref().to_string());
5741        self
5742    }
5743
5744    /// Identifies the authorization scope for the method you are building.
5745    ///
5746    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5747    /// [`Scope::CloudPlatform`].
5748    ///
5749    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5750    /// tokens for more than one scope.
5751    ///
5752    /// Usually there is more than one suitable scope to authorize an operation, some of which may
5753    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5754    /// sufficient, a read-write scope will do as well.
5755    pub fn add_scope<St>(
5756        mut self,
5757        scope: St,
5758    ) -> LocationWorkforcePoolProviderKeyOperationGetCall<'a, C>
5759    where
5760        St: AsRef<str>,
5761    {
5762        self._scopes.insert(String::from(scope.as_ref()));
5763        self
5764    }
5765    /// Identifies the authorization scope(s) for the method you are building.
5766    ///
5767    /// See [`Self::add_scope()`] for details.
5768    pub fn add_scopes<I, St>(
5769        mut self,
5770        scopes: I,
5771    ) -> LocationWorkforcePoolProviderKeyOperationGetCall<'a, C>
5772    where
5773        I: IntoIterator<Item = St>,
5774        St: AsRef<str>,
5775    {
5776        self._scopes
5777            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5778        self
5779    }
5780
5781    /// Removes all scopes, and no default scope will be used either.
5782    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5783    /// for details).
5784    pub fn clear_scopes(mut self) -> LocationWorkforcePoolProviderKeyOperationGetCall<'a, C> {
5785        self._scopes.clear();
5786        self
5787    }
5788}
5789
5790/// Creates a new WorkforcePoolProviderKey in a WorkforcePoolProvider.
5791///
5792/// A builder for the *workforcePools.providers.keys.create* method supported by a *location* resource.
5793/// It is not used directly, but through a [`LocationMethods`] instance.
5794///
5795/// # Example
5796///
5797/// Instantiate a resource method builder
5798///
5799/// ```test_harness,no_run
5800/// # extern crate hyper;
5801/// # extern crate hyper_rustls;
5802/// # extern crate google_iam1 as iam1;
5803/// use iam1::api::WorkforcePoolProviderKey;
5804/// # async fn dox() {
5805/// # use iam1::{Iam, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5806///
5807/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5808/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
5809/// #     secret,
5810/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5811/// # ).build().await.unwrap();
5812///
5813/// # let client = hyper_util::client::legacy::Client::builder(
5814/// #     hyper_util::rt::TokioExecutor::new()
5815/// # )
5816/// # .build(
5817/// #     hyper_rustls::HttpsConnectorBuilder::new()
5818/// #         .with_native_roots()
5819/// #         .unwrap()
5820/// #         .https_or_http()
5821/// #         .enable_http1()
5822/// #         .build()
5823/// # );
5824/// # let mut hub = Iam::new(client, auth);
5825/// // As the method needs a request, you would usually fill it with the desired information
5826/// // into the respective structure. Some of the parts shown here might not be applicable !
5827/// // Values shown here are possibly random and not representative !
5828/// let mut req = WorkforcePoolProviderKey::default();
5829///
5830/// // You can configure optional parameters by calling the respective setters at will, and
5831/// // execute the final call using `doit()`.
5832/// // Values shown here are possibly random and not representative !
5833/// let result = hub.locations().workforce_pools_providers_keys_create(req, "parent")
5834///              .workforce_pool_provider_key_id("takimata")
5835///              .doit().await;
5836/// # }
5837/// ```
5838pub struct LocationWorkforcePoolProviderKeyCreateCall<'a, C>
5839where
5840    C: 'a,
5841{
5842    hub: &'a Iam<C>,
5843    _request: WorkforcePoolProviderKey,
5844    _parent: String,
5845    _workforce_pool_provider_key_id: Option<String>,
5846    _delegate: Option<&'a mut dyn common::Delegate>,
5847    _additional_params: HashMap<String, String>,
5848    _scopes: BTreeSet<String>,
5849}
5850
5851impl<'a, C> common::CallBuilder for LocationWorkforcePoolProviderKeyCreateCall<'a, C> {}
5852
5853impl<'a, C> LocationWorkforcePoolProviderKeyCreateCall<'a, C>
5854where
5855    C: common::Connector,
5856{
5857    /// Perform the operation you have build so far.
5858    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
5859        use std::borrow::Cow;
5860        use std::io::{Read, Seek};
5861
5862        use common::{url::Params, ToParts};
5863        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5864
5865        let mut dd = common::DefaultDelegate;
5866        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5867        dlg.begin(common::MethodInfo {
5868            id: "iam.locations.workforcePools.providers.keys.create",
5869            http_method: hyper::Method::POST,
5870        });
5871
5872        for &field in ["alt", "parent", "workforcePoolProviderKeyId"].iter() {
5873            if self._additional_params.contains_key(field) {
5874                dlg.finished(false);
5875                return Err(common::Error::FieldClash(field));
5876            }
5877        }
5878
5879        let mut params = Params::with_capacity(5 + self._additional_params.len());
5880        params.push("parent", self._parent);
5881        if let Some(value) = self._workforce_pool_provider_key_id.as_ref() {
5882            params.push("workforcePoolProviderKeyId", value);
5883        }
5884
5885        params.extend(self._additional_params.iter());
5886
5887        params.push("alt", "json");
5888        let mut url = self.hub._base_url.clone() + "v1/{+parent}/keys";
5889        if self._scopes.is_empty() {
5890            self._scopes
5891                .insert(Scope::CloudPlatform.as_ref().to_string());
5892        }
5893
5894        #[allow(clippy::single_element_loop)]
5895        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
5896            url = params.uri_replacement(url, param_name, find_this, true);
5897        }
5898        {
5899            let to_remove = ["parent"];
5900            params.remove_params(&to_remove);
5901        }
5902
5903        let url = params.parse_with_url(&url);
5904
5905        let mut json_mime_type = mime::APPLICATION_JSON;
5906        let mut request_value_reader = {
5907            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
5908            common::remove_json_null_values(&mut value);
5909            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
5910            serde_json::to_writer(&mut dst, &value).unwrap();
5911            dst
5912        };
5913        let request_size = request_value_reader
5914            .seek(std::io::SeekFrom::End(0))
5915            .unwrap();
5916        request_value_reader
5917            .seek(std::io::SeekFrom::Start(0))
5918            .unwrap();
5919
5920        loop {
5921            let token = match self
5922                .hub
5923                .auth
5924                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5925                .await
5926            {
5927                Ok(token) => token,
5928                Err(e) => match dlg.token(e) {
5929                    Ok(token) => token,
5930                    Err(e) => {
5931                        dlg.finished(false);
5932                        return Err(common::Error::MissingToken(e));
5933                    }
5934                },
5935            };
5936            request_value_reader
5937                .seek(std::io::SeekFrom::Start(0))
5938                .unwrap();
5939            let mut req_result = {
5940                let client = &self.hub.client;
5941                dlg.pre_request();
5942                let mut req_builder = hyper::Request::builder()
5943                    .method(hyper::Method::POST)
5944                    .uri(url.as_str())
5945                    .header(USER_AGENT, self.hub._user_agent.clone());
5946
5947                if let Some(token) = token.as_ref() {
5948                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5949                }
5950
5951                let request = req_builder
5952                    .header(CONTENT_TYPE, json_mime_type.to_string())
5953                    .header(CONTENT_LENGTH, request_size as u64)
5954                    .body(common::to_body(
5955                        request_value_reader.get_ref().clone().into(),
5956                    ));
5957
5958                client.request(request.unwrap()).await
5959            };
5960
5961            match req_result {
5962                Err(err) => {
5963                    if let common::Retry::After(d) = dlg.http_error(&err) {
5964                        sleep(d).await;
5965                        continue;
5966                    }
5967                    dlg.finished(false);
5968                    return Err(common::Error::HttpError(err));
5969                }
5970                Ok(res) => {
5971                    let (mut parts, body) = res.into_parts();
5972                    let mut body = common::Body::new(body);
5973                    if !parts.status.is_success() {
5974                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5975                        let error = serde_json::from_str(&common::to_string(&bytes));
5976                        let response = common::to_response(parts, bytes.into());
5977
5978                        if let common::Retry::After(d) =
5979                            dlg.http_failure(&response, error.as_ref().ok())
5980                        {
5981                            sleep(d).await;
5982                            continue;
5983                        }
5984
5985                        dlg.finished(false);
5986
5987                        return Err(match error {
5988                            Ok(value) => common::Error::BadRequest(value),
5989                            _ => common::Error::Failure(response),
5990                        });
5991                    }
5992                    let response = {
5993                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5994                        let encoded = common::to_string(&bytes);
5995                        match serde_json::from_str(&encoded) {
5996                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5997                            Err(error) => {
5998                                dlg.response_json_decode_error(&encoded, &error);
5999                                return Err(common::Error::JsonDecodeError(
6000                                    encoded.to_string(),
6001                                    error,
6002                                ));
6003                            }
6004                        }
6005                    };
6006
6007                    dlg.finished(true);
6008                    return Ok(response);
6009                }
6010            }
6011        }
6012    }
6013
6014    ///
6015    /// Sets the *request* property to the given value.
6016    ///
6017    /// Even though the property as already been set when instantiating this call,
6018    /// we provide this method for API completeness.
6019    pub fn request(
6020        mut self,
6021        new_value: WorkforcePoolProviderKey,
6022    ) -> LocationWorkforcePoolProviderKeyCreateCall<'a, C> {
6023        self._request = new_value;
6024        self
6025    }
6026    /// Required. The provider to create this key in.
6027    ///
6028    /// Sets the *parent* path property to the given value.
6029    ///
6030    /// Even though the property as already been set when instantiating this call,
6031    /// we provide this method for API completeness.
6032    pub fn parent(mut self, new_value: &str) -> LocationWorkforcePoolProviderKeyCreateCall<'a, C> {
6033        self._parent = new_value.to_string();
6034        self
6035    }
6036    /// Required. The ID to use for the key, which becomes the final component of the resource name. This value must be 4-32 characters, and may contain the characters [a-z0-9-].
6037    ///
6038    /// Sets the *workforce pool provider key id* query property to the given value.
6039    pub fn workforce_pool_provider_key_id(
6040        mut self,
6041        new_value: &str,
6042    ) -> LocationWorkforcePoolProviderKeyCreateCall<'a, C> {
6043        self._workforce_pool_provider_key_id = Some(new_value.to_string());
6044        self
6045    }
6046    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6047    /// while executing the actual API request.
6048    ///
6049    /// ````text
6050    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
6051    /// ````
6052    ///
6053    /// Sets the *delegate* property to the given value.
6054    pub fn delegate(
6055        mut self,
6056        new_value: &'a mut dyn common::Delegate,
6057    ) -> LocationWorkforcePoolProviderKeyCreateCall<'a, C> {
6058        self._delegate = Some(new_value);
6059        self
6060    }
6061
6062    /// Set any additional parameter of the query string used in the request.
6063    /// It should be used to set parameters which are not yet available through their own
6064    /// setters.
6065    ///
6066    /// Please note that this method must not be used to set any of the known parameters
6067    /// which have their own setter method. If done anyway, the request will fail.
6068    ///
6069    /// # Additional Parameters
6070    ///
6071    /// * *$.xgafv* (query-string) - V1 error format.
6072    /// * *access_token* (query-string) - OAuth access token.
6073    /// * *alt* (query-string) - Data format for response.
6074    /// * *callback* (query-string) - JSONP
6075    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6076    /// * *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.
6077    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6078    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6079    /// * *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.
6080    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6081    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6082    pub fn param<T>(
6083        mut self,
6084        name: T,
6085        value: T,
6086    ) -> LocationWorkforcePoolProviderKeyCreateCall<'a, C>
6087    where
6088        T: AsRef<str>,
6089    {
6090        self._additional_params
6091            .insert(name.as_ref().to_string(), value.as_ref().to_string());
6092        self
6093    }
6094
6095    /// Identifies the authorization scope for the method you are building.
6096    ///
6097    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6098    /// [`Scope::CloudPlatform`].
6099    ///
6100    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6101    /// tokens for more than one scope.
6102    ///
6103    /// Usually there is more than one suitable scope to authorize an operation, some of which may
6104    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6105    /// sufficient, a read-write scope will do as well.
6106    pub fn add_scope<St>(mut self, scope: St) -> LocationWorkforcePoolProviderKeyCreateCall<'a, C>
6107    where
6108        St: AsRef<str>,
6109    {
6110        self._scopes.insert(String::from(scope.as_ref()));
6111        self
6112    }
6113    /// Identifies the authorization scope(s) for the method you are building.
6114    ///
6115    /// See [`Self::add_scope()`] for details.
6116    pub fn add_scopes<I, St>(
6117        mut self,
6118        scopes: I,
6119    ) -> LocationWorkforcePoolProviderKeyCreateCall<'a, C>
6120    where
6121        I: IntoIterator<Item = St>,
6122        St: AsRef<str>,
6123    {
6124        self._scopes
6125            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6126        self
6127    }
6128
6129    /// Removes all scopes, and no default scope will be used either.
6130    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6131    /// for details).
6132    pub fn clear_scopes(mut self) -> LocationWorkforcePoolProviderKeyCreateCall<'a, C> {
6133        self._scopes.clear();
6134        self
6135    }
6136}
6137
6138/// Deletes a WorkforcePoolProviderKey. You can undelete a key for 30 days. After 30 days, deletion is permanent.
6139///
6140/// A builder for the *workforcePools.providers.keys.delete* method supported by a *location* resource.
6141/// It is not used directly, but through a [`LocationMethods`] instance.
6142///
6143/// # Example
6144///
6145/// Instantiate a resource method builder
6146///
6147/// ```test_harness,no_run
6148/// # extern crate hyper;
6149/// # extern crate hyper_rustls;
6150/// # extern crate google_iam1 as iam1;
6151/// # async fn dox() {
6152/// # use iam1::{Iam, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6153///
6154/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6155/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
6156/// #     secret,
6157/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6158/// # ).build().await.unwrap();
6159///
6160/// # let client = hyper_util::client::legacy::Client::builder(
6161/// #     hyper_util::rt::TokioExecutor::new()
6162/// # )
6163/// # .build(
6164/// #     hyper_rustls::HttpsConnectorBuilder::new()
6165/// #         .with_native_roots()
6166/// #         .unwrap()
6167/// #         .https_or_http()
6168/// #         .enable_http1()
6169/// #         .build()
6170/// # );
6171/// # let mut hub = Iam::new(client, auth);
6172/// // You can configure optional parameters by calling the respective setters at will, and
6173/// // execute the final call using `doit()`.
6174/// // Values shown here are possibly random and not representative !
6175/// let result = hub.locations().workforce_pools_providers_keys_delete("name")
6176///              .doit().await;
6177/// # }
6178/// ```
6179pub struct LocationWorkforcePoolProviderKeyDeleteCall<'a, C>
6180where
6181    C: 'a,
6182{
6183    hub: &'a Iam<C>,
6184    _name: String,
6185    _delegate: Option<&'a mut dyn common::Delegate>,
6186    _additional_params: HashMap<String, String>,
6187    _scopes: BTreeSet<String>,
6188}
6189
6190impl<'a, C> common::CallBuilder for LocationWorkforcePoolProviderKeyDeleteCall<'a, C> {}
6191
6192impl<'a, C> LocationWorkforcePoolProviderKeyDeleteCall<'a, C>
6193where
6194    C: common::Connector,
6195{
6196    /// Perform the operation you have build so far.
6197    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
6198        use std::borrow::Cow;
6199        use std::io::{Read, Seek};
6200
6201        use common::{url::Params, ToParts};
6202        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6203
6204        let mut dd = common::DefaultDelegate;
6205        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6206        dlg.begin(common::MethodInfo {
6207            id: "iam.locations.workforcePools.providers.keys.delete",
6208            http_method: hyper::Method::DELETE,
6209        });
6210
6211        for &field in ["alt", "name"].iter() {
6212            if self._additional_params.contains_key(field) {
6213                dlg.finished(false);
6214                return Err(common::Error::FieldClash(field));
6215            }
6216        }
6217
6218        let mut params = Params::with_capacity(3 + self._additional_params.len());
6219        params.push("name", self._name);
6220
6221        params.extend(self._additional_params.iter());
6222
6223        params.push("alt", "json");
6224        let mut url = self.hub._base_url.clone() + "v1/{+name}";
6225        if self._scopes.is_empty() {
6226            self._scopes
6227                .insert(Scope::CloudPlatform.as_ref().to_string());
6228        }
6229
6230        #[allow(clippy::single_element_loop)]
6231        for &(find_this, param_name) in [("{+name}", "name")].iter() {
6232            url = params.uri_replacement(url, param_name, find_this, true);
6233        }
6234        {
6235            let to_remove = ["name"];
6236            params.remove_params(&to_remove);
6237        }
6238
6239        let url = params.parse_with_url(&url);
6240
6241        loop {
6242            let token = match self
6243                .hub
6244                .auth
6245                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6246                .await
6247            {
6248                Ok(token) => token,
6249                Err(e) => match dlg.token(e) {
6250                    Ok(token) => token,
6251                    Err(e) => {
6252                        dlg.finished(false);
6253                        return Err(common::Error::MissingToken(e));
6254                    }
6255                },
6256            };
6257            let mut req_result = {
6258                let client = &self.hub.client;
6259                dlg.pre_request();
6260                let mut req_builder = hyper::Request::builder()
6261                    .method(hyper::Method::DELETE)
6262                    .uri(url.as_str())
6263                    .header(USER_AGENT, self.hub._user_agent.clone());
6264
6265                if let Some(token) = token.as_ref() {
6266                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6267                }
6268
6269                let request = req_builder
6270                    .header(CONTENT_LENGTH, 0_u64)
6271                    .body(common::to_body::<String>(None));
6272
6273                client.request(request.unwrap()).await
6274            };
6275
6276            match req_result {
6277                Err(err) => {
6278                    if let common::Retry::After(d) = dlg.http_error(&err) {
6279                        sleep(d).await;
6280                        continue;
6281                    }
6282                    dlg.finished(false);
6283                    return Err(common::Error::HttpError(err));
6284                }
6285                Ok(res) => {
6286                    let (mut parts, body) = res.into_parts();
6287                    let mut body = common::Body::new(body);
6288                    if !parts.status.is_success() {
6289                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6290                        let error = serde_json::from_str(&common::to_string(&bytes));
6291                        let response = common::to_response(parts, bytes.into());
6292
6293                        if let common::Retry::After(d) =
6294                            dlg.http_failure(&response, error.as_ref().ok())
6295                        {
6296                            sleep(d).await;
6297                            continue;
6298                        }
6299
6300                        dlg.finished(false);
6301
6302                        return Err(match error {
6303                            Ok(value) => common::Error::BadRequest(value),
6304                            _ => common::Error::Failure(response),
6305                        });
6306                    }
6307                    let response = {
6308                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6309                        let encoded = common::to_string(&bytes);
6310                        match serde_json::from_str(&encoded) {
6311                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6312                            Err(error) => {
6313                                dlg.response_json_decode_error(&encoded, &error);
6314                                return Err(common::Error::JsonDecodeError(
6315                                    encoded.to_string(),
6316                                    error,
6317                                ));
6318                            }
6319                        }
6320                    };
6321
6322                    dlg.finished(true);
6323                    return Ok(response);
6324                }
6325            }
6326        }
6327    }
6328
6329    /// Required. The name of the key to delete.
6330    ///
6331    /// Sets the *name* path property to the given value.
6332    ///
6333    /// Even though the property as already been set when instantiating this call,
6334    /// we provide this method for API completeness.
6335    pub fn name(mut self, new_value: &str) -> LocationWorkforcePoolProviderKeyDeleteCall<'a, C> {
6336        self._name = new_value.to_string();
6337        self
6338    }
6339    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6340    /// while executing the actual API request.
6341    ///
6342    /// ````text
6343    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
6344    /// ````
6345    ///
6346    /// Sets the *delegate* property to the given value.
6347    pub fn delegate(
6348        mut self,
6349        new_value: &'a mut dyn common::Delegate,
6350    ) -> LocationWorkforcePoolProviderKeyDeleteCall<'a, C> {
6351        self._delegate = Some(new_value);
6352        self
6353    }
6354
6355    /// Set any additional parameter of the query string used in the request.
6356    /// It should be used to set parameters which are not yet available through their own
6357    /// setters.
6358    ///
6359    /// Please note that this method must not be used to set any of the known parameters
6360    /// which have their own setter method. If done anyway, the request will fail.
6361    ///
6362    /// # Additional Parameters
6363    ///
6364    /// * *$.xgafv* (query-string) - V1 error format.
6365    /// * *access_token* (query-string) - OAuth access token.
6366    /// * *alt* (query-string) - Data format for response.
6367    /// * *callback* (query-string) - JSONP
6368    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6369    /// * *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.
6370    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6371    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6372    /// * *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.
6373    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6374    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6375    pub fn param<T>(
6376        mut self,
6377        name: T,
6378        value: T,
6379    ) -> LocationWorkforcePoolProviderKeyDeleteCall<'a, C>
6380    where
6381        T: AsRef<str>,
6382    {
6383        self._additional_params
6384            .insert(name.as_ref().to_string(), value.as_ref().to_string());
6385        self
6386    }
6387
6388    /// Identifies the authorization scope for the method you are building.
6389    ///
6390    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6391    /// [`Scope::CloudPlatform`].
6392    ///
6393    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6394    /// tokens for more than one scope.
6395    ///
6396    /// Usually there is more than one suitable scope to authorize an operation, some of which may
6397    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6398    /// sufficient, a read-write scope will do as well.
6399    pub fn add_scope<St>(mut self, scope: St) -> LocationWorkforcePoolProviderKeyDeleteCall<'a, C>
6400    where
6401        St: AsRef<str>,
6402    {
6403        self._scopes.insert(String::from(scope.as_ref()));
6404        self
6405    }
6406    /// Identifies the authorization scope(s) for the method you are building.
6407    ///
6408    /// See [`Self::add_scope()`] for details.
6409    pub fn add_scopes<I, St>(
6410        mut self,
6411        scopes: I,
6412    ) -> LocationWorkforcePoolProviderKeyDeleteCall<'a, C>
6413    where
6414        I: IntoIterator<Item = St>,
6415        St: AsRef<str>,
6416    {
6417        self._scopes
6418            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6419        self
6420    }
6421
6422    /// Removes all scopes, and no default scope will be used either.
6423    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6424    /// for details).
6425    pub fn clear_scopes(mut self) -> LocationWorkforcePoolProviderKeyDeleteCall<'a, C> {
6426        self._scopes.clear();
6427        self
6428    }
6429}
6430
6431/// Gets a WorkforcePoolProviderKey.
6432///
6433/// A builder for the *workforcePools.providers.keys.get* method supported by a *location* resource.
6434/// It is not used directly, but through a [`LocationMethods`] instance.
6435///
6436/// # Example
6437///
6438/// Instantiate a resource method builder
6439///
6440/// ```test_harness,no_run
6441/// # extern crate hyper;
6442/// # extern crate hyper_rustls;
6443/// # extern crate google_iam1 as iam1;
6444/// # async fn dox() {
6445/// # use iam1::{Iam, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6446///
6447/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6448/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
6449/// #     secret,
6450/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6451/// # ).build().await.unwrap();
6452///
6453/// # let client = hyper_util::client::legacy::Client::builder(
6454/// #     hyper_util::rt::TokioExecutor::new()
6455/// # )
6456/// # .build(
6457/// #     hyper_rustls::HttpsConnectorBuilder::new()
6458/// #         .with_native_roots()
6459/// #         .unwrap()
6460/// #         .https_or_http()
6461/// #         .enable_http1()
6462/// #         .build()
6463/// # );
6464/// # let mut hub = Iam::new(client, auth);
6465/// // You can configure optional parameters by calling the respective setters at will, and
6466/// // execute the final call using `doit()`.
6467/// // Values shown here are possibly random and not representative !
6468/// let result = hub.locations().workforce_pools_providers_keys_get("name")
6469///              .doit().await;
6470/// # }
6471/// ```
6472pub struct LocationWorkforcePoolProviderKeyGetCall<'a, C>
6473where
6474    C: 'a,
6475{
6476    hub: &'a Iam<C>,
6477    _name: String,
6478    _delegate: Option<&'a mut dyn common::Delegate>,
6479    _additional_params: HashMap<String, String>,
6480    _scopes: BTreeSet<String>,
6481}
6482
6483impl<'a, C> common::CallBuilder for LocationWorkforcePoolProviderKeyGetCall<'a, C> {}
6484
6485impl<'a, C> LocationWorkforcePoolProviderKeyGetCall<'a, C>
6486where
6487    C: common::Connector,
6488{
6489    /// Perform the operation you have build so far.
6490    pub async fn doit(mut self) -> common::Result<(common::Response, WorkforcePoolProviderKey)> {
6491        use std::borrow::Cow;
6492        use std::io::{Read, Seek};
6493
6494        use common::{url::Params, ToParts};
6495        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6496
6497        let mut dd = common::DefaultDelegate;
6498        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6499        dlg.begin(common::MethodInfo {
6500            id: "iam.locations.workforcePools.providers.keys.get",
6501            http_method: hyper::Method::GET,
6502        });
6503
6504        for &field in ["alt", "name"].iter() {
6505            if self._additional_params.contains_key(field) {
6506                dlg.finished(false);
6507                return Err(common::Error::FieldClash(field));
6508            }
6509        }
6510
6511        let mut params = Params::with_capacity(3 + self._additional_params.len());
6512        params.push("name", self._name);
6513
6514        params.extend(self._additional_params.iter());
6515
6516        params.push("alt", "json");
6517        let mut url = self.hub._base_url.clone() + "v1/{+name}";
6518        if self._scopes.is_empty() {
6519            self._scopes
6520                .insert(Scope::CloudPlatform.as_ref().to_string());
6521        }
6522
6523        #[allow(clippy::single_element_loop)]
6524        for &(find_this, param_name) in [("{+name}", "name")].iter() {
6525            url = params.uri_replacement(url, param_name, find_this, true);
6526        }
6527        {
6528            let to_remove = ["name"];
6529            params.remove_params(&to_remove);
6530        }
6531
6532        let url = params.parse_with_url(&url);
6533
6534        loop {
6535            let token = match self
6536                .hub
6537                .auth
6538                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6539                .await
6540            {
6541                Ok(token) => token,
6542                Err(e) => match dlg.token(e) {
6543                    Ok(token) => token,
6544                    Err(e) => {
6545                        dlg.finished(false);
6546                        return Err(common::Error::MissingToken(e));
6547                    }
6548                },
6549            };
6550            let mut req_result = {
6551                let client = &self.hub.client;
6552                dlg.pre_request();
6553                let mut req_builder = hyper::Request::builder()
6554                    .method(hyper::Method::GET)
6555                    .uri(url.as_str())
6556                    .header(USER_AGENT, self.hub._user_agent.clone());
6557
6558                if let Some(token) = token.as_ref() {
6559                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6560                }
6561
6562                let request = req_builder
6563                    .header(CONTENT_LENGTH, 0_u64)
6564                    .body(common::to_body::<String>(None));
6565
6566                client.request(request.unwrap()).await
6567            };
6568
6569            match req_result {
6570                Err(err) => {
6571                    if let common::Retry::After(d) = dlg.http_error(&err) {
6572                        sleep(d).await;
6573                        continue;
6574                    }
6575                    dlg.finished(false);
6576                    return Err(common::Error::HttpError(err));
6577                }
6578                Ok(res) => {
6579                    let (mut parts, body) = res.into_parts();
6580                    let mut body = common::Body::new(body);
6581                    if !parts.status.is_success() {
6582                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6583                        let error = serde_json::from_str(&common::to_string(&bytes));
6584                        let response = common::to_response(parts, bytes.into());
6585
6586                        if let common::Retry::After(d) =
6587                            dlg.http_failure(&response, error.as_ref().ok())
6588                        {
6589                            sleep(d).await;
6590                            continue;
6591                        }
6592
6593                        dlg.finished(false);
6594
6595                        return Err(match error {
6596                            Ok(value) => common::Error::BadRequest(value),
6597                            _ => common::Error::Failure(response),
6598                        });
6599                    }
6600                    let response = {
6601                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6602                        let encoded = common::to_string(&bytes);
6603                        match serde_json::from_str(&encoded) {
6604                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6605                            Err(error) => {
6606                                dlg.response_json_decode_error(&encoded, &error);
6607                                return Err(common::Error::JsonDecodeError(
6608                                    encoded.to_string(),
6609                                    error,
6610                                ));
6611                            }
6612                        }
6613                    };
6614
6615                    dlg.finished(true);
6616                    return Ok(response);
6617                }
6618            }
6619        }
6620    }
6621
6622    /// Required. The name of the key to retrieve.
6623    ///
6624    /// Sets the *name* path property to the given value.
6625    ///
6626    /// Even though the property as already been set when instantiating this call,
6627    /// we provide this method for API completeness.
6628    pub fn name(mut self, new_value: &str) -> LocationWorkforcePoolProviderKeyGetCall<'a, C> {
6629        self._name = new_value.to_string();
6630        self
6631    }
6632    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6633    /// while executing the actual API request.
6634    ///
6635    /// ````text
6636    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
6637    /// ````
6638    ///
6639    /// Sets the *delegate* property to the given value.
6640    pub fn delegate(
6641        mut self,
6642        new_value: &'a mut dyn common::Delegate,
6643    ) -> LocationWorkforcePoolProviderKeyGetCall<'a, C> {
6644        self._delegate = Some(new_value);
6645        self
6646    }
6647
6648    /// Set any additional parameter of the query string used in the request.
6649    /// It should be used to set parameters which are not yet available through their own
6650    /// setters.
6651    ///
6652    /// Please note that this method must not be used to set any of the known parameters
6653    /// which have their own setter method. If done anyway, the request will fail.
6654    ///
6655    /// # Additional Parameters
6656    ///
6657    /// * *$.xgafv* (query-string) - V1 error format.
6658    /// * *access_token* (query-string) - OAuth access token.
6659    /// * *alt* (query-string) - Data format for response.
6660    /// * *callback* (query-string) - JSONP
6661    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6662    /// * *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.
6663    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6664    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6665    /// * *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.
6666    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6667    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6668    pub fn param<T>(mut self, name: T, value: T) -> LocationWorkforcePoolProviderKeyGetCall<'a, C>
6669    where
6670        T: AsRef<str>,
6671    {
6672        self._additional_params
6673            .insert(name.as_ref().to_string(), value.as_ref().to_string());
6674        self
6675    }
6676
6677    /// Identifies the authorization scope for the method you are building.
6678    ///
6679    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6680    /// [`Scope::CloudPlatform`].
6681    ///
6682    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6683    /// tokens for more than one scope.
6684    ///
6685    /// Usually there is more than one suitable scope to authorize an operation, some of which may
6686    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6687    /// sufficient, a read-write scope will do as well.
6688    pub fn add_scope<St>(mut self, scope: St) -> LocationWorkforcePoolProviderKeyGetCall<'a, C>
6689    where
6690        St: AsRef<str>,
6691    {
6692        self._scopes.insert(String::from(scope.as_ref()));
6693        self
6694    }
6695    /// Identifies the authorization scope(s) for the method you are building.
6696    ///
6697    /// See [`Self::add_scope()`] for details.
6698    pub fn add_scopes<I, St>(mut self, scopes: I) -> LocationWorkforcePoolProviderKeyGetCall<'a, C>
6699    where
6700        I: IntoIterator<Item = St>,
6701        St: AsRef<str>,
6702    {
6703        self._scopes
6704            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6705        self
6706    }
6707
6708    /// Removes all scopes, and no default scope will be used either.
6709    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6710    /// for details).
6711    pub fn clear_scopes(mut self) -> LocationWorkforcePoolProviderKeyGetCall<'a, C> {
6712        self._scopes.clear();
6713        self
6714    }
6715}
6716
6717/// Lists all non-deleted WorkforcePoolProviderKeys in a WorkforcePoolProvider. If `show_deleted` is set to `true`, then deleted keys are also listed.
6718///
6719/// A builder for the *workforcePools.providers.keys.list* method supported by a *location* resource.
6720/// It is not used directly, but through a [`LocationMethods`] instance.
6721///
6722/// # Example
6723///
6724/// Instantiate a resource method builder
6725///
6726/// ```test_harness,no_run
6727/// # extern crate hyper;
6728/// # extern crate hyper_rustls;
6729/// # extern crate google_iam1 as iam1;
6730/// # async fn dox() {
6731/// # use iam1::{Iam, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6732///
6733/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6734/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
6735/// #     secret,
6736/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6737/// # ).build().await.unwrap();
6738///
6739/// # let client = hyper_util::client::legacy::Client::builder(
6740/// #     hyper_util::rt::TokioExecutor::new()
6741/// # )
6742/// # .build(
6743/// #     hyper_rustls::HttpsConnectorBuilder::new()
6744/// #         .with_native_roots()
6745/// #         .unwrap()
6746/// #         .https_or_http()
6747/// #         .enable_http1()
6748/// #         .build()
6749/// # );
6750/// # let mut hub = Iam::new(client, auth);
6751/// // You can configure optional parameters by calling the respective setters at will, and
6752/// // execute the final call using `doit()`.
6753/// // Values shown here are possibly random and not representative !
6754/// let result = hub.locations().workforce_pools_providers_keys_list("parent")
6755///              .show_deleted(true)
6756///              .page_token("Lorem")
6757///              .page_size(-12)
6758///              .doit().await;
6759/// # }
6760/// ```
6761pub struct LocationWorkforcePoolProviderKeyListCall<'a, C>
6762where
6763    C: 'a,
6764{
6765    hub: &'a Iam<C>,
6766    _parent: String,
6767    _show_deleted: Option<bool>,
6768    _page_token: Option<String>,
6769    _page_size: Option<i32>,
6770    _delegate: Option<&'a mut dyn common::Delegate>,
6771    _additional_params: HashMap<String, String>,
6772    _scopes: BTreeSet<String>,
6773}
6774
6775impl<'a, C> common::CallBuilder for LocationWorkforcePoolProviderKeyListCall<'a, C> {}
6776
6777impl<'a, C> LocationWorkforcePoolProviderKeyListCall<'a, C>
6778where
6779    C: common::Connector,
6780{
6781    /// Perform the operation you have build so far.
6782    pub async fn doit(
6783        mut self,
6784    ) -> common::Result<(common::Response, ListWorkforcePoolProviderKeysResponse)> {
6785        use std::borrow::Cow;
6786        use std::io::{Read, Seek};
6787
6788        use common::{url::Params, ToParts};
6789        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6790
6791        let mut dd = common::DefaultDelegate;
6792        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6793        dlg.begin(common::MethodInfo {
6794            id: "iam.locations.workforcePools.providers.keys.list",
6795            http_method: hyper::Method::GET,
6796        });
6797
6798        for &field in ["alt", "parent", "showDeleted", "pageToken", "pageSize"].iter() {
6799            if self._additional_params.contains_key(field) {
6800                dlg.finished(false);
6801                return Err(common::Error::FieldClash(field));
6802            }
6803        }
6804
6805        let mut params = Params::with_capacity(6 + self._additional_params.len());
6806        params.push("parent", self._parent);
6807        if let Some(value) = self._show_deleted.as_ref() {
6808            params.push("showDeleted", value.to_string());
6809        }
6810        if let Some(value) = self._page_token.as_ref() {
6811            params.push("pageToken", value);
6812        }
6813        if let Some(value) = self._page_size.as_ref() {
6814            params.push("pageSize", value.to_string());
6815        }
6816
6817        params.extend(self._additional_params.iter());
6818
6819        params.push("alt", "json");
6820        let mut url = self.hub._base_url.clone() + "v1/{+parent}/keys";
6821        if self._scopes.is_empty() {
6822            self._scopes
6823                .insert(Scope::CloudPlatform.as_ref().to_string());
6824        }
6825
6826        #[allow(clippy::single_element_loop)]
6827        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
6828            url = params.uri_replacement(url, param_name, find_this, true);
6829        }
6830        {
6831            let to_remove = ["parent"];
6832            params.remove_params(&to_remove);
6833        }
6834
6835        let url = params.parse_with_url(&url);
6836
6837        loop {
6838            let token = match self
6839                .hub
6840                .auth
6841                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6842                .await
6843            {
6844                Ok(token) => token,
6845                Err(e) => match dlg.token(e) {
6846                    Ok(token) => token,
6847                    Err(e) => {
6848                        dlg.finished(false);
6849                        return Err(common::Error::MissingToken(e));
6850                    }
6851                },
6852            };
6853            let mut req_result = {
6854                let client = &self.hub.client;
6855                dlg.pre_request();
6856                let mut req_builder = hyper::Request::builder()
6857                    .method(hyper::Method::GET)
6858                    .uri(url.as_str())
6859                    .header(USER_AGENT, self.hub._user_agent.clone());
6860
6861                if let Some(token) = token.as_ref() {
6862                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6863                }
6864
6865                let request = req_builder
6866                    .header(CONTENT_LENGTH, 0_u64)
6867                    .body(common::to_body::<String>(None));
6868
6869                client.request(request.unwrap()).await
6870            };
6871
6872            match req_result {
6873                Err(err) => {
6874                    if let common::Retry::After(d) = dlg.http_error(&err) {
6875                        sleep(d).await;
6876                        continue;
6877                    }
6878                    dlg.finished(false);
6879                    return Err(common::Error::HttpError(err));
6880                }
6881                Ok(res) => {
6882                    let (mut parts, body) = res.into_parts();
6883                    let mut body = common::Body::new(body);
6884                    if !parts.status.is_success() {
6885                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6886                        let error = serde_json::from_str(&common::to_string(&bytes));
6887                        let response = common::to_response(parts, bytes.into());
6888
6889                        if let common::Retry::After(d) =
6890                            dlg.http_failure(&response, error.as_ref().ok())
6891                        {
6892                            sleep(d).await;
6893                            continue;
6894                        }
6895
6896                        dlg.finished(false);
6897
6898                        return Err(match error {
6899                            Ok(value) => common::Error::BadRequest(value),
6900                            _ => common::Error::Failure(response),
6901                        });
6902                    }
6903                    let response = {
6904                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6905                        let encoded = common::to_string(&bytes);
6906                        match serde_json::from_str(&encoded) {
6907                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6908                            Err(error) => {
6909                                dlg.response_json_decode_error(&encoded, &error);
6910                                return Err(common::Error::JsonDecodeError(
6911                                    encoded.to_string(),
6912                                    error,
6913                                ));
6914                            }
6915                        }
6916                    };
6917
6918                    dlg.finished(true);
6919                    return Ok(response);
6920                }
6921            }
6922        }
6923    }
6924
6925    /// Required. The provider resource to list encryption keys for. Format: `locations/{location}/workforcePools/{workforce_pool_id}/providers/{provider_id}`
6926    ///
6927    /// Sets the *parent* path property to the given value.
6928    ///
6929    /// Even though the property as already been set when instantiating this call,
6930    /// we provide this method for API completeness.
6931    pub fn parent(mut self, new_value: &str) -> LocationWorkforcePoolProviderKeyListCall<'a, C> {
6932        self._parent = new_value.to_string();
6933        self
6934    }
6935    /// Whether to return soft-deleted keys.
6936    ///
6937    /// Sets the *show deleted* query property to the given value.
6938    pub fn show_deleted(
6939        mut self,
6940        new_value: bool,
6941    ) -> LocationWorkforcePoolProviderKeyListCall<'a, C> {
6942        self._show_deleted = Some(new_value);
6943        self
6944    }
6945    /// A page token, received from a previous `ListWorkforcePoolProviderKeys` call. Provide this to retrieve the subsequent page.
6946    ///
6947    /// Sets the *page token* query property to the given value.
6948    pub fn page_token(
6949        mut self,
6950        new_value: &str,
6951    ) -> LocationWorkforcePoolProviderKeyListCall<'a, C> {
6952        self._page_token = Some(new_value.to_string());
6953        self
6954    }
6955    /// The maximum number of keys to return. If unspecified, all keys are returned. The maximum value is 10; values above 10 are truncated to 10.
6956    ///
6957    /// Sets the *page size* query property to the given value.
6958    pub fn page_size(mut self, new_value: i32) -> LocationWorkforcePoolProviderKeyListCall<'a, C> {
6959        self._page_size = Some(new_value);
6960        self
6961    }
6962    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6963    /// while executing the actual API request.
6964    ///
6965    /// ````text
6966    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
6967    /// ````
6968    ///
6969    /// Sets the *delegate* property to the given value.
6970    pub fn delegate(
6971        mut self,
6972        new_value: &'a mut dyn common::Delegate,
6973    ) -> LocationWorkforcePoolProviderKeyListCall<'a, C> {
6974        self._delegate = Some(new_value);
6975        self
6976    }
6977
6978    /// Set any additional parameter of the query string used in the request.
6979    /// It should be used to set parameters which are not yet available through their own
6980    /// setters.
6981    ///
6982    /// Please note that this method must not be used to set any of the known parameters
6983    /// which have their own setter method. If done anyway, the request will fail.
6984    ///
6985    /// # Additional Parameters
6986    ///
6987    /// * *$.xgafv* (query-string) - V1 error format.
6988    /// * *access_token* (query-string) - OAuth access token.
6989    /// * *alt* (query-string) - Data format for response.
6990    /// * *callback* (query-string) - JSONP
6991    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6992    /// * *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.
6993    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6994    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6995    /// * *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.
6996    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6997    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6998    pub fn param<T>(mut self, name: T, value: T) -> LocationWorkforcePoolProviderKeyListCall<'a, C>
6999    where
7000        T: AsRef<str>,
7001    {
7002        self._additional_params
7003            .insert(name.as_ref().to_string(), value.as_ref().to_string());
7004        self
7005    }
7006
7007    /// Identifies the authorization scope for the method you are building.
7008    ///
7009    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7010    /// [`Scope::CloudPlatform`].
7011    ///
7012    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7013    /// tokens for more than one scope.
7014    ///
7015    /// Usually there is more than one suitable scope to authorize an operation, some of which may
7016    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7017    /// sufficient, a read-write scope will do as well.
7018    pub fn add_scope<St>(mut self, scope: St) -> LocationWorkforcePoolProviderKeyListCall<'a, C>
7019    where
7020        St: AsRef<str>,
7021    {
7022        self._scopes.insert(String::from(scope.as_ref()));
7023        self
7024    }
7025    /// Identifies the authorization scope(s) for the method you are building.
7026    ///
7027    /// See [`Self::add_scope()`] for details.
7028    pub fn add_scopes<I, St>(mut self, scopes: I) -> LocationWorkforcePoolProviderKeyListCall<'a, C>
7029    where
7030        I: IntoIterator<Item = St>,
7031        St: AsRef<str>,
7032    {
7033        self._scopes
7034            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7035        self
7036    }
7037
7038    /// Removes all scopes, and no default scope will be used either.
7039    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7040    /// for details).
7041    pub fn clear_scopes(mut self) -> LocationWorkforcePoolProviderKeyListCall<'a, C> {
7042        self._scopes.clear();
7043        self
7044    }
7045}
7046
7047/// Undeletes a WorkforcePoolProviderKey, as long as it was deleted fewer than 30 days ago.
7048///
7049/// A builder for the *workforcePools.providers.keys.undelete* method supported by a *location* resource.
7050/// It is not used directly, but through a [`LocationMethods`] instance.
7051///
7052/// # Example
7053///
7054/// Instantiate a resource method builder
7055///
7056/// ```test_harness,no_run
7057/// # extern crate hyper;
7058/// # extern crate hyper_rustls;
7059/// # extern crate google_iam1 as iam1;
7060/// use iam1::api::UndeleteWorkforcePoolProviderKeyRequest;
7061/// # async fn dox() {
7062/// # use iam1::{Iam, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7063///
7064/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7065/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
7066/// #     secret,
7067/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7068/// # ).build().await.unwrap();
7069///
7070/// # let client = hyper_util::client::legacy::Client::builder(
7071/// #     hyper_util::rt::TokioExecutor::new()
7072/// # )
7073/// # .build(
7074/// #     hyper_rustls::HttpsConnectorBuilder::new()
7075/// #         .with_native_roots()
7076/// #         .unwrap()
7077/// #         .https_or_http()
7078/// #         .enable_http1()
7079/// #         .build()
7080/// # );
7081/// # let mut hub = Iam::new(client, auth);
7082/// // As the method needs a request, you would usually fill it with the desired information
7083/// // into the respective structure. Some of the parts shown here might not be applicable !
7084/// // Values shown here are possibly random and not representative !
7085/// let mut req = UndeleteWorkforcePoolProviderKeyRequest::default();
7086///
7087/// // You can configure optional parameters by calling the respective setters at will, and
7088/// // execute the final call using `doit()`.
7089/// // Values shown here are possibly random and not representative !
7090/// let result = hub.locations().workforce_pools_providers_keys_undelete(req, "name")
7091///              .doit().await;
7092/// # }
7093/// ```
7094pub struct LocationWorkforcePoolProviderKeyUndeleteCall<'a, C>
7095where
7096    C: 'a,
7097{
7098    hub: &'a Iam<C>,
7099    _request: UndeleteWorkforcePoolProviderKeyRequest,
7100    _name: String,
7101    _delegate: Option<&'a mut dyn common::Delegate>,
7102    _additional_params: HashMap<String, String>,
7103    _scopes: BTreeSet<String>,
7104}
7105
7106impl<'a, C> common::CallBuilder for LocationWorkforcePoolProviderKeyUndeleteCall<'a, C> {}
7107
7108impl<'a, C> LocationWorkforcePoolProviderKeyUndeleteCall<'a, C>
7109where
7110    C: common::Connector,
7111{
7112    /// Perform the operation you have build so far.
7113    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
7114        use std::borrow::Cow;
7115        use std::io::{Read, Seek};
7116
7117        use common::{url::Params, ToParts};
7118        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7119
7120        let mut dd = common::DefaultDelegate;
7121        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7122        dlg.begin(common::MethodInfo {
7123            id: "iam.locations.workforcePools.providers.keys.undelete",
7124            http_method: hyper::Method::POST,
7125        });
7126
7127        for &field in ["alt", "name"].iter() {
7128            if self._additional_params.contains_key(field) {
7129                dlg.finished(false);
7130                return Err(common::Error::FieldClash(field));
7131            }
7132        }
7133
7134        let mut params = Params::with_capacity(4 + self._additional_params.len());
7135        params.push("name", self._name);
7136
7137        params.extend(self._additional_params.iter());
7138
7139        params.push("alt", "json");
7140        let mut url = self.hub._base_url.clone() + "v1/{+name}:undelete";
7141        if self._scopes.is_empty() {
7142            self._scopes
7143                .insert(Scope::CloudPlatform.as_ref().to_string());
7144        }
7145
7146        #[allow(clippy::single_element_loop)]
7147        for &(find_this, param_name) in [("{+name}", "name")].iter() {
7148            url = params.uri_replacement(url, param_name, find_this, true);
7149        }
7150        {
7151            let to_remove = ["name"];
7152            params.remove_params(&to_remove);
7153        }
7154
7155        let url = params.parse_with_url(&url);
7156
7157        let mut json_mime_type = mime::APPLICATION_JSON;
7158        let mut request_value_reader = {
7159            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
7160            common::remove_json_null_values(&mut value);
7161            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
7162            serde_json::to_writer(&mut dst, &value).unwrap();
7163            dst
7164        };
7165        let request_size = request_value_reader
7166            .seek(std::io::SeekFrom::End(0))
7167            .unwrap();
7168        request_value_reader
7169            .seek(std::io::SeekFrom::Start(0))
7170            .unwrap();
7171
7172        loop {
7173            let token = match self
7174                .hub
7175                .auth
7176                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
7177                .await
7178            {
7179                Ok(token) => token,
7180                Err(e) => match dlg.token(e) {
7181                    Ok(token) => token,
7182                    Err(e) => {
7183                        dlg.finished(false);
7184                        return Err(common::Error::MissingToken(e));
7185                    }
7186                },
7187            };
7188            request_value_reader
7189                .seek(std::io::SeekFrom::Start(0))
7190                .unwrap();
7191            let mut req_result = {
7192                let client = &self.hub.client;
7193                dlg.pre_request();
7194                let mut req_builder = hyper::Request::builder()
7195                    .method(hyper::Method::POST)
7196                    .uri(url.as_str())
7197                    .header(USER_AGENT, self.hub._user_agent.clone());
7198
7199                if let Some(token) = token.as_ref() {
7200                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7201                }
7202
7203                let request = req_builder
7204                    .header(CONTENT_TYPE, json_mime_type.to_string())
7205                    .header(CONTENT_LENGTH, request_size as u64)
7206                    .body(common::to_body(
7207                        request_value_reader.get_ref().clone().into(),
7208                    ));
7209
7210                client.request(request.unwrap()).await
7211            };
7212
7213            match req_result {
7214                Err(err) => {
7215                    if let common::Retry::After(d) = dlg.http_error(&err) {
7216                        sleep(d).await;
7217                        continue;
7218                    }
7219                    dlg.finished(false);
7220                    return Err(common::Error::HttpError(err));
7221                }
7222                Ok(res) => {
7223                    let (mut parts, body) = res.into_parts();
7224                    let mut body = common::Body::new(body);
7225                    if !parts.status.is_success() {
7226                        let bytes = common::to_bytes(body).await.unwrap_or_default();
7227                        let error = serde_json::from_str(&common::to_string(&bytes));
7228                        let response = common::to_response(parts, bytes.into());
7229
7230                        if let common::Retry::After(d) =
7231                            dlg.http_failure(&response, error.as_ref().ok())
7232                        {
7233                            sleep(d).await;
7234                            continue;
7235                        }
7236
7237                        dlg.finished(false);
7238
7239                        return Err(match error {
7240                            Ok(value) => common::Error::BadRequest(value),
7241                            _ => common::Error::Failure(response),
7242                        });
7243                    }
7244                    let response = {
7245                        let bytes = common::to_bytes(body).await.unwrap_or_default();
7246                        let encoded = common::to_string(&bytes);
7247                        match serde_json::from_str(&encoded) {
7248                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
7249                            Err(error) => {
7250                                dlg.response_json_decode_error(&encoded, &error);
7251                                return Err(common::Error::JsonDecodeError(
7252                                    encoded.to_string(),
7253                                    error,
7254                                ));
7255                            }
7256                        }
7257                    };
7258
7259                    dlg.finished(true);
7260                    return Ok(response);
7261                }
7262            }
7263        }
7264    }
7265
7266    ///
7267    /// Sets the *request* property to the given value.
7268    ///
7269    /// Even though the property as already been set when instantiating this call,
7270    /// we provide this method for API completeness.
7271    pub fn request(
7272        mut self,
7273        new_value: UndeleteWorkforcePoolProviderKeyRequest,
7274    ) -> LocationWorkforcePoolProviderKeyUndeleteCall<'a, C> {
7275        self._request = new_value;
7276        self
7277    }
7278    /// Required. The name of the key to undelete.
7279    ///
7280    /// Sets the *name* path property to the given value.
7281    ///
7282    /// Even though the property as already been set when instantiating this call,
7283    /// we provide this method for API completeness.
7284    pub fn name(mut self, new_value: &str) -> LocationWorkforcePoolProviderKeyUndeleteCall<'a, C> {
7285        self._name = new_value.to_string();
7286        self
7287    }
7288    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7289    /// while executing the actual API request.
7290    ///
7291    /// ````text
7292    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
7293    /// ````
7294    ///
7295    /// Sets the *delegate* property to the given value.
7296    pub fn delegate(
7297        mut self,
7298        new_value: &'a mut dyn common::Delegate,
7299    ) -> LocationWorkforcePoolProviderKeyUndeleteCall<'a, C> {
7300        self._delegate = Some(new_value);
7301        self
7302    }
7303
7304    /// Set any additional parameter of the query string used in the request.
7305    /// It should be used to set parameters which are not yet available through their own
7306    /// setters.
7307    ///
7308    /// Please note that this method must not be used to set any of the known parameters
7309    /// which have their own setter method. If done anyway, the request will fail.
7310    ///
7311    /// # Additional Parameters
7312    ///
7313    /// * *$.xgafv* (query-string) - V1 error format.
7314    /// * *access_token* (query-string) - OAuth access token.
7315    /// * *alt* (query-string) - Data format for response.
7316    /// * *callback* (query-string) - JSONP
7317    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7318    /// * *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.
7319    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7320    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7321    /// * *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.
7322    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7323    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7324    pub fn param<T>(
7325        mut self,
7326        name: T,
7327        value: T,
7328    ) -> LocationWorkforcePoolProviderKeyUndeleteCall<'a, C>
7329    where
7330        T: AsRef<str>,
7331    {
7332        self._additional_params
7333            .insert(name.as_ref().to_string(), value.as_ref().to_string());
7334        self
7335    }
7336
7337    /// Identifies the authorization scope for the method you are building.
7338    ///
7339    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7340    /// [`Scope::CloudPlatform`].
7341    ///
7342    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7343    /// tokens for more than one scope.
7344    ///
7345    /// Usually there is more than one suitable scope to authorize an operation, some of which may
7346    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7347    /// sufficient, a read-write scope will do as well.
7348    pub fn add_scope<St>(mut self, scope: St) -> LocationWorkforcePoolProviderKeyUndeleteCall<'a, C>
7349    where
7350        St: AsRef<str>,
7351    {
7352        self._scopes.insert(String::from(scope.as_ref()));
7353        self
7354    }
7355    /// Identifies the authorization scope(s) for the method you are building.
7356    ///
7357    /// See [`Self::add_scope()`] for details.
7358    pub fn add_scopes<I, St>(
7359        mut self,
7360        scopes: I,
7361    ) -> LocationWorkforcePoolProviderKeyUndeleteCall<'a, C>
7362    where
7363        I: IntoIterator<Item = St>,
7364        St: AsRef<str>,
7365    {
7366        self._scopes
7367            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7368        self
7369    }
7370
7371    /// Removes all scopes, and no default scope will be used either.
7372    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7373    /// for details).
7374    pub fn clear_scopes(mut self) -> LocationWorkforcePoolProviderKeyUndeleteCall<'a, C> {
7375        self._scopes.clear();
7376        self
7377    }
7378}
7379
7380/// Gets the latest state of a long-running operation. Clients can use this method to poll the operation result at intervals as recommended by the API service.
7381///
7382/// A builder for the *workforcePools.providers.operations.get* method supported by a *location* resource.
7383/// It is not used directly, but through a [`LocationMethods`] instance.
7384///
7385/// # Example
7386///
7387/// Instantiate a resource method builder
7388///
7389/// ```test_harness,no_run
7390/// # extern crate hyper;
7391/// # extern crate hyper_rustls;
7392/// # extern crate google_iam1 as iam1;
7393/// # async fn dox() {
7394/// # use iam1::{Iam, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7395///
7396/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7397/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
7398/// #     secret,
7399/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7400/// # ).build().await.unwrap();
7401///
7402/// # let client = hyper_util::client::legacy::Client::builder(
7403/// #     hyper_util::rt::TokioExecutor::new()
7404/// # )
7405/// # .build(
7406/// #     hyper_rustls::HttpsConnectorBuilder::new()
7407/// #         .with_native_roots()
7408/// #         .unwrap()
7409/// #         .https_or_http()
7410/// #         .enable_http1()
7411/// #         .build()
7412/// # );
7413/// # let mut hub = Iam::new(client, auth);
7414/// // You can configure optional parameters by calling the respective setters at will, and
7415/// // execute the final call using `doit()`.
7416/// // Values shown here are possibly random and not representative !
7417/// let result = hub.locations().workforce_pools_providers_operations_get("name")
7418///              .doit().await;
7419/// # }
7420/// ```
7421pub struct LocationWorkforcePoolProviderOperationGetCall<'a, C>
7422where
7423    C: 'a,
7424{
7425    hub: &'a Iam<C>,
7426    _name: String,
7427    _delegate: Option<&'a mut dyn common::Delegate>,
7428    _additional_params: HashMap<String, String>,
7429    _scopes: BTreeSet<String>,
7430}
7431
7432impl<'a, C> common::CallBuilder for LocationWorkforcePoolProviderOperationGetCall<'a, C> {}
7433
7434impl<'a, C> LocationWorkforcePoolProviderOperationGetCall<'a, C>
7435where
7436    C: common::Connector,
7437{
7438    /// Perform the operation you have build so far.
7439    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
7440        use std::borrow::Cow;
7441        use std::io::{Read, Seek};
7442
7443        use common::{url::Params, ToParts};
7444        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7445
7446        let mut dd = common::DefaultDelegate;
7447        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7448        dlg.begin(common::MethodInfo {
7449            id: "iam.locations.workforcePools.providers.operations.get",
7450            http_method: hyper::Method::GET,
7451        });
7452
7453        for &field in ["alt", "name"].iter() {
7454            if self._additional_params.contains_key(field) {
7455                dlg.finished(false);
7456                return Err(common::Error::FieldClash(field));
7457            }
7458        }
7459
7460        let mut params = Params::with_capacity(3 + self._additional_params.len());
7461        params.push("name", self._name);
7462
7463        params.extend(self._additional_params.iter());
7464
7465        params.push("alt", "json");
7466        let mut url = self.hub._base_url.clone() + "v1/{+name}";
7467        if self._scopes.is_empty() {
7468            self._scopes
7469                .insert(Scope::CloudPlatform.as_ref().to_string());
7470        }
7471
7472        #[allow(clippy::single_element_loop)]
7473        for &(find_this, param_name) in [("{+name}", "name")].iter() {
7474            url = params.uri_replacement(url, param_name, find_this, true);
7475        }
7476        {
7477            let to_remove = ["name"];
7478            params.remove_params(&to_remove);
7479        }
7480
7481        let url = params.parse_with_url(&url);
7482
7483        loop {
7484            let token = match self
7485                .hub
7486                .auth
7487                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
7488                .await
7489            {
7490                Ok(token) => token,
7491                Err(e) => match dlg.token(e) {
7492                    Ok(token) => token,
7493                    Err(e) => {
7494                        dlg.finished(false);
7495                        return Err(common::Error::MissingToken(e));
7496                    }
7497                },
7498            };
7499            let mut req_result = {
7500                let client = &self.hub.client;
7501                dlg.pre_request();
7502                let mut req_builder = hyper::Request::builder()
7503                    .method(hyper::Method::GET)
7504                    .uri(url.as_str())
7505                    .header(USER_AGENT, self.hub._user_agent.clone());
7506
7507                if let Some(token) = token.as_ref() {
7508                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7509                }
7510
7511                let request = req_builder
7512                    .header(CONTENT_LENGTH, 0_u64)
7513                    .body(common::to_body::<String>(None));
7514
7515                client.request(request.unwrap()).await
7516            };
7517
7518            match req_result {
7519                Err(err) => {
7520                    if let common::Retry::After(d) = dlg.http_error(&err) {
7521                        sleep(d).await;
7522                        continue;
7523                    }
7524                    dlg.finished(false);
7525                    return Err(common::Error::HttpError(err));
7526                }
7527                Ok(res) => {
7528                    let (mut parts, body) = res.into_parts();
7529                    let mut body = common::Body::new(body);
7530                    if !parts.status.is_success() {
7531                        let bytes = common::to_bytes(body).await.unwrap_or_default();
7532                        let error = serde_json::from_str(&common::to_string(&bytes));
7533                        let response = common::to_response(parts, bytes.into());
7534
7535                        if let common::Retry::After(d) =
7536                            dlg.http_failure(&response, error.as_ref().ok())
7537                        {
7538                            sleep(d).await;
7539                            continue;
7540                        }
7541
7542                        dlg.finished(false);
7543
7544                        return Err(match error {
7545                            Ok(value) => common::Error::BadRequest(value),
7546                            _ => common::Error::Failure(response),
7547                        });
7548                    }
7549                    let response = {
7550                        let bytes = common::to_bytes(body).await.unwrap_or_default();
7551                        let encoded = common::to_string(&bytes);
7552                        match serde_json::from_str(&encoded) {
7553                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
7554                            Err(error) => {
7555                                dlg.response_json_decode_error(&encoded, &error);
7556                                return Err(common::Error::JsonDecodeError(
7557                                    encoded.to_string(),
7558                                    error,
7559                                ));
7560                            }
7561                        }
7562                    };
7563
7564                    dlg.finished(true);
7565                    return Ok(response);
7566                }
7567            }
7568        }
7569    }
7570
7571    /// The name of the operation resource.
7572    ///
7573    /// Sets the *name* path property to the given value.
7574    ///
7575    /// Even though the property as already been set when instantiating this call,
7576    /// we provide this method for API completeness.
7577    pub fn name(mut self, new_value: &str) -> LocationWorkforcePoolProviderOperationGetCall<'a, C> {
7578        self._name = new_value.to_string();
7579        self
7580    }
7581    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7582    /// while executing the actual API request.
7583    ///
7584    /// ````text
7585    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
7586    /// ````
7587    ///
7588    /// Sets the *delegate* property to the given value.
7589    pub fn delegate(
7590        mut self,
7591        new_value: &'a mut dyn common::Delegate,
7592    ) -> LocationWorkforcePoolProviderOperationGetCall<'a, C> {
7593        self._delegate = Some(new_value);
7594        self
7595    }
7596
7597    /// Set any additional parameter of the query string used in the request.
7598    /// It should be used to set parameters which are not yet available through their own
7599    /// setters.
7600    ///
7601    /// Please note that this method must not be used to set any of the known parameters
7602    /// which have their own setter method. If done anyway, the request will fail.
7603    ///
7604    /// # Additional Parameters
7605    ///
7606    /// * *$.xgafv* (query-string) - V1 error format.
7607    /// * *access_token* (query-string) - OAuth access token.
7608    /// * *alt* (query-string) - Data format for response.
7609    /// * *callback* (query-string) - JSONP
7610    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7611    /// * *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.
7612    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7613    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7614    /// * *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.
7615    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7616    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7617    pub fn param<T>(
7618        mut self,
7619        name: T,
7620        value: T,
7621    ) -> LocationWorkforcePoolProviderOperationGetCall<'a, C>
7622    where
7623        T: AsRef<str>,
7624    {
7625        self._additional_params
7626            .insert(name.as_ref().to_string(), value.as_ref().to_string());
7627        self
7628    }
7629
7630    /// Identifies the authorization scope for the method you are building.
7631    ///
7632    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7633    /// [`Scope::CloudPlatform`].
7634    ///
7635    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7636    /// tokens for more than one scope.
7637    ///
7638    /// Usually there is more than one suitable scope to authorize an operation, some of which may
7639    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7640    /// sufficient, a read-write scope will do as well.
7641    pub fn add_scope<St>(
7642        mut self,
7643        scope: St,
7644    ) -> LocationWorkforcePoolProviderOperationGetCall<'a, C>
7645    where
7646        St: AsRef<str>,
7647    {
7648        self._scopes.insert(String::from(scope.as_ref()));
7649        self
7650    }
7651    /// Identifies the authorization scope(s) for the method you are building.
7652    ///
7653    /// See [`Self::add_scope()`] for details.
7654    pub fn add_scopes<I, St>(
7655        mut self,
7656        scopes: I,
7657    ) -> LocationWorkforcePoolProviderOperationGetCall<'a, C>
7658    where
7659        I: IntoIterator<Item = St>,
7660        St: AsRef<str>,
7661    {
7662        self._scopes
7663            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7664        self
7665    }
7666
7667    /// Removes all scopes, and no default scope will be used either.
7668    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7669    /// for details).
7670    pub fn clear_scopes(mut self) -> LocationWorkforcePoolProviderOperationGetCall<'a, C> {
7671        self._scopes.clear();
7672        self
7673    }
7674}
7675
7676/// Creates a new WorkforcePoolProvider in a WorkforcePool. You cannot reuse the name of a deleted provider until 30 days after deletion.
7677///
7678/// A builder for the *workforcePools.providers.create* method supported by a *location* resource.
7679/// It is not used directly, but through a [`LocationMethods`] instance.
7680///
7681/// # Example
7682///
7683/// Instantiate a resource method builder
7684///
7685/// ```test_harness,no_run
7686/// # extern crate hyper;
7687/// # extern crate hyper_rustls;
7688/// # extern crate google_iam1 as iam1;
7689/// use iam1::api::WorkforcePoolProvider;
7690/// # async fn dox() {
7691/// # use iam1::{Iam, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7692///
7693/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7694/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
7695/// #     secret,
7696/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7697/// # ).build().await.unwrap();
7698///
7699/// # let client = hyper_util::client::legacy::Client::builder(
7700/// #     hyper_util::rt::TokioExecutor::new()
7701/// # )
7702/// # .build(
7703/// #     hyper_rustls::HttpsConnectorBuilder::new()
7704/// #         .with_native_roots()
7705/// #         .unwrap()
7706/// #         .https_or_http()
7707/// #         .enable_http1()
7708/// #         .build()
7709/// # );
7710/// # let mut hub = Iam::new(client, auth);
7711/// // As the method needs a request, you would usually fill it with the desired information
7712/// // into the respective structure. Some of the parts shown here might not be applicable !
7713/// // Values shown here are possibly random and not representative !
7714/// let mut req = WorkforcePoolProvider::default();
7715///
7716/// // You can configure optional parameters by calling the respective setters at will, and
7717/// // execute the final call using `doit()`.
7718/// // Values shown here are possibly random and not representative !
7719/// let result = hub.locations().workforce_pools_providers_create(req, "parent")
7720///              .workforce_pool_provider_id("ipsum")
7721///              .doit().await;
7722/// # }
7723/// ```
7724pub struct LocationWorkforcePoolProviderCreateCall<'a, C>
7725where
7726    C: 'a,
7727{
7728    hub: &'a Iam<C>,
7729    _request: WorkforcePoolProvider,
7730    _parent: String,
7731    _workforce_pool_provider_id: Option<String>,
7732    _delegate: Option<&'a mut dyn common::Delegate>,
7733    _additional_params: HashMap<String, String>,
7734    _scopes: BTreeSet<String>,
7735}
7736
7737impl<'a, C> common::CallBuilder for LocationWorkforcePoolProviderCreateCall<'a, C> {}
7738
7739impl<'a, C> LocationWorkforcePoolProviderCreateCall<'a, C>
7740where
7741    C: common::Connector,
7742{
7743    /// Perform the operation you have build so far.
7744    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
7745        use std::borrow::Cow;
7746        use std::io::{Read, Seek};
7747
7748        use common::{url::Params, ToParts};
7749        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7750
7751        let mut dd = common::DefaultDelegate;
7752        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7753        dlg.begin(common::MethodInfo {
7754            id: "iam.locations.workforcePools.providers.create",
7755            http_method: hyper::Method::POST,
7756        });
7757
7758        for &field in ["alt", "parent", "workforcePoolProviderId"].iter() {
7759            if self._additional_params.contains_key(field) {
7760                dlg.finished(false);
7761                return Err(common::Error::FieldClash(field));
7762            }
7763        }
7764
7765        let mut params = Params::with_capacity(5 + self._additional_params.len());
7766        params.push("parent", self._parent);
7767        if let Some(value) = self._workforce_pool_provider_id.as_ref() {
7768            params.push("workforcePoolProviderId", value);
7769        }
7770
7771        params.extend(self._additional_params.iter());
7772
7773        params.push("alt", "json");
7774        let mut url = self.hub._base_url.clone() + "v1/{+parent}/providers";
7775        if self._scopes.is_empty() {
7776            self._scopes
7777                .insert(Scope::CloudPlatform.as_ref().to_string());
7778        }
7779
7780        #[allow(clippy::single_element_loop)]
7781        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
7782            url = params.uri_replacement(url, param_name, find_this, true);
7783        }
7784        {
7785            let to_remove = ["parent"];
7786            params.remove_params(&to_remove);
7787        }
7788
7789        let url = params.parse_with_url(&url);
7790
7791        let mut json_mime_type = mime::APPLICATION_JSON;
7792        let mut request_value_reader = {
7793            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
7794            common::remove_json_null_values(&mut value);
7795            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
7796            serde_json::to_writer(&mut dst, &value).unwrap();
7797            dst
7798        };
7799        let request_size = request_value_reader
7800            .seek(std::io::SeekFrom::End(0))
7801            .unwrap();
7802        request_value_reader
7803            .seek(std::io::SeekFrom::Start(0))
7804            .unwrap();
7805
7806        loop {
7807            let token = match self
7808                .hub
7809                .auth
7810                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
7811                .await
7812            {
7813                Ok(token) => token,
7814                Err(e) => match dlg.token(e) {
7815                    Ok(token) => token,
7816                    Err(e) => {
7817                        dlg.finished(false);
7818                        return Err(common::Error::MissingToken(e));
7819                    }
7820                },
7821            };
7822            request_value_reader
7823                .seek(std::io::SeekFrom::Start(0))
7824                .unwrap();
7825            let mut req_result = {
7826                let client = &self.hub.client;
7827                dlg.pre_request();
7828                let mut req_builder = hyper::Request::builder()
7829                    .method(hyper::Method::POST)
7830                    .uri(url.as_str())
7831                    .header(USER_AGENT, self.hub._user_agent.clone());
7832
7833                if let Some(token) = token.as_ref() {
7834                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7835                }
7836
7837                let request = req_builder
7838                    .header(CONTENT_TYPE, json_mime_type.to_string())
7839                    .header(CONTENT_LENGTH, request_size as u64)
7840                    .body(common::to_body(
7841                        request_value_reader.get_ref().clone().into(),
7842                    ));
7843
7844                client.request(request.unwrap()).await
7845            };
7846
7847            match req_result {
7848                Err(err) => {
7849                    if let common::Retry::After(d) = dlg.http_error(&err) {
7850                        sleep(d).await;
7851                        continue;
7852                    }
7853                    dlg.finished(false);
7854                    return Err(common::Error::HttpError(err));
7855                }
7856                Ok(res) => {
7857                    let (mut parts, body) = res.into_parts();
7858                    let mut body = common::Body::new(body);
7859                    if !parts.status.is_success() {
7860                        let bytes = common::to_bytes(body).await.unwrap_or_default();
7861                        let error = serde_json::from_str(&common::to_string(&bytes));
7862                        let response = common::to_response(parts, bytes.into());
7863
7864                        if let common::Retry::After(d) =
7865                            dlg.http_failure(&response, error.as_ref().ok())
7866                        {
7867                            sleep(d).await;
7868                            continue;
7869                        }
7870
7871                        dlg.finished(false);
7872
7873                        return Err(match error {
7874                            Ok(value) => common::Error::BadRequest(value),
7875                            _ => common::Error::Failure(response),
7876                        });
7877                    }
7878                    let response = {
7879                        let bytes = common::to_bytes(body).await.unwrap_or_default();
7880                        let encoded = common::to_string(&bytes);
7881                        match serde_json::from_str(&encoded) {
7882                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
7883                            Err(error) => {
7884                                dlg.response_json_decode_error(&encoded, &error);
7885                                return Err(common::Error::JsonDecodeError(
7886                                    encoded.to_string(),
7887                                    error,
7888                                ));
7889                            }
7890                        }
7891                    };
7892
7893                    dlg.finished(true);
7894                    return Ok(response);
7895                }
7896            }
7897        }
7898    }
7899
7900    ///
7901    /// Sets the *request* property to the given value.
7902    ///
7903    /// Even though the property as already been set when instantiating this call,
7904    /// we provide this method for API completeness.
7905    pub fn request(
7906        mut self,
7907        new_value: WorkforcePoolProvider,
7908    ) -> LocationWorkforcePoolProviderCreateCall<'a, C> {
7909        self._request = new_value;
7910        self
7911    }
7912    /// Required. The pool to create this provider in. Format: `locations/{location}/workforcePools/{workforce_pool_id}`
7913    ///
7914    /// Sets the *parent* path property to the given value.
7915    ///
7916    /// Even though the property as already been set when instantiating this call,
7917    /// we provide this method for API completeness.
7918    pub fn parent(mut self, new_value: &str) -> LocationWorkforcePoolProviderCreateCall<'a, C> {
7919        self._parent = new_value.to_string();
7920        self
7921    }
7922    /// Required. The ID for the provider, which becomes the final component of the resource name. This value must be 4-32 characters, and may contain the characters [a-z0-9-]. The prefix `gcp-` is reserved for use by Google, and may not be specified.
7923    ///
7924    /// Sets the *workforce pool provider id* query property to the given value.
7925    pub fn workforce_pool_provider_id(
7926        mut self,
7927        new_value: &str,
7928    ) -> LocationWorkforcePoolProviderCreateCall<'a, C> {
7929        self._workforce_pool_provider_id = Some(new_value.to_string());
7930        self
7931    }
7932    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7933    /// while executing the actual API request.
7934    ///
7935    /// ````text
7936    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
7937    /// ````
7938    ///
7939    /// Sets the *delegate* property to the given value.
7940    pub fn delegate(
7941        mut self,
7942        new_value: &'a mut dyn common::Delegate,
7943    ) -> LocationWorkforcePoolProviderCreateCall<'a, C> {
7944        self._delegate = Some(new_value);
7945        self
7946    }
7947
7948    /// Set any additional parameter of the query string used in the request.
7949    /// It should be used to set parameters which are not yet available through their own
7950    /// setters.
7951    ///
7952    /// Please note that this method must not be used to set any of the known parameters
7953    /// which have their own setter method. If done anyway, the request will fail.
7954    ///
7955    /// # Additional Parameters
7956    ///
7957    /// * *$.xgafv* (query-string) - V1 error format.
7958    /// * *access_token* (query-string) - OAuth access token.
7959    /// * *alt* (query-string) - Data format for response.
7960    /// * *callback* (query-string) - JSONP
7961    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7962    /// * *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.
7963    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7964    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7965    /// * *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.
7966    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7967    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7968    pub fn param<T>(mut self, name: T, value: T) -> LocationWorkforcePoolProviderCreateCall<'a, C>
7969    where
7970        T: AsRef<str>,
7971    {
7972        self._additional_params
7973            .insert(name.as_ref().to_string(), value.as_ref().to_string());
7974        self
7975    }
7976
7977    /// Identifies the authorization scope for the method you are building.
7978    ///
7979    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7980    /// [`Scope::CloudPlatform`].
7981    ///
7982    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7983    /// tokens for more than one scope.
7984    ///
7985    /// Usually there is more than one suitable scope to authorize an operation, some of which may
7986    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7987    /// sufficient, a read-write scope will do as well.
7988    pub fn add_scope<St>(mut self, scope: St) -> LocationWorkforcePoolProviderCreateCall<'a, C>
7989    where
7990        St: AsRef<str>,
7991    {
7992        self._scopes.insert(String::from(scope.as_ref()));
7993        self
7994    }
7995    /// Identifies the authorization scope(s) for the method you are building.
7996    ///
7997    /// See [`Self::add_scope()`] for details.
7998    pub fn add_scopes<I, St>(mut self, scopes: I) -> LocationWorkforcePoolProviderCreateCall<'a, C>
7999    where
8000        I: IntoIterator<Item = St>,
8001        St: AsRef<str>,
8002    {
8003        self._scopes
8004            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
8005        self
8006    }
8007
8008    /// Removes all scopes, and no default scope will be used either.
8009    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
8010    /// for details).
8011    pub fn clear_scopes(mut self) -> LocationWorkforcePoolProviderCreateCall<'a, C> {
8012        self._scopes.clear();
8013        self
8014    }
8015}
8016
8017/// Deletes a WorkforcePoolProvider. Deleting a provider does not revoke credentials that have already been issued; they continue to grant access. You can undelete a provider for 30 days. After 30 days, deletion is permanent. You cannot update deleted providers. However, you can view and list them.
8018///
8019/// A builder for the *workforcePools.providers.delete* method supported by a *location* resource.
8020/// It is not used directly, but through a [`LocationMethods`] instance.
8021///
8022/// # Example
8023///
8024/// Instantiate a resource method builder
8025///
8026/// ```test_harness,no_run
8027/// # extern crate hyper;
8028/// # extern crate hyper_rustls;
8029/// # extern crate google_iam1 as iam1;
8030/// # async fn dox() {
8031/// # use iam1::{Iam, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8032///
8033/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
8034/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
8035/// #     secret,
8036/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8037/// # ).build().await.unwrap();
8038///
8039/// # let client = hyper_util::client::legacy::Client::builder(
8040/// #     hyper_util::rt::TokioExecutor::new()
8041/// # )
8042/// # .build(
8043/// #     hyper_rustls::HttpsConnectorBuilder::new()
8044/// #         .with_native_roots()
8045/// #         .unwrap()
8046/// #         .https_or_http()
8047/// #         .enable_http1()
8048/// #         .build()
8049/// # );
8050/// # let mut hub = Iam::new(client, auth);
8051/// // You can configure optional parameters by calling the respective setters at will, and
8052/// // execute the final call using `doit()`.
8053/// // Values shown here are possibly random and not representative !
8054/// let result = hub.locations().workforce_pools_providers_delete("name")
8055///              .doit().await;
8056/// # }
8057/// ```
8058pub struct LocationWorkforcePoolProviderDeleteCall<'a, C>
8059where
8060    C: 'a,
8061{
8062    hub: &'a Iam<C>,
8063    _name: String,
8064    _delegate: Option<&'a mut dyn common::Delegate>,
8065    _additional_params: HashMap<String, String>,
8066    _scopes: BTreeSet<String>,
8067}
8068
8069impl<'a, C> common::CallBuilder for LocationWorkforcePoolProviderDeleteCall<'a, C> {}
8070
8071impl<'a, C> LocationWorkforcePoolProviderDeleteCall<'a, C>
8072where
8073    C: common::Connector,
8074{
8075    /// Perform the operation you have build so far.
8076    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
8077        use std::borrow::Cow;
8078        use std::io::{Read, Seek};
8079
8080        use common::{url::Params, ToParts};
8081        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
8082
8083        let mut dd = common::DefaultDelegate;
8084        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
8085        dlg.begin(common::MethodInfo {
8086            id: "iam.locations.workforcePools.providers.delete",
8087            http_method: hyper::Method::DELETE,
8088        });
8089
8090        for &field in ["alt", "name"].iter() {
8091            if self._additional_params.contains_key(field) {
8092                dlg.finished(false);
8093                return Err(common::Error::FieldClash(field));
8094            }
8095        }
8096
8097        let mut params = Params::with_capacity(3 + self._additional_params.len());
8098        params.push("name", self._name);
8099
8100        params.extend(self._additional_params.iter());
8101
8102        params.push("alt", "json");
8103        let mut url = self.hub._base_url.clone() + "v1/{+name}";
8104        if self._scopes.is_empty() {
8105            self._scopes
8106                .insert(Scope::CloudPlatform.as_ref().to_string());
8107        }
8108
8109        #[allow(clippy::single_element_loop)]
8110        for &(find_this, param_name) in [("{+name}", "name")].iter() {
8111            url = params.uri_replacement(url, param_name, find_this, true);
8112        }
8113        {
8114            let to_remove = ["name"];
8115            params.remove_params(&to_remove);
8116        }
8117
8118        let url = params.parse_with_url(&url);
8119
8120        loop {
8121            let token = match self
8122                .hub
8123                .auth
8124                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
8125                .await
8126            {
8127                Ok(token) => token,
8128                Err(e) => match dlg.token(e) {
8129                    Ok(token) => token,
8130                    Err(e) => {
8131                        dlg.finished(false);
8132                        return Err(common::Error::MissingToken(e));
8133                    }
8134                },
8135            };
8136            let mut req_result = {
8137                let client = &self.hub.client;
8138                dlg.pre_request();
8139                let mut req_builder = hyper::Request::builder()
8140                    .method(hyper::Method::DELETE)
8141                    .uri(url.as_str())
8142                    .header(USER_AGENT, self.hub._user_agent.clone());
8143
8144                if let Some(token) = token.as_ref() {
8145                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8146                }
8147
8148                let request = req_builder
8149                    .header(CONTENT_LENGTH, 0_u64)
8150                    .body(common::to_body::<String>(None));
8151
8152                client.request(request.unwrap()).await
8153            };
8154
8155            match req_result {
8156                Err(err) => {
8157                    if let common::Retry::After(d) = dlg.http_error(&err) {
8158                        sleep(d).await;
8159                        continue;
8160                    }
8161                    dlg.finished(false);
8162                    return Err(common::Error::HttpError(err));
8163                }
8164                Ok(res) => {
8165                    let (mut parts, body) = res.into_parts();
8166                    let mut body = common::Body::new(body);
8167                    if !parts.status.is_success() {
8168                        let bytes = common::to_bytes(body).await.unwrap_or_default();
8169                        let error = serde_json::from_str(&common::to_string(&bytes));
8170                        let response = common::to_response(parts, bytes.into());
8171
8172                        if let common::Retry::After(d) =
8173                            dlg.http_failure(&response, error.as_ref().ok())
8174                        {
8175                            sleep(d).await;
8176                            continue;
8177                        }
8178
8179                        dlg.finished(false);
8180
8181                        return Err(match error {
8182                            Ok(value) => common::Error::BadRequest(value),
8183                            _ => common::Error::Failure(response),
8184                        });
8185                    }
8186                    let response = {
8187                        let bytes = common::to_bytes(body).await.unwrap_or_default();
8188                        let encoded = common::to_string(&bytes);
8189                        match serde_json::from_str(&encoded) {
8190                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8191                            Err(error) => {
8192                                dlg.response_json_decode_error(&encoded, &error);
8193                                return Err(common::Error::JsonDecodeError(
8194                                    encoded.to_string(),
8195                                    error,
8196                                ));
8197                            }
8198                        }
8199                    };
8200
8201                    dlg.finished(true);
8202                    return Ok(response);
8203                }
8204            }
8205        }
8206    }
8207
8208    /// Required. The name of the provider to delete. Format: `locations/{location}/workforcePools/{workforce_pool_id}/providers/{provider_id}`
8209    ///
8210    /// Sets the *name* path property to the given value.
8211    ///
8212    /// Even though the property as already been set when instantiating this call,
8213    /// we provide this method for API completeness.
8214    pub fn name(mut self, new_value: &str) -> LocationWorkforcePoolProviderDeleteCall<'a, C> {
8215        self._name = new_value.to_string();
8216        self
8217    }
8218    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8219    /// while executing the actual API request.
8220    ///
8221    /// ````text
8222    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
8223    /// ````
8224    ///
8225    /// Sets the *delegate* property to the given value.
8226    pub fn delegate(
8227        mut self,
8228        new_value: &'a mut dyn common::Delegate,
8229    ) -> LocationWorkforcePoolProviderDeleteCall<'a, C> {
8230        self._delegate = Some(new_value);
8231        self
8232    }
8233
8234    /// Set any additional parameter of the query string used in the request.
8235    /// It should be used to set parameters which are not yet available through their own
8236    /// setters.
8237    ///
8238    /// Please note that this method must not be used to set any of the known parameters
8239    /// which have their own setter method. If done anyway, the request will fail.
8240    ///
8241    /// # Additional Parameters
8242    ///
8243    /// * *$.xgafv* (query-string) - V1 error format.
8244    /// * *access_token* (query-string) - OAuth access token.
8245    /// * *alt* (query-string) - Data format for response.
8246    /// * *callback* (query-string) - JSONP
8247    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8248    /// * *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.
8249    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8250    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8251    /// * *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.
8252    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8253    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8254    pub fn param<T>(mut self, name: T, value: T) -> LocationWorkforcePoolProviderDeleteCall<'a, C>
8255    where
8256        T: AsRef<str>,
8257    {
8258        self._additional_params
8259            .insert(name.as_ref().to_string(), value.as_ref().to_string());
8260        self
8261    }
8262
8263    /// Identifies the authorization scope for the method you are building.
8264    ///
8265    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
8266    /// [`Scope::CloudPlatform`].
8267    ///
8268    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
8269    /// tokens for more than one scope.
8270    ///
8271    /// Usually there is more than one suitable scope to authorize an operation, some of which may
8272    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
8273    /// sufficient, a read-write scope will do as well.
8274    pub fn add_scope<St>(mut self, scope: St) -> LocationWorkforcePoolProviderDeleteCall<'a, C>
8275    where
8276        St: AsRef<str>,
8277    {
8278        self._scopes.insert(String::from(scope.as_ref()));
8279        self
8280    }
8281    /// Identifies the authorization scope(s) for the method you are building.
8282    ///
8283    /// See [`Self::add_scope()`] for details.
8284    pub fn add_scopes<I, St>(mut self, scopes: I) -> LocationWorkforcePoolProviderDeleteCall<'a, C>
8285    where
8286        I: IntoIterator<Item = St>,
8287        St: AsRef<str>,
8288    {
8289        self._scopes
8290            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
8291        self
8292    }
8293
8294    /// Removes all scopes, and no default scope will be used either.
8295    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
8296    /// for details).
8297    pub fn clear_scopes(mut self) -> LocationWorkforcePoolProviderDeleteCall<'a, C> {
8298        self._scopes.clear();
8299        self
8300    }
8301}
8302
8303/// Gets an individual WorkforcePoolProvider.
8304///
8305/// A builder for the *workforcePools.providers.get* method supported by a *location* resource.
8306/// It is not used directly, but through a [`LocationMethods`] instance.
8307///
8308/// # Example
8309///
8310/// Instantiate a resource method builder
8311///
8312/// ```test_harness,no_run
8313/// # extern crate hyper;
8314/// # extern crate hyper_rustls;
8315/// # extern crate google_iam1 as iam1;
8316/// # async fn dox() {
8317/// # use iam1::{Iam, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8318///
8319/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
8320/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
8321/// #     secret,
8322/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8323/// # ).build().await.unwrap();
8324///
8325/// # let client = hyper_util::client::legacy::Client::builder(
8326/// #     hyper_util::rt::TokioExecutor::new()
8327/// # )
8328/// # .build(
8329/// #     hyper_rustls::HttpsConnectorBuilder::new()
8330/// #         .with_native_roots()
8331/// #         .unwrap()
8332/// #         .https_or_http()
8333/// #         .enable_http1()
8334/// #         .build()
8335/// # );
8336/// # let mut hub = Iam::new(client, auth);
8337/// // You can configure optional parameters by calling the respective setters at will, and
8338/// // execute the final call using `doit()`.
8339/// // Values shown here are possibly random and not representative !
8340/// let result = hub.locations().workforce_pools_providers_get("name")
8341///              .doit().await;
8342/// # }
8343/// ```
8344pub struct LocationWorkforcePoolProviderGetCall<'a, C>
8345where
8346    C: 'a,
8347{
8348    hub: &'a Iam<C>,
8349    _name: String,
8350    _delegate: Option<&'a mut dyn common::Delegate>,
8351    _additional_params: HashMap<String, String>,
8352    _scopes: BTreeSet<String>,
8353}
8354
8355impl<'a, C> common::CallBuilder for LocationWorkforcePoolProviderGetCall<'a, C> {}
8356
8357impl<'a, C> LocationWorkforcePoolProviderGetCall<'a, C>
8358where
8359    C: common::Connector,
8360{
8361    /// Perform the operation you have build so far.
8362    pub async fn doit(mut self) -> common::Result<(common::Response, WorkforcePoolProvider)> {
8363        use std::borrow::Cow;
8364        use std::io::{Read, Seek};
8365
8366        use common::{url::Params, ToParts};
8367        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
8368
8369        let mut dd = common::DefaultDelegate;
8370        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
8371        dlg.begin(common::MethodInfo {
8372            id: "iam.locations.workforcePools.providers.get",
8373            http_method: hyper::Method::GET,
8374        });
8375
8376        for &field in ["alt", "name"].iter() {
8377            if self._additional_params.contains_key(field) {
8378                dlg.finished(false);
8379                return Err(common::Error::FieldClash(field));
8380            }
8381        }
8382
8383        let mut params = Params::with_capacity(3 + self._additional_params.len());
8384        params.push("name", self._name);
8385
8386        params.extend(self._additional_params.iter());
8387
8388        params.push("alt", "json");
8389        let mut url = self.hub._base_url.clone() + "v1/{+name}";
8390        if self._scopes.is_empty() {
8391            self._scopes
8392                .insert(Scope::CloudPlatform.as_ref().to_string());
8393        }
8394
8395        #[allow(clippy::single_element_loop)]
8396        for &(find_this, param_name) in [("{+name}", "name")].iter() {
8397            url = params.uri_replacement(url, param_name, find_this, true);
8398        }
8399        {
8400            let to_remove = ["name"];
8401            params.remove_params(&to_remove);
8402        }
8403
8404        let url = params.parse_with_url(&url);
8405
8406        loop {
8407            let token = match self
8408                .hub
8409                .auth
8410                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
8411                .await
8412            {
8413                Ok(token) => token,
8414                Err(e) => match dlg.token(e) {
8415                    Ok(token) => token,
8416                    Err(e) => {
8417                        dlg.finished(false);
8418                        return Err(common::Error::MissingToken(e));
8419                    }
8420                },
8421            };
8422            let mut req_result = {
8423                let client = &self.hub.client;
8424                dlg.pre_request();
8425                let mut req_builder = hyper::Request::builder()
8426                    .method(hyper::Method::GET)
8427                    .uri(url.as_str())
8428                    .header(USER_AGENT, self.hub._user_agent.clone());
8429
8430                if let Some(token) = token.as_ref() {
8431                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8432                }
8433
8434                let request = req_builder
8435                    .header(CONTENT_LENGTH, 0_u64)
8436                    .body(common::to_body::<String>(None));
8437
8438                client.request(request.unwrap()).await
8439            };
8440
8441            match req_result {
8442                Err(err) => {
8443                    if let common::Retry::After(d) = dlg.http_error(&err) {
8444                        sleep(d).await;
8445                        continue;
8446                    }
8447                    dlg.finished(false);
8448                    return Err(common::Error::HttpError(err));
8449                }
8450                Ok(res) => {
8451                    let (mut parts, body) = res.into_parts();
8452                    let mut body = common::Body::new(body);
8453                    if !parts.status.is_success() {
8454                        let bytes = common::to_bytes(body).await.unwrap_or_default();
8455                        let error = serde_json::from_str(&common::to_string(&bytes));
8456                        let response = common::to_response(parts, bytes.into());
8457
8458                        if let common::Retry::After(d) =
8459                            dlg.http_failure(&response, error.as_ref().ok())
8460                        {
8461                            sleep(d).await;
8462                            continue;
8463                        }
8464
8465                        dlg.finished(false);
8466
8467                        return Err(match error {
8468                            Ok(value) => common::Error::BadRequest(value),
8469                            _ => common::Error::Failure(response),
8470                        });
8471                    }
8472                    let response = {
8473                        let bytes = common::to_bytes(body).await.unwrap_or_default();
8474                        let encoded = common::to_string(&bytes);
8475                        match serde_json::from_str(&encoded) {
8476                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8477                            Err(error) => {
8478                                dlg.response_json_decode_error(&encoded, &error);
8479                                return Err(common::Error::JsonDecodeError(
8480                                    encoded.to_string(),
8481                                    error,
8482                                ));
8483                            }
8484                        }
8485                    };
8486
8487                    dlg.finished(true);
8488                    return Ok(response);
8489                }
8490            }
8491        }
8492    }
8493
8494    /// Required. The name of the provider to retrieve. Format: `locations/{location}/workforcePools/{workforce_pool_id}/providers/{provider_id}`
8495    ///
8496    /// Sets the *name* path property to the given value.
8497    ///
8498    /// Even though the property as already been set when instantiating this call,
8499    /// we provide this method for API completeness.
8500    pub fn name(mut self, new_value: &str) -> LocationWorkforcePoolProviderGetCall<'a, C> {
8501        self._name = new_value.to_string();
8502        self
8503    }
8504    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8505    /// while executing the actual API request.
8506    ///
8507    /// ````text
8508    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
8509    /// ````
8510    ///
8511    /// Sets the *delegate* property to the given value.
8512    pub fn delegate(
8513        mut self,
8514        new_value: &'a mut dyn common::Delegate,
8515    ) -> LocationWorkforcePoolProviderGetCall<'a, C> {
8516        self._delegate = Some(new_value);
8517        self
8518    }
8519
8520    /// Set any additional parameter of the query string used in the request.
8521    /// It should be used to set parameters which are not yet available through their own
8522    /// setters.
8523    ///
8524    /// Please note that this method must not be used to set any of the known parameters
8525    /// which have their own setter method. If done anyway, the request will fail.
8526    ///
8527    /// # Additional Parameters
8528    ///
8529    /// * *$.xgafv* (query-string) - V1 error format.
8530    /// * *access_token* (query-string) - OAuth access token.
8531    /// * *alt* (query-string) - Data format for response.
8532    /// * *callback* (query-string) - JSONP
8533    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8534    /// * *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.
8535    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8536    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8537    /// * *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.
8538    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8539    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8540    pub fn param<T>(mut self, name: T, value: T) -> LocationWorkforcePoolProviderGetCall<'a, C>
8541    where
8542        T: AsRef<str>,
8543    {
8544        self._additional_params
8545            .insert(name.as_ref().to_string(), value.as_ref().to_string());
8546        self
8547    }
8548
8549    /// Identifies the authorization scope for the method you are building.
8550    ///
8551    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
8552    /// [`Scope::CloudPlatform`].
8553    ///
8554    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
8555    /// tokens for more than one scope.
8556    ///
8557    /// Usually there is more than one suitable scope to authorize an operation, some of which may
8558    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
8559    /// sufficient, a read-write scope will do as well.
8560    pub fn add_scope<St>(mut self, scope: St) -> LocationWorkforcePoolProviderGetCall<'a, C>
8561    where
8562        St: AsRef<str>,
8563    {
8564        self._scopes.insert(String::from(scope.as_ref()));
8565        self
8566    }
8567    /// Identifies the authorization scope(s) for the method you are building.
8568    ///
8569    /// See [`Self::add_scope()`] for details.
8570    pub fn add_scopes<I, St>(mut self, scopes: I) -> LocationWorkforcePoolProviderGetCall<'a, C>
8571    where
8572        I: IntoIterator<Item = St>,
8573        St: AsRef<str>,
8574    {
8575        self._scopes
8576            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
8577        self
8578    }
8579
8580    /// Removes all scopes, and no default scope will be used either.
8581    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
8582    /// for details).
8583    pub fn clear_scopes(mut self) -> LocationWorkforcePoolProviderGetCall<'a, C> {
8584        self._scopes.clear();
8585        self
8586    }
8587}
8588
8589/// Lists all non-deleted WorkforcePoolProviders in a WorkforcePool. If `show_deleted` is set to `true`, then deleted providers are also listed.
8590///
8591/// A builder for the *workforcePools.providers.list* method supported by a *location* resource.
8592/// It is not used directly, but through a [`LocationMethods`] instance.
8593///
8594/// # Example
8595///
8596/// Instantiate a resource method builder
8597///
8598/// ```test_harness,no_run
8599/// # extern crate hyper;
8600/// # extern crate hyper_rustls;
8601/// # extern crate google_iam1 as iam1;
8602/// # async fn dox() {
8603/// # use iam1::{Iam, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8604///
8605/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
8606/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
8607/// #     secret,
8608/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8609/// # ).build().await.unwrap();
8610///
8611/// # let client = hyper_util::client::legacy::Client::builder(
8612/// #     hyper_util::rt::TokioExecutor::new()
8613/// # )
8614/// # .build(
8615/// #     hyper_rustls::HttpsConnectorBuilder::new()
8616/// #         .with_native_roots()
8617/// #         .unwrap()
8618/// #         .https_or_http()
8619/// #         .enable_http1()
8620/// #         .build()
8621/// # );
8622/// # let mut hub = Iam::new(client, auth);
8623/// // You can configure optional parameters by calling the respective setters at will, and
8624/// // execute the final call using `doit()`.
8625/// // Values shown here are possibly random and not representative !
8626/// let result = hub.locations().workforce_pools_providers_list("parent")
8627///              .show_deleted(true)
8628///              .page_token("sed")
8629///              .page_size(-37)
8630///              .doit().await;
8631/// # }
8632/// ```
8633pub struct LocationWorkforcePoolProviderListCall<'a, C>
8634where
8635    C: 'a,
8636{
8637    hub: &'a Iam<C>,
8638    _parent: String,
8639    _show_deleted: Option<bool>,
8640    _page_token: Option<String>,
8641    _page_size: Option<i32>,
8642    _delegate: Option<&'a mut dyn common::Delegate>,
8643    _additional_params: HashMap<String, String>,
8644    _scopes: BTreeSet<String>,
8645}
8646
8647impl<'a, C> common::CallBuilder for LocationWorkforcePoolProviderListCall<'a, C> {}
8648
8649impl<'a, C> LocationWorkforcePoolProviderListCall<'a, C>
8650where
8651    C: common::Connector,
8652{
8653    /// Perform the operation you have build so far.
8654    pub async fn doit(
8655        mut self,
8656    ) -> common::Result<(common::Response, ListWorkforcePoolProvidersResponse)> {
8657        use std::borrow::Cow;
8658        use std::io::{Read, Seek};
8659
8660        use common::{url::Params, ToParts};
8661        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
8662
8663        let mut dd = common::DefaultDelegate;
8664        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
8665        dlg.begin(common::MethodInfo {
8666            id: "iam.locations.workforcePools.providers.list",
8667            http_method: hyper::Method::GET,
8668        });
8669
8670        for &field in ["alt", "parent", "showDeleted", "pageToken", "pageSize"].iter() {
8671            if self._additional_params.contains_key(field) {
8672                dlg.finished(false);
8673                return Err(common::Error::FieldClash(field));
8674            }
8675        }
8676
8677        let mut params = Params::with_capacity(6 + self._additional_params.len());
8678        params.push("parent", self._parent);
8679        if let Some(value) = self._show_deleted.as_ref() {
8680            params.push("showDeleted", value.to_string());
8681        }
8682        if let Some(value) = self._page_token.as_ref() {
8683            params.push("pageToken", value);
8684        }
8685        if let Some(value) = self._page_size.as_ref() {
8686            params.push("pageSize", value.to_string());
8687        }
8688
8689        params.extend(self._additional_params.iter());
8690
8691        params.push("alt", "json");
8692        let mut url = self.hub._base_url.clone() + "v1/{+parent}/providers";
8693        if self._scopes.is_empty() {
8694            self._scopes
8695                .insert(Scope::CloudPlatform.as_ref().to_string());
8696        }
8697
8698        #[allow(clippy::single_element_loop)]
8699        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
8700            url = params.uri_replacement(url, param_name, find_this, true);
8701        }
8702        {
8703            let to_remove = ["parent"];
8704            params.remove_params(&to_remove);
8705        }
8706
8707        let url = params.parse_with_url(&url);
8708
8709        loop {
8710            let token = match self
8711                .hub
8712                .auth
8713                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
8714                .await
8715            {
8716                Ok(token) => token,
8717                Err(e) => match dlg.token(e) {
8718                    Ok(token) => token,
8719                    Err(e) => {
8720                        dlg.finished(false);
8721                        return Err(common::Error::MissingToken(e));
8722                    }
8723                },
8724            };
8725            let mut req_result = {
8726                let client = &self.hub.client;
8727                dlg.pre_request();
8728                let mut req_builder = hyper::Request::builder()
8729                    .method(hyper::Method::GET)
8730                    .uri(url.as_str())
8731                    .header(USER_AGENT, self.hub._user_agent.clone());
8732
8733                if let Some(token) = token.as_ref() {
8734                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8735                }
8736
8737                let request = req_builder
8738                    .header(CONTENT_LENGTH, 0_u64)
8739                    .body(common::to_body::<String>(None));
8740
8741                client.request(request.unwrap()).await
8742            };
8743
8744            match req_result {
8745                Err(err) => {
8746                    if let common::Retry::After(d) = dlg.http_error(&err) {
8747                        sleep(d).await;
8748                        continue;
8749                    }
8750                    dlg.finished(false);
8751                    return Err(common::Error::HttpError(err));
8752                }
8753                Ok(res) => {
8754                    let (mut parts, body) = res.into_parts();
8755                    let mut body = common::Body::new(body);
8756                    if !parts.status.is_success() {
8757                        let bytes = common::to_bytes(body).await.unwrap_or_default();
8758                        let error = serde_json::from_str(&common::to_string(&bytes));
8759                        let response = common::to_response(parts, bytes.into());
8760
8761                        if let common::Retry::After(d) =
8762                            dlg.http_failure(&response, error.as_ref().ok())
8763                        {
8764                            sleep(d).await;
8765                            continue;
8766                        }
8767
8768                        dlg.finished(false);
8769
8770                        return Err(match error {
8771                            Ok(value) => common::Error::BadRequest(value),
8772                            _ => common::Error::Failure(response),
8773                        });
8774                    }
8775                    let response = {
8776                        let bytes = common::to_bytes(body).await.unwrap_or_default();
8777                        let encoded = common::to_string(&bytes);
8778                        match serde_json::from_str(&encoded) {
8779                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8780                            Err(error) => {
8781                                dlg.response_json_decode_error(&encoded, &error);
8782                                return Err(common::Error::JsonDecodeError(
8783                                    encoded.to_string(),
8784                                    error,
8785                                ));
8786                            }
8787                        }
8788                    };
8789
8790                    dlg.finished(true);
8791                    return Ok(response);
8792                }
8793            }
8794        }
8795    }
8796
8797    /// Required. The pool to list providers for. Format: `locations/{location}/workforcePools/{workforce_pool_id}`
8798    ///
8799    /// Sets the *parent* path property to the given value.
8800    ///
8801    /// Even though the property as already been set when instantiating this call,
8802    /// we provide this method for API completeness.
8803    pub fn parent(mut self, new_value: &str) -> LocationWorkforcePoolProviderListCall<'a, C> {
8804        self._parent = new_value.to_string();
8805        self
8806    }
8807    /// Whether to return soft-deleted providers.
8808    ///
8809    /// Sets the *show deleted* query property to the given value.
8810    pub fn show_deleted(mut self, new_value: bool) -> LocationWorkforcePoolProviderListCall<'a, C> {
8811        self._show_deleted = Some(new_value);
8812        self
8813    }
8814    /// A page token, received from a previous `ListWorkforcePoolProviders` call. Provide this to retrieve the subsequent page.
8815    ///
8816    /// Sets the *page token* query property to the given value.
8817    pub fn page_token(mut self, new_value: &str) -> LocationWorkforcePoolProviderListCall<'a, C> {
8818        self._page_token = Some(new_value.to_string());
8819        self
8820    }
8821    /// The maximum number of providers to return. If unspecified, at most 50 providers are returned. The maximum value is 100; values above 100 are truncated to 100.
8822    ///
8823    /// Sets the *page size* query property to the given value.
8824    pub fn page_size(mut self, new_value: i32) -> LocationWorkforcePoolProviderListCall<'a, C> {
8825        self._page_size = Some(new_value);
8826        self
8827    }
8828    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8829    /// while executing the actual API request.
8830    ///
8831    /// ````text
8832    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
8833    /// ````
8834    ///
8835    /// Sets the *delegate* property to the given value.
8836    pub fn delegate(
8837        mut self,
8838        new_value: &'a mut dyn common::Delegate,
8839    ) -> LocationWorkforcePoolProviderListCall<'a, C> {
8840        self._delegate = Some(new_value);
8841        self
8842    }
8843
8844    /// Set any additional parameter of the query string used in the request.
8845    /// It should be used to set parameters which are not yet available through their own
8846    /// setters.
8847    ///
8848    /// Please note that this method must not be used to set any of the known parameters
8849    /// which have their own setter method. If done anyway, the request will fail.
8850    ///
8851    /// # Additional Parameters
8852    ///
8853    /// * *$.xgafv* (query-string) - V1 error format.
8854    /// * *access_token* (query-string) - OAuth access token.
8855    /// * *alt* (query-string) - Data format for response.
8856    /// * *callback* (query-string) - JSONP
8857    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8858    /// * *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.
8859    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8860    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8861    /// * *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.
8862    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8863    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8864    pub fn param<T>(mut self, name: T, value: T) -> LocationWorkforcePoolProviderListCall<'a, C>
8865    where
8866        T: AsRef<str>,
8867    {
8868        self._additional_params
8869            .insert(name.as_ref().to_string(), value.as_ref().to_string());
8870        self
8871    }
8872
8873    /// Identifies the authorization scope for the method you are building.
8874    ///
8875    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
8876    /// [`Scope::CloudPlatform`].
8877    ///
8878    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
8879    /// tokens for more than one scope.
8880    ///
8881    /// Usually there is more than one suitable scope to authorize an operation, some of which may
8882    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
8883    /// sufficient, a read-write scope will do as well.
8884    pub fn add_scope<St>(mut self, scope: St) -> LocationWorkforcePoolProviderListCall<'a, C>
8885    where
8886        St: AsRef<str>,
8887    {
8888        self._scopes.insert(String::from(scope.as_ref()));
8889        self
8890    }
8891    /// Identifies the authorization scope(s) for the method you are building.
8892    ///
8893    /// See [`Self::add_scope()`] for details.
8894    pub fn add_scopes<I, St>(mut self, scopes: I) -> LocationWorkforcePoolProviderListCall<'a, C>
8895    where
8896        I: IntoIterator<Item = St>,
8897        St: AsRef<str>,
8898    {
8899        self._scopes
8900            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
8901        self
8902    }
8903
8904    /// Removes all scopes, and no default scope will be used either.
8905    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
8906    /// for details).
8907    pub fn clear_scopes(mut self) -> LocationWorkforcePoolProviderListCall<'a, C> {
8908        self._scopes.clear();
8909        self
8910    }
8911}
8912
8913/// Updates an existing WorkforcePoolProvider.
8914///
8915/// A builder for the *workforcePools.providers.patch* method supported by a *location* resource.
8916/// It is not used directly, but through a [`LocationMethods`] instance.
8917///
8918/// # Example
8919///
8920/// Instantiate a resource method builder
8921///
8922/// ```test_harness,no_run
8923/// # extern crate hyper;
8924/// # extern crate hyper_rustls;
8925/// # extern crate google_iam1 as iam1;
8926/// use iam1::api::WorkforcePoolProvider;
8927/// # async fn dox() {
8928/// # use iam1::{Iam, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8929///
8930/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
8931/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
8932/// #     secret,
8933/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8934/// # ).build().await.unwrap();
8935///
8936/// # let client = hyper_util::client::legacy::Client::builder(
8937/// #     hyper_util::rt::TokioExecutor::new()
8938/// # )
8939/// # .build(
8940/// #     hyper_rustls::HttpsConnectorBuilder::new()
8941/// #         .with_native_roots()
8942/// #         .unwrap()
8943/// #         .https_or_http()
8944/// #         .enable_http1()
8945/// #         .build()
8946/// # );
8947/// # let mut hub = Iam::new(client, auth);
8948/// // As the method needs a request, you would usually fill it with the desired information
8949/// // into the respective structure. Some of the parts shown here might not be applicable !
8950/// // Values shown here are possibly random and not representative !
8951/// let mut req = WorkforcePoolProvider::default();
8952///
8953/// // You can configure optional parameters by calling the respective setters at will, and
8954/// // execute the final call using `doit()`.
8955/// // Values shown here are possibly random and not representative !
8956/// let result = hub.locations().workforce_pools_providers_patch(req, "name")
8957///              .update_mask(FieldMask::new::<&str>(&[]))
8958///              .doit().await;
8959/// # }
8960/// ```
8961pub struct LocationWorkforcePoolProviderPatchCall<'a, C>
8962where
8963    C: 'a,
8964{
8965    hub: &'a Iam<C>,
8966    _request: WorkforcePoolProvider,
8967    _name: String,
8968    _update_mask: Option<common::FieldMask>,
8969    _delegate: Option<&'a mut dyn common::Delegate>,
8970    _additional_params: HashMap<String, String>,
8971    _scopes: BTreeSet<String>,
8972}
8973
8974impl<'a, C> common::CallBuilder for LocationWorkforcePoolProviderPatchCall<'a, C> {}
8975
8976impl<'a, C> LocationWorkforcePoolProviderPatchCall<'a, C>
8977where
8978    C: common::Connector,
8979{
8980    /// Perform the operation you have build so far.
8981    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
8982        use std::borrow::Cow;
8983        use std::io::{Read, Seek};
8984
8985        use common::{url::Params, ToParts};
8986        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
8987
8988        let mut dd = common::DefaultDelegate;
8989        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
8990        dlg.begin(common::MethodInfo {
8991            id: "iam.locations.workforcePools.providers.patch",
8992            http_method: hyper::Method::PATCH,
8993        });
8994
8995        for &field in ["alt", "name", "updateMask"].iter() {
8996            if self._additional_params.contains_key(field) {
8997                dlg.finished(false);
8998                return Err(common::Error::FieldClash(field));
8999            }
9000        }
9001
9002        let mut params = Params::with_capacity(5 + self._additional_params.len());
9003        params.push("name", self._name);
9004        if let Some(value) = self._update_mask.as_ref() {
9005            params.push("updateMask", value.to_string());
9006        }
9007
9008        params.extend(self._additional_params.iter());
9009
9010        params.push("alt", "json");
9011        let mut url = self.hub._base_url.clone() + "v1/{+name}";
9012        if self._scopes.is_empty() {
9013            self._scopes
9014                .insert(Scope::CloudPlatform.as_ref().to_string());
9015        }
9016
9017        #[allow(clippy::single_element_loop)]
9018        for &(find_this, param_name) in [("{+name}", "name")].iter() {
9019            url = params.uri_replacement(url, param_name, find_this, true);
9020        }
9021        {
9022            let to_remove = ["name"];
9023            params.remove_params(&to_remove);
9024        }
9025
9026        let url = params.parse_with_url(&url);
9027
9028        let mut json_mime_type = mime::APPLICATION_JSON;
9029        let mut request_value_reader = {
9030            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
9031            common::remove_json_null_values(&mut value);
9032            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
9033            serde_json::to_writer(&mut dst, &value).unwrap();
9034            dst
9035        };
9036        let request_size = request_value_reader
9037            .seek(std::io::SeekFrom::End(0))
9038            .unwrap();
9039        request_value_reader
9040            .seek(std::io::SeekFrom::Start(0))
9041            .unwrap();
9042
9043        loop {
9044            let token = match self
9045                .hub
9046                .auth
9047                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
9048                .await
9049            {
9050                Ok(token) => token,
9051                Err(e) => match dlg.token(e) {
9052                    Ok(token) => token,
9053                    Err(e) => {
9054                        dlg.finished(false);
9055                        return Err(common::Error::MissingToken(e));
9056                    }
9057                },
9058            };
9059            request_value_reader
9060                .seek(std::io::SeekFrom::Start(0))
9061                .unwrap();
9062            let mut req_result = {
9063                let client = &self.hub.client;
9064                dlg.pre_request();
9065                let mut req_builder = hyper::Request::builder()
9066                    .method(hyper::Method::PATCH)
9067                    .uri(url.as_str())
9068                    .header(USER_AGENT, self.hub._user_agent.clone());
9069
9070                if let Some(token) = token.as_ref() {
9071                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
9072                }
9073
9074                let request = req_builder
9075                    .header(CONTENT_TYPE, json_mime_type.to_string())
9076                    .header(CONTENT_LENGTH, request_size as u64)
9077                    .body(common::to_body(
9078                        request_value_reader.get_ref().clone().into(),
9079                    ));
9080
9081                client.request(request.unwrap()).await
9082            };
9083
9084            match req_result {
9085                Err(err) => {
9086                    if let common::Retry::After(d) = dlg.http_error(&err) {
9087                        sleep(d).await;
9088                        continue;
9089                    }
9090                    dlg.finished(false);
9091                    return Err(common::Error::HttpError(err));
9092                }
9093                Ok(res) => {
9094                    let (mut parts, body) = res.into_parts();
9095                    let mut body = common::Body::new(body);
9096                    if !parts.status.is_success() {
9097                        let bytes = common::to_bytes(body).await.unwrap_or_default();
9098                        let error = serde_json::from_str(&common::to_string(&bytes));
9099                        let response = common::to_response(parts, bytes.into());
9100
9101                        if let common::Retry::After(d) =
9102                            dlg.http_failure(&response, error.as_ref().ok())
9103                        {
9104                            sleep(d).await;
9105                            continue;
9106                        }
9107
9108                        dlg.finished(false);
9109
9110                        return Err(match error {
9111                            Ok(value) => common::Error::BadRequest(value),
9112                            _ => common::Error::Failure(response),
9113                        });
9114                    }
9115                    let response = {
9116                        let bytes = common::to_bytes(body).await.unwrap_or_default();
9117                        let encoded = common::to_string(&bytes);
9118                        match serde_json::from_str(&encoded) {
9119                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
9120                            Err(error) => {
9121                                dlg.response_json_decode_error(&encoded, &error);
9122                                return Err(common::Error::JsonDecodeError(
9123                                    encoded.to_string(),
9124                                    error,
9125                                ));
9126                            }
9127                        }
9128                    };
9129
9130                    dlg.finished(true);
9131                    return Ok(response);
9132                }
9133            }
9134        }
9135    }
9136
9137    ///
9138    /// Sets the *request* property to the given value.
9139    ///
9140    /// Even though the property as already been set when instantiating this call,
9141    /// we provide this method for API completeness.
9142    pub fn request(
9143        mut self,
9144        new_value: WorkforcePoolProvider,
9145    ) -> LocationWorkforcePoolProviderPatchCall<'a, C> {
9146        self._request = new_value;
9147        self
9148    }
9149    /// Output only. The resource name of the provider. Format: `locations/{location}/workforcePools/{workforce_pool_id}/providers/{provider_id}`
9150    ///
9151    /// Sets the *name* path property to the given value.
9152    ///
9153    /// Even though the property as already been set when instantiating this call,
9154    /// we provide this method for API completeness.
9155    pub fn name(mut self, new_value: &str) -> LocationWorkforcePoolProviderPatchCall<'a, C> {
9156        self._name = new_value.to_string();
9157        self
9158    }
9159    /// Required. The list of fields to update.
9160    ///
9161    /// Sets the *update mask* query property to the given value.
9162    pub fn update_mask(
9163        mut self,
9164        new_value: common::FieldMask,
9165    ) -> LocationWorkforcePoolProviderPatchCall<'a, C> {
9166        self._update_mask = Some(new_value);
9167        self
9168    }
9169    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
9170    /// while executing the actual API request.
9171    ///
9172    /// ````text
9173    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
9174    /// ````
9175    ///
9176    /// Sets the *delegate* property to the given value.
9177    pub fn delegate(
9178        mut self,
9179        new_value: &'a mut dyn common::Delegate,
9180    ) -> LocationWorkforcePoolProviderPatchCall<'a, C> {
9181        self._delegate = Some(new_value);
9182        self
9183    }
9184
9185    /// Set any additional parameter of the query string used in the request.
9186    /// It should be used to set parameters which are not yet available through their own
9187    /// setters.
9188    ///
9189    /// Please note that this method must not be used to set any of the known parameters
9190    /// which have their own setter method. If done anyway, the request will fail.
9191    ///
9192    /// # Additional Parameters
9193    ///
9194    /// * *$.xgafv* (query-string) - V1 error format.
9195    /// * *access_token* (query-string) - OAuth access token.
9196    /// * *alt* (query-string) - Data format for response.
9197    /// * *callback* (query-string) - JSONP
9198    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
9199    /// * *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.
9200    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
9201    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
9202    /// * *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.
9203    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
9204    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
9205    pub fn param<T>(mut self, name: T, value: T) -> LocationWorkforcePoolProviderPatchCall<'a, C>
9206    where
9207        T: AsRef<str>,
9208    {
9209        self._additional_params
9210            .insert(name.as_ref().to_string(), value.as_ref().to_string());
9211        self
9212    }
9213
9214    /// Identifies the authorization scope for the method you are building.
9215    ///
9216    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
9217    /// [`Scope::CloudPlatform`].
9218    ///
9219    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
9220    /// tokens for more than one scope.
9221    ///
9222    /// Usually there is more than one suitable scope to authorize an operation, some of which may
9223    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
9224    /// sufficient, a read-write scope will do as well.
9225    pub fn add_scope<St>(mut self, scope: St) -> LocationWorkforcePoolProviderPatchCall<'a, C>
9226    where
9227        St: AsRef<str>,
9228    {
9229        self._scopes.insert(String::from(scope.as_ref()));
9230        self
9231    }
9232    /// Identifies the authorization scope(s) for the method you are building.
9233    ///
9234    /// See [`Self::add_scope()`] for details.
9235    pub fn add_scopes<I, St>(mut self, scopes: I) -> LocationWorkforcePoolProviderPatchCall<'a, C>
9236    where
9237        I: IntoIterator<Item = St>,
9238        St: AsRef<str>,
9239    {
9240        self._scopes
9241            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
9242        self
9243    }
9244
9245    /// Removes all scopes, and no default scope will be used either.
9246    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
9247    /// for details).
9248    pub fn clear_scopes(mut self) -> LocationWorkforcePoolProviderPatchCall<'a, C> {
9249        self._scopes.clear();
9250        self
9251    }
9252}
9253
9254/// Undeletes a WorkforcePoolProvider, as long as it was deleted fewer than 30 days ago.
9255///
9256/// A builder for the *workforcePools.providers.undelete* method supported by a *location* resource.
9257/// It is not used directly, but through a [`LocationMethods`] instance.
9258///
9259/// # Example
9260///
9261/// Instantiate a resource method builder
9262///
9263/// ```test_harness,no_run
9264/// # extern crate hyper;
9265/// # extern crate hyper_rustls;
9266/// # extern crate google_iam1 as iam1;
9267/// use iam1::api::UndeleteWorkforcePoolProviderRequest;
9268/// # async fn dox() {
9269/// # use iam1::{Iam, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9270///
9271/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
9272/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
9273/// #     secret,
9274/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9275/// # ).build().await.unwrap();
9276///
9277/// # let client = hyper_util::client::legacy::Client::builder(
9278/// #     hyper_util::rt::TokioExecutor::new()
9279/// # )
9280/// # .build(
9281/// #     hyper_rustls::HttpsConnectorBuilder::new()
9282/// #         .with_native_roots()
9283/// #         .unwrap()
9284/// #         .https_or_http()
9285/// #         .enable_http1()
9286/// #         .build()
9287/// # );
9288/// # let mut hub = Iam::new(client, auth);
9289/// // As the method needs a request, you would usually fill it with the desired information
9290/// // into the respective structure. Some of the parts shown here might not be applicable !
9291/// // Values shown here are possibly random and not representative !
9292/// let mut req = UndeleteWorkforcePoolProviderRequest::default();
9293///
9294/// // You can configure optional parameters by calling the respective setters at will, and
9295/// // execute the final call using `doit()`.
9296/// // Values shown here are possibly random and not representative !
9297/// let result = hub.locations().workforce_pools_providers_undelete(req, "name")
9298///              .doit().await;
9299/// # }
9300/// ```
9301pub struct LocationWorkforcePoolProviderUndeleteCall<'a, C>
9302where
9303    C: 'a,
9304{
9305    hub: &'a Iam<C>,
9306    _request: UndeleteWorkforcePoolProviderRequest,
9307    _name: String,
9308    _delegate: Option<&'a mut dyn common::Delegate>,
9309    _additional_params: HashMap<String, String>,
9310    _scopes: BTreeSet<String>,
9311}
9312
9313impl<'a, C> common::CallBuilder for LocationWorkforcePoolProviderUndeleteCall<'a, C> {}
9314
9315impl<'a, C> LocationWorkforcePoolProviderUndeleteCall<'a, C>
9316where
9317    C: common::Connector,
9318{
9319    /// Perform the operation you have build so far.
9320    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
9321        use std::borrow::Cow;
9322        use std::io::{Read, Seek};
9323
9324        use common::{url::Params, ToParts};
9325        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
9326
9327        let mut dd = common::DefaultDelegate;
9328        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
9329        dlg.begin(common::MethodInfo {
9330            id: "iam.locations.workforcePools.providers.undelete",
9331            http_method: hyper::Method::POST,
9332        });
9333
9334        for &field in ["alt", "name"].iter() {
9335            if self._additional_params.contains_key(field) {
9336                dlg.finished(false);
9337                return Err(common::Error::FieldClash(field));
9338            }
9339        }
9340
9341        let mut params = Params::with_capacity(4 + self._additional_params.len());
9342        params.push("name", self._name);
9343
9344        params.extend(self._additional_params.iter());
9345
9346        params.push("alt", "json");
9347        let mut url = self.hub._base_url.clone() + "v1/{+name}:undelete";
9348        if self._scopes.is_empty() {
9349            self._scopes
9350                .insert(Scope::CloudPlatform.as_ref().to_string());
9351        }
9352
9353        #[allow(clippy::single_element_loop)]
9354        for &(find_this, param_name) in [("{+name}", "name")].iter() {
9355            url = params.uri_replacement(url, param_name, find_this, true);
9356        }
9357        {
9358            let to_remove = ["name"];
9359            params.remove_params(&to_remove);
9360        }
9361
9362        let url = params.parse_with_url(&url);
9363
9364        let mut json_mime_type = mime::APPLICATION_JSON;
9365        let mut request_value_reader = {
9366            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
9367            common::remove_json_null_values(&mut value);
9368            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
9369            serde_json::to_writer(&mut dst, &value).unwrap();
9370            dst
9371        };
9372        let request_size = request_value_reader
9373            .seek(std::io::SeekFrom::End(0))
9374            .unwrap();
9375        request_value_reader
9376            .seek(std::io::SeekFrom::Start(0))
9377            .unwrap();
9378
9379        loop {
9380            let token = match self
9381                .hub
9382                .auth
9383                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
9384                .await
9385            {
9386                Ok(token) => token,
9387                Err(e) => match dlg.token(e) {
9388                    Ok(token) => token,
9389                    Err(e) => {
9390                        dlg.finished(false);
9391                        return Err(common::Error::MissingToken(e));
9392                    }
9393                },
9394            };
9395            request_value_reader
9396                .seek(std::io::SeekFrom::Start(0))
9397                .unwrap();
9398            let mut req_result = {
9399                let client = &self.hub.client;
9400                dlg.pre_request();
9401                let mut req_builder = hyper::Request::builder()
9402                    .method(hyper::Method::POST)
9403                    .uri(url.as_str())
9404                    .header(USER_AGENT, self.hub._user_agent.clone());
9405
9406                if let Some(token) = token.as_ref() {
9407                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
9408                }
9409
9410                let request = req_builder
9411                    .header(CONTENT_TYPE, json_mime_type.to_string())
9412                    .header(CONTENT_LENGTH, request_size as u64)
9413                    .body(common::to_body(
9414                        request_value_reader.get_ref().clone().into(),
9415                    ));
9416
9417                client.request(request.unwrap()).await
9418            };
9419
9420            match req_result {
9421                Err(err) => {
9422                    if let common::Retry::After(d) = dlg.http_error(&err) {
9423                        sleep(d).await;
9424                        continue;
9425                    }
9426                    dlg.finished(false);
9427                    return Err(common::Error::HttpError(err));
9428                }
9429                Ok(res) => {
9430                    let (mut parts, body) = res.into_parts();
9431                    let mut body = common::Body::new(body);
9432                    if !parts.status.is_success() {
9433                        let bytes = common::to_bytes(body).await.unwrap_or_default();
9434                        let error = serde_json::from_str(&common::to_string(&bytes));
9435                        let response = common::to_response(parts, bytes.into());
9436
9437                        if let common::Retry::After(d) =
9438                            dlg.http_failure(&response, error.as_ref().ok())
9439                        {
9440                            sleep(d).await;
9441                            continue;
9442                        }
9443
9444                        dlg.finished(false);
9445
9446                        return Err(match error {
9447                            Ok(value) => common::Error::BadRequest(value),
9448                            _ => common::Error::Failure(response),
9449                        });
9450                    }
9451                    let response = {
9452                        let bytes = common::to_bytes(body).await.unwrap_or_default();
9453                        let encoded = common::to_string(&bytes);
9454                        match serde_json::from_str(&encoded) {
9455                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
9456                            Err(error) => {
9457                                dlg.response_json_decode_error(&encoded, &error);
9458                                return Err(common::Error::JsonDecodeError(
9459                                    encoded.to_string(),
9460                                    error,
9461                                ));
9462                            }
9463                        }
9464                    };
9465
9466                    dlg.finished(true);
9467                    return Ok(response);
9468                }
9469            }
9470        }
9471    }
9472
9473    ///
9474    /// Sets the *request* property to the given value.
9475    ///
9476    /// Even though the property as already been set when instantiating this call,
9477    /// we provide this method for API completeness.
9478    pub fn request(
9479        mut self,
9480        new_value: UndeleteWorkforcePoolProviderRequest,
9481    ) -> LocationWorkforcePoolProviderUndeleteCall<'a, C> {
9482        self._request = new_value;
9483        self
9484    }
9485    /// Required. The name of the provider to undelete. Format: `locations/{location}/workforcePools/{workforce_pool_id}/providers/{provider_id}`
9486    ///
9487    /// Sets the *name* path property to the given value.
9488    ///
9489    /// Even though the property as already been set when instantiating this call,
9490    /// we provide this method for API completeness.
9491    pub fn name(mut self, new_value: &str) -> LocationWorkforcePoolProviderUndeleteCall<'a, C> {
9492        self._name = new_value.to_string();
9493        self
9494    }
9495    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
9496    /// while executing the actual API request.
9497    ///
9498    /// ````text
9499    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
9500    /// ````
9501    ///
9502    /// Sets the *delegate* property to the given value.
9503    pub fn delegate(
9504        mut self,
9505        new_value: &'a mut dyn common::Delegate,
9506    ) -> LocationWorkforcePoolProviderUndeleteCall<'a, C> {
9507        self._delegate = Some(new_value);
9508        self
9509    }
9510
9511    /// Set any additional parameter of the query string used in the request.
9512    /// It should be used to set parameters which are not yet available through their own
9513    /// setters.
9514    ///
9515    /// Please note that this method must not be used to set any of the known parameters
9516    /// which have their own setter method. If done anyway, the request will fail.
9517    ///
9518    /// # Additional Parameters
9519    ///
9520    /// * *$.xgafv* (query-string) - V1 error format.
9521    /// * *access_token* (query-string) - OAuth access token.
9522    /// * *alt* (query-string) - Data format for response.
9523    /// * *callback* (query-string) - JSONP
9524    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
9525    /// * *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.
9526    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
9527    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
9528    /// * *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.
9529    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
9530    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
9531    pub fn param<T>(mut self, name: T, value: T) -> LocationWorkforcePoolProviderUndeleteCall<'a, C>
9532    where
9533        T: AsRef<str>,
9534    {
9535        self._additional_params
9536            .insert(name.as_ref().to_string(), value.as_ref().to_string());
9537        self
9538    }
9539
9540    /// Identifies the authorization scope for the method you are building.
9541    ///
9542    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
9543    /// [`Scope::CloudPlatform`].
9544    ///
9545    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
9546    /// tokens for more than one scope.
9547    ///
9548    /// Usually there is more than one suitable scope to authorize an operation, some of which may
9549    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
9550    /// sufficient, a read-write scope will do as well.
9551    pub fn add_scope<St>(mut self, scope: St) -> LocationWorkforcePoolProviderUndeleteCall<'a, C>
9552    where
9553        St: AsRef<str>,
9554    {
9555        self._scopes.insert(String::from(scope.as_ref()));
9556        self
9557    }
9558    /// Identifies the authorization scope(s) for the method you are building.
9559    ///
9560    /// See [`Self::add_scope()`] for details.
9561    pub fn add_scopes<I, St>(
9562        mut self,
9563        scopes: I,
9564    ) -> LocationWorkforcePoolProviderUndeleteCall<'a, C>
9565    where
9566        I: IntoIterator<Item = St>,
9567        St: AsRef<str>,
9568    {
9569        self._scopes
9570            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
9571        self
9572    }
9573
9574    /// Removes all scopes, and no default scope will be used either.
9575    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
9576    /// for details).
9577    pub fn clear_scopes(mut self) -> LocationWorkforcePoolProviderUndeleteCall<'a, C> {
9578        self._scopes.clear();
9579        self
9580    }
9581}
9582
9583/// Gets the latest state of a long-running operation. Clients can use this method to poll the operation result at intervals as recommended by the API service.
9584///
9585/// A builder for the *workforcePools.subjects.operations.get* method supported by a *location* resource.
9586/// It is not used directly, but through a [`LocationMethods`] instance.
9587///
9588/// # Example
9589///
9590/// Instantiate a resource method builder
9591///
9592/// ```test_harness,no_run
9593/// # extern crate hyper;
9594/// # extern crate hyper_rustls;
9595/// # extern crate google_iam1 as iam1;
9596/// # async fn dox() {
9597/// # use iam1::{Iam, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9598///
9599/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
9600/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
9601/// #     secret,
9602/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9603/// # ).build().await.unwrap();
9604///
9605/// # let client = hyper_util::client::legacy::Client::builder(
9606/// #     hyper_util::rt::TokioExecutor::new()
9607/// # )
9608/// # .build(
9609/// #     hyper_rustls::HttpsConnectorBuilder::new()
9610/// #         .with_native_roots()
9611/// #         .unwrap()
9612/// #         .https_or_http()
9613/// #         .enable_http1()
9614/// #         .build()
9615/// # );
9616/// # let mut hub = Iam::new(client, auth);
9617/// // You can configure optional parameters by calling the respective setters at will, and
9618/// // execute the final call using `doit()`.
9619/// // Values shown here are possibly random and not representative !
9620/// let result = hub.locations().workforce_pools_subjects_operations_get("name")
9621///              .doit().await;
9622/// # }
9623/// ```
9624pub struct LocationWorkforcePoolSubjectOperationGetCall<'a, C>
9625where
9626    C: 'a,
9627{
9628    hub: &'a Iam<C>,
9629    _name: String,
9630    _delegate: Option<&'a mut dyn common::Delegate>,
9631    _additional_params: HashMap<String, String>,
9632    _scopes: BTreeSet<String>,
9633}
9634
9635impl<'a, C> common::CallBuilder for LocationWorkforcePoolSubjectOperationGetCall<'a, C> {}
9636
9637impl<'a, C> LocationWorkforcePoolSubjectOperationGetCall<'a, C>
9638where
9639    C: common::Connector,
9640{
9641    /// Perform the operation you have build so far.
9642    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
9643        use std::borrow::Cow;
9644        use std::io::{Read, Seek};
9645
9646        use common::{url::Params, ToParts};
9647        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
9648
9649        let mut dd = common::DefaultDelegate;
9650        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
9651        dlg.begin(common::MethodInfo {
9652            id: "iam.locations.workforcePools.subjects.operations.get",
9653            http_method: hyper::Method::GET,
9654        });
9655
9656        for &field in ["alt", "name"].iter() {
9657            if self._additional_params.contains_key(field) {
9658                dlg.finished(false);
9659                return Err(common::Error::FieldClash(field));
9660            }
9661        }
9662
9663        let mut params = Params::with_capacity(3 + self._additional_params.len());
9664        params.push("name", self._name);
9665
9666        params.extend(self._additional_params.iter());
9667
9668        params.push("alt", "json");
9669        let mut url = self.hub._base_url.clone() + "v1/{+name}";
9670        if self._scopes.is_empty() {
9671            self._scopes
9672                .insert(Scope::CloudPlatform.as_ref().to_string());
9673        }
9674
9675        #[allow(clippy::single_element_loop)]
9676        for &(find_this, param_name) in [("{+name}", "name")].iter() {
9677            url = params.uri_replacement(url, param_name, find_this, true);
9678        }
9679        {
9680            let to_remove = ["name"];
9681            params.remove_params(&to_remove);
9682        }
9683
9684        let url = params.parse_with_url(&url);
9685
9686        loop {
9687            let token = match self
9688                .hub
9689                .auth
9690                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
9691                .await
9692            {
9693                Ok(token) => token,
9694                Err(e) => match dlg.token(e) {
9695                    Ok(token) => token,
9696                    Err(e) => {
9697                        dlg.finished(false);
9698                        return Err(common::Error::MissingToken(e));
9699                    }
9700                },
9701            };
9702            let mut req_result = {
9703                let client = &self.hub.client;
9704                dlg.pre_request();
9705                let mut req_builder = hyper::Request::builder()
9706                    .method(hyper::Method::GET)
9707                    .uri(url.as_str())
9708                    .header(USER_AGENT, self.hub._user_agent.clone());
9709
9710                if let Some(token) = token.as_ref() {
9711                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
9712                }
9713
9714                let request = req_builder
9715                    .header(CONTENT_LENGTH, 0_u64)
9716                    .body(common::to_body::<String>(None));
9717
9718                client.request(request.unwrap()).await
9719            };
9720
9721            match req_result {
9722                Err(err) => {
9723                    if let common::Retry::After(d) = dlg.http_error(&err) {
9724                        sleep(d).await;
9725                        continue;
9726                    }
9727                    dlg.finished(false);
9728                    return Err(common::Error::HttpError(err));
9729                }
9730                Ok(res) => {
9731                    let (mut parts, body) = res.into_parts();
9732                    let mut body = common::Body::new(body);
9733                    if !parts.status.is_success() {
9734                        let bytes = common::to_bytes(body).await.unwrap_or_default();
9735                        let error = serde_json::from_str(&common::to_string(&bytes));
9736                        let response = common::to_response(parts, bytes.into());
9737
9738                        if let common::Retry::After(d) =
9739                            dlg.http_failure(&response, error.as_ref().ok())
9740                        {
9741                            sleep(d).await;
9742                            continue;
9743                        }
9744
9745                        dlg.finished(false);
9746
9747                        return Err(match error {
9748                            Ok(value) => common::Error::BadRequest(value),
9749                            _ => common::Error::Failure(response),
9750                        });
9751                    }
9752                    let response = {
9753                        let bytes = common::to_bytes(body).await.unwrap_or_default();
9754                        let encoded = common::to_string(&bytes);
9755                        match serde_json::from_str(&encoded) {
9756                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
9757                            Err(error) => {
9758                                dlg.response_json_decode_error(&encoded, &error);
9759                                return Err(common::Error::JsonDecodeError(
9760                                    encoded.to_string(),
9761                                    error,
9762                                ));
9763                            }
9764                        }
9765                    };
9766
9767                    dlg.finished(true);
9768                    return Ok(response);
9769                }
9770            }
9771        }
9772    }
9773
9774    /// The name of the operation resource.
9775    ///
9776    /// Sets the *name* path property to the given value.
9777    ///
9778    /// Even though the property as already been set when instantiating this call,
9779    /// we provide this method for API completeness.
9780    pub fn name(mut self, new_value: &str) -> LocationWorkforcePoolSubjectOperationGetCall<'a, C> {
9781        self._name = new_value.to_string();
9782        self
9783    }
9784    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
9785    /// while executing the actual API request.
9786    ///
9787    /// ````text
9788    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
9789    /// ````
9790    ///
9791    /// Sets the *delegate* property to the given value.
9792    pub fn delegate(
9793        mut self,
9794        new_value: &'a mut dyn common::Delegate,
9795    ) -> LocationWorkforcePoolSubjectOperationGetCall<'a, C> {
9796        self._delegate = Some(new_value);
9797        self
9798    }
9799
9800    /// Set any additional parameter of the query string used in the request.
9801    /// It should be used to set parameters which are not yet available through their own
9802    /// setters.
9803    ///
9804    /// Please note that this method must not be used to set any of the known parameters
9805    /// which have their own setter method. If done anyway, the request will fail.
9806    ///
9807    /// # Additional Parameters
9808    ///
9809    /// * *$.xgafv* (query-string) - V1 error format.
9810    /// * *access_token* (query-string) - OAuth access token.
9811    /// * *alt* (query-string) - Data format for response.
9812    /// * *callback* (query-string) - JSONP
9813    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
9814    /// * *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.
9815    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
9816    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
9817    /// * *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.
9818    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
9819    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
9820    pub fn param<T>(
9821        mut self,
9822        name: T,
9823        value: T,
9824    ) -> LocationWorkforcePoolSubjectOperationGetCall<'a, C>
9825    where
9826        T: AsRef<str>,
9827    {
9828        self._additional_params
9829            .insert(name.as_ref().to_string(), value.as_ref().to_string());
9830        self
9831    }
9832
9833    /// Identifies the authorization scope for the method you are building.
9834    ///
9835    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
9836    /// [`Scope::CloudPlatform`].
9837    ///
9838    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
9839    /// tokens for more than one scope.
9840    ///
9841    /// Usually there is more than one suitable scope to authorize an operation, some of which may
9842    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
9843    /// sufficient, a read-write scope will do as well.
9844    pub fn add_scope<St>(mut self, scope: St) -> LocationWorkforcePoolSubjectOperationGetCall<'a, C>
9845    where
9846        St: AsRef<str>,
9847    {
9848        self._scopes.insert(String::from(scope.as_ref()));
9849        self
9850    }
9851    /// Identifies the authorization scope(s) for the method you are building.
9852    ///
9853    /// See [`Self::add_scope()`] for details.
9854    pub fn add_scopes<I, St>(
9855        mut self,
9856        scopes: I,
9857    ) -> LocationWorkforcePoolSubjectOperationGetCall<'a, C>
9858    where
9859        I: IntoIterator<Item = St>,
9860        St: AsRef<str>,
9861    {
9862        self._scopes
9863            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
9864        self
9865    }
9866
9867    /// Removes all scopes, and no default scope will be used either.
9868    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
9869    /// for details).
9870    pub fn clear_scopes(mut self) -> LocationWorkforcePoolSubjectOperationGetCall<'a, C> {
9871        self._scopes.clear();
9872        self
9873    }
9874}
9875
9876/// Deletes a WorkforcePoolSubject. Subject must not already be in a deleted state. A WorkforcePoolSubject is automatically created the first time an external credential is exchanged for a Google Cloud credential using a mapped `google.subject` attribute. There is no endpoint to manually create a WorkforcePoolSubject. For 30 days after a WorkforcePoolSubject is deleted, using the same `google.subject` attribute in token exchanges with Google Cloud STS fails. Call UndeleteWorkforcePoolSubject to undelete a WorkforcePoolSubject that has been deleted, within within 30 days of deleting it. After 30 days, the WorkforcePoolSubject is permanently deleted. At this point, a token exchange with Google Cloud STS that uses the same mapped `google.subject` attribute automatically creates a new WorkforcePoolSubject that is unrelated to the previously deleted WorkforcePoolSubject but has the same `google.subject` value.
9877///
9878/// A builder for the *workforcePools.subjects.delete* method supported by a *location* resource.
9879/// It is not used directly, but through a [`LocationMethods`] instance.
9880///
9881/// # Example
9882///
9883/// Instantiate a resource method builder
9884///
9885/// ```test_harness,no_run
9886/// # extern crate hyper;
9887/// # extern crate hyper_rustls;
9888/// # extern crate google_iam1 as iam1;
9889/// # async fn dox() {
9890/// # use iam1::{Iam, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9891///
9892/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
9893/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
9894/// #     secret,
9895/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9896/// # ).build().await.unwrap();
9897///
9898/// # let client = hyper_util::client::legacy::Client::builder(
9899/// #     hyper_util::rt::TokioExecutor::new()
9900/// # )
9901/// # .build(
9902/// #     hyper_rustls::HttpsConnectorBuilder::new()
9903/// #         .with_native_roots()
9904/// #         .unwrap()
9905/// #         .https_or_http()
9906/// #         .enable_http1()
9907/// #         .build()
9908/// # );
9909/// # let mut hub = Iam::new(client, auth);
9910/// // You can configure optional parameters by calling the respective setters at will, and
9911/// // execute the final call using `doit()`.
9912/// // Values shown here are possibly random and not representative !
9913/// let result = hub.locations().workforce_pools_subjects_delete("name")
9914///              .doit().await;
9915/// # }
9916/// ```
9917pub struct LocationWorkforcePoolSubjectDeleteCall<'a, C>
9918where
9919    C: 'a,
9920{
9921    hub: &'a Iam<C>,
9922    _name: String,
9923    _delegate: Option<&'a mut dyn common::Delegate>,
9924    _additional_params: HashMap<String, String>,
9925    _scopes: BTreeSet<String>,
9926}
9927
9928impl<'a, C> common::CallBuilder for LocationWorkforcePoolSubjectDeleteCall<'a, C> {}
9929
9930impl<'a, C> LocationWorkforcePoolSubjectDeleteCall<'a, C>
9931where
9932    C: common::Connector,
9933{
9934    /// Perform the operation you have build so far.
9935    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
9936        use std::borrow::Cow;
9937        use std::io::{Read, Seek};
9938
9939        use common::{url::Params, ToParts};
9940        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
9941
9942        let mut dd = common::DefaultDelegate;
9943        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
9944        dlg.begin(common::MethodInfo {
9945            id: "iam.locations.workforcePools.subjects.delete",
9946            http_method: hyper::Method::DELETE,
9947        });
9948
9949        for &field in ["alt", "name"].iter() {
9950            if self._additional_params.contains_key(field) {
9951                dlg.finished(false);
9952                return Err(common::Error::FieldClash(field));
9953            }
9954        }
9955
9956        let mut params = Params::with_capacity(3 + self._additional_params.len());
9957        params.push("name", self._name);
9958
9959        params.extend(self._additional_params.iter());
9960
9961        params.push("alt", "json");
9962        let mut url = self.hub._base_url.clone() + "v1/{+name}";
9963        if self._scopes.is_empty() {
9964            self._scopes
9965                .insert(Scope::CloudPlatform.as_ref().to_string());
9966        }
9967
9968        #[allow(clippy::single_element_loop)]
9969        for &(find_this, param_name) in [("{+name}", "name")].iter() {
9970            url = params.uri_replacement(url, param_name, find_this, true);
9971        }
9972        {
9973            let to_remove = ["name"];
9974            params.remove_params(&to_remove);
9975        }
9976
9977        let url = params.parse_with_url(&url);
9978
9979        loop {
9980            let token = match self
9981                .hub
9982                .auth
9983                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
9984                .await
9985            {
9986                Ok(token) => token,
9987                Err(e) => match dlg.token(e) {
9988                    Ok(token) => token,
9989                    Err(e) => {
9990                        dlg.finished(false);
9991                        return Err(common::Error::MissingToken(e));
9992                    }
9993                },
9994            };
9995            let mut req_result = {
9996                let client = &self.hub.client;
9997                dlg.pre_request();
9998                let mut req_builder = hyper::Request::builder()
9999                    .method(hyper::Method::DELETE)
10000                    .uri(url.as_str())
10001                    .header(USER_AGENT, self.hub._user_agent.clone());
10002
10003                if let Some(token) = token.as_ref() {
10004                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
10005                }
10006
10007                let request = req_builder
10008                    .header(CONTENT_LENGTH, 0_u64)
10009                    .body(common::to_body::<String>(None));
10010
10011                client.request(request.unwrap()).await
10012            };
10013
10014            match req_result {
10015                Err(err) => {
10016                    if let common::Retry::After(d) = dlg.http_error(&err) {
10017                        sleep(d).await;
10018                        continue;
10019                    }
10020                    dlg.finished(false);
10021                    return Err(common::Error::HttpError(err));
10022                }
10023                Ok(res) => {
10024                    let (mut parts, body) = res.into_parts();
10025                    let mut body = common::Body::new(body);
10026                    if !parts.status.is_success() {
10027                        let bytes = common::to_bytes(body).await.unwrap_or_default();
10028                        let error = serde_json::from_str(&common::to_string(&bytes));
10029                        let response = common::to_response(parts, bytes.into());
10030
10031                        if let common::Retry::After(d) =
10032                            dlg.http_failure(&response, error.as_ref().ok())
10033                        {
10034                            sleep(d).await;
10035                            continue;
10036                        }
10037
10038                        dlg.finished(false);
10039
10040                        return Err(match error {
10041                            Ok(value) => common::Error::BadRequest(value),
10042                            _ => common::Error::Failure(response),
10043                        });
10044                    }
10045                    let response = {
10046                        let bytes = common::to_bytes(body).await.unwrap_or_default();
10047                        let encoded = common::to_string(&bytes);
10048                        match serde_json::from_str(&encoded) {
10049                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
10050                            Err(error) => {
10051                                dlg.response_json_decode_error(&encoded, &error);
10052                                return Err(common::Error::JsonDecodeError(
10053                                    encoded.to_string(),
10054                                    error,
10055                                ));
10056                            }
10057                        }
10058                    };
10059
10060                    dlg.finished(true);
10061                    return Ok(response);
10062                }
10063            }
10064        }
10065    }
10066
10067    /// Required. The resource name of the WorkforcePoolSubject. Special characters, like `/` and `:`, must be escaped, because all URLs need to conform to the "When to Escape and Unescape" section of [RFC3986](https://www.ietf.org/rfc/rfc2396.txt). Format: `locations/{location}/workforcePools/{workforce_pool_id}/subjects/{subject_id}`
10068    ///
10069    /// Sets the *name* path property to the given value.
10070    ///
10071    /// Even though the property as already been set when instantiating this call,
10072    /// we provide this method for API completeness.
10073    pub fn name(mut self, new_value: &str) -> LocationWorkforcePoolSubjectDeleteCall<'a, C> {
10074        self._name = new_value.to_string();
10075        self
10076    }
10077    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
10078    /// while executing the actual API request.
10079    ///
10080    /// ````text
10081    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
10082    /// ````
10083    ///
10084    /// Sets the *delegate* property to the given value.
10085    pub fn delegate(
10086        mut self,
10087        new_value: &'a mut dyn common::Delegate,
10088    ) -> LocationWorkforcePoolSubjectDeleteCall<'a, C> {
10089        self._delegate = Some(new_value);
10090        self
10091    }
10092
10093    /// Set any additional parameter of the query string used in the request.
10094    /// It should be used to set parameters which are not yet available through their own
10095    /// setters.
10096    ///
10097    /// Please note that this method must not be used to set any of the known parameters
10098    /// which have their own setter method. If done anyway, the request will fail.
10099    ///
10100    /// # Additional Parameters
10101    ///
10102    /// * *$.xgafv* (query-string) - V1 error format.
10103    /// * *access_token* (query-string) - OAuth access token.
10104    /// * *alt* (query-string) - Data format for response.
10105    /// * *callback* (query-string) - JSONP
10106    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
10107    /// * *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.
10108    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
10109    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
10110    /// * *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.
10111    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
10112    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
10113    pub fn param<T>(mut self, name: T, value: T) -> LocationWorkforcePoolSubjectDeleteCall<'a, C>
10114    where
10115        T: AsRef<str>,
10116    {
10117        self._additional_params
10118            .insert(name.as_ref().to_string(), value.as_ref().to_string());
10119        self
10120    }
10121
10122    /// Identifies the authorization scope for the method you are building.
10123    ///
10124    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
10125    /// [`Scope::CloudPlatform`].
10126    ///
10127    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
10128    /// tokens for more than one scope.
10129    ///
10130    /// Usually there is more than one suitable scope to authorize an operation, some of which may
10131    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
10132    /// sufficient, a read-write scope will do as well.
10133    pub fn add_scope<St>(mut self, scope: St) -> LocationWorkforcePoolSubjectDeleteCall<'a, C>
10134    where
10135        St: AsRef<str>,
10136    {
10137        self._scopes.insert(String::from(scope.as_ref()));
10138        self
10139    }
10140    /// Identifies the authorization scope(s) for the method you are building.
10141    ///
10142    /// See [`Self::add_scope()`] for details.
10143    pub fn add_scopes<I, St>(mut self, scopes: I) -> LocationWorkforcePoolSubjectDeleteCall<'a, C>
10144    where
10145        I: IntoIterator<Item = St>,
10146        St: AsRef<str>,
10147    {
10148        self._scopes
10149            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
10150        self
10151    }
10152
10153    /// Removes all scopes, and no default scope will be used either.
10154    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
10155    /// for details).
10156    pub fn clear_scopes(mut self) -> LocationWorkforcePoolSubjectDeleteCall<'a, C> {
10157        self._scopes.clear();
10158        self
10159    }
10160}
10161
10162/// Undeletes a WorkforcePoolSubject, as long as it was deleted fewer than 30 days ago.
10163///
10164/// A builder for the *workforcePools.subjects.undelete* method supported by a *location* resource.
10165/// It is not used directly, but through a [`LocationMethods`] instance.
10166///
10167/// # Example
10168///
10169/// Instantiate a resource method builder
10170///
10171/// ```test_harness,no_run
10172/// # extern crate hyper;
10173/// # extern crate hyper_rustls;
10174/// # extern crate google_iam1 as iam1;
10175/// use iam1::api::UndeleteWorkforcePoolSubjectRequest;
10176/// # async fn dox() {
10177/// # use iam1::{Iam, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
10178///
10179/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
10180/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
10181/// #     secret,
10182/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
10183/// # ).build().await.unwrap();
10184///
10185/// # let client = hyper_util::client::legacy::Client::builder(
10186/// #     hyper_util::rt::TokioExecutor::new()
10187/// # )
10188/// # .build(
10189/// #     hyper_rustls::HttpsConnectorBuilder::new()
10190/// #         .with_native_roots()
10191/// #         .unwrap()
10192/// #         .https_or_http()
10193/// #         .enable_http1()
10194/// #         .build()
10195/// # );
10196/// # let mut hub = Iam::new(client, auth);
10197/// // As the method needs a request, you would usually fill it with the desired information
10198/// // into the respective structure. Some of the parts shown here might not be applicable !
10199/// // Values shown here are possibly random and not representative !
10200/// let mut req = UndeleteWorkforcePoolSubjectRequest::default();
10201///
10202/// // You can configure optional parameters by calling the respective setters at will, and
10203/// // execute the final call using `doit()`.
10204/// // Values shown here are possibly random and not representative !
10205/// let result = hub.locations().workforce_pools_subjects_undelete(req, "name")
10206///              .doit().await;
10207/// # }
10208/// ```
10209pub struct LocationWorkforcePoolSubjectUndeleteCall<'a, C>
10210where
10211    C: 'a,
10212{
10213    hub: &'a Iam<C>,
10214    _request: UndeleteWorkforcePoolSubjectRequest,
10215    _name: String,
10216    _delegate: Option<&'a mut dyn common::Delegate>,
10217    _additional_params: HashMap<String, String>,
10218    _scopes: BTreeSet<String>,
10219}
10220
10221impl<'a, C> common::CallBuilder for LocationWorkforcePoolSubjectUndeleteCall<'a, C> {}
10222
10223impl<'a, C> LocationWorkforcePoolSubjectUndeleteCall<'a, C>
10224where
10225    C: common::Connector,
10226{
10227    /// Perform the operation you have build so far.
10228    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
10229        use std::borrow::Cow;
10230        use std::io::{Read, Seek};
10231
10232        use common::{url::Params, ToParts};
10233        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
10234
10235        let mut dd = common::DefaultDelegate;
10236        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
10237        dlg.begin(common::MethodInfo {
10238            id: "iam.locations.workforcePools.subjects.undelete",
10239            http_method: hyper::Method::POST,
10240        });
10241
10242        for &field in ["alt", "name"].iter() {
10243            if self._additional_params.contains_key(field) {
10244                dlg.finished(false);
10245                return Err(common::Error::FieldClash(field));
10246            }
10247        }
10248
10249        let mut params = Params::with_capacity(4 + self._additional_params.len());
10250        params.push("name", self._name);
10251
10252        params.extend(self._additional_params.iter());
10253
10254        params.push("alt", "json");
10255        let mut url = self.hub._base_url.clone() + "v1/{+name}:undelete";
10256        if self._scopes.is_empty() {
10257            self._scopes
10258                .insert(Scope::CloudPlatform.as_ref().to_string());
10259        }
10260
10261        #[allow(clippy::single_element_loop)]
10262        for &(find_this, param_name) in [("{+name}", "name")].iter() {
10263            url = params.uri_replacement(url, param_name, find_this, true);
10264        }
10265        {
10266            let to_remove = ["name"];
10267            params.remove_params(&to_remove);
10268        }
10269
10270        let url = params.parse_with_url(&url);
10271
10272        let mut json_mime_type = mime::APPLICATION_JSON;
10273        let mut request_value_reader = {
10274            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
10275            common::remove_json_null_values(&mut value);
10276            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
10277            serde_json::to_writer(&mut dst, &value).unwrap();
10278            dst
10279        };
10280        let request_size = request_value_reader
10281            .seek(std::io::SeekFrom::End(0))
10282            .unwrap();
10283        request_value_reader
10284            .seek(std::io::SeekFrom::Start(0))
10285            .unwrap();
10286
10287        loop {
10288            let token = match self
10289                .hub
10290                .auth
10291                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
10292                .await
10293            {
10294                Ok(token) => token,
10295                Err(e) => match dlg.token(e) {
10296                    Ok(token) => token,
10297                    Err(e) => {
10298                        dlg.finished(false);
10299                        return Err(common::Error::MissingToken(e));
10300                    }
10301                },
10302            };
10303            request_value_reader
10304                .seek(std::io::SeekFrom::Start(0))
10305                .unwrap();
10306            let mut req_result = {
10307                let client = &self.hub.client;
10308                dlg.pre_request();
10309                let mut req_builder = hyper::Request::builder()
10310                    .method(hyper::Method::POST)
10311                    .uri(url.as_str())
10312                    .header(USER_AGENT, self.hub._user_agent.clone());
10313
10314                if let Some(token) = token.as_ref() {
10315                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
10316                }
10317
10318                let request = req_builder
10319                    .header(CONTENT_TYPE, json_mime_type.to_string())
10320                    .header(CONTENT_LENGTH, request_size as u64)
10321                    .body(common::to_body(
10322                        request_value_reader.get_ref().clone().into(),
10323                    ));
10324
10325                client.request(request.unwrap()).await
10326            };
10327
10328            match req_result {
10329                Err(err) => {
10330                    if let common::Retry::After(d) = dlg.http_error(&err) {
10331                        sleep(d).await;
10332                        continue;
10333                    }
10334                    dlg.finished(false);
10335                    return Err(common::Error::HttpError(err));
10336                }
10337                Ok(res) => {
10338                    let (mut parts, body) = res.into_parts();
10339                    let mut body = common::Body::new(body);
10340                    if !parts.status.is_success() {
10341                        let bytes = common::to_bytes(body).await.unwrap_or_default();
10342                        let error = serde_json::from_str(&common::to_string(&bytes));
10343                        let response = common::to_response(parts, bytes.into());
10344
10345                        if let common::Retry::After(d) =
10346                            dlg.http_failure(&response, error.as_ref().ok())
10347                        {
10348                            sleep(d).await;
10349                            continue;
10350                        }
10351
10352                        dlg.finished(false);
10353
10354                        return Err(match error {
10355                            Ok(value) => common::Error::BadRequest(value),
10356                            _ => common::Error::Failure(response),
10357                        });
10358                    }
10359                    let response = {
10360                        let bytes = common::to_bytes(body).await.unwrap_or_default();
10361                        let encoded = common::to_string(&bytes);
10362                        match serde_json::from_str(&encoded) {
10363                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
10364                            Err(error) => {
10365                                dlg.response_json_decode_error(&encoded, &error);
10366                                return Err(common::Error::JsonDecodeError(
10367                                    encoded.to_string(),
10368                                    error,
10369                                ));
10370                            }
10371                        }
10372                    };
10373
10374                    dlg.finished(true);
10375                    return Ok(response);
10376                }
10377            }
10378        }
10379    }
10380
10381    ///
10382    /// Sets the *request* property to the given value.
10383    ///
10384    /// Even though the property as already been set when instantiating this call,
10385    /// we provide this method for API completeness.
10386    pub fn request(
10387        mut self,
10388        new_value: UndeleteWorkforcePoolSubjectRequest,
10389    ) -> LocationWorkforcePoolSubjectUndeleteCall<'a, C> {
10390        self._request = new_value;
10391        self
10392    }
10393    /// Required. The resource name of the WorkforcePoolSubject. Special characters, like `/` and `:`, must be escaped, because all URLs need to conform to the "When to Escape and Unescape" section of [RFC3986](https://www.ietf.org/rfc/rfc2396.txt). Format: `locations/{location}/workforcePools/{workforce_pool_id}/subjects/{subject_id}`
10394    ///
10395    /// Sets the *name* path property to the given value.
10396    ///
10397    /// Even though the property as already been set when instantiating this call,
10398    /// we provide this method for API completeness.
10399    pub fn name(mut self, new_value: &str) -> LocationWorkforcePoolSubjectUndeleteCall<'a, C> {
10400        self._name = new_value.to_string();
10401        self
10402    }
10403    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
10404    /// while executing the actual API request.
10405    ///
10406    /// ````text
10407    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
10408    /// ````
10409    ///
10410    /// Sets the *delegate* property to the given value.
10411    pub fn delegate(
10412        mut self,
10413        new_value: &'a mut dyn common::Delegate,
10414    ) -> LocationWorkforcePoolSubjectUndeleteCall<'a, C> {
10415        self._delegate = Some(new_value);
10416        self
10417    }
10418
10419    /// Set any additional parameter of the query string used in the request.
10420    /// It should be used to set parameters which are not yet available through their own
10421    /// setters.
10422    ///
10423    /// Please note that this method must not be used to set any of the known parameters
10424    /// which have their own setter method. If done anyway, the request will fail.
10425    ///
10426    /// # Additional Parameters
10427    ///
10428    /// * *$.xgafv* (query-string) - V1 error format.
10429    /// * *access_token* (query-string) - OAuth access token.
10430    /// * *alt* (query-string) - Data format for response.
10431    /// * *callback* (query-string) - JSONP
10432    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
10433    /// * *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.
10434    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
10435    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
10436    /// * *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.
10437    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
10438    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
10439    pub fn param<T>(mut self, name: T, value: T) -> LocationWorkforcePoolSubjectUndeleteCall<'a, C>
10440    where
10441        T: AsRef<str>,
10442    {
10443        self._additional_params
10444            .insert(name.as_ref().to_string(), value.as_ref().to_string());
10445        self
10446    }
10447
10448    /// Identifies the authorization scope for the method you are building.
10449    ///
10450    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
10451    /// [`Scope::CloudPlatform`].
10452    ///
10453    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
10454    /// tokens for more than one scope.
10455    ///
10456    /// Usually there is more than one suitable scope to authorize an operation, some of which may
10457    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
10458    /// sufficient, a read-write scope will do as well.
10459    pub fn add_scope<St>(mut self, scope: St) -> LocationWorkforcePoolSubjectUndeleteCall<'a, C>
10460    where
10461        St: AsRef<str>,
10462    {
10463        self._scopes.insert(String::from(scope.as_ref()));
10464        self
10465    }
10466    /// Identifies the authorization scope(s) for the method you are building.
10467    ///
10468    /// See [`Self::add_scope()`] for details.
10469    pub fn add_scopes<I, St>(mut self, scopes: I) -> LocationWorkforcePoolSubjectUndeleteCall<'a, C>
10470    where
10471        I: IntoIterator<Item = St>,
10472        St: AsRef<str>,
10473    {
10474        self._scopes
10475            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
10476        self
10477    }
10478
10479    /// Removes all scopes, and no default scope will be used either.
10480    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
10481    /// for details).
10482    pub fn clear_scopes(mut self) -> LocationWorkforcePoolSubjectUndeleteCall<'a, C> {
10483        self._scopes.clear();
10484        self
10485    }
10486}
10487
10488/// Creates a new WorkforcePool. You cannot reuse the name of a deleted pool until 30 days after deletion.
10489///
10490/// A builder for the *workforcePools.create* method supported by a *location* resource.
10491/// It is not used directly, but through a [`LocationMethods`] instance.
10492///
10493/// # Example
10494///
10495/// Instantiate a resource method builder
10496///
10497/// ```test_harness,no_run
10498/// # extern crate hyper;
10499/// # extern crate hyper_rustls;
10500/// # extern crate google_iam1 as iam1;
10501/// use iam1::api::WorkforcePool;
10502/// # async fn dox() {
10503/// # use iam1::{Iam, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
10504///
10505/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
10506/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
10507/// #     secret,
10508/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
10509/// # ).build().await.unwrap();
10510///
10511/// # let client = hyper_util::client::legacy::Client::builder(
10512/// #     hyper_util::rt::TokioExecutor::new()
10513/// # )
10514/// # .build(
10515/// #     hyper_rustls::HttpsConnectorBuilder::new()
10516/// #         .with_native_roots()
10517/// #         .unwrap()
10518/// #         .https_or_http()
10519/// #         .enable_http1()
10520/// #         .build()
10521/// # );
10522/// # let mut hub = Iam::new(client, auth);
10523/// // As the method needs a request, you would usually fill it with the desired information
10524/// // into the respective structure. Some of the parts shown here might not be applicable !
10525/// // Values shown here are possibly random and not representative !
10526/// let mut req = WorkforcePool::default();
10527///
10528/// // You can configure optional parameters by calling the respective setters at will, and
10529/// // execute the final call using `doit()`.
10530/// // Values shown here are possibly random and not representative !
10531/// let result = hub.locations().workforce_pools_create(req, "location")
10532///              .workforce_pool_id("gubergren")
10533///              .doit().await;
10534/// # }
10535/// ```
10536pub struct LocationWorkforcePoolCreateCall<'a, C>
10537where
10538    C: 'a,
10539{
10540    hub: &'a Iam<C>,
10541    _request: WorkforcePool,
10542    _location: String,
10543    _workforce_pool_id: Option<String>,
10544    _delegate: Option<&'a mut dyn common::Delegate>,
10545    _additional_params: HashMap<String, String>,
10546    _scopes: BTreeSet<String>,
10547}
10548
10549impl<'a, C> common::CallBuilder for LocationWorkforcePoolCreateCall<'a, C> {}
10550
10551impl<'a, C> LocationWorkforcePoolCreateCall<'a, C>
10552where
10553    C: common::Connector,
10554{
10555    /// Perform the operation you have build so far.
10556    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
10557        use std::borrow::Cow;
10558        use std::io::{Read, Seek};
10559
10560        use common::{url::Params, ToParts};
10561        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
10562
10563        let mut dd = common::DefaultDelegate;
10564        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
10565        dlg.begin(common::MethodInfo {
10566            id: "iam.locations.workforcePools.create",
10567            http_method: hyper::Method::POST,
10568        });
10569
10570        for &field in ["alt", "location", "workforcePoolId"].iter() {
10571            if self._additional_params.contains_key(field) {
10572                dlg.finished(false);
10573                return Err(common::Error::FieldClash(field));
10574            }
10575        }
10576
10577        let mut params = Params::with_capacity(5 + self._additional_params.len());
10578        params.push("location", self._location);
10579        if let Some(value) = self._workforce_pool_id.as_ref() {
10580            params.push("workforcePoolId", value);
10581        }
10582
10583        params.extend(self._additional_params.iter());
10584
10585        params.push("alt", "json");
10586        let mut url = self.hub._base_url.clone() + "v1/{+location}/workforcePools";
10587        if self._scopes.is_empty() {
10588            self._scopes
10589                .insert(Scope::CloudPlatform.as_ref().to_string());
10590        }
10591
10592        #[allow(clippy::single_element_loop)]
10593        for &(find_this, param_name) in [("{+location}", "location")].iter() {
10594            url = params.uri_replacement(url, param_name, find_this, true);
10595        }
10596        {
10597            let to_remove = ["location"];
10598            params.remove_params(&to_remove);
10599        }
10600
10601        let url = params.parse_with_url(&url);
10602
10603        let mut json_mime_type = mime::APPLICATION_JSON;
10604        let mut request_value_reader = {
10605            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
10606            common::remove_json_null_values(&mut value);
10607            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
10608            serde_json::to_writer(&mut dst, &value).unwrap();
10609            dst
10610        };
10611        let request_size = request_value_reader
10612            .seek(std::io::SeekFrom::End(0))
10613            .unwrap();
10614        request_value_reader
10615            .seek(std::io::SeekFrom::Start(0))
10616            .unwrap();
10617
10618        loop {
10619            let token = match self
10620                .hub
10621                .auth
10622                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
10623                .await
10624            {
10625                Ok(token) => token,
10626                Err(e) => match dlg.token(e) {
10627                    Ok(token) => token,
10628                    Err(e) => {
10629                        dlg.finished(false);
10630                        return Err(common::Error::MissingToken(e));
10631                    }
10632                },
10633            };
10634            request_value_reader
10635                .seek(std::io::SeekFrom::Start(0))
10636                .unwrap();
10637            let mut req_result = {
10638                let client = &self.hub.client;
10639                dlg.pre_request();
10640                let mut req_builder = hyper::Request::builder()
10641                    .method(hyper::Method::POST)
10642                    .uri(url.as_str())
10643                    .header(USER_AGENT, self.hub._user_agent.clone());
10644
10645                if let Some(token) = token.as_ref() {
10646                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
10647                }
10648
10649                let request = req_builder
10650                    .header(CONTENT_TYPE, json_mime_type.to_string())
10651                    .header(CONTENT_LENGTH, request_size as u64)
10652                    .body(common::to_body(
10653                        request_value_reader.get_ref().clone().into(),
10654                    ));
10655
10656                client.request(request.unwrap()).await
10657            };
10658
10659            match req_result {
10660                Err(err) => {
10661                    if let common::Retry::After(d) = dlg.http_error(&err) {
10662                        sleep(d).await;
10663                        continue;
10664                    }
10665                    dlg.finished(false);
10666                    return Err(common::Error::HttpError(err));
10667                }
10668                Ok(res) => {
10669                    let (mut parts, body) = res.into_parts();
10670                    let mut body = common::Body::new(body);
10671                    if !parts.status.is_success() {
10672                        let bytes = common::to_bytes(body).await.unwrap_or_default();
10673                        let error = serde_json::from_str(&common::to_string(&bytes));
10674                        let response = common::to_response(parts, bytes.into());
10675
10676                        if let common::Retry::After(d) =
10677                            dlg.http_failure(&response, error.as_ref().ok())
10678                        {
10679                            sleep(d).await;
10680                            continue;
10681                        }
10682
10683                        dlg.finished(false);
10684
10685                        return Err(match error {
10686                            Ok(value) => common::Error::BadRequest(value),
10687                            _ => common::Error::Failure(response),
10688                        });
10689                    }
10690                    let response = {
10691                        let bytes = common::to_bytes(body).await.unwrap_or_default();
10692                        let encoded = common::to_string(&bytes);
10693                        match serde_json::from_str(&encoded) {
10694                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
10695                            Err(error) => {
10696                                dlg.response_json_decode_error(&encoded, &error);
10697                                return Err(common::Error::JsonDecodeError(
10698                                    encoded.to_string(),
10699                                    error,
10700                                ));
10701                            }
10702                        }
10703                    };
10704
10705                    dlg.finished(true);
10706                    return Ok(response);
10707                }
10708            }
10709        }
10710    }
10711
10712    ///
10713    /// Sets the *request* property to the given value.
10714    ///
10715    /// Even though the property as already been set when instantiating this call,
10716    /// we provide this method for API completeness.
10717    pub fn request(mut self, new_value: WorkforcePool) -> LocationWorkforcePoolCreateCall<'a, C> {
10718        self._request = new_value;
10719        self
10720    }
10721    /// The location of the pool to create. Format: `locations/{location}`.
10722    ///
10723    /// Sets the *location* path property to the given value.
10724    ///
10725    /// Even though the property as already been set when instantiating this call,
10726    /// we provide this method for API completeness.
10727    pub fn location(mut self, new_value: &str) -> LocationWorkforcePoolCreateCall<'a, C> {
10728        self._location = new_value.to_string();
10729        self
10730    }
10731    /// The ID to use for the pool, which becomes the final component of the resource name. The IDs must be a globally unique string of 6 to 63 lowercase letters, digits, or hyphens. It must start with a letter, and cannot have a trailing hyphen. The prefix `gcp-` is reserved for use by Google, and may not be specified.
10732    ///
10733    /// Sets the *workforce pool id* query property to the given value.
10734    pub fn workforce_pool_id(mut self, new_value: &str) -> LocationWorkforcePoolCreateCall<'a, C> {
10735        self._workforce_pool_id = Some(new_value.to_string());
10736        self
10737    }
10738    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
10739    /// while executing the actual API request.
10740    ///
10741    /// ````text
10742    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
10743    /// ````
10744    ///
10745    /// Sets the *delegate* property to the given value.
10746    pub fn delegate(
10747        mut self,
10748        new_value: &'a mut dyn common::Delegate,
10749    ) -> LocationWorkforcePoolCreateCall<'a, C> {
10750        self._delegate = Some(new_value);
10751        self
10752    }
10753
10754    /// Set any additional parameter of the query string used in the request.
10755    /// It should be used to set parameters which are not yet available through their own
10756    /// setters.
10757    ///
10758    /// Please note that this method must not be used to set any of the known parameters
10759    /// which have their own setter method. If done anyway, the request will fail.
10760    ///
10761    /// # Additional Parameters
10762    ///
10763    /// * *$.xgafv* (query-string) - V1 error format.
10764    /// * *access_token* (query-string) - OAuth access token.
10765    /// * *alt* (query-string) - Data format for response.
10766    /// * *callback* (query-string) - JSONP
10767    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
10768    /// * *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.
10769    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
10770    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
10771    /// * *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.
10772    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
10773    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
10774    pub fn param<T>(mut self, name: T, value: T) -> LocationWorkforcePoolCreateCall<'a, C>
10775    where
10776        T: AsRef<str>,
10777    {
10778        self._additional_params
10779            .insert(name.as_ref().to_string(), value.as_ref().to_string());
10780        self
10781    }
10782
10783    /// Identifies the authorization scope for the method you are building.
10784    ///
10785    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
10786    /// [`Scope::CloudPlatform`].
10787    ///
10788    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
10789    /// tokens for more than one scope.
10790    ///
10791    /// Usually there is more than one suitable scope to authorize an operation, some of which may
10792    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
10793    /// sufficient, a read-write scope will do as well.
10794    pub fn add_scope<St>(mut self, scope: St) -> LocationWorkforcePoolCreateCall<'a, C>
10795    where
10796        St: AsRef<str>,
10797    {
10798        self._scopes.insert(String::from(scope.as_ref()));
10799        self
10800    }
10801    /// Identifies the authorization scope(s) for the method you are building.
10802    ///
10803    /// See [`Self::add_scope()`] for details.
10804    pub fn add_scopes<I, St>(mut self, scopes: I) -> LocationWorkforcePoolCreateCall<'a, C>
10805    where
10806        I: IntoIterator<Item = St>,
10807        St: AsRef<str>,
10808    {
10809        self._scopes
10810            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
10811        self
10812    }
10813
10814    /// Removes all scopes, and no default scope will be used either.
10815    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
10816    /// for details).
10817    pub fn clear_scopes(mut self) -> LocationWorkforcePoolCreateCall<'a, C> {
10818        self._scopes.clear();
10819        self
10820    }
10821}
10822
10823/// Deletes a WorkforcePool. You cannot use a deleted WorkforcePool to exchange external credentials for Google Cloud credentials. However, deletion does not revoke credentials that have already been issued. Credentials issued for a deleted pool do not grant access to resources. If the pool is undeleted, and the credentials are not expired, they grant access again. You can undelete a pool for 30 days. After 30 days, deletion is permanent. You cannot update deleted pools. However, you can view and list them.
10824///
10825/// A builder for the *workforcePools.delete* method supported by a *location* resource.
10826/// It is not used directly, but through a [`LocationMethods`] instance.
10827///
10828/// # Example
10829///
10830/// Instantiate a resource method builder
10831///
10832/// ```test_harness,no_run
10833/// # extern crate hyper;
10834/// # extern crate hyper_rustls;
10835/// # extern crate google_iam1 as iam1;
10836/// # async fn dox() {
10837/// # use iam1::{Iam, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
10838///
10839/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
10840/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
10841/// #     secret,
10842/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
10843/// # ).build().await.unwrap();
10844///
10845/// # let client = hyper_util::client::legacy::Client::builder(
10846/// #     hyper_util::rt::TokioExecutor::new()
10847/// # )
10848/// # .build(
10849/// #     hyper_rustls::HttpsConnectorBuilder::new()
10850/// #         .with_native_roots()
10851/// #         .unwrap()
10852/// #         .https_or_http()
10853/// #         .enable_http1()
10854/// #         .build()
10855/// # );
10856/// # let mut hub = Iam::new(client, auth);
10857/// // You can configure optional parameters by calling the respective setters at will, and
10858/// // execute the final call using `doit()`.
10859/// // Values shown here are possibly random and not representative !
10860/// let result = hub.locations().workforce_pools_delete("name")
10861///              .doit().await;
10862/// # }
10863/// ```
10864pub struct LocationWorkforcePoolDeleteCall<'a, C>
10865where
10866    C: 'a,
10867{
10868    hub: &'a Iam<C>,
10869    _name: String,
10870    _delegate: Option<&'a mut dyn common::Delegate>,
10871    _additional_params: HashMap<String, String>,
10872    _scopes: BTreeSet<String>,
10873}
10874
10875impl<'a, C> common::CallBuilder for LocationWorkforcePoolDeleteCall<'a, C> {}
10876
10877impl<'a, C> LocationWorkforcePoolDeleteCall<'a, C>
10878where
10879    C: common::Connector,
10880{
10881    /// Perform the operation you have build so far.
10882    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
10883        use std::borrow::Cow;
10884        use std::io::{Read, Seek};
10885
10886        use common::{url::Params, ToParts};
10887        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
10888
10889        let mut dd = common::DefaultDelegate;
10890        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
10891        dlg.begin(common::MethodInfo {
10892            id: "iam.locations.workforcePools.delete",
10893            http_method: hyper::Method::DELETE,
10894        });
10895
10896        for &field in ["alt", "name"].iter() {
10897            if self._additional_params.contains_key(field) {
10898                dlg.finished(false);
10899                return Err(common::Error::FieldClash(field));
10900            }
10901        }
10902
10903        let mut params = Params::with_capacity(3 + self._additional_params.len());
10904        params.push("name", self._name);
10905
10906        params.extend(self._additional_params.iter());
10907
10908        params.push("alt", "json");
10909        let mut url = self.hub._base_url.clone() + "v1/{+name}";
10910        if self._scopes.is_empty() {
10911            self._scopes
10912                .insert(Scope::CloudPlatform.as_ref().to_string());
10913        }
10914
10915        #[allow(clippy::single_element_loop)]
10916        for &(find_this, param_name) in [("{+name}", "name")].iter() {
10917            url = params.uri_replacement(url, param_name, find_this, true);
10918        }
10919        {
10920            let to_remove = ["name"];
10921            params.remove_params(&to_remove);
10922        }
10923
10924        let url = params.parse_with_url(&url);
10925
10926        loop {
10927            let token = match self
10928                .hub
10929                .auth
10930                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
10931                .await
10932            {
10933                Ok(token) => token,
10934                Err(e) => match dlg.token(e) {
10935                    Ok(token) => token,
10936                    Err(e) => {
10937                        dlg.finished(false);
10938                        return Err(common::Error::MissingToken(e));
10939                    }
10940                },
10941            };
10942            let mut req_result = {
10943                let client = &self.hub.client;
10944                dlg.pre_request();
10945                let mut req_builder = hyper::Request::builder()
10946                    .method(hyper::Method::DELETE)
10947                    .uri(url.as_str())
10948                    .header(USER_AGENT, self.hub._user_agent.clone());
10949
10950                if let Some(token) = token.as_ref() {
10951                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
10952                }
10953
10954                let request = req_builder
10955                    .header(CONTENT_LENGTH, 0_u64)
10956                    .body(common::to_body::<String>(None));
10957
10958                client.request(request.unwrap()).await
10959            };
10960
10961            match req_result {
10962                Err(err) => {
10963                    if let common::Retry::After(d) = dlg.http_error(&err) {
10964                        sleep(d).await;
10965                        continue;
10966                    }
10967                    dlg.finished(false);
10968                    return Err(common::Error::HttpError(err));
10969                }
10970                Ok(res) => {
10971                    let (mut parts, body) = res.into_parts();
10972                    let mut body = common::Body::new(body);
10973                    if !parts.status.is_success() {
10974                        let bytes = common::to_bytes(body).await.unwrap_or_default();
10975                        let error = serde_json::from_str(&common::to_string(&bytes));
10976                        let response = common::to_response(parts, bytes.into());
10977
10978                        if let common::Retry::After(d) =
10979                            dlg.http_failure(&response, error.as_ref().ok())
10980                        {
10981                            sleep(d).await;
10982                            continue;
10983                        }
10984
10985                        dlg.finished(false);
10986
10987                        return Err(match error {
10988                            Ok(value) => common::Error::BadRequest(value),
10989                            _ => common::Error::Failure(response),
10990                        });
10991                    }
10992                    let response = {
10993                        let bytes = common::to_bytes(body).await.unwrap_or_default();
10994                        let encoded = common::to_string(&bytes);
10995                        match serde_json::from_str(&encoded) {
10996                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
10997                            Err(error) => {
10998                                dlg.response_json_decode_error(&encoded, &error);
10999                                return Err(common::Error::JsonDecodeError(
11000                                    encoded.to_string(),
11001                                    error,
11002                                ));
11003                            }
11004                        }
11005                    };
11006
11007                    dlg.finished(true);
11008                    return Ok(response);
11009                }
11010            }
11011        }
11012    }
11013
11014    /// Required. The name of the pool to delete. Format: `locations/{location}/workforcePools/{workforce_pool_id}`
11015    ///
11016    /// Sets the *name* path property to the given value.
11017    ///
11018    /// Even though the property as already been set when instantiating this call,
11019    /// we provide this method for API completeness.
11020    pub fn name(mut self, new_value: &str) -> LocationWorkforcePoolDeleteCall<'a, C> {
11021        self._name = new_value.to_string();
11022        self
11023    }
11024    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
11025    /// while executing the actual API request.
11026    ///
11027    /// ````text
11028    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
11029    /// ````
11030    ///
11031    /// Sets the *delegate* property to the given value.
11032    pub fn delegate(
11033        mut self,
11034        new_value: &'a mut dyn common::Delegate,
11035    ) -> LocationWorkforcePoolDeleteCall<'a, C> {
11036        self._delegate = Some(new_value);
11037        self
11038    }
11039
11040    /// Set any additional parameter of the query string used in the request.
11041    /// It should be used to set parameters which are not yet available through their own
11042    /// setters.
11043    ///
11044    /// Please note that this method must not be used to set any of the known parameters
11045    /// which have their own setter method. If done anyway, the request will fail.
11046    ///
11047    /// # Additional Parameters
11048    ///
11049    /// * *$.xgafv* (query-string) - V1 error format.
11050    /// * *access_token* (query-string) - OAuth access token.
11051    /// * *alt* (query-string) - Data format for response.
11052    /// * *callback* (query-string) - JSONP
11053    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
11054    /// * *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.
11055    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
11056    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
11057    /// * *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.
11058    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
11059    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
11060    pub fn param<T>(mut self, name: T, value: T) -> LocationWorkforcePoolDeleteCall<'a, C>
11061    where
11062        T: AsRef<str>,
11063    {
11064        self._additional_params
11065            .insert(name.as_ref().to_string(), value.as_ref().to_string());
11066        self
11067    }
11068
11069    /// Identifies the authorization scope for the method you are building.
11070    ///
11071    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
11072    /// [`Scope::CloudPlatform`].
11073    ///
11074    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
11075    /// tokens for more than one scope.
11076    ///
11077    /// Usually there is more than one suitable scope to authorize an operation, some of which may
11078    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
11079    /// sufficient, a read-write scope will do as well.
11080    pub fn add_scope<St>(mut self, scope: St) -> LocationWorkforcePoolDeleteCall<'a, C>
11081    where
11082        St: AsRef<str>,
11083    {
11084        self._scopes.insert(String::from(scope.as_ref()));
11085        self
11086    }
11087    /// Identifies the authorization scope(s) for the method you are building.
11088    ///
11089    /// See [`Self::add_scope()`] for details.
11090    pub fn add_scopes<I, St>(mut self, scopes: I) -> LocationWorkforcePoolDeleteCall<'a, C>
11091    where
11092        I: IntoIterator<Item = St>,
11093        St: AsRef<str>,
11094    {
11095        self._scopes
11096            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
11097        self
11098    }
11099
11100    /// Removes all scopes, and no default scope will be used either.
11101    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
11102    /// for details).
11103    pub fn clear_scopes(mut self) -> LocationWorkforcePoolDeleteCall<'a, C> {
11104        self._scopes.clear();
11105        self
11106    }
11107}
11108
11109/// Gets an individual WorkforcePool.
11110///
11111/// A builder for the *workforcePools.get* method supported by a *location* resource.
11112/// It is not used directly, but through a [`LocationMethods`] instance.
11113///
11114/// # Example
11115///
11116/// Instantiate a resource method builder
11117///
11118/// ```test_harness,no_run
11119/// # extern crate hyper;
11120/// # extern crate hyper_rustls;
11121/// # extern crate google_iam1 as iam1;
11122/// # async fn dox() {
11123/// # use iam1::{Iam, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
11124///
11125/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
11126/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
11127/// #     secret,
11128/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
11129/// # ).build().await.unwrap();
11130///
11131/// # let client = hyper_util::client::legacy::Client::builder(
11132/// #     hyper_util::rt::TokioExecutor::new()
11133/// # )
11134/// # .build(
11135/// #     hyper_rustls::HttpsConnectorBuilder::new()
11136/// #         .with_native_roots()
11137/// #         .unwrap()
11138/// #         .https_or_http()
11139/// #         .enable_http1()
11140/// #         .build()
11141/// # );
11142/// # let mut hub = Iam::new(client, auth);
11143/// // You can configure optional parameters by calling the respective setters at will, and
11144/// // execute the final call using `doit()`.
11145/// // Values shown here are possibly random and not representative !
11146/// let result = hub.locations().workforce_pools_get("name")
11147///              .doit().await;
11148/// # }
11149/// ```
11150pub struct LocationWorkforcePoolGetCall<'a, C>
11151where
11152    C: 'a,
11153{
11154    hub: &'a Iam<C>,
11155    _name: String,
11156    _delegate: Option<&'a mut dyn common::Delegate>,
11157    _additional_params: HashMap<String, String>,
11158    _scopes: BTreeSet<String>,
11159}
11160
11161impl<'a, C> common::CallBuilder for LocationWorkforcePoolGetCall<'a, C> {}
11162
11163impl<'a, C> LocationWorkforcePoolGetCall<'a, C>
11164where
11165    C: common::Connector,
11166{
11167    /// Perform the operation you have build so far.
11168    pub async fn doit(mut self) -> common::Result<(common::Response, WorkforcePool)> {
11169        use std::borrow::Cow;
11170        use std::io::{Read, Seek};
11171
11172        use common::{url::Params, ToParts};
11173        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
11174
11175        let mut dd = common::DefaultDelegate;
11176        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
11177        dlg.begin(common::MethodInfo {
11178            id: "iam.locations.workforcePools.get",
11179            http_method: hyper::Method::GET,
11180        });
11181
11182        for &field in ["alt", "name"].iter() {
11183            if self._additional_params.contains_key(field) {
11184                dlg.finished(false);
11185                return Err(common::Error::FieldClash(field));
11186            }
11187        }
11188
11189        let mut params = Params::with_capacity(3 + self._additional_params.len());
11190        params.push("name", self._name);
11191
11192        params.extend(self._additional_params.iter());
11193
11194        params.push("alt", "json");
11195        let mut url = self.hub._base_url.clone() + "v1/{+name}";
11196        if self._scopes.is_empty() {
11197            self._scopes
11198                .insert(Scope::CloudPlatform.as_ref().to_string());
11199        }
11200
11201        #[allow(clippy::single_element_loop)]
11202        for &(find_this, param_name) in [("{+name}", "name")].iter() {
11203            url = params.uri_replacement(url, param_name, find_this, true);
11204        }
11205        {
11206            let to_remove = ["name"];
11207            params.remove_params(&to_remove);
11208        }
11209
11210        let url = params.parse_with_url(&url);
11211
11212        loop {
11213            let token = match self
11214                .hub
11215                .auth
11216                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
11217                .await
11218            {
11219                Ok(token) => token,
11220                Err(e) => match dlg.token(e) {
11221                    Ok(token) => token,
11222                    Err(e) => {
11223                        dlg.finished(false);
11224                        return Err(common::Error::MissingToken(e));
11225                    }
11226                },
11227            };
11228            let mut req_result = {
11229                let client = &self.hub.client;
11230                dlg.pre_request();
11231                let mut req_builder = hyper::Request::builder()
11232                    .method(hyper::Method::GET)
11233                    .uri(url.as_str())
11234                    .header(USER_AGENT, self.hub._user_agent.clone());
11235
11236                if let Some(token) = token.as_ref() {
11237                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
11238                }
11239
11240                let request = req_builder
11241                    .header(CONTENT_LENGTH, 0_u64)
11242                    .body(common::to_body::<String>(None));
11243
11244                client.request(request.unwrap()).await
11245            };
11246
11247            match req_result {
11248                Err(err) => {
11249                    if let common::Retry::After(d) = dlg.http_error(&err) {
11250                        sleep(d).await;
11251                        continue;
11252                    }
11253                    dlg.finished(false);
11254                    return Err(common::Error::HttpError(err));
11255                }
11256                Ok(res) => {
11257                    let (mut parts, body) = res.into_parts();
11258                    let mut body = common::Body::new(body);
11259                    if !parts.status.is_success() {
11260                        let bytes = common::to_bytes(body).await.unwrap_or_default();
11261                        let error = serde_json::from_str(&common::to_string(&bytes));
11262                        let response = common::to_response(parts, bytes.into());
11263
11264                        if let common::Retry::After(d) =
11265                            dlg.http_failure(&response, error.as_ref().ok())
11266                        {
11267                            sleep(d).await;
11268                            continue;
11269                        }
11270
11271                        dlg.finished(false);
11272
11273                        return Err(match error {
11274                            Ok(value) => common::Error::BadRequest(value),
11275                            _ => common::Error::Failure(response),
11276                        });
11277                    }
11278                    let response = {
11279                        let bytes = common::to_bytes(body).await.unwrap_or_default();
11280                        let encoded = common::to_string(&bytes);
11281                        match serde_json::from_str(&encoded) {
11282                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
11283                            Err(error) => {
11284                                dlg.response_json_decode_error(&encoded, &error);
11285                                return Err(common::Error::JsonDecodeError(
11286                                    encoded.to_string(),
11287                                    error,
11288                                ));
11289                            }
11290                        }
11291                    };
11292
11293                    dlg.finished(true);
11294                    return Ok(response);
11295                }
11296            }
11297        }
11298    }
11299
11300    /// Required. The name of the pool to retrieve. Format: `locations/{location}/workforcePools/{workforce_pool_id}`
11301    ///
11302    /// Sets the *name* path property to the given value.
11303    ///
11304    /// Even though the property as already been set when instantiating this call,
11305    /// we provide this method for API completeness.
11306    pub fn name(mut self, new_value: &str) -> LocationWorkforcePoolGetCall<'a, C> {
11307        self._name = new_value.to_string();
11308        self
11309    }
11310    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
11311    /// while executing the actual API request.
11312    ///
11313    /// ````text
11314    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
11315    /// ````
11316    ///
11317    /// Sets the *delegate* property to the given value.
11318    pub fn delegate(
11319        mut self,
11320        new_value: &'a mut dyn common::Delegate,
11321    ) -> LocationWorkforcePoolGetCall<'a, C> {
11322        self._delegate = Some(new_value);
11323        self
11324    }
11325
11326    /// Set any additional parameter of the query string used in the request.
11327    /// It should be used to set parameters which are not yet available through their own
11328    /// setters.
11329    ///
11330    /// Please note that this method must not be used to set any of the known parameters
11331    /// which have their own setter method. If done anyway, the request will fail.
11332    ///
11333    /// # Additional Parameters
11334    ///
11335    /// * *$.xgafv* (query-string) - V1 error format.
11336    /// * *access_token* (query-string) - OAuth access token.
11337    /// * *alt* (query-string) - Data format for response.
11338    /// * *callback* (query-string) - JSONP
11339    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
11340    /// * *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.
11341    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
11342    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
11343    /// * *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.
11344    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
11345    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
11346    pub fn param<T>(mut self, name: T, value: T) -> LocationWorkforcePoolGetCall<'a, C>
11347    where
11348        T: AsRef<str>,
11349    {
11350        self._additional_params
11351            .insert(name.as_ref().to_string(), value.as_ref().to_string());
11352        self
11353    }
11354
11355    /// Identifies the authorization scope for the method you are building.
11356    ///
11357    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
11358    /// [`Scope::CloudPlatform`].
11359    ///
11360    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
11361    /// tokens for more than one scope.
11362    ///
11363    /// Usually there is more than one suitable scope to authorize an operation, some of which may
11364    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
11365    /// sufficient, a read-write scope will do as well.
11366    pub fn add_scope<St>(mut self, scope: St) -> LocationWorkforcePoolGetCall<'a, C>
11367    where
11368        St: AsRef<str>,
11369    {
11370        self._scopes.insert(String::from(scope.as_ref()));
11371        self
11372    }
11373    /// Identifies the authorization scope(s) for the method you are building.
11374    ///
11375    /// See [`Self::add_scope()`] for details.
11376    pub fn add_scopes<I, St>(mut self, scopes: I) -> LocationWorkforcePoolGetCall<'a, C>
11377    where
11378        I: IntoIterator<Item = St>,
11379        St: AsRef<str>,
11380    {
11381        self._scopes
11382            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
11383        self
11384    }
11385
11386    /// Removes all scopes, and no default scope will be used either.
11387    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
11388    /// for details).
11389    pub fn clear_scopes(mut self) -> LocationWorkforcePoolGetCall<'a, C> {
11390        self._scopes.clear();
11391        self
11392    }
11393}
11394
11395/// Gets IAM policies on a WorkforcePool.
11396///
11397/// A builder for the *workforcePools.getIamPolicy* method supported by a *location* resource.
11398/// It is not used directly, but through a [`LocationMethods`] instance.
11399///
11400/// # Example
11401///
11402/// Instantiate a resource method builder
11403///
11404/// ```test_harness,no_run
11405/// # extern crate hyper;
11406/// # extern crate hyper_rustls;
11407/// # extern crate google_iam1 as iam1;
11408/// use iam1::api::GetIamPolicyRequest;
11409/// # async fn dox() {
11410/// # use iam1::{Iam, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
11411///
11412/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
11413/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
11414/// #     secret,
11415/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
11416/// # ).build().await.unwrap();
11417///
11418/// # let client = hyper_util::client::legacy::Client::builder(
11419/// #     hyper_util::rt::TokioExecutor::new()
11420/// # )
11421/// # .build(
11422/// #     hyper_rustls::HttpsConnectorBuilder::new()
11423/// #         .with_native_roots()
11424/// #         .unwrap()
11425/// #         .https_or_http()
11426/// #         .enable_http1()
11427/// #         .build()
11428/// # );
11429/// # let mut hub = Iam::new(client, auth);
11430/// // As the method needs a request, you would usually fill it with the desired information
11431/// // into the respective structure. Some of the parts shown here might not be applicable !
11432/// // Values shown here are possibly random and not representative !
11433/// let mut req = GetIamPolicyRequest::default();
11434///
11435/// // You can configure optional parameters by calling the respective setters at will, and
11436/// // execute the final call using `doit()`.
11437/// // Values shown here are possibly random and not representative !
11438/// let result = hub.locations().workforce_pools_get_iam_policy(req, "resource")
11439///              .doit().await;
11440/// # }
11441/// ```
11442pub struct LocationWorkforcePoolGetIamPolicyCall<'a, C>
11443where
11444    C: 'a,
11445{
11446    hub: &'a Iam<C>,
11447    _request: GetIamPolicyRequest,
11448    _resource: String,
11449    _delegate: Option<&'a mut dyn common::Delegate>,
11450    _additional_params: HashMap<String, String>,
11451    _scopes: BTreeSet<String>,
11452}
11453
11454impl<'a, C> common::CallBuilder for LocationWorkforcePoolGetIamPolicyCall<'a, C> {}
11455
11456impl<'a, C> LocationWorkforcePoolGetIamPolicyCall<'a, C>
11457where
11458    C: common::Connector,
11459{
11460    /// Perform the operation you have build so far.
11461    pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
11462        use std::borrow::Cow;
11463        use std::io::{Read, Seek};
11464
11465        use common::{url::Params, ToParts};
11466        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
11467
11468        let mut dd = common::DefaultDelegate;
11469        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
11470        dlg.begin(common::MethodInfo {
11471            id: "iam.locations.workforcePools.getIamPolicy",
11472            http_method: hyper::Method::POST,
11473        });
11474
11475        for &field in ["alt", "resource"].iter() {
11476            if self._additional_params.contains_key(field) {
11477                dlg.finished(false);
11478                return Err(common::Error::FieldClash(field));
11479            }
11480        }
11481
11482        let mut params = Params::with_capacity(4 + self._additional_params.len());
11483        params.push("resource", self._resource);
11484
11485        params.extend(self._additional_params.iter());
11486
11487        params.push("alt", "json");
11488        let mut url = self.hub._base_url.clone() + "v1/{+resource}:getIamPolicy";
11489        if self._scopes.is_empty() {
11490            self._scopes
11491                .insert(Scope::CloudPlatform.as_ref().to_string());
11492        }
11493
11494        #[allow(clippy::single_element_loop)]
11495        for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
11496            url = params.uri_replacement(url, param_name, find_this, true);
11497        }
11498        {
11499            let to_remove = ["resource"];
11500            params.remove_params(&to_remove);
11501        }
11502
11503        let url = params.parse_with_url(&url);
11504
11505        let mut json_mime_type = mime::APPLICATION_JSON;
11506        let mut request_value_reader = {
11507            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
11508            common::remove_json_null_values(&mut value);
11509            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
11510            serde_json::to_writer(&mut dst, &value).unwrap();
11511            dst
11512        };
11513        let request_size = request_value_reader
11514            .seek(std::io::SeekFrom::End(0))
11515            .unwrap();
11516        request_value_reader
11517            .seek(std::io::SeekFrom::Start(0))
11518            .unwrap();
11519
11520        loop {
11521            let token = match self
11522                .hub
11523                .auth
11524                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
11525                .await
11526            {
11527                Ok(token) => token,
11528                Err(e) => match dlg.token(e) {
11529                    Ok(token) => token,
11530                    Err(e) => {
11531                        dlg.finished(false);
11532                        return Err(common::Error::MissingToken(e));
11533                    }
11534                },
11535            };
11536            request_value_reader
11537                .seek(std::io::SeekFrom::Start(0))
11538                .unwrap();
11539            let mut req_result = {
11540                let client = &self.hub.client;
11541                dlg.pre_request();
11542                let mut req_builder = hyper::Request::builder()
11543                    .method(hyper::Method::POST)
11544                    .uri(url.as_str())
11545                    .header(USER_AGENT, self.hub._user_agent.clone());
11546
11547                if let Some(token) = token.as_ref() {
11548                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
11549                }
11550
11551                let request = req_builder
11552                    .header(CONTENT_TYPE, json_mime_type.to_string())
11553                    .header(CONTENT_LENGTH, request_size as u64)
11554                    .body(common::to_body(
11555                        request_value_reader.get_ref().clone().into(),
11556                    ));
11557
11558                client.request(request.unwrap()).await
11559            };
11560
11561            match req_result {
11562                Err(err) => {
11563                    if let common::Retry::After(d) = dlg.http_error(&err) {
11564                        sleep(d).await;
11565                        continue;
11566                    }
11567                    dlg.finished(false);
11568                    return Err(common::Error::HttpError(err));
11569                }
11570                Ok(res) => {
11571                    let (mut parts, body) = res.into_parts();
11572                    let mut body = common::Body::new(body);
11573                    if !parts.status.is_success() {
11574                        let bytes = common::to_bytes(body).await.unwrap_or_default();
11575                        let error = serde_json::from_str(&common::to_string(&bytes));
11576                        let response = common::to_response(parts, bytes.into());
11577
11578                        if let common::Retry::After(d) =
11579                            dlg.http_failure(&response, error.as_ref().ok())
11580                        {
11581                            sleep(d).await;
11582                            continue;
11583                        }
11584
11585                        dlg.finished(false);
11586
11587                        return Err(match error {
11588                            Ok(value) => common::Error::BadRequest(value),
11589                            _ => common::Error::Failure(response),
11590                        });
11591                    }
11592                    let response = {
11593                        let bytes = common::to_bytes(body).await.unwrap_or_default();
11594                        let encoded = common::to_string(&bytes);
11595                        match serde_json::from_str(&encoded) {
11596                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
11597                            Err(error) => {
11598                                dlg.response_json_decode_error(&encoded, &error);
11599                                return Err(common::Error::JsonDecodeError(
11600                                    encoded.to_string(),
11601                                    error,
11602                                ));
11603                            }
11604                        }
11605                    };
11606
11607                    dlg.finished(true);
11608                    return Ok(response);
11609                }
11610            }
11611        }
11612    }
11613
11614    ///
11615    /// Sets the *request* property to the given value.
11616    ///
11617    /// Even though the property as already been set when instantiating this call,
11618    /// we provide this method for API completeness.
11619    pub fn request(
11620        mut self,
11621        new_value: GetIamPolicyRequest,
11622    ) -> LocationWorkforcePoolGetIamPolicyCall<'a, C> {
11623        self._request = new_value;
11624        self
11625    }
11626    /// REQUIRED: The resource for which the policy is being requested. See [Resource names](https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
11627    ///
11628    /// Sets the *resource* path property to the given value.
11629    ///
11630    /// Even though the property as already been set when instantiating this call,
11631    /// we provide this method for API completeness.
11632    pub fn resource(mut self, new_value: &str) -> LocationWorkforcePoolGetIamPolicyCall<'a, C> {
11633        self._resource = new_value.to_string();
11634        self
11635    }
11636    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
11637    /// while executing the actual API request.
11638    ///
11639    /// ````text
11640    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
11641    /// ````
11642    ///
11643    /// Sets the *delegate* property to the given value.
11644    pub fn delegate(
11645        mut self,
11646        new_value: &'a mut dyn common::Delegate,
11647    ) -> LocationWorkforcePoolGetIamPolicyCall<'a, C> {
11648        self._delegate = Some(new_value);
11649        self
11650    }
11651
11652    /// Set any additional parameter of the query string used in the request.
11653    /// It should be used to set parameters which are not yet available through their own
11654    /// setters.
11655    ///
11656    /// Please note that this method must not be used to set any of the known parameters
11657    /// which have their own setter method. If done anyway, the request will fail.
11658    ///
11659    /// # Additional Parameters
11660    ///
11661    /// * *$.xgafv* (query-string) - V1 error format.
11662    /// * *access_token* (query-string) - OAuth access token.
11663    /// * *alt* (query-string) - Data format for response.
11664    /// * *callback* (query-string) - JSONP
11665    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
11666    /// * *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.
11667    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
11668    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
11669    /// * *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.
11670    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
11671    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
11672    pub fn param<T>(mut self, name: T, value: T) -> LocationWorkforcePoolGetIamPolicyCall<'a, C>
11673    where
11674        T: AsRef<str>,
11675    {
11676        self._additional_params
11677            .insert(name.as_ref().to_string(), value.as_ref().to_string());
11678        self
11679    }
11680
11681    /// Identifies the authorization scope for the method you are building.
11682    ///
11683    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
11684    /// [`Scope::CloudPlatform`].
11685    ///
11686    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
11687    /// tokens for more than one scope.
11688    ///
11689    /// Usually there is more than one suitable scope to authorize an operation, some of which may
11690    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
11691    /// sufficient, a read-write scope will do as well.
11692    pub fn add_scope<St>(mut self, scope: St) -> LocationWorkforcePoolGetIamPolicyCall<'a, C>
11693    where
11694        St: AsRef<str>,
11695    {
11696        self._scopes.insert(String::from(scope.as_ref()));
11697        self
11698    }
11699    /// Identifies the authorization scope(s) for the method you are building.
11700    ///
11701    /// See [`Self::add_scope()`] for details.
11702    pub fn add_scopes<I, St>(mut self, scopes: I) -> LocationWorkforcePoolGetIamPolicyCall<'a, C>
11703    where
11704        I: IntoIterator<Item = St>,
11705        St: AsRef<str>,
11706    {
11707        self._scopes
11708            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
11709        self
11710    }
11711
11712    /// Removes all scopes, and no default scope will be used either.
11713    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
11714    /// for details).
11715    pub fn clear_scopes(mut self) -> LocationWorkforcePoolGetIamPolicyCall<'a, C> {
11716        self._scopes.clear();
11717        self
11718    }
11719}
11720
11721/// Lists all non-deleted WorkforcePools under the specified parent. If `show_deleted` is set to `true`, then deleted pools are also listed.
11722///
11723/// A builder for the *workforcePools.list* method supported by a *location* resource.
11724/// It is not used directly, but through a [`LocationMethods`] instance.
11725///
11726/// # Example
11727///
11728/// Instantiate a resource method builder
11729///
11730/// ```test_harness,no_run
11731/// # extern crate hyper;
11732/// # extern crate hyper_rustls;
11733/// # extern crate google_iam1 as iam1;
11734/// # async fn dox() {
11735/// # use iam1::{Iam, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
11736///
11737/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
11738/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
11739/// #     secret,
11740/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
11741/// # ).build().await.unwrap();
11742///
11743/// # let client = hyper_util::client::legacy::Client::builder(
11744/// #     hyper_util::rt::TokioExecutor::new()
11745/// # )
11746/// # .build(
11747/// #     hyper_rustls::HttpsConnectorBuilder::new()
11748/// #         .with_native_roots()
11749/// #         .unwrap()
11750/// #         .https_or_http()
11751/// #         .enable_http1()
11752/// #         .build()
11753/// # );
11754/// # let mut hub = Iam::new(client, auth);
11755/// // You can configure optional parameters by calling the respective setters at will, and
11756/// // execute the final call using `doit()`.
11757/// // Values shown here are possibly random and not representative !
11758/// let result = hub.locations().workforce_pools_list("location")
11759///              .show_deleted(false)
11760///              .parent("sed")
11761///              .page_token("duo")
11762///              .page_size(-80)
11763///              .doit().await;
11764/// # }
11765/// ```
11766pub struct LocationWorkforcePoolListCall<'a, C>
11767where
11768    C: 'a,
11769{
11770    hub: &'a Iam<C>,
11771    _location: String,
11772    _show_deleted: Option<bool>,
11773    _parent: Option<String>,
11774    _page_token: Option<String>,
11775    _page_size: Option<i32>,
11776    _delegate: Option<&'a mut dyn common::Delegate>,
11777    _additional_params: HashMap<String, String>,
11778    _scopes: BTreeSet<String>,
11779}
11780
11781impl<'a, C> common::CallBuilder for LocationWorkforcePoolListCall<'a, C> {}
11782
11783impl<'a, C> LocationWorkforcePoolListCall<'a, C>
11784where
11785    C: common::Connector,
11786{
11787    /// Perform the operation you have build so far.
11788    pub async fn doit(mut self) -> common::Result<(common::Response, ListWorkforcePoolsResponse)> {
11789        use std::borrow::Cow;
11790        use std::io::{Read, Seek};
11791
11792        use common::{url::Params, ToParts};
11793        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
11794
11795        let mut dd = common::DefaultDelegate;
11796        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
11797        dlg.begin(common::MethodInfo {
11798            id: "iam.locations.workforcePools.list",
11799            http_method: hyper::Method::GET,
11800        });
11801
11802        for &field in [
11803            "alt",
11804            "location",
11805            "showDeleted",
11806            "parent",
11807            "pageToken",
11808            "pageSize",
11809        ]
11810        .iter()
11811        {
11812            if self._additional_params.contains_key(field) {
11813                dlg.finished(false);
11814                return Err(common::Error::FieldClash(field));
11815            }
11816        }
11817
11818        let mut params = Params::with_capacity(7 + self._additional_params.len());
11819        params.push("location", self._location);
11820        if let Some(value) = self._show_deleted.as_ref() {
11821            params.push("showDeleted", value.to_string());
11822        }
11823        if let Some(value) = self._parent.as_ref() {
11824            params.push("parent", value);
11825        }
11826        if let Some(value) = self._page_token.as_ref() {
11827            params.push("pageToken", value);
11828        }
11829        if let Some(value) = self._page_size.as_ref() {
11830            params.push("pageSize", value.to_string());
11831        }
11832
11833        params.extend(self._additional_params.iter());
11834
11835        params.push("alt", "json");
11836        let mut url = self.hub._base_url.clone() + "v1/{+location}/workforcePools";
11837        if self._scopes.is_empty() {
11838            self._scopes
11839                .insert(Scope::CloudPlatform.as_ref().to_string());
11840        }
11841
11842        #[allow(clippy::single_element_loop)]
11843        for &(find_this, param_name) in [("{+location}", "location")].iter() {
11844            url = params.uri_replacement(url, param_name, find_this, true);
11845        }
11846        {
11847            let to_remove = ["location"];
11848            params.remove_params(&to_remove);
11849        }
11850
11851        let url = params.parse_with_url(&url);
11852
11853        loop {
11854            let token = match self
11855                .hub
11856                .auth
11857                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
11858                .await
11859            {
11860                Ok(token) => token,
11861                Err(e) => match dlg.token(e) {
11862                    Ok(token) => token,
11863                    Err(e) => {
11864                        dlg.finished(false);
11865                        return Err(common::Error::MissingToken(e));
11866                    }
11867                },
11868            };
11869            let mut req_result = {
11870                let client = &self.hub.client;
11871                dlg.pre_request();
11872                let mut req_builder = hyper::Request::builder()
11873                    .method(hyper::Method::GET)
11874                    .uri(url.as_str())
11875                    .header(USER_AGENT, self.hub._user_agent.clone());
11876
11877                if let Some(token) = token.as_ref() {
11878                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
11879                }
11880
11881                let request = req_builder
11882                    .header(CONTENT_LENGTH, 0_u64)
11883                    .body(common::to_body::<String>(None));
11884
11885                client.request(request.unwrap()).await
11886            };
11887
11888            match req_result {
11889                Err(err) => {
11890                    if let common::Retry::After(d) = dlg.http_error(&err) {
11891                        sleep(d).await;
11892                        continue;
11893                    }
11894                    dlg.finished(false);
11895                    return Err(common::Error::HttpError(err));
11896                }
11897                Ok(res) => {
11898                    let (mut parts, body) = res.into_parts();
11899                    let mut body = common::Body::new(body);
11900                    if !parts.status.is_success() {
11901                        let bytes = common::to_bytes(body).await.unwrap_or_default();
11902                        let error = serde_json::from_str(&common::to_string(&bytes));
11903                        let response = common::to_response(parts, bytes.into());
11904
11905                        if let common::Retry::After(d) =
11906                            dlg.http_failure(&response, error.as_ref().ok())
11907                        {
11908                            sleep(d).await;
11909                            continue;
11910                        }
11911
11912                        dlg.finished(false);
11913
11914                        return Err(match error {
11915                            Ok(value) => common::Error::BadRequest(value),
11916                            _ => common::Error::Failure(response),
11917                        });
11918                    }
11919                    let response = {
11920                        let bytes = common::to_bytes(body).await.unwrap_or_default();
11921                        let encoded = common::to_string(&bytes);
11922                        match serde_json::from_str(&encoded) {
11923                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
11924                            Err(error) => {
11925                                dlg.response_json_decode_error(&encoded, &error);
11926                                return Err(common::Error::JsonDecodeError(
11927                                    encoded.to_string(),
11928                                    error,
11929                                ));
11930                            }
11931                        }
11932                    };
11933
11934                    dlg.finished(true);
11935                    return Ok(response);
11936                }
11937            }
11938        }
11939    }
11940
11941    /// The location of the pool. Format: `locations/{location}`.
11942    ///
11943    /// Sets the *location* path property to the given value.
11944    ///
11945    /// Even though the property as already been set when instantiating this call,
11946    /// we provide this method for API completeness.
11947    pub fn location(mut self, new_value: &str) -> LocationWorkforcePoolListCall<'a, C> {
11948        self._location = new_value.to_string();
11949        self
11950    }
11951    /// Whether to return soft-deleted pools.
11952    ///
11953    /// Sets the *show deleted* query property to the given value.
11954    pub fn show_deleted(mut self, new_value: bool) -> LocationWorkforcePoolListCall<'a, C> {
11955        self._show_deleted = Some(new_value);
11956        self
11957    }
11958    /// Required. The parent resource to list pools for. Format: `organizations/{org-id}`.
11959    ///
11960    /// Sets the *parent* query property to the given value.
11961    pub fn parent(mut self, new_value: &str) -> LocationWorkforcePoolListCall<'a, C> {
11962        self._parent = Some(new_value.to_string());
11963        self
11964    }
11965    /// A page token, received from a previous `ListWorkforcePools` call. Provide this to retrieve the subsequent page.
11966    ///
11967    /// Sets the *page token* query property to the given value.
11968    pub fn page_token(mut self, new_value: &str) -> LocationWorkforcePoolListCall<'a, C> {
11969        self._page_token = Some(new_value.to_string());
11970        self
11971    }
11972    /// The maximum number of pools to return. If unspecified, at most 50 pools will be returned. The maximum value is 1000; values above 1000 are truncated to 1000.
11973    ///
11974    /// Sets the *page size* query property to the given value.
11975    pub fn page_size(mut self, new_value: i32) -> LocationWorkforcePoolListCall<'a, C> {
11976        self._page_size = Some(new_value);
11977        self
11978    }
11979    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
11980    /// while executing the actual API request.
11981    ///
11982    /// ````text
11983    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
11984    /// ````
11985    ///
11986    /// Sets the *delegate* property to the given value.
11987    pub fn delegate(
11988        mut self,
11989        new_value: &'a mut dyn common::Delegate,
11990    ) -> LocationWorkforcePoolListCall<'a, C> {
11991        self._delegate = Some(new_value);
11992        self
11993    }
11994
11995    /// Set any additional parameter of the query string used in the request.
11996    /// It should be used to set parameters which are not yet available through their own
11997    /// setters.
11998    ///
11999    /// Please note that this method must not be used to set any of the known parameters
12000    /// which have their own setter method. If done anyway, the request will fail.
12001    ///
12002    /// # Additional Parameters
12003    ///
12004    /// * *$.xgafv* (query-string) - V1 error format.
12005    /// * *access_token* (query-string) - OAuth access token.
12006    /// * *alt* (query-string) - Data format for response.
12007    /// * *callback* (query-string) - JSONP
12008    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
12009    /// * *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.
12010    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
12011    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
12012    /// * *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.
12013    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
12014    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
12015    pub fn param<T>(mut self, name: T, value: T) -> LocationWorkforcePoolListCall<'a, C>
12016    where
12017        T: AsRef<str>,
12018    {
12019        self._additional_params
12020            .insert(name.as_ref().to_string(), value.as_ref().to_string());
12021        self
12022    }
12023
12024    /// Identifies the authorization scope for the method you are building.
12025    ///
12026    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
12027    /// [`Scope::CloudPlatform`].
12028    ///
12029    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
12030    /// tokens for more than one scope.
12031    ///
12032    /// Usually there is more than one suitable scope to authorize an operation, some of which may
12033    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
12034    /// sufficient, a read-write scope will do as well.
12035    pub fn add_scope<St>(mut self, scope: St) -> LocationWorkforcePoolListCall<'a, C>
12036    where
12037        St: AsRef<str>,
12038    {
12039        self._scopes.insert(String::from(scope.as_ref()));
12040        self
12041    }
12042    /// Identifies the authorization scope(s) for the method you are building.
12043    ///
12044    /// See [`Self::add_scope()`] for details.
12045    pub fn add_scopes<I, St>(mut self, scopes: I) -> LocationWorkforcePoolListCall<'a, C>
12046    where
12047        I: IntoIterator<Item = St>,
12048        St: AsRef<str>,
12049    {
12050        self._scopes
12051            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
12052        self
12053    }
12054
12055    /// Removes all scopes, and no default scope will be used either.
12056    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
12057    /// for details).
12058    pub fn clear_scopes(mut self) -> LocationWorkforcePoolListCall<'a, C> {
12059        self._scopes.clear();
12060        self
12061    }
12062}
12063
12064/// Updates an existing WorkforcePool.
12065///
12066/// A builder for the *workforcePools.patch* method supported by a *location* resource.
12067/// It is not used directly, but through a [`LocationMethods`] instance.
12068///
12069/// # Example
12070///
12071/// Instantiate a resource method builder
12072///
12073/// ```test_harness,no_run
12074/// # extern crate hyper;
12075/// # extern crate hyper_rustls;
12076/// # extern crate google_iam1 as iam1;
12077/// use iam1::api::WorkforcePool;
12078/// # async fn dox() {
12079/// # use iam1::{Iam, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
12080///
12081/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
12082/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
12083/// #     secret,
12084/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
12085/// # ).build().await.unwrap();
12086///
12087/// # let client = hyper_util::client::legacy::Client::builder(
12088/// #     hyper_util::rt::TokioExecutor::new()
12089/// # )
12090/// # .build(
12091/// #     hyper_rustls::HttpsConnectorBuilder::new()
12092/// #         .with_native_roots()
12093/// #         .unwrap()
12094/// #         .https_or_http()
12095/// #         .enable_http1()
12096/// #         .build()
12097/// # );
12098/// # let mut hub = Iam::new(client, auth);
12099/// // As the method needs a request, you would usually fill it with the desired information
12100/// // into the respective structure. Some of the parts shown here might not be applicable !
12101/// // Values shown here are possibly random and not representative !
12102/// let mut req = WorkforcePool::default();
12103///
12104/// // You can configure optional parameters by calling the respective setters at will, and
12105/// // execute the final call using `doit()`.
12106/// // Values shown here are possibly random and not representative !
12107/// let result = hub.locations().workforce_pools_patch(req, "name")
12108///              .update_mask(FieldMask::new::<&str>(&[]))
12109///              .doit().await;
12110/// # }
12111/// ```
12112pub struct LocationWorkforcePoolPatchCall<'a, C>
12113where
12114    C: 'a,
12115{
12116    hub: &'a Iam<C>,
12117    _request: WorkforcePool,
12118    _name: String,
12119    _update_mask: Option<common::FieldMask>,
12120    _delegate: Option<&'a mut dyn common::Delegate>,
12121    _additional_params: HashMap<String, String>,
12122    _scopes: BTreeSet<String>,
12123}
12124
12125impl<'a, C> common::CallBuilder for LocationWorkforcePoolPatchCall<'a, C> {}
12126
12127impl<'a, C> LocationWorkforcePoolPatchCall<'a, C>
12128where
12129    C: common::Connector,
12130{
12131    /// Perform the operation you have build so far.
12132    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
12133        use std::borrow::Cow;
12134        use std::io::{Read, Seek};
12135
12136        use common::{url::Params, ToParts};
12137        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
12138
12139        let mut dd = common::DefaultDelegate;
12140        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
12141        dlg.begin(common::MethodInfo {
12142            id: "iam.locations.workforcePools.patch",
12143            http_method: hyper::Method::PATCH,
12144        });
12145
12146        for &field in ["alt", "name", "updateMask"].iter() {
12147            if self._additional_params.contains_key(field) {
12148                dlg.finished(false);
12149                return Err(common::Error::FieldClash(field));
12150            }
12151        }
12152
12153        let mut params = Params::with_capacity(5 + self._additional_params.len());
12154        params.push("name", self._name);
12155        if let Some(value) = self._update_mask.as_ref() {
12156            params.push("updateMask", value.to_string());
12157        }
12158
12159        params.extend(self._additional_params.iter());
12160
12161        params.push("alt", "json");
12162        let mut url = self.hub._base_url.clone() + "v1/{+name}";
12163        if self._scopes.is_empty() {
12164            self._scopes
12165                .insert(Scope::CloudPlatform.as_ref().to_string());
12166        }
12167
12168        #[allow(clippy::single_element_loop)]
12169        for &(find_this, param_name) in [("{+name}", "name")].iter() {
12170            url = params.uri_replacement(url, param_name, find_this, true);
12171        }
12172        {
12173            let to_remove = ["name"];
12174            params.remove_params(&to_remove);
12175        }
12176
12177        let url = params.parse_with_url(&url);
12178
12179        let mut json_mime_type = mime::APPLICATION_JSON;
12180        let mut request_value_reader = {
12181            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
12182            common::remove_json_null_values(&mut value);
12183            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
12184            serde_json::to_writer(&mut dst, &value).unwrap();
12185            dst
12186        };
12187        let request_size = request_value_reader
12188            .seek(std::io::SeekFrom::End(0))
12189            .unwrap();
12190        request_value_reader
12191            .seek(std::io::SeekFrom::Start(0))
12192            .unwrap();
12193
12194        loop {
12195            let token = match self
12196                .hub
12197                .auth
12198                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
12199                .await
12200            {
12201                Ok(token) => token,
12202                Err(e) => match dlg.token(e) {
12203                    Ok(token) => token,
12204                    Err(e) => {
12205                        dlg.finished(false);
12206                        return Err(common::Error::MissingToken(e));
12207                    }
12208                },
12209            };
12210            request_value_reader
12211                .seek(std::io::SeekFrom::Start(0))
12212                .unwrap();
12213            let mut req_result = {
12214                let client = &self.hub.client;
12215                dlg.pre_request();
12216                let mut req_builder = hyper::Request::builder()
12217                    .method(hyper::Method::PATCH)
12218                    .uri(url.as_str())
12219                    .header(USER_AGENT, self.hub._user_agent.clone());
12220
12221                if let Some(token) = token.as_ref() {
12222                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
12223                }
12224
12225                let request = req_builder
12226                    .header(CONTENT_TYPE, json_mime_type.to_string())
12227                    .header(CONTENT_LENGTH, request_size as u64)
12228                    .body(common::to_body(
12229                        request_value_reader.get_ref().clone().into(),
12230                    ));
12231
12232                client.request(request.unwrap()).await
12233            };
12234
12235            match req_result {
12236                Err(err) => {
12237                    if let common::Retry::After(d) = dlg.http_error(&err) {
12238                        sleep(d).await;
12239                        continue;
12240                    }
12241                    dlg.finished(false);
12242                    return Err(common::Error::HttpError(err));
12243                }
12244                Ok(res) => {
12245                    let (mut parts, body) = res.into_parts();
12246                    let mut body = common::Body::new(body);
12247                    if !parts.status.is_success() {
12248                        let bytes = common::to_bytes(body).await.unwrap_or_default();
12249                        let error = serde_json::from_str(&common::to_string(&bytes));
12250                        let response = common::to_response(parts, bytes.into());
12251
12252                        if let common::Retry::After(d) =
12253                            dlg.http_failure(&response, error.as_ref().ok())
12254                        {
12255                            sleep(d).await;
12256                            continue;
12257                        }
12258
12259                        dlg.finished(false);
12260
12261                        return Err(match error {
12262                            Ok(value) => common::Error::BadRequest(value),
12263                            _ => common::Error::Failure(response),
12264                        });
12265                    }
12266                    let response = {
12267                        let bytes = common::to_bytes(body).await.unwrap_or_default();
12268                        let encoded = common::to_string(&bytes);
12269                        match serde_json::from_str(&encoded) {
12270                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
12271                            Err(error) => {
12272                                dlg.response_json_decode_error(&encoded, &error);
12273                                return Err(common::Error::JsonDecodeError(
12274                                    encoded.to_string(),
12275                                    error,
12276                                ));
12277                            }
12278                        }
12279                    };
12280
12281                    dlg.finished(true);
12282                    return Ok(response);
12283                }
12284            }
12285        }
12286    }
12287
12288    ///
12289    /// Sets the *request* property to the given value.
12290    ///
12291    /// Even though the property as already been set when instantiating this call,
12292    /// we provide this method for API completeness.
12293    pub fn request(mut self, new_value: WorkforcePool) -> LocationWorkforcePoolPatchCall<'a, C> {
12294        self._request = new_value;
12295        self
12296    }
12297    /// Output only. The resource name of the pool. Format: `locations/{location}/workforcePools/{workforce_pool_id}`
12298    ///
12299    /// Sets the *name* path property to the given value.
12300    ///
12301    /// Even though the property as already been set when instantiating this call,
12302    /// we provide this method for API completeness.
12303    pub fn name(mut self, new_value: &str) -> LocationWorkforcePoolPatchCall<'a, C> {
12304        self._name = new_value.to_string();
12305        self
12306    }
12307    /// Required. The list of fields to update.
12308    ///
12309    /// Sets the *update mask* query property to the given value.
12310    pub fn update_mask(
12311        mut self,
12312        new_value: common::FieldMask,
12313    ) -> LocationWorkforcePoolPatchCall<'a, C> {
12314        self._update_mask = Some(new_value);
12315        self
12316    }
12317    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
12318    /// while executing the actual API request.
12319    ///
12320    /// ````text
12321    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
12322    /// ````
12323    ///
12324    /// Sets the *delegate* property to the given value.
12325    pub fn delegate(
12326        mut self,
12327        new_value: &'a mut dyn common::Delegate,
12328    ) -> LocationWorkforcePoolPatchCall<'a, C> {
12329        self._delegate = Some(new_value);
12330        self
12331    }
12332
12333    /// Set any additional parameter of the query string used in the request.
12334    /// It should be used to set parameters which are not yet available through their own
12335    /// setters.
12336    ///
12337    /// Please note that this method must not be used to set any of the known parameters
12338    /// which have their own setter method. If done anyway, the request will fail.
12339    ///
12340    /// # Additional Parameters
12341    ///
12342    /// * *$.xgafv* (query-string) - V1 error format.
12343    /// * *access_token* (query-string) - OAuth access token.
12344    /// * *alt* (query-string) - Data format for response.
12345    /// * *callback* (query-string) - JSONP
12346    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
12347    /// * *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.
12348    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
12349    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
12350    /// * *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.
12351    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
12352    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
12353    pub fn param<T>(mut self, name: T, value: T) -> LocationWorkforcePoolPatchCall<'a, C>
12354    where
12355        T: AsRef<str>,
12356    {
12357        self._additional_params
12358            .insert(name.as_ref().to_string(), value.as_ref().to_string());
12359        self
12360    }
12361
12362    /// Identifies the authorization scope for the method you are building.
12363    ///
12364    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
12365    /// [`Scope::CloudPlatform`].
12366    ///
12367    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
12368    /// tokens for more than one scope.
12369    ///
12370    /// Usually there is more than one suitable scope to authorize an operation, some of which may
12371    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
12372    /// sufficient, a read-write scope will do as well.
12373    pub fn add_scope<St>(mut self, scope: St) -> LocationWorkforcePoolPatchCall<'a, C>
12374    where
12375        St: AsRef<str>,
12376    {
12377        self._scopes.insert(String::from(scope.as_ref()));
12378        self
12379    }
12380    /// Identifies the authorization scope(s) for the method you are building.
12381    ///
12382    /// See [`Self::add_scope()`] for details.
12383    pub fn add_scopes<I, St>(mut self, scopes: I) -> LocationWorkforcePoolPatchCall<'a, C>
12384    where
12385        I: IntoIterator<Item = St>,
12386        St: AsRef<str>,
12387    {
12388        self._scopes
12389            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
12390        self
12391    }
12392
12393    /// Removes all scopes, and no default scope will be used either.
12394    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
12395    /// for details).
12396    pub fn clear_scopes(mut self) -> LocationWorkforcePoolPatchCall<'a, C> {
12397        self._scopes.clear();
12398        self
12399    }
12400}
12401
12402/// Sets IAM policies on a WorkforcePool.
12403///
12404/// A builder for the *workforcePools.setIamPolicy* method supported by a *location* resource.
12405/// It is not used directly, but through a [`LocationMethods`] instance.
12406///
12407/// # Example
12408///
12409/// Instantiate a resource method builder
12410///
12411/// ```test_harness,no_run
12412/// # extern crate hyper;
12413/// # extern crate hyper_rustls;
12414/// # extern crate google_iam1 as iam1;
12415/// use iam1::api::SetIamPolicyRequest;
12416/// # async fn dox() {
12417/// # use iam1::{Iam, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
12418///
12419/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
12420/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
12421/// #     secret,
12422/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
12423/// # ).build().await.unwrap();
12424///
12425/// # let client = hyper_util::client::legacy::Client::builder(
12426/// #     hyper_util::rt::TokioExecutor::new()
12427/// # )
12428/// # .build(
12429/// #     hyper_rustls::HttpsConnectorBuilder::new()
12430/// #         .with_native_roots()
12431/// #         .unwrap()
12432/// #         .https_or_http()
12433/// #         .enable_http1()
12434/// #         .build()
12435/// # );
12436/// # let mut hub = Iam::new(client, auth);
12437/// // As the method needs a request, you would usually fill it with the desired information
12438/// // into the respective structure. Some of the parts shown here might not be applicable !
12439/// // Values shown here are possibly random and not representative !
12440/// let mut req = SetIamPolicyRequest::default();
12441///
12442/// // You can configure optional parameters by calling the respective setters at will, and
12443/// // execute the final call using `doit()`.
12444/// // Values shown here are possibly random and not representative !
12445/// let result = hub.locations().workforce_pools_set_iam_policy(req, "resource")
12446///              .doit().await;
12447/// # }
12448/// ```
12449pub struct LocationWorkforcePoolSetIamPolicyCall<'a, C>
12450where
12451    C: 'a,
12452{
12453    hub: &'a Iam<C>,
12454    _request: SetIamPolicyRequest,
12455    _resource: String,
12456    _delegate: Option<&'a mut dyn common::Delegate>,
12457    _additional_params: HashMap<String, String>,
12458    _scopes: BTreeSet<String>,
12459}
12460
12461impl<'a, C> common::CallBuilder for LocationWorkforcePoolSetIamPolicyCall<'a, C> {}
12462
12463impl<'a, C> LocationWorkforcePoolSetIamPolicyCall<'a, C>
12464where
12465    C: common::Connector,
12466{
12467    /// Perform the operation you have build so far.
12468    pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
12469        use std::borrow::Cow;
12470        use std::io::{Read, Seek};
12471
12472        use common::{url::Params, ToParts};
12473        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
12474
12475        let mut dd = common::DefaultDelegate;
12476        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
12477        dlg.begin(common::MethodInfo {
12478            id: "iam.locations.workforcePools.setIamPolicy",
12479            http_method: hyper::Method::POST,
12480        });
12481
12482        for &field in ["alt", "resource"].iter() {
12483            if self._additional_params.contains_key(field) {
12484                dlg.finished(false);
12485                return Err(common::Error::FieldClash(field));
12486            }
12487        }
12488
12489        let mut params = Params::with_capacity(4 + self._additional_params.len());
12490        params.push("resource", self._resource);
12491
12492        params.extend(self._additional_params.iter());
12493
12494        params.push("alt", "json");
12495        let mut url = self.hub._base_url.clone() + "v1/{+resource}:setIamPolicy";
12496        if self._scopes.is_empty() {
12497            self._scopes
12498                .insert(Scope::CloudPlatform.as_ref().to_string());
12499        }
12500
12501        #[allow(clippy::single_element_loop)]
12502        for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
12503            url = params.uri_replacement(url, param_name, find_this, true);
12504        }
12505        {
12506            let to_remove = ["resource"];
12507            params.remove_params(&to_remove);
12508        }
12509
12510        let url = params.parse_with_url(&url);
12511
12512        let mut json_mime_type = mime::APPLICATION_JSON;
12513        let mut request_value_reader = {
12514            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
12515            common::remove_json_null_values(&mut value);
12516            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
12517            serde_json::to_writer(&mut dst, &value).unwrap();
12518            dst
12519        };
12520        let request_size = request_value_reader
12521            .seek(std::io::SeekFrom::End(0))
12522            .unwrap();
12523        request_value_reader
12524            .seek(std::io::SeekFrom::Start(0))
12525            .unwrap();
12526
12527        loop {
12528            let token = match self
12529                .hub
12530                .auth
12531                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
12532                .await
12533            {
12534                Ok(token) => token,
12535                Err(e) => match dlg.token(e) {
12536                    Ok(token) => token,
12537                    Err(e) => {
12538                        dlg.finished(false);
12539                        return Err(common::Error::MissingToken(e));
12540                    }
12541                },
12542            };
12543            request_value_reader
12544                .seek(std::io::SeekFrom::Start(0))
12545                .unwrap();
12546            let mut req_result = {
12547                let client = &self.hub.client;
12548                dlg.pre_request();
12549                let mut req_builder = hyper::Request::builder()
12550                    .method(hyper::Method::POST)
12551                    .uri(url.as_str())
12552                    .header(USER_AGENT, self.hub._user_agent.clone());
12553
12554                if let Some(token) = token.as_ref() {
12555                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
12556                }
12557
12558                let request = req_builder
12559                    .header(CONTENT_TYPE, json_mime_type.to_string())
12560                    .header(CONTENT_LENGTH, request_size as u64)
12561                    .body(common::to_body(
12562                        request_value_reader.get_ref().clone().into(),
12563                    ));
12564
12565                client.request(request.unwrap()).await
12566            };
12567
12568            match req_result {
12569                Err(err) => {
12570                    if let common::Retry::After(d) = dlg.http_error(&err) {
12571                        sleep(d).await;
12572                        continue;
12573                    }
12574                    dlg.finished(false);
12575                    return Err(common::Error::HttpError(err));
12576                }
12577                Ok(res) => {
12578                    let (mut parts, body) = res.into_parts();
12579                    let mut body = common::Body::new(body);
12580                    if !parts.status.is_success() {
12581                        let bytes = common::to_bytes(body).await.unwrap_or_default();
12582                        let error = serde_json::from_str(&common::to_string(&bytes));
12583                        let response = common::to_response(parts, bytes.into());
12584
12585                        if let common::Retry::After(d) =
12586                            dlg.http_failure(&response, error.as_ref().ok())
12587                        {
12588                            sleep(d).await;
12589                            continue;
12590                        }
12591
12592                        dlg.finished(false);
12593
12594                        return Err(match error {
12595                            Ok(value) => common::Error::BadRequest(value),
12596                            _ => common::Error::Failure(response),
12597                        });
12598                    }
12599                    let response = {
12600                        let bytes = common::to_bytes(body).await.unwrap_or_default();
12601                        let encoded = common::to_string(&bytes);
12602                        match serde_json::from_str(&encoded) {
12603                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
12604                            Err(error) => {
12605                                dlg.response_json_decode_error(&encoded, &error);
12606                                return Err(common::Error::JsonDecodeError(
12607                                    encoded.to_string(),
12608                                    error,
12609                                ));
12610                            }
12611                        }
12612                    };
12613
12614                    dlg.finished(true);
12615                    return Ok(response);
12616                }
12617            }
12618        }
12619    }
12620
12621    ///
12622    /// Sets the *request* property to the given value.
12623    ///
12624    /// Even though the property as already been set when instantiating this call,
12625    /// we provide this method for API completeness.
12626    pub fn request(
12627        mut self,
12628        new_value: SetIamPolicyRequest,
12629    ) -> LocationWorkforcePoolSetIamPolicyCall<'a, C> {
12630        self._request = new_value;
12631        self
12632    }
12633    /// REQUIRED: The resource for which the policy is being specified. See [Resource names](https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
12634    ///
12635    /// Sets the *resource* path property to the given value.
12636    ///
12637    /// Even though the property as already been set when instantiating this call,
12638    /// we provide this method for API completeness.
12639    pub fn resource(mut self, new_value: &str) -> LocationWorkforcePoolSetIamPolicyCall<'a, C> {
12640        self._resource = new_value.to_string();
12641        self
12642    }
12643    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
12644    /// while executing the actual API request.
12645    ///
12646    /// ````text
12647    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
12648    /// ````
12649    ///
12650    /// Sets the *delegate* property to the given value.
12651    pub fn delegate(
12652        mut self,
12653        new_value: &'a mut dyn common::Delegate,
12654    ) -> LocationWorkforcePoolSetIamPolicyCall<'a, C> {
12655        self._delegate = Some(new_value);
12656        self
12657    }
12658
12659    /// Set any additional parameter of the query string used in the request.
12660    /// It should be used to set parameters which are not yet available through their own
12661    /// setters.
12662    ///
12663    /// Please note that this method must not be used to set any of the known parameters
12664    /// which have their own setter method. If done anyway, the request will fail.
12665    ///
12666    /// # Additional Parameters
12667    ///
12668    /// * *$.xgafv* (query-string) - V1 error format.
12669    /// * *access_token* (query-string) - OAuth access token.
12670    /// * *alt* (query-string) - Data format for response.
12671    /// * *callback* (query-string) - JSONP
12672    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
12673    /// * *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.
12674    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
12675    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
12676    /// * *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.
12677    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
12678    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
12679    pub fn param<T>(mut self, name: T, value: T) -> LocationWorkforcePoolSetIamPolicyCall<'a, C>
12680    where
12681        T: AsRef<str>,
12682    {
12683        self._additional_params
12684            .insert(name.as_ref().to_string(), value.as_ref().to_string());
12685        self
12686    }
12687
12688    /// Identifies the authorization scope for the method you are building.
12689    ///
12690    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
12691    /// [`Scope::CloudPlatform`].
12692    ///
12693    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
12694    /// tokens for more than one scope.
12695    ///
12696    /// Usually there is more than one suitable scope to authorize an operation, some of which may
12697    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
12698    /// sufficient, a read-write scope will do as well.
12699    pub fn add_scope<St>(mut self, scope: St) -> LocationWorkforcePoolSetIamPolicyCall<'a, C>
12700    where
12701        St: AsRef<str>,
12702    {
12703        self._scopes.insert(String::from(scope.as_ref()));
12704        self
12705    }
12706    /// Identifies the authorization scope(s) for the method you are building.
12707    ///
12708    /// See [`Self::add_scope()`] for details.
12709    pub fn add_scopes<I, St>(mut self, scopes: I) -> LocationWorkforcePoolSetIamPolicyCall<'a, C>
12710    where
12711        I: IntoIterator<Item = St>,
12712        St: AsRef<str>,
12713    {
12714        self._scopes
12715            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
12716        self
12717    }
12718
12719    /// Removes all scopes, and no default scope will be used either.
12720    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
12721    /// for details).
12722    pub fn clear_scopes(mut self) -> LocationWorkforcePoolSetIamPolicyCall<'a, C> {
12723        self._scopes.clear();
12724        self
12725    }
12726}
12727
12728/// Returns the caller's permissions on the WorkforcePool. If the pool doesn't exist, this call returns an empty set of permissions. It doesn't return a `NOT_FOUND` error.
12729///
12730/// A builder for the *workforcePools.testIamPermissions* method supported by a *location* resource.
12731/// It is not used directly, but through a [`LocationMethods`] instance.
12732///
12733/// # Example
12734///
12735/// Instantiate a resource method builder
12736///
12737/// ```test_harness,no_run
12738/// # extern crate hyper;
12739/// # extern crate hyper_rustls;
12740/// # extern crate google_iam1 as iam1;
12741/// use iam1::api::TestIamPermissionsRequest;
12742/// # async fn dox() {
12743/// # use iam1::{Iam, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
12744///
12745/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
12746/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
12747/// #     secret,
12748/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
12749/// # ).build().await.unwrap();
12750///
12751/// # let client = hyper_util::client::legacy::Client::builder(
12752/// #     hyper_util::rt::TokioExecutor::new()
12753/// # )
12754/// # .build(
12755/// #     hyper_rustls::HttpsConnectorBuilder::new()
12756/// #         .with_native_roots()
12757/// #         .unwrap()
12758/// #         .https_or_http()
12759/// #         .enable_http1()
12760/// #         .build()
12761/// # );
12762/// # let mut hub = Iam::new(client, auth);
12763/// // As the method needs a request, you would usually fill it with the desired information
12764/// // into the respective structure. Some of the parts shown here might not be applicable !
12765/// // Values shown here are possibly random and not representative !
12766/// let mut req = TestIamPermissionsRequest::default();
12767///
12768/// // You can configure optional parameters by calling the respective setters at will, and
12769/// // execute the final call using `doit()`.
12770/// // Values shown here are possibly random and not representative !
12771/// let result = hub.locations().workforce_pools_test_iam_permissions(req, "resource")
12772///              .doit().await;
12773/// # }
12774/// ```
12775pub struct LocationWorkforcePoolTestIamPermissionCall<'a, C>
12776where
12777    C: 'a,
12778{
12779    hub: &'a Iam<C>,
12780    _request: TestIamPermissionsRequest,
12781    _resource: String,
12782    _delegate: Option<&'a mut dyn common::Delegate>,
12783    _additional_params: HashMap<String, String>,
12784    _scopes: BTreeSet<String>,
12785}
12786
12787impl<'a, C> common::CallBuilder for LocationWorkforcePoolTestIamPermissionCall<'a, C> {}
12788
12789impl<'a, C> LocationWorkforcePoolTestIamPermissionCall<'a, C>
12790where
12791    C: common::Connector,
12792{
12793    /// Perform the operation you have build so far.
12794    pub async fn doit(mut self) -> common::Result<(common::Response, TestIamPermissionsResponse)> {
12795        use std::borrow::Cow;
12796        use std::io::{Read, Seek};
12797
12798        use common::{url::Params, ToParts};
12799        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
12800
12801        let mut dd = common::DefaultDelegate;
12802        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
12803        dlg.begin(common::MethodInfo {
12804            id: "iam.locations.workforcePools.testIamPermissions",
12805            http_method: hyper::Method::POST,
12806        });
12807
12808        for &field in ["alt", "resource"].iter() {
12809            if self._additional_params.contains_key(field) {
12810                dlg.finished(false);
12811                return Err(common::Error::FieldClash(field));
12812            }
12813        }
12814
12815        let mut params = Params::with_capacity(4 + self._additional_params.len());
12816        params.push("resource", self._resource);
12817
12818        params.extend(self._additional_params.iter());
12819
12820        params.push("alt", "json");
12821        let mut url = self.hub._base_url.clone() + "v1/{+resource}:testIamPermissions";
12822        if self._scopes.is_empty() {
12823            self._scopes
12824                .insert(Scope::CloudPlatform.as_ref().to_string());
12825        }
12826
12827        #[allow(clippy::single_element_loop)]
12828        for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
12829            url = params.uri_replacement(url, param_name, find_this, true);
12830        }
12831        {
12832            let to_remove = ["resource"];
12833            params.remove_params(&to_remove);
12834        }
12835
12836        let url = params.parse_with_url(&url);
12837
12838        let mut json_mime_type = mime::APPLICATION_JSON;
12839        let mut request_value_reader = {
12840            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
12841            common::remove_json_null_values(&mut value);
12842            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
12843            serde_json::to_writer(&mut dst, &value).unwrap();
12844            dst
12845        };
12846        let request_size = request_value_reader
12847            .seek(std::io::SeekFrom::End(0))
12848            .unwrap();
12849        request_value_reader
12850            .seek(std::io::SeekFrom::Start(0))
12851            .unwrap();
12852
12853        loop {
12854            let token = match self
12855                .hub
12856                .auth
12857                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
12858                .await
12859            {
12860                Ok(token) => token,
12861                Err(e) => match dlg.token(e) {
12862                    Ok(token) => token,
12863                    Err(e) => {
12864                        dlg.finished(false);
12865                        return Err(common::Error::MissingToken(e));
12866                    }
12867                },
12868            };
12869            request_value_reader
12870                .seek(std::io::SeekFrom::Start(0))
12871                .unwrap();
12872            let mut req_result = {
12873                let client = &self.hub.client;
12874                dlg.pre_request();
12875                let mut req_builder = hyper::Request::builder()
12876                    .method(hyper::Method::POST)
12877                    .uri(url.as_str())
12878                    .header(USER_AGENT, self.hub._user_agent.clone());
12879
12880                if let Some(token) = token.as_ref() {
12881                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
12882                }
12883
12884                let request = req_builder
12885                    .header(CONTENT_TYPE, json_mime_type.to_string())
12886                    .header(CONTENT_LENGTH, request_size as u64)
12887                    .body(common::to_body(
12888                        request_value_reader.get_ref().clone().into(),
12889                    ));
12890
12891                client.request(request.unwrap()).await
12892            };
12893
12894            match req_result {
12895                Err(err) => {
12896                    if let common::Retry::After(d) = dlg.http_error(&err) {
12897                        sleep(d).await;
12898                        continue;
12899                    }
12900                    dlg.finished(false);
12901                    return Err(common::Error::HttpError(err));
12902                }
12903                Ok(res) => {
12904                    let (mut parts, body) = res.into_parts();
12905                    let mut body = common::Body::new(body);
12906                    if !parts.status.is_success() {
12907                        let bytes = common::to_bytes(body).await.unwrap_or_default();
12908                        let error = serde_json::from_str(&common::to_string(&bytes));
12909                        let response = common::to_response(parts, bytes.into());
12910
12911                        if let common::Retry::After(d) =
12912                            dlg.http_failure(&response, error.as_ref().ok())
12913                        {
12914                            sleep(d).await;
12915                            continue;
12916                        }
12917
12918                        dlg.finished(false);
12919
12920                        return Err(match error {
12921                            Ok(value) => common::Error::BadRequest(value),
12922                            _ => common::Error::Failure(response),
12923                        });
12924                    }
12925                    let response = {
12926                        let bytes = common::to_bytes(body).await.unwrap_or_default();
12927                        let encoded = common::to_string(&bytes);
12928                        match serde_json::from_str(&encoded) {
12929                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
12930                            Err(error) => {
12931                                dlg.response_json_decode_error(&encoded, &error);
12932                                return Err(common::Error::JsonDecodeError(
12933                                    encoded.to_string(),
12934                                    error,
12935                                ));
12936                            }
12937                        }
12938                    };
12939
12940                    dlg.finished(true);
12941                    return Ok(response);
12942                }
12943            }
12944        }
12945    }
12946
12947    ///
12948    /// Sets the *request* property to the given value.
12949    ///
12950    /// Even though the property as already been set when instantiating this call,
12951    /// we provide this method for API completeness.
12952    pub fn request(
12953        mut self,
12954        new_value: TestIamPermissionsRequest,
12955    ) -> LocationWorkforcePoolTestIamPermissionCall<'a, C> {
12956        self._request = new_value;
12957        self
12958    }
12959    /// REQUIRED: The resource for which the policy detail is being requested. See [Resource names](https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
12960    ///
12961    /// Sets the *resource* path property to the given value.
12962    ///
12963    /// Even though the property as already been set when instantiating this call,
12964    /// we provide this method for API completeness.
12965    pub fn resource(
12966        mut self,
12967        new_value: &str,
12968    ) -> LocationWorkforcePoolTestIamPermissionCall<'a, C> {
12969        self._resource = new_value.to_string();
12970        self
12971    }
12972    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
12973    /// while executing the actual API request.
12974    ///
12975    /// ````text
12976    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
12977    /// ````
12978    ///
12979    /// Sets the *delegate* property to the given value.
12980    pub fn delegate(
12981        mut self,
12982        new_value: &'a mut dyn common::Delegate,
12983    ) -> LocationWorkforcePoolTestIamPermissionCall<'a, C> {
12984        self._delegate = Some(new_value);
12985        self
12986    }
12987
12988    /// Set any additional parameter of the query string used in the request.
12989    /// It should be used to set parameters which are not yet available through their own
12990    /// setters.
12991    ///
12992    /// Please note that this method must not be used to set any of the known parameters
12993    /// which have their own setter method. If done anyway, the request will fail.
12994    ///
12995    /// # Additional Parameters
12996    ///
12997    /// * *$.xgafv* (query-string) - V1 error format.
12998    /// * *access_token* (query-string) - OAuth access token.
12999    /// * *alt* (query-string) - Data format for response.
13000    /// * *callback* (query-string) - JSONP
13001    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
13002    /// * *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.
13003    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
13004    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
13005    /// * *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.
13006    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
13007    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
13008    pub fn param<T>(
13009        mut self,
13010        name: T,
13011        value: T,
13012    ) -> LocationWorkforcePoolTestIamPermissionCall<'a, C>
13013    where
13014        T: AsRef<str>,
13015    {
13016        self._additional_params
13017            .insert(name.as_ref().to_string(), value.as_ref().to_string());
13018        self
13019    }
13020
13021    /// Identifies the authorization scope for the method you are building.
13022    ///
13023    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
13024    /// [`Scope::CloudPlatform`].
13025    ///
13026    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
13027    /// tokens for more than one scope.
13028    ///
13029    /// Usually there is more than one suitable scope to authorize an operation, some of which may
13030    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
13031    /// sufficient, a read-write scope will do as well.
13032    pub fn add_scope<St>(mut self, scope: St) -> LocationWorkforcePoolTestIamPermissionCall<'a, C>
13033    where
13034        St: AsRef<str>,
13035    {
13036        self._scopes.insert(String::from(scope.as_ref()));
13037        self
13038    }
13039    /// Identifies the authorization scope(s) for the method you are building.
13040    ///
13041    /// See [`Self::add_scope()`] for details.
13042    pub fn add_scopes<I, St>(
13043        mut self,
13044        scopes: I,
13045    ) -> LocationWorkforcePoolTestIamPermissionCall<'a, C>
13046    where
13047        I: IntoIterator<Item = St>,
13048        St: AsRef<str>,
13049    {
13050        self._scopes
13051            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
13052        self
13053    }
13054
13055    /// Removes all scopes, and no default scope will be used either.
13056    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
13057    /// for details).
13058    pub fn clear_scopes(mut self) -> LocationWorkforcePoolTestIamPermissionCall<'a, C> {
13059        self._scopes.clear();
13060        self
13061    }
13062}
13063
13064/// Undeletes a WorkforcePool, as long as it was deleted fewer than 30 days ago.
13065///
13066/// A builder for the *workforcePools.undelete* method supported by a *location* resource.
13067/// It is not used directly, but through a [`LocationMethods`] instance.
13068///
13069/// # Example
13070///
13071/// Instantiate a resource method builder
13072///
13073/// ```test_harness,no_run
13074/// # extern crate hyper;
13075/// # extern crate hyper_rustls;
13076/// # extern crate google_iam1 as iam1;
13077/// use iam1::api::UndeleteWorkforcePoolRequest;
13078/// # async fn dox() {
13079/// # use iam1::{Iam, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
13080///
13081/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
13082/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
13083/// #     secret,
13084/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
13085/// # ).build().await.unwrap();
13086///
13087/// # let client = hyper_util::client::legacy::Client::builder(
13088/// #     hyper_util::rt::TokioExecutor::new()
13089/// # )
13090/// # .build(
13091/// #     hyper_rustls::HttpsConnectorBuilder::new()
13092/// #         .with_native_roots()
13093/// #         .unwrap()
13094/// #         .https_or_http()
13095/// #         .enable_http1()
13096/// #         .build()
13097/// # );
13098/// # let mut hub = Iam::new(client, auth);
13099/// // As the method needs a request, you would usually fill it with the desired information
13100/// // into the respective structure. Some of the parts shown here might not be applicable !
13101/// // Values shown here are possibly random and not representative !
13102/// let mut req = UndeleteWorkforcePoolRequest::default();
13103///
13104/// // You can configure optional parameters by calling the respective setters at will, and
13105/// // execute the final call using `doit()`.
13106/// // Values shown here are possibly random and not representative !
13107/// let result = hub.locations().workforce_pools_undelete(req, "name")
13108///              .doit().await;
13109/// # }
13110/// ```
13111pub struct LocationWorkforcePoolUndeleteCall<'a, C>
13112where
13113    C: 'a,
13114{
13115    hub: &'a Iam<C>,
13116    _request: UndeleteWorkforcePoolRequest,
13117    _name: String,
13118    _delegate: Option<&'a mut dyn common::Delegate>,
13119    _additional_params: HashMap<String, String>,
13120    _scopes: BTreeSet<String>,
13121}
13122
13123impl<'a, C> common::CallBuilder for LocationWorkforcePoolUndeleteCall<'a, C> {}
13124
13125impl<'a, C> LocationWorkforcePoolUndeleteCall<'a, C>
13126where
13127    C: common::Connector,
13128{
13129    /// Perform the operation you have build so far.
13130    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
13131        use std::borrow::Cow;
13132        use std::io::{Read, Seek};
13133
13134        use common::{url::Params, ToParts};
13135        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
13136
13137        let mut dd = common::DefaultDelegate;
13138        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
13139        dlg.begin(common::MethodInfo {
13140            id: "iam.locations.workforcePools.undelete",
13141            http_method: hyper::Method::POST,
13142        });
13143
13144        for &field in ["alt", "name"].iter() {
13145            if self._additional_params.contains_key(field) {
13146                dlg.finished(false);
13147                return Err(common::Error::FieldClash(field));
13148            }
13149        }
13150
13151        let mut params = Params::with_capacity(4 + self._additional_params.len());
13152        params.push("name", self._name);
13153
13154        params.extend(self._additional_params.iter());
13155
13156        params.push("alt", "json");
13157        let mut url = self.hub._base_url.clone() + "v1/{+name}:undelete";
13158        if self._scopes.is_empty() {
13159            self._scopes
13160                .insert(Scope::CloudPlatform.as_ref().to_string());
13161        }
13162
13163        #[allow(clippy::single_element_loop)]
13164        for &(find_this, param_name) in [("{+name}", "name")].iter() {
13165            url = params.uri_replacement(url, param_name, find_this, true);
13166        }
13167        {
13168            let to_remove = ["name"];
13169            params.remove_params(&to_remove);
13170        }
13171
13172        let url = params.parse_with_url(&url);
13173
13174        let mut json_mime_type = mime::APPLICATION_JSON;
13175        let mut request_value_reader = {
13176            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
13177            common::remove_json_null_values(&mut value);
13178            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
13179            serde_json::to_writer(&mut dst, &value).unwrap();
13180            dst
13181        };
13182        let request_size = request_value_reader
13183            .seek(std::io::SeekFrom::End(0))
13184            .unwrap();
13185        request_value_reader
13186            .seek(std::io::SeekFrom::Start(0))
13187            .unwrap();
13188
13189        loop {
13190            let token = match self
13191                .hub
13192                .auth
13193                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
13194                .await
13195            {
13196                Ok(token) => token,
13197                Err(e) => match dlg.token(e) {
13198                    Ok(token) => token,
13199                    Err(e) => {
13200                        dlg.finished(false);
13201                        return Err(common::Error::MissingToken(e));
13202                    }
13203                },
13204            };
13205            request_value_reader
13206                .seek(std::io::SeekFrom::Start(0))
13207                .unwrap();
13208            let mut req_result = {
13209                let client = &self.hub.client;
13210                dlg.pre_request();
13211                let mut req_builder = hyper::Request::builder()
13212                    .method(hyper::Method::POST)
13213                    .uri(url.as_str())
13214                    .header(USER_AGENT, self.hub._user_agent.clone());
13215
13216                if let Some(token) = token.as_ref() {
13217                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
13218                }
13219
13220                let request = req_builder
13221                    .header(CONTENT_TYPE, json_mime_type.to_string())
13222                    .header(CONTENT_LENGTH, request_size as u64)
13223                    .body(common::to_body(
13224                        request_value_reader.get_ref().clone().into(),
13225                    ));
13226
13227                client.request(request.unwrap()).await
13228            };
13229
13230            match req_result {
13231                Err(err) => {
13232                    if let common::Retry::After(d) = dlg.http_error(&err) {
13233                        sleep(d).await;
13234                        continue;
13235                    }
13236                    dlg.finished(false);
13237                    return Err(common::Error::HttpError(err));
13238                }
13239                Ok(res) => {
13240                    let (mut parts, body) = res.into_parts();
13241                    let mut body = common::Body::new(body);
13242                    if !parts.status.is_success() {
13243                        let bytes = common::to_bytes(body).await.unwrap_or_default();
13244                        let error = serde_json::from_str(&common::to_string(&bytes));
13245                        let response = common::to_response(parts, bytes.into());
13246
13247                        if let common::Retry::After(d) =
13248                            dlg.http_failure(&response, error.as_ref().ok())
13249                        {
13250                            sleep(d).await;
13251                            continue;
13252                        }
13253
13254                        dlg.finished(false);
13255
13256                        return Err(match error {
13257                            Ok(value) => common::Error::BadRequest(value),
13258                            _ => common::Error::Failure(response),
13259                        });
13260                    }
13261                    let response = {
13262                        let bytes = common::to_bytes(body).await.unwrap_or_default();
13263                        let encoded = common::to_string(&bytes);
13264                        match serde_json::from_str(&encoded) {
13265                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
13266                            Err(error) => {
13267                                dlg.response_json_decode_error(&encoded, &error);
13268                                return Err(common::Error::JsonDecodeError(
13269                                    encoded.to_string(),
13270                                    error,
13271                                ));
13272                            }
13273                        }
13274                    };
13275
13276                    dlg.finished(true);
13277                    return Ok(response);
13278                }
13279            }
13280        }
13281    }
13282
13283    ///
13284    /// Sets the *request* property to the given value.
13285    ///
13286    /// Even though the property as already been set when instantiating this call,
13287    /// we provide this method for API completeness.
13288    pub fn request(
13289        mut self,
13290        new_value: UndeleteWorkforcePoolRequest,
13291    ) -> LocationWorkforcePoolUndeleteCall<'a, C> {
13292        self._request = new_value;
13293        self
13294    }
13295    /// Required. The name of the pool to undelete. Format: `locations/{location}/workforcePools/{workforce_pool_id}`
13296    ///
13297    /// Sets the *name* path property to the given value.
13298    ///
13299    /// Even though the property as already been set when instantiating this call,
13300    /// we provide this method for API completeness.
13301    pub fn name(mut self, new_value: &str) -> LocationWorkforcePoolUndeleteCall<'a, C> {
13302        self._name = new_value.to_string();
13303        self
13304    }
13305    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
13306    /// while executing the actual API request.
13307    ///
13308    /// ````text
13309    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
13310    /// ````
13311    ///
13312    /// Sets the *delegate* property to the given value.
13313    pub fn delegate(
13314        mut self,
13315        new_value: &'a mut dyn common::Delegate,
13316    ) -> LocationWorkforcePoolUndeleteCall<'a, C> {
13317        self._delegate = Some(new_value);
13318        self
13319    }
13320
13321    /// Set any additional parameter of the query string used in the request.
13322    /// It should be used to set parameters which are not yet available through their own
13323    /// setters.
13324    ///
13325    /// Please note that this method must not be used to set any of the known parameters
13326    /// which have their own setter method. If done anyway, the request will fail.
13327    ///
13328    /// # Additional Parameters
13329    ///
13330    /// * *$.xgafv* (query-string) - V1 error format.
13331    /// * *access_token* (query-string) - OAuth access token.
13332    /// * *alt* (query-string) - Data format for response.
13333    /// * *callback* (query-string) - JSONP
13334    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
13335    /// * *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.
13336    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
13337    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
13338    /// * *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.
13339    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
13340    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
13341    pub fn param<T>(mut self, name: T, value: T) -> LocationWorkforcePoolUndeleteCall<'a, C>
13342    where
13343        T: AsRef<str>,
13344    {
13345        self._additional_params
13346            .insert(name.as_ref().to_string(), value.as_ref().to_string());
13347        self
13348    }
13349
13350    /// Identifies the authorization scope for the method you are building.
13351    ///
13352    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
13353    /// [`Scope::CloudPlatform`].
13354    ///
13355    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
13356    /// tokens for more than one scope.
13357    ///
13358    /// Usually there is more than one suitable scope to authorize an operation, some of which may
13359    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
13360    /// sufficient, a read-write scope will do as well.
13361    pub fn add_scope<St>(mut self, scope: St) -> LocationWorkforcePoolUndeleteCall<'a, C>
13362    where
13363        St: AsRef<str>,
13364    {
13365        self._scopes.insert(String::from(scope.as_ref()));
13366        self
13367    }
13368    /// Identifies the authorization scope(s) for the method you are building.
13369    ///
13370    /// See [`Self::add_scope()`] for details.
13371    pub fn add_scopes<I, St>(mut self, scopes: I) -> LocationWorkforcePoolUndeleteCall<'a, C>
13372    where
13373        I: IntoIterator<Item = St>,
13374        St: AsRef<str>,
13375    {
13376        self._scopes
13377            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
13378        self
13379    }
13380
13381    /// Removes all scopes, and no default scope will be used either.
13382    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
13383    /// for details).
13384    pub fn clear_scopes(mut self) -> LocationWorkforcePoolUndeleteCall<'a, C> {
13385        self._scopes.clear();
13386        self
13387    }
13388}
13389
13390/// Creates a new custom Role.
13391///
13392/// A builder for the *roles.create* method supported by a *organization* resource.
13393/// It is not used directly, but through a [`OrganizationMethods`] instance.
13394///
13395/// # Example
13396///
13397/// Instantiate a resource method builder
13398///
13399/// ```test_harness,no_run
13400/// # extern crate hyper;
13401/// # extern crate hyper_rustls;
13402/// # extern crate google_iam1 as iam1;
13403/// use iam1::api::CreateRoleRequest;
13404/// # async fn dox() {
13405/// # use iam1::{Iam, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
13406///
13407/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
13408/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
13409/// #     secret,
13410/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
13411/// # ).build().await.unwrap();
13412///
13413/// # let client = hyper_util::client::legacy::Client::builder(
13414/// #     hyper_util::rt::TokioExecutor::new()
13415/// # )
13416/// # .build(
13417/// #     hyper_rustls::HttpsConnectorBuilder::new()
13418/// #         .with_native_roots()
13419/// #         .unwrap()
13420/// #         .https_or_http()
13421/// #         .enable_http1()
13422/// #         .build()
13423/// # );
13424/// # let mut hub = Iam::new(client, auth);
13425/// // As the method needs a request, you would usually fill it with the desired information
13426/// // into the respective structure. Some of the parts shown here might not be applicable !
13427/// // Values shown here are possibly random and not representative !
13428/// let mut req = CreateRoleRequest::default();
13429///
13430/// // You can configure optional parameters by calling the respective setters at will, and
13431/// // execute the final call using `doit()`.
13432/// // Values shown here are possibly random and not representative !
13433/// let result = hub.organizations().roles_create(req, "parent")
13434///              .doit().await;
13435/// # }
13436/// ```
13437pub struct OrganizationRoleCreateCall<'a, C>
13438where
13439    C: 'a,
13440{
13441    hub: &'a Iam<C>,
13442    _request: CreateRoleRequest,
13443    _parent: String,
13444    _delegate: Option<&'a mut dyn common::Delegate>,
13445    _additional_params: HashMap<String, String>,
13446    _scopes: BTreeSet<String>,
13447}
13448
13449impl<'a, C> common::CallBuilder for OrganizationRoleCreateCall<'a, C> {}
13450
13451impl<'a, C> OrganizationRoleCreateCall<'a, C>
13452where
13453    C: common::Connector,
13454{
13455    /// Perform the operation you have build so far.
13456    pub async fn doit(mut self) -> common::Result<(common::Response, Role)> {
13457        use std::borrow::Cow;
13458        use std::io::{Read, Seek};
13459
13460        use common::{url::Params, ToParts};
13461        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
13462
13463        let mut dd = common::DefaultDelegate;
13464        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
13465        dlg.begin(common::MethodInfo {
13466            id: "iam.organizations.roles.create",
13467            http_method: hyper::Method::POST,
13468        });
13469
13470        for &field in ["alt", "parent"].iter() {
13471            if self._additional_params.contains_key(field) {
13472                dlg.finished(false);
13473                return Err(common::Error::FieldClash(field));
13474            }
13475        }
13476
13477        let mut params = Params::with_capacity(4 + self._additional_params.len());
13478        params.push("parent", self._parent);
13479
13480        params.extend(self._additional_params.iter());
13481
13482        params.push("alt", "json");
13483        let mut url = self.hub._base_url.clone() + "v1/{+parent}/roles";
13484        if self._scopes.is_empty() {
13485            self._scopes
13486                .insert(Scope::CloudPlatform.as_ref().to_string());
13487        }
13488
13489        #[allow(clippy::single_element_loop)]
13490        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
13491            url = params.uri_replacement(url, param_name, find_this, true);
13492        }
13493        {
13494            let to_remove = ["parent"];
13495            params.remove_params(&to_remove);
13496        }
13497
13498        let url = params.parse_with_url(&url);
13499
13500        let mut json_mime_type = mime::APPLICATION_JSON;
13501        let mut request_value_reader = {
13502            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
13503            common::remove_json_null_values(&mut value);
13504            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
13505            serde_json::to_writer(&mut dst, &value).unwrap();
13506            dst
13507        };
13508        let request_size = request_value_reader
13509            .seek(std::io::SeekFrom::End(0))
13510            .unwrap();
13511        request_value_reader
13512            .seek(std::io::SeekFrom::Start(0))
13513            .unwrap();
13514
13515        loop {
13516            let token = match self
13517                .hub
13518                .auth
13519                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
13520                .await
13521            {
13522                Ok(token) => token,
13523                Err(e) => match dlg.token(e) {
13524                    Ok(token) => token,
13525                    Err(e) => {
13526                        dlg.finished(false);
13527                        return Err(common::Error::MissingToken(e));
13528                    }
13529                },
13530            };
13531            request_value_reader
13532                .seek(std::io::SeekFrom::Start(0))
13533                .unwrap();
13534            let mut req_result = {
13535                let client = &self.hub.client;
13536                dlg.pre_request();
13537                let mut req_builder = hyper::Request::builder()
13538                    .method(hyper::Method::POST)
13539                    .uri(url.as_str())
13540                    .header(USER_AGENT, self.hub._user_agent.clone());
13541
13542                if let Some(token) = token.as_ref() {
13543                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
13544                }
13545
13546                let request = req_builder
13547                    .header(CONTENT_TYPE, json_mime_type.to_string())
13548                    .header(CONTENT_LENGTH, request_size as u64)
13549                    .body(common::to_body(
13550                        request_value_reader.get_ref().clone().into(),
13551                    ));
13552
13553                client.request(request.unwrap()).await
13554            };
13555
13556            match req_result {
13557                Err(err) => {
13558                    if let common::Retry::After(d) = dlg.http_error(&err) {
13559                        sleep(d).await;
13560                        continue;
13561                    }
13562                    dlg.finished(false);
13563                    return Err(common::Error::HttpError(err));
13564                }
13565                Ok(res) => {
13566                    let (mut parts, body) = res.into_parts();
13567                    let mut body = common::Body::new(body);
13568                    if !parts.status.is_success() {
13569                        let bytes = common::to_bytes(body).await.unwrap_or_default();
13570                        let error = serde_json::from_str(&common::to_string(&bytes));
13571                        let response = common::to_response(parts, bytes.into());
13572
13573                        if let common::Retry::After(d) =
13574                            dlg.http_failure(&response, error.as_ref().ok())
13575                        {
13576                            sleep(d).await;
13577                            continue;
13578                        }
13579
13580                        dlg.finished(false);
13581
13582                        return Err(match error {
13583                            Ok(value) => common::Error::BadRequest(value),
13584                            _ => common::Error::Failure(response),
13585                        });
13586                    }
13587                    let response = {
13588                        let bytes = common::to_bytes(body).await.unwrap_or_default();
13589                        let encoded = common::to_string(&bytes);
13590                        match serde_json::from_str(&encoded) {
13591                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
13592                            Err(error) => {
13593                                dlg.response_json_decode_error(&encoded, &error);
13594                                return Err(common::Error::JsonDecodeError(
13595                                    encoded.to_string(),
13596                                    error,
13597                                ));
13598                            }
13599                        }
13600                    };
13601
13602                    dlg.finished(true);
13603                    return Ok(response);
13604                }
13605            }
13606        }
13607    }
13608
13609    ///
13610    /// Sets the *request* property to the given value.
13611    ///
13612    /// Even though the property as already been set when instantiating this call,
13613    /// we provide this method for API completeness.
13614    pub fn request(mut self, new_value: CreateRoleRequest) -> OrganizationRoleCreateCall<'a, C> {
13615        self._request = new_value;
13616        self
13617    }
13618    /// The `parent` parameter's value depends on the target resource for the request, namely [projects](https://cloud.google.com/iam/docs/reference/rest/v1/projects.roles) or [organizations](https://cloud.google.com/iam/docs/reference/rest/v1/organizations.roles). Each resource type's `parent` value format is described below: * [projects.roles.create](https://cloud.google.com/iam/docs/reference/rest/v1/projects.roles/create): `projects/{PROJECT_ID}`. This method creates project-level [custom roles](https://cloud.google.com/iam/docs/understanding-custom-roles). Example request URL: `https://iam.googleapis.com/v1/projects/{PROJECT_ID}/roles` * [organizations.roles.create](https://cloud.google.com/iam/docs/reference/rest/v1/organizations.roles/create): `organizations/{ORGANIZATION_ID}`. This method creates organization-level [custom roles](https://cloud.google.com/iam/docs/understanding-custom-roles). Example request URL: `https://iam.googleapis.com/v1/organizations/{ORGANIZATION_ID}/roles` Note: Wildcard (*) values are invalid; you must specify a complete project ID or organization ID.
13619    ///
13620    /// Sets the *parent* path property to the given value.
13621    ///
13622    /// Even though the property as already been set when instantiating this call,
13623    /// we provide this method for API completeness.
13624    pub fn parent(mut self, new_value: &str) -> OrganizationRoleCreateCall<'a, C> {
13625        self._parent = new_value.to_string();
13626        self
13627    }
13628    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
13629    /// while executing the actual API request.
13630    ///
13631    /// ````text
13632    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
13633    /// ````
13634    ///
13635    /// Sets the *delegate* property to the given value.
13636    pub fn delegate(
13637        mut self,
13638        new_value: &'a mut dyn common::Delegate,
13639    ) -> OrganizationRoleCreateCall<'a, C> {
13640        self._delegate = Some(new_value);
13641        self
13642    }
13643
13644    /// Set any additional parameter of the query string used in the request.
13645    /// It should be used to set parameters which are not yet available through their own
13646    /// setters.
13647    ///
13648    /// Please note that this method must not be used to set any of the known parameters
13649    /// which have their own setter method. If done anyway, the request will fail.
13650    ///
13651    /// # Additional Parameters
13652    ///
13653    /// * *$.xgafv* (query-string) - V1 error format.
13654    /// * *access_token* (query-string) - OAuth access token.
13655    /// * *alt* (query-string) - Data format for response.
13656    /// * *callback* (query-string) - JSONP
13657    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
13658    /// * *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.
13659    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
13660    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
13661    /// * *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.
13662    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
13663    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
13664    pub fn param<T>(mut self, name: T, value: T) -> OrganizationRoleCreateCall<'a, C>
13665    where
13666        T: AsRef<str>,
13667    {
13668        self._additional_params
13669            .insert(name.as_ref().to_string(), value.as_ref().to_string());
13670        self
13671    }
13672
13673    /// Identifies the authorization scope for the method you are building.
13674    ///
13675    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
13676    /// [`Scope::CloudPlatform`].
13677    ///
13678    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
13679    /// tokens for more than one scope.
13680    ///
13681    /// Usually there is more than one suitable scope to authorize an operation, some of which may
13682    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
13683    /// sufficient, a read-write scope will do as well.
13684    pub fn add_scope<St>(mut self, scope: St) -> OrganizationRoleCreateCall<'a, C>
13685    where
13686        St: AsRef<str>,
13687    {
13688        self._scopes.insert(String::from(scope.as_ref()));
13689        self
13690    }
13691    /// Identifies the authorization scope(s) for the method you are building.
13692    ///
13693    /// See [`Self::add_scope()`] for details.
13694    pub fn add_scopes<I, St>(mut self, scopes: I) -> OrganizationRoleCreateCall<'a, C>
13695    where
13696        I: IntoIterator<Item = St>,
13697        St: AsRef<str>,
13698    {
13699        self._scopes
13700            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
13701        self
13702    }
13703
13704    /// Removes all scopes, and no default scope will be used either.
13705    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
13706    /// for details).
13707    pub fn clear_scopes(mut self) -> OrganizationRoleCreateCall<'a, C> {
13708        self._scopes.clear();
13709        self
13710    }
13711}
13712
13713/// Deletes a custom Role. When you delete a custom role, the following changes occur immediately: * You cannot bind a principal to the custom role in an IAM Policy. * Existing bindings to the custom role are not changed, but they have no effect. * By default, the response from ListRoles does not include the custom role. You have 7 days to undelete the custom role. After 7 days, the following changes occur: * The custom role is permanently deleted and cannot be recovered. * If an IAM policy contains a binding to the custom role, the binding is permanently removed.
13714///
13715/// A builder for the *roles.delete* method supported by a *organization* resource.
13716/// It is not used directly, but through a [`OrganizationMethods`] instance.
13717///
13718/// # Example
13719///
13720/// Instantiate a resource method builder
13721///
13722/// ```test_harness,no_run
13723/// # extern crate hyper;
13724/// # extern crate hyper_rustls;
13725/// # extern crate google_iam1 as iam1;
13726/// # async fn dox() {
13727/// # use iam1::{Iam, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
13728///
13729/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
13730/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
13731/// #     secret,
13732/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
13733/// # ).build().await.unwrap();
13734///
13735/// # let client = hyper_util::client::legacy::Client::builder(
13736/// #     hyper_util::rt::TokioExecutor::new()
13737/// # )
13738/// # .build(
13739/// #     hyper_rustls::HttpsConnectorBuilder::new()
13740/// #         .with_native_roots()
13741/// #         .unwrap()
13742/// #         .https_or_http()
13743/// #         .enable_http1()
13744/// #         .build()
13745/// # );
13746/// # let mut hub = Iam::new(client, auth);
13747/// // You can configure optional parameters by calling the respective setters at will, and
13748/// // execute the final call using `doit()`.
13749/// // Values shown here are possibly random and not representative !
13750/// let result = hub.organizations().roles_delete("name")
13751///              .etag(vec![0, 1, 2, 3])
13752///              .doit().await;
13753/// # }
13754/// ```
13755pub struct OrganizationRoleDeleteCall<'a, C>
13756where
13757    C: 'a,
13758{
13759    hub: &'a Iam<C>,
13760    _name: String,
13761    _etag: Option<Vec<u8>>,
13762    _delegate: Option<&'a mut dyn common::Delegate>,
13763    _additional_params: HashMap<String, String>,
13764    _scopes: BTreeSet<String>,
13765}
13766
13767impl<'a, C> common::CallBuilder for OrganizationRoleDeleteCall<'a, C> {}
13768
13769impl<'a, C> OrganizationRoleDeleteCall<'a, C>
13770where
13771    C: common::Connector,
13772{
13773    /// Perform the operation you have build so far.
13774    pub async fn doit(mut self) -> common::Result<(common::Response, Role)> {
13775        use std::borrow::Cow;
13776        use std::io::{Read, Seek};
13777
13778        use common::{url::Params, ToParts};
13779        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
13780
13781        let mut dd = common::DefaultDelegate;
13782        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
13783        dlg.begin(common::MethodInfo {
13784            id: "iam.organizations.roles.delete",
13785            http_method: hyper::Method::DELETE,
13786        });
13787
13788        for &field in ["alt", "name", "etag"].iter() {
13789            if self._additional_params.contains_key(field) {
13790                dlg.finished(false);
13791                return Err(common::Error::FieldClash(field));
13792            }
13793        }
13794
13795        let mut params = Params::with_capacity(4 + self._additional_params.len());
13796        params.push("name", self._name);
13797        if let Some(value) = self._etag.as_ref() {
13798            params.push("etag", common::serde::standard_base64::to_string(&value));
13799        }
13800
13801        params.extend(self._additional_params.iter());
13802
13803        params.push("alt", "json");
13804        let mut url = self.hub._base_url.clone() + "v1/{+name}";
13805        if self._scopes.is_empty() {
13806            self._scopes
13807                .insert(Scope::CloudPlatform.as_ref().to_string());
13808        }
13809
13810        #[allow(clippy::single_element_loop)]
13811        for &(find_this, param_name) in [("{+name}", "name")].iter() {
13812            url = params.uri_replacement(url, param_name, find_this, true);
13813        }
13814        {
13815            let to_remove = ["name"];
13816            params.remove_params(&to_remove);
13817        }
13818
13819        let url = params.parse_with_url(&url);
13820
13821        loop {
13822            let token = match self
13823                .hub
13824                .auth
13825                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
13826                .await
13827            {
13828                Ok(token) => token,
13829                Err(e) => match dlg.token(e) {
13830                    Ok(token) => token,
13831                    Err(e) => {
13832                        dlg.finished(false);
13833                        return Err(common::Error::MissingToken(e));
13834                    }
13835                },
13836            };
13837            let mut req_result = {
13838                let client = &self.hub.client;
13839                dlg.pre_request();
13840                let mut req_builder = hyper::Request::builder()
13841                    .method(hyper::Method::DELETE)
13842                    .uri(url.as_str())
13843                    .header(USER_AGENT, self.hub._user_agent.clone());
13844
13845                if let Some(token) = token.as_ref() {
13846                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
13847                }
13848
13849                let request = req_builder
13850                    .header(CONTENT_LENGTH, 0_u64)
13851                    .body(common::to_body::<String>(None));
13852
13853                client.request(request.unwrap()).await
13854            };
13855
13856            match req_result {
13857                Err(err) => {
13858                    if let common::Retry::After(d) = dlg.http_error(&err) {
13859                        sleep(d).await;
13860                        continue;
13861                    }
13862                    dlg.finished(false);
13863                    return Err(common::Error::HttpError(err));
13864                }
13865                Ok(res) => {
13866                    let (mut parts, body) = res.into_parts();
13867                    let mut body = common::Body::new(body);
13868                    if !parts.status.is_success() {
13869                        let bytes = common::to_bytes(body).await.unwrap_or_default();
13870                        let error = serde_json::from_str(&common::to_string(&bytes));
13871                        let response = common::to_response(parts, bytes.into());
13872
13873                        if let common::Retry::After(d) =
13874                            dlg.http_failure(&response, error.as_ref().ok())
13875                        {
13876                            sleep(d).await;
13877                            continue;
13878                        }
13879
13880                        dlg.finished(false);
13881
13882                        return Err(match error {
13883                            Ok(value) => common::Error::BadRequest(value),
13884                            _ => common::Error::Failure(response),
13885                        });
13886                    }
13887                    let response = {
13888                        let bytes = common::to_bytes(body).await.unwrap_or_default();
13889                        let encoded = common::to_string(&bytes);
13890                        match serde_json::from_str(&encoded) {
13891                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
13892                            Err(error) => {
13893                                dlg.response_json_decode_error(&encoded, &error);
13894                                return Err(common::Error::JsonDecodeError(
13895                                    encoded.to_string(),
13896                                    error,
13897                                ));
13898                            }
13899                        }
13900                    };
13901
13902                    dlg.finished(true);
13903                    return Ok(response);
13904                }
13905            }
13906        }
13907    }
13908
13909    /// The `name` parameter's value depends on the target resource for the request, namely [projects](https://cloud.google.com/iam/docs/reference/rest/v1/projects.roles) or [organizations](https://cloud.google.com/iam/docs/reference/rest/v1/organizations.roles). Each resource type's `name` value format is described below: * [projects.roles.delete](https://cloud.google.com/iam/docs/reference/rest/v1/projects.roles/delete): `projects/{PROJECT_ID}/roles/{CUSTOM_ROLE_ID}`. This method deletes only [custom roles](https://cloud.google.com/iam/docs/understanding-custom-roles) that have been created at the project level. Example request URL: `https://iam.googleapis.com/v1/projects/{PROJECT_ID}/roles/{CUSTOM_ROLE_ID}` * [organizations.roles.delete](https://cloud.google.com/iam/docs/reference/rest/v1/organizations.roles/delete): `organizations/{ORGANIZATION_ID}/roles/{CUSTOM_ROLE_ID}`. This method deletes only [custom roles](https://cloud.google.com/iam/docs/understanding-custom-roles) that have been created at the organization level. Example request URL: `https://iam.googleapis.com/v1/organizations/{ORGANIZATION_ID}/roles/{CUSTOM_ROLE_ID}` Note: Wildcard (*) values are invalid; you must specify a complete project ID or organization ID.
13910    ///
13911    /// Sets the *name* path property to the given value.
13912    ///
13913    /// Even though the property as already been set when instantiating this call,
13914    /// we provide this method for API completeness.
13915    pub fn name(mut self, new_value: &str) -> OrganizationRoleDeleteCall<'a, C> {
13916        self._name = new_value.to_string();
13917        self
13918    }
13919    /// Used to perform a consistent read-modify-write.
13920    ///
13921    /// Sets the *etag* query property to the given value.
13922    pub fn etag(mut self, new_value: Vec<u8>) -> OrganizationRoleDeleteCall<'a, C> {
13923        self._etag = Some(new_value);
13924        self
13925    }
13926    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
13927    /// while executing the actual API request.
13928    ///
13929    /// ````text
13930    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
13931    /// ````
13932    ///
13933    /// Sets the *delegate* property to the given value.
13934    pub fn delegate(
13935        mut self,
13936        new_value: &'a mut dyn common::Delegate,
13937    ) -> OrganizationRoleDeleteCall<'a, C> {
13938        self._delegate = Some(new_value);
13939        self
13940    }
13941
13942    /// Set any additional parameter of the query string used in the request.
13943    /// It should be used to set parameters which are not yet available through their own
13944    /// setters.
13945    ///
13946    /// Please note that this method must not be used to set any of the known parameters
13947    /// which have their own setter method. If done anyway, the request will fail.
13948    ///
13949    /// # Additional Parameters
13950    ///
13951    /// * *$.xgafv* (query-string) - V1 error format.
13952    /// * *access_token* (query-string) - OAuth access token.
13953    /// * *alt* (query-string) - Data format for response.
13954    /// * *callback* (query-string) - JSONP
13955    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
13956    /// * *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.
13957    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
13958    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
13959    /// * *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.
13960    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
13961    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
13962    pub fn param<T>(mut self, name: T, value: T) -> OrganizationRoleDeleteCall<'a, C>
13963    where
13964        T: AsRef<str>,
13965    {
13966        self._additional_params
13967            .insert(name.as_ref().to_string(), value.as_ref().to_string());
13968        self
13969    }
13970
13971    /// Identifies the authorization scope for the method you are building.
13972    ///
13973    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
13974    /// [`Scope::CloudPlatform`].
13975    ///
13976    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
13977    /// tokens for more than one scope.
13978    ///
13979    /// Usually there is more than one suitable scope to authorize an operation, some of which may
13980    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
13981    /// sufficient, a read-write scope will do as well.
13982    pub fn add_scope<St>(mut self, scope: St) -> OrganizationRoleDeleteCall<'a, C>
13983    where
13984        St: AsRef<str>,
13985    {
13986        self._scopes.insert(String::from(scope.as_ref()));
13987        self
13988    }
13989    /// Identifies the authorization scope(s) for the method you are building.
13990    ///
13991    /// See [`Self::add_scope()`] for details.
13992    pub fn add_scopes<I, St>(mut self, scopes: I) -> OrganizationRoleDeleteCall<'a, C>
13993    where
13994        I: IntoIterator<Item = St>,
13995        St: AsRef<str>,
13996    {
13997        self._scopes
13998            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
13999        self
14000    }
14001
14002    /// Removes all scopes, and no default scope will be used either.
14003    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
14004    /// for details).
14005    pub fn clear_scopes(mut self) -> OrganizationRoleDeleteCall<'a, C> {
14006        self._scopes.clear();
14007        self
14008    }
14009}
14010
14011/// Gets the definition of a Role.
14012///
14013/// A builder for the *roles.get* method supported by a *organization* resource.
14014/// It is not used directly, but through a [`OrganizationMethods`] instance.
14015///
14016/// # Example
14017///
14018/// Instantiate a resource method builder
14019///
14020/// ```test_harness,no_run
14021/// # extern crate hyper;
14022/// # extern crate hyper_rustls;
14023/// # extern crate google_iam1 as iam1;
14024/// # async fn dox() {
14025/// # use iam1::{Iam, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
14026///
14027/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
14028/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
14029/// #     secret,
14030/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
14031/// # ).build().await.unwrap();
14032///
14033/// # let client = hyper_util::client::legacy::Client::builder(
14034/// #     hyper_util::rt::TokioExecutor::new()
14035/// # )
14036/// # .build(
14037/// #     hyper_rustls::HttpsConnectorBuilder::new()
14038/// #         .with_native_roots()
14039/// #         .unwrap()
14040/// #         .https_or_http()
14041/// #         .enable_http1()
14042/// #         .build()
14043/// # );
14044/// # let mut hub = Iam::new(client, auth);
14045/// // You can configure optional parameters by calling the respective setters at will, and
14046/// // execute the final call using `doit()`.
14047/// // Values shown here are possibly random and not representative !
14048/// let result = hub.organizations().roles_get("name")
14049///              .doit().await;
14050/// # }
14051/// ```
14052pub struct OrganizationRoleGetCall<'a, C>
14053where
14054    C: 'a,
14055{
14056    hub: &'a Iam<C>,
14057    _name: String,
14058    _delegate: Option<&'a mut dyn common::Delegate>,
14059    _additional_params: HashMap<String, String>,
14060    _scopes: BTreeSet<String>,
14061}
14062
14063impl<'a, C> common::CallBuilder for OrganizationRoleGetCall<'a, C> {}
14064
14065impl<'a, C> OrganizationRoleGetCall<'a, C>
14066where
14067    C: common::Connector,
14068{
14069    /// Perform the operation you have build so far.
14070    pub async fn doit(mut self) -> common::Result<(common::Response, Role)> {
14071        use std::borrow::Cow;
14072        use std::io::{Read, Seek};
14073
14074        use common::{url::Params, ToParts};
14075        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
14076
14077        let mut dd = common::DefaultDelegate;
14078        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
14079        dlg.begin(common::MethodInfo {
14080            id: "iam.organizations.roles.get",
14081            http_method: hyper::Method::GET,
14082        });
14083
14084        for &field in ["alt", "name"].iter() {
14085            if self._additional_params.contains_key(field) {
14086                dlg.finished(false);
14087                return Err(common::Error::FieldClash(field));
14088            }
14089        }
14090
14091        let mut params = Params::with_capacity(3 + self._additional_params.len());
14092        params.push("name", self._name);
14093
14094        params.extend(self._additional_params.iter());
14095
14096        params.push("alt", "json");
14097        let mut url = self.hub._base_url.clone() + "v1/{+name}";
14098        if self._scopes.is_empty() {
14099            self._scopes
14100                .insert(Scope::CloudPlatform.as_ref().to_string());
14101        }
14102
14103        #[allow(clippy::single_element_loop)]
14104        for &(find_this, param_name) in [("{+name}", "name")].iter() {
14105            url = params.uri_replacement(url, param_name, find_this, true);
14106        }
14107        {
14108            let to_remove = ["name"];
14109            params.remove_params(&to_remove);
14110        }
14111
14112        let url = params.parse_with_url(&url);
14113
14114        loop {
14115            let token = match self
14116                .hub
14117                .auth
14118                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
14119                .await
14120            {
14121                Ok(token) => token,
14122                Err(e) => match dlg.token(e) {
14123                    Ok(token) => token,
14124                    Err(e) => {
14125                        dlg.finished(false);
14126                        return Err(common::Error::MissingToken(e));
14127                    }
14128                },
14129            };
14130            let mut req_result = {
14131                let client = &self.hub.client;
14132                dlg.pre_request();
14133                let mut req_builder = hyper::Request::builder()
14134                    .method(hyper::Method::GET)
14135                    .uri(url.as_str())
14136                    .header(USER_AGENT, self.hub._user_agent.clone());
14137
14138                if let Some(token) = token.as_ref() {
14139                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
14140                }
14141
14142                let request = req_builder
14143                    .header(CONTENT_LENGTH, 0_u64)
14144                    .body(common::to_body::<String>(None));
14145
14146                client.request(request.unwrap()).await
14147            };
14148
14149            match req_result {
14150                Err(err) => {
14151                    if let common::Retry::After(d) = dlg.http_error(&err) {
14152                        sleep(d).await;
14153                        continue;
14154                    }
14155                    dlg.finished(false);
14156                    return Err(common::Error::HttpError(err));
14157                }
14158                Ok(res) => {
14159                    let (mut parts, body) = res.into_parts();
14160                    let mut body = common::Body::new(body);
14161                    if !parts.status.is_success() {
14162                        let bytes = common::to_bytes(body).await.unwrap_or_default();
14163                        let error = serde_json::from_str(&common::to_string(&bytes));
14164                        let response = common::to_response(parts, bytes.into());
14165
14166                        if let common::Retry::After(d) =
14167                            dlg.http_failure(&response, error.as_ref().ok())
14168                        {
14169                            sleep(d).await;
14170                            continue;
14171                        }
14172
14173                        dlg.finished(false);
14174
14175                        return Err(match error {
14176                            Ok(value) => common::Error::BadRequest(value),
14177                            _ => common::Error::Failure(response),
14178                        });
14179                    }
14180                    let response = {
14181                        let bytes = common::to_bytes(body).await.unwrap_or_default();
14182                        let encoded = common::to_string(&bytes);
14183                        match serde_json::from_str(&encoded) {
14184                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
14185                            Err(error) => {
14186                                dlg.response_json_decode_error(&encoded, &error);
14187                                return Err(common::Error::JsonDecodeError(
14188                                    encoded.to_string(),
14189                                    error,
14190                                ));
14191                            }
14192                        }
14193                    };
14194
14195                    dlg.finished(true);
14196                    return Ok(response);
14197                }
14198            }
14199        }
14200    }
14201
14202    /// The `name` parameter's value depends on the target resource for the request, namely [roles](https://cloud.google.com/iam/docs/reference/rest/v1/roles), [projects](https://cloud.google.com/iam/docs/reference/rest/v1/projects.roles), or [organizations](https://cloud.google.com/iam/docs/reference/rest/v1/organizations.roles). Each resource type's `name` value format is described below: * [roles.get](https://cloud.google.com/iam/docs/reference/rest/v1/roles/get): `roles/{ROLE_NAME}`. This method returns results from all [predefined roles](https://cloud.google.com/iam/docs/understanding-roles#predefined_roles) in IAM. Example request URL: `https://iam.googleapis.com/v1/roles/{ROLE_NAME}` * [projects.roles.get](https://cloud.google.com/iam/docs/reference/rest/v1/projects.roles/get): `projects/{PROJECT_ID}/roles/{CUSTOM_ROLE_ID}`. This method returns only [custom roles](https://cloud.google.com/iam/docs/understanding-custom-roles) that have been created at the project level. Example request URL: `https://iam.googleapis.com/v1/projects/{PROJECT_ID}/roles/{CUSTOM_ROLE_ID}` * [organizations.roles.get](https://cloud.google.com/iam/docs/reference/rest/v1/organizations.roles/get): `organizations/{ORGANIZATION_ID}/roles/{CUSTOM_ROLE_ID}`. This method returns only [custom roles](https://cloud.google.com/iam/docs/understanding-custom-roles) that have been created at the organization level. Example request URL: `https://iam.googleapis.com/v1/organizations/{ORGANIZATION_ID}/roles/{CUSTOM_ROLE_ID}` Note: Wildcard (*) values are invalid; you must specify a complete project ID or organization ID.
14203    ///
14204    /// Sets the *name* path property to the given value.
14205    ///
14206    /// Even though the property as already been set when instantiating this call,
14207    /// we provide this method for API completeness.
14208    pub fn name(mut self, new_value: &str) -> OrganizationRoleGetCall<'a, C> {
14209        self._name = new_value.to_string();
14210        self
14211    }
14212    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
14213    /// while executing the actual API request.
14214    ///
14215    /// ````text
14216    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
14217    /// ````
14218    ///
14219    /// Sets the *delegate* property to the given value.
14220    pub fn delegate(
14221        mut self,
14222        new_value: &'a mut dyn common::Delegate,
14223    ) -> OrganizationRoleGetCall<'a, C> {
14224        self._delegate = Some(new_value);
14225        self
14226    }
14227
14228    /// Set any additional parameter of the query string used in the request.
14229    /// It should be used to set parameters which are not yet available through their own
14230    /// setters.
14231    ///
14232    /// Please note that this method must not be used to set any of the known parameters
14233    /// which have their own setter method. If done anyway, the request will fail.
14234    ///
14235    /// # Additional Parameters
14236    ///
14237    /// * *$.xgafv* (query-string) - V1 error format.
14238    /// * *access_token* (query-string) - OAuth access token.
14239    /// * *alt* (query-string) - Data format for response.
14240    /// * *callback* (query-string) - JSONP
14241    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
14242    /// * *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.
14243    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
14244    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
14245    /// * *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.
14246    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
14247    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
14248    pub fn param<T>(mut self, name: T, value: T) -> OrganizationRoleGetCall<'a, C>
14249    where
14250        T: AsRef<str>,
14251    {
14252        self._additional_params
14253            .insert(name.as_ref().to_string(), value.as_ref().to_string());
14254        self
14255    }
14256
14257    /// Identifies the authorization scope for the method you are building.
14258    ///
14259    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
14260    /// [`Scope::CloudPlatform`].
14261    ///
14262    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
14263    /// tokens for more than one scope.
14264    ///
14265    /// Usually there is more than one suitable scope to authorize an operation, some of which may
14266    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
14267    /// sufficient, a read-write scope will do as well.
14268    pub fn add_scope<St>(mut self, scope: St) -> OrganizationRoleGetCall<'a, C>
14269    where
14270        St: AsRef<str>,
14271    {
14272        self._scopes.insert(String::from(scope.as_ref()));
14273        self
14274    }
14275    /// Identifies the authorization scope(s) for the method you are building.
14276    ///
14277    /// See [`Self::add_scope()`] for details.
14278    pub fn add_scopes<I, St>(mut self, scopes: I) -> OrganizationRoleGetCall<'a, C>
14279    where
14280        I: IntoIterator<Item = St>,
14281        St: AsRef<str>,
14282    {
14283        self._scopes
14284            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
14285        self
14286    }
14287
14288    /// Removes all scopes, and no default scope will be used either.
14289    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
14290    /// for details).
14291    pub fn clear_scopes(mut self) -> OrganizationRoleGetCall<'a, C> {
14292        self._scopes.clear();
14293        self
14294    }
14295}
14296
14297/// Lists every predefined Role that IAM supports, or every custom role that is defined for an organization or project.
14298///
14299/// A builder for the *roles.list* method supported by a *organization* resource.
14300/// It is not used directly, but through a [`OrganizationMethods`] instance.
14301///
14302/// # Example
14303///
14304/// Instantiate a resource method builder
14305///
14306/// ```test_harness,no_run
14307/// # extern crate hyper;
14308/// # extern crate hyper_rustls;
14309/// # extern crate google_iam1 as iam1;
14310/// # async fn dox() {
14311/// # use iam1::{Iam, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
14312///
14313/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
14314/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
14315/// #     secret,
14316/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
14317/// # ).build().await.unwrap();
14318///
14319/// # let client = hyper_util::client::legacy::Client::builder(
14320/// #     hyper_util::rt::TokioExecutor::new()
14321/// # )
14322/// # .build(
14323/// #     hyper_rustls::HttpsConnectorBuilder::new()
14324/// #         .with_native_roots()
14325/// #         .unwrap()
14326/// #         .https_or_http()
14327/// #         .enable_http1()
14328/// #         .build()
14329/// # );
14330/// # let mut hub = Iam::new(client, auth);
14331/// // You can configure optional parameters by calling the respective setters at will, and
14332/// // execute the final call using `doit()`.
14333/// // Values shown here are possibly random and not representative !
14334/// let result = hub.organizations().roles_list("parent")
14335///              .view("erat")
14336///              .show_deleted(false)
14337///              .page_token("duo")
14338///              .page_size(-34)
14339///              .doit().await;
14340/// # }
14341/// ```
14342pub struct OrganizationRoleListCall<'a, C>
14343where
14344    C: 'a,
14345{
14346    hub: &'a Iam<C>,
14347    _parent: String,
14348    _view: Option<String>,
14349    _show_deleted: Option<bool>,
14350    _page_token: Option<String>,
14351    _page_size: Option<i32>,
14352    _delegate: Option<&'a mut dyn common::Delegate>,
14353    _additional_params: HashMap<String, String>,
14354    _scopes: BTreeSet<String>,
14355}
14356
14357impl<'a, C> common::CallBuilder for OrganizationRoleListCall<'a, C> {}
14358
14359impl<'a, C> OrganizationRoleListCall<'a, C>
14360where
14361    C: common::Connector,
14362{
14363    /// Perform the operation you have build so far.
14364    pub async fn doit(mut self) -> common::Result<(common::Response, ListRolesResponse)> {
14365        use std::borrow::Cow;
14366        use std::io::{Read, Seek};
14367
14368        use common::{url::Params, ToParts};
14369        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
14370
14371        let mut dd = common::DefaultDelegate;
14372        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
14373        dlg.begin(common::MethodInfo {
14374            id: "iam.organizations.roles.list",
14375            http_method: hyper::Method::GET,
14376        });
14377
14378        for &field in [
14379            "alt",
14380            "parent",
14381            "view",
14382            "showDeleted",
14383            "pageToken",
14384            "pageSize",
14385        ]
14386        .iter()
14387        {
14388            if self._additional_params.contains_key(field) {
14389                dlg.finished(false);
14390                return Err(common::Error::FieldClash(field));
14391            }
14392        }
14393
14394        let mut params = Params::with_capacity(7 + self._additional_params.len());
14395        params.push("parent", self._parent);
14396        if let Some(value) = self._view.as_ref() {
14397            params.push("view", value);
14398        }
14399        if let Some(value) = self._show_deleted.as_ref() {
14400            params.push("showDeleted", value.to_string());
14401        }
14402        if let Some(value) = self._page_token.as_ref() {
14403            params.push("pageToken", value);
14404        }
14405        if let Some(value) = self._page_size.as_ref() {
14406            params.push("pageSize", value.to_string());
14407        }
14408
14409        params.extend(self._additional_params.iter());
14410
14411        params.push("alt", "json");
14412        let mut url = self.hub._base_url.clone() + "v1/{+parent}/roles";
14413        if self._scopes.is_empty() {
14414            self._scopes
14415                .insert(Scope::CloudPlatform.as_ref().to_string());
14416        }
14417
14418        #[allow(clippy::single_element_loop)]
14419        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
14420            url = params.uri_replacement(url, param_name, find_this, true);
14421        }
14422        {
14423            let to_remove = ["parent"];
14424            params.remove_params(&to_remove);
14425        }
14426
14427        let url = params.parse_with_url(&url);
14428
14429        loop {
14430            let token = match self
14431                .hub
14432                .auth
14433                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
14434                .await
14435            {
14436                Ok(token) => token,
14437                Err(e) => match dlg.token(e) {
14438                    Ok(token) => token,
14439                    Err(e) => {
14440                        dlg.finished(false);
14441                        return Err(common::Error::MissingToken(e));
14442                    }
14443                },
14444            };
14445            let mut req_result = {
14446                let client = &self.hub.client;
14447                dlg.pre_request();
14448                let mut req_builder = hyper::Request::builder()
14449                    .method(hyper::Method::GET)
14450                    .uri(url.as_str())
14451                    .header(USER_AGENT, self.hub._user_agent.clone());
14452
14453                if let Some(token) = token.as_ref() {
14454                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
14455                }
14456
14457                let request = req_builder
14458                    .header(CONTENT_LENGTH, 0_u64)
14459                    .body(common::to_body::<String>(None));
14460
14461                client.request(request.unwrap()).await
14462            };
14463
14464            match req_result {
14465                Err(err) => {
14466                    if let common::Retry::After(d) = dlg.http_error(&err) {
14467                        sleep(d).await;
14468                        continue;
14469                    }
14470                    dlg.finished(false);
14471                    return Err(common::Error::HttpError(err));
14472                }
14473                Ok(res) => {
14474                    let (mut parts, body) = res.into_parts();
14475                    let mut body = common::Body::new(body);
14476                    if !parts.status.is_success() {
14477                        let bytes = common::to_bytes(body).await.unwrap_or_default();
14478                        let error = serde_json::from_str(&common::to_string(&bytes));
14479                        let response = common::to_response(parts, bytes.into());
14480
14481                        if let common::Retry::After(d) =
14482                            dlg.http_failure(&response, error.as_ref().ok())
14483                        {
14484                            sleep(d).await;
14485                            continue;
14486                        }
14487
14488                        dlg.finished(false);
14489
14490                        return Err(match error {
14491                            Ok(value) => common::Error::BadRequest(value),
14492                            _ => common::Error::Failure(response),
14493                        });
14494                    }
14495                    let response = {
14496                        let bytes = common::to_bytes(body).await.unwrap_or_default();
14497                        let encoded = common::to_string(&bytes);
14498                        match serde_json::from_str(&encoded) {
14499                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
14500                            Err(error) => {
14501                                dlg.response_json_decode_error(&encoded, &error);
14502                                return Err(common::Error::JsonDecodeError(
14503                                    encoded.to_string(),
14504                                    error,
14505                                ));
14506                            }
14507                        }
14508                    };
14509
14510                    dlg.finished(true);
14511                    return Ok(response);
14512                }
14513            }
14514        }
14515    }
14516
14517    /// The `parent` parameter's value depends on the target resource for the request, namely [roles](https://cloud.google.com/iam/docs/reference/rest/v1/roles), [projects](https://cloud.google.com/iam/docs/reference/rest/v1/projects.roles), or [organizations](https://cloud.google.com/iam/docs/reference/rest/v1/organizations.roles). Each resource type's `parent` value format is described below: * [roles.list](https://cloud.google.com/iam/docs/reference/rest/v1/roles/list): An empty string. This method doesn't require a resource; it simply returns all [predefined roles](https://cloud.google.com/iam/docs/understanding-roles#predefined_roles) in IAM. Example request URL: `https://iam.googleapis.com/v1/roles` * [projects.roles.list](https://cloud.google.com/iam/docs/reference/rest/v1/projects.roles/list): `projects/{PROJECT_ID}`. This method lists all project-level [custom roles](https://cloud.google.com/iam/docs/understanding-custom-roles). Example request URL: `https://iam.googleapis.com/v1/projects/{PROJECT_ID}/roles` * [organizations.roles.list](https://cloud.google.com/iam/docs/reference/rest/v1/organizations.roles/list): `organizations/{ORGANIZATION_ID}`. This method lists all organization-level [custom roles](https://cloud.google.com/iam/docs/understanding-custom-roles). Example request URL: `https://iam.googleapis.com/v1/organizations/{ORGANIZATION_ID}/roles` Note: Wildcard (*) values are invalid; you must specify a complete project ID or organization ID.
14518    ///
14519    /// Sets the *parent* path property to the given value.
14520    ///
14521    /// Even though the property as already been set when instantiating this call,
14522    /// we provide this method for API completeness.
14523    pub fn parent(mut self, new_value: &str) -> OrganizationRoleListCall<'a, C> {
14524        self._parent = new_value.to_string();
14525        self
14526    }
14527    /// Optional view for the returned Role objects. When `FULL` is specified, the `includedPermissions` field is returned, which includes a list of all permissions in the role. The default value is `BASIC`, which does not return the `includedPermissions` field.
14528    ///
14529    /// Sets the *view* query property to the given value.
14530    pub fn view(mut self, new_value: &str) -> OrganizationRoleListCall<'a, C> {
14531        self._view = Some(new_value.to_string());
14532        self
14533    }
14534    /// Include Roles that have been deleted.
14535    ///
14536    /// Sets the *show deleted* query property to the given value.
14537    pub fn show_deleted(mut self, new_value: bool) -> OrganizationRoleListCall<'a, C> {
14538        self._show_deleted = Some(new_value);
14539        self
14540    }
14541    /// Optional pagination token returned in an earlier ListRolesResponse.
14542    ///
14543    /// Sets the *page token* query property to the given value.
14544    pub fn page_token(mut self, new_value: &str) -> OrganizationRoleListCall<'a, C> {
14545        self._page_token = Some(new_value.to_string());
14546        self
14547    }
14548    /// Optional limit on the number of roles to include in the response. The default is 300, and the maximum is 1,000.
14549    ///
14550    /// Sets the *page size* query property to the given value.
14551    pub fn page_size(mut self, new_value: i32) -> OrganizationRoleListCall<'a, C> {
14552        self._page_size = Some(new_value);
14553        self
14554    }
14555    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
14556    /// while executing the actual API request.
14557    ///
14558    /// ````text
14559    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
14560    /// ````
14561    ///
14562    /// Sets the *delegate* property to the given value.
14563    pub fn delegate(
14564        mut self,
14565        new_value: &'a mut dyn common::Delegate,
14566    ) -> OrganizationRoleListCall<'a, C> {
14567        self._delegate = Some(new_value);
14568        self
14569    }
14570
14571    /// Set any additional parameter of the query string used in the request.
14572    /// It should be used to set parameters which are not yet available through their own
14573    /// setters.
14574    ///
14575    /// Please note that this method must not be used to set any of the known parameters
14576    /// which have their own setter method. If done anyway, the request will fail.
14577    ///
14578    /// # Additional Parameters
14579    ///
14580    /// * *$.xgafv* (query-string) - V1 error format.
14581    /// * *access_token* (query-string) - OAuth access token.
14582    /// * *alt* (query-string) - Data format for response.
14583    /// * *callback* (query-string) - JSONP
14584    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
14585    /// * *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.
14586    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
14587    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
14588    /// * *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.
14589    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
14590    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
14591    pub fn param<T>(mut self, name: T, value: T) -> OrganizationRoleListCall<'a, C>
14592    where
14593        T: AsRef<str>,
14594    {
14595        self._additional_params
14596            .insert(name.as_ref().to_string(), value.as_ref().to_string());
14597        self
14598    }
14599
14600    /// Identifies the authorization scope for the method you are building.
14601    ///
14602    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
14603    /// [`Scope::CloudPlatform`].
14604    ///
14605    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
14606    /// tokens for more than one scope.
14607    ///
14608    /// Usually there is more than one suitable scope to authorize an operation, some of which may
14609    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
14610    /// sufficient, a read-write scope will do as well.
14611    pub fn add_scope<St>(mut self, scope: St) -> OrganizationRoleListCall<'a, C>
14612    where
14613        St: AsRef<str>,
14614    {
14615        self._scopes.insert(String::from(scope.as_ref()));
14616        self
14617    }
14618    /// Identifies the authorization scope(s) for the method you are building.
14619    ///
14620    /// See [`Self::add_scope()`] for details.
14621    pub fn add_scopes<I, St>(mut self, scopes: I) -> OrganizationRoleListCall<'a, C>
14622    where
14623        I: IntoIterator<Item = St>,
14624        St: AsRef<str>,
14625    {
14626        self._scopes
14627            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
14628        self
14629    }
14630
14631    /// Removes all scopes, and no default scope will be used either.
14632    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
14633    /// for details).
14634    pub fn clear_scopes(mut self) -> OrganizationRoleListCall<'a, C> {
14635        self._scopes.clear();
14636        self
14637    }
14638}
14639
14640/// Updates the definition of a custom Role.
14641///
14642/// A builder for the *roles.patch* method supported by a *organization* resource.
14643/// It is not used directly, but through a [`OrganizationMethods`] instance.
14644///
14645/// # Example
14646///
14647/// Instantiate a resource method builder
14648///
14649/// ```test_harness,no_run
14650/// # extern crate hyper;
14651/// # extern crate hyper_rustls;
14652/// # extern crate google_iam1 as iam1;
14653/// use iam1::api::Role;
14654/// # async fn dox() {
14655/// # use iam1::{Iam, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
14656///
14657/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
14658/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
14659/// #     secret,
14660/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
14661/// # ).build().await.unwrap();
14662///
14663/// # let client = hyper_util::client::legacy::Client::builder(
14664/// #     hyper_util::rt::TokioExecutor::new()
14665/// # )
14666/// # .build(
14667/// #     hyper_rustls::HttpsConnectorBuilder::new()
14668/// #         .with_native_roots()
14669/// #         .unwrap()
14670/// #         .https_or_http()
14671/// #         .enable_http1()
14672/// #         .build()
14673/// # );
14674/// # let mut hub = Iam::new(client, auth);
14675/// // As the method needs a request, you would usually fill it with the desired information
14676/// // into the respective structure. Some of the parts shown here might not be applicable !
14677/// // Values shown here are possibly random and not representative !
14678/// let mut req = Role::default();
14679///
14680/// // You can configure optional parameters by calling the respective setters at will, and
14681/// // execute the final call using `doit()`.
14682/// // Values shown here are possibly random and not representative !
14683/// let result = hub.organizations().roles_patch(req, "name")
14684///              .update_mask(FieldMask::new::<&str>(&[]))
14685///              .doit().await;
14686/// # }
14687/// ```
14688pub struct OrganizationRolePatchCall<'a, C>
14689where
14690    C: 'a,
14691{
14692    hub: &'a Iam<C>,
14693    _request: Role,
14694    _name: String,
14695    _update_mask: Option<common::FieldMask>,
14696    _delegate: Option<&'a mut dyn common::Delegate>,
14697    _additional_params: HashMap<String, String>,
14698    _scopes: BTreeSet<String>,
14699}
14700
14701impl<'a, C> common::CallBuilder for OrganizationRolePatchCall<'a, C> {}
14702
14703impl<'a, C> OrganizationRolePatchCall<'a, C>
14704where
14705    C: common::Connector,
14706{
14707    /// Perform the operation you have build so far.
14708    pub async fn doit(mut self) -> common::Result<(common::Response, Role)> {
14709        use std::borrow::Cow;
14710        use std::io::{Read, Seek};
14711
14712        use common::{url::Params, ToParts};
14713        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
14714
14715        let mut dd = common::DefaultDelegate;
14716        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
14717        dlg.begin(common::MethodInfo {
14718            id: "iam.organizations.roles.patch",
14719            http_method: hyper::Method::PATCH,
14720        });
14721
14722        for &field in ["alt", "name", "updateMask"].iter() {
14723            if self._additional_params.contains_key(field) {
14724                dlg.finished(false);
14725                return Err(common::Error::FieldClash(field));
14726            }
14727        }
14728
14729        let mut params = Params::with_capacity(5 + self._additional_params.len());
14730        params.push("name", self._name);
14731        if let Some(value) = self._update_mask.as_ref() {
14732            params.push("updateMask", value.to_string());
14733        }
14734
14735        params.extend(self._additional_params.iter());
14736
14737        params.push("alt", "json");
14738        let mut url = self.hub._base_url.clone() + "v1/{+name}";
14739        if self._scopes.is_empty() {
14740            self._scopes
14741                .insert(Scope::CloudPlatform.as_ref().to_string());
14742        }
14743
14744        #[allow(clippy::single_element_loop)]
14745        for &(find_this, param_name) in [("{+name}", "name")].iter() {
14746            url = params.uri_replacement(url, param_name, find_this, true);
14747        }
14748        {
14749            let to_remove = ["name"];
14750            params.remove_params(&to_remove);
14751        }
14752
14753        let url = params.parse_with_url(&url);
14754
14755        let mut json_mime_type = mime::APPLICATION_JSON;
14756        let mut request_value_reader = {
14757            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
14758            common::remove_json_null_values(&mut value);
14759            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
14760            serde_json::to_writer(&mut dst, &value).unwrap();
14761            dst
14762        };
14763        let request_size = request_value_reader
14764            .seek(std::io::SeekFrom::End(0))
14765            .unwrap();
14766        request_value_reader
14767            .seek(std::io::SeekFrom::Start(0))
14768            .unwrap();
14769
14770        loop {
14771            let token = match self
14772                .hub
14773                .auth
14774                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
14775                .await
14776            {
14777                Ok(token) => token,
14778                Err(e) => match dlg.token(e) {
14779                    Ok(token) => token,
14780                    Err(e) => {
14781                        dlg.finished(false);
14782                        return Err(common::Error::MissingToken(e));
14783                    }
14784                },
14785            };
14786            request_value_reader
14787                .seek(std::io::SeekFrom::Start(0))
14788                .unwrap();
14789            let mut req_result = {
14790                let client = &self.hub.client;
14791                dlg.pre_request();
14792                let mut req_builder = hyper::Request::builder()
14793                    .method(hyper::Method::PATCH)
14794                    .uri(url.as_str())
14795                    .header(USER_AGENT, self.hub._user_agent.clone());
14796
14797                if let Some(token) = token.as_ref() {
14798                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
14799                }
14800
14801                let request = req_builder
14802                    .header(CONTENT_TYPE, json_mime_type.to_string())
14803                    .header(CONTENT_LENGTH, request_size as u64)
14804                    .body(common::to_body(
14805                        request_value_reader.get_ref().clone().into(),
14806                    ));
14807
14808                client.request(request.unwrap()).await
14809            };
14810
14811            match req_result {
14812                Err(err) => {
14813                    if let common::Retry::After(d) = dlg.http_error(&err) {
14814                        sleep(d).await;
14815                        continue;
14816                    }
14817                    dlg.finished(false);
14818                    return Err(common::Error::HttpError(err));
14819                }
14820                Ok(res) => {
14821                    let (mut parts, body) = res.into_parts();
14822                    let mut body = common::Body::new(body);
14823                    if !parts.status.is_success() {
14824                        let bytes = common::to_bytes(body).await.unwrap_or_default();
14825                        let error = serde_json::from_str(&common::to_string(&bytes));
14826                        let response = common::to_response(parts, bytes.into());
14827
14828                        if let common::Retry::After(d) =
14829                            dlg.http_failure(&response, error.as_ref().ok())
14830                        {
14831                            sleep(d).await;
14832                            continue;
14833                        }
14834
14835                        dlg.finished(false);
14836
14837                        return Err(match error {
14838                            Ok(value) => common::Error::BadRequest(value),
14839                            _ => common::Error::Failure(response),
14840                        });
14841                    }
14842                    let response = {
14843                        let bytes = common::to_bytes(body).await.unwrap_or_default();
14844                        let encoded = common::to_string(&bytes);
14845                        match serde_json::from_str(&encoded) {
14846                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
14847                            Err(error) => {
14848                                dlg.response_json_decode_error(&encoded, &error);
14849                                return Err(common::Error::JsonDecodeError(
14850                                    encoded.to_string(),
14851                                    error,
14852                                ));
14853                            }
14854                        }
14855                    };
14856
14857                    dlg.finished(true);
14858                    return Ok(response);
14859                }
14860            }
14861        }
14862    }
14863
14864    ///
14865    /// Sets the *request* property to the given value.
14866    ///
14867    /// Even though the property as already been set when instantiating this call,
14868    /// we provide this method for API completeness.
14869    pub fn request(mut self, new_value: Role) -> OrganizationRolePatchCall<'a, C> {
14870        self._request = new_value;
14871        self
14872    }
14873    /// The `name` parameter's value depends on the target resource for the request, namely [projects](https://cloud.google.com/iam/docs/reference/rest/v1/projects.roles) or [organizations](https://cloud.google.com/iam/docs/reference/rest/v1/organizations.roles). Each resource type's `name` value format is described below: * [projects.roles.patch](https://cloud.google.com/iam/docs/reference/rest/v1/projects.roles/patch): `projects/{PROJECT_ID}/roles/{CUSTOM_ROLE_ID}`. This method updates only [custom roles](https://cloud.google.com/iam/docs/understanding-custom-roles) that have been created at the project level. Example request URL: `https://iam.googleapis.com/v1/projects/{PROJECT_ID}/roles/{CUSTOM_ROLE_ID}` * [organizations.roles.patch](https://cloud.google.com/iam/docs/reference/rest/v1/organizations.roles/patch): `organizations/{ORGANIZATION_ID}/roles/{CUSTOM_ROLE_ID}`. This method updates only [custom roles](https://cloud.google.com/iam/docs/understanding-custom-roles) that have been created at the organization level. Example request URL: `https://iam.googleapis.com/v1/organizations/{ORGANIZATION_ID}/roles/{CUSTOM_ROLE_ID}` Note: Wildcard (*) values are invalid; you must specify a complete project ID or organization ID.
14874    ///
14875    /// Sets the *name* path property to the given value.
14876    ///
14877    /// Even though the property as already been set when instantiating this call,
14878    /// we provide this method for API completeness.
14879    pub fn name(mut self, new_value: &str) -> OrganizationRolePatchCall<'a, C> {
14880        self._name = new_value.to_string();
14881        self
14882    }
14883    /// A mask describing which fields in the Role have changed.
14884    ///
14885    /// Sets the *update mask* query property to the given value.
14886    pub fn update_mask(mut self, new_value: common::FieldMask) -> OrganizationRolePatchCall<'a, C> {
14887        self._update_mask = Some(new_value);
14888        self
14889    }
14890    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
14891    /// while executing the actual API request.
14892    ///
14893    /// ````text
14894    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
14895    /// ````
14896    ///
14897    /// Sets the *delegate* property to the given value.
14898    pub fn delegate(
14899        mut self,
14900        new_value: &'a mut dyn common::Delegate,
14901    ) -> OrganizationRolePatchCall<'a, C> {
14902        self._delegate = Some(new_value);
14903        self
14904    }
14905
14906    /// Set any additional parameter of the query string used in the request.
14907    /// It should be used to set parameters which are not yet available through their own
14908    /// setters.
14909    ///
14910    /// Please note that this method must not be used to set any of the known parameters
14911    /// which have their own setter method. If done anyway, the request will fail.
14912    ///
14913    /// # Additional Parameters
14914    ///
14915    /// * *$.xgafv* (query-string) - V1 error format.
14916    /// * *access_token* (query-string) - OAuth access token.
14917    /// * *alt* (query-string) - Data format for response.
14918    /// * *callback* (query-string) - JSONP
14919    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
14920    /// * *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.
14921    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
14922    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
14923    /// * *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.
14924    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
14925    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
14926    pub fn param<T>(mut self, name: T, value: T) -> OrganizationRolePatchCall<'a, C>
14927    where
14928        T: AsRef<str>,
14929    {
14930        self._additional_params
14931            .insert(name.as_ref().to_string(), value.as_ref().to_string());
14932        self
14933    }
14934
14935    /// Identifies the authorization scope for the method you are building.
14936    ///
14937    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
14938    /// [`Scope::CloudPlatform`].
14939    ///
14940    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
14941    /// tokens for more than one scope.
14942    ///
14943    /// Usually there is more than one suitable scope to authorize an operation, some of which may
14944    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
14945    /// sufficient, a read-write scope will do as well.
14946    pub fn add_scope<St>(mut self, scope: St) -> OrganizationRolePatchCall<'a, C>
14947    where
14948        St: AsRef<str>,
14949    {
14950        self._scopes.insert(String::from(scope.as_ref()));
14951        self
14952    }
14953    /// Identifies the authorization scope(s) for the method you are building.
14954    ///
14955    /// See [`Self::add_scope()`] for details.
14956    pub fn add_scopes<I, St>(mut self, scopes: I) -> OrganizationRolePatchCall<'a, C>
14957    where
14958        I: IntoIterator<Item = St>,
14959        St: AsRef<str>,
14960    {
14961        self._scopes
14962            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
14963        self
14964    }
14965
14966    /// Removes all scopes, and no default scope will be used either.
14967    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
14968    /// for details).
14969    pub fn clear_scopes(mut self) -> OrganizationRolePatchCall<'a, C> {
14970        self._scopes.clear();
14971        self
14972    }
14973}
14974
14975/// Undeletes a custom Role.
14976///
14977/// A builder for the *roles.undelete* method supported by a *organization* resource.
14978/// It is not used directly, but through a [`OrganizationMethods`] instance.
14979///
14980/// # Example
14981///
14982/// Instantiate a resource method builder
14983///
14984/// ```test_harness,no_run
14985/// # extern crate hyper;
14986/// # extern crate hyper_rustls;
14987/// # extern crate google_iam1 as iam1;
14988/// use iam1::api::UndeleteRoleRequest;
14989/// # async fn dox() {
14990/// # use iam1::{Iam, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
14991///
14992/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
14993/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
14994/// #     secret,
14995/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
14996/// # ).build().await.unwrap();
14997///
14998/// # let client = hyper_util::client::legacy::Client::builder(
14999/// #     hyper_util::rt::TokioExecutor::new()
15000/// # )
15001/// # .build(
15002/// #     hyper_rustls::HttpsConnectorBuilder::new()
15003/// #         .with_native_roots()
15004/// #         .unwrap()
15005/// #         .https_or_http()
15006/// #         .enable_http1()
15007/// #         .build()
15008/// # );
15009/// # let mut hub = Iam::new(client, auth);
15010/// // As the method needs a request, you would usually fill it with the desired information
15011/// // into the respective structure. Some of the parts shown here might not be applicable !
15012/// // Values shown here are possibly random and not representative !
15013/// let mut req = UndeleteRoleRequest::default();
15014///
15015/// // You can configure optional parameters by calling the respective setters at will, and
15016/// // execute the final call using `doit()`.
15017/// // Values shown here are possibly random and not representative !
15018/// let result = hub.organizations().roles_undelete(req, "name")
15019///              .doit().await;
15020/// # }
15021/// ```
15022pub struct OrganizationRoleUndeleteCall<'a, C>
15023where
15024    C: 'a,
15025{
15026    hub: &'a Iam<C>,
15027    _request: UndeleteRoleRequest,
15028    _name: String,
15029    _delegate: Option<&'a mut dyn common::Delegate>,
15030    _additional_params: HashMap<String, String>,
15031    _scopes: BTreeSet<String>,
15032}
15033
15034impl<'a, C> common::CallBuilder for OrganizationRoleUndeleteCall<'a, C> {}
15035
15036impl<'a, C> OrganizationRoleUndeleteCall<'a, C>
15037where
15038    C: common::Connector,
15039{
15040    /// Perform the operation you have build so far.
15041    pub async fn doit(mut self) -> common::Result<(common::Response, Role)> {
15042        use std::borrow::Cow;
15043        use std::io::{Read, Seek};
15044
15045        use common::{url::Params, ToParts};
15046        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
15047
15048        let mut dd = common::DefaultDelegate;
15049        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
15050        dlg.begin(common::MethodInfo {
15051            id: "iam.organizations.roles.undelete",
15052            http_method: hyper::Method::POST,
15053        });
15054
15055        for &field in ["alt", "name"].iter() {
15056            if self._additional_params.contains_key(field) {
15057                dlg.finished(false);
15058                return Err(common::Error::FieldClash(field));
15059            }
15060        }
15061
15062        let mut params = Params::with_capacity(4 + self._additional_params.len());
15063        params.push("name", self._name);
15064
15065        params.extend(self._additional_params.iter());
15066
15067        params.push("alt", "json");
15068        let mut url = self.hub._base_url.clone() + "v1/{+name}:undelete";
15069        if self._scopes.is_empty() {
15070            self._scopes
15071                .insert(Scope::CloudPlatform.as_ref().to_string());
15072        }
15073
15074        #[allow(clippy::single_element_loop)]
15075        for &(find_this, param_name) in [("{+name}", "name")].iter() {
15076            url = params.uri_replacement(url, param_name, find_this, true);
15077        }
15078        {
15079            let to_remove = ["name"];
15080            params.remove_params(&to_remove);
15081        }
15082
15083        let url = params.parse_with_url(&url);
15084
15085        let mut json_mime_type = mime::APPLICATION_JSON;
15086        let mut request_value_reader = {
15087            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
15088            common::remove_json_null_values(&mut value);
15089            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
15090            serde_json::to_writer(&mut dst, &value).unwrap();
15091            dst
15092        };
15093        let request_size = request_value_reader
15094            .seek(std::io::SeekFrom::End(0))
15095            .unwrap();
15096        request_value_reader
15097            .seek(std::io::SeekFrom::Start(0))
15098            .unwrap();
15099
15100        loop {
15101            let token = match self
15102                .hub
15103                .auth
15104                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
15105                .await
15106            {
15107                Ok(token) => token,
15108                Err(e) => match dlg.token(e) {
15109                    Ok(token) => token,
15110                    Err(e) => {
15111                        dlg.finished(false);
15112                        return Err(common::Error::MissingToken(e));
15113                    }
15114                },
15115            };
15116            request_value_reader
15117                .seek(std::io::SeekFrom::Start(0))
15118                .unwrap();
15119            let mut req_result = {
15120                let client = &self.hub.client;
15121                dlg.pre_request();
15122                let mut req_builder = hyper::Request::builder()
15123                    .method(hyper::Method::POST)
15124                    .uri(url.as_str())
15125                    .header(USER_AGENT, self.hub._user_agent.clone());
15126
15127                if let Some(token) = token.as_ref() {
15128                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
15129                }
15130
15131                let request = req_builder
15132                    .header(CONTENT_TYPE, json_mime_type.to_string())
15133                    .header(CONTENT_LENGTH, request_size as u64)
15134                    .body(common::to_body(
15135                        request_value_reader.get_ref().clone().into(),
15136                    ));
15137
15138                client.request(request.unwrap()).await
15139            };
15140
15141            match req_result {
15142                Err(err) => {
15143                    if let common::Retry::After(d) = dlg.http_error(&err) {
15144                        sleep(d).await;
15145                        continue;
15146                    }
15147                    dlg.finished(false);
15148                    return Err(common::Error::HttpError(err));
15149                }
15150                Ok(res) => {
15151                    let (mut parts, body) = res.into_parts();
15152                    let mut body = common::Body::new(body);
15153                    if !parts.status.is_success() {
15154                        let bytes = common::to_bytes(body).await.unwrap_or_default();
15155                        let error = serde_json::from_str(&common::to_string(&bytes));
15156                        let response = common::to_response(parts, bytes.into());
15157
15158                        if let common::Retry::After(d) =
15159                            dlg.http_failure(&response, error.as_ref().ok())
15160                        {
15161                            sleep(d).await;
15162                            continue;
15163                        }
15164
15165                        dlg.finished(false);
15166
15167                        return Err(match error {
15168                            Ok(value) => common::Error::BadRequest(value),
15169                            _ => common::Error::Failure(response),
15170                        });
15171                    }
15172                    let response = {
15173                        let bytes = common::to_bytes(body).await.unwrap_or_default();
15174                        let encoded = common::to_string(&bytes);
15175                        match serde_json::from_str(&encoded) {
15176                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
15177                            Err(error) => {
15178                                dlg.response_json_decode_error(&encoded, &error);
15179                                return Err(common::Error::JsonDecodeError(
15180                                    encoded.to_string(),
15181                                    error,
15182                                ));
15183                            }
15184                        }
15185                    };
15186
15187                    dlg.finished(true);
15188                    return Ok(response);
15189                }
15190            }
15191        }
15192    }
15193
15194    ///
15195    /// Sets the *request* property to the given value.
15196    ///
15197    /// Even though the property as already been set when instantiating this call,
15198    /// we provide this method for API completeness.
15199    pub fn request(
15200        mut self,
15201        new_value: UndeleteRoleRequest,
15202    ) -> OrganizationRoleUndeleteCall<'a, C> {
15203        self._request = new_value;
15204        self
15205    }
15206    /// The `name` parameter's value depends on the target resource for the request, namely [projects](https://cloud.google.com/iam/docs/reference/rest/v1/projects.roles) or [organizations](https://cloud.google.com/iam/docs/reference/rest/v1/organizations.roles). Each resource type's `name` value format is described below: * [projects.roles.undelete](https://cloud.google.com/iam/docs/reference/rest/v1/projects.roles/undelete): `projects/{PROJECT_ID}/roles/{CUSTOM_ROLE_ID}`. This method undeletes only [custom roles](https://cloud.google.com/iam/docs/understanding-custom-roles) that have been created at the project level. Example request URL: `https://iam.googleapis.com/v1/projects/{PROJECT_ID}/roles/{CUSTOM_ROLE_ID}` * [organizations.roles.undelete](https://cloud.google.com/iam/docs/reference/rest/v1/organizations.roles/undelete): `organizations/{ORGANIZATION_ID}/roles/{CUSTOM_ROLE_ID}`. This method undeletes only [custom roles](https://cloud.google.com/iam/docs/understanding-custom-roles) that have been created at the organization level. Example request URL: `https://iam.googleapis.com/v1/organizations/{ORGANIZATION_ID}/roles/{CUSTOM_ROLE_ID}` Note: Wildcard (*) values are invalid; you must specify a complete project ID or organization ID.
15207    ///
15208    /// Sets the *name* path property to the given value.
15209    ///
15210    /// Even though the property as already been set when instantiating this call,
15211    /// we provide this method for API completeness.
15212    pub fn name(mut self, new_value: &str) -> OrganizationRoleUndeleteCall<'a, C> {
15213        self._name = new_value.to_string();
15214        self
15215    }
15216    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
15217    /// while executing the actual API request.
15218    ///
15219    /// ````text
15220    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
15221    /// ````
15222    ///
15223    /// Sets the *delegate* property to the given value.
15224    pub fn delegate(
15225        mut self,
15226        new_value: &'a mut dyn common::Delegate,
15227    ) -> OrganizationRoleUndeleteCall<'a, C> {
15228        self._delegate = Some(new_value);
15229        self
15230    }
15231
15232    /// Set any additional parameter of the query string used in the request.
15233    /// It should be used to set parameters which are not yet available through their own
15234    /// setters.
15235    ///
15236    /// Please note that this method must not be used to set any of the known parameters
15237    /// which have their own setter method. If done anyway, the request will fail.
15238    ///
15239    /// # Additional Parameters
15240    ///
15241    /// * *$.xgafv* (query-string) - V1 error format.
15242    /// * *access_token* (query-string) - OAuth access token.
15243    /// * *alt* (query-string) - Data format for response.
15244    /// * *callback* (query-string) - JSONP
15245    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
15246    /// * *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.
15247    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
15248    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
15249    /// * *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.
15250    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
15251    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
15252    pub fn param<T>(mut self, name: T, value: T) -> OrganizationRoleUndeleteCall<'a, C>
15253    where
15254        T: AsRef<str>,
15255    {
15256        self._additional_params
15257            .insert(name.as_ref().to_string(), value.as_ref().to_string());
15258        self
15259    }
15260
15261    /// Identifies the authorization scope for the method you are building.
15262    ///
15263    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
15264    /// [`Scope::CloudPlatform`].
15265    ///
15266    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
15267    /// tokens for more than one scope.
15268    ///
15269    /// Usually there is more than one suitable scope to authorize an operation, some of which may
15270    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
15271    /// sufficient, a read-write scope will do as well.
15272    pub fn add_scope<St>(mut self, scope: St) -> OrganizationRoleUndeleteCall<'a, C>
15273    where
15274        St: AsRef<str>,
15275    {
15276        self._scopes.insert(String::from(scope.as_ref()));
15277        self
15278    }
15279    /// Identifies the authorization scope(s) for the method you are building.
15280    ///
15281    /// See [`Self::add_scope()`] for details.
15282    pub fn add_scopes<I, St>(mut self, scopes: I) -> OrganizationRoleUndeleteCall<'a, C>
15283    where
15284        I: IntoIterator<Item = St>,
15285        St: AsRef<str>,
15286    {
15287        self._scopes
15288            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
15289        self
15290    }
15291
15292    /// Removes all scopes, and no default scope will be used either.
15293    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
15294    /// for details).
15295    pub fn clear_scopes(mut self) -> OrganizationRoleUndeleteCall<'a, C> {
15296        self._scopes.clear();
15297        self
15298    }
15299}
15300
15301/// Lists every permission that you can test on a resource. A permission is testable if you can check whether a principal has that permission on the resource.
15302///
15303/// A builder for the *queryTestablePermissions* method supported by a *permission* resource.
15304/// It is not used directly, but through a [`PermissionMethods`] instance.
15305///
15306/// # Example
15307///
15308/// Instantiate a resource method builder
15309///
15310/// ```test_harness,no_run
15311/// # extern crate hyper;
15312/// # extern crate hyper_rustls;
15313/// # extern crate google_iam1 as iam1;
15314/// use iam1::api::QueryTestablePermissionsRequest;
15315/// # async fn dox() {
15316/// # use iam1::{Iam, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
15317///
15318/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
15319/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
15320/// #     secret,
15321/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
15322/// # ).build().await.unwrap();
15323///
15324/// # let client = hyper_util::client::legacy::Client::builder(
15325/// #     hyper_util::rt::TokioExecutor::new()
15326/// # )
15327/// # .build(
15328/// #     hyper_rustls::HttpsConnectorBuilder::new()
15329/// #         .with_native_roots()
15330/// #         .unwrap()
15331/// #         .https_or_http()
15332/// #         .enable_http1()
15333/// #         .build()
15334/// # );
15335/// # let mut hub = Iam::new(client, auth);
15336/// // As the method needs a request, you would usually fill it with the desired information
15337/// // into the respective structure. Some of the parts shown here might not be applicable !
15338/// // Values shown here are possibly random and not representative !
15339/// let mut req = QueryTestablePermissionsRequest::default();
15340///
15341/// // You can configure optional parameters by calling the respective setters at will, and
15342/// // execute the final call using `doit()`.
15343/// // Values shown here are possibly random and not representative !
15344/// let result = hub.permissions().query_testable_permissions(req)
15345///              .doit().await;
15346/// # }
15347/// ```
15348pub struct PermissionQueryTestablePermissionCall<'a, C>
15349where
15350    C: 'a,
15351{
15352    hub: &'a Iam<C>,
15353    _request: QueryTestablePermissionsRequest,
15354    _delegate: Option<&'a mut dyn common::Delegate>,
15355    _additional_params: HashMap<String, String>,
15356    _scopes: BTreeSet<String>,
15357}
15358
15359impl<'a, C> common::CallBuilder for PermissionQueryTestablePermissionCall<'a, C> {}
15360
15361impl<'a, C> PermissionQueryTestablePermissionCall<'a, C>
15362where
15363    C: common::Connector,
15364{
15365    /// Perform the operation you have build so far.
15366    pub async fn doit(
15367        mut self,
15368    ) -> common::Result<(common::Response, QueryTestablePermissionsResponse)> {
15369        use std::borrow::Cow;
15370        use std::io::{Read, Seek};
15371
15372        use common::{url::Params, ToParts};
15373        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
15374
15375        let mut dd = common::DefaultDelegate;
15376        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
15377        dlg.begin(common::MethodInfo {
15378            id: "iam.permissions.queryTestablePermissions",
15379            http_method: hyper::Method::POST,
15380        });
15381
15382        for &field in ["alt"].iter() {
15383            if self._additional_params.contains_key(field) {
15384                dlg.finished(false);
15385                return Err(common::Error::FieldClash(field));
15386            }
15387        }
15388
15389        let mut params = Params::with_capacity(3 + self._additional_params.len());
15390
15391        params.extend(self._additional_params.iter());
15392
15393        params.push("alt", "json");
15394        let mut url = self.hub._base_url.clone() + "v1/permissions:queryTestablePermissions";
15395        if self._scopes.is_empty() {
15396            self._scopes
15397                .insert(Scope::CloudPlatform.as_ref().to_string());
15398        }
15399
15400        let url = params.parse_with_url(&url);
15401
15402        let mut json_mime_type = mime::APPLICATION_JSON;
15403        let mut request_value_reader = {
15404            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
15405            common::remove_json_null_values(&mut value);
15406            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
15407            serde_json::to_writer(&mut dst, &value).unwrap();
15408            dst
15409        };
15410        let request_size = request_value_reader
15411            .seek(std::io::SeekFrom::End(0))
15412            .unwrap();
15413        request_value_reader
15414            .seek(std::io::SeekFrom::Start(0))
15415            .unwrap();
15416
15417        loop {
15418            let token = match self
15419                .hub
15420                .auth
15421                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
15422                .await
15423            {
15424                Ok(token) => token,
15425                Err(e) => match dlg.token(e) {
15426                    Ok(token) => token,
15427                    Err(e) => {
15428                        dlg.finished(false);
15429                        return Err(common::Error::MissingToken(e));
15430                    }
15431                },
15432            };
15433            request_value_reader
15434                .seek(std::io::SeekFrom::Start(0))
15435                .unwrap();
15436            let mut req_result = {
15437                let client = &self.hub.client;
15438                dlg.pre_request();
15439                let mut req_builder = hyper::Request::builder()
15440                    .method(hyper::Method::POST)
15441                    .uri(url.as_str())
15442                    .header(USER_AGENT, self.hub._user_agent.clone());
15443
15444                if let Some(token) = token.as_ref() {
15445                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
15446                }
15447
15448                let request = req_builder
15449                    .header(CONTENT_TYPE, json_mime_type.to_string())
15450                    .header(CONTENT_LENGTH, request_size as u64)
15451                    .body(common::to_body(
15452                        request_value_reader.get_ref().clone().into(),
15453                    ));
15454
15455                client.request(request.unwrap()).await
15456            };
15457
15458            match req_result {
15459                Err(err) => {
15460                    if let common::Retry::After(d) = dlg.http_error(&err) {
15461                        sleep(d).await;
15462                        continue;
15463                    }
15464                    dlg.finished(false);
15465                    return Err(common::Error::HttpError(err));
15466                }
15467                Ok(res) => {
15468                    let (mut parts, body) = res.into_parts();
15469                    let mut body = common::Body::new(body);
15470                    if !parts.status.is_success() {
15471                        let bytes = common::to_bytes(body).await.unwrap_or_default();
15472                        let error = serde_json::from_str(&common::to_string(&bytes));
15473                        let response = common::to_response(parts, bytes.into());
15474
15475                        if let common::Retry::After(d) =
15476                            dlg.http_failure(&response, error.as_ref().ok())
15477                        {
15478                            sleep(d).await;
15479                            continue;
15480                        }
15481
15482                        dlg.finished(false);
15483
15484                        return Err(match error {
15485                            Ok(value) => common::Error::BadRequest(value),
15486                            _ => common::Error::Failure(response),
15487                        });
15488                    }
15489                    let response = {
15490                        let bytes = common::to_bytes(body).await.unwrap_or_default();
15491                        let encoded = common::to_string(&bytes);
15492                        match serde_json::from_str(&encoded) {
15493                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
15494                            Err(error) => {
15495                                dlg.response_json_decode_error(&encoded, &error);
15496                                return Err(common::Error::JsonDecodeError(
15497                                    encoded.to_string(),
15498                                    error,
15499                                ));
15500                            }
15501                        }
15502                    };
15503
15504                    dlg.finished(true);
15505                    return Ok(response);
15506                }
15507            }
15508        }
15509    }
15510
15511    ///
15512    /// Sets the *request* property to the given value.
15513    ///
15514    /// Even though the property as already been set when instantiating this call,
15515    /// we provide this method for API completeness.
15516    pub fn request(
15517        mut self,
15518        new_value: QueryTestablePermissionsRequest,
15519    ) -> PermissionQueryTestablePermissionCall<'a, C> {
15520        self._request = new_value;
15521        self
15522    }
15523    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
15524    /// while executing the actual API request.
15525    ///
15526    /// ````text
15527    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
15528    /// ````
15529    ///
15530    /// Sets the *delegate* property to the given value.
15531    pub fn delegate(
15532        mut self,
15533        new_value: &'a mut dyn common::Delegate,
15534    ) -> PermissionQueryTestablePermissionCall<'a, C> {
15535        self._delegate = Some(new_value);
15536        self
15537    }
15538
15539    /// Set any additional parameter of the query string used in the request.
15540    /// It should be used to set parameters which are not yet available through their own
15541    /// setters.
15542    ///
15543    /// Please note that this method must not be used to set any of the known parameters
15544    /// which have their own setter method. If done anyway, the request will fail.
15545    ///
15546    /// # Additional Parameters
15547    ///
15548    /// * *$.xgafv* (query-string) - V1 error format.
15549    /// * *access_token* (query-string) - OAuth access token.
15550    /// * *alt* (query-string) - Data format for response.
15551    /// * *callback* (query-string) - JSONP
15552    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
15553    /// * *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.
15554    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
15555    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
15556    /// * *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.
15557    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
15558    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
15559    pub fn param<T>(mut self, name: T, value: T) -> PermissionQueryTestablePermissionCall<'a, C>
15560    where
15561        T: AsRef<str>,
15562    {
15563        self._additional_params
15564            .insert(name.as_ref().to_string(), value.as_ref().to_string());
15565        self
15566    }
15567
15568    /// Identifies the authorization scope for the method you are building.
15569    ///
15570    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
15571    /// [`Scope::CloudPlatform`].
15572    ///
15573    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
15574    /// tokens for more than one scope.
15575    ///
15576    /// Usually there is more than one suitable scope to authorize an operation, some of which may
15577    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
15578    /// sufficient, a read-write scope will do as well.
15579    pub fn add_scope<St>(mut self, scope: St) -> PermissionQueryTestablePermissionCall<'a, C>
15580    where
15581        St: AsRef<str>,
15582    {
15583        self._scopes.insert(String::from(scope.as_ref()));
15584        self
15585    }
15586    /// Identifies the authorization scope(s) for the method you are building.
15587    ///
15588    /// See [`Self::add_scope()`] for details.
15589    pub fn add_scopes<I, St>(mut self, scopes: I) -> PermissionQueryTestablePermissionCall<'a, C>
15590    where
15591        I: IntoIterator<Item = St>,
15592        St: AsRef<str>,
15593    {
15594        self._scopes
15595            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
15596        self
15597    }
15598
15599    /// Removes all scopes, and no default scope will be used either.
15600    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
15601    /// for details).
15602    pub fn clear_scopes(mut self) -> PermissionQueryTestablePermissionCall<'a, C> {
15603        self._scopes.clear();
15604        self
15605    }
15606}
15607
15608/// Creates a new OauthClientCredential.
15609///
15610/// A builder for the *locations.oauthClients.credentials.create* method supported by a *project* resource.
15611/// It is not used directly, but through a [`ProjectMethods`] instance.
15612///
15613/// # Example
15614///
15615/// Instantiate a resource method builder
15616///
15617/// ```test_harness,no_run
15618/// # extern crate hyper;
15619/// # extern crate hyper_rustls;
15620/// # extern crate google_iam1 as iam1;
15621/// use iam1::api::OauthClientCredential;
15622/// # async fn dox() {
15623/// # use iam1::{Iam, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
15624///
15625/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
15626/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
15627/// #     secret,
15628/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
15629/// # ).build().await.unwrap();
15630///
15631/// # let client = hyper_util::client::legacy::Client::builder(
15632/// #     hyper_util::rt::TokioExecutor::new()
15633/// # )
15634/// # .build(
15635/// #     hyper_rustls::HttpsConnectorBuilder::new()
15636/// #         .with_native_roots()
15637/// #         .unwrap()
15638/// #         .https_or_http()
15639/// #         .enable_http1()
15640/// #         .build()
15641/// # );
15642/// # let mut hub = Iam::new(client, auth);
15643/// // As the method needs a request, you would usually fill it with the desired information
15644/// // into the respective structure. Some of the parts shown here might not be applicable !
15645/// // Values shown here are possibly random and not representative !
15646/// let mut req = OauthClientCredential::default();
15647///
15648/// // You can configure optional parameters by calling the respective setters at will, and
15649/// // execute the final call using `doit()`.
15650/// // Values shown here are possibly random and not representative !
15651/// let result = hub.projects().locations_oauth_clients_credentials_create(req, "parent")
15652///              .oauth_client_credential_id("consetetur")
15653///              .doit().await;
15654/// # }
15655/// ```
15656pub struct ProjectLocationOauthClientCredentialCreateCall<'a, C>
15657where
15658    C: 'a,
15659{
15660    hub: &'a Iam<C>,
15661    _request: OauthClientCredential,
15662    _parent: String,
15663    _oauth_client_credential_id: Option<String>,
15664    _delegate: Option<&'a mut dyn common::Delegate>,
15665    _additional_params: HashMap<String, String>,
15666    _scopes: BTreeSet<String>,
15667}
15668
15669impl<'a, C> common::CallBuilder for ProjectLocationOauthClientCredentialCreateCall<'a, C> {}
15670
15671impl<'a, C> ProjectLocationOauthClientCredentialCreateCall<'a, C>
15672where
15673    C: common::Connector,
15674{
15675    /// Perform the operation you have build so far.
15676    pub async fn doit(mut self) -> common::Result<(common::Response, OauthClientCredential)> {
15677        use std::borrow::Cow;
15678        use std::io::{Read, Seek};
15679
15680        use common::{url::Params, ToParts};
15681        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
15682
15683        let mut dd = common::DefaultDelegate;
15684        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
15685        dlg.begin(common::MethodInfo {
15686            id: "iam.projects.locations.oauthClients.credentials.create",
15687            http_method: hyper::Method::POST,
15688        });
15689
15690        for &field in ["alt", "parent", "oauthClientCredentialId"].iter() {
15691            if self._additional_params.contains_key(field) {
15692                dlg.finished(false);
15693                return Err(common::Error::FieldClash(field));
15694            }
15695        }
15696
15697        let mut params = Params::with_capacity(5 + self._additional_params.len());
15698        params.push("parent", self._parent);
15699        if let Some(value) = self._oauth_client_credential_id.as_ref() {
15700            params.push("oauthClientCredentialId", value);
15701        }
15702
15703        params.extend(self._additional_params.iter());
15704
15705        params.push("alt", "json");
15706        let mut url = self.hub._base_url.clone() + "v1/{+parent}/credentials";
15707        if self._scopes.is_empty() {
15708            self._scopes
15709                .insert(Scope::CloudPlatform.as_ref().to_string());
15710        }
15711
15712        #[allow(clippy::single_element_loop)]
15713        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
15714            url = params.uri_replacement(url, param_name, find_this, true);
15715        }
15716        {
15717            let to_remove = ["parent"];
15718            params.remove_params(&to_remove);
15719        }
15720
15721        let url = params.parse_with_url(&url);
15722
15723        let mut json_mime_type = mime::APPLICATION_JSON;
15724        let mut request_value_reader = {
15725            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
15726            common::remove_json_null_values(&mut value);
15727            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
15728            serde_json::to_writer(&mut dst, &value).unwrap();
15729            dst
15730        };
15731        let request_size = request_value_reader
15732            .seek(std::io::SeekFrom::End(0))
15733            .unwrap();
15734        request_value_reader
15735            .seek(std::io::SeekFrom::Start(0))
15736            .unwrap();
15737
15738        loop {
15739            let token = match self
15740                .hub
15741                .auth
15742                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
15743                .await
15744            {
15745                Ok(token) => token,
15746                Err(e) => match dlg.token(e) {
15747                    Ok(token) => token,
15748                    Err(e) => {
15749                        dlg.finished(false);
15750                        return Err(common::Error::MissingToken(e));
15751                    }
15752                },
15753            };
15754            request_value_reader
15755                .seek(std::io::SeekFrom::Start(0))
15756                .unwrap();
15757            let mut req_result = {
15758                let client = &self.hub.client;
15759                dlg.pre_request();
15760                let mut req_builder = hyper::Request::builder()
15761                    .method(hyper::Method::POST)
15762                    .uri(url.as_str())
15763                    .header(USER_AGENT, self.hub._user_agent.clone());
15764
15765                if let Some(token) = token.as_ref() {
15766                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
15767                }
15768
15769                let request = req_builder
15770                    .header(CONTENT_TYPE, json_mime_type.to_string())
15771                    .header(CONTENT_LENGTH, request_size as u64)
15772                    .body(common::to_body(
15773                        request_value_reader.get_ref().clone().into(),
15774                    ));
15775
15776                client.request(request.unwrap()).await
15777            };
15778
15779            match req_result {
15780                Err(err) => {
15781                    if let common::Retry::After(d) = dlg.http_error(&err) {
15782                        sleep(d).await;
15783                        continue;
15784                    }
15785                    dlg.finished(false);
15786                    return Err(common::Error::HttpError(err));
15787                }
15788                Ok(res) => {
15789                    let (mut parts, body) = res.into_parts();
15790                    let mut body = common::Body::new(body);
15791                    if !parts.status.is_success() {
15792                        let bytes = common::to_bytes(body).await.unwrap_or_default();
15793                        let error = serde_json::from_str(&common::to_string(&bytes));
15794                        let response = common::to_response(parts, bytes.into());
15795
15796                        if let common::Retry::After(d) =
15797                            dlg.http_failure(&response, error.as_ref().ok())
15798                        {
15799                            sleep(d).await;
15800                            continue;
15801                        }
15802
15803                        dlg.finished(false);
15804
15805                        return Err(match error {
15806                            Ok(value) => common::Error::BadRequest(value),
15807                            _ => common::Error::Failure(response),
15808                        });
15809                    }
15810                    let response = {
15811                        let bytes = common::to_bytes(body).await.unwrap_or_default();
15812                        let encoded = common::to_string(&bytes);
15813                        match serde_json::from_str(&encoded) {
15814                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
15815                            Err(error) => {
15816                                dlg.response_json_decode_error(&encoded, &error);
15817                                return Err(common::Error::JsonDecodeError(
15818                                    encoded.to_string(),
15819                                    error,
15820                                ));
15821                            }
15822                        }
15823                    };
15824
15825                    dlg.finished(true);
15826                    return Ok(response);
15827                }
15828            }
15829        }
15830    }
15831
15832    ///
15833    /// Sets the *request* property to the given value.
15834    ///
15835    /// Even though the property as already been set when instantiating this call,
15836    /// we provide this method for API completeness.
15837    pub fn request(
15838        mut self,
15839        new_value: OauthClientCredential,
15840    ) -> ProjectLocationOauthClientCredentialCreateCall<'a, C> {
15841        self._request = new_value;
15842        self
15843    }
15844    /// Required. The parent resource to create the OauthClientCredential in.
15845    ///
15846    /// Sets the *parent* path property to the given value.
15847    ///
15848    /// Even though the property as already been set when instantiating this call,
15849    /// we provide this method for API completeness.
15850    pub fn parent(
15851        mut self,
15852        new_value: &str,
15853    ) -> ProjectLocationOauthClientCredentialCreateCall<'a, C> {
15854        self._parent = new_value.to_string();
15855        self
15856    }
15857    /// Required. The ID to use for the OauthClientCredential, which becomes the final component of the resource name. This value should be 4-32 characters, and may contain the characters [a-z0-9-]. The prefix `gcp-` is reserved for use by Google, and may not be specified.
15858    ///
15859    /// Sets the *oauth client credential id* query property to the given value.
15860    pub fn oauth_client_credential_id(
15861        mut self,
15862        new_value: &str,
15863    ) -> ProjectLocationOauthClientCredentialCreateCall<'a, C> {
15864        self._oauth_client_credential_id = Some(new_value.to_string());
15865        self
15866    }
15867    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
15868    /// while executing the actual API request.
15869    ///
15870    /// ````text
15871    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
15872    /// ````
15873    ///
15874    /// Sets the *delegate* property to the given value.
15875    pub fn delegate(
15876        mut self,
15877        new_value: &'a mut dyn common::Delegate,
15878    ) -> ProjectLocationOauthClientCredentialCreateCall<'a, C> {
15879        self._delegate = Some(new_value);
15880        self
15881    }
15882
15883    /// Set any additional parameter of the query string used in the request.
15884    /// It should be used to set parameters which are not yet available through their own
15885    /// setters.
15886    ///
15887    /// Please note that this method must not be used to set any of the known parameters
15888    /// which have their own setter method. If done anyway, the request will fail.
15889    ///
15890    /// # Additional Parameters
15891    ///
15892    /// * *$.xgafv* (query-string) - V1 error format.
15893    /// * *access_token* (query-string) - OAuth access token.
15894    /// * *alt* (query-string) - Data format for response.
15895    /// * *callback* (query-string) - JSONP
15896    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
15897    /// * *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.
15898    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
15899    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
15900    /// * *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.
15901    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
15902    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
15903    pub fn param<T>(
15904        mut self,
15905        name: T,
15906        value: T,
15907    ) -> ProjectLocationOauthClientCredentialCreateCall<'a, C>
15908    where
15909        T: AsRef<str>,
15910    {
15911        self._additional_params
15912            .insert(name.as_ref().to_string(), value.as_ref().to_string());
15913        self
15914    }
15915
15916    /// Identifies the authorization scope for the method you are building.
15917    ///
15918    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
15919    /// [`Scope::CloudPlatform`].
15920    ///
15921    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
15922    /// tokens for more than one scope.
15923    ///
15924    /// Usually there is more than one suitable scope to authorize an operation, some of which may
15925    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
15926    /// sufficient, a read-write scope will do as well.
15927    pub fn add_scope<St>(
15928        mut self,
15929        scope: St,
15930    ) -> ProjectLocationOauthClientCredentialCreateCall<'a, C>
15931    where
15932        St: AsRef<str>,
15933    {
15934        self._scopes.insert(String::from(scope.as_ref()));
15935        self
15936    }
15937    /// Identifies the authorization scope(s) for the method you are building.
15938    ///
15939    /// See [`Self::add_scope()`] for details.
15940    pub fn add_scopes<I, St>(
15941        mut self,
15942        scopes: I,
15943    ) -> ProjectLocationOauthClientCredentialCreateCall<'a, C>
15944    where
15945        I: IntoIterator<Item = St>,
15946        St: AsRef<str>,
15947    {
15948        self._scopes
15949            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
15950        self
15951    }
15952
15953    /// Removes all scopes, and no default scope will be used either.
15954    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
15955    /// for details).
15956    pub fn clear_scopes(mut self) -> ProjectLocationOauthClientCredentialCreateCall<'a, C> {
15957        self._scopes.clear();
15958        self
15959    }
15960}
15961
15962/// Deletes an OauthClientCredential. Before deleting an OauthClientCredential, it should first be disabled.
15963///
15964/// A builder for the *locations.oauthClients.credentials.delete* method supported by a *project* resource.
15965/// It is not used directly, but through a [`ProjectMethods`] instance.
15966///
15967/// # Example
15968///
15969/// Instantiate a resource method builder
15970///
15971/// ```test_harness,no_run
15972/// # extern crate hyper;
15973/// # extern crate hyper_rustls;
15974/// # extern crate google_iam1 as iam1;
15975/// # async fn dox() {
15976/// # use iam1::{Iam, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
15977///
15978/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
15979/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
15980/// #     secret,
15981/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
15982/// # ).build().await.unwrap();
15983///
15984/// # let client = hyper_util::client::legacy::Client::builder(
15985/// #     hyper_util::rt::TokioExecutor::new()
15986/// # )
15987/// # .build(
15988/// #     hyper_rustls::HttpsConnectorBuilder::new()
15989/// #         .with_native_roots()
15990/// #         .unwrap()
15991/// #         .https_or_http()
15992/// #         .enable_http1()
15993/// #         .build()
15994/// # );
15995/// # let mut hub = Iam::new(client, auth);
15996/// // You can configure optional parameters by calling the respective setters at will, and
15997/// // execute the final call using `doit()`.
15998/// // Values shown here are possibly random and not representative !
15999/// let result = hub.projects().locations_oauth_clients_credentials_delete("name")
16000///              .doit().await;
16001/// # }
16002/// ```
16003pub struct ProjectLocationOauthClientCredentialDeleteCall<'a, C>
16004where
16005    C: 'a,
16006{
16007    hub: &'a Iam<C>,
16008    _name: String,
16009    _delegate: Option<&'a mut dyn common::Delegate>,
16010    _additional_params: HashMap<String, String>,
16011    _scopes: BTreeSet<String>,
16012}
16013
16014impl<'a, C> common::CallBuilder for ProjectLocationOauthClientCredentialDeleteCall<'a, C> {}
16015
16016impl<'a, C> ProjectLocationOauthClientCredentialDeleteCall<'a, C>
16017where
16018    C: common::Connector,
16019{
16020    /// Perform the operation you have build so far.
16021    pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
16022        use std::borrow::Cow;
16023        use std::io::{Read, Seek};
16024
16025        use common::{url::Params, ToParts};
16026        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
16027
16028        let mut dd = common::DefaultDelegate;
16029        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
16030        dlg.begin(common::MethodInfo {
16031            id: "iam.projects.locations.oauthClients.credentials.delete",
16032            http_method: hyper::Method::DELETE,
16033        });
16034
16035        for &field in ["alt", "name"].iter() {
16036            if self._additional_params.contains_key(field) {
16037                dlg.finished(false);
16038                return Err(common::Error::FieldClash(field));
16039            }
16040        }
16041
16042        let mut params = Params::with_capacity(3 + self._additional_params.len());
16043        params.push("name", self._name);
16044
16045        params.extend(self._additional_params.iter());
16046
16047        params.push("alt", "json");
16048        let mut url = self.hub._base_url.clone() + "v1/{+name}";
16049        if self._scopes.is_empty() {
16050            self._scopes
16051                .insert(Scope::CloudPlatform.as_ref().to_string());
16052        }
16053
16054        #[allow(clippy::single_element_loop)]
16055        for &(find_this, param_name) in [("{+name}", "name")].iter() {
16056            url = params.uri_replacement(url, param_name, find_this, true);
16057        }
16058        {
16059            let to_remove = ["name"];
16060            params.remove_params(&to_remove);
16061        }
16062
16063        let url = params.parse_with_url(&url);
16064
16065        loop {
16066            let token = match self
16067                .hub
16068                .auth
16069                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
16070                .await
16071            {
16072                Ok(token) => token,
16073                Err(e) => match dlg.token(e) {
16074                    Ok(token) => token,
16075                    Err(e) => {
16076                        dlg.finished(false);
16077                        return Err(common::Error::MissingToken(e));
16078                    }
16079                },
16080            };
16081            let mut req_result = {
16082                let client = &self.hub.client;
16083                dlg.pre_request();
16084                let mut req_builder = hyper::Request::builder()
16085                    .method(hyper::Method::DELETE)
16086                    .uri(url.as_str())
16087                    .header(USER_AGENT, self.hub._user_agent.clone());
16088
16089                if let Some(token) = token.as_ref() {
16090                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
16091                }
16092
16093                let request = req_builder
16094                    .header(CONTENT_LENGTH, 0_u64)
16095                    .body(common::to_body::<String>(None));
16096
16097                client.request(request.unwrap()).await
16098            };
16099
16100            match req_result {
16101                Err(err) => {
16102                    if let common::Retry::After(d) = dlg.http_error(&err) {
16103                        sleep(d).await;
16104                        continue;
16105                    }
16106                    dlg.finished(false);
16107                    return Err(common::Error::HttpError(err));
16108                }
16109                Ok(res) => {
16110                    let (mut parts, body) = res.into_parts();
16111                    let mut body = common::Body::new(body);
16112                    if !parts.status.is_success() {
16113                        let bytes = common::to_bytes(body).await.unwrap_or_default();
16114                        let error = serde_json::from_str(&common::to_string(&bytes));
16115                        let response = common::to_response(parts, bytes.into());
16116
16117                        if let common::Retry::After(d) =
16118                            dlg.http_failure(&response, error.as_ref().ok())
16119                        {
16120                            sleep(d).await;
16121                            continue;
16122                        }
16123
16124                        dlg.finished(false);
16125
16126                        return Err(match error {
16127                            Ok(value) => common::Error::BadRequest(value),
16128                            _ => common::Error::Failure(response),
16129                        });
16130                    }
16131                    let response = {
16132                        let bytes = common::to_bytes(body).await.unwrap_or_default();
16133                        let encoded = common::to_string(&bytes);
16134                        match serde_json::from_str(&encoded) {
16135                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
16136                            Err(error) => {
16137                                dlg.response_json_decode_error(&encoded, &error);
16138                                return Err(common::Error::JsonDecodeError(
16139                                    encoded.to_string(),
16140                                    error,
16141                                ));
16142                            }
16143                        }
16144                    };
16145
16146                    dlg.finished(true);
16147                    return Ok(response);
16148                }
16149            }
16150        }
16151    }
16152
16153    /// Required. The name of the OauthClientCredential to delete. Format: `projects/{project}/locations/{location}/oauthClients/{oauth_client}/credentials/{credential}`.
16154    ///
16155    /// Sets the *name* path property to the given value.
16156    ///
16157    /// Even though the property as already been set when instantiating this call,
16158    /// we provide this method for API completeness.
16159    pub fn name(
16160        mut self,
16161        new_value: &str,
16162    ) -> ProjectLocationOauthClientCredentialDeleteCall<'a, C> {
16163        self._name = new_value.to_string();
16164        self
16165    }
16166    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
16167    /// while executing the actual API request.
16168    ///
16169    /// ````text
16170    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
16171    /// ````
16172    ///
16173    /// Sets the *delegate* property to the given value.
16174    pub fn delegate(
16175        mut self,
16176        new_value: &'a mut dyn common::Delegate,
16177    ) -> ProjectLocationOauthClientCredentialDeleteCall<'a, C> {
16178        self._delegate = Some(new_value);
16179        self
16180    }
16181
16182    /// Set any additional parameter of the query string used in the request.
16183    /// It should be used to set parameters which are not yet available through their own
16184    /// setters.
16185    ///
16186    /// Please note that this method must not be used to set any of the known parameters
16187    /// which have their own setter method. If done anyway, the request will fail.
16188    ///
16189    /// # Additional Parameters
16190    ///
16191    /// * *$.xgafv* (query-string) - V1 error format.
16192    /// * *access_token* (query-string) - OAuth access token.
16193    /// * *alt* (query-string) - Data format for response.
16194    /// * *callback* (query-string) - JSONP
16195    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
16196    /// * *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.
16197    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
16198    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
16199    /// * *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.
16200    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
16201    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
16202    pub fn param<T>(
16203        mut self,
16204        name: T,
16205        value: T,
16206    ) -> ProjectLocationOauthClientCredentialDeleteCall<'a, C>
16207    where
16208        T: AsRef<str>,
16209    {
16210        self._additional_params
16211            .insert(name.as_ref().to_string(), value.as_ref().to_string());
16212        self
16213    }
16214
16215    /// Identifies the authorization scope for the method you are building.
16216    ///
16217    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
16218    /// [`Scope::CloudPlatform`].
16219    ///
16220    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
16221    /// tokens for more than one scope.
16222    ///
16223    /// Usually there is more than one suitable scope to authorize an operation, some of which may
16224    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
16225    /// sufficient, a read-write scope will do as well.
16226    pub fn add_scope<St>(
16227        mut self,
16228        scope: St,
16229    ) -> ProjectLocationOauthClientCredentialDeleteCall<'a, C>
16230    where
16231        St: AsRef<str>,
16232    {
16233        self._scopes.insert(String::from(scope.as_ref()));
16234        self
16235    }
16236    /// Identifies the authorization scope(s) for the method you are building.
16237    ///
16238    /// See [`Self::add_scope()`] for details.
16239    pub fn add_scopes<I, St>(
16240        mut self,
16241        scopes: I,
16242    ) -> ProjectLocationOauthClientCredentialDeleteCall<'a, C>
16243    where
16244        I: IntoIterator<Item = St>,
16245        St: AsRef<str>,
16246    {
16247        self._scopes
16248            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
16249        self
16250    }
16251
16252    /// Removes all scopes, and no default scope will be used either.
16253    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
16254    /// for details).
16255    pub fn clear_scopes(mut self) -> ProjectLocationOauthClientCredentialDeleteCall<'a, C> {
16256        self._scopes.clear();
16257        self
16258    }
16259}
16260
16261/// Gets an individual OauthClientCredential.
16262///
16263/// A builder for the *locations.oauthClients.credentials.get* method supported by a *project* resource.
16264/// It is not used directly, but through a [`ProjectMethods`] instance.
16265///
16266/// # Example
16267///
16268/// Instantiate a resource method builder
16269///
16270/// ```test_harness,no_run
16271/// # extern crate hyper;
16272/// # extern crate hyper_rustls;
16273/// # extern crate google_iam1 as iam1;
16274/// # async fn dox() {
16275/// # use iam1::{Iam, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
16276///
16277/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
16278/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
16279/// #     secret,
16280/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
16281/// # ).build().await.unwrap();
16282///
16283/// # let client = hyper_util::client::legacy::Client::builder(
16284/// #     hyper_util::rt::TokioExecutor::new()
16285/// # )
16286/// # .build(
16287/// #     hyper_rustls::HttpsConnectorBuilder::new()
16288/// #         .with_native_roots()
16289/// #         .unwrap()
16290/// #         .https_or_http()
16291/// #         .enable_http1()
16292/// #         .build()
16293/// # );
16294/// # let mut hub = Iam::new(client, auth);
16295/// // You can configure optional parameters by calling the respective setters at will, and
16296/// // execute the final call using `doit()`.
16297/// // Values shown here are possibly random and not representative !
16298/// let result = hub.projects().locations_oauth_clients_credentials_get("name")
16299///              .doit().await;
16300/// # }
16301/// ```
16302pub struct ProjectLocationOauthClientCredentialGetCall<'a, C>
16303where
16304    C: 'a,
16305{
16306    hub: &'a Iam<C>,
16307    _name: String,
16308    _delegate: Option<&'a mut dyn common::Delegate>,
16309    _additional_params: HashMap<String, String>,
16310    _scopes: BTreeSet<String>,
16311}
16312
16313impl<'a, C> common::CallBuilder for ProjectLocationOauthClientCredentialGetCall<'a, C> {}
16314
16315impl<'a, C> ProjectLocationOauthClientCredentialGetCall<'a, C>
16316where
16317    C: common::Connector,
16318{
16319    /// Perform the operation you have build so far.
16320    pub async fn doit(mut self) -> common::Result<(common::Response, OauthClientCredential)> {
16321        use std::borrow::Cow;
16322        use std::io::{Read, Seek};
16323
16324        use common::{url::Params, ToParts};
16325        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
16326
16327        let mut dd = common::DefaultDelegate;
16328        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
16329        dlg.begin(common::MethodInfo {
16330            id: "iam.projects.locations.oauthClients.credentials.get",
16331            http_method: hyper::Method::GET,
16332        });
16333
16334        for &field in ["alt", "name"].iter() {
16335            if self._additional_params.contains_key(field) {
16336                dlg.finished(false);
16337                return Err(common::Error::FieldClash(field));
16338            }
16339        }
16340
16341        let mut params = Params::with_capacity(3 + self._additional_params.len());
16342        params.push("name", self._name);
16343
16344        params.extend(self._additional_params.iter());
16345
16346        params.push("alt", "json");
16347        let mut url = self.hub._base_url.clone() + "v1/{+name}";
16348        if self._scopes.is_empty() {
16349            self._scopes
16350                .insert(Scope::CloudPlatform.as_ref().to_string());
16351        }
16352
16353        #[allow(clippy::single_element_loop)]
16354        for &(find_this, param_name) in [("{+name}", "name")].iter() {
16355            url = params.uri_replacement(url, param_name, find_this, true);
16356        }
16357        {
16358            let to_remove = ["name"];
16359            params.remove_params(&to_remove);
16360        }
16361
16362        let url = params.parse_with_url(&url);
16363
16364        loop {
16365            let token = match self
16366                .hub
16367                .auth
16368                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
16369                .await
16370            {
16371                Ok(token) => token,
16372                Err(e) => match dlg.token(e) {
16373                    Ok(token) => token,
16374                    Err(e) => {
16375                        dlg.finished(false);
16376                        return Err(common::Error::MissingToken(e));
16377                    }
16378                },
16379            };
16380            let mut req_result = {
16381                let client = &self.hub.client;
16382                dlg.pre_request();
16383                let mut req_builder = hyper::Request::builder()
16384                    .method(hyper::Method::GET)
16385                    .uri(url.as_str())
16386                    .header(USER_AGENT, self.hub._user_agent.clone());
16387
16388                if let Some(token) = token.as_ref() {
16389                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
16390                }
16391
16392                let request = req_builder
16393                    .header(CONTENT_LENGTH, 0_u64)
16394                    .body(common::to_body::<String>(None));
16395
16396                client.request(request.unwrap()).await
16397            };
16398
16399            match req_result {
16400                Err(err) => {
16401                    if let common::Retry::After(d) = dlg.http_error(&err) {
16402                        sleep(d).await;
16403                        continue;
16404                    }
16405                    dlg.finished(false);
16406                    return Err(common::Error::HttpError(err));
16407                }
16408                Ok(res) => {
16409                    let (mut parts, body) = res.into_parts();
16410                    let mut body = common::Body::new(body);
16411                    if !parts.status.is_success() {
16412                        let bytes = common::to_bytes(body).await.unwrap_or_default();
16413                        let error = serde_json::from_str(&common::to_string(&bytes));
16414                        let response = common::to_response(parts, bytes.into());
16415
16416                        if let common::Retry::After(d) =
16417                            dlg.http_failure(&response, error.as_ref().ok())
16418                        {
16419                            sleep(d).await;
16420                            continue;
16421                        }
16422
16423                        dlg.finished(false);
16424
16425                        return Err(match error {
16426                            Ok(value) => common::Error::BadRequest(value),
16427                            _ => common::Error::Failure(response),
16428                        });
16429                    }
16430                    let response = {
16431                        let bytes = common::to_bytes(body).await.unwrap_or_default();
16432                        let encoded = common::to_string(&bytes);
16433                        match serde_json::from_str(&encoded) {
16434                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
16435                            Err(error) => {
16436                                dlg.response_json_decode_error(&encoded, &error);
16437                                return Err(common::Error::JsonDecodeError(
16438                                    encoded.to_string(),
16439                                    error,
16440                                ));
16441                            }
16442                        }
16443                    };
16444
16445                    dlg.finished(true);
16446                    return Ok(response);
16447                }
16448            }
16449        }
16450    }
16451
16452    /// Required. The name of the OauthClientCredential to retrieve. Format: `projects/{project}/locations/{location}/oauthClients/{oauth_client}/credentials/{credential}`.
16453    ///
16454    /// Sets the *name* path property to the given value.
16455    ///
16456    /// Even though the property as already been set when instantiating this call,
16457    /// we provide this method for API completeness.
16458    pub fn name(mut self, new_value: &str) -> ProjectLocationOauthClientCredentialGetCall<'a, C> {
16459        self._name = new_value.to_string();
16460        self
16461    }
16462    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
16463    /// while executing the actual API request.
16464    ///
16465    /// ````text
16466    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
16467    /// ````
16468    ///
16469    /// Sets the *delegate* property to the given value.
16470    pub fn delegate(
16471        mut self,
16472        new_value: &'a mut dyn common::Delegate,
16473    ) -> ProjectLocationOauthClientCredentialGetCall<'a, C> {
16474        self._delegate = Some(new_value);
16475        self
16476    }
16477
16478    /// Set any additional parameter of the query string used in the request.
16479    /// It should be used to set parameters which are not yet available through their own
16480    /// setters.
16481    ///
16482    /// Please note that this method must not be used to set any of the known parameters
16483    /// which have their own setter method. If done anyway, the request will fail.
16484    ///
16485    /// # Additional Parameters
16486    ///
16487    /// * *$.xgafv* (query-string) - V1 error format.
16488    /// * *access_token* (query-string) - OAuth access token.
16489    /// * *alt* (query-string) - Data format for response.
16490    /// * *callback* (query-string) - JSONP
16491    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
16492    /// * *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.
16493    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
16494    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
16495    /// * *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.
16496    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
16497    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
16498    pub fn param<T>(
16499        mut self,
16500        name: T,
16501        value: T,
16502    ) -> ProjectLocationOauthClientCredentialGetCall<'a, C>
16503    where
16504        T: AsRef<str>,
16505    {
16506        self._additional_params
16507            .insert(name.as_ref().to_string(), value.as_ref().to_string());
16508        self
16509    }
16510
16511    /// Identifies the authorization scope for the method you are building.
16512    ///
16513    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
16514    /// [`Scope::CloudPlatform`].
16515    ///
16516    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
16517    /// tokens for more than one scope.
16518    ///
16519    /// Usually there is more than one suitable scope to authorize an operation, some of which may
16520    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
16521    /// sufficient, a read-write scope will do as well.
16522    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationOauthClientCredentialGetCall<'a, C>
16523    where
16524        St: AsRef<str>,
16525    {
16526        self._scopes.insert(String::from(scope.as_ref()));
16527        self
16528    }
16529    /// Identifies the authorization scope(s) for the method you are building.
16530    ///
16531    /// See [`Self::add_scope()`] for details.
16532    pub fn add_scopes<I, St>(
16533        mut self,
16534        scopes: I,
16535    ) -> ProjectLocationOauthClientCredentialGetCall<'a, C>
16536    where
16537        I: IntoIterator<Item = St>,
16538        St: AsRef<str>,
16539    {
16540        self._scopes
16541            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
16542        self
16543    }
16544
16545    /// Removes all scopes, and no default scope will be used either.
16546    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
16547    /// for details).
16548    pub fn clear_scopes(mut self) -> ProjectLocationOauthClientCredentialGetCall<'a, C> {
16549        self._scopes.clear();
16550        self
16551    }
16552}
16553
16554/// Lists all OauthClientCredentials in an OauthClient.
16555///
16556/// A builder for the *locations.oauthClients.credentials.list* method supported by a *project* resource.
16557/// It is not used directly, but through a [`ProjectMethods`] instance.
16558///
16559/// # Example
16560///
16561/// Instantiate a resource method builder
16562///
16563/// ```test_harness,no_run
16564/// # extern crate hyper;
16565/// # extern crate hyper_rustls;
16566/// # extern crate google_iam1 as iam1;
16567/// # async fn dox() {
16568/// # use iam1::{Iam, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
16569///
16570/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
16571/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
16572/// #     secret,
16573/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
16574/// # ).build().await.unwrap();
16575///
16576/// # let client = hyper_util::client::legacy::Client::builder(
16577/// #     hyper_util::rt::TokioExecutor::new()
16578/// # )
16579/// # .build(
16580/// #     hyper_rustls::HttpsConnectorBuilder::new()
16581/// #         .with_native_roots()
16582/// #         .unwrap()
16583/// #         .https_or_http()
16584/// #         .enable_http1()
16585/// #         .build()
16586/// # );
16587/// # let mut hub = Iam::new(client, auth);
16588/// // You can configure optional parameters by calling the respective setters at will, and
16589/// // execute the final call using `doit()`.
16590/// // Values shown here are possibly random and not representative !
16591/// let result = hub.projects().locations_oauth_clients_credentials_list("parent")
16592///              .doit().await;
16593/// # }
16594/// ```
16595pub struct ProjectLocationOauthClientCredentialListCall<'a, C>
16596where
16597    C: 'a,
16598{
16599    hub: &'a Iam<C>,
16600    _parent: String,
16601    _delegate: Option<&'a mut dyn common::Delegate>,
16602    _additional_params: HashMap<String, String>,
16603    _scopes: BTreeSet<String>,
16604}
16605
16606impl<'a, C> common::CallBuilder for ProjectLocationOauthClientCredentialListCall<'a, C> {}
16607
16608impl<'a, C> ProjectLocationOauthClientCredentialListCall<'a, C>
16609where
16610    C: common::Connector,
16611{
16612    /// Perform the operation you have build so far.
16613    pub async fn doit(
16614        mut self,
16615    ) -> common::Result<(common::Response, ListOauthClientCredentialsResponse)> {
16616        use std::borrow::Cow;
16617        use std::io::{Read, Seek};
16618
16619        use common::{url::Params, ToParts};
16620        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
16621
16622        let mut dd = common::DefaultDelegate;
16623        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
16624        dlg.begin(common::MethodInfo {
16625            id: "iam.projects.locations.oauthClients.credentials.list",
16626            http_method: hyper::Method::GET,
16627        });
16628
16629        for &field in ["alt", "parent"].iter() {
16630            if self._additional_params.contains_key(field) {
16631                dlg.finished(false);
16632                return Err(common::Error::FieldClash(field));
16633            }
16634        }
16635
16636        let mut params = Params::with_capacity(3 + self._additional_params.len());
16637        params.push("parent", self._parent);
16638
16639        params.extend(self._additional_params.iter());
16640
16641        params.push("alt", "json");
16642        let mut url = self.hub._base_url.clone() + "v1/{+parent}/credentials";
16643        if self._scopes.is_empty() {
16644            self._scopes
16645                .insert(Scope::CloudPlatform.as_ref().to_string());
16646        }
16647
16648        #[allow(clippy::single_element_loop)]
16649        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
16650            url = params.uri_replacement(url, param_name, find_this, true);
16651        }
16652        {
16653            let to_remove = ["parent"];
16654            params.remove_params(&to_remove);
16655        }
16656
16657        let url = params.parse_with_url(&url);
16658
16659        loop {
16660            let token = match self
16661                .hub
16662                .auth
16663                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
16664                .await
16665            {
16666                Ok(token) => token,
16667                Err(e) => match dlg.token(e) {
16668                    Ok(token) => token,
16669                    Err(e) => {
16670                        dlg.finished(false);
16671                        return Err(common::Error::MissingToken(e));
16672                    }
16673                },
16674            };
16675            let mut req_result = {
16676                let client = &self.hub.client;
16677                dlg.pre_request();
16678                let mut req_builder = hyper::Request::builder()
16679                    .method(hyper::Method::GET)
16680                    .uri(url.as_str())
16681                    .header(USER_AGENT, self.hub._user_agent.clone());
16682
16683                if let Some(token) = token.as_ref() {
16684                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
16685                }
16686
16687                let request = req_builder
16688                    .header(CONTENT_LENGTH, 0_u64)
16689                    .body(common::to_body::<String>(None));
16690
16691                client.request(request.unwrap()).await
16692            };
16693
16694            match req_result {
16695                Err(err) => {
16696                    if let common::Retry::After(d) = dlg.http_error(&err) {
16697                        sleep(d).await;
16698                        continue;
16699                    }
16700                    dlg.finished(false);
16701                    return Err(common::Error::HttpError(err));
16702                }
16703                Ok(res) => {
16704                    let (mut parts, body) = res.into_parts();
16705                    let mut body = common::Body::new(body);
16706                    if !parts.status.is_success() {
16707                        let bytes = common::to_bytes(body).await.unwrap_or_default();
16708                        let error = serde_json::from_str(&common::to_string(&bytes));
16709                        let response = common::to_response(parts, bytes.into());
16710
16711                        if let common::Retry::After(d) =
16712                            dlg.http_failure(&response, error.as_ref().ok())
16713                        {
16714                            sleep(d).await;
16715                            continue;
16716                        }
16717
16718                        dlg.finished(false);
16719
16720                        return Err(match error {
16721                            Ok(value) => common::Error::BadRequest(value),
16722                            _ => common::Error::Failure(response),
16723                        });
16724                    }
16725                    let response = {
16726                        let bytes = common::to_bytes(body).await.unwrap_or_default();
16727                        let encoded = common::to_string(&bytes);
16728                        match serde_json::from_str(&encoded) {
16729                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
16730                            Err(error) => {
16731                                dlg.response_json_decode_error(&encoded, &error);
16732                                return Err(common::Error::JsonDecodeError(
16733                                    encoded.to_string(),
16734                                    error,
16735                                ));
16736                            }
16737                        }
16738                    };
16739
16740                    dlg.finished(true);
16741                    return Ok(response);
16742                }
16743            }
16744        }
16745    }
16746
16747    /// Required. The parent to list OauthClientCredentials for.
16748    ///
16749    /// Sets the *parent* path property to the given value.
16750    ///
16751    /// Even though the property as already been set when instantiating this call,
16752    /// we provide this method for API completeness.
16753    pub fn parent(
16754        mut self,
16755        new_value: &str,
16756    ) -> ProjectLocationOauthClientCredentialListCall<'a, C> {
16757        self._parent = new_value.to_string();
16758        self
16759    }
16760    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
16761    /// while executing the actual API request.
16762    ///
16763    /// ````text
16764    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
16765    /// ````
16766    ///
16767    /// Sets the *delegate* property to the given value.
16768    pub fn delegate(
16769        mut self,
16770        new_value: &'a mut dyn common::Delegate,
16771    ) -> ProjectLocationOauthClientCredentialListCall<'a, C> {
16772        self._delegate = Some(new_value);
16773        self
16774    }
16775
16776    /// Set any additional parameter of the query string used in the request.
16777    /// It should be used to set parameters which are not yet available through their own
16778    /// setters.
16779    ///
16780    /// Please note that this method must not be used to set any of the known parameters
16781    /// which have their own setter method. If done anyway, the request will fail.
16782    ///
16783    /// # Additional Parameters
16784    ///
16785    /// * *$.xgafv* (query-string) - V1 error format.
16786    /// * *access_token* (query-string) - OAuth access token.
16787    /// * *alt* (query-string) - Data format for response.
16788    /// * *callback* (query-string) - JSONP
16789    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
16790    /// * *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.
16791    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
16792    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
16793    /// * *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.
16794    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
16795    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
16796    pub fn param<T>(
16797        mut self,
16798        name: T,
16799        value: T,
16800    ) -> ProjectLocationOauthClientCredentialListCall<'a, C>
16801    where
16802        T: AsRef<str>,
16803    {
16804        self._additional_params
16805            .insert(name.as_ref().to_string(), value.as_ref().to_string());
16806        self
16807    }
16808
16809    /// Identifies the authorization scope for the method you are building.
16810    ///
16811    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
16812    /// [`Scope::CloudPlatform`].
16813    ///
16814    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
16815    /// tokens for more than one scope.
16816    ///
16817    /// Usually there is more than one suitable scope to authorize an operation, some of which may
16818    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
16819    /// sufficient, a read-write scope will do as well.
16820    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationOauthClientCredentialListCall<'a, C>
16821    where
16822        St: AsRef<str>,
16823    {
16824        self._scopes.insert(String::from(scope.as_ref()));
16825        self
16826    }
16827    /// Identifies the authorization scope(s) for the method you are building.
16828    ///
16829    /// See [`Self::add_scope()`] for details.
16830    pub fn add_scopes<I, St>(
16831        mut self,
16832        scopes: I,
16833    ) -> ProjectLocationOauthClientCredentialListCall<'a, C>
16834    where
16835        I: IntoIterator<Item = St>,
16836        St: AsRef<str>,
16837    {
16838        self._scopes
16839            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
16840        self
16841    }
16842
16843    /// Removes all scopes, and no default scope will be used either.
16844    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
16845    /// for details).
16846    pub fn clear_scopes(mut self) -> ProjectLocationOauthClientCredentialListCall<'a, C> {
16847        self._scopes.clear();
16848        self
16849    }
16850}
16851
16852/// Updates an existing OauthClientCredential.
16853///
16854/// A builder for the *locations.oauthClients.credentials.patch* method supported by a *project* resource.
16855/// It is not used directly, but through a [`ProjectMethods`] instance.
16856///
16857/// # Example
16858///
16859/// Instantiate a resource method builder
16860///
16861/// ```test_harness,no_run
16862/// # extern crate hyper;
16863/// # extern crate hyper_rustls;
16864/// # extern crate google_iam1 as iam1;
16865/// use iam1::api::OauthClientCredential;
16866/// # async fn dox() {
16867/// # use iam1::{Iam, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
16868///
16869/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
16870/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
16871/// #     secret,
16872/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
16873/// # ).build().await.unwrap();
16874///
16875/// # let client = hyper_util::client::legacy::Client::builder(
16876/// #     hyper_util::rt::TokioExecutor::new()
16877/// # )
16878/// # .build(
16879/// #     hyper_rustls::HttpsConnectorBuilder::new()
16880/// #         .with_native_roots()
16881/// #         .unwrap()
16882/// #         .https_or_http()
16883/// #         .enable_http1()
16884/// #         .build()
16885/// # );
16886/// # let mut hub = Iam::new(client, auth);
16887/// // As the method needs a request, you would usually fill it with the desired information
16888/// // into the respective structure. Some of the parts shown here might not be applicable !
16889/// // Values shown here are possibly random and not representative !
16890/// let mut req = OauthClientCredential::default();
16891///
16892/// // You can configure optional parameters by calling the respective setters at will, and
16893/// // execute the final call using `doit()`.
16894/// // Values shown here are possibly random and not representative !
16895/// let result = hub.projects().locations_oauth_clients_credentials_patch(req, "name")
16896///              .update_mask(FieldMask::new::<&str>(&[]))
16897///              .doit().await;
16898/// # }
16899/// ```
16900pub struct ProjectLocationOauthClientCredentialPatchCall<'a, C>
16901where
16902    C: 'a,
16903{
16904    hub: &'a Iam<C>,
16905    _request: OauthClientCredential,
16906    _name: String,
16907    _update_mask: Option<common::FieldMask>,
16908    _delegate: Option<&'a mut dyn common::Delegate>,
16909    _additional_params: HashMap<String, String>,
16910    _scopes: BTreeSet<String>,
16911}
16912
16913impl<'a, C> common::CallBuilder for ProjectLocationOauthClientCredentialPatchCall<'a, C> {}
16914
16915impl<'a, C> ProjectLocationOauthClientCredentialPatchCall<'a, C>
16916where
16917    C: common::Connector,
16918{
16919    /// Perform the operation you have build so far.
16920    pub async fn doit(mut self) -> common::Result<(common::Response, OauthClientCredential)> {
16921        use std::borrow::Cow;
16922        use std::io::{Read, Seek};
16923
16924        use common::{url::Params, ToParts};
16925        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
16926
16927        let mut dd = common::DefaultDelegate;
16928        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
16929        dlg.begin(common::MethodInfo {
16930            id: "iam.projects.locations.oauthClients.credentials.patch",
16931            http_method: hyper::Method::PATCH,
16932        });
16933
16934        for &field in ["alt", "name", "updateMask"].iter() {
16935            if self._additional_params.contains_key(field) {
16936                dlg.finished(false);
16937                return Err(common::Error::FieldClash(field));
16938            }
16939        }
16940
16941        let mut params = Params::with_capacity(5 + self._additional_params.len());
16942        params.push("name", self._name);
16943        if let Some(value) = self._update_mask.as_ref() {
16944            params.push("updateMask", value.to_string());
16945        }
16946
16947        params.extend(self._additional_params.iter());
16948
16949        params.push("alt", "json");
16950        let mut url = self.hub._base_url.clone() + "v1/{+name}";
16951        if self._scopes.is_empty() {
16952            self._scopes
16953                .insert(Scope::CloudPlatform.as_ref().to_string());
16954        }
16955
16956        #[allow(clippy::single_element_loop)]
16957        for &(find_this, param_name) in [("{+name}", "name")].iter() {
16958            url = params.uri_replacement(url, param_name, find_this, true);
16959        }
16960        {
16961            let to_remove = ["name"];
16962            params.remove_params(&to_remove);
16963        }
16964
16965        let url = params.parse_with_url(&url);
16966
16967        let mut json_mime_type = mime::APPLICATION_JSON;
16968        let mut request_value_reader = {
16969            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
16970            common::remove_json_null_values(&mut value);
16971            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
16972            serde_json::to_writer(&mut dst, &value).unwrap();
16973            dst
16974        };
16975        let request_size = request_value_reader
16976            .seek(std::io::SeekFrom::End(0))
16977            .unwrap();
16978        request_value_reader
16979            .seek(std::io::SeekFrom::Start(0))
16980            .unwrap();
16981
16982        loop {
16983            let token = match self
16984                .hub
16985                .auth
16986                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
16987                .await
16988            {
16989                Ok(token) => token,
16990                Err(e) => match dlg.token(e) {
16991                    Ok(token) => token,
16992                    Err(e) => {
16993                        dlg.finished(false);
16994                        return Err(common::Error::MissingToken(e));
16995                    }
16996                },
16997            };
16998            request_value_reader
16999                .seek(std::io::SeekFrom::Start(0))
17000                .unwrap();
17001            let mut req_result = {
17002                let client = &self.hub.client;
17003                dlg.pre_request();
17004                let mut req_builder = hyper::Request::builder()
17005                    .method(hyper::Method::PATCH)
17006                    .uri(url.as_str())
17007                    .header(USER_AGENT, self.hub._user_agent.clone());
17008
17009                if let Some(token) = token.as_ref() {
17010                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
17011                }
17012
17013                let request = req_builder
17014                    .header(CONTENT_TYPE, json_mime_type.to_string())
17015                    .header(CONTENT_LENGTH, request_size as u64)
17016                    .body(common::to_body(
17017                        request_value_reader.get_ref().clone().into(),
17018                    ));
17019
17020                client.request(request.unwrap()).await
17021            };
17022
17023            match req_result {
17024                Err(err) => {
17025                    if let common::Retry::After(d) = dlg.http_error(&err) {
17026                        sleep(d).await;
17027                        continue;
17028                    }
17029                    dlg.finished(false);
17030                    return Err(common::Error::HttpError(err));
17031                }
17032                Ok(res) => {
17033                    let (mut parts, body) = res.into_parts();
17034                    let mut body = common::Body::new(body);
17035                    if !parts.status.is_success() {
17036                        let bytes = common::to_bytes(body).await.unwrap_or_default();
17037                        let error = serde_json::from_str(&common::to_string(&bytes));
17038                        let response = common::to_response(parts, bytes.into());
17039
17040                        if let common::Retry::After(d) =
17041                            dlg.http_failure(&response, error.as_ref().ok())
17042                        {
17043                            sleep(d).await;
17044                            continue;
17045                        }
17046
17047                        dlg.finished(false);
17048
17049                        return Err(match error {
17050                            Ok(value) => common::Error::BadRequest(value),
17051                            _ => common::Error::Failure(response),
17052                        });
17053                    }
17054                    let response = {
17055                        let bytes = common::to_bytes(body).await.unwrap_or_default();
17056                        let encoded = common::to_string(&bytes);
17057                        match serde_json::from_str(&encoded) {
17058                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
17059                            Err(error) => {
17060                                dlg.response_json_decode_error(&encoded, &error);
17061                                return Err(common::Error::JsonDecodeError(
17062                                    encoded.to_string(),
17063                                    error,
17064                                ));
17065                            }
17066                        }
17067                    };
17068
17069                    dlg.finished(true);
17070                    return Ok(response);
17071                }
17072            }
17073        }
17074    }
17075
17076    ///
17077    /// Sets the *request* property to the given value.
17078    ///
17079    /// Even though the property as already been set when instantiating this call,
17080    /// we provide this method for API completeness.
17081    pub fn request(
17082        mut self,
17083        new_value: OauthClientCredential,
17084    ) -> ProjectLocationOauthClientCredentialPatchCall<'a, C> {
17085        self._request = new_value;
17086        self
17087    }
17088    /// Immutable. The resource name of the OauthClientCredential. Format: `projects/{project}/locations/{location}/oauthClients/{oauth_client}/credentials/{credential}`
17089    ///
17090    /// Sets the *name* path property to the given value.
17091    ///
17092    /// Even though the property as already been set when instantiating this call,
17093    /// we provide this method for API completeness.
17094    pub fn name(mut self, new_value: &str) -> ProjectLocationOauthClientCredentialPatchCall<'a, C> {
17095        self._name = new_value.to_string();
17096        self
17097    }
17098    /// Required. The list of fields to update.
17099    ///
17100    /// Sets the *update mask* query property to the given value.
17101    pub fn update_mask(
17102        mut self,
17103        new_value: common::FieldMask,
17104    ) -> ProjectLocationOauthClientCredentialPatchCall<'a, C> {
17105        self._update_mask = Some(new_value);
17106        self
17107    }
17108    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
17109    /// while executing the actual API request.
17110    ///
17111    /// ````text
17112    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
17113    /// ````
17114    ///
17115    /// Sets the *delegate* property to the given value.
17116    pub fn delegate(
17117        mut self,
17118        new_value: &'a mut dyn common::Delegate,
17119    ) -> ProjectLocationOauthClientCredentialPatchCall<'a, C> {
17120        self._delegate = Some(new_value);
17121        self
17122    }
17123
17124    /// Set any additional parameter of the query string used in the request.
17125    /// It should be used to set parameters which are not yet available through their own
17126    /// setters.
17127    ///
17128    /// Please note that this method must not be used to set any of the known parameters
17129    /// which have their own setter method. If done anyway, the request will fail.
17130    ///
17131    /// # Additional Parameters
17132    ///
17133    /// * *$.xgafv* (query-string) - V1 error format.
17134    /// * *access_token* (query-string) - OAuth access token.
17135    /// * *alt* (query-string) - Data format for response.
17136    /// * *callback* (query-string) - JSONP
17137    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
17138    /// * *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.
17139    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
17140    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
17141    /// * *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.
17142    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
17143    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
17144    pub fn param<T>(
17145        mut self,
17146        name: T,
17147        value: T,
17148    ) -> ProjectLocationOauthClientCredentialPatchCall<'a, C>
17149    where
17150        T: AsRef<str>,
17151    {
17152        self._additional_params
17153            .insert(name.as_ref().to_string(), value.as_ref().to_string());
17154        self
17155    }
17156
17157    /// Identifies the authorization scope for the method you are building.
17158    ///
17159    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
17160    /// [`Scope::CloudPlatform`].
17161    ///
17162    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
17163    /// tokens for more than one scope.
17164    ///
17165    /// Usually there is more than one suitable scope to authorize an operation, some of which may
17166    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
17167    /// sufficient, a read-write scope will do as well.
17168    pub fn add_scope<St>(
17169        mut self,
17170        scope: St,
17171    ) -> ProjectLocationOauthClientCredentialPatchCall<'a, C>
17172    where
17173        St: AsRef<str>,
17174    {
17175        self._scopes.insert(String::from(scope.as_ref()));
17176        self
17177    }
17178    /// Identifies the authorization scope(s) for the method you are building.
17179    ///
17180    /// See [`Self::add_scope()`] for details.
17181    pub fn add_scopes<I, St>(
17182        mut self,
17183        scopes: I,
17184    ) -> ProjectLocationOauthClientCredentialPatchCall<'a, C>
17185    where
17186        I: IntoIterator<Item = St>,
17187        St: AsRef<str>,
17188    {
17189        self._scopes
17190            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
17191        self
17192    }
17193
17194    /// Removes all scopes, and no default scope will be used either.
17195    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
17196    /// for details).
17197    pub fn clear_scopes(mut self) -> ProjectLocationOauthClientCredentialPatchCall<'a, C> {
17198        self._scopes.clear();
17199        self
17200    }
17201}
17202
17203/// Creates a new OauthClient. You cannot reuse the name of a deleted OauthClient until 30 days after deletion.
17204///
17205/// A builder for the *locations.oauthClients.create* method supported by a *project* resource.
17206/// It is not used directly, but through a [`ProjectMethods`] instance.
17207///
17208/// # Example
17209///
17210/// Instantiate a resource method builder
17211///
17212/// ```test_harness,no_run
17213/// # extern crate hyper;
17214/// # extern crate hyper_rustls;
17215/// # extern crate google_iam1 as iam1;
17216/// use iam1::api::OauthClient;
17217/// # async fn dox() {
17218/// # use iam1::{Iam, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
17219///
17220/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
17221/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
17222/// #     secret,
17223/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
17224/// # ).build().await.unwrap();
17225///
17226/// # let client = hyper_util::client::legacy::Client::builder(
17227/// #     hyper_util::rt::TokioExecutor::new()
17228/// # )
17229/// # .build(
17230/// #     hyper_rustls::HttpsConnectorBuilder::new()
17231/// #         .with_native_roots()
17232/// #         .unwrap()
17233/// #         .https_or_http()
17234/// #         .enable_http1()
17235/// #         .build()
17236/// # );
17237/// # let mut hub = Iam::new(client, auth);
17238/// // As the method needs a request, you would usually fill it with the desired information
17239/// // into the respective structure. Some of the parts shown here might not be applicable !
17240/// // Values shown here are possibly random and not representative !
17241/// let mut req = OauthClient::default();
17242///
17243/// // You can configure optional parameters by calling the respective setters at will, and
17244/// // execute the final call using `doit()`.
17245/// // Values shown here are possibly random and not representative !
17246/// let result = hub.projects().locations_oauth_clients_create(req, "parent")
17247///              .oauth_client_id("Stet")
17248///              .doit().await;
17249/// # }
17250/// ```
17251pub struct ProjectLocationOauthClientCreateCall<'a, C>
17252where
17253    C: 'a,
17254{
17255    hub: &'a Iam<C>,
17256    _request: OauthClient,
17257    _parent: String,
17258    _oauth_client_id: Option<String>,
17259    _delegate: Option<&'a mut dyn common::Delegate>,
17260    _additional_params: HashMap<String, String>,
17261    _scopes: BTreeSet<String>,
17262}
17263
17264impl<'a, C> common::CallBuilder for ProjectLocationOauthClientCreateCall<'a, C> {}
17265
17266impl<'a, C> ProjectLocationOauthClientCreateCall<'a, C>
17267where
17268    C: common::Connector,
17269{
17270    /// Perform the operation you have build so far.
17271    pub async fn doit(mut self) -> common::Result<(common::Response, OauthClient)> {
17272        use std::borrow::Cow;
17273        use std::io::{Read, Seek};
17274
17275        use common::{url::Params, ToParts};
17276        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
17277
17278        let mut dd = common::DefaultDelegate;
17279        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
17280        dlg.begin(common::MethodInfo {
17281            id: "iam.projects.locations.oauthClients.create",
17282            http_method: hyper::Method::POST,
17283        });
17284
17285        for &field in ["alt", "parent", "oauthClientId"].iter() {
17286            if self._additional_params.contains_key(field) {
17287                dlg.finished(false);
17288                return Err(common::Error::FieldClash(field));
17289            }
17290        }
17291
17292        let mut params = Params::with_capacity(5 + self._additional_params.len());
17293        params.push("parent", self._parent);
17294        if let Some(value) = self._oauth_client_id.as_ref() {
17295            params.push("oauthClientId", value);
17296        }
17297
17298        params.extend(self._additional_params.iter());
17299
17300        params.push("alt", "json");
17301        let mut url = self.hub._base_url.clone() + "v1/{+parent}/oauthClients";
17302        if self._scopes.is_empty() {
17303            self._scopes
17304                .insert(Scope::CloudPlatform.as_ref().to_string());
17305        }
17306
17307        #[allow(clippy::single_element_loop)]
17308        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
17309            url = params.uri_replacement(url, param_name, find_this, true);
17310        }
17311        {
17312            let to_remove = ["parent"];
17313            params.remove_params(&to_remove);
17314        }
17315
17316        let url = params.parse_with_url(&url);
17317
17318        let mut json_mime_type = mime::APPLICATION_JSON;
17319        let mut request_value_reader = {
17320            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
17321            common::remove_json_null_values(&mut value);
17322            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
17323            serde_json::to_writer(&mut dst, &value).unwrap();
17324            dst
17325        };
17326        let request_size = request_value_reader
17327            .seek(std::io::SeekFrom::End(0))
17328            .unwrap();
17329        request_value_reader
17330            .seek(std::io::SeekFrom::Start(0))
17331            .unwrap();
17332
17333        loop {
17334            let token = match self
17335                .hub
17336                .auth
17337                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
17338                .await
17339            {
17340                Ok(token) => token,
17341                Err(e) => match dlg.token(e) {
17342                    Ok(token) => token,
17343                    Err(e) => {
17344                        dlg.finished(false);
17345                        return Err(common::Error::MissingToken(e));
17346                    }
17347                },
17348            };
17349            request_value_reader
17350                .seek(std::io::SeekFrom::Start(0))
17351                .unwrap();
17352            let mut req_result = {
17353                let client = &self.hub.client;
17354                dlg.pre_request();
17355                let mut req_builder = hyper::Request::builder()
17356                    .method(hyper::Method::POST)
17357                    .uri(url.as_str())
17358                    .header(USER_AGENT, self.hub._user_agent.clone());
17359
17360                if let Some(token) = token.as_ref() {
17361                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
17362                }
17363
17364                let request = req_builder
17365                    .header(CONTENT_TYPE, json_mime_type.to_string())
17366                    .header(CONTENT_LENGTH, request_size as u64)
17367                    .body(common::to_body(
17368                        request_value_reader.get_ref().clone().into(),
17369                    ));
17370
17371                client.request(request.unwrap()).await
17372            };
17373
17374            match req_result {
17375                Err(err) => {
17376                    if let common::Retry::After(d) = dlg.http_error(&err) {
17377                        sleep(d).await;
17378                        continue;
17379                    }
17380                    dlg.finished(false);
17381                    return Err(common::Error::HttpError(err));
17382                }
17383                Ok(res) => {
17384                    let (mut parts, body) = res.into_parts();
17385                    let mut body = common::Body::new(body);
17386                    if !parts.status.is_success() {
17387                        let bytes = common::to_bytes(body).await.unwrap_or_default();
17388                        let error = serde_json::from_str(&common::to_string(&bytes));
17389                        let response = common::to_response(parts, bytes.into());
17390
17391                        if let common::Retry::After(d) =
17392                            dlg.http_failure(&response, error.as_ref().ok())
17393                        {
17394                            sleep(d).await;
17395                            continue;
17396                        }
17397
17398                        dlg.finished(false);
17399
17400                        return Err(match error {
17401                            Ok(value) => common::Error::BadRequest(value),
17402                            _ => common::Error::Failure(response),
17403                        });
17404                    }
17405                    let response = {
17406                        let bytes = common::to_bytes(body).await.unwrap_or_default();
17407                        let encoded = common::to_string(&bytes);
17408                        match serde_json::from_str(&encoded) {
17409                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
17410                            Err(error) => {
17411                                dlg.response_json_decode_error(&encoded, &error);
17412                                return Err(common::Error::JsonDecodeError(
17413                                    encoded.to_string(),
17414                                    error,
17415                                ));
17416                            }
17417                        }
17418                    };
17419
17420                    dlg.finished(true);
17421                    return Ok(response);
17422                }
17423            }
17424        }
17425    }
17426
17427    ///
17428    /// Sets the *request* property to the given value.
17429    ///
17430    /// Even though the property as already been set when instantiating this call,
17431    /// we provide this method for API completeness.
17432    pub fn request(
17433        mut self,
17434        new_value: OauthClient,
17435    ) -> ProjectLocationOauthClientCreateCall<'a, C> {
17436        self._request = new_value;
17437        self
17438    }
17439    /// Required. The parent resource to create the OauthClient in. The only supported location is `global`.
17440    ///
17441    /// Sets the *parent* path property to the given value.
17442    ///
17443    /// Even though the property as already been set when instantiating this call,
17444    /// we provide this method for API completeness.
17445    pub fn parent(mut self, new_value: &str) -> ProjectLocationOauthClientCreateCall<'a, C> {
17446        self._parent = new_value.to_string();
17447        self
17448    }
17449    /// Required. The ID to use for the OauthClient, which becomes the final component of the resource name. This value should be a string of 6 to 63 lowercase letters, digits, or hyphens. It must start with a letter, and cannot have a trailing hyphen. The prefix `gcp-` is reserved for use by Google, and may not be specified.
17450    ///
17451    /// Sets the *oauth client id* query property to the given value.
17452    pub fn oauth_client_id(
17453        mut self,
17454        new_value: &str,
17455    ) -> ProjectLocationOauthClientCreateCall<'a, C> {
17456        self._oauth_client_id = Some(new_value.to_string());
17457        self
17458    }
17459    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
17460    /// while executing the actual API request.
17461    ///
17462    /// ````text
17463    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
17464    /// ````
17465    ///
17466    /// Sets the *delegate* property to the given value.
17467    pub fn delegate(
17468        mut self,
17469        new_value: &'a mut dyn common::Delegate,
17470    ) -> ProjectLocationOauthClientCreateCall<'a, C> {
17471        self._delegate = Some(new_value);
17472        self
17473    }
17474
17475    /// Set any additional parameter of the query string used in the request.
17476    /// It should be used to set parameters which are not yet available through their own
17477    /// setters.
17478    ///
17479    /// Please note that this method must not be used to set any of the known parameters
17480    /// which have their own setter method. If done anyway, the request will fail.
17481    ///
17482    /// # Additional Parameters
17483    ///
17484    /// * *$.xgafv* (query-string) - V1 error format.
17485    /// * *access_token* (query-string) - OAuth access token.
17486    /// * *alt* (query-string) - Data format for response.
17487    /// * *callback* (query-string) - JSONP
17488    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
17489    /// * *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.
17490    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
17491    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
17492    /// * *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.
17493    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
17494    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
17495    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationOauthClientCreateCall<'a, C>
17496    where
17497        T: AsRef<str>,
17498    {
17499        self._additional_params
17500            .insert(name.as_ref().to_string(), value.as_ref().to_string());
17501        self
17502    }
17503
17504    /// Identifies the authorization scope for the method you are building.
17505    ///
17506    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
17507    /// [`Scope::CloudPlatform`].
17508    ///
17509    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
17510    /// tokens for more than one scope.
17511    ///
17512    /// Usually there is more than one suitable scope to authorize an operation, some of which may
17513    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
17514    /// sufficient, a read-write scope will do as well.
17515    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationOauthClientCreateCall<'a, C>
17516    where
17517        St: AsRef<str>,
17518    {
17519        self._scopes.insert(String::from(scope.as_ref()));
17520        self
17521    }
17522    /// Identifies the authorization scope(s) for the method you are building.
17523    ///
17524    /// See [`Self::add_scope()`] for details.
17525    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationOauthClientCreateCall<'a, C>
17526    where
17527        I: IntoIterator<Item = St>,
17528        St: AsRef<str>,
17529    {
17530        self._scopes
17531            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
17532        self
17533    }
17534
17535    /// Removes all scopes, and no default scope will be used either.
17536    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
17537    /// for details).
17538    pub fn clear_scopes(mut self) -> ProjectLocationOauthClientCreateCall<'a, C> {
17539        self._scopes.clear();
17540        self
17541    }
17542}
17543
17544/// Deletes an OauthClient. You cannot use a deleted OauthClient. However, deletion does not revoke access tokens that have already been issued. They continue to grant access. Deletion does revoke refresh tokens that have already been issued. They cannot be used to renew an access token. If the OauthClient is undeleted, and the refresh tokens are not expired, they are valid for token exchange again. You can undelete an OauthClient for 30 days. After 30 days, deletion is permanent. You cannot update deleted OauthClients. However, you can view and list them.
17545///
17546/// A builder for the *locations.oauthClients.delete* method supported by a *project* resource.
17547/// It is not used directly, but through a [`ProjectMethods`] instance.
17548///
17549/// # Example
17550///
17551/// Instantiate a resource method builder
17552///
17553/// ```test_harness,no_run
17554/// # extern crate hyper;
17555/// # extern crate hyper_rustls;
17556/// # extern crate google_iam1 as iam1;
17557/// # async fn dox() {
17558/// # use iam1::{Iam, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
17559///
17560/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
17561/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
17562/// #     secret,
17563/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
17564/// # ).build().await.unwrap();
17565///
17566/// # let client = hyper_util::client::legacy::Client::builder(
17567/// #     hyper_util::rt::TokioExecutor::new()
17568/// # )
17569/// # .build(
17570/// #     hyper_rustls::HttpsConnectorBuilder::new()
17571/// #         .with_native_roots()
17572/// #         .unwrap()
17573/// #         .https_or_http()
17574/// #         .enable_http1()
17575/// #         .build()
17576/// # );
17577/// # let mut hub = Iam::new(client, auth);
17578/// // You can configure optional parameters by calling the respective setters at will, and
17579/// // execute the final call using `doit()`.
17580/// // Values shown here are possibly random and not representative !
17581/// let result = hub.projects().locations_oauth_clients_delete("name")
17582///              .doit().await;
17583/// # }
17584/// ```
17585pub struct ProjectLocationOauthClientDeleteCall<'a, C>
17586where
17587    C: 'a,
17588{
17589    hub: &'a Iam<C>,
17590    _name: String,
17591    _delegate: Option<&'a mut dyn common::Delegate>,
17592    _additional_params: HashMap<String, String>,
17593    _scopes: BTreeSet<String>,
17594}
17595
17596impl<'a, C> common::CallBuilder for ProjectLocationOauthClientDeleteCall<'a, C> {}
17597
17598impl<'a, C> ProjectLocationOauthClientDeleteCall<'a, C>
17599where
17600    C: common::Connector,
17601{
17602    /// Perform the operation you have build so far.
17603    pub async fn doit(mut self) -> common::Result<(common::Response, OauthClient)> {
17604        use std::borrow::Cow;
17605        use std::io::{Read, Seek};
17606
17607        use common::{url::Params, ToParts};
17608        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
17609
17610        let mut dd = common::DefaultDelegate;
17611        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
17612        dlg.begin(common::MethodInfo {
17613            id: "iam.projects.locations.oauthClients.delete",
17614            http_method: hyper::Method::DELETE,
17615        });
17616
17617        for &field in ["alt", "name"].iter() {
17618            if self._additional_params.contains_key(field) {
17619                dlg.finished(false);
17620                return Err(common::Error::FieldClash(field));
17621            }
17622        }
17623
17624        let mut params = Params::with_capacity(3 + self._additional_params.len());
17625        params.push("name", self._name);
17626
17627        params.extend(self._additional_params.iter());
17628
17629        params.push("alt", "json");
17630        let mut url = self.hub._base_url.clone() + "v1/{+name}";
17631        if self._scopes.is_empty() {
17632            self._scopes
17633                .insert(Scope::CloudPlatform.as_ref().to_string());
17634        }
17635
17636        #[allow(clippy::single_element_loop)]
17637        for &(find_this, param_name) in [("{+name}", "name")].iter() {
17638            url = params.uri_replacement(url, param_name, find_this, true);
17639        }
17640        {
17641            let to_remove = ["name"];
17642            params.remove_params(&to_remove);
17643        }
17644
17645        let url = params.parse_with_url(&url);
17646
17647        loop {
17648            let token = match self
17649                .hub
17650                .auth
17651                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
17652                .await
17653            {
17654                Ok(token) => token,
17655                Err(e) => match dlg.token(e) {
17656                    Ok(token) => token,
17657                    Err(e) => {
17658                        dlg.finished(false);
17659                        return Err(common::Error::MissingToken(e));
17660                    }
17661                },
17662            };
17663            let mut req_result = {
17664                let client = &self.hub.client;
17665                dlg.pre_request();
17666                let mut req_builder = hyper::Request::builder()
17667                    .method(hyper::Method::DELETE)
17668                    .uri(url.as_str())
17669                    .header(USER_AGENT, self.hub._user_agent.clone());
17670
17671                if let Some(token) = token.as_ref() {
17672                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
17673                }
17674
17675                let request = req_builder
17676                    .header(CONTENT_LENGTH, 0_u64)
17677                    .body(common::to_body::<String>(None));
17678
17679                client.request(request.unwrap()).await
17680            };
17681
17682            match req_result {
17683                Err(err) => {
17684                    if let common::Retry::After(d) = dlg.http_error(&err) {
17685                        sleep(d).await;
17686                        continue;
17687                    }
17688                    dlg.finished(false);
17689                    return Err(common::Error::HttpError(err));
17690                }
17691                Ok(res) => {
17692                    let (mut parts, body) = res.into_parts();
17693                    let mut body = common::Body::new(body);
17694                    if !parts.status.is_success() {
17695                        let bytes = common::to_bytes(body).await.unwrap_or_default();
17696                        let error = serde_json::from_str(&common::to_string(&bytes));
17697                        let response = common::to_response(parts, bytes.into());
17698
17699                        if let common::Retry::After(d) =
17700                            dlg.http_failure(&response, error.as_ref().ok())
17701                        {
17702                            sleep(d).await;
17703                            continue;
17704                        }
17705
17706                        dlg.finished(false);
17707
17708                        return Err(match error {
17709                            Ok(value) => common::Error::BadRequest(value),
17710                            _ => common::Error::Failure(response),
17711                        });
17712                    }
17713                    let response = {
17714                        let bytes = common::to_bytes(body).await.unwrap_or_default();
17715                        let encoded = common::to_string(&bytes);
17716                        match serde_json::from_str(&encoded) {
17717                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
17718                            Err(error) => {
17719                                dlg.response_json_decode_error(&encoded, &error);
17720                                return Err(common::Error::JsonDecodeError(
17721                                    encoded.to_string(),
17722                                    error,
17723                                ));
17724                            }
17725                        }
17726                    };
17727
17728                    dlg.finished(true);
17729                    return Ok(response);
17730                }
17731            }
17732        }
17733    }
17734
17735    /// Required. The name of the OauthClient to delete. Format: `projects/{project}/locations/{location}/oauthClients/{oauth_client}`.
17736    ///
17737    /// Sets the *name* path property to the given value.
17738    ///
17739    /// Even though the property as already been set when instantiating this call,
17740    /// we provide this method for API completeness.
17741    pub fn name(mut self, new_value: &str) -> ProjectLocationOauthClientDeleteCall<'a, C> {
17742        self._name = new_value.to_string();
17743        self
17744    }
17745    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
17746    /// while executing the actual API request.
17747    ///
17748    /// ````text
17749    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
17750    /// ````
17751    ///
17752    /// Sets the *delegate* property to the given value.
17753    pub fn delegate(
17754        mut self,
17755        new_value: &'a mut dyn common::Delegate,
17756    ) -> ProjectLocationOauthClientDeleteCall<'a, C> {
17757        self._delegate = Some(new_value);
17758        self
17759    }
17760
17761    /// Set any additional parameter of the query string used in the request.
17762    /// It should be used to set parameters which are not yet available through their own
17763    /// setters.
17764    ///
17765    /// Please note that this method must not be used to set any of the known parameters
17766    /// which have their own setter method. If done anyway, the request will fail.
17767    ///
17768    /// # Additional Parameters
17769    ///
17770    /// * *$.xgafv* (query-string) - V1 error format.
17771    /// * *access_token* (query-string) - OAuth access token.
17772    /// * *alt* (query-string) - Data format for response.
17773    /// * *callback* (query-string) - JSONP
17774    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
17775    /// * *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.
17776    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
17777    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
17778    /// * *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.
17779    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
17780    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
17781    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationOauthClientDeleteCall<'a, C>
17782    where
17783        T: AsRef<str>,
17784    {
17785        self._additional_params
17786            .insert(name.as_ref().to_string(), value.as_ref().to_string());
17787        self
17788    }
17789
17790    /// Identifies the authorization scope for the method you are building.
17791    ///
17792    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
17793    /// [`Scope::CloudPlatform`].
17794    ///
17795    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
17796    /// tokens for more than one scope.
17797    ///
17798    /// Usually there is more than one suitable scope to authorize an operation, some of which may
17799    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
17800    /// sufficient, a read-write scope will do as well.
17801    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationOauthClientDeleteCall<'a, C>
17802    where
17803        St: AsRef<str>,
17804    {
17805        self._scopes.insert(String::from(scope.as_ref()));
17806        self
17807    }
17808    /// Identifies the authorization scope(s) for the method you are building.
17809    ///
17810    /// See [`Self::add_scope()`] for details.
17811    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationOauthClientDeleteCall<'a, C>
17812    where
17813        I: IntoIterator<Item = St>,
17814        St: AsRef<str>,
17815    {
17816        self._scopes
17817            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
17818        self
17819    }
17820
17821    /// Removes all scopes, and no default scope will be used either.
17822    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
17823    /// for details).
17824    pub fn clear_scopes(mut self) -> ProjectLocationOauthClientDeleteCall<'a, C> {
17825        self._scopes.clear();
17826        self
17827    }
17828}
17829
17830/// Gets an individual OauthClient.
17831///
17832/// A builder for the *locations.oauthClients.get* method supported by a *project* resource.
17833/// It is not used directly, but through a [`ProjectMethods`] instance.
17834///
17835/// # Example
17836///
17837/// Instantiate a resource method builder
17838///
17839/// ```test_harness,no_run
17840/// # extern crate hyper;
17841/// # extern crate hyper_rustls;
17842/// # extern crate google_iam1 as iam1;
17843/// # async fn dox() {
17844/// # use iam1::{Iam, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
17845///
17846/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
17847/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
17848/// #     secret,
17849/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
17850/// # ).build().await.unwrap();
17851///
17852/// # let client = hyper_util::client::legacy::Client::builder(
17853/// #     hyper_util::rt::TokioExecutor::new()
17854/// # )
17855/// # .build(
17856/// #     hyper_rustls::HttpsConnectorBuilder::new()
17857/// #         .with_native_roots()
17858/// #         .unwrap()
17859/// #         .https_or_http()
17860/// #         .enable_http1()
17861/// #         .build()
17862/// # );
17863/// # let mut hub = Iam::new(client, auth);
17864/// // You can configure optional parameters by calling the respective setters at will, and
17865/// // execute the final call using `doit()`.
17866/// // Values shown here are possibly random and not representative !
17867/// let result = hub.projects().locations_oauth_clients_get("name")
17868///              .doit().await;
17869/// # }
17870/// ```
17871pub struct ProjectLocationOauthClientGetCall<'a, C>
17872where
17873    C: 'a,
17874{
17875    hub: &'a Iam<C>,
17876    _name: String,
17877    _delegate: Option<&'a mut dyn common::Delegate>,
17878    _additional_params: HashMap<String, String>,
17879    _scopes: BTreeSet<String>,
17880}
17881
17882impl<'a, C> common::CallBuilder for ProjectLocationOauthClientGetCall<'a, C> {}
17883
17884impl<'a, C> ProjectLocationOauthClientGetCall<'a, C>
17885where
17886    C: common::Connector,
17887{
17888    /// Perform the operation you have build so far.
17889    pub async fn doit(mut self) -> common::Result<(common::Response, OauthClient)> {
17890        use std::borrow::Cow;
17891        use std::io::{Read, Seek};
17892
17893        use common::{url::Params, ToParts};
17894        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
17895
17896        let mut dd = common::DefaultDelegate;
17897        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
17898        dlg.begin(common::MethodInfo {
17899            id: "iam.projects.locations.oauthClients.get",
17900            http_method: hyper::Method::GET,
17901        });
17902
17903        for &field in ["alt", "name"].iter() {
17904            if self._additional_params.contains_key(field) {
17905                dlg.finished(false);
17906                return Err(common::Error::FieldClash(field));
17907            }
17908        }
17909
17910        let mut params = Params::with_capacity(3 + self._additional_params.len());
17911        params.push("name", self._name);
17912
17913        params.extend(self._additional_params.iter());
17914
17915        params.push("alt", "json");
17916        let mut url = self.hub._base_url.clone() + "v1/{+name}";
17917        if self._scopes.is_empty() {
17918            self._scopes
17919                .insert(Scope::CloudPlatform.as_ref().to_string());
17920        }
17921
17922        #[allow(clippy::single_element_loop)]
17923        for &(find_this, param_name) in [("{+name}", "name")].iter() {
17924            url = params.uri_replacement(url, param_name, find_this, true);
17925        }
17926        {
17927            let to_remove = ["name"];
17928            params.remove_params(&to_remove);
17929        }
17930
17931        let url = params.parse_with_url(&url);
17932
17933        loop {
17934            let token = match self
17935                .hub
17936                .auth
17937                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
17938                .await
17939            {
17940                Ok(token) => token,
17941                Err(e) => match dlg.token(e) {
17942                    Ok(token) => token,
17943                    Err(e) => {
17944                        dlg.finished(false);
17945                        return Err(common::Error::MissingToken(e));
17946                    }
17947                },
17948            };
17949            let mut req_result = {
17950                let client = &self.hub.client;
17951                dlg.pre_request();
17952                let mut req_builder = hyper::Request::builder()
17953                    .method(hyper::Method::GET)
17954                    .uri(url.as_str())
17955                    .header(USER_AGENT, self.hub._user_agent.clone());
17956
17957                if let Some(token) = token.as_ref() {
17958                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
17959                }
17960
17961                let request = req_builder
17962                    .header(CONTENT_LENGTH, 0_u64)
17963                    .body(common::to_body::<String>(None));
17964
17965                client.request(request.unwrap()).await
17966            };
17967
17968            match req_result {
17969                Err(err) => {
17970                    if let common::Retry::After(d) = dlg.http_error(&err) {
17971                        sleep(d).await;
17972                        continue;
17973                    }
17974                    dlg.finished(false);
17975                    return Err(common::Error::HttpError(err));
17976                }
17977                Ok(res) => {
17978                    let (mut parts, body) = res.into_parts();
17979                    let mut body = common::Body::new(body);
17980                    if !parts.status.is_success() {
17981                        let bytes = common::to_bytes(body).await.unwrap_or_default();
17982                        let error = serde_json::from_str(&common::to_string(&bytes));
17983                        let response = common::to_response(parts, bytes.into());
17984
17985                        if let common::Retry::After(d) =
17986                            dlg.http_failure(&response, error.as_ref().ok())
17987                        {
17988                            sleep(d).await;
17989                            continue;
17990                        }
17991
17992                        dlg.finished(false);
17993
17994                        return Err(match error {
17995                            Ok(value) => common::Error::BadRequest(value),
17996                            _ => common::Error::Failure(response),
17997                        });
17998                    }
17999                    let response = {
18000                        let bytes = common::to_bytes(body).await.unwrap_or_default();
18001                        let encoded = common::to_string(&bytes);
18002                        match serde_json::from_str(&encoded) {
18003                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
18004                            Err(error) => {
18005                                dlg.response_json_decode_error(&encoded, &error);
18006                                return Err(common::Error::JsonDecodeError(
18007                                    encoded.to_string(),
18008                                    error,
18009                                ));
18010                            }
18011                        }
18012                    };
18013
18014                    dlg.finished(true);
18015                    return Ok(response);
18016                }
18017            }
18018        }
18019    }
18020
18021    /// Required. The name of the OauthClient to retrieve. Format: `projects/{project}/locations/{location}/oauthClients/{oauth_client}`.
18022    ///
18023    /// Sets the *name* path property to the given value.
18024    ///
18025    /// Even though the property as already been set when instantiating this call,
18026    /// we provide this method for API completeness.
18027    pub fn name(mut self, new_value: &str) -> ProjectLocationOauthClientGetCall<'a, C> {
18028        self._name = new_value.to_string();
18029        self
18030    }
18031    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
18032    /// while executing the actual API request.
18033    ///
18034    /// ````text
18035    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
18036    /// ````
18037    ///
18038    /// Sets the *delegate* property to the given value.
18039    pub fn delegate(
18040        mut self,
18041        new_value: &'a mut dyn common::Delegate,
18042    ) -> ProjectLocationOauthClientGetCall<'a, C> {
18043        self._delegate = Some(new_value);
18044        self
18045    }
18046
18047    /// Set any additional parameter of the query string used in the request.
18048    /// It should be used to set parameters which are not yet available through their own
18049    /// setters.
18050    ///
18051    /// Please note that this method must not be used to set any of the known parameters
18052    /// which have their own setter method. If done anyway, the request will fail.
18053    ///
18054    /// # Additional Parameters
18055    ///
18056    /// * *$.xgafv* (query-string) - V1 error format.
18057    /// * *access_token* (query-string) - OAuth access token.
18058    /// * *alt* (query-string) - Data format for response.
18059    /// * *callback* (query-string) - JSONP
18060    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
18061    /// * *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.
18062    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
18063    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
18064    /// * *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.
18065    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
18066    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
18067    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationOauthClientGetCall<'a, C>
18068    where
18069        T: AsRef<str>,
18070    {
18071        self._additional_params
18072            .insert(name.as_ref().to_string(), value.as_ref().to_string());
18073        self
18074    }
18075
18076    /// Identifies the authorization scope for the method you are building.
18077    ///
18078    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
18079    /// [`Scope::CloudPlatform`].
18080    ///
18081    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
18082    /// tokens for more than one scope.
18083    ///
18084    /// Usually there is more than one suitable scope to authorize an operation, some of which may
18085    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
18086    /// sufficient, a read-write scope will do as well.
18087    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationOauthClientGetCall<'a, C>
18088    where
18089        St: AsRef<str>,
18090    {
18091        self._scopes.insert(String::from(scope.as_ref()));
18092        self
18093    }
18094    /// Identifies the authorization scope(s) for the method you are building.
18095    ///
18096    /// See [`Self::add_scope()`] for details.
18097    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationOauthClientGetCall<'a, C>
18098    where
18099        I: IntoIterator<Item = St>,
18100        St: AsRef<str>,
18101    {
18102        self._scopes
18103            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
18104        self
18105    }
18106
18107    /// Removes all scopes, and no default scope will be used either.
18108    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
18109    /// for details).
18110    pub fn clear_scopes(mut self) -> ProjectLocationOauthClientGetCall<'a, C> {
18111        self._scopes.clear();
18112        self
18113    }
18114}
18115
18116/// Lists all non-deleted OauthClients in a project. If `show_deleted` is set to `true`, then deleted OauthClients are also listed.
18117///
18118/// A builder for the *locations.oauthClients.list* method supported by a *project* resource.
18119/// It is not used directly, but through a [`ProjectMethods`] instance.
18120///
18121/// # Example
18122///
18123/// Instantiate a resource method builder
18124///
18125/// ```test_harness,no_run
18126/// # extern crate hyper;
18127/// # extern crate hyper_rustls;
18128/// # extern crate google_iam1 as iam1;
18129/// # async fn dox() {
18130/// # use iam1::{Iam, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
18131///
18132/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
18133/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
18134/// #     secret,
18135/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
18136/// # ).build().await.unwrap();
18137///
18138/// # let client = hyper_util::client::legacy::Client::builder(
18139/// #     hyper_util::rt::TokioExecutor::new()
18140/// # )
18141/// # .build(
18142/// #     hyper_rustls::HttpsConnectorBuilder::new()
18143/// #         .with_native_roots()
18144/// #         .unwrap()
18145/// #         .https_or_http()
18146/// #         .enable_http1()
18147/// #         .build()
18148/// # );
18149/// # let mut hub = Iam::new(client, auth);
18150/// // You can configure optional parameters by calling the respective setters at will, and
18151/// // execute the final call using `doit()`.
18152/// // Values shown here are possibly random and not representative !
18153/// let result = hub.projects().locations_oauth_clients_list("parent")
18154///              .show_deleted(false)
18155///              .page_token("invidunt")
18156///              .page_size(-65)
18157///              .doit().await;
18158/// # }
18159/// ```
18160pub struct ProjectLocationOauthClientListCall<'a, C>
18161where
18162    C: 'a,
18163{
18164    hub: &'a Iam<C>,
18165    _parent: String,
18166    _show_deleted: Option<bool>,
18167    _page_token: Option<String>,
18168    _page_size: Option<i32>,
18169    _delegate: Option<&'a mut dyn common::Delegate>,
18170    _additional_params: HashMap<String, String>,
18171    _scopes: BTreeSet<String>,
18172}
18173
18174impl<'a, C> common::CallBuilder for ProjectLocationOauthClientListCall<'a, C> {}
18175
18176impl<'a, C> ProjectLocationOauthClientListCall<'a, C>
18177where
18178    C: common::Connector,
18179{
18180    /// Perform the operation you have build so far.
18181    pub async fn doit(mut self) -> common::Result<(common::Response, ListOauthClientsResponse)> {
18182        use std::borrow::Cow;
18183        use std::io::{Read, Seek};
18184
18185        use common::{url::Params, ToParts};
18186        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
18187
18188        let mut dd = common::DefaultDelegate;
18189        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
18190        dlg.begin(common::MethodInfo {
18191            id: "iam.projects.locations.oauthClients.list",
18192            http_method: hyper::Method::GET,
18193        });
18194
18195        for &field in ["alt", "parent", "showDeleted", "pageToken", "pageSize"].iter() {
18196            if self._additional_params.contains_key(field) {
18197                dlg.finished(false);
18198                return Err(common::Error::FieldClash(field));
18199            }
18200        }
18201
18202        let mut params = Params::with_capacity(6 + self._additional_params.len());
18203        params.push("parent", self._parent);
18204        if let Some(value) = self._show_deleted.as_ref() {
18205            params.push("showDeleted", value.to_string());
18206        }
18207        if let Some(value) = self._page_token.as_ref() {
18208            params.push("pageToken", value);
18209        }
18210        if let Some(value) = self._page_size.as_ref() {
18211            params.push("pageSize", value.to_string());
18212        }
18213
18214        params.extend(self._additional_params.iter());
18215
18216        params.push("alt", "json");
18217        let mut url = self.hub._base_url.clone() + "v1/{+parent}/oauthClients";
18218        if self._scopes.is_empty() {
18219            self._scopes
18220                .insert(Scope::CloudPlatform.as_ref().to_string());
18221        }
18222
18223        #[allow(clippy::single_element_loop)]
18224        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
18225            url = params.uri_replacement(url, param_name, find_this, true);
18226        }
18227        {
18228            let to_remove = ["parent"];
18229            params.remove_params(&to_remove);
18230        }
18231
18232        let url = params.parse_with_url(&url);
18233
18234        loop {
18235            let token = match self
18236                .hub
18237                .auth
18238                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
18239                .await
18240            {
18241                Ok(token) => token,
18242                Err(e) => match dlg.token(e) {
18243                    Ok(token) => token,
18244                    Err(e) => {
18245                        dlg.finished(false);
18246                        return Err(common::Error::MissingToken(e));
18247                    }
18248                },
18249            };
18250            let mut req_result = {
18251                let client = &self.hub.client;
18252                dlg.pre_request();
18253                let mut req_builder = hyper::Request::builder()
18254                    .method(hyper::Method::GET)
18255                    .uri(url.as_str())
18256                    .header(USER_AGENT, self.hub._user_agent.clone());
18257
18258                if let Some(token) = token.as_ref() {
18259                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
18260                }
18261
18262                let request = req_builder
18263                    .header(CONTENT_LENGTH, 0_u64)
18264                    .body(common::to_body::<String>(None));
18265
18266                client.request(request.unwrap()).await
18267            };
18268
18269            match req_result {
18270                Err(err) => {
18271                    if let common::Retry::After(d) = dlg.http_error(&err) {
18272                        sleep(d).await;
18273                        continue;
18274                    }
18275                    dlg.finished(false);
18276                    return Err(common::Error::HttpError(err));
18277                }
18278                Ok(res) => {
18279                    let (mut parts, body) = res.into_parts();
18280                    let mut body = common::Body::new(body);
18281                    if !parts.status.is_success() {
18282                        let bytes = common::to_bytes(body).await.unwrap_or_default();
18283                        let error = serde_json::from_str(&common::to_string(&bytes));
18284                        let response = common::to_response(parts, bytes.into());
18285
18286                        if let common::Retry::After(d) =
18287                            dlg.http_failure(&response, error.as_ref().ok())
18288                        {
18289                            sleep(d).await;
18290                            continue;
18291                        }
18292
18293                        dlg.finished(false);
18294
18295                        return Err(match error {
18296                            Ok(value) => common::Error::BadRequest(value),
18297                            _ => common::Error::Failure(response),
18298                        });
18299                    }
18300                    let response = {
18301                        let bytes = common::to_bytes(body).await.unwrap_or_default();
18302                        let encoded = common::to_string(&bytes);
18303                        match serde_json::from_str(&encoded) {
18304                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
18305                            Err(error) => {
18306                                dlg.response_json_decode_error(&encoded, &error);
18307                                return Err(common::Error::JsonDecodeError(
18308                                    encoded.to_string(),
18309                                    error,
18310                                ));
18311                            }
18312                        }
18313                    };
18314
18315                    dlg.finished(true);
18316                    return Ok(response);
18317                }
18318            }
18319        }
18320    }
18321
18322    /// Required. The parent to list OauthClients for.
18323    ///
18324    /// Sets the *parent* path property to the given value.
18325    ///
18326    /// Even though the property as already been set when instantiating this call,
18327    /// we provide this method for API completeness.
18328    pub fn parent(mut self, new_value: &str) -> ProjectLocationOauthClientListCall<'a, C> {
18329        self._parent = new_value.to_string();
18330        self
18331    }
18332    /// Optional. Whether to return soft-deleted OauthClients.
18333    ///
18334    /// Sets the *show deleted* query property to the given value.
18335    pub fn show_deleted(mut self, new_value: bool) -> ProjectLocationOauthClientListCall<'a, C> {
18336        self._show_deleted = Some(new_value);
18337        self
18338    }
18339    /// Optional. A page token, received from a previous `ListOauthClients` call. Provide this to retrieve the subsequent page.
18340    ///
18341    /// Sets the *page token* query property to the given value.
18342    pub fn page_token(mut self, new_value: &str) -> ProjectLocationOauthClientListCall<'a, C> {
18343        self._page_token = Some(new_value.to_string());
18344        self
18345    }
18346    /// Optional. The maximum number of OauthClients to return. If unspecified, at most 50 OauthClients will be returned. The maximum value is 100; values above 100 are truncated to 100.
18347    ///
18348    /// Sets the *page size* query property to the given value.
18349    pub fn page_size(mut self, new_value: i32) -> ProjectLocationOauthClientListCall<'a, C> {
18350        self._page_size = Some(new_value);
18351        self
18352    }
18353    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
18354    /// while executing the actual API request.
18355    ///
18356    /// ````text
18357    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
18358    /// ````
18359    ///
18360    /// Sets the *delegate* property to the given value.
18361    pub fn delegate(
18362        mut self,
18363        new_value: &'a mut dyn common::Delegate,
18364    ) -> ProjectLocationOauthClientListCall<'a, C> {
18365        self._delegate = Some(new_value);
18366        self
18367    }
18368
18369    /// Set any additional parameter of the query string used in the request.
18370    /// It should be used to set parameters which are not yet available through their own
18371    /// setters.
18372    ///
18373    /// Please note that this method must not be used to set any of the known parameters
18374    /// which have their own setter method. If done anyway, the request will fail.
18375    ///
18376    /// # Additional Parameters
18377    ///
18378    /// * *$.xgafv* (query-string) - V1 error format.
18379    /// * *access_token* (query-string) - OAuth access token.
18380    /// * *alt* (query-string) - Data format for response.
18381    /// * *callback* (query-string) - JSONP
18382    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
18383    /// * *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.
18384    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
18385    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
18386    /// * *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.
18387    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
18388    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
18389    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationOauthClientListCall<'a, C>
18390    where
18391        T: AsRef<str>,
18392    {
18393        self._additional_params
18394            .insert(name.as_ref().to_string(), value.as_ref().to_string());
18395        self
18396    }
18397
18398    /// Identifies the authorization scope for the method you are building.
18399    ///
18400    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
18401    /// [`Scope::CloudPlatform`].
18402    ///
18403    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
18404    /// tokens for more than one scope.
18405    ///
18406    /// Usually there is more than one suitable scope to authorize an operation, some of which may
18407    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
18408    /// sufficient, a read-write scope will do as well.
18409    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationOauthClientListCall<'a, C>
18410    where
18411        St: AsRef<str>,
18412    {
18413        self._scopes.insert(String::from(scope.as_ref()));
18414        self
18415    }
18416    /// Identifies the authorization scope(s) for the method you are building.
18417    ///
18418    /// See [`Self::add_scope()`] for details.
18419    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationOauthClientListCall<'a, C>
18420    where
18421        I: IntoIterator<Item = St>,
18422        St: AsRef<str>,
18423    {
18424        self._scopes
18425            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
18426        self
18427    }
18428
18429    /// Removes all scopes, and no default scope will be used either.
18430    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
18431    /// for details).
18432    pub fn clear_scopes(mut self) -> ProjectLocationOauthClientListCall<'a, C> {
18433        self._scopes.clear();
18434        self
18435    }
18436}
18437
18438/// Updates an existing OauthClient.
18439///
18440/// A builder for the *locations.oauthClients.patch* method supported by a *project* resource.
18441/// It is not used directly, but through a [`ProjectMethods`] instance.
18442///
18443/// # Example
18444///
18445/// Instantiate a resource method builder
18446///
18447/// ```test_harness,no_run
18448/// # extern crate hyper;
18449/// # extern crate hyper_rustls;
18450/// # extern crate google_iam1 as iam1;
18451/// use iam1::api::OauthClient;
18452/// # async fn dox() {
18453/// # use iam1::{Iam, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
18454///
18455/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
18456/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
18457/// #     secret,
18458/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
18459/// # ).build().await.unwrap();
18460///
18461/// # let client = hyper_util::client::legacy::Client::builder(
18462/// #     hyper_util::rt::TokioExecutor::new()
18463/// # )
18464/// # .build(
18465/// #     hyper_rustls::HttpsConnectorBuilder::new()
18466/// #         .with_native_roots()
18467/// #         .unwrap()
18468/// #         .https_or_http()
18469/// #         .enable_http1()
18470/// #         .build()
18471/// # );
18472/// # let mut hub = Iam::new(client, auth);
18473/// // As the method needs a request, you would usually fill it with the desired information
18474/// // into the respective structure. Some of the parts shown here might not be applicable !
18475/// // Values shown here are possibly random and not representative !
18476/// let mut req = OauthClient::default();
18477///
18478/// // You can configure optional parameters by calling the respective setters at will, and
18479/// // execute the final call using `doit()`.
18480/// // Values shown here are possibly random and not representative !
18481/// let result = hub.projects().locations_oauth_clients_patch(req, "name")
18482///              .update_mask(FieldMask::new::<&str>(&[]))
18483///              .doit().await;
18484/// # }
18485/// ```
18486pub struct ProjectLocationOauthClientPatchCall<'a, C>
18487where
18488    C: 'a,
18489{
18490    hub: &'a Iam<C>,
18491    _request: OauthClient,
18492    _name: String,
18493    _update_mask: Option<common::FieldMask>,
18494    _delegate: Option<&'a mut dyn common::Delegate>,
18495    _additional_params: HashMap<String, String>,
18496    _scopes: BTreeSet<String>,
18497}
18498
18499impl<'a, C> common::CallBuilder for ProjectLocationOauthClientPatchCall<'a, C> {}
18500
18501impl<'a, C> ProjectLocationOauthClientPatchCall<'a, C>
18502where
18503    C: common::Connector,
18504{
18505    /// Perform the operation you have build so far.
18506    pub async fn doit(mut self) -> common::Result<(common::Response, OauthClient)> {
18507        use std::borrow::Cow;
18508        use std::io::{Read, Seek};
18509
18510        use common::{url::Params, ToParts};
18511        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
18512
18513        let mut dd = common::DefaultDelegate;
18514        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
18515        dlg.begin(common::MethodInfo {
18516            id: "iam.projects.locations.oauthClients.patch",
18517            http_method: hyper::Method::PATCH,
18518        });
18519
18520        for &field in ["alt", "name", "updateMask"].iter() {
18521            if self._additional_params.contains_key(field) {
18522                dlg.finished(false);
18523                return Err(common::Error::FieldClash(field));
18524            }
18525        }
18526
18527        let mut params = Params::with_capacity(5 + self._additional_params.len());
18528        params.push("name", self._name);
18529        if let Some(value) = self._update_mask.as_ref() {
18530            params.push("updateMask", value.to_string());
18531        }
18532
18533        params.extend(self._additional_params.iter());
18534
18535        params.push("alt", "json");
18536        let mut url = self.hub._base_url.clone() + "v1/{+name}";
18537        if self._scopes.is_empty() {
18538            self._scopes
18539                .insert(Scope::CloudPlatform.as_ref().to_string());
18540        }
18541
18542        #[allow(clippy::single_element_loop)]
18543        for &(find_this, param_name) in [("{+name}", "name")].iter() {
18544            url = params.uri_replacement(url, param_name, find_this, true);
18545        }
18546        {
18547            let to_remove = ["name"];
18548            params.remove_params(&to_remove);
18549        }
18550
18551        let url = params.parse_with_url(&url);
18552
18553        let mut json_mime_type = mime::APPLICATION_JSON;
18554        let mut request_value_reader = {
18555            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
18556            common::remove_json_null_values(&mut value);
18557            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
18558            serde_json::to_writer(&mut dst, &value).unwrap();
18559            dst
18560        };
18561        let request_size = request_value_reader
18562            .seek(std::io::SeekFrom::End(0))
18563            .unwrap();
18564        request_value_reader
18565            .seek(std::io::SeekFrom::Start(0))
18566            .unwrap();
18567
18568        loop {
18569            let token = match self
18570                .hub
18571                .auth
18572                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
18573                .await
18574            {
18575                Ok(token) => token,
18576                Err(e) => match dlg.token(e) {
18577                    Ok(token) => token,
18578                    Err(e) => {
18579                        dlg.finished(false);
18580                        return Err(common::Error::MissingToken(e));
18581                    }
18582                },
18583            };
18584            request_value_reader
18585                .seek(std::io::SeekFrom::Start(0))
18586                .unwrap();
18587            let mut req_result = {
18588                let client = &self.hub.client;
18589                dlg.pre_request();
18590                let mut req_builder = hyper::Request::builder()
18591                    .method(hyper::Method::PATCH)
18592                    .uri(url.as_str())
18593                    .header(USER_AGENT, self.hub._user_agent.clone());
18594
18595                if let Some(token) = token.as_ref() {
18596                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
18597                }
18598
18599                let request = req_builder
18600                    .header(CONTENT_TYPE, json_mime_type.to_string())
18601                    .header(CONTENT_LENGTH, request_size as u64)
18602                    .body(common::to_body(
18603                        request_value_reader.get_ref().clone().into(),
18604                    ));
18605
18606                client.request(request.unwrap()).await
18607            };
18608
18609            match req_result {
18610                Err(err) => {
18611                    if let common::Retry::After(d) = dlg.http_error(&err) {
18612                        sleep(d).await;
18613                        continue;
18614                    }
18615                    dlg.finished(false);
18616                    return Err(common::Error::HttpError(err));
18617                }
18618                Ok(res) => {
18619                    let (mut parts, body) = res.into_parts();
18620                    let mut body = common::Body::new(body);
18621                    if !parts.status.is_success() {
18622                        let bytes = common::to_bytes(body).await.unwrap_or_default();
18623                        let error = serde_json::from_str(&common::to_string(&bytes));
18624                        let response = common::to_response(parts, bytes.into());
18625
18626                        if let common::Retry::After(d) =
18627                            dlg.http_failure(&response, error.as_ref().ok())
18628                        {
18629                            sleep(d).await;
18630                            continue;
18631                        }
18632
18633                        dlg.finished(false);
18634
18635                        return Err(match error {
18636                            Ok(value) => common::Error::BadRequest(value),
18637                            _ => common::Error::Failure(response),
18638                        });
18639                    }
18640                    let response = {
18641                        let bytes = common::to_bytes(body).await.unwrap_or_default();
18642                        let encoded = common::to_string(&bytes);
18643                        match serde_json::from_str(&encoded) {
18644                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
18645                            Err(error) => {
18646                                dlg.response_json_decode_error(&encoded, &error);
18647                                return Err(common::Error::JsonDecodeError(
18648                                    encoded.to_string(),
18649                                    error,
18650                                ));
18651                            }
18652                        }
18653                    };
18654
18655                    dlg.finished(true);
18656                    return Ok(response);
18657                }
18658            }
18659        }
18660    }
18661
18662    ///
18663    /// Sets the *request* property to the given value.
18664    ///
18665    /// Even though the property as already been set when instantiating this call,
18666    /// we provide this method for API completeness.
18667    pub fn request(mut self, new_value: OauthClient) -> ProjectLocationOauthClientPatchCall<'a, C> {
18668        self._request = new_value;
18669        self
18670    }
18671    /// Immutable. The resource name of the OauthClient. Format:`projects/{project}/locations/{location}/oauthClients/{oauth_client}`.
18672    ///
18673    /// Sets the *name* path property to the given value.
18674    ///
18675    /// Even though the property as already been set when instantiating this call,
18676    /// we provide this method for API completeness.
18677    pub fn name(mut self, new_value: &str) -> ProjectLocationOauthClientPatchCall<'a, C> {
18678        self._name = new_value.to_string();
18679        self
18680    }
18681    /// Required. The list of fields to update.
18682    ///
18683    /// Sets the *update mask* query property to the given value.
18684    pub fn update_mask(
18685        mut self,
18686        new_value: common::FieldMask,
18687    ) -> ProjectLocationOauthClientPatchCall<'a, C> {
18688        self._update_mask = Some(new_value);
18689        self
18690    }
18691    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
18692    /// while executing the actual API request.
18693    ///
18694    /// ````text
18695    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
18696    /// ````
18697    ///
18698    /// Sets the *delegate* property to the given value.
18699    pub fn delegate(
18700        mut self,
18701        new_value: &'a mut dyn common::Delegate,
18702    ) -> ProjectLocationOauthClientPatchCall<'a, C> {
18703        self._delegate = Some(new_value);
18704        self
18705    }
18706
18707    /// Set any additional parameter of the query string used in the request.
18708    /// It should be used to set parameters which are not yet available through their own
18709    /// setters.
18710    ///
18711    /// Please note that this method must not be used to set any of the known parameters
18712    /// which have their own setter method. If done anyway, the request will fail.
18713    ///
18714    /// # Additional Parameters
18715    ///
18716    /// * *$.xgafv* (query-string) - V1 error format.
18717    /// * *access_token* (query-string) - OAuth access token.
18718    /// * *alt* (query-string) - Data format for response.
18719    /// * *callback* (query-string) - JSONP
18720    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
18721    /// * *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.
18722    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
18723    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
18724    /// * *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.
18725    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
18726    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
18727    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationOauthClientPatchCall<'a, C>
18728    where
18729        T: AsRef<str>,
18730    {
18731        self._additional_params
18732            .insert(name.as_ref().to_string(), value.as_ref().to_string());
18733        self
18734    }
18735
18736    /// Identifies the authorization scope for the method you are building.
18737    ///
18738    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
18739    /// [`Scope::CloudPlatform`].
18740    ///
18741    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
18742    /// tokens for more than one scope.
18743    ///
18744    /// Usually there is more than one suitable scope to authorize an operation, some of which may
18745    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
18746    /// sufficient, a read-write scope will do as well.
18747    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationOauthClientPatchCall<'a, C>
18748    where
18749        St: AsRef<str>,
18750    {
18751        self._scopes.insert(String::from(scope.as_ref()));
18752        self
18753    }
18754    /// Identifies the authorization scope(s) for the method you are building.
18755    ///
18756    /// See [`Self::add_scope()`] for details.
18757    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationOauthClientPatchCall<'a, C>
18758    where
18759        I: IntoIterator<Item = St>,
18760        St: AsRef<str>,
18761    {
18762        self._scopes
18763            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
18764        self
18765    }
18766
18767    /// Removes all scopes, and no default scope will be used either.
18768    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
18769    /// for details).
18770    pub fn clear_scopes(mut self) -> ProjectLocationOauthClientPatchCall<'a, C> {
18771        self._scopes.clear();
18772        self
18773    }
18774}
18775
18776/// Undeletes an OauthClient, as long as it was deleted fewer than 30 days ago.
18777///
18778/// A builder for the *locations.oauthClients.undelete* method supported by a *project* resource.
18779/// It is not used directly, but through a [`ProjectMethods`] instance.
18780///
18781/// # Example
18782///
18783/// Instantiate a resource method builder
18784///
18785/// ```test_harness,no_run
18786/// # extern crate hyper;
18787/// # extern crate hyper_rustls;
18788/// # extern crate google_iam1 as iam1;
18789/// use iam1::api::UndeleteOauthClientRequest;
18790/// # async fn dox() {
18791/// # use iam1::{Iam, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
18792///
18793/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
18794/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
18795/// #     secret,
18796/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
18797/// # ).build().await.unwrap();
18798///
18799/// # let client = hyper_util::client::legacy::Client::builder(
18800/// #     hyper_util::rt::TokioExecutor::new()
18801/// # )
18802/// # .build(
18803/// #     hyper_rustls::HttpsConnectorBuilder::new()
18804/// #         .with_native_roots()
18805/// #         .unwrap()
18806/// #         .https_or_http()
18807/// #         .enable_http1()
18808/// #         .build()
18809/// # );
18810/// # let mut hub = Iam::new(client, auth);
18811/// // As the method needs a request, you would usually fill it with the desired information
18812/// // into the respective structure. Some of the parts shown here might not be applicable !
18813/// // Values shown here are possibly random and not representative !
18814/// let mut req = UndeleteOauthClientRequest::default();
18815///
18816/// // You can configure optional parameters by calling the respective setters at will, and
18817/// // execute the final call using `doit()`.
18818/// // Values shown here are possibly random and not representative !
18819/// let result = hub.projects().locations_oauth_clients_undelete(req, "name")
18820///              .doit().await;
18821/// # }
18822/// ```
18823pub struct ProjectLocationOauthClientUndeleteCall<'a, C>
18824where
18825    C: 'a,
18826{
18827    hub: &'a Iam<C>,
18828    _request: UndeleteOauthClientRequest,
18829    _name: String,
18830    _delegate: Option<&'a mut dyn common::Delegate>,
18831    _additional_params: HashMap<String, String>,
18832    _scopes: BTreeSet<String>,
18833}
18834
18835impl<'a, C> common::CallBuilder for ProjectLocationOauthClientUndeleteCall<'a, C> {}
18836
18837impl<'a, C> ProjectLocationOauthClientUndeleteCall<'a, C>
18838where
18839    C: common::Connector,
18840{
18841    /// Perform the operation you have build so far.
18842    pub async fn doit(mut self) -> common::Result<(common::Response, OauthClient)> {
18843        use std::borrow::Cow;
18844        use std::io::{Read, Seek};
18845
18846        use common::{url::Params, ToParts};
18847        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
18848
18849        let mut dd = common::DefaultDelegate;
18850        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
18851        dlg.begin(common::MethodInfo {
18852            id: "iam.projects.locations.oauthClients.undelete",
18853            http_method: hyper::Method::POST,
18854        });
18855
18856        for &field in ["alt", "name"].iter() {
18857            if self._additional_params.contains_key(field) {
18858                dlg.finished(false);
18859                return Err(common::Error::FieldClash(field));
18860            }
18861        }
18862
18863        let mut params = Params::with_capacity(4 + self._additional_params.len());
18864        params.push("name", self._name);
18865
18866        params.extend(self._additional_params.iter());
18867
18868        params.push("alt", "json");
18869        let mut url = self.hub._base_url.clone() + "v1/{+name}:undelete";
18870        if self._scopes.is_empty() {
18871            self._scopes
18872                .insert(Scope::CloudPlatform.as_ref().to_string());
18873        }
18874
18875        #[allow(clippy::single_element_loop)]
18876        for &(find_this, param_name) in [("{+name}", "name")].iter() {
18877            url = params.uri_replacement(url, param_name, find_this, true);
18878        }
18879        {
18880            let to_remove = ["name"];
18881            params.remove_params(&to_remove);
18882        }
18883
18884        let url = params.parse_with_url(&url);
18885
18886        let mut json_mime_type = mime::APPLICATION_JSON;
18887        let mut request_value_reader = {
18888            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
18889            common::remove_json_null_values(&mut value);
18890            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
18891            serde_json::to_writer(&mut dst, &value).unwrap();
18892            dst
18893        };
18894        let request_size = request_value_reader
18895            .seek(std::io::SeekFrom::End(0))
18896            .unwrap();
18897        request_value_reader
18898            .seek(std::io::SeekFrom::Start(0))
18899            .unwrap();
18900
18901        loop {
18902            let token = match self
18903                .hub
18904                .auth
18905                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
18906                .await
18907            {
18908                Ok(token) => token,
18909                Err(e) => match dlg.token(e) {
18910                    Ok(token) => token,
18911                    Err(e) => {
18912                        dlg.finished(false);
18913                        return Err(common::Error::MissingToken(e));
18914                    }
18915                },
18916            };
18917            request_value_reader
18918                .seek(std::io::SeekFrom::Start(0))
18919                .unwrap();
18920            let mut req_result = {
18921                let client = &self.hub.client;
18922                dlg.pre_request();
18923                let mut req_builder = hyper::Request::builder()
18924                    .method(hyper::Method::POST)
18925                    .uri(url.as_str())
18926                    .header(USER_AGENT, self.hub._user_agent.clone());
18927
18928                if let Some(token) = token.as_ref() {
18929                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
18930                }
18931
18932                let request = req_builder
18933                    .header(CONTENT_TYPE, json_mime_type.to_string())
18934                    .header(CONTENT_LENGTH, request_size as u64)
18935                    .body(common::to_body(
18936                        request_value_reader.get_ref().clone().into(),
18937                    ));
18938
18939                client.request(request.unwrap()).await
18940            };
18941
18942            match req_result {
18943                Err(err) => {
18944                    if let common::Retry::After(d) = dlg.http_error(&err) {
18945                        sleep(d).await;
18946                        continue;
18947                    }
18948                    dlg.finished(false);
18949                    return Err(common::Error::HttpError(err));
18950                }
18951                Ok(res) => {
18952                    let (mut parts, body) = res.into_parts();
18953                    let mut body = common::Body::new(body);
18954                    if !parts.status.is_success() {
18955                        let bytes = common::to_bytes(body).await.unwrap_or_default();
18956                        let error = serde_json::from_str(&common::to_string(&bytes));
18957                        let response = common::to_response(parts, bytes.into());
18958
18959                        if let common::Retry::After(d) =
18960                            dlg.http_failure(&response, error.as_ref().ok())
18961                        {
18962                            sleep(d).await;
18963                            continue;
18964                        }
18965
18966                        dlg.finished(false);
18967
18968                        return Err(match error {
18969                            Ok(value) => common::Error::BadRequest(value),
18970                            _ => common::Error::Failure(response),
18971                        });
18972                    }
18973                    let response = {
18974                        let bytes = common::to_bytes(body).await.unwrap_or_default();
18975                        let encoded = common::to_string(&bytes);
18976                        match serde_json::from_str(&encoded) {
18977                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
18978                            Err(error) => {
18979                                dlg.response_json_decode_error(&encoded, &error);
18980                                return Err(common::Error::JsonDecodeError(
18981                                    encoded.to_string(),
18982                                    error,
18983                                ));
18984                            }
18985                        }
18986                    };
18987
18988                    dlg.finished(true);
18989                    return Ok(response);
18990                }
18991            }
18992        }
18993    }
18994
18995    ///
18996    /// Sets the *request* property to the given value.
18997    ///
18998    /// Even though the property as already been set when instantiating this call,
18999    /// we provide this method for API completeness.
19000    pub fn request(
19001        mut self,
19002        new_value: UndeleteOauthClientRequest,
19003    ) -> ProjectLocationOauthClientUndeleteCall<'a, C> {
19004        self._request = new_value;
19005        self
19006    }
19007    /// Required. The name of the OauthClient to undelete. Format: `projects/{project}/locations/{location}/oauthClients/{oauth_client}`.
19008    ///
19009    /// Sets the *name* path property to the given value.
19010    ///
19011    /// Even though the property as already been set when instantiating this call,
19012    /// we provide this method for API completeness.
19013    pub fn name(mut self, new_value: &str) -> ProjectLocationOauthClientUndeleteCall<'a, C> {
19014        self._name = new_value.to_string();
19015        self
19016    }
19017    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
19018    /// while executing the actual API request.
19019    ///
19020    /// ````text
19021    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
19022    /// ````
19023    ///
19024    /// Sets the *delegate* property to the given value.
19025    pub fn delegate(
19026        mut self,
19027        new_value: &'a mut dyn common::Delegate,
19028    ) -> ProjectLocationOauthClientUndeleteCall<'a, C> {
19029        self._delegate = Some(new_value);
19030        self
19031    }
19032
19033    /// Set any additional parameter of the query string used in the request.
19034    /// It should be used to set parameters which are not yet available through their own
19035    /// setters.
19036    ///
19037    /// Please note that this method must not be used to set any of the known parameters
19038    /// which have their own setter method. If done anyway, the request will fail.
19039    ///
19040    /// # Additional Parameters
19041    ///
19042    /// * *$.xgafv* (query-string) - V1 error format.
19043    /// * *access_token* (query-string) - OAuth access token.
19044    /// * *alt* (query-string) - Data format for response.
19045    /// * *callback* (query-string) - JSONP
19046    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
19047    /// * *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.
19048    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
19049    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
19050    /// * *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.
19051    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
19052    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
19053    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationOauthClientUndeleteCall<'a, C>
19054    where
19055        T: AsRef<str>,
19056    {
19057        self._additional_params
19058            .insert(name.as_ref().to_string(), value.as_ref().to_string());
19059        self
19060    }
19061
19062    /// Identifies the authorization scope for the method you are building.
19063    ///
19064    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
19065    /// [`Scope::CloudPlatform`].
19066    ///
19067    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
19068    /// tokens for more than one scope.
19069    ///
19070    /// Usually there is more than one suitable scope to authorize an operation, some of which may
19071    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
19072    /// sufficient, a read-write scope will do as well.
19073    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationOauthClientUndeleteCall<'a, C>
19074    where
19075        St: AsRef<str>,
19076    {
19077        self._scopes.insert(String::from(scope.as_ref()));
19078        self
19079    }
19080    /// Identifies the authorization scope(s) for the method you are building.
19081    ///
19082    /// See [`Self::add_scope()`] for details.
19083    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationOauthClientUndeleteCall<'a, C>
19084    where
19085        I: IntoIterator<Item = St>,
19086        St: AsRef<str>,
19087    {
19088        self._scopes
19089            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
19090        self
19091    }
19092
19093    /// Removes all scopes, and no default scope will be used either.
19094    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
19095    /// for details).
19096    pub fn clear_scopes(mut self) -> ProjectLocationOauthClientUndeleteCall<'a, C> {
19097        self._scopes.clear();
19098        self
19099    }
19100}
19101
19102/// Gets the latest state of a long-running operation. Clients can use this method to poll the operation result at intervals as recommended by the API service.
19103///
19104/// A builder for the *locations.workloadIdentityPools.namespaces.managedIdentities.operations.get* method supported by a *project* resource.
19105/// It is not used directly, but through a [`ProjectMethods`] instance.
19106///
19107/// # Example
19108///
19109/// Instantiate a resource method builder
19110///
19111/// ```test_harness,no_run
19112/// # extern crate hyper;
19113/// # extern crate hyper_rustls;
19114/// # extern crate google_iam1 as iam1;
19115/// # async fn dox() {
19116/// # use iam1::{Iam, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
19117///
19118/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
19119/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
19120/// #     secret,
19121/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
19122/// # ).build().await.unwrap();
19123///
19124/// # let client = hyper_util::client::legacy::Client::builder(
19125/// #     hyper_util::rt::TokioExecutor::new()
19126/// # )
19127/// # .build(
19128/// #     hyper_rustls::HttpsConnectorBuilder::new()
19129/// #         .with_native_roots()
19130/// #         .unwrap()
19131/// #         .https_or_http()
19132/// #         .enable_http1()
19133/// #         .build()
19134/// # );
19135/// # let mut hub = Iam::new(client, auth);
19136/// // You can configure optional parameters by calling the respective setters at will, and
19137/// // execute the final call using `doit()`.
19138/// // Values shown here are possibly random and not representative !
19139/// let result = hub.projects().locations_workload_identity_pools_namespaces_managed_identities_operations_get("name")
19140///              .doit().await;
19141/// # }
19142/// ```
19143pub struct ProjectLocationWorkloadIdentityPoolNamespaceManagedIdentityOperationGetCall<'a, C>
19144where
19145    C: 'a,
19146{
19147    hub: &'a Iam<C>,
19148    _name: String,
19149    _delegate: Option<&'a mut dyn common::Delegate>,
19150    _additional_params: HashMap<String, String>,
19151    _scopes: BTreeSet<String>,
19152}
19153
19154impl<'a, C> common::CallBuilder
19155    for ProjectLocationWorkloadIdentityPoolNamespaceManagedIdentityOperationGetCall<'a, C>
19156{
19157}
19158
19159impl<'a, C> ProjectLocationWorkloadIdentityPoolNamespaceManagedIdentityOperationGetCall<'a, C>
19160where
19161    C: common::Connector,
19162{
19163    /// Perform the operation you have build so far.
19164    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
19165        use std::borrow::Cow;
19166        use std::io::{Read, Seek};
19167
19168        use common::{url::Params, ToParts};
19169        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
19170
19171        let mut dd = common::DefaultDelegate;
19172        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
19173        dlg.begin(common::MethodInfo { id: "iam.projects.locations.workloadIdentityPools.namespaces.managedIdentities.operations.get",
19174                               http_method: hyper::Method::GET });
19175
19176        for &field in ["alt", "name"].iter() {
19177            if self._additional_params.contains_key(field) {
19178                dlg.finished(false);
19179                return Err(common::Error::FieldClash(field));
19180            }
19181        }
19182
19183        let mut params = Params::with_capacity(3 + self._additional_params.len());
19184        params.push("name", self._name);
19185
19186        params.extend(self._additional_params.iter());
19187
19188        params.push("alt", "json");
19189        let mut url = self.hub._base_url.clone() + "v1/{+name}";
19190        if self._scopes.is_empty() {
19191            self._scopes
19192                .insert(Scope::CloudPlatform.as_ref().to_string());
19193        }
19194
19195        #[allow(clippy::single_element_loop)]
19196        for &(find_this, param_name) in [("{+name}", "name")].iter() {
19197            url = params.uri_replacement(url, param_name, find_this, true);
19198        }
19199        {
19200            let to_remove = ["name"];
19201            params.remove_params(&to_remove);
19202        }
19203
19204        let url = params.parse_with_url(&url);
19205
19206        loop {
19207            let token = match self
19208                .hub
19209                .auth
19210                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
19211                .await
19212            {
19213                Ok(token) => token,
19214                Err(e) => match dlg.token(e) {
19215                    Ok(token) => token,
19216                    Err(e) => {
19217                        dlg.finished(false);
19218                        return Err(common::Error::MissingToken(e));
19219                    }
19220                },
19221            };
19222            let mut req_result = {
19223                let client = &self.hub.client;
19224                dlg.pre_request();
19225                let mut req_builder = hyper::Request::builder()
19226                    .method(hyper::Method::GET)
19227                    .uri(url.as_str())
19228                    .header(USER_AGENT, self.hub._user_agent.clone());
19229
19230                if let Some(token) = token.as_ref() {
19231                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
19232                }
19233
19234                let request = req_builder
19235                    .header(CONTENT_LENGTH, 0_u64)
19236                    .body(common::to_body::<String>(None));
19237
19238                client.request(request.unwrap()).await
19239            };
19240
19241            match req_result {
19242                Err(err) => {
19243                    if let common::Retry::After(d) = dlg.http_error(&err) {
19244                        sleep(d).await;
19245                        continue;
19246                    }
19247                    dlg.finished(false);
19248                    return Err(common::Error::HttpError(err));
19249                }
19250                Ok(res) => {
19251                    let (mut parts, body) = res.into_parts();
19252                    let mut body = common::Body::new(body);
19253                    if !parts.status.is_success() {
19254                        let bytes = common::to_bytes(body).await.unwrap_or_default();
19255                        let error = serde_json::from_str(&common::to_string(&bytes));
19256                        let response = common::to_response(parts, bytes.into());
19257
19258                        if let common::Retry::After(d) =
19259                            dlg.http_failure(&response, error.as_ref().ok())
19260                        {
19261                            sleep(d).await;
19262                            continue;
19263                        }
19264
19265                        dlg.finished(false);
19266
19267                        return Err(match error {
19268                            Ok(value) => common::Error::BadRequest(value),
19269                            _ => common::Error::Failure(response),
19270                        });
19271                    }
19272                    let response = {
19273                        let bytes = common::to_bytes(body).await.unwrap_or_default();
19274                        let encoded = common::to_string(&bytes);
19275                        match serde_json::from_str(&encoded) {
19276                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
19277                            Err(error) => {
19278                                dlg.response_json_decode_error(&encoded, &error);
19279                                return Err(common::Error::JsonDecodeError(
19280                                    encoded.to_string(),
19281                                    error,
19282                                ));
19283                            }
19284                        }
19285                    };
19286
19287                    dlg.finished(true);
19288                    return Ok(response);
19289                }
19290            }
19291        }
19292    }
19293
19294    /// The name of the operation resource.
19295    ///
19296    /// Sets the *name* path property to the given value.
19297    ///
19298    /// Even though the property as already been set when instantiating this call,
19299    /// we provide this method for API completeness.
19300    pub fn name(
19301        mut self,
19302        new_value: &str,
19303    ) -> ProjectLocationWorkloadIdentityPoolNamespaceManagedIdentityOperationGetCall<'a, C> {
19304        self._name = new_value.to_string();
19305        self
19306    }
19307    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
19308    /// while executing the actual API request.
19309    ///
19310    /// ````text
19311    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
19312    /// ````
19313    ///
19314    /// Sets the *delegate* property to the given value.
19315    pub fn delegate(
19316        mut self,
19317        new_value: &'a mut dyn common::Delegate,
19318    ) -> ProjectLocationWorkloadIdentityPoolNamespaceManagedIdentityOperationGetCall<'a, C> {
19319        self._delegate = Some(new_value);
19320        self
19321    }
19322
19323    /// Set any additional parameter of the query string used in the request.
19324    /// It should be used to set parameters which are not yet available through their own
19325    /// setters.
19326    ///
19327    /// Please note that this method must not be used to set any of the known parameters
19328    /// which have their own setter method. If done anyway, the request will fail.
19329    ///
19330    /// # Additional Parameters
19331    ///
19332    /// * *$.xgafv* (query-string) - V1 error format.
19333    /// * *access_token* (query-string) - OAuth access token.
19334    /// * *alt* (query-string) - Data format for response.
19335    /// * *callback* (query-string) - JSONP
19336    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
19337    /// * *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.
19338    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
19339    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
19340    /// * *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.
19341    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
19342    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
19343    pub fn param<T>(
19344        mut self,
19345        name: T,
19346        value: T,
19347    ) -> ProjectLocationWorkloadIdentityPoolNamespaceManagedIdentityOperationGetCall<'a, C>
19348    where
19349        T: AsRef<str>,
19350    {
19351        self._additional_params
19352            .insert(name.as_ref().to_string(), value.as_ref().to_string());
19353        self
19354    }
19355
19356    /// Identifies the authorization scope for the method you are building.
19357    ///
19358    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
19359    /// [`Scope::CloudPlatform`].
19360    ///
19361    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
19362    /// tokens for more than one scope.
19363    ///
19364    /// Usually there is more than one suitable scope to authorize an operation, some of which may
19365    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
19366    /// sufficient, a read-write scope will do as well.
19367    pub fn add_scope<St>(
19368        mut self,
19369        scope: St,
19370    ) -> ProjectLocationWorkloadIdentityPoolNamespaceManagedIdentityOperationGetCall<'a, C>
19371    where
19372        St: AsRef<str>,
19373    {
19374        self._scopes.insert(String::from(scope.as_ref()));
19375        self
19376    }
19377    /// Identifies the authorization scope(s) for the method you are building.
19378    ///
19379    /// See [`Self::add_scope()`] for details.
19380    pub fn add_scopes<I, St>(
19381        mut self,
19382        scopes: I,
19383    ) -> ProjectLocationWorkloadIdentityPoolNamespaceManagedIdentityOperationGetCall<'a, C>
19384    where
19385        I: IntoIterator<Item = St>,
19386        St: AsRef<str>,
19387    {
19388        self._scopes
19389            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
19390        self
19391    }
19392
19393    /// Removes all scopes, and no default scope will be used either.
19394    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
19395    /// for details).
19396    pub fn clear_scopes(
19397        mut self,
19398    ) -> ProjectLocationWorkloadIdentityPoolNamespaceManagedIdentityOperationGetCall<'a, C> {
19399        self._scopes.clear();
19400        self
19401    }
19402}
19403
19404/// Gets the latest state of a long-running operation. Clients can use this method to poll the operation result at intervals as recommended by the API service.
19405///
19406/// A builder for the *locations.workloadIdentityPools.namespaces.managedIdentities.workloadSources.operations.get* method supported by a *project* resource.
19407/// It is not used directly, but through a [`ProjectMethods`] instance.
19408///
19409/// # Example
19410///
19411/// Instantiate a resource method builder
19412///
19413/// ```test_harness,no_run
19414/// # extern crate hyper;
19415/// # extern crate hyper_rustls;
19416/// # extern crate google_iam1 as iam1;
19417/// # async fn dox() {
19418/// # use iam1::{Iam, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
19419///
19420/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
19421/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
19422/// #     secret,
19423/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
19424/// # ).build().await.unwrap();
19425///
19426/// # let client = hyper_util::client::legacy::Client::builder(
19427/// #     hyper_util::rt::TokioExecutor::new()
19428/// # )
19429/// # .build(
19430/// #     hyper_rustls::HttpsConnectorBuilder::new()
19431/// #         .with_native_roots()
19432/// #         .unwrap()
19433/// #         .https_or_http()
19434/// #         .enable_http1()
19435/// #         .build()
19436/// # );
19437/// # let mut hub = Iam::new(client, auth);
19438/// // You can configure optional parameters by calling the respective setters at will, and
19439/// // execute the final call using `doit()`.
19440/// // Values shown here are possibly random and not representative !
19441/// let result = hub.projects().locations_workload_identity_pools_namespaces_managed_identities_workload_sources_operations_get("name")
19442///              .doit().await;
19443/// # }
19444/// ```
19445pub struct ProjectLocationWorkloadIdentityPoolNamespaceManagedIdentityWorkloadSourceOperationGetCall<
19446    'a,
19447    C,
19448> where
19449    C: 'a,
19450{
19451    hub: &'a Iam<C>,
19452    _name: String,
19453    _delegate: Option<&'a mut dyn common::Delegate>,
19454    _additional_params: HashMap<String, String>,
19455    _scopes: BTreeSet<String>,
19456}
19457
19458impl<'a, C> common::CallBuilder
19459    for ProjectLocationWorkloadIdentityPoolNamespaceManagedIdentityWorkloadSourceOperationGetCall<
19460        'a,
19461        C,
19462    >
19463{
19464}
19465
19466impl<'a, C>
19467    ProjectLocationWorkloadIdentityPoolNamespaceManagedIdentityWorkloadSourceOperationGetCall<'a, C>
19468where
19469    C: common::Connector,
19470{
19471    /// Perform the operation you have build so far.
19472    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
19473        use std::borrow::Cow;
19474        use std::io::{Read, Seek};
19475
19476        use common::{url::Params, ToParts};
19477        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
19478
19479        let mut dd = common::DefaultDelegate;
19480        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
19481        dlg.begin(common::MethodInfo { id: "iam.projects.locations.workloadIdentityPools.namespaces.managedIdentities.workloadSources.operations.get",
19482                               http_method: hyper::Method::GET });
19483
19484        for &field in ["alt", "name"].iter() {
19485            if self._additional_params.contains_key(field) {
19486                dlg.finished(false);
19487                return Err(common::Error::FieldClash(field));
19488            }
19489        }
19490
19491        let mut params = Params::with_capacity(3 + self._additional_params.len());
19492        params.push("name", self._name);
19493
19494        params.extend(self._additional_params.iter());
19495
19496        params.push("alt", "json");
19497        let mut url = self.hub._base_url.clone() + "v1/{+name}";
19498        if self._scopes.is_empty() {
19499            self._scopes
19500                .insert(Scope::CloudPlatform.as_ref().to_string());
19501        }
19502
19503        #[allow(clippy::single_element_loop)]
19504        for &(find_this, param_name) in [("{+name}", "name")].iter() {
19505            url = params.uri_replacement(url, param_name, find_this, true);
19506        }
19507        {
19508            let to_remove = ["name"];
19509            params.remove_params(&to_remove);
19510        }
19511
19512        let url = params.parse_with_url(&url);
19513
19514        loop {
19515            let token = match self
19516                .hub
19517                .auth
19518                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
19519                .await
19520            {
19521                Ok(token) => token,
19522                Err(e) => match dlg.token(e) {
19523                    Ok(token) => token,
19524                    Err(e) => {
19525                        dlg.finished(false);
19526                        return Err(common::Error::MissingToken(e));
19527                    }
19528                },
19529            };
19530            let mut req_result = {
19531                let client = &self.hub.client;
19532                dlg.pre_request();
19533                let mut req_builder = hyper::Request::builder()
19534                    .method(hyper::Method::GET)
19535                    .uri(url.as_str())
19536                    .header(USER_AGENT, self.hub._user_agent.clone());
19537
19538                if let Some(token) = token.as_ref() {
19539                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
19540                }
19541
19542                let request = req_builder
19543                    .header(CONTENT_LENGTH, 0_u64)
19544                    .body(common::to_body::<String>(None));
19545
19546                client.request(request.unwrap()).await
19547            };
19548
19549            match req_result {
19550                Err(err) => {
19551                    if let common::Retry::After(d) = dlg.http_error(&err) {
19552                        sleep(d).await;
19553                        continue;
19554                    }
19555                    dlg.finished(false);
19556                    return Err(common::Error::HttpError(err));
19557                }
19558                Ok(res) => {
19559                    let (mut parts, body) = res.into_parts();
19560                    let mut body = common::Body::new(body);
19561                    if !parts.status.is_success() {
19562                        let bytes = common::to_bytes(body).await.unwrap_or_default();
19563                        let error = serde_json::from_str(&common::to_string(&bytes));
19564                        let response = common::to_response(parts, bytes.into());
19565
19566                        if let common::Retry::After(d) =
19567                            dlg.http_failure(&response, error.as_ref().ok())
19568                        {
19569                            sleep(d).await;
19570                            continue;
19571                        }
19572
19573                        dlg.finished(false);
19574
19575                        return Err(match error {
19576                            Ok(value) => common::Error::BadRequest(value),
19577                            _ => common::Error::Failure(response),
19578                        });
19579                    }
19580                    let response = {
19581                        let bytes = common::to_bytes(body).await.unwrap_or_default();
19582                        let encoded = common::to_string(&bytes);
19583                        match serde_json::from_str(&encoded) {
19584                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
19585                            Err(error) => {
19586                                dlg.response_json_decode_error(&encoded, &error);
19587                                return Err(common::Error::JsonDecodeError(
19588                                    encoded.to_string(),
19589                                    error,
19590                                ));
19591                            }
19592                        }
19593                    };
19594
19595                    dlg.finished(true);
19596                    return Ok(response);
19597                }
19598            }
19599        }
19600    }
19601
19602    /// The name of the operation resource.
19603    ///
19604    /// Sets the *name* path property to the given value.
19605    ///
19606    /// Even though the property as already been set when instantiating this call,
19607    /// we provide this method for API completeness.
19608    pub fn name(mut self, new_value: &str) -> ProjectLocationWorkloadIdentityPoolNamespaceManagedIdentityWorkloadSourceOperationGetCall<'a, C>{
19609        self._name = new_value.to_string();
19610        self
19611    }
19612    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
19613    /// while executing the actual API request.
19614    ///
19615    /// ````text
19616    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
19617    /// ````
19618    ///
19619    /// Sets the *delegate* property to the given value.
19620    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> ProjectLocationWorkloadIdentityPoolNamespaceManagedIdentityWorkloadSourceOperationGetCall<'a, C>{
19621        self._delegate = Some(new_value);
19622        self
19623    }
19624
19625    /// Set any additional parameter of the query string used in the request.
19626    /// It should be used to set parameters which are not yet available through their own
19627    /// setters.
19628    ///
19629    /// Please note that this method must not be used to set any of the known parameters
19630    /// which have their own setter method. If done anyway, the request will fail.
19631    ///
19632    /// # Additional Parameters
19633    ///
19634    /// * *$.xgafv* (query-string) - V1 error format.
19635    /// * *access_token* (query-string) - OAuth access token.
19636    /// * *alt* (query-string) - Data format for response.
19637    /// * *callback* (query-string) - JSONP
19638    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
19639    /// * *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.
19640    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
19641    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
19642    /// * *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.
19643    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
19644    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
19645    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationWorkloadIdentityPoolNamespaceManagedIdentityWorkloadSourceOperationGetCall<'a, C>
19646    where T: AsRef<str>{
19647        self._additional_params
19648            .insert(name.as_ref().to_string(), value.as_ref().to_string());
19649        self
19650    }
19651
19652    /// Identifies the authorization scope for the method you are building.
19653    ///
19654    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
19655    /// [`Scope::CloudPlatform`].
19656    ///
19657    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
19658    /// tokens for more than one scope.
19659    ///
19660    /// Usually there is more than one suitable scope to authorize an operation, some of which may
19661    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
19662    /// sufficient, a read-write scope will do as well.
19663    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationWorkloadIdentityPoolNamespaceManagedIdentityWorkloadSourceOperationGetCall<'a, C>
19664    where St: AsRef<str>{
19665        self._scopes.insert(String::from(scope.as_ref()));
19666        self
19667    }
19668    /// Identifies the authorization scope(s) for the method you are building.
19669    ///
19670    /// See [`Self::add_scope()`] for details.
19671    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationWorkloadIdentityPoolNamespaceManagedIdentityWorkloadSourceOperationGetCall<'a, C>
19672                                                        where I: IntoIterator<Item = St>,
19673    St: AsRef<str>{
19674        self._scopes
19675            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
19676        self
19677    }
19678
19679    /// Removes all scopes, and no default scope will be used either.
19680    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
19681    /// for details).
19682    pub fn clear_scopes(mut self) -> ProjectLocationWorkloadIdentityPoolNamespaceManagedIdentityWorkloadSourceOperationGetCall<'a, C>{
19683        self._scopes.clear();
19684        self
19685    }
19686}
19687
19688/// Gets the latest state of a long-running operation. Clients can use this method to poll the operation result at intervals as recommended by the API service.
19689///
19690/// A builder for the *locations.workloadIdentityPools.namespaces.operations.get* method supported by a *project* resource.
19691/// It is not used directly, but through a [`ProjectMethods`] instance.
19692///
19693/// # Example
19694///
19695/// Instantiate a resource method builder
19696///
19697/// ```test_harness,no_run
19698/// # extern crate hyper;
19699/// # extern crate hyper_rustls;
19700/// # extern crate google_iam1 as iam1;
19701/// # async fn dox() {
19702/// # use iam1::{Iam, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
19703///
19704/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
19705/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
19706/// #     secret,
19707/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
19708/// # ).build().await.unwrap();
19709///
19710/// # let client = hyper_util::client::legacy::Client::builder(
19711/// #     hyper_util::rt::TokioExecutor::new()
19712/// # )
19713/// # .build(
19714/// #     hyper_rustls::HttpsConnectorBuilder::new()
19715/// #         .with_native_roots()
19716/// #         .unwrap()
19717/// #         .https_or_http()
19718/// #         .enable_http1()
19719/// #         .build()
19720/// # );
19721/// # let mut hub = Iam::new(client, auth);
19722/// // You can configure optional parameters by calling the respective setters at will, and
19723/// // execute the final call using `doit()`.
19724/// // Values shown here are possibly random and not representative !
19725/// let result = hub.projects().locations_workload_identity_pools_namespaces_operations_get("name")
19726///              .doit().await;
19727/// # }
19728/// ```
19729pub struct ProjectLocationWorkloadIdentityPoolNamespaceOperationGetCall<'a, C>
19730where
19731    C: 'a,
19732{
19733    hub: &'a Iam<C>,
19734    _name: String,
19735    _delegate: Option<&'a mut dyn common::Delegate>,
19736    _additional_params: HashMap<String, String>,
19737    _scopes: BTreeSet<String>,
19738}
19739
19740impl<'a, C> common::CallBuilder
19741    for ProjectLocationWorkloadIdentityPoolNamespaceOperationGetCall<'a, C>
19742{
19743}
19744
19745impl<'a, C> ProjectLocationWorkloadIdentityPoolNamespaceOperationGetCall<'a, C>
19746where
19747    C: common::Connector,
19748{
19749    /// Perform the operation you have build so far.
19750    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
19751        use std::borrow::Cow;
19752        use std::io::{Read, Seek};
19753
19754        use common::{url::Params, ToParts};
19755        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
19756
19757        let mut dd = common::DefaultDelegate;
19758        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
19759        dlg.begin(common::MethodInfo {
19760            id: "iam.projects.locations.workloadIdentityPools.namespaces.operations.get",
19761            http_method: hyper::Method::GET,
19762        });
19763
19764        for &field in ["alt", "name"].iter() {
19765            if self._additional_params.contains_key(field) {
19766                dlg.finished(false);
19767                return Err(common::Error::FieldClash(field));
19768            }
19769        }
19770
19771        let mut params = Params::with_capacity(3 + self._additional_params.len());
19772        params.push("name", self._name);
19773
19774        params.extend(self._additional_params.iter());
19775
19776        params.push("alt", "json");
19777        let mut url = self.hub._base_url.clone() + "v1/{+name}";
19778        if self._scopes.is_empty() {
19779            self._scopes
19780                .insert(Scope::CloudPlatform.as_ref().to_string());
19781        }
19782
19783        #[allow(clippy::single_element_loop)]
19784        for &(find_this, param_name) in [("{+name}", "name")].iter() {
19785            url = params.uri_replacement(url, param_name, find_this, true);
19786        }
19787        {
19788            let to_remove = ["name"];
19789            params.remove_params(&to_remove);
19790        }
19791
19792        let url = params.parse_with_url(&url);
19793
19794        loop {
19795            let token = match self
19796                .hub
19797                .auth
19798                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
19799                .await
19800            {
19801                Ok(token) => token,
19802                Err(e) => match dlg.token(e) {
19803                    Ok(token) => token,
19804                    Err(e) => {
19805                        dlg.finished(false);
19806                        return Err(common::Error::MissingToken(e));
19807                    }
19808                },
19809            };
19810            let mut req_result = {
19811                let client = &self.hub.client;
19812                dlg.pre_request();
19813                let mut req_builder = hyper::Request::builder()
19814                    .method(hyper::Method::GET)
19815                    .uri(url.as_str())
19816                    .header(USER_AGENT, self.hub._user_agent.clone());
19817
19818                if let Some(token) = token.as_ref() {
19819                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
19820                }
19821
19822                let request = req_builder
19823                    .header(CONTENT_LENGTH, 0_u64)
19824                    .body(common::to_body::<String>(None));
19825
19826                client.request(request.unwrap()).await
19827            };
19828
19829            match req_result {
19830                Err(err) => {
19831                    if let common::Retry::After(d) = dlg.http_error(&err) {
19832                        sleep(d).await;
19833                        continue;
19834                    }
19835                    dlg.finished(false);
19836                    return Err(common::Error::HttpError(err));
19837                }
19838                Ok(res) => {
19839                    let (mut parts, body) = res.into_parts();
19840                    let mut body = common::Body::new(body);
19841                    if !parts.status.is_success() {
19842                        let bytes = common::to_bytes(body).await.unwrap_or_default();
19843                        let error = serde_json::from_str(&common::to_string(&bytes));
19844                        let response = common::to_response(parts, bytes.into());
19845
19846                        if let common::Retry::After(d) =
19847                            dlg.http_failure(&response, error.as_ref().ok())
19848                        {
19849                            sleep(d).await;
19850                            continue;
19851                        }
19852
19853                        dlg.finished(false);
19854
19855                        return Err(match error {
19856                            Ok(value) => common::Error::BadRequest(value),
19857                            _ => common::Error::Failure(response),
19858                        });
19859                    }
19860                    let response = {
19861                        let bytes = common::to_bytes(body).await.unwrap_or_default();
19862                        let encoded = common::to_string(&bytes);
19863                        match serde_json::from_str(&encoded) {
19864                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
19865                            Err(error) => {
19866                                dlg.response_json_decode_error(&encoded, &error);
19867                                return Err(common::Error::JsonDecodeError(
19868                                    encoded.to_string(),
19869                                    error,
19870                                ));
19871                            }
19872                        }
19873                    };
19874
19875                    dlg.finished(true);
19876                    return Ok(response);
19877                }
19878            }
19879        }
19880    }
19881
19882    /// The name of the operation resource.
19883    ///
19884    /// Sets the *name* path property to the given value.
19885    ///
19886    /// Even though the property as already been set when instantiating this call,
19887    /// we provide this method for API completeness.
19888    pub fn name(
19889        mut self,
19890        new_value: &str,
19891    ) -> ProjectLocationWorkloadIdentityPoolNamespaceOperationGetCall<'a, C> {
19892        self._name = new_value.to_string();
19893        self
19894    }
19895    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
19896    /// while executing the actual API request.
19897    ///
19898    /// ````text
19899    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
19900    /// ````
19901    ///
19902    /// Sets the *delegate* property to the given value.
19903    pub fn delegate(
19904        mut self,
19905        new_value: &'a mut dyn common::Delegate,
19906    ) -> ProjectLocationWorkloadIdentityPoolNamespaceOperationGetCall<'a, C> {
19907        self._delegate = Some(new_value);
19908        self
19909    }
19910
19911    /// Set any additional parameter of the query string used in the request.
19912    /// It should be used to set parameters which are not yet available through their own
19913    /// setters.
19914    ///
19915    /// Please note that this method must not be used to set any of the known parameters
19916    /// which have their own setter method. If done anyway, the request will fail.
19917    ///
19918    /// # Additional Parameters
19919    ///
19920    /// * *$.xgafv* (query-string) - V1 error format.
19921    /// * *access_token* (query-string) - OAuth access token.
19922    /// * *alt* (query-string) - Data format for response.
19923    /// * *callback* (query-string) - JSONP
19924    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
19925    /// * *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.
19926    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
19927    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
19928    /// * *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.
19929    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
19930    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
19931    pub fn param<T>(
19932        mut self,
19933        name: T,
19934        value: T,
19935    ) -> ProjectLocationWorkloadIdentityPoolNamespaceOperationGetCall<'a, C>
19936    where
19937        T: AsRef<str>,
19938    {
19939        self._additional_params
19940            .insert(name.as_ref().to_string(), value.as_ref().to_string());
19941        self
19942    }
19943
19944    /// Identifies the authorization scope for the method you are building.
19945    ///
19946    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
19947    /// [`Scope::CloudPlatform`].
19948    ///
19949    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
19950    /// tokens for more than one scope.
19951    ///
19952    /// Usually there is more than one suitable scope to authorize an operation, some of which may
19953    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
19954    /// sufficient, a read-write scope will do as well.
19955    pub fn add_scope<St>(
19956        mut self,
19957        scope: St,
19958    ) -> ProjectLocationWorkloadIdentityPoolNamespaceOperationGetCall<'a, C>
19959    where
19960        St: AsRef<str>,
19961    {
19962        self._scopes.insert(String::from(scope.as_ref()));
19963        self
19964    }
19965    /// Identifies the authorization scope(s) for the method you are building.
19966    ///
19967    /// See [`Self::add_scope()`] for details.
19968    pub fn add_scopes<I, St>(
19969        mut self,
19970        scopes: I,
19971    ) -> ProjectLocationWorkloadIdentityPoolNamespaceOperationGetCall<'a, C>
19972    where
19973        I: IntoIterator<Item = St>,
19974        St: AsRef<str>,
19975    {
19976        self._scopes
19977            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
19978        self
19979    }
19980
19981    /// Removes all scopes, and no default scope will be used either.
19982    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
19983    /// for details).
19984    pub fn clear_scopes(
19985        mut self,
19986    ) -> ProjectLocationWorkloadIdentityPoolNamespaceOperationGetCall<'a, C> {
19987        self._scopes.clear();
19988        self
19989    }
19990}
19991
19992/// Gets the latest state of a long-running operation. Clients can use this method to poll the operation result at intervals as recommended by the API service.
19993///
19994/// A builder for the *locations.workloadIdentityPools.operations.get* method supported by a *project* resource.
19995/// It is not used directly, but through a [`ProjectMethods`] instance.
19996///
19997/// # Example
19998///
19999/// Instantiate a resource method builder
20000///
20001/// ```test_harness,no_run
20002/// # extern crate hyper;
20003/// # extern crate hyper_rustls;
20004/// # extern crate google_iam1 as iam1;
20005/// # async fn dox() {
20006/// # use iam1::{Iam, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
20007///
20008/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
20009/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
20010/// #     secret,
20011/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
20012/// # ).build().await.unwrap();
20013///
20014/// # let client = hyper_util::client::legacy::Client::builder(
20015/// #     hyper_util::rt::TokioExecutor::new()
20016/// # )
20017/// # .build(
20018/// #     hyper_rustls::HttpsConnectorBuilder::new()
20019/// #         .with_native_roots()
20020/// #         .unwrap()
20021/// #         .https_or_http()
20022/// #         .enable_http1()
20023/// #         .build()
20024/// # );
20025/// # let mut hub = Iam::new(client, auth);
20026/// // You can configure optional parameters by calling the respective setters at will, and
20027/// // execute the final call using `doit()`.
20028/// // Values shown here are possibly random and not representative !
20029/// let result = hub.projects().locations_workload_identity_pools_operations_get("name")
20030///              .doit().await;
20031/// # }
20032/// ```
20033pub struct ProjectLocationWorkloadIdentityPoolOperationGetCall<'a, C>
20034where
20035    C: 'a,
20036{
20037    hub: &'a Iam<C>,
20038    _name: String,
20039    _delegate: Option<&'a mut dyn common::Delegate>,
20040    _additional_params: HashMap<String, String>,
20041    _scopes: BTreeSet<String>,
20042}
20043
20044impl<'a, C> common::CallBuilder for ProjectLocationWorkloadIdentityPoolOperationGetCall<'a, C> {}
20045
20046impl<'a, C> ProjectLocationWorkloadIdentityPoolOperationGetCall<'a, C>
20047where
20048    C: common::Connector,
20049{
20050    /// Perform the operation you have build so far.
20051    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
20052        use std::borrow::Cow;
20053        use std::io::{Read, Seek};
20054
20055        use common::{url::Params, ToParts};
20056        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
20057
20058        let mut dd = common::DefaultDelegate;
20059        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
20060        dlg.begin(common::MethodInfo {
20061            id: "iam.projects.locations.workloadIdentityPools.operations.get",
20062            http_method: hyper::Method::GET,
20063        });
20064
20065        for &field in ["alt", "name"].iter() {
20066            if self._additional_params.contains_key(field) {
20067                dlg.finished(false);
20068                return Err(common::Error::FieldClash(field));
20069            }
20070        }
20071
20072        let mut params = Params::with_capacity(3 + self._additional_params.len());
20073        params.push("name", self._name);
20074
20075        params.extend(self._additional_params.iter());
20076
20077        params.push("alt", "json");
20078        let mut url = self.hub._base_url.clone() + "v1/{+name}";
20079        if self._scopes.is_empty() {
20080            self._scopes
20081                .insert(Scope::CloudPlatform.as_ref().to_string());
20082        }
20083
20084        #[allow(clippy::single_element_loop)]
20085        for &(find_this, param_name) in [("{+name}", "name")].iter() {
20086            url = params.uri_replacement(url, param_name, find_this, true);
20087        }
20088        {
20089            let to_remove = ["name"];
20090            params.remove_params(&to_remove);
20091        }
20092
20093        let url = params.parse_with_url(&url);
20094
20095        loop {
20096            let token = match self
20097                .hub
20098                .auth
20099                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
20100                .await
20101            {
20102                Ok(token) => token,
20103                Err(e) => match dlg.token(e) {
20104                    Ok(token) => token,
20105                    Err(e) => {
20106                        dlg.finished(false);
20107                        return Err(common::Error::MissingToken(e));
20108                    }
20109                },
20110            };
20111            let mut req_result = {
20112                let client = &self.hub.client;
20113                dlg.pre_request();
20114                let mut req_builder = hyper::Request::builder()
20115                    .method(hyper::Method::GET)
20116                    .uri(url.as_str())
20117                    .header(USER_AGENT, self.hub._user_agent.clone());
20118
20119                if let Some(token) = token.as_ref() {
20120                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
20121                }
20122
20123                let request = req_builder
20124                    .header(CONTENT_LENGTH, 0_u64)
20125                    .body(common::to_body::<String>(None));
20126
20127                client.request(request.unwrap()).await
20128            };
20129
20130            match req_result {
20131                Err(err) => {
20132                    if let common::Retry::After(d) = dlg.http_error(&err) {
20133                        sleep(d).await;
20134                        continue;
20135                    }
20136                    dlg.finished(false);
20137                    return Err(common::Error::HttpError(err));
20138                }
20139                Ok(res) => {
20140                    let (mut parts, body) = res.into_parts();
20141                    let mut body = common::Body::new(body);
20142                    if !parts.status.is_success() {
20143                        let bytes = common::to_bytes(body).await.unwrap_or_default();
20144                        let error = serde_json::from_str(&common::to_string(&bytes));
20145                        let response = common::to_response(parts, bytes.into());
20146
20147                        if let common::Retry::After(d) =
20148                            dlg.http_failure(&response, error.as_ref().ok())
20149                        {
20150                            sleep(d).await;
20151                            continue;
20152                        }
20153
20154                        dlg.finished(false);
20155
20156                        return Err(match error {
20157                            Ok(value) => common::Error::BadRequest(value),
20158                            _ => common::Error::Failure(response),
20159                        });
20160                    }
20161                    let response = {
20162                        let bytes = common::to_bytes(body).await.unwrap_or_default();
20163                        let encoded = common::to_string(&bytes);
20164                        match serde_json::from_str(&encoded) {
20165                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
20166                            Err(error) => {
20167                                dlg.response_json_decode_error(&encoded, &error);
20168                                return Err(common::Error::JsonDecodeError(
20169                                    encoded.to_string(),
20170                                    error,
20171                                ));
20172                            }
20173                        }
20174                    };
20175
20176                    dlg.finished(true);
20177                    return Ok(response);
20178                }
20179            }
20180        }
20181    }
20182
20183    /// The name of the operation resource.
20184    ///
20185    /// Sets the *name* path property to the given value.
20186    ///
20187    /// Even though the property as already been set when instantiating this call,
20188    /// we provide this method for API completeness.
20189    pub fn name(
20190        mut self,
20191        new_value: &str,
20192    ) -> ProjectLocationWorkloadIdentityPoolOperationGetCall<'a, C> {
20193        self._name = new_value.to_string();
20194        self
20195    }
20196    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
20197    /// while executing the actual API request.
20198    ///
20199    /// ````text
20200    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
20201    /// ````
20202    ///
20203    /// Sets the *delegate* property to the given value.
20204    pub fn delegate(
20205        mut self,
20206        new_value: &'a mut dyn common::Delegate,
20207    ) -> ProjectLocationWorkloadIdentityPoolOperationGetCall<'a, C> {
20208        self._delegate = Some(new_value);
20209        self
20210    }
20211
20212    /// Set any additional parameter of the query string used in the request.
20213    /// It should be used to set parameters which are not yet available through their own
20214    /// setters.
20215    ///
20216    /// Please note that this method must not be used to set any of the known parameters
20217    /// which have their own setter method. If done anyway, the request will fail.
20218    ///
20219    /// # Additional Parameters
20220    ///
20221    /// * *$.xgafv* (query-string) - V1 error format.
20222    /// * *access_token* (query-string) - OAuth access token.
20223    /// * *alt* (query-string) - Data format for response.
20224    /// * *callback* (query-string) - JSONP
20225    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
20226    /// * *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.
20227    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
20228    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
20229    /// * *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.
20230    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
20231    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
20232    pub fn param<T>(
20233        mut self,
20234        name: T,
20235        value: T,
20236    ) -> ProjectLocationWorkloadIdentityPoolOperationGetCall<'a, C>
20237    where
20238        T: AsRef<str>,
20239    {
20240        self._additional_params
20241            .insert(name.as_ref().to_string(), value.as_ref().to_string());
20242        self
20243    }
20244
20245    /// Identifies the authorization scope for the method you are building.
20246    ///
20247    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
20248    /// [`Scope::CloudPlatform`].
20249    ///
20250    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
20251    /// tokens for more than one scope.
20252    ///
20253    /// Usually there is more than one suitable scope to authorize an operation, some of which may
20254    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
20255    /// sufficient, a read-write scope will do as well.
20256    pub fn add_scope<St>(
20257        mut self,
20258        scope: St,
20259    ) -> ProjectLocationWorkloadIdentityPoolOperationGetCall<'a, C>
20260    where
20261        St: AsRef<str>,
20262    {
20263        self._scopes.insert(String::from(scope.as_ref()));
20264        self
20265    }
20266    /// Identifies the authorization scope(s) for the method you are building.
20267    ///
20268    /// See [`Self::add_scope()`] for details.
20269    pub fn add_scopes<I, St>(
20270        mut self,
20271        scopes: I,
20272    ) -> ProjectLocationWorkloadIdentityPoolOperationGetCall<'a, C>
20273    where
20274        I: IntoIterator<Item = St>,
20275        St: AsRef<str>,
20276    {
20277        self._scopes
20278            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
20279        self
20280    }
20281
20282    /// Removes all scopes, and no default scope will be used either.
20283    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
20284    /// for details).
20285    pub fn clear_scopes(mut self) -> ProjectLocationWorkloadIdentityPoolOperationGetCall<'a, C> {
20286        self._scopes.clear();
20287        self
20288    }
20289}
20290
20291/// Gets the latest state of a long-running operation. Clients can use this method to poll the operation result at intervals as recommended by the API service.
20292///
20293/// A builder for the *locations.workloadIdentityPools.providers.keys.operations.get* method supported by a *project* resource.
20294/// It is not used directly, but through a [`ProjectMethods`] instance.
20295///
20296/// # Example
20297///
20298/// Instantiate a resource method builder
20299///
20300/// ```test_harness,no_run
20301/// # extern crate hyper;
20302/// # extern crate hyper_rustls;
20303/// # extern crate google_iam1 as iam1;
20304/// # async fn dox() {
20305/// # use iam1::{Iam, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
20306///
20307/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
20308/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
20309/// #     secret,
20310/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
20311/// # ).build().await.unwrap();
20312///
20313/// # let client = hyper_util::client::legacy::Client::builder(
20314/// #     hyper_util::rt::TokioExecutor::new()
20315/// # )
20316/// # .build(
20317/// #     hyper_rustls::HttpsConnectorBuilder::new()
20318/// #         .with_native_roots()
20319/// #         .unwrap()
20320/// #         .https_or_http()
20321/// #         .enable_http1()
20322/// #         .build()
20323/// # );
20324/// # let mut hub = Iam::new(client, auth);
20325/// // You can configure optional parameters by calling the respective setters at will, and
20326/// // execute the final call using `doit()`.
20327/// // Values shown here are possibly random and not representative !
20328/// let result = hub.projects().locations_workload_identity_pools_providers_keys_operations_get("name")
20329///              .doit().await;
20330/// # }
20331/// ```
20332pub struct ProjectLocationWorkloadIdentityPoolProviderKeyOperationGetCall<'a, C>
20333where
20334    C: 'a,
20335{
20336    hub: &'a Iam<C>,
20337    _name: String,
20338    _delegate: Option<&'a mut dyn common::Delegate>,
20339    _additional_params: HashMap<String, String>,
20340    _scopes: BTreeSet<String>,
20341}
20342
20343impl<'a, C> common::CallBuilder
20344    for ProjectLocationWorkloadIdentityPoolProviderKeyOperationGetCall<'a, C>
20345{
20346}
20347
20348impl<'a, C> ProjectLocationWorkloadIdentityPoolProviderKeyOperationGetCall<'a, C>
20349where
20350    C: common::Connector,
20351{
20352    /// Perform the operation you have build so far.
20353    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
20354        use std::borrow::Cow;
20355        use std::io::{Read, Seek};
20356
20357        use common::{url::Params, ToParts};
20358        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
20359
20360        let mut dd = common::DefaultDelegate;
20361        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
20362        dlg.begin(common::MethodInfo {
20363            id: "iam.projects.locations.workloadIdentityPools.providers.keys.operations.get",
20364            http_method: hyper::Method::GET,
20365        });
20366
20367        for &field in ["alt", "name"].iter() {
20368            if self._additional_params.contains_key(field) {
20369                dlg.finished(false);
20370                return Err(common::Error::FieldClash(field));
20371            }
20372        }
20373
20374        let mut params = Params::with_capacity(3 + self._additional_params.len());
20375        params.push("name", self._name);
20376
20377        params.extend(self._additional_params.iter());
20378
20379        params.push("alt", "json");
20380        let mut url = self.hub._base_url.clone() + "v1/{+name}";
20381        if self._scopes.is_empty() {
20382            self._scopes
20383                .insert(Scope::CloudPlatform.as_ref().to_string());
20384        }
20385
20386        #[allow(clippy::single_element_loop)]
20387        for &(find_this, param_name) in [("{+name}", "name")].iter() {
20388            url = params.uri_replacement(url, param_name, find_this, true);
20389        }
20390        {
20391            let to_remove = ["name"];
20392            params.remove_params(&to_remove);
20393        }
20394
20395        let url = params.parse_with_url(&url);
20396
20397        loop {
20398            let token = match self
20399                .hub
20400                .auth
20401                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
20402                .await
20403            {
20404                Ok(token) => token,
20405                Err(e) => match dlg.token(e) {
20406                    Ok(token) => token,
20407                    Err(e) => {
20408                        dlg.finished(false);
20409                        return Err(common::Error::MissingToken(e));
20410                    }
20411                },
20412            };
20413            let mut req_result = {
20414                let client = &self.hub.client;
20415                dlg.pre_request();
20416                let mut req_builder = hyper::Request::builder()
20417                    .method(hyper::Method::GET)
20418                    .uri(url.as_str())
20419                    .header(USER_AGENT, self.hub._user_agent.clone());
20420
20421                if let Some(token) = token.as_ref() {
20422                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
20423                }
20424
20425                let request = req_builder
20426                    .header(CONTENT_LENGTH, 0_u64)
20427                    .body(common::to_body::<String>(None));
20428
20429                client.request(request.unwrap()).await
20430            };
20431
20432            match req_result {
20433                Err(err) => {
20434                    if let common::Retry::After(d) = dlg.http_error(&err) {
20435                        sleep(d).await;
20436                        continue;
20437                    }
20438                    dlg.finished(false);
20439                    return Err(common::Error::HttpError(err));
20440                }
20441                Ok(res) => {
20442                    let (mut parts, body) = res.into_parts();
20443                    let mut body = common::Body::new(body);
20444                    if !parts.status.is_success() {
20445                        let bytes = common::to_bytes(body).await.unwrap_or_default();
20446                        let error = serde_json::from_str(&common::to_string(&bytes));
20447                        let response = common::to_response(parts, bytes.into());
20448
20449                        if let common::Retry::After(d) =
20450                            dlg.http_failure(&response, error.as_ref().ok())
20451                        {
20452                            sleep(d).await;
20453                            continue;
20454                        }
20455
20456                        dlg.finished(false);
20457
20458                        return Err(match error {
20459                            Ok(value) => common::Error::BadRequest(value),
20460                            _ => common::Error::Failure(response),
20461                        });
20462                    }
20463                    let response = {
20464                        let bytes = common::to_bytes(body).await.unwrap_or_default();
20465                        let encoded = common::to_string(&bytes);
20466                        match serde_json::from_str(&encoded) {
20467                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
20468                            Err(error) => {
20469                                dlg.response_json_decode_error(&encoded, &error);
20470                                return Err(common::Error::JsonDecodeError(
20471                                    encoded.to_string(),
20472                                    error,
20473                                ));
20474                            }
20475                        }
20476                    };
20477
20478                    dlg.finished(true);
20479                    return Ok(response);
20480                }
20481            }
20482        }
20483    }
20484
20485    /// The name of the operation resource.
20486    ///
20487    /// Sets the *name* path property to the given value.
20488    ///
20489    /// Even though the property as already been set when instantiating this call,
20490    /// we provide this method for API completeness.
20491    pub fn name(
20492        mut self,
20493        new_value: &str,
20494    ) -> ProjectLocationWorkloadIdentityPoolProviderKeyOperationGetCall<'a, C> {
20495        self._name = new_value.to_string();
20496        self
20497    }
20498    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
20499    /// while executing the actual API request.
20500    ///
20501    /// ````text
20502    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
20503    /// ````
20504    ///
20505    /// Sets the *delegate* property to the given value.
20506    pub fn delegate(
20507        mut self,
20508        new_value: &'a mut dyn common::Delegate,
20509    ) -> ProjectLocationWorkloadIdentityPoolProviderKeyOperationGetCall<'a, C> {
20510        self._delegate = Some(new_value);
20511        self
20512    }
20513
20514    /// Set any additional parameter of the query string used in the request.
20515    /// It should be used to set parameters which are not yet available through their own
20516    /// setters.
20517    ///
20518    /// Please note that this method must not be used to set any of the known parameters
20519    /// which have their own setter method. If done anyway, the request will fail.
20520    ///
20521    /// # Additional Parameters
20522    ///
20523    /// * *$.xgafv* (query-string) - V1 error format.
20524    /// * *access_token* (query-string) - OAuth access token.
20525    /// * *alt* (query-string) - Data format for response.
20526    /// * *callback* (query-string) - JSONP
20527    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
20528    /// * *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.
20529    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
20530    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
20531    /// * *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.
20532    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
20533    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
20534    pub fn param<T>(
20535        mut self,
20536        name: T,
20537        value: T,
20538    ) -> ProjectLocationWorkloadIdentityPoolProviderKeyOperationGetCall<'a, C>
20539    where
20540        T: AsRef<str>,
20541    {
20542        self._additional_params
20543            .insert(name.as_ref().to_string(), value.as_ref().to_string());
20544        self
20545    }
20546
20547    /// Identifies the authorization scope for the method you are building.
20548    ///
20549    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
20550    /// [`Scope::CloudPlatform`].
20551    ///
20552    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
20553    /// tokens for more than one scope.
20554    ///
20555    /// Usually there is more than one suitable scope to authorize an operation, some of which may
20556    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
20557    /// sufficient, a read-write scope will do as well.
20558    pub fn add_scope<St>(
20559        mut self,
20560        scope: St,
20561    ) -> ProjectLocationWorkloadIdentityPoolProviderKeyOperationGetCall<'a, C>
20562    where
20563        St: AsRef<str>,
20564    {
20565        self._scopes.insert(String::from(scope.as_ref()));
20566        self
20567    }
20568    /// Identifies the authorization scope(s) for the method you are building.
20569    ///
20570    /// See [`Self::add_scope()`] for details.
20571    pub fn add_scopes<I, St>(
20572        mut self,
20573        scopes: I,
20574    ) -> ProjectLocationWorkloadIdentityPoolProviderKeyOperationGetCall<'a, C>
20575    where
20576        I: IntoIterator<Item = St>,
20577        St: AsRef<str>,
20578    {
20579        self._scopes
20580            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
20581        self
20582    }
20583
20584    /// Removes all scopes, and no default scope will be used either.
20585    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
20586    /// for details).
20587    pub fn clear_scopes(
20588        mut self,
20589    ) -> ProjectLocationWorkloadIdentityPoolProviderKeyOperationGetCall<'a, C> {
20590        self._scopes.clear();
20591        self
20592    }
20593}
20594
20595/// Create a new WorkloadIdentityPoolProviderKey in a WorkloadIdentityPoolProvider.
20596///
20597/// A builder for the *locations.workloadIdentityPools.providers.keys.create* method supported by a *project* resource.
20598/// It is not used directly, but through a [`ProjectMethods`] instance.
20599///
20600/// # Example
20601///
20602/// Instantiate a resource method builder
20603///
20604/// ```test_harness,no_run
20605/// # extern crate hyper;
20606/// # extern crate hyper_rustls;
20607/// # extern crate google_iam1 as iam1;
20608/// use iam1::api::WorkloadIdentityPoolProviderKey;
20609/// # async fn dox() {
20610/// # use iam1::{Iam, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
20611///
20612/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
20613/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
20614/// #     secret,
20615/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
20616/// # ).build().await.unwrap();
20617///
20618/// # let client = hyper_util::client::legacy::Client::builder(
20619/// #     hyper_util::rt::TokioExecutor::new()
20620/// # )
20621/// # .build(
20622/// #     hyper_rustls::HttpsConnectorBuilder::new()
20623/// #         .with_native_roots()
20624/// #         .unwrap()
20625/// #         .https_or_http()
20626/// #         .enable_http1()
20627/// #         .build()
20628/// # );
20629/// # let mut hub = Iam::new(client, auth);
20630/// // As the method needs a request, you would usually fill it with the desired information
20631/// // into the respective structure. Some of the parts shown here might not be applicable !
20632/// // Values shown here are possibly random and not representative !
20633/// let mut req = WorkloadIdentityPoolProviderKey::default();
20634///
20635/// // You can configure optional parameters by calling the respective setters at will, and
20636/// // execute the final call using `doit()`.
20637/// // Values shown here are possibly random and not representative !
20638/// let result = hub.projects().locations_workload_identity_pools_providers_keys_create(req, "parent")
20639///              .workload_identity_pool_provider_key_id("consetetur")
20640///              .doit().await;
20641/// # }
20642/// ```
20643pub struct ProjectLocationWorkloadIdentityPoolProviderKeyCreateCall<'a, C>
20644where
20645    C: 'a,
20646{
20647    hub: &'a Iam<C>,
20648    _request: WorkloadIdentityPoolProviderKey,
20649    _parent: String,
20650    _workload_identity_pool_provider_key_id: Option<String>,
20651    _delegate: Option<&'a mut dyn common::Delegate>,
20652    _additional_params: HashMap<String, String>,
20653    _scopes: BTreeSet<String>,
20654}
20655
20656impl<'a, C> common::CallBuilder
20657    for ProjectLocationWorkloadIdentityPoolProviderKeyCreateCall<'a, C>
20658{
20659}
20660
20661impl<'a, C> ProjectLocationWorkloadIdentityPoolProviderKeyCreateCall<'a, C>
20662where
20663    C: common::Connector,
20664{
20665    /// Perform the operation you have build so far.
20666    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
20667        use std::borrow::Cow;
20668        use std::io::{Read, Seek};
20669
20670        use common::{url::Params, ToParts};
20671        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
20672
20673        let mut dd = common::DefaultDelegate;
20674        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
20675        dlg.begin(common::MethodInfo {
20676            id: "iam.projects.locations.workloadIdentityPools.providers.keys.create",
20677            http_method: hyper::Method::POST,
20678        });
20679
20680        for &field in ["alt", "parent", "workloadIdentityPoolProviderKeyId"].iter() {
20681            if self._additional_params.contains_key(field) {
20682                dlg.finished(false);
20683                return Err(common::Error::FieldClash(field));
20684            }
20685        }
20686
20687        let mut params = Params::with_capacity(5 + self._additional_params.len());
20688        params.push("parent", self._parent);
20689        if let Some(value) = self._workload_identity_pool_provider_key_id.as_ref() {
20690            params.push("workloadIdentityPoolProviderKeyId", value);
20691        }
20692
20693        params.extend(self._additional_params.iter());
20694
20695        params.push("alt", "json");
20696        let mut url = self.hub._base_url.clone() + "v1/{+parent}/keys";
20697        if self._scopes.is_empty() {
20698            self._scopes
20699                .insert(Scope::CloudPlatform.as_ref().to_string());
20700        }
20701
20702        #[allow(clippy::single_element_loop)]
20703        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
20704            url = params.uri_replacement(url, param_name, find_this, true);
20705        }
20706        {
20707            let to_remove = ["parent"];
20708            params.remove_params(&to_remove);
20709        }
20710
20711        let url = params.parse_with_url(&url);
20712
20713        let mut json_mime_type = mime::APPLICATION_JSON;
20714        let mut request_value_reader = {
20715            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
20716            common::remove_json_null_values(&mut value);
20717            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
20718            serde_json::to_writer(&mut dst, &value).unwrap();
20719            dst
20720        };
20721        let request_size = request_value_reader
20722            .seek(std::io::SeekFrom::End(0))
20723            .unwrap();
20724        request_value_reader
20725            .seek(std::io::SeekFrom::Start(0))
20726            .unwrap();
20727
20728        loop {
20729            let token = match self
20730                .hub
20731                .auth
20732                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
20733                .await
20734            {
20735                Ok(token) => token,
20736                Err(e) => match dlg.token(e) {
20737                    Ok(token) => token,
20738                    Err(e) => {
20739                        dlg.finished(false);
20740                        return Err(common::Error::MissingToken(e));
20741                    }
20742                },
20743            };
20744            request_value_reader
20745                .seek(std::io::SeekFrom::Start(0))
20746                .unwrap();
20747            let mut req_result = {
20748                let client = &self.hub.client;
20749                dlg.pre_request();
20750                let mut req_builder = hyper::Request::builder()
20751                    .method(hyper::Method::POST)
20752                    .uri(url.as_str())
20753                    .header(USER_AGENT, self.hub._user_agent.clone());
20754
20755                if let Some(token) = token.as_ref() {
20756                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
20757                }
20758
20759                let request = req_builder
20760                    .header(CONTENT_TYPE, json_mime_type.to_string())
20761                    .header(CONTENT_LENGTH, request_size as u64)
20762                    .body(common::to_body(
20763                        request_value_reader.get_ref().clone().into(),
20764                    ));
20765
20766                client.request(request.unwrap()).await
20767            };
20768
20769            match req_result {
20770                Err(err) => {
20771                    if let common::Retry::After(d) = dlg.http_error(&err) {
20772                        sleep(d).await;
20773                        continue;
20774                    }
20775                    dlg.finished(false);
20776                    return Err(common::Error::HttpError(err));
20777                }
20778                Ok(res) => {
20779                    let (mut parts, body) = res.into_parts();
20780                    let mut body = common::Body::new(body);
20781                    if !parts.status.is_success() {
20782                        let bytes = common::to_bytes(body).await.unwrap_or_default();
20783                        let error = serde_json::from_str(&common::to_string(&bytes));
20784                        let response = common::to_response(parts, bytes.into());
20785
20786                        if let common::Retry::After(d) =
20787                            dlg.http_failure(&response, error.as_ref().ok())
20788                        {
20789                            sleep(d).await;
20790                            continue;
20791                        }
20792
20793                        dlg.finished(false);
20794
20795                        return Err(match error {
20796                            Ok(value) => common::Error::BadRequest(value),
20797                            _ => common::Error::Failure(response),
20798                        });
20799                    }
20800                    let response = {
20801                        let bytes = common::to_bytes(body).await.unwrap_or_default();
20802                        let encoded = common::to_string(&bytes);
20803                        match serde_json::from_str(&encoded) {
20804                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
20805                            Err(error) => {
20806                                dlg.response_json_decode_error(&encoded, &error);
20807                                return Err(common::Error::JsonDecodeError(
20808                                    encoded.to_string(),
20809                                    error,
20810                                ));
20811                            }
20812                        }
20813                    };
20814
20815                    dlg.finished(true);
20816                    return Ok(response);
20817                }
20818            }
20819        }
20820    }
20821
20822    ///
20823    /// Sets the *request* property to the given value.
20824    ///
20825    /// Even though the property as already been set when instantiating this call,
20826    /// we provide this method for API completeness.
20827    pub fn request(
20828        mut self,
20829        new_value: WorkloadIdentityPoolProviderKey,
20830    ) -> ProjectLocationWorkloadIdentityPoolProviderKeyCreateCall<'a, C> {
20831        self._request = new_value;
20832        self
20833    }
20834    /// Required. The parent provider resource to create the key in.
20835    ///
20836    /// Sets the *parent* path property to the given value.
20837    ///
20838    /// Even though the property as already been set when instantiating this call,
20839    /// we provide this method for API completeness.
20840    pub fn parent(
20841        mut self,
20842        new_value: &str,
20843    ) -> ProjectLocationWorkloadIdentityPoolProviderKeyCreateCall<'a, C> {
20844        self._parent = new_value.to_string();
20845        self
20846    }
20847    /// Required. The ID to use for the key, which becomes the final component of the resource name. This value should be 4-32 characters, and may contain the characters [a-z0-9-].
20848    ///
20849    /// Sets the *workload identity pool provider key id* query property to the given value.
20850    pub fn workload_identity_pool_provider_key_id(
20851        mut self,
20852        new_value: &str,
20853    ) -> ProjectLocationWorkloadIdentityPoolProviderKeyCreateCall<'a, C> {
20854        self._workload_identity_pool_provider_key_id = Some(new_value.to_string());
20855        self
20856    }
20857    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
20858    /// while executing the actual API request.
20859    ///
20860    /// ````text
20861    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
20862    /// ````
20863    ///
20864    /// Sets the *delegate* property to the given value.
20865    pub fn delegate(
20866        mut self,
20867        new_value: &'a mut dyn common::Delegate,
20868    ) -> ProjectLocationWorkloadIdentityPoolProviderKeyCreateCall<'a, C> {
20869        self._delegate = Some(new_value);
20870        self
20871    }
20872
20873    /// Set any additional parameter of the query string used in the request.
20874    /// It should be used to set parameters which are not yet available through their own
20875    /// setters.
20876    ///
20877    /// Please note that this method must not be used to set any of the known parameters
20878    /// which have their own setter method. If done anyway, the request will fail.
20879    ///
20880    /// # Additional Parameters
20881    ///
20882    /// * *$.xgafv* (query-string) - V1 error format.
20883    /// * *access_token* (query-string) - OAuth access token.
20884    /// * *alt* (query-string) - Data format for response.
20885    /// * *callback* (query-string) - JSONP
20886    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
20887    /// * *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.
20888    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
20889    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
20890    /// * *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.
20891    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
20892    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
20893    pub fn param<T>(
20894        mut self,
20895        name: T,
20896        value: T,
20897    ) -> ProjectLocationWorkloadIdentityPoolProviderKeyCreateCall<'a, C>
20898    where
20899        T: AsRef<str>,
20900    {
20901        self._additional_params
20902            .insert(name.as_ref().to_string(), value.as_ref().to_string());
20903        self
20904    }
20905
20906    /// Identifies the authorization scope for the method you are building.
20907    ///
20908    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
20909    /// [`Scope::CloudPlatform`].
20910    ///
20911    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
20912    /// tokens for more than one scope.
20913    ///
20914    /// Usually there is more than one suitable scope to authorize an operation, some of which may
20915    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
20916    /// sufficient, a read-write scope will do as well.
20917    pub fn add_scope<St>(
20918        mut self,
20919        scope: St,
20920    ) -> ProjectLocationWorkloadIdentityPoolProviderKeyCreateCall<'a, C>
20921    where
20922        St: AsRef<str>,
20923    {
20924        self._scopes.insert(String::from(scope.as_ref()));
20925        self
20926    }
20927    /// Identifies the authorization scope(s) for the method you are building.
20928    ///
20929    /// See [`Self::add_scope()`] for details.
20930    pub fn add_scopes<I, St>(
20931        mut self,
20932        scopes: I,
20933    ) -> ProjectLocationWorkloadIdentityPoolProviderKeyCreateCall<'a, C>
20934    where
20935        I: IntoIterator<Item = St>,
20936        St: AsRef<str>,
20937    {
20938        self._scopes
20939            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
20940        self
20941    }
20942
20943    /// Removes all scopes, and no default scope will be used either.
20944    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
20945    /// for details).
20946    pub fn clear_scopes(
20947        mut self,
20948    ) -> ProjectLocationWorkloadIdentityPoolProviderKeyCreateCall<'a, C> {
20949        self._scopes.clear();
20950        self
20951    }
20952}
20953
20954/// Deletes an WorkloadIdentityPoolProviderKey. You can undelete a key for 30 days. After 30 days, deletion is permanent.
20955///
20956/// A builder for the *locations.workloadIdentityPools.providers.keys.delete* method supported by a *project* resource.
20957/// It is not used directly, but through a [`ProjectMethods`] instance.
20958///
20959/// # Example
20960///
20961/// Instantiate a resource method builder
20962///
20963/// ```test_harness,no_run
20964/// # extern crate hyper;
20965/// # extern crate hyper_rustls;
20966/// # extern crate google_iam1 as iam1;
20967/// # async fn dox() {
20968/// # use iam1::{Iam, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
20969///
20970/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
20971/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
20972/// #     secret,
20973/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
20974/// # ).build().await.unwrap();
20975///
20976/// # let client = hyper_util::client::legacy::Client::builder(
20977/// #     hyper_util::rt::TokioExecutor::new()
20978/// # )
20979/// # .build(
20980/// #     hyper_rustls::HttpsConnectorBuilder::new()
20981/// #         .with_native_roots()
20982/// #         .unwrap()
20983/// #         .https_or_http()
20984/// #         .enable_http1()
20985/// #         .build()
20986/// # );
20987/// # let mut hub = Iam::new(client, auth);
20988/// // You can configure optional parameters by calling the respective setters at will, and
20989/// // execute the final call using `doit()`.
20990/// // Values shown here are possibly random and not representative !
20991/// let result = hub.projects().locations_workload_identity_pools_providers_keys_delete("name")
20992///              .doit().await;
20993/// # }
20994/// ```
20995pub struct ProjectLocationWorkloadIdentityPoolProviderKeyDeleteCall<'a, C>
20996where
20997    C: 'a,
20998{
20999    hub: &'a Iam<C>,
21000    _name: String,
21001    _delegate: Option<&'a mut dyn common::Delegate>,
21002    _additional_params: HashMap<String, String>,
21003    _scopes: BTreeSet<String>,
21004}
21005
21006impl<'a, C> common::CallBuilder
21007    for ProjectLocationWorkloadIdentityPoolProviderKeyDeleteCall<'a, C>
21008{
21009}
21010
21011impl<'a, C> ProjectLocationWorkloadIdentityPoolProviderKeyDeleteCall<'a, C>
21012where
21013    C: common::Connector,
21014{
21015    /// Perform the operation you have build so far.
21016    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
21017        use std::borrow::Cow;
21018        use std::io::{Read, Seek};
21019
21020        use common::{url::Params, ToParts};
21021        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
21022
21023        let mut dd = common::DefaultDelegate;
21024        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
21025        dlg.begin(common::MethodInfo {
21026            id: "iam.projects.locations.workloadIdentityPools.providers.keys.delete",
21027            http_method: hyper::Method::DELETE,
21028        });
21029
21030        for &field in ["alt", "name"].iter() {
21031            if self._additional_params.contains_key(field) {
21032                dlg.finished(false);
21033                return Err(common::Error::FieldClash(field));
21034            }
21035        }
21036
21037        let mut params = Params::with_capacity(3 + self._additional_params.len());
21038        params.push("name", self._name);
21039
21040        params.extend(self._additional_params.iter());
21041
21042        params.push("alt", "json");
21043        let mut url = self.hub._base_url.clone() + "v1/{+name}";
21044        if self._scopes.is_empty() {
21045            self._scopes
21046                .insert(Scope::CloudPlatform.as_ref().to_string());
21047        }
21048
21049        #[allow(clippy::single_element_loop)]
21050        for &(find_this, param_name) in [("{+name}", "name")].iter() {
21051            url = params.uri_replacement(url, param_name, find_this, true);
21052        }
21053        {
21054            let to_remove = ["name"];
21055            params.remove_params(&to_remove);
21056        }
21057
21058        let url = params.parse_with_url(&url);
21059
21060        loop {
21061            let token = match self
21062                .hub
21063                .auth
21064                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
21065                .await
21066            {
21067                Ok(token) => token,
21068                Err(e) => match dlg.token(e) {
21069                    Ok(token) => token,
21070                    Err(e) => {
21071                        dlg.finished(false);
21072                        return Err(common::Error::MissingToken(e));
21073                    }
21074                },
21075            };
21076            let mut req_result = {
21077                let client = &self.hub.client;
21078                dlg.pre_request();
21079                let mut req_builder = hyper::Request::builder()
21080                    .method(hyper::Method::DELETE)
21081                    .uri(url.as_str())
21082                    .header(USER_AGENT, self.hub._user_agent.clone());
21083
21084                if let Some(token) = token.as_ref() {
21085                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
21086                }
21087
21088                let request = req_builder
21089                    .header(CONTENT_LENGTH, 0_u64)
21090                    .body(common::to_body::<String>(None));
21091
21092                client.request(request.unwrap()).await
21093            };
21094
21095            match req_result {
21096                Err(err) => {
21097                    if let common::Retry::After(d) = dlg.http_error(&err) {
21098                        sleep(d).await;
21099                        continue;
21100                    }
21101                    dlg.finished(false);
21102                    return Err(common::Error::HttpError(err));
21103                }
21104                Ok(res) => {
21105                    let (mut parts, body) = res.into_parts();
21106                    let mut body = common::Body::new(body);
21107                    if !parts.status.is_success() {
21108                        let bytes = common::to_bytes(body).await.unwrap_or_default();
21109                        let error = serde_json::from_str(&common::to_string(&bytes));
21110                        let response = common::to_response(parts, bytes.into());
21111
21112                        if let common::Retry::After(d) =
21113                            dlg.http_failure(&response, error.as_ref().ok())
21114                        {
21115                            sleep(d).await;
21116                            continue;
21117                        }
21118
21119                        dlg.finished(false);
21120
21121                        return Err(match error {
21122                            Ok(value) => common::Error::BadRequest(value),
21123                            _ => common::Error::Failure(response),
21124                        });
21125                    }
21126                    let response = {
21127                        let bytes = common::to_bytes(body).await.unwrap_or_default();
21128                        let encoded = common::to_string(&bytes);
21129                        match serde_json::from_str(&encoded) {
21130                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
21131                            Err(error) => {
21132                                dlg.response_json_decode_error(&encoded, &error);
21133                                return Err(common::Error::JsonDecodeError(
21134                                    encoded.to_string(),
21135                                    error,
21136                                ));
21137                            }
21138                        }
21139                    };
21140
21141                    dlg.finished(true);
21142                    return Ok(response);
21143                }
21144            }
21145        }
21146    }
21147
21148    /// Required. The name of the encryption key to delete.
21149    ///
21150    /// Sets the *name* path property to the given value.
21151    ///
21152    /// Even though the property as already been set when instantiating this call,
21153    /// we provide this method for API completeness.
21154    pub fn name(
21155        mut self,
21156        new_value: &str,
21157    ) -> ProjectLocationWorkloadIdentityPoolProviderKeyDeleteCall<'a, C> {
21158        self._name = new_value.to_string();
21159        self
21160    }
21161    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
21162    /// while executing the actual API request.
21163    ///
21164    /// ````text
21165    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
21166    /// ````
21167    ///
21168    /// Sets the *delegate* property to the given value.
21169    pub fn delegate(
21170        mut self,
21171        new_value: &'a mut dyn common::Delegate,
21172    ) -> ProjectLocationWorkloadIdentityPoolProviderKeyDeleteCall<'a, C> {
21173        self._delegate = Some(new_value);
21174        self
21175    }
21176
21177    /// Set any additional parameter of the query string used in the request.
21178    /// It should be used to set parameters which are not yet available through their own
21179    /// setters.
21180    ///
21181    /// Please note that this method must not be used to set any of the known parameters
21182    /// which have their own setter method. If done anyway, the request will fail.
21183    ///
21184    /// # Additional Parameters
21185    ///
21186    /// * *$.xgafv* (query-string) - V1 error format.
21187    /// * *access_token* (query-string) - OAuth access token.
21188    /// * *alt* (query-string) - Data format for response.
21189    /// * *callback* (query-string) - JSONP
21190    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
21191    /// * *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.
21192    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
21193    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
21194    /// * *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.
21195    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
21196    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
21197    pub fn param<T>(
21198        mut self,
21199        name: T,
21200        value: T,
21201    ) -> ProjectLocationWorkloadIdentityPoolProviderKeyDeleteCall<'a, C>
21202    where
21203        T: AsRef<str>,
21204    {
21205        self._additional_params
21206            .insert(name.as_ref().to_string(), value.as_ref().to_string());
21207        self
21208    }
21209
21210    /// Identifies the authorization scope for the method you are building.
21211    ///
21212    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
21213    /// [`Scope::CloudPlatform`].
21214    ///
21215    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
21216    /// tokens for more than one scope.
21217    ///
21218    /// Usually there is more than one suitable scope to authorize an operation, some of which may
21219    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
21220    /// sufficient, a read-write scope will do as well.
21221    pub fn add_scope<St>(
21222        mut self,
21223        scope: St,
21224    ) -> ProjectLocationWorkloadIdentityPoolProviderKeyDeleteCall<'a, C>
21225    where
21226        St: AsRef<str>,
21227    {
21228        self._scopes.insert(String::from(scope.as_ref()));
21229        self
21230    }
21231    /// Identifies the authorization scope(s) for the method you are building.
21232    ///
21233    /// See [`Self::add_scope()`] for details.
21234    pub fn add_scopes<I, St>(
21235        mut self,
21236        scopes: I,
21237    ) -> ProjectLocationWorkloadIdentityPoolProviderKeyDeleteCall<'a, C>
21238    where
21239        I: IntoIterator<Item = St>,
21240        St: AsRef<str>,
21241    {
21242        self._scopes
21243            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
21244        self
21245    }
21246
21247    /// Removes all scopes, and no default scope will be used either.
21248    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
21249    /// for details).
21250    pub fn clear_scopes(
21251        mut self,
21252    ) -> ProjectLocationWorkloadIdentityPoolProviderKeyDeleteCall<'a, C> {
21253        self._scopes.clear();
21254        self
21255    }
21256}
21257
21258/// Gets an individual WorkloadIdentityPoolProviderKey.
21259///
21260/// A builder for the *locations.workloadIdentityPools.providers.keys.get* method supported by a *project* resource.
21261/// It is not used directly, but through a [`ProjectMethods`] instance.
21262///
21263/// # Example
21264///
21265/// Instantiate a resource method builder
21266///
21267/// ```test_harness,no_run
21268/// # extern crate hyper;
21269/// # extern crate hyper_rustls;
21270/// # extern crate google_iam1 as iam1;
21271/// # async fn dox() {
21272/// # use iam1::{Iam, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
21273///
21274/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
21275/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
21276/// #     secret,
21277/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
21278/// # ).build().await.unwrap();
21279///
21280/// # let client = hyper_util::client::legacy::Client::builder(
21281/// #     hyper_util::rt::TokioExecutor::new()
21282/// # )
21283/// # .build(
21284/// #     hyper_rustls::HttpsConnectorBuilder::new()
21285/// #         .with_native_roots()
21286/// #         .unwrap()
21287/// #         .https_or_http()
21288/// #         .enable_http1()
21289/// #         .build()
21290/// # );
21291/// # let mut hub = Iam::new(client, auth);
21292/// // You can configure optional parameters by calling the respective setters at will, and
21293/// // execute the final call using `doit()`.
21294/// // Values shown here are possibly random and not representative !
21295/// let result = hub.projects().locations_workload_identity_pools_providers_keys_get("name")
21296///              .doit().await;
21297/// # }
21298/// ```
21299pub struct ProjectLocationWorkloadIdentityPoolProviderKeyGetCall<'a, C>
21300where
21301    C: 'a,
21302{
21303    hub: &'a Iam<C>,
21304    _name: String,
21305    _delegate: Option<&'a mut dyn common::Delegate>,
21306    _additional_params: HashMap<String, String>,
21307    _scopes: BTreeSet<String>,
21308}
21309
21310impl<'a, C> common::CallBuilder for ProjectLocationWorkloadIdentityPoolProviderKeyGetCall<'a, C> {}
21311
21312impl<'a, C> ProjectLocationWorkloadIdentityPoolProviderKeyGetCall<'a, C>
21313where
21314    C: common::Connector,
21315{
21316    /// Perform the operation you have build so far.
21317    pub async fn doit(
21318        mut self,
21319    ) -> common::Result<(common::Response, WorkloadIdentityPoolProviderKey)> {
21320        use std::borrow::Cow;
21321        use std::io::{Read, Seek};
21322
21323        use common::{url::Params, ToParts};
21324        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
21325
21326        let mut dd = common::DefaultDelegate;
21327        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
21328        dlg.begin(common::MethodInfo {
21329            id: "iam.projects.locations.workloadIdentityPools.providers.keys.get",
21330            http_method: hyper::Method::GET,
21331        });
21332
21333        for &field in ["alt", "name"].iter() {
21334            if self._additional_params.contains_key(field) {
21335                dlg.finished(false);
21336                return Err(common::Error::FieldClash(field));
21337            }
21338        }
21339
21340        let mut params = Params::with_capacity(3 + self._additional_params.len());
21341        params.push("name", self._name);
21342
21343        params.extend(self._additional_params.iter());
21344
21345        params.push("alt", "json");
21346        let mut url = self.hub._base_url.clone() + "v1/{+name}";
21347        if self._scopes.is_empty() {
21348            self._scopes
21349                .insert(Scope::CloudPlatform.as_ref().to_string());
21350        }
21351
21352        #[allow(clippy::single_element_loop)]
21353        for &(find_this, param_name) in [("{+name}", "name")].iter() {
21354            url = params.uri_replacement(url, param_name, find_this, true);
21355        }
21356        {
21357            let to_remove = ["name"];
21358            params.remove_params(&to_remove);
21359        }
21360
21361        let url = params.parse_with_url(&url);
21362
21363        loop {
21364            let token = match self
21365                .hub
21366                .auth
21367                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
21368                .await
21369            {
21370                Ok(token) => token,
21371                Err(e) => match dlg.token(e) {
21372                    Ok(token) => token,
21373                    Err(e) => {
21374                        dlg.finished(false);
21375                        return Err(common::Error::MissingToken(e));
21376                    }
21377                },
21378            };
21379            let mut req_result = {
21380                let client = &self.hub.client;
21381                dlg.pre_request();
21382                let mut req_builder = hyper::Request::builder()
21383                    .method(hyper::Method::GET)
21384                    .uri(url.as_str())
21385                    .header(USER_AGENT, self.hub._user_agent.clone());
21386
21387                if let Some(token) = token.as_ref() {
21388                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
21389                }
21390
21391                let request = req_builder
21392                    .header(CONTENT_LENGTH, 0_u64)
21393                    .body(common::to_body::<String>(None));
21394
21395                client.request(request.unwrap()).await
21396            };
21397
21398            match req_result {
21399                Err(err) => {
21400                    if let common::Retry::After(d) = dlg.http_error(&err) {
21401                        sleep(d).await;
21402                        continue;
21403                    }
21404                    dlg.finished(false);
21405                    return Err(common::Error::HttpError(err));
21406                }
21407                Ok(res) => {
21408                    let (mut parts, body) = res.into_parts();
21409                    let mut body = common::Body::new(body);
21410                    if !parts.status.is_success() {
21411                        let bytes = common::to_bytes(body).await.unwrap_or_default();
21412                        let error = serde_json::from_str(&common::to_string(&bytes));
21413                        let response = common::to_response(parts, bytes.into());
21414
21415                        if let common::Retry::After(d) =
21416                            dlg.http_failure(&response, error.as_ref().ok())
21417                        {
21418                            sleep(d).await;
21419                            continue;
21420                        }
21421
21422                        dlg.finished(false);
21423
21424                        return Err(match error {
21425                            Ok(value) => common::Error::BadRequest(value),
21426                            _ => common::Error::Failure(response),
21427                        });
21428                    }
21429                    let response = {
21430                        let bytes = common::to_bytes(body).await.unwrap_or_default();
21431                        let encoded = common::to_string(&bytes);
21432                        match serde_json::from_str(&encoded) {
21433                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
21434                            Err(error) => {
21435                                dlg.response_json_decode_error(&encoded, &error);
21436                                return Err(common::Error::JsonDecodeError(
21437                                    encoded.to_string(),
21438                                    error,
21439                                ));
21440                            }
21441                        }
21442                    };
21443
21444                    dlg.finished(true);
21445                    return Ok(response);
21446                }
21447            }
21448        }
21449    }
21450
21451    /// Required. The name of the key to retrieve.
21452    ///
21453    /// Sets the *name* path property to the given value.
21454    ///
21455    /// Even though the property as already been set when instantiating this call,
21456    /// we provide this method for API completeness.
21457    pub fn name(
21458        mut self,
21459        new_value: &str,
21460    ) -> ProjectLocationWorkloadIdentityPoolProviderKeyGetCall<'a, C> {
21461        self._name = new_value.to_string();
21462        self
21463    }
21464    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
21465    /// while executing the actual API request.
21466    ///
21467    /// ````text
21468    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
21469    /// ````
21470    ///
21471    /// Sets the *delegate* property to the given value.
21472    pub fn delegate(
21473        mut self,
21474        new_value: &'a mut dyn common::Delegate,
21475    ) -> ProjectLocationWorkloadIdentityPoolProviderKeyGetCall<'a, C> {
21476        self._delegate = Some(new_value);
21477        self
21478    }
21479
21480    /// Set any additional parameter of the query string used in the request.
21481    /// It should be used to set parameters which are not yet available through their own
21482    /// setters.
21483    ///
21484    /// Please note that this method must not be used to set any of the known parameters
21485    /// which have their own setter method. If done anyway, the request will fail.
21486    ///
21487    /// # Additional Parameters
21488    ///
21489    /// * *$.xgafv* (query-string) - V1 error format.
21490    /// * *access_token* (query-string) - OAuth access token.
21491    /// * *alt* (query-string) - Data format for response.
21492    /// * *callback* (query-string) - JSONP
21493    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
21494    /// * *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.
21495    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
21496    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
21497    /// * *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.
21498    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
21499    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
21500    pub fn param<T>(
21501        mut self,
21502        name: T,
21503        value: T,
21504    ) -> ProjectLocationWorkloadIdentityPoolProviderKeyGetCall<'a, C>
21505    where
21506        T: AsRef<str>,
21507    {
21508        self._additional_params
21509            .insert(name.as_ref().to_string(), value.as_ref().to_string());
21510        self
21511    }
21512
21513    /// Identifies the authorization scope for the method you are building.
21514    ///
21515    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
21516    /// [`Scope::CloudPlatform`].
21517    ///
21518    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
21519    /// tokens for more than one scope.
21520    ///
21521    /// Usually there is more than one suitable scope to authorize an operation, some of which may
21522    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
21523    /// sufficient, a read-write scope will do as well.
21524    pub fn add_scope<St>(
21525        mut self,
21526        scope: St,
21527    ) -> ProjectLocationWorkloadIdentityPoolProviderKeyGetCall<'a, C>
21528    where
21529        St: AsRef<str>,
21530    {
21531        self._scopes.insert(String::from(scope.as_ref()));
21532        self
21533    }
21534    /// Identifies the authorization scope(s) for the method you are building.
21535    ///
21536    /// See [`Self::add_scope()`] for details.
21537    pub fn add_scopes<I, St>(
21538        mut self,
21539        scopes: I,
21540    ) -> ProjectLocationWorkloadIdentityPoolProviderKeyGetCall<'a, C>
21541    where
21542        I: IntoIterator<Item = St>,
21543        St: AsRef<str>,
21544    {
21545        self._scopes
21546            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
21547        self
21548    }
21549
21550    /// Removes all scopes, and no default scope will be used either.
21551    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
21552    /// for details).
21553    pub fn clear_scopes(mut self) -> ProjectLocationWorkloadIdentityPoolProviderKeyGetCall<'a, C> {
21554        self._scopes.clear();
21555        self
21556    }
21557}
21558
21559/// Lists all non-deleted WorkloadIdentityPoolProviderKeys in a project. If show_deleted is set to `true`, then deleted pools are also listed.
21560///
21561/// A builder for the *locations.workloadIdentityPools.providers.keys.list* method supported by a *project* resource.
21562/// It is not used directly, but through a [`ProjectMethods`] instance.
21563///
21564/// # Example
21565///
21566/// Instantiate a resource method builder
21567///
21568/// ```test_harness,no_run
21569/// # extern crate hyper;
21570/// # extern crate hyper_rustls;
21571/// # extern crate google_iam1 as iam1;
21572/// # async fn dox() {
21573/// # use iam1::{Iam, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
21574///
21575/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
21576/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
21577/// #     secret,
21578/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
21579/// # ).build().await.unwrap();
21580///
21581/// # let client = hyper_util::client::legacy::Client::builder(
21582/// #     hyper_util::rt::TokioExecutor::new()
21583/// # )
21584/// # .build(
21585/// #     hyper_rustls::HttpsConnectorBuilder::new()
21586/// #         .with_native_roots()
21587/// #         .unwrap()
21588/// #         .https_or_http()
21589/// #         .enable_http1()
21590/// #         .build()
21591/// # );
21592/// # let mut hub = Iam::new(client, auth);
21593/// // You can configure optional parameters by calling the respective setters at will, and
21594/// // execute the final call using `doit()`.
21595/// // Values shown here are possibly random and not representative !
21596/// let result = hub.projects().locations_workload_identity_pools_providers_keys_list("parent")
21597///              .show_deleted(false)
21598///              .page_token("amet.")
21599///              .page_size(-30)
21600///              .doit().await;
21601/// # }
21602/// ```
21603pub struct ProjectLocationWorkloadIdentityPoolProviderKeyListCall<'a, C>
21604where
21605    C: 'a,
21606{
21607    hub: &'a Iam<C>,
21608    _parent: String,
21609    _show_deleted: Option<bool>,
21610    _page_token: Option<String>,
21611    _page_size: Option<i32>,
21612    _delegate: Option<&'a mut dyn common::Delegate>,
21613    _additional_params: HashMap<String, String>,
21614    _scopes: BTreeSet<String>,
21615}
21616
21617impl<'a, C> common::CallBuilder for ProjectLocationWorkloadIdentityPoolProviderKeyListCall<'a, C> {}
21618
21619impl<'a, C> ProjectLocationWorkloadIdentityPoolProviderKeyListCall<'a, C>
21620where
21621    C: common::Connector,
21622{
21623    /// Perform the operation you have build so far.
21624    pub async fn doit(
21625        mut self,
21626    ) -> common::Result<(
21627        common::Response,
21628        ListWorkloadIdentityPoolProviderKeysResponse,
21629    )> {
21630        use std::borrow::Cow;
21631        use std::io::{Read, Seek};
21632
21633        use common::{url::Params, ToParts};
21634        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
21635
21636        let mut dd = common::DefaultDelegate;
21637        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
21638        dlg.begin(common::MethodInfo {
21639            id: "iam.projects.locations.workloadIdentityPools.providers.keys.list",
21640            http_method: hyper::Method::GET,
21641        });
21642
21643        for &field in ["alt", "parent", "showDeleted", "pageToken", "pageSize"].iter() {
21644            if self._additional_params.contains_key(field) {
21645                dlg.finished(false);
21646                return Err(common::Error::FieldClash(field));
21647            }
21648        }
21649
21650        let mut params = Params::with_capacity(6 + self._additional_params.len());
21651        params.push("parent", self._parent);
21652        if let Some(value) = self._show_deleted.as_ref() {
21653            params.push("showDeleted", value.to_string());
21654        }
21655        if let Some(value) = self._page_token.as_ref() {
21656            params.push("pageToken", value);
21657        }
21658        if let Some(value) = self._page_size.as_ref() {
21659            params.push("pageSize", value.to_string());
21660        }
21661
21662        params.extend(self._additional_params.iter());
21663
21664        params.push("alt", "json");
21665        let mut url = self.hub._base_url.clone() + "v1/{+parent}/keys";
21666        if self._scopes.is_empty() {
21667            self._scopes
21668                .insert(Scope::CloudPlatform.as_ref().to_string());
21669        }
21670
21671        #[allow(clippy::single_element_loop)]
21672        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
21673            url = params.uri_replacement(url, param_name, find_this, true);
21674        }
21675        {
21676            let to_remove = ["parent"];
21677            params.remove_params(&to_remove);
21678        }
21679
21680        let url = params.parse_with_url(&url);
21681
21682        loop {
21683            let token = match self
21684                .hub
21685                .auth
21686                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
21687                .await
21688            {
21689                Ok(token) => token,
21690                Err(e) => match dlg.token(e) {
21691                    Ok(token) => token,
21692                    Err(e) => {
21693                        dlg.finished(false);
21694                        return Err(common::Error::MissingToken(e));
21695                    }
21696                },
21697            };
21698            let mut req_result = {
21699                let client = &self.hub.client;
21700                dlg.pre_request();
21701                let mut req_builder = hyper::Request::builder()
21702                    .method(hyper::Method::GET)
21703                    .uri(url.as_str())
21704                    .header(USER_AGENT, self.hub._user_agent.clone());
21705
21706                if let Some(token) = token.as_ref() {
21707                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
21708                }
21709
21710                let request = req_builder
21711                    .header(CONTENT_LENGTH, 0_u64)
21712                    .body(common::to_body::<String>(None));
21713
21714                client.request(request.unwrap()).await
21715            };
21716
21717            match req_result {
21718                Err(err) => {
21719                    if let common::Retry::After(d) = dlg.http_error(&err) {
21720                        sleep(d).await;
21721                        continue;
21722                    }
21723                    dlg.finished(false);
21724                    return Err(common::Error::HttpError(err));
21725                }
21726                Ok(res) => {
21727                    let (mut parts, body) = res.into_parts();
21728                    let mut body = common::Body::new(body);
21729                    if !parts.status.is_success() {
21730                        let bytes = common::to_bytes(body).await.unwrap_or_default();
21731                        let error = serde_json::from_str(&common::to_string(&bytes));
21732                        let response = common::to_response(parts, bytes.into());
21733
21734                        if let common::Retry::After(d) =
21735                            dlg.http_failure(&response, error.as_ref().ok())
21736                        {
21737                            sleep(d).await;
21738                            continue;
21739                        }
21740
21741                        dlg.finished(false);
21742
21743                        return Err(match error {
21744                            Ok(value) => common::Error::BadRequest(value),
21745                            _ => common::Error::Failure(response),
21746                        });
21747                    }
21748                    let response = {
21749                        let bytes = common::to_bytes(body).await.unwrap_or_default();
21750                        let encoded = common::to_string(&bytes);
21751                        match serde_json::from_str(&encoded) {
21752                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
21753                            Err(error) => {
21754                                dlg.response_json_decode_error(&encoded, &error);
21755                                return Err(common::Error::JsonDecodeError(
21756                                    encoded.to_string(),
21757                                    error,
21758                                ));
21759                            }
21760                        }
21761                    };
21762
21763                    dlg.finished(true);
21764                    return Ok(response);
21765                }
21766            }
21767        }
21768    }
21769
21770    /// Required. The parent provider resource to list encryption keys for.
21771    ///
21772    /// Sets the *parent* path property to the given value.
21773    ///
21774    /// Even though the property as already been set when instantiating this call,
21775    /// we provide this method for API completeness.
21776    pub fn parent(
21777        mut self,
21778        new_value: &str,
21779    ) -> ProjectLocationWorkloadIdentityPoolProviderKeyListCall<'a, C> {
21780        self._parent = new_value.to_string();
21781        self
21782    }
21783    /// Whether to return soft deleted resources as well.
21784    ///
21785    /// Sets the *show deleted* query property to the given value.
21786    pub fn show_deleted(
21787        mut self,
21788        new_value: bool,
21789    ) -> ProjectLocationWorkloadIdentityPoolProviderKeyListCall<'a, C> {
21790        self._show_deleted = Some(new_value);
21791        self
21792    }
21793    /// A page token, received from a previous `ListWorkloadIdentityPoolProviderKeys` call. Provide this to retrieve the subsequent page.
21794    ///
21795    /// Sets the *page token* query property to the given value.
21796    pub fn page_token(
21797        mut self,
21798        new_value: &str,
21799    ) -> ProjectLocationWorkloadIdentityPoolProviderKeyListCall<'a, C> {
21800        self._page_token = Some(new_value.to_string());
21801        self
21802    }
21803    /// The maximum number of keys to return. If unspecified, all keys are returned. The maximum value is 10; values above 10 are truncated to 10.
21804    ///
21805    /// Sets the *page size* query property to the given value.
21806    pub fn page_size(
21807        mut self,
21808        new_value: i32,
21809    ) -> ProjectLocationWorkloadIdentityPoolProviderKeyListCall<'a, C> {
21810        self._page_size = Some(new_value);
21811        self
21812    }
21813    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
21814    /// while executing the actual API request.
21815    ///
21816    /// ````text
21817    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
21818    /// ````
21819    ///
21820    /// Sets the *delegate* property to the given value.
21821    pub fn delegate(
21822        mut self,
21823        new_value: &'a mut dyn common::Delegate,
21824    ) -> ProjectLocationWorkloadIdentityPoolProviderKeyListCall<'a, C> {
21825        self._delegate = Some(new_value);
21826        self
21827    }
21828
21829    /// Set any additional parameter of the query string used in the request.
21830    /// It should be used to set parameters which are not yet available through their own
21831    /// setters.
21832    ///
21833    /// Please note that this method must not be used to set any of the known parameters
21834    /// which have their own setter method. If done anyway, the request will fail.
21835    ///
21836    /// # Additional Parameters
21837    ///
21838    /// * *$.xgafv* (query-string) - V1 error format.
21839    /// * *access_token* (query-string) - OAuth access token.
21840    /// * *alt* (query-string) - Data format for response.
21841    /// * *callback* (query-string) - JSONP
21842    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
21843    /// * *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.
21844    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
21845    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
21846    /// * *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.
21847    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
21848    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
21849    pub fn param<T>(
21850        mut self,
21851        name: T,
21852        value: T,
21853    ) -> ProjectLocationWorkloadIdentityPoolProviderKeyListCall<'a, C>
21854    where
21855        T: AsRef<str>,
21856    {
21857        self._additional_params
21858            .insert(name.as_ref().to_string(), value.as_ref().to_string());
21859        self
21860    }
21861
21862    /// Identifies the authorization scope for the method you are building.
21863    ///
21864    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
21865    /// [`Scope::CloudPlatform`].
21866    ///
21867    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
21868    /// tokens for more than one scope.
21869    ///
21870    /// Usually there is more than one suitable scope to authorize an operation, some of which may
21871    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
21872    /// sufficient, a read-write scope will do as well.
21873    pub fn add_scope<St>(
21874        mut self,
21875        scope: St,
21876    ) -> ProjectLocationWorkloadIdentityPoolProviderKeyListCall<'a, C>
21877    where
21878        St: AsRef<str>,
21879    {
21880        self._scopes.insert(String::from(scope.as_ref()));
21881        self
21882    }
21883    /// Identifies the authorization scope(s) for the method you are building.
21884    ///
21885    /// See [`Self::add_scope()`] for details.
21886    pub fn add_scopes<I, St>(
21887        mut self,
21888        scopes: I,
21889    ) -> ProjectLocationWorkloadIdentityPoolProviderKeyListCall<'a, C>
21890    where
21891        I: IntoIterator<Item = St>,
21892        St: AsRef<str>,
21893    {
21894        self._scopes
21895            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
21896        self
21897    }
21898
21899    /// Removes all scopes, and no default scope will be used either.
21900    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
21901    /// for details).
21902    pub fn clear_scopes(mut self) -> ProjectLocationWorkloadIdentityPoolProviderKeyListCall<'a, C> {
21903        self._scopes.clear();
21904        self
21905    }
21906}
21907
21908/// Undeletes an WorkloadIdentityPoolProviderKey, as long as it was deleted fewer than 30 days ago.
21909///
21910/// A builder for the *locations.workloadIdentityPools.providers.keys.undelete* method supported by a *project* resource.
21911/// It is not used directly, but through a [`ProjectMethods`] instance.
21912///
21913/// # Example
21914///
21915/// Instantiate a resource method builder
21916///
21917/// ```test_harness,no_run
21918/// # extern crate hyper;
21919/// # extern crate hyper_rustls;
21920/// # extern crate google_iam1 as iam1;
21921/// use iam1::api::UndeleteWorkloadIdentityPoolProviderKeyRequest;
21922/// # async fn dox() {
21923/// # use iam1::{Iam, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
21924///
21925/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
21926/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
21927/// #     secret,
21928/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
21929/// # ).build().await.unwrap();
21930///
21931/// # let client = hyper_util::client::legacy::Client::builder(
21932/// #     hyper_util::rt::TokioExecutor::new()
21933/// # )
21934/// # .build(
21935/// #     hyper_rustls::HttpsConnectorBuilder::new()
21936/// #         .with_native_roots()
21937/// #         .unwrap()
21938/// #         .https_or_http()
21939/// #         .enable_http1()
21940/// #         .build()
21941/// # );
21942/// # let mut hub = Iam::new(client, auth);
21943/// // As the method needs a request, you would usually fill it with the desired information
21944/// // into the respective structure. Some of the parts shown here might not be applicable !
21945/// // Values shown here are possibly random and not representative !
21946/// let mut req = UndeleteWorkloadIdentityPoolProviderKeyRequest::default();
21947///
21948/// // You can configure optional parameters by calling the respective setters at will, and
21949/// // execute the final call using `doit()`.
21950/// // Values shown here are possibly random and not representative !
21951/// let result = hub.projects().locations_workload_identity_pools_providers_keys_undelete(req, "name")
21952///              .doit().await;
21953/// # }
21954/// ```
21955pub struct ProjectLocationWorkloadIdentityPoolProviderKeyUndeleteCall<'a, C>
21956where
21957    C: 'a,
21958{
21959    hub: &'a Iam<C>,
21960    _request: UndeleteWorkloadIdentityPoolProviderKeyRequest,
21961    _name: String,
21962    _delegate: Option<&'a mut dyn common::Delegate>,
21963    _additional_params: HashMap<String, String>,
21964    _scopes: BTreeSet<String>,
21965}
21966
21967impl<'a, C> common::CallBuilder
21968    for ProjectLocationWorkloadIdentityPoolProviderKeyUndeleteCall<'a, C>
21969{
21970}
21971
21972impl<'a, C> ProjectLocationWorkloadIdentityPoolProviderKeyUndeleteCall<'a, C>
21973where
21974    C: common::Connector,
21975{
21976    /// Perform the operation you have build so far.
21977    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
21978        use std::borrow::Cow;
21979        use std::io::{Read, Seek};
21980
21981        use common::{url::Params, ToParts};
21982        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
21983
21984        let mut dd = common::DefaultDelegate;
21985        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
21986        dlg.begin(common::MethodInfo {
21987            id: "iam.projects.locations.workloadIdentityPools.providers.keys.undelete",
21988            http_method: hyper::Method::POST,
21989        });
21990
21991        for &field in ["alt", "name"].iter() {
21992            if self._additional_params.contains_key(field) {
21993                dlg.finished(false);
21994                return Err(common::Error::FieldClash(field));
21995            }
21996        }
21997
21998        let mut params = Params::with_capacity(4 + self._additional_params.len());
21999        params.push("name", self._name);
22000
22001        params.extend(self._additional_params.iter());
22002
22003        params.push("alt", "json");
22004        let mut url = self.hub._base_url.clone() + "v1/{+name}:undelete";
22005        if self._scopes.is_empty() {
22006            self._scopes
22007                .insert(Scope::CloudPlatform.as_ref().to_string());
22008        }
22009
22010        #[allow(clippy::single_element_loop)]
22011        for &(find_this, param_name) in [("{+name}", "name")].iter() {
22012            url = params.uri_replacement(url, param_name, find_this, true);
22013        }
22014        {
22015            let to_remove = ["name"];
22016            params.remove_params(&to_remove);
22017        }
22018
22019        let url = params.parse_with_url(&url);
22020
22021        let mut json_mime_type = mime::APPLICATION_JSON;
22022        let mut request_value_reader = {
22023            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
22024            common::remove_json_null_values(&mut value);
22025            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
22026            serde_json::to_writer(&mut dst, &value).unwrap();
22027            dst
22028        };
22029        let request_size = request_value_reader
22030            .seek(std::io::SeekFrom::End(0))
22031            .unwrap();
22032        request_value_reader
22033            .seek(std::io::SeekFrom::Start(0))
22034            .unwrap();
22035
22036        loop {
22037            let token = match self
22038                .hub
22039                .auth
22040                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
22041                .await
22042            {
22043                Ok(token) => token,
22044                Err(e) => match dlg.token(e) {
22045                    Ok(token) => token,
22046                    Err(e) => {
22047                        dlg.finished(false);
22048                        return Err(common::Error::MissingToken(e));
22049                    }
22050                },
22051            };
22052            request_value_reader
22053                .seek(std::io::SeekFrom::Start(0))
22054                .unwrap();
22055            let mut req_result = {
22056                let client = &self.hub.client;
22057                dlg.pre_request();
22058                let mut req_builder = hyper::Request::builder()
22059                    .method(hyper::Method::POST)
22060                    .uri(url.as_str())
22061                    .header(USER_AGENT, self.hub._user_agent.clone());
22062
22063                if let Some(token) = token.as_ref() {
22064                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
22065                }
22066
22067                let request = req_builder
22068                    .header(CONTENT_TYPE, json_mime_type.to_string())
22069                    .header(CONTENT_LENGTH, request_size as u64)
22070                    .body(common::to_body(
22071                        request_value_reader.get_ref().clone().into(),
22072                    ));
22073
22074                client.request(request.unwrap()).await
22075            };
22076
22077            match req_result {
22078                Err(err) => {
22079                    if let common::Retry::After(d) = dlg.http_error(&err) {
22080                        sleep(d).await;
22081                        continue;
22082                    }
22083                    dlg.finished(false);
22084                    return Err(common::Error::HttpError(err));
22085                }
22086                Ok(res) => {
22087                    let (mut parts, body) = res.into_parts();
22088                    let mut body = common::Body::new(body);
22089                    if !parts.status.is_success() {
22090                        let bytes = common::to_bytes(body).await.unwrap_or_default();
22091                        let error = serde_json::from_str(&common::to_string(&bytes));
22092                        let response = common::to_response(parts, bytes.into());
22093
22094                        if let common::Retry::After(d) =
22095                            dlg.http_failure(&response, error.as_ref().ok())
22096                        {
22097                            sleep(d).await;
22098                            continue;
22099                        }
22100
22101                        dlg.finished(false);
22102
22103                        return Err(match error {
22104                            Ok(value) => common::Error::BadRequest(value),
22105                            _ => common::Error::Failure(response),
22106                        });
22107                    }
22108                    let response = {
22109                        let bytes = common::to_bytes(body).await.unwrap_or_default();
22110                        let encoded = common::to_string(&bytes);
22111                        match serde_json::from_str(&encoded) {
22112                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
22113                            Err(error) => {
22114                                dlg.response_json_decode_error(&encoded, &error);
22115                                return Err(common::Error::JsonDecodeError(
22116                                    encoded.to_string(),
22117                                    error,
22118                                ));
22119                            }
22120                        }
22121                    };
22122
22123                    dlg.finished(true);
22124                    return Ok(response);
22125                }
22126            }
22127        }
22128    }
22129
22130    ///
22131    /// Sets the *request* property to the given value.
22132    ///
22133    /// Even though the property as already been set when instantiating this call,
22134    /// we provide this method for API completeness.
22135    pub fn request(
22136        mut self,
22137        new_value: UndeleteWorkloadIdentityPoolProviderKeyRequest,
22138    ) -> ProjectLocationWorkloadIdentityPoolProviderKeyUndeleteCall<'a, C> {
22139        self._request = new_value;
22140        self
22141    }
22142    /// Required. The name of the encryption key to undelete.
22143    ///
22144    /// Sets the *name* path property to the given value.
22145    ///
22146    /// Even though the property as already been set when instantiating this call,
22147    /// we provide this method for API completeness.
22148    pub fn name(
22149        mut self,
22150        new_value: &str,
22151    ) -> ProjectLocationWorkloadIdentityPoolProviderKeyUndeleteCall<'a, C> {
22152        self._name = new_value.to_string();
22153        self
22154    }
22155    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
22156    /// while executing the actual API request.
22157    ///
22158    /// ````text
22159    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
22160    /// ````
22161    ///
22162    /// Sets the *delegate* property to the given value.
22163    pub fn delegate(
22164        mut self,
22165        new_value: &'a mut dyn common::Delegate,
22166    ) -> ProjectLocationWorkloadIdentityPoolProviderKeyUndeleteCall<'a, C> {
22167        self._delegate = Some(new_value);
22168        self
22169    }
22170
22171    /// Set any additional parameter of the query string used in the request.
22172    /// It should be used to set parameters which are not yet available through their own
22173    /// setters.
22174    ///
22175    /// Please note that this method must not be used to set any of the known parameters
22176    /// which have their own setter method. If done anyway, the request will fail.
22177    ///
22178    /// # Additional Parameters
22179    ///
22180    /// * *$.xgafv* (query-string) - V1 error format.
22181    /// * *access_token* (query-string) - OAuth access token.
22182    /// * *alt* (query-string) - Data format for response.
22183    /// * *callback* (query-string) - JSONP
22184    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
22185    /// * *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.
22186    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
22187    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
22188    /// * *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.
22189    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
22190    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
22191    pub fn param<T>(
22192        mut self,
22193        name: T,
22194        value: T,
22195    ) -> ProjectLocationWorkloadIdentityPoolProviderKeyUndeleteCall<'a, C>
22196    where
22197        T: AsRef<str>,
22198    {
22199        self._additional_params
22200            .insert(name.as_ref().to_string(), value.as_ref().to_string());
22201        self
22202    }
22203
22204    /// Identifies the authorization scope for the method you are building.
22205    ///
22206    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
22207    /// [`Scope::CloudPlatform`].
22208    ///
22209    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
22210    /// tokens for more than one scope.
22211    ///
22212    /// Usually there is more than one suitable scope to authorize an operation, some of which may
22213    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
22214    /// sufficient, a read-write scope will do as well.
22215    pub fn add_scope<St>(
22216        mut self,
22217        scope: St,
22218    ) -> ProjectLocationWorkloadIdentityPoolProviderKeyUndeleteCall<'a, C>
22219    where
22220        St: AsRef<str>,
22221    {
22222        self._scopes.insert(String::from(scope.as_ref()));
22223        self
22224    }
22225    /// Identifies the authorization scope(s) for the method you are building.
22226    ///
22227    /// See [`Self::add_scope()`] for details.
22228    pub fn add_scopes<I, St>(
22229        mut self,
22230        scopes: I,
22231    ) -> ProjectLocationWorkloadIdentityPoolProviderKeyUndeleteCall<'a, C>
22232    where
22233        I: IntoIterator<Item = St>,
22234        St: AsRef<str>,
22235    {
22236        self._scopes
22237            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
22238        self
22239    }
22240
22241    /// Removes all scopes, and no default scope will be used either.
22242    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
22243    /// for details).
22244    pub fn clear_scopes(
22245        mut self,
22246    ) -> ProjectLocationWorkloadIdentityPoolProviderKeyUndeleteCall<'a, C> {
22247        self._scopes.clear();
22248        self
22249    }
22250}
22251
22252/// Gets the latest state of a long-running operation. Clients can use this method to poll the operation result at intervals as recommended by the API service.
22253///
22254/// A builder for the *locations.workloadIdentityPools.providers.operations.get* method supported by a *project* resource.
22255/// It is not used directly, but through a [`ProjectMethods`] instance.
22256///
22257/// # Example
22258///
22259/// Instantiate a resource method builder
22260///
22261/// ```test_harness,no_run
22262/// # extern crate hyper;
22263/// # extern crate hyper_rustls;
22264/// # extern crate google_iam1 as iam1;
22265/// # async fn dox() {
22266/// # use iam1::{Iam, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
22267///
22268/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
22269/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
22270/// #     secret,
22271/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
22272/// # ).build().await.unwrap();
22273///
22274/// # let client = hyper_util::client::legacy::Client::builder(
22275/// #     hyper_util::rt::TokioExecutor::new()
22276/// # )
22277/// # .build(
22278/// #     hyper_rustls::HttpsConnectorBuilder::new()
22279/// #         .with_native_roots()
22280/// #         .unwrap()
22281/// #         .https_or_http()
22282/// #         .enable_http1()
22283/// #         .build()
22284/// # );
22285/// # let mut hub = Iam::new(client, auth);
22286/// // You can configure optional parameters by calling the respective setters at will, and
22287/// // execute the final call using `doit()`.
22288/// // Values shown here are possibly random and not representative !
22289/// let result = hub.projects().locations_workload_identity_pools_providers_operations_get("name")
22290///              .doit().await;
22291/// # }
22292/// ```
22293pub struct ProjectLocationWorkloadIdentityPoolProviderOperationGetCall<'a, C>
22294where
22295    C: 'a,
22296{
22297    hub: &'a Iam<C>,
22298    _name: String,
22299    _delegate: Option<&'a mut dyn common::Delegate>,
22300    _additional_params: HashMap<String, String>,
22301    _scopes: BTreeSet<String>,
22302}
22303
22304impl<'a, C> common::CallBuilder
22305    for ProjectLocationWorkloadIdentityPoolProviderOperationGetCall<'a, C>
22306{
22307}
22308
22309impl<'a, C> ProjectLocationWorkloadIdentityPoolProviderOperationGetCall<'a, C>
22310where
22311    C: common::Connector,
22312{
22313    /// Perform the operation you have build so far.
22314    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
22315        use std::borrow::Cow;
22316        use std::io::{Read, Seek};
22317
22318        use common::{url::Params, ToParts};
22319        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
22320
22321        let mut dd = common::DefaultDelegate;
22322        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
22323        dlg.begin(common::MethodInfo {
22324            id: "iam.projects.locations.workloadIdentityPools.providers.operations.get",
22325            http_method: hyper::Method::GET,
22326        });
22327
22328        for &field in ["alt", "name"].iter() {
22329            if self._additional_params.contains_key(field) {
22330                dlg.finished(false);
22331                return Err(common::Error::FieldClash(field));
22332            }
22333        }
22334
22335        let mut params = Params::with_capacity(3 + self._additional_params.len());
22336        params.push("name", self._name);
22337
22338        params.extend(self._additional_params.iter());
22339
22340        params.push("alt", "json");
22341        let mut url = self.hub._base_url.clone() + "v1/{+name}";
22342        if self._scopes.is_empty() {
22343            self._scopes
22344                .insert(Scope::CloudPlatform.as_ref().to_string());
22345        }
22346
22347        #[allow(clippy::single_element_loop)]
22348        for &(find_this, param_name) in [("{+name}", "name")].iter() {
22349            url = params.uri_replacement(url, param_name, find_this, true);
22350        }
22351        {
22352            let to_remove = ["name"];
22353            params.remove_params(&to_remove);
22354        }
22355
22356        let url = params.parse_with_url(&url);
22357
22358        loop {
22359            let token = match self
22360                .hub
22361                .auth
22362                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
22363                .await
22364            {
22365                Ok(token) => token,
22366                Err(e) => match dlg.token(e) {
22367                    Ok(token) => token,
22368                    Err(e) => {
22369                        dlg.finished(false);
22370                        return Err(common::Error::MissingToken(e));
22371                    }
22372                },
22373            };
22374            let mut req_result = {
22375                let client = &self.hub.client;
22376                dlg.pre_request();
22377                let mut req_builder = hyper::Request::builder()
22378                    .method(hyper::Method::GET)
22379                    .uri(url.as_str())
22380                    .header(USER_AGENT, self.hub._user_agent.clone());
22381
22382                if let Some(token) = token.as_ref() {
22383                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
22384                }
22385
22386                let request = req_builder
22387                    .header(CONTENT_LENGTH, 0_u64)
22388                    .body(common::to_body::<String>(None));
22389
22390                client.request(request.unwrap()).await
22391            };
22392
22393            match req_result {
22394                Err(err) => {
22395                    if let common::Retry::After(d) = dlg.http_error(&err) {
22396                        sleep(d).await;
22397                        continue;
22398                    }
22399                    dlg.finished(false);
22400                    return Err(common::Error::HttpError(err));
22401                }
22402                Ok(res) => {
22403                    let (mut parts, body) = res.into_parts();
22404                    let mut body = common::Body::new(body);
22405                    if !parts.status.is_success() {
22406                        let bytes = common::to_bytes(body).await.unwrap_or_default();
22407                        let error = serde_json::from_str(&common::to_string(&bytes));
22408                        let response = common::to_response(parts, bytes.into());
22409
22410                        if let common::Retry::After(d) =
22411                            dlg.http_failure(&response, error.as_ref().ok())
22412                        {
22413                            sleep(d).await;
22414                            continue;
22415                        }
22416
22417                        dlg.finished(false);
22418
22419                        return Err(match error {
22420                            Ok(value) => common::Error::BadRequest(value),
22421                            _ => common::Error::Failure(response),
22422                        });
22423                    }
22424                    let response = {
22425                        let bytes = common::to_bytes(body).await.unwrap_or_default();
22426                        let encoded = common::to_string(&bytes);
22427                        match serde_json::from_str(&encoded) {
22428                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
22429                            Err(error) => {
22430                                dlg.response_json_decode_error(&encoded, &error);
22431                                return Err(common::Error::JsonDecodeError(
22432                                    encoded.to_string(),
22433                                    error,
22434                                ));
22435                            }
22436                        }
22437                    };
22438
22439                    dlg.finished(true);
22440                    return Ok(response);
22441                }
22442            }
22443        }
22444    }
22445
22446    /// The name of the operation resource.
22447    ///
22448    /// Sets the *name* path property to the given value.
22449    ///
22450    /// Even though the property as already been set when instantiating this call,
22451    /// we provide this method for API completeness.
22452    pub fn name(
22453        mut self,
22454        new_value: &str,
22455    ) -> ProjectLocationWorkloadIdentityPoolProviderOperationGetCall<'a, C> {
22456        self._name = new_value.to_string();
22457        self
22458    }
22459    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
22460    /// while executing the actual API request.
22461    ///
22462    /// ````text
22463    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
22464    /// ````
22465    ///
22466    /// Sets the *delegate* property to the given value.
22467    pub fn delegate(
22468        mut self,
22469        new_value: &'a mut dyn common::Delegate,
22470    ) -> ProjectLocationWorkloadIdentityPoolProviderOperationGetCall<'a, C> {
22471        self._delegate = Some(new_value);
22472        self
22473    }
22474
22475    /// Set any additional parameter of the query string used in the request.
22476    /// It should be used to set parameters which are not yet available through their own
22477    /// setters.
22478    ///
22479    /// Please note that this method must not be used to set any of the known parameters
22480    /// which have their own setter method. If done anyway, the request will fail.
22481    ///
22482    /// # Additional Parameters
22483    ///
22484    /// * *$.xgafv* (query-string) - V1 error format.
22485    /// * *access_token* (query-string) - OAuth access token.
22486    /// * *alt* (query-string) - Data format for response.
22487    /// * *callback* (query-string) - JSONP
22488    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
22489    /// * *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.
22490    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
22491    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
22492    /// * *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.
22493    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
22494    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
22495    pub fn param<T>(
22496        mut self,
22497        name: T,
22498        value: T,
22499    ) -> ProjectLocationWorkloadIdentityPoolProviderOperationGetCall<'a, C>
22500    where
22501        T: AsRef<str>,
22502    {
22503        self._additional_params
22504            .insert(name.as_ref().to_string(), value.as_ref().to_string());
22505        self
22506    }
22507
22508    /// Identifies the authorization scope for the method you are building.
22509    ///
22510    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
22511    /// [`Scope::CloudPlatform`].
22512    ///
22513    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
22514    /// tokens for more than one scope.
22515    ///
22516    /// Usually there is more than one suitable scope to authorize an operation, some of which may
22517    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
22518    /// sufficient, a read-write scope will do as well.
22519    pub fn add_scope<St>(
22520        mut self,
22521        scope: St,
22522    ) -> ProjectLocationWorkloadIdentityPoolProviderOperationGetCall<'a, C>
22523    where
22524        St: AsRef<str>,
22525    {
22526        self._scopes.insert(String::from(scope.as_ref()));
22527        self
22528    }
22529    /// Identifies the authorization scope(s) for the method you are building.
22530    ///
22531    /// See [`Self::add_scope()`] for details.
22532    pub fn add_scopes<I, St>(
22533        mut self,
22534        scopes: I,
22535    ) -> ProjectLocationWorkloadIdentityPoolProviderOperationGetCall<'a, C>
22536    where
22537        I: IntoIterator<Item = St>,
22538        St: AsRef<str>,
22539    {
22540        self._scopes
22541            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
22542        self
22543    }
22544
22545    /// Removes all scopes, and no default scope will be used either.
22546    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
22547    /// for details).
22548    pub fn clear_scopes(
22549        mut self,
22550    ) -> ProjectLocationWorkloadIdentityPoolProviderOperationGetCall<'a, C> {
22551        self._scopes.clear();
22552        self
22553    }
22554}
22555
22556/// Creates a new WorkloadIdentityPoolProvider in a WorkloadIdentityPool. You cannot reuse the name of a deleted provider until 30 days after deletion.
22557///
22558/// A builder for the *locations.workloadIdentityPools.providers.create* method supported by a *project* resource.
22559/// It is not used directly, but through a [`ProjectMethods`] instance.
22560///
22561/// # Example
22562///
22563/// Instantiate a resource method builder
22564///
22565/// ```test_harness,no_run
22566/// # extern crate hyper;
22567/// # extern crate hyper_rustls;
22568/// # extern crate google_iam1 as iam1;
22569/// use iam1::api::WorkloadIdentityPoolProvider;
22570/// # async fn dox() {
22571/// # use iam1::{Iam, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
22572///
22573/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
22574/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
22575/// #     secret,
22576/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
22577/// # ).build().await.unwrap();
22578///
22579/// # let client = hyper_util::client::legacy::Client::builder(
22580/// #     hyper_util::rt::TokioExecutor::new()
22581/// # )
22582/// # .build(
22583/// #     hyper_rustls::HttpsConnectorBuilder::new()
22584/// #         .with_native_roots()
22585/// #         .unwrap()
22586/// #         .https_or_http()
22587/// #         .enable_http1()
22588/// #         .build()
22589/// # );
22590/// # let mut hub = Iam::new(client, auth);
22591/// // As the method needs a request, you would usually fill it with the desired information
22592/// // into the respective structure. Some of the parts shown here might not be applicable !
22593/// // Values shown here are possibly random and not representative !
22594/// let mut req = WorkloadIdentityPoolProvider::default();
22595///
22596/// // You can configure optional parameters by calling the respective setters at will, and
22597/// // execute the final call using `doit()`.
22598/// // Values shown here are possibly random and not representative !
22599/// let result = hub.projects().locations_workload_identity_pools_providers_create(req, "parent")
22600///              .workload_identity_pool_provider_id("et")
22601///              .doit().await;
22602/// # }
22603/// ```
22604pub struct ProjectLocationWorkloadIdentityPoolProviderCreateCall<'a, C>
22605where
22606    C: 'a,
22607{
22608    hub: &'a Iam<C>,
22609    _request: WorkloadIdentityPoolProvider,
22610    _parent: String,
22611    _workload_identity_pool_provider_id: Option<String>,
22612    _delegate: Option<&'a mut dyn common::Delegate>,
22613    _additional_params: HashMap<String, String>,
22614    _scopes: BTreeSet<String>,
22615}
22616
22617impl<'a, C> common::CallBuilder for ProjectLocationWorkloadIdentityPoolProviderCreateCall<'a, C> {}
22618
22619impl<'a, C> ProjectLocationWorkloadIdentityPoolProviderCreateCall<'a, C>
22620where
22621    C: common::Connector,
22622{
22623    /// Perform the operation you have build so far.
22624    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
22625        use std::borrow::Cow;
22626        use std::io::{Read, Seek};
22627
22628        use common::{url::Params, ToParts};
22629        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
22630
22631        let mut dd = common::DefaultDelegate;
22632        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
22633        dlg.begin(common::MethodInfo {
22634            id: "iam.projects.locations.workloadIdentityPools.providers.create",
22635            http_method: hyper::Method::POST,
22636        });
22637
22638        for &field in ["alt", "parent", "workloadIdentityPoolProviderId"].iter() {
22639            if self._additional_params.contains_key(field) {
22640                dlg.finished(false);
22641                return Err(common::Error::FieldClash(field));
22642            }
22643        }
22644
22645        let mut params = Params::with_capacity(5 + self._additional_params.len());
22646        params.push("parent", self._parent);
22647        if let Some(value) = self._workload_identity_pool_provider_id.as_ref() {
22648            params.push("workloadIdentityPoolProviderId", value);
22649        }
22650
22651        params.extend(self._additional_params.iter());
22652
22653        params.push("alt", "json");
22654        let mut url = self.hub._base_url.clone() + "v1/{+parent}/providers";
22655        if self._scopes.is_empty() {
22656            self._scopes
22657                .insert(Scope::CloudPlatform.as_ref().to_string());
22658        }
22659
22660        #[allow(clippy::single_element_loop)]
22661        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
22662            url = params.uri_replacement(url, param_name, find_this, true);
22663        }
22664        {
22665            let to_remove = ["parent"];
22666            params.remove_params(&to_remove);
22667        }
22668
22669        let url = params.parse_with_url(&url);
22670
22671        let mut json_mime_type = mime::APPLICATION_JSON;
22672        let mut request_value_reader = {
22673            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
22674            common::remove_json_null_values(&mut value);
22675            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
22676            serde_json::to_writer(&mut dst, &value).unwrap();
22677            dst
22678        };
22679        let request_size = request_value_reader
22680            .seek(std::io::SeekFrom::End(0))
22681            .unwrap();
22682        request_value_reader
22683            .seek(std::io::SeekFrom::Start(0))
22684            .unwrap();
22685
22686        loop {
22687            let token = match self
22688                .hub
22689                .auth
22690                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
22691                .await
22692            {
22693                Ok(token) => token,
22694                Err(e) => match dlg.token(e) {
22695                    Ok(token) => token,
22696                    Err(e) => {
22697                        dlg.finished(false);
22698                        return Err(common::Error::MissingToken(e));
22699                    }
22700                },
22701            };
22702            request_value_reader
22703                .seek(std::io::SeekFrom::Start(0))
22704                .unwrap();
22705            let mut req_result = {
22706                let client = &self.hub.client;
22707                dlg.pre_request();
22708                let mut req_builder = hyper::Request::builder()
22709                    .method(hyper::Method::POST)
22710                    .uri(url.as_str())
22711                    .header(USER_AGENT, self.hub._user_agent.clone());
22712
22713                if let Some(token) = token.as_ref() {
22714                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
22715                }
22716
22717                let request = req_builder
22718                    .header(CONTENT_TYPE, json_mime_type.to_string())
22719                    .header(CONTENT_LENGTH, request_size as u64)
22720                    .body(common::to_body(
22721                        request_value_reader.get_ref().clone().into(),
22722                    ));
22723
22724                client.request(request.unwrap()).await
22725            };
22726
22727            match req_result {
22728                Err(err) => {
22729                    if let common::Retry::After(d) = dlg.http_error(&err) {
22730                        sleep(d).await;
22731                        continue;
22732                    }
22733                    dlg.finished(false);
22734                    return Err(common::Error::HttpError(err));
22735                }
22736                Ok(res) => {
22737                    let (mut parts, body) = res.into_parts();
22738                    let mut body = common::Body::new(body);
22739                    if !parts.status.is_success() {
22740                        let bytes = common::to_bytes(body).await.unwrap_or_default();
22741                        let error = serde_json::from_str(&common::to_string(&bytes));
22742                        let response = common::to_response(parts, bytes.into());
22743
22744                        if let common::Retry::After(d) =
22745                            dlg.http_failure(&response, error.as_ref().ok())
22746                        {
22747                            sleep(d).await;
22748                            continue;
22749                        }
22750
22751                        dlg.finished(false);
22752
22753                        return Err(match error {
22754                            Ok(value) => common::Error::BadRequest(value),
22755                            _ => common::Error::Failure(response),
22756                        });
22757                    }
22758                    let response = {
22759                        let bytes = common::to_bytes(body).await.unwrap_or_default();
22760                        let encoded = common::to_string(&bytes);
22761                        match serde_json::from_str(&encoded) {
22762                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
22763                            Err(error) => {
22764                                dlg.response_json_decode_error(&encoded, &error);
22765                                return Err(common::Error::JsonDecodeError(
22766                                    encoded.to_string(),
22767                                    error,
22768                                ));
22769                            }
22770                        }
22771                    };
22772
22773                    dlg.finished(true);
22774                    return Ok(response);
22775                }
22776            }
22777        }
22778    }
22779
22780    ///
22781    /// Sets the *request* property to the given value.
22782    ///
22783    /// Even though the property as already been set when instantiating this call,
22784    /// we provide this method for API completeness.
22785    pub fn request(
22786        mut self,
22787        new_value: WorkloadIdentityPoolProvider,
22788    ) -> ProjectLocationWorkloadIdentityPoolProviderCreateCall<'a, C> {
22789        self._request = new_value;
22790        self
22791    }
22792    /// Required. The pool to create this provider in.
22793    ///
22794    /// Sets the *parent* path property to the given value.
22795    ///
22796    /// Even though the property as already been set when instantiating this call,
22797    /// we provide this method for API completeness.
22798    pub fn parent(
22799        mut self,
22800        new_value: &str,
22801    ) -> ProjectLocationWorkloadIdentityPoolProviderCreateCall<'a, C> {
22802        self._parent = new_value.to_string();
22803        self
22804    }
22805    /// Required. The ID for the provider, which becomes the final component of the resource name. This value must be 4-32 characters, and may contain the characters [a-z0-9-]. The prefix `gcp-` is reserved for use by Google, and may not be specified.
22806    ///
22807    /// Sets the *workload identity pool provider id* query property to the given value.
22808    pub fn workload_identity_pool_provider_id(
22809        mut self,
22810        new_value: &str,
22811    ) -> ProjectLocationWorkloadIdentityPoolProviderCreateCall<'a, C> {
22812        self._workload_identity_pool_provider_id = Some(new_value.to_string());
22813        self
22814    }
22815    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
22816    /// while executing the actual API request.
22817    ///
22818    /// ````text
22819    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
22820    /// ````
22821    ///
22822    /// Sets the *delegate* property to the given value.
22823    pub fn delegate(
22824        mut self,
22825        new_value: &'a mut dyn common::Delegate,
22826    ) -> ProjectLocationWorkloadIdentityPoolProviderCreateCall<'a, C> {
22827        self._delegate = Some(new_value);
22828        self
22829    }
22830
22831    /// Set any additional parameter of the query string used in the request.
22832    /// It should be used to set parameters which are not yet available through their own
22833    /// setters.
22834    ///
22835    /// Please note that this method must not be used to set any of the known parameters
22836    /// which have their own setter method. If done anyway, the request will fail.
22837    ///
22838    /// # Additional Parameters
22839    ///
22840    /// * *$.xgafv* (query-string) - V1 error format.
22841    /// * *access_token* (query-string) - OAuth access token.
22842    /// * *alt* (query-string) - Data format for response.
22843    /// * *callback* (query-string) - JSONP
22844    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
22845    /// * *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.
22846    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
22847    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
22848    /// * *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.
22849    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
22850    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
22851    pub fn param<T>(
22852        mut self,
22853        name: T,
22854        value: T,
22855    ) -> ProjectLocationWorkloadIdentityPoolProviderCreateCall<'a, C>
22856    where
22857        T: AsRef<str>,
22858    {
22859        self._additional_params
22860            .insert(name.as_ref().to_string(), value.as_ref().to_string());
22861        self
22862    }
22863
22864    /// Identifies the authorization scope for the method you are building.
22865    ///
22866    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
22867    /// [`Scope::CloudPlatform`].
22868    ///
22869    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
22870    /// tokens for more than one scope.
22871    ///
22872    /// Usually there is more than one suitable scope to authorize an operation, some of which may
22873    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
22874    /// sufficient, a read-write scope will do as well.
22875    pub fn add_scope<St>(
22876        mut self,
22877        scope: St,
22878    ) -> ProjectLocationWorkloadIdentityPoolProviderCreateCall<'a, C>
22879    where
22880        St: AsRef<str>,
22881    {
22882        self._scopes.insert(String::from(scope.as_ref()));
22883        self
22884    }
22885    /// Identifies the authorization scope(s) for the method you are building.
22886    ///
22887    /// See [`Self::add_scope()`] for details.
22888    pub fn add_scopes<I, St>(
22889        mut self,
22890        scopes: I,
22891    ) -> ProjectLocationWorkloadIdentityPoolProviderCreateCall<'a, C>
22892    where
22893        I: IntoIterator<Item = St>,
22894        St: AsRef<str>,
22895    {
22896        self._scopes
22897            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
22898        self
22899    }
22900
22901    /// Removes all scopes, and no default scope will be used either.
22902    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
22903    /// for details).
22904    pub fn clear_scopes(mut self) -> ProjectLocationWorkloadIdentityPoolProviderCreateCall<'a, C> {
22905        self._scopes.clear();
22906        self
22907    }
22908}
22909
22910/// Deletes a WorkloadIdentityPoolProvider. Deleting a provider does not revoke credentials that have already been issued; they continue to grant access. You can undelete a provider for 30 days. After 30 days, deletion is permanent. You cannot update deleted providers. However, you can view and list them.
22911///
22912/// A builder for the *locations.workloadIdentityPools.providers.delete* method supported by a *project* resource.
22913/// It is not used directly, but through a [`ProjectMethods`] instance.
22914///
22915/// # Example
22916///
22917/// Instantiate a resource method builder
22918///
22919/// ```test_harness,no_run
22920/// # extern crate hyper;
22921/// # extern crate hyper_rustls;
22922/// # extern crate google_iam1 as iam1;
22923/// # async fn dox() {
22924/// # use iam1::{Iam, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
22925///
22926/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
22927/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
22928/// #     secret,
22929/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
22930/// # ).build().await.unwrap();
22931///
22932/// # let client = hyper_util::client::legacy::Client::builder(
22933/// #     hyper_util::rt::TokioExecutor::new()
22934/// # )
22935/// # .build(
22936/// #     hyper_rustls::HttpsConnectorBuilder::new()
22937/// #         .with_native_roots()
22938/// #         .unwrap()
22939/// #         .https_or_http()
22940/// #         .enable_http1()
22941/// #         .build()
22942/// # );
22943/// # let mut hub = Iam::new(client, auth);
22944/// // You can configure optional parameters by calling the respective setters at will, and
22945/// // execute the final call using `doit()`.
22946/// // Values shown here are possibly random and not representative !
22947/// let result = hub.projects().locations_workload_identity_pools_providers_delete("name")
22948///              .doit().await;
22949/// # }
22950/// ```
22951pub struct ProjectLocationWorkloadIdentityPoolProviderDeleteCall<'a, C>
22952where
22953    C: 'a,
22954{
22955    hub: &'a Iam<C>,
22956    _name: String,
22957    _delegate: Option<&'a mut dyn common::Delegate>,
22958    _additional_params: HashMap<String, String>,
22959    _scopes: BTreeSet<String>,
22960}
22961
22962impl<'a, C> common::CallBuilder for ProjectLocationWorkloadIdentityPoolProviderDeleteCall<'a, C> {}
22963
22964impl<'a, C> ProjectLocationWorkloadIdentityPoolProviderDeleteCall<'a, C>
22965where
22966    C: common::Connector,
22967{
22968    /// Perform the operation you have build so far.
22969    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
22970        use std::borrow::Cow;
22971        use std::io::{Read, Seek};
22972
22973        use common::{url::Params, ToParts};
22974        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
22975
22976        let mut dd = common::DefaultDelegate;
22977        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
22978        dlg.begin(common::MethodInfo {
22979            id: "iam.projects.locations.workloadIdentityPools.providers.delete",
22980            http_method: hyper::Method::DELETE,
22981        });
22982
22983        for &field in ["alt", "name"].iter() {
22984            if self._additional_params.contains_key(field) {
22985                dlg.finished(false);
22986                return Err(common::Error::FieldClash(field));
22987            }
22988        }
22989
22990        let mut params = Params::with_capacity(3 + self._additional_params.len());
22991        params.push("name", self._name);
22992
22993        params.extend(self._additional_params.iter());
22994
22995        params.push("alt", "json");
22996        let mut url = self.hub._base_url.clone() + "v1/{+name}";
22997        if self._scopes.is_empty() {
22998            self._scopes
22999                .insert(Scope::CloudPlatform.as_ref().to_string());
23000        }
23001
23002        #[allow(clippy::single_element_loop)]
23003        for &(find_this, param_name) in [("{+name}", "name")].iter() {
23004            url = params.uri_replacement(url, param_name, find_this, true);
23005        }
23006        {
23007            let to_remove = ["name"];
23008            params.remove_params(&to_remove);
23009        }
23010
23011        let url = params.parse_with_url(&url);
23012
23013        loop {
23014            let token = match self
23015                .hub
23016                .auth
23017                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
23018                .await
23019            {
23020                Ok(token) => token,
23021                Err(e) => match dlg.token(e) {
23022                    Ok(token) => token,
23023                    Err(e) => {
23024                        dlg.finished(false);
23025                        return Err(common::Error::MissingToken(e));
23026                    }
23027                },
23028            };
23029            let mut req_result = {
23030                let client = &self.hub.client;
23031                dlg.pre_request();
23032                let mut req_builder = hyper::Request::builder()
23033                    .method(hyper::Method::DELETE)
23034                    .uri(url.as_str())
23035                    .header(USER_AGENT, self.hub._user_agent.clone());
23036
23037                if let Some(token) = token.as_ref() {
23038                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
23039                }
23040
23041                let request = req_builder
23042                    .header(CONTENT_LENGTH, 0_u64)
23043                    .body(common::to_body::<String>(None));
23044
23045                client.request(request.unwrap()).await
23046            };
23047
23048            match req_result {
23049                Err(err) => {
23050                    if let common::Retry::After(d) = dlg.http_error(&err) {
23051                        sleep(d).await;
23052                        continue;
23053                    }
23054                    dlg.finished(false);
23055                    return Err(common::Error::HttpError(err));
23056                }
23057                Ok(res) => {
23058                    let (mut parts, body) = res.into_parts();
23059                    let mut body = common::Body::new(body);
23060                    if !parts.status.is_success() {
23061                        let bytes = common::to_bytes(body).await.unwrap_or_default();
23062                        let error = serde_json::from_str(&common::to_string(&bytes));
23063                        let response = common::to_response(parts, bytes.into());
23064
23065                        if let common::Retry::After(d) =
23066                            dlg.http_failure(&response, error.as_ref().ok())
23067                        {
23068                            sleep(d).await;
23069                            continue;
23070                        }
23071
23072                        dlg.finished(false);
23073
23074                        return Err(match error {
23075                            Ok(value) => common::Error::BadRequest(value),
23076                            _ => common::Error::Failure(response),
23077                        });
23078                    }
23079                    let response = {
23080                        let bytes = common::to_bytes(body).await.unwrap_or_default();
23081                        let encoded = common::to_string(&bytes);
23082                        match serde_json::from_str(&encoded) {
23083                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
23084                            Err(error) => {
23085                                dlg.response_json_decode_error(&encoded, &error);
23086                                return Err(common::Error::JsonDecodeError(
23087                                    encoded.to_string(),
23088                                    error,
23089                                ));
23090                            }
23091                        }
23092                    };
23093
23094                    dlg.finished(true);
23095                    return Ok(response);
23096                }
23097            }
23098        }
23099    }
23100
23101    /// Required. The name of the provider to delete.
23102    ///
23103    /// Sets the *name* path property to the given value.
23104    ///
23105    /// Even though the property as already been set when instantiating this call,
23106    /// we provide this method for API completeness.
23107    pub fn name(
23108        mut self,
23109        new_value: &str,
23110    ) -> ProjectLocationWorkloadIdentityPoolProviderDeleteCall<'a, C> {
23111        self._name = new_value.to_string();
23112        self
23113    }
23114    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
23115    /// while executing the actual API request.
23116    ///
23117    /// ````text
23118    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
23119    /// ````
23120    ///
23121    /// Sets the *delegate* property to the given value.
23122    pub fn delegate(
23123        mut self,
23124        new_value: &'a mut dyn common::Delegate,
23125    ) -> ProjectLocationWorkloadIdentityPoolProviderDeleteCall<'a, C> {
23126        self._delegate = Some(new_value);
23127        self
23128    }
23129
23130    /// Set any additional parameter of the query string used in the request.
23131    /// It should be used to set parameters which are not yet available through their own
23132    /// setters.
23133    ///
23134    /// Please note that this method must not be used to set any of the known parameters
23135    /// which have their own setter method. If done anyway, the request will fail.
23136    ///
23137    /// # Additional Parameters
23138    ///
23139    /// * *$.xgafv* (query-string) - V1 error format.
23140    /// * *access_token* (query-string) - OAuth access token.
23141    /// * *alt* (query-string) - Data format for response.
23142    /// * *callback* (query-string) - JSONP
23143    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
23144    /// * *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.
23145    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
23146    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
23147    /// * *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.
23148    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
23149    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
23150    pub fn param<T>(
23151        mut self,
23152        name: T,
23153        value: T,
23154    ) -> ProjectLocationWorkloadIdentityPoolProviderDeleteCall<'a, C>
23155    where
23156        T: AsRef<str>,
23157    {
23158        self._additional_params
23159            .insert(name.as_ref().to_string(), value.as_ref().to_string());
23160        self
23161    }
23162
23163    /// Identifies the authorization scope for the method you are building.
23164    ///
23165    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
23166    /// [`Scope::CloudPlatform`].
23167    ///
23168    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
23169    /// tokens for more than one scope.
23170    ///
23171    /// Usually there is more than one suitable scope to authorize an operation, some of which may
23172    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
23173    /// sufficient, a read-write scope will do as well.
23174    pub fn add_scope<St>(
23175        mut self,
23176        scope: St,
23177    ) -> ProjectLocationWorkloadIdentityPoolProviderDeleteCall<'a, C>
23178    where
23179        St: AsRef<str>,
23180    {
23181        self._scopes.insert(String::from(scope.as_ref()));
23182        self
23183    }
23184    /// Identifies the authorization scope(s) for the method you are building.
23185    ///
23186    /// See [`Self::add_scope()`] for details.
23187    pub fn add_scopes<I, St>(
23188        mut self,
23189        scopes: I,
23190    ) -> ProjectLocationWorkloadIdentityPoolProviderDeleteCall<'a, C>
23191    where
23192        I: IntoIterator<Item = St>,
23193        St: AsRef<str>,
23194    {
23195        self._scopes
23196            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
23197        self
23198    }
23199
23200    /// Removes all scopes, and no default scope will be used either.
23201    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
23202    /// for details).
23203    pub fn clear_scopes(mut self) -> ProjectLocationWorkloadIdentityPoolProviderDeleteCall<'a, C> {
23204        self._scopes.clear();
23205        self
23206    }
23207}
23208
23209/// Gets an individual WorkloadIdentityPoolProvider.
23210///
23211/// A builder for the *locations.workloadIdentityPools.providers.get* method supported by a *project* resource.
23212/// It is not used directly, but through a [`ProjectMethods`] instance.
23213///
23214/// # Example
23215///
23216/// Instantiate a resource method builder
23217///
23218/// ```test_harness,no_run
23219/// # extern crate hyper;
23220/// # extern crate hyper_rustls;
23221/// # extern crate google_iam1 as iam1;
23222/// # async fn dox() {
23223/// # use iam1::{Iam, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
23224///
23225/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
23226/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
23227/// #     secret,
23228/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
23229/// # ).build().await.unwrap();
23230///
23231/// # let client = hyper_util::client::legacy::Client::builder(
23232/// #     hyper_util::rt::TokioExecutor::new()
23233/// # )
23234/// # .build(
23235/// #     hyper_rustls::HttpsConnectorBuilder::new()
23236/// #         .with_native_roots()
23237/// #         .unwrap()
23238/// #         .https_or_http()
23239/// #         .enable_http1()
23240/// #         .build()
23241/// # );
23242/// # let mut hub = Iam::new(client, auth);
23243/// // You can configure optional parameters by calling the respective setters at will, and
23244/// // execute the final call using `doit()`.
23245/// // Values shown here are possibly random and not representative !
23246/// let result = hub.projects().locations_workload_identity_pools_providers_get("name")
23247///              .doit().await;
23248/// # }
23249/// ```
23250pub struct ProjectLocationWorkloadIdentityPoolProviderGetCall<'a, C>
23251where
23252    C: 'a,
23253{
23254    hub: &'a Iam<C>,
23255    _name: String,
23256    _delegate: Option<&'a mut dyn common::Delegate>,
23257    _additional_params: HashMap<String, String>,
23258    _scopes: BTreeSet<String>,
23259}
23260
23261impl<'a, C> common::CallBuilder for ProjectLocationWorkloadIdentityPoolProviderGetCall<'a, C> {}
23262
23263impl<'a, C> ProjectLocationWorkloadIdentityPoolProviderGetCall<'a, C>
23264where
23265    C: common::Connector,
23266{
23267    /// Perform the operation you have build so far.
23268    pub async fn doit(
23269        mut self,
23270    ) -> common::Result<(common::Response, WorkloadIdentityPoolProvider)> {
23271        use std::borrow::Cow;
23272        use std::io::{Read, Seek};
23273
23274        use common::{url::Params, ToParts};
23275        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
23276
23277        let mut dd = common::DefaultDelegate;
23278        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
23279        dlg.begin(common::MethodInfo {
23280            id: "iam.projects.locations.workloadIdentityPools.providers.get",
23281            http_method: hyper::Method::GET,
23282        });
23283
23284        for &field in ["alt", "name"].iter() {
23285            if self._additional_params.contains_key(field) {
23286                dlg.finished(false);
23287                return Err(common::Error::FieldClash(field));
23288            }
23289        }
23290
23291        let mut params = Params::with_capacity(3 + self._additional_params.len());
23292        params.push("name", self._name);
23293
23294        params.extend(self._additional_params.iter());
23295
23296        params.push("alt", "json");
23297        let mut url = self.hub._base_url.clone() + "v1/{+name}";
23298        if self._scopes.is_empty() {
23299            self._scopes
23300                .insert(Scope::CloudPlatform.as_ref().to_string());
23301        }
23302
23303        #[allow(clippy::single_element_loop)]
23304        for &(find_this, param_name) in [("{+name}", "name")].iter() {
23305            url = params.uri_replacement(url, param_name, find_this, true);
23306        }
23307        {
23308            let to_remove = ["name"];
23309            params.remove_params(&to_remove);
23310        }
23311
23312        let url = params.parse_with_url(&url);
23313
23314        loop {
23315            let token = match self
23316                .hub
23317                .auth
23318                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
23319                .await
23320            {
23321                Ok(token) => token,
23322                Err(e) => match dlg.token(e) {
23323                    Ok(token) => token,
23324                    Err(e) => {
23325                        dlg.finished(false);
23326                        return Err(common::Error::MissingToken(e));
23327                    }
23328                },
23329            };
23330            let mut req_result = {
23331                let client = &self.hub.client;
23332                dlg.pre_request();
23333                let mut req_builder = hyper::Request::builder()
23334                    .method(hyper::Method::GET)
23335                    .uri(url.as_str())
23336                    .header(USER_AGENT, self.hub._user_agent.clone());
23337
23338                if let Some(token) = token.as_ref() {
23339                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
23340                }
23341
23342                let request = req_builder
23343                    .header(CONTENT_LENGTH, 0_u64)
23344                    .body(common::to_body::<String>(None));
23345
23346                client.request(request.unwrap()).await
23347            };
23348
23349            match req_result {
23350                Err(err) => {
23351                    if let common::Retry::After(d) = dlg.http_error(&err) {
23352                        sleep(d).await;
23353                        continue;
23354                    }
23355                    dlg.finished(false);
23356                    return Err(common::Error::HttpError(err));
23357                }
23358                Ok(res) => {
23359                    let (mut parts, body) = res.into_parts();
23360                    let mut body = common::Body::new(body);
23361                    if !parts.status.is_success() {
23362                        let bytes = common::to_bytes(body).await.unwrap_or_default();
23363                        let error = serde_json::from_str(&common::to_string(&bytes));
23364                        let response = common::to_response(parts, bytes.into());
23365
23366                        if let common::Retry::After(d) =
23367                            dlg.http_failure(&response, error.as_ref().ok())
23368                        {
23369                            sleep(d).await;
23370                            continue;
23371                        }
23372
23373                        dlg.finished(false);
23374
23375                        return Err(match error {
23376                            Ok(value) => common::Error::BadRequest(value),
23377                            _ => common::Error::Failure(response),
23378                        });
23379                    }
23380                    let response = {
23381                        let bytes = common::to_bytes(body).await.unwrap_or_default();
23382                        let encoded = common::to_string(&bytes);
23383                        match serde_json::from_str(&encoded) {
23384                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
23385                            Err(error) => {
23386                                dlg.response_json_decode_error(&encoded, &error);
23387                                return Err(common::Error::JsonDecodeError(
23388                                    encoded.to_string(),
23389                                    error,
23390                                ));
23391                            }
23392                        }
23393                    };
23394
23395                    dlg.finished(true);
23396                    return Ok(response);
23397                }
23398            }
23399        }
23400    }
23401
23402    /// Required. The name of the provider to retrieve.
23403    ///
23404    /// Sets the *name* path property to the given value.
23405    ///
23406    /// Even though the property as already been set when instantiating this call,
23407    /// we provide this method for API completeness.
23408    pub fn name(
23409        mut self,
23410        new_value: &str,
23411    ) -> ProjectLocationWorkloadIdentityPoolProviderGetCall<'a, C> {
23412        self._name = new_value.to_string();
23413        self
23414    }
23415    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
23416    /// while executing the actual API request.
23417    ///
23418    /// ````text
23419    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
23420    /// ````
23421    ///
23422    /// Sets the *delegate* property to the given value.
23423    pub fn delegate(
23424        mut self,
23425        new_value: &'a mut dyn common::Delegate,
23426    ) -> ProjectLocationWorkloadIdentityPoolProviderGetCall<'a, C> {
23427        self._delegate = Some(new_value);
23428        self
23429    }
23430
23431    /// Set any additional parameter of the query string used in the request.
23432    /// It should be used to set parameters which are not yet available through their own
23433    /// setters.
23434    ///
23435    /// Please note that this method must not be used to set any of the known parameters
23436    /// which have their own setter method. If done anyway, the request will fail.
23437    ///
23438    /// # Additional Parameters
23439    ///
23440    /// * *$.xgafv* (query-string) - V1 error format.
23441    /// * *access_token* (query-string) - OAuth access token.
23442    /// * *alt* (query-string) - Data format for response.
23443    /// * *callback* (query-string) - JSONP
23444    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
23445    /// * *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.
23446    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
23447    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
23448    /// * *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.
23449    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
23450    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
23451    pub fn param<T>(
23452        mut self,
23453        name: T,
23454        value: T,
23455    ) -> ProjectLocationWorkloadIdentityPoolProviderGetCall<'a, C>
23456    where
23457        T: AsRef<str>,
23458    {
23459        self._additional_params
23460            .insert(name.as_ref().to_string(), value.as_ref().to_string());
23461        self
23462    }
23463
23464    /// Identifies the authorization scope for the method you are building.
23465    ///
23466    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
23467    /// [`Scope::CloudPlatform`].
23468    ///
23469    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
23470    /// tokens for more than one scope.
23471    ///
23472    /// Usually there is more than one suitable scope to authorize an operation, some of which may
23473    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
23474    /// sufficient, a read-write scope will do as well.
23475    pub fn add_scope<St>(
23476        mut self,
23477        scope: St,
23478    ) -> ProjectLocationWorkloadIdentityPoolProviderGetCall<'a, C>
23479    where
23480        St: AsRef<str>,
23481    {
23482        self._scopes.insert(String::from(scope.as_ref()));
23483        self
23484    }
23485    /// Identifies the authorization scope(s) for the method you are building.
23486    ///
23487    /// See [`Self::add_scope()`] for details.
23488    pub fn add_scopes<I, St>(
23489        mut self,
23490        scopes: I,
23491    ) -> ProjectLocationWorkloadIdentityPoolProviderGetCall<'a, C>
23492    where
23493        I: IntoIterator<Item = St>,
23494        St: AsRef<str>,
23495    {
23496        self._scopes
23497            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
23498        self
23499    }
23500
23501    /// Removes all scopes, and no default scope will be used either.
23502    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
23503    /// for details).
23504    pub fn clear_scopes(mut self) -> ProjectLocationWorkloadIdentityPoolProviderGetCall<'a, C> {
23505        self._scopes.clear();
23506        self
23507    }
23508}
23509
23510/// Lists all non-deleted WorkloadIdentityPoolProviders in a WorkloadIdentityPool. If `show_deleted` is set to `true`, then deleted providers are also listed.
23511///
23512/// A builder for the *locations.workloadIdentityPools.providers.list* method supported by a *project* resource.
23513/// It is not used directly, but through a [`ProjectMethods`] instance.
23514///
23515/// # Example
23516///
23517/// Instantiate a resource method builder
23518///
23519/// ```test_harness,no_run
23520/// # extern crate hyper;
23521/// # extern crate hyper_rustls;
23522/// # extern crate google_iam1 as iam1;
23523/// # async fn dox() {
23524/// # use iam1::{Iam, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
23525///
23526/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
23527/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
23528/// #     secret,
23529/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
23530/// # ).build().await.unwrap();
23531///
23532/// # let client = hyper_util::client::legacy::Client::builder(
23533/// #     hyper_util::rt::TokioExecutor::new()
23534/// # )
23535/// # .build(
23536/// #     hyper_rustls::HttpsConnectorBuilder::new()
23537/// #         .with_native_roots()
23538/// #         .unwrap()
23539/// #         .https_or_http()
23540/// #         .enable_http1()
23541/// #         .build()
23542/// # );
23543/// # let mut hub = Iam::new(client, auth);
23544/// // You can configure optional parameters by calling the respective setters at will, and
23545/// // execute the final call using `doit()`.
23546/// // Values shown here are possibly random and not representative !
23547/// let result = hub.projects().locations_workload_identity_pools_providers_list("parent")
23548///              .show_deleted(false)
23549///              .page_token("amet.")
23550///              .page_size(-17)
23551///              .doit().await;
23552/// # }
23553/// ```
23554pub struct ProjectLocationWorkloadIdentityPoolProviderListCall<'a, C>
23555where
23556    C: 'a,
23557{
23558    hub: &'a Iam<C>,
23559    _parent: String,
23560    _show_deleted: Option<bool>,
23561    _page_token: Option<String>,
23562    _page_size: Option<i32>,
23563    _delegate: Option<&'a mut dyn common::Delegate>,
23564    _additional_params: HashMap<String, String>,
23565    _scopes: BTreeSet<String>,
23566}
23567
23568impl<'a, C> common::CallBuilder for ProjectLocationWorkloadIdentityPoolProviderListCall<'a, C> {}
23569
23570impl<'a, C> ProjectLocationWorkloadIdentityPoolProviderListCall<'a, C>
23571where
23572    C: common::Connector,
23573{
23574    /// Perform the operation you have build so far.
23575    pub async fn doit(
23576        mut self,
23577    ) -> common::Result<(common::Response, ListWorkloadIdentityPoolProvidersResponse)> {
23578        use std::borrow::Cow;
23579        use std::io::{Read, Seek};
23580
23581        use common::{url::Params, ToParts};
23582        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
23583
23584        let mut dd = common::DefaultDelegate;
23585        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
23586        dlg.begin(common::MethodInfo {
23587            id: "iam.projects.locations.workloadIdentityPools.providers.list",
23588            http_method: hyper::Method::GET,
23589        });
23590
23591        for &field in ["alt", "parent", "showDeleted", "pageToken", "pageSize"].iter() {
23592            if self._additional_params.contains_key(field) {
23593                dlg.finished(false);
23594                return Err(common::Error::FieldClash(field));
23595            }
23596        }
23597
23598        let mut params = Params::with_capacity(6 + self._additional_params.len());
23599        params.push("parent", self._parent);
23600        if let Some(value) = self._show_deleted.as_ref() {
23601            params.push("showDeleted", value.to_string());
23602        }
23603        if let Some(value) = self._page_token.as_ref() {
23604            params.push("pageToken", value);
23605        }
23606        if let Some(value) = self._page_size.as_ref() {
23607            params.push("pageSize", value.to_string());
23608        }
23609
23610        params.extend(self._additional_params.iter());
23611
23612        params.push("alt", "json");
23613        let mut url = self.hub._base_url.clone() + "v1/{+parent}/providers";
23614        if self._scopes.is_empty() {
23615            self._scopes
23616                .insert(Scope::CloudPlatform.as_ref().to_string());
23617        }
23618
23619        #[allow(clippy::single_element_loop)]
23620        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
23621            url = params.uri_replacement(url, param_name, find_this, true);
23622        }
23623        {
23624            let to_remove = ["parent"];
23625            params.remove_params(&to_remove);
23626        }
23627
23628        let url = params.parse_with_url(&url);
23629
23630        loop {
23631            let token = match self
23632                .hub
23633                .auth
23634                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
23635                .await
23636            {
23637                Ok(token) => token,
23638                Err(e) => match dlg.token(e) {
23639                    Ok(token) => token,
23640                    Err(e) => {
23641                        dlg.finished(false);
23642                        return Err(common::Error::MissingToken(e));
23643                    }
23644                },
23645            };
23646            let mut req_result = {
23647                let client = &self.hub.client;
23648                dlg.pre_request();
23649                let mut req_builder = hyper::Request::builder()
23650                    .method(hyper::Method::GET)
23651                    .uri(url.as_str())
23652                    .header(USER_AGENT, self.hub._user_agent.clone());
23653
23654                if let Some(token) = token.as_ref() {
23655                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
23656                }
23657
23658                let request = req_builder
23659                    .header(CONTENT_LENGTH, 0_u64)
23660                    .body(common::to_body::<String>(None));
23661
23662                client.request(request.unwrap()).await
23663            };
23664
23665            match req_result {
23666                Err(err) => {
23667                    if let common::Retry::After(d) = dlg.http_error(&err) {
23668                        sleep(d).await;
23669                        continue;
23670                    }
23671                    dlg.finished(false);
23672                    return Err(common::Error::HttpError(err));
23673                }
23674                Ok(res) => {
23675                    let (mut parts, body) = res.into_parts();
23676                    let mut body = common::Body::new(body);
23677                    if !parts.status.is_success() {
23678                        let bytes = common::to_bytes(body).await.unwrap_or_default();
23679                        let error = serde_json::from_str(&common::to_string(&bytes));
23680                        let response = common::to_response(parts, bytes.into());
23681
23682                        if let common::Retry::After(d) =
23683                            dlg.http_failure(&response, error.as_ref().ok())
23684                        {
23685                            sleep(d).await;
23686                            continue;
23687                        }
23688
23689                        dlg.finished(false);
23690
23691                        return Err(match error {
23692                            Ok(value) => common::Error::BadRequest(value),
23693                            _ => common::Error::Failure(response),
23694                        });
23695                    }
23696                    let response = {
23697                        let bytes = common::to_bytes(body).await.unwrap_or_default();
23698                        let encoded = common::to_string(&bytes);
23699                        match serde_json::from_str(&encoded) {
23700                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
23701                            Err(error) => {
23702                                dlg.response_json_decode_error(&encoded, &error);
23703                                return Err(common::Error::JsonDecodeError(
23704                                    encoded.to_string(),
23705                                    error,
23706                                ));
23707                            }
23708                        }
23709                    };
23710
23711                    dlg.finished(true);
23712                    return Ok(response);
23713                }
23714            }
23715        }
23716    }
23717
23718    /// Required. The pool to list providers for.
23719    ///
23720    /// Sets the *parent* path property to the given value.
23721    ///
23722    /// Even though the property as already been set when instantiating this call,
23723    /// we provide this method for API completeness.
23724    pub fn parent(
23725        mut self,
23726        new_value: &str,
23727    ) -> ProjectLocationWorkloadIdentityPoolProviderListCall<'a, C> {
23728        self._parent = new_value.to_string();
23729        self
23730    }
23731    /// Whether to return soft-deleted providers.
23732    ///
23733    /// Sets the *show deleted* query property to the given value.
23734    pub fn show_deleted(
23735        mut self,
23736        new_value: bool,
23737    ) -> ProjectLocationWorkloadIdentityPoolProviderListCall<'a, C> {
23738        self._show_deleted = Some(new_value);
23739        self
23740    }
23741    /// A page token, received from a previous `ListWorkloadIdentityPoolProviders` call. Provide this to retrieve the subsequent page.
23742    ///
23743    /// Sets the *page token* query property to the given value.
23744    pub fn page_token(
23745        mut self,
23746        new_value: &str,
23747    ) -> ProjectLocationWorkloadIdentityPoolProviderListCall<'a, C> {
23748        self._page_token = Some(new_value.to_string());
23749        self
23750    }
23751    /// The maximum number of providers to return. If unspecified, at most 50 providers are returned. The maximum value is 100; values above 100 are truncated to 100.
23752    ///
23753    /// Sets the *page size* query property to the given value.
23754    pub fn page_size(
23755        mut self,
23756        new_value: i32,
23757    ) -> ProjectLocationWorkloadIdentityPoolProviderListCall<'a, C> {
23758        self._page_size = Some(new_value);
23759        self
23760    }
23761    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
23762    /// while executing the actual API request.
23763    ///
23764    /// ````text
23765    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
23766    /// ````
23767    ///
23768    /// Sets the *delegate* property to the given value.
23769    pub fn delegate(
23770        mut self,
23771        new_value: &'a mut dyn common::Delegate,
23772    ) -> ProjectLocationWorkloadIdentityPoolProviderListCall<'a, C> {
23773        self._delegate = Some(new_value);
23774        self
23775    }
23776
23777    /// Set any additional parameter of the query string used in the request.
23778    /// It should be used to set parameters which are not yet available through their own
23779    /// setters.
23780    ///
23781    /// Please note that this method must not be used to set any of the known parameters
23782    /// which have their own setter method. If done anyway, the request will fail.
23783    ///
23784    /// # Additional Parameters
23785    ///
23786    /// * *$.xgafv* (query-string) - V1 error format.
23787    /// * *access_token* (query-string) - OAuth access token.
23788    /// * *alt* (query-string) - Data format for response.
23789    /// * *callback* (query-string) - JSONP
23790    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
23791    /// * *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.
23792    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
23793    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
23794    /// * *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.
23795    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
23796    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
23797    pub fn param<T>(
23798        mut self,
23799        name: T,
23800        value: T,
23801    ) -> ProjectLocationWorkloadIdentityPoolProviderListCall<'a, C>
23802    where
23803        T: AsRef<str>,
23804    {
23805        self._additional_params
23806            .insert(name.as_ref().to_string(), value.as_ref().to_string());
23807        self
23808    }
23809
23810    /// Identifies the authorization scope for the method you are building.
23811    ///
23812    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
23813    /// [`Scope::CloudPlatform`].
23814    ///
23815    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
23816    /// tokens for more than one scope.
23817    ///
23818    /// Usually there is more than one suitable scope to authorize an operation, some of which may
23819    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
23820    /// sufficient, a read-write scope will do as well.
23821    pub fn add_scope<St>(
23822        mut self,
23823        scope: St,
23824    ) -> ProjectLocationWorkloadIdentityPoolProviderListCall<'a, C>
23825    where
23826        St: AsRef<str>,
23827    {
23828        self._scopes.insert(String::from(scope.as_ref()));
23829        self
23830    }
23831    /// Identifies the authorization scope(s) for the method you are building.
23832    ///
23833    /// See [`Self::add_scope()`] for details.
23834    pub fn add_scopes<I, St>(
23835        mut self,
23836        scopes: I,
23837    ) -> ProjectLocationWorkloadIdentityPoolProviderListCall<'a, C>
23838    where
23839        I: IntoIterator<Item = St>,
23840        St: AsRef<str>,
23841    {
23842        self._scopes
23843            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
23844        self
23845    }
23846
23847    /// Removes all scopes, and no default scope will be used either.
23848    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
23849    /// for details).
23850    pub fn clear_scopes(mut self) -> ProjectLocationWorkloadIdentityPoolProviderListCall<'a, C> {
23851        self._scopes.clear();
23852        self
23853    }
23854}
23855
23856/// Updates an existing WorkloadIdentityPoolProvider.
23857///
23858/// A builder for the *locations.workloadIdentityPools.providers.patch* method supported by a *project* resource.
23859/// It is not used directly, but through a [`ProjectMethods`] instance.
23860///
23861/// # Example
23862///
23863/// Instantiate a resource method builder
23864///
23865/// ```test_harness,no_run
23866/// # extern crate hyper;
23867/// # extern crate hyper_rustls;
23868/// # extern crate google_iam1 as iam1;
23869/// use iam1::api::WorkloadIdentityPoolProvider;
23870/// # async fn dox() {
23871/// # use iam1::{Iam, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
23872///
23873/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
23874/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
23875/// #     secret,
23876/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
23877/// # ).build().await.unwrap();
23878///
23879/// # let client = hyper_util::client::legacy::Client::builder(
23880/// #     hyper_util::rt::TokioExecutor::new()
23881/// # )
23882/// # .build(
23883/// #     hyper_rustls::HttpsConnectorBuilder::new()
23884/// #         .with_native_roots()
23885/// #         .unwrap()
23886/// #         .https_or_http()
23887/// #         .enable_http1()
23888/// #         .build()
23889/// # );
23890/// # let mut hub = Iam::new(client, auth);
23891/// // As the method needs a request, you would usually fill it with the desired information
23892/// // into the respective structure. Some of the parts shown here might not be applicable !
23893/// // Values shown here are possibly random and not representative !
23894/// let mut req = WorkloadIdentityPoolProvider::default();
23895///
23896/// // You can configure optional parameters by calling the respective setters at will, and
23897/// // execute the final call using `doit()`.
23898/// // Values shown here are possibly random and not representative !
23899/// let result = hub.projects().locations_workload_identity_pools_providers_patch(req, "name")
23900///              .update_mask(FieldMask::new::<&str>(&[]))
23901///              .doit().await;
23902/// # }
23903/// ```
23904pub struct ProjectLocationWorkloadIdentityPoolProviderPatchCall<'a, C>
23905where
23906    C: 'a,
23907{
23908    hub: &'a Iam<C>,
23909    _request: WorkloadIdentityPoolProvider,
23910    _name: String,
23911    _update_mask: Option<common::FieldMask>,
23912    _delegate: Option<&'a mut dyn common::Delegate>,
23913    _additional_params: HashMap<String, String>,
23914    _scopes: BTreeSet<String>,
23915}
23916
23917impl<'a, C> common::CallBuilder for ProjectLocationWorkloadIdentityPoolProviderPatchCall<'a, C> {}
23918
23919impl<'a, C> ProjectLocationWorkloadIdentityPoolProviderPatchCall<'a, C>
23920where
23921    C: common::Connector,
23922{
23923    /// Perform the operation you have build so far.
23924    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
23925        use std::borrow::Cow;
23926        use std::io::{Read, Seek};
23927
23928        use common::{url::Params, ToParts};
23929        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
23930
23931        let mut dd = common::DefaultDelegate;
23932        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
23933        dlg.begin(common::MethodInfo {
23934            id: "iam.projects.locations.workloadIdentityPools.providers.patch",
23935            http_method: hyper::Method::PATCH,
23936        });
23937
23938        for &field in ["alt", "name", "updateMask"].iter() {
23939            if self._additional_params.contains_key(field) {
23940                dlg.finished(false);
23941                return Err(common::Error::FieldClash(field));
23942            }
23943        }
23944
23945        let mut params = Params::with_capacity(5 + self._additional_params.len());
23946        params.push("name", self._name);
23947        if let Some(value) = self._update_mask.as_ref() {
23948            params.push("updateMask", value.to_string());
23949        }
23950
23951        params.extend(self._additional_params.iter());
23952
23953        params.push("alt", "json");
23954        let mut url = self.hub._base_url.clone() + "v1/{+name}";
23955        if self._scopes.is_empty() {
23956            self._scopes
23957                .insert(Scope::CloudPlatform.as_ref().to_string());
23958        }
23959
23960        #[allow(clippy::single_element_loop)]
23961        for &(find_this, param_name) in [("{+name}", "name")].iter() {
23962            url = params.uri_replacement(url, param_name, find_this, true);
23963        }
23964        {
23965            let to_remove = ["name"];
23966            params.remove_params(&to_remove);
23967        }
23968
23969        let url = params.parse_with_url(&url);
23970
23971        let mut json_mime_type = mime::APPLICATION_JSON;
23972        let mut request_value_reader = {
23973            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
23974            common::remove_json_null_values(&mut value);
23975            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
23976            serde_json::to_writer(&mut dst, &value).unwrap();
23977            dst
23978        };
23979        let request_size = request_value_reader
23980            .seek(std::io::SeekFrom::End(0))
23981            .unwrap();
23982        request_value_reader
23983            .seek(std::io::SeekFrom::Start(0))
23984            .unwrap();
23985
23986        loop {
23987            let token = match self
23988                .hub
23989                .auth
23990                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
23991                .await
23992            {
23993                Ok(token) => token,
23994                Err(e) => match dlg.token(e) {
23995                    Ok(token) => token,
23996                    Err(e) => {
23997                        dlg.finished(false);
23998                        return Err(common::Error::MissingToken(e));
23999                    }
24000                },
24001            };
24002            request_value_reader
24003                .seek(std::io::SeekFrom::Start(0))
24004                .unwrap();
24005            let mut req_result = {
24006                let client = &self.hub.client;
24007                dlg.pre_request();
24008                let mut req_builder = hyper::Request::builder()
24009                    .method(hyper::Method::PATCH)
24010                    .uri(url.as_str())
24011                    .header(USER_AGENT, self.hub._user_agent.clone());
24012
24013                if let Some(token) = token.as_ref() {
24014                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
24015                }
24016
24017                let request = req_builder
24018                    .header(CONTENT_TYPE, json_mime_type.to_string())
24019                    .header(CONTENT_LENGTH, request_size as u64)
24020                    .body(common::to_body(
24021                        request_value_reader.get_ref().clone().into(),
24022                    ));
24023
24024                client.request(request.unwrap()).await
24025            };
24026
24027            match req_result {
24028                Err(err) => {
24029                    if let common::Retry::After(d) = dlg.http_error(&err) {
24030                        sleep(d).await;
24031                        continue;
24032                    }
24033                    dlg.finished(false);
24034                    return Err(common::Error::HttpError(err));
24035                }
24036                Ok(res) => {
24037                    let (mut parts, body) = res.into_parts();
24038                    let mut body = common::Body::new(body);
24039                    if !parts.status.is_success() {
24040                        let bytes = common::to_bytes(body).await.unwrap_or_default();
24041                        let error = serde_json::from_str(&common::to_string(&bytes));
24042                        let response = common::to_response(parts, bytes.into());
24043
24044                        if let common::Retry::After(d) =
24045                            dlg.http_failure(&response, error.as_ref().ok())
24046                        {
24047                            sleep(d).await;
24048                            continue;
24049                        }
24050
24051                        dlg.finished(false);
24052
24053                        return Err(match error {
24054                            Ok(value) => common::Error::BadRequest(value),
24055                            _ => common::Error::Failure(response),
24056                        });
24057                    }
24058                    let response = {
24059                        let bytes = common::to_bytes(body).await.unwrap_or_default();
24060                        let encoded = common::to_string(&bytes);
24061                        match serde_json::from_str(&encoded) {
24062                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
24063                            Err(error) => {
24064                                dlg.response_json_decode_error(&encoded, &error);
24065                                return Err(common::Error::JsonDecodeError(
24066                                    encoded.to_string(),
24067                                    error,
24068                                ));
24069                            }
24070                        }
24071                    };
24072
24073                    dlg.finished(true);
24074                    return Ok(response);
24075                }
24076            }
24077        }
24078    }
24079
24080    ///
24081    /// Sets the *request* property to the given value.
24082    ///
24083    /// Even though the property as already been set when instantiating this call,
24084    /// we provide this method for API completeness.
24085    pub fn request(
24086        mut self,
24087        new_value: WorkloadIdentityPoolProvider,
24088    ) -> ProjectLocationWorkloadIdentityPoolProviderPatchCall<'a, C> {
24089        self._request = new_value;
24090        self
24091    }
24092    /// Output only. The resource name of the provider.
24093    ///
24094    /// Sets the *name* path property to the given value.
24095    ///
24096    /// Even though the property as already been set when instantiating this call,
24097    /// we provide this method for API completeness.
24098    pub fn name(
24099        mut self,
24100        new_value: &str,
24101    ) -> ProjectLocationWorkloadIdentityPoolProviderPatchCall<'a, C> {
24102        self._name = new_value.to_string();
24103        self
24104    }
24105    /// Required. The list of fields to update.
24106    ///
24107    /// Sets the *update mask* query property to the given value.
24108    pub fn update_mask(
24109        mut self,
24110        new_value: common::FieldMask,
24111    ) -> ProjectLocationWorkloadIdentityPoolProviderPatchCall<'a, C> {
24112        self._update_mask = Some(new_value);
24113        self
24114    }
24115    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
24116    /// while executing the actual API request.
24117    ///
24118    /// ````text
24119    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
24120    /// ````
24121    ///
24122    /// Sets the *delegate* property to the given value.
24123    pub fn delegate(
24124        mut self,
24125        new_value: &'a mut dyn common::Delegate,
24126    ) -> ProjectLocationWorkloadIdentityPoolProviderPatchCall<'a, C> {
24127        self._delegate = Some(new_value);
24128        self
24129    }
24130
24131    /// Set any additional parameter of the query string used in the request.
24132    /// It should be used to set parameters which are not yet available through their own
24133    /// setters.
24134    ///
24135    /// Please note that this method must not be used to set any of the known parameters
24136    /// which have their own setter method. If done anyway, the request will fail.
24137    ///
24138    /// # Additional Parameters
24139    ///
24140    /// * *$.xgafv* (query-string) - V1 error format.
24141    /// * *access_token* (query-string) - OAuth access token.
24142    /// * *alt* (query-string) - Data format for response.
24143    /// * *callback* (query-string) - JSONP
24144    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
24145    /// * *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.
24146    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
24147    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
24148    /// * *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.
24149    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
24150    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
24151    pub fn param<T>(
24152        mut self,
24153        name: T,
24154        value: T,
24155    ) -> ProjectLocationWorkloadIdentityPoolProviderPatchCall<'a, C>
24156    where
24157        T: AsRef<str>,
24158    {
24159        self._additional_params
24160            .insert(name.as_ref().to_string(), value.as_ref().to_string());
24161        self
24162    }
24163
24164    /// Identifies the authorization scope for the method you are building.
24165    ///
24166    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
24167    /// [`Scope::CloudPlatform`].
24168    ///
24169    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
24170    /// tokens for more than one scope.
24171    ///
24172    /// Usually there is more than one suitable scope to authorize an operation, some of which may
24173    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
24174    /// sufficient, a read-write scope will do as well.
24175    pub fn add_scope<St>(
24176        mut self,
24177        scope: St,
24178    ) -> ProjectLocationWorkloadIdentityPoolProviderPatchCall<'a, C>
24179    where
24180        St: AsRef<str>,
24181    {
24182        self._scopes.insert(String::from(scope.as_ref()));
24183        self
24184    }
24185    /// Identifies the authorization scope(s) for the method you are building.
24186    ///
24187    /// See [`Self::add_scope()`] for details.
24188    pub fn add_scopes<I, St>(
24189        mut self,
24190        scopes: I,
24191    ) -> ProjectLocationWorkloadIdentityPoolProviderPatchCall<'a, C>
24192    where
24193        I: IntoIterator<Item = St>,
24194        St: AsRef<str>,
24195    {
24196        self._scopes
24197            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
24198        self
24199    }
24200
24201    /// Removes all scopes, and no default scope will be used either.
24202    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
24203    /// for details).
24204    pub fn clear_scopes(mut self) -> ProjectLocationWorkloadIdentityPoolProviderPatchCall<'a, C> {
24205        self._scopes.clear();
24206        self
24207    }
24208}
24209
24210/// Undeletes a WorkloadIdentityPoolProvider, as long as it was deleted fewer than 30 days ago.
24211///
24212/// A builder for the *locations.workloadIdentityPools.providers.undelete* method supported by a *project* resource.
24213/// It is not used directly, but through a [`ProjectMethods`] instance.
24214///
24215/// # Example
24216///
24217/// Instantiate a resource method builder
24218///
24219/// ```test_harness,no_run
24220/// # extern crate hyper;
24221/// # extern crate hyper_rustls;
24222/// # extern crate google_iam1 as iam1;
24223/// use iam1::api::UndeleteWorkloadIdentityPoolProviderRequest;
24224/// # async fn dox() {
24225/// # use iam1::{Iam, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
24226///
24227/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
24228/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
24229/// #     secret,
24230/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
24231/// # ).build().await.unwrap();
24232///
24233/// # let client = hyper_util::client::legacy::Client::builder(
24234/// #     hyper_util::rt::TokioExecutor::new()
24235/// # )
24236/// # .build(
24237/// #     hyper_rustls::HttpsConnectorBuilder::new()
24238/// #         .with_native_roots()
24239/// #         .unwrap()
24240/// #         .https_or_http()
24241/// #         .enable_http1()
24242/// #         .build()
24243/// # );
24244/// # let mut hub = Iam::new(client, auth);
24245/// // As the method needs a request, you would usually fill it with the desired information
24246/// // into the respective structure. Some of the parts shown here might not be applicable !
24247/// // Values shown here are possibly random and not representative !
24248/// let mut req = UndeleteWorkloadIdentityPoolProviderRequest::default();
24249///
24250/// // You can configure optional parameters by calling the respective setters at will, and
24251/// // execute the final call using `doit()`.
24252/// // Values shown here are possibly random and not representative !
24253/// let result = hub.projects().locations_workload_identity_pools_providers_undelete(req, "name")
24254///              .doit().await;
24255/// # }
24256/// ```
24257pub struct ProjectLocationWorkloadIdentityPoolProviderUndeleteCall<'a, C>
24258where
24259    C: 'a,
24260{
24261    hub: &'a Iam<C>,
24262    _request: UndeleteWorkloadIdentityPoolProviderRequest,
24263    _name: String,
24264    _delegate: Option<&'a mut dyn common::Delegate>,
24265    _additional_params: HashMap<String, String>,
24266    _scopes: BTreeSet<String>,
24267}
24268
24269impl<'a, C> common::CallBuilder for ProjectLocationWorkloadIdentityPoolProviderUndeleteCall<'a, C> {}
24270
24271impl<'a, C> ProjectLocationWorkloadIdentityPoolProviderUndeleteCall<'a, C>
24272where
24273    C: common::Connector,
24274{
24275    /// Perform the operation you have build so far.
24276    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
24277        use std::borrow::Cow;
24278        use std::io::{Read, Seek};
24279
24280        use common::{url::Params, ToParts};
24281        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
24282
24283        let mut dd = common::DefaultDelegate;
24284        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
24285        dlg.begin(common::MethodInfo {
24286            id: "iam.projects.locations.workloadIdentityPools.providers.undelete",
24287            http_method: hyper::Method::POST,
24288        });
24289
24290        for &field in ["alt", "name"].iter() {
24291            if self._additional_params.contains_key(field) {
24292                dlg.finished(false);
24293                return Err(common::Error::FieldClash(field));
24294            }
24295        }
24296
24297        let mut params = Params::with_capacity(4 + self._additional_params.len());
24298        params.push("name", self._name);
24299
24300        params.extend(self._additional_params.iter());
24301
24302        params.push("alt", "json");
24303        let mut url = self.hub._base_url.clone() + "v1/{+name}:undelete";
24304        if self._scopes.is_empty() {
24305            self._scopes
24306                .insert(Scope::CloudPlatform.as_ref().to_string());
24307        }
24308
24309        #[allow(clippy::single_element_loop)]
24310        for &(find_this, param_name) in [("{+name}", "name")].iter() {
24311            url = params.uri_replacement(url, param_name, find_this, true);
24312        }
24313        {
24314            let to_remove = ["name"];
24315            params.remove_params(&to_remove);
24316        }
24317
24318        let url = params.parse_with_url(&url);
24319
24320        let mut json_mime_type = mime::APPLICATION_JSON;
24321        let mut request_value_reader = {
24322            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
24323            common::remove_json_null_values(&mut value);
24324            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
24325            serde_json::to_writer(&mut dst, &value).unwrap();
24326            dst
24327        };
24328        let request_size = request_value_reader
24329            .seek(std::io::SeekFrom::End(0))
24330            .unwrap();
24331        request_value_reader
24332            .seek(std::io::SeekFrom::Start(0))
24333            .unwrap();
24334
24335        loop {
24336            let token = match self
24337                .hub
24338                .auth
24339                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
24340                .await
24341            {
24342                Ok(token) => token,
24343                Err(e) => match dlg.token(e) {
24344                    Ok(token) => token,
24345                    Err(e) => {
24346                        dlg.finished(false);
24347                        return Err(common::Error::MissingToken(e));
24348                    }
24349                },
24350            };
24351            request_value_reader
24352                .seek(std::io::SeekFrom::Start(0))
24353                .unwrap();
24354            let mut req_result = {
24355                let client = &self.hub.client;
24356                dlg.pre_request();
24357                let mut req_builder = hyper::Request::builder()
24358                    .method(hyper::Method::POST)
24359                    .uri(url.as_str())
24360                    .header(USER_AGENT, self.hub._user_agent.clone());
24361
24362                if let Some(token) = token.as_ref() {
24363                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
24364                }
24365
24366                let request = req_builder
24367                    .header(CONTENT_TYPE, json_mime_type.to_string())
24368                    .header(CONTENT_LENGTH, request_size as u64)
24369                    .body(common::to_body(
24370                        request_value_reader.get_ref().clone().into(),
24371                    ));
24372
24373                client.request(request.unwrap()).await
24374            };
24375
24376            match req_result {
24377                Err(err) => {
24378                    if let common::Retry::After(d) = dlg.http_error(&err) {
24379                        sleep(d).await;
24380                        continue;
24381                    }
24382                    dlg.finished(false);
24383                    return Err(common::Error::HttpError(err));
24384                }
24385                Ok(res) => {
24386                    let (mut parts, body) = res.into_parts();
24387                    let mut body = common::Body::new(body);
24388                    if !parts.status.is_success() {
24389                        let bytes = common::to_bytes(body).await.unwrap_or_default();
24390                        let error = serde_json::from_str(&common::to_string(&bytes));
24391                        let response = common::to_response(parts, bytes.into());
24392
24393                        if let common::Retry::After(d) =
24394                            dlg.http_failure(&response, error.as_ref().ok())
24395                        {
24396                            sleep(d).await;
24397                            continue;
24398                        }
24399
24400                        dlg.finished(false);
24401
24402                        return Err(match error {
24403                            Ok(value) => common::Error::BadRequest(value),
24404                            _ => common::Error::Failure(response),
24405                        });
24406                    }
24407                    let response = {
24408                        let bytes = common::to_bytes(body).await.unwrap_or_default();
24409                        let encoded = common::to_string(&bytes);
24410                        match serde_json::from_str(&encoded) {
24411                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
24412                            Err(error) => {
24413                                dlg.response_json_decode_error(&encoded, &error);
24414                                return Err(common::Error::JsonDecodeError(
24415                                    encoded.to_string(),
24416                                    error,
24417                                ));
24418                            }
24419                        }
24420                    };
24421
24422                    dlg.finished(true);
24423                    return Ok(response);
24424                }
24425            }
24426        }
24427    }
24428
24429    ///
24430    /// Sets the *request* property to the given value.
24431    ///
24432    /// Even though the property as already been set when instantiating this call,
24433    /// we provide this method for API completeness.
24434    pub fn request(
24435        mut self,
24436        new_value: UndeleteWorkloadIdentityPoolProviderRequest,
24437    ) -> ProjectLocationWorkloadIdentityPoolProviderUndeleteCall<'a, C> {
24438        self._request = new_value;
24439        self
24440    }
24441    /// Required. The name of the provider to undelete.
24442    ///
24443    /// Sets the *name* path property to the given value.
24444    ///
24445    /// Even though the property as already been set when instantiating this call,
24446    /// we provide this method for API completeness.
24447    pub fn name(
24448        mut self,
24449        new_value: &str,
24450    ) -> ProjectLocationWorkloadIdentityPoolProviderUndeleteCall<'a, C> {
24451        self._name = new_value.to_string();
24452        self
24453    }
24454    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
24455    /// while executing the actual API request.
24456    ///
24457    /// ````text
24458    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
24459    /// ````
24460    ///
24461    /// Sets the *delegate* property to the given value.
24462    pub fn delegate(
24463        mut self,
24464        new_value: &'a mut dyn common::Delegate,
24465    ) -> ProjectLocationWorkloadIdentityPoolProviderUndeleteCall<'a, C> {
24466        self._delegate = Some(new_value);
24467        self
24468    }
24469
24470    /// Set any additional parameter of the query string used in the request.
24471    /// It should be used to set parameters which are not yet available through their own
24472    /// setters.
24473    ///
24474    /// Please note that this method must not be used to set any of the known parameters
24475    /// which have their own setter method. If done anyway, the request will fail.
24476    ///
24477    /// # Additional Parameters
24478    ///
24479    /// * *$.xgafv* (query-string) - V1 error format.
24480    /// * *access_token* (query-string) - OAuth access token.
24481    /// * *alt* (query-string) - Data format for response.
24482    /// * *callback* (query-string) - JSONP
24483    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
24484    /// * *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.
24485    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
24486    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
24487    /// * *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.
24488    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
24489    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
24490    pub fn param<T>(
24491        mut self,
24492        name: T,
24493        value: T,
24494    ) -> ProjectLocationWorkloadIdentityPoolProviderUndeleteCall<'a, C>
24495    where
24496        T: AsRef<str>,
24497    {
24498        self._additional_params
24499            .insert(name.as_ref().to_string(), value.as_ref().to_string());
24500        self
24501    }
24502
24503    /// Identifies the authorization scope for the method you are building.
24504    ///
24505    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
24506    /// [`Scope::CloudPlatform`].
24507    ///
24508    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
24509    /// tokens for more than one scope.
24510    ///
24511    /// Usually there is more than one suitable scope to authorize an operation, some of which may
24512    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
24513    /// sufficient, a read-write scope will do as well.
24514    pub fn add_scope<St>(
24515        mut self,
24516        scope: St,
24517    ) -> ProjectLocationWorkloadIdentityPoolProviderUndeleteCall<'a, C>
24518    where
24519        St: AsRef<str>,
24520    {
24521        self._scopes.insert(String::from(scope.as_ref()));
24522        self
24523    }
24524    /// Identifies the authorization scope(s) for the method you are building.
24525    ///
24526    /// See [`Self::add_scope()`] for details.
24527    pub fn add_scopes<I, St>(
24528        mut self,
24529        scopes: I,
24530    ) -> ProjectLocationWorkloadIdentityPoolProviderUndeleteCall<'a, C>
24531    where
24532        I: IntoIterator<Item = St>,
24533        St: AsRef<str>,
24534    {
24535        self._scopes
24536            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
24537        self
24538    }
24539
24540    /// Removes all scopes, and no default scope will be used either.
24541    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
24542    /// for details).
24543    pub fn clear_scopes(
24544        mut self,
24545    ) -> ProjectLocationWorkloadIdentityPoolProviderUndeleteCall<'a, C> {
24546        self._scopes.clear();
24547        self
24548    }
24549}
24550
24551/// Creates a new WorkloadIdentityPool. You cannot reuse the name of a deleted pool until 30 days after deletion.
24552///
24553/// A builder for the *locations.workloadIdentityPools.create* method supported by a *project* resource.
24554/// It is not used directly, but through a [`ProjectMethods`] instance.
24555///
24556/// # Example
24557///
24558/// Instantiate a resource method builder
24559///
24560/// ```test_harness,no_run
24561/// # extern crate hyper;
24562/// # extern crate hyper_rustls;
24563/// # extern crate google_iam1 as iam1;
24564/// use iam1::api::WorkloadIdentityPool;
24565/// # async fn dox() {
24566/// # use iam1::{Iam, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
24567///
24568/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
24569/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
24570/// #     secret,
24571/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
24572/// # ).build().await.unwrap();
24573///
24574/// # let client = hyper_util::client::legacy::Client::builder(
24575/// #     hyper_util::rt::TokioExecutor::new()
24576/// # )
24577/// # .build(
24578/// #     hyper_rustls::HttpsConnectorBuilder::new()
24579/// #         .with_native_roots()
24580/// #         .unwrap()
24581/// #         .https_or_http()
24582/// #         .enable_http1()
24583/// #         .build()
24584/// # );
24585/// # let mut hub = Iam::new(client, auth);
24586/// // As the method needs a request, you would usually fill it with the desired information
24587/// // into the respective structure. Some of the parts shown here might not be applicable !
24588/// // Values shown here are possibly random and not representative !
24589/// let mut req = WorkloadIdentityPool::default();
24590///
24591/// // You can configure optional parameters by calling the respective setters at will, and
24592/// // execute the final call using `doit()`.
24593/// // Values shown here are possibly random and not representative !
24594/// let result = hub.projects().locations_workload_identity_pools_create(req, "parent")
24595///              .workload_identity_pool_id("no")
24596///              .doit().await;
24597/// # }
24598/// ```
24599pub struct ProjectLocationWorkloadIdentityPoolCreateCall<'a, C>
24600where
24601    C: 'a,
24602{
24603    hub: &'a Iam<C>,
24604    _request: WorkloadIdentityPool,
24605    _parent: String,
24606    _workload_identity_pool_id: Option<String>,
24607    _delegate: Option<&'a mut dyn common::Delegate>,
24608    _additional_params: HashMap<String, String>,
24609    _scopes: BTreeSet<String>,
24610}
24611
24612impl<'a, C> common::CallBuilder for ProjectLocationWorkloadIdentityPoolCreateCall<'a, C> {}
24613
24614impl<'a, C> ProjectLocationWorkloadIdentityPoolCreateCall<'a, C>
24615where
24616    C: common::Connector,
24617{
24618    /// Perform the operation you have build so far.
24619    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
24620        use std::borrow::Cow;
24621        use std::io::{Read, Seek};
24622
24623        use common::{url::Params, ToParts};
24624        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
24625
24626        let mut dd = common::DefaultDelegate;
24627        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
24628        dlg.begin(common::MethodInfo {
24629            id: "iam.projects.locations.workloadIdentityPools.create",
24630            http_method: hyper::Method::POST,
24631        });
24632
24633        for &field in ["alt", "parent", "workloadIdentityPoolId"].iter() {
24634            if self._additional_params.contains_key(field) {
24635                dlg.finished(false);
24636                return Err(common::Error::FieldClash(field));
24637            }
24638        }
24639
24640        let mut params = Params::with_capacity(5 + self._additional_params.len());
24641        params.push("parent", self._parent);
24642        if let Some(value) = self._workload_identity_pool_id.as_ref() {
24643            params.push("workloadIdentityPoolId", value);
24644        }
24645
24646        params.extend(self._additional_params.iter());
24647
24648        params.push("alt", "json");
24649        let mut url = self.hub._base_url.clone() + "v1/{+parent}/workloadIdentityPools";
24650        if self._scopes.is_empty() {
24651            self._scopes
24652                .insert(Scope::CloudPlatform.as_ref().to_string());
24653        }
24654
24655        #[allow(clippy::single_element_loop)]
24656        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
24657            url = params.uri_replacement(url, param_name, find_this, true);
24658        }
24659        {
24660            let to_remove = ["parent"];
24661            params.remove_params(&to_remove);
24662        }
24663
24664        let url = params.parse_with_url(&url);
24665
24666        let mut json_mime_type = mime::APPLICATION_JSON;
24667        let mut request_value_reader = {
24668            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
24669            common::remove_json_null_values(&mut value);
24670            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
24671            serde_json::to_writer(&mut dst, &value).unwrap();
24672            dst
24673        };
24674        let request_size = request_value_reader
24675            .seek(std::io::SeekFrom::End(0))
24676            .unwrap();
24677        request_value_reader
24678            .seek(std::io::SeekFrom::Start(0))
24679            .unwrap();
24680
24681        loop {
24682            let token = match self
24683                .hub
24684                .auth
24685                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
24686                .await
24687            {
24688                Ok(token) => token,
24689                Err(e) => match dlg.token(e) {
24690                    Ok(token) => token,
24691                    Err(e) => {
24692                        dlg.finished(false);
24693                        return Err(common::Error::MissingToken(e));
24694                    }
24695                },
24696            };
24697            request_value_reader
24698                .seek(std::io::SeekFrom::Start(0))
24699                .unwrap();
24700            let mut req_result = {
24701                let client = &self.hub.client;
24702                dlg.pre_request();
24703                let mut req_builder = hyper::Request::builder()
24704                    .method(hyper::Method::POST)
24705                    .uri(url.as_str())
24706                    .header(USER_AGENT, self.hub._user_agent.clone());
24707
24708                if let Some(token) = token.as_ref() {
24709                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
24710                }
24711
24712                let request = req_builder
24713                    .header(CONTENT_TYPE, json_mime_type.to_string())
24714                    .header(CONTENT_LENGTH, request_size as u64)
24715                    .body(common::to_body(
24716                        request_value_reader.get_ref().clone().into(),
24717                    ));
24718
24719                client.request(request.unwrap()).await
24720            };
24721
24722            match req_result {
24723                Err(err) => {
24724                    if let common::Retry::After(d) = dlg.http_error(&err) {
24725                        sleep(d).await;
24726                        continue;
24727                    }
24728                    dlg.finished(false);
24729                    return Err(common::Error::HttpError(err));
24730                }
24731                Ok(res) => {
24732                    let (mut parts, body) = res.into_parts();
24733                    let mut body = common::Body::new(body);
24734                    if !parts.status.is_success() {
24735                        let bytes = common::to_bytes(body).await.unwrap_or_default();
24736                        let error = serde_json::from_str(&common::to_string(&bytes));
24737                        let response = common::to_response(parts, bytes.into());
24738
24739                        if let common::Retry::After(d) =
24740                            dlg.http_failure(&response, error.as_ref().ok())
24741                        {
24742                            sleep(d).await;
24743                            continue;
24744                        }
24745
24746                        dlg.finished(false);
24747
24748                        return Err(match error {
24749                            Ok(value) => common::Error::BadRequest(value),
24750                            _ => common::Error::Failure(response),
24751                        });
24752                    }
24753                    let response = {
24754                        let bytes = common::to_bytes(body).await.unwrap_or_default();
24755                        let encoded = common::to_string(&bytes);
24756                        match serde_json::from_str(&encoded) {
24757                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
24758                            Err(error) => {
24759                                dlg.response_json_decode_error(&encoded, &error);
24760                                return Err(common::Error::JsonDecodeError(
24761                                    encoded.to_string(),
24762                                    error,
24763                                ));
24764                            }
24765                        }
24766                    };
24767
24768                    dlg.finished(true);
24769                    return Ok(response);
24770                }
24771            }
24772        }
24773    }
24774
24775    ///
24776    /// Sets the *request* property to the given value.
24777    ///
24778    /// Even though the property as already been set when instantiating this call,
24779    /// we provide this method for API completeness.
24780    pub fn request(
24781        mut self,
24782        new_value: WorkloadIdentityPool,
24783    ) -> ProjectLocationWorkloadIdentityPoolCreateCall<'a, C> {
24784        self._request = new_value;
24785        self
24786    }
24787    /// Required. The parent resource to create the pool in. The only supported location is `global`.
24788    ///
24789    /// Sets the *parent* path property to the given value.
24790    ///
24791    /// Even though the property as already been set when instantiating this call,
24792    /// we provide this method for API completeness.
24793    pub fn parent(
24794        mut self,
24795        new_value: &str,
24796    ) -> ProjectLocationWorkloadIdentityPoolCreateCall<'a, C> {
24797        self._parent = new_value.to_string();
24798        self
24799    }
24800    /// Required. The ID to use for the pool, which becomes the final component of the resource name. This value should be 4-32 characters, and may contain the characters [a-z0-9-]. The prefix `gcp-` is reserved for use by Google, and may not be specified.
24801    ///
24802    /// Sets the *workload identity pool id* query property to the given value.
24803    pub fn workload_identity_pool_id(
24804        mut self,
24805        new_value: &str,
24806    ) -> ProjectLocationWorkloadIdentityPoolCreateCall<'a, C> {
24807        self._workload_identity_pool_id = Some(new_value.to_string());
24808        self
24809    }
24810    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
24811    /// while executing the actual API request.
24812    ///
24813    /// ````text
24814    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
24815    /// ````
24816    ///
24817    /// Sets the *delegate* property to the given value.
24818    pub fn delegate(
24819        mut self,
24820        new_value: &'a mut dyn common::Delegate,
24821    ) -> ProjectLocationWorkloadIdentityPoolCreateCall<'a, C> {
24822        self._delegate = Some(new_value);
24823        self
24824    }
24825
24826    /// Set any additional parameter of the query string used in the request.
24827    /// It should be used to set parameters which are not yet available through their own
24828    /// setters.
24829    ///
24830    /// Please note that this method must not be used to set any of the known parameters
24831    /// which have their own setter method. If done anyway, the request will fail.
24832    ///
24833    /// # Additional Parameters
24834    ///
24835    /// * *$.xgafv* (query-string) - V1 error format.
24836    /// * *access_token* (query-string) - OAuth access token.
24837    /// * *alt* (query-string) - Data format for response.
24838    /// * *callback* (query-string) - JSONP
24839    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
24840    /// * *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.
24841    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
24842    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
24843    /// * *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.
24844    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
24845    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
24846    pub fn param<T>(
24847        mut self,
24848        name: T,
24849        value: T,
24850    ) -> ProjectLocationWorkloadIdentityPoolCreateCall<'a, C>
24851    where
24852        T: AsRef<str>,
24853    {
24854        self._additional_params
24855            .insert(name.as_ref().to_string(), value.as_ref().to_string());
24856        self
24857    }
24858
24859    /// Identifies the authorization scope for the method you are building.
24860    ///
24861    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
24862    /// [`Scope::CloudPlatform`].
24863    ///
24864    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
24865    /// tokens for more than one scope.
24866    ///
24867    /// Usually there is more than one suitable scope to authorize an operation, some of which may
24868    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
24869    /// sufficient, a read-write scope will do as well.
24870    pub fn add_scope<St>(
24871        mut self,
24872        scope: St,
24873    ) -> ProjectLocationWorkloadIdentityPoolCreateCall<'a, C>
24874    where
24875        St: AsRef<str>,
24876    {
24877        self._scopes.insert(String::from(scope.as_ref()));
24878        self
24879    }
24880    /// Identifies the authorization scope(s) for the method you are building.
24881    ///
24882    /// See [`Self::add_scope()`] for details.
24883    pub fn add_scopes<I, St>(
24884        mut self,
24885        scopes: I,
24886    ) -> ProjectLocationWorkloadIdentityPoolCreateCall<'a, C>
24887    where
24888        I: IntoIterator<Item = St>,
24889        St: AsRef<str>,
24890    {
24891        self._scopes
24892            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
24893        self
24894    }
24895
24896    /// Removes all scopes, and no default scope will be used either.
24897    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
24898    /// for details).
24899    pub fn clear_scopes(mut self) -> ProjectLocationWorkloadIdentityPoolCreateCall<'a, C> {
24900        self._scopes.clear();
24901        self
24902    }
24903}
24904
24905/// Deletes a WorkloadIdentityPool. You cannot use a deleted pool to exchange external credentials for Google Cloud credentials. However, deletion does not revoke credentials that have already been issued. Credentials issued for a deleted pool do not grant access to resources. If the pool is undeleted, and the credentials are not expired, they grant access again. You can undelete a pool for 30 days. After 30 days, deletion is permanent. You cannot update deleted pools. However, you can view and list them.
24906///
24907/// A builder for the *locations.workloadIdentityPools.delete* method supported by a *project* resource.
24908/// It is not used directly, but through a [`ProjectMethods`] instance.
24909///
24910/// # Example
24911///
24912/// Instantiate a resource method builder
24913///
24914/// ```test_harness,no_run
24915/// # extern crate hyper;
24916/// # extern crate hyper_rustls;
24917/// # extern crate google_iam1 as iam1;
24918/// # async fn dox() {
24919/// # use iam1::{Iam, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
24920///
24921/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
24922/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
24923/// #     secret,
24924/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
24925/// # ).build().await.unwrap();
24926///
24927/// # let client = hyper_util::client::legacy::Client::builder(
24928/// #     hyper_util::rt::TokioExecutor::new()
24929/// # )
24930/// # .build(
24931/// #     hyper_rustls::HttpsConnectorBuilder::new()
24932/// #         .with_native_roots()
24933/// #         .unwrap()
24934/// #         .https_or_http()
24935/// #         .enable_http1()
24936/// #         .build()
24937/// # );
24938/// # let mut hub = Iam::new(client, auth);
24939/// // You can configure optional parameters by calling the respective setters at will, and
24940/// // execute the final call using `doit()`.
24941/// // Values shown here are possibly random and not representative !
24942/// let result = hub.projects().locations_workload_identity_pools_delete("name")
24943///              .doit().await;
24944/// # }
24945/// ```
24946pub struct ProjectLocationWorkloadIdentityPoolDeleteCall<'a, C>
24947where
24948    C: 'a,
24949{
24950    hub: &'a Iam<C>,
24951    _name: String,
24952    _delegate: Option<&'a mut dyn common::Delegate>,
24953    _additional_params: HashMap<String, String>,
24954    _scopes: BTreeSet<String>,
24955}
24956
24957impl<'a, C> common::CallBuilder for ProjectLocationWorkloadIdentityPoolDeleteCall<'a, C> {}
24958
24959impl<'a, C> ProjectLocationWorkloadIdentityPoolDeleteCall<'a, C>
24960where
24961    C: common::Connector,
24962{
24963    /// Perform the operation you have build so far.
24964    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
24965        use std::borrow::Cow;
24966        use std::io::{Read, Seek};
24967
24968        use common::{url::Params, ToParts};
24969        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
24970
24971        let mut dd = common::DefaultDelegate;
24972        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
24973        dlg.begin(common::MethodInfo {
24974            id: "iam.projects.locations.workloadIdentityPools.delete",
24975            http_method: hyper::Method::DELETE,
24976        });
24977
24978        for &field in ["alt", "name"].iter() {
24979            if self._additional_params.contains_key(field) {
24980                dlg.finished(false);
24981                return Err(common::Error::FieldClash(field));
24982            }
24983        }
24984
24985        let mut params = Params::with_capacity(3 + self._additional_params.len());
24986        params.push("name", self._name);
24987
24988        params.extend(self._additional_params.iter());
24989
24990        params.push("alt", "json");
24991        let mut url = self.hub._base_url.clone() + "v1/{+name}";
24992        if self._scopes.is_empty() {
24993            self._scopes
24994                .insert(Scope::CloudPlatform.as_ref().to_string());
24995        }
24996
24997        #[allow(clippy::single_element_loop)]
24998        for &(find_this, param_name) in [("{+name}", "name")].iter() {
24999            url = params.uri_replacement(url, param_name, find_this, true);
25000        }
25001        {
25002            let to_remove = ["name"];
25003            params.remove_params(&to_remove);
25004        }
25005
25006        let url = params.parse_with_url(&url);
25007
25008        loop {
25009            let token = match self
25010                .hub
25011                .auth
25012                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
25013                .await
25014            {
25015                Ok(token) => token,
25016                Err(e) => match dlg.token(e) {
25017                    Ok(token) => token,
25018                    Err(e) => {
25019                        dlg.finished(false);
25020                        return Err(common::Error::MissingToken(e));
25021                    }
25022                },
25023            };
25024            let mut req_result = {
25025                let client = &self.hub.client;
25026                dlg.pre_request();
25027                let mut req_builder = hyper::Request::builder()
25028                    .method(hyper::Method::DELETE)
25029                    .uri(url.as_str())
25030                    .header(USER_AGENT, self.hub._user_agent.clone());
25031
25032                if let Some(token) = token.as_ref() {
25033                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
25034                }
25035
25036                let request = req_builder
25037                    .header(CONTENT_LENGTH, 0_u64)
25038                    .body(common::to_body::<String>(None));
25039
25040                client.request(request.unwrap()).await
25041            };
25042
25043            match req_result {
25044                Err(err) => {
25045                    if let common::Retry::After(d) = dlg.http_error(&err) {
25046                        sleep(d).await;
25047                        continue;
25048                    }
25049                    dlg.finished(false);
25050                    return Err(common::Error::HttpError(err));
25051                }
25052                Ok(res) => {
25053                    let (mut parts, body) = res.into_parts();
25054                    let mut body = common::Body::new(body);
25055                    if !parts.status.is_success() {
25056                        let bytes = common::to_bytes(body).await.unwrap_or_default();
25057                        let error = serde_json::from_str(&common::to_string(&bytes));
25058                        let response = common::to_response(parts, bytes.into());
25059
25060                        if let common::Retry::After(d) =
25061                            dlg.http_failure(&response, error.as_ref().ok())
25062                        {
25063                            sleep(d).await;
25064                            continue;
25065                        }
25066
25067                        dlg.finished(false);
25068
25069                        return Err(match error {
25070                            Ok(value) => common::Error::BadRequest(value),
25071                            _ => common::Error::Failure(response),
25072                        });
25073                    }
25074                    let response = {
25075                        let bytes = common::to_bytes(body).await.unwrap_or_default();
25076                        let encoded = common::to_string(&bytes);
25077                        match serde_json::from_str(&encoded) {
25078                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
25079                            Err(error) => {
25080                                dlg.response_json_decode_error(&encoded, &error);
25081                                return Err(common::Error::JsonDecodeError(
25082                                    encoded.to_string(),
25083                                    error,
25084                                ));
25085                            }
25086                        }
25087                    };
25088
25089                    dlg.finished(true);
25090                    return Ok(response);
25091                }
25092            }
25093        }
25094    }
25095
25096    /// Required. The name of the pool to delete.
25097    ///
25098    /// Sets the *name* path property to the given value.
25099    ///
25100    /// Even though the property as already been set when instantiating this call,
25101    /// we provide this method for API completeness.
25102    pub fn name(mut self, new_value: &str) -> ProjectLocationWorkloadIdentityPoolDeleteCall<'a, C> {
25103        self._name = new_value.to_string();
25104        self
25105    }
25106    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
25107    /// while executing the actual API request.
25108    ///
25109    /// ````text
25110    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
25111    /// ````
25112    ///
25113    /// Sets the *delegate* property to the given value.
25114    pub fn delegate(
25115        mut self,
25116        new_value: &'a mut dyn common::Delegate,
25117    ) -> ProjectLocationWorkloadIdentityPoolDeleteCall<'a, C> {
25118        self._delegate = Some(new_value);
25119        self
25120    }
25121
25122    /// Set any additional parameter of the query string used in the request.
25123    /// It should be used to set parameters which are not yet available through their own
25124    /// setters.
25125    ///
25126    /// Please note that this method must not be used to set any of the known parameters
25127    /// which have their own setter method. If done anyway, the request will fail.
25128    ///
25129    /// # Additional Parameters
25130    ///
25131    /// * *$.xgafv* (query-string) - V1 error format.
25132    /// * *access_token* (query-string) - OAuth access token.
25133    /// * *alt* (query-string) - Data format for response.
25134    /// * *callback* (query-string) - JSONP
25135    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
25136    /// * *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.
25137    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
25138    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
25139    /// * *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.
25140    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
25141    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
25142    pub fn param<T>(
25143        mut self,
25144        name: T,
25145        value: T,
25146    ) -> ProjectLocationWorkloadIdentityPoolDeleteCall<'a, C>
25147    where
25148        T: AsRef<str>,
25149    {
25150        self._additional_params
25151            .insert(name.as_ref().to_string(), value.as_ref().to_string());
25152        self
25153    }
25154
25155    /// Identifies the authorization scope for the method you are building.
25156    ///
25157    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
25158    /// [`Scope::CloudPlatform`].
25159    ///
25160    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
25161    /// tokens for more than one scope.
25162    ///
25163    /// Usually there is more than one suitable scope to authorize an operation, some of which may
25164    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
25165    /// sufficient, a read-write scope will do as well.
25166    pub fn add_scope<St>(
25167        mut self,
25168        scope: St,
25169    ) -> ProjectLocationWorkloadIdentityPoolDeleteCall<'a, C>
25170    where
25171        St: AsRef<str>,
25172    {
25173        self._scopes.insert(String::from(scope.as_ref()));
25174        self
25175    }
25176    /// Identifies the authorization scope(s) for the method you are building.
25177    ///
25178    /// See [`Self::add_scope()`] for details.
25179    pub fn add_scopes<I, St>(
25180        mut self,
25181        scopes: I,
25182    ) -> ProjectLocationWorkloadIdentityPoolDeleteCall<'a, C>
25183    where
25184        I: IntoIterator<Item = St>,
25185        St: AsRef<str>,
25186    {
25187        self._scopes
25188            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
25189        self
25190    }
25191
25192    /// Removes all scopes, and no default scope will be used either.
25193    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
25194    /// for details).
25195    pub fn clear_scopes(mut self) -> ProjectLocationWorkloadIdentityPoolDeleteCall<'a, C> {
25196        self._scopes.clear();
25197        self
25198    }
25199}
25200
25201/// Gets an individual WorkloadIdentityPool.
25202///
25203/// A builder for the *locations.workloadIdentityPools.get* method supported by a *project* resource.
25204/// It is not used directly, but through a [`ProjectMethods`] instance.
25205///
25206/// # Example
25207///
25208/// Instantiate a resource method builder
25209///
25210/// ```test_harness,no_run
25211/// # extern crate hyper;
25212/// # extern crate hyper_rustls;
25213/// # extern crate google_iam1 as iam1;
25214/// # async fn dox() {
25215/// # use iam1::{Iam, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
25216///
25217/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
25218/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
25219/// #     secret,
25220/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
25221/// # ).build().await.unwrap();
25222///
25223/// # let client = hyper_util::client::legacy::Client::builder(
25224/// #     hyper_util::rt::TokioExecutor::new()
25225/// # )
25226/// # .build(
25227/// #     hyper_rustls::HttpsConnectorBuilder::new()
25228/// #         .with_native_roots()
25229/// #         .unwrap()
25230/// #         .https_or_http()
25231/// #         .enable_http1()
25232/// #         .build()
25233/// # );
25234/// # let mut hub = Iam::new(client, auth);
25235/// // You can configure optional parameters by calling the respective setters at will, and
25236/// // execute the final call using `doit()`.
25237/// // Values shown here are possibly random and not representative !
25238/// let result = hub.projects().locations_workload_identity_pools_get("name")
25239///              .doit().await;
25240/// # }
25241/// ```
25242pub struct ProjectLocationWorkloadIdentityPoolGetCall<'a, C>
25243where
25244    C: 'a,
25245{
25246    hub: &'a Iam<C>,
25247    _name: String,
25248    _delegate: Option<&'a mut dyn common::Delegate>,
25249    _additional_params: HashMap<String, String>,
25250    _scopes: BTreeSet<String>,
25251}
25252
25253impl<'a, C> common::CallBuilder for ProjectLocationWorkloadIdentityPoolGetCall<'a, C> {}
25254
25255impl<'a, C> ProjectLocationWorkloadIdentityPoolGetCall<'a, C>
25256where
25257    C: common::Connector,
25258{
25259    /// Perform the operation you have build so far.
25260    pub async fn doit(mut self) -> common::Result<(common::Response, WorkloadIdentityPool)> {
25261        use std::borrow::Cow;
25262        use std::io::{Read, Seek};
25263
25264        use common::{url::Params, ToParts};
25265        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
25266
25267        let mut dd = common::DefaultDelegate;
25268        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
25269        dlg.begin(common::MethodInfo {
25270            id: "iam.projects.locations.workloadIdentityPools.get",
25271            http_method: hyper::Method::GET,
25272        });
25273
25274        for &field in ["alt", "name"].iter() {
25275            if self._additional_params.contains_key(field) {
25276                dlg.finished(false);
25277                return Err(common::Error::FieldClash(field));
25278            }
25279        }
25280
25281        let mut params = Params::with_capacity(3 + self._additional_params.len());
25282        params.push("name", self._name);
25283
25284        params.extend(self._additional_params.iter());
25285
25286        params.push("alt", "json");
25287        let mut url = self.hub._base_url.clone() + "v1/{+name}";
25288        if self._scopes.is_empty() {
25289            self._scopes
25290                .insert(Scope::CloudPlatform.as_ref().to_string());
25291        }
25292
25293        #[allow(clippy::single_element_loop)]
25294        for &(find_this, param_name) in [("{+name}", "name")].iter() {
25295            url = params.uri_replacement(url, param_name, find_this, true);
25296        }
25297        {
25298            let to_remove = ["name"];
25299            params.remove_params(&to_remove);
25300        }
25301
25302        let url = params.parse_with_url(&url);
25303
25304        loop {
25305            let token = match self
25306                .hub
25307                .auth
25308                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
25309                .await
25310            {
25311                Ok(token) => token,
25312                Err(e) => match dlg.token(e) {
25313                    Ok(token) => token,
25314                    Err(e) => {
25315                        dlg.finished(false);
25316                        return Err(common::Error::MissingToken(e));
25317                    }
25318                },
25319            };
25320            let mut req_result = {
25321                let client = &self.hub.client;
25322                dlg.pre_request();
25323                let mut req_builder = hyper::Request::builder()
25324                    .method(hyper::Method::GET)
25325                    .uri(url.as_str())
25326                    .header(USER_AGENT, self.hub._user_agent.clone());
25327
25328                if let Some(token) = token.as_ref() {
25329                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
25330                }
25331
25332                let request = req_builder
25333                    .header(CONTENT_LENGTH, 0_u64)
25334                    .body(common::to_body::<String>(None));
25335
25336                client.request(request.unwrap()).await
25337            };
25338
25339            match req_result {
25340                Err(err) => {
25341                    if let common::Retry::After(d) = dlg.http_error(&err) {
25342                        sleep(d).await;
25343                        continue;
25344                    }
25345                    dlg.finished(false);
25346                    return Err(common::Error::HttpError(err));
25347                }
25348                Ok(res) => {
25349                    let (mut parts, body) = res.into_parts();
25350                    let mut body = common::Body::new(body);
25351                    if !parts.status.is_success() {
25352                        let bytes = common::to_bytes(body).await.unwrap_or_default();
25353                        let error = serde_json::from_str(&common::to_string(&bytes));
25354                        let response = common::to_response(parts, bytes.into());
25355
25356                        if let common::Retry::After(d) =
25357                            dlg.http_failure(&response, error.as_ref().ok())
25358                        {
25359                            sleep(d).await;
25360                            continue;
25361                        }
25362
25363                        dlg.finished(false);
25364
25365                        return Err(match error {
25366                            Ok(value) => common::Error::BadRequest(value),
25367                            _ => common::Error::Failure(response),
25368                        });
25369                    }
25370                    let response = {
25371                        let bytes = common::to_bytes(body).await.unwrap_or_default();
25372                        let encoded = common::to_string(&bytes);
25373                        match serde_json::from_str(&encoded) {
25374                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
25375                            Err(error) => {
25376                                dlg.response_json_decode_error(&encoded, &error);
25377                                return Err(common::Error::JsonDecodeError(
25378                                    encoded.to_string(),
25379                                    error,
25380                                ));
25381                            }
25382                        }
25383                    };
25384
25385                    dlg.finished(true);
25386                    return Ok(response);
25387                }
25388            }
25389        }
25390    }
25391
25392    /// Required. The name of the pool to retrieve.
25393    ///
25394    /// Sets the *name* path property to the given value.
25395    ///
25396    /// Even though the property as already been set when instantiating this call,
25397    /// we provide this method for API completeness.
25398    pub fn name(mut self, new_value: &str) -> ProjectLocationWorkloadIdentityPoolGetCall<'a, C> {
25399        self._name = new_value.to_string();
25400        self
25401    }
25402    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
25403    /// while executing the actual API request.
25404    ///
25405    /// ````text
25406    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
25407    /// ````
25408    ///
25409    /// Sets the *delegate* property to the given value.
25410    pub fn delegate(
25411        mut self,
25412        new_value: &'a mut dyn common::Delegate,
25413    ) -> ProjectLocationWorkloadIdentityPoolGetCall<'a, C> {
25414        self._delegate = Some(new_value);
25415        self
25416    }
25417
25418    /// Set any additional parameter of the query string used in the request.
25419    /// It should be used to set parameters which are not yet available through their own
25420    /// setters.
25421    ///
25422    /// Please note that this method must not be used to set any of the known parameters
25423    /// which have their own setter method. If done anyway, the request will fail.
25424    ///
25425    /// # Additional Parameters
25426    ///
25427    /// * *$.xgafv* (query-string) - V1 error format.
25428    /// * *access_token* (query-string) - OAuth access token.
25429    /// * *alt* (query-string) - Data format for response.
25430    /// * *callback* (query-string) - JSONP
25431    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
25432    /// * *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.
25433    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
25434    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
25435    /// * *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.
25436    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
25437    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
25438    pub fn param<T>(
25439        mut self,
25440        name: T,
25441        value: T,
25442    ) -> ProjectLocationWorkloadIdentityPoolGetCall<'a, C>
25443    where
25444        T: AsRef<str>,
25445    {
25446        self._additional_params
25447            .insert(name.as_ref().to_string(), value.as_ref().to_string());
25448        self
25449    }
25450
25451    /// Identifies the authorization scope for the method you are building.
25452    ///
25453    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
25454    /// [`Scope::CloudPlatform`].
25455    ///
25456    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
25457    /// tokens for more than one scope.
25458    ///
25459    /// Usually there is more than one suitable scope to authorize an operation, some of which may
25460    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
25461    /// sufficient, a read-write scope will do as well.
25462    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationWorkloadIdentityPoolGetCall<'a, C>
25463    where
25464        St: AsRef<str>,
25465    {
25466        self._scopes.insert(String::from(scope.as_ref()));
25467        self
25468    }
25469    /// Identifies the authorization scope(s) for the method you are building.
25470    ///
25471    /// See [`Self::add_scope()`] for details.
25472    pub fn add_scopes<I, St>(
25473        mut self,
25474        scopes: I,
25475    ) -> ProjectLocationWorkloadIdentityPoolGetCall<'a, C>
25476    where
25477        I: IntoIterator<Item = St>,
25478        St: AsRef<str>,
25479    {
25480        self._scopes
25481            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
25482        self
25483    }
25484
25485    /// Removes all scopes, and no default scope will be used either.
25486    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
25487    /// for details).
25488    pub fn clear_scopes(mut self) -> ProjectLocationWorkloadIdentityPoolGetCall<'a, C> {
25489        self._scopes.clear();
25490        self
25491    }
25492}
25493
25494/// Lists all non-deleted WorkloadIdentityPools in a project. If `show_deleted` is set to `true`, then deleted pools are also listed.
25495///
25496/// A builder for the *locations.workloadIdentityPools.list* method supported by a *project* resource.
25497/// It is not used directly, but through a [`ProjectMethods`] instance.
25498///
25499/// # Example
25500///
25501/// Instantiate a resource method builder
25502///
25503/// ```test_harness,no_run
25504/// # extern crate hyper;
25505/// # extern crate hyper_rustls;
25506/// # extern crate google_iam1 as iam1;
25507/// # async fn dox() {
25508/// # use iam1::{Iam, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
25509///
25510/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
25511/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
25512/// #     secret,
25513/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
25514/// # ).build().await.unwrap();
25515///
25516/// # let client = hyper_util::client::legacy::Client::builder(
25517/// #     hyper_util::rt::TokioExecutor::new()
25518/// # )
25519/// # .build(
25520/// #     hyper_rustls::HttpsConnectorBuilder::new()
25521/// #         .with_native_roots()
25522/// #         .unwrap()
25523/// #         .https_or_http()
25524/// #         .enable_http1()
25525/// #         .build()
25526/// # );
25527/// # let mut hub = Iam::new(client, auth);
25528/// // You can configure optional parameters by calling the respective setters at will, and
25529/// // execute the final call using `doit()`.
25530/// // Values shown here are possibly random and not representative !
25531/// let result = hub.projects().locations_workload_identity_pools_list("parent")
25532///              .show_deleted(false)
25533///              .page_token("et")
25534///              .page_size(-39)
25535///              .doit().await;
25536/// # }
25537/// ```
25538pub struct ProjectLocationWorkloadIdentityPoolListCall<'a, C>
25539where
25540    C: 'a,
25541{
25542    hub: &'a Iam<C>,
25543    _parent: String,
25544    _show_deleted: Option<bool>,
25545    _page_token: Option<String>,
25546    _page_size: Option<i32>,
25547    _delegate: Option<&'a mut dyn common::Delegate>,
25548    _additional_params: HashMap<String, String>,
25549    _scopes: BTreeSet<String>,
25550}
25551
25552impl<'a, C> common::CallBuilder for ProjectLocationWorkloadIdentityPoolListCall<'a, C> {}
25553
25554impl<'a, C> ProjectLocationWorkloadIdentityPoolListCall<'a, C>
25555where
25556    C: common::Connector,
25557{
25558    /// Perform the operation you have build so far.
25559    pub async fn doit(
25560        mut self,
25561    ) -> common::Result<(common::Response, ListWorkloadIdentityPoolsResponse)> {
25562        use std::borrow::Cow;
25563        use std::io::{Read, Seek};
25564
25565        use common::{url::Params, ToParts};
25566        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
25567
25568        let mut dd = common::DefaultDelegate;
25569        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
25570        dlg.begin(common::MethodInfo {
25571            id: "iam.projects.locations.workloadIdentityPools.list",
25572            http_method: hyper::Method::GET,
25573        });
25574
25575        for &field in ["alt", "parent", "showDeleted", "pageToken", "pageSize"].iter() {
25576            if self._additional_params.contains_key(field) {
25577                dlg.finished(false);
25578                return Err(common::Error::FieldClash(field));
25579            }
25580        }
25581
25582        let mut params = Params::with_capacity(6 + self._additional_params.len());
25583        params.push("parent", self._parent);
25584        if let Some(value) = self._show_deleted.as_ref() {
25585            params.push("showDeleted", value.to_string());
25586        }
25587        if let Some(value) = self._page_token.as_ref() {
25588            params.push("pageToken", value);
25589        }
25590        if let Some(value) = self._page_size.as_ref() {
25591            params.push("pageSize", value.to_string());
25592        }
25593
25594        params.extend(self._additional_params.iter());
25595
25596        params.push("alt", "json");
25597        let mut url = self.hub._base_url.clone() + "v1/{+parent}/workloadIdentityPools";
25598        if self._scopes.is_empty() {
25599            self._scopes
25600                .insert(Scope::CloudPlatform.as_ref().to_string());
25601        }
25602
25603        #[allow(clippy::single_element_loop)]
25604        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
25605            url = params.uri_replacement(url, param_name, find_this, true);
25606        }
25607        {
25608            let to_remove = ["parent"];
25609            params.remove_params(&to_remove);
25610        }
25611
25612        let url = params.parse_with_url(&url);
25613
25614        loop {
25615            let token = match self
25616                .hub
25617                .auth
25618                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
25619                .await
25620            {
25621                Ok(token) => token,
25622                Err(e) => match dlg.token(e) {
25623                    Ok(token) => token,
25624                    Err(e) => {
25625                        dlg.finished(false);
25626                        return Err(common::Error::MissingToken(e));
25627                    }
25628                },
25629            };
25630            let mut req_result = {
25631                let client = &self.hub.client;
25632                dlg.pre_request();
25633                let mut req_builder = hyper::Request::builder()
25634                    .method(hyper::Method::GET)
25635                    .uri(url.as_str())
25636                    .header(USER_AGENT, self.hub._user_agent.clone());
25637
25638                if let Some(token) = token.as_ref() {
25639                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
25640                }
25641
25642                let request = req_builder
25643                    .header(CONTENT_LENGTH, 0_u64)
25644                    .body(common::to_body::<String>(None));
25645
25646                client.request(request.unwrap()).await
25647            };
25648
25649            match req_result {
25650                Err(err) => {
25651                    if let common::Retry::After(d) = dlg.http_error(&err) {
25652                        sleep(d).await;
25653                        continue;
25654                    }
25655                    dlg.finished(false);
25656                    return Err(common::Error::HttpError(err));
25657                }
25658                Ok(res) => {
25659                    let (mut parts, body) = res.into_parts();
25660                    let mut body = common::Body::new(body);
25661                    if !parts.status.is_success() {
25662                        let bytes = common::to_bytes(body).await.unwrap_or_default();
25663                        let error = serde_json::from_str(&common::to_string(&bytes));
25664                        let response = common::to_response(parts, bytes.into());
25665
25666                        if let common::Retry::After(d) =
25667                            dlg.http_failure(&response, error.as_ref().ok())
25668                        {
25669                            sleep(d).await;
25670                            continue;
25671                        }
25672
25673                        dlg.finished(false);
25674
25675                        return Err(match error {
25676                            Ok(value) => common::Error::BadRequest(value),
25677                            _ => common::Error::Failure(response),
25678                        });
25679                    }
25680                    let response = {
25681                        let bytes = common::to_bytes(body).await.unwrap_or_default();
25682                        let encoded = common::to_string(&bytes);
25683                        match serde_json::from_str(&encoded) {
25684                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
25685                            Err(error) => {
25686                                dlg.response_json_decode_error(&encoded, &error);
25687                                return Err(common::Error::JsonDecodeError(
25688                                    encoded.to_string(),
25689                                    error,
25690                                ));
25691                            }
25692                        }
25693                    };
25694
25695                    dlg.finished(true);
25696                    return Ok(response);
25697                }
25698            }
25699        }
25700    }
25701
25702    /// Required. The parent resource to list pools for.
25703    ///
25704    /// Sets the *parent* path property to the given value.
25705    ///
25706    /// Even though the property as already been set when instantiating this call,
25707    /// we provide this method for API completeness.
25708    pub fn parent(mut self, new_value: &str) -> ProjectLocationWorkloadIdentityPoolListCall<'a, C> {
25709        self._parent = new_value.to_string();
25710        self
25711    }
25712    /// Whether to return soft-deleted pools.
25713    ///
25714    /// Sets the *show deleted* query property to the given value.
25715    pub fn show_deleted(
25716        mut self,
25717        new_value: bool,
25718    ) -> ProjectLocationWorkloadIdentityPoolListCall<'a, C> {
25719        self._show_deleted = Some(new_value);
25720        self
25721    }
25722    /// A page token, received from a previous `ListWorkloadIdentityPools` call. Provide this to retrieve the subsequent page.
25723    ///
25724    /// Sets the *page token* query property to the given value.
25725    pub fn page_token(
25726        mut self,
25727        new_value: &str,
25728    ) -> ProjectLocationWorkloadIdentityPoolListCall<'a, C> {
25729        self._page_token = Some(new_value.to_string());
25730        self
25731    }
25732    /// The maximum number of pools to return. If unspecified, at most 50 pools are returned. The maximum value is 1000; values above are 1000 truncated to 1000.
25733    ///
25734    /// Sets the *page size* query property to the given value.
25735    pub fn page_size(
25736        mut self,
25737        new_value: i32,
25738    ) -> ProjectLocationWorkloadIdentityPoolListCall<'a, C> {
25739        self._page_size = Some(new_value);
25740        self
25741    }
25742    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
25743    /// while executing the actual API request.
25744    ///
25745    /// ````text
25746    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
25747    /// ````
25748    ///
25749    /// Sets the *delegate* property to the given value.
25750    pub fn delegate(
25751        mut self,
25752        new_value: &'a mut dyn common::Delegate,
25753    ) -> ProjectLocationWorkloadIdentityPoolListCall<'a, C> {
25754        self._delegate = Some(new_value);
25755        self
25756    }
25757
25758    /// Set any additional parameter of the query string used in the request.
25759    /// It should be used to set parameters which are not yet available through their own
25760    /// setters.
25761    ///
25762    /// Please note that this method must not be used to set any of the known parameters
25763    /// which have their own setter method. If done anyway, the request will fail.
25764    ///
25765    /// # Additional Parameters
25766    ///
25767    /// * *$.xgafv* (query-string) - V1 error format.
25768    /// * *access_token* (query-string) - OAuth access token.
25769    /// * *alt* (query-string) - Data format for response.
25770    /// * *callback* (query-string) - JSONP
25771    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
25772    /// * *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.
25773    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
25774    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
25775    /// * *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.
25776    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
25777    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
25778    pub fn param<T>(
25779        mut self,
25780        name: T,
25781        value: T,
25782    ) -> ProjectLocationWorkloadIdentityPoolListCall<'a, C>
25783    where
25784        T: AsRef<str>,
25785    {
25786        self._additional_params
25787            .insert(name.as_ref().to_string(), value.as_ref().to_string());
25788        self
25789    }
25790
25791    /// Identifies the authorization scope for the method you are building.
25792    ///
25793    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
25794    /// [`Scope::CloudPlatform`].
25795    ///
25796    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
25797    /// tokens for more than one scope.
25798    ///
25799    /// Usually there is more than one suitable scope to authorize an operation, some of which may
25800    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
25801    /// sufficient, a read-write scope will do as well.
25802    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationWorkloadIdentityPoolListCall<'a, C>
25803    where
25804        St: AsRef<str>,
25805    {
25806        self._scopes.insert(String::from(scope.as_ref()));
25807        self
25808    }
25809    /// Identifies the authorization scope(s) for the method you are building.
25810    ///
25811    /// See [`Self::add_scope()`] for details.
25812    pub fn add_scopes<I, St>(
25813        mut self,
25814        scopes: I,
25815    ) -> ProjectLocationWorkloadIdentityPoolListCall<'a, C>
25816    where
25817        I: IntoIterator<Item = St>,
25818        St: AsRef<str>,
25819    {
25820        self._scopes
25821            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
25822        self
25823    }
25824
25825    /// Removes all scopes, and no default scope will be used either.
25826    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
25827    /// for details).
25828    pub fn clear_scopes(mut self) -> ProjectLocationWorkloadIdentityPoolListCall<'a, C> {
25829        self._scopes.clear();
25830        self
25831    }
25832}
25833
25834/// Updates an existing WorkloadIdentityPool.
25835///
25836/// A builder for the *locations.workloadIdentityPools.patch* method supported by a *project* resource.
25837/// It is not used directly, but through a [`ProjectMethods`] instance.
25838///
25839/// # Example
25840///
25841/// Instantiate a resource method builder
25842///
25843/// ```test_harness,no_run
25844/// # extern crate hyper;
25845/// # extern crate hyper_rustls;
25846/// # extern crate google_iam1 as iam1;
25847/// use iam1::api::WorkloadIdentityPool;
25848/// # async fn dox() {
25849/// # use iam1::{Iam, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
25850///
25851/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
25852/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
25853/// #     secret,
25854/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
25855/// # ).build().await.unwrap();
25856///
25857/// # let client = hyper_util::client::legacy::Client::builder(
25858/// #     hyper_util::rt::TokioExecutor::new()
25859/// # )
25860/// # .build(
25861/// #     hyper_rustls::HttpsConnectorBuilder::new()
25862/// #         .with_native_roots()
25863/// #         .unwrap()
25864/// #         .https_or_http()
25865/// #         .enable_http1()
25866/// #         .build()
25867/// # );
25868/// # let mut hub = Iam::new(client, auth);
25869/// // As the method needs a request, you would usually fill it with the desired information
25870/// // into the respective structure. Some of the parts shown here might not be applicable !
25871/// // Values shown here are possibly random and not representative !
25872/// let mut req = WorkloadIdentityPool::default();
25873///
25874/// // You can configure optional parameters by calling the respective setters at will, and
25875/// // execute the final call using `doit()`.
25876/// // Values shown here are possibly random and not representative !
25877/// let result = hub.projects().locations_workload_identity_pools_patch(req, "name")
25878///              .update_mask(FieldMask::new::<&str>(&[]))
25879///              .doit().await;
25880/// # }
25881/// ```
25882pub struct ProjectLocationWorkloadIdentityPoolPatchCall<'a, C>
25883where
25884    C: 'a,
25885{
25886    hub: &'a Iam<C>,
25887    _request: WorkloadIdentityPool,
25888    _name: String,
25889    _update_mask: Option<common::FieldMask>,
25890    _delegate: Option<&'a mut dyn common::Delegate>,
25891    _additional_params: HashMap<String, String>,
25892    _scopes: BTreeSet<String>,
25893}
25894
25895impl<'a, C> common::CallBuilder for ProjectLocationWorkloadIdentityPoolPatchCall<'a, C> {}
25896
25897impl<'a, C> ProjectLocationWorkloadIdentityPoolPatchCall<'a, C>
25898where
25899    C: common::Connector,
25900{
25901    /// Perform the operation you have build so far.
25902    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
25903        use std::borrow::Cow;
25904        use std::io::{Read, Seek};
25905
25906        use common::{url::Params, ToParts};
25907        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
25908
25909        let mut dd = common::DefaultDelegate;
25910        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
25911        dlg.begin(common::MethodInfo {
25912            id: "iam.projects.locations.workloadIdentityPools.patch",
25913            http_method: hyper::Method::PATCH,
25914        });
25915
25916        for &field in ["alt", "name", "updateMask"].iter() {
25917            if self._additional_params.contains_key(field) {
25918                dlg.finished(false);
25919                return Err(common::Error::FieldClash(field));
25920            }
25921        }
25922
25923        let mut params = Params::with_capacity(5 + self._additional_params.len());
25924        params.push("name", self._name);
25925        if let Some(value) = self._update_mask.as_ref() {
25926            params.push("updateMask", value.to_string());
25927        }
25928
25929        params.extend(self._additional_params.iter());
25930
25931        params.push("alt", "json");
25932        let mut url = self.hub._base_url.clone() + "v1/{+name}";
25933        if self._scopes.is_empty() {
25934            self._scopes
25935                .insert(Scope::CloudPlatform.as_ref().to_string());
25936        }
25937
25938        #[allow(clippy::single_element_loop)]
25939        for &(find_this, param_name) in [("{+name}", "name")].iter() {
25940            url = params.uri_replacement(url, param_name, find_this, true);
25941        }
25942        {
25943            let to_remove = ["name"];
25944            params.remove_params(&to_remove);
25945        }
25946
25947        let url = params.parse_with_url(&url);
25948
25949        let mut json_mime_type = mime::APPLICATION_JSON;
25950        let mut request_value_reader = {
25951            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
25952            common::remove_json_null_values(&mut value);
25953            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
25954            serde_json::to_writer(&mut dst, &value).unwrap();
25955            dst
25956        };
25957        let request_size = request_value_reader
25958            .seek(std::io::SeekFrom::End(0))
25959            .unwrap();
25960        request_value_reader
25961            .seek(std::io::SeekFrom::Start(0))
25962            .unwrap();
25963
25964        loop {
25965            let token = match self
25966                .hub
25967                .auth
25968                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
25969                .await
25970            {
25971                Ok(token) => token,
25972                Err(e) => match dlg.token(e) {
25973                    Ok(token) => token,
25974                    Err(e) => {
25975                        dlg.finished(false);
25976                        return Err(common::Error::MissingToken(e));
25977                    }
25978                },
25979            };
25980            request_value_reader
25981                .seek(std::io::SeekFrom::Start(0))
25982                .unwrap();
25983            let mut req_result = {
25984                let client = &self.hub.client;
25985                dlg.pre_request();
25986                let mut req_builder = hyper::Request::builder()
25987                    .method(hyper::Method::PATCH)
25988                    .uri(url.as_str())
25989                    .header(USER_AGENT, self.hub._user_agent.clone());
25990
25991                if let Some(token) = token.as_ref() {
25992                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
25993                }
25994
25995                let request = req_builder
25996                    .header(CONTENT_TYPE, json_mime_type.to_string())
25997                    .header(CONTENT_LENGTH, request_size as u64)
25998                    .body(common::to_body(
25999                        request_value_reader.get_ref().clone().into(),
26000                    ));
26001
26002                client.request(request.unwrap()).await
26003            };
26004
26005            match req_result {
26006                Err(err) => {
26007                    if let common::Retry::After(d) = dlg.http_error(&err) {
26008                        sleep(d).await;
26009                        continue;
26010                    }
26011                    dlg.finished(false);
26012                    return Err(common::Error::HttpError(err));
26013                }
26014                Ok(res) => {
26015                    let (mut parts, body) = res.into_parts();
26016                    let mut body = common::Body::new(body);
26017                    if !parts.status.is_success() {
26018                        let bytes = common::to_bytes(body).await.unwrap_or_default();
26019                        let error = serde_json::from_str(&common::to_string(&bytes));
26020                        let response = common::to_response(parts, bytes.into());
26021
26022                        if let common::Retry::After(d) =
26023                            dlg.http_failure(&response, error.as_ref().ok())
26024                        {
26025                            sleep(d).await;
26026                            continue;
26027                        }
26028
26029                        dlg.finished(false);
26030
26031                        return Err(match error {
26032                            Ok(value) => common::Error::BadRequest(value),
26033                            _ => common::Error::Failure(response),
26034                        });
26035                    }
26036                    let response = {
26037                        let bytes = common::to_bytes(body).await.unwrap_or_default();
26038                        let encoded = common::to_string(&bytes);
26039                        match serde_json::from_str(&encoded) {
26040                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
26041                            Err(error) => {
26042                                dlg.response_json_decode_error(&encoded, &error);
26043                                return Err(common::Error::JsonDecodeError(
26044                                    encoded.to_string(),
26045                                    error,
26046                                ));
26047                            }
26048                        }
26049                    };
26050
26051                    dlg.finished(true);
26052                    return Ok(response);
26053                }
26054            }
26055        }
26056    }
26057
26058    ///
26059    /// Sets the *request* property to the given value.
26060    ///
26061    /// Even though the property as already been set when instantiating this call,
26062    /// we provide this method for API completeness.
26063    pub fn request(
26064        mut self,
26065        new_value: WorkloadIdentityPool,
26066    ) -> ProjectLocationWorkloadIdentityPoolPatchCall<'a, C> {
26067        self._request = new_value;
26068        self
26069    }
26070    /// Output only. The resource name of the pool.
26071    ///
26072    /// Sets the *name* path property to the given value.
26073    ///
26074    /// Even though the property as already been set when instantiating this call,
26075    /// we provide this method for API completeness.
26076    pub fn name(mut self, new_value: &str) -> ProjectLocationWorkloadIdentityPoolPatchCall<'a, C> {
26077        self._name = new_value.to_string();
26078        self
26079    }
26080    /// Required. The list of fields to update.
26081    ///
26082    /// Sets the *update mask* query property to the given value.
26083    pub fn update_mask(
26084        mut self,
26085        new_value: common::FieldMask,
26086    ) -> ProjectLocationWorkloadIdentityPoolPatchCall<'a, C> {
26087        self._update_mask = Some(new_value);
26088        self
26089    }
26090    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
26091    /// while executing the actual API request.
26092    ///
26093    /// ````text
26094    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
26095    /// ````
26096    ///
26097    /// Sets the *delegate* property to the given value.
26098    pub fn delegate(
26099        mut self,
26100        new_value: &'a mut dyn common::Delegate,
26101    ) -> ProjectLocationWorkloadIdentityPoolPatchCall<'a, C> {
26102        self._delegate = Some(new_value);
26103        self
26104    }
26105
26106    /// Set any additional parameter of the query string used in the request.
26107    /// It should be used to set parameters which are not yet available through their own
26108    /// setters.
26109    ///
26110    /// Please note that this method must not be used to set any of the known parameters
26111    /// which have their own setter method. If done anyway, the request will fail.
26112    ///
26113    /// # Additional Parameters
26114    ///
26115    /// * *$.xgafv* (query-string) - V1 error format.
26116    /// * *access_token* (query-string) - OAuth access token.
26117    /// * *alt* (query-string) - Data format for response.
26118    /// * *callback* (query-string) - JSONP
26119    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
26120    /// * *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.
26121    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
26122    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
26123    /// * *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.
26124    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
26125    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
26126    pub fn param<T>(
26127        mut self,
26128        name: T,
26129        value: T,
26130    ) -> ProjectLocationWorkloadIdentityPoolPatchCall<'a, C>
26131    where
26132        T: AsRef<str>,
26133    {
26134        self._additional_params
26135            .insert(name.as_ref().to_string(), value.as_ref().to_string());
26136        self
26137    }
26138
26139    /// Identifies the authorization scope for the method you are building.
26140    ///
26141    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
26142    /// [`Scope::CloudPlatform`].
26143    ///
26144    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
26145    /// tokens for more than one scope.
26146    ///
26147    /// Usually there is more than one suitable scope to authorize an operation, some of which may
26148    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
26149    /// sufficient, a read-write scope will do as well.
26150    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationWorkloadIdentityPoolPatchCall<'a, C>
26151    where
26152        St: AsRef<str>,
26153    {
26154        self._scopes.insert(String::from(scope.as_ref()));
26155        self
26156    }
26157    /// Identifies the authorization scope(s) for the method you are building.
26158    ///
26159    /// See [`Self::add_scope()`] for details.
26160    pub fn add_scopes<I, St>(
26161        mut self,
26162        scopes: I,
26163    ) -> ProjectLocationWorkloadIdentityPoolPatchCall<'a, C>
26164    where
26165        I: IntoIterator<Item = St>,
26166        St: AsRef<str>,
26167    {
26168        self._scopes
26169            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
26170        self
26171    }
26172
26173    /// Removes all scopes, and no default scope will be used either.
26174    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
26175    /// for details).
26176    pub fn clear_scopes(mut self) -> ProjectLocationWorkloadIdentityPoolPatchCall<'a, C> {
26177        self._scopes.clear();
26178        self
26179    }
26180}
26181
26182/// Undeletes a WorkloadIdentityPool, as long as it was deleted fewer than 30 days ago.
26183///
26184/// A builder for the *locations.workloadIdentityPools.undelete* method supported by a *project* resource.
26185/// It is not used directly, but through a [`ProjectMethods`] instance.
26186///
26187/// # Example
26188///
26189/// Instantiate a resource method builder
26190///
26191/// ```test_harness,no_run
26192/// # extern crate hyper;
26193/// # extern crate hyper_rustls;
26194/// # extern crate google_iam1 as iam1;
26195/// use iam1::api::UndeleteWorkloadIdentityPoolRequest;
26196/// # async fn dox() {
26197/// # use iam1::{Iam, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
26198///
26199/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
26200/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
26201/// #     secret,
26202/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
26203/// # ).build().await.unwrap();
26204///
26205/// # let client = hyper_util::client::legacy::Client::builder(
26206/// #     hyper_util::rt::TokioExecutor::new()
26207/// # )
26208/// # .build(
26209/// #     hyper_rustls::HttpsConnectorBuilder::new()
26210/// #         .with_native_roots()
26211/// #         .unwrap()
26212/// #         .https_or_http()
26213/// #         .enable_http1()
26214/// #         .build()
26215/// # );
26216/// # let mut hub = Iam::new(client, auth);
26217/// // As the method needs a request, you would usually fill it with the desired information
26218/// // into the respective structure. Some of the parts shown here might not be applicable !
26219/// // Values shown here are possibly random and not representative !
26220/// let mut req = UndeleteWorkloadIdentityPoolRequest::default();
26221///
26222/// // You can configure optional parameters by calling the respective setters at will, and
26223/// // execute the final call using `doit()`.
26224/// // Values shown here are possibly random and not representative !
26225/// let result = hub.projects().locations_workload_identity_pools_undelete(req, "name")
26226///              .doit().await;
26227/// # }
26228/// ```
26229pub struct ProjectLocationWorkloadIdentityPoolUndeleteCall<'a, C>
26230where
26231    C: 'a,
26232{
26233    hub: &'a Iam<C>,
26234    _request: UndeleteWorkloadIdentityPoolRequest,
26235    _name: String,
26236    _delegate: Option<&'a mut dyn common::Delegate>,
26237    _additional_params: HashMap<String, String>,
26238    _scopes: BTreeSet<String>,
26239}
26240
26241impl<'a, C> common::CallBuilder for ProjectLocationWorkloadIdentityPoolUndeleteCall<'a, C> {}
26242
26243impl<'a, C> ProjectLocationWorkloadIdentityPoolUndeleteCall<'a, C>
26244where
26245    C: common::Connector,
26246{
26247    /// Perform the operation you have build so far.
26248    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
26249        use std::borrow::Cow;
26250        use std::io::{Read, Seek};
26251
26252        use common::{url::Params, ToParts};
26253        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
26254
26255        let mut dd = common::DefaultDelegate;
26256        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
26257        dlg.begin(common::MethodInfo {
26258            id: "iam.projects.locations.workloadIdentityPools.undelete",
26259            http_method: hyper::Method::POST,
26260        });
26261
26262        for &field in ["alt", "name"].iter() {
26263            if self._additional_params.contains_key(field) {
26264                dlg.finished(false);
26265                return Err(common::Error::FieldClash(field));
26266            }
26267        }
26268
26269        let mut params = Params::with_capacity(4 + self._additional_params.len());
26270        params.push("name", self._name);
26271
26272        params.extend(self._additional_params.iter());
26273
26274        params.push("alt", "json");
26275        let mut url = self.hub._base_url.clone() + "v1/{+name}:undelete";
26276        if self._scopes.is_empty() {
26277            self._scopes
26278                .insert(Scope::CloudPlatform.as_ref().to_string());
26279        }
26280
26281        #[allow(clippy::single_element_loop)]
26282        for &(find_this, param_name) in [("{+name}", "name")].iter() {
26283            url = params.uri_replacement(url, param_name, find_this, true);
26284        }
26285        {
26286            let to_remove = ["name"];
26287            params.remove_params(&to_remove);
26288        }
26289
26290        let url = params.parse_with_url(&url);
26291
26292        let mut json_mime_type = mime::APPLICATION_JSON;
26293        let mut request_value_reader = {
26294            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
26295            common::remove_json_null_values(&mut value);
26296            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
26297            serde_json::to_writer(&mut dst, &value).unwrap();
26298            dst
26299        };
26300        let request_size = request_value_reader
26301            .seek(std::io::SeekFrom::End(0))
26302            .unwrap();
26303        request_value_reader
26304            .seek(std::io::SeekFrom::Start(0))
26305            .unwrap();
26306
26307        loop {
26308            let token = match self
26309                .hub
26310                .auth
26311                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
26312                .await
26313            {
26314                Ok(token) => token,
26315                Err(e) => match dlg.token(e) {
26316                    Ok(token) => token,
26317                    Err(e) => {
26318                        dlg.finished(false);
26319                        return Err(common::Error::MissingToken(e));
26320                    }
26321                },
26322            };
26323            request_value_reader
26324                .seek(std::io::SeekFrom::Start(0))
26325                .unwrap();
26326            let mut req_result = {
26327                let client = &self.hub.client;
26328                dlg.pre_request();
26329                let mut req_builder = hyper::Request::builder()
26330                    .method(hyper::Method::POST)
26331                    .uri(url.as_str())
26332                    .header(USER_AGENT, self.hub._user_agent.clone());
26333
26334                if let Some(token) = token.as_ref() {
26335                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
26336                }
26337
26338                let request = req_builder
26339                    .header(CONTENT_TYPE, json_mime_type.to_string())
26340                    .header(CONTENT_LENGTH, request_size as u64)
26341                    .body(common::to_body(
26342                        request_value_reader.get_ref().clone().into(),
26343                    ));
26344
26345                client.request(request.unwrap()).await
26346            };
26347
26348            match req_result {
26349                Err(err) => {
26350                    if let common::Retry::After(d) = dlg.http_error(&err) {
26351                        sleep(d).await;
26352                        continue;
26353                    }
26354                    dlg.finished(false);
26355                    return Err(common::Error::HttpError(err));
26356                }
26357                Ok(res) => {
26358                    let (mut parts, body) = res.into_parts();
26359                    let mut body = common::Body::new(body);
26360                    if !parts.status.is_success() {
26361                        let bytes = common::to_bytes(body).await.unwrap_or_default();
26362                        let error = serde_json::from_str(&common::to_string(&bytes));
26363                        let response = common::to_response(parts, bytes.into());
26364
26365                        if let common::Retry::After(d) =
26366                            dlg.http_failure(&response, error.as_ref().ok())
26367                        {
26368                            sleep(d).await;
26369                            continue;
26370                        }
26371
26372                        dlg.finished(false);
26373
26374                        return Err(match error {
26375                            Ok(value) => common::Error::BadRequest(value),
26376                            _ => common::Error::Failure(response),
26377                        });
26378                    }
26379                    let response = {
26380                        let bytes = common::to_bytes(body).await.unwrap_or_default();
26381                        let encoded = common::to_string(&bytes);
26382                        match serde_json::from_str(&encoded) {
26383                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
26384                            Err(error) => {
26385                                dlg.response_json_decode_error(&encoded, &error);
26386                                return Err(common::Error::JsonDecodeError(
26387                                    encoded.to_string(),
26388                                    error,
26389                                ));
26390                            }
26391                        }
26392                    };
26393
26394                    dlg.finished(true);
26395                    return Ok(response);
26396                }
26397            }
26398        }
26399    }
26400
26401    ///
26402    /// Sets the *request* property to the given value.
26403    ///
26404    /// Even though the property as already been set when instantiating this call,
26405    /// we provide this method for API completeness.
26406    pub fn request(
26407        mut self,
26408        new_value: UndeleteWorkloadIdentityPoolRequest,
26409    ) -> ProjectLocationWorkloadIdentityPoolUndeleteCall<'a, C> {
26410        self._request = new_value;
26411        self
26412    }
26413    /// Required. The name of the pool to undelete.
26414    ///
26415    /// Sets the *name* path property to the given value.
26416    ///
26417    /// Even though the property as already been set when instantiating this call,
26418    /// we provide this method for API completeness.
26419    pub fn name(
26420        mut self,
26421        new_value: &str,
26422    ) -> ProjectLocationWorkloadIdentityPoolUndeleteCall<'a, C> {
26423        self._name = new_value.to_string();
26424        self
26425    }
26426    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
26427    /// while executing the actual API request.
26428    ///
26429    /// ````text
26430    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
26431    /// ````
26432    ///
26433    /// Sets the *delegate* property to the given value.
26434    pub fn delegate(
26435        mut self,
26436        new_value: &'a mut dyn common::Delegate,
26437    ) -> ProjectLocationWorkloadIdentityPoolUndeleteCall<'a, C> {
26438        self._delegate = Some(new_value);
26439        self
26440    }
26441
26442    /// Set any additional parameter of the query string used in the request.
26443    /// It should be used to set parameters which are not yet available through their own
26444    /// setters.
26445    ///
26446    /// Please note that this method must not be used to set any of the known parameters
26447    /// which have their own setter method. If done anyway, the request will fail.
26448    ///
26449    /// # Additional Parameters
26450    ///
26451    /// * *$.xgafv* (query-string) - V1 error format.
26452    /// * *access_token* (query-string) - OAuth access token.
26453    /// * *alt* (query-string) - Data format for response.
26454    /// * *callback* (query-string) - JSONP
26455    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
26456    /// * *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.
26457    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
26458    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
26459    /// * *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.
26460    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
26461    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
26462    pub fn param<T>(
26463        mut self,
26464        name: T,
26465        value: T,
26466    ) -> ProjectLocationWorkloadIdentityPoolUndeleteCall<'a, C>
26467    where
26468        T: AsRef<str>,
26469    {
26470        self._additional_params
26471            .insert(name.as_ref().to_string(), value.as_ref().to_string());
26472        self
26473    }
26474
26475    /// Identifies the authorization scope for the method you are building.
26476    ///
26477    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
26478    /// [`Scope::CloudPlatform`].
26479    ///
26480    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
26481    /// tokens for more than one scope.
26482    ///
26483    /// Usually there is more than one suitable scope to authorize an operation, some of which may
26484    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
26485    /// sufficient, a read-write scope will do as well.
26486    pub fn add_scope<St>(
26487        mut self,
26488        scope: St,
26489    ) -> ProjectLocationWorkloadIdentityPoolUndeleteCall<'a, C>
26490    where
26491        St: AsRef<str>,
26492    {
26493        self._scopes.insert(String::from(scope.as_ref()));
26494        self
26495    }
26496    /// Identifies the authorization scope(s) for the method you are building.
26497    ///
26498    /// See [`Self::add_scope()`] for details.
26499    pub fn add_scopes<I, St>(
26500        mut self,
26501        scopes: I,
26502    ) -> ProjectLocationWorkloadIdentityPoolUndeleteCall<'a, C>
26503    where
26504        I: IntoIterator<Item = St>,
26505        St: AsRef<str>,
26506    {
26507        self._scopes
26508            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
26509        self
26510    }
26511
26512    /// Removes all scopes, and no default scope will be used either.
26513    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
26514    /// for details).
26515    pub fn clear_scopes(mut self) -> ProjectLocationWorkloadIdentityPoolUndeleteCall<'a, C> {
26516        self._scopes.clear();
26517        self
26518    }
26519}
26520
26521/// Creates a new custom Role.
26522///
26523/// A builder for the *roles.create* method supported by a *project* resource.
26524/// It is not used directly, but through a [`ProjectMethods`] instance.
26525///
26526/// # Example
26527///
26528/// Instantiate a resource method builder
26529///
26530/// ```test_harness,no_run
26531/// # extern crate hyper;
26532/// # extern crate hyper_rustls;
26533/// # extern crate google_iam1 as iam1;
26534/// use iam1::api::CreateRoleRequest;
26535/// # async fn dox() {
26536/// # use iam1::{Iam, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
26537///
26538/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
26539/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
26540/// #     secret,
26541/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
26542/// # ).build().await.unwrap();
26543///
26544/// # let client = hyper_util::client::legacy::Client::builder(
26545/// #     hyper_util::rt::TokioExecutor::new()
26546/// # )
26547/// # .build(
26548/// #     hyper_rustls::HttpsConnectorBuilder::new()
26549/// #         .with_native_roots()
26550/// #         .unwrap()
26551/// #         .https_or_http()
26552/// #         .enable_http1()
26553/// #         .build()
26554/// # );
26555/// # let mut hub = Iam::new(client, auth);
26556/// // As the method needs a request, you would usually fill it with the desired information
26557/// // into the respective structure. Some of the parts shown here might not be applicable !
26558/// // Values shown here are possibly random and not representative !
26559/// let mut req = CreateRoleRequest::default();
26560///
26561/// // You can configure optional parameters by calling the respective setters at will, and
26562/// // execute the final call using `doit()`.
26563/// // Values shown here are possibly random and not representative !
26564/// let result = hub.projects().roles_create(req, "parent")
26565///              .doit().await;
26566/// # }
26567/// ```
26568pub struct ProjectRoleCreateCall<'a, C>
26569where
26570    C: 'a,
26571{
26572    hub: &'a Iam<C>,
26573    _request: CreateRoleRequest,
26574    _parent: String,
26575    _delegate: Option<&'a mut dyn common::Delegate>,
26576    _additional_params: HashMap<String, String>,
26577    _scopes: BTreeSet<String>,
26578}
26579
26580impl<'a, C> common::CallBuilder for ProjectRoleCreateCall<'a, C> {}
26581
26582impl<'a, C> ProjectRoleCreateCall<'a, C>
26583where
26584    C: common::Connector,
26585{
26586    /// Perform the operation you have build so far.
26587    pub async fn doit(mut self) -> common::Result<(common::Response, Role)> {
26588        use std::borrow::Cow;
26589        use std::io::{Read, Seek};
26590
26591        use common::{url::Params, ToParts};
26592        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
26593
26594        let mut dd = common::DefaultDelegate;
26595        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
26596        dlg.begin(common::MethodInfo {
26597            id: "iam.projects.roles.create",
26598            http_method: hyper::Method::POST,
26599        });
26600
26601        for &field in ["alt", "parent"].iter() {
26602            if self._additional_params.contains_key(field) {
26603                dlg.finished(false);
26604                return Err(common::Error::FieldClash(field));
26605            }
26606        }
26607
26608        let mut params = Params::with_capacity(4 + self._additional_params.len());
26609        params.push("parent", self._parent);
26610
26611        params.extend(self._additional_params.iter());
26612
26613        params.push("alt", "json");
26614        let mut url = self.hub._base_url.clone() + "v1/{+parent}/roles";
26615        if self._scopes.is_empty() {
26616            self._scopes
26617                .insert(Scope::CloudPlatform.as_ref().to_string());
26618        }
26619
26620        #[allow(clippy::single_element_loop)]
26621        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
26622            url = params.uri_replacement(url, param_name, find_this, true);
26623        }
26624        {
26625            let to_remove = ["parent"];
26626            params.remove_params(&to_remove);
26627        }
26628
26629        let url = params.parse_with_url(&url);
26630
26631        let mut json_mime_type = mime::APPLICATION_JSON;
26632        let mut request_value_reader = {
26633            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
26634            common::remove_json_null_values(&mut value);
26635            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
26636            serde_json::to_writer(&mut dst, &value).unwrap();
26637            dst
26638        };
26639        let request_size = request_value_reader
26640            .seek(std::io::SeekFrom::End(0))
26641            .unwrap();
26642        request_value_reader
26643            .seek(std::io::SeekFrom::Start(0))
26644            .unwrap();
26645
26646        loop {
26647            let token = match self
26648                .hub
26649                .auth
26650                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
26651                .await
26652            {
26653                Ok(token) => token,
26654                Err(e) => match dlg.token(e) {
26655                    Ok(token) => token,
26656                    Err(e) => {
26657                        dlg.finished(false);
26658                        return Err(common::Error::MissingToken(e));
26659                    }
26660                },
26661            };
26662            request_value_reader
26663                .seek(std::io::SeekFrom::Start(0))
26664                .unwrap();
26665            let mut req_result = {
26666                let client = &self.hub.client;
26667                dlg.pre_request();
26668                let mut req_builder = hyper::Request::builder()
26669                    .method(hyper::Method::POST)
26670                    .uri(url.as_str())
26671                    .header(USER_AGENT, self.hub._user_agent.clone());
26672
26673                if let Some(token) = token.as_ref() {
26674                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
26675                }
26676
26677                let request = req_builder
26678                    .header(CONTENT_TYPE, json_mime_type.to_string())
26679                    .header(CONTENT_LENGTH, request_size as u64)
26680                    .body(common::to_body(
26681                        request_value_reader.get_ref().clone().into(),
26682                    ));
26683
26684                client.request(request.unwrap()).await
26685            };
26686
26687            match req_result {
26688                Err(err) => {
26689                    if let common::Retry::After(d) = dlg.http_error(&err) {
26690                        sleep(d).await;
26691                        continue;
26692                    }
26693                    dlg.finished(false);
26694                    return Err(common::Error::HttpError(err));
26695                }
26696                Ok(res) => {
26697                    let (mut parts, body) = res.into_parts();
26698                    let mut body = common::Body::new(body);
26699                    if !parts.status.is_success() {
26700                        let bytes = common::to_bytes(body).await.unwrap_or_default();
26701                        let error = serde_json::from_str(&common::to_string(&bytes));
26702                        let response = common::to_response(parts, bytes.into());
26703
26704                        if let common::Retry::After(d) =
26705                            dlg.http_failure(&response, error.as_ref().ok())
26706                        {
26707                            sleep(d).await;
26708                            continue;
26709                        }
26710
26711                        dlg.finished(false);
26712
26713                        return Err(match error {
26714                            Ok(value) => common::Error::BadRequest(value),
26715                            _ => common::Error::Failure(response),
26716                        });
26717                    }
26718                    let response = {
26719                        let bytes = common::to_bytes(body).await.unwrap_or_default();
26720                        let encoded = common::to_string(&bytes);
26721                        match serde_json::from_str(&encoded) {
26722                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
26723                            Err(error) => {
26724                                dlg.response_json_decode_error(&encoded, &error);
26725                                return Err(common::Error::JsonDecodeError(
26726                                    encoded.to_string(),
26727                                    error,
26728                                ));
26729                            }
26730                        }
26731                    };
26732
26733                    dlg.finished(true);
26734                    return Ok(response);
26735                }
26736            }
26737        }
26738    }
26739
26740    ///
26741    /// Sets the *request* property to the given value.
26742    ///
26743    /// Even though the property as already been set when instantiating this call,
26744    /// we provide this method for API completeness.
26745    pub fn request(mut self, new_value: CreateRoleRequest) -> ProjectRoleCreateCall<'a, C> {
26746        self._request = new_value;
26747        self
26748    }
26749    /// The `parent` parameter's value depends on the target resource for the request, namely [projects](https://cloud.google.com/iam/docs/reference/rest/v1/projects.roles) or [organizations](https://cloud.google.com/iam/docs/reference/rest/v1/organizations.roles). Each resource type's `parent` value format is described below: * [projects.roles.create](https://cloud.google.com/iam/docs/reference/rest/v1/projects.roles/create): `projects/{PROJECT_ID}`. This method creates project-level [custom roles](https://cloud.google.com/iam/docs/understanding-custom-roles). Example request URL: `https://iam.googleapis.com/v1/projects/{PROJECT_ID}/roles` * [organizations.roles.create](https://cloud.google.com/iam/docs/reference/rest/v1/organizations.roles/create): `organizations/{ORGANIZATION_ID}`. This method creates organization-level [custom roles](https://cloud.google.com/iam/docs/understanding-custom-roles). Example request URL: `https://iam.googleapis.com/v1/organizations/{ORGANIZATION_ID}/roles` Note: Wildcard (*) values are invalid; you must specify a complete project ID or organization ID.
26750    ///
26751    /// Sets the *parent* path property to the given value.
26752    ///
26753    /// Even though the property as already been set when instantiating this call,
26754    /// we provide this method for API completeness.
26755    pub fn parent(mut self, new_value: &str) -> ProjectRoleCreateCall<'a, C> {
26756        self._parent = new_value.to_string();
26757        self
26758    }
26759    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
26760    /// while executing the actual API request.
26761    ///
26762    /// ````text
26763    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
26764    /// ````
26765    ///
26766    /// Sets the *delegate* property to the given value.
26767    pub fn delegate(
26768        mut self,
26769        new_value: &'a mut dyn common::Delegate,
26770    ) -> ProjectRoleCreateCall<'a, C> {
26771        self._delegate = Some(new_value);
26772        self
26773    }
26774
26775    /// Set any additional parameter of the query string used in the request.
26776    /// It should be used to set parameters which are not yet available through their own
26777    /// setters.
26778    ///
26779    /// Please note that this method must not be used to set any of the known parameters
26780    /// which have their own setter method. If done anyway, the request will fail.
26781    ///
26782    /// # Additional Parameters
26783    ///
26784    /// * *$.xgafv* (query-string) - V1 error format.
26785    /// * *access_token* (query-string) - OAuth access token.
26786    /// * *alt* (query-string) - Data format for response.
26787    /// * *callback* (query-string) - JSONP
26788    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
26789    /// * *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.
26790    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
26791    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
26792    /// * *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.
26793    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
26794    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
26795    pub fn param<T>(mut self, name: T, value: T) -> ProjectRoleCreateCall<'a, C>
26796    where
26797        T: AsRef<str>,
26798    {
26799        self._additional_params
26800            .insert(name.as_ref().to_string(), value.as_ref().to_string());
26801        self
26802    }
26803
26804    /// Identifies the authorization scope for the method you are building.
26805    ///
26806    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
26807    /// [`Scope::CloudPlatform`].
26808    ///
26809    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
26810    /// tokens for more than one scope.
26811    ///
26812    /// Usually there is more than one suitable scope to authorize an operation, some of which may
26813    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
26814    /// sufficient, a read-write scope will do as well.
26815    pub fn add_scope<St>(mut self, scope: St) -> ProjectRoleCreateCall<'a, C>
26816    where
26817        St: AsRef<str>,
26818    {
26819        self._scopes.insert(String::from(scope.as_ref()));
26820        self
26821    }
26822    /// Identifies the authorization scope(s) for the method you are building.
26823    ///
26824    /// See [`Self::add_scope()`] for details.
26825    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectRoleCreateCall<'a, C>
26826    where
26827        I: IntoIterator<Item = St>,
26828        St: AsRef<str>,
26829    {
26830        self._scopes
26831            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
26832        self
26833    }
26834
26835    /// Removes all scopes, and no default scope will be used either.
26836    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
26837    /// for details).
26838    pub fn clear_scopes(mut self) -> ProjectRoleCreateCall<'a, C> {
26839        self._scopes.clear();
26840        self
26841    }
26842}
26843
26844/// Deletes a custom Role. When you delete a custom role, the following changes occur immediately: * You cannot bind a principal to the custom role in an IAM Policy. * Existing bindings to the custom role are not changed, but they have no effect. * By default, the response from ListRoles does not include the custom role. You have 7 days to undelete the custom role. After 7 days, the following changes occur: * The custom role is permanently deleted and cannot be recovered. * If an IAM policy contains a binding to the custom role, the binding is permanently removed.
26845///
26846/// A builder for the *roles.delete* method supported by a *project* resource.
26847/// It is not used directly, but through a [`ProjectMethods`] instance.
26848///
26849/// # Example
26850///
26851/// Instantiate a resource method builder
26852///
26853/// ```test_harness,no_run
26854/// # extern crate hyper;
26855/// # extern crate hyper_rustls;
26856/// # extern crate google_iam1 as iam1;
26857/// # async fn dox() {
26858/// # use iam1::{Iam, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
26859///
26860/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
26861/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
26862/// #     secret,
26863/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
26864/// # ).build().await.unwrap();
26865///
26866/// # let client = hyper_util::client::legacy::Client::builder(
26867/// #     hyper_util::rt::TokioExecutor::new()
26868/// # )
26869/// # .build(
26870/// #     hyper_rustls::HttpsConnectorBuilder::new()
26871/// #         .with_native_roots()
26872/// #         .unwrap()
26873/// #         .https_or_http()
26874/// #         .enable_http1()
26875/// #         .build()
26876/// # );
26877/// # let mut hub = Iam::new(client, auth);
26878/// // You can configure optional parameters by calling the respective setters at will, and
26879/// // execute the final call using `doit()`.
26880/// // Values shown here are possibly random and not representative !
26881/// let result = hub.projects().roles_delete("name")
26882///              .etag(vec![0, 1, 2, 3])
26883///              .doit().await;
26884/// # }
26885/// ```
26886pub struct ProjectRoleDeleteCall<'a, C>
26887where
26888    C: 'a,
26889{
26890    hub: &'a Iam<C>,
26891    _name: String,
26892    _etag: Option<Vec<u8>>,
26893    _delegate: Option<&'a mut dyn common::Delegate>,
26894    _additional_params: HashMap<String, String>,
26895    _scopes: BTreeSet<String>,
26896}
26897
26898impl<'a, C> common::CallBuilder for ProjectRoleDeleteCall<'a, C> {}
26899
26900impl<'a, C> ProjectRoleDeleteCall<'a, C>
26901where
26902    C: common::Connector,
26903{
26904    /// Perform the operation you have build so far.
26905    pub async fn doit(mut self) -> common::Result<(common::Response, Role)> {
26906        use std::borrow::Cow;
26907        use std::io::{Read, Seek};
26908
26909        use common::{url::Params, ToParts};
26910        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
26911
26912        let mut dd = common::DefaultDelegate;
26913        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
26914        dlg.begin(common::MethodInfo {
26915            id: "iam.projects.roles.delete",
26916            http_method: hyper::Method::DELETE,
26917        });
26918
26919        for &field in ["alt", "name", "etag"].iter() {
26920            if self._additional_params.contains_key(field) {
26921                dlg.finished(false);
26922                return Err(common::Error::FieldClash(field));
26923            }
26924        }
26925
26926        let mut params = Params::with_capacity(4 + self._additional_params.len());
26927        params.push("name", self._name);
26928        if let Some(value) = self._etag.as_ref() {
26929            params.push("etag", common::serde::standard_base64::to_string(&value));
26930        }
26931
26932        params.extend(self._additional_params.iter());
26933
26934        params.push("alt", "json");
26935        let mut url = self.hub._base_url.clone() + "v1/{+name}";
26936        if self._scopes.is_empty() {
26937            self._scopes
26938                .insert(Scope::CloudPlatform.as_ref().to_string());
26939        }
26940
26941        #[allow(clippy::single_element_loop)]
26942        for &(find_this, param_name) in [("{+name}", "name")].iter() {
26943            url = params.uri_replacement(url, param_name, find_this, true);
26944        }
26945        {
26946            let to_remove = ["name"];
26947            params.remove_params(&to_remove);
26948        }
26949
26950        let url = params.parse_with_url(&url);
26951
26952        loop {
26953            let token = match self
26954                .hub
26955                .auth
26956                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
26957                .await
26958            {
26959                Ok(token) => token,
26960                Err(e) => match dlg.token(e) {
26961                    Ok(token) => token,
26962                    Err(e) => {
26963                        dlg.finished(false);
26964                        return Err(common::Error::MissingToken(e));
26965                    }
26966                },
26967            };
26968            let mut req_result = {
26969                let client = &self.hub.client;
26970                dlg.pre_request();
26971                let mut req_builder = hyper::Request::builder()
26972                    .method(hyper::Method::DELETE)
26973                    .uri(url.as_str())
26974                    .header(USER_AGENT, self.hub._user_agent.clone());
26975
26976                if let Some(token) = token.as_ref() {
26977                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
26978                }
26979
26980                let request = req_builder
26981                    .header(CONTENT_LENGTH, 0_u64)
26982                    .body(common::to_body::<String>(None));
26983
26984                client.request(request.unwrap()).await
26985            };
26986
26987            match req_result {
26988                Err(err) => {
26989                    if let common::Retry::After(d) = dlg.http_error(&err) {
26990                        sleep(d).await;
26991                        continue;
26992                    }
26993                    dlg.finished(false);
26994                    return Err(common::Error::HttpError(err));
26995                }
26996                Ok(res) => {
26997                    let (mut parts, body) = res.into_parts();
26998                    let mut body = common::Body::new(body);
26999                    if !parts.status.is_success() {
27000                        let bytes = common::to_bytes(body).await.unwrap_or_default();
27001                        let error = serde_json::from_str(&common::to_string(&bytes));
27002                        let response = common::to_response(parts, bytes.into());
27003
27004                        if let common::Retry::After(d) =
27005                            dlg.http_failure(&response, error.as_ref().ok())
27006                        {
27007                            sleep(d).await;
27008                            continue;
27009                        }
27010
27011                        dlg.finished(false);
27012
27013                        return Err(match error {
27014                            Ok(value) => common::Error::BadRequest(value),
27015                            _ => common::Error::Failure(response),
27016                        });
27017                    }
27018                    let response = {
27019                        let bytes = common::to_bytes(body).await.unwrap_or_default();
27020                        let encoded = common::to_string(&bytes);
27021                        match serde_json::from_str(&encoded) {
27022                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
27023                            Err(error) => {
27024                                dlg.response_json_decode_error(&encoded, &error);
27025                                return Err(common::Error::JsonDecodeError(
27026                                    encoded.to_string(),
27027                                    error,
27028                                ));
27029                            }
27030                        }
27031                    };
27032
27033                    dlg.finished(true);
27034                    return Ok(response);
27035                }
27036            }
27037        }
27038    }
27039
27040    /// The `name` parameter's value depends on the target resource for the request, namely [projects](https://cloud.google.com/iam/docs/reference/rest/v1/projects.roles) or [organizations](https://cloud.google.com/iam/docs/reference/rest/v1/organizations.roles). Each resource type's `name` value format is described below: * [projects.roles.delete](https://cloud.google.com/iam/docs/reference/rest/v1/projects.roles/delete): `projects/{PROJECT_ID}/roles/{CUSTOM_ROLE_ID}`. This method deletes only [custom roles](https://cloud.google.com/iam/docs/understanding-custom-roles) that have been created at the project level. Example request URL: `https://iam.googleapis.com/v1/projects/{PROJECT_ID}/roles/{CUSTOM_ROLE_ID}` * [organizations.roles.delete](https://cloud.google.com/iam/docs/reference/rest/v1/organizations.roles/delete): `organizations/{ORGANIZATION_ID}/roles/{CUSTOM_ROLE_ID}`. This method deletes only [custom roles](https://cloud.google.com/iam/docs/understanding-custom-roles) that have been created at the organization level. Example request URL: `https://iam.googleapis.com/v1/organizations/{ORGANIZATION_ID}/roles/{CUSTOM_ROLE_ID}` Note: Wildcard (*) values are invalid; you must specify a complete project ID or organization ID.
27041    ///
27042    /// Sets the *name* path property to the given value.
27043    ///
27044    /// Even though the property as already been set when instantiating this call,
27045    /// we provide this method for API completeness.
27046    pub fn name(mut self, new_value: &str) -> ProjectRoleDeleteCall<'a, C> {
27047        self._name = new_value.to_string();
27048        self
27049    }
27050    /// Used to perform a consistent read-modify-write.
27051    ///
27052    /// Sets the *etag* query property to the given value.
27053    pub fn etag(mut self, new_value: Vec<u8>) -> ProjectRoleDeleteCall<'a, C> {
27054        self._etag = Some(new_value);
27055        self
27056    }
27057    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
27058    /// while executing the actual API request.
27059    ///
27060    /// ````text
27061    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
27062    /// ````
27063    ///
27064    /// Sets the *delegate* property to the given value.
27065    pub fn delegate(
27066        mut self,
27067        new_value: &'a mut dyn common::Delegate,
27068    ) -> ProjectRoleDeleteCall<'a, C> {
27069        self._delegate = Some(new_value);
27070        self
27071    }
27072
27073    /// Set any additional parameter of the query string used in the request.
27074    /// It should be used to set parameters which are not yet available through their own
27075    /// setters.
27076    ///
27077    /// Please note that this method must not be used to set any of the known parameters
27078    /// which have their own setter method. If done anyway, the request will fail.
27079    ///
27080    /// # Additional Parameters
27081    ///
27082    /// * *$.xgafv* (query-string) - V1 error format.
27083    /// * *access_token* (query-string) - OAuth access token.
27084    /// * *alt* (query-string) - Data format for response.
27085    /// * *callback* (query-string) - JSONP
27086    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
27087    /// * *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.
27088    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
27089    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
27090    /// * *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.
27091    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
27092    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
27093    pub fn param<T>(mut self, name: T, value: T) -> ProjectRoleDeleteCall<'a, C>
27094    where
27095        T: AsRef<str>,
27096    {
27097        self._additional_params
27098            .insert(name.as_ref().to_string(), value.as_ref().to_string());
27099        self
27100    }
27101
27102    /// Identifies the authorization scope for the method you are building.
27103    ///
27104    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
27105    /// [`Scope::CloudPlatform`].
27106    ///
27107    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
27108    /// tokens for more than one scope.
27109    ///
27110    /// Usually there is more than one suitable scope to authorize an operation, some of which may
27111    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
27112    /// sufficient, a read-write scope will do as well.
27113    pub fn add_scope<St>(mut self, scope: St) -> ProjectRoleDeleteCall<'a, C>
27114    where
27115        St: AsRef<str>,
27116    {
27117        self._scopes.insert(String::from(scope.as_ref()));
27118        self
27119    }
27120    /// Identifies the authorization scope(s) for the method you are building.
27121    ///
27122    /// See [`Self::add_scope()`] for details.
27123    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectRoleDeleteCall<'a, C>
27124    where
27125        I: IntoIterator<Item = St>,
27126        St: AsRef<str>,
27127    {
27128        self._scopes
27129            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
27130        self
27131    }
27132
27133    /// Removes all scopes, and no default scope will be used either.
27134    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
27135    /// for details).
27136    pub fn clear_scopes(mut self) -> ProjectRoleDeleteCall<'a, C> {
27137        self._scopes.clear();
27138        self
27139    }
27140}
27141
27142/// Gets the definition of a Role.
27143///
27144/// A builder for the *roles.get* method supported by a *project* resource.
27145/// It is not used directly, but through a [`ProjectMethods`] instance.
27146///
27147/// # Example
27148///
27149/// Instantiate a resource method builder
27150///
27151/// ```test_harness,no_run
27152/// # extern crate hyper;
27153/// # extern crate hyper_rustls;
27154/// # extern crate google_iam1 as iam1;
27155/// # async fn dox() {
27156/// # use iam1::{Iam, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
27157///
27158/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
27159/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
27160/// #     secret,
27161/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
27162/// # ).build().await.unwrap();
27163///
27164/// # let client = hyper_util::client::legacy::Client::builder(
27165/// #     hyper_util::rt::TokioExecutor::new()
27166/// # )
27167/// # .build(
27168/// #     hyper_rustls::HttpsConnectorBuilder::new()
27169/// #         .with_native_roots()
27170/// #         .unwrap()
27171/// #         .https_or_http()
27172/// #         .enable_http1()
27173/// #         .build()
27174/// # );
27175/// # let mut hub = Iam::new(client, auth);
27176/// // You can configure optional parameters by calling the respective setters at will, and
27177/// // execute the final call using `doit()`.
27178/// // Values shown here are possibly random and not representative !
27179/// let result = hub.projects().roles_get("name")
27180///              .doit().await;
27181/// # }
27182/// ```
27183pub struct ProjectRoleGetCall<'a, C>
27184where
27185    C: 'a,
27186{
27187    hub: &'a Iam<C>,
27188    _name: String,
27189    _delegate: Option<&'a mut dyn common::Delegate>,
27190    _additional_params: HashMap<String, String>,
27191    _scopes: BTreeSet<String>,
27192}
27193
27194impl<'a, C> common::CallBuilder for ProjectRoleGetCall<'a, C> {}
27195
27196impl<'a, C> ProjectRoleGetCall<'a, C>
27197where
27198    C: common::Connector,
27199{
27200    /// Perform the operation you have build so far.
27201    pub async fn doit(mut self) -> common::Result<(common::Response, Role)> {
27202        use std::borrow::Cow;
27203        use std::io::{Read, Seek};
27204
27205        use common::{url::Params, ToParts};
27206        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
27207
27208        let mut dd = common::DefaultDelegate;
27209        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
27210        dlg.begin(common::MethodInfo {
27211            id: "iam.projects.roles.get",
27212            http_method: hyper::Method::GET,
27213        });
27214
27215        for &field in ["alt", "name"].iter() {
27216            if self._additional_params.contains_key(field) {
27217                dlg.finished(false);
27218                return Err(common::Error::FieldClash(field));
27219            }
27220        }
27221
27222        let mut params = Params::with_capacity(3 + self._additional_params.len());
27223        params.push("name", self._name);
27224
27225        params.extend(self._additional_params.iter());
27226
27227        params.push("alt", "json");
27228        let mut url = self.hub._base_url.clone() + "v1/{+name}";
27229        if self._scopes.is_empty() {
27230            self._scopes
27231                .insert(Scope::CloudPlatform.as_ref().to_string());
27232        }
27233
27234        #[allow(clippy::single_element_loop)]
27235        for &(find_this, param_name) in [("{+name}", "name")].iter() {
27236            url = params.uri_replacement(url, param_name, find_this, true);
27237        }
27238        {
27239            let to_remove = ["name"];
27240            params.remove_params(&to_remove);
27241        }
27242
27243        let url = params.parse_with_url(&url);
27244
27245        loop {
27246            let token = match self
27247                .hub
27248                .auth
27249                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
27250                .await
27251            {
27252                Ok(token) => token,
27253                Err(e) => match dlg.token(e) {
27254                    Ok(token) => token,
27255                    Err(e) => {
27256                        dlg.finished(false);
27257                        return Err(common::Error::MissingToken(e));
27258                    }
27259                },
27260            };
27261            let mut req_result = {
27262                let client = &self.hub.client;
27263                dlg.pre_request();
27264                let mut req_builder = hyper::Request::builder()
27265                    .method(hyper::Method::GET)
27266                    .uri(url.as_str())
27267                    .header(USER_AGENT, self.hub._user_agent.clone());
27268
27269                if let Some(token) = token.as_ref() {
27270                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
27271                }
27272
27273                let request = req_builder
27274                    .header(CONTENT_LENGTH, 0_u64)
27275                    .body(common::to_body::<String>(None));
27276
27277                client.request(request.unwrap()).await
27278            };
27279
27280            match req_result {
27281                Err(err) => {
27282                    if let common::Retry::After(d) = dlg.http_error(&err) {
27283                        sleep(d).await;
27284                        continue;
27285                    }
27286                    dlg.finished(false);
27287                    return Err(common::Error::HttpError(err));
27288                }
27289                Ok(res) => {
27290                    let (mut parts, body) = res.into_parts();
27291                    let mut body = common::Body::new(body);
27292                    if !parts.status.is_success() {
27293                        let bytes = common::to_bytes(body).await.unwrap_or_default();
27294                        let error = serde_json::from_str(&common::to_string(&bytes));
27295                        let response = common::to_response(parts, bytes.into());
27296
27297                        if let common::Retry::After(d) =
27298                            dlg.http_failure(&response, error.as_ref().ok())
27299                        {
27300                            sleep(d).await;
27301                            continue;
27302                        }
27303
27304                        dlg.finished(false);
27305
27306                        return Err(match error {
27307                            Ok(value) => common::Error::BadRequest(value),
27308                            _ => common::Error::Failure(response),
27309                        });
27310                    }
27311                    let response = {
27312                        let bytes = common::to_bytes(body).await.unwrap_or_default();
27313                        let encoded = common::to_string(&bytes);
27314                        match serde_json::from_str(&encoded) {
27315                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
27316                            Err(error) => {
27317                                dlg.response_json_decode_error(&encoded, &error);
27318                                return Err(common::Error::JsonDecodeError(
27319                                    encoded.to_string(),
27320                                    error,
27321                                ));
27322                            }
27323                        }
27324                    };
27325
27326                    dlg.finished(true);
27327                    return Ok(response);
27328                }
27329            }
27330        }
27331    }
27332
27333    /// The `name` parameter's value depends on the target resource for the request, namely [roles](https://cloud.google.com/iam/docs/reference/rest/v1/roles), [projects](https://cloud.google.com/iam/docs/reference/rest/v1/projects.roles), or [organizations](https://cloud.google.com/iam/docs/reference/rest/v1/organizations.roles). Each resource type's `name` value format is described below: * [roles.get](https://cloud.google.com/iam/docs/reference/rest/v1/roles/get): `roles/{ROLE_NAME}`. This method returns results from all [predefined roles](https://cloud.google.com/iam/docs/understanding-roles#predefined_roles) in IAM. Example request URL: `https://iam.googleapis.com/v1/roles/{ROLE_NAME}` * [projects.roles.get](https://cloud.google.com/iam/docs/reference/rest/v1/projects.roles/get): `projects/{PROJECT_ID}/roles/{CUSTOM_ROLE_ID}`. This method returns only [custom roles](https://cloud.google.com/iam/docs/understanding-custom-roles) that have been created at the project level. Example request URL: `https://iam.googleapis.com/v1/projects/{PROJECT_ID}/roles/{CUSTOM_ROLE_ID}` * [organizations.roles.get](https://cloud.google.com/iam/docs/reference/rest/v1/organizations.roles/get): `organizations/{ORGANIZATION_ID}/roles/{CUSTOM_ROLE_ID}`. This method returns only [custom roles](https://cloud.google.com/iam/docs/understanding-custom-roles) that have been created at the organization level. Example request URL: `https://iam.googleapis.com/v1/organizations/{ORGANIZATION_ID}/roles/{CUSTOM_ROLE_ID}` Note: Wildcard (*) values are invalid; you must specify a complete project ID or organization ID.
27334    ///
27335    /// Sets the *name* path property to the given value.
27336    ///
27337    /// Even though the property as already been set when instantiating this call,
27338    /// we provide this method for API completeness.
27339    pub fn name(mut self, new_value: &str) -> ProjectRoleGetCall<'a, C> {
27340        self._name = new_value.to_string();
27341        self
27342    }
27343    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
27344    /// while executing the actual API request.
27345    ///
27346    /// ````text
27347    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
27348    /// ````
27349    ///
27350    /// Sets the *delegate* property to the given value.
27351    pub fn delegate(
27352        mut self,
27353        new_value: &'a mut dyn common::Delegate,
27354    ) -> ProjectRoleGetCall<'a, C> {
27355        self._delegate = Some(new_value);
27356        self
27357    }
27358
27359    /// Set any additional parameter of the query string used in the request.
27360    /// It should be used to set parameters which are not yet available through their own
27361    /// setters.
27362    ///
27363    /// Please note that this method must not be used to set any of the known parameters
27364    /// which have their own setter method. If done anyway, the request will fail.
27365    ///
27366    /// # Additional Parameters
27367    ///
27368    /// * *$.xgafv* (query-string) - V1 error format.
27369    /// * *access_token* (query-string) - OAuth access token.
27370    /// * *alt* (query-string) - Data format for response.
27371    /// * *callback* (query-string) - JSONP
27372    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
27373    /// * *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.
27374    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
27375    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
27376    /// * *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.
27377    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
27378    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
27379    pub fn param<T>(mut self, name: T, value: T) -> ProjectRoleGetCall<'a, C>
27380    where
27381        T: AsRef<str>,
27382    {
27383        self._additional_params
27384            .insert(name.as_ref().to_string(), value.as_ref().to_string());
27385        self
27386    }
27387
27388    /// Identifies the authorization scope for the method you are building.
27389    ///
27390    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
27391    /// [`Scope::CloudPlatform`].
27392    ///
27393    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
27394    /// tokens for more than one scope.
27395    ///
27396    /// Usually there is more than one suitable scope to authorize an operation, some of which may
27397    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
27398    /// sufficient, a read-write scope will do as well.
27399    pub fn add_scope<St>(mut self, scope: St) -> ProjectRoleGetCall<'a, C>
27400    where
27401        St: AsRef<str>,
27402    {
27403        self._scopes.insert(String::from(scope.as_ref()));
27404        self
27405    }
27406    /// Identifies the authorization scope(s) for the method you are building.
27407    ///
27408    /// See [`Self::add_scope()`] for details.
27409    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectRoleGetCall<'a, C>
27410    where
27411        I: IntoIterator<Item = St>,
27412        St: AsRef<str>,
27413    {
27414        self._scopes
27415            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
27416        self
27417    }
27418
27419    /// Removes all scopes, and no default scope will be used either.
27420    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
27421    /// for details).
27422    pub fn clear_scopes(mut self) -> ProjectRoleGetCall<'a, C> {
27423        self._scopes.clear();
27424        self
27425    }
27426}
27427
27428/// Lists every predefined Role that IAM supports, or every custom role that is defined for an organization or project.
27429///
27430/// A builder for the *roles.list* method supported by a *project* resource.
27431/// It is not used directly, but through a [`ProjectMethods`] instance.
27432///
27433/// # Example
27434///
27435/// Instantiate a resource method builder
27436///
27437/// ```test_harness,no_run
27438/// # extern crate hyper;
27439/// # extern crate hyper_rustls;
27440/// # extern crate google_iam1 as iam1;
27441/// # async fn dox() {
27442/// # use iam1::{Iam, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
27443///
27444/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
27445/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
27446/// #     secret,
27447/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
27448/// # ).build().await.unwrap();
27449///
27450/// # let client = hyper_util::client::legacy::Client::builder(
27451/// #     hyper_util::rt::TokioExecutor::new()
27452/// # )
27453/// # .build(
27454/// #     hyper_rustls::HttpsConnectorBuilder::new()
27455/// #         .with_native_roots()
27456/// #         .unwrap()
27457/// #         .https_or_http()
27458/// #         .enable_http1()
27459/// #         .build()
27460/// # );
27461/// # let mut hub = Iam::new(client, auth);
27462/// // You can configure optional parameters by calling the respective setters at will, and
27463/// // execute the final call using `doit()`.
27464/// // Values shown here are possibly random and not representative !
27465/// let result = hub.projects().roles_list("parent")
27466///              .view("sed")
27467///              .show_deleted(true)
27468///              .page_token("et")
27469///              .page_size(-93)
27470///              .doit().await;
27471/// # }
27472/// ```
27473pub struct ProjectRoleListCall<'a, C>
27474where
27475    C: 'a,
27476{
27477    hub: &'a Iam<C>,
27478    _parent: String,
27479    _view: Option<String>,
27480    _show_deleted: Option<bool>,
27481    _page_token: Option<String>,
27482    _page_size: Option<i32>,
27483    _delegate: Option<&'a mut dyn common::Delegate>,
27484    _additional_params: HashMap<String, String>,
27485    _scopes: BTreeSet<String>,
27486}
27487
27488impl<'a, C> common::CallBuilder for ProjectRoleListCall<'a, C> {}
27489
27490impl<'a, C> ProjectRoleListCall<'a, C>
27491where
27492    C: common::Connector,
27493{
27494    /// Perform the operation you have build so far.
27495    pub async fn doit(mut self) -> common::Result<(common::Response, ListRolesResponse)> {
27496        use std::borrow::Cow;
27497        use std::io::{Read, Seek};
27498
27499        use common::{url::Params, ToParts};
27500        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
27501
27502        let mut dd = common::DefaultDelegate;
27503        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
27504        dlg.begin(common::MethodInfo {
27505            id: "iam.projects.roles.list",
27506            http_method: hyper::Method::GET,
27507        });
27508
27509        for &field in [
27510            "alt",
27511            "parent",
27512            "view",
27513            "showDeleted",
27514            "pageToken",
27515            "pageSize",
27516        ]
27517        .iter()
27518        {
27519            if self._additional_params.contains_key(field) {
27520                dlg.finished(false);
27521                return Err(common::Error::FieldClash(field));
27522            }
27523        }
27524
27525        let mut params = Params::with_capacity(7 + self._additional_params.len());
27526        params.push("parent", self._parent);
27527        if let Some(value) = self._view.as_ref() {
27528            params.push("view", value);
27529        }
27530        if let Some(value) = self._show_deleted.as_ref() {
27531            params.push("showDeleted", value.to_string());
27532        }
27533        if let Some(value) = self._page_token.as_ref() {
27534            params.push("pageToken", value);
27535        }
27536        if let Some(value) = self._page_size.as_ref() {
27537            params.push("pageSize", value.to_string());
27538        }
27539
27540        params.extend(self._additional_params.iter());
27541
27542        params.push("alt", "json");
27543        let mut url = self.hub._base_url.clone() + "v1/{+parent}/roles";
27544        if self._scopes.is_empty() {
27545            self._scopes
27546                .insert(Scope::CloudPlatform.as_ref().to_string());
27547        }
27548
27549        #[allow(clippy::single_element_loop)]
27550        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
27551            url = params.uri_replacement(url, param_name, find_this, true);
27552        }
27553        {
27554            let to_remove = ["parent"];
27555            params.remove_params(&to_remove);
27556        }
27557
27558        let url = params.parse_with_url(&url);
27559
27560        loop {
27561            let token = match self
27562                .hub
27563                .auth
27564                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
27565                .await
27566            {
27567                Ok(token) => token,
27568                Err(e) => match dlg.token(e) {
27569                    Ok(token) => token,
27570                    Err(e) => {
27571                        dlg.finished(false);
27572                        return Err(common::Error::MissingToken(e));
27573                    }
27574                },
27575            };
27576            let mut req_result = {
27577                let client = &self.hub.client;
27578                dlg.pre_request();
27579                let mut req_builder = hyper::Request::builder()
27580                    .method(hyper::Method::GET)
27581                    .uri(url.as_str())
27582                    .header(USER_AGENT, self.hub._user_agent.clone());
27583
27584                if let Some(token) = token.as_ref() {
27585                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
27586                }
27587
27588                let request = req_builder
27589                    .header(CONTENT_LENGTH, 0_u64)
27590                    .body(common::to_body::<String>(None));
27591
27592                client.request(request.unwrap()).await
27593            };
27594
27595            match req_result {
27596                Err(err) => {
27597                    if let common::Retry::After(d) = dlg.http_error(&err) {
27598                        sleep(d).await;
27599                        continue;
27600                    }
27601                    dlg.finished(false);
27602                    return Err(common::Error::HttpError(err));
27603                }
27604                Ok(res) => {
27605                    let (mut parts, body) = res.into_parts();
27606                    let mut body = common::Body::new(body);
27607                    if !parts.status.is_success() {
27608                        let bytes = common::to_bytes(body).await.unwrap_or_default();
27609                        let error = serde_json::from_str(&common::to_string(&bytes));
27610                        let response = common::to_response(parts, bytes.into());
27611
27612                        if let common::Retry::After(d) =
27613                            dlg.http_failure(&response, error.as_ref().ok())
27614                        {
27615                            sleep(d).await;
27616                            continue;
27617                        }
27618
27619                        dlg.finished(false);
27620
27621                        return Err(match error {
27622                            Ok(value) => common::Error::BadRequest(value),
27623                            _ => common::Error::Failure(response),
27624                        });
27625                    }
27626                    let response = {
27627                        let bytes = common::to_bytes(body).await.unwrap_or_default();
27628                        let encoded = common::to_string(&bytes);
27629                        match serde_json::from_str(&encoded) {
27630                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
27631                            Err(error) => {
27632                                dlg.response_json_decode_error(&encoded, &error);
27633                                return Err(common::Error::JsonDecodeError(
27634                                    encoded.to_string(),
27635                                    error,
27636                                ));
27637                            }
27638                        }
27639                    };
27640
27641                    dlg.finished(true);
27642                    return Ok(response);
27643                }
27644            }
27645        }
27646    }
27647
27648    /// The `parent` parameter's value depends on the target resource for the request, namely [roles](https://cloud.google.com/iam/docs/reference/rest/v1/roles), [projects](https://cloud.google.com/iam/docs/reference/rest/v1/projects.roles), or [organizations](https://cloud.google.com/iam/docs/reference/rest/v1/organizations.roles). Each resource type's `parent` value format is described below: * [roles.list](https://cloud.google.com/iam/docs/reference/rest/v1/roles/list): An empty string. This method doesn't require a resource; it simply returns all [predefined roles](https://cloud.google.com/iam/docs/understanding-roles#predefined_roles) in IAM. Example request URL: `https://iam.googleapis.com/v1/roles` * [projects.roles.list](https://cloud.google.com/iam/docs/reference/rest/v1/projects.roles/list): `projects/{PROJECT_ID}`. This method lists all project-level [custom roles](https://cloud.google.com/iam/docs/understanding-custom-roles). Example request URL: `https://iam.googleapis.com/v1/projects/{PROJECT_ID}/roles` * [organizations.roles.list](https://cloud.google.com/iam/docs/reference/rest/v1/organizations.roles/list): `organizations/{ORGANIZATION_ID}`. This method lists all organization-level [custom roles](https://cloud.google.com/iam/docs/understanding-custom-roles). Example request URL: `https://iam.googleapis.com/v1/organizations/{ORGANIZATION_ID}/roles` Note: Wildcard (*) values are invalid; you must specify a complete project ID or organization ID.
27649    ///
27650    /// Sets the *parent* path property to the given value.
27651    ///
27652    /// Even though the property as already been set when instantiating this call,
27653    /// we provide this method for API completeness.
27654    pub fn parent(mut self, new_value: &str) -> ProjectRoleListCall<'a, C> {
27655        self._parent = new_value.to_string();
27656        self
27657    }
27658    /// Optional view for the returned Role objects. When `FULL` is specified, the `includedPermissions` field is returned, which includes a list of all permissions in the role. The default value is `BASIC`, which does not return the `includedPermissions` field.
27659    ///
27660    /// Sets the *view* query property to the given value.
27661    pub fn view(mut self, new_value: &str) -> ProjectRoleListCall<'a, C> {
27662        self._view = Some(new_value.to_string());
27663        self
27664    }
27665    /// Include Roles that have been deleted.
27666    ///
27667    /// Sets the *show deleted* query property to the given value.
27668    pub fn show_deleted(mut self, new_value: bool) -> ProjectRoleListCall<'a, C> {
27669        self._show_deleted = Some(new_value);
27670        self
27671    }
27672    /// Optional pagination token returned in an earlier ListRolesResponse.
27673    ///
27674    /// Sets the *page token* query property to the given value.
27675    pub fn page_token(mut self, new_value: &str) -> ProjectRoleListCall<'a, C> {
27676        self._page_token = Some(new_value.to_string());
27677        self
27678    }
27679    /// Optional limit on the number of roles to include in the response. The default is 300, and the maximum is 1,000.
27680    ///
27681    /// Sets the *page size* query property to the given value.
27682    pub fn page_size(mut self, new_value: i32) -> ProjectRoleListCall<'a, C> {
27683        self._page_size = Some(new_value);
27684        self
27685    }
27686    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
27687    /// while executing the actual API request.
27688    ///
27689    /// ````text
27690    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
27691    /// ````
27692    ///
27693    /// Sets the *delegate* property to the given value.
27694    pub fn delegate(
27695        mut self,
27696        new_value: &'a mut dyn common::Delegate,
27697    ) -> ProjectRoleListCall<'a, C> {
27698        self._delegate = Some(new_value);
27699        self
27700    }
27701
27702    /// Set any additional parameter of the query string used in the request.
27703    /// It should be used to set parameters which are not yet available through their own
27704    /// setters.
27705    ///
27706    /// Please note that this method must not be used to set any of the known parameters
27707    /// which have their own setter method. If done anyway, the request will fail.
27708    ///
27709    /// # Additional Parameters
27710    ///
27711    /// * *$.xgafv* (query-string) - V1 error format.
27712    /// * *access_token* (query-string) - OAuth access token.
27713    /// * *alt* (query-string) - Data format for response.
27714    /// * *callback* (query-string) - JSONP
27715    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
27716    /// * *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.
27717    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
27718    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
27719    /// * *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.
27720    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
27721    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
27722    pub fn param<T>(mut self, name: T, value: T) -> ProjectRoleListCall<'a, C>
27723    where
27724        T: AsRef<str>,
27725    {
27726        self._additional_params
27727            .insert(name.as_ref().to_string(), value.as_ref().to_string());
27728        self
27729    }
27730
27731    /// Identifies the authorization scope for the method you are building.
27732    ///
27733    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
27734    /// [`Scope::CloudPlatform`].
27735    ///
27736    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
27737    /// tokens for more than one scope.
27738    ///
27739    /// Usually there is more than one suitable scope to authorize an operation, some of which may
27740    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
27741    /// sufficient, a read-write scope will do as well.
27742    pub fn add_scope<St>(mut self, scope: St) -> ProjectRoleListCall<'a, C>
27743    where
27744        St: AsRef<str>,
27745    {
27746        self._scopes.insert(String::from(scope.as_ref()));
27747        self
27748    }
27749    /// Identifies the authorization scope(s) for the method you are building.
27750    ///
27751    /// See [`Self::add_scope()`] for details.
27752    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectRoleListCall<'a, C>
27753    where
27754        I: IntoIterator<Item = St>,
27755        St: AsRef<str>,
27756    {
27757        self._scopes
27758            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
27759        self
27760    }
27761
27762    /// Removes all scopes, and no default scope will be used either.
27763    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
27764    /// for details).
27765    pub fn clear_scopes(mut self) -> ProjectRoleListCall<'a, C> {
27766        self._scopes.clear();
27767        self
27768    }
27769}
27770
27771/// Updates the definition of a custom Role.
27772///
27773/// A builder for the *roles.patch* method supported by a *project* resource.
27774/// It is not used directly, but through a [`ProjectMethods`] instance.
27775///
27776/// # Example
27777///
27778/// Instantiate a resource method builder
27779///
27780/// ```test_harness,no_run
27781/// # extern crate hyper;
27782/// # extern crate hyper_rustls;
27783/// # extern crate google_iam1 as iam1;
27784/// use iam1::api::Role;
27785/// # async fn dox() {
27786/// # use iam1::{Iam, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
27787///
27788/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
27789/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
27790/// #     secret,
27791/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
27792/// # ).build().await.unwrap();
27793///
27794/// # let client = hyper_util::client::legacy::Client::builder(
27795/// #     hyper_util::rt::TokioExecutor::new()
27796/// # )
27797/// # .build(
27798/// #     hyper_rustls::HttpsConnectorBuilder::new()
27799/// #         .with_native_roots()
27800/// #         .unwrap()
27801/// #         .https_or_http()
27802/// #         .enable_http1()
27803/// #         .build()
27804/// # );
27805/// # let mut hub = Iam::new(client, auth);
27806/// // As the method needs a request, you would usually fill it with the desired information
27807/// // into the respective structure. Some of the parts shown here might not be applicable !
27808/// // Values shown here are possibly random and not representative !
27809/// let mut req = Role::default();
27810///
27811/// // You can configure optional parameters by calling the respective setters at will, and
27812/// // execute the final call using `doit()`.
27813/// // Values shown here are possibly random and not representative !
27814/// let result = hub.projects().roles_patch(req, "name")
27815///              .update_mask(FieldMask::new::<&str>(&[]))
27816///              .doit().await;
27817/// # }
27818/// ```
27819pub struct ProjectRolePatchCall<'a, C>
27820where
27821    C: 'a,
27822{
27823    hub: &'a Iam<C>,
27824    _request: Role,
27825    _name: String,
27826    _update_mask: Option<common::FieldMask>,
27827    _delegate: Option<&'a mut dyn common::Delegate>,
27828    _additional_params: HashMap<String, String>,
27829    _scopes: BTreeSet<String>,
27830}
27831
27832impl<'a, C> common::CallBuilder for ProjectRolePatchCall<'a, C> {}
27833
27834impl<'a, C> ProjectRolePatchCall<'a, C>
27835where
27836    C: common::Connector,
27837{
27838    /// Perform the operation you have build so far.
27839    pub async fn doit(mut self) -> common::Result<(common::Response, Role)> {
27840        use std::borrow::Cow;
27841        use std::io::{Read, Seek};
27842
27843        use common::{url::Params, ToParts};
27844        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
27845
27846        let mut dd = common::DefaultDelegate;
27847        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
27848        dlg.begin(common::MethodInfo {
27849            id: "iam.projects.roles.patch",
27850            http_method: hyper::Method::PATCH,
27851        });
27852
27853        for &field in ["alt", "name", "updateMask"].iter() {
27854            if self._additional_params.contains_key(field) {
27855                dlg.finished(false);
27856                return Err(common::Error::FieldClash(field));
27857            }
27858        }
27859
27860        let mut params = Params::with_capacity(5 + self._additional_params.len());
27861        params.push("name", self._name);
27862        if let Some(value) = self._update_mask.as_ref() {
27863            params.push("updateMask", value.to_string());
27864        }
27865
27866        params.extend(self._additional_params.iter());
27867
27868        params.push("alt", "json");
27869        let mut url = self.hub._base_url.clone() + "v1/{+name}";
27870        if self._scopes.is_empty() {
27871            self._scopes
27872                .insert(Scope::CloudPlatform.as_ref().to_string());
27873        }
27874
27875        #[allow(clippy::single_element_loop)]
27876        for &(find_this, param_name) in [("{+name}", "name")].iter() {
27877            url = params.uri_replacement(url, param_name, find_this, true);
27878        }
27879        {
27880            let to_remove = ["name"];
27881            params.remove_params(&to_remove);
27882        }
27883
27884        let url = params.parse_with_url(&url);
27885
27886        let mut json_mime_type = mime::APPLICATION_JSON;
27887        let mut request_value_reader = {
27888            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
27889            common::remove_json_null_values(&mut value);
27890            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
27891            serde_json::to_writer(&mut dst, &value).unwrap();
27892            dst
27893        };
27894        let request_size = request_value_reader
27895            .seek(std::io::SeekFrom::End(0))
27896            .unwrap();
27897        request_value_reader
27898            .seek(std::io::SeekFrom::Start(0))
27899            .unwrap();
27900
27901        loop {
27902            let token = match self
27903                .hub
27904                .auth
27905                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
27906                .await
27907            {
27908                Ok(token) => token,
27909                Err(e) => match dlg.token(e) {
27910                    Ok(token) => token,
27911                    Err(e) => {
27912                        dlg.finished(false);
27913                        return Err(common::Error::MissingToken(e));
27914                    }
27915                },
27916            };
27917            request_value_reader
27918                .seek(std::io::SeekFrom::Start(0))
27919                .unwrap();
27920            let mut req_result = {
27921                let client = &self.hub.client;
27922                dlg.pre_request();
27923                let mut req_builder = hyper::Request::builder()
27924                    .method(hyper::Method::PATCH)
27925                    .uri(url.as_str())
27926                    .header(USER_AGENT, self.hub._user_agent.clone());
27927
27928                if let Some(token) = token.as_ref() {
27929                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
27930                }
27931
27932                let request = req_builder
27933                    .header(CONTENT_TYPE, json_mime_type.to_string())
27934                    .header(CONTENT_LENGTH, request_size as u64)
27935                    .body(common::to_body(
27936                        request_value_reader.get_ref().clone().into(),
27937                    ));
27938
27939                client.request(request.unwrap()).await
27940            };
27941
27942            match req_result {
27943                Err(err) => {
27944                    if let common::Retry::After(d) = dlg.http_error(&err) {
27945                        sleep(d).await;
27946                        continue;
27947                    }
27948                    dlg.finished(false);
27949                    return Err(common::Error::HttpError(err));
27950                }
27951                Ok(res) => {
27952                    let (mut parts, body) = res.into_parts();
27953                    let mut body = common::Body::new(body);
27954                    if !parts.status.is_success() {
27955                        let bytes = common::to_bytes(body).await.unwrap_or_default();
27956                        let error = serde_json::from_str(&common::to_string(&bytes));
27957                        let response = common::to_response(parts, bytes.into());
27958
27959                        if let common::Retry::After(d) =
27960                            dlg.http_failure(&response, error.as_ref().ok())
27961                        {
27962                            sleep(d).await;
27963                            continue;
27964                        }
27965
27966                        dlg.finished(false);
27967
27968                        return Err(match error {
27969                            Ok(value) => common::Error::BadRequest(value),
27970                            _ => common::Error::Failure(response),
27971                        });
27972                    }
27973                    let response = {
27974                        let bytes = common::to_bytes(body).await.unwrap_or_default();
27975                        let encoded = common::to_string(&bytes);
27976                        match serde_json::from_str(&encoded) {
27977                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
27978                            Err(error) => {
27979                                dlg.response_json_decode_error(&encoded, &error);
27980                                return Err(common::Error::JsonDecodeError(
27981                                    encoded.to_string(),
27982                                    error,
27983                                ));
27984                            }
27985                        }
27986                    };
27987
27988                    dlg.finished(true);
27989                    return Ok(response);
27990                }
27991            }
27992        }
27993    }
27994
27995    ///
27996    /// Sets the *request* property to the given value.
27997    ///
27998    /// Even though the property as already been set when instantiating this call,
27999    /// we provide this method for API completeness.
28000    pub fn request(mut self, new_value: Role) -> ProjectRolePatchCall<'a, C> {
28001        self._request = new_value;
28002        self
28003    }
28004    /// The `name` parameter's value depends on the target resource for the request, namely [projects](https://cloud.google.com/iam/docs/reference/rest/v1/projects.roles) or [organizations](https://cloud.google.com/iam/docs/reference/rest/v1/organizations.roles). Each resource type's `name` value format is described below: * [projects.roles.patch](https://cloud.google.com/iam/docs/reference/rest/v1/projects.roles/patch): `projects/{PROJECT_ID}/roles/{CUSTOM_ROLE_ID}`. This method updates only [custom roles](https://cloud.google.com/iam/docs/understanding-custom-roles) that have been created at the project level. Example request URL: `https://iam.googleapis.com/v1/projects/{PROJECT_ID}/roles/{CUSTOM_ROLE_ID}` * [organizations.roles.patch](https://cloud.google.com/iam/docs/reference/rest/v1/organizations.roles/patch): `organizations/{ORGANIZATION_ID}/roles/{CUSTOM_ROLE_ID}`. This method updates only [custom roles](https://cloud.google.com/iam/docs/understanding-custom-roles) that have been created at the organization level. Example request URL: `https://iam.googleapis.com/v1/organizations/{ORGANIZATION_ID}/roles/{CUSTOM_ROLE_ID}` Note: Wildcard (*) values are invalid; you must specify a complete project ID or organization ID.
28005    ///
28006    /// Sets the *name* path property to the given value.
28007    ///
28008    /// Even though the property as already been set when instantiating this call,
28009    /// we provide this method for API completeness.
28010    pub fn name(mut self, new_value: &str) -> ProjectRolePatchCall<'a, C> {
28011        self._name = new_value.to_string();
28012        self
28013    }
28014    /// A mask describing which fields in the Role have changed.
28015    ///
28016    /// Sets the *update mask* query property to the given value.
28017    pub fn update_mask(mut self, new_value: common::FieldMask) -> ProjectRolePatchCall<'a, C> {
28018        self._update_mask = Some(new_value);
28019        self
28020    }
28021    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
28022    /// while executing the actual API request.
28023    ///
28024    /// ````text
28025    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
28026    /// ````
28027    ///
28028    /// Sets the *delegate* property to the given value.
28029    pub fn delegate(
28030        mut self,
28031        new_value: &'a mut dyn common::Delegate,
28032    ) -> ProjectRolePatchCall<'a, C> {
28033        self._delegate = Some(new_value);
28034        self
28035    }
28036
28037    /// Set any additional parameter of the query string used in the request.
28038    /// It should be used to set parameters which are not yet available through their own
28039    /// setters.
28040    ///
28041    /// Please note that this method must not be used to set any of the known parameters
28042    /// which have their own setter method. If done anyway, the request will fail.
28043    ///
28044    /// # Additional Parameters
28045    ///
28046    /// * *$.xgafv* (query-string) - V1 error format.
28047    /// * *access_token* (query-string) - OAuth access token.
28048    /// * *alt* (query-string) - Data format for response.
28049    /// * *callback* (query-string) - JSONP
28050    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
28051    /// * *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.
28052    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
28053    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
28054    /// * *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.
28055    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
28056    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
28057    pub fn param<T>(mut self, name: T, value: T) -> ProjectRolePatchCall<'a, C>
28058    where
28059        T: AsRef<str>,
28060    {
28061        self._additional_params
28062            .insert(name.as_ref().to_string(), value.as_ref().to_string());
28063        self
28064    }
28065
28066    /// Identifies the authorization scope for the method you are building.
28067    ///
28068    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
28069    /// [`Scope::CloudPlatform`].
28070    ///
28071    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
28072    /// tokens for more than one scope.
28073    ///
28074    /// Usually there is more than one suitable scope to authorize an operation, some of which may
28075    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
28076    /// sufficient, a read-write scope will do as well.
28077    pub fn add_scope<St>(mut self, scope: St) -> ProjectRolePatchCall<'a, C>
28078    where
28079        St: AsRef<str>,
28080    {
28081        self._scopes.insert(String::from(scope.as_ref()));
28082        self
28083    }
28084    /// Identifies the authorization scope(s) for the method you are building.
28085    ///
28086    /// See [`Self::add_scope()`] for details.
28087    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectRolePatchCall<'a, C>
28088    where
28089        I: IntoIterator<Item = St>,
28090        St: AsRef<str>,
28091    {
28092        self._scopes
28093            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
28094        self
28095    }
28096
28097    /// Removes all scopes, and no default scope will be used either.
28098    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
28099    /// for details).
28100    pub fn clear_scopes(mut self) -> ProjectRolePatchCall<'a, C> {
28101        self._scopes.clear();
28102        self
28103    }
28104}
28105
28106/// Undeletes a custom Role.
28107///
28108/// A builder for the *roles.undelete* method supported by a *project* resource.
28109/// It is not used directly, but through a [`ProjectMethods`] instance.
28110///
28111/// # Example
28112///
28113/// Instantiate a resource method builder
28114///
28115/// ```test_harness,no_run
28116/// # extern crate hyper;
28117/// # extern crate hyper_rustls;
28118/// # extern crate google_iam1 as iam1;
28119/// use iam1::api::UndeleteRoleRequest;
28120/// # async fn dox() {
28121/// # use iam1::{Iam, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
28122///
28123/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
28124/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
28125/// #     secret,
28126/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
28127/// # ).build().await.unwrap();
28128///
28129/// # let client = hyper_util::client::legacy::Client::builder(
28130/// #     hyper_util::rt::TokioExecutor::new()
28131/// # )
28132/// # .build(
28133/// #     hyper_rustls::HttpsConnectorBuilder::new()
28134/// #         .with_native_roots()
28135/// #         .unwrap()
28136/// #         .https_or_http()
28137/// #         .enable_http1()
28138/// #         .build()
28139/// # );
28140/// # let mut hub = Iam::new(client, auth);
28141/// // As the method needs a request, you would usually fill it with the desired information
28142/// // into the respective structure. Some of the parts shown here might not be applicable !
28143/// // Values shown here are possibly random and not representative !
28144/// let mut req = UndeleteRoleRequest::default();
28145///
28146/// // You can configure optional parameters by calling the respective setters at will, and
28147/// // execute the final call using `doit()`.
28148/// // Values shown here are possibly random and not representative !
28149/// let result = hub.projects().roles_undelete(req, "name")
28150///              .doit().await;
28151/// # }
28152/// ```
28153pub struct ProjectRoleUndeleteCall<'a, C>
28154where
28155    C: 'a,
28156{
28157    hub: &'a Iam<C>,
28158    _request: UndeleteRoleRequest,
28159    _name: String,
28160    _delegate: Option<&'a mut dyn common::Delegate>,
28161    _additional_params: HashMap<String, String>,
28162    _scopes: BTreeSet<String>,
28163}
28164
28165impl<'a, C> common::CallBuilder for ProjectRoleUndeleteCall<'a, C> {}
28166
28167impl<'a, C> ProjectRoleUndeleteCall<'a, C>
28168where
28169    C: common::Connector,
28170{
28171    /// Perform the operation you have build so far.
28172    pub async fn doit(mut self) -> common::Result<(common::Response, Role)> {
28173        use std::borrow::Cow;
28174        use std::io::{Read, Seek};
28175
28176        use common::{url::Params, ToParts};
28177        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
28178
28179        let mut dd = common::DefaultDelegate;
28180        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
28181        dlg.begin(common::MethodInfo {
28182            id: "iam.projects.roles.undelete",
28183            http_method: hyper::Method::POST,
28184        });
28185
28186        for &field in ["alt", "name"].iter() {
28187            if self._additional_params.contains_key(field) {
28188                dlg.finished(false);
28189                return Err(common::Error::FieldClash(field));
28190            }
28191        }
28192
28193        let mut params = Params::with_capacity(4 + self._additional_params.len());
28194        params.push("name", self._name);
28195
28196        params.extend(self._additional_params.iter());
28197
28198        params.push("alt", "json");
28199        let mut url = self.hub._base_url.clone() + "v1/{+name}:undelete";
28200        if self._scopes.is_empty() {
28201            self._scopes
28202                .insert(Scope::CloudPlatform.as_ref().to_string());
28203        }
28204
28205        #[allow(clippy::single_element_loop)]
28206        for &(find_this, param_name) in [("{+name}", "name")].iter() {
28207            url = params.uri_replacement(url, param_name, find_this, true);
28208        }
28209        {
28210            let to_remove = ["name"];
28211            params.remove_params(&to_remove);
28212        }
28213
28214        let url = params.parse_with_url(&url);
28215
28216        let mut json_mime_type = mime::APPLICATION_JSON;
28217        let mut request_value_reader = {
28218            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
28219            common::remove_json_null_values(&mut value);
28220            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
28221            serde_json::to_writer(&mut dst, &value).unwrap();
28222            dst
28223        };
28224        let request_size = request_value_reader
28225            .seek(std::io::SeekFrom::End(0))
28226            .unwrap();
28227        request_value_reader
28228            .seek(std::io::SeekFrom::Start(0))
28229            .unwrap();
28230
28231        loop {
28232            let token = match self
28233                .hub
28234                .auth
28235                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
28236                .await
28237            {
28238                Ok(token) => token,
28239                Err(e) => match dlg.token(e) {
28240                    Ok(token) => token,
28241                    Err(e) => {
28242                        dlg.finished(false);
28243                        return Err(common::Error::MissingToken(e));
28244                    }
28245                },
28246            };
28247            request_value_reader
28248                .seek(std::io::SeekFrom::Start(0))
28249                .unwrap();
28250            let mut req_result = {
28251                let client = &self.hub.client;
28252                dlg.pre_request();
28253                let mut req_builder = hyper::Request::builder()
28254                    .method(hyper::Method::POST)
28255                    .uri(url.as_str())
28256                    .header(USER_AGENT, self.hub._user_agent.clone());
28257
28258                if let Some(token) = token.as_ref() {
28259                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
28260                }
28261
28262                let request = req_builder
28263                    .header(CONTENT_TYPE, json_mime_type.to_string())
28264                    .header(CONTENT_LENGTH, request_size as u64)
28265                    .body(common::to_body(
28266                        request_value_reader.get_ref().clone().into(),
28267                    ));
28268
28269                client.request(request.unwrap()).await
28270            };
28271
28272            match req_result {
28273                Err(err) => {
28274                    if let common::Retry::After(d) = dlg.http_error(&err) {
28275                        sleep(d).await;
28276                        continue;
28277                    }
28278                    dlg.finished(false);
28279                    return Err(common::Error::HttpError(err));
28280                }
28281                Ok(res) => {
28282                    let (mut parts, body) = res.into_parts();
28283                    let mut body = common::Body::new(body);
28284                    if !parts.status.is_success() {
28285                        let bytes = common::to_bytes(body).await.unwrap_or_default();
28286                        let error = serde_json::from_str(&common::to_string(&bytes));
28287                        let response = common::to_response(parts, bytes.into());
28288
28289                        if let common::Retry::After(d) =
28290                            dlg.http_failure(&response, error.as_ref().ok())
28291                        {
28292                            sleep(d).await;
28293                            continue;
28294                        }
28295
28296                        dlg.finished(false);
28297
28298                        return Err(match error {
28299                            Ok(value) => common::Error::BadRequest(value),
28300                            _ => common::Error::Failure(response),
28301                        });
28302                    }
28303                    let response = {
28304                        let bytes = common::to_bytes(body).await.unwrap_or_default();
28305                        let encoded = common::to_string(&bytes);
28306                        match serde_json::from_str(&encoded) {
28307                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
28308                            Err(error) => {
28309                                dlg.response_json_decode_error(&encoded, &error);
28310                                return Err(common::Error::JsonDecodeError(
28311                                    encoded.to_string(),
28312                                    error,
28313                                ));
28314                            }
28315                        }
28316                    };
28317
28318                    dlg.finished(true);
28319                    return Ok(response);
28320                }
28321            }
28322        }
28323    }
28324
28325    ///
28326    /// Sets the *request* property to the given value.
28327    ///
28328    /// Even though the property as already been set when instantiating this call,
28329    /// we provide this method for API completeness.
28330    pub fn request(mut self, new_value: UndeleteRoleRequest) -> ProjectRoleUndeleteCall<'a, C> {
28331        self._request = new_value;
28332        self
28333    }
28334    /// The `name` parameter's value depends on the target resource for the request, namely [projects](https://cloud.google.com/iam/docs/reference/rest/v1/projects.roles) or [organizations](https://cloud.google.com/iam/docs/reference/rest/v1/organizations.roles). Each resource type's `name` value format is described below: * [projects.roles.undelete](https://cloud.google.com/iam/docs/reference/rest/v1/projects.roles/undelete): `projects/{PROJECT_ID}/roles/{CUSTOM_ROLE_ID}`. This method undeletes only [custom roles](https://cloud.google.com/iam/docs/understanding-custom-roles) that have been created at the project level. Example request URL: `https://iam.googleapis.com/v1/projects/{PROJECT_ID}/roles/{CUSTOM_ROLE_ID}` * [organizations.roles.undelete](https://cloud.google.com/iam/docs/reference/rest/v1/organizations.roles/undelete): `organizations/{ORGANIZATION_ID}/roles/{CUSTOM_ROLE_ID}`. This method undeletes only [custom roles](https://cloud.google.com/iam/docs/understanding-custom-roles) that have been created at the organization level. Example request URL: `https://iam.googleapis.com/v1/organizations/{ORGANIZATION_ID}/roles/{CUSTOM_ROLE_ID}` Note: Wildcard (*) values are invalid; you must specify a complete project ID or organization ID.
28335    ///
28336    /// Sets the *name* path property to the given value.
28337    ///
28338    /// Even though the property as already been set when instantiating this call,
28339    /// we provide this method for API completeness.
28340    pub fn name(mut self, new_value: &str) -> ProjectRoleUndeleteCall<'a, C> {
28341        self._name = new_value.to_string();
28342        self
28343    }
28344    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
28345    /// while executing the actual API request.
28346    ///
28347    /// ````text
28348    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
28349    /// ````
28350    ///
28351    /// Sets the *delegate* property to the given value.
28352    pub fn delegate(
28353        mut self,
28354        new_value: &'a mut dyn common::Delegate,
28355    ) -> ProjectRoleUndeleteCall<'a, C> {
28356        self._delegate = Some(new_value);
28357        self
28358    }
28359
28360    /// Set any additional parameter of the query string used in the request.
28361    /// It should be used to set parameters which are not yet available through their own
28362    /// setters.
28363    ///
28364    /// Please note that this method must not be used to set any of the known parameters
28365    /// which have their own setter method. If done anyway, the request will fail.
28366    ///
28367    /// # Additional Parameters
28368    ///
28369    /// * *$.xgafv* (query-string) - V1 error format.
28370    /// * *access_token* (query-string) - OAuth access token.
28371    /// * *alt* (query-string) - Data format for response.
28372    /// * *callback* (query-string) - JSONP
28373    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
28374    /// * *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.
28375    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
28376    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
28377    /// * *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.
28378    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
28379    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
28380    pub fn param<T>(mut self, name: T, value: T) -> ProjectRoleUndeleteCall<'a, C>
28381    where
28382        T: AsRef<str>,
28383    {
28384        self._additional_params
28385            .insert(name.as_ref().to_string(), value.as_ref().to_string());
28386        self
28387    }
28388
28389    /// Identifies the authorization scope for the method you are building.
28390    ///
28391    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
28392    /// [`Scope::CloudPlatform`].
28393    ///
28394    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
28395    /// tokens for more than one scope.
28396    ///
28397    /// Usually there is more than one suitable scope to authorize an operation, some of which may
28398    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
28399    /// sufficient, a read-write scope will do as well.
28400    pub fn add_scope<St>(mut self, scope: St) -> ProjectRoleUndeleteCall<'a, C>
28401    where
28402        St: AsRef<str>,
28403    {
28404        self._scopes.insert(String::from(scope.as_ref()));
28405        self
28406    }
28407    /// Identifies the authorization scope(s) for the method you are building.
28408    ///
28409    /// See [`Self::add_scope()`] for details.
28410    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectRoleUndeleteCall<'a, C>
28411    where
28412        I: IntoIterator<Item = St>,
28413        St: AsRef<str>,
28414    {
28415        self._scopes
28416            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
28417        self
28418    }
28419
28420    /// Removes all scopes, and no default scope will be used either.
28421    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
28422    /// for details).
28423    pub fn clear_scopes(mut self) -> ProjectRoleUndeleteCall<'a, C> {
28424        self._scopes.clear();
28425        self
28426    }
28427}
28428
28429/// Creates a ServiceAccountKey.
28430///
28431/// A builder for the *serviceAccounts.keys.create* method supported by a *project* resource.
28432/// It is not used directly, but through a [`ProjectMethods`] instance.
28433///
28434/// # Example
28435///
28436/// Instantiate a resource method builder
28437///
28438/// ```test_harness,no_run
28439/// # extern crate hyper;
28440/// # extern crate hyper_rustls;
28441/// # extern crate google_iam1 as iam1;
28442/// use iam1::api::CreateServiceAccountKeyRequest;
28443/// # async fn dox() {
28444/// # use iam1::{Iam, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
28445///
28446/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
28447/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
28448/// #     secret,
28449/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
28450/// # ).build().await.unwrap();
28451///
28452/// # let client = hyper_util::client::legacy::Client::builder(
28453/// #     hyper_util::rt::TokioExecutor::new()
28454/// # )
28455/// # .build(
28456/// #     hyper_rustls::HttpsConnectorBuilder::new()
28457/// #         .with_native_roots()
28458/// #         .unwrap()
28459/// #         .https_or_http()
28460/// #         .enable_http1()
28461/// #         .build()
28462/// # );
28463/// # let mut hub = Iam::new(client, auth);
28464/// // As the method needs a request, you would usually fill it with the desired information
28465/// // into the respective structure. Some of the parts shown here might not be applicable !
28466/// // Values shown here are possibly random and not representative !
28467/// let mut req = CreateServiceAccountKeyRequest::default();
28468///
28469/// // You can configure optional parameters by calling the respective setters at will, and
28470/// // execute the final call using `doit()`.
28471/// // Values shown here are possibly random and not representative !
28472/// let result = hub.projects().service_accounts_keys_create(req, "name")
28473///              .doit().await;
28474/// # }
28475/// ```
28476pub struct ProjectServiceAccountKeyCreateCall<'a, C>
28477where
28478    C: 'a,
28479{
28480    hub: &'a Iam<C>,
28481    _request: CreateServiceAccountKeyRequest,
28482    _name: String,
28483    _delegate: Option<&'a mut dyn common::Delegate>,
28484    _additional_params: HashMap<String, String>,
28485    _scopes: BTreeSet<String>,
28486}
28487
28488impl<'a, C> common::CallBuilder for ProjectServiceAccountKeyCreateCall<'a, C> {}
28489
28490impl<'a, C> ProjectServiceAccountKeyCreateCall<'a, C>
28491where
28492    C: common::Connector,
28493{
28494    /// Perform the operation you have build so far.
28495    pub async fn doit(mut self) -> common::Result<(common::Response, ServiceAccountKey)> {
28496        use std::borrow::Cow;
28497        use std::io::{Read, Seek};
28498
28499        use common::{url::Params, ToParts};
28500        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
28501
28502        let mut dd = common::DefaultDelegate;
28503        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
28504        dlg.begin(common::MethodInfo {
28505            id: "iam.projects.serviceAccounts.keys.create",
28506            http_method: hyper::Method::POST,
28507        });
28508
28509        for &field in ["alt", "name"].iter() {
28510            if self._additional_params.contains_key(field) {
28511                dlg.finished(false);
28512                return Err(common::Error::FieldClash(field));
28513            }
28514        }
28515
28516        let mut params = Params::with_capacity(4 + self._additional_params.len());
28517        params.push("name", self._name);
28518
28519        params.extend(self._additional_params.iter());
28520
28521        params.push("alt", "json");
28522        let mut url = self.hub._base_url.clone() + "v1/{+name}/keys";
28523        if self._scopes.is_empty() {
28524            self._scopes
28525                .insert(Scope::CloudPlatform.as_ref().to_string());
28526        }
28527
28528        #[allow(clippy::single_element_loop)]
28529        for &(find_this, param_name) in [("{+name}", "name")].iter() {
28530            url = params.uri_replacement(url, param_name, find_this, true);
28531        }
28532        {
28533            let to_remove = ["name"];
28534            params.remove_params(&to_remove);
28535        }
28536
28537        let url = params.parse_with_url(&url);
28538
28539        let mut json_mime_type = mime::APPLICATION_JSON;
28540        let mut request_value_reader = {
28541            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
28542            common::remove_json_null_values(&mut value);
28543            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
28544            serde_json::to_writer(&mut dst, &value).unwrap();
28545            dst
28546        };
28547        let request_size = request_value_reader
28548            .seek(std::io::SeekFrom::End(0))
28549            .unwrap();
28550        request_value_reader
28551            .seek(std::io::SeekFrom::Start(0))
28552            .unwrap();
28553
28554        loop {
28555            let token = match self
28556                .hub
28557                .auth
28558                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
28559                .await
28560            {
28561                Ok(token) => token,
28562                Err(e) => match dlg.token(e) {
28563                    Ok(token) => token,
28564                    Err(e) => {
28565                        dlg.finished(false);
28566                        return Err(common::Error::MissingToken(e));
28567                    }
28568                },
28569            };
28570            request_value_reader
28571                .seek(std::io::SeekFrom::Start(0))
28572                .unwrap();
28573            let mut req_result = {
28574                let client = &self.hub.client;
28575                dlg.pre_request();
28576                let mut req_builder = hyper::Request::builder()
28577                    .method(hyper::Method::POST)
28578                    .uri(url.as_str())
28579                    .header(USER_AGENT, self.hub._user_agent.clone());
28580
28581                if let Some(token) = token.as_ref() {
28582                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
28583                }
28584
28585                let request = req_builder
28586                    .header(CONTENT_TYPE, json_mime_type.to_string())
28587                    .header(CONTENT_LENGTH, request_size as u64)
28588                    .body(common::to_body(
28589                        request_value_reader.get_ref().clone().into(),
28590                    ));
28591
28592                client.request(request.unwrap()).await
28593            };
28594
28595            match req_result {
28596                Err(err) => {
28597                    if let common::Retry::After(d) = dlg.http_error(&err) {
28598                        sleep(d).await;
28599                        continue;
28600                    }
28601                    dlg.finished(false);
28602                    return Err(common::Error::HttpError(err));
28603                }
28604                Ok(res) => {
28605                    let (mut parts, body) = res.into_parts();
28606                    let mut body = common::Body::new(body);
28607                    if !parts.status.is_success() {
28608                        let bytes = common::to_bytes(body).await.unwrap_or_default();
28609                        let error = serde_json::from_str(&common::to_string(&bytes));
28610                        let response = common::to_response(parts, bytes.into());
28611
28612                        if let common::Retry::After(d) =
28613                            dlg.http_failure(&response, error.as_ref().ok())
28614                        {
28615                            sleep(d).await;
28616                            continue;
28617                        }
28618
28619                        dlg.finished(false);
28620
28621                        return Err(match error {
28622                            Ok(value) => common::Error::BadRequest(value),
28623                            _ => common::Error::Failure(response),
28624                        });
28625                    }
28626                    let response = {
28627                        let bytes = common::to_bytes(body).await.unwrap_or_default();
28628                        let encoded = common::to_string(&bytes);
28629                        match serde_json::from_str(&encoded) {
28630                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
28631                            Err(error) => {
28632                                dlg.response_json_decode_error(&encoded, &error);
28633                                return Err(common::Error::JsonDecodeError(
28634                                    encoded.to_string(),
28635                                    error,
28636                                ));
28637                            }
28638                        }
28639                    };
28640
28641                    dlg.finished(true);
28642                    return Ok(response);
28643                }
28644            }
28645        }
28646    }
28647
28648    ///
28649    /// Sets the *request* property to the given value.
28650    ///
28651    /// Even though the property as already been set when instantiating this call,
28652    /// we provide this method for API completeness.
28653    pub fn request(
28654        mut self,
28655        new_value: CreateServiceAccountKeyRequest,
28656    ) -> ProjectServiceAccountKeyCreateCall<'a, C> {
28657        self._request = new_value;
28658        self
28659    }
28660    /// Required. The resource name of the service account. Use one of the following formats: * `projects/{PROJECT_ID}/serviceAccounts/{EMAIL_ADDRESS}` * `projects/{PROJECT_ID}/serviceAccounts/{UNIQUE_ID}` As an alternative, you can use the `-` wildcard character instead of the project ID: * `projects/-/serviceAccounts/{EMAIL_ADDRESS}` * `projects/-/serviceAccounts/{UNIQUE_ID}` When possible, avoid using the `-` wildcard character, because it can cause response messages to contain misleading error codes. For example, if you try to access the service account `projects/-/serviceAccounts/fake@example.com`, which does not exist, the response contains an HTTP `403 Forbidden` error instead of a `404 Not Found` error.
28661    ///
28662    /// Sets the *name* path property to the given value.
28663    ///
28664    /// Even though the property as already been set when instantiating this call,
28665    /// we provide this method for API completeness.
28666    pub fn name(mut self, new_value: &str) -> ProjectServiceAccountKeyCreateCall<'a, C> {
28667        self._name = new_value.to_string();
28668        self
28669    }
28670    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
28671    /// while executing the actual API request.
28672    ///
28673    /// ````text
28674    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
28675    /// ````
28676    ///
28677    /// Sets the *delegate* property to the given value.
28678    pub fn delegate(
28679        mut self,
28680        new_value: &'a mut dyn common::Delegate,
28681    ) -> ProjectServiceAccountKeyCreateCall<'a, C> {
28682        self._delegate = Some(new_value);
28683        self
28684    }
28685
28686    /// Set any additional parameter of the query string used in the request.
28687    /// It should be used to set parameters which are not yet available through their own
28688    /// setters.
28689    ///
28690    /// Please note that this method must not be used to set any of the known parameters
28691    /// which have their own setter method. If done anyway, the request will fail.
28692    ///
28693    /// # Additional Parameters
28694    ///
28695    /// * *$.xgafv* (query-string) - V1 error format.
28696    /// * *access_token* (query-string) - OAuth access token.
28697    /// * *alt* (query-string) - Data format for response.
28698    /// * *callback* (query-string) - JSONP
28699    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
28700    /// * *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.
28701    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
28702    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
28703    /// * *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.
28704    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
28705    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
28706    pub fn param<T>(mut self, name: T, value: T) -> ProjectServiceAccountKeyCreateCall<'a, C>
28707    where
28708        T: AsRef<str>,
28709    {
28710        self._additional_params
28711            .insert(name.as_ref().to_string(), value.as_ref().to_string());
28712        self
28713    }
28714
28715    /// Identifies the authorization scope for the method you are building.
28716    ///
28717    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
28718    /// [`Scope::CloudPlatform`].
28719    ///
28720    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
28721    /// tokens for more than one scope.
28722    ///
28723    /// Usually there is more than one suitable scope to authorize an operation, some of which may
28724    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
28725    /// sufficient, a read-write scope will do as well.
28726    pub fn add_scope<St>(mut self, scope: St) -> ProjectServiceAccountKeyCreateCall<'a, C>
28727    where
28728        St: AsRef<str>,
28729    {
28730        self._scopes.insert(String::from(scope.as_ref()));
28731        self
28732    }
28733    /// Identifies the authorization scope(s) for the method you are building.
28734    ///
28735    /// See [`Self::add_scope()`] for details.
28736    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectServiceAccountKeyCreateCall<'a, C>
28737    where
28738        I: IntoIterator<Item = St>,
28739        St: AsRef<str>,
28740    {
28741        self._scopes
28742            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
28743        self
28744    }
28745
28746    /// Removes all scopes, and no default scope will be used either.
28747    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
28748    /// for details).
28749    pub fn clear_scopes(mut self) -> ProjectServiceAccountKeyCreateCall<'a, C> {
28750        self._scopes.clear();
28751        self
28752    }
28753}
28754
28755/// Deletes a ServiceAccountKey. Deleting a service account key does not revoke short-lived credentials that have been issued based on the service account key.
28756///
28757/// A builder for the *serviceAccounts.keys.delete* method supported by a *project* resource.
28758/// It is not used directly, but through a [`ProjectMethods`] instance.
28759///
28760/// # Example
28761///
28762/// Instantiate a resource method builder
28763///
28764/// ```test_harness,no_run
28765/// # extern crate hyper;
28766/// # extern crate hyper_rustls;
28767/// # extern crate google_iam1 as iam1;
28768/// # async fn dox() {
28769/// # use iam1::{Iam, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
28770///
28771/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
28772/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
28773/// #     secret,
28774/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
28775/// # ).build().await.unwrap();
28776///
28777/// # let client = hyper_util::client::legacy::Client::builder(
28778/// #     hyper_util::rt::TokioExecutor::new()
28779/// # )
28780/// # .build(
28781/// #     hyper_rustls::HttpsConnectorBuilder::new()
28782/// #         .with_native_roots()
28783/// #         .unwrap()
28784/// #         .https_or_http()
28785/// #         .enable_http1()
28786/// #         .build()
28787/// # );
28788/// # let mut hub = Iam::new(client, auth);
28789/// // You can configure optional parameters by calling the respective setters at will, and
28790/// // execute the final call using `doit()`.
28791/// // Values shown here are possibly random and not representative !
28792/// let result = hub.projects().service_accounts_keys_delete("name")
28793///              .doit().await;
28794/// # }
28795/// ```
28796pub struct ProjectServiceAccountKeyDeleteCall<'a, C>
28797where
28798    C: 'a,
28799{
28800    hub: &'a Iam<C>,
28801    _name: String,
28802    _delegate: Option<&'a mut dyn common::Delegate>,
28803    _additional_params: HashMap<String, String>,
28804    _scopes: BTreeSet<String>,
28805}
28806
28807impl<'a, C> common::CallBuilder for ProjectServiceAccountKeyDeleteCall<'a, C> {}
28808
28809impl<'a, C> ProjectServiceAccountKeyDeleteCall<'a, C>
28810where
28811    C: common::Connector,
28812{
28813    /// Perform the operation you have build so far.
28814    pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
28815        use std::borrow::Cow;
28816        use std::io::{Read, Seek};
28817
28818        use common::{url::Params, ToParts};
28819        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
28820
28821        let mut dd = common::DefaultDelegate;
28822        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
28823        dlg.begin(common::MethodInfo {
28824            id: "iam.projects.serviceAccounts.keys.delete",
28825            http_method: hyper::Method::DELETE,
28826        });
28827
28828        for &field in ["alt", "name"].iter() {
28829            if self._additional_params.contains_key(field) {
28830                dlg.finished(false);
28831                return Err(common::Error::FieldClash(field));
28832            }
28833        }
28834
28835        let mut params = Params::with_capacity(3 + self._additional_params.len());
28836        params.push("name", self._name);
28837
28838        params.extend(self._additional_params.iter());
28839
28840        params.push("alt", "json");
28841        let mut url = self.hub._base_url.clone() + "v1/{+name}";
28842        if self._scopes.is_empty() {
28843            self._scopes
28844                .insert(Scope::CloudPlatform.as_ref().to_string());
28845        }
28846
28847        #[allow(clippy::single_element_loop)]
28848        for &(find_this, param_name) in [("{+name}", "name")].iter() {
28849            url = params.uri_replacement(url, param_name, find_this, true);
28850        }
28851        {
28852            let to_remove = ["name"];
28853            params.remove_params(&to_remove);
28854        }
28855
28856        let url = params.parse_with_url(&url);
28857
28858        loop {
28859            let token = match self
28860                .hub
28861                .auth
28862                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
28863                .await
28864            {
28865                Ok(token) => token,
28866                Err(e) => match dlg.token(e) {
28867                    Ok(token) => token,
28868                    Err(e) => {
28869                        dlg.finished(false);
28870                        return Err(common::Error::MissingToken(e));
28871                    }
28872                },
28873            };
28874            let mut req_result = {
28875                let client = &self.hub.client;
28876                dlg.pre_request();
28877                let mut req_builder = hyper::Request::builder()
28878                    .method(hyper::Method::DELETE)
28879                    .uri(url.as_str())
28880                    .header(USER_AGENT, self.hub._user_agent.clone());
28881
28882                if let Some(token) = token.as_ref() {
28883                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
28884                }
28885
28886                let request = req_builder
28887                    .header(CONTENT_LENGTH, 0_u64)
28888                    .body(common::to_body::<String>(None));
28889
28890                client.request(request.unwrap()).await
28891            };
28892
28893            match req_result {
28894                Err(err) => {
28895                    if let common::Retry::After(d) = dlg.http_error(&err) {
28896                        sleep(d).await;
28897                        continue;
28898                    }
28899                    dlg.finished(false);
28900                    return Err(common::Error::HttpError(err));
28901                }
28902                Ok(res) => {
28903                    let (mut parts, body) = res.into_parts();
28904                    let mut body = common::Body::new(body);
28905                    if !parts.status.is_success() {
28906                        let bytes = common::to_bytes(body).await.unwrap_or_default();
28907                        let error = serde_json::from_str(&common::to_string(&bytes));
28908                        let response = common::to_response(parts, bytes.into());
28909
28910                        if let common::Retry::After(d) =
28911                            dlg.http_failure(&response, error.as_ref().ok())
28912                        {
28913                            sleep(d).await;
28914                            continue;
28915                        }
28916
28917                        dlg.finished(false);
28918
28919                        return Err(match error {
28920                            Ok(value) => common::Error::BadRequest(value),
28921                            _ => common::Error::Failure(response),
28922                        });
28923                    }
28924                    let response = {
28925                        let bytes = common::to_bytes(body).await.unwrap_or_default();
28926                        let encoded = common::to_string(&bytes);
28927                        match serde_json::from_str(&encoded) {
28928                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
28929                            Err(error) => {
28930                                dlg.response_json_decode_error(&encoded, &error);
28931                                return Err(common::Error::JsonDecodeError(
28932                                    encoded.to_string(),
28933                                    error,
28934                                ));
28935                            }
28936                        }
28937                    };
28938
28939                    dlg.finished(true);
28940                    return Ok(response);
28941                }
28942            }
28943        }
28944    }
28945
28946    /// Required. The resource name of the service account key. Use one of the following formats: * `projects/{PROJECT_ID}/serviceAccounts/{EMAIL_ADDRESS}/keys/{KEY_ID}` * `projects/{PROJECT_ID}/serviceAccounts/{UNIQUE_ID}/keys/{KEY_ID}` As an alternative, you can use the `-` wildcard character instead of the project ID: * `projects/-/serviceAccounts/{EMAIL_ADDRESS}/keys/{KEY_ID}` * `projects/-/serviceAccounts/{UNIQUE_ID}/keys/{KEY_ID}` When possible, avoid using the `-` wildcard character, because it can cause response messages to contain misleading error codes. For example, if you try to access the service account key `projects/-/serviceAccounts/fake@example.com/keys/fake-key`, which does not exist, the response contains an HTTP `403 Forbidden` error instead of a `404 Not Found` error.
28947    ///
28948    /// Sets the *name* path property to the given value.
28949    ///
28950    /// Even though the property as already been set when instantiating this call,
28951    /// we provide this method for API completeness.
28952    pub fn name(mut self, new_value: &str) -> ProjectServiceAccountKeyDeleteCall<'a, C> {
28953        self._name = new_value.to_string();
28954        self
28955    }
28956    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
28957    /// while executing the actual API request.
28958    ///
28959    /// ````text
28960    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
28961    /// ````
28962    ///
28963    /// Sets the *delegate* property to the given value.
28964    pub fn delegate(
28965        mut self,
28966        new_value: &'a mut dyn common::Delegate,
28967    ) -> ProjectServiceAccountKeyDeleteCall<'a, C> {
28968        self._delegate = Some(new_value);
28969        self
28970    }
28971
28972    /// Set any additional parameter of the query string used in the request.
28973    /// It should be used to set parameters which are not yet available through their own
28974    /// setters.
28975    ///
28976    /// Please note that this method must not be used to set any of the known parameters
28977    /// which have their own setter method. If done anyway, the request will fail.
28978    ///
28979    /// # Additional Parameters
28980    ///
28981    /// * *$.xgafv* (query-string) - V1 error format.
28982    /// * *access_token* (query-string) - OAuth access token.
28983    /// * *alt* (query-string) - Data format for response.
28984    /// * *callback* (query-string) - JSONP
28985    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
28986    /// * *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.
28987    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
28988    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
28989    /// * *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.
28990    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
28991    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
28992    pub fn param<T>(mut self, name: T, value: T) -> ProjectServiceAccountKeyDeleteCall<'a, C>
28993    where
28994        T: AsRef<str>,
28995    {
28996        self._additional_params
28997            .insert(name.as_ref().to_string(), value.as_ref().to_string());
28998        self
28999    }
29000
29001    /// Identifies the authorization scope for the method you are building.
29002    ///
29003    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
29004    /// [`Scope::CloudPlatform`].
29005    ///
29006    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
29007    /// tokens for more than one scope.
29008    ///
29009    /// Usually there is more than one suitable scope to authorize an operation, some of which may
29010    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
29011    /// sufficient, a read-write scope will do as well.
29012    pub fn add_scope<St>(mut self, scope: St) -> ProjectServiceAccountKeyDeleteCall<'a, C>
29013    where
29014        St: AsRef<str>,
29015    {
29016        self._scopes.insert(String::from(scope.as_ref()));
29017        self
29018    }
29019    /// Identifies the authorization scope(s) for the method you are building.
29020    ///
29021    /// See [`Self::add_scope()`] for details.
29022    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectServiceAccountKeyDeleteCall<'a, C>
29023    where
29024        I: IntoIterator<Item = St>,
29025        St: AsRef<str>,
29026    {
29027        self._scopes
29028            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
29029        self
29030    }
29031
29032    /// Removes all scopes, and no default scope will be used either.
29033    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
29034    /// for details).
29035    pub fn clear_scopes(mut self) -> ProjectServiceAccountKeyDeleteCall<'a, C> {
29036        self._scopes.clear();
29037        self
29038    }
29039}
29040
29041/// Disable a ServiceAccountKey. A disabled service account key can be re-enabled with EnableServiceAccountKey.
29042///
29043/// A builder for the *serviceAccounts.keys.disable* method supported by a *project* resource.
29044/// It is not used directly, but through a [`ProjectMethods`] instance.
29045///
29046/// # Example
29047///
29048/// Instantiate a resource method builder
29049///
29050/// ```test_harness,no_run
29051/// # extern crate hyper;
29052/// # extern crate hyper_rustls;
29053/// # extern crate google_iam1 as iam1;
29054/// use iam1::api::DisableServiceAccountKeyRequest;
29055/// # async fn dox() {
29056/// # use iam1::{Iam, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
29057///
29058/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
29059/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
29060/// #     secret,
29061/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
29062/// # ).build().await.unwrap();
29063///
29064/// # let client = hyper_util::client::legacy::Client::builder(
29065/// #     hyper_util::rt::TokioExecutor::new()
29066/// # )
29067/// # .build(
29068/// #     hyper_rustls::HttpsConnectorBuilder::new()
29069/// #         .with_native_roots()
29070/// #         .unwrap()
29071/// #         .https_or_http()
29072/// #         .enable_http1()
29073/// #         .build()
29074/// # );
29075/// # let mut hub = Iam::new(client, auth);
29076/// // As the method needs a request, you would usually fill it with the desired information
29077/// // into the respective structure. Some of the parts shown here might not be applicable !
29078/// // Values shown here are possibly random and not representative !
29079/// let mut req = DisableServiceAccountKeyRequest::default();
29080///
29081/// // You can configure optional parameters by calling the respective setters at will, and
29082/// // execute the final call using `doit()`.
29083/// // Values shown here are possibly random and not representative !
29084/// let result = hub.projects().service_accounts_keys_disable(req, "name")
29085///              .doit().await;
29086/// # }
29087/// ```
29088pub struct ProjectServiceAccountKeyDisableCall<'a, C>
29089where
29090    C: 'a,
29091{
29092    hub: &'a Iam<C>,
29093    _request: DisableServiceAccountKeyRequest,
29094    _name: String,
29095    _delegate: Option<&'a mut dyn common::Delegate>,
29096    _additional_params: HashMap<String, String>,
29097    _scopes: BTreeSet<String>,
29098}
29099
29100impl<'a, C> common::CallBuilder for ProjectServiceAccountKeyDisableCall<'a, C> {}
29101
29102impl<'a, C> ProjectServiceAccountKeyDisableCall<'a, C>
29103where
29104    C: common::Connector,
29105{
29106    /// Perform the operation you have build so far.
29107    pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
29108        use std::borrow::Cow;
29109        use std::io::{Read, Seek};
29110
29111        use common::{url::Params, ToParts};
29112        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
29113
29114        let mut dd = common::DefaultDelegate;
29115        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
29116        dlg.begin(common::MethodInfo {
29117            id: "iam.projects.serviceAccounts.keys.disable",
29118            http_method: hyper::Method::POST,
29119        });
29120
29121        for &field in ["alt", "name"].iter() {
29122            if self._additional_params.contains_key(field) {
29123                dlg.finished(false);
29124                return Err(common::Error::FieldClash(field));
29125            }
29126        }
29127
29128        let mut params = Params::with_capacity(4 + self._additional_params.len());
29129        params.push("name", self._name);
29130
29131        params.extend(self._additional_params.iter());
29132
29133        params.push("alt", "json");
29134        let mut url = self.hub._base_url.clone() + "v1/{+name}:disable";
29135        if self._scopes.is_empty() {
29136            self._scopes
29137                .insert(Scope::CloudPlatform.as_ref().to_string());
29138        }
29139
29140        #[allow(clippy::single_element_loop)]
29141        for &(find_this, param_name) in [("{+name}", "name")].iter() {
29142            url = params.uri_replacement(url, param_name, find_this, true);
29143        }
29144        {
29145            let to_remove = ["name"];
29146            params.remove_params(&to_remove);
29147        }
29148
29149        let url = params.parse_with_url(&url);
29150
29151        let mut json_mime_type = mime::APPLICATION_JSON;
29152        let mut request_value_reader = {
29153            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
29154            common::remove_json_null_values(&mut value);
29155            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
29156            serde_json::to_writer(&mut dst, &value).unwrap();
29157            dst
29158        };
29159        let request_size = request_value_reader
29160            .seek(std::io::SeekFrom::End(0))
29161            .unwrap();
29162        request_value_reader
29163            .seek(std::io::SeekFrom::Start(0))
29164            .unwrap();
29165
29166        loop {
29167            let token = match self
29168                .hub
29169                .auth
29170                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
29171                .await
29172            {
29173                Ok(token) => token,
29174                Err(e) => match dlg.token(e) {
29175                    Ok(token) => token,
29176                    Err(e) => {
29177                        dlg.finished(false);
29178                        return Err(common::Error::MissingToken(e));
29179                    }
29180                },
29181            };
29182            request_value_reader
29183                .seek(std::io::SeekFrom::Start(0))
29184                .unwrap();
29185            let mut req_result = {
29186                let client = &self.hub.client;
29187                dlg.pre_request();
29188                let mut req_builder = hyper::Request::builder()
29189                    .method(hyper::Method::POST)
29190                    .uri(url.as_str())
29191                    .header(USER_AGENT, self.hub._user_agent.clone());
29192
29193                if let Some(token) = token.as_ref() {
29194                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
29195                }
29196
29197                let request = req_builder
29198                    .header(CONTENT_TYPE, json_mime_type.to_string())
29199                    .header(CONTENT_LENGTH, request_size as u64)
29200                    .body(common::to_body(
29201                        request_value_reader.get_ref().clone().into(),
29202                    ));
29203
29204                client.request(request.unwrap()).await
29205            };
29206
29207            match req_result {
29208                Err(err) => {
29209                    if let common::Retry::After(d) = dlg.http_error(&err) {
29210                        sleep(d).await;
29211                        continue;
29212                    }
29213                    dlg.finished(false);
29214                    return Err(common::Error::HttpError(err));
29215                }
29216                Ok(res) => {
29217                    let (mut parts, body) = res.into_parts();
29218                    let mut body = common::Body::new(body);
29219                    if !parts.status.is_success() {
29220                        let bytes = common::to_bytes(body).await.unwrap_or_default();
29221                        let error = serde_json::from_str(&common::to_string(&bytes));
29222                        let response = common::to_response(parts, bytes.into());
29223
29224                        if let common::Retry::After(d) =
29225                            dlg.http_failure(&response, error.as_ref().ok())
29226                        {
29227                            sleep(d).await;
29228                            continue;
29229                        }
29230
29231                        dlg.finished(false);
29232
29233                        return Err(match error {
29234                            Ok(value) => common::Error::BadRequest(value),
29235                            _ => common::Error::Failure(response),
29236                        });
29237                    }
29238                    let response = {
29239                        let bytes = common::to_bytes(body).await.unwrap_or_default();
29240                        let encoded = common::to_string(&bytes);
29241                        match serde_json::from_str(&encoded) {
29242                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
29243                            Err(error) => {
29244                                dlg.response_json_decode_error(&encoded, &error);
29245                                return Err(common::Error::JsonDecodeError(
29246                                    encoded.to_string(),
29247                                    error,
29248                                ));
29249                            }
29250                        }
29251                    };
29252
29253                    dlg.finished(true);
29254                    return Ok(response);
29255                }
29256            }
29257        }
29258    }
29259
29260    ///
29261    /// Sets the *request* property to the given value.
29262    ///
29263    /// Even though the property as already been set when instantiating this call,
29264    /// we provide this method for API completeness.
29265    pub fn request(
29266        mut self,
29267        new_value: DisableServiceAccountKeyRequest,
29268    ) -> ProjectServiceAccountKeyDisableCall<'a, C> {
29269        self._request = new_value;
29270        self
29271    }
29272    /// Required. The resource name of the service account key. Use one of the following formats: * `projects/{PROJECT_ID}/serviceAccounts/{EMAIL_ADDRESS}/keys/{KEY_ID}` * `projects/{PROJECT_ID}/serviceAccounts/{UNIQUE_ID}/keys/{KEY_ID}` As an alternative, you can use the `-` wildcard character instead of the project ID: * `projects/-/serviceAccounts/{EMAIL_ADDRESS}/keys/{KEY_ID}` * `projects/-/serviceAccounts/{UNIQUE_ID}/keys/{KEY_ID}` When possible, avoid using the `-` wildcard character, because it can cause response messages to contain misleading error codes. For example, if you try to access the service account key `projects/-/serviceAccounts/fake@example.com/keys/fake-key`, which does not exist, the response contains an HTTP `403 Forbidden` error instead of a `404 Not Found` error.
29273    ///
29274    /// Sets the *name* path property to the given value.
29275    ///
29276    /// Even though the property as already been set when instantiating this call,
29277    /// we provide this method for API completeness.
29278    pub fn name(mut self, new_value: &str) -> ProjectServiceAccountKeyDisableCall<'a, C> {
29279        self._name = new_value.to_string();
29280        self
29281    }
29282    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
29283    /// while executing the actual API request.
29284    ///
29285    /// ````text
29286    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
29287    /// ````
29288    ///
29289    /// Sets the *delegate* property to the given value.
29290    pub fn delegate(
29291        mut self,
29292        new_value: &'a mut dyn common::Delegate,
29293    ) -> ProjectServiceAccountKeyDisableCall<'a, C> {
29294        self._delegate = Some(new_value);
29295        self
29296    }
29297
29298    /// Set any additional parameter of the query string used in the request.
29299    /// It should be used to set parameters which are not yet available through their own
29300    /// setters.
29301    ///
29302    /// Please note that this method must not be used to set any of the known parameters
29303    /// which have their own setter method. If done anyway, the request will fail.
29304    ///
29305    /// # Additional Parameters
29306    ///
29307    /// * *$.xgafv* (query-string) - V1 error format.
29308    /// * *access_token* (query-string) - OAuth access token.
29309    /// * *alt* (query-string) - Data format for response.
29310    /// * *callback* (query-string) - JSONP
29311    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
29312    /// * *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.
29313    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
29314    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
29315    /// * *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.
29316    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
29317    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
29318    pub fn param<T>(mut self, name: T, value: T) -> ProjectServiceAccountKeyDisableCall<'a, C>
29319    where
29320        T: AsRef<str>,
29321    {
29322        self._additional_params
29323            .insert(name.as_ref().to_string(), value.as_ref().to_string());
29324        self
29325    }
29326
29327    /// Identifies the authorization scope for the method you are building.
29328    ///
29329    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
29330    /// [`Scope::CloudPlatform`].
29331    ///
29332    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
29333    /// tokens for more than one scope.
29334    ///
29335    /// Usually there is more than one suitable scope to authorize an operation, some of which may
29336    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
29337    /// sufficient, a read-write scope will do as well.
29338    pub fn add_scope<St>(mut self, scope: St) -> ProjectServiceAccountKeyDisableCall<'a, C>
29339    where
29340        St: AsRef<str>,
29341    {
29342        self._scopes.insert(String::from(scope.as_ref()));
29343        self
29344    }
29345    /// Identifies the authorization scope(s) for the method you are building.
29346    ///
29347    /// See [`Self::add_scope()`] for details.
29348    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectServiceAccountKeyDisableCall<'a, C>
29349    where
29350        I: IntoIterator<Item = St>,
29351        St: AsRef<str>,
29352    {
29353        self._scopes
29354            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
29355        self
29356    }
29357
29358    /// Removes all scopes, and no default scope will be used either.
29359    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
29360    /// for details).
29361    pub fn clear_scopes(mut self) -> ProjectServiceAccountKeyDisableCall<'a, C> {
29362        self._scopes.clear();
29363        self
29364    }
29365}
29366
29367/// Enable a ServiceAccountKey.
29368///
29369/// A builder for the *serviceAccounts.keys.enable* method supported by a *project* resource.
29370/// It is not used directly, but through a [`ProjectMethods`] instance.
29371///
29372/// # Example
29373///
29374/// Instantiate a resource method builder
29375///
29376/// ```test_harness,no_run
29377/// # extern crate hyper;
29378/// # extern crate hyper_rustls;
29379/// # extern crate google_iam1 as iam1;
29380/// use iam1::api::EnableServiceAccountKeyRequest;
29381/// # async fn dox() {
29382/// # use iam1::{Iam, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
29383///
29384/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
29385/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
29386/// #     secret,
29387/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
29388/// # ).build().await.unwrap();
29389///
29390/// # let client = hyper_util::client::legacy::Client::builder(
29391/// #     hyper_util::rt::TokioExecutor::new()
29392/// # )
29393/// # .build(
29394/// #     hyper_rustls::HttpsConnectorBuilder::new()
29395/// #         .with_native_roots()
29396/// #         .unwrap()
29397/// #         .https_or_http()
29398/// #         .enable_http1()
29399/// #         .build()
29400/// # );
29401/// # let mut hub = Iam::new(client, auth);
29402/// // As the method needs a request, you would usually fill it with the desired information
29403/// // into the respective structure. Some of the parts shown here might not be applicable !
29404/// // Values shown here are possibly random and not representative !
29405/// let mut req = EnableServiceAccountKeyRequest::default();
29406///
29407/// // You can configure optional parameters by calling the respective setters at will, and
29408/// // execute the final call using `doit()`.
29409/// // Values shown here are possibly random and not representative !
29410/// let result = hub.projects().service_accounts_keys_enable(req, "name")
29411///              .doit().await;
29412/// # }
29413/// ```
29414pub struct ProjectServiceAccountKeyEnableCall<'a, C>
29415where
29416    C: 'a,
29417{
29418    hub: &'a Iam<C>,
29419    _request: EnableServiceAccountKeyRequest,
29420    _name: String,
29421    _delegate: Option<&'a mut dyn common::Delegate>,
29422    _additional_params: HashMap<String, String>,
29423    _scopes: BTreeSet<String>,
29424}
29425
29426impl<'a, C> common::CallBuilder for ProjectServiceAccountKeyEnableCall<'a, C> {}
29427
29428impl<'a, C> ProjectServiceAccountKeyEnableCall<'a, C>
29429where
29430    C: common::Connector,
29431{
29432    /// Perform the operation you have build so far.
29433    pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
29434        use std::borrow::Cow;
29435        use std::io::{Read, Seek};
29436
29437        use common::{url::Params, ToParts};
29438        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
29439
29440        let mut dd = common::DefaultDelegate;
29441        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
29442        dlg.begin(common::MethodInfo {
29443            id: "iam.projects.serviceAccounts.keys.enable",
29444            http_method: hyper::Method::POST,
29445        });
29446
29447        for &field in ["alt", "name"].iter() {
29448            if self._additional_params.contains_key(field) {
29449                dlg.finished(false);
29450                return Err(common::Error::FieldClash(field));
29451            }
29452        }
29453
29454        let mut params = Params::with_capacity(4 + self._additional_params.len());
29455        params.push("name", self._name);
29456
29457        params.extend(self._additional_params.iter());
29458
29459        params.push("alt", "json");
29460        let mut url = self.hub._base_url.clone() + "v1/{+name}:enable";
29461        if self._scopes.is_empty() {
29462            self._scopes
29463                .insert(Scope::CloudPlatform.as_ref().to_string());
29464        }
29465
29466        #[allow(clippy::single_element_loop)]
29467        for &(find_this, param_name) in [("{+name}", "name")].iter() {
29468            url = params.uri_replacement(url, param_name, find_this, true);
29469        }
29470        {
29471            let to_remove = ["name"];
29472            params.remove_params(&to_remove);
29473        }
29474
29475        let url = params.parse_with_url(&url);
29476
29477        let mut json_mime_type = mime::APPLICATION_JSON;
29478        let mut request_value_reader = {
29479            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
29480            common::remove_json_null_values(&mut value);
29481            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
29482            serde_json::to_writer(&mut dst, &value).unwrap();
29483            dst
29484        };
29485        let request_size = request_value_reader
29486            .seek(std::io::SeekFrom::End(0))
29487            .unwrap();
29488        request_value_reader
29489            .seek(std::io::SeekFrom::Start(0))
29490            .unwrap();
29491
29492        loop {
29493            let token = match self
29494                .hub
29495                .auth
29496                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
29497                .await
29498            {
29499                Ok(token) => token,
29500                Err(e) => match dlg.token(e) {
29501                    Ok(token) => token,
29502                    Err(e) => {
29503                        dlg.finished(false);
29504                        return Err(common::Error::MissingToken(e));
29505                    }
29506                },
29507            };
29508            request_value_reader
29509                .seek(std::io::SeekFrom::Start(0))
29510                .unwrap();
29511            let mut req_result = {
29512                let client = &self.hub.client;
29513                dlg.pre_request();
29514                let mut req_builder = hyper::Request::builder()
29515                    .method(hyper::Method::POST)
29516                    .uri(url.as_str())
29517                    .header(USER_AGENT, self.hub._user_agent.clone());
29518
29519                if let Some(token) = token.as_ref() {
29520                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
29521                }
29522
29523                let request = req_builder
29524                    .header(CONTENT_TYPE, json_mime_type.to_string())
29525                    .header(CONTENT_LENGTH, request_size as u64)
29526                    .body(common::to_body(
29527                        request_value_reader.get_ref().clone().into(),
29528                    ));
29529
29530                client.request(request.unwrap()).await
29531            };
29532
29533            match req_result {
29534                Err(err) => {
29535                    if let common::Retry::After(d) = dlg.http_error(&err) {
29536                        sleep(d).await;
29537                        continue;
29538                    }
29539                    dlg.finished(false);
29540                    return Err(common::Error::HttpError(err));
29541                }
29542                Ok(res) => {
29543                    let (mut parts, body) = res.into_parts();
29544                    let mut body = common::Body::new(body);
29545                    if !parts.status.is_success() {
29546                        let bytes = common::to_bytes(body).await.unwrap_or_default();
29547                        let error = serde_json::from_str(&common::to_string(&bytes));
29548                        let response = common::to_response(parts, bytes.into());
29549
29550                        if let common::Retry::After(d) =
29551                            dlg.http_failure(&response, error.as_ref().ok())
29552                        {
29553                            sleep(d).await;
29554                            continue;
29555                        }
29556
29557                        dlg.finished(false);
29558
29559                        return Err(match error {
29560                            Ok(value) => common::Error::BadRequest(value),
29561                            _ => common::Error::Failure(response),
29562                        });
29563                    }
29564                    let response = {
29565                        let bytes = common::to_bytes(body).await.unwrap_or_default();
29566                        let encoded = common::to_string(&bytes);
29567                        match serde_json::from_str(&encoded) {
29568                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
29569                            Err(error) => {
29570                                dlg.response_json_decode_error(&encoded, &error);
29571                                return Err(common::Error::JsonDecodeError(
29572                                    encoded.to_string(),
29573                                    error,
29574                                ));
29575                            }
29576                        }
29577                    };
29578
29579                    dlg.finished(true);
29580                    return Ok(response);
29581                }
29582            }
29583        }
29584    }
29585
29586    ///
29587    /// Sets the *request* property to the given value.
29588    ///
29589    /// Even though the property as already been set when instantiating this call,
29590    /// we provide this method for API completeness.
29591    pub fn request(
29592        mut self,
29593        new_value: EnableServiceAccountKeyRequest,
29594    ) -> ProjectServiceAccountKeyEnableCall<'a, C> {
29595        self._request = new_value;
29596        self
29597    }
29598    /// Required. The resource name of the service account key. Use one of the following formats: * `projects/{PROJECT_ID}/serviceAccounts/{EMAIL_ADDRESS}/keys/{KEY_ID}` * `projects/{PROJECT_ID}/serviceAccounts/{UNIQUE_ID}/keys/{KEY_ID}` As an alternative, you can use the `-` wildcard character instead of the project ID: * `projects/-/serviceAccounts/{EMAIL_ADDRESS}/keys/{KEY_ID}` * `projects/-/serviceAccounts/{UNIQUE_ID}/keys/{KEY_ID}` When possible, avoid using the `-` wildcard character, because it can cause response messages to contain misleading error codes. For example, if you try to access the service account key `projects/-/serviceAccounts/fake@example.com/keys/fake-key`, which does not exist, the response contains an HTTP `403 Forbidden` error instead of a `404 Not Found` error.
29599    ///
29600    /// Sets the *name* path property to the given value.
29601    ///
29602    /// Even though the property as already been set when instantiating this call,
29603    /// we provide this method for API completeness.
29604    pub fn name(mut self, new_value: &str) -> ProjectServiceAccountKeyEnableCall<'a, C> {
29605        self._name = new_value.to_string();
29606        self
29607    }
29608    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
29609    /// while executing the actual API request.
29610    ///
29611    /// ````text
29612    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
29613    /// ````
29614    ///
29615    /// Sets the *delegate* property to the given value.
29616    pub fn delegate(
29617        mut self,
29618        new_value: &'a mut dyn common::Delegate,
29619    ) -> ProjectServiceAccountKeyEnableCall<'a, C> {
29620        self._delegate = Some(new_value);
29621        self
29622    }
29623
29624    /// Set any additional parameter of the query string used in the request.
29625    /// It should be used to set parameters which are not yet available through their own
29626    /// setters.
29627    ///
29628    /// Please note that this method must not be used to set any of the known parameters
29629    /// which have their own setter method. If done anyway, the request will fail.
29630    ///
29631    /// # Additional Parameters
29632    ///
29633    /// * *$.xgafv* (query-string) - V1 error format.
29634    /// * *access_token* (query-string) - OAuth access token.
29635    /// * *alt* (query-string) - Data format for response.
29636    /// * *callback* (query-string) - JSONP
29637    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
29638    /// * *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.
29639    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
29640    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
29641    /// * *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.
29642    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
29643    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
29644    pub fn param<T>(mut self, name: T, value: T) -> ProjectServiceAccountKeyEnableCall<'a, C>
29645    where
29646        T: AsRef<str>,
29647    {
29648        self._additional_params
29649            .insert(name.as_ref().to_string(), value.as_ref().to_string());
29650        self
29651    }
29652
29653    /// Identifies the authorization scope for the method you are building.
29654    ///
29655    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
29656    /// [`Scope::CloudPlatform`].
29657    ///
29658    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
29659    /// tokens for more than one scope.
29660    ///
29661    /// Usually there is more than one suitable scope to authorize an operation, some of which may
29662    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
29663    /// sufficient, a read-write scope will do as well.
29664    pub fn add_scope<St>(mut self, scope: St) -> ProjectServiceAccountKeyEnableCall<'a, C>
29665    where
29666        St: AsRef<str>,
29667    {
29668        self._scopes.insert(String::from(scope.as_ref()));
29669        self
29670    }
29671    /// Identifies the authorization scope(s) for the method you are building.
29672    ///
29673    /// See [`Self::add_scope()`] for details.
29674    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectServiceAccountKeyEnableCall<'a, C>
29675    where
29676        I: IntoIterator<Item = St>,
29677        St: AsRef<str>,
29678    {
29679        self._scopes
29680            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
29681        self
29682    }
29683
29684    /// Removes all scopes, and no default scope will be used either.
29685    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
29686    /// for details).
29687    pub fn clear_scopes(mut self) -> ProjectServiceAccountKeyEnableCall<'a, C> {
29688        self._scopes.clear();
29689        self
29690    }
29691}
29692
29693/// Gets a ServiceAccountKey.
29694///
29695/// A builder for the *serviceAccounts.keys.get* method supported by a *project* resource.
29696/// It is not used directly, but through a [`ProjectMethods`] instance.
29697///
29698/// # Example
29699///
29700/// Instantiate a resource method builder
29701///
29702/// ```test_harness,no_run
29703/// # extern crate hyper;
29704/// # extern crate hyper_rustls;
29705/// # extern crate google_iam1 as iam1;
29706/// # async fn dox() {
29707/// # use iam1::{Iam, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
29708///
29709/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
29710/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
29711/// #     secret,
29712/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
29713/// # ).build().await.unwrap();
29714///
29715/// # let client = hyper_util::client::legacy::Client::builder(
29716/// #     hyper_util::rt::TokioExecutor::new()
29717/// # )
29718/// # .build(
29719/// #     hyper_rustls::HttpsConnectorBuilder::new()
29720/// #         .with_native_roots()
29721/// #         .unwrap()
29722/// #         .https_or_http()
29723/// #         .enable_http1()
29724/// #         .build()
29725/// # );
29726/// # let mut hub = Iam::new(client, auth);
29727/// // You can configure optional parameters by calling the respective setters at will, and
29728/// // execute the final call using `doit()`.
29729/// // Values shown here are possibly random and not representative !
29730/// let result = hub.projects().service_accounts_keys_get("name")
29731///              .public_key_type("sadipscing")
29732///              .doit().await;
29733/// # }
29734/// ```
29735pub struct ProjectServiceAccountKeyGetCall<'a, C>
29736where
29737    C: 'a,
29738{
29739    hub: &'a Iam<C>,
29740    _name: String,
29741    _public_key_type: Option<String>,
29742    _delegate: Option<&'a mut dyn common::Delegate>,
29743    _additional_params: HashMap<String, String>,
29744    _scopes: BTreeSet<String>,
29745}
29746
29747impl<'a, C> common::CallBuilder for ProjectServiceAccountKeyGetCall<'a, C> {}
29748
29749impl<'a, C> ProjectServiceAccountKeyGetCall<'a, C>
29750where
29751    C: common::Connector,
29752{
29753    /// Perform the operation you have build so far.
29754    pub async fn doit(mut self) -> common::Result<(common::Response, ServiceAccountKey)> {
29755        use std::borrow::Cow;
29756        use std::io::{Read, Seek};
29757
29758        use common::{url::Params, ToParts};
29759        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
29760
29761        let mut dd = common::DefaultDelegate;
29762        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
29763        dlg.begin(common::MethodInfo {
29764            id: "iam.projects.serviceAccounts.keys.get",
29765            http_method: hyper::Method::GET,
29766        });
29767
29768        for &field in ["alt", "name", "publicKeyType"].iter() {
29769            if self._additional_params.contains_key(field) {
29770                dlg.finished(false);
29771                return Err(common::Error::FieldClash(field));
29772            }
29773        }
29774
29775        let mut params = Params::with_capacity(4 + self._additional_params.len());
29776        params.push("name", self._name);
29777        if let Some(value) = self._public_key_type.as_ref() {
29778            params.push("publicKeyType", value);
29779        }
29780
29781        params.extend(self._additional_params.iter());
29782
29783        params.push("alt", "json");
29784        let mut url = self.hub._base_url.clone() + "v1/{+name}";
29785        if self._scopes.is_empty() {
29786            self._scopes
29787                .insert(Scope::CloudPlatform.as_ref().to_string());
29788        }
29789
29790        #[allow(clippy::single_element_loop)]
29791        for &(find_this, param_name) in [("{+name}", "name")].iter() {
29792            url = params.uri_replacement(url, param_name, find_this, true);
29793        }
29794        {
29795            let to_remove = ["name"];
29796            params.remove_params(&to_remove);
29797        }
29798
29799        let url = params.parse_with_url(&url);
29800
29801        loop {
29802            let token = match self
29803                .hub
29804                .auth
29805                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
29806                .await
29807            {
29808                Ok(token) => token,
29809                Err(e) => match dlg.token(e) {
29810                    Ok(token) => token,
29811                    Err(e) => {
29812                        dlg.finished(false);
29813                        return Err(common::Error::MissingToken(e));
29814                    }
29815                },
29816            };
29817            let mut req_result = {
29818                let client = &self.hub.client;
29819                dlg.pre_request();
29820                let mut req_builder = hyper::Request::builder()
29821                    .method(hyper::Method::GET)
29822                    .uri(url.as_str())
29823                    .header(USER_AGENT, self.hub._user_agent.clone());
29824
29825                if let Some(token) = token.as_ref() {
29826                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
29827                }
29828
29829                let request = req_builder
29830                    .header(CONTENT_LENGTH, 0_u64)
29831                    .body(common::to_body::<String>(None));
29832
29833                client.request(request.unwrap()).await
29834            };
29835
29836            match req_result {
29837                Err(err) => {
29838                    if let common::Retry::After(d) = dlg.http_error(&err) {
29839                        sleep(d).await;
29840                        continue;
29841                    }
29842                    dlg.finished(false);
29843                    return Err(common::Error::HttpError(err));
29844                }
29845                Ok(res) => {
29846                    let (mut parts, body) = res.into_parts();
29847                    let mut body = common::Body::new(body);
29848                    if !parts.status.is_success() {
29849                        let bytes = common::to_bytes(body).await.unwrap_or_default();
29850                        let error = serde_json::from_str(&common::to_string(&bytes));
29851                        let response = common::to_response(parts, bytes.into());
29852
29853                        if let common::Retry::After(d) =
29854                            dlg.http_failure(&response, error.as_ref().ok())
29855                        {
29856                            sleep(d).await;
29857                            continue;
29858                        }
29859
29860                        dlg.finished(false);
29861
29862                        return Err(match error {
29863                            Ok(value) => common::Error::BadRequest(value),
29864                            _ => common::Error::Failure(response),
29865                        });
29866                    }
29867                    let response = {
29868                        let bytes = common::to_bytes(body).await.unwrap_or_default();
29869                        let encoded = common::to_string(&bytes);
29870                        match serde_json::from_str(&encoded) {
29871                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
29872                            Err(error) => {
29873                                dlg.response_json_decode_error(&encoded, &error);
29874                                return Err(common::Error::JsonDecodeError(
29875                                    encoded.to_string(),
29876                                    error,
29877                                ));
29878                            }
29879                        }
29880                    };
29881
29882                    dlg.finished(true);
29883                    return Ok(response);
29884                }
29885            }
29886        }
29887    }
29888
29889    /// Required. The resource name of the service account key. Use one of the following formats: * `projects/{PROJECT_ID}/serviceAccounts/{EMAIL_ADDRESS}/keys/{KEY_ID}` * `projects/{PROJECT_ID}/serviceAccounts/{UNIQUE_ID}/keys/{KEY_ID}` As an alternative, you can use the `-` wildcard character instead of the project ID: * `projects/-/serviceAccounts/{EMAIL_ADDRESS}/keys/{KEY_ID}` * `projects/-/serviceAccounts/{UNIQUE_ID}/keys/{KEY_ID}` When possible, avoid using the `-` wildcard character, because it can cause response messages to contain misleading error codes. For example, if you try to access the service account key `projects/-/serviceAccounts/fake@example.com/keys/fake-key`, which does not exist, the response contains an HTTP `403 Forbidden` error instead of a `404 Not Found` error.
29890    ///
29891    /// Sets the *name* path property to the given value.
29892    ///
29893    /// Even though the property as already been set when instantiating this call,
29894    /// we provide this method for API completeness.
29895    pub fn name(mut self, new_value: &str) -> ProjectServiceAccountKeyGetCall<'a, C> {
29896        self._name = new_value.to_string();
29897        self
29898    }
29899    /// Optional. The output format of the public key. The default is `TYPE_NONE`, which means that the public key is not returned.
29900    ///
29901    /// Sets the *public key type* query property to the given value.
29902    pub fn public_key_type(mut self, new_value: &str) -> ProjectServiceAccountKeyGetCall<'a, C> {
29903        self._public_key_type = Some(new_value.to_string());
29904        self
29905    }
29906    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
29907    /// while executing the actual API request.
29908    ///
29909    /// ````text
29910    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
29911    /// ````
29912    ///
29913    /// Sets the *delegate* property to the given value.
29914    pub fn delegate(
29915        mut self,
29916        new_value: &'a mut dyn common::Delegate,
29917    ) -> ProjectServiceAccountKeyGetCall<'a, C> {
29918        self._delegate = Some(new_value);
29919        self
29920    }
29921
29922    /// Set any additional parameter of the query string used in the request.
29923    /// It should be used to set parameters which are not yet available through their own
29924    /// setters.
29925    ///
29926    /// Please note that this method must not be used to set any of the known parameters
29927    /// which have their own setter method. If done anyway, the request will fail.
29928    ///
29929    /// # Additional Parameters
29930    ///
29931    /// * *$.xgafv* (query-string) - V1 error format.
29932    /// * *access_token* (query-string) - OAuth access token.
29933    /// * *alt* (query-string) - Data format for response.
29934    /// * *callback* (query-string) - JSONP
29935    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
29936    /// * *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.
29937    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
29938    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
29939    /// * *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.
29940    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
29941    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
29942    pub fn param<T>(mut self, name: T, value: T) -> ProjectServiceAccountKeyGetCall<'a, C>
29943    where
29944        T: AsRef<str>,
29945    {
29946        self._additional_params
29947            .insert(name.as_ref().to_string(), value.as_ref().to_string());
29948        self
29949    }
29950
29951    /// Identifies the authorization scope for the method you are building.
29952    ///
29953    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
29954    /// [`Scope::CloudPlatform`].
29955    ///
29956    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
29957    /// tokens for more than one scope.
29958    ///
29959    /// Usually there is more than one suitable scope to authorize an operation, some of which may
29960    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
29961    /// sufficient, a read-write scope will do as well.
29962    pub fn add_scope<St>(mut self, scope: St) -> ProjectServiceAccountKeyGetCall<'a, C>
29963    where
29964        St: AsRef<str>,
29965    {
29966        self._scopes.insert(String::from(scope.as_ref()));
29967        self
29968    }
29969    /// Identifies the authorization scope(s) for the method you are building.
29970    ///
29971    /// See [`Self::add_scope()`] for details.
29972    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectServiceAccountKeyGetCall<'a, C>
29973    where
29974        I: IntoIterator<Item = St>,
29975        St: AsRef<str>,
29976    {
29977        self._scopes
29978            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
29979        self
29980    }
29981
29982    /// Removes all scopes, and no default scope will be used either.
29983    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
29984    /// for details).
29985    pub fn clear_scopes(mut self) -> ProjectServiceAccountKeyGetCall<'a, C> {
29986        self._scopes.clear();
29987        self
29988    }
29989}
29990
29991/// Lists every ServiceAccountKey for a service account.
29992///
29993/// A builder for the *serviceAccounts.keys.list* method supported by a *project* resource.
29994/// It is not used directly, but through a [`ProjectMethods`] instance.
29995///
29996/// # Example
29997///
29998/// Instantiate a resource method builder
29999///
30000/// ```test_harness,no_run
30001/// # extern crate hyper;
30002/// # extern crate hyper_rustls;
30003/// # extern crate google_iam1 as iam1;
30004/// # async fn dox() {
30005/// # use iam1::{Iam, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
30006///
30007/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
30008/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
30009/// #     secret,
30010/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
30011/// # ).build().await.unwrap();
30012///
30013/// # let client = hyper_util::client::legacy::Client::builder(
30014/// #     hyper_util::rt::TokioExecutor::new()
30015/// # )
30016/// # .build(
30017/// #     hyper_rustls::HttpsConnectorBuilder::new()
30018/// #         .with_native_roots()
30019/// #         .unwrap()
30020/// #         .https_or_http()
30021/// #         .enable_http1()
30022/// #         .build()
30023/// # );
30024/// # let mut hub = Iam::new(client, auth);
30025/// // You can configure optional parameters by calling the respective setters at will, and
30026/// // execute the final call using `doit()`.
30027/// // Values shown here are possibly random and not representative !
30028/// let result = hub.projects().service_accounts_keys_list("name")
30029///              .add_key_types("dolores")
30030///              .doit().await;
30031/// # }
30032/// ```
30033pub struct ProjectServiceAccountKeyListCall<'a, C>
30034where
30035    C: 'a,
30036{
30037    hub: &'a Iam<C>,
30038    _name: String,
30039    _key_types: Vec<String>,
30040    _delegate: Option<&'a mut dyn common::Delegate>,
30041    _additional_params: HashMap<String, String>,
30042    _scopes: BTreeSet<String>,
30043}
30044
30045impl<'a, C> common::CallBuilder for ProjectServiceAccountKeyListCall<'a, C> {}
30046
30047impl<'a, C> ProjectServiceAccountKeyListCall<'a, C>
30048where
30049    C: common::Connector,
30050{
30051    /// Perform the operation you have build so far.
30052    pub async fn doit(
30053        mut self,
30054    ) -> common::Result<(common::Response, ListServiceAccountKeysResponse)> {
30055        use std::borrow::Cow;
30056        use std::io::{Read, Seek};
30057
30058        use common::{url::Params, ToParts};
30059        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
30060
30061        let mut dd = common::DefaultDelegate;
30062        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
30063        dlg.begin(common::MethodInfo {
30064            id: "iam.projects.serviceAccounts.keys.list",
30065            http_method: hyper::Method::GET,
30066        });
30067
30068        for &field in ["alt", "name", "keyTypes"].iter() {
30069            if self._additional_params.contains_key(field) {
30070                dlg.finished(false);
30071                return Err(common::Error::FieldClash(field));
30072            }
30073        }
30074
30075        let mut params = Params::with_capacity(4 + self._additional_params.len());
30076        params.push("name", self._name);
30077        if !self._key_types.is_empty() {
30078            for f in self._key_types.iter() {
30079                params.push("keyTypes", f);
30080            }
30081        }
30082
30083        params.extend(self._additional_params.iter());
30084
30085        params.push("alt", "json");
30086        let mut url = self.hub._base_url.clone() + "v1/{+name}/keys";
30087        if self._scopes.is_empty() {
30088            self._scopes
30089                .insert(Scope::CloudPlatform.as_ref().to_string());
30090        }
30091
30092        #[allow(clippy::single_element_loop)]
30093        for &(find_this, param_name) in [("{+name}", "name")].iter() {
30094            url = params.uri_replacement(url, param_name, find_this, true);
30095        }
30096        {
30097            let to_remove = ["name"];
30098            params.remove_params(&to_remove);
30099        }
30100
30101        let url = params.parse_with_url(&url);
30102
30103        loop {
30104            let token = match self
30105                .hub
30106                .auth
30107                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
30108                .await
30109            {
30110                Ok(token) => token,
30111                Err(e) => match dlg.token(e) {
30112                    Ok(token) => token,
30113                    Err(e) => {
30114                        dlg.finished(false);
30115                        return Err(common::Error::MissingToken(e));
30116                    }
30117                },
30118            };
30119            let mut req_result = {
30120                let client = &self.hub.client;
30121                dlg.pre_request();
30122                let mut req_builder = hyper::Request::builder()
30123                    .method(hyper::Method::GET)
30124                    .uri(url.as_str())
30125                    .header(USER_AGENT, self.hub._user_agent.clone());
30126
30127                if let Some(token) = token.as_ref() {
30128                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
30129                }
30130
30131                let request = req_builder
30132                    .header(CONTENT_LENGTH, 0_u64)
30133                    .body(common::to_body::<String>(None));
30134
30135                client.request(request.unwrap()).await
30136            };
30137
30138            match req_result {
30139                Err(err) => {
30140                    if let common::Retry::After(d) = dlg.http_error(&err) {
30141                        sleep(d).await;
30142                        continue;
30143                    }
30144                    dlg.finished(false);
30145                    return Err(common::Error::HttpError(err));
30146                }
30147                Ok(res) => {
30148                    let (mut parts, body) = res.into_parts();
30149                    let mut body = common::Body::new(body);
30150                    if !parts.status.is_success() {
30151                        let bytes = common::to_bytes(body).await.unwrap_or_default();
30152                        let error = serde_json::from_str(&common::to_string(&bytes));
30153                        let response = common::to_response(parts, bytes.into());
30154
30155                        if let common::Retry::After(d) =
30156                            dlg.http_failure(&response, error.as_ref().ok())
30157                        {
30158                            sleep(d).await;
30159                            continue;
30160                        }
30161
30162                        dlg.finished(false);
30163
30164                        return Err(match error {
30165                            Ok(value) => common::Error::BadRequest(value),
30166                            _ => common::Error::Failure(response),
30167                        });
30168                    }
30169                    let response = {
30170                        let bytes = common::to_bytes(body).await.unwrap_or_default();
30171                        let encoded = common::to_string(&bytes);
30172                        match serde_json::from_str(&encoded) {
30173                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
30174                            Err(error) => {
30175                                dlg.response_json_decode_error(&encoded, &error);
30176                                return Err(common::Error::JsonDecodeError(
30177                                    encoded.to_string(),
30178                                    error,
30179                                ));
30180                            }
30181                        }
30182                    };
30183
30184                    dlg.finished(true);
30185                    return Ok(response);
30186                }
30187            }
30188        }
30189    }
30190
30191    /// Required. The resource name of the service account. Use one of the following formats: * `projects/{PROJECT_ID}/serviceAccounts/{EMAIL_ADDRESS}` * `projects/{PROJECT_ID}/serviceAccounts/{UNIQUE_ID}` As an alternative, you can use the `-` wildcard character instead of the project ID: * `projects/-/serviceAccounts/{EMAIL_ADDRESS}` * `projects/-/serviceAccounts/{UNIQUE_ID}` When possible, avoid using the `-` wildcard character, because it can cause response messages to contain misleading error codes. For example, if you try to access the service account `projects/-/serviceAccounts/fake@example.com`, which does not exist, the response contains an HTTP `403 Forbidden` error instead of a `404 Not Found` error.
30192    ///
30193    /// Sets the *name* path property to the given value.
30194    ///
30195    /// Even though the property as already been set when instantiating this call,
30196    /// we provide this method for API completeness.
30197    pub fn name(mut self, new_value: &str) -> ProjectServiceAccountKeyListCall<'a, C> {
30198        self._name = new_value.to_string();
30199        self
30200    }
30201    /// Filters the types of keys the user wants to include in the list response. Duplicate key types are not allowed. If no key type is provided, all keys are returned.
30202    ///
30203    /// Append the given value to the *key types* query property.
30204    /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
30205    pub fn add_key_types(mut self, new_value: &str) -> ProjectServiceAccountKeyListCall<'a, C> {
30206        self._key_types.push(new_value.to_string());
30207        self
30208    }
30209    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
30210    /// while executing the actual API request.
30211    ///
30212    /// ````text
30213    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
30214    /// ````
30215    ///
30216    /// Sets the *delegate* property to the given value.
30217    pub fn delegate(
30218        mut self,
30219        new_value: &'a mut dyn common::Delegate,
30220    ) -> ProjectServiceAccountKeyListCall<'a, C> {
30221        self._delegate = Some(new_value);
30222        self
30223    }
30224
30225    /// Set any additional parameter of the query string used in the request.
30226    /// It should be used to set parameters which are not yet available through their own
30227    /// setters.
30228    ///
30229    /// Please note that this method must not be used to set any of the known parameters
30230    /// which have their own setter method. If done anyway, the request will fail.
30231    ///
30232    /// # Additional Parameters
30233    ///
30234    /// * *$.xgafv* (query-string) - V1 error format.
30235    /// * *access_token* (query-string) - OAuth access token.
30236    /// * *alt* (query-string) - Data format for response.
30237    /// * *callback* (query-string) - JSONP
30238    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
30239    /// * *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.
30240    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
30241    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
30242    /// * *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.
30243    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
30244    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
30245    pub fn param<T>(mut self, name: T, value: T) -> ProjectServiceAccountKeyListCall<'a, C>
30246    where
30247        T: AsRef<str>,
30248    {
30249        self._additional_params
30250            .insert(name.as_ref().to_string(), value.as_ref().to_string());
30251        self
30252    }
30253
30254    /// Identifies the authorization scope for the method you are building.
30255    ///
30256    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
30257    /// [`Scope::CloudPlatform`].
30258    ///
30259    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
30260    /// tokens for more than one scope.
30261    ///
30262    /// Usually there is more than one suitable scope to authorize an operation, some of which may
30263    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
30264    /// sufficient, a read-write scope will do as well.
30265    pub fn add_scope<St>(mut self, scope: St) -> ProjectServiceAccountKeyListCall<'a, C>
30266    where
30267        St: AsRef<str>,
30268    {
30269        self._scopes.insert(String::from(scope.as_ref()));
30270        self
30271    }
30272    /// Identifies the authorization scope(s) for the method you are building.
30273    ///
30274    /// See [`Self::add_scope()`] for details.
30275    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectServiceAccountKeyListCall<'a, C>
30276    where
30277        I: IntoIterator<Item = St>,
30278        St: AsRef<str>,
30279    {
30280        self._scopes
30281            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
30282        self
30283    }
30284
30285    /// Removes all scopes, and no default scope will be used either.
30286    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
30287    /// for details).
30288    pub fn clear_scopes(mut self) -> ProjectServiceAccountKeyListCall<'a, C> {
30289        self._scopes.clear();
30290        self
30291    }
30292}
30293
30294/// Patches a ServiceAccountKey.
30295///
30296/// A builder for the *serviceAccounts.keys.patch* method supported by a *project* resource.
30297/// It is not used directly, but through a [`ProjectMethods`] instance.
30298///
30299/// # Example
30300///
30301/// Instantiate a resource method builder
30302///
30303/// ```test_harness,no_run
30304/// # extern crate hyper;
30305/// # extern crate hyper_rustls;
30306/// # extern crate google_iam1 as iam1;
30307/// use iam1::api::PatchServiceAccountKeyRequest;
30308/// # async fn dox() {
30309/// # use iam1::{Iam, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
30310///
30311/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
30312/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
30313/// #     secret,
30314/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
30315/// # ).build().await.unwrap();
30316///
30317/// # let client = hyper_util::client::legacy::Client::builder(
30318/// #     hyper_util::rt::TokioExecutor::new()
30319/// # )
30320/// # .build(
30321/// #     hyper_rustls::HttpsConnectorBuilder::new()
30322/// #         .with_native_roots()
30323/// #         .unwrap()
30324/// #         .https_or_http()
30325/// #         .enable_http1()
30326/// #         .build()
30327/// # );
30328/// # let mut hub = Iam::new(client, auth);
30329/// // As the method needs a request, you would usually fill it with the desired information
30330/// // into the respective structure. Some of the parts shown here might not be applicable !
30331/// // Values shown here are possibly random and not representative !
30332/// let mut req = PatchServiceAccountKeyRequest::default();
30333///
30334/// // You can configure optional parameters by calling the respective setters at will, and
30335/// // execute the final call using `doit()`.
30336/// // Values shown here are possibly random and not representative !
30337/// let result = hub.projects().service_accounts_keys_patch(req, "name")
30338///              .doit().await;
30339/// # }
30340/// ```
30341pub struct ProjectServiceAccountKeyPatchCall<'a, C>
30342where
30343    C: 'a,
30344{
30345    hub: &'a Iam<C>,
30346    _request: PatchServiceAccountKeyRequest,
30347    _name: String,
30348    _delegate: Option<&'a mut dyn common::Delegate>,
30349    _additional_params: HashMap<String, String>,
30350    _scopes: BTreeSet<String>,
30351}
30352
30353impl<'a, C> common::CallBuilder for ProjectServiceAccountKeyPatchCall<'a, C> {}
30354
30355impl<'a, C> ProjectServiceAccountKeyPatchCall<'a, C>
30356where
30357    C: common::Connector,
30358{
30359    /// Perform the operation you have build so far.
30360    pub async fn doit(mut self) -> common::Result<(common::Response, ServiceAccountKey)> {
30361        use std::borrow::Cow;
30362        use std::io::{Read, Seek};
30363
30364        use common::{url::Params, ToParts};
30365        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
30366
30367        let mut dd = common::DefaultDelegate;
30368        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
30369        dlg.begin(common::MethodInfo {
30370            id: "iam.projects.serviceAccounts.keys.patch",
30371            http_method: hyper::Method::POST,
30372        });
30373
30374        for &field in ["alt", "name"].iter() {
30375            if self._additional_params.contains_key(field) {
30376                dlg.finished(false);
30377                return Err(common::Error::FieldClash(field));
30378            }
30379        }
30380
30381        let mut params = Params::with_capacity(4 + self._additional_params.len());
30382        params.push("name", self._name);
30383
30384        params.extend(self._additional_params.iter());
30385
30386        params.push("alt", "json");
30387        let mut url = self.hub._base_url.clone() + "v1/{+name}:patch";
30388        if self._scopes.is_empty() {
30389            self._scopes
30390                .insert(Scope::CloudPlatform.as_ref().to_string());
30391        }
30392
30393        #[allow(clippy::single_element_loop)]
30394        for &(find_this, param_name) in [("{+name}", "name")].iter() {
30395            url = params.uri_replacement(url, param_name, find_this, true);
30396        }
30397        {
30398            let to_remove = ["name"];
30399            params.remove_params(&to_remove);
30400        }
30401
30402        let url = params.parse_with_url(&url);
30403
30404        let mut json_mime_type = mime::APPLICATION_JSON;
30405        let mut request_value_reader = {
30406            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
30407            common::remove_json_null_values(&mut value);
30408            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
30409            serde_json::to_writer(&mut dst, &value).unwrap();
30410            dst
30411        };
30412        let request_size = request_value_reader
30413            .seek(std::io::SeekFrom::End(0))
30414            .unwrap();
30415        request_value_reader
30416            .seek(std::io::SeekFrom::Start(0))
30417            .unwrap();
30418
30419        loop {
30420            let token = match self
30421                .hub
30422                .auth
30423                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
30424                .await
30425            {
30426                Ok(token) => token,
30427                Err(e) => match dlg.token(e) {
30428                    Ok(token) => token,
30429                    Err(e) => {
30430                        dlg.finished(false);
30431                        return Err(common::Error::MissingToken(e));
30432                    }
30433                },
30434            };
30435            request_value_reader
30436                .seek(std::io::SeekFrom::Start(0))
30437                .unwrap();
30438            let mut req_result = {
30439                let client = &self.hub.client;
30440                dlg.pre_request();
30441                let mut req_builder = hyper::Request::builder()
30442                    .method(hyper::Method::POST)
30443                    .uri(url.as_str())
30444                    .header(USER_AGENT, self.hub._user_agent.clone());
30445
30446                if let Some(token) = token.as_ref() {
30447                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
30448                }
30449
30450                let request = req_builder
30451                    .header(CONTENT_TYPE, json_mime_type.to_string())
30452                    .header(CONTENT_LENGTH, request_size as u64)
30453                    .body(common::to_body(
30454                        request_value_reader.get_ref().clone().into(),
30455                    ));
30456
30457                client.request(request.unwrap()).await
30458            };
30459
30460            match req_result {
30461                Err(err) => {
30462                    if let common::Retry::After(d) = dlg.http_error(&err) {
30463                        sleep(d).await;
30464                        continue;
30465                    }
30466                    dlg.finished(false);
30467                    return Err(common::Error::HttpError(err));
30468                }
30469                Ok(res) => {
30470                    let (mut parts, body) = res.into_parts();
30471                    let mut body = common::Body::new(body);
30472                    if !parts.status.is_success() {
30473                        let bytes = common::to_bytes(body).await.unwrap_or_default();
30474                        let error = serde_json::from_str(&common::to_string(&bytes));
30475                        let response = common::to_response(parts, bytes.into());
30476
30477                        if let common::Retry::After(d) =
30478                            dlg.http_failure(&response, error.as_ref().ok())
30479                        {
30480                            sleep(d).await;
30481                            continue;
30482                        }
30483
30484                        dlg.finished(false);
30485
30486                        return Err(match error {
30487                            Ok(value) => common::Error::BadRequest(value),
30488                            _ => common::Error::Failure(response),
30489                        });
30490                    }
30491                    let response = {
30492                        let bytes = common::to_bytes(body).await.unwrap_or_default();
30493                        let encoded = common::to_string(&bytes);
30494                        match serde_json::from_str(&encoded) {
30495                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
30496                            Err(error) => {
30497                                dlg.response_json_decode_error(&encoded, &error);
30498                                return Err(common::Error::JsonDecodeError(
30499                                    encoded.to_string(),
30500                                    error,
30501                                ));
30502                            }
30503                        }
30504                    };
30505
30506                    dlg.finished(true);
30507                    return Ok(response);
30508                }
30509            }
30510        }
30511    }
30512
30513    ///
30514    /// Sets the *request* property to the given value.
30515    ///
30516    /// Even though the property as already been set when instantiating this call,
30517    /// we provide this method for API completeness.
30518    pub fn request(
30519        mut self,
30520        new_value: PatchServiceAccountKeyRequest,
30521    ) -> ProjectServiceAccountKeyPatchCall<'a, C> {
30522        self._request = new_value;
30523        self
30524    }
30525    /// The resource name of the service account key in the following format `projects/{PROJECT_ID}/serviceAccounts/{ACCOUNT}/keys/{key}`.
30526    ///
30527    /// Sets the *name* path property to the given value.
30528    ///
30529    /// Even though the property as already been set when instantiating this call,
30530    /// we provide this method for API completeness.
30531    pub fn name(mut self, new_value: &str) -> ProjectServiceAccountKeyPatchCall<'a, C> {
30532        self._name = new_value.to_string();
30533        self
30534    }
30535    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
30536    /// while executing the actual API request.
30537    ///
30538    /// ````text
30539    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
30540    /// ````
30541    ///
30542    /// Sets the *delegate* property to the given value.
30543    pub fn delegate(
30544        mut self,
30545        new_value: &'a mut dyn common::Delegate,
30546    ) -> ProjectServiceAccountKeyPatchCall<'a, C> {
30547        self._delegate = Some(new_value);
30548        self
30549    }
30550
30551    /// Set any additional parameter of the query string used in the request.
30552    /// It should be used to set parameters which are not yet available through their own
30553    /// setters.
30554    ///
30555    /// Please note that this method must not be used to set any of the known parameters
30556    /// which have their own setter method. If done anyway, the request will fail.
30557    ///
30558    /// # Additional Parameters
30559    ///
30560    /// * *$.xgafv* (query-string) - V1 error format.
30561    /// * *access_token* (query-string) - OAuth access token.
30562    /// * *alt* (query-string) - Data format for response.
30563    /// * *callback* (query-string) - JSONP
30564    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
30565    /// * *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.
30566    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
30567    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
30568    /// * *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.
30569    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
30570    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
30571    pub fn param<T>(mut self, name: T, value: T) -> ProjectServiceAccountKeyPatchCall<'a, C>
30572    where
30573        T: AsRef<str>,
30574    {
30575        self._additional_params
30576            .insert(name.as_ref().to_string(), value.as_ref().to_string());
30577        self
30578    }
30579
30580    /// Identifies the authorization scope for the method you are building.
30581    ///
30582    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
30583    /// [`Scope::CloudPlatform`].
30584    ///
30585    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
30586    /// tokens for more than one scope.
30587    ///
30588    /// Usually there is more than one suitable scope to authorize an operation, some of which may
30589    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
30590    /// sufficient, a read-write scope will do as well.
30591    pub fn add_scope<St>(mut self, scope: St) -> ProjectServiceAccountKeyPatchCall<'a, C>
30592    where
30593        St: AsRef<str>,
30594    {
30595        self._scopes.insert(String::from(scope.as_ref()));
30596        self
30597    }
30598    /// Identifies the authorization scope(s) for the method you are building.
30599    ///
30600    /// See [`Self::add_scope()`] for details.
30601    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectServiceAccountKeyPatchCall<'a, C>
30602    where
30603        I: IntoIterator<Item = St>,
30604        St: AsRef<str>,
30605    {
30606        self._scopes
30607            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
30608        self
30609    }
30610
30611    /// Removes all scopes, and no default scope will be used either.
30612    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
30613    /// for details).
30614    pub fn clear_scopes(mut self) -> ProjectServiceAccountKeyPatchCall<'a, C> {
30615        self._scopes.clear();
30616        self
30617    }
30618}
30619
30620/// Uploads the public key portion of a key pair that you manage, and associates the public key with a ServiceAccount. After you upload the public key, you can use the private key from the key pair as a service account key.
30621///
30622/// A builder for the *serviceAccounts.keys.upload* method supported by a *project* resource.
30623/// It is not used directly, but through a [`ProjectMethods`] instance.
30624///
30625/// # Example
30626///
30627/// Instantiate a resource method builder
30628///
30629/// ```test_harness,no_run
30630/// # extern crate hyper;
30631/// # extern crate hyper_rustls;
30632/// # extern crate google_iam1 as iam1;
30633/// use iam1::api::UploadServiceAccountKeyRequest;
30634/// # async fn dox() {
30635/// # use iam1::{Iam, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
30636///
30637/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
30638/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
30639/// #     secret,
30640/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
30641/// # ).build().await.unwrap();
30642///
30643/// # let client = hyper_util::client::legacy::Client::builder(
30644/// #     hyper_util::rt::TokioExecutor::new()
30645/// # )
30646/// # .build(
30647/// #     hyper_rustls::HttpsConnectorBuilder::new()
30648/// #         .with_native_roots()
30649/// #         .unwrap()
30650/// #         .https_or_http()
30651/// #         .enable_http1()
30652/// #         .build()
30653/// # );
30654/// # let mut hub = Iam::new(client, auth);
30655/// // As the method needs a request, you would usually fill it with the desired information
30656/// // into the respective structure. Some of the parts shown here might not be applicable !
30657/// // Values shown here are possibly random and not representative !
30658/// let mut req = UploadServiceAccountKeyRequest::default();
30659///
30660/// // You can configure optional parameters by calling the respective setters at will, and
30661/// // execute the final call using `doit()`.
30662/// // Values shown here are possibly random and not representative !
30663/// let result = hub.projects().service_accounts_keys_upload(req, "name")
30664///              .doit().await;
30665/// # }
30666/// ```
30667pub struct ProjectServiceAccountKeyUploadCall<'a, C>
30668where
30669    C: 'a,
30670{
30671    hub: &'a Iam<C>,
30672    _request: UploadServiceAccountKeyRequest,
30673    _name: String,
30674    _delegate: Option<&'a mut dyn common::Delegate>,
30675    _additional_params: HashMap<String, String>,
30676    _scopes: BTreeSet<String>,
30677}
30678
30679impl<'a, C> common::CallBuilder for ProjectServiceAccountKeyUploadCall<'a, C> {}
30680
30681impl<'a, C> ProjectServiceAccountKeyUploadCall<'a, C>
30682where
30683    C: common::Connector,
30684{
30685    /// Perform the operation you have build so far.
30686    pub async fn doit(mut self) -> common::Result<(common::Response, ServiceAccountKey)> {
30687        use std::borrow::Cow;
30688        use std::io::{Read, Seek};
30689
30690        use common::{url::Params, ToParts};
30691        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
30692
30693        let mut dd = common::DefaultDelegate;
30694        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
30695        dlg.begin(common::MethodInfo {
30696            id: "iam.projects.serviceAccounts.keys.upload",
30697            http_method: hyper::Method::POST,
30698        });
30699
30700        for &field in ["alt", "name"].iter() {
30701            if self._additional_params.contains_key(field) {
30702                dlg.finished(false);
30703                return Err(common::Error::FieldClash(field));
30704            }
30705        }
30706
30707        let mut params = Params::with_capacity(4 + self._additional_params.len());
30708        params.push("name", self._name);
30709
30710        params.extend(self._additional_params.iter());
30711
30712        params.push("alt", "json");
30713        let mut url = self.hub._base_url.clone() + "v1/{+name}/keys:upload";
30714        if self._scopes.is_empty() {
30715            self._scopes
30716                .insert(Scope::CloudPlatform.as_ref().to_string());
30717        }
30718
30719        #[allow(clippy::single_element_loop)]
30720        for &(find_this, param_name) in [("{+name}", "name")].iter() {
30721            url = params.uri_replacement(url, param_name, find_this, true);
30722        }
30723        {
30724            let to_remove = ["name"];
30725            params.remove_params(&to_remove);
30726        }
30727
30728        let url = params.parse_with_url(&url);
30729
30730        let mut json_mime_type = mime::APPLICATION_JSON;
30731        let mut request_value_reader = {
30732            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
30733            common::remove_json_null_values(&mut value);
30734            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
30735            serde_json::to_writer(&mut dst, &value).unwrap();
30736            dst
30737        };
30738        let request_size = request_value_reader
30739            .seek(std::io::SeekFrom::End(0))
30740            .unwrap();
30741        request_value_reader
30742            .seek(std::io::SeekFrom::Start(0))
30743            .unwrap();
30744
30745        loop {
30746            let token = match self
30747                .hub
30748                .auth
30749                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
30750                .await
30751            {
30752                Ok(token) => token,
30753                Err(e) => match dlg.token(e) {
30754                    Ok(token) => token,
30755                    Err(e) => {
30756                        dlg.finished(false);
30757                        return Err(common::Error::MissingToken(e));
30758                    }
30759                },
30760            };
30761            request_value_reader
30762                .seek(std::io::SeekFrom::Start(0))
30763                .unwrap();
30764            let mut req_result = {
30765                let client = &self.hub.client;
30766                dlg.pre_request();
30767                let mut req_builder = hyper::Request::builder()
30768                    .method(hyper::Method::POST)
30769                    .uri(url.as_str())
30770                    .header(USER_AGENT, self.hub._user_agent.clone());
30771
30772                if let Some(token) = token.as_ref() {
30773                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
30774                }
30775
30776                let request = req_builder
30777                    .header(CONTENT_TYPE, json_mime_type.to_string())
30778                    .header(CONTENT_LENGTH, request_size as u64)
30779                    .body(common::to_body(
30780                        request_value_reader.get_ref().clone().into(),
30781                    ));
30782
30783                client.request(request.unwrap()).await
30784            };
30785
30786            match req_result {
30787                Err(err) => {
30788                    if let common::Retry::After(d) = dlg.http_error(&err) {
30789                        sleep(d).await;
30790                        continue;
30791                    }
30792                    dlg.finished(false);
30793                    return Err(common::Error::HttpError(err));
30794                }
30795                Ok(res) => {
30796                    let (mut parts, body) = res.into_parts();
30797                    let mut body = common::Body::new(body);
30798                    if !parts.status.is_success() {
30799                        let bytes = common::to_bytes(body).await.unwrap_or_default();
30800                        let error = serde_json::from_str(&common::to_string(&bytes));
30801                        let response = common::to_response(parts, bytes.into());
30802
30803                        if let common::Retry::After(d) =
30804                            dlg.http_failure(&response, error.as_ref().ok())
30805                        {
30806                            sleep(d).await;
30807                            continue;
30808                        }
30809
30810                        dlg.finished(false);
30811
30812                        return Err(match error {
30813                            Ok(value) => common::Error::BadRequest(value),
30814                            _ => common::Error::Failure(response),
30815                        });
30816                    }
30817                    let response = {
30818                        let bytes = common::to_bytes(body).await.unwrap_or_default();
30819                        let encoded = common::to_string(&bytes);
30820                        match serde_json::from_str(&encoded) {
30821                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
30822                            Err(error) => {
30823                                dlg.response_json_decode_error(&encoded, &error);
30824                                return Err(common::Error::JsonDecodeError(
30825                                    encoded.to_string(),
30826                                    error,
30827                                ));
30828                            }
30829                        }
30830                    };
30831
30832                    dlg.finished(true);
30833                    return Ok(response);
30834                }
30835            }
30836        }
30837    }
30838
30839    ///
30840    /// Sets the *request* property to the given value.
30841    ///
30842    /// Even though the property as already been set when instantiating this call,
30843    /// we provide this method for API completeness.
30844    pub fn request(
30845        mut self,
30846        new_value: UploadServiceAccountKeyRequest,
30847    ) -> ProjectServiceAccountKeyUploadCall<'a, C> {
30848        self._request = new_value;
30849        self
30850    }
30851    /// The resource name of the service account key. Use one of the following formats: * `projects/{PROJECT_ID}/serviceAccounts/{EMAIL_ADDRESS}` * `projects/{PROJECT_ID}/serviceAccounts/{UNIQUE_ID}` As an alternative, you can use the `-` wildcard character instead of the project ID: * `projects/-/serviceAccounts/{EMAIL_ADDRESS}` * `projects/-/serviceAccounts/{UNIQUE_ID}` When possible, avoid using the `-` wildcard character, because it can cause response messages to contain misleading error codes. For example, if you try to access the service account `projects/-/serviceAccounts/fake@example.com`, which does not exist, the response contains an HTTP `403 Forbidden` error instead of a `404 Not Found` error.
30852    ///
30853    /// Sets the *name* path property to the given value.
30854    ///
30855    /// Even though the property as already been set when instantiating this call,
30856    /// we provide this method for API completeness.
30857    pub fn name(mut self, new_value: &str) -> ProjectServiceAccountKeyUploadCall<'a, C> {
30858        self._name = new_value.to_string();
30859        self
30860    }
30861    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
30862    /// while executing the actual API request.
30863    ///
30864    /// ````text
30865    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
30866    /// ````
30867    ///
30868    /// Sets the *delegate* property to the given value.
30869    pub fn delegate(
30870        mut self,
30871        new_value: &'a mut dyn common::Delegate,
30872    ) -> ProjectServiceAccountKeyUploadCall<'a, C> {
30873        self._delegate = Some(new_value);
30874        self
30875    }
30876
30877    /// Set any additional parameter of the query string used in the request.
30878    /// It should be used to set parameters which are not yet available through their own
30879    /// setters.
30880    ///
30881    /// Please note that this method must not be used to set any of the known parameters
30882    /// which have their own setter method. If done anyway, the request will fail.
30883    ///
30884    /// # Additional Parameters
30885    ///
30886    /// * *$.xgafv* (query-string) - V1 error format.
30887    /// * *access_token* (query-string) - OAuth access token.
30888    /// * *alt* (query-string) - Data format for response.
30889    /// * *callback* (query-string) - JSONP
30890    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
30891    /// * *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.
30892    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
30893    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
30894    /// * *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.
30895    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
30896    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
30897    pub fn param<T>(mut self, name: T, value: T) -> ProjectServiceAccountKeyUploadCall<'a, C>
30898    where
30899        T: AsRef<str>,
30900    {
30901        self._additional_params
30902            .insert(name.as_ref().to_string(), value.as_ref().to_string());
30903        self
30904    }
30905
30906    /// Identifies the authorization scope for the method you are building.
30907    ///
30908    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
30909    /// [`Scope::CloudPlatform`].
30910    ///
30911    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
30912    /// tokens for more than one scope.
30913    ///
30914    /// Usually there is more than one suitable scope to authorize an operation, some of which may
30915    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
30916    /// sufficient, a read-write scope will do as well.
30917    pub fn add_scope<St>(mut self, scope: St) -> ProjectServiceAccountKeyUploadCall<'a, C>
30918    where
30919        St: AsRef<str>,
30920    {
30921        self._scopes.insert(String::from(scope.as_ref()));
30922        self
30923    }
30924    /// Identifies the authorization scope(s) for the method you are building.
30925    ///
30926    /// See [`Self::add_scope()`] for details.
30927    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectServiceAccountKeyUploadCall<'a, C>
30928    where
30929        I: IntoIterator<Item = St>,
30930        St: AsRef<str>,
30931    {
30932        self._scopes
30933            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
30934        self
30935    }
30936
30937    /// Removes all scopes, and no default scope will be used either.
30938    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
30939    /// for details).
30940    pub fn clear_scopes(mut self) -> ProjectServiceAccountKeyUploadCall<'a, C> {
30941        self._scopes.clear();
30942        self
30943    }
30944}
30945
30946/// Creates a ServiceAccount.
30947///
30948/// A builder for the *serviceAccounts.create* method supported by a *project* resource.
30949/// It is not used directly, but through a [`ProjectMethods`] instance.
30950///
30951/// # Example
30952///
30953/// Instantiate a resource method builder
30954///
30955/// ```test_harness,no_run
30956/// # extern crate hyper;
30957/// # extern crate hyper_rustls;
30958/// # extern crate google_iam1 as iam1;
30959/// use iam1::api::CreateServiceAccountRequest;
30960/// # async fn dox() {
30961/// # use iam1::{Iam, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
30962///
30963/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
30964/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
30965/// #     secret,
30966/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
30967/// # ).build().await.unwrap();
30968///
30969/// # let client = hyper_util::client::legacy::Client::builder(
30970/// #     hyper_util::rt::TokioExecutor::new()
30971/// # )
30972/// # .build(
30973/// #     hyper_rustls::HttpsConnectorBuilder::new()
30974/// #         .with_native_roots()
30975/// #         .unwrap()
30976/// #         .https_or_http()
30977/// #         .enable_http1()
30978/// #         .build()
30979/// # );
30980/// # let mut hub = Iam::new(client, auth);
30981/// // As the method needs a request, you would usually fill it with the desired information
30982/// // into the respective structure. Some of the parts shown here might not be applicable !
30983/// // Values shown here are possibly random and not representative !
30984/// let mut req = CreateServiceAccountRequest::default();
30985///
30986/// // You can configure optional parameters by calling the respective setters at will, and
30987/// // execute the final call using `doit()`.
30988/// // Values shown here are possibly random and not representative !
30989/// let result = hub.projects().service_accounts_create(req, "name")
30990///              .doit().await;
30991/// # }
30992/// ```
30993pub struct ProjectServiceAccountCreateCall<'a, C>
30994where
30995    C: 'a,
30996{
30997    hub: &'a Iam<C>,
30998    _request: CreateServiceAccountRequest,
30999    _name: String,
31000    _delegate: Option<&'a mut dyn common::Delegate>,
31001    _additional_params: HashMap<String, String>,
31002    _scopes: BTreeSet<String>,
31003}
31004
31005impl<'a, C> common::CallBuilder for ProjectServiceAccountCreateCall<'a, C> {}
31006
31007impl<'a, C> ProjectServiceAccountCreateCall<'a, C>
31008where
31009    C: common::Connector,
31010{
31011    /// Perform the operation you have build so far.
31012    pub async fn doit(mut self) -> common::Result<(common::Response, ServiceAccount)> {
31013        use std::borrow::Cow;
31014        use std::io::{Read, Seek};
31015
31016        use common::{url::Params, ToParts};
31017        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
31018
31019        let mut dd = common::DefaultDelegate;
31020        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
31021        dlg.begin(common::MethodInfo {
31022            id: "iam.projects.serviceAccounts.create",
31023            http_method: hyper::Method::POST,
31024        });
31025
31026        for &field in ["alt", "name"].iter() {
31027            if self._additional_params.contains_key(field) {
31028                dlg.finished(false);
31029                return Err(common::Error::FieldClash(field));
31030            }
31031        }
31032
31033        let mut params = Params::with_capacity(4 + self._additional_params.len());
31034        params.push("name", self._name);
31035
31036        params.extend(self._additional_params.iter());
31037
31038        params.push("alt", "json");
31039        let mut url = self.hub._base_url.clone() + "v1/{+name}/serviceAccounts";
31040        if self._scopes.is_empty() {
31041            self._scopes
31042                .insert(Scope::CloudPlatform.as_ref().to_string());
31043        }
31044
31045        #[allow(clippy::single_element_loop)]
31046        for &(find_this, param_name) in [("{+name}", "name")].iter() {
31047            url = params.uri_replacement(url, param_name, find_this, true);
31048        }
31049        {
31050            let to_remove = ["name"];
31051            params.remove_params(&to_remove);
31052        }
31053
31054        let url = params.parse_with_url(&url);
31055
31056        let mut json_mime_type = mime::APPLICATION_JSON;
31057        let mut request_value_reader = {
31058            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
31059            common::remove_json_null_values(&mut value);
31060            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
31061            serde_json::to_writer(&mut dst, &value).unwrap();
31062            dst
31063        };
31064        let request_size = request_value_reader
31065            .seek(std::io::SeekFrom::End(0))
31066            .unwrap();
31067        request_value_reader
31068            .seek(std::io::SeekFrom::Start(0))
31069            .unwrap();
31070
31071        loop {
31072            let token = match self
31073                .hub
31074                .auth
31075                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
31076                .await
31077            {
31078                Ok(token) => token,
31079                Err(e) => match dlg.token(e) {
31080                    Ok(token) => token,
31081                    Err(e) => {
31082                        dlg.finished(false);
31083                        return Err(common::Error::MissingToken(e));
31084                    }
31085                },
31086            };
31087            request_value_reader
31088                .seek(std::io::SeekFrom::Start(0))
31089                .unwrap();
31090            let mut req_result = {
31091                let client = &self.hub.client;
31092                dlg.pre_request();
31093                let mut req_builder = hyper::Request::builder()
31094                    .method(hyper::Method::POST)
31095                    .uri(url.as_str())
31096                    .header(USER_AGENT, self.hub._user_agent.clone());
31097
31098                if let Some(token) = token.as_ref() {
31099                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
31100                }
31101
31102                let request = req_builder
31103                    .header(CONTENT_TYPE, json_mime_type.to_string())
31104                    .header(CONTENT_LENGTH, request_size as u64)
31105                    .body(common::to_body(
31106                        request_value_reader.get_ref().clone().into(),
31107                    ));
31108
31109                client.request(request.unwrap()).await
31110            };
31111
31112            match req_result {
31113                Err(err) => {
31114                    if let common::Retry::After(d) = dlg.http_error(&err) {
31115                        sleep(d).await;
31116                        continue;
31117                    }
31118                    dlg.finished(false);
31119                    return Err(common::Error::HttpError(err));
31120                }
31121                Ok(res) => {
31122                    let (mut parts, body) = res.into_parts();
31123                    let mut body = common::Body::new(body);
31124                    if !parts.status.is_success() {
31125                        let bytes = common::to_bytes(body).await.unwrap_or_default();
31126                        let error = serde_json::from_str(&common::to_string(&bytes));
31127                        let response = common::to_response(parts, bytes.into());
31128
31129                        if let common::Retry::After(d) =
31130                            dlg.http_failure(&response, error.as_ref().ok())
31131                        {
31132                            sleep(d).await;
31133                            continue;
31134                        }
31135
31136                        dlg.finished(false);
31137
31138                        return Err(match error {
31139                            Ok(value) => common::Error::BadRequest(value),
31140                            _ => common::Error::Failure(response),
31141                        });
31142                    }
31143                    let response = {
31144                        let bytes = common::to_bytes(body).await.unwrap_or_default();
31145                        let encoded = common::to_string(&bytes);
31146                        match serde_json::from_str(&encoded) {
31147                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
31148                            Err(error) => {
31149                                dlg.response_json_decode_error(&encoded, &error);
31150                                return Err(common::Error::JsonDecodeError(
31151                                    encoded.to_string(),
31152                                    error,
31153                                ));
31154                            }
31155                        }
31156                    };
31157
31158                    dlg.finished(true);
31159                    return Ok(response);
31160                }
31161            }
31162        }
31163    }
31164
31165    ///
31166    /// Sets the *request* property to the given value.
31167    ///
31168    /// Even though the property as already been set when instantiating this call,
31169    /// we provide this method for API completeness.
31170    pub fn request(
31171        mut self,
31172        new_value: CreateServiceAccountRequest,
31173    ) -> ProjectServiceAccountCreateCall<'a, C> {
31174        self._request = new_value;
31175        self
31176    }
31177    /// Required. The resource name of the project associated with the service accounts, such as `projects/my-project-123`.
31178    ///
31179    /// Sets the *name* path property to the given value.
31180    ///
31181    /// Even though the property as already been set when instantiating this call,
31182    /// we provide this method for API completeness.
31183    pub fn name(mut self, new_value: &str) -> ProjectServiceAccountCreateCall<'a, C> {
31184        self._name = new_value.to_string();
31185        self
31186    }
31187    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
31188    /// while executing the actual API request.
31189    ///
31190    /// ````text
31191    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
31192    /// ````
31193    ///
31194    /// Sets the *delegate* property to the given value.
31195    pub fn delegate(
31196        mut self,
31197        new_value: &'a mut dyn common::Delegate,
31198    ) -> ProjectServiceAccountCreateCall<'a, C> {
31199        self._delegate = Some(new_value);
31200        self
31201    }
31202
31203    /// Set any additional parameter of the query string used in the request.
31204    /// It should be used to set parameters which are not yet available through their own
31205    /// setters.
31206    ///
31207    /// Please note that this method must not be used to set any of the known parameters
31208    /// which have their own setter method. If done anyway, the request will fail.
31209    ///
31210    /// # Additional Parameters
31211    ///
31212    /// * *$.xgafv* (query-string) - V1 error format.
31213    /// * *access_token* (query-string) - OAuth access token.
31214    /// * *alt* (query-string) - Data format for response.
31215    /// * *callback* (query-string) - JSONP
31216    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
31217    /// * *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.
31218    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
31219    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
31220    /// * *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.
31221    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
31222    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
31223    pub fn param<T>(mut self, name: T, value: T) -> ProjectServiceAccountCreateCall<'a, C>
31224    where
31225        T: AsRef<str>,
31226    {
31227        self._additional_params
31228            .insert(name.as_ref().to_string(), value.as_ref().to_string());
31229        self
31230    }
31231
31232    /// Identifies the authorization scope for the method you are building.
31233    ///
31234    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
31235    /// [`Scope::CloudPlatform`].
31236    ///
31237    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
31238    /// tokens for more than one scope.
31239    ///
31240    /// Usually there is more than one suitable scope to authorize an operation, some of which may
31241    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
31242    /// sufficient, a read-write scope will do as well.
31243    pub fn add_scope<St>(mut self, scope: St) -> ProjectServiceAccountCreateCall<'a, C>
31244    where
31245        St: AsRef<str>,
31246    {
31247        self._scopes.insert(String::from(scope.as_ref()));
31248        self
31249    }
31250    /// Identifies the authorization scope(s) for the method you are building.
31251    ///
31252    /// See [`Self::add_scope()`] for details.
31253    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectServiceAccountCreateCall<'a, C>
31254    where
31255        I: IntoIterator<Item = St>,
31256        St: AsRef<str>,
31257    {
31258        self._scopes
31259            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
31260        self
31261    }
31262
31263    /// Removes all scopes, and no default scope will be used either.
31264    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
31265    /// for details).
31266    pub fn clear_scopes(mut self) -> ProjectServiceAccountCreateCall<'a, C> {
31267        self._scopes.clear();
31268        self
31269    }
31270}
31271
31272/// Deletes a ServiceAccount. **Warning:** After you delete a service account, you might not be able to undelete it. If you know that you need to re-enable the service account in the future, use DisableServiceAccount instead. If you delete a service account, IAM permanently removes the service account 30 days later. Google Cloud cannot recover the service account after it is permanently removed, even if you file a support request. To help avoid unplanned outages, we recommend that you disable the service account before you delete it. Use DisableServiceAccount to disable the service account, then wait at least 24 hours and watch for unintended consequences. If there are no unintended consequences, you can delete the service account.
31273///
31274/// A builder for the *serviceAccounts.delete* method supported by a *project* resource.
31275/// It is not used directly, but through a [`ProjectMethods`] instance.
31276///
31277/// # Example
31278///
31279/// Instantiate a resource method builder
31280///
31281/// ```test_harness,no_run
31282/// # extern crate hyper;
31283/// # extern crate hyper_rustls;
31284/// # extern crate google_iam1 as iam1;
31285/// # async fn dox() {
31286/// # use iam1::{Iam, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
31287///
31288/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
31289/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
31290/// #     secret,
31291/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
31292/// # ).build().await.unwrap();
31293///
31294/// # let client = hyper_util::client::legacy::Client::builder(
31295/// #     hyper_util::rt::TokioExecutor::new()
31296/// # )
31297/// # .build(
31298/// #     hyper_rustls::HttpsConnectorBuilder::new()
31299/// #         .with_native_roots()
31300/// #         .unwrap()
31301/// #         .https_or_http()
31302/// #         .enable_http1()
31303/// #         .build()
31304/// # );
31305/// # let mut hub = Iam::new(client, auth);
31306/// // You can configure optional parameters by calling the respective setters at will, and
31307/// // execute the final call using `doit()`.
31308/// // Values shown here are possibly random and not representative !
31309/// let result = hub.projects().service_accounts_delete("name")
31310///              .doit().await;
31311/// # }
31312/// ```
31313pub struct ProjectServiceAccountDeleteCall<'a, C>
31314where
31315    C: 'a,
31316{
31317    hub: &'a Iam<C>,
31318    _name: String,
31319    _delegate: Option<&'a mut dyn common::Delegate>,
31320    _additional_params: HashMap<String, String>,
31321    _scopes: BTreeSet<String>,
31322}
31323
31324impl<'a, C> common::CallBuilder for ProjectServiceAccountDeleteCall<'a, C> {}
31325
31326impl<'a, C> ProjectServiceAccountDeleteCall<'a, C>
31327where
31328    C: common::Connector,
31329{
31330    /// Perform the operation you have build so far.
31331    pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
31332        use std::borrow::Cow;
31333        use std::io::{Read, Seek};
31334
31335        use common::{url::Params, ToParts};
31336        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
31337
31338        let mut dd = common::DefaultDelegate;
31339        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
31340        dlg.begin(common::MethodInfo {
31341            id: "iam.projects.serviceAccounts.delete",
31342            http_method: hyper::Method::DELETE,
31343        });
31344
31345        for &field in ["alt", "name"].iter() {
31346            if self._additional_params.contains_key(field) {
31347                dlg.finished(false);
31348                return Err(common::Error::FieldClash(field));
31349            }
31350        }
31351
31352        let mut params = Params::with_capacity(3 + self._additional_params.len());
31353        params.push("name", self._name);
31354
31355        params.extend(self._additional_params.iter());
31356
31357        params.push("alt", "json");
31358        let mut url = self.hub._base_url.clone() + "v1/{+name}";
31359        if self._scopes.is_empty() {
31360            self._scopes
31361                .insert(Scope::CloudPlatform.as_ref().to_string());
31362        }
31363
31364        #[allow(clippy::single_element_loop)]
31365        for &(find_this, param_name) in [("{+name}", "name")].iter() {
31366            url = params.uri_replacement(url, param_name, find_this, true);
31367        }
31368        {
31369            let to_remove = ["name"];
31370            params.remove_params(&to_remove);
31371        }
31372
31373        let url = params.parse_with_url(&url);
31374
31375        loop {
31376            let token = match self
31377                .hub
31378                .auth
31379                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
31380                .await
31381            {
31382                Ok(token) => token,
31383                Err(e) => match dlg.token(e) {
31384                    Ok(token) => token,
31385                    Err(e) => {
31386                        dlg.finished(false);
31387                        return Err(common::Error::MissingToken(e));
31388                    }
31389                },
31390            };
31391            let mut req_result = {
31392                let client = &self.hub.client;
31393                dlg.pre_request();
31394                let mut req_builder = hyper::Request::builder()
31395                    .method(hyper::Method::DELETE)
31396                    .uri(url.as_str())
31397                    .header(USER_AGENT, self.hub._user_agent.clone());
31398
31399                if let Some(token) = token.as_ref() {
31400                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
31401                }
31402
31403                let request = req_builder
31404                    .header(CONTENT_LENGTH, 0_u64)
31405                    .body(common::to_body::<String>(None));
31406
31407                client.request(request.unwrap()).await
31408            };
31409
31410            match req_result {
31411                Err(err) => {
31412                    if let common::Retry::After(d) = dlg.http_error(&err) {
31413                        sleep(d).await;
31414                        continue;
31415                    }
31416                    dlg.finished(false);
31417                    return Err(common::Error::HttpError(err));
31418                }
31419                Ok(res) => {
31420                    let (mut parts, body) = res.into_parts();
31421                    let mut body = common::Body::new(body);
31422                    if !parts.status.is_success() {
31423                        let bytes = common::to_bytes(body).await.unwrap_or_default();
31424                        let error = serde_json::from_str(&common::to_string(&bytes));
31425                        let response = common::to_response(parts, bytes.into());
31426
31427                        if let common::Retry::After(d) =
31428                            dlg.http_failure(&response, error.as_ref().ok())
31429                        {
31430                            sleep(d).await;
31431                            continue;
31432                        }
31433
31434                        dlg.finished(false);
31435
31436                        return Err(match error {
31437                            Ok(value) => common::Error::BadRequest(value),
31438                            _ => common::Error::Failure(response),
31439                        });
31440                    }
31441                    let response = {
31442                        let bytes = common::to_bytes(body).await.unwrap_or_default();
31443                        let encoded = common::to_string(&bytes);
31444                        match serde_json::from_str(&encoded) {
31445                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
31446                            Err(error) => {
31447                                dlg.response_json_decode_error(&encoded, &error);
31448                                return Err(common::Error::JsonDecodeError(
31449                                    encoded.to_string(),
31450                                    error,
31451                                ));
31452                            }
31453                        }
31454                    };
31455
31456                    dlg.finished(true);
31457                    return Ok(response);
31458                }
31459            }
31460        }
31461    }
31462
31463    /// Required. The resource name of the service account. Use one of the following formats: * `projects/{PROJECT_ID}/serviceAccounts/{EMAIL_ADDRESS}` * `projects/{PROJECT_ID}/serviceAccounts/{UNIQUE_ID}` As an alternative, you can use the `-` wildcard character instead of the project ID: * `projects/-/serviceAccounts/{EMAIL_ADDRESS}` * `projects/-/serviceAccounts/{UNIQUE_ID}` When possible, avoid using the `-` wildcard character, because it can cause response messages to contain misleading error codes. For example, if you try to access the service account `projects/-/serviceAccounts/fake@example.com`, which does not exist, the response contains an HTTP `403 Forbidden` error instead of a `404 Not Found` error.
31464    ///
31465    /// Sets the *name* path property to the given value.
31466    ///
31467    /// Even though the property as already been set when instantiating this call,
31468    /// we provide this method for API completeness.
31469    pub fn name(mut self, new_value: &str) -> ProjectServiceAccountDeleteCall<'a, C> {
31470        self._name = new_value.to_string();
31471        self
31472    }
31473    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
31474    /// while executing the actual API request.
31475    ///
31476    /// ````text
31477    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
31478    /// ````
31479    ///
31480    /// Sets the *delegate* property to the given value.
31481    pub fn delegate(
31482        mut self,
31483        new_value: &'a mut dyn common::Delegate,
31484    ) -> ProjectServiceAccountDeleteCall<'a, C> {
31485        self._delegate = Some(new_value);
31486        self
31487    }
31488
31489    /// Set any additional parameter of the query string used in the request.
31490    /// It should be used to set parameters which are not yet available through their own
31491    /// setters.
31492    ///
31493    /// Please note that this method must not be used to set any of the known parameters
31494    /// which have their own setter method. If done anyway, the request will fail.
31495    ///
31496    /// # Additional Parameters
31497    ///
31498    /// * *$.xgafv* (query-string) - V1 error format.
31499    /// * *access_token* (query-string) - OAuth access token.
31500    /// * *alt* (query-string) - Data format for response.
31501    /// * *callback* (query-string) - JSONP
31502    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
31503    /// * *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.
31504    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
31505    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
31506    /// * *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.
31507    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
31508    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
31509    pub fn param<T>(mut self, name: T, value: T) -> ProjectServiceAccountDeleteCall<'a, C>
31510    where
31511        T: AsRef<str>,
31512    {
31513        self._additional_params
31514            .insert(name.as_ref().to_string(), value.as_ref().to_string());
31515        self
31516    }
31517
31518    /// Identifies the authorization scope for the method you are building.
31519    ///
31520    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
31521    /// [`Scope::CloudPlatform`].
31522    ///
31523    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
31524    /// tokens for more than one scope.
31525    ///
31526    /// Usually there is more than one suitable scope to authorize an operation, some of which may
31527    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
31528    /// sufficient, a read-write scope will do as well.
31529    pub fn add_scope<St>(mut self, scope: St) -> ProjectServiceAccountDeleteCall<'a, C>
31530    where
31531        St: AsRef<str>,
31532    {
31533        self._scopes.insert(String::from(scope.as_ref()));
31534        self
31535    }
31536    /// Identifies the authorization scope(s) for the method you are building.
31537    ///
31538    /// See [`Self::add_scope()`] for details.
31539    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectServiceAccountDeleteCall<'a, C>
31540    where
31541        I: IntoIterator<Item = St>,
31542        St: AsRef<str>,
31543    {
31544        self._scopes
31545            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
31546        self
31547    }
31548
31549    /// Removes all scopes, and no default scope will be used either.
31550    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
31551    /// for details).
31552    pub fn clear_scopes(mut self) -> ProjectServiceAccountDeleteCall<'a, C> {
31553        self._scopes.clear();
31554        self
31555    }
31556}
31557
31558/// Disables a ServiceAccount immediately. If an application uses the service account to authenticate, that application can no longer call Google APIs or access Google Cloud resources. Existing access tokens for the service account are rejected, and requests for new access tokens will fail. To re-enable the service account, use EnableServiceAccount. After you re-enable the service account, its existing access tokens will be accepted, and you can request new access tokens. To help avoid unplanned outages, we recommend that you disable the service account before you delete it. Use this method to disable the service account, then wait at least 24 hours and watch for unintended consequences. If there are no unintended consequences, you can delete the service account with DeleteServiceAccount.
31559///
31560/// A builder for the *serviceAccounts.disable* method supported by a *project* resource.
31561/// It is not used directly, but through a [`ProjectMethods`] instance.
31562///
31563/// # Example
31564///
31565/// Instantiate a resource method builder
31566///
31567/// ```test_harness,no_run
31568/// # extern crate hyper;
31569/// # extern crate hyper_rustls;
31570/// # extern crate google_iam1 as iam1;
31571/// use iam1::api::DisableServiceAccountRequest;
31572/// # async fn dox() {
31573/// # use iam1::{Iam, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
31574///
31575/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
31576/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
31577/// #     secret,
31578/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
31579/// # ).build().await.unwrap();
31580///
31581/// # let client = hyper_util::client::legacy::Client::builder(
31582/// #     hyper_util::rt::TokioExecutor::new()
31583/// # )
31584/// # .build(
31585/// #     hyper_rustls::HttpsConnectorBuilder::new()
31586/// #         .with_native_roots()
31587/// #         .unwrap()
31588/// #         .https_or_http()
31589/// #         .enable_http1()
31590/// #         .build()
31591/// # );
31592/// # let mut hub = Iam::new(client, auth);
31593/// // As the method needs a request, you would usually fill it with the desired information
31594/// // into the respective structure. Some of the parts shown here might not be applicable !
31595/// // Values shown here are possibly random and not representative !
31596/// let mut req = DisableServiceAccountRequest::default();
31597///
31598/// // You can configure optional parameters by calling the respective setters at will, and
31599/// // execute the final call using `doit()`.
31600/// // Values shown here are possibly random and not representative !
31601/// let result = hub.projects().service_accounts_disable(req, "name")
31602///              .doit().await;
31603/// # }
31604/// ```
31605pub struct ProjectServiceAccountDisableCall<'a, C>
31606where
31607    C: 'a,
31608{
31609    hub: &'a Iam<C>,
31610    _request: DisableServiceAccountRequest,
31611    _name: String,
31612    _delegate: Option<&'a mut dyn common::Delegate>,
31613    _additional_params: HashMap<String, String>,
31614    _scopes: BTreeSet<String>,
31615}
31616
31617impl<'a, C> common::CallBuilder for ProjectServiceAccountDisableCall<'a, C> {}
31618
31619impl<'a, C> ProjectServiceAccountDisableCall<'a, C>
31620where
31621    C: common::Connector,
31622{
31623    /// Perform the operation you have build so far.
31624    pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
31625        use std::borrow::Cow;
31626        use std::io::{Read, Seek};
31627
31628        use common::{url::Params, ToParts};
31629        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
31630
31631        let mut dd = common::DefaultDelegate;
31632        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
31633        dlg.begin(common::MethodInfo {
31634            id: "iam.projects.serviceAccounts.disable",
31635            http_method: hyper::Method::POST,
31636        });
31637
31638        for &field in ["alt", "name"].iter() {
31639            if self._additional_params.contains_key(field) {
31640                dlg.finished(false);
31641                return Err(common::Error::FieldClash(field));
31642            }
31643        }
31644
31645        let mut params = Params::with_capacity(4 + self._additional_params.len());
31646        params.push("name", self._name);
31647
31648        params.extend(self._additional_params.iter());
31649
31650        params.push("alt", "json");
31651        let mut url = self.hub._base_url.clone() + "v1/{+name}:disable";
31652        if self._scopes.is_empty() {
31653            self._scopes
31654                .insert(Scope::CloudPlatform.as_ref().to_string());
31655        }
31656
31657        #[allow(clippy::single_element_loop)]
31658        for &(find_this, param_name) in [("{+name}", "name")].iter() {
31659            url = params.uri_replacement(url, param_name, find_this, true);
31660        }
31661        {
31662            let to_remove = ["name"];
31663            params.remove_params(&to_remove);
31664        }
31665
31666        let url = params.parse_with_url(&url);
31667
31668        let mut json_mime_type = mime::APPLICATION_JSON;
31669        let mut request_value_reader = {
31670            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
31671            common::remove_json_null_values(&mut value);
31672            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
31673            serde_json::to_writer(&mut dst, &value).unwrap();
31674            dst
31675        };
31676        let request_size = request_value_reader
31677            .seek(std::io::SeekFrom::End(0))
31678            .unwrap();
31679        request_value_reader
31680            .seek(std::io::SeekFrom::Start(0))
31681            .unwrap();
31682
31683        loop {
31684            let token = match self
31685                .hub
31686                .auth
31687                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
31688                .await
31689            {
31690                Ok(token) => token,
31691                Err(e) => match dlg.token(e) {
31692                    Ok(token) => token,
31693                    Err(e) => {
31694                        dlg.finished(false);
31695                        return Err(common::Error::MissingToken(e));
31696                    }
31697                },
31698            };
31699            request_value_reader
31700                .seek(std::io::SeekFrom::Start(0))
31701                .unwrap();
31702            let mut req_result = {
31703                let client = &self.hub.client;
31704                dlg.pre_request();
31705                let mut req_builder = hyper::Request::builder()
31706                    .method(hyper::Method::POST)
31707                    .uri(url.as_str())
31708                    .header(USER_AGENT, self.hub._user_agent.clone());
31709
31710                if let Some(token) = token.as_ref() {
31711                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
31712                }
31713
31714                let request = req_builder
31715                    .header(CONTENT_TYPE, json_mime_type.to_string())
31716                    .header(CONTENT_LENGTH, request_size as u64)
31717                    .body(common::to_body(
31718                        request_value_reader.get_ref().clone().into(),
31719                    ));
31720
31721                client.request(request.unwrap()).await
31722            };
31723
31724            match req_result {
31725                Err(err) => {
31726                    if let common::Retry::After(d) = dlg.http_error(&err) {
31727                        sleep(d).await;
31728                        continue;
31729                    }
31730                    dlg.finished(false);
31731                    return Err(common::Error::HttpError(err));
31732                }
31733                Ok(res) => {
31734                    let (mut parts, body) = res.into_parts();
31735                    let mut body = common::Body::new(body);
31736                    if !parts.status.is_success() {
31737                        let bytes = common::to_bytes(body).await.unwrap_or_default();
31738                        let error = serde_json::from_str(&common::to_string(&bytes));
31739                        let response = common::to_response(parts, bytes.into());
31740
31741                        if let common::Retry::After(d) =
31742                            dlg.http_failure(&response, error.as_ref().ok())
31743                        {
31744                            sleep(d).await;
31745                            continue;
31746                        }
31747
31748                        dlg.finished(false);
31749
31750                        return Err(match error {
31751                            Ok(value) => common::Error::BadRequest(value),
31752                            _ => common::Error::Failure(response),
31753                        });
31754                    }
31755                    let response = {
31756                        let bytes = common::to_bytes(body).await.unwrap_or_default();
31757                        let encoded = common::to_string(&bytes);
31758                        match serde_json::from_str(&encoded) {
31759                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
31760                            Err(error) => {
31761                                dlg.response_json_decode_error(&encoded, &error);
31762                                return Err(common::Error::JsonDecodeError(
31763                                    encoded.to_string(),
31764                                    error,
31765                                ));
31766                            }
31767                        }
31768                    };
31769
31770                    dlg.finished(true);
31771                    return Ok(response);
31772                }
31773            }
31774        }
31775    }
31776
31777    ///
31778    /// Sets the *request* property to the given value.
31779    ///
31780    /// Even though the property as already been set when instantiating this call,
31781    /// we provide this method for API completeness.
31782    pub fn request(
31783        mut self,
31784        new_value: DisableServiceAccountRequest,
31785    ) -> ProjectServiceAccountDisableCall<'a, C> {
31786        self._request = new_value;
31787        self
31788    }
31789    /// The resource name of the service account. Use one of the following formats: * `projects/{PROJECT_ID}/serviceAccounts/{EMAIL_ADDRESS}` * `projects/{PROJECT_ID}/serviceAccounts/{UNIQUE_ID}` As an alternative, you can use the `-` wildcard character instead of the project ID: * `projects/-/serviceAccounts/{EMAIL_ADDRESS}` * `projects/-/serviceAccounts/{UNIQUE_ID}` When possible, avoid using the `-` wildcard character, because it can cause response messages to contain misleading error codes. For example, if you try to access the service account `projects/-/serviceAccounts/fake@example.com`, which does not exist, the response contains an HTTP `403 Forbidden` error instead of a `404 Not Found` error.
31790    ///
31791    /// Sets the *name* path property to the given value.
31792    ///
31793    /// Even though the property as already been set when instantiating this call,
31794    /// we provide this method for API completeness.
31795    pub fn name(mut self, new_value: &str) -> ProjectServiceAccountDisableCall<'a, C> {
31796        self._name = new_value.to_string();
31797        self
31798    }
31799    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
31800    /// while executing the actual API request.
31801    ///
31802    /// ````text
31803    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
31804    /// ````
31805    ///
31806    /// Sets the *delegate* property to the given value.
31807    pub fn delegate(
31808        mut self,
31809        new_value: &'a mut dyn common::Delegate,
31810    ) -> ProjectServiceAccountDisableCall<'a, C> {
31811        self._delegate = Some(new_value);
31812        self
31813    }
31814
31815    /// Set any additional parameter of the query string used in the request.
31816    /// It should be used to set parameters which are not yet available through their own
31817    /// setters.
31818    ///
31819    /// Please note that this method must not be used to set any of the known parameters
31820    /// which have their own setter method. If done anyway, the request will fail.
31821    ///
31822    /// # Additional Parameters
31823    ///
31824    /// * *$.xgafv* (query-string) - V1 error format.
31825    /// * *access_token* (query-string) - OAuth access token.
31826    /// * *alt* (query-string) - Data format for response.
31827    /// * *callback* (query-string) - JSONP
31828    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
31829    /// * *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.
31830    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
31831    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
31832    /// * *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.
31833    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
31834    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
31835    pub fn param<T>(mut self, name: T, value: T) -> ProjectServiceAccountDisableCall<'a, C>
31836    where
31837        T: AsRef<str>,
31838    {
31839        self._additional_params
31840            .insert(name.as_ref().to_string(), value.as_ref().to_string());
31841        self
31842    }
31843
31844    /// Identifies the authorization scope for the method you are building.
31845    ///
31846    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
31847    /// [`Scope::CloudPlatform`].
31848    ///
31849    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
31850    /// tokens for more than one scope.
31851    ///
31852    /// Usually there is more than one suitable scope to authorize an operation, some of which may
31853    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
31854    /// sufficient, a read-write scope will do as well.
31855    pub fn add_scope<St>(mut self, scope: St) -> ProjectServiceAccountDisableCall<'a, C>
31856    where
31857        St: AsRef<str>,
31858    {
31859        self._scopes.insert(String::from(scope.as_ref()));
31860        self
31861    }
31862    /// Identifies the authorization scope(s) for the method you are building.
31863    ///
31864    /// See [`Self::add_scope()`] for details.
31865    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectServiceAccountDisableCall<'a, C>
31866    where
31867        I: IntoIterator<Item = St>,
31868        St: AsRef<str>,
31869    {
31870        self._scopes
31871            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
31872        self
31873    }
31874
31875    /// Removes all scopes, and no default scope will be used either.
31876    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
31877    /// for details).
31878    pub fn clear_scopes(mut self) -> ProjectServiceAccountDisableCall<'a, C> {
31879        self._scopes.clear();
31880        self
31881    }
31882}
31883
31884/// Enables a ServiceAccount that was disabled by DisableServiceAccount. If the service account is already enabled, then this method has no effect. If the service account was disabled by other means—for example, if Google disabled the service account because it was compromised—you cannot use this method to enable the service account.
31885///
31886/// A builder for the *serviceAccounts.enable* method supported by a *project* resource.
31887/// It is not used directly, but through a [`ProjectMethods`] instance.
31888///
31889/// # Example
31890///
31891/// Instantiate a resource method builder
31892///
31893/// ```test_harness,no_run
31894/// # extern crate hyper;
31895/// # extern crate hyper_rustls;
31896/// # extern crate google_iam1 as iam1;
31897/// use iam1::api::EnableServiceAccountRequest;
31898/// # async fn dox() {
31899/// # use iam1::{Iam, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
31900///
31901/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
31902/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
31903/// #     secret,
31904/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
31905/// # ).build().await.unwrap();
31906///
31907/// # let client = hyper_util::client::legacy::Client::builder(
31908/// #     hyper_util::rt::TokioExecutor::new()
31909/// # )
31910/// # .build(
31911/// #     hyper_rustls::HttpsConnectorBuilder::new()
31912/// #         .with_native_roots()
31913/// #         .unwrap()
31914/// #         .https_or_http()
31915/// #         .enable_http1()
31916/// #         .build()
31917/// # );
31918/// # let mut hub = Iam::new(client, auth);
31919/// // As the method needs a request, you would usually fill it with the desired information
31920/// // into the respective structure. Some of the parts shown here might not be applicable !
31921/// // Values shown here are possibly random and not representative !
31922/// let mut req = EnableServiceAccountRequest::default();
31923///
31924/// // You can configure optional parameters by calling the respective setters at will, and
31925/// // execute the final call using `doit()`.
31926/// // Values shown here are possibly random and not representative !
31927/// let result = hub.projects().service_accounts_enable(req, "name")
31928///              .doit().await;
31929/// # }
31930/// ```
31931pub struct ProjectServiceAccountEnableCall<'a, C>
31932where
31933    C: 'a,
31934{
31935    hub: &'a Iam<C>,
31936    _request: EnableServiceAccountRequest,
31937    _name: String,
31938    _delegate: Option<&'a mut dyn common::Delegate>,
31939    _additional_params: HashMap<String, String>,
31940    _scopes: BTreeSet<String>,
31941}
31942
31943impl<'a, C> common::CallBuilder for ProjectServiceAccountEnableCall<'a, C> {}
31944
31945impl<'a, C> ProjectServiceAccountEnableCall<'a, C>
31946where
31947    C: common::Connector,
31948{
31949    /// Perform the operation you have build so far.
31950    pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
31951        use std::borrow::Cow;
31952        use std::io::{Read, Seek};
31953
31954        use common::{url::Params, ToParts};
31955        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
31956
31957        let mut dd = common::DefaultDelegate;
31958        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
31959        dlg.begin(common::MethodInfo {
31960            id: "iam.projects.serviceAccounts.enable",
31961            http_method: hyper::Method::POST,
31962        });
31963
31964        for &field in ["alt", "name"].iter() {
31965            if self._additional_params.contains_key(field) {
31966                dlg.finished(false);
31967                return Err(common::Error::FieldClash(field));
31968            }
31969        }
31970
31971        let mut params = Params::with_capacity(4 + self._additional_params.len());
31972        params.push("name", self._name);
31973
31974        params.extend(self._additional_params.iter());
31975
31976        params.push("alt", "json");
31977        let mut url = self.hub._base_url.clone() + "v1/{+name}:enable";
31978        if self._scopes.is_empty() {
31979            self._scopes
31980                .insert(Scope::CloudPlatform.as_ref().to_string());
31981        }
31982
31983        #[allow(clippy::single_element_loop)]
31984        for &(find_this, param_name) in [("{+name}", "name")].iter() {
31985            url = params.uri_replacement(url, param_name, find_this, true);
31986        }
31987        {
31988            let to_remove = ["name"];
31989            params.remove_params(&to_remove);
31990        }
31991
31992        let url = params.parse_with_url(&url);
31993
31994        let mut json_mime_type = mime::APPLICATION_JSON;
31995        let mut request_value_reader = {
31996            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
31997            common::remove_json_null_values(&mut value);
31998            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
31999            serde_json::to_writer(&mut dst, &value).unwrap();
32000            dst
32001        };
32002        let request_size = request_value_reader
32003            .seek(std::io::SeekFrom::End(0))
32004            .unwrap();
32005        request_value_reader
32006            .seek(std::io::SeekFrom::Start(0))
32007            .unwrap();
32008
32009        loop {
32010            let token = match self
32011                .hub
32012                .auth
32013                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
32014                .await
32015            {
32016                Ok(token) => token,
32017                Err(e) => match dlg.token(e) {
32018                    Ok(token) => token,
32019                    Err(e) => {
32020                        dlg.finished(false);
32021                        return Err(common::Error::MissingToken(e));
32022                    }
32023                },
32024            };
32025            request_value_reader
32026                .seek(std::io::SeekFrom::Start(0))
32027                .unwrap();
32028            let mut req_result = {
32029                let client = &self.hub.client;
32030                dlg.pre_request();
32031                let mut req_builder = hyper::Request::builder()
32032                    .method(hyper::Method::POST)
32033                    .uri(url.as_str())
32034                    .header(USER_AGENT, self.hub._user_agent.clone());
32035
32036                if let Some(token) = token.as_ref() {
32037                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
32038                }
32039
32040                let request = req_builder
32041                    .header(CONTENT_TYPE, json_mime_type.to_string())
32042                    .header(CONTENT_LENGTH, request_size as u64)
32043                    .body(common::to_body(
32044                        request_value_reader.get_ref().clone().into(),
32045                    ));
32046
32047                client.request(request.unwrap()).await
32048            };
32049
32050            match req_result {
32051                Err(err) => {
32052                    if let common::Retry::After(d) = dlg.http_error(&err) {
32053                        sleep(d).await;
32054                        continue;
32055                    }
32056                    dlg.finished(false);
32057                    return Err(common::Error::HttpError(err));
32058                }
32059                Ok(res) => {
32060                    let (mut parts, body) = res.into_parts();
32061                    let mut body = common::Body::new(body);
32062                    if !parts.status.is_success() {
32063                        let bytes = common::to_bytes(body).await.unwrap_or_default();
32064                        let error = serde_json::from_str(&common::to_string(&bytes));
32065                        let response = common::to_response(parts, bytes.into());
32066
32067                        if let common::Retry::After(d) =
32068                            dlg.http_failure(&response, error.as_ref().ok())
32069                        {
32070                            sleep(d).await;
32071                            continue;
32072                        }
32073
32074                        dlg.finished(false);
32075
32076                        return Err(match error {
32077                            Ok(value) => common::Error::BadRequest(value),
32078                            _ => common::Error::Failure(response),
32079                        });
32080                    }
32081                    let response = {
32082                        let bytes = common::to_bytes(body).await.unwrap_or_default();
32083                        let encoded = common::to_string(&bytes);
32084                        match serde_json::from_str(&encoded) {
32085                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
32086                            Err(error) => {
32087                                dlg.response_json_decode_error(&encoded, &error);
32088                                return Err(common::Error::JsonDecodeError(
32089                                    encoded.to_string(),
32090                                    error,
32091                                ));
32092                            }
32093                        }
32094                    };
32095
32096                    dlg.finished(true);
32097                    return Ok(response);
32098                }
32099            }
32100        }
32101    }
32102
32103    ///
32104    /// Sets the *request* property to the given value.
32105    ///
32106    /// Even though the property as already been set when instantiating this call,
32107    /// we provide this method for API completeness.
32108    pub fn request(
32109        mut self,
32110        new_value: EnableServiceAccountRequest,
32111    ) -> ProjectServiceAccountEnableCall<'a, C> {
32112        self._request = new_value;
32113        self
32114    }
32115    /// The resource name of the service account. Use one of the following formats: * `projects/{PROJECT_ID}/serviceAccounts/{EMAIL_ADDRESS}` * `projects/{PROJECT_ID}/serviceAccounts/{UNIQUE_ID}` As an alternative, you can use the `-` wildcard character instead of the project ID: * `projects/-/serviceAccounts/{EMAIL_ADDRESS}` * `projects/-/serviceAccounts/{UNIQUE_ID}` When possible, avoid using the `-` wildcard character, because it can cause response messages to contain misleading error codes. For example, if you try to access the service account `projects/-/serviceAccounts/fake@example.com`, which does not exist, the response contains an HTTP `403 Forbidden` error instead of a `404 Not Found` error.
32116    ///
32117    /// Sets the *name* path property to the given value.
32118    ///
32119    /// Even though the property as already been set when instantiating this call,
32120    /// we provide this method for API completeness.
32121    pub fn name(mut self, new_value: &str) -> ProjectServiceAccountEnableCall<'a, C> {
32122        self._name = new_value.to_string();
32123        self
32124    }
32125    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
32126    /// while executing the actual API request.
32127    ///
32128    /// ````text
32129    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
32130    /// ````
32131    ///
32132    /// Sets the *delegate* property to the given value.
32133    pub fn delegate(
32134        mut self,
32135        new_value: &'a mut dyn common::Delegate,
32136    ) -> ProjectServiceAccountEnableCall<'a, C> {
32137        self._delegate = Some(new_value);
32138        self
32139    }
32140
32141    /// Set any additional parameter of the query string used in the request.
32142    /// It should be used to set parameters which are not yet available through their own
32143    /// setters.
32144    ///
32145    /// Please note that this method must not be used to set any of the known parameters
32146    /// which have their own setter method. If done anyway, the request will fail.
32147    ///
32148    /// # Additional Parameters
32149    ///
32150    /// * *$.xgafv* (query-string) - V1 error format.
32151    /// * *access_token* (query-string) - OAuth access token.
32152    /// * *alt* (query-string) - Data format for response.
32153    /// * *callback* (query-string) - JSONP
32154    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
32155    /// * *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.
32156    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
32157    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
32158    /// * *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.
32159    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
32160    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
32161    pub fn param<T>(mut self, name: T, value: T) -> ProjectServiceAccountEnableCall<'a, C>
32162    where
32163        T: AsRef<str>,
32164    {
32165        self._additional_params
32166            .insert(name.as_ref().to_string(), value.as_ref().to_string());
32167        self
32168    }
32169
32170    /// Identifies the authorization scope for the method you are building.
32171    ///
32172    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
32173    /// [`Scope::CloudPlatform`].
32174    ///
32175    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
32176    /// tokens for more than one scope.
32177    ///
32178    /// Usually there is more than one suitable scope to authorize an operation, some of which may
32179    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
32180    /// sufficient, a read-write scope will do as well.
32181    pub fn add_scope<St>(mut self, scope: St) -> ProjectServiceAccountEnableCall<'a, C>
32182    where
32183        St: AsRef<str>,
32184    {
32185        self._scopes.insert(String::from(scope.as_ref()));
32186        self
32187    }
32188    /// Identifies the authorization scope(s) for the method you are building.
32189    ///
32190    /// See [`Self::add_scope()`] for details.
32191    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectServiceAccountEnableCall<'a, C>
32192    where
32193        I: IntoIterator<Item = St>,
32194        St: AsRef<str>,
32195    {
32196        self._scopes
32197            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
32198        self
32199    }
32200
32201    /// Removes all scopes, and no default scope will be used either.
32202    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
32203    /// for details).
32204    pub fn clear_scopes(mut self) -> ProjectServiceAccountEnableCall<'a, C> {
32205        self._scopes.clear();
32206        self
32207    }
32208}
32209
32210/// Gets a ServiceAccount.
32211///
32212/// A builder for the *serviceAccounts.get* method supported by a *project* resource.
32213/// It is not used directly, but through a [`ProjectMethods`] instance.
32214///
32215/// # Example
32216///
32217/// Instantiate a resource method builder
32218///
32219/// ```test_harness,no_run
32220/// # extern crate hyper;
32221/// # extern crate hyper_rustls;
32222/// # extern crate google_iam1 as iam1;
32223/// # async fn dox() {
32224/// # use iam1::{Iam, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
32225///
32226/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
32227/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
32228/// #     secret,
32229/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
32230/// # ).build().await.unwrap();
32231///
32232/// # let client = hyper_util::client::legacy::Client::builder(
32233/// #     hyper_util::rt::TokioExecutor::new()
32234/// # )
32235/// # .build(
32236/// #     hyper_rustls::HttpsConnectorBuilder::new()
32237/// #         .with_native_roots()
32238/// #         .unwrap()
32239/// #         .https_or_http()
32240/// #         .enable_http1()
32241/// #         .build()
32242/// # );
32243/// # let mut hub = Iam::new(client, auth);
32244/// // You can configure optional parameters by calling the respective setters at will, and
32245/// // execute the final call using `doit()`.
32246/// // Values shown here are possibly random and not representative !
32247/// let result = hub.projects().service_accounts_get("name")
32248///              .doit().await;
32249/// # }
32250/// ```
32251pub struct ProjectServiceAccountGetCall<'a, C>
32252where
32253    C: 'a,
32254{
32255    hub: &'a Iam<C>,
32256    _name: String,
32257    _delegate: Option<&'a mut dyn common::Delegate>,
32258    _additional_params: HashMap<String, String>,
32259    _scopes: BTreeSet<String>,
32260}
32261
32262impl<'a, C> common::CallBuilder for ProjectServiceAccountGetCall<'a, C> {}
32263
32264impl<'a, C> ProjectServiceAccountGetCall<'a, C>
32265where
32266    C: common::Connector,
32267{
32268    /// Perform the operation you have build so far.
32269    pub async fn doit(mut self) -> common::Result<(common::Response, ServiceAccount)> {
32270        use std::borrow::Cow;
32271        use std::io::{Read, Seek};
32272
32273        use common::{url::Params, ToParts};
32274        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
32275
32276        let mut dd = common::DefaultDelegate;
32277        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
32278        dlg.begin(common::MethodInfo {
32279            id: "iam.projects.serviceAccounts.get",
32280            http_method: hyper::Method::GET,
32281        });
32282
32283        for &field in ["alt", "name"].iter() {
32284            if self._additional_params.contains_key(field) {
32285                dlg.finished(false);
32286                return Err(common::Error::FieldClash(field));
32287            }
32288        }
32289
32290        let mut params = Params::with_capacity(3 + self._additional_params.len());
32291        params.push("name", self._name);
32292
32293        params.extend(self._additional_params.iter());
32294
32295        params.push("alt", "json");
32296        let mut url = self.hub._base_url.clone() + "v1/{+name}";
32297        if self._scopes.is_empty() {
32298            self._scopes
32299                .insert(Scope::CloudPlatform.as_ref().to_string());
32300        }
32301
32302        #[allow(clippy::single_element_loop)]
32303        for &(find_this, param_name) in [("{+name}", "name")].iter() {
32304            url = params.uri_replacement(url, param_name, find_this, true);
32305        }
32306        {
32307            let to_remove = ["name"];
32308            params.remove_params(&to_remove);
32309        }
32310
32311        let url = params.parse_with_url(&url);
32312
32313        loop {
32314            let token = match self
32315                .hub
32316                .auth
32317                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
32318                .await
32319            {
32320                Ok(token) => token,
32321                Err(e) => match dlg.token(e) {
32322                    Ok(token) => token,
32323                    Err(e) => {
32324                        dlg.finished(false);
32325                        return Err(common::Error::MissingToken(e));
32326                    }
32327                },
32328            };
32329            let mut req_result = {
32330                let client = &self.hub.client;
32331                dlg.pre_request();
32332                let mut req_builder = hyper::Request::builder()
32333                    .method(hyper::Method::GET)
32334                    .uri(url.as_str())
32335                    .header(USER_AGENT, self.hub._user_agent.clone());
32336
32337                if let Some(token) = token.as_ref() {
32338                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
32339                }
32340
32341                let request = req_builder
32342                    .header(CONTENT_LENGTH, 0_u64)
32343                    .body(common::to_body::<String>(None));
32344
32345                client.request(request.unwrap()).await
32346            };
32347
32348            match req_result {
32349                Err(err) => {
32350                    if let common::Retry::After(d) = dlg.http_error(&err) {
32351                        sleep(d).await;
32352                        continue;
32353                    }
32354                    dlg.finished(false);
32355                    return Err(common::Error::HttpError(err));
32356                }
32357                Ok(res) => {
32358                    let (mut parts, body) = res.into_parts();
32359                    let mut body = common::Body::new(body);
32360                    if !parts.status.is_success() {
32361                        let bytes = common::to_bytes(body).await.unwrap_or_default();
32362                        let error = serde_json::from_str(&common::to_string(&bytes));
32363                        let response = common::to_response(parts, bytes.into());
32364
32365                        if let common::Retry::After(d) =
32366                            dlg.http_failure(&response, error.as_ref().ok())
32367                        {
32368                            sleep(d).await;
32369                            continue;
32370                        }
32371
32372                        dlg.finished(false);
32373
32374                        return Err(match error {
32375                            Ok(value) => common::Error::BadRequest(value),
32376                            _ => common::Error::Failure(response),
32377                        });
32378                    }
32379                    let response = {
32380                        let bytes = common::to_bytes(body).await.unwrap_or_default();
32381                        let encoded = common::to_string(&bytes);
32382                        match serde_json::from_str(&encoded) {
32383                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
32384                            Err(error) => {
32385                                dlg.response_json_decode_error(&encoded, &error);
32386                                return Err(common::Error::JsonDecodeError(
32387                                    encoded.to_string(),
32388                                    error,
32389                                ));
32390                            }
32391                        }
32392                    };
32393
32394                    dlg.finished(true);
32395                    return Ok(response);
32396                }
32397            }
32398        }
32399    }
32400
32401    /// Required. The resource name of the service account. Use one of the following formats: * `projects/{PROJECT_ID}/serviceAccounts/{EMAIL_ADDRESS}` * `projects/{PROJECT_ID}/serviceAccounts/{UNIQUE_ID}` As an alternative, you can use the `-` wildcard character instead of the project ID: * `projects/-/serviceAccounts/{EMAIL_ADDRESS}` * `projects/-/serviceAccounts/{UNIQUE_ID}` When possible, avoid using the `-` wildcard character, because it can cause response messages to contain misleading error codes. For example, if you try to access the service account `projects/-/serviceAccounts/fake@example.com`, which does not exist, the response contains an HTTP `403 Forbidden` error instead of a `404 Not Found` error.
32402    ///
32403    /// Sets the *name* path property to the given value.
32404    ///
32405    /// Even though the property as already been set when instantiating this call,
32406    /// we provide this method for API completeness.
32407    pub fn name(mut self, new_value: &str) -> ProjectServiceAccountGetCall<'a, C> {
32408        self._name = new_value.to_string();
32409        self
32410    }
32411    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
32412    /// while executing the actual API request.
32413    ///
32414    /// ````text
32415    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
32416    /// ````
32417    ///
32418    /// Sets the *delegate* property to the given value.
32419    pub fn delegate(
32420        mut self,
32421        new_value: &'a mut dyn common::Delegate,
32422    ) -> ProjectServiceAccountGetCall<'a, C> {
32423        self._delegate = Some(new_value);
32424        self
32425    }
32426
32427    /// Set any additional parameter of the query string used in the request.
32428    /// It should be used to set parameters which are not yet available through their own
32429    /// setters.
32430    ///
32431    /// Please note that this method must not be used to set any of the known parameters
32432    /// which have their own setter method. If done anyway, the request will fail.
32433    ///
32434    /// # Additional Parameters
32435    ///
32436    /// * *$.xgafv* (query-string) - V1 error format.
32437    /// * *access_token* (query-string) - OAuth access token.
32438    /// * *alt* (query-string) - Data format for response.
32439    /// * *callback* (query-string) - JSONP
32440    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
32441    /// * *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.
32442    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
32443    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
32444    /// * *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.
32445    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
32446    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
32447    pub fn param<T>(mut self, name: T, value: T) -> ProjectServiceAccountGetCall<'a, C>
32448    where
32449        T: AsRef<str>,
32450    {
32451        self._additional_params
32452            .insert(name.as_ref().to_string(), value.as_ref().to_string());
32453        self
32454    }
32455
32456    /// Identifies the authorization scope for the method you are building.
32457    ///
32458    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
32459    /// [`Scope::CloudPlatform`].
32460    ///
32461    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
32462    /// tokens for more than one scope.
32463    ///
32464    /// Usually there is more than one suitable scope to authorize an operation, some of which may
32465    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
32466    /// sufficient, a read-write scope will do as well.
32467    pub fn add_scope<St>(mut self, scope: St) -> ProjectServiceAccountGetCall<'a, C>
32468    where
32469        St: AsRef<str>,
32470    {
32471        self._scopes.insert(String::from(scope.as_ref()));
32472        self
32473    }
32474    /// Identifies the authorization scope(s) for the method you are building.
32475    ///
32476    /// See [`Self::add_scope()`] for details.
32477    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectServiceAccountGetCall<'a, C>
32478    where
32479        I: IntoIterator<Item = St>,
32480        St: AsRef<str>,
32481    {
32482        self._scopes
32483            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
32484        self
32485    }
32486
32487    /// Removes all scopes, and no default scope will be used either.
32488    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
32489    /// for details).
32490    pub fn clear_scopes(mut self) -> ProjectServiceAccountGetCall<'a, C> {
32491        self._scopes.clear();
32492        self
32493    }
32494}
32495
32496/// Gets the IAM policy that is attached to a ServiceAccount. This IAM policy specifies which principals have access to the service account. This method does not tell you whether the service account has been granted any roles on other resources. To check whether a service account has role grants on a resource, use the `getIamPolicy` method for that resource. For example, to view the role grants for a project, call the Resource Manager API's [projects.getIamPolicy](https://cloud.google.com/resource-manager/reference/rest/v1/projects/getIamPolicy) method.
32497///
32498/// A builder for the *serviceAccounts.getIamPolicy* method supported by a *project* resource.
32499/// It is not used directly, but through a [`ProjectMethods`] instance.
32500///
32501/// # Example
32502///
32503/// Instantiate a resource method builder
32504///
32505/// ```test_harness,no_run
32506/// # extern crate hyper;
32507/// # extern crate hyper_rustls;
32508/// # extern crate google_iam1 as iam1;
32509/// # async fn dox() {
32510/// # use iam1::{Iam, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
32511///
32512/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
32513/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
32514/// #     secret,
32515/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
32516/// # ).build().await.unwrap();
32517///
32518/// # let client = hyper_util::client::legacy::Client::builder(
32519/// #     hyper_util::rt::TokioExecutor::new()
32520/// # )
32521/// # .build(
32522/// #     hyper_rustls::HttpsConnectorBuilder::new()
32523/// #         .with_native_roots()
32524/// #         .unwrap()
32525/// #         .https_or_http()
32526/// #         .enable_http1()
32527/// #         .build()
32528/// # );
32529/// # let mut hub = Iam::new(client, auth);
32530/// // You can configure optional parameters by calling the respective setters at will, and
32531/// // execute the final call using `doit()`.
32532/// // Values shown here are possibly random and not representative !
32533/// let result = hub.projects().service_accounts_get_iam_policy("resource")
32534///              .options_requested_policy_version(-46)
32535///              .doit().await;
32536/// # }
32537/// ```
32538pub struct ProjectServiceAccountGetIamPolicyCall<'a, C>
32539where
32540    C: 'a,
32541{
32542    hub: &'a Iam<C>,
32543    _resource: String,
32544    _options_requested_policy_version: Option<i32>,
32545    _delegate: Option<&'a mut dyn common::Delegate>,
32546    _additional_params: HashMap<String, String>,
32547    _scopes: BTreeSet<String>,
32548}
32549
32550impl<'a, C> common::CallBuilder for ProjectServiceAccountGetIamPolicyCall<'a, C> {}
32551
32552impl<'a, C> ProjectServiceAccountGetIamPolicyCall<'a, C>
32553where
32554    C: common::Connector,
32555{
32556    /// Perform the operation you have build so far.
32557    pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
32558        use std::borrow::Cow;
32559        use std::io::{Read, Seek};
32560
32561        use common::{url::Params, ToParts};
32562        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
32563
32564        let mut dd = common::DefaultDelegate;
32565        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
32566        dlg.begin(common::MethodInfo {
32567            id: "iam.projects.serviceAccounts.getIamPolicy",
32568            http_method: hyper::Method::POST,
32569        });
32570
32571        for &field in ["alt", "resource", "options.requestedPolicyVersion"].iter() {
32572            if self._additional_params.contains_key(field) {
32573                dlg.finished(false);
32574                return Err(common::Error::FieldClash(field));
32575            }
32576        }
32577
32578        let mut params = Params::with_capacity(4 + self._additional_params.len());
32579        params.push("resource", self._resource);
32580        if let Some(value) = self._options_requested_policy_version.as_ref() {
32581            params.push("options.requestedPolicyVersion", value.to_string());
32582        }
32583
32584        params.extend(self._additional_params.iter());
32585
32586        params.push("alt", "json");
32587        let mut url = self.hub._base_url.clone() + "v1/{+resource}:getIamPolicy";
32588        if self._scopes.is_empty() {
32589            self._scopes
32590                .insert(Scope::CloudPlatform.as_ref().to_string());
32591        }
32592
32593        #[allow(clippy::single_element_loop)]
32594        for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
32595            url = params.uri_replacement(url, param_name, find_this, true);
32596        }
32597        {
32598            let to_remove = ["resource"];
32599            params.remove_params(&to_remove);
32600        }
32601
32602        let url = params.parse_with_url(&url);
32603
32604        loop {
32605            let token = match self
32606                .hub
32607                .auth
32608                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
32609                .await
32610            {
32611                Ok(token) => token,
32612                Err(e) => match dlg.token(e) {
32613                    Ok(token) => token,
32614                    Err(e) => {
32615                        dlg.finished(false);
32616                        return Err(common::Error::MissingToken(e));
32617                    }
32618                },
32619            };
32620            let mut req_result = {
32621                let client = &self.hub.client;
32622                dlg.pre_request();
32623                let mut req_builder = hyper::Request::builder()
32624                    .method(hyper::Method::POST)
32625                    .uri(url.as_str())
32626                    .header(USER_AGENT, self.hub._user_agent.clone());
32627
32628                if let Some(token) = token.as_ref() {
32629                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
32630                }
32631
32632                let request = req_builder
32633                    .header(CONTENT_LENGTH, 0_u64)
32634                    .body(common::to_body::<String>(None));
32635
32636                client.request(request.unwrap()).await
32637            };
32638
32639            match req_result {
32640                Err(err) => {
32641                    if let common::Retry::After(d) = dlg.http_error(&err) {
32642                        sleep(d).await;
32643                        continue;
32644                    }
32645                    dlg.finished(false);
32646                    return Err(common::Error::HttpError(err));
32647                }
32648                Ok(res) => {
32649                    let (mut parts, body) = res.into_parts();
32650                    let mut body = common::Body::new(body);
32651                    if !parts.status.is_success() {
32652                        let bytes = common::to_bytes(body).await.unwrap_or_default();
32653                        let error = serde_json::from_str(&common::to_string(&bytes));
32654                        let response = common::to_response(parts, bytes.into());
32655
32656                        if let common::Retry::After(d) =
32657                            dlg.http_failure(&response, error.as_ref().ok())
32658                        {
32659                            sleep(d).await;
32660                            continue;
32661                        }
32662
32663                        dlg.finished(false);
32664
32665                        return Err(match error {
32666                            Ok(value) => common::Error::BadRequest(value),
32667                            _ => common::Error::Failure(response),
32668                        });
32669                    }
32670                    let response = {
32671                        let bytes = common::to_bytes(body).await.unwrap_or_default();
32672                        let encoded = common::to_string(&bytes);
32673                        match serde_json::from_str(&encoded) {
32674                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
32675                            Err(error) => {
32676                                dlg.response_json_decode_error(&encoded, &error);
32677                                return Err(common::Error::JsonDecodeError(
32678                                    encoded.to_string(),
32679                                    error,
32680                                ));
32681                            }
32682                        }
32683                    };
32684
32685                    dlg.finished(true);
32686                    return Ok(response);
32687                }
32688            }
32689        }
32690    }
32691
32692    /// REQUIRED: The resource for which the policy is being requested. See [Resource names](https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
32693    ///
32694    /// Sets the *resource* path property to the given value.
32695    ///
32696    /// Even though the property as already been set when instantiating this call,
32697    /// we provide this method for API completeness.
32698    pub fn resource(mut self, new_value: &str) -> ProjectServiceAccountGetIamPolicyCall<'a, C> {
32699        self._resource = new_value.to_string();
32700        self
32701    }
32702    /// Optional. The maximum policy version that will be used to format the policy. Valid values are 0, 1, and 3. Requests specifying an invalid value will be rejected. Requests for policies with any conditional role bindings must specify version 3. Policies with no conditional role bindings may specify any valid value or leave the field unset. The policy in the response might use the policy version that you specified, or it might use a lower policy version. For example, if you specify version 3, but the policy has no conditional role bindings, the response uses version 1. To learn which resources support conditions in their IAM policies, see the [IAM documentation](https://cloud.google.com/iam/help/conditions/resource-policies).
32703    ///
32704    /// Sets the *options.requested policy version* query property to the given value.
32705    pub fn options_requested_policy_version(
32706        mut self,
32707        new_value: i32,
32708    ) -> ProjectServiceAccountGetIamPolicyCall<'a, C> {
32709        self._options_requested_policy_version = Some(new_value);
32710        self
32711    }
32712    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
32713    /// while executing the actual API request.
32714    ///
32715    /// ````text
32716    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
32717    /// ````
32718    ///
32719    /// Sets the *delegate* property to the given value.
32720    pub fn delegate(
32721        mut self,
32722        new_value: &'a mut dyn common::Delegate,
32723    ) -> ProjectServiceAccountGetIamPolicyCall<'a, C> {
32724        self._delegate = Some(new_value);
32725        self
32726    }
32727
32728    /// Set any additional parameter of the query string used in the request.
32729    /// It should be used to set parameters which are not yet available through their own
32730    /// setters.
32731    ///
32732    /// Please note that this method must not be used to set any of the known parameters
32733    /// which have their own setter method. If done anyway, the request will fail.
32734    ///
32735    /// # Additional Parameters
32736    ///
32737    /// * *$.xgafv* (query-string) - V1 error format.
32738    /// * *access_token* (query-string) - OAuth access token.
32739    /// * *alt* (query-string) - Data format for response.
32740    /// * *callback* (query-string) - JSONP
32741    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
32742    /// * *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.
32743    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
32744    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
32745    /// * *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.
32746    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
32747    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
32748    pub fn param<T>(mut self, name: T, value: T) -> ProjectServiceAccountGetIamPolicyCall<'a, C>
32749    where
32750        T: AsRef<str>,
32751    {
32752        self._additional_params
32753            .insert(name.as_ref().to_string(), value.as_ref().to_string());
32754        self
32755    }
32756
32757    /// Identifies the authorization scope for the method you are building.
32758    ///
32759    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
32760    /// [`Scope::CloudPlatform`].
32761    ///
32762    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
32763    /// tokens for more than one scope.
32764    ///
32765    /// Usually there is more than one suitable scope to authorize an operation, some of which may
32766    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
32767    /// sufficient, a read-write scope will do as well.
32768    pub fn add_scope<St>(mut self, scope: St) -> ProjectServiceAccountGetIamPolicyCall<'a, C>
32769    where
32770        St: AsRef<str>,
32771    {
32772        self._scopes.insert(String::from(scope.as_ref()));
32773        self
32774    }
32775    /// Identifies the authorization scope(s) for the method you are building.
32776    ///
32777    /// See [`Self::add_scope()`] for details.
32778    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectServiceAccountGetIamPolicyCall<'a, C>
32779    where
32780        I: IntoIterator<Item = St>,
32781        St: AsRef<str>,
32782    {
32783        self._scopes
32784            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
32785        self
32786    }
32787
32788    /// Removes all scopes, and no default scope will be used either.
32789    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
32790    /// for details).
32791    pub fn clear_scopes(mut self) -> ProjectServiceAccountGetIamPolicyCall<'a, C> {
32792        self._scopes.clear();
32793        self
32794    }
32795}
32796
32797/// Lists every ServiceAccount that belongs to a specific project.
32798///
32799/// A builder for the *serviceAccounts.list* method supported by a *project* resource.
32800/// It is not used directly, but through a [`ProjectMethods`] instance.
32801///
32802/// # Example
32803///
32804/// Instantiate a resource method builder
32805///
32806/// ```test_harness,no_run
32807/// # extern crate hyper;
32808/// # extern crate hyper_rustls;
32809/// # extern crate google_iam1 as iam1;
32810/// # async fn dox() {
32811/// # use iam1::{Iam, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
32812///
32813/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
32814/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
32815/// #     secret,
32816/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
32817/// # ).build().await.unwrap();
32818///
32819/// # let client = hyper_util::client::legacy::Client::builder(
32820/// #     hyper_util::rt::TokioExecutor::new()
32821/// # )
32822/// # .build(
32823/// #     hyper_rustls::HttpsConnectorBuilder::new()
32824/// #         .with_native_roots()
32825/// #         .unwrap()
32826/// #         .https_or_http()
32827/// #         .enable_http1()
32828/// #         .build()
32829/// # );
32830/// # let mut hub = Iam::new(client, auth);
32831/// // You can configure optional parameters by calling the respective setters at will, and
32832/// // execute the final call using `doit()`.
32833/// // Values shown here are possibly random and not representative !
32834/// let result = hub.projects().service_accounts_list("name")
32835///              .page_token("est")
32836///              .page_size(-82)
32837///              .doit().await;
32838/// # }
32839/// ```
32840pub struct ProjectServiceAccountListCall<'a, C>
32841where
32842    C: 'a,
32843{
32844    hub: &'a Iam<C>,
32845    _name: String,
32846    _page_token: Option<String>,
32847    _page_size: Option<i32>,
32848    _delegate: Option<&'a mut dyn common::Delegate>,
32849    _additional_params: HashMap<String, String>,
32850    _scopes: BTreeSet<String>,
32851}
32852
32853impl<'a, C> common::CallBuilder for ProjectServiceAccountListCall<'a, C> {}
32854
32855impl<'a, C> ProjectServiceAccountListCall<'a, C>
32856where
32857    C: common::Connector,
32858{
32859    /// Perform the operation you have build so far.
32860    pub async fn doit(mut self) -> common::Result<(common::Response, ListServiceAccountsResponse)> {
32861        use std::borrow::Cow;
32862        use std::io::{Read, Seek};
32863
32864        use common::{url::Params, ToParts};
32865        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
32866
32867        let mut dd = common::DefaultDelegate;
32868        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
32869        dlg.begin(common::MethodInfo {
32870            id: "iam.projects.serviceAccounts.list",
32871            http_method: hyper::Method::GET,
32872        });
32873
32874        for &field in ["alt", "name", "pageToken", "pageSize"].iter() {
32875            if self._additional_params.contains_key(field) {
32876                dlg.finished(false);
32877                return Err(common::Error::FieldClash(field));
32878            }
32879        }
32880
32881        let mut params = Params::with_capacity(5 + self._additional_params.len());
32882        params.push("name", self._name);
32883        if let Some(value) = self._page_token.as_ref() {
32884            params.push("pageToken", value);
32885        }
32886        if let Some(value) = self._page_size.as_ref() {
32887            params.push("pageSize", value.to_string());
32888        }
32889
32890        params.extend(self._additional_params.iter());
32891
32892        params.push("alt", "json");
32893        let mut url = self.hub._base_url.clone() + "v1/{+name}/serviceAccounts";
32894        if self._scopes.is_empty() {
32895            self._scopes
32896                .insert(Scope::CloudPlatform.as_ref().to_string());
32897        }
32898
32899        #[allow(clippy::single_element_loop)]
32900        for &(find_this, param_name) in [("{+name}", "name")].iter() {
32901            url = params.uri_replacement(url, param_name, find_this, true);
32902        }
32903        {
32904            let to_remove = ["name"];
32905            params.remove_params(&to_remove);
32906        }
32907
32908        let url = params.parse_with_url(&url);
32909
32910        loop {
32911            let token = match self
32912                .hub
32913                .auth
32914                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
32915                .await
32916            {
32917                Ok(token) => token,
32918                Err(e) => match dlg.token(e) {
32919                    Ok(token) => token,
32920                    Err(e) => {
32921                        dlg.finished(false);
32922                        return Err(common::Error::MissingToken(e));
32923                    }
32924                },
32925            };
32926            let mut req_result = {
32927                let client = &self.hub.client;
32928                dlg.pre_request();
32929                let mut req_builder = hyper::Request::builder()
32930                    .method(hyper::Method::GET)
32931                    .uri(url.as_str())
32932                    .header(USER_AGENT, self.hub._user_agent.clone());
32933
32934                if let Some(token) = token.as_ref() {
32935                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
32936                }
32937
32938                let request = req_builder
32939                    .header(CONTENT_LENGTH, 0_u64)
32940                    .body(common::to_body::<String>(None));
32941
32942                client.request(request.unwrap()).await
32943            };
32944
32945            match req_result {
32946                Err(err) => {
32947                    if let common::Retry::After(d) = dlg.http_error(&err) {
32948                        sleep(d).await;
32949                        continue;
32950                    }
32951                    dlg.finished(false);
32952                    return Err(common::Error::HttpError(err));
32953                }
32954                Ok(res) => {
32955                    let (mut parts, body) = res.into_parts();
32956                    let mut body = common::Body::new(body);
32957                    if !parts.status.is_success() {
32958                        let bytes = common::to_bytes(body).await.unwrap_or_default();
32959                        let error = serde_json::from_str(&common::to_string(&bytes));
32960                        let response = common::to_response(parts, bytes.into());
32961
32962                        if let common::Retry::After(d) =
32963                            dlg.http_failure(&response, error.as_ref().ok())
32964                        {
32965                            sleep(d).await;
32966                            continue;
32967                        }
32968
32969                        dlg.finished(false);
32970
32971                        return Err(match error {
32972                            Ok(value) => common::Error::BadRequest(value),
32973                            _ => common::Error::Failure(response),
32974                        });
32975                    }
32976                    let response = {
32977                        let bytes = common::to_bytes(body).await.unwrap_or_default();
32978                        let encoded = common::to_string(&bytes);
32979                        match serde_json::from_str(&encoded) {
32980                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
32981                            Err(error) => {
32982                                dlg.response_json_decode_error(&encoded, &error);
32983                                return Err(common::Error::JsonDecodeError(
32984                                    encoded.to_string(),
32985                                    error,
32986                                ));
32987                            }
32988                        }
32989                    };
32990
32991                    dlg.finished(true);
32992                    return Ok(response);
32993                }
32994            }
32995        }
32996    }
32997
32998    /// Required. The resource name of the project associated with the service accounts, such as `projects/my-project-123`.
32999    ///
33000    /// Sets the *name* path property to the given value.
33001    ///
33002    /// Even though the property as already been set when instantiating this call,
33003    /// we provide this method for API completeness.
33004    pub fn name(mut self, new_value: &str) -> ProjectServiceAccountListCall<'a, C> {
33005        self._name = new_value.to_string();
33006        self
33007    }
33008    /// Optional pagination token returned in an earlier ListServiceAccountsResponse.next_page_token.
33009    ///
33010    /// Sets the *page token* query property to the given value.
33011    pub fn page_token(mut self, new_value: &str) -> ProjectServiceAccountListCall<'a, C> {
33012        self._page_token = Some(new_value.to_string());
33013        self
33014    }
33015    /// Optional limit on the number of service accounts to include in the response. Further accounts can subsequently be obtained by including the ListServiceAccountsResponse.next_page_token in a subsequent request. The default is 20, and the maximum is 100.
33016    ///
33017    /// Sets the *page size* query property to the given value.
33018    pub fn page_size(mut self, new_value: i32) -> ProjectServiceAccountListCall<'a, C> {
33019        self._page_size = Some(new_value);
33020        self
33021    }
33022    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
33023    /// while executing the actual API request.
33024    ///
33025    /// ````text
33026    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
33027    /// ````
33028    ///
33029    /// Sets the *delegate* property to the given value.
33030    pub fn delegate(
33031        mut self,
33032        new_value: &'a mut dyn common::Delegate,
33033    ) -> ProjectServiceAccountListCall<'a, C> {
33034        self._delegate = Some(new_value);
33035        self
33036    }
33037
33038    /// Set any additional parameter of the query string used in the request.
33039    /// It should be used to set parameters which are not yet available through their own
33040    /// setters.
33041    ///
33042    /// Please note that this method must not be used to set any of the known parameters
33043    /// which have their own setter method. If done anyway, the request will fail.
33044    ///
33045    /// # Additional Parameters
33046    ///
33047    /// * *$.xgafv* (query-string) - V1 error format.
33048    /// * *access_token* (query-string) - OAuth access token.
33049    /// * *alt* (query-string) - Data format for response.
33050    /// * *callback* (query-string) - JSONP
33051    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
33052    /// * *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.
33053    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
33054    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
33055    /// * *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.
33056    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
33057    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
33058    pub fn param<T>(mut self, name: T, value: T) -> ProjectServiceAccountListCall<'a, C>
33059    where
33060        T: AsRef<str>,
33061    {
33062        self._additional_params
33063            .insert(name.as_ref().to_string(), value.as_ref().to_string());
33064        self
33065    }
33066
33067    /// Identifies the authorization scope for the method you are building.
33068    ///
33069    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
33070    /// [`Scope::CloudPlatform`].
33071    ///
33072    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
33073    /// tokens for more than one scope.
33074    ///
33075    /// Usually there is more than one suitable scope to authorize an operation, some of which may
33076    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
33077    /// sufficient, a read-write scope will do as well.
33078    pub fn add_scope<St>(mut self, scope: St) -> ProjectServiceAccountListCall<'a, C>
33079    where
33080        St: AsRef<str>,
33081    {
33082        self._scopes.insert(String::from(scope.as_ref()));
33083        self
33084    }
33085    /// Identifies the authorization scope(s) for the method you are building.
33086    ///
33087    /// See [`Self::add_scope()`] for details.
33088    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectServiceAccountListCall<'a, C>
33089    where
33090        I: IntoIterator<Item = St>,
33091        St: AsRef<str>,
33092    {
33093        self._scopes
33094            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
33095        self
33096    }
33097
33098    /// Removes all scopes, and no default scope will be used either.
33099    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
33100    /// for details).
33101    pub fn clear_scopes(mut self) -> ProjectServiceAccountListCall<'a, C> {
33102        self._scopes.clear();
33103        self
33104    }
33105}
33106
33107/// Patches a ServiceAccount.
33108///
33109/// A builder for the *serviceAccounts.patch* method supported by a *project* resource.
33110/// It is not used directly, but through a [`ProjectMethods`] instance.
33111///
33112/// # Example
33113///
33114/// Instantiate a resource method builder
33115///
33116/// ```test_harness,no_run
33117/// # extern crate hyper;
33118/// # extern crate hyper_rustls;
33119/// # extern crate google_iam1 as iam1;
33120/// use iam1::api::PatchServiceAccountRequest;
33121/// # async fn dox() {
33122/// # use iam1::{Iam, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
33123///
33124/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
33125/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
33126/// #     secret,
33127/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
33128/// # ).build().await.unwrap();
33129///
33130/// # let client = hyper_util::client::legacy::Client::builder(
33131/// #     hyper_util::rt::TokioExecutor::new()
33132/// # )
33133/// # .build(
33134/// #     hyper_rustls::HttpsConnectorBuilder::new()
33135/// #         .with_native_roots()
33136/// #         .unwrap()
33137/// #         .https_or_http()
33138/// #         .enable_http1()
33139/// #         .build()
33140/// # );
33141/// # let mut hub = Iam::new(client, auth);
33142/// // As the method needs a request, you would usually fill it with the desired information
33143/// // into the respective structure. Some of the parts shown here might not be applicable !
33144/// // Values shown here are possibly random and not representative !
33145/// let mut req = PatchServiceAccountRequest::default();
33146///
33147/// // You can configure optional parameters by calling the respective setters at will, and
33148/// // execute the final call using `doit()`.
33149/// // Values shown here are possibly random and not representative !
33150/// let result = hub.projects().service_accounts_patch(req, "name")
33151///              .doit().await;
33152/// # }
33153/// ```
33154pub struct ProjectServiceAccountPatchCall<'a, C>
33155where
33156    C: 'a,
33157{
33158    hub: &'a Iam<C>,
33159    _request: PatchServiceAccountRequest,
33160    _name: String,
33161    _delegate: Option<&'a mut dyn common::Delegate>,
33162    _additional_params: HashMap<String, String>,
33163    _scopes: BTreeSet<String>,
33164}
33165
33166impl<'a, C> common::CallBuilder for ProjectServiceAccountPatchCall<'a, C> {}
33167
33168impl<'a, C> ProjectServiceAccountPatchCall<'a, C>
33169where
33170    C: common::Connector,
33171{
33172    /// Perform the operation you have build so far.
33173    pub async fn doit(mut self) -> common::Result<(common::Response, ServiceAccount)> {
33174        use std::borrow::Cow;
33175        use std::io::{Read, Seek};
33176
33177        use common::{url::Params, ToParts};
33178        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
33179
33180        let mut dd = common::DefaultDelegate;
33181        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
33182        dlg.begin(common::MethodInfo {
33183            id: "iam.projects.serviceAccounts.patch",
33184            http_method: hyper::Method::PATCH,
33185        });
33186
33187        for &field in ["alt", "name"].iter() {
33188            if self._additional_params.contains_key(field) {
33189                dlg.finished(false);
33190                return Err(common::Error::FieldClash(field));
33191            }
33192        }
33193
33194        let mut params = Params::with_capacity(4 + self._additional_params.len());
33195        params.push("name", self._name);
33196
33197        params.extend(self._additional_params.iter());
33198
33199        params.push("alt", "json");
33200        let mut url = self.hub._base_url.clone() + "v1/{+name}";
33201        if self._scopes.is_empty() {
33202            self._scopes
33203                .insert(Scope::CloudPlatform.as_ref().to_string());
33204        }
33205
33206        #[allow(clippy::single_element_loop)]
33207        for &(find_this, param_name) in [("{+name}", "name")].iter() {
33208            url = params.uri_replacement(url, param_name, find_this, true);
33209        }
33210        {
33211            let to_remove = ["name"];
33212            params.remove_params(&to_remove);
33213        }
33214
33215        let url = params.parse_with_url(&url);
33216
33217        let mut json_mime_type = mime::APPLICATION_JSON;
33218        let mut request_value_reader = {
33219            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
33220            common::remove_json_null_values(&mut value);
33221            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
33222            serde_json::to_writer(&mut dst, &value).unwrap();
33223            dst
33224        };
33225        let request_size = request_value_reader
33226            .seek(std::io::SeekFrom::End(0))
33227            .unwrap();
33228        request_value_reader
33229            .seek(std::io::SeekFrom::Start(0))
33230            .unwrap();
33231
33232        loop {
33233            let token = match self
33234                .hub
33235                .auth
33236                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
33237                .await
33238            {
33239                Ok(token) => token,
33240                Err(e) => match dlg.token(e) {
33241                    Ok(token) => token,
33242                    Err(e) => {
33243                        dlg.finished(false);
33244                        return Err(common::Error::MissingToken(e));
33245                    }
33246                },
33247            };
33248            request_value_reader
33249                .seek(std::io::SeekFrom::Start(0))
33250                .unwrap();
33251            let mut req_result = {
33252                let client = &self.hub.client;
33253                dlg.pre_request();
33254                let mut req_builder = hyper::Request::builder()
33255                    .method(hyper::Method::PATCH)
33256                    .uri(url.as_str())
33257                    .header(USER_AGENT, self.hub._user_agent.clone());
33258
33259                if let Some(token) = token.as_ref() {
33260                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
33261                }
33262
33263                let request = req_builder
33264                    .header(CONTENT_TYPE, json_mime_type.to_string())
33265                    .header(CONTENT_LENGTH, request_size as u64)
33266                    .body(common::to_body(
33267                        request_value_reader.get_ref().clone().into(),
33268                    ));
33269
33270                client.request(request.unwrap()).await
33271            };
33272
33273            match req_result {
33274                Err(err) => {
33275                    if let common::Retry::After(d) = dlg.http_error(&err) {
33276                        sleep(d).await;
33277                        continue;
33278                    }
33279                    dlg.finished(false);
33280                    return Err(common::Error::HttpError(err));
33281                }
33282                Ok(res) => {
33283                    let (mut parts, body) = res.into_parts();
33284                    let mut body = common::Body::new(body);
33285                    if !parts.status.is_success() {
33286                        let bytes = common::to_bytes(body).await.unwrap_or_default();
33287                        let error = serde_json::from_str(&common::to_string(&bytes));
33288                        let response = common::to_response(parts, bytes.into());
33289
33290                        if let common::Retry::After(d) =
33291                            dlg.http_failure(&response, error.as_ref().ok())
33292                        {
33293                            sleep(d).await;
33294                            continue;
33295                        }
33296
33297                        dlg.finished(false);
33298
33299                        return Err(match error {
33300                            Ok(value) => common::Error::BadRequest(value),
33301                            _ => common::Error::Failure(response),
33302                        });
33303                    }
33304                    let response = {
33305                        let bytes = common::to_bytes(body).await.unwrap_or_default();
33306                        let encoded = common::to_string(&bytes);
33307                        match serde_json::from_str(&encoded) {
33308                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
33309                            Err(error) => {
33310                                dlg.response_json_decode_error(&encoded, &error);
33311                                return Err(common::Error::JsonDecodeError(
33312                                    encoded.to_string(),
33313                                    error,
33314                                ));
33315                            }
33316                        }
33317                    };
33318
33319                    dlg.finished(true);
33320                    return Ok(response);
33321                }
33322            }
33323        }
33324    }
33325
33326    ///
33327    /// Sets the *request* property to the given value.
33328    ///
33329    /// Even though the property as already been set when instantiating this call,
33330    /// we provide this method for API completeness.
33331    pub fn request(
33332        mut self,
33333        new_value: PatchServiceAccountRequest,
33334    ) -> ProjectServiceAccountPatchCall<'a, C> {
33335        self._request = new_value;
33336        self
33337    }
33338    /// The resource name of the service account. Use one of the following formats: * `projects/{PROJECT_ID}/serviceAccounts/{EMAIL_ADDRESS}` * `projects/{PROJECT_ID}/serviceAccounts/{UNIQUE_ID}` As an alternative, you can use the `-` wildcard character instead of the project ID: * `projects/-/serviceAccounts/{EMAIL_ADDRESS}` * `projects/-/serviceAccounts/{UNIQUE_ID}` When possible, avoid using the `-` wildcard character, because it can cause response messages to contain misleading error codes. For example, if you try to access the service account `projects/-/serviceAccounts/fake@example.com`, which does not exist, the response contains an HTTP `403 Forbidden` error instead of a `404 Not Found` error.
33339    ///
33340    /// Sets the *name* path property to the given value.
33341    ///
33342    /// Even though the property as already been set when instantiating this call,
33343    /// we provide this method for API completeness.
33344    pub fn name(mut self, new_value: &str) -> ProjectServiceAccountPatchCall<'a, C> {
33345        self._name = new_value.to_string();
33346        self
33347    }
33348    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
33349    /// while executing the actual API request.
33350    ///
33351    /// ````text
33352    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
33353    /// ````
33354    ///
33355    /// Sets the *delegate* property to the given value.
33356    pub fn delegate(
33357        mut self,
33358        new_value: &'a mut dyn common::Delegate,
33359    ) -> ProjectServiceAccountPatchCall<'a, C> {
33360        self._delegate = Some(new_value);
33361        self
33362    }
33363
33364    /// Set any additional parameter of the query string used in the request.
33365    /// It should be used to set parameters which are not yet available through their own
33366    /// setters.
33367    ///
33368    /// Please note that this method must not be used to set any of the known parameters
33369    /// which have their own setter method. If done anyway, the request will fail.
33370    ///
33371    /// # Additional Parameters
33372    ///
33373    /// * *$.xgafv* (query-string) - V1 error format.
33374    /// * *access_token* (query-string) - OAuth access token.
33375    /// * *alt* (query-string) - Data format for response.
33376    /// * *callback* (query-string) - JSONP
33377    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
33378    /// * *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.
33379    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
33380    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
33381    /// * *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.
33382    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
33383    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
33384    pub fn param<T>(mut self, name: T, value: T) -> ProjectServiceAccountPatchCall<'a, C>
33385    where
33386        T: AsRef<str>,
33387    {
33388        self._additional_params
33389            .insert(name.as_ref().to_string(), value.as_ref().to_string());
33390        self
33391    }
33392
33393    /// Identifies the authorization scope for the method you are building.
33394    ///
33395    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
33396    /// [`Scope::CloudPlatform`].
33397    ///
33398    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
33399    /// tokens for more than one scope.
33400    ///
33401    /// Usually there is more than one suitable scope to authorize an operation, some of which may
33402    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
33403    /// sufficient, a read-write scope will do as well.
33404    pub fn add_scope<St>(mut self, scope: St) -> ProjectServiceAccountPatchCall<'a, C>
33405    where
33406        St: AsRef<str>,
33407    {
33408        self._scopes.insert(String::from(scope.as_ref()));
33409        self
33410    }
33411    /// Identifies the authorization scope(s) for the method you are building.
33412    ///
33413    /// See [`Self::add_scope()`] for details.
33414    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectServiceAccountPatchCall<'a, C>
33415    where
33416        I: IntoIterator<Item = St>,
33417        St: AsRef<str>,
33418    {
33419        self._scopes
33420            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
33421        self
33422    }
33423
33424    /// Removes all scopes, and no default scope will be used either.
33425    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
33426    /// for details).
33427    pub fn clear_scopes(mut self) -> ProjectServiceAccountPatchCall<'a, C> {
33428        self._scopes.clear();
33429        self
33430    }
33431}
33432
33433/// Sets the IAM policy that is attached to a ServiceAccount. Use this method to grant or revoke access to the service account. For example, you could grant a principal the ability to impersonate the service account. This method does not enable the service account to access other resources. To grant roles to a service account on a resource, follow these steps: 1. Call the resource's `getIamPolicy` method to get its current IAM policy. 2. Edit the policy so that it binds the service account to an IAM role for the resource. 3. Call the resource's `setIamPolicy` method to update its IAM policy. For detailed instructions, see [Manage access to project, folders, and organizations](https://cloud.google.com/iam/help/service-accounts/granting-access-to-service-accounts) or [Manage access to other resources](https://cloud.google.com/iam/help/access/manage-other-resources).
33434///
33435/// A builder for the *serviceAccounts.setIamPolicy* method supported by a *project* resource.
33436/// It is not used directly, but through a [`ProjectMethods`] instance.
33437///
33438/// # Example
33439///
33440/// Instantiate a resource method builder
33441///
33442/// ```test_harness,no_run
33443/// # extern crate hyper;
33444/// # extern crate hyper_rustls;
33445/// # extern crate google_iam1 as iam1;
33446/// use iam1::api::SetIamPolicyRequest;
33447/// # async fn dox() {
33448/// # use iam1::{Iam, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
33449///
33450/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
33451/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
33452/// #     secret,
33453/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
33454/// # ).build().await.unwrap();
33455///
33456/// # let client = hyper_util::client::legacy::Client::builder(
33457/// #     hyper_util::rt::TokioExecutor::new()
33458/// # )
33459/// # .build(
33460/// #     hyper_rustls::HttpsConnectorBuilder::new()
33461/// #         .with_native_roots()
33462/// #         .unwrap()
33463/// #         .https_or_http()
33464/// #         .enable_http1()
33465/// #         .build()
33466/// # );
33467/// # let mut hub = Iam::new(client, auth);
33468/// // As the method needs a request, you would usually fill it with the desired information
33469/// // into the respective structure. Some of the parts shown here might not be applicable !
33470/// // Values shown here are possibly random and not representative !
33471/// let mut req = SetIamPolicyRequest::default();
33472///
33473/// // You can configure optional parameters by calling the respective setters at will, and
33474/// // execute the final call using `doit()`.
33475/// // Values shown here are possibly random and not representative !
33476/// let result = hub.projects().service_accounts_set_iam_policy(req, "resource")
33477///              .doit().await;
33478/// # }
33479/// ```
33480pub struct ProjectServiceAccountSetIamPolicyCall<'a, C>
33481where
33482    C: 'a,
33483{
33484    hub: &'a Iam<C>,
33485    _request: SetIamPolicyRequest,
33486    _resource: String,
33487    _delegate: Option<&'a mut dyn common::Delegate>,
33488    _additional_params: HashMap<String, String>,
33489    _scopes: BTreeSet<String>,
33490}
33491
33492impl<'a, C> common::CallBuilder for ProjectServiceAccountSetIamPolicyCall<'a, C> {}
33493
33494impl<'a, C> ProjectServiceAccountSetIamPolicyCall<'a, C>
33495where
33496    C: common::Connector,
33497{
33498    /// Perform the operation you have build so far.
33499    pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
33500        use std::borrow::Cow;
33501        use std::io::{Read, Seek};
33502
33503        use common::{url::Params, ToParts};
33504        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
33505
33506        let mut dd = common::DefaultDelegate;
33507        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
33508        dlg.begin(common::MethodInfo {
33509            id: "iam.projects.serviceAccounts.setIamPolicy",
33510            http_method: hyper::Method::POST,
33511        });
33512
33513        for &field in ["alt", "resource"].iter() {
33514            if self._additional_params.contains_key(field) {
33515                dlg.finished(false);
33516                return Err(common::Error::FieldClash(field));
33517            }
33518        }
33519
33520        let mut params = Params::with_capacity(4 + self._additional_params.len());
33521        params.push("resource", self._resource);
33522
33523        params.extend(self._additional_params.iter());
33524
33525        params.push("alt", "json");
33526        let mut url = self.hub._base_url.clone() + "v1/{+resource}:setIamPolicy";
33527        if self._scopes.is_empty() {
33528            self._scopes
33529                .insert(Scope::CloudPlatform.as_ref().to_string());
33530        }
33531
33532        #[allow(clippy::single_element_loop)]
33533        for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
33534            url = params.uri_replacement(url, param_name, find_this, true);
33535        }
33536        {
33537            let to_remove = ["resource"];
33538            params.remove_params(&to_remove);
33539        }
33540
33541        let url = params.parse_with_url(&url);
33542
33543        let mut json_mime_type = mime::APPLICATION_JSON;
33544        let mut request_value_reader = {
33545            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
33546            common::remove_json_null_values(&mut value);
33547            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
33548            serde_json::to_writer(&mut dst, &value).unwrap();
33549            dst
33550        };
33551        let request_size = request_value_reader
33552            .seek(std::io::SeekFrom::End(0))
33553            .unwrap();
33554        request_value_reader
33555            .seek(std::io::SeekFrom::Start(0))
33556            .unwrap();
33557
33558        loop {
33559            let token = match self
33560                .hub
33561                .auth
33562                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
33563                .await
33564            {
33565                Ok(token) => token,
33566                Err(e) => match dlg.token(e) {
33567                    Ok(token) => token,
33568                    Err(e) => {
33569                        dlg.finished(false);
33570                        return Err(common::Error::MissingToken(e));
33571                    }
33572                },
33573            };
33574            request_value_reader
33575                .seek(std::io::SeekFrom::Start(0))
33576                .unwrap();
33577            let mut req_result = {
33578                let client = &self.hub.client;
33579                dlg.pre_request();
33580                let mut req_builder = hyper::Request::builder()
33581                    .method(hyper::Method::POST)
33582                    .uri(url.as_str())
33583                    .header(USER_AGENT, self.hub._user_agent.clone());
33584
33585                if let Some(token) = token.as_ref() {
33586                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
33587                }
33588
33589                let request = req_builder
33590                    .header(CONTENT_TYPE, json_mime_type.to_string())
33591                    .header(CONTENT_LENGTH, request_size as u64)
33592                    .body(common::to_body(
33593                        request_value_reader.get_ref().clone().into(),
33594                    ));
33595
33596                client.request(request.unwrap()).await
33597            };
33598
33599            match req_result {
33600                Err(err) => {
33601                    if let common::Retry::After(d) = dlg.http_error(&err) {
33602                        sleep(d).await;
33603                        continue;
33604                    }
33605                    dlg.finished(false);
33606                    return Err(common::Error::HttpError(err));
33607                }
33608                Ok(res) => {
33609                    let (mut parts, body) = res.into_parts();
33610                    let mut body = common::Body::new(body);
33611                    if !parts.status.is_success() {
33612                        let bytes = common::to_bytes(body).await.unwrap_or_default();
33613                        let error = serde_json::from_str(&common::to_string(&bytes));
33614                        let response = common::to_response(parts, bytes.into());
33615
33616                        if let common::Retry::After(d) =
33617                            dlg.http_failure(&response, error.as_ref().ok())
33618                        {
33619                            sleep(d).await;
33620                            continue;
33621                        }
33622
33623                        dlg.finished(false);
33624
33625                        return Err(match error {
33626                            Ok(value) => common::Error::BadRequest(value),
33627                            _ => common::Error::Failure(response),
33628                        });
33629                    }
33630                    let response = {
33631                        let bytes = common::to_bytes(body).await.unwrap_or_default();
33632                        let encoded = common::to_string(&bytes);
33633                        match serde_json::from_str(&encoded) {
33634                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
33635                            Err(error) => {
33636                                dlg.response_json_decode_error(&encoded, &error);
33637                                return Err(common::Error::JsonDecodeError(
33638                                    encoded.to_string(),
33639                                    error,
33640                                ));
33641                            }
33642                        }
33643                    };
33644
33645                    dlg.finished(true);
33646                    return Ok(response);
33647                }
33648            }
33649        }
33650    }
33651
33652    ///
33653    /// Sets the *request* property to the given value.
33654    ///
33655    /// Even though the property as already been set when instantiating this call,
33656    /// we provide this method for API completeness.
33657    pub fn request(
33658        mut self,
33659        new_value: SetIamPolicyRequest,
33660    ) -> ProjectServiceAccountSetIamPolicyCall<'a, C> {
33661        self._request = new_value;
33662        self
33663    }
33664    /// REQUIRED: The resource for which the policy is being specified. See [Resource names](https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
33665    ///
33666    /// Sets the *resource* path property to the given value.
33667    ///
33668    /// Even though the property as already been set when instantiating this call,
33669    /// we provide this method for API completeness.
33670    pub fn resource(mut self, new_value: &str) -> ProjectServiceAccountSetIamPolicyCall<'a, C> {
33671        self._resource = new_value.to_string();
33672        self
33673    }
33674    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
33675    /// while executing the actual API request.
33676    ///
33677    /// ````text
33678    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
33679    /// ````
33680    ///
33681    /// Sets the *delegate* property to the given value.
33682    pub fn delegate(
33683        mut self,
33684        new_value: &'a mut dyn common::Delegate,
33685    ) -> ProjectServiceAccountSetIamPolicyCall<'a, C> {
33686        self._delegate = Some(new_value);
33687        self
33688    }
33689
33690    /// Set any additional parameter of the query string used in the request.
33691    /// It should be used to set parameters which are not yet available through their own
33692    /// setters.
33693    ///
33694    /// Please note that this method must not be used to set any of the known parameters
33695    /// which have their own setter method. If done anyway, the request will fail.
33696    ///
33697    /// # Additional Parameters
33698    ///
33699    /// * *$.xgafv* (query-string) - V1 error format.
33700    /// * *access_token* (query-string) - OAuth access token.
33701    /// * *alt* (query-string) - Data format for response.
33702    /// * *callback* (query-string) - JSONP
33703    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
33704    /// * *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.
33705    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
33706    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
33707    /// * *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.
33708    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
33709    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
33710    pub fn param<T>(mut self, name: T, value: T) -> ProjectServiceAccountSetIamPolicyCall<'a, C>
33711    where
33712        T: AsRef<str>,
33713    {
33714        self._additional_params
33715            .insert(name.as_ref().to_string(), value.as_ref().to_string());
33716        self
33717    }
33718
33719    /// Identifies the authorization scope for the method you are building.
33720    ///
33721    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
33722    /// [`Scope::CloudPlatform`].
33723    ///
33724    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
33725    /// tokens for more than one scope.
33726    ///
33727    /// Usually there is more than one suitable scope to authorize an operation, some of which may
33728    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
33729    /// sufficient, a read-write scope will do as well.
33730    pub fn add_scope<St>(mut self, scope: St) -> ProjectServiceAccountSetIamPolicyCall<'a, C>
33731    where
33732        St: AsRef<str>,
33733    {
33734        self._scopes.insert(String::from(scope.as_ref()));
33735        self
33736    }
33737    /// Identifies the authorization scope(s) for the method you are building.
33738    ///
33739    /// See [`Self::add_scope()`] for details.
33740    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectServiceAccountSetIamPolicyCall<'a, C>
33741    where
33742        I: IntoIterator<Item = St>,
33743        St: AsRef<str>,
33744    {
33745        self._scopes
33746            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
33747        self
33748    }
33749
33750    /// Removes all scopes, and no default scope will be used either.
33751    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
33752    /// for details).
33753    pub fn clear_scopes(mut self) -> ProjectServiceAccountSetIamPolicyCall<'a, C> {
33754        self._scopes.clear();
33755        self
33756    }
33757}
33758
33759/// **Note:** This method is deprecated. Use the [signBlob](https://cloud.google.com/iam/help/rest-credentials/v1/projects.serviceAccounts/signBlob) method in the IAM Service Account Credentials API instead. If you currently use this method, see the [migration guide](https://cloud.google.com/iam/help/credentials/migrate-api) for instructions. Signs a blob using the system-managed private key for a ServiceAccount.
33760///
33761/// A builder for the *serviceAccounts.signBlob* method supported by a *project* resource.
33762/// It is not used directly, but through a [`ProjectMethods`] instance.
33763///
33764/// # Example
33765///
33766/// Instantiate a resource method builder
33767///
33768/// ```test_harness,no_run
33769/// # extern crate hyper;
33770/// # extern crate hyper_rustls;
33771/// # extern crate google_iam1 as iam1;
33772/// use iam1::api::SignBlobRequest;
33773/// # async fn dox() {
33774/// # use iam1::{Iam, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
33775///
33776/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
33777/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
33778/// #     secret,
33779/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
33780/// # ).build().await.unwrap();
33781///
33782/// # let client = hyper_util::client::legacy::Client::builder(
33783/// #     hyper_util::rt::TokioExecutor::new()
33784/// # )
33785/// # .build(
33786/// #     hyper_rustls::HttpsConnectorBuilder::new()
33787/// #         .with_native_roots()
33788/// #         .unwrap()
33789/// #         .https_or_http()
33790/// #         .enable_http1()
33791/// #         .build()
33792/// # );
33793/// # let mut hub = Iam::new(client, auth);
33794/// // As the method needs a request, you would usually fill it with the desired information
33795/// // into the respective structure. Some of the parts shown here might not be applicable !
33796/// // Values shown here are possibly random and not representative !
33797/// let mut req = SignBlobRequest::default();
33798///
33799/// // You can configure optional parameters by calling the respective setters at will, and
33800/// // execute the final call using `doit()`.
33801/// // Values shown here are possibly random and not representative !
33802/// let result = hub.projects().service_accounts_sign_blob(req, "name")
33803///              .doit().await;
33804/// # }
33805/// ```
33806pub struct ProjectServiceAccountSignBlobCall<'a, C>
33807where
33808    C: 'a,
33809{
33810    hub: &'a Iam<C>,
33811    _request: SignBlobRequest,
33812    _name: String,
33813    _delegate: Option<&'a mut dyn common::Delegate>,
33814    _additional_params: HashMap<String, String>,
33815    _scopes: BTreeSet<String>,
33816}
33817
33818impl<'a, C> common::CallBuilder for ProjectServiceAccountSignBlobCall<'a, C> {}
33819
33820impl<'a, C> ProjectServiceAccountSignBlobCall<'a, C>
33821where
33822    C: common::Connector,
33823{
33824    /// Perform the operation you have build so far.
33825    pub async fn doit(mut self) -> common::Result<(common::Response, SignBlobResponse)> {
33826        use std::borrow::Cow;
33827        use std::io::{Read, Seek};
33828
33829        use common::{url::Params, ToParts};
33830        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
33831
33832        let mut dd = common::DefaultDelegate;
33833        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
33834        dlg.begin(common::MethodInfo {
33835            id: "iam.projects.serviceAccounts.signBlob",
33836            http_method: hyper::Method::POST,
33837        });
33838
33839        for &field in ["alt", "name"].iter() {
33840            if self._additional_params.contains_key(field) {
33841                dlg.finished(false);
33842                return Err(common::Error::FieldClash(field));
33843            }
33844        }
33845
33846        let mut params = Params::with_capacity(4 + self._additional_params.len());
33847        params.push("name", self._name);
33848
33849        params.extend(self._additional_params.iter());
33850
33851        params.push("alt", "json");
33852        let mut url = self.hub._base_url.clone() + "v1/{+name}:signBlob";
33853        if self._scopes.is_empty() {
33854            self._scopes
33855                .insert(Scope::CloudPlatform.as_ref().to_string());
33856        }
33857
33858        #[allow(clippy::single_element_loop)]
33859        for &(find_this, param_name) in [("{+name}", "name")].iter() {
33860            url = params.uri_replacement(url, param_name, find_this, true);
33861        }
33862        {
33863            let to_remove = ["name"];
33864            params.remove_params(&to_remove);
33865        }
33866
33867        let url = params.parse_with_url(&url);
33868
33869        let mut json_mime_type = mime::APPLICATION_JSON;
33870        let mut request_value_reader = {
33871            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
33872            common::remove_json_null_values(&mut value);
33873            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
33874            serde_json::to_writer(&mut dst, &value).unwrap();
33875            dst
33876        };
33877        let request_size = request_value_reader
33878            .seek(std::io::SeekFrom::End(0))
33879            .unwrap();
33880        request_value_reader
33881            .seek(std::io::SeekFrom::Start(0))
33882            .unwrap();
33883
33884        loop {
33885            let token = match self
33886                .hub
33887                .auth
33888                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
33889                .await
33890            {
33891                Ok(token) => token,
33892                Err(e) => match dlg.token(e) {
33893                    Ok(token) => token,
33894                    Err(e) => {
33895                        dlg.finished(false);
33896                        return Err(common::Error::MissingToken(e));
33897                    }
33898                },
33899            };
33900            request_value_reader
33901                .seek(std::io::SeekFrom::Start(0))
33902                .unwrap();
33903            let mut req_result = {
33904                let client = &self.hub.client;
33905                dlg.pre_request();
33906                let mut req_builder = hyper::Request::builder()
33907                    .method(hyper::Method::POST)
33908                    .uri(url.as_str())
33909                    .header(USER_AGENT, self.hub._user_agent.clone());
33910
33911                if let Some(token) = token.as_ref() {
33912                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
33913                }
33914
33915                let request = req_builder
33916                    .header(CONTENT_TYPE, json_mime_type.to_string())
33917                    .header(CONTENT_LENGTH, request_size as u64)
33918                    .body(common::to_body(
33919                        request_value_reader.get_ref().clone().into(),
33920                    ));
33921
33922                client.request(request.unwrap()).await
33923            };
33924
33925            match req_result {
33926                Err(err) => {
33927                    if let common::Retry::After(d) = dlg.http_error(&err) {
33928                        sleep(d).await;
33929                        continue;
33930                    }
33931                    dlg.finished(false);
33932                    return Err(common::Error::HttpError(err));
33933                }
33934                Ok(res) => {
33935                    let (mut parts, body) = res.into_parts();
33936                    let mut body = common::Body::new(body);
33937                    if !parts.status.is_success() {
33938                        let bytes = common::to_bytes(body).await.unwrap_or_default();
33939                        let error = serde_json::from_str(&common::to_string(&bytes));
33940                        let response = common::to_response(parts, bytes.into());
33941
33942                        if let common::Retry::After(d) =
33943                            dlg.http_failure(&response, error.as_ref().ok())
33944                        {
33945                            sleep(d).await;
33946                            continue;
33947                        }
33948
33949                        dlg.finished(false);
33950
33951                        return Err(match error {
33952                            Ok(value) => common::Error::BadRequest(value),
33953                            _ => common::Error::Failure(response),
33954                        });
33955                    }
33956                    let response = {
33957                        let bytes = common::to_bytes(body).await.unwrap_or_default();
33958                        let encoded = common::to_string(&bytes);
33959                        match serde_json::from_str(&encoded) {
33960                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
33961                            Err(error) => {
33962                                dlg.response_json_decode_error(&encoded, &error);
33963                                return Err(common::Error::JsonDecodeError(
33964                                    encoded.to_string(),
33965                                    error,
33966                                ));
33967                            }
33968                        }
33969                    };
33970
33971                    dlg.finished(true);
33972                    return Ok(response);
33973                }
33974            }
33975        }
33976    }
33977
33978    ///
33979    /// Sets the *request* property to the given value.
33980    ///
33981    /// Even though the property as already been set when instantiating this call,
33982    /// we provide this method for API completeness.
33983    pub fn request(
33984        mut self,
33985        new_value: SignBlobRequest,
33986    ) -> ProjectServiceAccountSignBlobCall<'a, C> {
33987        self._request = new_value;
33988        self
33989    }
33990    /// Required. Deprecated. [Migrate to Service Account Credentials API](https://cloud.google.com/iam/help/credentials/migrate-api). The resource name of the service account. Use one of the following formats: * `projects/{PROJECT_ID}/serviceAccounts/{EMAIL_ADDRESS}` * `projects/{PROJECT_ID}/serviceAccounts/{UNIQUE_ID}` As an alternative, you can use the `-` wildcard character instead of the project ID: * `projects/-/serviceAccounts/{EMAIL_ADDRESS}` * `projects/-/serviceAccounts/{UNIQUE_ID}` When possible, avoid using the `-` wildcard character, because it can cause response messages to contain misleading error codes. For example, if you try to access the service account `projects/-/serviceAccounts/fake@example.com`, which does not exist, the response contains an HTTP `403 Forbidden` error instead of a `404 Not Found` error.
33991    ///
33992    /// Sets the *name* path property to the given value.
33993    ///
33994    /// Even though the property as already been set when instantiating this call,
33995    /// we provide this method for API completeness.
33996    pub fn name(mut self, new_value: &str) -> ProjectServiceAccountSignBlobCall<'a, C> {
33997        self._name = new_value.to_string();
33998        self
33999    }
34000    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
34001    /// while executing the actual API request.
34002    ///
34003    /// ````text
34004    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
34005    /// ````
34006    ///
34007    /// Sets the *delegate* property to the given value.
34008    pub fn delegate(
34009        mut self,
34010        new_value: &'a mut dyn common::Delegate,
34011    ) -> ProjectServiceAccountSignBlobCall<'a, C> {
34012        self._delegate = Some(new_value);
34013        self
34014    }
34015
34016    /// Set any additional parameter of the query string used in the request.
34017    /// It should be used to set parameters which are not yet available through their own
34018    /// setters.
34019    ///
34020    /// Please note that this method must not be used to set any of the known parameters
34021    /// which have their own setter method. If done anyway, the request will fail.
34022    ///
34023    /// # Additional Parameters
34024    ///
34025    /// * *$.xgafv* (query-string) - V1 error format.
34026    /// * *access_token* (query-string) - OAuth access token.
34027    /// * *alt* (query-string) - Data format for response.
34028    /// * *callback* (query-string) - JSONP
34029    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
34030    /// * *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.
34031    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
34032    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
34033    /// * *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.
34034    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
34035    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
34036    pub fn param<T>(mut self, name: T, value: T) -> ProjectServiceAccountSignBlobCall<'a, C>
34037    where
34038        T: AsRef<str>,
34039    {
34040        self._additional_params
34041            .insert(name.as_ref().to_string(), value.as_ref().to_string());
34042        self
34043    }
34044
34045    /// Identifies the authorization scope for the method you are building.
34046    ///
34047    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
34048    /// [`Scope::CloudPlatform`].
34049    ///
34050    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
34051    /// tokens for more than one scope.
34052    ///
34053    /// Usually there is more than one suitable scope to authorize an operation, some of which may
34054    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
34055    /// sufficient, a read-write scope will do as well.
34056    pub fn add_scope<St>(mut self, scope: St) -> ProjectServiceAccountSignBlobCall<'a, C>
34057    where
34058        St: AsRef<str>,
34059    {
34060        self._scopes.insert(String::from(scope.as_ref()));
34061        self
34062    }
34063    /// Identifies the authorization scope(s) for the method you are building.
34064    ///
34065    /// See [`Self::add_scope()`] for details.
34066    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectServiceAccountSignBlobCall<'a, C>
34067    where
34068        I: IntoIterator<Item = St>,
34069        St: AsRef<str>,
34070    {
34071        self._scopes
34072            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
34073        self
34074    }
34075
34076    /// Removes all scopes, and no default scope will be used either.
34077    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
34078    /// for details).
34079    pub fn clear_scopes(mut self) -> ProjectServiceAccountSignBlobCall<'a, C> {
34080        self._scopes.clear();
34081        self
34082    }
34083}
34084
34085/// **Note:** This method is deprecated. Use the [signJwt](https://cloud.google.com/iam/help/rest-credentials/v1/projects.serviceAccounts/signJwt) method in the IAM Service Account Credentials API instead. If you currently use this method, see the [migration guide](https://cloud.google.com/iam/help/credentials/migrate-api) for instructions. Signs a JSON Web Token (JWT) using the system-managed private key for a ServiceAccount.
34086///
34087/// A builder for the *serviceAccounts.signJwt* method supported by a *project* resource.
34088/// It is not used directly, but through a [`ProjectMethods`] instance.
34089///
34090/// # Example
34091///
34092/// Instantiate a resource method builder
34093///
34094/// ```test_harness,no_run
34095/// # extern crate hyper;
34096/// # extern crate hyper_rustls;
34097/// # extern crate google_iam1 as iam1;
34098/// use iam1::api::SignJwtRequest;
34099/// # async fn dox() {
34100/// # use iam1::{Iam, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
34101///
34102/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
34103/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
34104/// #     secret,
34105/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
34106/// # ).build().await.unwrap();
34107///
34108/// # let client = hyper_util::client::legacy::Client::builder(
34109/// #     hyper_util::rt::TokioExecutor::new()
34110/// # )
34111/// # .build(
34112/// #     hyper_rustls::HttpsConnectorBuilder::new()
34113/// #         .with_native_roots()
34114/// #         .unwrap()
34115/// #         .https_or_http()
34116/// #         .enable_http1()
34117/// #         .build()
34118/// # );
34119/// # let mut hub = Iam::new(client, auth);
34120/// // As the method needs a request, you would usually fill it with the desired information
34121/// // into the respective structure. Some of the parts shown here might not be applicable !
34122/// // Values shown here are possibly random and not representative !
34123/// let mut req = SignJwtRequest::default();
34124///
34125/// // You can configure optional parameters by calling the respective setters at will, and
34126/// // execute the final call using `doit()`.
34127/// // Values shown here are possibly random and not representative !
34128/// let result = hub.projects().service_accounts_sign_jwt(req, "name")
34129///              .doit().await;
34130/// # }
34131/// ```
34132pub struct ProjectServiceAccountSignJwtCall<'a, C>
34133where
34134    C: 'a,
34135{
34136    hub: &'a Iam<C>,
34137    _request: SignJwtRequest,
34138    _name: String,
34139    _delegate: Option<&'a mut dyn common::Delegate>,
34140    _additional_params: HashMap<String, String>,
34141    _scopes: BTreeSet<String>,
34142}
34143
34144impl<'a, C> common::CallBuilder for ProjectServiceAccountSignJwtCall<'a, C> {}
34145
34146impl<'a, C> ProjectServiceAccountSignJwtCall<'a, C>
34147where
34148    C: common::Connector,
34149{
34150    /// Perform the operation you have build so far.
34151    pub async fn doit(mut self) -> common::Result<(common::Response, SignJwtResponse)> {
34152        use std::borrow::Cow;
34153        use std::io::{Read, Seek};
34154
34155        use common::{url::Params, ToParts};
34156        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
34157
34158        let mut dd = common::DefaultDelegate;
34159        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
34160        dlg.begin(common::MethodInfo {
34161            id: "iam.projects.serviceAccounts.signJwt",
34162            http_method: hyper::Method::POST,
34163        });
34164
34165        for &field in ["alt", "name"].iter() {
34166            if self._additional_params.contains_key(field) {
34167                dlg.finished(false);
34168                return Err(common::Error::FieldClash(field));
34169            }
34170        }
34171
34172        let mut params = Params::with_capacity(4 + self._additional_params.len());
34173        params.push("name", self._name);
34174
34175        params.extend(self._additional_params.iter());
34176
34177        params.push("alt", "json");
34178        let mut url = self.hub._base_url.clone() + "v1/{+name}:signJwt";
34179        if self._scopes.is_empty() {
34180            self._scopes
34181                .insert(Scope::CloudPlatform.as_ref().to_string());
34182        }
34183
34184        #[allow(clippy::single_element_loop)]
34185        for &(find_this, param_name) in [("{+name}", "name")].iter() {
34186            url = params.uri_replacement(url, param_name, find_this, true);
34187        }
34188        {
34189            let to_remove = ["name"];
34190            params.remove_params(&to_remove);
34191        }
34192
34193        let url = params.parse_with_url(&url);
34194
34195        let mut json_mime_type = mime::APPLICATION_JSON;
34196        let mut request_value_reader = {
34197            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
34198            common::remove_json_null_values(&mut value);
34199            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
34200            serde_json::to_writer(&mut dst, &value).unwrap();
34201            dst
34202        };
34203        let request_size = request_value_reader
34204            .seek(std::io::SeekFrom::End(0))
34205            .unwrap();
34206        request_value_reader
34207            .seek(std::io::SeekFrom::Start(0))
34208            .unwrap();
34209
34210        loop {
34211            let token = match self
34212                .hub
34213                .auth
34214                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
34215                .await
34216            {
34217                Ok(token) => token,
34218                Err(e) => match dlg.token(e) {
34219                    Ok(token) => token,
34220                    Err(e) => {
34221                        dlg.finished(false);
34222                        return Err(common::Error::MissingToken(e));
34223                    }
34224                },
34225            };
34226            request_value_reader
34227                .seek(std::io::SeekFrom::Start(0))
34228                .unwrap();
34229            let mut req_result = {
34230                let client = &self.hub.client;
34231                dlg.pre_request();
34232                let mut req_builder = hyper::Request::builder()
34233                    .method(hyper::Method::POST)
34234                    .uri(url.as_str())
34235                    .header(USER_AGENT, self.hub._user_agent.clone());
34236
34237                if let Some(token) = token.as_ref() {
34238                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
34239                }
34240
34241                let request = req_builder
34242                    .header(CONTENT_TYPE, json_mime_type.to_string())
34243                    .header(CONTENT_LENGTH, request_size as u64)
34244                    .body(common::to_body(
34245                        request_value_reader.get_ref().clone().into(),
34246                    ));
34247
34248                client.request(request.unwrap()).await
34249            };
34250
34251            match req_result {
34252                Err(err) => {
34253                    if let common::Retry::After(d) = dlg.http_error(&err) {
34254                        sleep(d).await;
34255                        continue;
34256                    }
34257                    dlg.finished(false);
34258                    return Err(common::Error::HttpError(err));
34259                }
34260                Ok(res) => {
34261                    let (mut parts, body) = res.into_parts();
34262                    let mut body = common::Body::new(body);
34263                    if !parts.status.is_success() {
34264                        let bytes = common::to_bytes(body).await.unwrap_or_default();
34265                        let error = serde_json::from_str(&common::to_string(&bytes));
34266                        let response = common::to_response(parts, bytes.into());
34267
34268                        if let common::Retry::After(d) =
34269                            dlg.http_failure(&response, error.as_ref().ok())
34270                        {
34271                            sleep(d).await;
34272                            continue;
34273                        }
34274
34275                        dlg.finished(false);
34276
34277                        return Err(match error {
34278                            Ok(value) => common::Error::BadRequest(value),
34279                            _ => common::Error::Failure(response),
34280                        });
34281                    }
34282                    let response = {
34283                        let bytes = common::to_bytes(body).await.unwrap_or_default();
34284                        let encoded = common::to_string(&bytes);
34285                        match serde_json::from_str(&encoded) {
34286                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
34287                            Err(error) => {
34288                                dlg.response_json_decode_error(&encoded, &error);
34289                                return Err(common::Error::JsonDecodeError(
34290                                    encoded.to_string(),
34291                                    error,
34292                                ));
34293                            }
34294                        }
34295                    };
34296
34297                    dlg.finished(true);
34298                    return Ok(response);
34299                }
34300            }
34301        }
34302    }
34303
34304    ///
34305    /// Sets the *request* property to the given value.
34306    ///
34307    /// Even though the property as already been set when instantiating this call,
34308    /// we provide this method for API completeness.
34309    pub fn request(mut self, new_value: SignJwtRequest) -> ProjectServiceAccountSignJwtCall<'a, C> {
34310        self._request = new_value;
34311        self
34312    }
34313    /// Required. Deprecated. [Migrate to Service Account Credentials API](https://cloud.google.com/iam/help/credentials/migrate-api). The resource name of the service account. Use one of the following formats: * `projects/{PROJECT_ID}/serviceAccounts/{EMAIL_ADDRESS}` * `projects/{PROJECT_ID}/serviceAccounts/{UNIQUE_ID}` As an alternative, you can use the `-` wildcard character instead of the project ID: * `projects/-/serviceAccounts/{EMAIL_ADDRESS}` * `projects/-/serviceAccounts/{UNIQUE_ID}` When possible, avoid using the `-` wildcard character, because it can cause response messages to contain misleading error codes. For example, if you try to access the service account `projects/-/serviceAccounts/fake@example.com`, which does not exist, the response contains an HTTP `403 Forbidden` error instead of a `404 Not Found` error.
34314    ///
34315    /// Sets the *name* path property to the given value.
34316    ///
34317    /// Even though the property as already been set when instantiating this call,
34318    /// we provide this method for API completeness.
34319    pub fn name(mut self, new_value: &str) -> ProjectServiceAccountSignJwtCall<'a, C> {
34320        self._name = new_value.to_string();
34321        self
34322    }
34323    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
34324    /// while executing the actual API request.
34325    ///
34326    /// ````text
34327    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
34328    /// ````
34329    ///
34330    /// Sets the *delegate* property to the given value.
34331    pub fn delegate(
34332        mut self,
34333        new_value: &'a mut dyn common::Delegate,
34334    ) -> ProjectServiceAccountSignJwtCall<'a, C> {
34335        self._delegate = Some(new_value);
34336        self
34337    }
34338
34339    /// Set any additional parameter of the query string used in the request.
34340    /// It should be used to set parameters which are not yet available through their own
34341    /// setters.
34342    ///
34343    /// Please note that this method must not be used to set any of the known parameters
34344    /// which have their own setter method. If done anyway, the request will fail.
34345    ///
34346    /// # Additional Parameters
34347    ///
34348    /// * *$.xgafv* (query-string) - V1 error format.
34349    /// * *access_token* (query-string) - OAuth access token.
34350    /// * *alt* (query-string) - Data format for response.
34351    /// * *callback* (query-string) - JSONP
34352    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
34353    /// * *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.
34354    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
34355    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
34356    /// * *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.
34357    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
34358    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
34359    pub fn param<T>(mut self, name: T, value: T) -> ProjectServiceAccountSignJwtCall<'a, C>
34360    where
34361        T: AsRef<str>,
34362    {
34363        self._additional_params
34364            .insert(name.as_ref().to_string(), value.as_ref().to_string());
34365        self
34366    }
34367
34368    /// Identifies the authorization scope for the method you are building.
34369    ///
34370    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
34371    /// [`Scope::CloudPlatform`].
34372    ///
34373    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
34374    /// tokens for more than one scope.
34375    ///
34376    /// Usually there is more than one suitable scope to authorize an operation, some of which may
34377    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
34378    /// sufficient, a read-write scope will do as well.
34379    pub fn add_scope<St>(mut self, scope: St) -> ProjectServiceAccountSignJwtCall<'a, C>
34380    where
34381        St: AsRef<str>,
34382    {
34383        self._scopes.insert(String::from(scope.as_ref()));
34384        self
34385    }
34386    /// Identifies the authorization scope(s) for the method you are building.
34387    ///
34388    /// See [`Self::add_scope()`] for details.
34389    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectServiceAccountSignJwtCall<'a, C>
34390    where
34391        I: IntoIterator<Item = St>,
34392        St: AsRef<str>,
34393    {
34394        self._scopes
34395            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
34396        self
34397    }
34398
34399    /// Removes all scopes, and no default scope will be used either.
34400    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
34401    /// for details).
34402    pub fn clear_scopes(mut self) -> ProjectServiceAccountSignJwtCall<'a, C> {
34403        self._scopes.clear();
34404        self
34405    }
34406}
34407
34408/// Tests whether the caller has the specified permissions on a ServiceAccount.
34409///
34410/// A builder for the *serviceAccounts.testIamPermissions* method supported by a *project* resource.
34411/// It is not used directly, but through a [`ProjectMethods`] instance.
34412///
34413/// # Example
34414///
34415/// Instantiate a resource method builder
34416///
34417/// ```test_harness,no_run
34418/// # extern crate hyper;
34419/// # extern crate hyper_rustls;
34420/// # extern crate google_iam1 as iam1;
34421/// use iam1::api::TestIamPermissionsRequest;
34422/// # async fn dox() {
34423/// # use iam1::{Iam, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
34424///
34425/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
34426/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
34427/// #     secret,
34428/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
34429/// # ).build().await.unwrap();
34430///
34431/// # let client = hyper_util::client::legacy::Client::builder(
34432/// #     hyper_util::rt::TokioExecutor::new()
34433/// # )
34434/// # .build(
34435/// #     hyper_rustls::HttpsConnectorBuilder::new()
34436/// #         .with_native_roots()
34437/// #         .unwrap()
34438/// #         .https_or_http()
34439/// #         .enable_http1()
34440/// #         .build()
34441/// # );
34442/// # let mut hub = Iam::new(client, auth);
34443/// // As the method needs a request, you would usually fill it with the desired information
34444/// // into the respective structure. Some of the parts shown here might not be applicable !
34445/// // Values shown here are possibly random and not representative !
34446/// let mut req = TestIamPermissionsRequest::default();
34447///
34448/// // You can configure optional parameters by calling the respective setters at will, and
34449/// // execute the final call using `doit()`.
34450/// // Values shown here are possibly random and not representative !
34451/// let result = hub.projects().service_accounts_test_iam_permissions(req, "resource")
34452///              .doit().await;
34453/// # }
34454/// ```
34455pub struct ProjectServiceAccountTestIamPermissionCall<'a, C>
34456where
34457    C: 'a,
34458{
34459    hub: &'a Iam<C>,
34460    _request: TestIamPermissionsRequest,
34461    _resource: String,
34462    _delegate: Option<&'a mut dyn common::Delegate>,
34463    _additional_params: HashMap<String, String>,
34464    _scopes: BTreeSet<String>,
34465}
34466
34467impl<'a, C> common::CallBuilder for ProjectServiceAccountTestIamPermissionCall<'a, C> {}
34468
34469impl<'a, C> ProjectServiceAccountTestIamPermissionCall<'a, C>
34470where
34471    C: common::Connector,
34472{
34473    /// Perform the operation you have build so far.
34474    pub async fn doit(mut self) -> common::Result<(common::Response, TestIamPermissionsResponse)> {
34475        use std::borrow::Cow;
34476        use std::io::{Read, Seek};
34477
34478        use common::{url::Params, ToParts};
34479        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
34480
34481        let mut dd = common::DefaultDelegate;
34482        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
34483        dlg.begin(common::MethodInfo {
34484            id: "iam.projects.serviceAccounts.testIamPermissions",
34485            http_method: hyper::Method::POST,
34486        });
34487
34488        for &field in ["alt", "resource"].iter() {
34489            if self._additional_params.contains_key(field) {
34490                dlg.finished(false);
34491                return Err(common::Error::FieldClash(field));
34492            }
34493        }
34494
34495        let mut params = Params::with_capacity(4 + self._additional_params.len());
34496        params.push("resource", self._resource);
34497
34498        params.extend(self._additional_params.iter());
34499
34500        params.push("alt", "json");
34501        let mut url = self.hub._base_url.clone() + "v1/{+resource}:testIamPermissions";
34502        if self._scopes.is_empty() {
34503            self._scopes
34504                .insert(Scope::CloudPlatform.as_ref().to_string());
34505        }
34506
34507        #[allow(clippy::single_element_loop)]
34508        for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
34509            url = params.uri_replacement(url, param_name, find_this, true);
34510        }
34511        {
34512            let to_remove = ["resource"];
34513            params.remove_params(&to_remove);
34514        }
34515
34516        let url = params.parse_with_url(&url);
34517
34518        let mut json_mime_type = mime::APPLICATION_JSON;
34519        let mut request_value_reader = {
34520            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
34521            common::remove_json_null_values(&mut value);
34522            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
34523            serde_json::to_writer(&mut dst, &value).unwrap();
34524            dst
34525        };
34526        let request_size = request_value_reader
34527            .seek(std::io::SeekFrom::End(0))
34528            .unwrap();
34529        request_value_reader
34530            .seek(std::io::SeekFrom::Start(0))
34531            .unwrap();
34532
34533        loop {
34534            let token = match self
34535                .hub
34536                .auth
34537                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
34538                .await
34539            {
34540                Ok(token) => token,
34541                Err(e) => match dlg.token(e) {
34542                    Ok(token) => token,
34543                    Err(e) => {
34544                        dlg.finished(false);
34545                        return Err(common::Error::MissingToken(e));
34546                    }
34547                },
34548            };
34549            request_value_reader
34550                .seek(std::io::SeekFrom::Start(0))
34551                .unwrap();
34552            let mut req_result = {
34553                let client = &self.hub.client;
34554                dlg.pre_request();
34555                let mut req_builder = hyper::Request::builder()
34556                    .method(hyper::Method::POST)
34557                    .uri(url.as_str())
34558                    .header(USER_AGENT, self.hub._user_agent.clone());
34559
34560                if let Some(token) = token.as_ref() {
34561                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
34562                }
34563
34564                let request = req_builder
34565                    .header(CONTENT_TYPE, json_mime_type.to_string())
34566                    .header(CONTENT_LENGTH, request_size as u64)
34567                    .body(common::to_body(
34568                        request_value_reader.get_ref().clone().into(),
34569                    ));
34570
34571                client.request(request.unwrap()).await
34572            };
34573
34574            match req_result {
34575                Err(err) => {
34576                    if let common::Retry::After(d) = dlg.http_error(&err) {
34577                        sleep(d).await;
34578                        continue;
34579                    }
34580                    dlg.finished(false);
34581                    return Err(common::Error::HttpError(err));
34582                }
34583                Ok(res) => {
34584                    let (mut parts, body) = res.into_parts();
34585                    let mut body = common::Body::new(body);
34586                    if !parts.status.is_success() {
34587                        let bytes = common::to_bytes(body).await.unwrap_or_default();
34588                        let error = serde_json::from_str(&common::to_string(&bytes));
34589                        let response = common::to_response(parts, bytes.into());
34590
34591                        if let common::Retry::After(d) =
34592                            dlg.http_failure(&response, error.as_ref().ok())
34593                        {
34594                            sleep(d).await;
34595                            continue;
34596                        }
34597
34598                        dlg.finished(false);
34599
34600                        return Err(match error {
34601                            Ok(value) => common::Error::BadRequest(value),
34602                            _ => common::Error::Failure(response),
34603                        });
34604                    }
34605                    let response = {
34606                        let bytes = common::to_bytes(body).await.unwrap_or_default();
34607                        let encoded = common::to_string(&bytes);
34608                        match serde_json::from_str(&encoded) {
34609                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
34610                            Err(error) => {
34611                                dlg.response_json_decode_error(&encoded, &error);
34612                                return Err(common::Error::JsonDecodeError(
34613                                    encoded.to_string(),
34614                                    error,
34615                                ));
34616                            }
34617                        }
34618                    };
34619
34620                    dlg.finished(true);
34621                    return Ok(response);
34622                }
34623            }
34624        }
34625    }
34626
34627    ///
34628    /// Sets the *request* property to the given value.
34629    ///
34630    /// Even though the property as already been set when instantiating this call,
34631    /// we provide this method for API completeness.
34632    pub fn request(
34633        mut self,
34634        new_value: TestIamPermissionsRequest,
34635    ) -> ProjectServiceAccountTestIamPermissionCall<'a, C> {
34636        self._request = new_value;
34637        self
34638    }
34639    /// REQUIRED: The resource for which the policy detail is being requested. See [Resource names](https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
34640    ///
34641    /// Sets the *resource* path property to the given value.
34642    ///
34643    /// Even though the property as already been set when instantiating this call,
34644    /// we provide this method for API completeness.
34645    pub fn resource(
34646        mut self,
34647        new_value: &str,
34648    ) -> ProjectServiceAccountTestIamPermissionCall<'a, C> {
34649        self._resource = new_value.to_string();
34650        self
34651    }
34652    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
34653    /// while executing the actual API request.
34654    ///
34655    /// ````text
34656    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
34657    /// ````
34658    ///
34659    /// Sets the *delegate* property to the given value.
34660    pub fn delegate(
34661        mut self,
34662        new_value: &'a mut dyn common::Delegate,
34663    ) -> ProjectServiceAccountTestIamPermissionCall<'a, C> {
34664        self._delegate = Some(new_value);
34665        self
34666    }
34667
34668    /// Set any additional parameter of the query string used in the request.
34669    /// It should be used to set parameters which are not yet available through their own
34670    /// setters.
34671    ///
34672    /// Please note that this method must not be used to set any of the known parameters
34673    /// which have their own setter method. If done anyway, the request will fail.
34674    ///
34675    /// # Additional Parameters
34676    ///
34677    /// * *$.xgafv* (query-string) - V1 error format.
34678    /// * *access_token* (query-string) - OAuth access token.
34679    /// * *alt* (query-string) - Data format for response.
34680    /// * *callback* (query-string) - JSONP
34681    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
34682    /// * *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.
34683    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
34684    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
34685    /// * *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.
34686    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
34687    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
34688    pub fn param<T>(
34689        mut self,
34690        name: T,
34691        value: T,
34692    ) -> ProjectServiceAccountTestIamPermissionCall<'a, C>
34693    where
34694        T: AsRef<str>,
34695    {
34696        self._additional_params
34697            .insert(name.as_ref().to_string(), value.as_ref().to_string());
34698        self
34699    }
34700
34701    /// Identifies the authorization scope for the method you are building.
34702    ///
34703    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
34704    /// [`Scope::CloudPlatform`].
34705    ///
34706    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
34707    /// tokens for more than one scope.
34708    ///
34709    /// Usually there is more than one suitable scope to authorize an operation, some of which may
34710    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
34711    /// sufficient, a read-write scope will do as well.
34712    pub fn add_scope<St>(mut self, scope: St) -> ProjectServiceAccountTestIamPermissionCall<'a, C>
34713    where
34714        St: AsRef<str>,
34715    {
34716        self._scopes.insert(String::from(scope.as_ref()));
34717        self
34718    }
34719    /// Identifies the authorization scope(s) for the method you are building.
34720    ///
34721    /// See [`Self::add_scope()`] for details.
34722    pub fn add_scopes<I, St>(
34723        mut self,
34724        scopes: I,
34725    ) -> ProjectServiceAccountTestIamPermissionCall<'a, C>
34726    where
34727        I: IntoIterator<Item = St>,
34728        St: AsRef<str>,
34729    {
34730        self._scopes
34731            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
34732        self
34733    }
34734
34735    /// Removes all scopes, and no default scope will be used either.
34736    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
34737    /// for details).
34738    pub fn clear_scopes(mut self) -> ProjectServiceAccountTestIamPermissionCall<'a, C> {
34739        self._scopes.clear();
34740        self
34741    }
34742}
34743
34744/// Restores a deleted ServiceAccount. **Important:** It is not always possible to restore a deleted service account. Use this method only as a last resort. After you delete a service account, IAM permanently removes the service account 30 days later. There is no way to restore a deleted service account that has been permanently removed.
34745///
34746/// A builder for the *serviceAccounts.undelete* method supported by a *project* resource.
34747/// It is not used directly, but through a [`ProjectMethods`] instance.
34748///
34749/// # Example
34750///
34751/// Instantiate a resource method builder
34752///
34753/// ```test_harness,no_run
34754/// # extern crate hyper;
34755/// # extern crate hyper_rustls;
34756/// # extern crate google_iam1 as iam1;
34757/// use iam1::api::UndeleteServiceAccountRequest;
34758/// # async fn dox() {
34759/// # use iam1::{Iam, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
34760///
34761/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
34762/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
34763/// #     secret,
34764/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
34765/// # ).build().await.unwrap();
34766///
34767/// # let client = hyper_util::client::legacy::Client::builder(
34768/// #     hyper_util::rt::TokioExecutor::new()
34769/// # )
34770/// # .build(
34771/// #     hyper_rustls::HttpsConnectorBuilder::new()
34772/// #         .with_native_roots()
34773/// #         .unwrap()
34774/// #         .https_or_http()
34775/// #         .enable_http1()
34776/// #         .build()
34777/// # );
34778/// # let mut hub = Iam::new(client, auth);
34779/// // As the method needs a request, you would usually fill it with the desired information
34780/// // into the respective structure. Some of the parts shown here might not be applicable !
34781/// // Values shown here are possibly random and not representative !
34782/// let mut req = UndeleteServiceAccountRequest::default();
34783///
34784/// // You can configure optional parameters by calling the respective setters at will, and
34785/// // execute the final call using `doit()`.
34786/// // Values shown here are possibly random and not representative !
34787/// let result = hub.projects().service_accounts_undelete(req, "name")
34788///              .doit().await;
34789/// # }
34790/// ```
34791pub struct ProjectServiceAccountUndeleteCall<'a, C>
34792where
34793    C: 'a,
34794{
34795    hub: &'a Iam<C>,
34796    _request: UndeleteServiceAccountRequest,
34797    _name: String,
34798    _delegate: Option<&'a mut dyn common::Delegate>,
34799    _additional_params: HashMap<String, String>,
34800    _scopes: BTreeSet<String>,
34801}
34802
34803impl<'a, C> common::CallBuilder for ProjectServiceAccountUndeleteCall<'a, C> {}
34804
34805impl<'a, C> ProjectServiceAccountUndeleteCall<'a, C>
34806where
34807    C: common::Connector,
34808{
34809    /// Perform the operation you have build so far.
34810    pub async fn doit(
34811        mut self,
34812    ) -> common::Result<(common::Response, UndeleteServiceAccountResponse)> {
34813        use std::borrow::Cow;
34814        use std::io::{Read, Seek};
34815
34816        use common::{url::Params, ToParts};
34817        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
34818
34819        let mut dd = common::DefaultDelegate;
34820        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
34821        dlg.begin(common::MethodInfo {
34822            id: "iam.projects.serviceAccounts.undelete",
34823            http_method: hyper::Method::POST,
34824        });
34825
34826        for &field in ["alt", "name"].iter() {
34827            if self._additional_params.contains_key(field) {
34828                dlg.finished(false);
34829                return Err(common::Error::FieldClash(field));
34830            }
34831        }
34832
34833        let mut params = Params::with_capacity(4 + self._additional_params.len());
34834        params.push("name", self._name);
34835
34836        params.extend(self._additional_params.iter());
34837
34838        params.push("alt", "json");
34839        let mut url = self.hub._base_url.clone() + "v1/{+name}:undelete";
34840        if self._scopes.is_empty() {
34841            self._scopes
34842                .insert(Scope::CloudPlatform.as_ref().to_string());
34843        }
34844
34845        #[allow(clippy::single_element_loop)]
34846        for &(find_this, param_name) in [("{+name}", "name")].iter() {
34847            url = params.uri_replacement(url, param_name, find_this, true);
34848        }
34849        {
34850            let to_remove = ["name"];
34851            params.remove_params(&to_remove);
34852        }
34853
34854        let url = params.parse_with_url(&url);
34855
34856        let mut json_mime_type = mime::APPLICATION_JSON;
34857        let mut request_value_reader = {
34858            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
34859            common::remove_json_null_values(&mut value);
34860            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
34861            serde_json::to_writer(&mut dst, &value).unwrap();
34862            dst
34863        };
34864        let request_size = request_value_reader
34865            .seek(std::io::SeekFrom::End(0))
34866            .unwrap();
34867        request_value_reader
34868            .seek(std::io::SeekFrom::Start(0))
34869            .unwrap();
34870
34871        loop {
34872            let token = match self
34873                .hub
34874                .auth
34875                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
34876                .await
34877            {
34878                Ok(token) => token,
34879                Err(e) => match dlg.token(e) {
34880                    Ok(token) => token,
34881                    Err(e) => {
34882                        dlg.finished(false);
34883                        return Err(common::Error::MissingToken(e));
34884                    }
34885                },
34886            };
34887            request_value_reader
34888                .seek(std::io::SeekFrom::Start(0))
34889                .unwrap();
34890            let mut req_result = {
34891                let client = &self.hub.client;
34892                dlg.pre_request();
34893                let mut req_builder = hyper::Request::builder()
34894                    .method(hyper::Method::POST)
34895                    .uri(url.as_str())
34896                    .header(USER_AGENT, self.hub._user_agent.clone());
34897
34898                if let Some(token) = token.as_ref() {
34899                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
34900                }
34901
34902                let request = req_builder
34903                    .header(CONTENT_TYPE, json_mime_type.to_string())
34904                    .header(CONTENT_LENGTH, request_size as u64)
34905                    .body(common::to_body(
34906                        request_value_reader.get_ref().clone().into(),
34907                    ));
34908
34909                client.request(request.unwrap()).await
34910            };
34911
34912            match req_result {
34913                Err(err) => {
34914                    if let common::Retry::After(d) = dlg.http_error(&err) {
34915                        sleep(d).await;
34916                        continue;
34917                    }
34918                    dlg.finished(false);
34919                    return Err(common::Error::HttpError(err));
34920                }
34921                Ok(res) => {
34922                    let (mut parts, body) = res.into_parts();
34923                    let mut body = common::Body::new(body);
34924                    if !parts.status.is_success() {
34925                        let bytes = common::to_bytes(body).await.unwrap_or_default();
34926                        let error = serde_json::from_str(&common::to_string(&bytes));
34927                        let response = common::to_response(parts, bytes.into());
34928
34929                        if let common::Retry::After(d) =
34930                            dlg.http_failure(&response, error.as_ref().ok())
34931                        {
34932                            sleep(d).await;
34933                            continue;
34934                        }
34935
34936                        dlg.finished(false);
34937
34938                        return Err(match error {
34939                            Ok(value) => common::Error::BadRequest(value),
34940                            _ => common::Error::Failure(response),
34941                        });
34942                    }
34943                    let response = {
34944                        let bytes = common::to_bytes(body).await.unwrap_or_default();
34945                        let encoded = common::to_string(&bytes);
34946                        match serde_json::from_str(&encoded) {
34947                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
34948                            Err(error) => {
34949                                dlg.response_json_decode_error(&encoded, &error);
34950                                return Err(common::Error::JsonDecodeError(
34951                                    encoded.to_string(),
34952                                    error,
34953                                ));
34954                            }
34955                        }
34956                    };
34957
34958                    dlg.finished(true);
34959                    return Ok(response);
34960                }
34961            }
34962        }
34963    }
34964
34965    ///
34966    /// Sets the *request* property to the given value.
34967    ///
34968    /// Even though the property as already been set when instantiating this call,
34969    /// we provide this method for API completeness.
34970    pub fn request(
34971        mut self,
34972        new_value: UndeleteServiceAccountRequest,
34973    ) -> ProjectServiceAccountUndeleteCall<'a, C> {
34974        self._request = new_value;
34975        self
34976    }
34977    /// The resource name of the service account. Use one of the following formats: * `projects/{PROJECT_ID}/serviceAccounts/{EMAIL_ADDRESS}` * `projects/{PROJECT_ID}/serviceAccounts/{UNIQUE_ID}` As an alternative, you can use the `-` wildcard character instead of the project ID: * `projects/-/serviceAccounts/{EMAIL_ADDRESS}` * `projects/-/serviceAccounts/{UNIQUE_ID}` When possible, avoid using the `-` wildcard character, because it can cause response messages to contain misleading error codes. For example, if you try to access the service account `projects/-/serviceAccounts/fake@example.com`, which does not exist, the response contains an HTTP `403 Forbidden` error instead of a `404 Not Found` error.
34978    ///
34979    /// Sets the *name* path property to the given value.
34980    ///
34981    /// Even though the property as already been set when instantiating this call,
34982    /// we provide this method for API completeness.
34983    pub fn name(mut self, new_value: &str) -> ProjectServiceAccountUndeleteCall<'a, C> {
34984        self._name = new_value.to_string();
34985        self
34986    }
34987    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
34988    /// while executing the actual API request.
34989    ///
34990    /// ````text
34991    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
34992    /// ````
34993    ///
34994    /// Sets the *delegate* property to the given value.
34995    pub fn delegate(
34996        mut self,
34997        new_value: &'a mut dyn common::Delegate,
34998    ) -> ProjectServiceAccountUndeleteCall<'a, C> {
34999        self._delegate = Some(new_value);
35000        self
35001    }
35002
35003    /// Set any additional parameter of the query string used in the request.
35004    /// It should be used to set parameters which are not yet available through their own
35005    /// setters.
35006    ///
35007    /// Please note that this method must not be used to set any of the known parameters
35008    /// which have their own setter method. If done anyway, the request will fail.
35009    ///
35010    /// # Additional Parameters
35011    ///
35012    /// * *$.xgafv* (query-string) - V1 error format.
35013    /// * *access_token* (query-string) - OAuth access token.
35014    /// * *alt* (query-string) - Data format for response.
35015    /// * *callback* (query-string) - JSONP
35016    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
35017    /// * *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.
35018    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
35019    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
35020    /// * *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.
35021    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
35022    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
35023    pub fn param<T>(mut self, name: T, value: T) -> ProjectServiceAccountUndeleteCall<'a, C>
35024    where
35025        T: AsRef<str>,
35026    {
35027        self._additional_params
35028            .insert(name.as_ref().to_string(), value.as_ref().to_string());
35029        self
35030    }
35031
35032    /// Identifies the authorization scope for the method you are building.
35033    ///
35034    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
35035    /// [`Scope::CloudPlatform`].
35036    ///
35037    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
35038    /// tokens for more than one scope.
35039    ///
35040    /// Usually there is more than one suitable scope to authorize an operation, some of which may
35041    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
35042    /// sufficient, a read-write scope will do as well.
35043    pub fn add_scope<St>(mut self, scope: St) -> ProjectServiceAccountUndeleteCall<'a, C>
35044    where
35045        St: AsRef<str>,
35046    {
35047        self._scopes.insert(String::from(scope.as_ref()));
35048        self
35049    }
35050    /// Identifies the authorization scope(s) for the method you are building.
35051    ///
35052    /// See [`Self::add_scope()`] for details.
35053    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectServiceAccountUndeleteCall<'a, C>
35054    where
35055        I: IntoIterator<Item = St>,
35056        St: AsRef<str>,
35057    {
35058        self._scopes
35059            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
35060        self
35061    }
35062
35063    /// Removes all scopes, and no default scope will be used either.
35064    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
35065    /// for details).
35066    pub fn clear_scopes(mut self) -> ProjectServiceAccountUndeleteCall<'a, C> {
35067        self._scopes.clear();
35068        self
35069    }
35070}
35071
35072/// **Note:** We are in the process of deprecating this method. Use PatchServiceAccount instead. Updates a ServiceAccount. You can update only the `display_name` field.
35073///
35074/// A builder for the *serviceAccounts.update* method supported by a *project* resource.
35075/// It is not used directly, but through a [`ProjectMethods`] instance.
35076///
35077/// # Example
35078///
35079/// Instantiate a resource method builder
35080///
35081/// ```test_harness,no_run
35082/// # extern crate hyper;
35083/// # extern crate hyper_rustls;
35084/// # extern crate google_iam1 as iam1;
35085/// use iam1::api::ServiceAccount;
35086/// # async fn dox() {
35087/// # use iam1::{Iam, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
35088///
35089/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
35090/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
35091/// #     secret,
35092/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
35093/// # ).build().await.unwrap();
35094///
35095/// # let client = hyper_util::client::legacy::Client::builder(
35096/// #     hyper_util::rt::TokioExecutor::new()
35097/// # )
35098/// # .build(
35099/// #     hyper_rustls::HttpsConnectorBuilder::new()
35100/// #         .with_native_roots()
35101/// #         .unwrap()
35102/// #         .https_or_http()
35103/// #         .enable_http1()
35104/// #         .build()
35105/// # );
35106/// # let mut hub = Iam::new(client, auth);
35107/// // As the method needs a request, you would usually fill it with the desired information
35108/// // into the respective structure. Some of the parts shown here might not be applicable !
35109/// // Values shown here are possibly random and not representative !
35110/// let mut req = ServiceAccount::default();
35111///
35112/// // You can configure optional parameters by calling the respective setters at will, and
35113/// // execute the final call using `doit()`.
35114/// // Values shown here are possibly random and not representative !
35115/// let result = hub.projects().service_accounts_update(req, "name")
35116///              .doit().await;
35117/// # }
35118/// ```
35119pub struct ProjectServiceAccountUpdateCall<'a, C>
35120where
35121    C: 'a,
35122{
35123    hub: &'a Iam<C>,
35124    _request: ServiceAccount,
35125    _name: String,
35126    _delegate: Option<&'a mut dyn common::Delegate>,
35127    _additional_params: HashMap<String, String>,
35128    _scopes: BTreeSet<String>,
35129}
35130
35131impl<'a, C> common::CallBuilder for ProjectServiceAccountUpdateCall<'a, C> {}
35132
35133impl<'a, C> ProjectServiceAccountUpdateCall<'a, C>
35134where
35135    C: common::Connector,
35136{
35137    /// Perform the operation you have build so far.
35138    pub async fn doit(mut self) -> common::Result<(common::Response, ServiceAccount)> {
35139        use std::borrow::Cow;
35140        use std::io::{Read, Seek};
35141
35142        use common::{url::Params, ToParts};
35143        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
35144
35145        let mut dd = common::DefaultDelegate;
35146        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
35147        dlg.begin(common::MethodInfo {
35148            id: "iam.projects.serviceAccounts.update",
35149            http_method: hyper::Method::PUT,
35150        });
35151
35152        for &field in ["alt", "name"].iter() {
35153            if self._additional_params.contains_key(field) {
35154                dlg.finished(false);
35155                return Err(common::Error::FieldClash(field));
35156            }
35157        }
35158
35159        let mut params = Params::with_capacity(4 + self._additional_params.len());
35160        params.push("name", self._name);
35161
35162        params.extend(self._additional_params.iter());
35163
35164        params.push("alt", "json");
35165        let mut url = self.hub._base_url.clone() + "v1/{+name}";
35166        if self._scopes.is_empty() {
35167            self._scopes
35168                .insert(Scope::CloudPlatform.as_ref().to_string());
35169        }
35170
35171        #[allow(clippy::single_element_loop)]
35172        for &(find_this, param_name) in [("{+name}", "name")].iter() {
35173            url = params.uri_replacement(url, param_name, find_this, true);
35174        }
35175        {
35176            let to_remove = ["name"];
35177            params.remove_params(&to_remove);
35178        }
35179
35180        let url = params.parse_with_url(&url);
35181
35182        let mut json_mime_type = mime::APPLICATION_JSON;
35183        let mut request_value_reader = {
35184            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
35185            common::remove_json_null_values(&mut value);
35186            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
35187            serde_json::to_writer(&mut dst, &value).unwrap();
35188            dst
35189        };
35190        let request_size = request_value_reader
35191            .seek(std::io::SeekFrom::End(0))
35192            .unwrap();
35193        request_value_reader
35194            .seek(std::io::SeekFrom::Start(0))
35195            .unwrap();
35196
35197        loop {
35198            let token = match self
35199                .hub
35200                .auth
35201                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
35202                .await
35203            {
35204                Ok(token) => token,
35205                Err(e) => match dlg.token(e) {
35206                    Ok(token) => token,
35207                    Err(e) => {
35208                        dlg.finished(false);
35209                        return Err(common::Error::MissingToken(e));
35210                    }
35211                },
35212            };
35213            request_value_reader
35214                .seek(std::io::SeekFrom::Start(0))
35215                .unwrap();
35216            let mut req_result = {
35217                let client = &self.hub.client;
35218                dlg.pre_request();
35219                let mut req_builder = hyper::Request::builder()
35220                    .method(hyper::Method::PUT)
35221                    .uri(url.as_str())
35222                    .header(USER_AGENT, self.hub._user_agent.clone());
35223
35224                if let Some(token) = token.as_ref() {
35225                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
35226                }
35227
35228                let request = req_builder
35229                    .header(CONTENT_TYPE, json_mime_type.to_string())
35230                    .header(CONTENT_LENGTH, request_size as u64)
35231                    .body(common::to_body(
35232                        request_value_reader.get_ref().clone().into(),
35233                    ));
35234
35235                client.request(request.unwrap()).await
35236            };
35237
35238            match req_result {
35239                Err(err) => {
35240                    if let common::Retry::After(d) = dlg.http_error(&err) {
35241                        sleep(d).await;
35242                        continue;
35243                    }
35244                    dlg.finished(false);
35245                    return Err(common::Error::HttpError(err));
35246                }
35247                Ok(res) => {
35248                    let (mut parts, body) = res.into_parts();
35249                    let mut body = common::Body::new(body);
35250                    if !parts.status.is_success() {
35251                        let bytes = common::to_bytes(body).await.unwrap_or_default();
35252                        let error = serde_json::from_str(&common::to_string(&bytes));
35253                        let response = common::to_response(parts, bytes.into());
35254
35255                        if let common::Retry::After(d) =
35256                            dlg.http_failure(&response, error.as_ref().ok())
35257                        {
35258                            sleep(d).await;
35259                            continue;
35260                        }
35261
35262                        dlg.finished(false);
35263
35264                        return Err(match error {
35265                            Ok(value) => common::Error::BadRequest(value),
35266                            _ => common::Error::Failure(response),
35267                        });
35268                    }
35269                    let response = {
35270                        let bytes = common::to_bytes(body).await.unwrap_or_default();
35271                        let encoded = common::to_string(&bytes);
35272                        match serde_json::from_str(&encoded) {
35273                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
35274                            Err(error) => {
35275                                dlg.response_json_decode_error(&encoded, &error);
35276                                return Err(common::Error::JsonDecodeError(
35277                                    encoded.to_string(),
35278                                    error,
35279                                ));
35280                            }
35281                        }
35282                    };
35283
35284                    dlg.finished(true);
35285                    return Ok(response);
35286                }
35287            }
35288        }
35289    }
35290
35291    ///
35292    /// Sets the *request* property to the given value.
35293    ///
35294    /// Even though the property as already been set when instantiating this call,
35295    /// we provide this method for API completeness.
35296    pub fn request(mut self, new_value: ServiceAccount) -> ProjectServiceAccountUpdateCall<'a, C> {
35297        self._request = new_value;
35298        self
35299    }
35300    /// The resource name of the service account. Use one of the following formats: * `projects/{PROJECT_ID}/serviceAccounts/{EMAIL_ADDRESS}` * `projects/{PROJECT_ID}/serviceAccounts/{UNIQUE_ID}` As an alternative, you can use the `-` wildcard character instead of the project ID: * `projects/-/serviceAccounts/{EMAIL_ADDRESS}` * `projects/-/serviceAccounts/{UNIQUE_ID}` When possible, avoid using the `-` wildcard character, because it can cause response messages to contain misleading error codes. For example, if you try to access the service account `projects/-/serviceAccounts/fake@example.com`, which does not exist, the response contains an HTTP `403 Forbidden` error instead of a `404 Not Found` error.
35301    ///
35302    /// Sets the *name* path property to the given value.
35303    ///
35304    /// Even though the property as already been set when instantiating this call,
35305    /// we provide this method for API completeness.
35306    pub fn name(mut self, new_value: &str) -> ProjectServiceAccountUpdateCall<'a, C> {
35307        self._name = new_value.to_string();
35308        self
35309    }
35310    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
35311    /// while executing the actual API request.
35312    ///
35313    /// ````text
35314    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
35315    /// ````
35316    ///
35317    /// Sets the *delegate* property to the given value.
35318    pub fn delegate(
35319        mut self,
35320        new_value: &'a mut dyn common::Delegate,
35321    ) -> ProjectServiceAccountUpdateCall<'a, C> {
35322        self._delegate = Some(new_value);
35323        self
35324    }
35325
35326    /// Set any additional parameter of the query string used in the request.
35327    /// It should be used to set parameters which are not yet available through their own
35328    /// setters.
35329    ///
35330    /// Please note that this method must not be used to set any of the known parameters
35331    /// which have their own setter method. If done anyway, the request will fail.
35332    ///
35333    /// # Additional Parameters
35334    ///
35335    /// * *$.xgafv* (query-string) - V1 error format.
35336    /// * *access_token* (query-string) - OAuth access token.
35337    /// * *alt* (query-string) - Data format for response.
35338    /// * *callback* (query-string) - JSONP
35339    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
35340    /// * *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.
35341    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
35342    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
35343    /// * *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.
35344    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
35345    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
35346    pub fn param<T>(mut self, name: T, value: T) -> ProjectServiceAccountUpdateCall<'a, C>
35347    where
35348        T: AsRef<str>,
35349    {
35350        self._additional_params
35351            .insert(name.as_ref().to_string(), value.as_ref().to_string());
35352        self
35353    }
35354
35355    /// Identifies the authorization scope for the method you are building.
35356    ///
35357    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
35358    /// [`Scope::CloudPlatform`].
35359    ///
35360    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
35361    /// tokens for more than one scope.
35362    ///
35363    /// Usually there is more than one suitable scope to authorize an operation, some of which may
35364    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
35365    /// sufficient, a read-write scope will do as well.
35366    pub fn add_scope<St>(mut self, scope: St) -> ProjectServiceAccountUpdateCall<'a, C>
35367    where
35368        St: AsRef<str>,
35369    {
35370        self._scopes.insert(String::from(scope.as_ref()));
35371        self
35372    }
35373    /// Identifies the authorization scope(s) for the method you are building.
35374    ///
35375    /// See [`Self::add_scope()`] for details.
35376    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectServiceAccountUpdateCall<'a, C>
35377    where
35378        I: IntoIterator<Item = St>,
35379        St: AsRef<str>,
35380    {
35381        self._scopes
35382            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
35383        self
35384    }
35385
35386    /// Removes all scopes, and no default scope will be used either.
35387    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
35388    /// for details).
35389    pub fn clear_scopes(mut self) -> ProjectServiceAccountUpdateCall<'a, C> {
35390        self._scopes.clear();
35391        self
35392    }
35393}
35394
35395/// Gets the definition of a Role.
35396///
35397/// A builder for the *get* method supported by a *role* resource.
35398/// It is not used directly, but through a [`RoleMethods`] instance.
35399///
35400/// # Example
35401///
35402/// Instantiate a resource method builder
35403///
35404/// ```test_harness,no_run
35405/// # extern crate hyper;
35406/// # extern crate hyper_rustls;
35407/// # extern crate google_iam1 as iam1;
35408/// # async fn dox() {
35409/// # use iam1::{Iam, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
35410///
35411/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
35412/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
35413/// #     secret,
35414/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
35415/// # ).build().await.unwrap();
35416///
35417/// # let client = hyper_util::client::legacy::Client::builder(
35418/// #     hyper_util::rt::TokioExecutor::new()
35419/// # )
35420/// # .build(
35421/// #     hyper_rustls::HttpsConnectorBuilder::new()
35422/// #         .with_native_roots()
35423/// #         .unwrap()
35424/// #         .https_or_http()
35425/// #         .enable_http1()
35426/// #         .build()
35427/// # );
35428/// # let mut hub = Iam::new(client, auth);
35429/// // You can configure optional parameters by calling the respective setters at will, and
35430/// // execute the final call using `doit()`.
35431/// // Values shown here are possibly random and not representative !
35432/// let result = hub.roles().get("name")
35433///              .doit().await;
35434/// # }
35435/// ```
35436pub struct RoleGetCall<'a, C>
35437where
35438    C: 'a,
35439{
35440    hub: &'a Iam<C>,
35441    _name: String,
35442    _delegate: Option<&'a mut dyn common::Delegate>,
35443    _additional_params: HashMap<String, String>,
35444    _scopes: BTreeSet<String>,
35445}
35446
35447impl<'a, C> common::CallBuilder for RoleGetCall<'a, C> {}
35448
35449impl<'a, C> RoleGetCall<'a, C>
35450where
35451    C: common::Connector,
35452{
35453    /// Perform the operation you have build so far.
35454    pub async fn doit(mut self) -> common::Result<(common::Response, Role)> {
35455        use std::borrow::Cow;
35456        use std::io::{Read, Seek};
35457
35458        use common::{url::Params, ToParts};
35459        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
35460
35461        let mut dd = common::DefaultDelegate;
35462        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
35463        dlg.begin(common::MethodInfo {
35464            id: "iam.roles.get",
35465            http_method: hyper::Method::GET,
35466        });
35467
35468        for &field in ["alt", "name"].iter() {
35469            if self._additional_params.contains_key(field) {
35470                dlg.finished(false);
35471                return Err(common::Error::FieldClash(field));
35472            }
35473        }
35474
35475        let mut params = Params::with_capacity(3 + self._additional_params.len());
35476        params.push("name", self._name);
35477
35478        params.extend(self._additional_params.iter());
35479
35480        params.push("alt", "json");
35481        let mut url = self.hub._base_url.clone() + "v1/{+name}";
35482        if self._scopes.is_empty() {
35483            self._scopes
35484                .insert(Scope::CloudPlatform.as_ref().to_string());
35485        }
35486
35487        #[allow(clippy::single_element_loop)]
35488        for &(find_this, param_name) in [("{+name}", "name")].iter() {
35489            url = params.uri_replacement(url, param_name, find_this, true);
35490        }
35491        {
35492            let to_remove = ["name"];
35493            params.remove_params(&to_remove);
35494        }
35495
35496        let url = params.parse_with_url(&url);
35497
35498        loop {
35499            let token = match self
35500                .hub
35501                .auth
35502                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
35503                .await
35504            {
35505                Ok(token) => token,
35506                Err(e) => match dlg.token(e) {
35507                    Ok(token) => token,
35508                    Err(e) => {
35509                        dlg.finished(false);
35510                        return Err(common::Error::MissingToken(e));
35511                    }
35512                },
35513            };
35514            let mut req_result = {
35515                let client = &self.hub.client;
35516                dlg.pre_request();
35517                let mut req_builder = hyper::Request::builder()
35518                    .method(hyper::Method::GET)
35519                    .uri(url.as_str())
35520                    .header(USER_AGENT, self.hub._user_agent.clone());
35521
35522                if let Some(token) = token.as_ref() {
35523                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
35524                }
35525
35526                let request = req_builder
35527                    .header(CONTENT_LENGTH, 0_u64)
35528                    .body(common::to_body::<String>(None));
35529
35530                client.request(request.unwrap()).await
35531            };
35532
35533            match req_result {
35534                Err(err) => {
35535                    if let common::Retry::After(d) = dlg.http_error(&err) {
35536                        sleep(d).await;
35537                        continue;
35538                    }
35539                    dlg.finished(false);
35540                    return Err(common::Error::HttpError(err));
35541                }
35542                Ok(res) => {
35543                    let (mut parts, body) = res.into_parts();
35544                    let mut body = common::Body::new(body);
35545                    if !parts.status.is_success() {
35546                        let bytes = common::to_bytes(body).await.unwrap_or_default();
35547                        let error = serde_json::from_str(&common::to_string(&bytes));
35548                        let response = common::to_response(parts, bytes.into());
35549
35550                        if let common::Retry::After(d) =
35551                            dlg.http_failure(&response, error.as_ref().ok())
35552                        {
35553                            sleep(d).await;
35554                            continue;
35555                        }
35556
35557                        dlg.finished(false);
35558
35559                        return Err(match error {
35560                            Ok(value) => common::Error::BadRequest(value),
35561                            _ => common::Error::Failure(response),
35562                        });
35563                    }
35564                    let response = {
35565                        let bytes = common::to_bytes(body).await.unwrap_or_default();
35566                        let encoded = common::to_string(&bytes);
35567                        match serde_json::from_str(&encoded) {
35568                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
35569                            Err(error) => {
35570                                dlg.response_json_decode_error(&encoded, &error);
35571                                return Err(common::Error::JsonDecodeError(
35572                                    encoded.to_string(),
35573                                    error,
35574                                ));
35575                            }
35576                        }
35577                    };
35578
35579                    dlg.finished(true);
35580                    return Ok(response);
35581                }
35582            }
35583        }
35584    }
35585
35586    /// The `name` parameter's value depends on the target resource for the request, namely [roles](https://cloud.google.com/iam/docs/reference/rest/v1/roles), [projects](https://cloud.google.com/iam/docs/reference/rest/v1/projects.roles), or [organizations](https://cloud.google.com/iam/docs/reference/rest/v1/organizations.roles). Each resource type's `name` value format is described below: * [roles.get](https://cloud.google.com/iam/docs/reference/rest/v1/roles/get): `roles/{ROLE_NAME}`. This method returns results from all [predefined roles](https://cloud.google.com/iam/docs/understanding-roles#predefined_roles) in IAM. Example request URL: `https://iam.googleapis.com/v1/roles/{ROLE_NAME}` * [projects.roles.get](https://cloud.google.com/iam/docs/reference/rest/v1/projects.roles/get): `projects/{PROJECT_ID}/roles/{CUSTOM_ROLE_ID}`. This method returns only [custom roles](https://cloud.google.com/iam/docs/understanding-custom-roles) that have been created at the project level. Example request URL: `https://iam.googleapis.com/v1/projects/{PROJECT_ID}/roles/{CUSTOM_ROLE_ID}` * [organizations.roles.get](https://cloud.google.com/iam/docs/reference/rest/v1/organizations.roles/get): `organizations/{ORGANIZATION_ID}/roles/{CUSTOM_ROLE_ID}`. This method returns only [custom roles](https://cloud.google.com/iam/docs/understanding-custom-roles) that have been created at the organization level. Example request URL: `https://iam.googleapis.com/v1/organizations/{ORGANIZATION_ID}/roles/{CUSTOM_ROLE_ID}` Note: Wildcard (*) values are invalid; you must specify a complete project ID or organization ID.
35587    ///
35588    /// Sets the *name* path property to the given value.
35589    ///
35590    /// Even though the property as already been set when instantiating this call,
35591    /// we provide this method for API completeness.
35592    pub fn name(mut self, new_value: &str) -> RoleGetCall<'a, C> {
35593        self._name = new_value.to_string();
35594        self
35595    }
35596    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
35597    /// while executing the actual API request.
35598    ///
35599    /// ````text
35600    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
35601    /// ````
35602    ///
35603    /// Sets the *delegate* property to the given value.
35604    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> RoleGetCall<'a, C> {
35605        self._delegate = Some(new_value);
35606        self
35607    }
35608
35609    /// Set any additional parameter of the query string used in the request.
35610    /// It should be used to set parameters which are not yet available through their own
35611    /// setters.
35612    ///
35613    /// Please note that this method must not be used to set any of the known parameters
35614    /// which have their own setter method. If done anyway, the request will fail.
35615    ///
35616    /// # Additional Parameters
35617    ///
35618    /// * *$.xgafv* (query-string) - V1 error format.
35619    /// * *access_token* (query-string) - OAuth access token.
35620    /// * *alt* (query-string) - Data format for response.
35621    /// * *callback* (query-string) - JSONP
35622    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
35623    /// * *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.
35624    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
35625    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
35626    /// * *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.
35627    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
35628    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
35629    pub fn param<T>(mut self, name: T, value: T) -> RoleGetCall<'a, C>
35630    where
35631        T: AsRef<str>,
35632    {
35633        self._additional_params
35634            .insert(name.as_ref().to_string(), value.as_ref().to_string());
35635        self
35636    }
35637
35638    /// Identifies the authorization scope for the method you are building.
35639    ///
35640    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
35641    /// [`Scope::CloudPlatform`].
35642    ///
35643    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
35644    /// tokens for more than one scope.
35645    ///
35646    /// Usually there is more than one suitable scope to authorize an operation, some of which may
35647    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
35648    /// sufficient, a read-write scope will do as well.
35649    pub fn add_scope<St>(mut self, scope: St) -> RoleGetCall<'a, C>
35650    where
35651        St: AsRef<str>,
35652    {
35653        self._scopes.insert(String::from(scope.as_ref()));
35654        self
35655    }
35656    /// Identifies the authorization scope(s) for the method you are building.
35657    ///
35658    /// See [`Self::add_scope()`] for details.
35659    pub fn add_scopes<I, St>(mut self, scopes: I) -> RoleGetCall<'a, C>
35660    where
35661        I: IntoIterator<Item = St>,
35662        St: AsRef<str>,
35663    {
35664        self._scopes
35665            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
35666        self
35667    }
35668
35669    /// Removes all scopes, and no default scope will be used either.
35670    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
35671    /// for details).
35672    pub fn clear_scopes(mut self) -> RoleGetCall<'a, C> {
35673        self._scopes.clear();
35674        self
35675    }
35676}
35677
35678/// Lists every predefined Role that IAM supports, or every custom role that is defined for an organization or project.
35679///
35680/// A builder for the *list* method supported by a *role* resource.
35681/// It is not used directly, but through a [`RoleMethods`] instance.
35682///
35683/// # Example
35684///
35685/// Instantiate a resource method builder
35686///
35687/// ```test_harness,no_run
35688/// # extern crate hyper;
35689/// # extern crate hyper_rustls;
35690/// # extern crate google_iam1 as iam1;
35691/// # async fn dox() {
35692/// # use iam1::{Iam, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
35693///
35694/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
35695/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
35696/// #     secret,
35697/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
35698/// # ).build().await.unwrap();
35699///
35700/// # let client = hyper_util::client::legacy::Client::builder(
35701/// #     hyper_util::rt::TokioExecutor::new()
35702/// # )
35703/// # .build(
35704/// #     hyper_rustls::HttpsConnectorBuilder::new()
35705/// #         .with_native_roots()
35706/// #         .unwrap()
35707/// #         .https_or_http()
35708/// #         .enable_http1()
35709/// #         .build()
35710/// # );
35711/// # let mut hub = Iam::new(client, auth);
35712/// // You can configure optional parameters by calling the respective setters at will, and
35713/// // execute the final call using `doit()`.
35714/// // Values shown here are possibly random and not representative !
35715/// let result = hub.roles().list()
35716///              .view("ea")
35717///              .show_deleted(true)
35718///              .parent("sea")
35719///              .page_token("et")
35720///              .page_size(-77)
35721///              .doit().await;
35722/// # }
35723/// ```
35724pub struct RoleListCall<'a, C>
35725where
35726    C: 'a,
35727{
35728    hub: &'a Iam<C>,
35729    _view: Option<String>,
35730    _show_deleted: Option<bool>,
35731    _parent: Option<String>,
35732    _page_token: Option<String>,
35733    _page_size: Option<i32>,
35734    _delegate: Option<&'a mut dyn common::Delegate>,
35735    _additional_params: HashMap<String, String>,
35736    _scopes: BTreeSet<String>,
35737}
35738
35739impl<'a, C> common::CallBuilder for RoleListCall<'a, C> {}
35740
35741impl<'a, C> RoleListCall<'a, C>
35742where
35743    C: common::Connector,
35744{
35745    /// Perform the operation you have build so far.
35746    pub async fn doit(mut self) -> common::Result<(common::Response, ListRolesResponse)> {
35747        use std::borrow::Cow;
35748        use std::io::{Read, Seek};
35749
35750        use common::{url::Params, ToParts};
35751        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
35752
35753        let mut dd = common::DefaultDelegate;
35754        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
35755        dlg.begin(common::MethodInfo {
35756            id: "iam.roles.list",
35757            http_method: hyper::Method::GET,
35758        });
35759
35760        for &field in [
35761            "alt",
35762            "view",
35763            "showDeleted",
35764            "parent",
35765            "pageToken",
35766            "pageSize",
35767        ]
35768        .iter()
35769        {
35770            if self._additional_params.contains_key(field) {
35771                dlg.finished(false);
35772                return Err(common::Error::FieldClash(field));
35773            }
35774        }
35775
35776        let mut params = Params::with_capacity(7 + self._additional_params.len());
35777        if let Some(value) = self._view.as_ref() {
35778            params.push("view", value);
35779        }
35780        if let Some(value) = self._show_deleted.as_ref() {
35781            params.push("showDeleted", value.to_string());
35782        }
35783        if let Some(value) = self._parent.as_ref() {
35784            params.push("parent", value);
35785        }
35786        if let Some(value) = self._page_token.as_ref() {
35787            params.push("pageToken", value);
35788        }
35789        if let Some(value) = self._page_size.as_ref() {
35790            params.push("pageSize", value.to_string());
35791        }
35792
35793        params.extend(self._additional_params.iter());
35794
35795        params.push("alt", "json");
35796        let mut url = self.hub._base_url.clone() + "v1/roles";
35797        if self._scopes.is_empty() {
35798            self._scopes
35799                .insert(Scope::CloudPlatform.as_ref().to_string());
35800        }
35801
35802        let url = params.parse_with_url(&url);
35803
35804        loop {
35805            let token = match self
35806                .hub
35807                .auth
35808                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
35809                .await
35810            {
35811                Ok(token) => token,
35812                Err(e) => match dlg.token(e) {
35813                    Ok(token) => token,
35814                    Err(e) => {
35815                        dlg.finished(false);
35816                        return Err(common::Error::MissingToken(e));
35817                    }
35818                },
35819            };
35820            let mut req_result = {
35821                let client = &self.hub.client;
35822                dlg.pre_request();
35823                let mut req_builder = hyper::Request::builder()
35824                    .method(hyper::Method::GET)
35825                    .uri(url.as_str())
35826                    .header(USER_AGENT, self.hub._user_agent.clone());
35827
35828                if let Some(token) = token.as_ref() {
35829                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
35830                }
35831
35832                let request = req_builder
35833                    .header(CONTENT_LENGTH, 0_u64)
35834                    .body(common::to_body::<String>(None));
35835
35836                client.request(request.unwrap()).await
35837            };
35838
35839            match req_result {
35840                Err(err) => {
35841                    if let common::Retry::After(d) = dlg.http_error(&err) {
35842                        sleep(d).await;
35843                        continue;
35844                    }
35845                    dlg.finished(false);
35846                    return Err(common::Error::HttpError(err));
35847                }
35848                Ok(res) => {
35849                    let (mut parts, body) = res.into_parts();
35850                    let mut body = common::Body::new(body);
35851                    if !parts.status.is_success() {
35852                        let bytes = common::to_bytes(body).await.unwrap_or_default();
35853                        let error = serde_json::from_str(&common::to_string(&bytes));
35854                        let response = common::to_response(parts, bytes.into());
35855
35856                        if let common::Retry::After(d) =
35857                            dlg.http_failure(&response, error.as_ref().ok())
35858                        {
35859                            sleep(d).await;
35860                            continue;
35861                        }
35862
35863                        dlg.finished(false);
35864
35865                        return Err(match error {
35866                            Ok(value) => common::Error::BadRequest(value),
35867                            _ => common::Error::Failure(response),
35868                        });
35869                    }
35870                    let response = {
35871                        let bytes = common::to_bytes(body).await.unwrap_or_default();
35872                        let encoded = common::to_string(&bytes);
35873                        match serde_json::from_str(&encoded) {
35874                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
35875                            Err(error) => {
35876                                dlg.response_json_decode_error(&encoded, &error);
35877                                return Err(common::Error::JsonDecodeError(
35878                                    encoded.to_string(),
35879                                    error,
35880                                ));
35881                            }
35882                        }
35883                    };
35884
35885                    dlg.finished(true);
35886                    return Ok(response);
35887                }
35888            }
35889        }
35890    }
35891
35892    /// Optional view for the returned Role objects. When `FULL` is specified, the `includedPermissions` field is returned, which includes a list of all permissions in the role. The default value is `BASIC`, which does not return the `includedPermissions` field.
35893    ///
35894    /// Sets the *view* query property to the given value.
35895    pub fn view(mut self, new_value: &str) -> RoleListCall<'a, C> {
35896        self._view = Some(new_value.to_string());
35897        self
35898    }
35899    /// Include Roles that have been deleted.
35900    ///
35901    /// Sets the *show deleted* query property to the given value.
35902    pub fn show_deleted(mut self, new_value: bool) -> RoleListCall<'a, C> {
35903        self._show_deleted = Some(new_value);
35904        self
35905    }
35906    /// The `parent` parameter's value depends on the target resource for the request, namely [roles](https://cloud.google.com/iam/docs/reference/rest/v1/roles), [projects](https://cloud.google.com/iam/docs/reference/rest/v1/projects.roles), or [organizations](https://cloud.google.com/iam/docs/reference/rest/v1/organizations.roles). Each resource type's `parent` value format is described below: * [roles.list](https://cloud.google.com/iam/docs/reference/rest/v1/roles/list): An empty string. This method doesn't require a resource; it simply returns all [predefined roles](https://cloud.google.com/iam/docs/understanding-roles#predefined_roles) in IAM. Example request URL: `https://iam.googleapis.com/v1/roles` * [projects.roles.list](https://cloud.google.com/iam/docs/reference/rest/v1/projects.roles/list): `projects/{PROJECT_ID}`. This method lists all project-level [custom roles](https://cloud.google.com/iam/docs/understanding-custom-roles). Example request URL: `https://iam.googleapis.com/v1/projects/{PROJECT_ID}/roles` * [organizations.roles.list](https://cloud.google.com/iam/docs/reference/rest/v1/organizations.roles/list): `organizations/{ORGANIZATION_ID}`. This method lists all organization-level [custom roles](https://cloud.google.com/iam/docs/understanding-custom-roles). Example request URL: `https://iam.googleapis.com/v1/organizations/{ORGANIZATION_ID}/roles` Note: Wildcard (*) values are invalid; you must specify a complete project ID or organization ID.
35907    ///
35908    /// Sets the *parent* query property to the given value.
35909    pub fn parent(mut self, new_value: &str) -> RoleListCall<'a, C> {
35910        self._parent = Some(new_value.to_string());
35911        self
35912    }
35913    /// Optional pagination token returned in an earlier ListRolesResponse.
35914    ///
35915    /// Sets the *page token* query property to the given value.
35916    pub fn page_token(mut self, new_value: &str) -> RoleListCall<'a, C> {
35917        self._page_token = Some(new_value.to_string());
35918        self
35919    }
35920    /// Optional limit on the number of roles to include in the response. The default is 300, and the maximum is 1,000.
35921    ///
35922    /// Sets the *page size* query property to the given value.
35923    pub fn page_size(mut self, new_value: i32) -> RoleListCall<'a, C> {
35924        self._page_size = Some(new_value);
35925        self
35926    }
35927    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
35928    /// while executing the actual API request.
35929    ///
35930    /// ````text
35931    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
35932    /// ````
35933    ///
35934    /// Sets the *delegate* property to the given value.
35935    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> RoleListCall<'a, C> {
35936        self._delegate = Some(new_value);
35937        self
35938    }
35939
35940    /// Set any additional parameter of the query string used in the request.
35941    /// It should be used to set parameters which are not yet available through their own
35942    /// setters.
35943    ///
35944    /// Please note that this method must not be used to set any of the known parameters
35945    /// which have their own setter method. If done anyway, the request will fail.
35946    ///
35947    /// # Additional Parameters
35948    ///
35949    /// * *$.xgafv* (query-string) - V1 error format.
35950    /// * *access_token* (query-string) - OAuth access token.
35951    /// * *alt* (query-string) - Data format for response.
35952    /// * *callback* (query-string) - JSONP
35953    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
35954    /// * *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.
35955    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
35956    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
35957    /// * *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.
35958    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
35959    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
35960    pub fn param<T>(mut self, name: T, value: T) -> RoleListCall<'a, C>
35961    where
35962        T: AsRef<str>,
35963    {
35964        self._additional_params
35965            .insert(name.as_ref().to_string(), value.as_ref().to_string());
35966        self
35967    }
35968
35969    /// Identifies the authorization scope for the method you are building.
35970    ///
35971    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
35972    /// [`Scope::CloudPlatform`].
35973    ///
35974    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
35975    /// tokens for more than one scope.
35976    ///
35977    /// Usually there is more than one suitable scope to authorize an operation, some of which may
35978    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
35979    /// sufficient, a read-write scope will do as well.
35980    pub fn add_scope<St>(mut self, scope: St) -> RoleListCall<'a, C>
35981    where
35982        St: AsRef<str>,
35983    {
35984        self._scopes.insert(String::from(scope.as_ref()));
35985        self
35986    }
35987    /// Identifies the authorization scope(s) for the method you are building.
35988    ///
35989    /// See [`Self::add_scope()`] for details.
35990    pub fn add_scopes<I, St>(mut self, scopes: I) -> RoleListCall<'a, C>
35991    where
35992        I: IntoIterator<Item = St>,
35993        St: AsRef<str>,
35994    {
35995        self._scopes
35996            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
35997        self
35998    }
35999
36000    /// Removes all scopes, and no default scope will be used either.
36001    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
36002    /// for details).
36003    pub fn clear_scopes(mut self) -> RoleListCall<'a, C> {
36004        self._scopes.clear();
36005        self
36006    }
36007}
36008
36009/// Lists roles that can be granted on a Google Cloud resource. A role is grantable if the IAM policy for the resource can contain bindings to the role.
36010///
36011/// A builder for the *queryGrantableRoles* method supported by a *role* resource.
36012/// It is not used directly, but through a [`RoleMethods`] instance.
36013///
36014/// # Example
36015///
36016/// Instantiate a resource method builder
36017///
36018/// ```test_harness,no_run
36019/// # extern crate hyper;
36020/// # extern crate hyper_rustls;
36021/// # extern crate google_iam1 as iam1;
36022/// use iam1::api::QueryGrantableRolesRequest;
36023/// # async fn dox() {
36024/// # use iam1::{Iam, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
36025///
36026/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
36027/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
36028/// #     secret,
36029/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
36030/// # ).build().await.unwrap();
36031///
36032/// # let client = hyper_util::client::legacy::Client::builder(
36033/// #     hyper_util::rt::TokioExecutor::new()
36034/// # )
36035/// # .build(
36036/// #     hyper_rustls::HttpsConnectorBuilder::new()
36037/// #         .with_native_roots()
36038/// #         .unwrap()
36039/// #         .https_or_http()
36040/// #         .enable_http1()
36041/// #         .build()
36042/// # );
36043/// # let mut hub = Iam::new(client, auth);
36044/// // As the method needs a request, you would usually fill it with the desired information
36045/// // into the respective structure. Some of the parts shown here might not be applicable !
36046/// // Values shown here are possibly random and not representative !
36047/// let mut req = QueryGrantableRolesRequest::default();
36048///
36049/// // You can configure optional parameters by calling the respective setters at will, and
36050/// // execute the final call using `doit()`.
36051/// // Values shown here are possibly random and not representative !
36052/// let result = hub.roles().query_grantable_roles(req)
36053///              .doit().await;
36054/// # }
36055/// ```
36056pub struct RoleQueryGrantableRoleCall<'a, C>
36057where
36058    C: 'a,
36059{
36060    hub: &'a Iam<C>,
36061    _request: QueryGrantableRolesRequest,
36062    _delegate: Option<&'a mut dyn common::Delegate>,
36063    _additional_params: HashMap<String, String>,
36064    _scopes: BTreeSet<String>,
36065}
36066
36067impl<'a, C> common::CallBuilder for RoleQueryGrantableRoleCall<'a, C> {}
36068
36069impl<'a, C> RoleQueryGrantableRoleCall<'a, C>
36070where
36071    C: common::Connector,
36072{
36073    /// Perform the operation you have build so far.
36074    pub async fn doit(mut self) -> common::Result<(common::Response, QueryGrantableRolesResponse)> {
36075        use std::borrow::Cow;
36076        use std::io::{Read, Seek};
36077
36078        use common::{url::Params, ToParts};
36079        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
36080
36081        let mut dd = common::DefaultDelegate;
36082        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
36083        dlg.begin(common::MethodInfo {
36084            id: "iam.roles.queryGrantableRoles",
36085            http_method: hyper::Method::POST,
36086        });
36087
36088        for &field in ["alt"].iter() {
36089            if self._additional_params.contains_key(field) {
36090                dlg.finished(false);
36091                return Err(common::Error::FieldClash(field));
36092            }
36093        }
36094
36095        let mut params = Params::with_capacity(3 + self._additional_params.len());
36096
36097        params.extend(self._additional_params.iter());
36098
36099        params.push("alt", "json");
36100        let mut url = self.hub._base_url.clone() + "v1/roles:queryGrantableRoles";
36101        if self._scopes.is_empty() {
36102            self._scopes
36103                .insert(Scope::CloudPlatform.as_ref().to_string());
36104        }
36105
36106        let url = params.parse_with_url(&url);
36107
36108        let mut json_mime_type = mime::APPLICATION_JSON;
36109        let mut request_value_reader = {
36110            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
36111            common::remove_json_null_values(&mut value);
36112            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
36113            serde_json::to_writer(&mut dst, &value).unwrap();
36114            dst
36115        };
36116        let request_size = request_value_reader
36117            .seek(std::io::SeekFrom::End(0))
36118            .unwrap();
36119        request_value_reader
36120            .seek(std::io::SeekFrom::Start(0))
36121            .unwrap();
36122
36123        loop {
36124            let token = match self
36125                .hub
36126                .auth
36127                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
36128                .await
36129            {
36130                Ok(token) => token,
36131                Err(e) => match dlg.token(e) {
36132                    Ok(token) => token,
36133                    Err(e) => {
36134                        dlg.finished(false);
36135                        return Err(common::Error::MissingToken(e));
36136                    }
36137                },
36138            };
36139            request_value_reader
36140                .seek(std::io::SeekFrom::Start(0))
36141                .unwrap();
36142            let mut req_result = {
36143                let client = &self.hub.client;
36144                dlg.pre_request();
36145                let mut req_builder = hyper::Request::builder()
36146                    .method(hyper::Method::POST)
36147                    .uri(url.as_str())
36148                    .header(USER_AGENT, self.hub._user_agent.clone());
36149
36150                if let Some(token) = token.as_ref() {
36151                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
36152                }
36153
36154                let request = req_builder
36155                    .header(CONTENT_TYPE, json_mime_type.to_string())
36156                    .header(CONTENT_LENGTH, request_size as u64)
36157                    .body(common::to_body(
36158                        request_value_reader.get_ref().clone().into(),
36159                    ));
36160
36161                client.request(request.unwrap()).await
36162            };
36163
36164            match req_result {
36165                Err(err) => {
36166                    if let common::Retry::After(d) = dlg.http_error(&err) {
36167                        sleep(d).await;
36168                        continue;
36169                    }
36170                    dlg.finished(false);
36171                    return Err(common::Error::HttpError(err));
36172                }
36173                Ok(res) => {
36174                    let (mut parts, body) = res.into_parts();
36175                    let mut body = common::Body::new(body);
36176                    if !parts.status.is_success() {
36177                        let bytes = common::to_bytes(body).await.unwrap_or_default();
36178                        let error = serde_json::from_str(&common::to_string(&bytes));
36179                        let response = common::to_response(parts, bytes.into());
36180
36181                        if let common::Retry::After(d) =
36182                            dlg.http_failure(&response, error.as_ref().ok())
36183                        {
36184                            sleep(d).await;
36185                            continue;
36186                        }
36187
36188                        dlg.finished(false);
36189
36190                        return Err(match error {
36191                            Ok(value) => common::Error::BadRequest(value),
36192                            _ => common::Error::Failure(response),
36193                        });
36194                    }
36195                    let response = {
36196                        let bytes = common::to_bytes(body).await.unwrap_or_default();
36197                        let encoded = common::to_string(&bytes);
36198                        match serde_json::from_str(&encoded) {
36199                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
36200                            Err(error) => {
36201                                dlg.response_json_decode_error(&encoded, &error);
36202                                return Err(common::Error::JsonDecodeError(
36203                                    encoded.to_string(),
36204                                    error,
36205                                ));
36206                            }
36207                        }
36208                    };
36209
36210                    dlg.finished(true);
36211                    return Ok(response);
36212                }
36213            }
36214        }
36215    }
36216
36217    ///
36218    /// Sets the *request* property to the given value.
36219    ///
36220    /// Even though the property as already been set when instantiating this call,
36221    /// we provide this method for API completeness.
36222    pub fn request(
36223        mut self,
36224        new_value: QueryGrantableRolesRequest,
36225    ) -> RoleQueryGrantableRoleCall<'a, C> {
36226        self._request = new_value;
36227        self
36228    }
36229    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
36230    /// while executing the actual API request.
36231    ///
36232    /// ````text
36233    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
36234    /// ````
36235    ///
36236    /// Sets the *delegate* property to the given value.
36237    pub fn delegate(
36238        mut self,
36239        new_value: &'a mut dyn common::Delegate,
36240    ) -> RoleQueryGrantableRoleCall<'a, C> {
36241        self._delegate = Some(new_value);
36242        self
36243    }
36244
36245    /// Set any additional parameter of the query string used in the request.
36246    /// It should be used to set parameters which are not yet available through their own
36247    /// setters.
36248    ///
36249    /// Please note that this method must not be used to set any of the known parameters
36250    /// which have their own setter method. If done anyway, the request will fail.
36251    ///
36252    /// # Additional Parameters
36253    ///
36254    /// * *$.xgafv* (query-string) - V1 error format.
36255    /// * *access_token* (query-string) - OAuth access token.
36256    /// * *alt* (query-string) - Data format for response.
36257    /// * *callback* (query-string) - JSONP
36258    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
36259    /// * *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.
36260    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
36261    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
36262    /// * *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.
36263    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
36264    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
36265    pub fn param<T>(mut self, name: T, value: T) -> RoleQueryGrantableRoleCall<'a, C>
36266    where
36267        T: AsRef<str>,
36268    {
36269        self._additional_params
36270            .insert(name.as_ref().to_string(), value.as_ref().to_string());
36271        self
36272    }
36273
36274    /// Identifies the authorization scope for the method you are building.
36275    ///
36276    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
36277    /// [`Scope::CloudPlatform`].
36278    ///
36279    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
36280    /// tokens for more than one scope.
36281    ///
36282    /// Usually there is more than one suitable scope to authorize an operation, some of which may
36283    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
36284    /// sufficient, a read-write scope will do as well.
36285    pub fn add_scope<St>(mut self, scope: St) -> RoleQueryGrantableRoleCall<'a, C>
36286    where
36287        St: AsRef<str>,
36288    {
36289        self._scopes.insert(String::from(scope.as_ref()));
36290        self
36291    }
36292    /// Identifies the authorization scope(s) for the method you are building.
36293    ///
36294    /// See [`Self::add_scope()`] for details.
36295    pub fn add_scopes<I, St>(mut self, scopes: I) -> RoleQueryGrantableRoleCall<'a, C>
36296    where
36297        I: IntoIterator<Item = St>,
36298        St: AsRef<str>,
36299    {
36300        self._scopes
36301            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
36302        self
36303    }
36304
36305    /// Removes all scopes, and no default scope will be used either.
36306    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
36307    /// for details).
36308    pub fn clear_scopes(mut self) -> RoleQueryGrantableRoleCall<'a, C> {
36309        self._scopes.clear();
36310        self
36311    }
36312}