google_cloudresourcemanager1_beta1/
api.rs

1#![allow(clippy::ptr_arg)]
2
3use std::collections::{BTreeSet, HashMap};
4
5use tokio::time::sleep;
6
7// ##############
8// UTILITIES ###
9// ############
10
11/// Identifies the an OAuth2 authorization scope.
12/// A scope is needed when requesting an
13/// [authorization token](https://developers.google.com/youtube/v3/guides/authentication).
14#[derive(PartialEq, Eq, Ord, PartialOrd, Hash, Debug, Clone, Copy)]
15pub enum Scope {
16    /// See, edit, configure, and delete your Google Cloud data and see the email address for your Google Account.
17    CloudPlatform,
18
19    /// View your data across Google Cloud services and see the email address of your Google Account
20    CloudPlatformReadOnly,
21}
22
23impl AsRef<str> for Scope {
24    fn as_ref(&self) -> &str {
25        match *self {
26            Scope::CloudPlatform => "https://www.googleapis.com/auth/cloud-platform",
27            Scope::CloudPlatformReadOnly => {
28                "https://www.googleapis.com/auth/cloud-platform.read-only"
29            }
30        }
31    }
32}
33
34#[allow(clippy::derivable_impls)]
35impl Default for Scope {
36    fn default() -> Scope {
37        Scope::CloudPlatform
38    }
39}
40
41// ########
42// HUB ###
43// ######
44
45/// Central instance to access all CloudResourceManager related resource activities
46///
47/// # Examples
48///
49/// Instantiate a new hub
50///
51/// ```test_harness,no_run
52/// extern crate hyper;
53/// extern crate hyper_rustls;
54/// extern crate google_cloudresourcemanager1_beta1 as cloudresourcemanager1_beta1;
55/// use cloudresourcemanager1_beta1::{Result, Error};
56/// # async fn dox() {
57/// use cloudresourcemanager1_beta1::{CloudResourceManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
58///
59/// // Get an ApplicationSecret instance by some means. It contains the `client_id` and
60/// // `client_secret`, among other things.
61/// let secret: yup_oauth2::ApplicationSecret = Default::default();
62/// // Instantiate the authenticator. It will choose a suitable authentication flow for you,
63/// // unless you replace  `None` with the desired Flow.
64/// // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about
65/// // what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and
66/// // retrieve them from storage.
67/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
68///     .with_native_roots()
69///     .unwrap()
70///     .https_only()
71///     .enable_http2()
72///     .build();
73///
74/// let executor = hyper_util::rt::TokioExecutor::new();
75/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
76///     secret,
77///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
78///     yup_oauth2::client::CustomHyperClientBuilder::from(
79///         hyper_util::client::legacy::Client::builder(executor).build(connector),
80///     ),
81/// ).build().await.unwrap();
82///
83/// let client = hyper_util::client::legacy::Client::builder(
84///     hyper_util::rt::TokioExecutor::new()
85/// )
86/// .build(
87///     hyper_rustls::HttpsConnectorBuilder::new()
88///         .with_native_roots()
89///         .unwrap()
90///         .https_or_http()
91///         .enable_http2()
92///         .build()
93/// );
94/// let mut hub = CloudResourceManager::new(client, auth);
95/// // You can configure optional parameters by calling the respective setters at will, and
96/// // execute the final call using `doit()`.
97/// // Values shown here are possibly random and not representative !
98/// let result = hub.projects().list()
99///              .page_token("sanctus")
100///              .page_size(-80)
101///              .filter("amet.")
102///              .doit().await;
103///
104/// match result {
105///     Err(e) => match e {
106///         // The Error enum provides details about what exactly happened.
107///         // You can also just use its `Debug`, `Display` or `Error` traits
108///          Error::HttpError(_)
109///         |Error::Io(_)
110///         |Error::MissingAPIKey
111///         |Error::MissingToken(_)
112///         |Error::Cancelled
113///         |Error::UploadSizeLimitExceeded(_, _)
114///         |Error::Failure(_)
115///         |Error::BadRequest(_)
116///         |Error::FieldClash(_)
117///         |Error::JsonDecodeError(_, _) => println!("{}", e),
118///     },
119///     Ok(res) => println!("Success: {:?}", res),
120/// }
121/// # }
122/// ```
123#[derive(Clone)]
124pub struct CloudResourceManager<C> {
125    pub client: common::Client<C>,
126    pub auth: Box<dyn common::GetToken>,
127    _user_agent: String,
128    _base_url: String,
129    _root_url: String,
130}
131
132impl<C> common::Hub for CloudResourceManager<C> {}
133
134impl<'a, C> CloudResourceManager<C> {
135    pub fn new<A: 'static + common::GetToken>(
136        client: common::Client<C>,
137        auth: A,
138    ) -> CloudResourceManager<C> {
139        CloudResourceManager {
140            client,
141            auth: Box::new(auth),
142            _user_agent: "google-api-rust-client/7.0.0".to_string(),
143            _base_url: "https://cloudresourcemanager.googleapis.com/".to_string(),
144            _root_url: "https://cloudresourcemanager.googleapis.com/".to_string(),
145        }
146    }
147
148    pub fn organizations(&'a self) -> OrganizationMethods<'a, C> {
149        OrganizationMethods { hub: self }
150    }
151    pub fn projects(&'a self) -> ProjectMethods<'a, C> {
152        ProjectMethods { hub: self }
153    }
154
155    /// Set the user-agent header field to use in all requests to the server.
156    /// It defaults to `google-api-rust-client/7.0.0`.
157    ///
158    /// Returns the previously set user-agent.
159    pub fn user_agent(&mut self, agent_name: String) -> String {
160        std::mem::replace(&mut self._user_agent, agent_name)
161    }
162
163    /// Set the base url to use in all requests to the server.
164    /// It defaults to `https://cloudresourcemanager.googleapis.com/`.
165    ///
166    /// Returns the previously set base url.
167    pub fn base_url(&mut self, new_base_url: String) -> String {
168        std::mem::replace(&mut self._base_url, new_base_url)
169    }
170
171    /// Set the root url to use in all requests to the server.
172    /// It defaults to `https://cloudresourcemanager.googleapis.com/`.
173    ///
174    /// Returns the previously set root url.
175    pub fn root_url(&mut self, new_root_url: String) -> String {
176        std::mem::replace(&mut self._root_url, new_root_url)
177    }
178}
179
180// ############
181// SCHEMAS ###
182// ##########
183/// Identifying information for a single ancestor of a project.
184///
185/// This type is not used in any activity, and only used as *part* of another schema.
186///
187#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
188#[serde_with::serde_as]
189#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
190pub struct Ancestor {
191    /// Resource id of the ancestor.
192    #[serde(rename = "resourceId")]
193    pub resource_id: Option<ResourceId>,
194}
195
196impl common::Part for Ancestor {}
197
198/// 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.
199///
200/// This type is not used in any activity, and only used as *part* of another schema.
201///
202#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
203#[serde_with::serde_as]
204#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
205pub struct AuditConfig {
206    /// The configuration for logging of each type of permission.
207    #[serde(rename = "auditLogConfigs")]
208    pub audit_log_configs: Option<Vec<AuditLogConfig>>,
209    /// 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.
210    pub service: Option<String>,
211}
212
213impl common::Part for AuditConfig {}
214
215/// 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.
216///
217/// This type is not used in any activity, and only used as *part* of another schema.
218///
219#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
220#[serde_with::serde_as]
221#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
222pub struct AuditLogConfig {
223    /// Specifies the identities that do not cause logging for this type of permission. Follows the same format of Binding.members.
224    #[serde(rename = "exemptedMembers")]
225    pub exempted_members: Option<Vec<String>>,
226    /// The log type that this config enables.
227    #[serde(rename = "logType")]
228    pub log_type: Option<String>,
229}
230
231impl common::Part for AuditLogConfig {}
232
233/// Associates `members`, or principals, with a `role`.
234///
235/// This type is not used in any activity, and only used as *part* of another schema.
236///
237#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
238#[serde_with::serde_as]
239#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
240pub struct Binding {
241    /// The condition that is associated with this binding. If the condition evaluates to `true`, then this binding applies to the current request. If the condition evaluates to `false`, then this binding does not apply to the current request. However, a different role binding might grant the same role to one or more of the principals in this binding. To learn which resources support conditions in their IAM policies, see the [IAM documentation](https://cloud.google.com/iam/help/conditions/resource-policies).
242    pub condition: Option<Expr>,
243    /// Specifies the principals requesting access for a Google Cloud resource. `members` can have the following values: * `allUsers`: A special identifier that represents anyone who is on the internet; with or without a Google account. * `allAuthenticatedUsers`: A special identifier that represents anyone who is authenticated with a Google account or a service account. Does not include identities that come from external identity providers (IdPs) through identity federation. * `user:{emailid}`: An email address that represents a specific Google account. For example, `alice@example.com` . * `serviceAccount:{emailid}`: An email address that represents a Google service account. For example, `my-other-app@appspot.gserviceaccount.com`. * `serviceAccount:{projectid}.svc.id.goog[{namespace}/{kubernetes-sa}]`: An identifier for a [Kubernetes service account](https://cloud.google.com/kubernetes-engine/docs/how-to/kubernetes-service-accounts). For example, `my-project.svc.id.goog[my-namespace/my-kubernetes-sa]`. * `group:{emailid}`: An email address that represents a Google group. For example, `admins@example.com`. * `domain:{domain}`: The G Suite domain (primary) that represents all the users of that domain. For example, `google.com` or `example.com`. * `principal://iam.googleapis.com/locations/global/workforcePools/{pool_id}/subject/{subject_attribute_value}`: A single identity in a workforce identity pool. * `principalSet://iam.googleapis.com/locations/global/workforcePools/{pool_id}/group/{group_id}`: All workforce identities in a group. * `principalSet://iam.googleapis.com/locations/global/workforcePools/{pool_id}/attribute.{attribute_name}/{attribute_value}`: All workforce identities with a specific attribute value. * `principalSet://iam.googleapis.com/locations/global/workforcePools/{pool_id}/*`: All identities in a workforce identity pool. * `principal://iam.googleapis.com/projects/{project_number}/locations/global/workloadIdentityPools/{pool_id}/subject/{subject_attribute_value}`: A single identity in a workload identity pool. * `principalSet://iam.googleapis.com/projects/{project_number}/locations/global/workloadIdentityPools/{pool_id}/group/{group_id}`: A workload identity pool group. * `principalSet://iam.googleapis.com/projects/{project_number}/locations/global/workloadIdentityPools/{pool_id}/attribute.{attribute_name}/{attribute_value}`: All identities in a workload identity pool with a certain attribute. * `principalSet://iam.googleapis.com/projects/{project_number}/locations/global/workloadIdentityPools/{pool_id}/*`: All identities in a workload identity pool. * `deleted:user:{emailid}?uid={uniqueid}`: An email address (plus unique identifier) representing a user that has been recently deleted. For example, `alice@example.com?uid=123456789012345678901`. If the user is recovered, this value reverts to `user:{emailid}` and the recovered user retains the role in the binding. * `deleted:serviceAccount:{emailid}?uid={uniqueid}`: An email address (plus unique identifier) representing a service account that has been recently deleted. For example, `my-other-app@appspot.gserviceaccount.com?uid=123456789012345678901`. If the service account is undeleted, this value reverts to `serviceAccount:{emailid}` and the undeleted service account retains the role in the binding. * `deleted:group:{emailid}?uid={uniqueid}`: An email address (plus unique identifier) representing a Google group that has been recently deleted. For example, `admins@example.com?uid=123456789012345678901`. If the group is recovered, this value reverts to `group:{emailid}` and the recovered group retains the role in the binding. * `deleted:principal://iam.googleapis.com/locations/global/workforcePools/{pool_id}/subject/{subject_attribute_value}`: Deleted single identity in a workforce identity pool. For example, `deleted:principal://iam.googleapis.com/locations/global/workforcePools/my-pool-id/subject/my-subject-attribute-value`.
244    pub members: Option<Vec<String>>,
245    /// Role that is assigned to the list of `members`, or principals. For example, `roles/viewer`, `roles/editor`, or `roles/owner`. For an overview of the IAM roles and permissions, see the [IAM documentation](https://cloud.google.com/iam/docs/roles-overview). For a list of the available pre-defined roles, see [here](https://cloud.google.com/iam/docs/understanding-roles).
246    pub role: Option<String>,
247}
248
249impl common::Part for Binding {}
250
251/// 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); }
252///
253/// # Activities
254///
255/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
256/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
257///
258/// * [delete projects](ProjectDeleteCall) (response)
259/// * [undelete projects](ProjectUndeleteCall) (response)
260#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
261#[serde_with::serde_as]
262#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
263pub struct Empty {
264    _never_set: Option<bool>,
265}
266
267impl common::ResponseResult for Empty {}
268
269/// 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.
270///
271/// This type is not used in any activity, and only used as *part* of another schema.
272///
273#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
274#[serde_with::serde_as]
275#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
276pub struct Expr {
277    /// Optional. Description of the expression. This is a longer text which describes the expression, e.g. when hovered over it in a UI.
278    pub description: Option<String>,
279    /// Textual representation of an expression in Common Expression Language syntax.
280    pub expression: Option<String>,
281    /// Optional. String indicating the location of the expression for error reporting, e.g. a file name and a position in the file.
282    pub location: Option<String>,
283    /// 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.
284    pub title: Option<String>,
285}
286
287impl common::Part for Expr {}
288
289/// The request sent to the \[google.cloudresourcemanager.projects.v1beta1.DeveloperProjects.GetAncestry\] method.
290///
291/// # Activities
292///
293/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
294/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
295///
296/// * [get ancestry projects](ProjectGetAncestryCall) (request)
297#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
298#[serde_with::serde_as]
299#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
300pub struct GetAncestryRequest {
301    _never_set: Option<bool>,
302}
303
304impl common::RequestValue for GetAncestryRequest {}
305
306/// Response from the projects.getAncestry method.
307///
308/// # Activities
309///
310/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
311/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
312///
313/// * [get ancestry projects](ProjectGetAncestryCall) (response)
314#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
315#[serde_with::serde_as]
316#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
317pub struct GetAncestryResponse {
318    /// Ancestors are ordered from bottom to top of the resource hierarchy. The first ancestor is the project itself, followed by the project's parent, etc.
319    pub ancestor: Option<Vec<Ancestor>>,
320}
321
322impl common::ResponseResult for GetAncestryResponse {}
323
324/// Request message for `GetIamPolicy` method.
325///
326/// # Activities
327///
328/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
329/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
330///
331/// * [get iam policy organizations](OrganizationGetIamPolicyCall) (request)
332/// * [get iam policy projects](ProjectGetIamPolicyCall) (request)
333#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
334#[serde_with::serde_as]
335#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
336pub struct GetIamPolicyRequest {
337    /// OPTIONAL: A `GetPolicyOptions` object for specifying options to `GetIamPolicy`.
338    pub options: Option<GetPolicyOptions>,
339}
340
341impl common::RequestValue for GetIamPolicyRequest {}
342
343/// Encapsulates settings provided to GetIamPolicy.
344///
345/// This type is not used in any activity, and only used as *part* of another schema.
346///
347#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
348#[serde_with::serde_as]
349#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
350pub struct GetPolicyOptions {
351    /// 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).
352    #[serde(rename = "requestedPolicyVersion")]
353    pub requested_policy_version: Option<i32>,
354}
355
356impl common::Part for GetPolicyOptions {}
357
358/// The response returned from the `ListOrganizations` method.
359///
360/// # Activities
361///
362/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
363/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
364///
365/// * [list organizations](OrganizationListCall) (response)
366#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
367#[serde_with::serde_as]
368#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
369pub struct ListOrganizationsResponse {
370    /// A pagination token to be used to retrieve the next page of results. If the result is too large to fit within the page size specified in the request, this field will be set with a token that can be used to fetch the next page of results. If this field is empty, it indicates that this response contains the last page of results.
371    #[serde(rename = "nextPageToken")]
372    pub next_page_token: Option<String>,
373    /// The list of Organizations that matched the list query, possibly paginated.
374    pub organizations: Option<Vec<Organization>>,
375}
376
377impl common::ResponseResult for ListOrganizationsResponse {}
378
379/// A page of the response received from the ListProjects method. A paginated response where more pages are available has `next_page_token` set. This token can be used in a subsequent request to retrieve the next request page.
380///
381/// # Activities
382///
383/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
384/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
385///
386/// * [list projects](ProjectListCall) (response)
387#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
388#[serde_with::serde_as]
389#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
390pub struct ListProjectsResponse {
391    /// Pagination token. If the result set is too large to fit in a single response, this token is returned. It encodes the position of the current result cursor. Feeding this value into a new list request with the `page_token` parameter gives the next page of the results. When `next_page_token` is not filled in, there is no next page and the list returned is the last page in the result set. Pagination tokens have a limited lifetime.
392    #[serde(rename = "nextPageToken")]
393    pub next_page_token: Option<String>,
394    /// The list of Projects that matched the list filter. This list can be paginated.
395    pub projects: Option<Vec<Project>>,
396}
397
398impl common::ResponseResult for ListProjectsResponse {}
399
400/// The root node in the resource hierarchy to which a particular entity’s (e.g., company) resources belong.
401///
402/// # Activities
403///
404/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
405/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
406///
407/// * [get organizations](OrganizationGetCall) (response)
408/// * [get iam policy organizations](OrganizationGetIamPolicyCall) (none)
409/// * [list organizations](OrganizationListCall) (none)
410/// * [set iam policy organizations](OrganizationSetIamPolicyCall) (none)
411/// * [test iam permissions organizations](OrganizationTestIamPermissionCall) (none)
412/// * [update organizations](OrganizationUpdateCall) (request|response)
413#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
414#[serde_with::serde_as]
415#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
416pub struct Organization {
417    /// Timestamp when the Organization was created. Assigned by the server.
418    #[serde(rename = "creationTime")]
419    pub creation_time: Option<chrono::DateTime<chrono::offset::Utc>>,
420    /// A human-readable string that refers to the Organization in the Google Cloud console. This string is set by the server and cannot be changed. The string will be set to the primary domain (for example, "google.com") of the G Suite customer that owns the organization.
421    #[serde(rename = "displayName")]
422    pub display_name: Option<String>,
423    /// The organization's current lifecycle state. Assigned by the server.
424    #[serde(rename = "lifecycleState")]
425    pub lifecycle_state: Option<String>,
426    /// Output only. The resource name of the organization. This is the organization's relative path in the API. Its format is "organizations/[organization_id]". For example, "organizations/1234".
427    pub name: Option<String>,
428    /// An immutable id for the Organization that is assigned on creation. This should be omitted when creating a new Organization. This field is read-only.
429    #[serde(rename = "organizationId")]
430    pub organization_id: Option<String>,
431    /// The owner of this Organization. The owner should be specified on creation. Once set, it cannot be changed. This field is required.
432    pub owner: Option<OrganizationOwner>,
433}
434
435impl common::RequestValue for Organization {}
436impl common::Resource for Organization {}
437impl common::ResponseResult for Organization {}
438
439/// The entity that owns an Organization. The lifetime of the Organization and all of its descendants are bound to the `OrganizationOwner`. If the `OrganizationOwner` is deleted, the Organization and all its descendants will be deleted.
440///
441/// This type is not used in any activity, and only used as *part* of another schema.
442///
443#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
444#[serde_with::serde_as]
445#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
446pub struct OrganizationOwner {
447    /// The G Suite customer id used in the Directory API.
448    #[serde(rename = "directoryCustomerId")]
449    pub directory_customer_id: Option<String>,
450}
451
452impl common::Part for OrganizationOwner {}
453
454/// 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/).
455///
456/// # Activities
457///
458/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
459/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
460///
461/// * [get iam policy organizations](OrganizationGetIamPolicyCall) (response)
462/// * [set iam policy organizations](OrganizationSetIamPolicyCall) (response)
463/// * [get iam policy projects](ProjectGetIamPolicyCall) (response)
464/// * [set iam policy projects](ProjectSetIamPolicyCall) (response)
465#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
466#[serde_with::serde_as]
467#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
468pub struct Policy {
469    /// Specifies cloud audit logging configuration for this policy.
470    #[serde(rename = "auditConfigs")]
471    pub audit_configs: Option<Vec<AuditConfig>>,
472    /// 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`.
473    pub bindings: Option<Vec<Binding>>,
474    /// `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.
475    #[serde_as(as = "Option<common::serde::standard_base64::Wrapper>")]
476    pub etag: Option<Vec<u8>>,
477    /// 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).
478    pub version: Option<i32>,
479}
480
481impl common::ResponseResult for Policy {}
482
483/// A Project is a high-level Google Cloud Platform entity. It is a container for ACLs, APIs, App Engine Apps, VMs, and other Google Cloud Platform resources.
484///
485/// # Activities
486///
487/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
488/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
489///
490/// * [create projects](ProjectCreateCall) (request|response)
491/// * [delete projects](ProjectDeleteCall) (none)
492/// * [get projects](ProjectGetCall) (response)
493/// * [get ancestry projects](ProjectGetAncestryCall) (none)
494/// * [get iam policy projects](ProjectGetIamPolicyCall) (none)
495/// * [list projects](ProjectListCall) (none)
496/// * [set iam policy projects](ProjectSetIamPolicyCall) (none)
497/// * [test iam permissions projects](ProjectTestIamPermissionCall) (none)
498/// * [undelete projects](ProjectUndeleteCall) (none)
499/// * [update projects](ProjectUpdateCall) (request|response)
500#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
501#[serde_with::serde_as]
502#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
503pub struct Project {
504    /// Output only. If this project is a Management Project, list of capabilities configured on the parent folder. Note, presence of any capability implies that this is a Management Project. Example: `folders/123/capabilities/app-management`. OUTPUT ONLY.
505    #[serde(rename = "configuredCapabilities")]
506    pub configured_capabilities: Option<Vec<String>>,
507    /// Creation time. Read-only.
508    #[serde(rename = "createTime")]
509    pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
510    /// The labels associated with this Project. Label keys must be between 1 and 63 characters long and must conform to the following regular expression: a-z{0,62}. Label values must be between 0 and 63 characters long and must conform to the regular expression [a-z0-9_-]{0,63}. A label value can be empty. No more than 256 labels can be associated with a given resource. Clients should store labels in a representation such as JSON that does not depend on specific characters being disallowed. Example: `"environment" : "dev"` Read-write.
511    pub labels: Option<HashMap<String, String>>,
512    /// The Project lifecycle state. Read-only.
513    #[serde(rename = "lifecycleState")]
514    pub lifecycle_state: Option<String>,
515    /// The optional user-assigned display name of the Project. When present it must be between 4 to 30 characters. Allowed characters are: lowercase and uppercase letters, numbers, hyphen, single-quote, double-quote, space, and exclamation point. Example: `My Project` Read-write.
516    pub name: Option<String>,
517    /// An optional reference to a parent Resource. Supported parent types include "organization" and "folder". Once set, the parent cannot be cleared. The `parent` can be set on creation or using the `UpdateProject` method; the end user must have the `resourcemanager.projects.create` permission on the parent. Read-write.
518    pub parent: Option<ResourceId>,
519    /// The unique, user-assigned ID of the Project. It must be 6 to 30 lowercase letters, digits, or hyphens. It must start with a letter. Trailing hyphens are prohibited. Example: `tokyo-rain-123` Read-only after creation.
520    #[serde(rename = "projectId")]
521    pub project_id: Option<String>,
522    /// The number uniquely identifying the project. Example: `415104041262` Read-only.
523    #[serde(rename = "projectNumber")]
524    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
525    pub project_number: Option<i64>,
526}
527
528impl common::RequestValue for Project {}
529impl common::Resource for Project {}
530impl common::ResponseResult for Project {}
531
532/// A container to reference an id for any resource type. A `resource` in Google Cloud Platform is a generic term for something you (a developer) may want to interact with through one of our API's. Some examples are an App Engine app, a Compute Engine instance, a Cloud SQL database, and so on.
533///
534/// This type is not used in any activity, and only used as *part* of another schema.
535///
536#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
537#[serde_with::serde_as]
538#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
539pub struct ResourceId {
540    /// Required field for the type-specific id. This should correspond to the id used in the type-specific API's.
541    pub id: Option<String>,
542    /// Required field representing the resource type this id is for. At present, the valid types are "project", "folder", and "organization".
543    #[serde(rename = "type")]
544    pub type_: Option<String>,
545}
546
547impl common::Part for ResourceId {}
548
549/// Request message for `SetIamPolicy` method.
550///
551/// # Activities
552///
553/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
554/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
555///
556/// * [set iam policy organizations](OrganizationSetIamPolicyCall) (request)
557/// * [set iam policy projects](ProjectSetIamPolicyCall) (request)
558#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
559#[serde_with::serde_as]
560#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
561pub struct SetIamPolicyRequest {
562    /// 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.
563    pub policy: Option<Policy>,
564    /// 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"`
565    #[serde(rename = "updateMask")]
566    pub update_mask: Option<common::FieldMask>,
567}
568
569impl common::RequestValue for SetIamPolicyRequest {}
570
571/// Request message for `TestIamPermissions` method.
572///
573/// # Activities
574///
575/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
576/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
577///
578/// * [test iam permissions organizations](OrganizationTestIamPermissionCall) (request)
579/// * [test iam permissions projects](ProjectTestIamPermissionCall) (request)
580#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
581#[serde_with::serde_as]
582#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
583pub struct TestIamPermissionsRequest {
584    /// 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).
585    pub permissions: Option<Vec<String>>,
586}
587
588impl common::RequestValue for TestIamPermissionsRequest {}
589
590/// Response message for `TestIamPermissions` method.
591///
592/// # Activities
593///
594/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
595/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
596///
597/// * [test iam permissions organizations](OrganizationTestIamPermissionCall) (response)
598/// * [test iam permissions projects](ProjectTestIamPermissionCall) (response)
599#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
600#[serde_with::serde_as]
601#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
602pub struct TestIamPermissionsResponse {
603    /// A subset of `TestPermissionsRequest.permissions` that the caller is allowed.
604    pub permissions: Option<Vec<String>>,
605}
606
607impl common::ResponseResult for TestIamPermissionsResponse {}
608
609/// The request sent to the UndeleteProject method.
610///
611/// # Activities
612///
613/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
614/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
615///
616/// * [undelete projects](ProjectUndeleteCall) (request)
617#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
618#[serde_with::serde_as]
619#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
620pub struct UndeleteProjectRequest {
621    _never_set: Option<bool>,
622}
623
624impl common::RequestValue for UndeleteProjectRequest {}
625
626// ###################
627// MethodBuilders ###
628// #################
629
630/// A builder providing access to all methods supported on *organization* resources.
631/// It is not used directly, but through the [`CloudResourceManager`] hub.
632///
633/// # Example
634///
635/// Instantiate a resource builder
636///
637/// ```test_harness,no_run
638/// extern crate hyper;
639/// extern crate hyper_rustls;
640/// extern crate google_cloudresourcemanager1_beta1 as cloudresourcemanager1_beta1;
641///
642/// # async fn dox() {
643/// use cloudresourcemanager1_beta1::{CloudResourceManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
644///
645/// let secret: yup_oauth2::ApplicationSecret = Default::default();
646/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
647///     .with_native_roots()
648///     .unwrap()
649///     .https_only()
650///     .enable_http2()
651///     .build();
652///
653/// let executor = hyper_util::rt::TokioExecutor::new();
654/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
655///     secret,
656///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
657///     yup_oauth2::client::CustomHyperClientBuilder::from(
658///         hyper_util::client::legacy::Client::builder(executor).build(connector),
659///     ),
660/// ).build().await.unwrap();
661///
662/// let client = hyper_util::client::legacy::Client::builder(
663///     hyper_util::rt::TokioExecutor::new()
664/// )
665/// .build(
666///     hyper_rustls::HttpsConnectorBuilder::new()
667///         .with_native_roots()
668///         .unwrap()
669///         .https_or_http()
670///         .enable_http2()
671///         .build()
672/// );
673/// let mut hub = CloudResourceManager::new(client, auth);
674/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
675/// // like `get(...)`, `get_iam_policy(...)`, `list(...)`, `set_iam_policy(...)`, `test_iam_permissions(...)` and `update(...)`
676/// // to build up your call.
677/// let rb = hub.organizations();
678/// # }
679/// ```
680pub struct OrganizationMethods<'a, C>
681where
682    C: 'a,
683{
684    hub: &'a CloudResourceManager<C>,
685}
686
687impl<'a, C> common::MethodsBuilder for OrganizationMethods<'a, C> {}
688
689impl<'a, C> OrganizationMethods<'a, C> {
690    /// Create a builder to help you perform the following task:
691    ///
692    /// Fetches an Organization resource identified by the specified resource name.
693    ///
694    /// # Arguments
695    ///
696    /// * `name` - The resource name of the Organization to fetch. This is the organization's relative path in the API, formatted as "organizations/[organizationId]". For example, "organizations/1234".
697    pub fn get(&self, name: &str) -> OrganizationGetCall<'a, C> {
698        OrganizationGetCall {
699            hub: self.hub,
700            _name: name.to_string(),
701            _organization_id: Default::default(),
702            _delegate: Default::default(),
703            _additional_params: Default::default(),
704            _scopes: Default::default(),
705        }
706    }
707
708    /// Create a builder to help you perform the following task:
709    ///
710    /// Gets the access control policy for an Organization resource. May be empty if no such policy or resource exists. The `resource` field should be the organization's resource name, e.g. "organizations/123".
711    ///
712    /// # Arguments
713    ///
714    /// * `request` - No description provided.
715    /// * `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.
716    pub fn get_iam_policy(
717        &self,
718        request: GetIamPolicyRequest,
719        resource: &str,
720    ) -> OrganizationGetIamPolicyCall<'a, C> {
721        OrganizationGetIamPolicyCall {
722            hub: self.hub,
723            _request: request,
724            _resource: resource.to_string(),
725            _delegate: Default::default(),
726            _additional_params: Default::default(),
727            _scopes: Default::default(),
728        }
729    }
730
731    /// Create a builder to help you perform the following task:
732    ///
733    /// Lists Organization resources that are visible to the user and satisfy the specified filter. This method returns Organizations in an unspecified order. New Organizations do not necessarily appear at the end of the list.
734    pub fn list(&self) -> OrganizationListCall<'a, C> {
735        OrganizationListCall {
736            hub: self.hub,
737            _page_token: Default::default(),
738            _page_size: Default::default(),
739            _filter: Default::default(),
740            _delegate: Default::default(),
741            _additional_params: Default::default(),
742            _scopes: Default::default(),
743        }
744    }
745
746    /// Create a builder to help you perform the following task:
747    ///
748    /// Sets the access control policy on an Organization resource. Replaces any existing policy. The `resource` field should be the organization's resource name, e.g. "organizations/123".
749    ///
750    /// # Arguments
751    ///
752    /// * `request` - No description provided.
753    /// * `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.
754    pub fn set_iam_policy(
755        &self,
756        request: SetIamPolicyRequest,
757        resource: &str,
758    ) -> OrganizationSetIamPolicyCall<'a, C> {
759        OrganizationSetIamPolicyCall {
760            hub: self.hub,
761            _request: request,
762            _resource: resource.to_string(),
763            _delegate: Default::default(),
764            _additional_params: Default::default(),
765            _scopes: Default::default(),
766        }
767    }
768
769    /// Create a builder to help you perform the following task:
770    ///
771    /// Returns permissions that a caller has on the specified Organization. The `resource` field should be the organization's resource name, e.g. "organizations/123".
772    ///
773    /// # Arguments
774    ///
775    /// * `request` - No description provided.
776    /// * `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.
777    pub fn test_iam_permissions(
778        &self,
779        request: TestIamPermissionsRequest,
780        resource: &str,
781    ) -> OrganizationTestIamPermissionCall<'a, C> {
782        OrganizationTestIamPermissionCall {
783            hub: self.hub,
784            _request: request,
785            _resource: resource.to_string(),
786            _delegate: Default::default(),
787            _additional_params: Default::default(),
788            _scopes: Default::default(),
789        }
790    }
791
792    /// Create a builder to help you perform the following task:
793    ///
794    /// Updates an Organization resource identified by the specified resource name.
795    ///
796    /// # Arguments
797    ///
798    /// * `request` - No description provided.
799    /// * `name` - Output only. The resource name of the organization. This is the organization's relative path in the API. Its format is "organizations/[organization_id]". For example, "organizations/1234".
800    pub fn update(&self, request: Organization, name: &str) -> OrganizationUpdateCall<'a, C> {
801        OrganizationUpdateCall {
802            hub: self.hub,
803            _request: request,
804            _name: name.to_string(),
805            _delegate: Default::default(),
806            _additional_params: Default::default(),
807            _scopes: Default::default(),
808        }
809    }
810}
811
812/// A builder providing access to all methods supported on *project* resources.
813/// It is not used directly, but through the [`CloudResourceManager`] hub.
814///
815/// # Example
816///
817/// Instantiate a resource builder
818///
819/// ```test_harness,no_run
820/// extern crate hyper;
821/// extern crate hyper_rustls;
822/// extern crate google_cloudresourcemanager1_beta1 as cloudresourcemanager1_beta1;
823///
824/// # async fn dox() {
825/// use cloudresourcemanager1_beta1::{CloudResourceManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
826///
827/// let secret: yup_oauth2::ApplicationSecret = Default::default();
828/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
829///     .with_native_roots()
830///     .unwrap()
831///     .https_only()
832///     .enable_http2()
833///     .build();
834///
835/// let executor = hyper_util::rt::TokioExecutor::new();
836/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
837///     secret,
838///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
839///     yup_oauth2::client::CustomHyperClientBuilder::from(
840///         hyper_util::client::legacy::Client::builder(executor).build(connector),
841///     ),
842/// ).build().await.unwrap();
843///
844/// let client = hyper_util::client::legacy::Client::builder(
845///     hyper_util::rt::TokioExecutor::new()
846/// )
847/// .build(
848///     hyper_rustls::HttpsConnectorBuilder::new()
849///         .with_native_roots()
850///         .unwrap()
851///         .https_or_http()
852///         .enable_http2()
853///         .build()
854/// );
855/// let mut hub = CloudResourceManager::new(client, auth);
856/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
857/// // like `create(...)`, `delete(...)`, `get(...)`, `get_ancestry(...)`, `get_iam_policy(...)`, `list(...)`, `set_iam_policy(...)`, `test_iam_permissions(...)`, `undelete(...)` and `update(...)`
858/// // to build up your call.
859/// let rb = hub.projects();
860/// # }
861/// ```
862pub struct ProjectMethods<'a, C>
863where
864    C: 'a,
865{
866    hub: &'a CloudResourceManager<C>,
867}
868
869impl<'a, C> common::MethodsBuilder for ProjectMethods<'a, C> {}
870
871impl<'a, C> ProjectMethods<'a, C> {
872    /// Create a builder to help you perform the following task:
873    ///
874    /// Creates a Project resource. Initially, the Project resource is owned by its creator exclusively. The creator can later grant permission to others to read or update the Project. Several APIs are activated automatically for the Project, including Google Cloud Storage. The parent is identified by a specified ResourceId, which must include both an ID and a type, such as project, folder, or organization. This method does not associate the new project with a billing account. You can set or update the billing account associated with a project using the \[`projects.updateBillingInfo`\] (/billing/reference/rest/v1/projects/updateBillingInfo) method.
875    ///
876    /// # Arguments
877    ///
878    /// * `request` - No description provided.
879    pub fn create(&self, request: Project) -> ProjectCreateCall<'a, C> {
880        ProjectCreateCall {
881            hub: self.hub,
882            _request: request,
883            _use_legacy_stack: Default::default(),
884            _delegate: Default::default(),
885            _additional_params: Default::default(),
886            _scopes: Default::default(),
887        }
888    }
889
890    /// Create a builder to help you perform the following task:
891    ///
892    /// Marks the Project identified by the specified `project_id` (for example, `my-project-123`) for deletion. This method will only affect the Project if it has a lifecycle state of ACTIVE. This method changes the Project's lifecycle state from ACTIVE to DELETE_REQUESTED. The deletion starts at an unspecified time, at which point the project is no longer accessible. Until the deletion completes, you can check the lifecycle state checked by retrieving the Project with GetProject, and the Project remains visible to ListProjects. However, you cannot update the project. After the deletion completes, the Project is not retrievable by the GetProject and ListProjects methods. The caller must have delete permissions for this Project.
893    ///
894    /// # Arguments
895    ///
896    /// * `projectId` - The Project ID (for example, `foo-bar-123`).
897    pub fn delete(&self, project_id: &str) -> ProjectDeleteCall<'a, C> {
898        ProjectDeleteCall {
899            hub: self.hub,
900            _project_id: project_id.to_string(),
901            _delegate: Default::default(),
902            _additional_params: Default::default(),
903            _scopes: Default::default(),
904        }
905    }
906
907    /// Create a builder to help you perform the following task:
908    ///
909    /// Retrieves the Project identified by the specified `project_id` (for example, `my-project-123`). The caller must have read permissions for this Project.
910    ///
911    /// # Arguments
912    ///
913    /// * `projectId` - Required. The Project ID (for example, `my-project-123`).
914    pub fn get(&self, project_id: &str) -> ProjectGetCall<'a, C> {
915        ProjectGetCall {
916            hub: self.hub,
917            _project_id: project_id.to_string(),
918            _delegate: Default::default(),
919            _additional_params: Default::default(),
920            _scopes: Default::default(),
921        }
922    }
923
924    /// Create a builder to help you perform the following task:
925    ///
926    /// Gets a list of ancestors in the resource hierarchy for the Project identified by the specified `project_id` (for example, `my-project-123`). The caller must have read permissions for this Project.
927    ///
928    /// # Arguments
929    ///
930    /// * `request` - No description provided.
931    /// * `projectId` - Required. The Project ID (for example, `my-project-123`).
932    pub fn get_ancestry(
933        &self,
934        request: GetAncestryRequest,
935        project_id: &str,
936    ) -> ProjectGetAncestryCall<'a, C> {
937        ProjectGetAncestryCall {
938            hub: self.hub,
939            _request: request,
940            _project_id: project_id.to_string(),
941            _delegate: Default::default(),
942            _additional_params: Default::default(),
943            _scopes: Default::default(),
944        }
945    }
946
947    /// Create a builder to help you perform the following task:
948    ///
949    /// Returns the IAM access control policy for the specified Project. Permission is denied if the policy or the resource does not exist. For additional information about resource structure and identification, see [Resource Names](https://cloud.google.com/apis/design/resource_names).
950    ///
951    /// # Arguments
952    ///
953    /// * `request` - No description provided.
954    /// * `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.
955    pub fn get_iam_policy(
956        &self,
957        request: GetIamPolicyRequest,
958        resource: &str,
959    ) -> ProjectGetIamPolicyCall<'a, C> {
960        ProjectGetIamPolicyCall {
961            hub: self.hub,
962            _request: request,
963            _resource: resource.to_string(),
964            _delegate: Default::default(),
965            _additional_params: Default::default(),
966            _scopes: Default::default(),
967        }
968    }
969
970    /// Create a builder to help you perform the following task:
971    ///
972    /// Lists Projects that the caller has the `resourcemanager.projects.get` permission on and satisfy the specified filter. This method returns Projects in an unspecified order. This method is eventually consistent with project mutations; this means that a newly created project may not appear in the results or recent updates to an existing project may not be reflected in the results. To retrieve the latest state of a project, use the GetProject method. NOTE: If the request filter contains a `parent.type` and `parent.id` and the caller has the `resourcemanager.projects.list` permission on the parent, the results will be drawn from an alternate index which provides more consistent results. In future versions of this API, this List method will be split into List and Search to properly capture the behavioral difference.
973    pub fn list(&self) -> ProjectListCall<'a, C> {
974        ProjectListCall {
975            hub: self.hub,
976            _page_token: Default::default(),
977            _page_size: Default::default(),
978            _filter: Default::default(),
979            _delegate: Default::default(),
980            _additional_params: Default::default(),
981            _scopes: Default::default(),
982        }
983    }
984
985    /// Create a builder to help you perform the following task:
986    ///
987    /// Sets the IAM access control policy for the specified Project. CAUTION: This method will replace the existing policy, and cannot be used to append additional IAM settings. NOTE: Removing service accounts from policies or changing their roles can render services completely inoperable. It is important to understand how the service account is being used before removing or updating its roles. The following constraints apply when using `setIamPolicy()`: + Project does not support `allUsers` and `allAuthenticatedUsers` as `members` in a `Binding` of a `Policy`. + The owner role can be granted to a `user`, `serviceAccount`, or a group that is part of an organization. For example, group@myownpersonaldomain.com could be added as an owner to a project in the myownpersonaldomain.com organization, but not the examplepetstore.com organization. + Service accounts can be made owners of a project directly without any restrictions. However, to be added as an owner, a user must be invited via Cloud Platform console and must accept the invitation. + A user cannot be granted the owner role using `setIamPolicy()`. The user must be granted the owner role using the Cloud Platform Console and must explicitly accept the invitation. + Invitations to grant the owner role cannot be sent using `setIamPolicy()`; they must be sent only using the Cloud Platform Console. + Membership changes that leave the project without any owners that have accepted the Terms of Service (ToS) will be rejected. + If the project is not part of an organization, there must be at least one owner who has accepted the Terms of Service (ToS) agreement in the policy. Calling `setIamPolicy()` to remove the last ToS-accepted owner from the policy will fail. This restriction also applies to legacy projects that no longer have owners who have accepted the ToS. Edits to IAM policies will be rejected until the lack of a ToS-accepting owner is rectified. Authorization requires the Google IAM permission `resourcemanager.projects.setIamPolicy` on the project
988    ///
989    /// # Arguments
990    ///
991    /// * `request` - No description provided.
992    /// * `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.
993    pub fn set_iam_policy(
994        &self,
995        request: SetIamPolicyRequest,
996        resource: &str,
997    ) -> ProjectSetIamPolicyCall<'a, C> {
998        ProjectSetIamPolicyCall {
999            hub: self.hub,
1000            _request: request,
1001            _resource: resource.to_string(),
1002            _delegate: Default::default(),
1003            _additional_params: Default::default(),
1004            _scopes: Default::default(),
1005        }
1006    }
1007
1008    /// Create a builder to help you perform the following task:
1009    ///
1010    /// Returns permissions that a caller has on the specified Project.
1011    ///
1012    /// # Arguments
1013    ///
1014    /// * `request` - No description provided.
1015    /// * `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.
1016    pub fn test_iam_permissions(
1017        &self,
1018        request: TestIamPermissionsRequest,
1019        resource: &str,
1020    ) -> ProjectTestIamPermissionCall<'a, C> {
1021        ProjectTestIamPermissionCall {
1022            hub: self.hub,
1023            _request: request,
1024            _resource: resource.to_string(),
1025            _delegate: Default::default(),
1026            _additional_params: Default::default(),
1027            _scopes: Default::default(),
1028        }
1029    }
1030
1031    /// Create a builder to help you perform the following task:
1032    ///
1033    /// Restores the Project identified by the specified `project_id` (for example, `my-project-123`). You can only use this method for a Project that has a lifecycle state of DELETE_REQUESTED. After deletion starts, the Project cannot be restored. The caller must have undelete permissions for this Project.
1034    ///
1035    /// # Arguments
1036    ///
1037    /// * `request` - No description provided.
1038    /// * `projectId` - Required. The project ID (for example, `foo-bar-123`).
1039    pub fn undelete(
1040        &self,
1041        request: UndeleteProjectRequest,
1042        project_id: &str,
1043    ) -> ProjectUndeleteCall<'a, C> {
1044        ProjectUndeleteCall {
1045            hub: self.hub,
1046            _request: request,
1047            _project_id: project_id.to_string(),
1048            _delegate: Default::default(),
1049            _additional_params: Default::default(),
1050            _scopes: Default::default(),
1051        }
1052    }
1053
1054    /// Create a builder to help you perform the following task:
1055    ///
1056    /// Updates the attributes of the Project identified by the specified `project_id` (for example, `my-project-123`). The caller must have modify permissions for this Project.
1057    ///
1058    /// # Arguments
1059    ///
1060    /// * `request` - No description provided.
1061    /// * `projectId` - The project ID (for example, `my-project-123`).
1062    pub fn update(&self, request: Project, project_id: &str) -> ProjectUpdateCall<'a, C> {
1063        ProjectUpdateCall {
1064            hub: self.hub,
1065            _request: request,
1066            _project_id: project_id.to_string(),
1067            _delegate: Default::default(),
1068            _additional_params: Default::default(),
1069            _scopes: Default::default(),
1070        }
1071    }
1072}
1073
1074// ###################
1075// CallBuilders   ###
1076// #################
1077
1078/// Fetches an Organization resource identified by the specified resource name.
1079///
1080/// A builder for the *get* method supported by a *organization* resource.
1081/// It is not used directly, but through a [`OrganizationMethods`] instance.
1082///
1083/// # Example
1084///
1085/// Instantiate a resource method builder
1086///
1087/// ```test_harness,no_run
1088/// # extern crate hyper;
1089/// # extern crate hyper_rustls;
1090/// # extern crate google_cloudresourcemanager1_beta1 as cloudresourcemanager1_beta1;
1091/// # async fn dox() {
1092/// # use cloudresourcemanager1_beta1::{CloudResourceManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
1093///
1094/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
1095/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
1096/// #     .with_native_roots()
1097/// #     .unwrap()
1098/// #     .https_only()
1099/// #     .enable_http2()
1100/// #     .build();
1101///
1102/// # let executor = hyper_util::rt::TokioExecutor::new();
1103/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
1104/// #     secret,
1105/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
1106/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
1107/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
1108/// #     ),
1109/// # ).build().await.unwrap();
1110///
1111/// # let client = hyper_util::client::legacy::Client::builder(
1112/// #     hyper_util::rt::TokioExecutor::new()
1113/// # )
1114/// # .build(
1115/// #     hyper_rustls::HttpsConnectorBuilder::new()
1116/// #         .with_native_roots()
1117/// #         .unwrap()
1118/// #         .https_or_http()
1119/// #         .enable_http2()
1120/// #         .build()
1121/// # );
1122/// # let mut hub = CloudResourceManager::new(client, auth);
1123/// // You can configure optional parameters by calling the respective setters at will, and
1124/// // execute the final call using `doit()`.
1125/// // Values shown here are possibly random and not representative !
1126/// let result = hub.organizations().get("name")
1127///              .organization_id("amet.")
1128///              .doit().await;
1129/// # }
1130/// ```
1131pub struct OrganizationGetCall<'a, C>
1132where
1133    C: 'a,
1134{
1135    hub: &'a CloudResourceManager<C>,
1136    _name: String,
1137    _organization_id: Option<String>,
1138    _delegate: Option<&'a mut dyn common::Delegate>,
1139    _additional_params: HashMap<String, String>,
1140    _scopes: BTreeSet<String>,
1141}
1142
1143impl<'a, C> common::CallBuilder for OrganizationGetCall<'a, C> {}
1144
1145impl<'a, C> OrganizationGetCall<'a, C>
1146where
1147    C: common::Connector,
1148{
1149    /// Perform the operation you have build so far.
1150    pub async fn doit(mut self) -> common::Result<(common::Response, Organization)> {
1151        use std::borrow::Cow;
1152        use std::io::{Read, Seek};
1153
1154        use common::{url::Params, ToParts};
1155        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
1156
1157        let mut dd = common::DefaultDelegate;
1158        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
1159        dlg.begin(common::MethodInfo {
1160            id: "cloudresourcemanager.organizations.get",
1161            http_method: hyper::Method::GET,
1162        });
1163
1164        for &field in ["alt", "name", "organizationId"].iter() {
1165            if self._additional_params.contains_key(field) {
1166                dlg.finished(false);
1167                return Err(common::Error::FieldClash(field));
1168            }
1169        }
1170
1171        let mut params = Params::with_capacity(4 + self._additional_params.len());
1172        params.push("name", self._name);
1173        if let Some(value) = self._organization_id.as_ref() {
1174            params.push("organizationId", value);
1175        }
1176
1177        params.extend(self._additional_params.iter());
1178
1179        params.push("alt", "json");
1180        let mut url = self.hub._base_url.clone() + "v1beta1/{+name}";
1181        if self._scopes.is_empty() {
1182            self._scopes
1183                .insert(Scope::CloudPlatformReadOnly.as_ref().to_string());
1184        }
1185
1186        #[allow(clippy::single_element_loop)]
1187        for &(find_this, param_name) in [("{+name}", "name")].iter() {
1188            url = params.uri_replacement(url, param_name, find_this, true);
1189        }
1190        {
1191            let to_remove = ["name"];
1192            params.remove_params(&to_remove);
1193        }
1194
1195        let url = params.parse_with_url(&url);
1196
1197        loop {
1198            let token = match self
1199                .hub
1200                .auth
1201                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
1202                .await
1203            {
1204                Ok(token) => token,
1205                Err(e) => match dlg.token(e) {
1206                    Ok(token) => token,
1207                    Err(e) => {
1208                        dlg.finished(false);
1209                        return Err(common::Error::MissingToken(e));
1210                    }
1211                },
1212            };
1213            let mut req_result = {
1214                let client = &self.hub.client;
1215                dlg.pre_request();
1216                let mut req_builder = hyper::Request::builder()
1217                    .method(hyper::Method::GET)
1218                    .uri(url.as_str())
1219                    .header(USER_AGENT, self.hub._user_agent.clone());
1220
1221                if let Some(token) = token.as_ref() {
1222                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
1223                }
1224
1225                let request = req_builder
1226                    .header(CONTENT_LENGTH, 0_u64)
1227                    .body(common::to_body::<String>(None));
1228
1229                client.request(request.unwrap()).await
1230            };
1231
1232            match req_result {
1233                Err(err) => {
1234                    if let common::Retry::After(d) = dlg.http_error(&err) {
1235                        sleep(d).await;
1236                        continue;
1237                    }
1238                    dlg.finished(false);
1239                    return Err(common::Error::HttpError(err));
1240                }
1241                Ok(res) => {
1242                    let (mut parts, body) = res.into_parts();
1243                    let mut body = common::Body::new(body);
1244                    if !parts.status.is_success() {
1245                        let bytes = common::to_bytes(body).await.unwrap_or_default();
1246                        let error = serde_json::from_str(&common::to_string(&bytes));
1247                        let response = common::to_response(parts, bytes.into());
1248
1249                        if let common::Retry::After(d) =
1250                            dlg.http_failure(&response, error.as_ref().ok())
1251                        {
1252                            sleep(d).await;
1253                            continue;
1254                        }
1255
1256                        dlg.finished(false);
1257
1258                        return Err(match error {
1259                            Ok(value) => common::Error::BadRequest(value),
1260                            _ => common::Error::Failure(response),
1261                        });
1262                    }
1263                    let response = {
1264                        let bytes = common::to_bytes(body).await.unwrap_or_default();
1265                        let encoded = common::to_string(&bytes);
1266                        match serde_json::from_str(&encoded) {
1267                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
1268                            Err(error) => {
1269                                dlg.response_json_decode_error(&encoded, &error);
1270                                return Err(common::Error::JsonDecodeError(
1271                                    encoded.to_string(),
1272                                    error,
1273                                ));
1274                            }
1275                        }
1276                    };
1277
1278                    dlg.finished(true);
1279                    return Ok(response);
1280                }
1281            }
1282        }
1283    }
1284
1285    /// The resource name of the Organization to fetch. This is the organization's relative path in the API, formatted as "organizations/[organizationId]". For example, "organizations/1234".
1286    ///
1287    /// Sets the *name* path property to the given value.
1288    ///
1289    /// Even though the property as already been set when instantiating this call,
1290    /// we provide this method for API completeness.
1291    pub fn name(mut self, new_value: &str) -> OrganizationGetCall<'a, C> {
1292        self._name = new_value.to_string();
1293        self
1294    }
1295    /// The id of the Organization resource to fetch. This field is deprecated and will be removed in v1. Use name instead.
1296    ///
1297    /// Sets the *organization id* query property to the given value.
1298    pub fn organization_id(mut self, new_value: &str) -> OrganizationGetCall<'a, C> {
1299        self._organization_id = Some(new_value.to_string());
1300        self
1301    }
1302    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
1303    /// while executing the actual API request.
1304    ///
1305    /// ````text
1306    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
1307    /// ````
1308    ///
1309    /// Sets the *delegate* property to the given value.
1310    pub fn delegate(
1311        mut self,
1312        new_value: &'a mut dyn common::Delegate,
1313    ) -> OrganizationGetCall<'a, C> {
1314        self._delegate = Some(new_value);
1315        self
1316    }
1317
1318    /// Set any additional parameter of the query string used in the request.
1319    /// It should be used to set parameters which are not yet available through their own
1320    /// setters.
1321    ///
1322    /// Please note that this method must not be used to set any of the known parameters
1323    /// which have their own setter method. If done anyway, the request will fail.
1324    ///
1325    /// # Additional Parameters
1326    ///
1327    /// * *$.xgafv* (query-string) - V1 error format.
1328    /// * *access_token* (query-string) - OAuth access token.
1329    /// * *alt* (query-string) - Data format for response.
1330    /// * *callback* (query-string) - JSONP
1331    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
1332    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
1333    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
1334    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
1335    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
1336    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
1337    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
1338    pub fn param<T>(mut self, name: T, value: T) -> OrganizationGetCall<'a, C>
1339    where
1340        T: AsRef<str>,
1341    {
1342        self._additional_params
1343            .insert(name.as_ref().to_string(), value.as_ref().to_string());
1344        self
1345    }
1346
1347    /// Identifies the authorization scope for the method you are building.
1348    ///
1349    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
1350    /// [`Scope::CloudPlatformReadOnly`].
1351    ///
1352    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
1353    /// tokens for more than one scope.
1354    ///
1355    /// Usually there is more than one suitable scope to authorize an operation, some of which may
1356    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
1357    /// sufficient, a read-write scope will do as well.
1358    pub fn add_scope<St>(mut self, scope: St) -> OrganizationGetCall<'a, C>
1359    where
1360        St: AsRef<str>,
1361    {
1362        self._scopes.insert(String::from(scope.as_ref()));
1363        self
1364    }
1365    /// Identifies the authorization scope(s) for the method you are building.
1366    ///
1367    /// See [`Self::add_scope()`] for details.
1368    pub fn add_scopes<I, St>(mut self, scopes: I) -> OrganizationGetCall<'a, C>
1369    where
1370        I: IntoIterator<Item = St>,
1371        St: AsRef<str>,
1372    {
1373        self._scopes
1374            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
1375        self
1376    }
1377
1378    /// Removes all scopes, and no default scope will be used either.
1379    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
1380    /// for details).
1381    pub fn clear_scopes(mut self) -> OrganizationGetCall<'a, C> {
1382        self._scopes.clear();
1383        self
1384    }
1385}
1386
1387/// Gets the access control policy for an Organization resource. May be empty if no such policy or resource exists. The `resource` field should be the organization's resource name, e.g. "organizations/123".
1388///
1389/// A builder for the *getIamPolicy* method supported by a *organization* resource.
1390/// It is not used directly, but through a [`OrganizationMethods`] instance.
1391///
1392/// # Example
1393///
1394/// Instantiate a resource method builder
1395///
1396/// ```test_harness,no_run
1397/// # extern crate hyper;
1398/// # extern crate hyper_rustls;
1399/// # extern crate google_cloudresourcemanager1_beta1 as cloudresourcemanager1_beta1;
1400/// use cloudresourcemanager1_beta1::api::GetIamPolicyRequest;
1401/// # async fn dox() {
1402/// # use cloudresourcemanager1_beta1::{CloudResourceManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
1403///
1404/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
1405/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
1406/// #     .with_native_roots()
1407/// #     .unwrap()
1408/// #     .https_only()
1409/// #     .enable_http2()
1410/// #     .build();
1411///
1412/// # let executor = hyper_util::rt::TokioExecutor::new();
1413/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
1414/// #     secret,
1415/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
1416/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
1417/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
1418/// #     ),
1419/// # ).build().await.unwrap();
1420///
1421/// # let client = hyper_util::client::legacy::Client::builder(
1422/// #     hyper_util::rt::TokioExecutor::new()
1423/// # )
1424/// # .build(
1425/// #     hyper_rustls::HttpsConnectorBuilder::new()
1426/// #         .with_native_roots()
1427/// #         .unwrap()
1428/// #         .https_or_http()
1429/// #         .enable_http2()
1430/// #         .build()
1431/// # );
1432/// # let mut hub = CloudResourceManager::new(client, auth);
1433/// // As the method needs a request, you would usually fill it with the desired information
1434/// // into the respective structure. Some of the parts shown here might not be applicable !
1435/// // Values shown here are possibly random and not representative !
1436/// let mut req = GetIamPolicyRequest::default();
1437///
1438/// // You can configure optional parameters by calling the respective setters at will, and
1439/// // execute the final call using `doit()`.
1440/// // Values shown here are possibly random and not representative !
1441/// let result = hub.organizations().get_iam_policy(req, "resource")
1442///              .doit().await;
1443/// # }
1444/// ```
1445pub struct OrganizationGetIamPolicyCall<'a, C>
1446where
1447    C: 'a,
1448{
1449    hub: &'a CloudResourceManager<C>,
1450    _request: GetIamPolicyRequest,
1451    _resource: String,
1452    _delegate: Option<&'a mut dyn common::Delegate>,
1453    _additional_params: HashMap<String, String>,
1454    _scopes: BTreeSet<String>,
1455}
1456
1457impl<'a, C> common::CallBuilder for OrganizationGetIamPolicyCall<'a, C> {}
1458
1459impl<'a, C> OrganizationGetIamPolicyCall<'a, C>
1460where
1461    C: common::Connector,
1462{
1463    /// Perform the operation you have build so far.
1464    pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
1465        use std::borrow::Cow;
1466        use std::io::{Read, Seek};
1467
1468        use common::{url::Params, ToParts};
1469        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
1470
1471        let mut dd = common::DefaultDelegate;
1472        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
1473        dlg.begin(common::MethodInfo {
1474            id: "cloudresourcemanager.organizations.getIamPolicy",
1475            http_method: hyper::Method::POST,
1476        });
1477
1478        for &field in ["alt", "resource"].iter() {
1479            if self._additional_params.contains_key(field) {
1480                dlg.finished(false);
1481                return Err(common::Error::FieldClash(field));
1482            }
1483        }
1484
1485        let mut params = Params::with_capacity(4 + self._additional_params.len());
1486        params.push("resource", self._resource);
1487
1488        params.extend(self._additional_params.iter());
1489
1490        params.push("alt", "json");
1491        let mut url = self.hub._base_url.clone() + "v1beta1/{+resource}:getIamPolicy";
1492        if self._scopes.is_empty() {
1493            self._scopes
1494                .insert(Scope::CloudPlatformReadOnly.as_ref().to_string());
1495        }
1496
1497        #[allow(clippy::single_element_loop)]
1498        for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
1499            url = params.uri_replacement(url, param_name, find_this, true);
1500        }
1501        {
1502            let to_remove = ["resource"];
1503            params.remove_params(&to_remove);
1504        }
1505
1506        let url = params.parse_with_url(&url);
1507
1508        let mut json_mime_type = mime::APPLICATION_JSON;
1509        let mut request_value_reader = {
1510            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
1511            common::remove_json_null_values(&mut value);
1512            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
1513            serde_json::to_writer(&mut dst, &value).unwrap();
1514            dst
1515        };
1516        let request_size = request_value_reader
1517            .seek(std::io::SeekFrom::End(0))
1518            .unwrap();
1519        request_value_reader
1520            .seek(std::io::SeekFrom::Start(0))
1521            .unwrap();
1522
1523        loop {
1524            let token = match self
1525                .hub
1526                .auth
1527                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
1528                .await
1529            {
1530                Ok(token) => token,
1531                Err(e) => match dlg.token(e) {
1532                    Ok(token) => token,
1533                    Err(e) => {
1534                        dlg.finished(false);
1535                        return Err(common::Error::MissingToken(e));
1536                    }
1537                },
1538            };
1539            request_value_reader
1540                .seek(std::io::SeekFrom::Start(0))
1541                .unwrap();
1542            let mut req_result = {
1543                let client = &self.hub.client;
1544                dlg.pre_request();
1545                let mut req_builder = hyper::Request::builder()
1546                    .method(hyper::Method::POST)
1547                    .uri(url.as_str())
1548                    .header(USER_AGENT, self.hub._user_agent.clone());
1549
1550                if let Some(token) = token.as_ref() {
1551                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
1552                }
1553
1554                let request = req_builder
1555                    .header(CONTENT_TYPE, json_mime_type.to_string())
1556                    .header(CONTENT_LENGTH, request_size as u64)
1557                    .body(common::to_body(
1558                        request_value_reader.get_ref().clone().into(),
1559                    ));
1560
1561                client.request(request.unwrap()).await
1562            };
1563
1564            match req_result {
1565                Err(err) => {
1566                    if let common::Retry::After(d) = dlg.http_error(&err) {
1567                        sleep(d).await;
1568                        continue;
1569                    }
1570                    dlg.finished(false);
1571                    return Err(common::Error::HttpError(err));
1572                }
1573                Ok(res) => {
1574                    let (mut parts, body) = res.into_parts();
1575                    let mut body = common::Body::new(body);
1576                    if !parts.status.is_success() {
1577                        let bytes = common::to_bytes(body).await.unwrap_or_default();
1578                        let error = serde_json::from_str(&common::to_string(&bytes));
1579                        let response = common::to_response(parts, bytes.into());
1580
1581                        if let common::Retry::After(d) =
1582                            dlg.http_failure(&response, error.as_ref().ok())
1583                        {
1584                            sleep(d).await;
1585                            continue;
1586                        }
1587
1588                        dlg.finished(false);
1589
1590                        return Err(match error {
1591                            Ok(value) => common::Error::BadRequest(value),
1592                            _ => common::Error::Failure(response),
1593                        });
1594                    }
1595                    let response = {
1596                        let bytes = common::to_bytes(body).await.unwrap_or_default();
1597                        let encoded = common::to_string(&bytes);
1598                        match serde_json::from_str(&encoded) {
1599                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
1600                            Err(error) => {
1601                                dlg.response_json_decode_error(&encoded, &error);
1602                                return Err(common::Error::JsonDecodeError(
1603                                    encoded.to_string(),
1604                                    error,
1605                                ));
1606                            }
1607                        }
1608                    };
1609
1610                    dlg.finished(true);
1611                    return Ok(response);
1612                }
1613            }
1614        }
1615    }
1616
1617    ///
1618    /// Sets the *request* property to the given value.
1619    ///
1620    /// Even though the property as already been set when instantiating this call,
1621    /// we provide this method for API completeness.
1622    pub fn request(
1623        mut self,
1624        new_value: GetIamPolicyRequest,
1625    ) -> OrganizationGetIamPolicyCall<'a, C> {
1626        self._request = new_value;
1627        self
1628    }
1629    /// 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.
1630    ///
1631    /// Sets the *resource* path property to the given value.
1632    ///
1633    /// Even though the property as already been set when instantiating this call,
1634    /// we provide this method for API completeness.
1635    pub fn resource(mut self, new_value: &str) -> OrganizationGetIamPolicyCall<'a, C> {
1636        self._resource = new_value.to_string();
1637        self
1638    }
1639    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
1640    /// while executing the actual API request.
1641    ///
1642    /// ````text
1643    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
1644    /// ````
1645    ///
1646    /// Sets the *delegate* property to the given value.
1647    pub fn delegate(
1648        mut self,
1649        new_value: &'a mut dyn common::Delegate,
1650    ) -> OrganizationGetIamPolicyCall<'a, C> {
1651        self._delegate = Some(new_value);
1652        self
1653    }
1654
1655    /// Set any additional parameter of the query string used in the request.
1656    /// It should be used to set parameters which are not yet available through their own
1657    /// setters.
1658    ///
1659    /// Please note that this method must not be used to set any of the known parameters
1660    /// which have their own setter method. If done anyway, the request will fail.
1661    ///
1662    /// # Additional Parameters
1663    ///
1664    /// * *$.xgafv* (query-string) - V1 error format.
1665    /// * *access_token* (query-string) - OAuth access token.
1666    /// * *alt* (query-string) - Data format for response.
1667    /// * *callback* (query-string) - JSONP
1668    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
1669    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
1670    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
1671    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
1672    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
1673    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
1674    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
1675    pub fn param<T>(mut self, name: T, value: T) -> OrganizationGetIamPolicyCall<'a, C>
1676    where
1677        T: AsRef<str>,
1678    {
1679        self._additional_params
1680            .insert(name.as_ref().to_string(), value.as_ref().to_string());
1681        self
1682    }
1683
1684    /// Identifies the authorization scope for the method you are building.
1685    ///
1686    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
1687    /// [`Scope::CloudPlatformReadOnly`].
1688    ///
1689    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
1690    /// tokens for more than one scope.
1691    ///
1692    /// Usually there is more than one suitable scope to authorize an operation, some of which may
1693    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
1694    /// sufficient, a read-write scope will do as well.
1695    pub fn add_scope<St>(mut self, scope: St) -> OrganizationGetIamPolicyCall<'a, C>
1696    where
1697        St: AsRef<str>,
1698    {
1699        self._scopes.insert(String::from(scope.as_ref()));
1700        self
1701    }
1702    /// Identifies the authorization scope(s) for the method you are building.
1703    ///
1704    /// See [`Self::add_scope()`] for details.
1705    pub fn add_scopes<I, St>(mut self, scopes: I) -> OrganizationGetIamPolicyCall<'a, C>
1706    where
1707        I: IntoIterator<Item = St>,
1708        St: AsRef<str>,
1709    {
1710        self._scopes
1711            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
1712        self
1713    }
1714
1715    /// Removes all scopes, and no default scope will be used either.
1716    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
1717    /// for details).
1718    pub fn clear_scopes(mut self) -> OrganizationGetIamPolicyCall<'a, C> {
1719        self._scopes.clear();
1720        self
1721    }
1722}
1723
1724/// Lists Organization resources that are visible to the user and satisfy the specified filter. This method returns Organizations in an unspecified order. New Organizations do not necessarily appear at the end of the list.
1725///
1726/// A builder for the *list* method supported by a *organization* resource.
1727/// It is not used directly, but through a [`OrganizationMethods`] instance.
1728///
1729/// # Example
1730///
1731/// Instantiate a resource method builder
1732///
1733/// ```test_harness,no_run
1734/// # extern crate hyper;
1735/// # extern crate hyper_rustls;
1736/// # extern crate google_cloudresourcemanager1_beta1 as cloudresourcemanager1_beta1;
1737/// # async fn dox() {
1738/// # use cloudresourcemanager1_beta1::{CloudResourceManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
1739///
1740/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
1741/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
1742/// #     .with_native_roots()
1743/// #     .unwrap()
1744/// #     .https_only()
1745/// #     .enable_http2()
1746/// #     .build();
1747///
1748/// # let executor = hyper_util::rt::TokioExecutor::new();
1749/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
1750/// #     secret,
1751/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
1752/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
1753/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
1754/// #     ),
1755/// # ).build().await.unwrap();
1756///
1757/// # let client = hyper_util::client::legacy::Client::builder(
1758/// #     hyper_util::rt::TokioExecutor::new()
1759/// # )
1760/// # .build(
1761/// #     hyper_rustls::HttpsConnectorBuilder::new()
1762/// #         .with_native_roots()
1763/// #         .unwrap()
1764/// #         .https_or_http()
1765/// #         .enable_http2()
1766/// #         .build()
1767/// # );
1768/// # let mut hub = CloudResourceManager::new(client, auth);
1769/// // You can configure optional parameters by calling the respective setters at will, and
1770/// // execute the final call using `doit()`.
1771/// // Values shown here are possibly random and not representative !
1772/// let result = hub.organizations().list()
1773///              .page_token("ipsum")
1774///              .page_size(-62)
1775///              .filter("Lorem")
1776///              .doit().await;
1777/// # }
1778/// ```
1779pub struct OrganizationListCall<'a, C>
1780where
1781    C: 'a,
1782{
1783    hub: &'a CloudResourceManager<C>,
1784    _page_token: Option<String>,
1785    _page_size: Option<i32>,
1786    _filter: Option<String>,
1787    _delegate: Option<&'a mut dyn common::Delegate>,
1788    _additional_params: HashMap<String, String>,
1789    _scopes: BTreeSet<String>,
1790}
1791
1792impl<'a, C> common::CallBuilder for OrganizationListCall<'a, C> {}
1793
1794impl<'a, C> OrganizationListCall<'a, C>
1795where
1796    C: common::Connector,
1797{
1798    /// Perform the operation you have build so far.
1799    pub async fn doit(mut self) -> common::Result<(common::Response, ListOrganizationsResponse)> {
1800        use std::borrow::Cow;
1801        use std::io::{Read, Seek};
1802
1803        use common::{url::Params, ToParts};
1804        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
1805
1806        let mut dd = common::DefaultDelegate;
1807        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
1808        dlg.begin(common::MethodInfo {
1809            id: "cloudresourcemanager.organizations.list",
1810            http_method: hyper::Method::GET,
1811        });
1812
1813        for &field in ["alt", "pageToken", "pageSize", "filter"].iter() {
1814            if self._additional_params.contains_key(field) {
1815                dlg.finished(false);
1816                return Err(common::Error::FieldClash(field));
1817            }
1818        }
1819
1820        let mut params = Params::with_capacity(5 + self._additional_params.len());
1821        if let Some(value) = self._page_token.as_ref() {
1822            params.push("pageToken", value);
1823        }
1824        if let Some(value) = self._page_size.as_ref() {
1825            params.push("pageSize", value.to_string());
1826        }
1827        if let Some(value) = self._filter.as_ref() {
1828            params.push("filter", value);
1829        }
1830
1831        params.extend(self._additional_params.iter());
1832
1833        params.push("alt", "json");
1834        let mut url = self.hub._base_url.clone() + "v1beta1/organizations";
1835        if self._scopes.is_empty() {
1836            self._scopes
1837                .insert(Scope::CloudPlatformReadOnly.as_ref().to_string());
1838        }
1839
1840        let url = params.parse_with_url(&url);
1841
1842        loop {
1843            let token = match self
1844                .hub
1845                .auth
1846                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
1847                .await
1848            {
1849                Ok(token) => token,
1850                Err(e) => match dlg.token(e) {
1851                    Ok(token) => token,
1852                    Err(e) => {
1853                        dlg.finished(false);
1854                        return Err(common::Error::MissingToken(e));
1855                    }
1856                },
1857            };
1858            let mut req_result = {
1859                let client = &self.hub.client;
1860                dlg.pre_request();
1861                let mut req_builder = hyper::Request::builder()
1862                    .method(hyper::Method::GET)
1863                    .uri(url.as_str())
1864                    .header(USER_AGENT, self.hub._user_agent.clone());
1865
1866                if let Some(token) = token.as_ref() {
1867                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
1868                }
1869
1870                let request = req_builder
1871                    .header(CONTENT_LENGTH, 0_u64)
1872                    .body(common::to_body::<String>(None));
1873
1874                client.request(request.unwrap()).await
1875            };
1876
1877            match req_result {
1878                Err(err) => {
1879                    if let common::Retry::After(d) = dlg.http_error(&err) {
1880                        sleep(d).await;
1881                        continue;
1882                    }
1883                    dlg.finished(false);
1884                    return Err(common::Error::HttpError(err));
1885                }
1886                Ok(res) => {
1887                    let (mut parts, body) = res.into_parts();
1888                    let mut body = common::Body::new(body);
1889                    if !parts.status.is_success() {
1890                        let bytes = common::to_bytes(body).await.unwrap_or_default();
1891                        let error = serde_json::from_str(&common::to_string(&bytes));
1892                        let response = common::to_response(parts, bytes.into());
1893
1894                        if let common::Retry::After(d) =
1895                            dlg.http_failure(&response, error.as_ref().ok())
1896                        {
1897                            sleep(d).await;
1898                            continue;
1899                        }
1900
1901                        dlg.finished(false);
1902
1903                        return Err(match error {
1904                            Ok(value) => common::Error::BadRequest(value),
1905                            _ => common::Error::Failure(response),
1906                        });
1907                    }
1908                    let response = {
1909                        let bytes = common::to_bytes(body).await.unwrap_or_default();
1910                        let encoded = common::to_string(&bytes);
1911                        match serde_json::from_str(&encoded) {
1912                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
1913                            Err(error) => {
1914                                dlg.response_json_decode_error(&encoded, &error);
1915                                return Err(common::Error::JsonDecodeError(
1916                                    encoded.to_string(),
1917                                    error,
1918                                ));
1919                            }
1920                        }
1921                    };
1922
1923                    dlg.finished(true);
1924                    return Ok(response);
1925                }
1926            }
1927        }
1928    }
1929
1930    /// A pagination token returned from a previous call to `ListOrganizations` that indicates from where listing should continue. This field is optional.
1931    ///
1932    /// Sets the *page token* query property to the given value.
1933    pub fn page_token(mut self, new_value: &str) -> OrganizationListCall<'a, C> {
1934        self._page_token = Some(new_value.to_string());
1935        self
1936    }
1937    /// The maximum number of Organizations to return in the response. This field is optional.
1938    ///
1939    /// Sets the *page size* query property to the given value.
1940    pub fn page_size(mut self, new_value: i32) -> OrganizationListCall<'a, C> {
1941        self._page_size = Some(new_value);
1942        self
1943    }
1944    /// An optional query string used to filter the Organizations to return in the response. Filter rules are case-insensitive. Organizations may be filtered by `owner.directoryCustomerId` or by `domain`, where the domain is a verified G Suite domain, for example: * Filter `owner.directorycustomerid:123456789` returns Organization resources with `owner.directory_customer_id` equal to `123456789`. * Filter `domain:google.com` returns Organization resources corresponding to the domain `google.com`. This field is optional.
1945    ///
1946    /// Sets the *filter* query property to the given value.
1947    pub fn filter(mut self, new_value: &str) -> OrganizationListCall<'a, C> {
1948        self._filter = Some(new_value.to_string());
1949        self
1950    }
1951    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
1952    /// while executing the actual API request.
1953    ///
1954    /// ````text
1955    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
1956    /// ````
1957    ///
1958    /// Sets the *delegate* property to the given value.
1959    pub fn delegate(
1960        mut self,
1961        new_value: &'a mut dyn common::Delegate,
1962    ) -> OrganizationListCall<'a, C> {
1963        self._delegate = Some(new_value);
1964        self
1965    }
1966
1967    /// Set any additional parameter of the query string used in the request.
1968    /// It should be used to set parameters which are not yet available through their own
1969    /// setters.
1970    ///
1971    /// Please note that this method must not be used to set any of the known parameters
1972    /// which have their own setter method. If done anyway, the request will fail.
1973    ///
1974    /// # Additional Parameters
1975    ///
1976    /// * *$.xgafv* (query-string) - V1 error format.
1977    /// * *access_token* (query-string) - OAuth access token.
1978    /// * *alt* (query-string) - Data format for response.
1979    /// * *callback* (query-string) - JSONP
1980    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
1981    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
1982    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
1983    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
1984    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
1985    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
1986    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
1987    pub fn param<T>(mut self, name: T, value: T) -> OrganizationListCall<'a, C>
1988    where
1989        T: AsRef<str>,
1990    {
1991        self._additional_params
1992            .insert(name.as_ref().to_string(), value.as_ref().to_string());
1993        self
1994    }
1995
1996    /// Identifies the authorization scope for the method you are building.
1997    ///
1998    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
1999    /// [`Scope::CloudPlatformReadOnly`].
2000    ///
2001    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
2002    /// tokens for more than one scope.
2003    ///
2004    /// Usually there is more than one suitable scope to authorize an operation, some of which may
2005    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
2006    /// sufficient, a read-write scope will do as well.
2007    pub fn add_scope<St>(mut self, scope: St) -> OrganizationListCall<'a, C>
2008    where
2009        St: AsRef<str>,
2010    {
2011        self._scopes.insert(String::from(scope.as_ref()));
2012        self
2013    }
2014    /// Identifies the authorization scope(s) for the method you are building.
2015    ///
2016    /// See [`Self::add_scope()`] for details.
2017    pub fn add_scopes<I, St>(mut self, scopes: I) -> OrganizationListCall<'a, C>
2018    where
2019        I: IntoIterator<Item = St>,
2020        St: AsRef<str>,
2021    {
2022        self._scopes
2023            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
2024        self
2025    }
2026
2027    /// Removes all scopes, and no default scope will be used either.
2028    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
2029    /// for details).
2030    pub fn clear_scopes(mut self) -> OrganizationListCall<'a, C> {
2031        self._scopes.clear();
2032        self
2033    }
2034}
2035
2036/// Sets the access control policy on an Organization resource. Replaces any existing policy. The `resource` field should be the organization's resource name, e.g. "organizations/123".
2037///
2038/// A builder for the *setIamPolicy* method supported by a *organization* resource.
2039/// It is not used directly, but through a [`OrganizationMethods`] instance.
2040///
2041/// # Example
2042///
2043/// Instantiate a resource method builder
2044///
2045/// ```test_harness,no_run
2046/// # extern crate hyper;
2047/// # extern crate hyper_rustls;
2048/// # extern crate google_cloudresourcemanager1_beta1 as cloudresourcemanager1_beta1;
2049/// use cloudresourcemanager1_beta1::api::SetIamPolicyRequest;
2050/// # async fn dox() {
2051/// # use cloudresourcemanager1_beta1::{CloudResourceManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2052///
2053/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
2054/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
2055/// #     .with_native_roots()
2056/// #     .unwrap()
2057/// #     .https_only()
2058/// #     .enable_http2()
2059/// #     .build();
2060///
2061/// # let executor = hyper_util::rt::TokioExecutor::new();
2062/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
2063/// #     secret,
2064/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2065/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
2066/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
2067/// #     ),
2068/// # ).build().await.unwrap();
2069///
2070/// # let client = hyper_util::client::legacy::Client::builder(
2071/// #     hyper_util::rt::TokioExecutor::new()
2072/// # )
2073/// # .build(
2074/// #     hyper_rustls::HttpsConnectorBuilder::new()
2075/// #         .with_native_roots()
2076/// #         .unwrap()
2077/// #         .https_or_http()
2078/// #         .enable_http2()
2079/// #         .build()
2080/// # );
2081/// # let mut hub = CloudResourceManager::new(client, auth);
2082/// // As the method needs a request, you would usually fill it with the desired information
2083/// // into the respective structure. Some of the parts shown here might not be applicable !
2084/// // Values shown here are possibly random and not representative !
2085/// let mut req = SetIamPolicyRequest::default();
2086///
2087/// // You can configure optional parameters by calling the respective setters at will, and
2088/// // execute the final call using `doit()`.
2089/// // Values shown here are possibly random and not representative !
2090/// let result = hub.organizations().set_iam_policy(req, "resource")
2091///              .doit().await;
2092/// # }
2093/// ```
2094pub struct OrganizationSetIamPolicyCall<'a, C>
2095where
2096    C: 'a,
2097{
2098    hub: &'a CloudResourceManager<C>,
2099    _request: SetIamPolicyRequest,
2100    _resource: String,
2101    _delegate: Option<&'a mut dyn common::Delegate>,
2102    _additional_params: HashMap<String, String>,
2103    _scopes: BTreeSet<String>,
2104}
2105
2106impl<'a, C> common::CallBuilder for OrganizationSetIamPolicyCall<'a, C> {}
2107
2108impl<'a, C> OrganizationSetIamPolicyCall<'a, C>
2109where
2110    C: common::Connector,
2111{
2112    /// Perform the operation you have build so far.
2113    pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
2114        use std::borrow::Cow;
2115        use std::io::{Read, Seek};
2116
2117        use common::{url::Params, ToParts};
2118        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
2119
2120        let mut dd = common::DefaultDelegate;
2121        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
2122        dlg.begin(common::MethodInfo {
2123            id: "cloudresourcemanager.organizations.setIamPolicy",
2124            http_method: hyper::Method::POST,
2125        });
2126
2127        for &field in ["alt", "resource"].iter() {
2128            if self._additional_params.contains_key(field) {
2129                dlg.finished(false);
2130                return Err(common::Error::FieldClash(field));
2131            }
2132        }
2133
2134        let mut params = Params::with_capacity(4 + self._additional_params.len());
2135        params.push("resource", self._resource);
2136
2137        params.extend(self._additional_params.iter());
2138
2139        params.push("alt", "json");
2140        let mut url = self.hub._base_url.clone() + "v1beta1/{+resource}:setIamPolicy";
2141        if self._scopes.is_empty() {
2142            self._scopes
2143                .insert(Scope::CloudPlatform.as_ref().to_string());
2144        }
2145
2146        #[allow(clippy::single_element_loop)]
2147        for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
2148            url = params.uri_replacement(url, param_name, find_this, true);
2149        }
2150        {
2151            let to_remove = ["resource"];
2152            params.remove_params(&to_remove);
2153        }
2154
2155        let url = params.parse_with_url(&url);
2156
2157        let mut json_mime_type = mime::APPLICATION_JSON;
2158        let mut request_value_reader = {
2159            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
2160            common::remove_json_null_values(&mut value);
2161            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
2162            serde_json::to_writer(&mut dst, &value).unwrap();
2163            dst
2164        };
2165        let request_size = request_value_reader
2166            .seek(std::io::SeekFrom::End(0))
2167            .unwrap();
2168        request_value_reader
2169            .seek(std::io::SeekFrom::Start(0))
2170            .unwrap();
2171
2172        loop {
2173            let token = match self
2174                .hub
2175                .auth
2176                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
2177                .await
2178            {
2179                Ok(token) => token,
2180                Err(e) => match dlg.token(e) {
2181                    Ok(token) => token,
2182                    Err(e) => {
2183                        dlg.finished(false);
2184                        return Err(common::Error::MissingToken(e));
2185                    }
2186                },
2187            };
2188            request_value_reader
2189                .seek(std::io::SeekFrom::Start(0))
2190                .unwrap();
2191            let mut req_result = {
2192                let client = &self.hub.client;
2193                dlg.pre_request();
2194                let mut req_builder = hyper::Request::builder()
2195                    .method(hyper::Method::POST)
2196                    .uri(url.as_str())
2197                    .header(USER_AGENT, self.hub._user_agent.clone());
2198
2199                if let Some(token) = token.as_ref() {
2200                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
2201                }
2202
2203                let request = req_builder
2204                    .header(CONTENT_TYPE, json_mime_type.to_string())
2205                    .header(CONTENT_LENGTH, request_size as u64)
2206                    .body(common::to_body(
2207                        request_value_reader.get_ref().clone().into(),
2208                    ));
2209
2210                client.request(request.unwrap()).await
2211            };
2212
2213            match req_result {
2214                Err(err) => {
2215                    if let common::Retry::After(d) = dlg.http_error(&err) {
2216                        sleep(d).await;
2217                        continue;
2218                    }
2219                    dlg.finished(false);
2220                    return Err(common::Error::HttpError(err));
2221                }
2222                Ok(res) => {
2223                    let (mut parts, body) = res.into_parts();
2224                    let mut body = common::Body::new(body);
2225                    if !parts.status.is_success() {
2226                        let bytes = common::to_bytes(body).await.unwrap_or_default();
2227                        let error = serde_json::from_str(&common::to_string(&bytes));
2228                        let response = common::to_response(parts, bytes.into());
2229
2230                        if let common::Retry::After(d) =
2231                            dlg.http_failure(&response, error.as_ref().ok())
2232                        {
2233                            sleep(d).await;
2234                            continue;
2235                        }
2236
2237                        dlg.finished(false);
2238
2239                        return Err(match error {
2240                            Ok(value) => common::Error::BadRequest(value),
2241                            _ => common::Error::Failure(response),
2242                        });
2243                    }
2244                    let response = {
2245                        let bytes = common::to_bytes(body).await.unwrap_or_default();
2246                        let encoded = common::to_string(&bytes);
2247                        match serde_json::from_str(&encoded) {
2248                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
2249                            Err(error) => {
2250                                dlg.response_json_decode_error(&encoded, &error);
2251                                return Err(common::Error::JsonDecodeError(
2252                                    encoded.to_string(),
2253                                    error,
2254                                ));
2255                            }
2256                        }
2257                    };
2258
2259                    dlg.finished(true);
2260                    return Ok(response);
2261                }
2262            }
2263        }
2264    }
2265
2266    ///
2267    /// Sets the *request* property to the given value.
2268    ///
2269    /// Even though the property as already been set when instantiating this call,
2270    /// we provide this method for API completeness.
2271    pub fn request(
2272        mut self,
2273        new_value: SetIamPolicyRequest,
2274    ) -> OrganizationSetIamPolicyCall<'a, C> {
2275        self._request = new_value;
2276        self
2277    }
2278    /// 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.
2279    ///
2280    /// Sets the *resource* path property to the given value.
2281    ///
2282    /// Even though the property as already been set when instantiating this call,
2283    /// we provide this method for API completeness.
2284    pub fn resource(mut self, new_value: &str) -> OrganizationSetIamPolicyCall<'a, C> {
2285        self._resource = new_value.to_string();
2286        self
2287    }
2288    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
2289    /// while executing the actual API request.
2290    ///
2291    /// ````text
2292    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
2293    /// ````
2294    ///
2295    /// Sets the *delegate* property to the given value.
2296    pub fn delegate(
2297        mut self,
2298        new_value: &'a mut dyn common::Delegate,
2299    ) -> OrganizationSetIamPolicyCall<'a, C> {
2300        self._delegate = Some(new_value);
2301        self
2302    }
2303
2304    /// Set any additional parameter of the query string used in the request.
2305    /// It should be used to set parameters which are not yet available through their own
2306    /// setters.
2307    ///
2308    /// Please note that this method must not be used to set any of the known parameters
2309    /// which have their own setter method. If done anyway, the request will fail.
2310    ///
2311    /// # Additional Parameters
2312    ///
2313    /// * *$.xgafv* (query-string) - V1 error format.
2314    /// * *access_token* (query-string) - OAuth access token.
2315    /// * *alt* (query-string) - Data format for response.
2316    /// * *callback* (query-string) - JSONP
2317    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
2318    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
2319    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
2320    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
2321    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
2322    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
2323    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
2324    pub fn param<T>(mut self, name: T, value: T) -> OrganizationSetIamPolicyCall<'a, C>
2325    where
2326        T: AsRef<str>,
2327    {
2328        self._additional_params
2329            .insert(name.as_ref().to_string(), value.as_ref().to_string());
2330        self
2331    }
2332
2333    /// Identifies the authorization scope for the method you are building.
2334    ///
2335    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
2336    /// [`Scope::CloudPlatform`].
2337    ///
2338    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
2339    /// tokens for more than one scope.
2340    ///
2341    /// Usually there is more than one suitable scope to authorize an operation, some of which may
2342    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
2343    /// sufficient, a read-write scope will do as well.
2344    pub fn add_scope<St>(mut self, scope: St) -> OrganizationSetIamPolicyCall<'a, C>
2345    where
2346        St: AsRef<str>,
2347    {
2348        self._scopes.insert(String::from(scope.as_ref()));
2349        self
2350    }
2351    /// Identifies the authorization scope(s) for the method you are building.
2352    ///
2353    /// See [`Self::add_scope()`] for details.
2354    pub fn add_scopes<I, St>(mut self, scopes: I) -> OrganizationSetIamPolicyCall<'a, C>
2355    where
2356        I: IntoIterator<Item = St>,
2357        St: AsRef<str>,
2358    {
2359        self._scopes
2360            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
2361        self
2362    }
2363
2364    /// Removes all scopes, and no default scope will be used either.
2365    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
2366    /// for details).
2367    pub fn clear_scopes(mut self) -> OrganizationSetIamPolicyCall<'a, C> {
2368        self._scopes.clear();
2369        self
2370    }
2371}
2372
2373/// Returns permissions that a caller has on the specified Organization. The `resource` field should be the organization's resource name, e.g. "organizations/123".
2374///
2375/// A builder for the *testIamPermissions* method supported by a *organization* resource.
2376/// It is not used directly, but through a [`OrganizationMethods`] instance.
2377///
2378/// # Example
2379///
2380/// Instantiate a resource method builder
2381///
2382/// ```test_harness,no_run
2383/// # extern crate hyper;
2384/// # extern crate hyper_rustls;
2385/// # extern crate google_cloudresourcemanager1_beta1 as cloudresourcemanager1_beta1;
2386/// use cloudresourcemanager1_beta1::api::TestIamPermissionsRequest;
2387/// # async fn dox() {
2388/// # use cloudresourcemanager1_beta1::{CloudResourceManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2389///
2390/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
2391/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
2392/// #     .with_native_roots()
2393/// #     .unwrap()
2394/// #     .https_only()
2395/// #     .enable_http2()
2396/// #     .build();
2397///
2398/// # let executor = hyper_util::rt::TokioExecutor::new();
2399/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
2400/// #     secret,
2401/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2402/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
2403/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
2404/// #     ),
2405/// # ).build().await.unwrap();
2406///
2407/// # let client = hyper_util::client::legacy::Client::builder(
2408/// #     hyper_util::rt::TokioExecutor::new()
2409/// # )
2410/// # .build(
2411/// #     hyper_rustls::HttpsConnectorBuilder::new()
2412/// #         .with_native_roots()
2413/// #         .unwrap()
2414/// #         .https_or_http()
2415/// #         .enable_http2()
2416/// #         .build()
2417/// # );
2418/// # let mut hub = CloudResourceManager::new(client, auth);
2419/// // As the method needs a request, you would usually fill it with the desired information
2420/// // into the respective structure. Some of the parts shown here might not be applicable !
2421/// // Values shown here are possibly random and not representative !
2422/// let mut req = TestIamPermissionsRequest::default();
2423///
2424/// // You can configure optional parameters by calling the respective setters at will, and
2425/// // execute the final call using `doit()`.
2426/// // Values shown here are possibly random and not representative !
2427/// let result = hub.organizations().test_iam_permissions(req, "resource")
2428///              .doit().await;
2429/// # }
2430/// ```
2431pub struct OrganizationTestIamPermissionCall<'a, C>
2432where
2433    C: 'a,
2434{
2435    hub: &'a CloudResourceManager<C>,
2436    _request: TestIamPermissionsRequest,
2437    _resource: String,
2438    _delegate: Option<&'a mut dyn common::Delegate>,
2439    _additional_params: HashMap<String, String>,
2440    _scopes: BTreeSet<String>,
2441}
2442
2443impl<'a, C> common::CallBuilder for OrganizationTestIamPermissionCall<'a, C> {}
2444
2445impl<'a, C> OrganizationTestIamPermissionCall<'a, C>
2446where
2447    C: common::Connector,
2448{
2449    /// Perform the operation you have build so far.
2450    pub async fn doit(mut self) -> common::Result<(common::Response, TestIamPermissionsResponse)> {
2451        use std::borrow::Cow;
2452        use std::io::{Read, Seek};
2453
2454        use common::{url::Params, ToParts};
2455        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
2456
2457        let mut dd = common::DefaultDelegate;
2458        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
2459        dlg.begin(common::MethodInfo {
2460            id: "cloudresourcemanager.organizations.testIamPermissions",
2461            http_method: hyper::Method::POST,
2462        });
2463
2464        for &field in ["alt", "resource"].iter() {
2465            if self._additional_params.contains_key(field) {
2466                dlg.finished(false);
2467                return Err(common::Error::FieldClash(field));
2468            }
2469        }
2470
2471        let mut params = Params::with_capacity(4 + self._additional_params.len());
2472        params.push("resource", self._resource);
2473
2474        params.extend(self._additional_params.iter());
2475
2476        params.push("alt", "json");
2477        let mut url = self.hub._base_url.clone() + "v1beta1/{+resource}:testIamPermissions";
2478        if self._scopes.is_empty() {
2479            self._scopes
2480                .insert(Scope::CloudPlatformReadOnly.as_ref().to_string());
2481        }
2482
2483        #[allow(clippy::single_element_loop)]
2484        for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
2485            url = params.uri_replacement(url, param_name, find_this, true);
2486        }
2487        {
2488            let to_remove = ["resource"];
2489            params.remove_params(&to_remove);
2490        }
2491
2492        let url = params.parse_with_url(&url);
2493
2494        let mut json_mime_type = mime::APPLICATION_JSON;
2495        let mut request_value_reader = {
2496            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
2497            common::remove_json_null_values(&mut value);
2498            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
2499            serde_json::to_writer(&mut dst, &value).unwrap();
2500            dst
2501        };
2502        let request_size = request_value_reader
2503            .seek(std::io::SeekFrom::End(0))
2504            .unwrap();
2505        request_value_reader
2506            .seek(std::io::SeekFrom::Start(0))
2507            .unwrap();
2508
2509        loop {
2510            let token = match self
2511                .hub
2512                .auth
2513                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
2514                .await
2515            {
2516                Ok(token) => token,
2517                Err(e) => match dlg.token(e) {
2518                    Ok(token) => token,
2519                    Err(e) => {
2520                        dlg.finished(false);
2521                        return Err(common::Error::MissingToken(e));
2522                    }
2523                },
2524            };
2525            request_value_reader
2526                .seek(std::io::SeekFrom::Start(0))
2527                .unwrap();
2528            let mut req_result = {
2529                let client = &self.hub.client;
2530                dlg.pre_request();
2531                let mut req_builder = hyper::Request::builder()
2532                    .method(hyper::Method::POST)
2533                    .uri(url.as_str())
2534                    .header(USER_AGENT, self.hub._user_agent.clone());
2535
2536                if let Some(token) = token.as_ref() {
2537                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
2538                }
2539
2540                let request = req_builder
2541                    .header(CONTENT_TYPE, json_mime_type.to_string())
2542                    .header(CONTENT_LENGTH, request_size as u64)
2543                    .body(common::to_body(
2544                        request_value_reader.get_ref().clone().into(),
2545                    ));
2546
2547                client.request(request.unwrap()).await
2548            };
2549
2550            match req_result {
2551                Err(err) => {
2552                    if let common::Retry::After(d) = dlg.http_error(&err) {
2553                        sleep(d).await;
2554                        continue;
2555                    }
2556                    dlg.finished(false);
2557                    return Err(common::Error::HttpError(err));
2558                }
2559                Ok(res) => {
2560                    let (mut parts, body) = res.into_parts();
2561                    let mut body = common::Body::new(body);
2562                    if !parts.status.is_success() {
2563                        let bytes = common::to_bytes(body).await.unwrap_or_default();
2564                        let error = serde_json::from_str(&common::to_string(&bytes));
2565                        let response = common::to_response(parts, bytes.into());
2566
2567                        if let common::Retry::After(d) =
2568                            dlg.http_failure(&response, error.as_ref().ok())
2569                        {
2570                            sleep(d).await;
2571                            continue;
2572                        }
2573
2574                        dlg.finished(false);
2575
2576                        return Err(match error {
2577                            Ok(value) => common::Error::BadRequest(value),
2578                            _ => common::Error::Failure(response),
2579                        });
2580                    }
2581                    let response = {
2582                        let bytes = common::to_bytes(body).await.unwrap_or_default();
2583                        let encoded = common::to_string(&bytes);
2584                        match serde_json::from_str(&encoded) {
2585                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
2586                            Err(error) => {
2587                                dlg.response_json_decode_error(&encoded, &error);
2588                                return Err(common::Error::JsonDecodeError(
2589                                    encoded.to_string(),
2590                                    error,
2591                                ));
2592                            }
2593                        }
2594                    };
2595
2596                    dlg.finished(true);
2597                    return Ok(response);
2598                }
2599            }
2600        }
2601    }
2602
2603    ///
2604    /// Sets the *request* property to the given value.
2605    ///
2606    /// Even though the property as already been set when instantiating this call,
2607    /// we provide this method for API completeness.
2608    pub fn request(
2609        mut self,
2610        new_value: TestIamPermissionsRequest,
2611    ) -> OrganizationTestIamPermissionCall<'a, C> {
2612        self._request = new_value;
2613        self
2614    }
2615    /// 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.
2616    ///
2617    /// Sets the *resource* path property to the given value.
2618    ///
2619    /// Even though the property as already been set when instantiating this call,
2620    /// we provide this method for API completeness.
2621    pub fn resource(mut self, new_value: &str) -> OrganizationTestIamPermissionCall<'a, C> {
2622        self._resource = new_value.to_string();
2623        self
2624    }
2625    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
2626    /// while executing the actual API request.
2627    ///
2628    /// ````text
2629    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
2630    /// ````
2631    ///
2632    /// Sets the *delegate* property to the given value.
2633    pub fn delegate(
2634        mut self,
2635        new_value: &'a mut dyn common::Delegate,
2636    ) -> OrganizationTestIamPermissionCall<'a, C> {
2637        self._delegate = Some(new_value);
2638        self
2639    }
2640
2641    /// Set any additional parameter of the query string used in the request.
2642    /// It should be used to set parameters which are not yet available through their own
2643    /// setters.
2644    ///
2645    /// Please note that this method must not be used to set any of the known parameters
2646    /// which have their own setter method. If done anyway, the request will fail.
2647    ///
2648    /// # Additional Parameters
2649    ///
2650    /// * *$.xgafv* (query-string) - V1 error format.
2651    /// * *access_token* (query-string) - OAuth access token.
2652    /// * *alt* (query-string) - Data format for response.
2653    /// * *callback* (query-string) - JSONP
2654    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
2655    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
2656    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
2657    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
2658    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
2659    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
2660    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
2661    pub fn param<T>(mut self, name: T, value: T) -> OrganizationTestIamPermissionCall<'a, C>
2662    where
2663        T: AsRef<str>,
2664    {
2665        self._additional_params
2666            .insert(name.as_ref().to_string(), value.as_ref().to_string());
2667        self
2668    }
2669
2670    /// Identifies the authorization scope for the method you are building.
2671    ///
2672    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
2673    /// [`Scope::CloudPlatformReadOnly`].
2674    ///
2675    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
2676    /// tokens for more than one scope.
2677    ///
2678    /// Usually there is more than one suitable scope to authorize an operation, some of which may
2679    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
2680    /// sufficient, a read-write scope will do as well.
2681    pub fn add_scope<St>(mut self, scope: St) -> OrganizationTestIamPermissionCall<'a, C>
2682    where
2683        St: AsRef<str>,
2684    {
2685        self._scopes.insert(String::from(scope.as_ref()));
2686        self
2687    }
2688    /// Identifies the authorization scope(s) for the method you are building.
2689    ///
2690    /// See [`Self::add_scope()`] for details.
2691    pub fn add_scopes<I, St>(mut self, scopes: I) -> OrganizationTestIamPermissionCall<'a, C>
2692    where
2693        I: IntoIterator<Item = St>,
2694        St: AsRef<str>,
2695    {
2696        self._scopes
2697            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
2698        self
2699    }
2700
2701    /// Removes all scopes, and no default scope will be used either.
2702    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
2703    /// for details).
2704    pub fn clear_scopes(mut self) -> OrganizationTestIamPermissionCall<'a, C> {
2705        self._scopes.clear();
2706        self
2707    }
2708}
2709
2710/// Updates an Organization resource identified by the specified resource name.
2711///
2712/// A builder for the *update* method supported by a *organization* resource.
2713/// It is not used directly, but through a [`OrganizationMethods`] instance.
2714///
2715/// # Example
2716///
2717/// Instantiate a resource method builder
2718///
2719/// ```test_harness,no_run
2720/// # extern crate hyper;
2721/// # extern crate hyper_rustls;
2722/// # extern crate google_cloudresourcemanager1_beta1 as cloudresourcemanager1_beta1;
2723/// use cloudresourcemanager1_beta1::api::Organization;
2724/// # async fn dox() {
2725/// # use cloudresourcemanager1_beta1::{CloudResourceManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2726///
2727/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
2728/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
2729/// #     .with_native_roots()
2730/// #     .unwrap()
2731/// #     .https_only()
2732/// #     .enable_http2()
2733/// #     .build();
2734///
2735/// # let executor = hyper_util::rt::TokioExecutor::new();
2736/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
2737/// #     secret,
2738/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2739/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
2740/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
2741/// #     ),
2742/// # ).build().await.unwrap();
2743///
2744/// # let client = hyper_util::client::legacy::Client::builder(
2745/// #     hyper_util::rt::TokioExecutor::new()
2746/// # )
2747/// # .build(
2748/// #     hyper_rustls::HttpsConnectorBuilder::new()
2749/// #         .with_native_roots()
2750/// #         .unwrap()
2751/// #         .https_or_http()
2752/// #         .enable_http2()
2753/// #         .build()
2754/// # );
2755/// # let mut hub = CloudResourceManager::new(client, auth);
2756/// // As the method needs a request, you would usually fill it with the desired information
2757/// // into the respective structure. Some of the parts shown here might not be applicable !
2758/// // Values shown here are possibly random and not representative !
2759/// let mut req = Organization::default();
2760///
2761/// // You can configure optional parameters by calling the respective setters at will, and
2762/// // execute the final call using `doit()`.
2763/// // Values shown here are possibly random and not representative !
2764/// let result = hub.organizations().update(req, "name")
2765///              .doit().await;
2766/// # }
2767/// ```
2768pub struct OrganizationUpdateCall<'a, C>
2769where
2770    C: 'a,
2771{
2772    hub: &'a CloudResourceManager<C>,
2773    _request: Organization,
2774    _name: String,
2775    _delegate: Option<&'a mut dyn common::Delegate>,
2776    _additional_params: HashMap<String, String>,
2777    _scopes: BTreeSet<String>,
2778}
2779
2780impl<'a, C> common::CallBuilder for OrganizationUpdateCall<'a, C> {}
2781
2782impl<'a, C> OrganizationUpdateCall<'a, C>
2783where
2784    C: common::Connector,
2785{
2786    /// Perform the operation you have build so far.
2787    pub async fn doit(mut self) -> common::Result<(common::Response, Organization)> {
2788        use std::borrow::Cow;
2789        use std::io::{Read, Seek};
2790
2791        use common::{url::Params, ToParts};
2792        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
2793
2794        let mut dd = common::DefaultDelegate;
2795        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
2796        dlg.begin(common::MethodInfo {
2797            id: "cloudresourcemanager.organizations.update",
2798            http_method: hyper::Method::PUT,
2799        });
2800
2801        for &field in ["alt", "name"].iter() {
2802            if self._additional_params.contains_key(field) {
2803                dlg.finished(false);
2804                return Err(common::Error::FieldClash(field));
2805            }
2806        }
2807
2808        let mut params = Params::with_capacity(4 + self._additional_params.len());
2809        params.push("name", self._name);
2810
2811        params.extend(self._additional_params.iter());
2812
2813        params.push("alt", "json");
2814        let mut url = self.hub._base_url.clone() + "v1beta1/{+name}";
2815        if self._scopes.is_empty() {
2816            self._scopes
2817                .insert(Scope::CloudPlatform.as_ref().to_string());
2818        }
2819
2820        #[allow(clippy::single_element_loop)]
2821        for &(find_this, param_name) in [("{+name}", "name")].iter() {
2822            url = params.uri_replacement(url, param_name, find_this, true);
2823        }
2824        {
2825            let to_remove = ["name"];
2826            params.remove_params(&to_remove);
2827        }
2828
2829        let url = params.parse_with_url(&url);
2830
2831        let mut json_mime_type = mime::APPLICATION_JSON;
2832        let mut request_value_reader = {
2833            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
2834            common::remove_json_null_values(&mut value);
2835            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
2836            serde_json::to_writer(&mut dst, &value).unwrap();
2837            dst
2838        };
2839        let request_size = request_value_reader
2840            .seek(std::io::SeekFrom::End(0))
2841            .unwrap();
2842        request_value_reader
2843            .seek(std::io::SeekFrom::Start(0))
2844            .unwrap();
2845
2846        loop {
2847            let token = match self
2848                .hub
2849                .auth
2850                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
2851                .await
2852            {
2853                Ok(token) => token,
2854                Err(e) => match dlg.token(e) {
2855                    Ok(token) => token,
2856                    Err(e) => {
2857                        dlg.finished(false);
2858                        return Err(common::Error::MissingToken(e));
2859                    }
2860                },
2861            };
2862            request_value_reader
2863                .seek(std::io::SeekFrom::Start(0))
2864                .unwrap();
2865            let mut req_result = {
2866                let client = &self.hub.client;
2867                dlg.pre_request();
2868                let mut req_builder = hyper::Request::builder()
2869                    .method(hyper::Method::PUT)
2870                    .uri(url.as_str())
2871                    .header(USER_AGENT, self.hub._user_agent.clone());
2872
2873                if let Some(token) = token.as_ref() {
2874                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
2875                }
2876
2877                let request = req_builder
2878                    .header(CONTENT_TYPE, json_mime_type.to_string())
2879                    .header(CONTENT_LENGTH, request_size as u64)
2880                    .body(common::to_body(
2881                        request_value_reader.get_ref().clone().into(),
2882                    ));
2883
2884                client.request(request.unwrap()).await
2885            };
2886
2887            match req_result {
2888                Err(err) => {
2889                    if let common::Retry::After(d) = dlg.http_error(&err) {
2890                        sleep(d).await;
2891                        continue;
2892                    }
2893                    dlg.finished(false);
2894                    return Err(common::Error::HttpError(err));
2895                }
2896                Ok(res) => {
2897                    let (mut parts, body) = res.into_parts();
2898                    let mut body = common::Body::new(body);
2899                    if !parts.status.is_success() {
2900                        let bytes = common::to_bytes(body).await.unwrap_or_default();
2901                        let error = serde_json::from_str(&common::to_string(&bytes));
2902                        let response = common::to_response(parts, bytes.into());
2903
2904                        if let common::Retry::After(d) =
2905                            dlg.http_failure(&response, error.as_ref().ok())
2906                        {
2907                            sleep(d).await;
2908                            continue;
2909                        }
2910
2911                        dlg.finished(false);
2912
2913                        return Err(match error {
2914                            Ok(value) => common::Error::BadRequest(value),
2915                            _ => common::Error::Failure(response),
2916                        });
2917                    }
2918                    let response = {
2919                        let bytes = common::to_bytes(body).await.unwrap_or_default();
2920                        let encoded = common::to_string(&bytes);
2921                        match serde_json::from_str(&encoded) {
2922                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
2923                            Err(error) => {
2924                                dlg.response_json_decode_error(&encoded, &error);
2925                                return Err(common::Error::JsonDecodeError(
2926                                    encoded.to_string(),
2927                                    error,
2928                                ));
2929                            }
2930                        }
2931                    };
2932
2933                    dlg.finished(true);
2934                    return Ok(response);
2935                }
2936            }
2937        }
2938    }
2939
2940    ///
2941    /// Sets the *request* property to the given value.
2942    ///
2943    /// Even though the property as already been set when instantiating this call,
2944    /// we provide this method for API completeness.
2945    pub fn request(mut self, new_value: Organization) -> OrganizationUpdateCall<'a, C> {
2946        self._request = new_value;
2947        self
2948    }
2949    /// Output only. The resource name of the organization. This is the organization's relative path in the API. Its format is "organizations/[organization_id]". For example, "organizations/1234".
2950    ///
2951    /// Sets the *name* path property to the given value.
2952    ///
2953    /// Even though the property as already been set when instantiating this call,
2954    /// we provide this method for API completeness.
2955    pub fn name(mut self, new_value: &str) -> OrganizationUpdateCall<'a, C> {
2956        self._name = new_value.to_string();
2957        self
2958    }
2959    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
2960    /// while executing the actual API request.
2961    ///
2962    /// ````text
2963    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
2964    /// ````
2965    ///
2966    /// Sets the *delegate* property to the given value.
2967    pub fn delegate(
2968        mut self,
2969        new_value: &'a mut dyn common::Delegate,
2970    ) -> OrganizationUpdateCall<'a, C> {
2971        self._delegate = Some(new_value);
2972        self
2973    }
2974
2975    /// Set any additional parameter of the query string used in the request.
2976    /// It should be used to set parameters which are not yet available through their own
2977    /// setters.
2978    ///
2979    /// Please note that this method must not be used to set any of the known parameters
2980    /// which have their own setter method. If done anyway, the request will fail.
2981    ///
2982    /// # Additional Parameters
2983    ///
2984    /// * *$.xgafv* (query-string) - V1 error format.
2985    /// * *access_token* (query-string) - OAuth access token.
2986    /// * *alt* (query-string) - Data format for response.
2987    /// * *callback* (query-string) - JSONP
2988    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
2989    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
2990    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
2991    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
2992    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
2993    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
2994    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
2995    pub fn param<T>(mut self, name: T, value: T) -> OrganizationUpdateCall<'a, C>
2996    where
2997        T: AsRef<str>,
2998    {
2999        self._additional_params
3000            .insert(name.as_ref().to_string(), value.as_ref().to_string());
3001        self
3002    }
3003
3004    /// Identifies the authorization scope for the method you are building.
3005    ///
3006    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
3007    /// [`Scope::CloudPlatform`].
3008    ///
3009    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
3010    /// tokens for more than one scope.
3011    ///
3012    /// Usually there is more than one suitable scope to authorize an operation, some of which may
3013    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
3014    /// sufficient, a read-write scope will do as well.
3015    pub fn add_scope<St>(mut self, scope: St) -> OrganizationUpdateCall<'a, C>
3016    where
3017        St: AsRef<str>,
3018    {
3019        self._scopes.insert(String::from(scope.as_ref()));
3020        self
3021    }
3022    /// Identifies the authorization scope(s) for the method you are building.
3023    ///
3024    /// See [`Self::add_scope()`] for details.
3025    pub fn add_scopes<I, St>(mut self, scopes: I) -> OrganizationUpdateCall<'a, C>
3026    where
3027        I: IntoIterator<Item = St>,
3028        St: AsRef<str>,
3029    {
3030        self._scopes
3031            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
3032        self
3033    }
3034
3035    /// Removes all scopes, and no default scope will be used either.
3036    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
3037    /// for details).
3038    pub fn clear_scopes(mut self) -> OrganizationUpdateCall<'a, C> {
3039        self._scopes.clear();
3040        self
3041    }
3042}
3043
3044/// Creates a Project resource. Initially, the Project resource is owned by its creator exclusively. The creator can later grant permission to others to read or update the Project. Several APIs are activated automatically for the Project, including Google Cloud Storage. The parent is identified by a specified ResourceId, which must include both an ID and a type, such as project, folder, or organization. This method does not associate the new project with a billing account. You can set or update the billing account associated with a project using the \[`projects.updateBillingInfo`\] (/billing/reference/rest/v1/projects/updateBillingInfo) method.
3045///
3046/// A builder for the *create* method supported by a *project* resource.
3047/// It is not used directly, but through a [`ProjectMethods`] instance.
3048///
3049/// # Example
3050///
3051/// Instantiate a resource method builder
3052///
3053/// ```test_harness,no_run
3054/// # extern crate hyper;
3055/// # extern crate hyper_rustls;
3056/// # extern crate google_cloudresourcemanager1_beta1 as cloudresourcemanager1_beta1;
3057/// use cloudresourcemanager1_beta1::api::Project;
3058/// # async fn dox() {
3059/// # use cloudresourcemanager1_beta1::{CloudResourceManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3060///
3061/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
3062/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
3063/// #     .with_native_roots()
3064/// #     .unwrap()
3065/// #     .https_only()
3066/// #     .enable_http2()
3067/// #     .build();
3068///
3069/// # let executor = hyper_util::rt::TokioExecutor::new();
3070/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
3071/// #     secret,
3072/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3073/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
3074/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
3075/// #     ),
3076/// # ).build().await.unwrap();
3077///
3078/// # let client = hyper_util::client::legacy::Client::builder(
3079/// #     hyper_util::rt::TokioExecutor::new()
3080/// # )
3081/// # .build(
3082/// #     hyper_rustls::HttpsConnectorBuilder::new()
3083/// #         .with_native_roots()
3084/// #         .unwrap()
3085/// #         .https_or_http()
3086/// #         .enable_http2()
3087/// #         .build()
3088/// # );
3089/// # let mut hub = CloudResourceManager::new(client, auth);
3090/// // As the method needs a request, you would usually fill it with the desired information
3091/// // into the respective structure. Some of the parts shown here might not be applicable !
3092/// // Values shown here are possibly random and not representative !
3093/// let mut req = Project::default();
3094///
3095/// // You can configure optional parameters by calling the respective setters at will, and
3096/// // execute the final call using `doit()`.
3097/// // Values shown here are possibly random and not representative !
3098/// let result = hub.projects().create(req)
3099///              .use_legacy_stack(true)
3100///              .doit().await;
3101/// # }
3102/// ```
3103pub struct ProjectCreateCall<'a, C>
3104where
3105    C: 'a,
3106{
3107    hub: &'a CloudResourceManager<C>,
3108    _request: Project,
3109    _use_legacy_stack: Option<bool>,
3110    _delegate: Option<&'a mut dyn common::Delegate>,
3111    _additional_params: HashMap<String, String>,
3112    _scopes: BTreeSet<String>,
3113}
3114
3115impl<'a, C> common::CallBuilder for ProjectCreateCall<'a, C> {}
3116
3117impl<'a, C> ProjectCreateCall<'a, C>
3118where
3119    C: common::Connector,
3120{
3121    /// Perform the operation you have build so far.
3122    pub async fn doit(mut self) -> common::Result<(common::Response, Project)> {
3123        use std::borrow::Cow;
3124        use std::io::{Read, Seek};
3125
3126        use common::{url::Params, ToParts};
3127        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
3128
3129        let mut dd = common::DefaultDelegate;
3130        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
3131        dlg.begin(common::MethodInfo {
3132            id: "cloudresourcemanager.projects.create",
3133            http_method: hyper::Method::POST,
3134        });
3135
3136        for &field in ["alt", "useLegacyStack"].iter() {
3137            if self._additional_params.contains_key(field) {
3138                dlg.finished(false);
3139                return Err(common::Error::FieldClash(field));
3140            }
3141        }
3142
3143        let mut params = Params::with_capacity(4 + self._additional_params.len());
3144        if let Some(value) = self._use_legacy_stack.as_ref() {
3145            params.push("useLegacyStack", value.to_string());
3146        }
3147
3148        params.extend(self._additional_params.iter());
3149
3150        params.push("alt", "json");
3151        let mut url = self.hub._base_url.clone() + "v1beta1/projects";
3152        if self._scopes.is_empty() {
3153            self._scopes
3154                .insert(Scope::CloudPlatform.as_ref().to_string());
3155        }
3156
3157        let url = params.parse_with_url(&url);
3158
3159        let mut json_mime_type = mime::APPLICATION_JSON;
3160        let mut request_value_reader = {
3161            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
3162            common::remove_json_null_values(&mut value);
3163            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
3164            serde_json::to_writer(&mut dst, &value).unwrap();
3165            dst
3166        };
3167        let request_size = request_value_reader
3168            .seek(std::io::SeekFrom::End(0))
3169            .unwrap();
3170        request_value_reader
3171            .seek(std::io::SeekFrom::Start(0))
3172            .unwrap();
3173
3174        loop {
3175            let token = match self
3176                .hub
3177                .auth
3178                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
3179                .await
3180            {
3181                Ok(token) => token,
3182                Err(e) => match dlg.token(e) {
3183                    Ok(token) => token,
3184                    Err(e) => {
3185                        dlg.finished(false);
3186                        return Err(common::Error::MissingToken(e));
3187                    }
3188                },
3189            };
3190            request_value_reader
3191                .seek(std::io::SeekFrom::Start(0))
3192                .unwrap();
3193            let mut req_result = {
3194                let client = &self.hub.client;
3195                dlg.pre_request();
3196                let mut req_builder = hyper::Request::builder()
3197                    .method(hyper::Method::POST)
3198                    .uri(url.as_str())
3199                    .header(USER_AGENT, self.hub._user_agent.clone());
3200
3201                if let Some(token) = token.as_ref() {
3202                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
3203                }
3204
3205                let request = req_builder
3206                    .header(CONTENT_TYPE, json_mime_type.to_string())
3207                    .header(CONTENT_LENGTH, request_size as u64)
3208                    .body(common::to_body(
3209                        request_value_reader.get_ref().clone().into(),
3210                    ));
3211
3212                client.request(request.unwrap()).await
3213            };
3214
3215            match req_result {
3216                Err(err) => {
3217                    if let common::Retry::After(d) = dlg.http_error(&err) {
3218                        sleep(d).await;
3219                        continue;
3220                    }
3221                    dlg.finished(false);
3222                    return Err(common::Error::HttpError(err));
3223                }
3224                Ok(res) => {
3225                    let (mut parts, body) = res.into_parts();
3226                    let mut body = common::Body::new(body);
3227                    if !parts.status.is_success() {
3228                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3229                        let error = serde_json::from_str(&common::to_string(&bytes));
3230                        let response = common::to_response(parts, bytes.into());
3231
3232                        if let common::Retry::After(d) =
3233                            dlg.http_failure(&response, error.as_ref().ok())
3234                        {
3235                            sleep(d).await;
3236                            continue;
3237                        }
3238
3239                        dlg.finished(false);
3240
3241                        return Err(match error {
3242                            Ok(value) => common::Error::BadRequest(value),
3243                            _ => common::Error::Failure(response),
3244                        });
3245                    }
3246                    let response = {
3247                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3248                        let encoded = common::to_string(&bytes);
3249                        match serde_json::from_str(&encoded) {
3250                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
3251                            Err(error) => {
3252                                dlg.response_json_decode_error(&encoded, &error);
3253                                return Err(common::Error::JsonDecodeError(
3254                                    encoded.to_string(),
3255                                    error,
3256                                ));
3257                            }
3258                        }
3259                    };
3260
3261                    dlg.finished(true);
3262                    return Ok(response);
3263                }
3264            }
3265        }
3266    }
3267
3268    ///
3269    /// Sets the *request* property to the given value.
3270    ///
3271    /// Even though the property as already been set when instantiating this call,
3272    /// we provide this method for API completeness.
3273    pub fn request(mut self, new_value: Project) -> ProjectCreateCall<'a, C> {
3274        self._request = new_value;
3275        self
3276    }
3277    /// A now unused experiment opt-out option.
3278    ///
3279    /// Sets the *use legacy stack* query property to the given value.
3280    pub fn use_legacy_stack(mut self, new_value: bool) -> ProjectCreateCall<'a, C> {
3281        self._use_legacy_stack = Some(new_value);
3282        self
3283    }
3284    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3285    /// while executing the actual API request.
3286    ///
3287    /// ````text
3288    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
3289    /// ````
3290    ///
3291    /// Sets the *delegate* property to the given value.
3292    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> ProjectCreateCall<'a, C> {
3293        self._delegate = Some(new_value);
3294        self
3295    }
3296
3297    /// Set any additional parameter of the query string used in the request.
3298    /// It should be used to set parameters which are not yet available through their own
3299    /// setters.
3300    ///
3301    /// Please note that this method must not be used to set any of the known parameters
3302    /// which have their own setter method. If done anyway, the request will fail.
3303    ///
3304    /// # Additional Parameters
3305    ///
3306    /// * *$.xgafv* (query-string) - V1 error format.
3307    /// * *access_token* (query-string) - OAuth access token.
3308    /// * *alt* (query-string) - Data format for response.
3309    /// * *callback* (query-string) - JSONP
3310    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
3311    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
3312    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3313    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
3314    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
3315    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
3316    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
3317    pub fn param<T>(mut self, name: T, value: T) -> ProjectCreateCall<'a, C>
3318    where
3319        T: AsRef<str>,
3320    {
3321        self._additional_params
3322            .insert(name.as_ref().to_string(), value.as_ref().to_string());
3323        self
3324    }
3325
3326    /// Identifies the authorization scope for the method you are building.
3327    ///
3328    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
3329    /// [`Scope::CloudPlatform`].
3330    ///
3331    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
3332    /// tokens for more than one scope.
3333    ///
3334    /// Usually there is more than one suitable scope to authorize an operation, some of which may
3335    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
3336    /// sufficient, a read-write scope will do as well.
3337    pub fn add_scope<St>(mut self, scope: St) -> ProjectCreateCall<'a, C>
3338    where
3339        St: AsRef<str>,
3340    {
3341        self._scopes.insert(String::from(scope.as_ref()));
3342        self
3343    }
3344    /// Identifies the authorization scope(s) for the method you are building.
3345    ///
3346    /// See [`Self::add_scope()`] for details.
3347    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectCreateCall<'a, C>
3348    where
3349        I: IntoIterator<Item = St>,
3350        St: AsRef<str>,
3351    {
3352        self._scopes
3353            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
3354        self
3355    }
3356
3357    /// Removes all scopes, and no default scope will be used either.
3358    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
3359    /// for details).
3360    pub fn clear_scopes(mut self) -> ProjectCreateCall<'a, C> {
3361        self._scopes.clear();
3362        self
3363    }
3364}
3365
3366/// Marks the Project identified by the specified `project_id` (for example, `my-project-123`) for deletion. This method will only affect the Project if it has a lifecycle state of ACTIVE. This method changes the Project's lifecycle state from ACTIVE to DELETE_REQUESTED. The deletion starts at an unspecified time, at which point the project is no longer accessible. Until the deletion completes, you can check the lifecycle state checked by retrieving the Project with GetProject, and the Project remains visible to ListProjects. However, you cannot update the project. After the deletion completes, the Project is not retrievable by the GetProject and ListProjects methods. The caller must have delete permissions for this Project.
3367///
3368/// A builder for the *delete* method supported by a *project* resource.
3369/// It is not used directly, but through a [`ProjectMethods`] instance.
3370///
3371/// # Example
3372///
3373/// Instantiate a resource method builder
3374///
3375/// ```test_harness,no_run
3376/// # extern crate hyper;
3377/// # extern crate hyper_rustls;
3378/// # extern crate google_cloudresourcemanager1_beta1 as cloudresourcemanager1_beta1;
3379/// # async fn dox() {
3380/// # use cloudresourcemanager1_beta1::{CloudResourceManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3381///
3382/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
3383/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
3384/// #     .with_native_roots()
3385/// #     .unwrap()
3386/// #     .https_only()
3387/// #     .enable_http2()
3388/// #     .build();
3389///
3390/// # let executor = hyper_util::rt::TokioExecutor::new();
3391/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
3392/// #     secret,
3393/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3394/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
3395/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
3396/// #     ),
3397/// # ).build().await.unwrap();
3398///
3399/// # let client = hyper_util::client::legacy::Client::builder(
3400/// #     hyper_util::rt::TokioExecutor::new()
3401/// # )
3402/// # .build(
3403/// #     hyper_rustls::HttpsConnectorBuilder::new()
3404/// #         .with_native_roots()
3405/// #         .unwrap()
3406/// #         .https_or_http()
3407/// #         .enable_http2()
3408/// #         .build()
3409/// # );
3410/// # let mut hub = CloudResourceManager::new(client, auth);
3411/// // You can configure optional parameters by calling the respective setters at will, and
3412/// // execute the final call using `doit()`.
3413/// // Values shown here are possibly random and not representative !
3414/// let result = hub.projects().delete("projectId")
3415///              .doit().await;
3416/// # }
3417/// ```
3418pub struct ProjectDeleteCall<'a, C>
3419where
3420    C: 'a,
3421{
3422    hub: &'a CloudResourceManager<C>,
3423    _project_id: String,
3424    _delegate: Option<&'a mut dyn common::Delegate>,
3425    _additional_params: HashMap<String, String>,
3426    _scopes: BTreeSet<String>,
3427}
3428
3429impl<'a, C> common::CallBuilder for ProjectDeleteCall<'a, C> {}
3430
3431impl<'a, C> ProjectDeleteCall<'a, C>
3432where
3433    C: common::Connector,
3434{
3435    /// Perform the operation you have build so far.
3436    pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
3437        use std::borrow::Cow;
3438        use std::io::{Read, Seek};
3439
3440        use common::{url::Params, ToParts};
3441        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
3442
3443        let mut dd = common::DefaultDelegate;
3444        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
3445        dlg.begin(common::MethodInfo {
3446            id: "cloudresourcemanager.projects.delete",
3447            http_method: hyper::Method::DELETE,
3448        });
3449
3450        for &field in ["alt", "projectId"].iter() {
3451            if self._additional_params.contains_key(field) {
3452                dlg.finished(false);
3453                return Err(common::Error::FieldClash(field));
3454            }
3455        }
3456
3457        let mut params = Params::with_capacity(3 + self._additional_params.len());
3458        params.push("projectId", self._project_id);
3459
3460        params.extend(self._additional_params.iter());
3461
3462        params.push("alt", "json");
3463        let mut url = self.hub._base_url.clone() + "v1beta1/projects/{projectId}";
3464        if self._scopes.is_empty() {
3465            self._scopes
3466                .insert(Scope::CloudPlatform.as_ref().to_string());
3467        }
3468
3469        #[allow(clippy::single_element_loop)]
3470        for &(find_this, param_name) in [("{projectId}", "projectId")].iter() {
3471            url = params.uri_replacement(url, param_name, find_this, false);
3472        }
3473        {
3474            let to_remove = ["projectId"];
3475            params.remove_params(&to_remove);
3476        }
3477
3478        let url = params.parse_with_url(&url);
3479
3480        loop {
3481            let token = match self
3482                .hub
3483                .auth
3484                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
3485                .await
3486            {
3487                Ok(token) => token,
3488                Err(e) => match dlg.token(e) {
3489                    Ok(token) => token,
3490                    Err(e) => {
3491                        dlg.finished(false);
3492                        return Err(common::Error::MissingToken(e));
3493                    }
3494                },
3495            };
3496            let mut req_result = {
3497                let client = &self.hub.client;
3498                dlg.pre_request();
3499                let mut req_builder = hyper::Request::builder()
3500                    .method(hyper::Method::DELETE)
3501                    .uri(url.as_str())
3502                    .header(USER_AGENT, self.hub._user_agent.clone());
3503
3504                if let Some(token) = token.as_ref() {
3505                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
3506                }
3507
3508                let request = req_builder
3509                    .header(CONTENT_LENGTH, 0_u64)
3510                    .body(common::to_body::<String>(None));
3511
3512                client.request(request.unwrap()).await
3513            };
3514
3515            match req_result {
3516                Err(err) => {
3517                    if let common::Retry::After(d) = dlg.http_error(&err) {
3518                        sleep(d).await;
3519                        continue;
3520                    }
3521                    dlg.finished(false);
3522                    return Err(common::Error::HttpError(err));
3523                }
3524                Ok(res) => {
3525                    let (mut parts, body) = res.into_parts();
3526                    let mut body = common::Body::new(body);
3527                    if !parts.status.is_success() {
3528                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3529                        let error = serde_json::from_str(&common::to_string(&bytes));
3530                        let response = common::to_response(parts, bytes.into());
3531
3532                        if let common::Retry::After(d) =
3533                            dlg.http_failure(&response, error.as_ref().ok())
3534                        {
3535                            sleep(d).await;
3536                            continue;
3537                        }
3538
3539                        dlg.finished(false);
3540
3541                        return Err(match error {
3542                            Ok(value) => common::Error::BadRequest(value),
3543                            _ => common::Error::Failure(response),
3544                        });
3545                    }
3546                    let response = {
3547                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3548                        let encoded = common::to_string(&bytes);
3549                        match serde_json::from_str(&encoded) {
3550                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
3551                            Err(error) => {
3552                                dlg.response_json_decode_error(&encoded, &error);
3553                                return Err(common::Error::JsonDecodeError(
3554                                    encoded.to_string(),
3555                                    error,
3556                                ));
3557                            }
3558                        }
3559                    };
3560
3561                    dlg.finished(true);
3562                    return Ok(response);
3563                }
3564            }
3565        }
3566    }
3567
3568    /// The Project ID (for example, `foo-bar-123`).
3569    ///
3570    /// Sets the *project id* path property to the given value.
3571    ///
3572    /// Even though the property as already been set when instantiating this call,
3573    /// we provide this method for API completeness.
3574    pub fn project_id(mut self, new_value: &str) -> ProjectDeleteCall<'a, C> {
3575        self._project_id = new_value.to_string();
3576        self
3577    }
3578    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3579    /// while executing the actual API request.
3580    ///
3581    /// ````text
3582    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
3583    /// ````
3584    ///
3585    /// Sets the *delegate* property to the given value.
3586    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> ProjectDeleteCall<'a, C> {
3587        self._delegate = Some(new_value);
3588        self
3589    }
3590
3591    /// Set any additional parameter of the query string used in the request.
3592    /// It should be used to set parameters which are not yet available through their own
3593    /// setters.
3594    ///
3595    /// Please note that this method must not be used to set any of the known parameters
3596    /// which have their own setter method. If done anyway, the request will fail.
3597    ///
3598    /// # Additional Parameters
3599    ///
3600    /// * *$.xgafv* (query-string) - V1 error format.
3601    /// * *access_token* (query-string) - OAuth access token.
3602    /// * *alt* (query-string) - Data format for response.
3603    /// * *callback* (query-string) - JSONP
3604    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
3605    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
3606    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3607    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
3608    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
3609    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
3610    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
3611    pub fn param<T>(mut self, name: T, value: T) -> ProjectDeleteCall<'a, C>
3612    where
3613        T: AsRef<str>,
3614    {
3615        self._additional_params
3616            .insert(name.as_ref().to_string(), value.as_ref().to_string());
3617        self
3618    }
3619
3620    /// Identifies the authorization scope for the method you are building.
3621    ///
3622    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
3623    /// [`Scope::CloudPlatform`].
3624    ///
3625    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
3626    /// tokens for more than one scope.
3627    ///
3628    /// Usually there is more than one suitable scope to authorize an operation, some of which may
3629    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
3630    /// sufficient, a read-write scope will do as well.
3631    pub fn add_scope<St>(mut self, scope: St) -> ProjectDeleteCall<'a, C>
3632    where
3633        St: AsRef<str>,
3634    {
3635        self._scopes.insert(String::from(scope.as_ref()));
3636        self
3637    }
3638    /// Identifies the authorization scope(s) for the method you are building.
3639    ///
3640    /// See [`Self::add_scope()`] for details.
3641    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectDeleteCall<'a, C>
3642    where
3643        I: IntoIterator<Item = St>,
3644        St: AsRef<str>,
3645    {
3646        self._scopes
3647            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
3648        self
3649    }
3650
3651    /// Removes all scopes, and no default scope will be used either.
3652    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
3653    /// for details).
3654    pub fn clear_scopes(mut self) -> ProjectDeleteCall<'a, C> {
3655        self._scopes.clear();
3656        self
3657    }
3658}
3659
3660/// Retrieves the Project identified by the specified `project_id` (for example, `my-project-123`). The caller must have read permissions for this Project.
3661///
3662/// A builder for the *get* method supported by a *project* resource.
3663/// It is not used directly, but through a [`ProjectMethods`] instance.
3664///
3665/// # Example
3666///
3667/// Instantiate a resource method builder
3668///
3669/// ```test_harness,no_run
3670/// # extern crate hyper;
3671/// # extern crate hyper_rustls;
3672/// # extern crate google_cloudresourcemanager1_beta1 as cloudresourcemanager1_beta1;
3673/// # async fn dox() {
3674/// # use cloudresourcemanager1_beta1::{CloudResourceManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3675///
3676/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
3677/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
3678/// #     .with_native_roots()
3679/// #     .unwrap()
3680/// #     .https_only()
3681/// #     .enable_http2()
3682/// #     .build();
3683///
3684/// # let executor = hyper_util::rt::TokioExecutor::new();
3685/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
3686/// #     secret,
3687/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3688/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
3689/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
3690/// #     ),
3691/// # ).build().await.unwrap();
3692///
3693/// # let client = hyper_util::client::legacy::Client::builder(
3694/// #     hyper_util::rt::TokioExecutor::new()
3695/// # )
3696/// # .build(
3697/// #     hyper_rustls::HttpsConnectorBuilder::new()
3698/// #         .with_native_roots()
3699/// #         .unwrap()
3700/// #         .https_or_http()
3701/// #         .enable_http2()
3702/// #         .build()
3703/// # );
3704/// # let mut hub = CloudResourceManager::new(client, auth);
3705/// // You can configure optional parameters by calling the respective setters at will, and
3706/// // execute the final call using `doit()`.
3707/// // Values shown here are possibly random and not representative !
3708/// let result = hub.projects().get("projectId")
3709///              .doit().await;
3710/// # }
3711/// ```
3712pub struct ProjectGetCall<'a, C>
3713where
3714    C: 'a,
3715{
3716    hub: &'a CloudResourceManager<C>,
3717    _project_id: String,
3718    _delegate: Option<&'a mut dyn common::Delegate>,
3719    _additional_params: HashMap<String, String>,
3720    _scopes: BTreeSet<String>,
3721}
3722
3723impl<'a, C> common::CallBuilder for ProjectGetCall<'a, C> {}
3724
3725impl<'a, C> ProjectGetCall<'a, C>
3726where
3727    C: common::Connector,
3728{
3729    /// Perform the operation you have build so far.
3730    pub async fn doit(mut self) -> common::Result<(common::Response, Project)> {
3731        use std::borrow::Cow;
3732        use std::io::{Read, Seek};
3733
3734        use common::{url::Params, ToParts};
3735        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
3736
3737        let mut dd = common::DefaultDelegate;
3738        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
3739        dlg.begin(common::MethodInfo {
3740            id: "cloudresourcemanager.projects.get",
3741            http_method: hyper::Method::GET,
3742        });
3743
3744        for &field in ["alt", "projectId"].iter() {
3745            if self._additional_params.contains_key(field) {
3746                dlg.finished(false);
3747                return Err(common::Error::FieldClash(field));
3748            }
3749        }
3750
3751        let mut params = Params::with_capacity(3 + self._additional_params.len());
3752        params.push("projectId", self._project_id);
3753
3754        params.extend(self._additional_params.iter());
3755
3756        params.push("alt", "json");
3757        let mut url = self.hub._base_url.clone() + "v1beta1/projects/{projectId}";
3758        if self._scopes.is_empty() {
3759            self._scopes
3760                .insert(Scope::CloudPlatformReadOnly.as_ref().to_string());
3761        }
3762
3763        #[allow(clippy::single_element_loop)]
3764        for &(find_this, param_name) in [("{projectId}", "projectId")].iter() {
3765            url = params.uri_replacement(url, param_name, find_this, false);
3766        }
3767        {
3768            let to_remove = ["projectId"];
3769            params.remove_params(&to_remove);
3770        }
3771
3772        let url = params.parse_with_url(&url);
3773
3774        loop {
3775            let token = match self
3776                .hub
3777                .auth
3778                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
3779                .await
3780            {
3781                Ok(token) => token,
3782                Err(e) => match dlg.token(e) {
3783                    Ok(token) => token,
3784                    Err(e) => {
3785                        dlg.finished(false);
3786                        return Err(common::Error::MissingToken(e));
3787                    }
3788                },
3789            };
3790            let mut req_result = {
3791                let client = &self.hub.client;
3792                dlg.pre_request();
3793                let mut req_builder = hyper::Request::builder()
3794                    .method(hyper::Method::GET)
3795                    .uri(url.as_str())
3796                    .header(USER_AGENT, self.hub._user_agent.clone());
3797
3798                if let Some(token) = token.as_ref() {
3799                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
3800                }
3801
3802                let request = req_builder
3803                    .header(CONTENT_LENGTH, 0_u64)
3804                    .body(common::to_body::<String>(None));
3805
3806                client.request(request.unwrap()).await
3807            };
3808
3809            match req_result {
3810                Err(err) => {
3811                    if let common::Retry::After(d) = dlg.http_error(&err) {
3812                        sleep(d).await;
3813                        continue;
3814                    }
3815                    dlg.finished(false);
3816                    return Err(common::Error::HttpError(err));
3817                }
3818                Ok(res) => {
3819                    let (mut parts, body) = res.into_parts();
3820                    let mut body = common::Body::new(body);
3821                    if !parts.status.is_success() {
3822                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3823                        let error = serde_json::from_str(&common::to_string(&bytes));
3824                        let response = common::to_response(parts, bytes.into());
3825
3826                        if let common::Retry::After(d) =
3827                            dlg.http_failure(&response, error.as_ref().ok())
3828                        {
3829                            sleep(d).await;
3830                            continue;
3831                        }
3832
3833                        dlg.finished(false);
3834
3835                        return Err(match error {
3836                            Ok(value) => common::Error::BadRequest(value),
3837                            _ => common::Error::Failure(response),
3838                        });
3839                    }
3840                    let response = {
3841                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3842                        let encoded = common::to_string(&bytes);
3843                        match serde_json::from_str(&encoded) {
3844                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
3845                            Err(error) => {
3846                                dlg.response_json_decode_error(&encoded, &error);
3847                                return Err(common::Error::JsonDecodeError(
3848                                    encoded.to_string(),
3849                                    error,
3850                                ));
3851                            }
3852                        }
3853                    };
3854
3855                    dlg.finished(true);
3856                    return Ok(response);
3857                }
3858            }
3859        }
3860    }
3861
3862    /// Required. The Project ID (for example, `my-project-123`).
3863    ///
3864    /// Sets the *project id* path property to the given value.
3865    ///
3866    /// Even though the property as already been set when instantiating this call,
3867    /// we provide this method for API completeness.
3868    pub fn project_id(mut self, new_value: &str) -> ProjectGetCall<'a, C> {
3869        self._project_id = new_value.to_string();
3870        self
3871    }
3872    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3873    /// while executing the actual API request.
3874    ///
3875    /// ````text
3876    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
3877    /// ````
3878    ///
3879    /// Sets the *delegate* property to the given value.
3880    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> ProjectGetCall<'a, C> {
3881        self._delegate = Some(new_value);
3882        self
3883    }
3884
3885    /// Set any additional parameter of the query string used in the request.
3886    /// It should be used to set parameters which are not yet available through their own
3887    /// setters.
3888    ///
3889    /// Please note that this method must not be used to set any of the known parameters
3890    /// which have their own setter method. If done anyway, the request will fail.
3891    ///
3892    /// # Additional Parameters
3893    ///
3894    /// * *$.xgafv* (query-string) - V1 error format.
3895    /// * *access_token* (query-string) - OAuth access token.
3896    /// * *alt* (query-string) - Data format for response.
3897    /// * *callback* (query-string) - JSONP
3898    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
3899    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
3900    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3901    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
3902    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
3903    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
3904    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
3905    pub fn param<T>(mut self, name: T, value: T) -> ProjectGetCall<'a, C>
3906    where
3907        T: AsRef<str>,
3908    {
3909        self._additional_params
3910            .insert(name.as_ref().to_string(), value.as_ref().to_string());
3911        self
3912    }
3913
3914    /// Identifies the authorization scope for the method you are building.
3915    ///
3916    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
3917    /// [`Scope::CloudPlatformReadOnly`].
3918    ///
3919    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
3920    /// tokens for more than one scope.
3921    ///
3922    /// Usually there is more than one suitable scope to authorize an operation, some of which may
3923    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
3924    /// sufficient, a read-write scope will do as well.
3925    pub fn add_scope<St>(mut self, scope: St) -> ProjectGetCall<'a, C>
3926    where
3927        St: AsRef<str>,
3928    {
3929        self._scopes.insert(String::from(scope.as_ref()));
3930        self
3931    }
3932    /// Identifies the authorization scope(s) for the method you are building.
3933    ///
3934    /// See [`Self::add_scope()`] for details.
3935    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectGetCall<'a, C>
3936    where
3937        I: IntoIterator<Item = St>,
3938        St: AsRef<str>,
3939    {
3940        self._scopes
3941            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
3942        self
3943    }
3944
3945    /// Removes all scopes, and no default scope will be used either.
3946    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
3947    /// for details).
3948    pub fn clear_scopes(mut self) -> ProjectGetCall<'a, C> {
3949        self._scopes.clear();
3950        self
3951    }
3952}
3953
3954/// Gets a list of ancestors in the resource hierarchy for the Project identified by the specified `project_id` (for example, `my-project-123`). The caller must have read permissions for this Project.
3955///
3956/// A builder for the *getAncestry* method supported by a *project* resource.
3957/// It is not used directly, but through a [`ProjectMethods`] instance.
3958///
3959/// # Example
3960///
3961/// Instantiate a resource method builder
3962///
3963/// ```test_harness,no_run
3964/// # extern crate hyper;
3965/// # extern crate hyper_rustls;
3966/// # extern crate google_cloudresourcemanager1_beta1 as cloudresourcemanager1_beta1;
3967/// use cloudresourcemanager1_beta1::api::GetAncestryRequest;
3968/// # async fn dox() {
3969/// # use cloudresourcemanager1_beta1::{CloudResourceManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3970///
3971/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
3972/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
3973/// #     .with_native_roots()
3974/// #     .unwrap()
3975/// #     .https_only()
3976/// #     .enable_http2()
3977/// #     .build();
3978///
3979/// # let executor = hyper_util::rt::TokioExecutor::new();
3980/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
3981/// #     secret,
3982/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3983/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
3984/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
3985/// #     ),
3986/// # ).build().await.unwrap();
3987///
3988/// # let client = hyper_util::client::legacy::Client::builder(
3989/// #     hyper_util::rt::TokioExecutor::new()
3990/// # )
3991/// # .build(
3992/// #     hyper_rustls::HttpsConnectorBuilder::new()
3993/// #         .with_native_roots()
3994/// #         .unwrap()
3995/// #         .https_or_http()
3996/// #         .enable_http2()
3997/// #         .build()
3998/// # );
3999/// # let mut hub = CloudResourceManager::new(client, auth);
4000/// // As the method needs a request, you would usually fill it with the desired information
4001/// // into the respective structure. Some of the parts shown here might not be applicable !
4002/// // Values shown here are possibly random and not representative !
4003/// let mut req = GetAncestryRequest::default();
4004///
4005/// // You can configure optional parameters by calling the respective setters at will, and
4006/// // execute the final call using `doit()`.
4007/// // Values shown here are possibly random and not representative !
4008/// let result = hub.projects().get_ancestry(req, "projectId")
4009///              .doit().await;
4010/// # }
4011/// ```
4012pub struct ProjectGetAncestryCall<'a, C>
4013where
4014    C: 'a,
4015{
4016    hub: &'a CloudResourceManager<C>,
4017    _request: GetAncestryRequest,
4018    _project_id: String,
4019    _delegate: Option<&'a mut dyn common::Delegate>,
4020    _additional_params: HashMap<String, String>,
4021    _scopes: BTreeSet<String>,
4022}
4023
4024impl<'a, C> common::CallBuilder for ProjectGetAncestryCall<'a, C> {}
4025
4026impl<'a, C> ProjectGetAncestryCall<'a, C>
4027where
4028    C: common::Connector,
4029{
4030    /// Perform the operation you have build so far.
4031    pub async fn doit(mut self) -> common::Result<(common::Response, GetAncestryResponse)> {
4032        use std::borrow::Cow;
4033        use std::io::{Read, Seek};
4034
4035        use common::{url::Params, ToParts};
4036        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
4037
4038        let mut dd = common::DefaultDelegate;
4039        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
4040        dlg.begin(common::MethodInfo {
4041            id: "cloudresourcemanager.projects.getAncestry",
4042            http_method: hyper::Method::POST,
4043        });
4044
4045        for &field in ["alt", "projectId"].iter() {
4046            if self._additional_params.contains_key(field) {
4047                dlg.finished(false);
4048                return Err(common::Error::FieldClash(field));
4049            }
4050        }
4051
4052        let mut params = Params::with_capacity(4 + self._additional_params.len());
4053        params.push("projectId", self._project_id);
4054
4055        params.extend(self._additional_params.iter());
4056
4057        params.push("alt", "json");
4058        let mut url = self.hub._base_url.clone() + "v1beta1/projects/{projectId}:getAncestry";
4059        if self._scopes.is_empty() {
4060            self._scopes
4061                .insert(Scope::CloudPlatformReadOnly.as_ref().to_string());
4062        }
4063
4064        #[allow(clippy::single_element_loop)]
4065        for &(find_this, param_name) in [("{projectId}", "projectId")].iter() {
4066            url = params.uri_replacement(url, param_name, find_this, false);
4067        }
4068        {
4069            let to_remove = ["projectId"];
4070            params.remove_params(&to_remove);
4071        }
4072
4073        let url = params.parse_with_url(&url);
4074
4075        let mut json_mime_type = mime::APPLICATION_JSON;
4076        let mut request_value_reader = {
4077            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
4078            common::remove_json_null_values(&mut value);
4079            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
4080            serde_json::to_writer(&mut dst, &value).unwrap();
4081            dst
4082        };
4083        let request_size = request_value_reader
4084            .seek(std::io::SeekFrom::End(0))
4085            .unwrap();
4086        request_value_reader
4087            .seek(std::io::SeekFrom::Start(0))
4088            .unwrap();
4089
4090        loop {
4091            let token = match self
4092                .hub
4093                .auth
4094                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
4095                .await
4096            {
4097                Ok(token) => token,
4098                Err(e) => match dlg.token(e) {
4099                    Ok(token) => token,
4100                    Err(e) => {
4101                        dlg.finished(false);
4102                        return Err(common::Error::MissingToken(e));
4103                    }
4104                },
4105            };
4106            request_value_reader
4107                .seek(std::io::SeekFrom::Start(0))
4108                .unwrap();
4109            let mut req_result = {
4110                let client = &self.hub.client;
4111                dlg.pre_request();
4112                let mut req_builder = hyper::Request::builder()
4113                    .method(hyper::Method::POST)
4114                    .uri(url.as_str())
4115                    .header(USER_AGENT, self.hub._user_agent.clone());
4116
4117                if let Some(token) = token.as_ref() {
4118                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
4119                }
4120
4121                let request = req_builder
4122                    .header(CONTENT_TYPE, json_mime_type.to_string())
4123                    .header(CONTENT_LENGTH, request_size as u64)
4124                    .body(common::to_body(
4125                        request_value_reader.get_ref().clone().into(),
4126                    ));
4127
4128                client.request(request.unwrap()).await
4129            };
4130
4131            match req_result {
4132                Err(err) => {
4133                    if let common::Retry::After(d) = dlg.http_error(&err) {
4134                        sleep(d).await;
4135                        continue;
4136                    }
4137                    dlg.finished(false);
4138                    return Err(common::Error::HttpError(err));
4139                }
4140                Ok(res) => {
4141                    let (mut parts, body) = res.into_parts();
4142                    let mut body = common::Body::new(body);
4143                    if !parts.status.is_success() {
4144                        let bytes = common::to_bytes(body).await.unwrap_or_default();
4145                        let error = serde_json::from_str(&common::to_string(&bytes));
4146                        let response = common::to_response(parts, bytes.into());
4147
4148                        if let common::Retry::After(d) =
4149                            dlg.http_failure(&response, error.as_ref().ok())
4150                        {
4151                            sleep(d).await;
4152                            continue;
4153                        }
4154
4155                        dlg.finished(false);
4156
4157                        return Err(match error {
4158                            Ok(value) => common::Error::BadRequest(value),
4159                            _ => common::Error::Failure(response),
4160                        });
4161                    }
4162                    let response = {
4163                        let bytes = common::to_bytes(body).await.unwrap_or_default();
4164                        let encoded = common::to_string(&bytes);
4165                        match serde_json::from_str(&encoded) {
4166                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4167                            Err(error) => {
4168                                dlg.response_json_decode_error(&encoded, &error);
4169                                return Err(common::Error::JsonDecodeError(
4170                                    encoded.to_string(),
4171                                    error,
4172                                ));
4173                            }
4174                        }
4175                    };
4176
4177                    dlg.finished(true);
4178                    return Ok(response);
4179                }
4180            }
4181        }
4182    }
4183
4184    ///
4185    /// Sets the *request* property to the given value.
4186    ///
4187    /// Even though the property as already been set when instantiating this call,
4188    /// we provide this method for API completeness.
4189    pub fn request(mut self, new_value: GetAncestryRequest) -> ProjectGetAncestryCall<'a, C> {
4190        self._request = new_value;
4191        self
4192    }
4193    /// Required. The Project ID (for example, `my-project-123`).
4194    ///
4195    /// Sets the *project id* path property to the given value.
4196    ///
4197    /// Even though the property as already been set when instantiating this call,
4198    /// we provide this method for API completeness.
4199    pub fn project_id(mut self, new_value: &str) -> ProjectGetAncestryCall<'a, C> {
4200        self._project_id = new_value.to_string();
4201        self
4202    }
4203    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4204    /// while executing the actual API request.
4205    ///
4206    /// ````text
4207    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
4208    /// ````
4209    ///
4210    /// Sets the *delegate* property to the given value.
4211    pub fn delegate(
4212        mut self,
4213        new_value: &'a mut dyn common::Delegate,
4214    ) -> ProjectGetAncestryCall<'a, C> {
4215        self._delegate = Some(new_value);
4216        self
4217    }
4218
4219    /// Set any additional parameter of the query string used in the request.
4220    /// It should be used to set parameters which are not yet available through their own
4221    /// setters.
4222    ///
4223    /// Please note that this method must not be used to set any of the known parameters
4224    /// which have their own setter method. If done anyway, the request will fail.
4225    ///
4226    /// # Additional Parameters
4227    ///
4228    /// * *$.xgafv* (query-string) - V1 error format.
4229    /// * *access_token* (query-string) - OAuth access token.
4230    /// * *alt* (query-string) - Data format for response.
4231    /// * *callback* (query-string) - JSONP
4232    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4233    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
4234    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4235    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4236    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
4237    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4238    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4239    pub fn param<T>(mut self, name: T, value: T) -> ProjectGetAncestryCall<'a, C>
4240    where
4241        T: AsRef<str>,
4242    {
4243        self._additional_params
4244            .insert(name.as_ref().to_string(), value.as_ref().to_string());
4245        self
4246    }
4247
4248    /// Identifies the authorization scope for the method you are building.
4249    ///
4250    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
4251    /// [`Scope::CloudPlatformReadOnly`].
4252    ///
4253    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4254    /// tokens for more than one scope.
4255    ///
4256    /// Usually there is more than one suitable scope to authorize an operation, some of which may
4257    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
4258    /// sufficient, a read-write scope will do as well.
4259    pub fn add_scope<St>(mut self, scope: St) -> ProjectGetAncestryCall<'a, C>
4260    where
4261        St: AsRef<str>,
4262    {
4263        self._scopes.insert(String::from(scope.as_ref()));
4264        self
4265    }
4266    /// Identifies the authorization scope(s) for the method you are building.
4267    ///
4268    /// See [`Self::add_scope()`] for details.
4269    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectGetAncestryCall<'a, C>
4270    where
4271        I: IntoIterator<Item = St>,
4272        St: AsRef<str>,
4273    {
4274        self._scopes
4275            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
4276        self
4277    }
4278
4279    /// Removes all scopes, and no default scope will be used either.
4280    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
4281    /// for details).
4282    pub fn clear_scopes(mut self) -> ProjectGetAncestryCall<'a, C> {
4283        self._scopes.clear();
4284        self
4285    }
4286}
4287
4288/// Returns the IAM access control policy for the specified Project. Permission is denied if the policy or the resource does not exist. For additional information about resource structure and identification, see [Resource Names](https://cloud.google.com/apis/design/resource_names).
4289///
4290/// A builder for the *getIamPolicy* method supported by a *project* resource.
4291/// It is not used directly, but through a [`ProjectMethods`] instance.
4292///
4293/// # Example
4294///
4295/// Instantiate a resource method builder
4296///
4297/// ```test_harness,no_run
4298/// # extern crate hyper;
4299/// # extern crate hyper_rustls;
4300/// # extern crate google_cloudresourcemanager1_beta1 as cloudresourcemanager1_beta1;
4301/// use cloudresourcemanager1_beta1::api::GetIamPolicyRequest;
4302/// # async fn dox() {
4303/// # use cloudresourcemanager1_beta1::{CloudResourceManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4304///
4305/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4306/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
4307/// #     .with_native_roots()
4308/// #     .unwrap()
4309/// #     .https_only()
4310/// #     .enable_http2()
4311/// #     .build();
4312///
4313/// # let executor = hyper_util::rt::TokioExecutor::new();
4314/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
4315/// #     secret,
4316/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4317/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
4318/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
4319/// #     ),
4320/// # ).build().await.unwrap();
4321///
4322/// # let client = hyper_util::client::legacy::Client::builder(
4323/// #     hyper_util::rt::TokioExecutor::new()
4324/// # )
4325/// # .build(
4326/// #     hyper_rustls::HttpsConnectorBuilder::new()
4327/// #         .with_native_roots()
4328/// #         .unwrap()
4329/// #         .https_or_http()
4330/// #         .enable_http2()
4331/// #         .build()
4332/// # );
4333/// # let mut hub = CloudResourceManager::new(client, auth);
4334/// // As the method needs a request, you would usually fill it with the desired information
4335/// // into the respective structure. Some of the parts shown here might not be applicable !
4336/// // Values shown here are possibly random and not representative !
4337/// let mut req = GetIamPolicyRequest::default();
4338///
4339/// // You can configure optional parameters by calling the respective setters at will, and
4340/// // execute the final call using `doit()`.
4341/// // Values shown here are possibly random and not representative !
4342/// let result = hub.projects().get_iam_policy(req, "resource")
4343///              .doit().await;
4344/// # }
4345/// ```
4346pub struct ProjectGetIamPolicyCall<'a, C>
4347where
4348    C: 'a,
4349{
4350    hub: &'a CloudResourceManager<C>,
4351    _request: GetIamPolicyRequest,
4352    _resource: String,
4353    _delegate: Option<&'a mut dyn common::Delegate>,
4354    _additional_params: HashMap<String, String>,
4355    _scopes: BTreeSet<String>,
4356}
4357
4358impl<'a, C> common::CallBuilder for ProjectGetIamPolicyCall<'a, C> {}
4359
4360impl<'a, C> ProjectGetIamPolicyCall<'a, C>
4361where
4362    C: common::Connector,
4363{
4364    /// Perform the operation you have build so far.
4365    pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
4366        use std::borrow::Cow;
4367        use std::io::{Read, Seek};
4368
4369        use common::{url::Params, ToParts};
4370        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
4371
4372        let mut dd = common::DefaultDelegate;
4373        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
4374        dlg.begin(common::MethodInfo {
4375            id: "cloudresourcemanager.projects.getIamPolicy",
4376            http_method: hyper::Method::POST,
4377        });
4378
4379        for &field in ["alt", "resource"].iter() {
4380            if self._additional_params.contains_key(field) {
4381                dlg.finished(false);
4382                return Err(common::Error::FieldClash(field));
4383            }
4384        }
4385
4386        let mut params = Params::with_capacity(4 + self._additional_params.len());
4387        params.push("resource", self._resource);
4388
4389        params.extend(self._additional_params.iter());
4390
4391        params.push("alt", "json");
4392        let mut url = self.hub._base_url.clone() + "v1beta1/projects/{resource}:getIamPolicy";
4393        if self._scopes.is_empty() {
4394            self._scopes
4395                .insert(Scope::CloudPlatformReadOnly.as_ref().to_string());
4396        }
4397
4398        #[allow(clippy::single_element_loop)]
4399        for &(find_this, param_name) in [("{resource}", "resource")].iter() {
4400            url = params.uri_replacement(url, param_name, find_this, false);
4401        }
4402        {
4403            let to_remove = ["resource"];
4404            params.remove_params(&to_remove);
4405        }
4406
4407        let url = params.parse_with_url(&url);
4408
4409        let mut json_mime_type = mime::APPLICATION_JSON;
4410        let mut request_value_reader = {
4411            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
4412            common::remove_json_null_values(&mut value);
4413            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
4414            serde_json::to_writer(&mut dst, &value).unwrap();
4415            dst
4416        };
4417        let request_size = request_value_reader
4418            .seek(std::io::SeekFrom::End(0))
4419            .unwrap();
4420        request_value_reader
4421            .seek(std::io::SeekFrom::Start(0))
4422            .unwrap();
4423
4424        loop {
4425            let token = match self
4426                .hub
4427                .auth
4428                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
4429                .await
4430            {
4431                Ok(token) => token,
4432                Err(e) => match dlg.token(e) {
4433                    Ok(token) => token,
4434                    Err(e) => {
4435                        dlg.finished(false);
4436                        return Err(common::Error::MissingToken(e));
4437                    }
4438                },
4439            };
4440            request_value_reader
4441                .seek(std::io::SeekFrom::Start(0))
4442                .unwrap();
4443            let mut req_result = {
4444                let client = &self.hub.client;
4445                dlg.pre_request();
4446                let mut req_builder = hyper::Request::builder()
4447                    .method(hyper::Method::POST)
4448                    .uri(url.as_str())
4449                    .header(USER_AGENT, self.hub._user_agent.clone());
4450
4451                if let Some(token) = token.as_ref() {
4452                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
4453                }
4454
4455                let request = req_builder
4456                    .header(CONTENT_TYPE, json_mime_type.to_string())
4457                    .header(CONTENT_LENGTH, request_size as u64)
4458                    .body(common::to_body(
4459                        request_value_reader.get_ref().clone().into(),
4460                    ));
4461
4462                client.request(request.unwrap()).await
4463            };
4464
4465            match req_result {
4466                Err(err) => {
4467                    if let common::Retry::After(d) = dlg.http_error(&err) {
4468                        sleep(d).await;
4469                        continue;
4470                    }
4471                    dlg.finished(false);
4472                    return Err(common::Error::HttpError(err));
4473                }
4474                Ok(res) => {
4475                    let (mut parts, body) = res.into_parts();
4476                    let mut body = common::Body::new(body);
4477                    if !parts.status.is_success() {
4478                        let bytes = common::to_bytes(body).await.unwrap_or_default();
4479                        let error = serde_json::from_str(&common::to_string(&bytes));
4480                        let response = common::to_response(parts, bytes.into());
4481
4482                        if let common::Retry::After(d) =
4483                            dlg.http_failure(&response, error.as_ref().ok())
4484                        {
4485                            sleep(d).await;
4486                            continue;
4487                        }
4488
4489                        dlg.finished(false);
4490
4491                        return Err(match error {
4492                            Ok(value) => common::Error::BadRequest(value),
4493                            _ => common::Error::Failure(response),
4494                        });
4495                    }
4496                    let response = {
4497                        let bytes = common::to_bytes(body).await.unwrap_or_default();
4498                        let encoded = common::to_string(&bytes);
4499                        match serde_json::from_str(&encoded) {
4500                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4501                            Err(error) => {
4502                                dlg.response_json_decode_error(&encoded, &error);
4503                                return Err(common::Error::JsonDecodeError(
4504                                    encoded.to_string(),
4505                                    error,
4506                                ));
4507                            }
4508                        }
4509                    };
4510
4511                    dlg.finished(true);
4512                    return Ok(response);
4513                }
4514            }
4515        }
4516    }
4517
4518    ///
4519    /// Sets the *request* property to the given value.
4520    ///
4521    /// Even though the property as already been set when instantiating this call,
4522    /// we provide this method for API completeness.
4523    pub fn request(mut self, new_value: GetIamPolicyRequest) -> ProjectGetIamPolicyCall<'a, C> {
4524        self._request = new_value;
4525        self
4526    }
4527    /// 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.
4528    ///
4529    /// Sets the *resource* path property to the given value.
4530    ///
4531    /// Even though the property as already been set when instantiating this call,
4532    /// we provide this method for API completeness.
4533    pub fn resource(mut self, new_value: &str) -> ProjectGetIamPolicyCall<'a, C> {
4534        self._resource = new_value.to_string();
4535        self
4536    }
4537    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4538    /// while executing the actual API request.
4539    ///
4540    /// ````text
4541    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
4542    /// ````
4543    ///
4544    /// Sets the *delegate* property to the given value.
4545    pub fn delegate(
4546        mut self,
4547        new_value: &'a mut dyn common::Delegate,
4548    ) -> ProjectGetIamPolicyCall<'a, C> {
4549        self._delegate = Some(new_value);
4550        self
4551    }
4552
4553    /// Set any additional parameter of the query string used in the request.
4554    /// It should be used to set parameters which are not yet available through their own
4555    /// setters.
4556    ///
4557    /// Please note that this method must not be used to set any of the known parameters
4558    /// which have their own setter method. If done anyway, the request will fail.
4559    ///
4560    /// # Additional Parameters
4561    ///
4562    /// * *$.xgafv* (query-string) - V1 error format.
4563    /// * *access_token* (query-string) - OAuth access token.
4564    /// * *alt* (query-string) - Data format for response.
4565    /// * *callback* (query-string) - JSONP
4566    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4567    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
4568    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4569    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4570    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
4571    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4572    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4573    pub fn param<T>(mut self, name: T, value: T) -> ProjectGetIamPolicyCall<'a, C>
4574    where
4575        T: AsRef<str>,
4576    {
4577        self._additional_params
4578            .insert(name.as_ref().to_string(), value.as_ref().to_string());
4579        self
4580    }
4581
4582    /// Identifies the authorization scope for the method you are building.
4583    ///
4584    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
4585    /// [`Scope::CloudPlatformReadOnly`].
4586    ///
4587    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4588    /// tokens for more than one scope.
4589    ///
4590    /// Usually there is more than one suitable scope to authorize an operation, some of which may
4591    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
4592    /// sufficient, a read-write scope will do as well.
4593    pub fn add_scope<St>(mut self, scope: St) -> ProjectGetIamPolicyCall<'a, C>
4594    where
4595        St: AsRef<str>,
4596    {
4597        self._scopes.insert(String::from(scope.as_ref()));
4598        self
4599    }
4600    /// Identifies the authorization scope(s) for the method you are building.
4601    ///
4602    /// See [`Self::add_scope()`] for details.
4603    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectGetIamPolicyCall<'a, C>
4604    where
4605        I: IntoIterator<Item = St>,
4606        St: AsRef<str>,
4607    {
4608        self._scopes
4609            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
4610        self
4611    }
4612
4613    /// Removes all scopes, and no default scope will be used either.
4614    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
4615    /// for details).
4616    pub fn clear_scopes(mut self) -> ProjectGetIamPolicyCall<'a, C> {
4617        self._scopes.clear();
4618        self
4619    }
4620}
4621
4622/// Lists Projects that the caller has the `resourcemanager.projects.get` permission on and satisfy the specified filter. This method returns Projects in an unspecified order. This method is eventually consistent with project mutations; this means that a newly created project may not appear in the results or recent updates to an existing project may not be reflected in the results. To retrieve the latest state of a project, use the GetProject method. NOTE: If the request filter contains a `parent.type` and `parent.id` and the caller has the `resourcemanager.projects.list` permission on the parent, the results will be drawn from an alternate index which provides more consistent results. In future versions of this API, this List method will be split into List and Search to properly capture the behavioral difference.
4623///
4624/// A builder for the *list* method supported by a *project* resource.
4625/// It is not used directly, but through a [`ProjectMethods`] instance.
4626///
4627/// # Example
4628///
4629/// Instantiate a resource method builder
4630///
4631/// ```test_harness,no_run
4632/// # extern crate hyper;
4633/// # extern crate hyper_rustls;
4634/// # extern crate google_cloudresourcemanager1_beta1 as cloudresourcemanager1_beta1;
4635/// # async fn dox() {
4636/// # use cloudresourcemanager1_beta1::{CloudResourceManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4637///
4638/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4639/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
4640/// #     .with_native_roots()
4641/// #     .unwrap()
4642/// #     .https_only()
4643/// #     .enable_http2()
4644/// #     .build();
4645///
4646/// # let executor = hyper_util::rt::TokioExecutor::new();
4647/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
4648/// #     secret,
4649/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4650/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
4651/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
4652/// #     ),
4653/// # ).build().await.unwrap();
4654///
4655/// # let client = hyper_util::client::legacy::Client::builder(
4656/// #     hyper_util::rt::TokioExecutor::new()
4657/// # )
4658/// # .build(
4659/// #     hyper_rustls::HttpsConnectorBuilder::new()
4660/// #         .with_native_roots()
4661/// #         .unwrap()
4662/// #         .https_or_http()
4663/// #         .enable_http2()
4664/// #         .build()
4665/// # );
4666/// # let mut hub = CloudResourceManager::new(client, auth);
4667/// // You can configure optional parameters by calling the respective setters at will, and
4668/// // execute the final call using `doit()`.
4669/// // Values shown here are possibly random and not representative !
4670/// let result = hub.projects().list()
4671///              .page_token("sed")
4672///              .page_size(-37)
4673///              .filter("gubergren")
4674///              .doit().await;
4675/// # }
4676/// ```
4677pub struct ProjectListCall<'a, C>
4678where
4679    C: 'a,
4680{
4681    hub: &'a CloudResourceManager<C>,
4682    _page_token: Option<String>,
4683    _page_size: Option<i32>,
4684    _filter: Option<String>,
4685    _delegate: Option<&'a mut dyn common::Delegate>,
4686    _additional_params: HashMap<String, String>,
4687    _scopes: BTreeSet<String>,
4688}
4689
4690impl<'a, C> common::CallBuilder for ProjectListCall<'a, C> {}
4691
4692impl<'a, C> ProjectListCall<'a, C>
4693where
4694    C: common::Connector,
4695{
4696    /// Perform the operation you have build so far.
4697    pub async fn doit(mut self) -> common::Result<(common::Response, ListProjectsResponse)> {
4698        use std::borrow::Cow;
4699        use std::io::{Read, Seek};
4700
4701        use common::{url::Params, ToParts};
4702        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
4703
4704        let mut dd = common::DefaultDelegate;
4705        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
4706        dlg.begin(common::MethodInfo {
4707            id: "cloudresourcemanager.projects.list",
4708            http_method: hyper::Method::GET,
4709        });
4710
4711        for &field in ["alt", "pageToken", "pageSize", "filter"].iter() {
4712            if self._additional_params.contains_key(field) {
4713                dlg.finished(false);
4714                return Err(common::Error::FieldClash(field));
4715            }
4716        }
4717
4718        let mut params = Params::with_capacity(5 + self._additional_params.len());
4719        if let Some(value) = self._page_token.as_ref() {
4720            params.push("pageToken", value);
4721        }
4722        if let Some(value) = self._page_size.as_ref() {
4723            params.push("pageSize", value.to_string());
4724        }
4725        if let Some(value) = self._filter.as_ref() {
4726            params.push("filter", value);
4727        }
4728
4729        params.extend(self._additional_params.iter());
4730
4731        params.push("alt", "json");
4732        let mut url = self.hub._base_url.clone() + "v1beta1/projects";
4733        if self._scopes.is_empty() {
4734            self._scopes
4735                .insert(Scope::CloudPlatformReadOnly.as_ref().to_string());
4736        }
4737
4738        let url = params.parse_with_url(&url);
4739
4740        loop {
4741            let token = match self
4742                .hub
4743                .auth
4744                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
4745                .await
4746            {
4747                Ok(token) => token,
4748                Err(e) => match dlg.token(e) {
4749                    Ok(token) => token,
4750                    Err(e) => {
4751                        dlg.finished(false);
4752                        return Err(common::Error::MissingToken(e));
4753                    }
4754                },
4755            };
4756            let mut req_result = {
4757                let client = &self.hub.client;
4758                dlg.pre_request();
4759                let mut req_builder = hyper::Request::builder()
4760                    .method(hyper::Method::GET)
4761                    .uri(url.as_str())
4762                    .header(USER_AGENT, self.hub._user_agent.clone());
4763
4764                if let Some(token) = token.as_ref() {
4765                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
4766                }
4767
4768                let request = req_builder
4769                    .header(CONTENT_LENGTH, 0_u64)
4770                    .body(common::to_body::<String>(None));
4771
4772                client.request(request.unwrap()).await
4773            };
4774
4775            match req_result {
4776                Err(err) => {
4777                    if let common::Retry::After(d) = dlg.http_error(&err) {
4778                        sleep(d).await;
4779                        continue;
4780                    }
4781                    dlg.finished(false);
4782                    return Err(common::Error::HttpError(err));
4783                }
4784                Ok(res) => {
4785                    let (mut parts, body) = res.into_parts();
4786                    let mut body = common::Body::new(body);
4787                    if !parts.status.is_success() {
4788                        let bytes = common::to_bytes(body).await.unwrap_or_default();
4789                        let error = serde_json::from_str(&common::to_string(&bytes));
4790                        let response = common::to_response(parts, bytes.into());
4791
4792                        if let common::Retry::After(d) =
4793                            dlg.http_failure(&response, error.as_ref().ok())
4794                        {
4795                            sleep(d).await;
4796                            continue;
4797                        }
4798
4799                        dlg.finished(false);
4800
4801                        return Err(match error {
4802                            Ok(value) => common::Error::BadRequest(value),
4803                            _ => common::Error::Failure(response),
4804                        });
4805                    }
4806                    let response = {
4807                        let bytes = common::to_bytes(body).await.unwrap_or_default();
4808                        let encoded = common::to_string(&bytes);
4809                        match serde_json::from_str(&encoded) {
4810                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4811                            Err(error) => {
4812                                dlg.response_json_decode_error(&encoded, &error);
4813                                return Err(common::Error::JsonDecodeError(
4814                                    encoded.to_string(),
4815                                    error,
4816                                ));
4817                            }
4818                        }
4819                    };
4820
4821                    dlg.finished(true);
4822                    return Ok(response);
4823                }
4824            }
4825        }
4826    }
4827
4828    /// A pagination token returned from a previous call to ListProjects that indicates from where listing should continue. Optional.
4829    ///
4830    /// Sets the *page token* query property to the given value.
4831    pub fn page_token(mut self, new_value: &str) -> ProjectListCall<'a, C> {
4832        self._page_token = Some(new_value.to_string());
4833        self
4834    }
4835    /// The maximum number of Projects to return in the response. The server can return fewer Projects than requested. If unspecified, server picks an appropriate default. Optional.
4836    ///
4837    /// Sets the *page size* query property to the given value.
4838    pub fn page_size(mut self, new_value: i32) -> ProjectListCall<'a, C> {
4839        self._page_size = Some(new_value);
4840        self
4841    }
4842    /// An expression for filtering the results of the request. Filter rules are case insensitive. If multiple fields are included in a filter query, the query will return results that match any of the fields. Some eligible fields for filtering are: + `name` + `id` + `labels.` (where *key* is the name of a label) + `parent.type` + `parent.id` Some examples of using labels as filters: | Filter | Description | |------------------|-----------------------------------------------------| | name:how* | The project's name starts with "how". | | name:Howl | The project's name is `Howl` or `howl`. | | name:HOWL | Equivalent to above. | | NAME:howl | Equivalent to above. | | labels.color:* | The project has the label `color`. | | labels.color:red | The project's label `color` has the value `red`. | | labels.color:red labels.size:big | The project's label `color` has the value `red` or its label `size` has the value `big`. | If no filter is specified, the call will return projects for which the user has the `resourcemanager.projects.get` permission. NOTE: To perform a by-parent query (eg., what projects are directly in a Folder), the caller must have the `resourcemanager.projects.list` permission on the parent and the filter must contain both a `parent.type` and a `parent.id` restriction (example: "parent.type:folder parent.id:123"). In this case an alternate search index is used which provides more consistent results. Optional.
4843    ///
4844    /// Sets the *filter* query property to the given value.
4845    pub fn filter(mut self, new_value: &str) -> ProjectListCall<'a, C> {
4846        self._filter = Some(new_value.to_string());
4847        self
4848    }
4849    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4850    /// while executing the actual API request.
4851    ///
4852    /// ````text
4853    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
4854    /// ````
4855    ///
4856    /// Sets the *delegate* property to the given value.
4857    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> ProjectListCall<'a, C> {
4858        self._delegate = Some(new_value);
4859        self
4860    }
4861
4862    /// Set any additional parameter of the query string used in the request.
4863    /// It should be used to set parameters which are not yet available through their own
4864    /// setters.
4865    ///
4866    /// Please note that this method must not be used to set any of the known parameters
4867    /// which have their own setter method. If done anyway, the request will fail.
4868    ///
4869    /// # Additional Parameters
4870    ///
4871    /// * *$.xgafv* (query-string) - V1 error format.
4872    /// * *access_token* (query-string) - OAuth access token.
4873    /// * *alt* (query-string) - Data format for response.
4874    /// * *callback* (query-string) - JSONP
4875    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4876    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
4877    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4878    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4879    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
4880    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4881    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4882    pub fn param<T>(mut self, name: T, value: T) -> ProjectListCall<'a, C>
4883    where
4884        T: AsRef<str>,
4885    {
4886        self._additional_params
4887            .insert(name.as_ref().to_string(), value.as_ref().to_string());
4888        self
4889    }
4890
4891    /// Identifies the authorization scope for the method you are building.
4892    ///
4893    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
4894    /// [`Scope::CloudPlatformReadOnly`].
4895    ///
4896    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4897    /// tokens for more than one scope.
4898    ///
4899    /// Usually there is more than one suitable scope to authorize an operation, some of which may
4900    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
4901    /// sufficient, a read-write scope will do as well.
4902    pub fn add_scope<St>(mut self, scope: St) -> ProjectListCall<'a, C>
4903    where
4904        St: AsRef<str>,
4905    {
4906        self._scopes.insert(String::from(scope.as_ref()));
4907        self
4908    }
4909    /// Identifies the authorization scope(s) for the method you are building.
4910    ///
4911    /// See [`Self::add_scope()`] for details.
4912    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectListCall<'a, C>
4913    where
4914        I: IntoIterator<Item = St>,
4915        St: AsRef<str>,
4916    {
4917        self._scopes
4918            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
4919        self
4920    }
4921
4922    /// Removes all scopes, and no default scope will be used either.
4923    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
4924    /// for details).
4925    pub fn clear_scopes(mut self) -> ProjectListCall<'a, C> {
4926        self._scopes.clear();
4927        self
4928    }
4929}
4930
4931/// Sets the IAM access control policy for the specified Project. CAUTION: This method will replace the existing policy, and cannot be used to append additional IAM settings. NOTE: Removing service accounts from policies or changing their roles can render services completely inoperable. It is important to understand how the service account is being used before removing or updating its roles. The following constraints apply when using `setIamPolicy()`: + Project does not support `allUsers` and `allAuthenticatedUsers` as `members` in a `Binding` of a `Policy`. + The owner role can be granted to a `user`, `serviceAccount`, or a group that is part of an organization. For example, group@myownpersonaldomain.com could be added as an owner to a project in the myownpersonaldomain.com organization, but not the examplepetstore.com organization. + Service accounts can be made owners of a project directly without any restrictions. However, to be added as an owner, a user must be invited via Cloud Platform console and must accept the invitation. + A user cannot be granted the owner role using `setIamPolicy()`. The user must be granted the owner role using the Cloud Platform Console and must explicitly accept the invitation. + Invitations to grant the owner role cannot be sent using `setIamPolicy()`; they must be sent only using the Cloud Platform Console. + Membership changes that leave the project without any owners that have accepted the Terms of Service (ToS) will be rejected. + If the project is not part of an organization, there must be at least one owner who has accepted the Terms of Service (ToS) agreement in the policy. Calling `setIamPolicy()` to remove the last ToS-accepted owner from the policy will fail. This restriction also applies to legacy projects that no longer have owners who have accepted the ToS. Edits to IAM policies will be rejected until the lack of a ToS-accepting owner is rectified. Authorization requires the Google IAM permission `resourcemanager.projects.setIamPolicy` on the project
4932///
4933/// A builder for the *setIamPolicy* method supported by a *project* resource.
4934/// It is not used directly, but through a [`ProjectMethods`] instance.
4935///
4936/// # Example
4937///
4938/// Instantiate a resource method builder
4939///
4940/// ```test_harness,no_run
4941/// # extern crate hyper;
4942/// # extern crate hyper_rustls;
4943/// # extern crate google_cloudresourcemanager1_beta1 as cloudresourcemanager1_beta1;
4944/// use cloudresourcemanager1_beta1::api::SetIamPolicyRequest;
4945/// # async fn dox() {
4946/// # use cloudresourcemanager1_beta1::{CloudResourceManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4947///
4948/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4949/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
4950/// #     .with_native_roots()
4951/// #     .unwrap()
4952/// #     .https_only()
4953/// #     .enable_http2()
4954/// #     .build();
4955///
4956/// # let executor = hyper_util::rt::TokioExecutor::new();
4957/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
4958/// #     secret,
4959/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4960/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
4961/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
4962/// #     ),
4963/// # ).build().await.unwrap();
4964///
4965/// # let client = hyper_util::client::legacy::Client::builder(
4966/// #     hyper_util::rt::TokioExecutor::new()
4967/// # )
4968/// # .build(
4969/// #     hyper_rustls::HttpsConnectorBuilder::new()
4970/// #         .with_native_roots()
4971/// #         .unwrap()
4972/// #         .https_or_http()
4973/// #         .enable_http2()
4974/// #         .build()
4975/// # );
4976/// # let mut hub = CloudResourceManager::new(client, auth);
4977/// // As the method needs a request, you would usually fill it with the desired information
4978/// // into the respective structure. Some of the parts shown here might not be applicable !
4979/// // Values shown here are possibly random and not representative !
4980/// let mut req = SetIamPolicyRequest::default();
4981///
4982/// // You can configure optional parameters by calling the respective setters at will, and
4983/// // execute the final call using `doit()`.
4984/// // Values shown here are possibly random and not representative !
4985/// let result = hub.projects().set_iam_policy(req, "resource")
4986///              .doit().await;
4987/// # }
4988/// ```
4989pub struct ProjectSetIamPolicyCall<'a, C>
4990where
4991    C: 'a,
4992{
4993    hub: &'a CloudResourceManager<C>,
4994    _request: SetIamPolicyRequest,
4995    _resource: String,
4996    _delegate: Option<&'a mut dyn common::Delegate>,
4997    _additional_params: HashMap<String, String>,
4998    _scopes: BTreeSet<String>,
4999}
5000
5001impl<'a, C> common::CallBuilder for ProjectSetIamPolicyCall<'a, C> {}
5002
5003impl<'a, C> ProjectSetIamPolicyCall<'a, C>
5004where
5005    C: common::Connector,
5006{
5007    /// Perform the operation you have build so far.
5008    pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
5009        use std::borrow::Cow;
5010        use std::io::{Read, Seek};
5011
5012        use common::{url::Params, ToParts};
5013        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5014
5015        let mut dd = common::DefaultDelegate;
5016        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5017        dlg.begin(common::MethodInfo {
5018            id: "cloudresourcemanager.projects.setIamPolicy",
5019            http_method: hyper::Method::POST,
5020        });
5021
5022        for &field in ["alt", "resource"].iter() {
5023            if self._additional_params.contains_key(field) {
5024                dlg.finished(false);
5025                return Err(common::Error::FieldClash(field));
5026            }
5027        }
5028
5029        let mut params = Params::with_capacity(4 + self._additional_params.len());
5030        params.push("resource", self._resource);
5031
5032        params.extend(self._additional_params.iter());
5033
5034        params.push("alt", "json");
5035        let mut url = self.hub._base_url.clone() + "v1beta1/projects/{resource}:setIamPolicy";
5036        if self._scopes.is_empty() {
5037            self._scopes
5038                .insert(Scope::CloudPlatform.as_ref().to_string());
5039        }
5040
5041        #[allow(clippy::single_element_loop)]
5042        for &(find_this, param_name) in [("{resource}", "resource")].iter() {
5043            url = params.uri_replacement(url, param_name, find_this, false);
5044        }
5045        {
5046            let to_remove = ["resource"];
5047            params.remove_params(&to_remove);
5048        }
5049
5050        let url = params.parse_with_url(&url);
5051
5052        let mut json_mime_type = mime::APPLICATION_JSON;
5053        let mut request_value_reader = {
5054            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
5055            common::remove_json_null_values(&mut value);
5056            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
5057            serde_json::to_writer(&mut dst, &value).unwrap();
5058            dst
5059        };
5060        let request_size = request_value_reader
5061            .seek(std::io::SeekFrom::End(0))
5062            .unwrap();
5063        request_value_reader
5064            .seek(std::io::SeekFrom::Start(0))
5065            .unwrap();
5066
5067        loop {
5068            let token = match self
5069                .hub
5070                .auth
5071                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5072                .await
5073            {
5074                Ok(token) => token,
5075                Err(e) => match dlg.token(e) {
5076                    Ok(token) => token,
5077                    Err(e) => {
5078                        dlg.finished(false);
5079                        return Err(common::Error::MissingToken(e));
5080                    }
5081                },
5082            };
5083            request_value_reader
5084                .seek(std::io::SeekFrom::Start(0))
5085                .unwrap();
5086            let mut req_result = {
5087                let client = &self.hub.client;
5088                dlg.pre_request();
5089                let mut req_builder = hyper::Request::builder()
5090                    .method(hyper::Method::POST)
5091                    .uri(url.as_str())
5092                    .header(USER_AGENT, self.hub._user_agent.clone());
5093
5094                if let Some(token) = token.as_ref() {
5095                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5096                }
5097
5098                let request = req_builder
5099                    .header(CONTENT_TYPE, json_mime_type.to_string())
5100                    .header(CONTENT_LENGTH, request_size as u64)
5101                    .body(common::to_body(
5102                        request_value_reader.get_ref().clone().into(),
5103                    ));
5104
5105                client.request(request.unwrap()).await
5106            };
5107
5108            match req_result {
5109                Err(err) => {
5110                    if let common::Retry::After(d) = dlg.http_error(&err) {
5111                        sleep(d).await;
5112                        continue;
5113                    }
5114                    dlg.finished(false);
5115                    return Err(common::Error::HttpError(err));
5116                }
5117                Ok(res) => {
5118                    let (mut parts, body) = res.into_parts();
5119                    let mut body = common::Body::new(body);
5120                    if !parts.status.is_success() {
5121                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5122                        let error = serde_json::from_str(&common::to_string(&bytes));
5123                        let response = common::to_response(parts, bytes.into());
5124
5125                        if let common::Retry::After(d) =
5126                            dlg.http_failure(&response, error.as_ref().ok())
5127                        {
5128                            sleep(d).await;
5129                            continue;
5130                        }
5131
5132                        dlg.finished(false);
5133
5134                        return Err(match error {
5135                            Ok(value) => common::Error::BadRequest(value),
5136                            _ => common::Error::Failure(response),
5137                        });
5138                    }
5139                    let response = {
5140                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5141                        let encoded = common::to_string(&bytes);
5142                        match serde_json::from_str(&encoded) {
5143                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5144                            Err(error) => {
5145                                dlg.response_json_decode_error(&encoded, &error);
5146                                return Err(common::Error::JsonDecodeError(
5147                                    encoded.to_string(),
5148                                    error,
5149                                ));
5150                            }
5151                        }
5152                    };
5153
5154                    dlg.finished(true);
5155                    return Ok(response);
5156                }
5157            }
5158        }
5159    }
5160
5161    ///
5162    /// Sets the *request* property to the given value.
5163    ///
5164    /// Even though the property as already been set when instantiating this call,
5165    /// we provide this method for API completeness.
5166    pub fn request(mut self, new_value: SetIamPolicyRequest) -> ProjectSetIamPolicyCall<'a, C> {
5167        self._request = new_value;
5168        self
5169    }
5170    /// 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.
5171    ///
5172    /// Sets the *resource* path property to the given value.
5173    ///
5174    /// Even though the property as already been set when instantiating this call,
5175    /// we provide this method for API completeness.
5176    pub fn resource(mut self, new_value: &str) -> ProjectSetIamPolicyCall<'a, C> {
5177        self._resource = new_value.to_string();
5178        self
5179    }
5180    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5181    /// while executing the actual API request.
5182    ///
5183    /// ````text
5184    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
5185    /// ````
5186    ///
5187    /// Sets the *delegate* property to the given value.
5188    pub fn delegate(
5189        mut self,
5190        new_value: &'a mut dyn common::Delegate,
5191    ) -> ProjectSetIamPolicyCall<'a, C> {
5192        self._delegate = Some(new_value);
5193        self
5194    }
5195
5196    /// Set any additional parameter of the query string used in the request.
5197    /// It should be used to set parameters which are not yet available through their own
5198    /// setters.
5199    ///
5200    /// Please note that this method must not be used to set any of the known parameters
5201    /// which have their own setter method. If done anyway, the request will fail.
5202    ///
5203    /// # Additional Parameters
5204    ///
5205    /// * *$.xgafv* (query-string) - V1 error format.
5206    /// * *access_token* (query-string) - OAuth access token.
5207    /// * *alt* (query-string) - Data format for response.
5208    /// * *callback* (query-string) - JSONP
5209    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5210    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
5211    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5212    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5213    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
5214    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5215    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5216    pub fn param<T>(mut self, name: T, value: T) -> ProjectSetIamPolicyCall<'a, C>
5217    where
5218        T: AsRef<str>,
5219    {
5220        self._additional_params
5221            .insert(name.as_ref().to_string(), value.as_ref().to_string());
5222        self
5223    }
5224
5225    /// Identifies the authorization scope for the method you are building.
5226    ///
5227    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5228    /// [`Scope::CloudPlatform`].
5229    ///
5230    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5231    /// tokens for more than one scope.
5232    ///
5233    /// Usually there is more than one suitable scope to authorize an operation, some of which may
5234    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5235    /// sufficient, a read-write scope will do as well.
5236    pub fn add_scope<St>(mut self, scope: St) -> ProjectSetIamPolicyCall<'a, C>
5237    where
5238        St: AsRef<str>,
5239    {
5240        self._scopes.insert(String::from(scope.as_ref()));
5241        self
5242    }
5243    /// Identifies the authorization scope(s) for the method you are building.
5244    ///
5245    /// See [`Self::add_scope()`] for details.
5246    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectSetIamPolicyCall<'a, C>
5247    where
5248        I: IntoIterator<Item = St>,
5249        St: AsRef<str>,
5250    {
5251        self._scopes
5252            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5253        self
5254    }
5255
5256    /// Removes all scopes, and no default scope will be used either.
5257    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5258    /// for details).
5259    pub fn clear_scopes(mut self) -> ProjectSetIamPolicyCall<'a, C> {
5260        self._scopes.clear();
5261        self
5262    }
5263}
5264
5265/// Returns permissions that a caller has on the specified Project.
5266///
5267/// A builder for the *testIamPermissions* method supported by a *project* resource.
5268/// It is not used directly, but through a [`ProjectMethods`] instance.
5269///
5270/// # Example
5271///
5272/// Instantiate a resource method builder
5273///
5274/// ```test_harness,no_run
5275/// # extern crate hyper;
5276/// # extern crate hyper_rustls;
5277/// # extern crate google_cloudresourcemanager1_beta1 as cloudresourcemanager1_beta1;
5278/// use cloudresourcemanager1_beta1::api::TestIamPermissionsRequest;
5279/// # async fn dox() {
5280/// # use cloudresourcemanager1_beta1::{CloudResourceManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5281///
5282/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5283/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
5284/// #     .with_native_roots()
5285/// #     .unwrap()
5286/// #     .https_only()
5287/// #     .enable_http2()
5288/// #     .build();
5289///
5290/// # let executor = hyper_util::rt::TokioExecutor::new();
5291/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
5292/// #     secret,
5293/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5294/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
5295/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
5296/// #     ),
5297/// # ).build().await.unwrap();
5298///
5299/// # let client = hyper_util::client::legacy::Client::builder(
5300/// #     hyper_util::rt::TokioExecutor::new()
5301/// # )
5302/// # .build(
5303/// #     hyper_rustls::HttpsConnectorBuilder::new()
5304/// #         .with_native_roots()
5305/// #         .unwrap()
5306/// #         .https_or_http()
5307/// #         .enable_http2()
5308/// #         .build()
5309/// # );
5310/// # let mut hub = CloudResourceManager::new(client, auth);
5311/// // As the method needs a request, you would usually fill it with the desired information
5312/// // into the respective structure. Some of the parts shown here might not be applicable !
5313/// // Values shown here are possibly random and not representative !
5314/// let mut req = TestIamPermissionsRequest::default();
5315///
5316/// // You can configure optional parameters by calling the respective setters at will, and
5317/// // execute the final call using `doit()`.
5318/// // Values shown here are possibly random and not representative !
5319/// let result = hub.projects().test_iam_permissions(req, "resource")
5320///              .doit().await;
5321/// # }
5322/// ```
5323pub struct ProjectTestIamPermissionCall<'a, C>
5324where
5325    C: 'a,
5326{
5327    hub: &'a CloudResourceManager<C>,
5328    _request: TestIamPermissionsRequest,
5329    _resource: String,
5330    _delegate: Option<&'a mut dyn common::Delegate>,
5331    _additional_params: HashMap<String, String>,
5332    _scopes: BTreeSet<String>,
5333}
5334
5335impl<'a, C> common::CallBuilder for ProjectTestIamPermissionCall<'a, C> {}
5336
5337impl<'a, C> ProjectTestIamPermissionCall<'a, C>
5338where
5339    C: common::Connector,
5340{
5341    /// Perform the operation you have build so far.
5342    pub async fn doit(mut self) -> common::Result<(common::Response, TestIamPermissionsResponse)> {
5343        use std::borrow::Cow;
5344        use std::io::{Read, Seek};
5345
5346        use common::{url::Params, ToParts};
5347        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5348
5349        let mut dd = common::DefaultDelegate;
5350        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5351        dlg.begin(common::MethodInfo {
5352            id: "cloudresourcemanager.projects.testIamPermissions",
5353            http_method: hyper::Method::POST,
5354        });
5355
5356        for &field in ["alt", "resource"].iter() {
5357            if self._additional_params.contains_key(field) {
5358                dlg.finished(false);
5359                return Err(common::Error::FieldClash(field));
5360            }
5361        }
5362
5363        let mut params = Params::with_capacity(4 + self._additional_params.len());
5364        params.push("resource", self._resource);
5365
5366        params.extend(self._additional_params.iter());
5367
5368        params.push("alt", "json");
5369        let mut url = self.hub._base_url.clone() + "v1beta1/projects/{resource}:testIamPermissions";
5370        if self._scopes.is_empty() {
5371            self._scopes
5372                .insert(Scope::CloudPlatformReadOnly.as_ref().to_string());
5373        }
5374
5375        #[allow(clippy::single_element_loop)]
5376        for &(find_this, param_name) in [("{resource}", "resource")].iter() {
5377            url = params.uri_replacement(url, param_name, find_this, false);
5378        }
5379        {
5380            let to_remove = ["resource"];
5381            params.remove_params(&to_remove);
5382        }
5383
5384        let url = params.parse_with_url(&url);
5385
5386        let mut json_mime_type = mime::APPLICATION_JSON;
5387        let mut request_value_reader = {
5388            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
5389            common::remove_json_null_values(&mut value);
5390            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
5391            serde_json::to_writer(&mut dst, &value).unwrap();
5392            dst
5393        };
5394        let request_size = request_value_reader
5395            .seek(std::io::SeekFrom::End(0))
5396            .unwrap();
5397        request_value_reader
5398            .seek(std::io::SeekFrom::Start(0))
5399            .unwrap();
5400
5401        loop {
5402            let token = match self
5403                .hub
5404                .auth
5405                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5406                .await
5407            {
5408                Ok(token) => token,
5409                Err(e) => match dlg.token(e) {
5410                    Ok(token) => token,
5411                    Err(e) => {
5412                        dlg.finished(false);
5413                        return Err(common::Error::MissingToken(e));
5414                    }
5415                },
5416            };
5417            request_value_reader
5418                .seek(std::io::SeekFrom::Start(0))
5419                .unwrap();
5420            let mut req_result = {
5421                let client = &self.hub.client;
5422                dlg.pre_request();
5423                let mut req_builder = hyper::Request::builder()
5424                    .method(hyper::Method::POST)
5425                    .uri(url.as_str())
5426                    .header(USER_AGENT, self.hub._user_agent.clone());
5427
5428                if let Some(token) = token.as_ref() {
5429                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5430                }
5431
5432                let request = req_builder
5433                    .header(CONTENT_TYPE, json_mime_type.to_string())
5434                    .header(CONTENT_LENGTH, request_size as u64)
5435                    .body(common::to_body(
5436                        request_value_reader.get_ref().clone().into(),
5437                    ));
5438
5439                client.request(request.unwrap()).await
5440            };
5441
5442            match req_result {
5443                Err(err) => {
5444                    if let common::Retry::After(d) = dlg.http_error(&err) {
5445                        sleep(d).await;
5446                        continue;
5447                    }
5448                    dlg.finished(false);
5449                    return Err(common::Error::HttpError(err));
5450                }
5451                Ok(res) => {
5452                    let (mut parts, body) = res.into_parts();
5453                    let mut body = common::Body::new(body);
5454                    if !parts.status.is_success() {
5455                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5456                        let error = serde_json::from_str(&common::to_string(&bytes));
5457                        let response = common::to_response(parts, bytes.into());
5458
5459                        if let common::Retry::After(d) =
5460                            dlg.http_failure(&response, error.as_ref().ok())
5461                        {
5462                            sleep(d).await;
5463                            continue;
5464                        }
5465
5466                        dlg.finished(false);
5467
5468                        return Err(match error {
5469                            Ok(value) => common::Error::BadRequest(value),
5470                            _ => common::Error::Failure(response),
5471                        });
5472                    }
5473                    let response = {
5474                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5475                        let encoded = common::to_string(&bytes);
5476                        match serde_json::from_str(&encoded) {
5477                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5478                            Err(error) => {
5479                                dlg.response_json_decode_error(&encoded, &error);
5480                                return Err(common::Error::JsonDecodeError(
5481                                    encoded.to_string(),
5482                                    error,
5483                                ));
5484                            }
5485                        }
5486                    };
5487
5488                    dlg.finished(true);
5489                    return Ok(response);
5490                }
5491            }
5492        }
5493    }
5494
5495    ///
5496    /// Sets the *request* property to the given value.
5497    ///
5498    /// Even though the property as already been set when instantiating this call,
5499    /// we provide this method for API completeness.
5500    pub fn request(
5501        mut self,
5502        new_value: TestIamPermissionsRequest,
5503    ) -> ProjectTestIamPermissionCall<'a, C> {
5504        self._request = new_value;
5505        self
5506    }
5507    /// 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.
5508    ///
5509    /// Sets the *resource* path property to the given value.
5510    ///
5511    /// Even though the property as already been set when instantiating this call,
5512    /// we provide this method for API completeness.
5513    pub fn resource(mut self, new_value: &str) -> ProjectTestIamPermissionCall<'a, C> {
5514        self._resource = new_value.to_string();
5515        self
5516    }
5517    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5518    /// while executing the actual API request.
5519    ///
5520    /// ````text
5521    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
5522    /// ````
5523    ///
5524    /// Sets the *delegate* property to the given value.
5525    pub fn delegate(
5526        mut self,
5527        new_value: &'a mut dyn common::Delegate,
5528    ) -> ProjectTestIamPermissionCall<'a, C> {
5529        self._delegate = Some(new_value);
5530        self
5531    }
5532
5533    /// Set any additional parameter of the query string used in the request.
5534    /// It should be used to set parameters which are not yet available through their own
5535    /// setters.
5536    ///
5537    /// Please note that this method must not be used to set any of the known parameters
5538    /// which have their own setter method. If done anyway, the request will fail.
5539    ///
5540    /// # Additional Parameters
5541    ///
5542    /// * *$.xgafv* (query-string) - V1 error format.
5543    /// * *access_token* (query-string) - OAuth access token.
5544    /// * *alt* (query-string) - Data format for response.
5545    /// * *callback* (query-string) - JSONP
5546    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5547    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
5548    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5549    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5550    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
5551    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5552    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5553    pub fn param<T>(mut self, name: T, value: T) -> ProjectTestIamPermissionCall<'a, C>
5554    where
5555        T: AsRef<str>,
5556    {
5557        self._additional_params
5558            .insert(name.as_ref().to_string(), value.as_ref().to_string());
5559        self
5560    }
5561
5562    /// Identifies the authorization scope for the method you are building.
5563    ///
5564    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5565    /// [`Scope::CloudPlatformReadOnly`].
5566    ///
5567    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5568    /// tokens for more than one scope.
5569    ///
5570    /// Usually there is more than one suitable scope to authorize an operation, some of which may
5571    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5572    /// sufficient, a read-write scope will do as well.
5573    pub fn add_scope<St>(mut self, scope: St) -> ProjectTestIamPermissionCall<'a, C>
5574    where
5575        St: AsRef<str>,
5576    {
5577        self._scopes.insert(String::from(scope.as_ref()));
5578        self
5579    }
5580    /// Identifies the authorization scope(s) for the method you are building.
5581    ///
5582    /// See [`Self::add_scope()`] for details.
5583    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectTestIamPermissionCall<'a, C>
5584    where
5585        I: IntoIterator<Item = St>,
5586        St: AsRef<str>,
5587    {
5588        self._scopes
5589            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5590        self
5591    }
5592
5593    /// Removes all scopes, and no default scope will be used either.
5594    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5595    /// for details).
5596    pub fn clear_scopes(mut self) -> ProjectTestIamPermissionCall<'a, C> {
5597        self._scopes.clear();
5598        self
5599    }
5600}
5601
5602/// Restores the Project identified by the specified `project_id` (for example, `my-project-123`). You can only use this method for a Project that has a lifecycle state of DELETE_REQUESTED. After deletion starts, the Project cannot be restored. The caller must have undelete permissions for this Project.
5603///
5604/// A builder for the *undelete* method supported by a *project* resource.
5605/// It is not used directly, but through a [`ProjectMethods`] instance.
5606///
5607/// # Example
5608///
5609/// Instantiate a resource method builder
5610///
5611/// ```test_harness,no_run
5612/// # extern crate hyper;
5613/// # extern crate hyper_rustls;
5614/// # extern crate google_cloudresourcemanager1_beta1 as cloudresourcemanager1_beta1;
5615/// use cloudresourcemanager1_beta1::api::UndeleteProjectRequest;
5616/// # async fn dox() {
5617/// # use cloudresourcemanager1_beta1::{CloudResourceManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5618///
5619/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5620/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
5621/// #     .with_native_roots()
5622/// #     .unwrap()
5623/// #     .https_only()
5624/// #     .enable_http2()
5625/// #     .build();
5626///
5627/// # let executor = hyper_util::rt::TokioExecutor::new();
5628/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
5629/// #     secret,
5630/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5631/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
5632/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
5633/// #     ),
5634/// # ).build().await.unwrap();
5635///
5636/// # let client = hyper_util::client::legacy::Client::builder(
5637/// #     hyper_util::rt::TokioExecutor::new()
5638/// # )
5639/// # .build(
5640/// #     hyper_rustls::HttpsConnectorBuilder::new()
5641/// #         .with_native_roots()
5642/// #         .unwrap()
5643/// #         .https_or_http()
5644/// #         .enable_http2()
5645/// #         .build()
5646/// # );
5647/// # let mut hub = CloudResourceManager::new(client, auth);
5648/// // As the method needs a request, you would usually fill it with the desired information
5649/// // into the respective structure. Some of the parts shown here might not be applicable !
5650/// // Values shown here are possibly random and not representative !
5651/// let mut req = UndeleteProjectRequest::default();
5652///
5653/// // You can configure optional parameters by calling the respective setters at will, and
5654/// // execute the final call using `doit()`.
5655/// // Values shown here are possibly random and not representative !
5656/// let result = hub.projects().undelete(req, "projectId")
5657///              .doit().await;
5658/// # }
5659/// ```
5660pub struct ProjectUndeleteCall<'a, C>
5661where
5662    C: 'a,
5663{
5664    hub: &'a CloudResourceManager<C>,
5665    _request: UndeleteProjectRequest,
5666    _project_id: String,
5667    _delegate: Option<&'a mut dyn common::Delegate>,
5668    _additional_params: HashMap<String, String>,
5669    _scopes: BTreeSet<String>,
5670}
5671
5672impl<'a, C> common::CallBuilder for ProjectUndeleteCall<'a, C> {}
5673
5674impl<'a, C> ProjectUndeleteCall<'a, C>
5675where
5676    C: common::Connector,
5677{
5678    /// Perform the operation you have build so far.
5679    pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
5680        use std::borrow::Cow;
5681        use std::io::{Read, Seek};
5682
5683        use common::{url::Params, ToParts};
5684        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5685
5686        let mut dd = common::DefaultDelegate;
5687        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5688        dlg.begin(common::MethodInfo {
5689            id: "cloudresourcemanager.projects.undelete",
5690            http_method: hyper::Method::POST,
5691        });
5692
5693        for &field in ["alt", "projectId"].iter() {
5694            if self._additional_params.contains_key(field) {
5695                dlg.finished(false);
5696                return Err(common::Error::FieldClash(field));
5697            }
5698        }
5699
5700        let mut params = Params::with_capacity(4 + self._additional_params.len());
5701        params.push("projectId", self._project_id);
5702
5703        params.extend(self._additional_params.iter());
5704
5705        params.push("alt", "json");
5706        let mut url = self.hub._base_url.clone() + "v1beta1/projects/{projectId}:undelete";
5707        if self._scopes.is_empty() {
5708            self._scopes
5709                .insert(Scope::CloudPlatform.as_ref().to_string());
5710        }
5711
5712        #[allow(clippy::single_element_loop)]
5713        for &(find_this, param_name) in [("{projectId}", "projectId")].iter() {
5714            url = params.uri_replacement(url, param_name, find_this, false);
5715        }
5716        {
5717            let to_remove = ["projectId"];
5718            params.remove_params(&to_remove);
5719        }
5720
5721        let url = params.parse_with_url(&url);
5722
5723        let mut json_mime_type = mime::APPLICATION_JSON;
5724        let mut request_value_reader = {
5725            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
5726            common::remove_json_null_values(&mut value);
5727            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
5728            serde_json::to_writer(&mut dst, &value).unwrap();
5729            dst
5730        };
5731        let request_size = request_value_reader
5732            .seek(std::io::SeekFrom::End(0))
5733            .unwrap();
5734        request_value_reader
5735            .seek(std::io::SeekFrom::Start(0))
5736            .unwrap();
5737
5738        loop {
5739            let token = match self
5740                .hub
5741                .auth
5742                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5743                .await
5744            {
5745                Ok(token) => token,
5746                Err(e) => match dlg.token(e) {
5747                    Ok(token) => token,
5748                    Err(e) => {
5749                        dlg.finished(false);
5750                        return Err(common::Error::MissingToken(e));
5751                    }
5752                },
5753            };
5754            request_value_reader
5755                .seek(std::io::SeekFrom::Start(0))
5756                .unwrap();
5757            let mut req_result = {
5758                let client = &self.hub.client;
5759                dlg.pre_request();
5760                let mut req_builder = hyper::Request::builder()
5761                    .method(hyper::Method::POST)
5762                    .uri(url.as_str())
5763                    .header(USER_AGENT, self.hub._user_agent.clone());
5764
5765                if let Some(token) = token.as_ref() {
5766                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5767                }
5768
5769                let request = req_builder
5770                    .header(CONTENT_TYPE, json_mime_type.to_string())
5771                    .header(CONTENT_LENGTH, request_size as u64)
5772                    .body(common::to_body(
5773                        request_value_reader.get_ref().clone().into(),
5774                    ));
5775
5776                client.request(request.unwrap()).await
5777            };
5778
5779            match req_result {
5780                Err(err) => {
5781                    if let common::Retry::After(d) = dlg.http_error(&err) {
5782                        sleep(d).await;
5783                        continue;
5784                    }
5785                    dlg.finished(false);
5786                    return Err(common::Error::HttpError(err));
5787                }
5788                Ok(res) => {
5789                    let (mut parts, body) = res.into_parts();
5790                    let mut body = common::Body::new(body);
5791                    if !parts.status.is_success() {
5792                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5793                        let error = serde_json::from_str(&common::to_string(&bytes));
5794                        let response = common::to_response(parts, bytes.into());
5795
5796                        if let common::Retry::After(d) =
5797                            dlg.http_failure(&response, error.as_ref().ok())
5798                        {
5799                            sleep(d).await;
5800                            continue;
5801                        }
5802
5803                        dlg.finished(false);
5804
5805                        return Err(match error {
5806                            Ok(value) => common::Error::BadRequest(value),
5807                            _ => common::Error::Failure(response),
5808                        });
5809                    }
5810                    let response = {
5811                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5812                        let encoded = common::to_string(&bytes);
5813                        match serde_json::from_str(&encoded) {
5814                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5815                            Err(error) => {
5816                                dlg.response_json_decode_error(&encoded, &error);
5817                                return Err(common::Error::JsonDecodeError(
5818                                    encoded.to_string(),
5819                                    error,
5820                                ));
5821                            }
5822                        }
5823                    };
5824
5825                    dlg.finished(true);
5826                    return Ok(response);
5827                }
5828            }
5829        }
5830    }
5831
5832    ///
5833    /// Sets the *request* property to the given value.
5834    ///
5835    /// Even though the property as already been set when instantiating this call,
5836    /// we provide this method for API completeness.
5837    pub fn request(mut self, new_value: UndeleteProjectRequest) -> ProjectUndeleteCall<'a, C> {
5838        self._request = new_value;
5839        self
5840    }
5841    /// Required. The project ID (for example, `foo-bar-123`).
5842    ///
5843    /// Sets the *project id* path property to the given value.
5844    ///
5845    /// Even though the property as already been set when instantiating this call,
5846    /// we provide this method for API completeness.
5847    pub fn project_id(mut self, new_value: &str) -> ProjectUndeleteCall<'a, C> {
5848        self._project_id = new_value.to_string();
5849        self
5850    }
5851    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5852    /// while executing the actual API request.
5853    ///
5854    /// ````text
5855    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
5856    /// ````
5857    ///
5858    /// Sets the *delegate* property to the given value.
5859    pub fn delegate(
5860        mut self,
5861        new_value: &'a mut dyn common::Delegate,
5862    ) -> ProjectUndeleteCall<'a, C> {
5863        self._delegate = Some(new_value);
5864        self
5865    }
5866
5867    /// Set any additional parameter of the query string used in the request.
5868    /// It should be used to set parameters which are not yet available through their own
5869    /// setters.
5870    ///
5871    /// Please note that this method must not be used to set any of the known parameters
5872    /// which have their own setter method. If done anyway, the request will fail.
5873    ///
5874    /// # Additional Parameters
5875    ///
5876    /// * *$.xgafv* (query-string) - V1 error format.
5877    /// * *access_token* (query-string) - OAuth access token.
5878    /// * *alt* (query-string) - Data format for response.
5879    /// * *callback* (query-string) - JSONP
5880    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5881    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
5882    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5883    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5884    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
5885    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5886    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5887    pub fn param<T>(mut self, name: T, value: T) -> ProjectUndeleteCall<'a, C>
5888    where
5889        T: AsRef<str>,
5890    {
5891        self._additional_params
5892            .insert(name.as_ref().to_string(), value.as_ref().to_string());
5893        self
5894    }
5895
5896    /// Identifies the authorization scope for the method you are building.
5897    ///
5898    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5899    /// [`Scope::CloudPlatform`].
5900    ///
5901    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5902    /// tokens for more than one scope.
5903    ///
5904    /// Usually there is more than one suitable scope to authorize an operation, some of which may
5905    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5906    /// sufficient, a read-write scope will do as well.
5907    pub fn add_scope<St>(mut self, scope: St) -> ProjectUndeleteCall<'a, C>
5908    where
5909        St: AsRef<str>,
5910    {
5911        self._scopes.insert(String::from(scope.as_ref()));
5912        self
5913    }
5914    /// Identifies the authorization scope(s) for the method you are building.
5915    ///
5916    /// See [`Self::add_scope()`] for details.
5917    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectUndeleteCall<'a, C>
5918    where
5919        I: IntoIterator<Item = St>,
5920        St: AsRef<str>,
5921    {
5922        self._scopes
5923            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5924        self
5925    }
5926
5927    /// Removes all scopes, and no default scope will be used either.
5928    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5929    /// for details).
5930    pub fn clear_scopes(mut self) -> ProjectUndeleteCall<'a, C> {
5931        self._scopes.clear();
5932        self
5933    }
5934}
5935
5936/// Updates the attributes of the Project identified by the specified `project_id` (for example, `my-project-123`). The caller must have modify permissions for this Project.
5937///
5938/// A builder for the *update* method supported by a *project* resource.
5939/// It is not used directly, but through a [`ProjectMethods`] instance.
5940///
5941/// # Example
5942///
5943/// Instantiate a resource method builder
5944///
5945/// ```test_harness,no_run
5946/// # extern crate hyper;
5947/// # extern crate hyper_rustls;
5948/// # extern crate google_cloudresourcemanager1_beta1 as cloudresourcemanager1_beta1;
5949/// use cloudresourcemanager1_beta1::api::Project;
5950/// # async fn dox() {
5951/// # use cloudresourcemanager1_beta1::{CloudResourceManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5952///
5953/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5954/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
5955/// #     .with_native_roots()
5956/// #     .unwrap()
5957/// #     .https_only()
5958/// #     .enable_http2()
5959/// #     .build();
5960///
5961/// # let executor = hyper_util::rt::TokioExecutor::new();
5962/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
5963/// #     secret,
5964/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5965/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
5966/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
5967/// #     ),
5968/// # ).build().await.unwrap();
5969///
5970/// # let client = hyper_util::client::legacy::Client::builder(
5971/// #     hyper_util::rt::TokioExecutor::new()
5972/// # )
5973/// # .build(
5974/// #     hyper_rustls::HttpsConnectorBuilder::new()
5975/// #         .with_native_roots()
5976/// #         .unwrap()
5977/// #         .https_or_http()
5978/// #         .enable_http2()
5979/// #         .build()
5980/// # );
5981/// # let mut hub = CloudResourceManager::new(client, auth);
5982/// // As the method needs a request, you would usually fill it with the desired information
5983/// // into the respective structure. Some of the parts shown here might not be applicable !
5984/// // Values shown here are possibly random and not representative !
5985/// let mut req = Project::default();
5986///
5987/// // You can configure optional parameters by calling the respective setters at will, and
5988/// // execute the final call using `doit()`.
5989/// // Values shown here are possibly random and not representative !
5990/// let result = hub.projects().update(req, "projectId")
5991///              .doit().await;
5992/// # }
5993/// ```
5994pub struct ProjectUpdateCall<'a, C>
5995where
5996    C: 'a,
5997{
5998    hub: &'a CloudResourceManager<C>,
5999    _request: Project,
6000    _project_id: String,
6001    _delegate: Option<&'a mut dyn common::Delegate>,
6002    _additional_params: HashMap<String, String>,
6003    _scopes: BTreeSet<String>,
6004}
6005
6006impl<'a, C> common::CallBuilder for ProjectUpdateCall<'a, C> {}
6007
6008impl<'a, C> ProjectUpdateCall<'a, C>
6009where
6010    C: common::Connector,
6011{
6012    /// Perform the operation you have build so far.
6013    pub async fn doit(mut self) -> common::Result<(common::Response, Project)> {
6014        use std::borrow::Cow;
6015        use std::io::{Read, Seek};
6016
6017        use common::{url::Params, ToParts};
6018        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6019
6020        let mut dd = common::DefaultDelegate;
6021        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6022        dlg.begin(common::MethodInfo {
6023            id: "cloudresourcemanager.projects.update",
6024            http_method: hyper::Method::PUT,
6025        });
6026
6027        for &field in ["alt", "projectId"].iter() {
6028            if self._additional_params.contains_key(field) {
6029                dlg.finished(false);
6030                return Err(common::Error::FieldClash(field));
6031            }
6032        }
6033
6034        let mut params = Params::with_capacity(4 + self._additional_params.len());
6035        params.push("projectId", self._project_id);
6036
6037        params.extend(self._additional_params.iter());
6038
6039        params.push("alt", "json");
6040        let mut url = self.hub._base_url.clone() + "v1beta1/projects/{projectId}";
6041        if self._scopes.is_empty() {
6042            self._scopes
6043                .insert(Scope::CloudPlatform.as_ref().to_string());
6044        }
6045
6046        #[allow(clippy::single_element_loop)]
6047        for &(find_this, param_name) in [("{projectId}", "projectId")].iter() {
6048            url = params.uri_replacement(url, param_name, find_this, false);
6049        }
6050        {
6051            let to_remove = ["projectId"];
6052            params.remove_params(&to_remove);
6053        }
6054
6055        let url = params.parse_with_url(&url);
6056
6057        let mut json_mime_type = mime::APPLICATION_JSON;
6058        let mut request_value_reader = {
6059            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
6060            common::remove_json_null_values(&mut value);
6061            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
6062            serde_json::to_writer(&mut dst, &value).unwrap();
6063            dst
6064        };
6065        let request_size = request_value_reader
6066            .seek(std::io::SeekFrom::End(0))
6067            .unwrap();
6068        request_value_reader
6069            .seek(std::io::SeekFrom::Start(0))
6070            .unwrap();
6071
6072        loop {
6073            let token = match self
6074                .hub
6075                .auth
6076                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6077                .await
6078            {
6079                Ok(token) => token,
6080                Err(e) => match dlg.token(e) {
6081                    Ok(token) => token,
6082                    Err(e) => {
6083                        dlg.finished(false);
6084                        return Err(common::Error::MissingToken(e));
6085                    }
6086                },
6087            };
6088            request_value_reader
6089                .seek(std::io::SeekFrom::Start(0))
6090                .unwrap();
6091            let mut req_result = {
6092                let client = &self.hub.client;
6093                dlg.pre_request();
6094                let mut req_builder = hyper::Request::builder()
6095                    .method(hyper::Method::PUT)
6096                    .uri(url.as_str())
6097                    .header(USER_AGENT, self.hub._user_agent.clone());
6098
6099                if let Some(token) = token.as_ref() {
6100                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6101                }
6102
6103                let request = req_builder
6104                    .header(CONTENT_TYPE, json_mime_type.to_string())
6105                    .header(CONTENT_LENGTH, request_size as u64)
6106                    .body(common::to_body(
6107                        request_value_reader.get_ref().clone().into(),
6108                    ));
6109
6110                client.request(request.unwrap()).await
6111            };
6112
6113            match req_result {
6114                Err(err) => {
6115                    if let common::Retry::After(d) = dlg.http_error(&err) {
6116                        sleep(d).await;
6117                        continue;
6118                    }
6119                    dlg.finished(false);
6120                    return Err(common::Error::HttpError(err));
6121                }
6122                Ok(res) => {
6123                    let (mut parts, body) = res.into_parts();
6124                    let mut body = common::Body::new(body);
6125                    if !parts.status.is_success() {
6126                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6127                        let error = serde_json::from_str(&common::to_string(&bytes));
6128                        let response = common::to_response(parts, bytes.into());
6129
6130                        if let common::Retry::After(d) =
6131                            dlg.http_failure(&response, error.as_ref().ok())
6132                        {
6133                            sleep(d).await;
6134                            continue;
6135                        }
6136
6137                        dlg.finished(false);
6138
6139                        return Err(match error {
6140                            Ok(value) => common::Error::BadRequest(value),
6141                            _ => common::Error::Failure(response),
6142                        });
6143                    }
6144                    let response = {
6145                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6146                        let encoded = common::to_string(&bytes);
6147                        match serde_json::from_str(&encoded) {
6148                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6149                            Err(error) => {
6150                                dlg.response_json_decode_error(&encoded, &error);
6151                                return Err(common::Error::JsonDecodeError(
6152                                    encoded.to_string(),
6153                                    error,
6154                                ));
6155                            }
6156                        }
6157                    };
6158
6159                    dlg.finished(true);
6160                    return Ok(response);
6161                }
6162            }
6163        }
6164    }
6165
6166    ///
6167    /// Sets the *request* property to the given value.
6168    ///
6169    /// Even though the property as already been set when instantiating this call,
6170    /// we provide this method for API completeness.
6171    pub fn request(mut self, new_value: Project) -> ProjectUpdateCall<'a, C> {
6172        self._request = new_value;
6173        self
6174    }
6175    /// The project ID (for example, `my-project-123`).
6176    ///
6177    /// Sets the *project id* path property to the given value.
6178    ///
6179    /// Even though the property as already been set when instantiating this call,
6180    /// we provide this method for API completeness.
6181    pub fn project_id(mut self, new_value: &str) -> ProjectUpdateCall<'a, C> {
6182        self._project_id = new_value.to_string();
6183        self
6184    }
6185    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6186    /// while executing the actual API request.
6187    ///
6188    /// ````text
6189    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
6190    /// ````
6191    ///
6192    /// Sets the *delegate* property to the given value.
6193    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> ProjectUpdateCall<'a, C> {
6194        self._delegate = Some(new_value);
6195        self
6196    }
6197
6198    /// Set any additional parameter of the query string used in the request.
6199    /// It should be used to set parameters which are not yet available through their own
6200    /// setters.
6201    ///
6202    /// Please note that this method must not be used to set any of the known parameters
6203    /// which have their own setter method. If done anyway, the request will fail.
6204    ///
6205    /// # Additional Parameters
6206    ///
6207    /// * *$.xgafv* (query-string) - V1 error format.
6208    /// * *access_token* (query-string) - OAuth access token.
6209    /// * *alt* (query-string) - Data format for response.
6210    /// * *callback* (query-string) - JSONP
6211    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6212    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
6213    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6214    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6215    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
6216    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6217    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6218    pub fn param<T>(mut self, name: T, value: T) -> ProjectUpdateCall<'a, C>
6219    where
6220        T: AsRef<str>,
6221    {
6222        self._additional_params
6223            .insert(name.as_ref().to_string(), value.as_ref().to_string());
6224        self
6225    }
6226
6227    /// Identifies the authorization scope for the method you are building.
6228    ///
6229    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6230    /// [`Scope::CloudPlatform`].
6231    ///
6232    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6233    /// tokens for more than one scope.
6234    ///
6235    /// Usually there is more than one suitable scope to authorize an operation, some of which may
6236    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6237    /// sufficient, a read-write scope will do as well.
6238    pub fn add_scope<St>(mut self, scope: St) -> ProjectUpdateCall<'a, C>
6239    where
6240        St: AsRef<str>,
6241    {
6242        self._scopes.insert(String::from(scope.as_ref()));
6243        self
6244    }
6245    /// Identifies the authorization scope(s) for the method you are building.
6246    ///
6247    /// See [`Self::add_scope()`] for details.
6248    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectUpdateCall<'a, C>
6249    where
6250        I: IntoIterator<Item = St>,
6251        St: AsRef<str>,
6252    {
6253        self._scopes
6254            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6255        self
6256    }
6257
6258    /// Removes all scopes, and no default scope will be used either.
6259    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6260    /// for details).
6261    pub fn clear_scopes(mut self) -> ProjectUpdateCall<'a, C> {
6262        self._scopes.clear();
6263        self
6264    }
6265}